|
|
function onDropDownKeyDown(e){var t=$(this),n=t.parent(),r=jQuery.Event("keydown.before.bs.dropdown"),i=jQuery.Event("keydown.after.bs.dropdown");n.trigger(r),n.hasClass("no-stop-propagate")?(arguments.length>1&&arguments[1]instanceof KeyboardEvent&&(e=arguments[1]),/^(38|40|27|13|9|37|39)$/.test(e.keyCode)&&!e.ctrlKey&&!e.altKey&&(patchDropDownKeyDownAdditional.call(this,e),/(37|39)/.test(e.keyCode)||(e.preventDefault(),e.stopPropagation()))):(patchDropDownKeyDown.call(this,e),e.preventDefault(),e.stopPropagation()),n.trigger(i)}function patchDropDownKeyDown(e){if(!/(38|40|27|37|39)/.test(e.keyCode))return;var t=$(this);e.preventDefault(),e.stopPropagation();if(t.is(".disabled, :disabled"))return;var n=getParent(t),r=n.hasClass("open")||n.hasClass("over");if(!r||r&&e.keyCode==27){if(e.which==27){i=$("[role=menu] li.dropdown-submenu.over:visible",n);if(i.size())return i.eq(i.size()-1).removeClass("over"),!1;n.hasClass("dropdown-submenu")&&n.hasClass("over")?(n.removeClass("over"),n.find("> a").focus()):n.find("[data-toggle=dropdown]").focus()}return r?t.click():undefined}var i=$("> [role=menu] > li:not(.divider):not(.disabled):visible",n).find("> a");if(!i.length)return;var s=i.index(i.filter(":focus"));if(e.keyCode==39){if(s<0)return;var o=i.eq(s).parent();o.hasClass("dropdown-submenu")&&!o.hasClass("over")&&(o.mouseenter(),o.addClass("focused-submenu"),_.delay(function(){var e=$("> [role=menu]",o),t=e.find("> li:not(.divider):not(.disabled):visible > a"),n=0;if(e.find("> .menu-scroll").length>0){var r=e.scrollTop();for(var i=0;i<t.length;i++)if(t[i].offsetTop>r){n=i;break}}t.length>0&&t.eq(n).focus()},250))}else e.keyCode==37?n.hasClass("dropdown-submenu")&&n.hasClass("over")&&(n.removeClass("over"),n.find("> a").focus()):(e.keyCode==38?s>0?s--:t.hasClass("no-cyclic")?s=0:s=i.length-1:e.keyCode==40&&(s<i.length-1?s++:t.hasClass("no-cyclic")?s=i.length-1:s=0),~s||(s=0),n.hasClass("dropdown-submenu")&&n.hasClass("over")&&n.addClass("focused-submenu"),i.eq(s).focus())}function patchDropDownKeyDownAdditional(e){if(!/(38|40|27|37|39)/.test(e.keyCode))return;var t=$(this);/(37|39)/.test(e.keyCode)||(e.preventDefault(),e.stopPropagation());if(t.is(".disabled, :disabled"))return;var n=getParent(t),r=n.hasClass("open")||n.hasClass("over");if(!r||r&&(e.keyCode==27||e.keyCode==37||e.keyCode==39))return r?t.click():undefined;var i=$("> [role=menu] > li:not(.divider):not(.disabled):visible",n).find("> a");if(!i.length)return;var s=i.index(i.filter(".focus"));e.keyCode==38?s>0?s--:t.hasClass("no-cyclic")?s=0:s=i.length-1:e.keyCode==40&&(s<i.length-1?s++:t.hasClass("no-cyclic")?s=i.length-1:s=0),~s||(s=0),i.removeClass("focus"),i.eq(s).addClass("focus")}function getParent(e){var t=e.attr("data-target");t||(t=e.attr("href"),t=t&&/#/.test(t)&&t.replace(/.*(?=#[^\s]*$)/,""));var n=t&&$(t);return n&&n.length?n:e.parent()}function clearMenus(e){$(".dropdown-toggle").each(function(t){var n=$(this).parent();if(!n.hasClass("open"))return;n.trigger(t=$.Event("hide.bs.dropdown"));if(t.isDefaultPrevented())return;n.removeClass("open").trigger("hidden.bs.dropdown",e)})}(function(){var e=this,t=e._,n={},r=Array.prototype,i=Object.prototype,s=Function.prototype,o=r.push,u=r.slice,a=r.concat,f=i.toString,l=i.hasOwnProperty,c=r.forEach,h=r.map,p=r.reduce,d=r.reduceRight,v=r.filter,m=r.every,g=r.some,y=r.indexOf,b=r.lastIndexOf,w=Array.isArray,E=Object.keys,S=s.bind,x=function(e){if(e instanceof x)return e;if(!(this instanceof x))return new x(e);this._wrapped=e};typeof exports!="undefined"?(typeof module!="undefined"&&module.exports&&(exports=module.exports=x),exports._=x):e._=x,x.VERSION="1.5.2";var T=x.each=x.forEach=function(e,t,r){if(e==null)return;if(c&&e.forEach===c)e.forEach(t,r);else if(e.length===+e.length){for(var i=0,s=e.length;i<s;i++)if(t.call(r,e[i],i,e)===n)return}else{var o=x.keys(e);for(var i=0,s=o.length;i<s;i++)if(t.call(r,e[o[i]],o[i],e)===n)return}};x.map=x.collect=function(e,t,n){var r=[];return e==null?r:h&&e.map===h?e.map(t,n):(T(e,function(e,i,s){r.push(t.call(n,e,i,s))}),r)};var N="Reduce of empty array with no initial value";x.reduce=x.foldl=x.inject=function(e,t,n,r){var i=arguments.length>2;e==null&&(e=[]);if(p&&e.reduce===p)return r&&(t=x.bind(t,r)),i?e.reduce(t,n):e.reduce(t);T(e,function(e,s,o){i?n=t.call(r,n,e,s,o):(n=e,i=!0)});if(!i)throw new TypeError(N);return n},x.reduceRight=x.foldr=function(e,t,n,r){var i=arguments.length>2;e==null&&(e=[]);if(d&&e.reduceRight===d)return r&&(t=x.bind(t,r)),i?e.reduceRight(t,n):e.reduceRight(t);var s=e.length;if(s!==+s){var o=x.keys(e);s=o.length}T(e,function(u,a,f){a=o?o[--s]:--s,i?n=t.call(r,n,e[a],a,f):(n=e[a],i=!0)});if(!i)throw new TypeError(N);return n},x.find=x.detect=function(e,t,n){var r;return C(e,function(e,i,s){if(t.call(n,e,i,s))return r=e,!0}),r},x.filter=x.select=function(e,t,n){var r=[];return e==null?r:v&&e.filter===v?e.filter(t,n):(T(e,function(e,i,s){t.call(n,e,i,s)&&r.push(e)}),r)},x.reject=function(e,t,n){return x.filter(e,function(e,r,i){return!t.call(n,e,r,i)},n)},x.every=x.all=function(e,t,r){t||(t=x.identity);var i=!0;return e==null?i:m&&e.every===m?e.every(t,r):(T(e,function(e,s,o){if(!(i=i&&t.call(r,e,s,o)))return n}),!!i)};var C=x.some=x.any=function(e,t,r){t||(t=x.identity);var i=!1;return e==null?i:g&&e.some===g?e.some(t,r):(T(e,function(e,s,o){if(i||(i=t.call(r,e,s,o)))return n}),!!i)};x.contains=x.include=function(e,t){return e==null?!1:y&&e.indexOf===y?e.indexOf(t)!=-1:C(e,function(e){return e===t})},x.invoke=function(e,t){var n=u.call(arguments,2),r=x.isFunction(t);return x.map(e,function(e){return(r?t:e[t]).apply(e,n)})},x.pluck=function(e,t){return x.map(e,function(e){return e[t]})},x.where=function(e,t,n){return x.isEmpty(t)?n?void 0:[]:x[n?"find":"filter"](e,function(e){for(var n in t)if(t[n]!==e[n])return!1;return!0})},x.findWhere=function(e,t){return x.where(e,t,!0)},x.max=function(e,t,n){if(!t&&x.isArray(e)&&e[0]===+e[0]&&e.length<65535)return Math.max.apply(Math,e);if(!t&&x.isEmpty(e))return-Infinity;var r={computed:-Infinity,value:-Infinity};return T(e,function(e,i,s){var o=t?t.call(n,e,i,s):e;o>r.computed&&(r={value:e,computed:o})}),r.value},x.min=function(e,t,n){if(!t&&x.isArray(e)&&e[0]===+e[0]&&e.length<65535)return Math.min.apply(Math,e);if(!t&&x.isEmpty(e))return Infinity;var r={computed:Infinity,value:Infinity};return T(e,function(e,i,s){var o=t?t.call(n,e,i,s):e;o<r.computed&&(r={value:e,computed:o})}),r.value},x.shuffle=function(e){var t,n=0,r=[];return T(e,function(e){t=x.random(n++),r[n-1]=r[t],r[t]=e}),r},x.sample=function(e,t,n){return arguments.length<2||n?e[x.random(e.length-1)]:x.shuffle(e).slice(0,Math.max(0,t))};var k=function(e){return x.isFunction(e)?e:function(t){return t[e]}};x.sortBy=function(e,t,n){var r=k(t);return x.pluck(x.map(e,function(e,t,i){return{value:e,index:t,criteria:r.call(n,e,t,i)}}).sort(function(e,t){var n=e.criteria,r=t.criteria;if(n!==r){if(n>r||n===void 0)return 1;if(n<r||r===void 0)return-1}return e.index-t.index}),"value")};var L=function(e){return function(t,n,r){var i={},s=n==null?x.identity:k(n);return T(t,function(n,o){var u=s.call(r,n,o,t);e(i,u,n)}),i}};x.groupBy=L(function(e,t,n){(x.has(e,t)?e[t]:e[t]=[]).push(n)}),x.indexBy=L(function(e,t,n){e[t]=n}),x.countBy=L(function(e,t){x.has(e,t)?e[t]++:e[t]=1}),x.sortedIndex=function(e,t,n,r){n=n==null?x.identity:k(n);var i=n.call(r,t),s=0,o=e.length;while(s<o){var u=s+o>>>1;n.call(r,e[u])<i?s=u+1:o=u}return s},x.toArray=function(e){return e?x.isArray(e)?u.call(e):e.length===+e.length?x.map(e,x.identity):x.values(e):[]},x.size=function(e){return e==null?0:e.length===+e.length?e.length:x.keys(e).length},x.first=x.head=x.take=function(e,t,n){return e==null?void 0:t==null||n?e[0]:u.call(e,0,t)},x.initial=function(e,t,n){return u.call(e,0,e.length-(t==null||n?1:t))},x.last=function(e,t,n){return e==null?void 0:t==null||n?e[e.length-1]:u.call(e,Math.max(e.length-t,0))},x.rest=x.tail=x.drop=function(e,t,n){return u.call(e,t==null||n?1:t)},x.compact=function(e){return x.filter(e,x.identity)};var A=function(e,t,n){return t&&x.every(e,x.isArray)?a.apply(n,e):(T(e,function(e){x.isArray(e)||x.isArguments(e)?t?o.apply(n,e):A(e,t,n):n.push(e)}),n)};x.flatten=function(e,t){return A(e,t,[])},x.without=function(e){return x.difference(e,u.call(arguments,1))},x.uniq=x.unique=function(e,t,n,r){x.isFunction(t)&&(r=n,n=t,t=!1);var i=n?x.map(e,n,r):e,s=[],o=[];return T(i,function(n,r){if(t?!r||o[o.length-1]!==n:!x.contains(o,n))o.push(n),s.push(e[r])}),s},x.union=function(){return x.uniq(x.flatten(arguments,!0))},x.intersection=function(e){var t=u.call(arguments,1);return x.filter(x.uniq(e),function(e){return x.every(t,function(t){return x.indexOf(t,e)>=0})})},x.difference=function(e){var t=a.apply(r,u.call(arguments,1));return x.filter(e,function(e){return!x.contains(t,e)})},x.zip=function(){var e=x.max(x.pluck(arguments,"length").concat(0)),t=new Array(e);for(var n=0;n<e;n++)t[n]=x.pluck(arguments,""+n);return t},x.object=function(e,t){if(e==null)return{};var n={};for(var r=0,i=e.length;r<i;r++)t?n[e[r]]=t[r]:n[e[r][0]]=e[r][1];return n},x.indexOf=function(e,t,n){if(e==null)return-1;var r=0,i=e.length;if(n){if(typeof n!="number")return r=x.sortedIndex(e,t),e[r]===t?r:-1;r=n<0?Math.max(0,i+n):n}if(y&&e.indexOf===y)return e.indexOf(t,n);for(;r<i;r++)if(e[r]===t)return r;return-1},x.lastIndexOf=function(e,t,n){if(e==null)return-1;var r=n!=null;if(b&&e.lastIndexOf===b)return r?e.lastIndexOf(t,n):e.lastIndexOf(t);var i=r?n:e.length;while(i--)if(e[i]===t)return i;return-1},x.range=function(e,t,n){arguments.length<=1&&(t=e||0,e=0),n=arguments[2]||1;var r=Math.max(Math.ceil((t-e)/n),0),i=0,s=new Array(r);while(i<r)s[i++]=e,e+=n;return s};var O=function(){};x.bind=function(e,t){var n,r;if(S&&e.bind===S)return S.apply(e,u.call(arguments,1));if(!x.isFunction(e))throw new TypeError;return n=u.call(arguments,2),r=function(){if(this instanceof r){O.prototype=e.prototype;var i=new O;O.prototype=null;var s=e.apply(i,n.concat(u.call(arguments)));return Object(s)===s?s:i}return e.apply(t,n.concat(u.call(arguments)))}},x.partial=function(e){var t=u.call(arguments,1);return function(){return e.apply(this,t.concat(u.call(arguments)))}},x.bindAll=function(e){var t=u.call(arguments,1);if(t.length===0)throw new Error("bindAll must be passed function names");return T(t,function(t){e[t]=x.bind(e[t],e)}),e},x.memoize=function(e,t){var n={};return t||(t=x.identity),function(){var r=t.apply(this,arguments);return x.has(n,r)?n[r]:n[r]=e.apply(this,arguments)}},x.delay=function(e,t){var n=u.call(arguments,2);return setTimeout(function(){return e.apply(null,n)},t)},x.defer=function(e){return x.delay.apply(x,[e,1].concat(u.call(arguments,1)))},x.throttle=function(e,t,n){var r,i,s,o=null,u=0;n||(n={});var a=function(){u=n.leading===!1?0:new Date,o=null,s=e.apply(r,i)};return function(){var f=new Date;!u&&n.leading===!1&&(u=f);var l=t-(f-u);return r=this,i=arguments,l<=0?(clearTimeout(o),o=null,u=f,s=e.apply(r,i)):!o&&n.trailing!==!1&&(o=setTimeout(a,l)),s}},x.debounce=function(e,t,n){var r,i,s,o,u;return function(){s=this,i=arguments,o=new Date;var a=function(){var f=new Date-o;f<t?r=setTimeout(a,t-f):(r=null,n||(u=e.apply(s,i)))},f=n&&!r;return r||(r=setTimeout(a,t)),f&&(u=e.apply(s,i)),u}},x.once=function(e){var t=!1,n;return function(){return t?n:(t=!0,n=e.apply(this,arguments),e=null,n)}},x.wrap=function(e,t){return function(){var n=[e];return o.apply(n,arguments),t.apply(this,n)}},x.compose=function(){var e=arguments;return function(){var t=arguments;for(var n=e.length-1;n>=0;n--)t=[e[n].apply(this,t)];return t[0]}},x.after=function(e,t){return function(){if(--e<1)return t.apply(this,arguments)}},x.keys=E||function(e){if(e!==Object(e))throw new TypeError("Invalid object");var t=[];for(var n in e)x.has(e,n)&&t.push(n);return t},x.values=function(e){var t=x.keys(e),n=t.length,r=new Array(n);for(var i=0;i<n;i++)r[i]=e[t[i]];return r},x.pairs=function(e){var t=x.keys(e),n=t.length,r=new Array(n);for(var i=0;i<n;i++)r[i]=[t[i],e[t[i]]];return r},x.invert=function(e){var t={},n=x.keys(e);for(var r=0,i=n.length;r<i;r++)t[e[n[r]]]=n[r];return t},x.functions=x.methods=function(e){var t=[];for(var n in e)x.isFunction(e[n])&&t.push(n);return t.sort()},x.extend=function(e){return T(u.call(arguments,1),function(t){if(t)for(var n in t)e[n]=t[n]}),e},x.pick=function(e){var t={},n=a.apply(r,u.call(arguments,1));return T(n,function(n){n in e&&(t[n]=e[n])}),t},x.omit=function(e){var t={},n=a.apply(r,u.call(arguments,1));for(var i in e)x.contains(n,i)||(t[i]=e[i]);return t},x.defaults=function(e){return T(u.call(arguments,1),function(t){if(t)for(var n in t)e[n]===void 0&&(e[n]=t[n])}),e},x.clone=function(e){return x.isObject(e)?x.isArray(e)?e.slice():x.extend({},e):e},x.tap=function(e,t){return t(e),e};var M=function(e,t,n,r){if(e===t)return e!==0||1/e==1/t;if(e==null||t==null)return e===t;e instanceof x&&(e=e._wrapped),t instanceof x&&(t=t._wrapped);var i=f.call(e);if(i!=f.call(t))return!1;switch(i){case"[object String]":return e==String(t);case"[object Number]":return e!=+e?t!=+t:e==0?1/e==1/t:e==+t;case"[object Date]":case"[object Boolean]":return+e==+t;case"[object RegExp]":return e.source==t.source&&e.global==t.global&&e.multiline==t.multiline&&e.ignoreCase==t.ignoreCase}if(typeof e!="object"||typeof t!="object")return!1;var s=n.length;while(s--)if(n[s]==e)return r[s]==t;var o=e.constructor,u=t.constructor;if(o!==u&&!(x.isFunction(o)&&o instanceof o&&x.isFunction(u)&&u instanceof u))return!1;n.push(e),r.push(t);var a=0,l=!0;if(i=="[object Array]"){a=e.length,l=a==t.length;if(l)while(a--)if(!(l=M(e[a],t[a],n,r)))break}else{for(var c in e)if(x.has(e,c)){a++;if(!(l=x.has(t,c)&&M(e[c],t[c],n,r)))break}if(l){for(c in t)if(x.has(t,c)&&!(a--))break;l=!a}}return n.pop(),r.pop(),l};x.isEqual=function(e,t){return M(e,t,[],[])},x.isEmpty=function(e){if(e==null)return!0;if(x.isArray(e)||x.isString(e))return e.length===0;for(var t in e)if(x.has(e,t))return!1;return!0},x.isElement=function(e){return!!e&&e.nodeType===1},x.isArray=w||function(e){return f.call(e)=="[object Array]"},x.isObject=function(e){return e===Object(e)},T(["Arguments","Function","String","Number","Date","RegExp"],function(e){x["is"+e]=function(t){return f.call(t)=="[object "+e+"]"}}),x.isArguments(arguments)||(x.isArguments=function(e){return!!e&&!!x.has(e,"callee")}),typeof /./!="function"&&(x.isFunction=function(e){return typeof e=="function"}),x.isFinite=function(e){return isFinite(e)&&!isNaN(parseFloat(e))},x.isNaN=function(e){return x.isNumber(e)&&e!=+e},x.isBoolean=function(e){return e===!0||e===!1||f.call(e)=="[object Boolean]"},x.isNull=function(e){return e===null},x.isUndefined=function(e){return e===void 0},x.has=function(e,t){return l.call(e,t)},x.noConflict=function(){return e._=t,this},x.identity=function(e){return e},x.times=function(e,t,n){var r=Array(Math.max(0,e));for(var i=0;i<e;i++)r[i]=t.call(n,i);return r},x.random=function(e,t){return t==null&&(t=e,e=0),e+Math.floor(Math.random()*(t-e+1))};var _={escape:{"&":"&","<":"<",">":">",'"':""","'":"'"}};_.unescape=x.invert(_.escape);var D={escape:new RegExp("["+x.keys(_.escape).join("")+"]","g"),unescape:new RegExp("("+x.keys(_.unescape).join("|")+")","g")};x.each(["escape","unescape"],function(e){x[e]=function(t){return t==null?"":(""+t).replace(D[e],function(t){return _[e][t]})}}),x.result=function(e,t){if(e==null)return void 0;var n=e[t];return x.isFunction(n)?n.call(e):n},x.mixin=function(e){T(x.functions(e),function(t){var n=x[t]=e[t];x.prototype[t]=function(){var e=[this._wrapped];return o.apply(e,arguments),F.call(this,n.apply(x,e))}})};var P=0;x.uniqueId=function(e){var t=++P+"";return e?e+t:t},x.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var H=/(.)^/,B={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},j=/\\|'|\r|\n|\t|\u2028|\u2029/g;x.template=function(e,t,n){var r;n=x.defaults({},n,x.templateSettings);var i=new RegExp([(n.escape||H).source,(n.interpolate||H).source,(n.evaluate||H).source].join("|")+"|$","g"),s=0,o="__p+='";e.replace(i,function(t,n,r,i,u){return o+=e.slice(s,u).replace(j,function(e){return"\\"+B[e]}),n&&(o+="'+\n((__t=("+n+"))==null?'':_.escape(__t))+\n'"),r&&(o+="'+\n((__t=("+r+"))==null?'':__t)+\n'"),i&&(o+="';\n"+i+"\n__p+='"),s=u+t.length,t}),o+="';\n",n.variable||(o="with(obj||{}){\n"+o+"}\n"),o="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+o+"return __p;\n";try{r=new Function(n.variable||"obj","_",o)}catch(u){throw u.source=o,u}if(t)return r(t,x);var a=function(e){return r.call(this,e,x)};return a.source="function("+(n.variable||"obj")+"){\n"+o+"}",a},x.chain=function(e){return x(e).chain()};var F=function(e){return this._chain?x(e).chain():e};x.mixin(x),T(["pop","push","reverse","shift","sort","splice","unshift"],function(e){var t=r[e];x.prototype[e]=function(){var n=this._wrapped;return t.apply(n,arguments),(e=="shift"||e=="splice")&&n.length===0&&delete n[0],F.call(this,n)}}),T(["concat","join","slice"],function(e){var t=r[e];x.prototype[e]=function(){return F.call(this,t.apply(this._wrapped,arguments))}}),x.extend(x.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}).call(this),define("underscore",function(e){return function(){var t,n;return t||e._}}(this)),function(e,t){typeof module=="object"&&typeof module.exports=="object"?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}(typeof window!="undefined"?window:this,function(window,noGlobal){function isArrayLike(e){var t=!!e&&"length"in e&&e.length,n=jQuery.type(e);return n==="function"||jQuery.isWindow(e)?!1:n==="array"||t===0||typeof t=="number"&&t>0&&t-1 in e}function winnow(e,t,n){if(jQuery.isFunction(t))return jQuery.grep(e,function(e,r){return!!t.call(e,r,e)!==n});if(t.nodeType)return jQuery.grep(e,function(e){return e===t!==n});if(typeof t=="string"){if(risSimple.test(t))return jQuery.filter(t,e,n);t=jQuery.filter(t,e)}return jQuery.grep(e,function(e){return indexOf.call(t,e)>-1!==n})}function sibling(e,t){while((e=e[t])&&e.nodeType!==1);return e}function createOptions(e){var t={};return jQuery.each(e.match(rnotwhite)||[],function(e,n){t[n]=!0}),t}function completed(){document.removeEventListener("DOMContentLoaded",completed),window.removeEventListener("load",completed),jQuery.ready()}function Data(){this.expando=jQuery.expando+Data.uid++}function dataAttr(e,t,n){var r;if(n===undefined&&e.nodeType===1){r="data-"+t.replace(rmultiDash,"-$&").toLowerCase(),n=e.getAttribute(r);if(typeof n=="string"){try{n=n==="true"?!0:n==="false"?!1:n==="null"?null:+n+""===n?+n:rbrace.test(n)?jQuery.parseJSON(n):n}catch(i){}dataUser.set(e,t,n)}else n=undefined}return n}function adjustCSS(e,t,n,r){var i,s=1,o=20,u=r?function(){return r.cur()}:function(){return jQuery.css(e,t,"")},a=u(),f=n&&n[3]||(jQuery.cssNumber[t]?"":"px"),l=(jQuery.cssNumber[t]||f!=="px"&&+a)&&rcssNum.exec(jQuery.css(e,t));if(l&&l[3]!==f){f=f||l[3],n=n||[],l=+a||1;do s=s||".5",l/=s,jQuery.style(e,t,l+f);while(s!==(s=u()/a)&&s!==1&&--o)}return n&&(l=+l||+a||0,i=n[1]?l+(n[1]+1)*n[2]:+n[2],r&&(r.unit=f,r.start=l,r.end=i)),i}function getAll(e,t){var n=typeof e.getElementsByTagName!="undefined"?e.getElementsByTagName(t||"*"):typeof e.querySelectorAll!="undefined"?e.querySelectorAll(t||"*"):[];return t===undefined||t&&jQuery.nodeName(e,t)?jQuery.merge([e],n):n}function setGlobalEval(e,t){var n=0,r=e.length;for(;n<r;n++)dataPriv.set(e[n],"globalEval",!t||dataPriv.get(t[n],"globalEval"))}function buildFragment(e,t,n,r,i){var s,o,u,a,f,l,c=t.createDocumentFragment(),h=[],p=0,d=e.length;for(;p<d;p++){s=e[p];if(s||s===0)if(jQuery.type(s)==="object")jQuery.merge(h,s.nodeType?[s]:s);else if(!rhtml.test(s))h.push(t.createTextNode(s));else{o=o||c.appendChild(t.createElement("div")),u=(rtagName.exec(s)||["",""])[1].toLowerCase(),a=wrapMap[u]||wrapMap._default,o.innerHTML=a[1]+jQuery.htmlPrefilter(s)+a[2],l=a[0];while(l--)o=o.lastChild;jQuery.merge(h,o.childNodes),o=c.firstChild,o.textContent=""}}c.textContent="",p=0;while(s=h[p++]){if(r&&jQuery.inArray(s,r)>-1){i&&i.push(s);continue}f=jQuery.contains(s.ownerDocument,s),o=getAll(c.appendChild(s),"script"),f&&setGlobalEval(o);if(n){l=0;while(s=o[l++])rscriptType.test(s.type||"")&&n.push(s)}}return c}function returnTrue(){return!0}function returnFalse(){return!1}function safeActiveElement(){try{return document.activeElement}catch(e){}}function on(e,t,n,r,i,s){var o,u;if(typeof t=="object"){typeof n!="string"&&(r=r||n,n=undefined);for(u in t)on(e,u,n,r,t[u],s);return e}r==null&&i==null?(i=n,r=n=undefined):i==null&&(typeof n=="string"?(i=r,r=undefined):(i=r,r=n,n=undefined));if(i===!1)i=returnFalse;else if(!i)return e;return s===1&&(o=i,i=function(e){return jQuery().off(e),o.apply(this,arguments)},i.guid=o.guid||(o.guid=jQuery.guid++)),e.each(function(){jQuery.event.add(this,t,i,r,n)})}function manipulationTarget(e,t){return jQuery.nodeName(e,"table")&&jQuery.nodeName(t.nodeType!==11?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function disableScript(e){return e.type=(e.getAttribute("type")!==null)+"/"+e.type,e}function restoreScript(e){var t=rscriptTypeMasked.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function cloneCopyEvent(e,t){var n,r,i,s,o,u,a,f;if(t.nodeType!==1)return;if(dataPriv.hasData(e)){s=dataPriv.access(e),o=dataPriv.set(t,s),f=s.events;if(f){delete o.handle,o.events={};for(i in f)for(n=0,r=f[i].length;n<r;n++)jQuery.event.add(t,i,f[i][n])}}dataUser.hasData(e)&&(u=dataUser.access(e),a=jQuery.extend({},u),dataUser.set(t,a))}function fixInput(e,t){var n=t.nodeName.toLowerCase();if(n==="input"&&rcheckableType.test(e.type))t.checked=e.checked;else if(n==="input"||n==="textarea")t.defaultValue=e.defaultValue}function domManip(e,t,n,r){t=concat.apply([],t);var i,s,o,u,a,f,l=0,c=e.length,h=c-1,p=t[0],d=jQuery.isFunction(p);if(d||c>1&&typeof p=="string"&&!support.checkClone&&rchecked.test(p))return e.each(function(i){var s=e.eq(i);d&&(t[0]=p.call(this,i,s.html())),domManip(s,t,n,r)});if(c){i=buildFragment(t,e[0].ownerDocument,!1,e,r),s=i.firstChild,i.childNodes.length===1&&(i=s);if(s||r){o=jQuery.map(getAll(i,"script"),disableScript),u=o.length;for(;l<c;l++)a=i,l!==h&&(a=jQuery.clone(a,!0,!0),u&&jQuery.merge(o,getAll(a,"script"))),n.call(e[l],a,l);if(u){f=o[o.length-1].ownerDocument,jQuery.map(o,restoreScript);for(l=0;l<u;l++)a=o[l],rscriptType.test(a.type||"")&&!dataPriv.access(a,"globalEval")&&jQuery.contains(f,a)&&(a.src?jQuery._evalUrl&&jQuery._evalUrl(a.src):jQuery.globalEval(a.textContent.replace(rcleanScript,"")))}}}return e}function remove(e,t,n){var r,i=t?jQuery.filter(t,e):e,s=0;for(;(r=i[s])!=null;s++)!n&&r.nodeType===1&&jQuery.cleanData(getAll(r)),r.parentNode&&(n&&jQuery.contains(r.ownerDocument,r)&&setGlobalEval(getAll(r,"script")),r.parentNode.removeChild(r));return e}function actualDisplay(e,t){var n=jQuery(t.createElement(e)).appendTo(t.body),r=jQuery.css(n[0],"display");return n.detach(),r}function defaultDisplay(e){var t=document,n=elemdisplay[e];if(!n){n=actualDisplay(e,t);if(n==="none"||!n)iframe=(iframe||jQuery("<iframe frameborder='0' width='0' height='0'/>")).appendTo(t.documentElement),t=iframe[0].contentDocument,t.write(),t.close(),n=actualDisplay(e,t),iframe.detach();elemdisplay[e]=n}return n}function curCSS(e,t,n){var r,i,s,o,u=e.style;return n=n||getStyles(e),o=n?n.getPropertyValue(t)||n[t]:undefined,(o===""||o===undefined)&&!jQuery.contains(e.ownerDocument,e)&&(o=jQuery.style(e,t)),n&&!support.pixelMarginRight()&&rnumnonpx.test(o)&&rmargin.test(t)&&(r=u.width,i=u.minWidth,s=u.maxWidth,u.minWidth=u.maxWidth=u.width=o,o=n.width,u.width=r,u.minWidth=i,u.maxWidth=s),o!==undefined?o+"":o}function addGetHookIf(e,t){return{get:function(){if(e()){delete this.get;return}return(this.get=t).apply(this,arguments)}}}function vendorPropName(e){if(e in emptyStyle)return e;var t=e[0].toUpperCase()+e.slice(1),n=cssPrefixes.length;while(n--){e=cssPrefixes[n]+t;if(e in emptyStyle)return e}}function setPositiveNumber(e,t,n){var r=rcssNum.exec(t);return r?Math.max(0,r[2]-(n||0))+(r[3]||"px"):t}function augmentWidthOrHeight(e,t,n,r,i){var s=n===(r?"border":"content")?4:t==="width"?1:0,o=0;for(;s<4;s+=2)n==="margin"&&(o+=jQuery.css(e,n+cssExpand[s],!0,i)),r?(n==="content"&&(o-=jQuery.css(e,"padding"+cssExpand[s],!0,i)),n!=="margin"&&(o-=jQuery.css(e,"border"+cssExpand[s]+"Width",!0,i))):(o+=jQuery.css(e,"padding"+cssExpand[s],!0,i),n!=="padding"&&(o+=jQuery.css(e,"border"+cssExpand[s]+"Width",!0,i)));return o}function getWidthOrHeight(e,t,n){var r=!0,i=t==="width"?e.offsetWidth:e.offsetHeight,s=getStyles(e),o=jQuery.css(e,"boxSizing",!1,s)==="border-box";document.msFullscreenElement&&window.top!==window&&e.getClientRects().length&&(i=Math.round(e.getBoundingClientRect()[t]*100));if(i<=0||i==null){i=curCSS(e,t,s);if(i<0||i==null)i=e.style[t];if(rnumnonpx.test(i))return i;r=o&&(support.boxSizingReliable()||i===e.style[t]),i=parseFloat(i)||0}return i+augmentWidthOrHeight(e,t,n||(o?"border":"content"),r,s)+"px"}function showHide(e,t){var n,r,i,s=[],o=0,u=e.length;for(;o<u;o++){r=e[o];if(!r.style)continue;s[o]=dataPriv.get(r,"olddisplay"),n=r.style.display,t?(!s[o]&&n==="none"&&(r.style.display=""),r.style.display===""&&isHidden(r)&&(s[o]=dataPriv.access(r,"olddisplay",defaultDisplay(r.nodeName)))):(i=isHidden(r),(n!=="none"||!i)&&dataPriv.set(r,"olddisplay",i?n:jQuery.css(r,"display")))}for(o=0;o<u;o++){r=e[o];if(!r.style)continue;if(!t||r.style.display==="none"||r.style.display==="")r.style.display=t?s[o]||"":"none"}return e}function Tween(e,t,n,r,i){return new Tween.prototype.init(e,t,n,r,i)}function createFxNow(){return window.setTimeout(function(){fxNow=undefined}),fxNow=jQuery.now()}function genFx(e,t){var n,r=0,i={height:e};t=t?1:0;for(;r<4;r+=2-t)n=cssExpand[r],i["margin"+n]=i["padding"+n]=e;return t&&(i.opacity=i.width=e),i}function createTween(e,t,n){var r,i=(Animation.tweeners[t]||[]).concat(Animation.tweeners["*"]),s=0,o=i.length;for(;s<o;s++)if(r=i[s].call(n,t,e))return r}function defaultPrefilter(e,t,n){var r,i,s,o,u,a,f,l,c=this,h={},p=e.style,d=e.nodeType&&isHidden(e),v=dataPriv.get(e,"fxshow");n.queue||(u=jQuery._queueHooks(e,"fx"),u.unqueued==null&&(u.unqueued=0,a=u.empty.fire,u.empty.fire=function(){u.unqueued||a()}),u.unqueued++,c.always(function(){c.always(function(){u.unqueued--,jQuery.queue(e,"fx").length||u.empty.fire()})})),e.nodeType===1&&("height"in t||"width"in t)&&(n.overflow=[p.overflow,p.overflowX,p.overflowY],f=jQuery.css(e,"display"),l=f==="none"?dataPriv.get(e,"olddisplay")||defaultDisplay(e.nodeName):f,l==="inline"&&jQuery.css(e,"float")==="none"&&(p.display="inline-block")),n.overflow&&(p.overflow="hidden",c.always(function(){p.overflow=n.overflow[0],p.overflowX=n.overflow[1],p.overflowY=n.overflow[2]}));for(r in t){i=t[r];if(rfxtypes.exec(i)){delete t[r],s=s||i==="toggle";if(i===(d?"hide":"show")){if(i!=="show"||!v||v[r]===undefined)continue;d=!0}h[r]=v&&v[r]||jQuery.style(e,r)}else f=undefined}if(!jQuery.isEmptyObject(h)){v?"hidden"in v&&(d=v.hidden):v=dataPriv.access(e,"fxshow",{}),s&&(v.hidden=!d),d?jQuery(e).show():c.done(function(){jQuery(e).hide()}),c.done(function(){var t;dataPriv.remove(e,"fxshow");for(t in h)jQuery.style(e,t,h[t])});for(r in h)o=createTween(d?v[r]:0,r,c),r in v||(v[r]=o.start,d&&(o.end=o.start,o.start=r==="width"||r==="height"?1:0))}else(f==="none"?defaultDisplay(e.nodeName):f)==="inline"&&(p.display=f)}function propFilter(e,t){var n,r,i,s,o;for(n in e){r=jQuery.camelCase(n),i=t[r],s=e[n],jQuery.isArray(s)&&(i=s[1],s=e[n]=s[0]),n!==r&&(e[r]=s,delete e[n]),o=jQuery.cssHooks[r];if(o&&"expand"in o){s=o.expand(s),delete e[r];for(n in s)n in e||(e[n]=s[n],t[n]=i)}else t[r]=i}}function Animation(e,t,n){var r,i,s=0,o=Animation.prefilters.length,u=jQuery.Deferred().always(function(){delete a.elem}),a=function(){if(i)return!1;var t=fxNow||createFxNow(),n=Math.max(0,f.startTime+f.duration-t),r=n/f.duration||0,s=1-r,o=0,a=f.tweens.length;for(;o<a;o++)f.tweens[o].run(s);return u.notifyWith(e,[f,s,n]),s<1&&a?n:(u.resolveWith(e,[f]),!1)},f=u.promise({elem:e,props:jQuery.extend({},t),opts:jQuery.extend(!0,{specialEasing:{},easing:jQuery.easing._default},n),originalProperties:t,originalOptions:n,startTime:fxNow||createFxNow(),duration:n.duration,tweens:[],createTween:function(t,n){var r=jQuery.Tween(e,f.opts,t,n,f.opts.specialEasing[t]||f.opts.easing);return f.tweens.push(r),r},stop:function(t){var n=0,r=t?f.tweens.length:0;if(i)return this;i=!0;for(;n<r;n++)f.tweens[n].run(1);return t?(u.notifyWith(e,[f,1,0]),u.resolveWith(e,[f,t])):u.rejectWith(e,[f,t]),this}}),l=f.props;propFilter(l,f.opts.specialEasing);for(;s<o;s++){r=Animation.prefilters[s].call(f,e,l,f.opts);if(r)return jQuery.isFunction(r.stop)&&(jQuery._queueHooks(f.elem,f.opts.queue).stop=jQuery.proxy(r.stop,r)),r}return jQuery.map(l,createTween,f),jQuery.isFunction(f.opts.start)&&f.opts.start.call(e,f),jQuery.fx.timer(jQuery.extend(a,{elem:e,anim:f,queue:f.opts.queue})),f.progress(f.opts.progress).done(f.opts.done,f.opts.complete).fail(f.opts.fail).always(f.opts.always)}function getClass(e){return e.getAttribute&&e.getAttribute("class")||""}function addToPrefiltersOrTransports(e){return function(t,n){typeof t!="string"&&(n=t,t="*");var r,i=0,s=t.toLowerCase().match(rnotwhite)||[];if(jQuery.isFunction(n))while(r=s[i++])r[0]==="+"?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function inspectPrefiltersOrTransports(e,t,n,r){function o(u){var a;return i[u]=!0,jQuery.each(e[u]||[],function(e,u){var f=u(t,n,r);if(typeof f=="string"&&!s&&!i[f])return t.dataTypes.unshift(f),o(f),!1;if(s)return!(a=f)}),a}var i={},s=e===transports;return o(t.dataTypes[0])||!i["*"]&&o("*")}function ajaxExtend(e,t){var n,r,i=jQuery.ajaxSettings.flatOptions||{};for(n in t)t[n]!==undefined&&((i[n]?e:r||(r={}))[n]=t[n]);return r&&jQuery.extend(!0,e,r),e}function ajaxHandleResponses(e,t,n){var r,i,s,o,u=e.contents,a=e.dataTypes;while(a[0]==="*")a.shift(),r===undefined&&(r=e.mimeType||t.getResponseHeader("Content-Type"));if(r)for(i in u)if(u[i]&&u[i].test(r)){a.unshift(i);break}if(a[0]in n)s=a[0];else{for(i in n){if(!a[0]||e.converters[i+" "+a[0]]){s=i;break}o||(o=i)}s=s||o}if(s)return s!==a[0]&&a.unshift(s),n[s]}function ajaxConvert(e,t,n,r){var i,s,o,u,a,f={},l=e.dataTypes.slice();if(l[1])for(o in e.converters)f[o.toLowerCase()]=e.converters[o];s=l.shift();while(s){e.responseFields[s]&&(n[e.responseFields[s]]=t),!a&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),a=s,s=l.shift();if(s)if(s==="*")s=a;else if(a!=="*"&&a!==s){o=f[a+" "+s]||f["* "+s];if(!o)for(i in f){u=i.split(" ");if(u[1]===s){o=f[a+" "+u[0]]||f["* "+u[0]];if(o){o===!0?o=f[i]:f[i]!==!0&&(s=u[0],l.unshift(u[1]));break}}}if(o!==!0)if(o&&e.throws)t=o(t);else try{t=o(t)}catch(c){return{state:"parsererror",error:o?c:"No conversion from "+a+" to "+s}}}}return{state:"success",data:t}}function buildParams(e,t,n,r){var i;if(jQuery.isArray(t))jQuery.each(t,function(t,i){n||rbracket.test(e)?r(e,i):buildParams(e+"["+(typeof i=="object"&&i!=null?t:"")+"]",i,n,r)});else if(!n&&jQuery.type(t)==="object")for(i in t)buildParams(e+"["+i+"]",t[i],n,r);else r(e,t)}function getWindow(e){return jQuery.isWindow(e)?e:e.nodeType===9&&e.defaultView}var arr=[],document=window.document,slice=arr.slice,concat=arr.concat,push=arr.push,indexOf=arr.indexOf,class2type={},toString=class2type.toString,hasOwn=class2type.hasOwnProperty,support={},version="2.2.3",jQuery=function(e,t){return new jQuery.fn.init(e,t)},rtrim=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,rmsPrefix=/^-ms-/,rdashAlpha=/-([\da-z])/gi,fcamelCase=function(e,t){return t.toUpperCase()};jQuery.fn=jQuery.prototype={jquery:version,constructor:jQuery,selector:"",length:0,toArray:function(){return slice.call(this)},get:function(e){return e!=null?e<0?this[e+this.length]:this[e]:slice.call(this)},pushStack:function(e){var t=jQuery.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e){return jQuery.each(this,e)},map:function(e){return this.pushStack(jQuery.map(this,function(t,n){return e.call(t,n,t)}))},slice:function(){return this.pushStack(slice.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(e<0?t:0);return this.pushStack(n>=0&&n<t?[this[n]]:[])},end:function(){return this.prevObject||this.constructor()},push:push,sort:arr.sort,splice:arr.splice},jQuery.extend=jQuery.fn.extend=function(){var e,t,n,r,i,s,o=arguments[0]||{},u=1,a=arguments.length,f=!1;typeof o=="boolean"&&(f=o,o=arguments[u]||{},u++),typeof o!="object"&&!jQuery.isFunction(o)&&(o={}),u===a&&(o=this,u--);for(;u<a;u++)if((e=arguments[u])!=null)for(t in e){n=o[t],r=e[t];if(o===r)continue;f&&r&&(jQuery.isPlainObject(r)||(i=jQuery.isArray(r)))?(i?(i=!1,s=n&&jQuery.isArray(n)?n:[]):s=n&&jQuery.isPlainObject(n)?n:{},o[t]=jQuery.extend(f,s,r)):r!==undefined&&(o[t]=r)}return o},jQuery.extend({expando:"jQuery"+(version+Math.random()).replace(/\D/g,""),isReady:!0,error:function(e){throw new Error(e)},noop:function(){},isFunction:function(e){return jQuery.type(e)==="function"},isArray:Array.isArray,isWindow:function(e){return e!=null&&e===e.window},isNumeric:function(e){var t=e&&e.toString();return!jQuery.isArray(e)&&t-parseFloat(t)+1>=0},isPlainObject:function(e){var t;if(jQuery.type(e)!=="object"||e.nodeType||jQuery.isWindow(e))return!1;if(e.constructor&&!hasOwn.call(e,"constructor")&&!hasOwn.call(e.constructor.prototype||{},"isPrototypeOf"))return!1;for(t in e);return t===undefined||hasOwn.call(e,t)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},type:function(e){return e==null?e+"":typeof e=="object"||typeof e=="function"?class2type[toString.call(e)]||"object":typeof e},globalEval:function(code){var script,indirect=eval;code=jQuery.trim(code),code&&(code.indexOf("use strict")===1?(script=document.createElement("script"),script.text=code,document.head.appendChild(script).parentNode.removeChild(script)):indirect(code))},camelCase:function(e){return e.replace(rmsPrefix,"ms-").replace(rdashAlpha,fcamelCase)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t){var n,r=0;if(isArrayLike(e)){n=e.length;for(;r<n;r++)if(t.call(e[r],r,e[r])===!1)break}else for(r in e)if(t.call(e[r],r,e[r])===!1)break;return e},trim:function(e){return e==null?"":(e+"").replace(rtrim,"")},makeArray:function(e,t){var n=t||[];return e!=null&&(isArrayLike(Object(e))?jQuery.merge(n,typeof e=="string"?[e]:e):push.call(n,e)),n},inArray:function(e,t,n){return t==null?-1:indexOf.call(t,e,n)},merge:function(e,t){var n=+t.length,r=0,i=e.length;for(;r<n;r++)e[i++]=t[r];return e.length=i,e},grep:function(e,t,n){var r,i=[],s=0,o=e.length,u=!n;for(;s<o;s++)r=!t(e[s],s),r!==u&&i.push(e[s]);return i},map:function(e,t,n){var r,i,s=0,o=[];if(isArrayLike(e)){r=e.length;for(;s<r;s++)i=t(e[s],s,n),i!=null&&o.push(i)}else for(s in e)i=t(e[s],s,n),i!=null&&o.push(i);return concat.apply([],o)},guid:1,proxy:function(e,t){var n,r,i;return typeof t=="string"&&(n=e[t],t=e,e=n),jQuery.isFunction(e)?(r=slice.call(arguments,2),i=function(){return e.apply(t||this,r.concat(slice.call(arguments)))},i.guid=e.guid=e.guid||jQuery.guid++,i):undefined},now:Date.now,support:support}),typeof Symbol=="function"&&(jQuery.fn[Symbol.iterator]=arr[Symbol.iterator]),jQuery.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(e,t){class2type["[object "+t+"]"]=t.toLowerCase()});var Sizzle=function(e){function st(e,t,r,i){var s,u,f,l,c,d,g,y,S=t&&t.ownerDocument,x=t?t.nodeType:9;r=r||[];if(typeof e!="string"||!e||x!==1&&x!==9&&x!==11)return r;if(!i){(t?t.ownerDocument||t:E)!==p&&h(t),t=t||p;if(v){if(x!==11&&(d=Y.exec(e)))if(s=d[1]){if(x===9){if(!(f=t.getElementById(s)))return r;if(f.id===s)return r.push(f),r}else if(S&&(f=S.getElementById(s))&&b(t,f)&&f.id===s)return r.push(f),r}else{if(d[2])return D.apply(r,t.getElementsByTagName(e)),r;if((s=d[3])&&n.getElementsByClassName&&t.getElementsByClassName)return D.apply(r,t.getElementsByClassName(s)),r}if(n.qsa&&!C[e+" "]&&(!m||!m.test(e))){if(x!==1)S=t,y=e;else if(t.nodeName.toLowerCase()!=="object"){(l=t.getAttribute("id"))?l=l.replace(et,"\\$&"):t.setAttribute("id",l=w),g=o(e),u=g.length,c=$.test(l)?"#"+l:"[id='"+l+"']";while(u--)g[u]=c+" "+mt(g[u]);y=g.join(","),S=Z.test(e)&&dt(t.parentNode)||t}if(y)try{return D.apply(r,S.querySelectorAll(y)),r}catch(T){}finally{l===w&&t.removeAttribute("id")}}}}return a(e.replace(U,"$1"),t,r,i)}function ot(){function t(n,i){return e.push(n+" ")>r.cacheLength&&delete t[e.shift()],t[n+" "]=i}var e=[];return t}function ut(e){return e[w]=!0,e}function at(e){var t=p.createElement("div");try{return!!e(t)}catch(n){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function ft(e,t){var n=e.split("|"),i=n.length;while(i--)r.attrHandle[n[i]]=t}function lt(e,t){var n=t&&e,r=n&&e.nodeType===1&&t.nodeType===1&&(~t.sourceIndex||L)-(~e.sourceIndex||L);if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function ct(e){return function(t){var n=t.nodeName.toLowerCase();return n==="input"&&t.type===e}}function ht(e){return function(t){var n=t.nodeName.toLowerCase();return(n==="input"||n==="button")&&t.type===e}}function pt(e){return ut(function(t){return t=+t,ut(function(n,r){var i,s=e([],n.length,t),o=s.length;while(o--)n[i=s[o]]&&(n[i]=!(r[i]=n[i]))})})}function dt(e){return e&&typeof e.getElementsByTagName!="undefined"&&e}function vt(){}function mt(e){var t=0,n=e.length,r="";for(;t<n;t++)r+=e[t].value;return r}function gt(e,t,n){var r=t.dir,i=n&&r==="parentNode",s=x++;return t.first?function(t,n,s){while(t=t[r])if(t.nodeType===1||i)return e(t,n,s)}:function(t,n,o){var u,a,f,l=[S,s];if(o){while(t=t[r])if(t.nodeType===1||i)if(e(t,n,o))return!0}else while(t=t[r])if(t.nodeType===1||i){f=t[w]||(t[w]={}),a=f[t.uniqueID]||(f[t.uniqueID]={});if((u=a[r])&&u[0]===S&&u[1]===s)return l[2]=u[2];a[r]=l;if(l[2]=e(t,n,o))return!0}}}function yt(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function bt(e,t,n){var r=0,i=t.length;for(;r<i;r++)st(e,t[r],n);return n}function wt(e,t,n,r,i){var s,o=[],u=0,a=e.length,f=t!=null;for(;u<a;u++)if(s=e[u])if(!n||n(s,r,i))o.push(s),f&&t.push(u);return o}function Et(e,t,n,r,i,s){return r&&!r[w]&&(r=Et(r)),i&&!i[w]&&(i=Et(i,s)),ut(function(s,o,u,a){var f,l,c,h=[],p=[],d=o.length,v=s||bt(t||"*",u.nodeType?[u]:u,[]),m=e&&(s||!t)?wt(v,h,e,u,a):v,g=n?i||(s?e:d||r)?[]:o:m;n&&n(m,g,u,a);if(r){f=wt(g,p),r(f,[],u,a),l=f.length;while(l--)if(c=f[l])g[p[l]]=!(m[p[l]]=c)}if(s){if(i||e){if(i){f=[],l=g.length;while(l--)(c=g[l])&&f.push(m[l]=c);i(null,g=[],f,a)}l=g.length;while(l--)(c=g[l])&&(f=i?H(s,c):h[l])>-1&&(s[f]=!(o[f]=c))}}else g=wt(g===o?g.splice(d,g.length):g),i?i(null,o,g,a):D.apply(o,g)})}function St(e){var t,n,i,s=e.length,o=r.relative[e[0].type],u=o||r.relative[" "],a=o?1:0,l=gt(function(e){return e===t},u,!0),c=gt(function(e){return H(t,e)>-1},u,!0),h=[function(e,n,r){var i=!o&&(r||n!==f)||((t=n).nodeType?l(e,n,r):c(e,n,r));return t=null,i}];for(;a<s;a++)if(n=r.relative[e[a].type])h=[gt(yt(h),n)];else{n=r.filter[e[a].type].apply(null,e[a].matches);if(n[w]){i=++a;for(;i<s;i++)if(r.relative[e[i].type])break;return Et(a>1&&yt(h),a>1&&mt(e.slice(0,a-1).concat({value:e[a-2].type===" "?"*":""})).replace(U,"$1"),n,a<i&&St(e.slice(a,i)),i<s&&St(e=e.slice(i)),i<s&&mt(e))}h.push(n)}return yt(h)}function xt(e,t){var n=t.length>0,i=e.length>0,s=function(s,o,u,a,l){var c,d,m,g=0,y="0",b=s&&[],w=[],E=f,x=s||i&&r.find.TAG("*",l),T=S+=E==null?1:Math.random()||.1,N=x.length;l&&(f=o===p||o||l);for(;y!==N&&(c=x[y])!=null;y++){if(i&&c){d=0,!o&&c.ownerDocument!==p&&(h(c),u=!v);while(m=e[d++])if(m(c,o||p,u)){a.push(c);break}l&&(S=T)}n&&((c=!m&&c)&&g--,s&&b.push(c))}g+=y;if(n&&y!==g){d=0;while(m=t[d++])m(b,w,o,u);if(s){if(g>0)while(y--)!b[y]&&!w[y]&&(w[y]=M.call(a));w=wt(w)}D.apply(a,w),l&&!s&&w.length>0&&g+t.length>1&&st.uniqueSort(a)}return l&&(S=T,f=E),b};return n?ut(s):s}var t,n,r,i,s,o,u,a,f,l,c,h,p,d,v,m,g,y,b,w="sizzle"+1*new Date,E=e.document,S=0,x=0,T=ot(),N=ot(),C=ot(),k=function(e,t){return e===t&&(c=!0),0},L=1<<31,A={}.hasOwnProperty,O=[],M=O.pop,_=O.push,D=O.push,P=O.slice,H=function(e,t){var n=0,r=e.length;for(;n<r;n++)if(e[n]===t)return n;return-1},B="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",j="[\\x20\\t\\r\\n\\f]",F="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",I="\\["+j+"*("+F+")(?:"+j+"*([*^$|!~]?=)"+j+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+F+"))|)"+j+"*\\]",q=":("+F+")(?:\\(("+"('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|"+"((?:\\\\.|[^\\\\()[\\]]|"+I+")*)|"+".*"+")\\)|)",R=new RegExp(j+"+","g"),U=new RegExp("^"+j+"+|((?:^|[^\\\\])(?:\\\\.)*)"+j+"+$","g"),z=new RegExp("^"+j+"*,"+j+"*"),W=new RegExp("^"+j+"*([>+~]|"+j+")"+j+"*"),X=new RegExp("="+j+"*([^\\]'\"]*?)"+j+"*\\]","g"),V=new RegExp(q),$=new RegExp("^"+F+"$"),J={ID:new RegExp("^#("+F+")"),CLASS:new RegExp("^\\.("+F+")"),TAG:new RegExp("^("+F+"|[*])"),ATTR:new RegExp("^"+I),PSEUDO:new RegExp("^"+q),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+j+"*(even|odd|(([+-]|)(\\d*)n|)"+j+"*(?:([+-]|)"+j+"*(\\d+)|))"+j+"*\\)|)","i"),bool:new RegExp("^(?:"+B+")$","i"),needsContext:new RegExp("^"+j+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+j+"*((?:-\\d)?\\d*)"+j+"*\\)|)(?=[^-]|$)","i")},K=/^(?:input|select|textarea|button)$/i,Q=/^h\d$/i,G=/^[^{]+\{\s*\[native \w/,Y=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,Z=/[+~]/,et=/'|\\/g,tt=new RegExp("\\\\([\\da-f]{1,6}"+j+"?|("+j+")|.)","ig"),nt=function(e,t,n){var r="0x"+t-65536;return r!==r||n?t:r<0?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,r&1023|56320)},rt=function(){h()};try{D.apply(O=P.call(E.childNodes),E.childNodes),O[E.childNodes.length].nodeType}catch(it){D={apply:O.length?function(e,t){_.apply(e,P.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}n=st.support={},s=st.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?t.nodeName!=="HTML":!1},h=st.setDocument=function(e){var t,i,o=e?e.ownerDocument||e:E;if(o===p||o.nodeType!==9||!o.documentElement)return p;p=o,d=p.documentElement,v=!s(p),(i=p.defaultView)&&i.top!==i&&(i.addEventListener?i.addEventListener("unload",rt,!1):i.attachEvent&&i.attachEvent("onunload",rt)),n.attributes=at(function(e){return e.className="i",!e.getAttribute("className")}),n.getElementsByTagName=at(function(e){return e.appendChild(p.createComment("")),!e.getElementsByTagName("*").length}),n.getElementsByClassName=G.test(p.getElementsByClassName),n.getById=at(function(e){return d.appendChild(e).id=w,!p.getElementsByName||!p.getElementsByName(w).length}),n.getById?(r.find.ID=function(e,t){if(typeof t.getElementById!="undefined"&&v){var n=t.getElementById(e);return n?[n]:[]}},r.filter.ID=function(e){var t=e.replace(tt,nt);return function(e){return e.getAttribute("id")===t}}):(delete r.find.ID,r.filter.ID=function(e){var t=e.replace(tt,nt);return function(e){var n=typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id");return n&&n.value===t}}),r.find.TAG=n.getElementsByTagName?function(e,t){if(typeof t.getElementsByTagName!="undefined")return t.getElementsByTagName(e);if(n.qsa)return t.querySelectorAll(e)}:function(e,t){var n,r=[],i=0,s=t.getElementsByTagName(e);if(e==="*"){while(n=s[i++])n.nodeType===1&&r.push(n);return r}return s},r.find.CLASS=n.getElementsByClassName&&function(e,t){if(typeof t.getElementsByClassName!="undefined"&&v)return t.getElementsByClassName(e)},g=[],m=[];if(n.qsa=G.test(p.querySelectorAll))at(function(e){d.appendChild(e).innerHTML="<a id='"+w+"'></a>"+"<select id='"+w+"-\r\\' msallowcapture=''>"+"<option selected=''></option></select>",e.querySelectorAll("[msallowcapture^='']").length&&m.push("[*^$]="+j+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||m.push("\\["+j+"*(?:value|"+B+")"),e.querySelectorAll("[id~="+w+"-]").length||m.push("~="),e.querySelectorAll(":checked").length||m.push(":checked"),e.querySelectorAll("a#"+w+"+*").length||m.push(".#.+[+~]")}),at(function(e){var t=p.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&m.push("name"+j+"*[*^$|!~]?="),e.querySelectorAll(":enabled").length||m.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),m.push(",.*:")});return(n.matchesSelector=G.test(y=d.matches||d.webkitMatchesSelector||d.mozMatchesSelector||d.oMatchesSelector||d.msMatchesSelector))&&at(function(e){n.disconnectedMatch=y.call(e,"div"),y.call(e,"[s!='']:x"),g.push("!=",q)}),m=m.length&&new RegExp(m.join("|")),g=g.length&&new RegExp(g.join("|")),t=G.test(d.compareDocumentPosition),b=t||G.test(d.contains)?function(e,t){var n=e.nodeType===9?e.documentElement:e,r=t&&t.parentNode;return e===r||!!r&&r.nodeType===1&&!!(n.contains?n.contains(r):e.compareDocumentPosition&&e.compareDocumentPosition(r)&16)}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},k=t?function(e,t){if(e===t)return c=!0,0;var r=!e.compareDocumentPosition-!t.compareDocumentPosition;return r?r:(r=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1,r&1||!n.sortDetached&&t.compareDocumentPosition(e)===r?e===p||e.ownerDocument===E&&b(E,e)?-1:t===p||t.ownerDocument===E&&b(E,t)?1:l?H(l,e)-H(l,t):0:r&4?-1:1)}:function(e,t){if(e===t)return c=!0,0;var n,r=0,i=e.parentNode,s=t.parentNode,o=[e],u=[t];if(!i||!s)return e===p?-1:t===p?1:i?-1:s?1:l?H(l,e)-H(l,t):0;if(i===s)return lt(e,t);n=e;while(n=n.parentNode)o.unshift(n);n=t;while(n=n.parentNode)u.unshift(n);while(o[r]===u[r])r++;return r?lt(o[r],u[r]):o[r]===E?-1:u[r]===E?1:0},p},st.matches=function(e,t){return st(e,null,null,t)},st.matchesSelector=function(e,t){(e.ownerDocument||e)!==p&&h(e),t=t.replace(X,"='$1']");if(n.matchesSelector&&v&&!C[t+" "]&&(!g||!g.test(t))&&(!m||!m.test(t)))try{var r=y.call(e,t);if(r||n.disconnectedMatch||e.document&&e.document.nodeType!==11)return r}catch(i){}return st(t,p,null,[e]).length>0},st.contains=function(e,t){return(e.ownerDocument||e)!==p&&h(e),b(e,t)},st.attr=function(e,t){(e.ownerDocument||e)!==p&&h(e);var i=r.attrHandle[t.toLowerCase()],s=i&&A.call(r.attrHandle,t.toLowerCase())?i(e,t,!v):undefined;return s!==undefined?s:n.attributes||!v?e.getAttribute(t):(s=e.getAttributeNode(t))&&s.specified?s.value:null},st.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},st.uniqueSort=function(e){var t,r=[],i=0,s=0;c=!n.detectDuplicates,l=!n.sortStable&&e.slice(0),e.sort(k);if(c){while(t=e[s++])t===e[s]&&(i=r.push(s));while(i--)e.splice(r[i],1)}return l=null,e},i=st.getText=function(e){var t,n="",r=0,s=e.nodeType;if(!s)while(t=e[r++])n+=i(t);else if(s===1||s===9||s===11){if(typeof e.textContent=="string")return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=i(e)}else if(s===3||s===4)return e.nodeValue;return n},r=st.selectors={cacheLength:50,createPseudo:ut,match:J,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(tt,nt),e[3]=(e[3]||e[4]||e[5]||"").replace(tt,nt),e[2]==="~="&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),e[1].slice(0,3)==="nth"?(e[3]||st.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*(e[3]==="even"||e[3]==="odd")),e[5]=+(e[7]+e[8]||e[3]==="odd")):e[3]&&st.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return J.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&V.test(n)&&(t=o(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(tt,nt).toLowerCase();return e==="*"?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=T[e+" "];return t||(t=new RegExp("(^|"+j+")"+e+"("+j+"|$)"))&&T(e,function(e){return t.test(typeof e.className=="string"&&e.className||typeof e.getAttribute!="undefined"&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=st.attr(r,e);return i==null?t==="!=":t?(i+="",t==="="?i===n:t==="!="?i!==n:t==="^="?n&&i.indexOf(n)===0:t==="*="?n&&i.indexOf(n)>-1:t==="$="?n&&i.slice(-n.length)===n:t==="~="?(" "+i.replace(R," ")+" ").indexOf(n)>-1:t==="|="?i===n||i.slice(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,r,i){var s=e.slice(0,3)!=="nth",o=e.slice(-4)!=="last",u=t==="of-type";return r===1&&i===0?function(e){return!!e.parentNode}:function(t,n,a){var f,l,c,h,p,d,v=s!==o?"nextSibling":"previousSibling",m=t.parentNode,g=u&&t.nodeName.toLowerCase(),y=!a&&!u,b=!1;if(m){if(s){while(v){h=t;while(h=h[v])if(u?h.nodeName.toLowerCase()===g:h.nodeType===1)return!1;d=v=e==="only"&&!d&&"nextSibling"}return!0}d=[o?m.firstChild:m.lastChild];if(o&&y){h=m,c=h[w]||(h[w]={}),l=c[h.uniqueID]||(c[h.uniqueID]={}),f=l[e]||[],p=f[0]===S&&f[1],b=p&&f[2],h=p&&m.childNodes[p];while(h=++p&&h&&h[v]||(b=p=0)||d.pop())if(h.nodeType===1&&++b&&h===t){l[e]=[S,p,b];break}}else{y&&(h=t,c=h[w]||(h[w]={}),l=c[h.uniqueID]||(c[h.uniqueID]={}),f=l[e]||[],p=f[0]===S&&f[1],b=p);if(b===!1)while(h=++p&&h&&h[v]||(b=p=0)||d.pop())if((u?h.nodeName.toLowerCase()===g:h.nodeType===1)&&++b){y&&(c=h[w]||(h[w]={}),l=c[h.uniqueID]||(c[h.uniqueID]={}),l[e]=[S,b]);if(h===t)break}}return b-=i,b===r||b%r===0&&b/r>=0}}},PSEUDO:function(e,t){var n,i=r.pseudos[e]||r.setFilters[e.toLowerCase()]||st.error("unsupported pseudo: "+e);return i[w]?i(t):i.length>1?(n=[e,e,"",t],r.setFilters.hasOwnProperty(e.toLowerCase())?ut(function(e,n){var r,s=i(e,t),o=s.length;while(o--)r=H(e,s[o]),e[r]=!(n[r]=s[o])}):function(e){return i(e,0,n)}):i}},pseudos:{not:ut(function(e){var t=[],n=[],r=u(e.replace(U,"$1"));return r[w]?ut(function(e,t,n,i){var s,o=r(e,null,i,[]),u=e.length;while(u--)if(s=o[u])e[u]=!(t[u]=s)}):function(e,i,s){return t[0]=e,r(t,null,s,n),t[0]=null,!n.pop()}}),has:ut(function(e){return function(t){return st(e,t).length>0}}),contains:ut(function(e){return e=e.replace(tt,nt),function(t){return(t.textContent||t.innerText||i(t)).indexOf(e)>-1}}),lang:ut(function(e){return $.test(e||"")||st.error("unsupported lang: "+e),e=e.replace(tt,nt).toLowerCase(),function(t){var n;do if(n=v?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return n=n.toLowerCase(),n===e||n.indexOf(e+"-")===0;while((t=t.parentNode)&&t.nodeType===1);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===d},focus:function(e){return e===p.activeElement&&(!p.hasFocus||p.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return t==="input"&&!!e.checked||t==="option"&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!r.pseudos.empty(e)},header:function(e){return Q.test(e.nodeName)},input:function(e){return K.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return t==="input"&&e.type==="button"||t==="button"},text:function(e){var t;return e.nodeName.toLowerCase()==="input"&&e.type==="text"&&((t=e.getAttribute("type"))==null||t.toLowerCase()==="text")},first:pt(function(){return[0]}),last:pt(function(e,t){return[t-1]}),eq:pt(function(e,t,n){return[n<0?n+t:n]}),even:pt(function(e,t){var n=0;for(;n<t;n+=2)e.push(n);return e}),odd:pt(function(e,t){var n=1;for(;n<t;n+=2)e.push(n);return e}),lt:pt(function(e,t,n){var r=n<0?n+t:n;for(;--r>=0;)e.push(r);return e}),gt:pt(function(e,t,n){var r=n<0?n+t:n;for(;++r<t;)e.push(r);return e})}},r.pseudos.nth=r.pseudos.eq;for(t in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})r.pseudos[t]=ct(t);for(t in{submit:!0,reset:!0})r.pseudos[t]=ht(t);return vt.prototype=r.filters=r.pseudos,r.setFilters=new vt,o=st.tokenize=function(e,t){var n,i,s,o,u,a,f,l=N[e+" "];if(l)return t?0:l.slice(0);u=e,a=[],f=r.preFilter;while(u){if(!n||(i=z.exec(u)))i&&(u=u.slice(i[0].length)||u),a.push(s=[]);n=!1;if(i=W.exec(u))n=i.shift(),s.push({value:n,type:i[0].replace(U," ")}),u=u.slice(n.length);for(o in r.filter)(i=J[o].exec(u))&&(!f[o]||(i=f[o](i)))&&(n=i.shift(),s.push({value:n,type:o,matches:i}),u=u.slice(n.length));if(!n)break}return t?u.length:u?st.error(e):N(e,a).slice(0)},u=st.compile=function(e,t){var n,r=[],i=[],s=C[e+" "];if(!s){t||(t=o(e)),n=t.length;while(n--)s=St(t[n]),s[w]?r.push(s):i.push(s);s=C(e,xt(i,r)),s.selector=e}return s},a=st.select=function(e,t,i,s){var a,f,l,c,h,p=typeof e=="function"&&e,d=!s&&o(e=p.selector||e);i=i||[];if(d.length===1){f=d[0]=d[0].slice(0);if(f.length>2&&(l=f[0]).type==="ID"&&n.getById&&t.nodeType===9&&v&&r.relative[f[1].type]){t=(r.find.ID(l.matches[0].replace(tt,nt),t)||[])[0];if(!t)return i;p&&(t=t.parentNode),e=e.slice(f.shift().value.length)}a=J.needsContext.test(e)?0:f.length;while(a--){l=f[a];if(r.relative[c=l.type])break;if(h=r.find[c])if(s=h(l.matches[0].replace(tt,nt),Z.test(f[0].type)&&dt(t.parentNode)||t)){f.splice(a,1),e=s.length&&mt(f);if(!e)return D.apply(i,s),i;break}}}return(p||u(e,d))(s,t,!v,i,!t||Z.test(e)&&dt(t.parentNode)||t),i},n.sortStable=w.split("").sort(k).join("")===w,n.detectDuplicates=!!c,h(),n.sortDetached=at(function(e){return e.compareDocumentPosition(p.createElement("div"))&1}),at(function(e){return e.innerHTML="<a href='#'></a>",e.firstChild.getAttribute("href")==="#"})||ft("type|href|height|width",function(e,t,n){if(!n)return e.getAttribute(t,t.toLowerCase()==="type"?1:2)}),(!n.attributes||!at(function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),e.firstChild.getAttribute("value")===""}))&&ft("value",function(e,t,n){if(!n&&e.nodeName.toLowerCase()==="input")return e.defaultValue}),at(function(e){return e.getAttribute("disabled")==null})||ft(B,function(e,t,n){var r;if(!n)return e[t]===!0?t.toLowerCase():(r=e.getAttributeNode(t))&&r.specified?r.value:null}),st}(window);jQuery.find=Sizzle,jQuery.expr=Sizzle.selectors,jQuery.expr[":"]=jQuery.expr.pseudos,jQuery.uniqueSort=jQuery.unique=Sizzle.uniqueSort,jQuery.text=Sizzle.getText,jQuery.isXMLDoc=Sizzle.isXML,jQuery.contains=Sizzle.contains;var dir=function(e,t,n){var r=[],i=n!==undefined;while((e=e[t])&&e.nodeType!==9)if(e.nodeType===1){if(i&&jQuery(e).is(n))break;r.push(e)}return r},siblings=function(e,t){var n=[];for(;e;e=e.nextSibling)e.nodeType===1&&e!==t&&n.push(e);return n},rneedsContext=jQuery.expr.match.needsContext,rsingleTag=/^<([\w-]+)\s*\/?>(?:<\/\1>|)$/,risSimple=/^.[^:#\[\.,]*$/;jQuery.filter=function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),t.length===1&&r.nodeType===1?jQuery.find.matchesSelector(r,e)?[r]:[]:jQuery.find.matches(e,jQuery.grep(t,function(e){return e.nodeType===1}))},jQuery.fn.extend({find:function(e){var t,n=this.length,r=[],i=this;if(typeof e!="string")return this.pushStack(jQuery(e).filter(function(){for(t=0;t<n;t++)if(jQuery.contains(i[t],this))return!0}));for(t=0;t<n;t++)jQuery.find(e,i[t],r);return r=this.pushStack(n>1?jQuery.unique(r):r),r.selector=this.selector?this.selector+" "+e:e,r},filter:function(e){return this.pushStack(winnow(this,e||[],!1))},not:function(e){return this.pushStack(winnow(this,e||[],!0))},is:function(e){return!!winnow(this,typeof e=="string"&&rneedsContext.test(e)?jQuery(e):e||[],!1).length}});var rootjQuery,rquickExpr=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,init=jQuery.fn.init=function(e,t,n){var r,i;if(!e)return this;n=n||rootjQuery;if(typeof e=="string"){e[0]==="<"&&e[e.length-1]===">"&&e.length>=3?r=[null,e,null]:r=rquickExpr.exec(e);if(r&&(r[1]||!t)){if(r[1]){t=t instanceof jQuery?t[0]:t,jQuery.merge(this,jQuery.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:document,!0));if(rsingleTag.test(r[1])&&jQuery.isPlainObject(t))for(r in t)jQuery.isFunction(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return i=document.getElementById(r[2]),i&&i.parentNode&&(this.length=1,this[0]=i),this.context=document,this.selector=e,this}return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e)}return e.nodeType?(this.context=this[0]=e,this.length=1,this):jQuery.isFunction(e)?n.ready!==undefined?n.ready(e):e(jQuery):(e.selector!==undefined&&(this.selector=e.selector,this.context=e.context),jQuery.makeArray(e,this))};init.prototype=jQuery.fn,rootjQuery=jQuery(document);var rparentsprev=/^(?:parents|prev(?:Until|All))/,guaranteedUnique={children:!0,contents:!0,next:!0,prev:!0};jQuery.fn.extend({has:function(e){var t=jQuery(e,this),n=t.length;return this.filter(function(){var e=0;for(;e<n;e++)if(jQuery.contains(this,t[e]))return!0})},closest:function(e,t){var n,r=0,i=this.length,s=[],o=rneedsContext.test(e)||typeof e!="string"?jQuery(e,t||this.context):0;for(;r<i;r++)for(n=this[r];n&&n!==t;n=n.parentNode)if(n.nodeType<11&&(o?o.index(n)>-1:n.nodeType===1&&jQuery.find.matchesSelector(n,e))){s.push(n);break}return this.pushStack(s.length>1?jQuery.uniqueSort(s):s)},index:function(e){return e?typeof e=="string"?indexOf.call(jQuery(e),this[0]):indexOf.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(jQuery.uniqueSort(jQuery.merge(this.get(),jQuery(e,t))))},addBack:function(e){return this.add(e==null?this.prevObject:this.prevObject.filter(e))}}),jQuery.each({parent:function(e){var t=e.parentNode;return t&&t.nodeType!==11?t:null},parents:function(e){return dir(e,"parentNode")},parentsUntil:function(e,t,n){return dir(e,"parentNode",n)},next:function(e){return sibling(e,"nextSibling")},prev:function(e){return sibling(e,"previousSibling")},nextAll:function(e){return dir(e,"nextSibling")},prevAll:function(e){return dir(e,"previousSibling")},nextUntil:function(e,t,n){return dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return dir(e,"previousSibling",n)},siblings:function(e){return siblings((e.parentNode||{}).firstChild,e)},children:function(e){return siblings(e.firstChild)},contents:function(e){return e.contentDocument||jQuery.merge([],e.childNodes)}},function(e,t){jQuery.fn[e]=function(n,r){var i=jQuery.map(this,t,n);return e.slice(-5)!=="Until"&&(r=n),r&&typeof r=="string"&&(i=jQuery.filter(r,i)),this.length>1&&(guaranteedUnique[e]||jQuery.uniqueSort(i),rparentsprev.test(e)&&i.reverse()),this.pushStack(i)}});var rnotwhite=/\S+/g;jQuery.Callbacks=function(e){e=typeof e=="string"?createOptions(e):jQuery.extend({},e);var t,n,r,i,s=[],o=[],u=-1,a=function(){i=e.once,r=t=!0;for(;o.length;u=-1){n=o.shift();while(++u<s.length)s[u].apply(n[0],n[1])===!1&&e.stopOnFalse&&(u=s.length,n=!1)}e.memory||(n=!1),t=!1,i&&(n?s=[]:s="")},f={add:function(){return s&&(n&&!t&&(u=s.length-1,o.push(n)),function r(t){jQuery.each(t,function(t,n){jQuery.isFunction(n)?(!e.unique||!f.has(n))&&s.push(n):n&&n.length&&jQuery.type(n)!=="string"&&r(n)})}(arguments),n&&!t&&a()),this},remove:function(){return jQuery.each(arguments,function(e,t){var n;while((n=jQuery.inArray(t,s,n))>-1)s.splice(n,1),n<=u&&u--}),this},has:function(e){return e?jQuery.inArray(e,s)>-1:s.length>0},empty:function(){return s&&(s=[]),this},disable:function(){return i=o=[],s=n="",this},disabled:function(){return!s},lock:function(){return i=o=[],n||(s=n=""),this},locked:function(){return!!i},fireWith:function(e,n){return i||(n=n||[],n=[e,n.slice?n.slice():n],o.push(n),t||a()),this},fire:function(){return f.fireWith(this,arguments),this},fired:function(){return!!r}};return f},jQuery.extend({Deferred:function(e){var t=[["resolve","done",jQuery.Callbacks("once memory"),"resolved"],["reject","fail",jQuery.Callbacks("once memory"),"rejected"],["notify","progress",jQuery.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return jQuery.Deferred(function(n){jQuery.each(t,function(t,s){var o=jQuery.isFunction(e[t])&&e[t];i[s[1]](function(){var e=o&&o.apply(this,arguments);e&&jQuery.isFunction(e.promise)?e.promise().progress(n.notify).done(n.resolve).fail(n.reject):n[s[0]+"With"](this===r?n.promise():this,o?[e]:arguments)})}),e=null}).promise()},promise:function(e){return e!=null?jQuery.extend(e,r):r}},i={};return r.pipe=r.then,jQuery.each(t,function(e,s){var o=s[2],u=s[3];r[s[1]]=o.add,u&&o.add(function(){n=u},t[e^1][2].disable,t[2][2].lock),i[s[0]]=function(){return i[s[0]+"With"](this===i?r:this,arguments),this},i[s[0]+"With"]=o.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=slice.call(arguments),r=n.length,i=r!==1||e&&jQuery.isFunction(e.promise)?r:0,s=i===1?e:jQuery.Deferred(),o=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?slice.call(arguments):r,n===u?s.notifyWith(t,n):--i||s.resolveWith(t,n)}},u,a,f;if(r>1){u=new Array(r),a=new Array(r),f=new Array(r);for(;t<r;t++)n[t]&&jQuery.isFunction(n[t].promise)?n[t].promise().progress(o(t,a,u)).done(o(t,f,n)).fail(s.reject):--i}return i||s.resolveWith(f,n),s.promise()}});var readyList;jQuery.fn.ready=function(e){return jQuery.ready.promise().done(e),this},jQuery.extend({isReady:!1,readyWait:1,holdReady:function(e){e?jQuery.readyWait++:jQuery.ready(!0)},ready:function(e){if(e===!0?--jQuery.readyWait:jQuery.isReady)return;jQuery.isReady=!0;if(e!==!0&&--jQuery.readyWait>0)return;readyList.resolveWith(document,[jQuery]),jQuery.fn.triggerHandler&&(jQuery(document).triggerHandler("ready"),jQuery(document).off("ready"))}}),jQuery.ready.promise=function(e){return readyList||(readyList=jQuery.Deferred(),document.readyState==="complete"||document.readyState!=="loading"&&!document.documentElement.doScroll?window.setTimeout(jQuery.ready):(document.addEventListener("DOMContentLoaded",completed),window.addEventListener("load",completed))),readyList.promise(e)},jQuery.ready.promise();var access=function(e,t,n,r,i,s,o){var u=0,a=e.length,f=n==null;if(jQuery.type(n)==="object"){i=!0;for(u in n)access(e,t,u,n[u],!0,s,o)}else if(r!==undefined){i=!0,jQuery.isFunction(r)||(o=!0),f&&(o?(t.call(e,r),t=null):(f=t,t=function(e,t,n){return f.call(jQuery(e),n)}));if(t)for(;u<a;u++)t(e[u],n,o?r:r.call(e[u],u,t(e[u],n)))}return i?e:f?t.call(e):a?t(e[0],n):s},acceptData=function(e){return e.nodeType===1||e.nodeType===9||!+e.nodeType};Data.uid=1,Data.prototype={register:function(e,t){var n=t||{};return e.nodeType?e[this.expando]=n:Object.defineProperty(e,this.expando,{value:n,writable:!0,configurable:!0}),e[this.expando]},cache:function(e){if(!acceptData(e))return{};var t=e[this.expando];return t||(t={},acceptData(e)&&(e.nodeType?e[this.expando]=t:Object.defineProperty(e,this.expando,{value:t,configurable:!0}))),t},set:function(e,t,n){var r,i=this.cache(e);if(typeof t=="string")i[t]=n;else for(r in t)i[r]=t[r];return i},get:function(e,t){return t===undefined?this.cache(e):e[this.expando]&&e[this.expando][t]},access:function(e,t,n){var r;return t===undefined||t&&typeof t=="string"&&n===undefined?(r=this.get(e,t),r!==undefined?r:this.get(e,jQuery.camelCase(t))):(this.set(e,t,n),n!==undefined?n:t)},remove:function(e,t){var n,r,i,s=e[this.expando];if(s===undefined)return;if(t===undefined)this.register(e);else{jQuery.isArray(t)?r=t.concat(t.map(jQuery.camelCase)):(i=jQuery.camelCase(t),t in s?r=[t,i]:(r=i,r=r in s?[r]:r.match(rnotwhite)||[])),n=r.length;while(n--)delete s[r[n]]}if(t===undefined||jQuery.isEmptyObject(s))e.nodeType?e[this.expando]=undefined:delete e[this.expando]},hasData:function(e){var t=e[this.expando];return t!==undefined&&!jQuery.isEmptyObject(t)}};var dataPriv=new Data,dataUser=new Data,rbrace=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,rmultiDash=/[A-Z]/g;jQuery.extend({hasData:function(e){return dataUser.hasData(e)||dataPriv.hasData(e)},data:function(e,t,n){return dataUser.access(e,t,n)},removeData:function(e,t){dataUser.remove(e,t)},_data:function(e,t,n){return dataPriv.access(e,t,n)},_removeData:function(e,t){dataPriv.remove(e,t)}}),jQuery.fn.extend({data:function(e,t){var n,r,i,s=this[0],o=s&&s.attributes;if(e===undefined){if(this.length){i=dataUser.get(s);if(s.nodeType===1&&!dataPriv.get(s,"hasDataAttrs")){n=o.length;while(n--)o[n]&&(r=o[n].name,r.indexOf("data-")===0&&(r=jQuery.camelCase(r.slice(5)),dataAttr(s,r,i[r])));dataPriv.set(s,"hasDataAttrs",!0)}}return i}return typeof e=="object"?this.each(function(){dataUser.set(this,e)}):access(this,function(t){var n,r;if(s&&t===undefined){n=dataUser.get(s,e)||dataUser.get(s,e.replace(rmultiDash,"-$&").toLowerCase());if(n!==undefined)return n;r=jQuery.camelCase(e),n=dataUser.get(s,r);if(n!==undefined)return n;n=dataAttr(s,r,undefined);if(n!==undefined)return n;return}r=jQuery.camelCase(e),this.each(function(){var n=dataUser.get(this,r);dataUser.set(this,r,t),e.indexOf("-")>-1&&n!==undefined&&dataUser.set(this,e,t)})},null,t,arguments.length>1,null,!0)},removeData:function(e){return this.each(function(){dataUser.remove(this,e)})}}),jQuery.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=dataPriv.get(e,t),n&&(!r||jQuery.isArray(n)?r=dataPriv.access(e,t,jQuery.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=jQuery.queue(e,t),r=n.length,i=n.shift(),s=jQuery._queueHooks(e,t),o=function(){jQuery.dequeue(e,t)};i==="inprogress"&&(i=n.shift(),r--),i&&(t==="fx"&&n.unshift("inprogress"),delete s.stop,i.call(e,o,s)),!r&&s&&s.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return dataPriv.get(e,n)||dataPriv.access(e,n,{empty:jQuery.Callbacks("once memory").add(function(){dataPriv.remove(e,[t+"queue",n])})})}}),jQuery.fn.extend({queue:function(e,t){var n=2;return typeof e!="string"&&(t=e,e="fx",n--),arguments.length<n?jQuery.queue(this[0],e):t===undefined?this:this.each(function(){var n=jQuery.queue(this,e,t);jQuery._queueHooks(this,e),e==="fx"&&n[0]!=="inprogress"&&jQuery.dequeue(this,e)})},dequeue:function(e){return this.each(function(){jQuery.dequeue(this,e)})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,t){var n,r=1,i=jQuery.Deferred(),s=this,o=this.length,u=function(){--r||i.resolveWith(s,[s])};typeof e!="string"&&(t=e,e=undefined),e=e||"fx";while(o--)n=dataPriv.get(s[o],e+"queueHooks"),n&&n.empty&&(r++,n.empty.add(u));return u(),i.promise(t)}});var pnum=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,rcssNum=new RegExp("^(?:([+-])=|)("+pnum+")([a-z%]*)$","i"),cssExpand=["Top","Right","Bottom","Left"],isHidden=function(e,t){return e=t||e,jQuery.css(e,"display")==="none"||!jQuery.contains(e.ownerDocument,e)},rcheckableType=/^(?:checkbox|radio)$/i,rtagName=/<([\w:-]+)/,rscriptType=/^$|\/(?:java|ecma)script/i,wrapMap={option:[1,"<select multiple='multiple'>","</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};wrapMap.optgroup=wrapMap.option,wrapMap.tbody=wrapMap.tfoot=wrapMap.colgroup=wrapMap.caption=wrapMap.thead,wrapMap.th=wrapMap.td;var rhtml=/<|&#?\w+;/;(function(){var e=document.createDocumentFragment(),t=e.appendChild(document.createElement("div")),n=document.createElement("input");n.setAttribute("type","radio"),n.setAttribute("checked","checked"),n.setAttribute("name","t"),t.appendChild(n),support.checkClone=t.cloneNode(!0).cloneNode(!0).lastChild.checked,t.innerHTML="<textarea>x</textarea>",support.noCloneChecked=!!t.cloneNode(!0).lastChild.defaultValue})();var rkeyEvent=/^key/,rmouseEvent=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,rtypenamespace=/^([^.]*)(?:\.(.+)|)/;jQuery.event={global:{},add:function(e,t,n,r,i){var s,o,u,a,f,l,c,h,p,d,v,m=dataPriv.get(e);if(!m)return;n.handler&&(s=n,n=s.handler,i=s.selector),n.guid||(n.guid=jQuery.guid++),(a=m.events)||(a=m.events={}),(o=m.handle)||(o=m.handle=function(t){return typeof jQuery!="undefined"&&jQuery.event.triggered!==t.type?jQuery.event.dispatch.apply(e,arguments):undefined}),t=(t||"").match(rnotwhite)||[""],f=t.length;while(f--){u=rtypenamespace.exec(t[f])||[],p=v=u[1],d=(u[2]||"").split(".").sort();if(!p)continue;c=jQuery.event.special[p]||{},p=(i?c.delegateType:c.bindType)||p,c=jQuery.event.special[p]||{},l=jQuery.extend({type:p,origType:v,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&jQuery.expr.match.needsContext.test(i),namespace:d.join(".")},s),(h=a[p])||(h=a[p]=[],h.delegateCount=0,(!c.setup||c.setup.call(e,r,d,o)===!1)&&e.addEventListener&&e.addEventListener(p,o)),c.add&&(c.add.call(e,l),l.handler.guid||(l.handler.guid=n.guid)),i?h.splice(h.delegateCount++,0,l):h.push(l),jQuery.event.global[p]=!0}},remove:function(e,t,n,r,i){var s,o,u,a,f,l,c,h,p,d,v,m=dataPriv.hasData(e)&&dataPriv.get(e);if(!m||!(a=m.events))return;t=(t||"").match(rnotwhite)||[""],f=t.length;while(f--){u=rtypenamespace.exec(t[f])||[],p=v=u[1],d=(u[2]||"").split(".").sort();if(!p){for(p in a)jQuery.event.remove(e,p+t[f],n,r,!0);continue}c=jQuery.event.special[p]||{},p=(r?c.delegateType:c.bindType)||p,h=a[p]||[],u=u[2]&&new RegExp("(^|\\.)"+d.join("\\.(?:.*\\.|)")+"(\\.|$)"),o=s=h.length;while(s--)l=h[s],(i||v===l.origType)&&(!n||n.guid===l.guid)&&(!u||u.test(l.namespace))&&(!r||r===l.selector||r==="**"&&l.selector)&&(h.splice(s,1),l.selector&&h.delegateCount--,c.remove&&c.remove.call(e,l));o&&!h.length&&((!c.teardown||c.teardown.call(e,d,m.handle)===!1)&&jQuery.removeEvent(e,p,m.handle),delete a[p])}jQuery.isEmptyObject(a)&&dataPriv.remove(e,"handle events")},dispatch:function(e){e=jQuery.event.fix(e);var t,n,r,i,s,o=[],u=slice.call(arguments),a=(dataPriv.get(this,"events")||{})[e.type]||[],f=jQuery.event.special[e.type]||{};u[0]=e,e.delegateTarget=this;if(f.preDispatch&&f.preDispatch.call(this,e)===!1)return;o=jQuery.event.handlers.call(this,e,a),t=0;while((i=o[t++])&&!e.isPropagationStopped()){e.currentTarget=i.elem,n=0;while((s=i.handlers[n++])&&!e.isImmediatePropagationStopped())if(!e.rnamespace||e.rnamespace.test(s.namespace))e.handleObj=s,e.data=s.data,r=((jQuery.event.special[s.origType]||{}).handle||s.handler).apply(i.elem,u),r!==undefined&&(e.result=r)===!1&&(e.preventDefault(),e.stopPropagation())}return f.postDispatch&&f.postDispatch.call(this,e),e.result},handlers:function(e,t){var n,r,i,s,o=[],u=t.delegateCount,a=e.target;if(u&&a.nodeType&&(e.type!=="click"||isNaN(e.button)||e.button<1))for(;a!==this;a=a.parentNode||this)if(a.nodeType===1&&(a.disabled!==!0||e.type!=="click")){r=[];for(n=0;n<u;n++)s=t[n],i=s.selector+" ",r[i]===undefined&&(r[i]=s.needsContext?jQuery(i,this).index(a)>-1:jQuery.find(i,this,null,[a]).length),r[i]&&r.push(s);r.length&&o.push({elem:a,handlers:r})}return u<t.length&&o.push({elem:this,handlers:t.slice(u)}),o},props:"altKey bubbles cancelable ctrlKey currentTarget detail eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return e.which==null&&(e.which=t.charCode!=null?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,t){var n,r,i,s=t.button;return e.pageX==null&&t.clientX!=null&&(n=e.target.ownerDocument||document,r=n.documentElement,i=n.body,e.pageX=t.clientX+(r&&r.scrollLeft||i&&i.scrollLeft||0)-(r&&r.clientLeft||i&&i.clientLeft||0),e.pageY=t.clientY+(r&&r.scrollTop||i&&i.scrollTop||0)-(r&&r.clientTop||i&&i.clientTop||0)),!e.which&&s!==undefined&&(e.which=s&1?1:s&2?3:s&4?2:0),e}},fix:function(e){if(e[jQuery.expando])return e;var t,n,r,i=e.type,s=e,o=this.fixHooks[i];o||(this.fixHooks[i]=o=rmouseEvent.test(i)?this.mouseHooks:rkeyEvent.test(i)?this.keyHooks:{}),r=o.props?this.props.concat(o.props):this.props,e=new jQuery.Event(s),t=r.length;while(t--)n=r[t],e[n]=s[n];return e.target||(e.target=document),e.target.nodeType===3&&(e.target=e.target.parentNode),o.filter?o.filter(e,s):e},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==safeActiveElement()&&this.focus)return this.focus(),!1},delegateType:"focusin"},blur:{trigger:function(){if(this===safeActiveElement()&&this.blur)return this.blur(),!1},delegateType:"focusout"},click:{trigger:function(){if(this.type==="checkbox"&&this.click&&jQuery.nodeName(this,"input"))return this.click(),!1},_default:function(e){return jQuery.nodeName(e.target,"a")}},beforeunload:{postDispatch:function(e){e.result!==undefined&&e.originalEvent&&(e.originalEvent.returnValue=e.result)}}}},jQuery.removeEvent=function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n)},jQuery.Event=function(e,t){if(!(this instanceof jQuery.Event))return new jQuery.Event(e,t);e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.defaultPrevented===undefined&&e.returnValue===!1?returnTrue:returnFalse):this.type=e,t&&jQuery.extend(this,t),this.timeStamp=e&&e.timeStamp||jQuery.now(),this[jQuery.expando]=!0},jQuery.Event.prototype={constructor:jQuery.Event,isDefaultPrevented:returnFalse,isPropagationStopped:returnFalse,isImmediatePropagationStopped:returnFalse,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=returnTrue,e&&e.preventDefault()},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=returnTrue,e&&e.stopPropagation()},stopImmediatePropagation:function(){var e=this.originalEvent;this.isImmediatePropagationStopped=returnTrue,e&&e.stopImmediatePropagation(),this.stopPropagation()}},jQuery.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(e,t){jQuery.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,s=e.handleObj;if(!i||i!==r&&!jQuery.contains(r,i))e.type=s.origType,n=s.handler.apply(this,arguments),e.type=t;return n}}}),jQuery.fn.extend({on:function(e,t,n,r){return on(this,e,t,n,r)},one:function(e,t,n,r){return on(this,e,t,n,r,1)},off:function(e,t,n){var r,i;if(e&&e.preventDefault&&e.handleObj)return r=e.handleObj,jQuery(e.delegateTarget).off(r.namespace?r.origType+"."+r.namespace:r.origType,r.selector,r.handler),this;if(typeof e=="object"){for(i in e)this.off(i,t,e[i]);return this}if(t===!1||typeof t=="function")n=t,t=undefined;return n===!1&&(n=returnFalse),this.each(function(){jQuery.event.remove(this,e,n,t)})}});var rxhtmlTag=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi,rnoInnerhtml=/<script|<style|<link/i,rchecked=/checked\s*(?:[^=]|=\s*.checked.)/i,rscriptTypeMasked=/^true\/(.*)/,rcleanScript=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;jQuery.extend({htmlPrefilter:function(e){return e.replace(rxhtmlTag,"<$1></$2>")},clone:function(e,t,n){var r,i,s,o,u=e.cloneNode(!0),a=jQuery.contains(e.ownerDocument,e);if(!support.noCloneChecked&&(e.nodeType===1||e.nodeType===11)&&!jQuery.isXMLDoc(e)){o=getAll(u),s=getAll(e);for(r=0,i=s.length;r<i;r++)fixInput(s[r],o[r])}if(t)if(n){s=s||getAll(e),o=o||getAll(u);for(r=0,i=s.length;r<i;r++)cloneCopyEvent(s[r],o[r])}else cloneCopyEvent(e,u);return o=getAll(u,"script"),o.length>0&&setGlobalEval(o,!a&&getAll(e,"script")),u},cleanData:function(e){var t,n,r,i=jQuery.event.special,s=0;for(;(n=e[s])!==undefined;s++)if(acceptData(n)){if(t=n[dataPriv.expando]){if(t.events)for(r in t.events)i[r]?jQuery.event.remove(n,r):jQuery.removeEvent(n,r,t.handle);n[dataPriv.expando]=undefined}n[dataUser.expando]&&(n[dataUser.expando]=undefined)}}}),jQuery.fn.extend({domManip:domManip,detach:function(e){return remove(this,e,!0)},remove:function(e){return remove(this,e)},text:function(e){return access(this,function(e){return e===undefined?jQuery.text(this):this.empty().each(function(){if(this.nodeType===1||this.nodeType===11||this.nodeType===9)this.textContent=e})},null,e,arguments.length)},append:function(){return domManip(this,arguments,function(e){if(this.nodeType===1||this.nodeType===11||this.nodeType===9){var t=manipulationTarget(this,e);t.appendChild(e)}})},prepend:function(){return domManip(this,arguments,function(e){if(this.nodeType===1||this.nodeType===11||this.nodeType===9){var t=manipulationTarget(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return domManip(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return domManip(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},empty:function(){var e,t=0;for(;(e=this[t])!=null;t++)e.nodeType===1&&(jQuery.cleanData(getAll(e,!1)),e.textContent="");return this},clone:function(e,t){return e=e==null?!1:e,t=t==null?e:t,this.map(function(){return jQuery.clone(this,e,t)})},html:function(e){return access(this,function(e){var t=this[0]||{},n=0,r=this.length;if(e===undefined&&t.nodeType===1)return t.innerHTML;if(typeof e=="string"&&!rnoInnerhtml.test(e)&&!wrapMap[(rtagName.exec(e)||["",""])[1].toLowerCase()]){e=jQuery.htmlPrefilter(e);try{for(;n<r;n++)t=this[n]||{},t.nodeType===1&&(jQuery.cleanData(getAll(t,!1)),t.innerHTML=e);t=0}catch(i){}}t&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var e=[];return domManip(this,arguments,function(t){var n=this.parentNode;jQuery.inArray(this,e)<0&&(jQuery.cleanData(getAll(this)),n&&n.replaceChild(t,this))},e)}}),jQuery.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){jQuery.fn[e]=function(e){var n,r=[],i=jQuery(e),s=i.length-1,o=0;for(;o<=s;o++)n=o===s?this:this.clone(!0),jQuery(i[o])[t](n),push.apply(r,n.get());return this.pushStack(r)}});var iframe,elemdisplay={HTML:"block",BODY:"block"},rmargin=/^margin/,rnumnonpx=new RegExp("^("+pnum+")(?!px)[a-z%]+$","i"),getStyles=function(e){var t=e.ownerDocument.defaultView;if(!t||!t.opener)t=window;return t.getComputedStyle(e)},swap=function(e,t,n,r){var i,s,o={};for(s in t)o[s]=e.style[s],e.style[s]=t[s];i=n.apply(e,r||[]);for(s in t)e.style[s]=o[s];return i},documentElement=document.documentElement;(function(){function o(){s.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;position:relative;display:block;margin:auto;border:1px;padding:1px;top:1%;width:50%",s.innerHTML="",documentElement.appendChild(i);var o=window.getComputedStyle(s);e=o.top!=="1%",r=o.marginLeft==="2px",t=o.width==="4px",s.style.marginRight="50%",n=o.marginRight==="4px",documentElement.removeChild(i)}var e,t,n,r,i=document.createElement("div"),s=document.createElement("div");if(!s.style)return;s.style.backgroundClip="content-box",s.cloneNode(!0).style.backgroundClip="",support.clearCloneStyle=s.style.backgroundClip==="content-box",i.style.cssText="border:0;width:8px;height:0;top:0;left:-9999px;padding:0;margin-top:1px;position:absolute",i.appendChild(s),jQuery.extend(support,{pixelPosition:function(){return o(),e},boxSizingReliable:function(){return t==null&&o(),t},pixelMarginRight:function(){return t==null&&o(),n},reliableMarginLeft:function(){return t==null&&o(),r},reliableMarginRight:function(){var e,t=s.appendChild(document.createElement("div"));return t.style.cssText=s.style.cssText="-webkit-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",t.style.marginRight=t.style.width="0",s.style.width="1px",documentElement.appendChild(i),e=!parseFloat(window.getComputedStyle(t).marginRight),documentElement.removeChild(i),s.removeChild(t),e}})})();var rdisplayswap=/^(none|table(?!-c[ea]).+)/,cssShow={position:"absolute",visibility:"hidden",display:"block"},cssNormalTransform={letterSpacing:"0",fontWeight:"400"},cssPrefixes=["Webkit","O","Moz","ms"],emptyStyle=document.createElement("div").style;jQuery.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=curCSS(e,"opacity");return n===""?"1":n}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":"cssFloat"},style:function(e,t,n,r){if(!e||e.nodeType===3||e.nodeType===8||!e.style)return;var i,s,o,u=jQuery.camelCase(t),a=e.style;t=jQuery.cssProps[u]||(jQuery.cssProps[u]=vendorPropName(u)||u),o=jQuery.cssHooks[t]||jQuery.cssHooks[u];if(n===undefined)return o&&"get"in o&&(i=o.get(e,!1,r))!==undefined?i:a[t];s=typeof n,s==="string"&&(i=rcssNum.exec(n))&&i[1]&&(n=adjustCSS(e,t,i),s="number");if(n==null||n!==n)return;s==="number"&&(n+=i&&i[3]||(jQuery.cssNumber[u]?"":"px")),!support.clearCloneStyle&&n===""&&t.indexOf("background")===0&&(a[t]="inherit");if(!o||!("set"in o)||(n=o.set(e,n,r))!==undefined)a[t]=n},css:function(e,t,n,r){var i,s,o,u=jQuery.camelCase(t);return t=jQuery.cssProps[u]||(jQuery.cssProps[u]=vendorPropName(u)||u),o=jQuery.cssHooks[t]||jQuery.cssHooks[u],o&&"get"in o&&(i=o.get(e,!0,n)),i===undefined&&(i=curCSS(e,t,r)),i==="normal"&&t in cssNormalTransform&&(i=cssNormalTransform[t]),n===""||n?(s=parseFloat(i),n===!0||isFinite(s)?s||0:i):i}}),jQuery.each(["height","width"],function(e,t){jQuery.cssHooks[t]={get:function(e,n,r){if(n)return rdisplayswap.test(jQuery.css(e,"display"))&&e.offsetWidth===0?swap(e,cssShow,function(){return getWidthOrHeight(e,t,r)}):getWidthOrHeight(e,t,r)},set:function(e,n,r){var i,s=r&&getStyles(e),o=r&&augmentWidthOrHeight(e,t,r,jQuery.css(e,"boxSizing",!1,s)==="border-box",s);return o&&(i=rcssNum.exec(n))&&(i[3]||"px")!=="px"&&(e.style[t]=n,n=jQuery.css(e,t)),setPositiveNumber(e,n,o)}}}),jQuery.cssHooks.marginLeft=addGetHookIf(support.reliableMarginLeft,function(e,t){if(t)return(parseFloat(curCSS(e,"marginLeft"))||e.getBoundingClientRect().left-swap(e,{marginLeft:0},function(){return e.getBoundingClientRect().left}))+"px"}),jQuery.cssHooks.marginRight=addGetHookIf(support.reliableMarginRight,function(e,t){if(t)return swap(e,{display:"inline-block"},curCSS,[e,"marginRight"])}),jQuery.each({margin:"",padding:"",border:"Width"},function(e,t){jQuery.cssHooks[e+t]={expand:function(n){var r=0,i={},s=typeof n=="string"?n.split(" "):[n];for(;r<4;r++)i[e+cssExpand[r]+t]=s[r]||s[r-2]||s[0];return i}},rmargin.test(e)||(jQuery.cssHooks[e+t].set=setPositiveNumber)}),jQuery.fn.extend({css:function(e,t){return access(this,function(e,t,n){var r,i,s={},o=0;if(jQuery.isArray(t)){r=getStyles(e),i=t.length;for(;o<i;o++)s[t[o]]=jQuery.css(e,t[o],!1,r);return s}return n!==undefined?jQuery.style(e,t,n):jQuery.css(e,t)},e,t,arguments.length>1)},show:function(){return showHide(this,!0)},hide:function(){return showHide(this)},toggle:function(e){return typeof e=="boolean"?e?this.show():this.hide():this.each(function(){isHidden(this)?jQuery(this).show():jQuery(this).hide()})}}),jQuery.Tween=Tween,Tween.prototype={constructor:Tween,init:function(e,t,n,r,i,s){this.elem=e,this.prop=n,this.easing=i||jQuery.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=s||(jQuery.cssNumber[n]?"":"px")},cur:function(){var e=Tween.propHooks[this.prop];return e&&e.get?e.get(this):Tween.propHooks._default.get(this)},run:function(e){var t,n=Tween.propHooks[this.prop];return this.options.duration?this.pos=t=jQuery.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):Tween.propHooks._default.set(this),this}},Tween.prototype.init.prototype=Tween.prototype,Tween.propHooks={_default:{get:function(e){var t;return e.elem.nodeType!==1||e.elem[e.prop]!=null&&e.elem.style[e.prop]==null?e.elem[e.prop]:(t=jQuery.css(e.elem,e.prop,""),!t||t==="auto"?0:t)},set:function(e){jQuery.fx.step[e.prop]?jQuery.fx.step[e.prop](e):e.elem.nodeType!==1||e.elem.style[jQuery.cssProps[e.prop]]==null&&!jQuery.cssHooks[e.prop]?e.elem[e.prop]=e.now:jQuery.style(e.elem,e.prop,e.now+e.unit)}}},Tween.propHooks.scrollTop=Tween.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},jQuery.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},_default:"swing"},jQuery.fx=Tween.prototype.init,jQuery.fx.step={};var fxNow,timerId,rfxtypes=/^(?:toggle|show|hide)$/,rrun=/queueHooks$/;jQuery.Animation=jQuery.extend(Animation,{tweeners:{"*":[function(e,t){var n=this.createTween(e,t);return adjustCSS(n.elem,e,rcssNum.exec(t),n),n}]},tweener:function(e,t){jQuery.isFunction(e)?(t=e,e=["*"]):e=e.match(rnotwhite);var n,r=0,i=e.length;for(;r<i;r++)n=e[r],Animation.tweeners[n]=Animation.tweeners[n]||[],Animation.tweeners[n].unshift(t)},prefilters:[defaultPrefilter],prefilter:function(e,t){t?Animation.prefilters.unshift(e):Animation.prefilters.push(e)}}),jQuery.speed=function(e,t,n){var r=e&&typeof e=="object"?jQuery.extend({},e):{complete:n||!n&&t||jQuery.isFunction(e)&&e,duration:e,easing:n&&t||t&&!jQuery.isFunction(t)&&t};r.duration=jQuery.fx.off?0:typeof r.duration=="number"?r.duration:r.duration in jQuery.fx.speeds?jQuery.fx.speeds[r.duration]:jQuery.fx.speeds._default;if(r.queue==null||r.queue===!0)r.queue="fx";return r.old=r.complete,r.complete=function(){jQuery.isFunction(r.old)&&r.old.call(this),r.queue&&jQuery.dequeue(this,r.queue)},r},jQuery.fn.extend({fadeTo:function(e,t,n,r){return this.filter(isHidden).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=jQuery.isEmptyObject(e),s=jQuery.speed(t,n,r),o=function(){var t=Animation(this,jQuery.extend({},e),s);(i||dataPriv.get(this,"finish"))&&t.stop(!0)};return o.finish=o,i||s.queue===!1?this.each(o):this.queue(s.queue,o)},stop:function(e,t,n){var r=function(e){var t=e.stop;delete e.stop,t(n)};return typeof e!="string"&&(n=t,t=e,e=undefined),t&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,i=e!=null&&e+"queueHooks",s=jQuery.timers,o=dataPriv.get(this);if(i)o[i]&&o[i].stop&&r(o[i]);else for(i in o)o[i]&&o[i].stop&&rrun.test(i)&&r(o[i]);for(i=s.length;i--;)s[i].elem===this&&(e==null||s[i].queue===e)&&(s[i].anim.stop(n),t=!1,s.splice(i,1));(t||!n)&&jQuery.dequeue(this,e)})},finish:function(e){return e!==!1&&(e=e||"fx"),this.each(function(){var t,n=dataPriv.get(this),r=n[e+"queue"],i=n[e+"queueHooks"],s=jQuery.timers,o=r?r.length:0;n.finish=!0,jQuery.queue(this,e,[]),i&&i.stop&&i.stop.call(this,!0);for(t=s.length;t--;)s[t].elem===this&&s[t].queue===e&&(s[t].anim.stop(!0),s.splice(t,1));for(t=0;t<o;t++)r[t]&&r[t].finish&&r[t].finish.call(this);delete n.finish})}}),jQuery.each(["toggle","show","hide"],function(e,t){var n=jQuery.fn[t];jQuery.fn[t]=function(e,r,i){return e==null||typeof e=="boolean"?n.apply(this,arguments):this.animate(genFx(t,!0),e,r,i)}}),jQuery.each({slideDown:genFx("show"),slideUp:genFx("hide"),slideToggle:genFx("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){jQuery.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),jQuery.timers=[],jQuery.fx.tick=function(){var e,t=0,n=jQuery.timers;fxNow=jQuery.now();for(;t<n.length;t++)e=n[t],!e()&&n[t]===e&&n.splice(t--,1);n.length||jQuery.fx.stop(),fxNow=undefined},jQuery.fx.timer=function(e){jQuery.timers.push(e),e()?jQuery.fx.start():jQuery.timers.pop()},jQuery.fx.interval=13,jQuery.fx.start=function(){timerId||(timerId=window.setInterval(jQuery.fx.tick,jQuery.fx.interval))},jQuery.fx.stop=function(){window.clearInterval(timerId),timerId=null},jQuery.fx.speeds={slow:600,fast:200,_default:400},jQuery.fn.delay=function(e,t){return e=jQuery.fx?jQuery.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var r=window.setTimeout(t,e);n.stop=function(){window.clearTimeout(r)}})},function(){var e=document.createElement("input"),t=document.createElement("select"),n=t.appendChild(document.createElement("option"));e.type="checkbox",support.checkOn=e.value!=="",support.optSelected=n.selected,t.disabled=!0,support.optDisabled=!n.disabled,e=document.createElement("input"),e.value="t",e.type="radio",support.radioValue=e.value==="t"}();var boolHook,attrHandle=jQuery.expr.attrHandle;jQuery.fn.extend({attr:function(e,t){return access(this,jQuery.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){jQuery.removeAttr(this,e)})}}),jQuery.extend({attr:function(e,t,n){var r,i,s=e.nodeType;if(s===3||s===8||s===2)return;if(typeof e.getAttribute=="undefined")return jQuery.prop(e,t,n);if(s!==1||!jQuery.isXMLDoc(e))t=t.toLowerCase(),i=jQuery.attrHooks[t]||(jQuery.expr.match.bool.test(t)?boolHook:undefined);if(n!==undefined){if(n===null){jQuery.removeAttr(e,t);return}return i&&"set"in i&&(r=i.set(e,n,t))!==undefined?r:(e.setAttribute(t,n+""),n)}return i&&"get"in i&&(r=i.get(e,t))!==null?r:(r=jQuery.find.attr(e,t),r==null?undefined:r)},attrHooks:{type:{set:function(e,t){if(!support.radioValue&&t==="radio"&&jQuery.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},removeAttr:function(e,t){var n,r,i=0,s=t&&t.match(rnotwhite);if(s&&e.nodeType===1)while(n=s[i++])r=jQuery.propFix[n]||n,jQuery.expr.match.bool.test(n)&&(e[r]=!1),e.removeAttribute(n)}}),boolHook={set:function(e,t,n){return t===!1?jQuery.removeAttr(e,n):e.setAttribute(n,n),n}},jQuery.each(jQuery.expr.match.bool.source.match(/\w+/g),function(e,t){var n=attrHandle[t]||jQuery.find.attr;attrHandle[t]=function(e,t,r){var i,s;return r||(s=attrHandle[t],attrHandle[t]=i,i=n(e,t,r)!=null?t.toLowerCase():null,attrHandle[t]=s),i}});var rfocusable=/^(?:input|select|textarea|button)$/i,rclickable=/^(?:a|area)$/i;jQuery.fn.extend({prop:function(e,t){return access(this,jQuery.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each(function(){delete this[jQuery.propFix[e]||e]})}}),jQuery.extend({prop:function(e,t,n){var r,i,s=e.nodeType;if(s===3||s===8||s===2)return;if(s!==1||!jQuery.isXMLDoc(e))t=jQuery.propFix[t]||t,i=jQuery.propHooks[t];return n!==undefined?i&&"set"in i&&(r=i.set(e,n,t))!==undefined?r:e[t]=n:i&&"get"in i&&(r=i.get(e,t))!==null?r:e[t]},propHooks:{tabIndex:{get:function(e){var t=jQuery.find.attr(e,"tabindex");return t?parseInt(t,10):rfocusable.test(e.nodeName)||rclickable.test(e.nodeName)&&e.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),support.optSelected||(jQuery.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null},set:function(e){var t=e.parentNode;t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex)}}),jQuery.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){jQuery.propFix[this.toLowerCase()]=this});var rclass=/[\t\r\n\f]/g;jQuery.fn.extend({addClass:function(e){var t,n,r,i,s,o,u,a=0;if(jQuery.isFunction(e))return this.each(function(t){jQuery(this).addClass(e.call(this,t,getClass(this)))});if(typeof e=="string"&&e){t=e.match(rnotwhite)||[];while(n=this[a++]){i=getClass(n),r=n.nodeType===1&&(" "+i+" ").replace(rclass," ");if(r){o=0;while(s=t[o++])r.indexOf(" "+s+" ")<0&&(r+=s+" ");u=jQuery.trim(r),i!==u&&n.setAttribute("class",u)}}}return this},removeClass:function(e){var t,n,r,i,s,o,u,a=0;if(jQuery.isFunction(e))return this.each(function(t){jQuery(this).removeClass(e.call(this,t,getClass(this)))});if(!arguments.length)return this.attr("class","");if(typeof e=="string"&&e){t=e.match(rnotwhite)||[];while(n=this[a++]){i=getClass(n),r=n.nodeType===1&&(" "+i+" ").replace(rclass," ");if(r){o=0;while(s=t[o++])while(r.indexOf(" "+s+" ")>-1)r=r.replace(" "+s+" "," ");u=jQuery.trim(r),i!==u&&n.setAttribute("class",u)}}}return this},toggleClass:function(e,t){var n=typeof e;return typeof t=="boolean"&&n==="string"?t?this.addClass(e):this.removeClass(e):jQuery.isFunction(e)?this.each(function(n){jQuery(this).toggleClass(e.call(this,n,getClass(this),t),t)}):this.each(function(){var t,r,i,s;if(n==="string"){r=0,i=jQuery(this),s=e.match(rnotwhite)||[];while(t=s[r++])i.hasClass(t)?i.removeClass(t):i.addClass(t)}else if(e===undefined||n==="boolean")t=getClass(this),t&&dataPriv.set(this,"__className__",t),this.setAttribute&&this.setAttribute("class",t||e===!1?"":dataPriv.get(this,"__className__")||"")})},hasClass:function(e){var t,n,r=0;t=" "+e+" ";while(n=this[r++])if(n.nodeType===1&&(" "+getClass(n)+" ").replace(rclass," ").indexOf(t)>-1)return!0;return!1}});var rreturn=/\r/g,rspaces=/[\x20\t\r\n\f]+/g;jQuery.fn.extend({val:function(e){var t,n,r,i=this[0];if(!arguments.length){if(i)return t=jQuery.valHooks[i.type]||jQuery.valHooks[i.nodeName.toLowerCase()],t&&"get"in t&&(n=t.get(i,"value"))!==undefined?n:(n=i.value,typeof n=="string"?n.replace(rreturn,""):n==null?"":n);return}return r=jQuery.isFunction(e),this.each(function(n){var i;if(this.nodeType!==1)return;r?i=e.call(this,n,jQuery(this).val()):i=e,i==null?i="":typeof i=="number"?i+="":jQuery.isArray(i)&&(i=jQuery.map(i,function(e){return e==null?"":e+""})),t=jQuery.valHooks[this.type]||jQuery.valHooks[this.nodeName.toLowerCase()];if(!t||!("set"in t)||t.set(this,i,"value")===undefined)this.value=i})}}),jQuery.extend({valHooks:{option:{get:function(e){var t=jQuery.find.attr(e,"value");return t!=null?t:jQuery.trim(jQuery.text(e)).replace(rspaces," ")}},select:{get:function(e){var t,n,r=e.options,i=e.selectedIndex,s=e.type==="select-one"||i<0,o=s?null:[],u=s?i+1:r.length,a=i<0?u:s?i:0;for(;a<u;a++){n=r[a];if((n.selected||a===i)&&(support.optDisabled?!n.disabled:n.getAttribute("disabled")===null)&&(!n.parentNode.disabled||!jQuery.nodeName(n.parentNode,"optgroup"))){t=jQuery(n).val();if(s)return t;o.push(t)}}return o},set:function(e,t){var n,r,i=e.options,s=jQuery.makeArray(t),o=i.length;while(o--){r=i[o];if(r.selected=jQuery.inArray(jQuery.valHooks.option.get(r),s)>-1)n=!0}return n||(e.selectedIndex=-1),s}}}}),jQuery.each(["radio","checkbox"],function(){jQuery.valHooks[this]={set:function(e,t){if(jQuery.isArray(t))return e.checked=jQuery.inArray(jQuery(e).val(),t)>-1}},support.checkOn||(jQuery.valHooks[this].get=function(e){return e.getAttribute("value")===null?"on":e.value})});var rfocusMorph=/^(?:focusinfocus|focusoutblur)$/;jQuery.extend(jQuery.event,{trigger:function(e,t,n,r){var i,s,o,u,a,f,l,c=[n||document],h=hasOwn.call(e,"type")?e.type:e,p=hasOwn.call(e,"namespace")?e.namespace.split("."):[];s=o=n=n||document;if(n.nodeType===3||n.nodeType===8)return;if(rfocusMorph.test(h+jQuery.event.triggered))return;h.indexOf(".")>-1&&(p=h.split("."),h=p.shift(),p.sort()),a=h.indexOf(":")<0&&"on"+h,e=e[jQuery.expando]?e:new jQuery.Event(h,typeof e=="object"&&e),e.isTrigger=r?2:3,e.namespace=p.join("."),e.rnamespace=e.namespace?new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,e.result=undefined,e.target||(e.target=n),t=t==null?[e]:jQuery.makeArray(t,[e]),l=jQuery.event.special[h]||{};if(!r&&l.trigger&&l.trigger.apply(n,t)===!1)return;if(!r&&!l.noBubble&&!jQuery.isWindow(n)){u=l.delegateType||h,rfocusMorph.test(u+h)||(s=s.parentNode);for(;s;s=s.parentNode)c.push(s),o=s;o===(n.ownerDocument||document)&&c.push(o.defaultView||o.parentWindow||window)}i=0;while((s=c[i++])&&!e.isPropagationStopped())e.type=i>1?u:l.bindType||h,f=(dataPriv.get(s,"events")||{})[e.type]&&dataPriv.get(s,"handle"),f&&f.apply(s,t),f=a&&s[a],f&&f.apply&&acceptData(s)&&(e.result=f.apply(s,t),e.result===!1&&e.preventDefault());return e.type=h,!r&&!e.isDefaultPrevented()&&(!l._default||l._default.apply(c.pop(),t)===!1)&&acceptData(n)&&a&&jQuery.isFunction(n[h])&&!jQuery.isWindow(n)&&(o=n[a],o&&(n[a]=null),jQuery.event.triggered=h,n[h](),jQuery.event.triggered=undefined,o&&(n[a]=o)),e.result},simulate:function(e,t,n){var r=jQuery.extend(new jQuery.Event,n,{type:e,isSimulated:!0});jQuery.event.trigger(r,null,t),r.isDefaultPrevented()&&n.preventDefault()}}),jQuery.fn.extend({trigger:function(e,t){return this.each(function(){jQuery.event.trigger(e,t,this)})},triggerHandler:function(e,t){var n=this[0];if(n)return jQuery.event.trigger(e,t,n,!0)}}),jQuery.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(e,t){jQuery.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),jQuery.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),support.focusin="onfocusin"in window,support.focusin||jQuery.each({focus:"focusin",blur:"focusout"},function(e,t){var n=function(e){jQuery.event.simulate(t,e.target,jQuery.event.fix(e))};jQuery.event.special[t]={setup:function(){var r=this.ownerDocument||this,i=dataPriv.access(r,t);i||r.addEventListener(e,n,!0),dataPriv.access(r,t,(i||0)+1)},teardown:function(){var r=this.ownerDocument||this,i=dataPriv.access(r,t)-1;i?dataPriv.access(r,t,i):(r.removeEventListener(e,n,!0),dataPriv.remove(r,t))}}});var location=window.location,nonce=jQuery.now(),rquery=/\?/;jQuery.parseJSON=function(e){return JSON.parse(e+"")},jQuery.parseXML=function(e){var t;if(!e||typeof e!="string")return null;try{t=(new window.DOMParser).parseFromString(e,"text/xml")}catch(n){t=undefined}return(!t||t.getElementsByTagName("parsererror").length)&&jQuery.error("Invalid XML: "+e),t};var rhash=/#.*$/,rts=/([?&])_=[^&]*/,rheaders=/^(.*?):[ \t]*([^\r\n]*)$/mg,rlocalProtocol=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,rnoContent=/^(?:GET|HEAD)$/,rprotocol=/^\/\//,prefilters={},transports={},allTypes="*/".concat("*"),originAnchor=document.createElement("a");originAnchor.href=location.href,jQuery.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:location.href,type:"GET",isLocal:rlocalProtocol.test(location.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":allTypes,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":jQuery.parseJSON,"text xml":jQuery.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?ajaxExtend(ajaxExtend(e,jQuery.ajaxSettings),t):ajaxExtend(jQuery.ajaxSettings,e)},ajaxPrefilter:addToPrefiltersOrTransports(prefilters),ajaxTransport:addToPrefiltersOrTransports(transports),ajax:function(e,t){function S(e,t,s,u){var f,m,g,b,E,S=t;if(y===2)return;y=2,o&&window.clearTimeout(o),n=undefined,i=u||"",w.readyState=e>0?4:0,f=e>=200&&e<300||e===304,s&&(b=ajaxHandleResponses(l,w,s)),b=ajaxConvert(l,b,w,f);if(f)l.ifModified&&(E=w.getResponseHeader("Last-Modified"),E&&(jQuery.lastModified[r]=E),E=w.getResponseHeader("etag"),E&&(jQuery.etag[r]=E)),e===204||l.type==="HEAD"?S="nocontent":e===304?S="notmodified":(S=b.state,m=b.data,g=b.error,f=!g);else{g=S;if(e||!S)S="error",e<0&&(e=0)}w.status=e,w.statusText=(t||S)+"",f?p.resolveWith(c,[m,S,w]):p.rejectWith(c,[w,S,g]),w.statusCode(v),v=undefined,a&&h.trigger(f?"ajaxSuccess":"ajaxError",[w,l,f?m:g]),d.fireWith(c,[w,S]),a&&(h.trigger("ajaxComplete",[w,l]),--jQuery.active||jQuery.event.trigger("ajaxStop"))}typeof e=="object"&&(t=e,e=undefined),t=t||{};var n,r,i,s,o,u,a,f,l=jQuery.ajaxSetup({},t),c=l.context||l,h=l.context&&(c.nodeType||c.jquery)?jQuery(c):jQuery.event,p=jQuery.Deferred(),d=jQuery.Callbacks("once memory"),v=l.statusCode||{},m={},g={},y=0,b="canceled",w={readyState:0,getResponseHeader:function(e){var t;if(y===2){if(!s){s={};while(t=rheaders.exec(i))s[t[1].toLowerCase()]=t[2]}t=s[e.toLowerCase()]}return t==null?null:t},getAllResponseHeaders:function(){return y===2?i:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return y||(e=g[n]=g[n]||e,m[e]=t),this},overrideMimeType:function(e){return y||(l.mimeType=e),this},statusCode:function(e){var t;if(e)if(y<2)for(t in e)v[t]=[v[t],e[t]];else w.always(e[w.status]);return this},abort:function(e){var t=e||b;return n&&n.abort(t),S(0,t),this}};p.promise(w).complete=d.add,w.success=w.done,w.error=w.fail,l.url=((e||l.url||location.href)+"").replace(rhash,"").replace(rprotocol,location.protocol+"//"),l.type=t.method||t.type||l.method||l.type,l.dataTypes=jQuery.trim(l.dataType||"*").toLowerCase().match(rnotwhite)||[""];if(l.crossDomain==null){u=document.createElement("a");try{u.href=l.url,u.href=u.href,l.crossDomain=originAnchor.protocol+"//"+originAnchor.host!=u.protocol+"//"+u.host}catch(E){l.crossDomain=!0}}l.data&&l.processData&&typeof l.data!="string"&&(l.data=jQuery.param(l.data,l.traditional)),inspectPrefiltersOrTransports(prefilters,l,t,w);if(y===2)return w;a=jQuery.event&&l.global,a&&jQuery.active++===0&&jQuery.event.trigger("ajaxStart"),l.type=l.type.toUpperCase(),l.hasContent=!rnoContent.test(l.type),r=l.url,l.hasContent||(l.data&&(r=l.url+=(rquery.test(r)?"&":"?")+l.data,delete l.data),l.cache===!1&&(l.url=rts.test(r)?r.replace(rts,"$1_="+nonce++):r+(rquery.test(r)?"&":"?")+"_="+nonce++)),l.ifModified&&(jQuery.lastModified[r]&&w.setRequestHeader("If-Modified-Since",jQuery.lastModified[r]),jQuery.etag[r]&&w.setRequestHeader("If-None-Match",jQuery.etag[r])),(l.data&&l.hasContent&&l.contentType!==!1||t.contentType)&&w.setRequestHeader("Content-Type",l.contentType),w.setRequestHeader("Accept",l.dataTypes[0]&&l.accepts[l.dataTypes[0]]?l.accepts[l.dataTypes[0]]+(l.dataTypes[0]!=="*"?", "+allTypes+"; q=0.01":""):l.accepts["*"]);for(f in l.headers)w.setRequestHeader(f,l.headers[f]);if(!l.beforeSend||l.beforeSend.call(c,w,l)!==!1&&y!==2){b="abort";for(f in{success:1,error:1,complete:1})w[f](l[f]);n=inspectPrefiltersOrTransports(transports,l,t,w);if(!n)S(-1,"No Transport");else{w.readyState=1,a&&h.trigger("ajaxSend",[w,l]);if(y===2)return w;l.async&&l.timeout>0&&(o=window.setTimeout(function(){w.abort("timeout")},l.timeout));try{y=1,n.send(m,S)}catch(E){if(!(y<2))throw E;S(-1,E)}}return w}return w.abort()},getJSON:function(e,t,n){return jQuery.get(e,t,n,"json")},getScript:function(e,t){return jQuery.get(e,undefined,t,"script")}}),jQuery.each(["get","post"],function(e,t){jQuery[t]=function(e,n,r,i){return jQuery.isFunction(n)&&(i=i||r,r=n,n=undefined),jQuery.ajax(jQuery.extend({url:e,type:t,dataType:i,data:n,success:r},jQuery.isPlainObject(e)&&e))}}),jQuery._evalUrl=function(e){return jQuery.ajax({url:e,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})},jQuery.fn.extend({wrapAll:function(e){var t;return jQuery.isFunction(e)?this.each(function(t){jQuery(this).wrapAll(e.call(this,t))}):(this[0]&&(t=jQuery(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstElementChild)e=e.firstElementChild;return e}).append(this)),this)},wrapInner:function(e){return jQuery.isFunction(e)?this.each(function(t){jQuery(this).wrapInner(e.call(this,t))}):this.each(function(){var t=jQuery(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=jQuery.isFunction(e);return this.each(function(n){jQuery(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){jQuery.nodeName(this,"body")||jQuery(this).replaceWith(this.childNodes)}).end()}}),jQuery.expr.filters.hidden=function(e){return!jQuery.expr.filters.visible(e)},jQuery.expr.filters.visible=function(e){return e.offsetWidth>0||e.offsetHeight>0||e.getClientRects().length>0};var r20=/%20/g,rbracket=/\[\]$/,rCRLF=/\r?\n/g,rsubmitterTypes=/^(?:submit|button|image|reset|file)$/i,rsubmittable=/^(?:input|select|textarea|keygen)/i;jQuery.param=function(e,t){var n,r=[],i=function(e,t){t=jQuery.isFunction(t)?t():t==null?"":t,r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};t===undefined&&(t=jQuery.ajaxSettings&&jQuery.ajaxSettings.traditional);if(jQuery.isArray(e)||e.jquery&&!jQuery.isPlainObject(e))jQuery.each(e,function(){i(this.name,this.value)});else for(n in e)buildParams(n,e[n],t,i);return r.join("&").replace(r20,"+")},jQuery.fn.extend({serialize:function(){return jQuery.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=jQuery.prop(this,"elements");return e?jQuery.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!jQuery(this).is(":disabled")&&rsubmittable.test(this.nodeName)&&!rsubmitterTypes.test(e)&&(this.checked||!rcheckableType.test(e))}).map(function(e,t){var n=jQuery(this).val();return n==null?null:jQuery.isArray(n)?jQuery.map(n,function(e){return{name:t.name,value:e.replace(rCRLF,"\r\n")}}):{name:t.name,value:n.replace(rCRLF,"\r\n")}}).get()}}),jQuery.ajaxSettings.xhr=function(){try{return new window.XMLHttpRequest}catch(e){}};var xhrSuccessStatus={0:200,1223:204},xhrSupported=jQuery.ajaxSettings.xhr();support.cors=!!xhrSupported&&"withCredentials"in xhrSupported,support.ajax=xhrSupported=!!xhrSupported,jQuery.ajaxTransport(function(e){var t,n;if(support.cors||xhrSupported&&!e.crossDomain)return{send:function(r,i){var s,o=e.xhr();o.open(e.type,e.url,e.async,e.username,e.password);if(e.xhrFields)for(s in e.xhrFields)o[s]=e.xhrFields[s];e.mimeType&&o.overrideMimeType&&o.overrideMimeType(e.mimeType),!e.crossDomain&&!r["X-Requested-With"]&&(r["X-Requested-With"]="XMLHttpRequest");for(s in r)o.setRequestHeader(s,r[s]);t=function(e){return function(){t&&(t=n=o.onload=o.onerror=o.onabort=o.onreadystatechange=null,e==="abort"?o.abort():e==="error"?typeof o.status!="number"?i(0,"error"):i(o.status,o.statusText):i(xhrSuccessStatus[o.status]||o.status,o.statusText,(o.responseType||"text")!=="text"||typeof o.responseText!="string"?{binary:o.response}:{text:o.responseText},o.getAllResponseHeaders()))}},o.onload=t(),n=o.onerror=t("error"),o.onabort!==undefined?o.onabort=n:o.onreadystatechange=function(){o.readyState===4&&window.setTimeout(function(){t&&n()})},t=t("abort");try{o.send(e.hasContent&&e.data||null)}catch(u){if(t)throw u}},abort:function(){t&&t()}}}),jQuery.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(e){return jQuery.globalEval(e),e}}}),jQuery.ajaxPrefilter("script",function(e){e.cache===undefined&&(e.cache=!1),e.crossDomain&&(e.type="GET")}),jQuery.ajaxTransport("script",function(e){if(e.crossDomain){var t,n;return{send:function(r,i){t=jQuery("<script>").prop({charset:e.scriptCharset,src:e.url}).on("load error",n=function(e){t.remove(),n=null,e&&i(e.type==="error"?404:200,e.type)}),document.head.appendChild(t[0])},abort:function(){n&&n()}}}});var oldCallbacks=[],rjsonp=/(=)\?(?=&|$)|\?\?/;jQuery.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=oldCallbacks.pop()||jQuery.expando+"_"+nonce++;return this[e]=!0,e}}),jQuery.ajaxPrefilter("json jsonp",function(e,t,n){var r,i,s,o=e.jsonp!==!1&&(rjsonp.test(e.url)?"url":typeof e.data=="string"&&(e.contentType||"").indexOf("application/x-www-form-urlencoded")===0&&rjsonp.test(e.data)&&"data");if(o||e.dataTypes[0]==="jsonp")return r=e.jsonpCallback=jQuery.isFunction(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,o?e[o]=e[o].replace(rjsonp,"$1"+r):e.jsonp!==!1&&(e.url+=(rquery.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return s||jQuery.error(r+" was not called"),s[0]},e.dataTypes[0]="json",i=window[r],window[r]=function(){s=arguments},n.always(function(){i===undefined?jQuery(window).removeProp(r):window[r]=i,e[r]&&(e.jsonpCallback=t.jsonpCallback,oldCallbacks.push(r)),s&&jQuery.isFunction(i)&&i(s[0]),s=i=undefined}),"script"}),jQuery.parseHTML=function(e,t,n){if(!e||typeof e!="string")return null;typeof t=="boolean"&&(n=t,t=!1),t=t||document;var r=rsingleTag.exec(e),i=!n&&[];return r?[t.createElement(r[1])]:(r=buildFragment([e],t,i),i&&i.length&&jQuery(i).remove(),jQuery.merge([],r.childNodes))};var _load=jQuery.fn.load;jQuery.fn.load=function(e,t,n){if(typeof e!="string"&&_load)return _load.apply(this,arguments);var r,i,s,o=this,u=e.indexOf(" ");return u>-1&&(r=jQuery.trim(e.slice(u)),e=e.slice(0,u)),jQuery.isFunction(t)?(n=t,t=undefined):t&&typeof t=="object"&&(i="POST"),o.length>0&&jQuery.ajax({url:e,type:i||"GET",dataType:"html",data:t}).done(function(e){s=arguments,o.html(r?jQuery("<div>").append(jQuery.parseHTML(e)).find(r):e)}).always(n&&function(e,t){o.each(function(){n.apply(this,s||[e.responseText,t,e])})}),this},jQuery.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){jQuery.fn[t]=function(e){return this.on(t,e)}}),jQuery.expr.filters.animated=function(e){return jQuery.grep(jQuery.timers,function(t){return e===t.elem}).length},jQuery.offset={setOffset:function(e,t,n){var r,i,s,o,u,a,f,l=jQuery.css(e,"position"),c=jQuery(e),h={};l==="static"&&(e.style.position="relative"),u=c.offset(),s=jQuery.css(e,"top"),a=jQuery.css(e,"left"),f=(l==="absolute"||l==="fixed")&&(s+a).indexOf("auto")>-1,f?(r=c.position(),o=r.top,i=r.left):(o=parseFloat(s)||0,i=parseFloat(a)||0),jQuery.isFunction(t)&&(t=t.call(e,n,jQuery.extend({},u))),t.top!=null&&(h.top=t.top-u.top+o),t.left!=null&&(h.left=t.left-u.left+i),"using"in t?t.using.call(e,h):c.css(h)}},jQuery.fn.extend({offset:function(e){if(arguments.length)return e===undefined?this:this.each(function(t){jQuery.offset.setOffset(this,e,t)});var t,n,r=this[0],i={top:0,left:0},s=r&&r.ownerDocument;if(!s)return;return t=s.documentElement,jQuery.contains(t,r)?(i=r.getBoundingClientRect(),n=getWindow(s),{top:i.top+n.pageYOffset-t.clientTop,left:i.left+n.pageXOffset-t.clientLeft}):i},position:function(){if(!this[0])return;var e,t,n=this[0],r={top:0,left:0};return jQuery.css(n,"position")==="fixed"?t=n.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),jQuery.nodeName(e[0],"html")||(r=e.offset()),r.top+=jQuery.css(e[0],"borderTopWidth",!0),r.left+=jQuery.css(e[0],"borderLeftWidth",!0)),{top:t.top-r.top-jQuery.css(n,"marginTop",!0),left:t.left-r.left-jQuery.css(n,"marginLeft",!0)}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&jQuery.css(e,"position")==="static")e=e.offsetParent;return e||documentElement})}}),jQuery.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,t){var n="pageYOffset"===t;jQuery.fn[e]=function(r){return access(this,function(e,r,i){var s=getWindow(e);if(i===undefined)return s?s[t]:e[r];s?s.scrollTo(n?s.pageXOffset:i,n?i:s.pageYOffset):e[r]=i},e,r,arguments.length)}}),jQuery.each(["top","left"],function(e,t){jQuery.cssHooks[t]=addGetHookIf(support.pixelPosition,function(e,n){if(n)return n=curCSS(e,t),rnumnonpx.test(n)?jQuery(e).position()[t]+"px":n})}),jQuery.each({Height:"height",Width:"width"},function(e,t){jQuery.each({padding:"inner"+e,content:t,"":"outer"+e},function(n,r){jQuery.fn[r]=function(r,i){var s=arguments.length&&(n||typeof r!="boolean"),o=n||(r===!0||i===!0?"margin":"border");return access(this,function(t,n,r){var i;return jQuery.isWindow(t)?t.document.documentElement["client"+e]:t.nodeType===9?(i=t.documentElement,Math.max(t.body["scroll"+e],i["scroll"+e],t.body["offset"+e],i["offset"+e],i["client"+e])):r===undefined?jQuery.css(t,n,o):jQuery.style(t,n,r,o)},t,s?r:undefined,s,null)}})}),jQuery.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return arguments.length===1?this.off(e,"**"):this.off(t,e||"**",n)},size:function(){return this.length}}),jQuery.fn.andSelf=jQuery.fn.addBack,typeof define=="function"&&define.amd&&define("jquery",[],function(){return jQuery});var _jQuery=window.jQuery,_$=window.$;return jQuery.noConflict=function(e){return window.$===jQuery&&(window.$=_$),e&&window.jQuery===jQuery&&(window.jQuery=_jQuery),jQuery},noGlobal||(window.jQuery=window.$=jQuery),jQuery}),function(){var e=this,t=e.Backbone,n=[],r=n.push,i=n.slice,s=n.splice,o;typeof exports!="undefined"?o=exports:o=e.Backbone={},o.VERSION="1.1.0";var u=e._;!u&&typeof require!="undefined"&&(u=require("underscore")),o.$=e.jQuery||e.Zepto||e.ender||e.$,o.noConflict=function(){return e.Backbone=t,this},o.emulateHTTP=!1,o.emulateJSON=!1;var a=o.Events={on:function(e,t,n){if(!l(this,"on",e,[t,n])||!t)return this;this._events||(this._events={});var r=this._events[e]||(this._events[e]=[]);return r.push({callback:t,context:n,ctx:n||this}),this},once:function(e,t,n){if(!l(this,"once",e,[t,n])||!t)return this;var r=this,i=u.once(function(){r.off(e,i),t.apply(this,arguments)});return i._callback=t,this.on(e,i,n)},off:function(e,t,n){var r,i,s,o,a,f,c,h;if(!this._events||!l(this,"off",e,[t,n]))return this;if(!e&&!t&&!n)return this._events={},this;o=e?[e]:u.keys(this._events);for(a=0,f=o.length;a<f;a++){e=o[a];if(s=this._events[e]){this._events[e]=r=[];if(t||n)for(c=0,h=s.length;c<h;c++)i=s[c],(t&&t!==i.callback&&t!==i.callback._callback||n&&n!==i.context)&&r.push(i);r.length||delete this._events[e]}}return this},trigger:function(e){if(!this._events)return this;var t=i.call(arguments,1);if(!l(this,"trigger",e,t))return this;var n=this._events[e],r=this._events.all;return n&&c(n,t),r&&c(r,arguments),this},stopListening:function(e,t,n){var r=this._listeningTo;if(!r)return this;var i=!t&&!n;!n&&typeof t=="object"&&(n=this),e&&((r={})[e._listenId]=e);for(var s in r)e=r[s],e.off(t,n,this),(i||u.isEmpty(e._events))&&delete this._listeningTo[s];return this}},f=/\s+/,l=function(e,t,n,r){if(!n)return!0;if(typeof n=="object"){for(var i in n)e[t].apply(e,[i,n[i]].concat(r));return!1}if(f.test(n)){var s=n.split(f);for(var o=0,u=s.length;o<u;o++)e[t].apply(e,[s[o]].concat(r));return!1}return!0},c=function(e,t){var n,r=-1,i=e.length,s=t[0],o=t[1],u=t[2];switch(t.length){case 0:while(++r<i)(n=e[r]).callback.call(n.ctx);return;case 1:while(++r<i)(n=e[r]).callback.call(n.ctx,s);return;case 2:while(++r<i)(n=e[r]).callback.call(n.ctx,s,o);return;case 3:while(++r<i)(n=e[r]).callback.call(n.ctx,s,o,u);return;default:while(++r<i)(n=e[r]).callback.apply(n.ctx,t)}},h={listenTo:"on",listenToOnce:"once"};u.each(h,function(e,t){a[t]=function(t,n,r){var i=this._listeningTo||(this._listeningTo={}),s=t._listenId||(t._listenId=u.uniqueId("l"));return i[s]=t,!r&&typeof n=="object"&&(r=this),t[e](n,r,this),this}}),a.bind=a.on,a.unbind=a.off,u.extend(o,a);var p=o.Model=function(e,t){var n=e||{};t||(t={}),this.cid=u.uniqueId("c"),this.attributes={},t.collection&&(this.collection=t.collection),t.parse&&(n=this.parse(n,t)||{}),n=u.defaults({},n,u.result(this,"defaults")),this.set(n,t),this.changed={},this.initialize.apply(this,arguments)};u.extend(p.prototype,a,{changed:null,validationError:null,idAttribute:"id",initialize:function(){},toJSON:function(e){return u.clone(this.attributes)},sync:function(){return o.sync.apply(this,arguments)},get:function(e){return this.attributes[e]},escape:function(e){return u.escape(this.get(e))},has:function(e){return this.get(e)!=null},set:function(e,t,n){var r,i,s,o,a,f,l,c;if(e==null)return this;typeof e=="object"?(i=e,n=t):(i={})[e]=t,n||(n={});if(!this._validate(i,n))return!1;s=n.unset,a=n.silent,o=[],f=this._changing,this._changing=!0,f||(this._previousAttributes=u.clone(this.attributes),this.changed={}),c=this.attributes,l=this._previousAttributes,this.idAttribute in i&&(this.id=i[this.idAttribute]);for(r in i)t=i[r],u.isEqual(c[r],t)||o.push(r),u.isEqual(l[r],t)?delete this.changed[r]:this.changed[r]=t,s?delete c[r]:c[r]=t;if(!a){o.length&&(this._pending=!0);for(var h=0,p=o.length;h<p;h++)this.trigger("change:"+o[h],this,c[o[h]],n)}if(f)return this;if(!a)while(this._pending)this._pending=!1,this.trigger("change",this,n);return this._pending=!1,this._changing=!1,this},unset:function(e,t){return this.set(e,void 0,u.extend({},t,{unset:!0}))},clear:function(e){var t={};for(var n in this.attributes)t[n]=void 0;return this.set(t,u.extend({},e,{unset:!0}))},hasChanged:function(e){return e==null?!u.isEmpty(this.changed):u.has(this.changed,e)},changedAttributes:function(e){if(!e)return this.hasChanged()?u.clone(this.changed):!1;var t,n=!1,r=this._changing?this._previousAttributes:this.attributes;for(var i in e){if(u.isEqual(r[i],t=e[i]))continue;(n||(n={}))[i]=t}return n},previous:function(e){return e==null||!this._previousAttributes?null:this._previousAttributes[e]},previousAttributes:function(){return u.clone(this._previousAttributes)},fetch:function(e){e=e?u.clone(e):{},e.parse===void 0&&(e.parse=!0);var t=this,n=e.success;return e.success=function(r){if(!t.set(t.parse(r,e),e))return!1;n&&n(t,r,e),t.trigger("sync",t,r,e)},F(this,e),this.sync("read",this,e)},save:function(e,t,n){var r,i,s,o=this.attributes;e==null||typeof e=="object"?(r=e,n=t):(r={})[e]=t,n=u.extend({validate:!0},n);if(r&&!n.wait){if(!this.set(r,n))return!1}else if(!this._validate(r,n))return!1;r&&n.wait&&(this.attributes=u.extend({},o,r)),n.parse===void 0&&(n.parse=!0);var a=this,f=n.success;return n.success=function(e){a.attributes=o;var t=a.parse(e,n);n.wait&&(t=u.extend(r||{},t));if(u.isObject(t)&&!a.set(t,n))return!1;f&&f(a,e,n),a.trigger("sync",a,e,n)},F(this,n),i=this.isNew()?"create":n.patch?"patch":"update",i==="patch"&&(n.attrs=r),s=this.sync(i,this,n),r&&n.wait&&(this.attributes=o),s},destroy:function(e){e=e?u.clone(e):{};var t=this,n=e.success,r=function(){t.trigger("destroy",t,t.collection,e)};e.success=function(i){(e.wait||t.isNew())&&r(),n&&n(t,i,e),t.isNew()||t.trigger("sync",t,i,e)};if(this.isNew())return e.success(),!1;F(this,e);var i=this.sync("delete",this,e);return e.wait||r(),i},url:function(){var e=u.result(this,"urlRoot")||u.result(this.collection,"url")||j();return this.isNew()?e:e+(e.charAt(e.length-1)==="/"?"":"/")+encodeURIComponent(this.id)},parse:function(e,t){return e},clone:function(){return new this.constructor(this.attributes)},isNew:function(){return this.id==null},isValid:function(e){return this._validate({},u.extend(e||{},{validate:!0}))},_validate:function(e,t){if(!t.validate||!this.validate)return!0;e=u.extend({},this.attributes,e);var n=this.validationError=this.validate(e,t)||null;return n?(this.trigger("invalid",this,n,u.extend(t,{validationError:n})),!1):!0}});var d=["keys","values","pairs","invert","pick","omit"];u.each(d,function(e){p.prototype[e]=function(){var t=i.call(arguments);return t.unshift(this.attributes),u[e].apply(u,t)}});var v=o.Collection=function(e,t){t||(t={}),t.model&&(this.model=t.model),t.comparator!==void 0&&(this.comparator=t.comparator),this._reset(),this.initialize.apply(this,arguments),e&&this.reset(e,u.extend({silent:!0},t))},m={add:!0,remove:!0,merge:!0},g={add:!0,remove:!1};u.extend(v.prototype,a,{model:p,initialize:function(){},toJSON:function(e){return this.map(function(t){return t.toJSON(e)})},sync:function(){return o.sync.apply(this,arguments)},add:function(e,t){return this.set(e,u.extend({merge:!1},t,g))},remove:function(e,t){var n=!u.isArray(e);e=n?[e]:u.clone(e),t||(t={});var r,i,s,o;for(r=0,i=e.length;r<i;r++){o=e[r]=this.get(e[r]);if(!o)continue;delete this._byId[o.id],delete this._byId[o.cid],s=this.indexOf(o),this.models.splice(s,1),this.length--,t.silent||(t.index=s,o.trigger("remove",o,this,t)),this._removeReference(o)}return n?e[0]:e},set:function(e,t){t=u.defaults({},t,m),t.parse&&(e=this.parse(e,t));var n=!u.isArray(e);e=n?e?[e]:[]:u.clone(e);var r,i,s,o,a,f,l,c=t.at,h=this.model,d=this.comparator&&c==null&&t.sort!==!1,v=u.isString(this.comparator)?this.comparator:null,g=[],y=[],b={},w=t.add,E=t.merge,S=t.remove,x=!d&&w&&S?[]:!1;for(r=0,i=e.length;r<i;r++){a=e[r],a instanceof p?s=o=a:s=a[h.prototype.idAttribute];if(f=this.get(s))S&&(b[f.cid]=!0),E&&(a=a===o?o.attributes:a,t.parse&&(a=f.parse(a,t)),f.set(a,t),d&&!l&&f.hasChanged(v)&&(l=!0)),e[r]=f;else if(w){o=e[r]=this._prepareModel(a,t);if(!o)continue;g.push(o),o.on("all",this._onModelEvent,this),this._byId[o.cid]=o,o.id!=null&&(this._byId[o.id]=o)}x&&x.push(f||o)}if(S){for(r=0,i=this.length;r<i;++r)b[(o=this.models[r]).cid]||y.push(o);y.length&&this.remove(y,t)}if(g.length||x&&x.length){d&&(l=!0),this.length+=g.length;if(c!=null)for(r=0,i=g.length;r<i;r++)this.models.splice(c+r,0,g[r]);else{x&&(this.models.length=0);var T=x||g;for(r=0,i=T.length;r<i;r++)this.models.push(T[r])}}l&&this.sort({silent:!0});if(!t.silent){for(r=0,i=g.length;r<i;r++)(o=g[r]).trigger("add",o,this,t);(l||x&&x.length)&&this.trigger("sort",this,t)}return n?e[0]:e},reset:function(e,t){t||(t={});for(var n=0,r=this.models.length;n<r;n++)this._removeReference(this.models[n]);return t.previousModels=this.models,this._reset(),e=this.add(e,u.extend({silent:!0},t)),t.silent||this.trigger("reset",this,t),e},push:function(e,t){return this.add(e,u.extend({at:this.length},t))},pop:function(e){var t=this.at(this.length-1);return this.remove(t,e),t},unshift:function(e,t){return this.add(e,u.extend({at:0},t))},shift:function(e){var t=this.at(0);return this.remove(t,e),t},slice:function(){return i.apply(this.models,arguments)},get:function(e){return e==null?void 0:this._byId[e.id]||this._byId[e.cid]||this._byId[e]},at:function(e){return this.models[e]},where:function(e,t){return u.isEmpty(e)?t?void 0:[]:this[t?"find":"filter"](function(t){for(var n in e)if(e[n]!==t.get(n))return!1;return!0})},findWhere:function(e){return this.where(e,!0)},sort:function(e){if(!this.comparator)throw new Error("Cannot sort a set without a comparator");return e||(e={}),u.isString(this.comparator)||this.comparator.length===1?this.models=this.sortBy(this.comparator,this):this.models.sort(u.bind(this.comparator,this)),e.silent||this.trigger("sort",this,e),this},pluck:function(e){return u.invoke(this.models,"get",e)},fetch:function(e){e=e?u.clone(e):{},e.parse===void 0&&(e.parse=!0);var t=e.success,n=this;return e.success=function(r){var i=e.reset?"reset":"set";n[i](r,e),t&&t(n,r,e),n.trigger("sync",n,r,e)},F(this,e),this.sync("read",this,e)},create:function(e,t){t=t?u.clone(t):{};if(!(e=this._prepareModel(e,t)))return!1;t.wait||this.add(e,t);var n=this,r=t.success;return t.success=function(e,t,i){i.wait&&n.add(e,i),r&&r(e,t,i)},e.save(null,t),e},parse:function(e,t){return e},clone:function(){return new this.constructor(this.models)},_reset:function(){this.length=0,this.models=[],this._byId={}},_prepareModel:function(e,t){if(e instanceof p)return e.collection||(e.collection=this),e;t=t?u.clone(t):{},t.collection=this;var n=new this.model(e,t);return n.validationError?(this.trigger("invalid",this,n.validationError,t),!1):n},_removeReference:function(e){this===e.collection&&delete e.collection,e.off("all",this._onModelEvent,this)},_onModelEvent:function(e,t,n,r){if((e==="add"||e==="remove")&&n!==this)return;e==="destroy"&&this.remove(t,r),t&&e==="change:"+t.idAttribute&&(delete this._byId[t.previous(t.idAttribute)],t.id!=null&&(this._byId[t.id]=t)),this.trigger.apply(this,arguments)}});var y=["forEach","each","map","collect","reduce","foldl","inject","reduceRight","foldr","find","detect","filter","select","reject","every","all","some","any","include","contains","invoke","max","min","toArray","size","first","head","take","initial","rest","tail","drop","last","without","difference","indexOf","shuffle","lastIndexOf","isEmpty","chain"];u.each(y,function(e){v.prototype[e]=function(){var t=i.call(arguments);return t.unshift(this.models),u[e].apply(u,t)}});var b=["groupBy","countBy","sortBy"];u.each(b,function(e){v.prototype[e]=function(t,n){var r=u.isFunction(t)?t:function(e){return e.get(t)};return u[e](this.models,r,n)}});var w=o.View=function(e){this.cid=u.uniqueId("view"),e||(e={}),u.extend(this,u.pick(e,S)),this._ensureElement(),this.initialize.apply(this,arguments),this.delegateEvents()},E=/^(\S+)\s*(.*)$/,S=["model","collection","el","id","attributes","className","tagName","events"];u.extend(w.prototype,a,{tagName:"div",$:function(e){return this.$el.find(e)},initialize:function(){},render:function(){return this},remove:function(){return this.$el.remove(),this.stopListening(),this},setElement:function(e,t){return this.$el&&this.undelegateEvents(),this.$el=e instanceof o.$?e:o.$(e),this.el=this.$el[0],t!==!1&&this.delegateEvents(),this},delegateEvents:function(e){if(!e&&!(e=u.result(this,"events")))return this;this.undelegateEvents();for(var t in e){var n=e[t];u.isFunction(n)||(n=this[e[t]]);if(!n)continue;var r=t.match(E),i=r[1],s=r[2];n=u.bind(n,this),i+=".delegateEvents"+this.cid,s===""?this.$el.on(i,n):this.$el.on(i,s,n)}return this},undelegateEvents:function(){return this.$el.off(".delegateEvents"+this.cid),this},_ensureElement:function(){if(!this.el){var e=u.extend({},u.result(this,"attributes"));this.id&&(e.id=u.result(this,"id")),this.className&&(e["class"]=u.result(this,"className"));var t=o.$("<"+u.result(this,"tagName")+">").attr(e);this.setElement(t,!1)}else this.setElement(u.result(this,"el"),!1)}}),o.sync=function(e,t,n){var r=T[e];u.defaults(n||(n={}),{emulateHTTP:o.emulateHTTP,emulateJSON:o.emulateJSON});var i={type:r,dataType:"json"};n.url||(i.url=u.result(t,"url")||j()),n.data==null&&t&&(e==="create"||e==="update"||e==="patch")&&(i.contentType="application/json",i.data=JSON.stringify(n.attrs||t.toJSON(n))),n.emulateJSON&&(i.contentType="application/x-www-form-urlencoded",i.data=i.data?{model:i.data}:{});if(n.emulateHTTP&&(r==="PUT"||r==="DELETE"||r==="PATCH")){i.type="POST",n.emulateJSON&&(i.data._method=r);var s=n.beforeSend;n.beforeSend=function(e){e.setRequestHeader("X-HTTP-Method-Override",r);if(s)return s.apply(this,arguments)}}i.type!=="GET"&&!n.emulateJSON&&(i.processData=!1),i.type==="PATCH"&&x&&(i.xhr=function(){return new ActiveXObject("Microsoft.XMLHTTP")});var a=n.xhr=o.ajax(u.extend(i,n));return t.trigger("request",t,a,n),a};var x=typeof window!="undefined"&&!!window.ActiveXObject&&(!window.XMLHttpRequest||!(new XMLHttpRequest).dispatchEvent),T={create:"POST",update:"PUT",patch:"PATCH","delete":"DELETE",read:"GET"};o.ajax=function(){return o.$.ajax.apply(o.$,arguments)};var N=o.Router=function(e){e||(e={}),e.routes&&(this.routes=e.routes),this._bindRoutes(),this.initialize.apply(this,arguments)},C=/\((.*?)\)/g,k=/(\(\?)?:\w+/g,L=/\*\w+/g,A=/[\-{}\[\]+?.,\\\^$|#\s]/g;u.extend(N.prototype,a,{initialize:function(){},route:function(e,t,n){u.isRegExp(e)||(e=this._routeToRegExp(e)),u.isFunction(t)&&(n=t,t=""),n||(n=this[t]);var r=this;return o.history.route(e,function(i){var s=r._extractParameters(e,i);n&&n.apply(r,s),r.trigger.apply(r,["route:"+t].concat(s)),r.trigger("route",t,s),o.history.trigger("route",r,t,s)}),this},navigate:function(e,t){return o.history.navigate(e,t),this},_bindRoutes:function(){if(!this.routes)return;this.routes=u.result(this,"routes");var e,t=u.keys(this.routes);while((e=t.pop())!=null)this.route(e,this.routes[e])},_routeToRegExp:function(e){return e=e.replace(A,"\\$&").replace(C,"(?:$1)?").replace(k,function(e,t){return t?e:"([^/]+)"}).replace(L,"(.*?)"),new RegExp("^"+e+"$")},_extractParameters:function(e,t){var n=e.exec(t).slice(1);return u.map(n,function(e){return e?decodeURIComponent(e):null})}});var O=o.History=function(){this.handlers=[],u.bindAll(this,"checkUrl"),typeof window!="undefined"&&(this.location=window.location,this.history=window.history)},M=/^[#\/]|\s+$/g,_=/^\/+|\/+$/g,D=/msie [\w.]+/,P=/\/$/,H=/[?#].*$/;O.started=!1,u.extend(O.prototype,a,{interval:50,getHash:function(e){var t=(e||this).location.href.match(/#(.*)$/);return t?t[1]:""},getFragment:function(e,t){if(e==null)if(this._hasPushState||!this._wantsHashChange||t){e=this.location.pathname;var n=this.root.replace(P,"");e.indexOf(n)||(e=e.slice(n.length))}else e=this.getHash();return e.replace(M,"")},start:function(e){if(O.started)throw new Error("Backbone.history has already been started");O.started=!0,this.options=u.extend({root:"/"},this.options,e),this.root=this.options.root,this._wantsHashChange=this.options.hashChange!==!1,this._wantsPushState=!!this.options.pushState,this._hasPushState=!!(this.options.pushState&&this.history&&this.history.pushState);var t=this.getFragment(),n=document.documentMode,r=D.exec(navigator.userAgent.toLowerCase())&&(!n||n<=7);this.root=("/"+this.root+"/").replace(_,"/"),r&&this._wantsHashChange&&(this.iframe=o.$('<iframe src="javascript:0" tabindex="-1" />').hide().appendTo("body")[0].contentWindow,this.navigate(t)),this._hasPushState?o.$(window).on("popstate",this.checkUrl):this._wantsHashChange&&"onhashchange"in window&&!r?o.$(window).on("hashchange",this.checkUrl):this._wantsHashChange&&(this._checkUrlInterval=setInterval(this.checkUrl,this.interval)),this.fragment=t;var i=this.location,s=i.pathname.replace(/[^\/]$/,"$&/")===this.root;if(this._wantsHashChange&&this._wantsPushState){if(!this._hasPushState&&!s)return this.fragment=this.getFragment(null,!0),this.location.replace(this.root+this.location.search+"#"+this.fragment),!0;this._hasPushState&&s&&i.hash&&(this.fragment=this.getHash().replace(M,""),this.history.replaceState({},document.title,this.root+this.fragment+i.search))}if(!this.options.silent)return this.loadUrl()},stop:function(){o.$(window).off("popstate",this.checkUrl).off("hashchange",this.checkUrl),clearInterval(this._checkUrlInterval),O.started=!1},route:function(e,t){this.handlers.unshift({route:e,callback:t})},checkUrl:function(e){var t=this.getFragment();t===this.fragment&&this.iframe&&(t=this.getFragment(this.getHash(this.iframe)));if(t===this.fragment)return!1;this.iframe&&this.navigate(t),this.loadUrl()},loadUrl:function(e){return e=this.fragment=this.getFragment(e),u.any(this.handlers,function(t){if(t.route.test(e))return t.callback(e),!0})},navigate:function(e,t){if(!O.started)return!1;if(!t||t===!0)t={trigger:!!t};var n=this.root+(e=this.getFragment(e||""));e=e.replace(H,"");if(this.fragment===e)return;this.fragment=e,e===""&&n!=="/"&&(n=n.slice(0,-1));if(this._hasPushState)this.history[t.replace?"replaceState":"pushState"]({},document.title,n);else{if(!this._wantsHashChange)return this.location.assign(n);this._updateHash(this.location,e,t.replace),this.iframe&&e!==this.getFragment(this.getHash(this.iframe))&&(t.replace||this.iframe.document.open().close(),this._updateHash(this.iframe.location,e,t.replace))}if(t.trigger)return this.loadUrl(e)},_updateHash:function(e,t,n){if(n){var r=e.href.replace(/(javascript:|#).*$/,"");e.replace(r+"#"+t)}else e.hash="#"+t}}),o.history=new O;var B=function(e,t){var n=this,r;e&&u.has(e,"constructor")?r=e.constructor:r=function(){return n.apply(this,arguments)},u.extend(r,n,t);var i=function(){this.constructor=r};return i.prototype=n.prototype,r.prototype=new i,e&&u.extend(r.prototype,e),r.__super__=n.prototype,r};p.extend=v.extend=N.extend=w.extend=O.extend=B;var j=function(){throw new Error('A "url" property or function must be specified')},F=function(e,t){var n=t.error;t.error=function(r){n&&n(e,r,t),e.trigger("error",e,r,t)}}}.call(this),define("backbone",["underscore","jquery"],function(e){return function(){var t,n;return t||e.Backbone}}(this));if(typeof jQuery=="undefined")throw new Error("Bootstrap's JavaScript requires jQuery");+function(e){"use strict";var t=e.fn.jquery.split(" ")[0].split(".");if(t[0]<2&&t[1]<9||t[0]==1&&t[1]==9&&t[2]<1||t[0]>3)throw new Error("Bootstrap's JavaScript requires jQuery version 1.9.1 or higher, but lower than version 4")}(jQuery),+function(e){"use strict";function t(){var e=document.createElement("bootstrap"),t={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var n in t)if(e.style[n]!==undefined)return{end:t[n]};return!1}e.fn.emulateTransitionEnd=function(t){var n=!1,r=this;e(this).one("bsTransitionEnd",function(){n=!0});var i=function(){n||e(r).trigger(e.support.transition.end)};return setTimeout(i,t),this},e(function(){e.support.transition=t();if(!e.support.transition)return;e.event.special.bsTransitionEnd={bindType:e.support.transition.end,delegateType:e.support.transition.end,handle:function(t){if(e(t.target).is(this))return t.handleObj.handler.apply(this,arguments)}}})}(jQuery),+function(e){"use strict";function r(t){return this.each(function(){var r=e(this),i=r.data("bs.alert");i||r.data("bs.alert",i=new n(this)),typeof t=="string"&&i[t].call(r)})}var t='[data-dismiss="alert"]',n=function(n){e(n).on("click",t,this.close)};n.VERSION="3.3.7",n.TRANSITION_DURATION=150,n.prototype.close=function(t){function o(){s.detach().trigger("closed.bs.alert").remove()}var r=e(this),i=r.attr("data-target");i||(i=r.attr("href"),i=i&&i.replace(/.*(?=#[^\s]*$)/,""));var s=e(i==="#"?[]:i);t&&t.preventDefault(),s.length||(s=r.closest(".alert")),s.trigger(t=e.Event("close.bs.alert"));if(t.isDefaultPrevented())return;s.removeClass("in"),e.support.transition&&s.hasClass("fade")?s.one("bsTransitionEnd",o).emulateTransitionEnd(n.TRANSITION_DURATION):o()};var i=e.fn.alert;e.fn.alert=r,e.fn.alert.Constructor=n,e.fn.alert.noConflict=function(){return e.fn.alert=i,this},e(document).on("click.bs.alert.data-api",t,n.prototype.close)}(jQuery),+function(e){"use strict";function n(n){return this.each(function(){var r=e(this),i=r.data("bs.button"),s=typeof n=="object"&&n;i||r.data("bs.button",i=new t(this,s)),n=="toggle"?i.toggle():n&&i.setState(n)})}var t=function(n,r){this.$element=e(n),this.options=e.extend({},t.DEFAULTS,r),this.isLoading=!1};t.VERSION="3.3.7",t.DEFAULTS={loadingText:"loading..."},t.prototype.setState=function(t){var n="disabled",r=this.$element,i=r.is("input")?"val":"html",s=r.data();t+="Text",s.resetText==null&&r.data("resetText",r[i]()),setTimeout(e.proxy(function(){r[i](s[t]==null?this.options[t]:s[t]),t=="loadingText"?(this.isLoading=!0,r.addClass(n).attr(n,n).prop(n,!0)):this.isLoading&&(this.isLoading=!1,r.removeClass(n).removeAttr(n).prop(n,!1))},this),0)},t.prototype.toggle=function(){var e=!0,t=this.$element.closest('[data-toggle="buttons"]');if(t.length){var n=this.$element.find("input");n.prop("type")=="radio"?(n.prop("checked")&&(e=!1),t.find(".active").removeClass("active"),this.$element.addClass("active")):n.prop("type")=="checkbox"&&(n.prop("checked")!==this.$element.hasClass("active")&&(e=!1),this.$element.toggleClass("active")),n.prop("checked",this.$element.hasClass("active")),e&&n.trigger("change")}else this.$element.attr("aria-pressed",!this.$element.hasClass("active")),this.$element.toggleClass("active")};var r=e.fn.button;e.fn.button=n,e.fn.button.Constructor=t,e.fn.button.noConflict=function(){return e.fn.button=r,this},e(document).on("click.bs.button.data-api",'[data-toggle^="button"]',function(t){var r=e(t.target).closest(".btn");n.call(r,"toggle"),e(t.target).is('input[type="radio"], input[type="checkbox"]')||(t.preventDefault(),r.is("input,button")?r.trigger("focus"):r.find("input:visible,button:visible").first().trigger("focus"))}).on("focus.bs.button.data-api blur.bs.button.data-api",'[data-toggle^="button"]',function(t){e(t.target).closest(".btn").toggleClass("focus",/^focus(in)?$/.test(t.type))})}(jQuery),+function(e){"use strict";function n(n){return this.each(function(){var r=e(this),i=r.data("bs.carousel"),s=e.extend({},t.DEFAULTS,r.data(),typeof n=="object"&&n),o=typeof n=="string"?n:s.slide;i||r.data("bs.carousel",i=new t(this,s)),typeof n=="number"?i.to(n):o?i[o]():s.interval&&i.pause().cycle()})}var t=function(t,n){this.$element=e(t),this.$indicators=this.$element.find(".carousel-indicators"),this.options=n,this.paused=null,this.sliding=null,this.interval=null,this.$active=null,this.$items=null,this.options.keyboard&&this.$element.on("keydown.bs.carousel",e.proxy(this.keydown,this)),this.options.pause=="hover"&&!("ontouchstart"in document.documentElement)&&this.$element.on("mouseenter.bs.carousel",e.proxy(this.pause,this)).on("mouseleave.bs.carousel",e.proxy(this.cycle,this))};t.VERSION="3.3.7",t.TRANSITION_DURATION=600,t.DEFAULTS={interval:5e3,pause:"hover",wrap:!0,keyboard:!0},t.prototype.keydown=function(e){if(/input|textarea/i.test(e.target.tagName))return;switch(e.which){case 37:this.prev();break;case 39:this.next();break;default:return}e.preventDefault()},t.prototype.cycle=function(t){return t||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(e.proxy(this.next,this),this.options.interval)),this},t.prototype.getItemIndex=function(e){return this.$items=e.parent().children(".item"),this.$items.index(e||this.$active)},t.prototype.getItemForDirection=function(e,t){var n=this.getItemIndex(t),r=e=="prev"&&n===0||e=="next"&&n==this.$items.length-1;if(r&&!this.options.wrap)return t;var i=e=="prev"?-1:1,s=(n+i)%this.$items.length;return this.$items.eq(s)},t.prototype.to=function(e){var t=this,n=this.getItemIndex(this.$active=this.$element.find(".item.active"));if(e>this.$items.length-1||e<0)return;return this.sliding?this.$element.one("slid.bs.carousel",function(){t.to(e)}):n==e?this.pause().cycle():this.slide(e>n?"next":"prev",this.$items.eq(e))},t.prototype.pause=function(t){return t||(this.paused=!0),this.$element.find(".next, .prev").length&&e.support.transition&&(this.$element.trigger(e.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},t.prototype.next=function(){if(this.sliding)return;return this.slide("next")},t.prototype.prev=function(){if(this.sliding)return;return this.slide("prev")},t.prototype.slide=function(n,r){var i=this.$element.find(".item.active"),s=r||this.getItemForDirection(n,i),o=this.interval,u=n=="next"?"left":"right",a=this;if(s.hasClass("active"))return this.sliding=!1;var f=s[0],l=e.Event("slide.bs.carousel",{relatedTarget:f,direction:u});this.$element.trigger(l);if(l.isDefaultPrevented())return;this.sliding=!0,o&&this.pause();if(this.$indicators.length){this.$indicators.find(".active").removeClass("active");var c=e(this.$indicators.children()[this.getItemIndex(s)]);c&&c.addClass("active")}var h=e.Event("slid.bs.carousel",{relatedTarget:f,direction:u});return e.support.transition&&this.$element.hasClass("slide")?(s.addClass(n),s[0].offsetWidth,i.addClass(u),s.addClass(u),i.one("bsTransitionEnd",function(){s.removeClass([n,u].join(" ")).addClass("active"),i.removeClass(["active",u].join(" ")),a.sliding=!1,setTimeout(function(){a.$element.trigger(h)},0)}).emulateTransitionEnd(t.TRANSITION_DURATION)):(i.removeClass("active"),s.addClass("active"),this.sliding=!1,this.$element.trigger(h)),o&&this.cycle(),this};var r=e.fn.carousel;e.fn.carousel=n,e.fn.carousel.Constructor=t,e.fn.carousel.noConflict=function(){return e.fn.carousel=r,this};var i=function(t){var r,i=e(this),s=e(i.attr("data-target")||(r=i.attr("href"))&&r.replace(/.*(?=#[^\s]+$)/,""));if(!s.hasClass("carousel"))return;var o=e.extend({},s.data(),i.data()),u=i.attr("data-slide-to");u&&(o.interval=!1),n.call(s,o),u&&s.data("bs.carousel").to(u),t.preventDefault()};e(document).on("click.bs.carousel.data-api","[data-slide]",i).on("click.bs.carousel.data-api","[data-slide-to]",i),e(window).on("load",function(){e('[data-ride="carousel"]').each(function(){var t=e(this);n.call(t,t.data())})})}(jQuery),+function(e){"use strict";function n(t){var n,r=t.attr("data-target")||(n=t.attr("href"))&&n.replace(/.*(?=#[^\s]+$)/,"");return e(r)}function r(n){return this.each(function(){var r=e(this),i=r.data("bs.collapse"),s=e.extend({},t.DEFAULTS,r.data(),typeof n=="object"&&n);!i&&s.toggle&&/show|hide/.test(n)&&(s.toggle=!1),i||r.data("bs.collapse",i=new t(this,s)),typeof n=="string"&&i[n]()})}var t=function(n,r){this.$element=e(n),this.options=e.extend({},t.DEFAULTS,r),this.$trigger=e('[data-toggle="collapse"][href="#'+n.id+'"],'+'[data-toggle="collapse"][data-target="#'+n.id+'"]'),this.transitioning=null,this.options.parent?this.$parent=this.getParent():this.addAriaAndCollapsedClass(this.$element,this.$trigger),this.options.toggle&&this.toggle()};t.VERSION="3.3.7",t.TRANSITION_DURATION=350,t.DEFAULTS={toggle:!0},t.prototype.dimension=function(){var e=this.$element.hasClass("width");return e?"width":"height"},t.prototype.show=function(){if(this.transitioning||this.$element.hasClass("in"))return;var n,i=this.$parent&&this.$parent.children(".panel").children(".in, .collapsing");if(i&&i.length){n=i.data("bs.collapse");if(n&&n.transitioning)return}var s=e.Event("show.bs.collapse");this.$element.trigger(s);if(s.isDefaultPrevented())return;i&&i.length&&(r.call(i,"hide"),n||i.data("bs.collapse",null));var o=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[o](0).attr("aria-expanded",!0),this.$trigger.removeClass("collapsed").attr("aria-expanded",!0),this.transitioning=1;var u=function(){this.$element.removeClass("collapsing").addClass("collapse in")[o](""),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!e.support.transition)return u.call(this);var a=e.camelCase(["scroll",o].join("-"));this.$element.one("bsTransitionEnd",e.proxy(u,this)).emulateTransitionEnd(t.TRANSITION_DURATION)[o](this.$element[0][a])},t.prototype.hide=function(){if(this.transitioning||!this.$element.hasClass("in"))return;var n=e.Event("hide.bs.collapse");this.$element.trigger(n);if(n.isDefaultPrevented())return;var r=this.dimension();this.$element[r](this.$element[r]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse in").attr("aria-expanded",!1),this.$trigger.addClass("collapsed").attr("aria-expanded",!1),this.transitioning=1;var i=function(){this.transitioning=0,this.$element.removeClass("collapsing").addClass("collapse").trigger("hidden.bs.collapse")};if(!e.support.transition)return i.call(this);this.$element[r](0).one("bsTransitionEnd",e.proxy(i,this)).emulateTransitionEnd(t.TRANSITION_DURATION)},t.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()},t.prototype.getParent=function(){return e(this.options.parent).find('[data-toggle="collapse"][data-parent="'+this.options.parent+'"]').each(e.proxy(function(t,r){var i=e(r);this.addAriaAndCollapsedClass(n(i),i)},this)).end()},t.prototype.addAriaAndCollapsedClass=function(e,t){var n=e.hasClass("in");e.attr("aria-expanded",n),t.toggleClass("collapsed",!n).attr("aria-expanded",n)};var i=e.fn.collapse;e.fn.collapse=r,e.fn.collapse.Constructor=t,e.fn.collapse.noConflict=function(){return e.fn.collapse=i,this},e(document).on("click.bs.collapse.data-api",'[data-toggle="collapse"]',function(t){var i=e(this);i.attr("data-target")||t.preventDefault();var s=n(i),o=s.data("bs.collapse"),u=o?"toggle":i.data();r.call(s,u)})}(jQuery),+function(e){"use strict";function i(t){var n=t.attr("data-target");n||(n=t.attr("href"),n=n&&/#[A-Za-z]/.test(n)&&n.replace(/.*(?=#[^\s]*$)/,""));var r=n&&e(n);return r&&r.length?r:t.parent()}function s(r){if(r&&r.which===3)return;e(t).remove(),e(n).each(function(){var t=e(this),n=i(t),s={relatedTarget:this};if(!n.hasClass("open"))return;if(r&&r.type=="click"&&/input|textarea/i.test(r.target.tagName)&&e.contains(n[0],r.target))return;n.trigger(r=e.Event("hide.bs.dropdown",s));if(r.isDefaultPrevented())return;t.attr("aria-expanded","false"),n.removeClass("open").trigger(e.Event("hidden.bs.dropdown",s))})}function o(t){return this.each(function(){var n=e(this),i=n.data("bs.dropdown");i||n.data("bs.dropdown",i=new r(this)),typeof t=="string"&&i[t].call(n)})}var t=".dropdown-backdrop",n='[data-toggle="dropdown"]',r=function(t){e(t).on("click.bs.dropdown",this.toggle)};r.VERSION="3.3.7",r.prototype.toggle=function(t){var n=e(this);if(n.is(".disabled, :disabled"))return;var r=i(n),o=r.hasClass("open");s();if(!o){"ontouchstart"in document.documentElement&&!r.closest(".navbar-nav").length&&e(document.createElement("div")).addClass("dropdown-backdrop").insertAfter(e(this)).on("click",s);var u={relatedTarget:this};r.trigger(t=e.Event("show.bs.dropdown",u));if(t.isDefaultPrevented())return;n.trigger("focus").attr("aria-expanded","true"),r.toggleClass("open").trigger(e.Event("shown.bs.dropdown",u))}return!1},r.prototype.keydown=function(t){if(!/(38|40|27|32)/.test(t.which)||/input|textarea/i.test(t.target.tagName))return;var r=e(this);t.preventDefault(),t.stopPropagation();if(r.is(".disabled, :disabled"))return;var s=i(r),o=s.hasClass("open");if(!o&&t.which!=27||o&&t.which==27)return t.which==27&&s.find(n).trigger("focus"),r.trigger("click");var u=" li:not(.disabled):visible a",a=s.find(".dropdown-menu"+u);if(!a.length)return;var f=a.index(t.target);t.which==38&&f>0&&f--,t.which==40&&f<a.length-1&&f++,~f||(f=0),a.eq(f).trigger("focus")};var u=e.fn.dropdown;e.fn.dropdown=o,e.fn.dropdown.Constructor=r,e.fn.dropdown.noConflict=function(){return e.fn.dropdown=u,this},e(document).on("click.bs.dropdown.data-api",s).on("click.bs.dropdown.data-api",".dropdown form",function(e){e.stopPropagation()}).on("click.bs.dropdown.data-api",n,r.prototype.toggle).on("keydown.bs.dropdown.data-api",n,r.prototype.keydown).on("keydown.bs.dropdown.data-api",".dropdown-menu",r.prototype.keydown)}(jQuery),+function(e){"use strict";function n(n,r){return this.each(function(){var i=e(this),s=i.data("bs.modal"),o=e.extend({},t.DEFAULTS,i.data(),typeof n=="object"&&n);s||i.data("bs.modal",s=new t(this,o)),typeof n=="string"?s[n](r):o.show&&s.show(r)})}var t=function(t,n){this.options=n,this.$body=e(document.body),this.$element=e(t),this.$dialog=this.$element.find(".modal-dialog"),this.$backdrop=null,this.isShown=null,this.originalBodyPad=null,this.scrollbarWidth=0,this.ignoreBackdropClick=!1,this.options.remote&&this.$element.find(".modal-content").load(this.options.remote,e.proxy(function(){this.$element.trigger("loaded.bs.modal")},this))};t.VERSION="3.3.7",t.TRANSITION_DURATION=300,t.BACKDROP_TRANSITION_DURATION=150,t.DEFAULTS={backdrop:!0,keyboard:!0,show:!0},t.prototype.toggle=function(e){return this.isShown?this.hide():this.show(e)},t.prototype.show=function(n){var r=this,i=e.Event("show.bs.modal",{relatedTarget:n});this.$element.trigger(i);if(this.isShown||i.isDefaultPrevented())return;this.isShown=!0,this.checkScrollbar(),this.setScrollbar(),this.$body.addClass("modal-open"),this.escape(),this.resize(),this.$element.on("click.dismiss.bs.modal",'[data-dismiss="modal"]',e.proxy(this.hide,this)),this.$dialog.on("mousedown.dismiss.bs.modal",function(){r.$element.one("mouseup.dismiss.bs.modal",function(t){e(t.target).is(r.$element)&&(r.ignoreBackdropClick=!0)})}),this.backdrop(function(){var i=e.support.transition&&r.$element.hasClass("fade");r.$element.parent().length||r.$element.appendTo(r.$body),r.$element.show().scrollTop(0),r.adjustDialog(),i&&r.$element[0].offsetWidth,r.$element.addClass("in"),r.enforceFocus();var s=e.Event("shown.bs.modal",{relatedTarget:n});i?r.$dialog.one("bsTransitionEnd",function(){r.$element.trigger("focus").trigger(s)}).emulateTransitionEnd(t.TRANSITION_DURATION):r.$element.trigger("focus").trigger(s)})},t.prototype.hide=function(n){n&&n.preventDefault(),n=e.Event("hide.bs.modal"),this.$element.trigger(n);if(!this.isShown||n.isDefaultPrevented())return;this.isShown=!1,this.escape(),this.resize(),e(document).off("focusin.bs.modal"),this.$element.removeClass("in").off("click.dismiss.bs.modal").off("mouseup.dismiss.bs.modal"),this.$dialog.off("mousedown.dismiss.bs.modal"),e.support.transition&&this.$element.hasClass("fade")?this.$element.one("bsTransitionEnd",e.proxy(this.hideModal,this)).emulateTransitionEnd(t.TRANSITION_DURATION):this.hideModal()},t.prototype.enforceFocus=function(){e(document).off("focusin.bs.modal").on("focusin.bs.modal",e.proxy(function(e){document!==e.target&&this.$element[0]!==e.target&&!this.$element.has(e.target).length&&this.$element.trigger("focus")},this))},t.prototype.escape=function(){this.isShown&&this.options.keyboard?this.$element.on("keydown.dismiss.bs.modal",e.proxy(function(e){e.which==27&&this.hide()},this)):this.isShown||this.$element.off("keydown.dismiss.bs.modal")},t.prototype.resize=function(){this.isShown?e(window).on("resize.bs.modal",e.proxy(this.handleUpdate,this)):e(window).off("resize.bs.modal")},t.prototype.hideModal=function(){var e=this;this.$element.hide(),this.backdrop(function(){e.$body.removeClass("modal-open"),e.resetAdjustments(),e.resetScrollbar(),e.$element.trigger("hidden.bs.modal")})},t.prototype.removeBackdrop=function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},t.prototype.backdrop=function(n){var r=this,i=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var s=e.support.transition&&i;this.$backdrop=e(document.createElement("div")).addClass("modal-backdrop "+i).appendTo(this.$body),this.$element.on("click.dismiss.bs.modal",e.proxy(function(e){if(this.ignoreBackdropClick){this.ignoreBackdropClick=!1;return}if(e.target!==e.currentTarget)return;this.options.backdrop=="static"?this.$element[0].focus():this.hide()},this)),s&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in");if(!n)return;s?this.$backdrop.one("bsTransitionEnd",n).emulateTransitionEnd(t.BACKDROP_TRANSITION_DURATION):n()}else if(!this.isShown&&this.$backdrop){this.$backdrop.removeClass("in");var o=function(){r.removeBackdrop(),n&&n()};e.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one("bsTransitionEnd",o).emulateTransitionEnd(t.BACKDROP_TRANSITION_DURATION):o()}else n&&n()},t.prototype.handleUpdate=function(){this.adjustDialog()},t.prototype.adjustDialog=function(){var e=this.$element[0].scrollHeight>document.documentElement.clientHeight;this.$element.css({paddingLeft:!this.bodyIsOverflowing&&e?this.scrollbarWidth:"",paddingRight:this.bodyIsOverflowing&&!e?this.scrollbarWidth:""})},t.prototype.resetAdjustments=function(){this.$element.css({paddingLeft:"",paddingRight:""})},t.prototype.checkScrollbar=function(){var e=window.innerWidth;if(!e){var t=document.documentElement.getBoundingClientRect();e=t.right-Math.abs(t.left)}this.bodyIsOverflowing=document.body.clientWidth<e,this.scrollbarWidth=this.measureScrollbar()},t.prototype.setScrollbar=function(){var e=parseInt(this.$body.css("padding-right")||0,10);this.originalBodyPad=document.body.style.paddingRight||"",this.bodyIsOverflowing&&this.$body.css("padding-right",e+this.scrollbarWidth)},t.prototype.resetScrollbar=function(){this.$body.css("padding-right",this.originalBodyPad)},t.prototype.measureScrollbar=function(){var e=document.createElement("div");e.className="modal-scrollbar-measure",this.$body.append(e);var t=e.offsetWidth-e.clientWidth;return this.$body[0].removeChild(e),t};var r=e.fn.modal;e.fn.modal=n,e.fn.modal.Constructor=t,e.fn.modal.noConflict=function(){return e.fn.modal=r,this},e(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',function(t){var r=e(this),i=r.attr("href"),s=e(r.attr("data-target")||i&&i.replace(/.*(?=#[^\s]+$)/,"")),o=s.data("bs.modal")?"toggle":e.extend({remote:!/#/.test(i)&&i},s.data(),r.data());r.is("a")&&t.preventDefault(),s.one("show.bs.modal",function(e){if(e.isDefaultPrevented())return;s.one("hidden.bs.modal",function(){r.is(":visible")&&r.trigger("focus")})}),n.call(s,o,this)})}(jQuery),+function(e){"use strict";function n(n){return this.each(function(){var r=e(this),i=r.data("bs.tooltip"),s=typeof n=="object"&&n;if(!i&&/destroy|hide/.test(n))return;i||r.data("bs.tooltip",i=new t(this,s)),typeof n=="string"&&i[n]()})}var t=function(e,t){this.type=null,this.options=null,this.enabled=null,this.timeout=null,this.hoverState=null,this.$element=null,this.inState=null,this.init("tooltip",e,t)};t.VERSION="3.3.7",t.TRANSITION_DURATION=150,t.DEFAULTS={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:!1,container:!1,viewport:{selector:"body",padding:0}},t.prototype.init=function(t,n,r){this.enabled=!0,this.type=t,this.$element=e(n),this.options=this.getOptions(r),this.$viewport=this.options.viewport&&e(e.isFunction(this.options.viewport)?this.options.viewport.call(this,this.$element):this.options.viewport.selector||this.options.viewport),this.inState={click:!1,hover:!1,focus:!1};if(this.$element[0]instanceof document.constructor&&!this.options.selector)throw new Error("`selector` option must be specified when initializing "+this.type+" on the window.document object!");var i=this.options.trigger.split(" ");for(var s=i.length;s--;){var o=i[s];if(o=="click")this.$element.on("click."+this.type,this.options.selector,e.proxy(this.toggle,this));else if(o!="manual"){var u=o=="hover"?"mouseenter":"focusin",a=o=="hover"?"mouseleave":"focusout";this.$element.on(u+"."+this.type,this.options.selector,e.proxy(this.enter,this)),this.$element.on(a+"."+this.type,this.options.selector,e.proxy(this.leave,this))}}this.options.selector?this._options=e.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},t.prototype.getDefaults=function(){return t.DEFAULTS},t.prototype.getOptions=function(t){return t=e.extend({},this.getDefaults(),this.$element.data(),t),t.delay&&typeof t.delay=="number"&&(t.delay={show:t.delay,hide:t.delay}),t},t.prototype.getDelegateOptions=function(){var t={},n=this.getDefaults();return this._options&&e.each(this._options,function(e,r){n[e]!=r&&(t[e]=r)}),t},t.prototype.enter=function(t){var n=t instanceof this.constructor?t:e(t.currentTarget).data("bs."+this.type);n||(n=new this.constructor(t.currentTarget,this.getDelegateOptions()),e(t.currentTarget).data("bs."+this.type,n)),t instanceof e.Event&&(n.inState[t.type=="focusin"?"focus":"hover"]=!0);if(n.tip().hasClass("in")||n.hoverState=="in"){n.hoverState="in";return}clearTimeout(n.timeout),n.hoverState="in";if(!n.options.delay||!n.options.delay.show)return n.show();n.timeout=setTimeout(function(){n.hoverState=="in"&&n.show()},n.options.delay.show)},t.prototype.isInStateTrue=function(){for(var e in this.inState)if(this.inState[e])return!0;return!1},t.prototype.leave=function(t){var n=t instanceof this.constructor?t:e(t.currentTarget).data("bs."+this.type);n||(n=new this.constructor(t.currentTarget,this.getDelegateOptions()),e(t.currentTarget).data("bs."+this.type,n)),t instanceof e.Event&&(n.inState[t.type=="focusout"?"focus":"hover"]=!1);if(n.isInStateTrue())return;clearTimeout(n.timeout),n.hoverState="out";if(!n.options.delay||!n.options.delay.hide)return n.hide();n.timeout=setTimeout(function(){n.hoverState=="out"&&n.hide()},n.options.delay.hide)},t.prototype.show=function(){var n=e.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(n);var r=e.contains(this.$element[0].ownerDocument.documentElement,this.$element[0]);if(n.isDefaultPrevented()||!r)return;var i=this,s=this.tip(),o=this.getUID(this.type);this.setContent(),s.attr("id",o),this.$element.attr("aria-describedby",o),this.options.animation&&s.addClass("fade");var u=typeof this.options.placement=="function"?this.options.placement.call(this,s[0],this.$element[0]):this.options.placement,a=/\s?auto?\s?/i,f=a.test(u);f&&(u=u.replace(a,"")||"top"),s.detach().css({top:0,left:0,display:"block"}).addClass(u).data("bs."+this.type,this),this.options.container?s.appendTo(this.options.container):s.insertAfter(this.$element),this.$element.trigger("inserted.bs."+this.type);var l=this.getPosition(),c=s[0].offsetWidth,h=s[0].offsetHeight;if(f){var p=u,d=this.getPosition(this.$viewport);u=u=="bottom"&&l.bottom+h>d.bottom?"top":u=="top"&&l.top-h<d.top?"bottom":u=="right"&&l.right+c>d.width?"left":u=="left"&&l.left-c<d.left?"right":u,s.removeClass(p).addClass(u)}var v=this.getCalculatedOffset(u,l,c,h);this.applyPlacement(v,u);var m=function(){var e=i.hoverState;i.$element.trigger("shown.bs."+i.type),i.hoverState=null,e=="out"&&i.leave(i)};e.support.transition&&this.$tip.hasClass("fade")?s.one("bsTransitionEnd",m).emulateTransitionEnd(t.TRANSITION_DURATION):m()}},t.prototype.applyPlacement=function(t,n){var r=this.tip(),i=r[0].offsetWidth,s=r[0].offsetHeight,o=parseInt(r.css("margin-top"),10),u=parseInt(r.css("margin-left"),10);isNaN(o)&&(o=0),isNaN(u)&&(u=0),t.top+=o,t.left+=u,e.offset.setOffset(r[0],e.extend({using:function(e){r.css({top:Math.round(e.top),left:Math.round(e.left)})}},t),0),r.addClass("in");var a=r[0].offsetWidth,f=r[0].offsetHeight;n=="top"&&f!=s&&(t.top=t.top+s-f);var l=this.getViewportAdjustedDelta(n,t,a,f);l.left?t.left+=l.left:t.top+=l.top;var c=/top|bottom/.test(n),h=c?l.left*2-i+a:l.top*2-s+f,p=c?"offsetWidth":"offsetHeight";r.offset(t),this.replaceArrow(h,r[0][p],c)},t.prototype.replaceArrow=function(e,t,n){this.arrow().css(n?"left":"top",50*(1-e/t)+"%").css(n?"top":"left","")},t.prototype.setContent=function(){var e=this.tip(),t=this.getTitle();e.find(".tooltip-inner")[this.options.html?"html":"text"](t),e.removeClass("fade in top bottom left right")},t.prototype.hide=function(n){function o(){r.hoverState!="in"&&i.detach(),r.$element&&r.$element.removeAttr("aria-describedby").trigger("hidden.bs."+r.type),n&&n()}var r=this,i=e(this.$tip),s=e.Event("hide.bs."+this.type);this.$element.trigger(s);if(s.isDefaultPrevented())return;return i.removeClass("in"),e.support.transition&&i.hasClass("fade")?i.one("bsTransitionEnd",o).emulateTransitionEnd(t.TRANSITION_DURATION):o(),this.hoverState=null,this},t.prototype.fixTitle=function(){var e=this.$element;(e.attr("title")||typeof e.attr("data-original-title")!="string")&&e.attr("data-original-title",e.attr("title")||"").attr("title","")},t.prototype.hasContent=function(){return this.getTitle()},t.prototype.getPosition=function(t){t=t||this.$element;var n=t[0],r=n.tagName=="BODY",i=n.getBoundingClientRect();i.width==null&&(i=e.extend({},i,{width:i.right-i.left,height:i.bottom-i.top}));var s=window.SVGElement&&n instanceof window.SVGElement,o=r?{top:0,left:0}:s?null:t.offset(),u={scroll:r?document.documentElement.scrollTop||document.body.scrollTop:t.scrollTop()},a=r?{width:e(window).width(),height:e(window).height()}:null;return e.extend({},i,u,a,o)},t.prototype.getCalculatedOffset=function(e,t,n,r){return e=="bottom"?{top:t.top+t.height,left:t.left+t.width/2-n/2}:e=="top"?{top:t.top-r,left:t.left+t.width/2-n/2}:e=="left"?{top:t.top+t.height/2-r/2,left:t.left-n}:{top:t.top+t.height/2-r/2,left:t.left+t.width}},t.prototype.getViewportAdjustedDelta=function(e,t,n,r){var i={top:0,left:0};if(!this.$viewport)return i;var s=this.options.viewport&&this.options.viewport.padding||0,o=this.getPosition(this.$viewport);if(/right|left/.test(e)){var u=t.top-s-o.scroll,a=t.top+s-o.scroll+r;u<o.top?i.top=o.top-u:a>o.top+o.height&&(i.top=o.top+o.height-a)}else{var f=t.left-s,l=t.left+s+n;f<o.left?i.left=o.left-f:l>o.right&&(i.left=o.left+o.width-l)}return i},t.prototype.getTitle=function(){var e,t=this.$element,n=this.options;return e=t.attr("data-original-title")||(typeof n.title=="function"?n.title.call(t[0]):n.title),e},t.prototype.getUID=function(e){do e+=~~(Math.random()*1e6);while(document.getElementById(e));return e},t.prototype.tip=function(){if(!this.$tip){this.$tip=e(this.options.template);if(this.$tip.length!=1)throw new Error(this.type+" `template` option must consist of exactly 1 top-level element!")}return this.$tip},t.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},t.prototype.enable=function(){this.enabled=!0},t.prototype.disable=function(){this.enabled=!1},t.prototype.toggleEnabled=function(){this.enabled=!this.enabled},t.prototype.toggle=function(t){var n=this;t&&(n=e(t.currentTarget).data("bs."+this.type),n||(n=new this.constructor(t.currentTarget,this.getDelegateOptions()),e(t.currentTarget).data("bs."+this.type,n))),t?(n.inState.click=!n.inState.click,n.isInStateTrue()?n.enter(n):n.leave(n)):n.tip().hasClass("in")?n.leave(n):n.enter(n)},t.prototype.destroy=function(){var e=this;clearTimeout(this.timeout),this.hide(function(){e.$element.off("."+e.type).removeData("bs."+e.type),e.$tip&&e.$tip.detach(),e.$tip=null,e.$arrow=null,e.$viewport=null,e.$element=null})};var r=e.fn.tooltip;e.fn.tooltip=n,e.fn.tooltip.Constructor=t,e.fn.tooltip.noConflict=function(){return e.fn.tooltip=r,this}}(jQuery),+function(e){"use strict";function n(n){return this.each(function(){var r=e(this),i=r.data("bs.popover"),s=typeof n=="object"&&n;if(!i&&/destroy|hide/.test(n))return;i||r.data("bs.popover",i=new t(this,s)),typeof n=="string"&&i[n]()})}var t=function(e,t){this.init("popover",e,t)};if(!e.fn.tooltip)throw new Error("Popover requires tooltip.js");t.VERSION="3.3.7",t.DEFAULTS=e.extend({},e.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:'<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'}),t.prototype=e.extend({},e.fn.tooltip.Constructor.prototype),t.prototype.constructor=t,t.prototype.getDefaults=function(){return t.DEFAULTS},t.prototype.setContent=function(){var e=this.tip(),t=this.getTitle(),n=this.getContent();e.find(".popover-title")[this.options.html?"html":"text"](t),e.find(".popover-content").children().detach().end()[this.options.html?typeof n=="string"?"html":"append":"text"](n),e.removeClass("fade top bottom left right in"),e.find(".popover-title").html()||e.find(".popover-title").hide()},t.prototype.hasContent=function(){return this.getTitle()||this.getContent()},t.prototype.getContent=function(){var e=this.$element,t=this.options;return e.attr("data-content")||(typeof t.content=="function"?t.content.call(e[0]):t.content)},t.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")};var r=e.fn.popover;e.fn.popover=n,e.fn.popover.Constructor=t,e.fn.popover.noConflict=function(){return e.fn.popover=r,this}}(jQuery),+function(e){"use strict";function t(n,r){this.$body=e(document.body),this.$scrollElement=e(n).is(document.body)?e(window):e(n),this.options=e.extend({},t.DEFAULTS,r),this.selector=(this.options.target||"")+" .nav li > a",this.offsets=[],this.targets=[],this.activeTarget=null,this.scrollHeight=0,this.$scrollElement.on("scroll.bs.scrollspy",e.proxy(this.process,this)),this.refresh(),this.process()}function n(n){return this.each(function(){var r=e(this),i=r.data("bs.scrollspy"),s=typeof n=="object"&&n;i||r.data("bs.scrollspy",i=new t(this,s)),typeof n=="string"&&i[n]()})}t.VERSION="3.3.7",t.DEFAULTS={offset:10},t.prototype.getScrollHeight=function(){return this.$scrollElement[0].scrollHeight||Math.max(this.$body[0].scrollHeight,document.documentElement.scrollHeight)},t.prototype.refresh=function(){var t=this,n="offset",r=0;this.offsets=[],this.targets=[],this.scrollHeight=this.getScrollHeight(),e.isWindow(this.$scrollElement[0])||(n="position",r=this.$scrollElement.scrollTop()),this.$body.find(this.selector).map(function(){var t=e(this),i=t.data("target")||t.attr("href"),s=/^#./.test(i)&&e(i);return s&&s.length&&s.is(":visible")&&[[s[n]().top+r,i]]||null}).sort(function(e,t){return e[0]-t[0]}).each(function(){t.offsets.push(this[0]),t.targets.push(this[1])})},t.prototype.process=function(){var e=this.$scrollElement.scrollTop()+this.options.offset,t=this.getScrollHeight(),n=this.options.offset+t-this.$scrollElement.height(),r=this.offsets,i=this.targets,s=this.activeTarget,o;this.scrollHeight!=t&&this.refresh();if(e>=n)return s!=(o=i[i.length-1])&&this.activate(o);if(s&&e<r[0])return this.activeTarget=null,this.clear();for(o=r.length;o--;)s!=i[o]&&e>=r[o]&&(r[o+1]===undefined||e<r[o+1])&&this.activate(i[o])},t.prototype.activate=function(t){this.activeTarget=t,this.clear();var n=this.selector+'[data-target="'+t+'"],'+this.selector+'[href="'+t+'"]',r=e(n).parents("li").addClass("active");r.parent(".dropdown-menu").length&&(r=r.closest("li.dropdown").addClass("active")),r.trigger("activate.bs.scrollspy")},t.prototype.clear=function(){e(this.selector).parentsUntil(this.options.target,".active").removeClass("active")};var r=e.fn.scrollspy;e.fn.scrollspy=n,e.fn.scrollspy.Constructor=t,e.fn.scrollspy.noConflict=function(){return e.fn.scrollspy=r,this},e(window).on("load.bs.scrollspy.data-api",function(){e('[data-spy="scroll"]').each(function(){var t=e(this);n.call(t,t.data())})})}(jQuery),+function(e){"use strict";function n(n){return this.each(function(){var r=e(this),i=r.data("bs.tab");i||r.data("bs.tab",i=new t(this)),typeof n=="string"&&i[n]()})}var t=function(t){this.element=e(t)};t.VERSION="3.3.7",t.TRANSITION_DURATION=150,t.prototype.show=function(){var t=this.element,n=t.closest("ul:not(.dropdown-menu)"),r=t.data("target");r||(r=t.attr("href"),r=r&&r.replace(/.*(?=#[^\s]*$)/,""));if(t.parent("li").hasClass("active"))return;var i=n.find(".active:last a"),s=e.Event("hide.bs.tab",{relatedTarget:t[0]}),o=e.Event("show.bs.tab",{relatedTarget:i[0]});i.trigger(s),t.trigger(o);if(o.isDefaultPrevented()||s.isDefaultPrevented())return;var u=e(r);this.activate(t.closest("li"),n),this.activate(u,u.parent(),function(){i.trigger({type:"hidden.bs.tab",relatedTarget:t[0]}),t.trigger({type:"shown.bs.tab",relatedTarget:i[0]})})},t.prototype.activate=function(n,r,i){function u(){s.removeClass("active").find("> .dropdown-menu > .active").removeClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!1),n.addClass("active").find('[data-toggle="tab"]').attr("aria-expanded",!0),o?(n[0].offsetWidth,n.addClass("in")):n.removeClass("fade"),n.parent(".dropdown-menu").length&&n.closest("li.dropdown").addClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!0),i&&i()}var s=r.find("> .active"),o=i&&e.support.transition&&(s.length&&s.hasClass("fade")||!!r.find("> .fade").length);s.length&&o?s.one("bsTransitionEnd",u).emulateTransitionEnd(t.TRANSITION_DURATION):u(),s.removeClass("in")};var r=e.fn.tab;e.fn.tab=n,e.fn.tab.Constructor=t,e.fn.tab.noConflict=function(){return e.fn.tab=r,this};var i=function(t){t.preventDefault(),n.call(e(this),"show")};e(document).on("click.bs.tab.data-api",'[data-toggle="tab"]',i).on("click.bs.tab.data-api",'[data-toggle="pill"]',i)}(jQuery),+function(e){"use strict";function n(n){return this.each(function(){var r=e(this),i=r.data("bs.affix"),s=typeof n=="object"&&n;i||r.data("bs.affix",i=new t(this,s)),typeof n=="string"&&i[n]()})}var t=function(n,r){this.options=e.extend({},t.DEFAULTS,r),this.$target=e(this.options.target).on("scroll.bs.affix.data-api",e.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",e.proxy(this.checkPositionWithEventLoop,this)),this.$element=e(n),this.affixed=null,this.unpin=null,this.pinnedOffset=null,this.checkPosition()};t.VERSION="3.3.7",t.RESET="affix affix-top affix-bottom",t.DEFAULTS={offset:0,target:window},t.prototype.getState=function(e,t,n,r){var i=this.$target.scrollTop(),s=this.$element.offset(),o=this.$target.height();if(n!=null&&this.affixed=="top")return i<n?"top":!1;if(this.affixed=="bottom")return n!=null?i+this.unpin<=s.top?!1:"bottom":i+o<=e-r?!1:"bottom";var u=this.affixed==null,a=u?i:s.top,f=u?o:t;return n!=null&&i<=n?"top":r!=null&&a+f>=e-r?"bottom":!1},t.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(t.RESET).addClass("affix");var e=this.$target.scrollTop(),n=this.$element.offset();return this.pinnedOffset=n.top-e},t.prototype.checkPositionWithEventLoop=function(){setTimeout(e.proxy(this.checkPosition,this),1)},t.prototype.checkPosition=function(){if(!this.$element.is(":visible"))return;var n=this.$element.height(),r=this.options.offset,i=r.top,s=r.bottom,o=Math.max(e(document).height(),e(document.body).height());typeof r!="object"&&(s=i=r),typeof i=="function"&&(i=r.top(this.$element)),typeof s=="function"&&(s=r.bottom(this.$element));var u=this.getState(o,n,i,s);if(this.affixed!=u){this.unpin!=null&&this.$element.css("top","");var a="affix"+(u?"-"+u:""),f=e.Event(a+".bs.affix");this.$element.trigger(f);if(f.isDefaultPrevented())return;this.affixed=u,this.unpin=u=="bottom"?this.getPinnedOffset():null,this.$element.removeClass(t.RESET).addClass(a).trigger(a.replace("affix","affixed")+".bs.affix")}u=="bottom"&&this.$element.offset({top:o-n-s})};var r=e.fn.affix;e.fn.affix=n,e.fn.affix.Constructor=t,e.fn.affix.noConflict=function(){return e.fn.affix=r,this},e(window).on("load",function(){e('[data-spy="affix"]').each(function(){var t=e(this),r=t.data();r.offset=r.offset||{},r.offsetBottom!=null&&(r.offset.bottom=r.offsetBottom),r.offsetTop!=null&&(r.offset.top=r.offsetTop),n.call(t,r)})})}(jQuery),define("bootstrap",["jquery"],function(){});if(Common===undefined)var Common={};define("notification",["backbone"],function(e){"use strict";var t=function(){};_.extend(t.prototype,e.Events);if(typeof Common.NotificationCenter!="undefined")throw"Native Common.NotificationCenter instance already defined.";t.extend=e.Model.extend,Common.NotificationCenter=new t}),function(){var e=function(e,t){var n=e.split("."),r=t||window;for(var i=0,s=n.length;i<s;i++)r=r[n[i]]||{};return r},t=function(e){_.extend(this,e||{}),this.eventbus=new r({application:this}),this.createApplicationNamespace(),this.initialize.apply(this,arguments),this.autoCreate!==!1&&$($.proxy(this.onReady,this))};_.extend(t.prototype,{nameSpace:"Application",models:{},collections:{},controllers:{},allocationMap:{model:"Models",collection:"Collections",controller:"Controllers",view:"Views"},createApplicationNamespace:function(){var e=window;this.nameSpace&&typeof e[this.nameSpace]=="undefined"&&(e[this.nameSpace]={}),e[this.nameSpace]=this,_.each(this.allocationMap,function(e,t){this[e]=this[e]||{}},this)},initialize:function(){},onReady:function(){this.start()},start:function(){this.initializeControllers(this.controllers||{}),this.launchControllers(),this.launch.call(this)},getClasseRefs:function(t,n){var r={},i=this.allocationMap[t],s=this[i];return _.each(n,function(t){r[t]=e(t,t.indexOf(".")>-1?window:s)},this),r},initializeControllers:function(t){this.controllers={},_.each(t,function(t){var n=t.indexOf(".")>-1?window:this[this.allocationMap.controller],r=e(t,n),i=t.split(".").pop(),s=new r({id:t,application:this});s.views=this.getClasseRefs("view",s.views||[]),_.extend(this.models,this.getClasseRefs("model",s.models||[])),_.extend(this.collections,this.getClasseRefs("collection",s.collections||{})),this.buildCollections(),this.controllers[t]=s},this)},launchControllers:function(){_.each(this.controllers,function(e,t){e.onLaunch(this)},this)},launch:function(){},addListeners:function(e,t){this.eventbus.addListeners(e,t)},getController:function(e){return this.controllers[e]},getModel:function(e){this._modelsCache=this._modelsCache||{};var t=this._modelsCache[e],n=this.getModelConstructor(e);return!t&&n&&(t=this.createModel(e),this._modelsCache[e]=t),t||null},getModelConstructor:function(e){return this.models[e]},createModel:function(e,t){var n=this.getModelConstructor(e),r=null;return n&&(r=new n(_.extend(t||{}))),r},getCollection:function(e){this._collectionsCache=this._collectionsCache||{};var t=this._collectionsCache[e],n=this.getCollectionConstructor(e);return!t&&n&&(t=this.createCollection(e),this._collectionsCache[e]=t),t||null},getCollectionConstructor:function(e){return this.collections[e]},createCollection:function(e){var t=this.getCollectionConstructor(e),n=null;return t&&(n=new t),n},buildCollections:function(){_.each(this.collections,function(e,t){this.getCollection(t)},this)}});if(typeof Backbone.Application!="undefined")throw"Native Backbone.Application instance already defined.";Backbone.Application=t,Backbone.Application.extend=Backbone.Model.extend;var n=function(e){_.extend(this,e||{}),this.initialize.apply(this,arguments)};_.extend(n.prototype,{name:null,views:{},models:{},collections:{},initialize:function(e){},addListeners:function(e){this.getApplication().addListeners(e,this)},onLaunch:function(e){},getApplication:function(){return this.application},getView:function(e){return this._viewsCache[e]},getViewConstructor:function(e){return this.views[e]},createView:function(e,t){var n=this.getViewConstructor(e),r=_.extend(t||{},{alias:e});return this._viewsCache=this._viewsCache||{},this._viewsCache[e]=new n(r),this._viewsCache[e].options=_.extend({},r),this._viewsCache[e]},getModel:function(e){return this.application.getModel(e)},getModelConstructor:function(e){return this.application.getModelConstructor(e)},createModel:function(e,t){return this.application.createModel(e)},getCollection:function(e){return this.application.getCollection(e)},getCollectionConstructor:function(e){return this.application.getCollectionConstructor(e)},createCollection:function(e){return this.application.createCollection(e)},fireEvent:function(e,t,n){this.application.eventbus.fireEvent(e,t,n)},bindViewEvents:function(e,t){this.unbindViewEvents(e),t=_.isFunction(t)?t.call(this):t;for(var n in t){var r=t[n];_.isFunction(r)||(r=this[t[n]]);var i=n.match(/^(\S+)\s*(.*)$/),s=i[1],o=i[2];r=_.bind(r,this),s+=".bindViewEvents"+e.cid,e.$el.on(s,o,r)}return this},unbindViewEvents:function(e){return e.$el.off(".bindViewEvents"+e.cid),this}});if(typeof Backbone.Controller!="undefined")throw"Native Backbone.Controller instance already defined.";Backbone.Controller=n,Backbone.Controller.extend=Backbone.Model.extend;var r=function(e){var t=this;_.extend(this,e||{}),_.extend(Backbone.View.prototype,{alias:null,hidden:!1,getAlias:function(){return this.options.alias},fireEvent:function(e,n){this.trigger.apply(this,arguments),t.fireEvent(this.getAlias(),e,n)},hide:function(){this.$el.hide(),this.hidden=!0},show:function(){this.$el.show(),this.hidden=!1}})};_.extend(r.prototype,{pool:{},addListeners:function(e,t){this.pool[t.id]=this.pool[t.id]||{};var n=this.pool[t.id];_.isArray(e)?_.each(e,function(e){this.addListeners(e,t)},this):_.isObject(e)&&_.each(e,function(e,t){_.each(e,function(e,r){n[t]=n[t]||{},n[t][r]=n[t][r]||[],n[t][r].push(e)},this)},this)},fireEvent:function(e,t,n){var r=this.getApplication();_.each(this.pool,function(i,s){var o=i[e];if(o){var u=o[t],a=r.getController(s);_.each(u,function(e){e.apply(a,n)})}},this)},getApplication:function(){return this.application}});if(typeof Backbone.EventBus!="undefined")throw"Native Backbone.Application instance already defined.";Backbone.EventBus=r}(),define("core",["backbone","notification"],function(){});if(Common===undefined)var Common={};Common.component=Common.component||{},Common.Analytics=Common.component.Analytics=new function(){var e;return{initialize:function(t,n){if(typeof t=="undefined")throw"Analytics: invalid id.";if(typeof n=="undefined"||Object.prototype.toString.apply(n)!=="[object String]")throw"Analytics: invalid category type.";e=n,$("head").append('<script type="text/javascript">var _gaq = _gaq || [];_gaq.push(["_setAccount", "'+t+'"]);'+'_gaq.push(["_trackPageview"]);'+"(function() {"+'var ga = document.createElement("script"); ga.type = "text/javascript"; ga.async = true;'+'ga.src = ("https:" == document.location.protocol ? "https://ssl" : "http://www") + ".google-analytics.com/ga.js";'+'var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(ga, s);'+"})();"+"</script>")},trackEvent:function(t,n,r){if(typeof t!="undefined"&&Object.prototype.toString.apply(t)!=="[object String]")throw"Analytics: invalid action type.";if(typeof n!="undefined"&&Object.prototype.toString.apply(n)!=="[object String]")throw"Analytics: invalid label type.";if(typeof r!="undefined"&&(Object.prototype.toString.apply(r)!=="[object Number]"||!isFinite(r)))throw"Analytics: invalid value type.";if(typeof _gaq=="undefined")return;if(e==="undefined")throw"Analytics is not initialized.";_gaq.push(["_trackEvent",e,t,n,r])}}},define("analytics",["jquery"],function(){});if(Common===undefined)var Common={};Common.Gateway=new function(){var e=this,t=$(e),n={init:function(e){t.trigger("init",e)},openDocument:function(e){t.trigger("opendocument",e)},showMessage:function(e){t.trigger("showmessage",e)},applyEditRights:function(e){t.trigger("applyeditrights",e)},processSaveResult:function(e){t.trigger("processsaveresult",e)},processRightsChange:function(e){t.trigger("processrightschange",e)},refreshHistory:function(e){t.trigger("refreshhistory",e)},setHistoryData:function(e){t.trigger("sethistorydata",e)},setEmailAddresses:function(e){t.trigger("setemailaddresses",e)},processMailMerge:function(e){t.trigger("processmailmerge",e)},downloadAs:function(){t.trigger("downloadas")},processMouse:function(e){t.trigger("processmouse",e)},internalCommand:function(e){t.trigger("internalcommand",e)},resetFocus:function(e){t.trigger("resetfocus",e)}},r=function(e){window.parent&&window.JSON&&(e.frameEditorId=window.frameEditorId,window.parent.postMessage(window.JSON.stringify(e),"*"))},i=function(e){var t=e.data;if(Object.prototype.toString.apply(t)!=="[object String]"||!window.JSON)return;var r,i;try{r=window.JSON.parse(t)}catch(s){r=""}r&&(i=n[r.command],i&&i.call(this,r.data))},s=function(e){i(e)};return window.attachEvent?window.attachEvent("onmessage",s):window.addEventListener("message",s,!1),{ready:function(){r({event:"onReady"})},requestEditRights:function(){r({event:"onRequestEditRights"})},requestHistory:function(){r({event:"onRequestHistory"})},requestHistoryData:function(e){r({event:"onRequestHistoryData",data:e})},requestRestore:function(e,t){r({event:"onRequestRestore",data:{version:e,url:t}})},requestEmailAddresses:function(){r({event:"onRequestEmailAddresses"})},requestStartMailMerge:function(){r({event:"onRequestStartMailMerge"})},requestHistoryClose:function(e){r({event:"onRequestHistoryClose"})},reportError:function(e,t){r({event:"onError",data:{errorCode:e,errorDescription:t}})},sendInfo:function(e){r({event:"onInfo",data:e})},setDocumentModified:function(e){r({event:"onDocumentStateChange",data:e})},internalMessage:function(e,t){r({event:"onInternalMessage",data:{type:e,data:t}})},updateVersion:function(){r({event:"onOutdatedVersion"})},downloadAs:function(e){r({event:"onDownloadAs",data:e})},collaborativeChanges:function(){r({event:"onCollaborativeChanges"})},requestRename:function(e){r({event:"onRequestRename",data:e})},metaChange:function(e){r({event:"onMetaChange",data:e})},on:function(n,r){var i=function(t,n){r.call(e,n)};t.on(n,i)}}},define("gateway",["jquery"],function(){});if(Common===undefined)var Common={};Common.Locale=new function(){var l10n={},_createXMLHTTPObject=function(){var e;try{e=new ActiveXObject("Msxml2.XMLHTTP")}catch(t){try{e=new ActiveXObject("Microsoft.XMLHTTP")}catch(n){e=!1}}return!e&&typeof XMLHttpRequest!="undefined"&&(e=new XMLHttpRequest),e},_applyLocalization=function(){try{for(var e in l10n){var t=e.split(".");if(t&&t.length>2){var n=window;for(var r=0;r<t.length-1;++r)n[t[r]]===undefined&&(n[t[r]]=new Object),n=n[t[r]];n&&(n[t[t.length-1]]=l10n[e])}}}catch(i){}},_get=function(prop,scope){var res="";return scope&&scope.name&&(res=l10n[scope.name+"."+prop]),res||(scope?eval(scope.name).prototype[prop]:"")},_getUrlParameterByName=function(e){e=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var t=new RegExp("[\\?&]"+e+"=([^&#]*)"),n=t.exec(location.search);return n==null?"":decodeURIComponent(n[1].replace(/\+/g," "))};try{var langParam=_getUrlParameterByName("lang"),xhrObj=_createXMLHTTPObject();if(xhrObj&&langParam){var lang=langParam.split("-")[0];xhrObj.open("GET","locale/"+lang+".json",!1),xhrObj.send(""),l10n=eval("("+xhrObj.responseText+")")}}catch(e){}return{apply:_applyLocalization,get:_get}},define("locale",function(){}),define("text",["module"],function(e){"use strict";var t,n,r,i,s,o=["Msxml2.XMLHTTP","Microsoft.XMLHTTP","Msxml2.XMLHTTP.4.0"],u=/^\s*<\?xml(\s)+version=[\'\"](\d)*.(\d)*[\'\"](\s)*\?>/im,a=/<body[^>]*>\s*([\s\S]+)\s*<\/body>/im,f=typeof location!="undefined"&&location.href,l=f&&location.protocol&&location.protocol.replace(/\:/,""),c=f&&location.hostname,h=f&&(location.port||undefined),p={},d=e.config&&e.config()||{};t={version:"2.0.10",strip:function(e){if(e){e=e.replace(u,"");var t=e.match(a);t&&(e=t[1])}else e="";return e},jsEscape:function(e){return e.replace(/(['\\])/g,"\\$1").replace(/[\f]/g,"\\f").replace(/[\b]/g,"\\b").replace(/[\n]/g,"\\n").replace(/[\t]/g,"\\t").replace(/[\r]/g,"\\r").replace(/[\u2028]/g,"\\u2028").replace(/[\u2029]/g,"\\u2029")},createXhr:d.createXhr||function(){var e,t,n;if(typeof XMLHttpRequest!="undefined")return new XMLHttpRequest;if(typeof ActiveXObject!="undefined")for(t=0;t<3;t+=1){n=o[t];try{e=new ActiveXObject(n)}catch(r){}if(e){o=[n];break}}return e},parseName:function(e){var t,n,r,i=!1,s=e.indexOf("."),o=e.indexOf("./")===0||e.indexOf("../")===0;return s!==-1&&(!o||s>1)?(t=e.substring(0,s),n=e.substring(s+1,e.length)):t=e,r=n||t,s=r.indexOf("!"),s!==-1&&(i=r.substring(s+1)==="strip",r=r.substring(0,s),n?n=r:t=r),{moduleName:t,ext:n,strip:i}},xdRegExp:/^((\w+)\:)?\/\/([^\/\\]+)/,useXhr:function(e,n,r,i){var s,o,u,a=t.xdRegExp.exec(e);return a?(s=a[2],o=a[3],o=o.split(":"),u=o[1],o=o[0],(!s||s===n)&&(!o||o.toLowerCase()===r.toLowerCase())&&(!u&&!o||u===i)):!0},finishLoad:function(e,n,r,i){r=n?t.strip(r):r,d.isBuild&&(p[e]=r),i(r)},load:function(e,n,r,i){if(i.isBuild&&!i.inlineText){r();return}d.isBuild=i.isBuild;var s=t.parseName(e),o=s.moduleName+(s.ext?"."+s.ext:""),u=n.toUrl(o),a=d.useXhr||t.useXhr;if(u.indexOf("empty:")===0){r();return}!f||a(u,l,c,h)?t.get(u,function(n){t.finishLoad(e,s.strip,n,r)},function(e){r.error&&r.error(e)}):n([o],function(e){t.finishLoad(s.moduleName+"."+s.ext,s.strip,e,r)})},write:function(e,n,r,i){if(p.hasOwnProperty(n)){var s=t.jsEscape(p[n]);r.asModule(e+"!"+n,"define(function () { return '"+s+"';});\n")}},writeFile:function(e,n,r,i,s){var o=t.parseName(n),u=o.ext?"."+o.ext:"",a=o.moduleName+u,f=r.toUrl(o.moduleName+u)+".js";t.load(a,r,function(n){var r=function(e){return i(f,e)};r.asModule=function(e,t){return i.asModule(e,f,t)},t.write(e,a,r,s)},s)}};if(d.env==="node"||!d.env&&typeof process!="undefined"&&process.versions&&!!process.versions.node&&!process.versions["node-webkit"])n=require.nodeRequire("fs"),t.get=function(e,t,r){try{var i=n.readFileSync(e,"utf8");i.indexOf("")===0&&(i=i.substring(1)),t(i)}catch(s){r(s)}};else if(d.env==="xhr"||!d.env&&t.createXhr())t.get=function(e,n,r,i){var s=t.createXhr(),o;s.open("GET",e,!0);if(i)for(o in i)i.hasOwnProperty(o)&&s.setRequestHeader(o.toLowerCase(),i[o]);d.onXhr&&d.onXhr(s,e),s.onreadystatechange=function(t){var i,o;s.readyState===4&&(i=s.status,i>399&&i<600?(o=new Error(e+" HTTP status: "+i),o.xhr=s,r(o)):n(s.responseText),d.onXhrComplete&&d.onXhrComplete(s,e))},s.send(null)};else if(d.env==="rhino"||!d.env&&typeof Packages!="undefined"&&typeof java!="undefined")t.get=function(e,t){var n,r,i="utf-8",s=new java.io.File(e),o=java.lang.System.getProperty("line.separator"),u=new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(s),i)),a="";try{n=new java.lang.StringBuffer,r=u.readLine(),r&&r.length()&&r.charAt(0)===65279&&(r=r.substring(1)),r!==null&&n.append(r);while((r=u.readLine())!==null)n.append(o),n.append(r);a=String(n.toString())}finally{u.close()}t(a)};else if(d.env==="xpconnect"||!d.env&&typeof Components!="undefined"&&Components.classes&&Components.interfaces)r=Components.classes,i=Components.interfaces,Components.utils["import"]("resource://gre/modules/FileUtils.jsm"),s="@mozilla.org/windows-registry-key;1"in r,t.get=function(e,t){var n,o,u,a={};s&&(e=e.replace(/\//g,"\\")),u=new FileUtils.File(e);try{n=r["@mozilla.org/network/file-input-stream;1"].createInstance(i.nsIFileInputStream),n.init(u,1,0,!1),o=r["@mozilla.org/intl/converter-input-stream;1"].createInstance(i.nsIConverterInputStream),o.init(n,"utf-8",n.available(),i.nsIConverterInputStream.DEFAULT_REPLACEMENT_CHARACTER),o.readString(n.available(),a),o.close(),n.close(),t(a.value)}catch(f){throw new Error((u&&u.path||"")+": "+f)}};return t}),define("text!common/main/lib/template/Header.template",[],function(){return'<div id="header-container">\n <div id="header-logo"></div>\n <div id="header-caption"><div><%= headerCaption %></div></div>\n <div id="header-documentcaption"><div><%= documentCaption %></div></div>\n <div id="header-back" style="display: <%= canBack ? \'table-cell\' : \'none\' %>;"><div><%= textBack %></div></div>\n</div>'});if(Common===undefined)var Common={};define("common/main/lib/component/BaseView",["backbone"],function(e){"use strict";Common.UI=_.extend(Common.UI||{},{Keys:{BACKSPACE:8,TAB:9,RETURN:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46,HOME:36,END:35,SPACE:32,PAGEUP:33,PAGEDOWN:34,INSERT:45,NUM_PLUS:107,NUM_MINUS:109,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,EQUALITY:187,MINUS:189},BaseView:e.View.extend({isSuspendEvents:!1,initialize:function(e){this.options=this.options?_({}).extend(this.options,e):e},setVisible:function(e){return this[e?"show":"hide"]()},isVisible:function(){return $(this.el).is(":visible")},suspendEvents:function(){this.isSuspendEvents=!0},resumeEvents:function(){this.isSuspendEvents=!1}}),getId:function(e){return _.uniqueId(e||"asc-gen")}})});if(Common===undefined)var Common={};define("common/main/lib/component/Window",["common/main/lib/component/BaseView"],function(){"use strict";Common.UI.Window=Common.UI.BaseView.extend(_.extend(function(){function n(){var e=$(".modals-mask");return e.length==0&&(e=$("<div class='modals-mask'>").appendTo(document.body).hide(),e.attr("counter",0)),e}function r(e){if(!this.isLocked()&&this.isVisible()&&this.initConfig.enableKeyEvents)switch(e.keyCode){case Common.UI.Keys.ESC:if($(".asc-loadmask").length<1)return e.preventDefault(),e.stopPropagation(),this.initConfig.closable!==!1&&(this.initConfig.toolclose=="hide"?this.hide():this.close()),!1;break;case Common.UI.Keys.RETURN:if(this.$window.find(".btn.primary").length&&$(".asc-loadmask").length<1&&(this.initConfig.onprimary||this.onPrimary).call(this)===!1)return e.preventDefault(),!1}}function i(){if(window.innerHeight==undefined)var e=document.documentElement.offsetWidth,t=document.documentElement.offsetHeight;else e=Common.Utils.innerWidth(),t=Common.Utils.innerHeight();if(this.initConfig.height=="auto"){var n=parseInt(this.$window.find(".body").css("height"));this.initConfig.header&&(n+=parseInt(this.$window.find(".header").css("height")))}else n=this.initConfig.height;var r=this.initConfig.width=="auto"?parseInt(this.$window.find(".body").css("width")):this.initConfig.width,i=Math.floor((parseInt(t)-parseInt(n))/2*.9),s=Math.floor((parseInt(e)-parseInt(r))/2);this.$window.css("left",s),this.$window.css("top",i)}function s(e){return{"-webkit-transition":"0.3s opacity","-moz-transition":"0.3s opacity","-ms-transition":"0.3s opacity","-o-transition":"0.3s opacity",opacity:e}}function o(e){if($(e.target).hasClass("close"))return;Common.UI.Menu.Manager.hideAll();var t=e instanceof jQuery.Event?Common.Utils.zoom():1;this.dragging.enabled=!0,this.dragging.initx=e.pageX*t-parseInt(this.$window.css("left")),this.dragging.inity=e.pageY*t-parseInt(this.$window.css("top"));if(window.innerHeight==undefined)var n=document.documentElement.offsetWidth,r=document.documentElement.offsetHeight;else n=Common.Utils.innerWidth(),r=Common.Utils.innerHeight();this.dragging.maxx=n-parseInt(this.$window.css("width")),this.dragging.maxy=r-parseInt(this.$window.css("height")),$(document).on("mousemove",this.binding.drag),$(document).on("mouseup",this.binding.dragStop),this.fireEvent("drag",[this,"start"])}function u(){$(document).off("mousemove",this.binding.drag),$(document).off("mouseup",this.binding.dragStop),this.dragging.enabled=!1,this.fireEvent("drag",[this,"end"])}function a(e){if(this.dragging.enabled){var t=e instanceof jQuery.Event?Common.Utils.zoom():1,n=e.pageX*t-this.dragging.initx,r=e.pageY*t-this.dragging.inity;n<0?n=0:n>this.dragging.maxx&&(n=this.dragging.maxx),r<0?r=0:r>this.dragging.maxy&&(r=this.dragging.maxy),this.$window.css({left:n,top:r})}}function f(e){Common.UI.Menu.Manager.hideAll();var t=$(e.target),n=parseInt(this.$window.css("left")),r=parseInt(this.$window.css("top"));this.resizing.enabled=!0,this.resizing.initpage_x=e.pageX*Common.Utils.zoom(),this.resizing.initpage_y=e.pageY*Common.Utils.zoom(),this.resizing.initx=this.resizing.initpage_x-n,this.resizing.inity=this.resizing.initpage_y-r,this.resizing.initw=parseInt(this.$window.css("width")),this.resizing.inith=parseInt(this.$window.css("height")),this.resizing.type=[t.hasClass("left")?-1:t.hasClass("right")?1:0,t.hasClass("top")?-1:t.hasClass("bottom")?1:0];var i=window.innerHeight==undefined?document.documentElement.offsetWidth:Common.Utils.innerWidth(),s=window.innerHeight==undefined?document.documentElement.offsetHeight:Common.Utils.innerHeight(),o=this.initConfig.maxwidth?this.initConfig.maxwidth:i,u=this.initConfig.maxheight?this.initConfig.maxheight:s;this.resizing.type[0]>0?(this.resizing.maxx=Math.min(i,n+o),this.resizing.minx=n+this.initConfig.minwidth):this.resizing.type[0]<0&&(this.resizing.maxx=n+this.resizing.initw-this.initConfig.minwidth,this.resizing.minx=Math.max(0,n+this.resizing.initw-o)),this.resizing.type[1]>0?(this.resizing.maxy=Math.min(s,r+u),this.resizing.miny=r+this.initConfig.minheight):this.resizing.type[1]<0&&(this.resizing.maxy=r+this.resizing.inith-this.initConfig.minheight,this.resizing.miny=Math.max(0,r+this.resizing.inith-u)),$(document.body).css("cursor",t.css("cursor")),this.$window.find(".resize-border").addClass("resizing"),this.$window.find(".header").addClass("resizing"),$(document).on("mousemove",this.binding.resize),$(document).on("mouseup",this.binding.resizeStop),this.fireEvent("resize",[this,"start"])}function l(e){if(this.resizing.enabled){var t=!1,n=e instanceof jQuery.Event?Common.Utils.zoom():1,r=e.pageX*n,i=e.pageY*n;this.resizing.type[0]&&r<this.resizing.maxx&&r>this.resizing.minx&&(this.resizing.type[0]<0&&this.$window.css({left:r-this.resizing.initx}),this.setWidth(this.resizing.initw+(r-this.resizing.initpage_x)*this.resizing.type[0]),t=!0),this.resizing.type[1]&&i<this.resizing.maxy&&i>this.resizing.miny&&(this.resizing.type[1]<0&&this.$window.css({top:i-this.resizing.inity}),this.setHeight(this.resizing.inith+(i-this.resizing.initpage_y)*this.resizing.type[1]),t=!0),t&&this.fireEvent("resizing")}}function c(){$(document).off("mousemove",this.binding.resize),$(document).off("mouseup",this.binding.resizeStop),$(document.body).css("cursor","auto"),this.$window.find(".resize-border").removeClass("resizing"),this.$window.find(".header").removeClass("resizing"),this.resizing.enabled=!1,this.fireEvent("resize",[this,"end"])}var e={closable:!0,header:!0,modal:!0,width:"auto",height:"auto",title:"Title",alias:"Window",cls:"",toolclose:"close",maxwidth:undefined,maxheight:undefined,minwidth:0,minheight:0,enableKeyEvents:!0},t='<div class="asc-window<%= modal?" modal":"" %><%= cls?" "+cls:"" %>" id="<%= id %>" style="width:<%= width %>px;"><% if (header==true) { %><div class="header"><% if (closable!==false) %><div class="tool close img-commonctrl"></div><% %><span class="title"><%= title %></span> </div><% } %><div class="body"><%= tpl %></div></div>';return Common.UI.alert=function(e){function u(t){var n=t.getChild(".info-box"),r=t.getChild(".info-box span"),i=t.getChild(".footer"),s=t.getChild(".header"),o=t.getChild(".body"),u=t.getChild(".icon"),a=t.getChild(".info-box .dont-show-checkbox");e.dontshow||o.css("padding-bottom","10px"),e.maxwidth&&e.width=="auto"&&r.position().left+r.width()+parseInt(n.css("padding-right"))>e.maxwidth&&(e.width=e.maxwidth),e.width=="auto"?(n.height(Math.max(r.height()+(a.length>0?a.height()+parseInt(a.css("margin-top")):0),u.height())),o.height(parseInt(n.css("height"))+parseInt(i.css("height"))),t.setSize(r.position().left+r.width()+parseInt(n.css("padding-right")),parseInt(o.css("height"))+parseInt(s.css("height")))):(r.css("white-space","normal"),t.setWidth(e.width),n.height(Math.max(r.height()+(a.length>0?a.height()+parseInt(a.css("margin-top")):0),u.height())),o.height(parseInt(n.css("height"))+parseInt(i.css("height"))),t.setHeight(parseInt(o.css("height"))+parseInt(s.css("height")))),r.height()<u.height()-10&&r.css({"vertical-align":"baseline","line-height":u.height()+"px"})}function a(t){e.callback&&e.callback.call(s,t.currentTarget.attributes.result.value,o?o.getValue()=="checked":!1),s.close(!0)}function f(e){return a({currentTarget:s.getChild(".footer .dlg-btn")[0]}),!1}var t=this.Window.prototype,n={ok:t.okButtonText,cancel:t.cancelButtonText,yes:t.yesButtonText,no:t.noButtonText,close:t.closeButtonText};if(!e.buttons)e.buttons={},e.buttons.ok={text:n.ok,cls:"primary"};else if(_.isArray(e.buttons)){e.primary==undefined&&(e.primary="ok");var r={};_.each(e.buttons,function(t){typeof t=="object"?t.value!==undefined&&(r[t.value]={text:t.caption,cls:"custom"+(t.primary||e.primary==t.value?" primary":"")}):(r[t]={text:t=="custom"?e.customButtonText:n[t],cls:e.primary==t?"primary":""},t=="custom"&&(r[t].cls+=" custom"))}),e.buttons=r}e.dontshow=e.dontshow||!1,e.width||(e.width="auto");var i='<div class="info-box"><% if (typeof iconCls !== "undefined") { %><div class="icon img-commonctrl <%= iconCls %>" /><% } %><div class="text" <% if (typeof iconCls == "undefined") { %> style="padding-left:10px;" <% } %>><span><%= msg %></span><% if (dontshow) { %><div class="dont-show-checkbox"></div><% } %></div></div><% if (dontshow) { %><div class="separator horizontal" style="width: 100%;"/><% } %><% if (_.size(buttons) > 0) { %><div class="footer <% if (dontshow) { %> dontshow <% } %>"><% for(var bt in buttons) { %><button class="btn normal dlg-btn <%= buttons[bt].cls %>" result="<%= bt %>"><%= buttons[bt].text %></button><% } %></div><% } %>';_.extend(e,{cls:"alert",onprimary:f,tpl:_.template(i,e)});var s=new Common.UI.Window(e),o=null;s.on({"render:after":function(e){e.getChild(".footer .dlg-btn").on("click",a),o=new Common.UI.CheckBox({el:s.$window.find(".dont-show-checkbox"),labelText:s.textDontShow}),u(e)},show:function(e){e.getChild(".footer .dlg-btn").focus()},close:function(){e.callback&&e.callback.call(s,"close")}}),s.show()},Common.UI.error=function(e){e=e||{},!e.title&&(e.title=this.Window.prototype.textError),Common.UI.alert(_.extend(e,{iconCls:"error"}))},Common.UI.confirm=function(e){e=e||{},!e.title&&(e.title=this.Window.prototype.textConfirmation),Common.UI.alert(_.extend(e,{iconCls:"confirm"}))},Common.UI.info=function(e){e=e||{},!e.title&&(e.title=this.Window.prototype.textInformation),Common.UI.alert(_.extend(e,{iconCls:"info"}))},Common.UI.warning=function(e){e=e||{},!e.title&&(e.title=this.Window.prototype.textWarning),Common.UI.alert(_.extend(e,{iconCls:"warn"}))},{$window:undefined,$lastmodal:undefined,dragging:{enabled:!1},resizing:{enabled:!1},initialize:function(t){this.initConfig={},this.binding={},_.extend(this.initConfig,e,t||{}),!this.initConfig.id&&(this.initConfig.id="window-"+this.cid),!this.initConfig.tpl&&(this.initConfig.tpl=""),Common.UI.BaseView.prototype.initialize.call(this,this.initConfig)},render:function(){var e=this.initConfig.renderTo||document.body;$(e).append(_.template(t,this.initConfig)),this.$window=$("#"+this.initConfig.id),this.binding.keydown=_.bind(r,this);if(this.initConfig.header){this.binding.drag=_.bind(a,this),this.binding.dragStop=_.bind(u,this),this.binding.dragStart=_.bind(o,this);var n=function(){if(this.$window.find(".tool.close").hasClass("disabled"))return;this.initConfig.toolcallback?this.initConfig.toolcallback.call(this):this.initConfig.toolclose=="hide"?this.hide():this.close()};this.$window.find(".header").on("mousedown",this.binding.dragStart),this.$window.find(".tool.close").on("click",_.bind(n,this))}else this.$window.find(".body").css({top:0,"border-radius":"5px"});if(this.initConfig.height=="auto"){var i=parseInt(this.$window.find("> .body").css("height"));this.initConfig.header&&(i+=parseInt(this.$window.find("> .header").css("height"))),this.$window.height(i)}else this.$window.css("height",this.initConfig.height);this.initConfig.resizable&&this.setResizable(this.initConfig.resizable);var s=this;return Common.NotificationCenter.on("window:close",function(){s.$window&&s.isVisible()&&s.close()}),this.fireEvent("render:after",this),this},show:function(e,t){if(this.initConfig.modal){var r=n();if(this.options.animate!==!1){var o=r.css("opacity");r.css("opacity",0),r.attr("counter",parseInt(r.attr("counter"))+1),r.show(),setTimeout(function(){r.css(s(o))},1)}else r.attr("counter",parseInt(r.attr("counter"))+1),r.show();Common.NotificationCenter.trigger("modal:show",this),this.$lastmodal=$(".asc-window.modal:not(.dethrone):visible").first().addClass("dethrone")}this.$window?this.$window.is(":visible")||(this.$window.css({opacity:0}),this.$window.show()):(this.render(),_.isNumber(e)&&_.isNumber(t)?(this.$window.css("left",Math.floor(e)),this.$window.css("top",Math.floor(t))):i.call(this)),$(document).on("keydown."+this.cid,this.binding.keydown);var u=this;setTimeout(function(){u.fireEvent("animate:before",u)},10),this.options.animate!==!1?(this.$window.css({"-webkit-transform":"scale(0.8)","-moz-transform":"scale(0.8)","-ms-transform":"scale(0.8)","-o-transform":"scale(0.8)",opacity:0}),setTimeout(function(){u.$window.css({"-webkit-transition":"0.2s opacity, 0.2s -webkit-transform","-webkit-transform":"scale(1)","-moz-transition":"0.2s opacity, 0.2s -moz-transform","-moz-transform":"scale(1)","-ms-transition":"0.2s opacity, 0.2s -ms-transform","-ms-transform":"scale(1)","-o-transition":"0.2s opacity, 0.2s -o-transform","-o-transform":"scale(1)",opacity:"1"})},1),setTimeout(function(){u.$window.addClass("notransform"),u.fireEvent("show",u)},this.initConfig.modal?1e3:350)):(this.$window.css({opacity:1}),this.$window.addClass("notransform"),this.fireEvent("show",this)),Common.NotificationCenter.trigger("window:show")},close:function(e){$(document).off("keydown."+this.cid),this.initConfig.header&&this.$window.find(".header").off("mousedown",this.binding.dragStart);if(this.initConfig.modal){var t=n(),r=!0;t.attr("counter",parseInt(t.attr("counter"))-1),this.$lastmodal.size()>0&&(this.$lastmodal.removeClass("dethrone"),r=!this.$lastmodal.hasClass("modal")||!this.$lastmodal.is(":visible"));if(r)if(this.options.animate!==!1){var i=t.css("opacity");t.css(s(0)),setTimeout(function(){t.css("opacity",i),parseInt(t.attr("counter"))<1&&(t.hide(),t.attr("counter",0))},300)}else parseInt(t.attr("counter"))<1&&(t.hide(),t.attr("counter",0));Common.NotificationCenter.trigger("modal:close",this)}this.$window.remove(),e!==!0&&this.fireEvent("close",this)},hide:function(){$(document).off("keydown."+this.cid);if(this.$window){if(this.initConfig.modal){var e=n(),t=!0;e.attr("counter",parseInt(e.attr("counter"))-1),this.$lastmodal.size()>0&&(this.$lastmodal.removeClass("dethrone"),t=!this.$lastmodal.hasClass("modal")||!this.$lastmodal.is(":visible"));if(t)if(this.options.animate!==!1){var r=e.css("opacity");e.css(s(0)),setTimeout(function(){e.css("opacity",r),parseInt(e.attr("counter"))<1&&(e.hide(),e.attr("counter",0))},300)}else parseInt(e.attr("counter"))<1&&(e.hide(),e.attr("counter",0));Common.NotificationCenter.trigger("modal:hide",this)}this.$window.hide(),this.$window.removeClass("notransform"),this.fireEvent("hide",this)}},isLocked:function(){return this.$window.hasClass("dethrone")||!this.options.modal&&this.$window.parent().find(".asc-window.modal:visible").length},getChild:function(e){return e?this.$window.find(e):this.$window},setWidth:function(e){if(e>=0){var t=parseInt(this.$window.css("min-width"));e<t&&(e=t),e-=parseInt(this.$window.css("border-left-width"))+parseInt(this.$window.css("border-right-width")),this.$window.width(e)}},getWidth:function(){return parseInt(this.$window.css("width"))},setHeight:function(e){if(e>=0){var t=parseInt(this.$window.css("min-height"));e<t&&(e=t),e-=parseInt(this.$window.css("border-bottom-width"))+parseInt(this.$window.css("border-top-width")),this.$window.height(e),this.initConfig.header&&(e-=parseInt(this.$window.find("> .header").css("height"))),this.$window.find("> .body").css("height",e)}},getHeight:function(){return parseInt(this.$window.css("height"))},setSize:function(e,t){this.setWidth(e),this.setHeight(t)},getSize:function(){return[this.getWidth(),this.getHeight()]},setTitle:function(e){this.$window.find("> .header > .title").text(e)},getTitle:function(){return this.$window.find("> .header > .title").text()},isVisible:function(){return this.$window&&this.$window.is(":visible")},setResizable:function(e,t,n){if(e!==this.resizable){if(e){var r='<div class="resize-border left" style="top:'+(this.initConfig.header?"33":"5")+'px; bottom: 5px; height: auto; border-right-style: solid; cursor: e-resize;"></div>'+'<div class="resize-border left bottom" style="border-bottom-left-radius: 5px; cursor: sw-resize;"></div>'+'<div class="resize-border bottom" style="left: 4px; right: 4px; width: auto; z-index: 2; border-top-style: solid; cursor: s-resize;"></div>'+'<div class="resize-border right bottom" style="border-bottom-right-radius: 5px; cursor: se-resize;"></div>'+'<div class="resize-border right" style="top:'+(this.initConfig.header?"33":"5")+'px; bottom: 5px; height: auto; border-left-style: solid; cursor: w-resize;"></div>'+'<div class="resize-border left top" style="border-top-left-radius: 5px; cursor: se-resize;"></div>'+'<div class="resize-border top" style="left: 4px; right: 4px; width: auto; z-index: 2; border-bottom-style:'+(this.initConfig.header?"none":"solid")+'; cursor: s-resize;"></div>'+'<div class="resize-border right top" style="border-top-right-radius: 5px; cursor: sw-resize;"></div>';this.initConfig.header&&(r+='<div class="resize-border left" style="top: 5px; height: 28px; cursor: e-resize;"></div><div class="resize-border right" style="top: 5px; height: 28px; cursor: w-resize;"></div>'),this.$window.append(_.template(r)),this.binding.resize=_.bind(l,this),this.binding.resizeStop=_.bind(c,this),this.binding.resizeStart=_.bind(f,this),t&&t.length>1&&(this.initConfig.minwidth=t[0]),t&&t.length>1&&(this.initConfig.minheight=t[1]),n&&n.length>1&&(this.initConfig.maxwidth=n[0]),n&&n.length>1&&(this.initConfig.maxheight=n[1]),this.$window.find(".resize-border").on("mousedown",this.binding.resizeStart)}else this.$window.find(".resize-border").remove();this.resizable=e}},onPrimary:function(){},cancelButtonText:"Cancel",okButtonText:"OK",yesButtonText:"Yes",noButtonText:"No",closeButtonText:"Close",textWarning:"Warning",textError:"Error",textConfirmation:"Confirmation",textInformation:"Information",textDontShow:"Don't show this message again"}}(),Common.UI.Window||{}))}),define("common/main/lib/view/RenameDialog",["common/main/lib/component/Window"],function(){"use strict";Common.Views.RenameDialog=Common.UI.Window.extend(_.extend({options:{width:330,header:!1,cls:"modal-dlg",filename:""},initialize:function(e){_.extend(this.options,e||{}),this.template=['<div class="box">','<div class="input-row">',"<label>"+this.textName+"</label>","</div>",'<div id="id-dlg-newname" class="input-row"></div>',"</div>",'<div class="footer right">','<button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px;">'+this.okButtonText+"</button>",'<button class="btn normal dlg-btn" result="cancel">'+this.cancelButtonText+"</button>","</div>"].join(""),this.options.tpl=_.template(this.template,this.options),Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this);var e=this;e.inputName=new Common.UI.InputField({el:$("#id-dlg-newname"),style:"width: 100%;",validateOnBlur:!1,validation:function(t){return/[\t*\+:\"<>?|\\\\/]/gim.test(t)?e.txtInvalidName+'*+:"<>?|/':!0}});var t=this.getChild();t.find(".btn").on("click",_.bind(this.onBtnClick,this)),e.inputNameEl=t.find("input"),e.inputNameEl.on("keypress",_.bind(this.onKeyPress,this))},show:function(){Common.UI.Window.prototype.show.apply(this,arguments);var e=this;_.delay(function(){e.inputName.setValue(e.options.filename),e.inputNameEl.focus().select()},100)},onKeyPress:function(e){e.keyCode==Common.UI.Keys.RETURN&&this._handleInput("ok")},onBtnClick:function(e){this._handleInput(e.currentTarget.attributes.result.value)},_handleInput:function(e){if(this.options.handler){if(e=="ok"&&this.inputName.checkValidate()!==!0){this.inputNameEl.focus();return}this.options.handler.call(this,e,this.inputName.getValue())}this.close()},textName:"File name",cancelButtonText:"Cancel",okButtonText:"Ok",txtInvalidName:"The file name cannot contain any of the following characters: "},Common.Views.RenameDialog||{}))});if(Common===undefined)var Common={};Common.Views=Common.Views||{},define("common/main/lib/view/Header",["backbone","text!common/main/lib/template/Header.template","core","common/main/lib/view/RenameDialog"],function(e,t){"use strict";Common.Views.Header=e.View.extend(_.extend({options:{branding:{},headerCaption:"Default Caption",documentCaption:"",canBack:!1},el:"#header",template:_.template(t),events:{"click #header-logo":function(e){var t=!this.branding||!this.branding.logo||!this.branding.logo.url?"http://www.onlyoffice.com":this.branding.logo.url,n=window.open(t);n&&n.focus()}},initialize:function(e){this.options=this.options?_({}).extend(this.options,e):e,this.headerCaption=this.options.headerCaption,this.documentCaption=this.options.documentCaption,this.canBack=this.options.canBack,this.branding=this.options.customization,this.isModified=!1},render:function(){$(this.el).html(this.template({headerCaption:this.headerCaption,documentCaption:Common.Utils.String.htmlEncode(this.documentCaption),canBack:this.canBack,textBack:this.textBack}));var e=(new Common.UI.MenuItem({caption:this.openNewTabText})).on("click",function(e,t){Common.NotificationCenter.trigger("goback",!0),Common.component.Analytics.trackEvent("Back to Folder")});this.gotoDocsMenu=new Common.UI.Menu({style:"min-width: 100px;",items:[e]})},setVisible:function(e){e?this.show():this.hide()},setBranding:function(e){var t;this.branding=e,e&&e.logo&&e.logo.image&&(t=$("#header-logo"),t&&(t.html('<img src="'+e.logo.image+'" style="max-width:86px; max-height:20px; margin: 0 8px 0 15px;"/>'),t.css({"background-image":"none",width:"auto"})))},setHeaderCaption:function(e){this.headerCaption=e;var t=$("#header-caption > div");return t&&t.html(e),e},getHeaderCaption:function(){return this.headerCaption},setDocumentCaption:function(e,t){t!==undefined&&(this.isModified=t),this.documentCaption=e,e||(e=""),this.isModified&&(e+="*");var n=$("#header-documentcaption div");return n&&n.html(Common.Utils.String.htmlEncode(e)),e},getDocumentCaption:function(){return this.documentCaption},setCanBack:function(e){this.canBack=e;var t=$("#header-back");t&&(t.off("mouseup"),t.css("display",e?"table-cell":"none"),e&&t.on("mouseup",_.bind(this.onBackClick,this)))},getCanBack:function(){return this.canBack},onBackClick:function(e){if(e.which==3){Common.UI.Menu.Manager.hideAll();var t=this,n=[e.pageX*Common.Utils.zoom(),e.pageY*Common.Utils.zoom()],r=$(this.el).find(Common.Utils.String.format("#menu-container-{0}",this.gotoDocsMenu.id));this.gotoDocsMenu.rendered||(r.length<1&&(r=$(Common.Utils.String.format('<div id="menu-container-{0}" style="position: absolute; z-index: 10000;"><div class="dropdown-toggle" data-toggle="dropdown"></div></div>',this.gotoDocsMenu.id)),$(this.el).append(r)),this.gotoDocsMenu.render(r),this.gotoDocsMenu.cmpEl.attr({tabindex:"-1"})),_.delay(function(){r.css({left:n[0]-t.gotoDocsMenu.cmpEl.width(),top:n[1]+3}),t.gotoDocsMenu.show()},10)}else Common.NotificationCenter.trigger("goback",e.which==2),Common.component.Analytics.trackEvent("Back to Folder")},setCanRename:function(e){var t=$("#header-documentcaption div");if(e){var n=this;t.tooltip({title:n.txtRename,placement:"cursor"}),t.on("click",function(e){(new Common.Views.RenameDialog({filename:n.documentCaption,handler:function(e,t){e=="ok"&&!_.isEmpty(t.trim())&&n.documentCaption!==t.trim()&&Common.Gateway.requestRename(t),Common.NotificationCenter.trigger("edit:complete",n)}})).show(t.position().left-1,20)})}else{var r=t.data("bs.tooltip");r&&(r.options.title="",r.setContent()),t.off("click")}t.css("cursor",e?"pointer":"default"),t.toggleClass("renamed",e)},textBack:"Go to Documents",openNewTabText:"Open in New Tab",txtRename:"Rename"},Common.Views.Header||{}))}),define("text!spreadsheeteditor/main/app/template/Viewport.template",[],function(){return'<div class="layout-region">\n <div id="viewport-vbox-layout" class="layout-ct vbox">\n <div id="header" class="layout-item"></div>\n <div class="layout-item" style="border-bottom: 1px solid #cbcbcb;display:none;"></div>\n <div id="toolbar" class="layout-item"></div>\n <div class="layout-item">\n <div id="viewport-hbox-layout" class="layout-ct hbox">\n <div id="left-menu" class="layout-item" style="width: 40px;"></div>\n <div id="file-menu-panel" class="left-menu-full-ct" style="display:none;"></div>\n <div id="about-menu-panel" class="left-menu-full-ct" style="display:none;"></div>\n <div class="layout-item">\n <div class="layout-ct vbox">\n <div id="cell-editing-box" class="layout-item" style="height:18px;"></div>\n <div id="editor_sdk" class="layout-item" style="min-height: 100px;"></div>\n </div>\n </div>\n <div id="right-menu" class="layout-item"></div>\n </div>\n </div>\n <div id="statusbar" class="layout-item"></div>\n </div>\n</div>\n'});if(Common===undefined)var Common={};define("common/main/lib/component/Layout",["backbone"],function(){"use strict";var e=function(e){this.box=null,this.panels=[],this.splitters=[],_.extend(this,e||{})},t=function(){return{width:null,height:null,resize:!1,stretch:!1,rely:!1}};_.extend(e.prototype,Backbone.Events,{initialize:function(e){this.$parent=this.box.parent(),this.resize={eventMove:_.bind(this.resizeMove,this),eventStop:_.bind(this.resizeStop,this)};var n,r,i=!1;e.items.forEach(function(e){e.el instanceof HTMLElement&&(e.el=$(e.el)),n=_.extend(new t,e),n.stretch&&(i=!0,n.rely=!1,n.resize=!1),this.panels.push(n),n.resize&&(r={isresizer:!0,minpos:n.resize.min||0,maxpos:n.resize.max||0,fmin:n.resize.fmin,fmax:n.resize.fmax,behaviour:n.behaviour,index:this.splitters.length},i?(n.resize.el=r.el=n.el.before('<div class="layout-resizer before"></div>').prev(),this.panels.splice(this.panels.length-1,0,r)):(n.resize.el=r.el=n.el.after('<div class="layout-resizer after"></div>').next(),this.panels.push(r)),this.splitters.push({resizer:r}),n.resize.hidden&&r.el.hide())},this),this.freeze=e.freeze,this.freeze&&this.freezePanels(this.freeze)},doLayout:function(){},getElementHeight:function(e){return parseInt(e.css("height"))},getElementWidth:function(e){return parseInt(e.css("width"))},onSelectStart:function(e){return e.preventDefault&&e.preventDefault(),!1},addHandler:function(e,t,n){e.addEventListener?e.addEventListener(t,n):e.attachEvent?e.attachEvent("on"+t,n):e["on"+t]=n},removeHandler:function(e,t,n){e.removeEventListener?e.removeEventListener(t,n):e.detachEvent?e.detachEvent("on"+t,n):e["on"+t]=null},clearSelection:function(){if(window.getSelection){var e=window.getSelection();e.empty?e.empty():e.removeAllRanges&&e.removeAllRanges()}else document.selection&&document.selection.empty()},resizeStart:function(e){this.clearSelection(),this.addHandler(window.document,"selectstart",this.onSelectStart),$(document).on({mousemove:this.resize.eventMove,mouseup:this.resize.eventStop}),Common.NotificationCenter.on({"frame:mousemove":this.resize.eventMove,"frame:mouseup":this.resize.eventStop});var t=e.data.panel;this.resize.type=e.data.type,this.resize.$el=t.el,this.resize.min=t.minpos,this.resize.fmin=t.fmin,this.resize.fmax=t.fmax,this.resize.behaviour=t.behaviour,this.resize.$el.addClass("move"),e.data.type=="vertical"?(this.resize.height=parseInt(this.resize.$el.css("height")),this.resize.max=(t.maxpos>0?t.maxpos:this.resize.$el.parent().height()+t.maxpos)-this.resize.height,this.resize.inity=e.pageY*Common.Utils.zoom()-parseInt(e.currentTarget.style.top)):e.data.type=="horizontal"&&(this.resize.width=parseInt(this.resize.$el.css("width")),this.resize.max=(t.maxpos>0?t.maxpos:this.resize.$el.parent().height()+t.maxpos)-this.resize.width,this.resize.initx=e.pageX*Common.Utils.zoom()-parseInt(e.currentTarget.style.left)),Common.NotificationCenter.trigger("layout:resizestart")},resizeMove:function(e){var t=e instanceof jQuery.Event?Common.Utils.zoom():1;if(this.resize.type=="vertical")var n="top",r=e.pageY*t-this.resize.inity;else this.resize.type=="horizontal"&&(n="left",r=e.pageX*t-this.resize.initx);this.resize.fmin&&this.resize.fmax?!(r<this.resize.fmin())&&!(r>this.resize.fmax())&&(this.resize.$el[0].style[n]=r+"px"):!(r<this.resize.min)&&!(r>this.resize.max)&&(this.resize.$el[0].style[n]=r+"px")},resizeStop:function(e){this.removeHandler(window.document,"selectstart",this.onSelectStart),$(document).off({mousemove:this.resize.eventMove,mouseup:this.resize.eventStop}),Common.NotificationCenter.off({"frame:mousemove":this.resize.eventMove,"frame:mouseup":this.resize.eventStop});if(!this.resize.$el)return;var t=e instanceof jQuery.Event?Common.Utils.zoom():1;if(this.resize.type=="vertical")var n="height",r=e.pageY*t-this.resize.inity;else this.resize.type=="horizontal"&&(n="width",r=e.pageX*t-this.resize.initx);this.resize.fmin&&this.resize.fmax?(r<this.resize.fmin()&&(r=this.resize.fmin()),r>this.resize.fmax()&&(r=this.resize.fmax())):(r<this.resize.min&&(r=this.resize.min),r>this.resize.max&&(r=this.resize.max));var i=null,s=null,o=0;this.resize.$el.hasClass("after")?(i=this.resize.$el.prev(),s=this.resize.$el.next(),o=parseInt(i.css(n))):(i=this.resize.$el.next(),s=this.resize.$el.next(),o=parseInt(i.css(n)),r=i.parent()[n]()-(r+this.resize[n])),this.resize.type=="vertical"&&(r-=i.position().top),this.resize.type=="horizontal"&&(r-=i.position().left),i.css(n,r+"px"),this.resize.behaviour&&s.css(n,parseInt(s.css(n))-(r-o)),this.resize.$el.removeClass("move"),delete this.resize.$el,this.resize.value!=r&&(this.doLayout(),this.trigger("layout:resizedrag",this)),Common.NotificationCenter.trigger("layout:resizestop")},freezePanels:function(e){this.panels.forEach(function(t){!t.stretch&&t.resize&&$(t.resize.el).css("cursor",e?"default":"")}),this.freeze=e},setResizeValue:function(e,t){if(e>=this.splitters.length)return;var n=null,r=null,i=0,s=this.splitters[e].resizer,o="height";t<s.fmin()&&(t=s.fmin()),t>s.fmax()&&(t=s.fmax()),s.el.hasClass("after")?(n=s.el.prev(),r=s.el.next(),i=parseInt(n.css(o))):(n=s.el.next(),t=n.parent()[o]()-(t+s[o]),r=s.el.next(),i=parseInt(n.css(o))),t-=n.position().top,n.css(o,t+"px"),s.behaviour&&r.css(o,parseInt(r.css(o))-(t-i)),s.value!=t&&this.doLayout()}}),!Common.UI&&(Common.UI={}),Common.UI.VBoxLayout=function(t){e.apply(this,arguments),this.initialize.apply(this,arguments)},Common.UI.VBoxLayout.prototype=_.extend(new e,{initialize:function(t){e.prototype.initialize.call(this,t),this.panels.forEach(function(e){!e.stretch&&!e.height&&(e.height=this.getElementHeight(e.el)),e.isresizer&&e.el.on("mousedown",{type:"vertical",panel:e},_.bind(this.resizeStart,this))},this),this.doLayout.call(this)},doLayout:function(){var e=0,t,n;this.panels.forEach(function(r){r.stretch?t=r:(n=r.el.is(":visible"),n&&(e+=r.rely!==!0?r.height:this.getElementHeight(r.el)),r.resize&&r.resize.autohide!==!1&&r.resize.el&&(n?(r.resize.el.show(),t&&(e+=r.resize.height)):(r.resize.el.hide(),t&&(e-=r.resize.height))))},this),t&&(t.height=this.$parent.height()-e),e=0,this.panels.forEach(function(t){t.el.is(":visible")&&(n={top:e},t.rely!==!0&&(n.height=t.height),t.el.css(n),e+=this.getElementHeight(t.el))},this)}}),Common.UI.HBoxLayout=function(t){e.apply(this,arguments),this.initialize.apply(this,arguments)},Common.UI.HBoxLayout.prototype=_.extend(new e,{initialize:function(t){e.prototype.initialize.call(this,t),this.panels.forEach(function(e){!e.stretch&&!e.width&&(e.width=this.getElementWidth(e.el)),e.isresizer&&e.el.on("mousedown",{type:"horizontal",panel:e},_.bind(this.resizeStart,this))},this),this.doLayout.call(this)},doLayout:function(e){var t=0,n,r;this.panels.forEach(function(e){e.stretch?n=e:(r=e.el.is(":visible"),r&&(t+=e.rely!==!0?e.width:this.getElementWidth(e.el)),e.resize&&e.resize.autohide!==!1&&e.resize.el&&(r?(e.resize.el.show(),n&&(t-=e.resize.width)):(e.resize.el.hide(),n&&(t-=e.resize.width))))},this),n&&(n.width=this.$parent.width()-t),t=0,this.panels.forEach(function(e){e.el.is(":visible")&&(r={left:t},e.rely!==!0&&(r.width=e.width),e.el.css(r),t+=this.getElementWidth(e.el))},this)}}),Common.UI.VBoxLayout.prototype.constructor=Common.UI.VBoxLayout,Common.UI.HBoxLayout.prototype.constructor=Common.UI.HBoxLayout}),define("spreadsheeteditor/main/app/view/Viewport",["text!spreadsheeteditor/main/app/template/Viewport.template","jquery","underscore","backbone","common/main/lib/component/BaseView","common/main/lib/component/Layout"],function(e,t,n,r){"use strict";SSE.Views.Viewport=r.View.extend({el:"#viewport",template:n.template(e),events:{},initialize:function(){},render:function(){var e=t(this.el);e.html(this.template({})),Common.Utils.isSafari?(t("body").addClass("safari"),t("body").mousewheel(function(e){e.preventDefault(),e.stopPropagation()})):Common.Utils.isChrome&&t("body").addClass("chrome");var n=t("#viewport-vbox-layout",e),r=n.find(" > .layout-item");return this.vlayout=new Common.UI.VBoxLayout({box:n,items:[{el:r[0],rely:!0},{el:r[1],height:5},{el:r[2],rely:!0},{el:r[3],stretch:!0},{el:r[4],height:25}]}),n=t("#viewport-hbox-layout",e),r=n.find(" > .layout-item"),this.hlayout=new Common.UI.HBoxLayout({box:n,items:[{el:r[0],rely:!0,resize:{hidden:!0,autohide:!1,min:300,max:600}},{el:r[1],stretch:!0},{el:t(r[2]).hide(),rely:!0}]}),n=n.find(".layout-ct.vbox"),r=n.find(" > .layout-item"),this.celayout=new Common.UI.VBoxLayout({box:n,items:[{el:r[0],rely:!0,resize:{min:19,max:-100}},{el:r[1],stretch:!0}]}),this},applyEditorMode:function(){var e=this,t=SSE.getController("Toolbar").getView("Toolbar"),n=SSE.getController("RightMenu").getView("RightMenu");e._toolbar=t.render(this.mode),e._rightMenu=n.render()},setMode:function(e,t){e.isDisconnected?(n.isUndefined(this.mode)&&(this.mode={}),this.mode.canCoAuthoring=!1):(this.mode=e,this.vlayout&&e.isDesktopApp&&!e.isEdit&&this.vlayout.items[1].el.css("display","block"))}})}),define("spreadsheeteditor/main/app/controller/Viewport",["core","common/main/lib/view/Header","spreadsheeteditor/main/app/view/Viewport"],function(e){"use strict";SSE.Controllers.Viewport=Backbone.Controller.extend({models:[],collections:[],views:["Viewport","Common.Views.Header"],initialize:function(){this.addListeners({Viewport:{}})},setApi:function(e){this.api=e},onLaunch:function(){this.viewport=this.createView("Viewport").render(),this.header=this.createView("Common.Views.Header",{headerCaption:"Spreadsheet Editor"}).render(),Common.NotificationCenter.on("layout:changed",_.bind(this.onLayoutChanged,this)),$(window).on("resize",_.bind(this.onWindowResize,this)),this.viewport.celayout.on("layout:resizedrag",function(){this.viewport.fireEvent("layout:resizedrag",[this,"cell:edit"]),this.api.asc_Resize()},this);var e=$("#left-menu");this.viewport.hlayout.on("layout:resizedrag",function(){this.api.asc_Resize(),Common.localStorage.setItem("sse-mainmenu-width",e.width())},this),this.boxSdk=$("#editor_sdk"),this.boxFormula=$("#cell-editing-box"),this.boxSdk.css("border-left","none"),this.boxFormula.css("border-left","none")},onLayoutChanged:function(e){switch(e){default:this.viewport.vlayout.doLayout(),this.viewport.celayout.doLayout();case"rightmenu":this.viewport.hlayout.doLayout();break;case"leftmenu":var t=this.viewport.hlayout.items[0];t.resize.el&&(t.el.width()>40?(this.boxSdk.css("border-left",""),this.boxFormula.css("border-left",""),t.resize.el.show()):(t.resize.el.hide(),this.boxSdk.css("border-left","none"),this.boxFormula.css("border-left","none"))),this.viewport.hlayout.doLayout();break;case"header":case"toolbar":case"status":this.viewport.vlayout.doLayout(),this.viewport.celayout.doLayout();break;case"celleditor":arguments[1]&&this.boxSdk.css("border-top",arguments[1]=="hidden"?"none":""),this.viewport.celayout.doLayout()}this.api.asc_Resize()},onWindowResize:function(e){this.onLayoutChanged("window"),Common.NotificationCenter.trigger("window:resize")}})});if(Common===undefined)var Common={};Common.Utils===undefined&&(Common.Utils={}),Common.Utils=_.extend(new function(){var e=navigator.userAgent.toLowerCase(),t=function(t){return t.test(e)},n=document.compatMode=="CSS1Compat",r=function(t,n){var r;return t&&(r=n.exec(e))?parseFloat(r[1]):0},i=document.documentMode,s=t(/opera/),o=s&&t(/version\/10\.5/),u=t(/\bchrome\b/),a=t(/webkit/),f=!u&&t(/safari/),l=f&&t(/applewebkit\/4/),c=f&&t(/version\/3/),h=f&&t(/version\/4/),p=f&&t(/version\/5\.0/),d=f&&t(/version\/5/),v=!s&&(t(/msie/)||t(/trident/)),m=v&&(t(/msie 7/)&&i!=8&&i!=9&&i!=10||i==7),g=v&&(t(/msie 8/)&&i!=7&&i!=9&&i!=10||i==8),y=v&&(t(/msie 9/)&&i!=7&&i!=8&&i!=10||i==9),b=v&&(t(/msie 10/)&&i!=7&&i!=8&&i!=9||i==10),w=v&&(t(/trident\/7\.0/)&&i!=7&&i!=8&&i!=9&&i!=10||i==11),E=v&&t(/msie 6/),S=!a&&!v&&t(/gecko/),x=S&&t(/rv:1\.9/),T=S&&t(/rv:2\.0/),N=S&&t(/rv:5\./),C=S&&t(/rv:10\./),k=x&&t(/rv:1\.9\.0/),L=x&&t(/rv:1\.9\.1/),A=x&&t(/rv:1\.9\.2/),O=t(/windows|win32/),M=t(/macintosh|mac os x/),_=t(/linux/),D=r(!0,/\bchrome\/(\d+\.\d+)/),P=r(!0,/\bfirefox\/(\d+\.\d+)/),H=r(v,/msie (\d+\.\d+)/),B=r(s,/version\/(\d+\.\d+)/),j=r(f,/version\/(\d+\.\d+)/),F=r(a,/webkit\/(\d+\.\d+)/),I=/^https/i.test(window.location.protocol),q=/^(mailto:)?([a-z0-9'\._-]+@[a-z0-9\.-]+\.[a-z0-9]{2,4})([a-яё0-9\._%+-=\? :&]*)/i,R=/^(((https?)|(ftps?)):\/\/)?([\-\wа-яё]*:?[\-\wа-яё]*@)?(((1[0-9]{2}|2[0-4][0-9]|25[0-5]|[1-9][0-9]|[0-9])\.){3}(1[0-9]{2}|2[0-4][0-9]|25[0-5]|[1-9][0-9]|[0-9]))(:\d+)?(\/[%\-\wа-яё]*(\.[\wа-яё]{2,})?(([\wа-яё\-\.\?\\\/+@&#;:`~=%!,\(\)]*)(\.[\wа-яё]{2,})?)*)*\/?/i,U=/^(((https?)|(ftps?)):\/\/)?([\-\wа-яё]*:?[\-\wа-яё]*@)?(([\-\wа-яё]+\.)+[\wа-яё\-]{2,}(:\d+)?(\/[%\-\wа-яё]*(\.[\wа-яё]{2,})?(([\wа-яё\-\.\?\\\/+@&#;:`'~=%!,\(\)]*)(\.[\wа-яё]{2,})?)*)*\/?)/i,z=/^(((https?)|(ftps?)):\/\/)([\-\wа-яё]*:?[\-\wа-яё]*@)?(([\-\wа-яё]+)(:\d+)?(\/[%\-\wа-яё]*(\.[\wа-яё]{2,})?(([\wа-яё\-\.\?\\\/+@&#;:`'~=%!,\(\)]*)(\.[\wа-яё]{2,})?)*)*\/?)/i,W=/(mailto:)?([a-z0-9'\._-]+@[a-z0-9\.-]+\.[a-z0-9]{2,4})([a-яё0-9\._%+-=\?:&]*)/ig,X=/(((https?)|(ftps?)):\/\/([\-\wа-яё]*:?[\-\wа-яё]*@)?)(((1[0-9]{2}|2[0-4][0-9]|25[0-5]|[1-9][0-9]|[0-9])\.){3}(1[0-9]{2}|2[0-4][0-9]|25[0-5]|[1-9][0-9]|[0-9]))(:\d+)?(\/[%\-\wа-яё]*(\.[\wа-яё]{2,})?(([\wа-яё\-\.\?\\\/+@&#;:`~=%!,\(\)]*)(\.[\wа-яё]{2,})?)*)*\/?/ig,V=/((((https?)|(ftps?)):\/\/([\-\wа-яё]*:?[\-\wа-яё]*@)?)|(([\-\wа-яё]*:?[\-\wа-яё]*@)?www\.))((([\-\wа-яё]+\.)+[\wа-яё\-]{2,}|([\-\wа-яё]+))(:\d+)?(\/[%\-\wа-яё]*(\.[\wа-яё]{2,})?(([\wа-яё\-\.\?\\\/+@&#;:`~=%!,\(\)]*)(\.[\wа-яё]{2,})?)*)*\/?)/ig,J={Paragraph:0,Table:1,Image:2,Header:3,TextArt:4,Shape:5,Slide:6,Chart:7,MailMerge:8},K=/android|avantgo|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od|ad)|iris|kindle|lge |maemo|midp|mmp|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(navigator.userAgent||navigator.vendor||window.opera),Q=this,G=function(){Q.zoom=1;if(u&&!s&&!K&&document&&document.firstElementChild&&document.body)if(window.devicePixelRatio>.1){if(window.devicePixelRatio<1.99){var e=1;Q.zoom=window.devicePixelRatio/e}else{var e=2;Q.zoom=window.devicePixelRatio/e}document.firstElementChild.style.zoom=1/Q.zoom}else document.firstElementChild.style.zoom="normal";Q.innerWidth=window.innerWidth*Q.zoom,Q.innerHeight=window.innerHeight*Q.zoom};return Q.zoom=1,Q.innerWidth=window.innerWidth,Q.innerHeight=window.innerHeight,G(),$(window).on("resize",G),{userAgent:e,isStrict:n,isIEQuirks:v&&!n&&(E||m||g||y),isOpera:s,isOpera10_5:o,isWebKit:a,isChrome:u,isSafari:f,isSafari3:c,isSafari4:h,isSafari5:d,isSafari5_0:p,isSafari2:l,isIE:v,isIE6:E,isIE7:m,isIE7m:E||m,isIE7p:v&&!E,isIE8:g,isIE8m:E||m||g,isIE8p:v&&!E&&!m,isIE9:y,isIE9m:E||m||g||y,isIE9p:v&&!(E||m||g),isIE10:b,isIE10m:E||m||g||y||b,isIE10p:v&&!(E||m||g||y),isIE11:w,isIE11m:E||m||g||y||b||w,isIE11p:v&&!(E||m||g||y||b),isGecko:S,isGecko3:x,isGecko4:T,isGecko5:N,isGecko10:C,isFF3_0:k,isFF3_5:L,isFF3_6:A,isFF4:4<=P&&P<5,isFF5:5<=P&&P<6,isFF10:10<=P&&P<11,isLinux:_,isWindows:O,isMac:M,chromeVersion:D,firefoxVersion:P,ieVersion:H,operaVersion:B,safariVersion:j,webKitVersion:F,isSecure:I,emailRe:q,ipRe:R,hostnameRe:U,localRe:z,emailStrongRe:W,ipStrongRe:X,hostnameStrongRe:V,documentSettingsType:J,zoom:function(){return Q.zoom},innerWidth:function(){return Q.innerWidth},innerHeight:function(){return Q.innerHeight}}},Common.Utils||{}),Common.Utils.ThemeColor=new function(){return{ThemeValues:[6,15,7,16,0,1,2,3,4,5],setColors:function(e,t){var n,r,i;if(t&&t.length>0){var s=[];for(n=0;n<t.length;n++)i=this.getHexColor(t[n].get_r(),t[n].get_g(),t[n].get_b()),s.push(i);this.standartcolors=s}var o=[];for(n=0;n<6;n++)for(r=0;r<10;r++){var u=n+r*6;i={color:this.getHexColor(e[u].get_r(),e[u].get_g(),e[u].get_b()),effectId:u,effectValue:this.ThemeValues[r]},o.push(i)}this.effectcolors=o},getEffectColors:function(){return this.effectcolors},getStandartColors:function(){return this.standartcolors},getHexColor:function(e,t,n){return e=e.toString(16),t=t.toString(16),n=n.toString(16),e.length==1&&(e="0"+e),t.length==1&&(t="0"+t),n.length==1&&(n="0"+n),e+t+n},getRgbColor:function(e){var t=typeof e=="object"?e.color:e;t=t.replace(/#/,""),t.length==3&&(t=t.replace(/(.)/g,"$1$1")),t=parseInt(t,16);var n=new Asc.asc_CColor;return n.put_type(typeof e=="object"&&e.effectId!==undefined?Asc.c_oAscColor.COLOR_TYPE_SCHEME:Asc.c_oAscColor.COLOR_TYPE_SRGB),n.put_r(t>>16),n.put_g((t&65280)>>8),n.put_b(t&255),n.put_a(255),e.effectId!==undefined&&n.put_value(e.effectId),n},colorValue2EffectId:function(e){if(typeof e=="object"&&e.effectValue!==undefined&&this.effectcolors)for(var t=0;t<this.effectcolors.length;t++)if(this.effectcolors[t].effectValue===e.effectValue&&e.color.toUpperCase()===this.effectcolors[t].color.toUpperCase()){e.effectId=this.effectcolors[t].effectId;break}return e}}},Common.Utils.Metric=_.extend(new function(){var e=this;return e.c_MetricUnits={cm:0,pt:1,inch:2},e.currentMetric=e.c_MetricUnits.pt,e.metricName=["Cm","Pt","Inch"],e.defaultMetric=e.c_MetricUnits.cm,{c_MetricUnits:e.c_MetricUnits,txtCm:"cm",txtPt:"pt",txtInch:'"',setCurrentMetric:function(t){e.currentMetric=t},getCurrentMetric:function(){return e.currentMetric},getCurrentMetricName:function(){return this["txt"+e.metricName[e.currentMetric]]},getMetricName:function(t){return this["txt"+e.metricName[t!==undefined?t:0]]},setDefaultMetric:function(t){e.defaultMetric=t},getDefaultMetric:function(){return e.defaultMetric},fnRecalcToMM:function(t){if(t!==null&&t!==undefined)switch(e.currentMetric){case e.c_MetricUnits.cm:return t*10;case e.c_MetricUnits.pt:return t*25.4/72;case e.c_MetricUnits.inch:return t*25.4}return t},fnRecalcFromMM:function(t){switch(e.currentMetric){case e.c_MetricUnits.cm:return parseFloat((t/10).toFixed(4));case e.c_MetricUnits.pt:return parseFloat((t*72/25.4).toFixed(3));case e.c_MetricUnits.inch:return parseFloat((t/25.4).toFixed(3))}return t}}},Common.Utils.Metric||{}),Common.Utils.RGBColor=function(e){var t,n,r;e.charAt(0)=="#"&&(e=e.substr(1,6)),e=e.replace(/ /g,""),e=e.toLowerCase();var i=[{re:/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,process:function(e){return[parseInt(e[1]),parseInt(e[2]),parseInt(e[3])]}},{re:/^hsb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,process:function(e){var t={},n=Math.round(e[1]),r=Math.round(e[2]*255/100),i=Math.round(e[3]*255/100);if(r==0)t.r=t.g=t.b=i;else{var s=i,o=(255-r)*i/255,u=(s-o)*(n%60)/60;n==360&&(n=0),n<60?(t.r=s,t.b=o,t.g=o+u):n<120?(t.g=s,t.b=o,t.r=s-u):n<180?(t.g=s,t.r=o,t.b=o+u):n<240?(t.b=s,t.r=o,t.g=s-u):n<300?(t.b=s,t.g=o,t.r=o+u):n<360?(t.r=s,t.g=o,t.b=s-u):(t.r=0,t.g=0,t.b=0)}return[Math.round(t.r),Math.round(t.g),Math.round(t.b)]}},{re:/^(\w{2})(\w{2})(\w{2})$/,process:function(e){return[parseInt(e[1],16),parseInt(e[2],16),parseInt(e[3],16)]}},{re:/^(\w{1})(\w{1})(\w{1})$/,process:function(e){return[parseInt(e[1]+e[1],16),parseInt(e[2]+e[2],16),parseInt(e[3]+e[3],16)]}}];for(var s=0;s<i.length;s++){var o=i[s].re,u=i[s].process,a=o.exec(e);if(a){var f=u(a);t=f[0],n=f[1],r=f[2]}}t=t<0||isNaN(t)?0:t>255?255:t,n=n<0||isNaN(n)?0:n>255?255:n,r=r<0||isNaN(r)?0:r>255?255:r;var l=function(e){return t==e.r&&n==e.g&&r==e.b},c=function(){return"rgb("+t+", "+n+", "+r+")"},h=function(e){return e===undefined&&(e=1),"rgba("+t+", "+n+", "+r+", "+e+")"},p=function(){var e=t.toString(16),i=n.toString(16),s=r.toString(16);return e.length==1&&(e="0"+e),i.length==1&&(i="0"+i),s.length==1&&(s="0"+s),"#"+e+i+s},d=function(){var e={h:0,s:0,b:0},i=Math.min(t,n,r),s=Math.max(t,n,r),o=s-i;return e.b=s,e.s=s!=0?255*o/s:0,e.s!=0?t==s?e.h=0+(n-r)/o:n==s?e.h=2+(r-t)/o:e.h=4+(t-n)/o:e.h=0,e.h*=60,e.h<0&&(e.h+=360),e.s*=100/255,e.b*=100/255,e.h=parseInt(e.h),e.s=parseInt(e.s),e.b=parseInt(e.b),e};return{r:t,g:n,b:r,isEqual:l,toRGB:c,toRGBA:h,toHex:p,toHSB:d}},Common.Utils.String=new function(){return{format:function(e){var t=_.toArray(arguments).slice(1);return e.replace(/\{(\d+)\}/g,function(e,n){return t[n]})},htmlEncode:function(e){return _.escape(e)},htmlDecode:function(e){return _.unescape(e)},ellipsis:function(e,t,n){if(e&&e.length>t){if(n){var r=e.substr(0,t-2),i=Math.max(r.lastIndexOf(" "),r.lastIndexOf("."),r.lastIndexOf("!"),r.lastIndexOf("?"));if(i!==-1&&i>=t-15)return r.substr(0,i)+"..."}return e.substr(0,t-3)+"..."}return e},platformKey:function(e,t,n){return _.isEmpty(t)&&(t=" ({0})"),Common.Utils.isMac?(_.isFunction(n)&&(e=n.call(this,e)),Common.Utils.String.format(t,e.replace(/\+(?=\S)/g,"").replace(/Ctrl|ctrl/g,"⌘").replace(/Alt|alt/g,"⌥").replace(/Shift|shift/g,"⇧"))):Common.Utils.String.format(t,e)}}},Common.Utils.isBrowserSupported=function(){return!(Common.Utils.ieVersion!=0&&Common.Utils.ieVersion<9||Common.Utils.safariVersion!=0&&Common.Utils.safariVersion<5||Common.Utils.firefoxVersion!=0&&Common.Utils.firefoxVersion<4||Common.Utils.chromeVersion!=0&&Common.Utils.chromeVersion<7||Common.Utils.operaVersion!=0&&Common.Utils.operaVersion<10.5)},Common.Utils.showBrowserRestriction=function(){var e=window.DE?"Document":window.SSE?"Spreadsheet":window.PE?"Presentation":"that",t=document.createElement("div");t.innerHTML='<div class="app-error-panel"><div class="message-block"><div class="message-inner"><div class="title">Your browser is not supported.</div><div class="text">Sorry, '+e+" Editor is currently only supported in the latest versions of the Chrome, Firefox, Safari or Internet Explorer web browsers.</div>"+"</div>"+"</div>"+'<div class="message-auxiliary"></div>'+"</div>",document.body.appendChild(t),$("#loading-mask").hide().remove(),$("#viewport").hide().remove()},Common.Utils.applyCustomization=function(e,t){for(var n in e){var r;if(!!t[n]){r=$(t[n]);if(r.length){var i=e[n];i===!1||i.visible===!1?r.hide():(!i.text||r.text(i.text),i.visible===!1&&r.hide())}}}},Common.Utils.applyCustomizationPlugins=function(plugins){if(!plugins||plugins.length<1)return;var _createXMLHTTPObject=function(){var e;try{e=new ActiveXObject("Msxml2.XMLHTTP")}catch(t){try{e=new ActiveXObject("Microsoft.XMLHTTP")}catch(n){e=!1}}return!e&&typeof XMLHttpRequest!="undefined"&&(e=new XMLHttpRequest),e},_getPluginCode=function(url){if(!url)return"";try{var xhrObj=_createXMLHTTPObject();xhrObj&&url&&(xhrObj.open("GET",url,!1),xhrObj.send(""),xhrObj.status==200&&eval(xhrObj.responseText))}catch(e){}return null};plugins.forEach(function(e){e&&_getPluginCode(e)})},Common.Utils.fillUserInfo=function(e,t,n){var r=e||{};return!r.id&&(r.id="uid-"+Date.now()),_.isEmpty(r.name)?(_.isEmpty(r.firstname)&&_.isEmpty(r.lastname)&&(r.firstname=n),_.isEmpty(r.firstname)?r.fullname=r.lastname:_.isEmpty(r.lastname)?r.fullname=r.firstname:r.fullname=/^ru/.test(t)?r.lastname+" "+r.firstname:r.firstname+" "+r.lastname):r.fullname=r.name,r},String.prototype.strongMatch=function(e){if(e&&e instanceof RegExp){var t=this.toString().match(e);return!!(t&&t.length>0&&t[0].length==this.length)}return!1},define("common/main/lib/util/utils",function(){});if(Common===undefined)var Common={};define("common/main/lib/view/CopyWarningDialog",["common/main/lib/component/Window"],function(){"use strict";Common.Views.CopyWarningDialog=Common.UI.Window.extend(_.extend({options:{width:500,height:325,cls:"modal-dlg copy-warning"},initialize:function(e){_.extend(this.options,{title:this.textTitle},e||{}),this.template=['<div class="box">','<p class="message">'+this.textMsg+"</p>",'<div class="hotkeys">',"<div>",'<p class="hotkey">'+Common.Utils.String.platformKey("Ctrl+C","{0}")+"</p>",'<p class="message">'+this.textToCopy+"</p>","</div>","<div>",'<p class="hotkey">'+Common.Utils.String.platformKey("Ctrl+X","{0}")+"</p>",'<p class="message">'+this.textToCut+"</p>","</div>","<div>",'<p class="hotkey">'+Common.Utils.String.platformKey("Ctrl+V","{0}")+"</p>",'<p class="message">'+this.textToPaste+"</p>","</div>","</div>",'<div id="copy-warning-checkbox" style="margin-top: 20px; text-align: left;"></div>',"</div>",'<div class="separator horizontal"/>','<div class="footer center">','<button class="btn normal dlg-btn primary">'+this.okButtonText+"</button>","</div>"].join(""),this.options.tpl=_.template(this.template,this.options),Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this),this.chDontShow=new Common.UI.CheckBox({el:$("#copy-warning-checkbox"),labelText:this.textDontShow}),this.getChild().find(".btn").on("click",_.bind(this.onBtnClick,this)),this.autoSize()},autoSize:function(){var e=this.getChild(".box"),t=this.getChild(".footer"),n=this.getChild(".header"),r=this.getChild(".body");r.height(parseInt(e.height())+parseInt(t.css("height"))),this.setHeight(parseInt(r.css("height"))+parseInt(n.css("height")))},onBtnClick:function(e){this.options.handler&&this.options.handler.call(this,this.chDontShow.getValue()=="checked"),this.close()},onKeyPress:function(e){e.keyCode==Common.UI.Keys.RETURN&&(this.options.handler&&this.options.handler.call(this,this.chDontShow.getValue()=="checked"),this.close())},getSettings:function(){return this.chDontShow.getValue()=="checked"},textTitle:"Copy, Cut and Paste Actions",textMsg:"Copy, cut and paste actions using the editor toolbar buttons and context menu actions will be performed within this editor tab only.<br><br>.To copy or paste to or from applications outside the editor tab use the following keyboard combinations:",textToCopy:"for Copy",textToPaste:"for Paste",textToCut:"for Cut",textDontShow:"Don't show this message again"},Common.Views.CopyWarningDialog||{}))}),$(document).off("keydown.bs.dropdown.data-api").on("keydown.bs.dropdown.data-api","[data-toggle=dropdown], [role=menu]",onDropDownKeyDown),function(){function n(e){(e.which==1||e.which==undefined)&&clearMenus(/form-control/.test(e.target.className))}var e=$._data($(document).get(0),"events"),t;e&&e.click&&e.click.every(function(e,n,r){return/click/.test(e.type)&&!e.selector&&/bs\..+\.dropdown/.test(e.namespace)&&(t=e.handler),!t}),!t||$(document).off("click.bs.dropdown.data-api",t).on("click.bs.dropdown.data-api",n)}(),define("common/main/lib/extend/Bootstrap",function(){});if(Common===undefined)var Common={};define("common/main/lib/component/ToggleManager",["common/main/lib/component/BaseView"],function(){"use strict";function t(t,n){var r,i,s;if(n){r=e[t.toggleGroup];for(i=0,s=r.length;i<s;i++)r[i]!==t&&(r[i].isActive?r[i].isActive()&&r[i].toggle(!1):r[i].toggle(!1))}}var e={};Common.UI.ToggleManager={register:function(n){if(!n.toggleGroup)return;var r=e[n.toggleGroup];r||(r=e[n.toggleGroup]=[]),r.push(n),n.on("toggle",t)},unregister:function(n){if(!n.toggleGroup)return;var r=e[n.toggleGroup];r&&(_.without(r,n),n.off("toggle",t))},getToggled:function(t){var n=e[t],r=0,i;if(n)for(i=n.length;r<i;r++)if(n[r].pressed===!0||n[r].checked===!0)return n[r];return null}}});if(Common===undefined)var Common={};define("common/main/lib/component/MenuItem",["common/main/lib/component/BaseView","common/main/lib/component/ToggleManager"],function(){"use strict";Common.UI.MenuItem=Common.UI.BaseView.extend({options:{id:null,cls:"",style:"",hint:!1,checkable:!1,checked:!1,allowDepress:!1,disabled:!1,value:null,toggleGroup:null,iconCls:"",menu:null,canFocused:!0},tagName:"li",template:_.template(['<a id="<%= id %>" style="<%= style %>" <% if(options.canFocused) { %> tabindex="-1" type="menuitem" <% }; if(!_.isUndefined(options.stopPropagation)) { %> data-stopPropagation="true" <% }; %> >',"<% if (!_.isEmpty(iconCls)) { %>",'<span class="menu-item-icon <%= iconCls %>"></span>',"<% } %>","<%= caption %>","</a>"].join("")),initialize:function(e){Common.UI.BaseView.prototype.initialize.call(this,e);var t=this,n=$(this.el);this.id=t.options.id||Common.UI.getId(),this.cls=t.options.cls,this.style=t.options.style,this.caption=t.options.caption,this.menu=t.options.menu||null,this.checkable=t.options.checkable,this.checked=t.options.checked,t.allowDepress=t.options.allowDepress,this.disabled=t.options.disabled,this.value=t.options.value,this.toggleGroup=t.options.toggleGroup,this.template=t.options.template||this.template,this.iconCls=t.options.iconCls,this.rendered=!1,this.menu!==null&&!(this.menu instanceof Common.UI.Menu)&&(this.menu=new Common.UI.Menu(_.extend({},t.options.menu))),t.options.el&&this.render()},render:function(){var e=this,t=$(this.el);e.trigger("render:before",e);if(e.caption==="--")t.addClass("divider");else if(!this.rendered){t.off("click"),Common.UI.ToggleManager.unregister(e),$(this.el).html(this.template({id:e.id,caption:e.caption,iconCls:e.iconCls,style:e.style,options:e.options})),e.menu&&(t.addClass("dropdown-submenu"),e.menu.render($(this.el)),t.mouseenter(_.bind(e.menu.alignPosition,e.menu)),t.focusout(_.bind(e.onBlurItem,e)),t.hover(_.bind(e.onHoverItem,e),_.bind(e.onUnHoverItem,e)));var n=t.children(":first");this.checkable&&n&&(n.toggleClass("checkable",this.checkable),n.toggleClass("checked",this.checked),_.isEmpty(this.iconCls)||n.css("background-image","none")),this.disabled&&$(this.el).toggleClass("disabled",this.disabled),t.on("click",_.bind(this.onItemClick,this)),t.on("mousedown",_.bind(this.onItemMouseDown,this)),Common.UI.ToggleManager.register(e)}return e.cmpEl=$(this.el),e.rendered=!0,e.trigger("render:after",e),this},setCaption:function(e,t){this.caption=e,this.rendered&&(this.cmpEl.find("a").contents().last()[0].textContent=t?e:Common.Utils.String.htmlEncode(e))},setChecked:function(e,t){this.toggle(e,t)},isChecked:function(){return this.checked},setDisabled:function(e){this.disabled=!!e,this.rendered&&this.cmpEl.toggleClass("disabled",this.disabled)},isDisabled:function(){return this.disabled},toggle:function(e,t){var n=e===undefined?!this.checked:!!e;if(this.checkable){this.checked=n;if(this.rendered){var r=this.cmpEl.children(":first");r&&(r.toggleClass("checked",this.checked),_.isEmpty(this.iconCls)||r.css("background-image","none"))}t||this.trigger("toggle",this,n)}},onItemMouseDown:function(e){if(e.which!=1)return e.preventDefault(),e.stopPropagation(),!1},onItemClick:function(e){if(!(e.which==1||e.which===undefined&&!this.menu))return!1;!this.disabled&&(this.allowDepress||!this.checked||!this.toggleGroup)&&!this.menu&&this.setChecked(!this.checked);if(this.menu){if(e.target.id==this.id)return!1;this.menu.isOver||this.cmpEl.removeClass("over");return}if(!!this.disabled)return!1;this.trigger("click",this,e)},onHoverItem:function(e){this._doHover(e)},onUnHoverItem:function(e){this._doUnHover(e)},onBlurItem:function(e){this._doUnHover(e)},_doHover:function(e){var t=this;t.menu&&!t.disabled&&(clearTimeout(t.hideMenuTimer),t.cmpEl.trigger("show.bs.dropdown"),t.expandMenuTimer=_.delay(function(){t.cmpEl.addClass("over"),t.cmpEl.trigger("shown.bs.dropdown")},200))},_doUnHover:function(e){var t=this;if(t.cmpEl.hasClass("dropdown-submenu")&&t.cmpEl.hasClass("over")&&(e&&e.relatedTarget&&t.cmpEl.find(e.relatedTarget).length>0||t.cmpEl.hasClass("focused-submenu"))){t.cmpEl.removeClass("focused-submenu");return}if(t.menu&&!t.disabled){clearTimeout(t.expandMenuTimer),t.hideMenuTimer=_.delay(function(){t.menu.isOver||t.cmpEl.removeClass("over")},200);if(e&&e.type!=="focusout"){var n=t.cmpEl.children(":focus");n.length>0&&(n.blur(),t.cmpEl.closest("ul").focus())}}}}),Common.UI.MenuItemSeparator=function(e){return e=e||{},e.caption="--",new Common.UI.MenuItem(e)}}),function(e){typeof define=="function"&&define.amd?define("jmousewheel",["jquery"],e):typeof exports=="object"?module.exports=e:e(jQuery)}(function(e){function a(t){var n=t||window.event,o=r.call(arguments,1),u=0,a=0,c=0,h=0;t=e.event.fix(n),t.type="mousewheel","detail"in n&&(c=n.detail*-1),"wheelDelta"in n&&(c=n.wheelDelta),"wheelDeltaY"in n&&(c=n.wheelDeltaY),"wheelDeltaX"in n&&(a=n.wheelDeltaX*-1),"axis"in n&&n.axis===n.HORIZONTAL_AXIS&&(a=c*-1,c=0),u=c===0?a:c,"deltaY"in n&&(c=n.deltaY*-1,u=c),"deltaX"in n&&(a=n.deltaX,c===0&&(u=a*-1));if(c===0&&a===0)return;if(n.deltaMode===1){var p=e.data(this,"mousewheel-line-height");u*=p,c*=p,a*=p}else if(n.deltaMode===2){var d=e.data(this,"mousewheel-page-height");u*=d,c*=d,a*=d}h=Math.max(Math.abs(c),Math.abs(a));if(!s||h<s)s=h,l(n,h)&&(s/=40);return l(n,h)&&(u/=40,a/=40,c/=40),u=Math[u>=1?"floor":"ceil"](u/s),a=Math[a>=1?"floor":"ceil"](a/s),c=Math[c>=1?"floor":"ceil"](c/s),t.deltaX=a,t.deltaY=c,t.deltaFactor=s,t.deltaMode=0,o.unshift(t,u,a,c),i&&clearTimeout(i),i=setTimeout(f,200),(e.event.dispatch||e.event.handle).apply(this,o)}function f(){s=null}function l(e,t){return u.settings.adjustOldDeltas&&e.type==="mousewheel"&&t%120===0}var t=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],n="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],r=Array.prototype.slice,i,s;if(e.event.fixHooks)for(var o=t.length;o;)e.event.fixHooks[t[--o]]=e.event.mouseHooks;var u=e.event.special.mousewheel={version:"3.1.9",setup:function(){if(this.addEventListener)for(var t=n.length;t;)this.addEventListener(n[--t],a,!1);else this.onmousewheel=a;e.data(this,"mousewheel-line-height",u.getLineHeight(this)),e.data(this,"mousewheel-page-height",u.getPageHeight(this))},teardown:function(){if(this.removeEventListener)for(var e=n.length;e;)this.removeEventListener(n[--e],a,!1);else this.onmousewheel=null},getLineHeight:function(t){return parseInt(e(t)["offsetParent"in e.fn?"offsetParent":"parent"]().css("fontSize"),10)},getPageHeight:function(t){return e(t).height()},settings:{adjustOldDeltas:!0}};e.fn.extend({mousewheel:function(e){return e?this.bind("mousewheel",e):this.trigger("mousewheel")},unmousewheel:function(e){return this.unbind("mousewheel",e)}})}),function(e){"use strict";typeof define=="function"&&define.amd?define("perfectscrollbar",["jquery"],e):typeof exports=="object"?e(require("jquery")):e(jQuery)}(function(e){"use strict";var t={wheelSpeed:10,wheelPropagation:!1,minScrollbarLength:null,useBothWheelAxes:!1,useKeyboard:!0,suppressScrollX:!1,suppressScrollY:!1,scrollXMarginOffset:0,scrollYMarginOffset:0,includePadding:!1,includeMargin:!0},n=function(){var e=0;return function(){var t=e;return e+=1,".perfect-scrollbar-"+t}}();e.fn.perfectScrollbar=function(r,i){return this.each(function(){var s=e.extend(!0,{},t),o=e(this);typeof r=="object"?e.extend(!0,s,r):i=r;if(i==="update")return o.data("perfect-scrollbar-update")&&o.data("perfect-scrollbar-update")(),o;if(i==="destroy")return o.data("perfect-scrollbar-destroy")&&o.data("perfect-scrollbar-destroy")(),o;if(o.data("perfect-scrollbar"))return o.data("perfect-scrollbar");o.addClass("ps-container");var u=e("<div class='ps-scrollbar-x-rail'></div>").appendTo(o),a=e("<div class='ps-scrollbar-y-rail'></div>").appendTo(o),f=e("<div class='ps-scrollbar-x'></div>").appendTo(u),l=e("<div class='ps-scrollbar-y'></div>").appendTo(a),c,h,p,d,v,m,g,y,b=parseInt(u.css("bottom"),10),w,E,S=parseInt(a.css("right"),10),x,T=n(),N=function(e,t){var n=e+t,r=x-w;n<0?E=0:n>r?E=r:E=n;var i=parseInt(E*(m-d)/(x-w),10);o.scrollTop(i),u.css({bottom:b-i})},C=function(e,t){var n=e+t,r=p-g;n<0?y=0:n>r?y=r:y=n;var i=parseInt(y*(v-p)/(p-g),10);o.scrollLeft(i),a.css({right:S-i})},k=function(e){return s.minScrollbarLength&&(e=Math.max(e,s.minScrollbarLength)),e},L=function(){u.css({left:o.scrollLeft(),bottom:b-o.scrollTop(),width:p,display:c?"inherit":"none"}),a.hasClass("in-scrolling")?a.css({right:S-o.scrollLeft(),height:x,display:h?"inherit":"none"}):a.css({top:o.scrollTop(),right:S-o.scrollLeft(),height:x,display:h?"inherit":"none"}),f.css({left:y,width:g}),l.css({top:E,height:w})},A=function(){p=s.includePadding?o.innerWidth():o.width(),d=s.includePadding?o.innerHeight():o.height(),x=d-(s.includeMargin?parseInt(a.css("margin-top"))+parseInt(a.css("margin-bottom")):0),v=o.prop("scrollWidth"),m=o.prop("scrollHeight"),!s.suppressScrollX&&p+s.scrollXMarginOffset<v?(c=!0,g=k(parseInt(p*p/v,10)),y=parseInt(o.scrollLeft()*(p-g)/(v-p),10)):(c=!1,g=0,y=0,o.scrollLeft(0)),!s.suppressScrollY&&d+s.scrollYMarginOffset<m?(h=!0,w=k(parseInt(x*d/m,10)),E=parseInt(o.scrollTop()*(x-w)/(m-d),10)):(h=!1,w=0,E=0,o.scrollTop(0)),E>=x-w&&(E=x-w),y>=p-g&&(y=p-g),L(),s.onChange&&s.onChange(this)},O=function(){var t,n;f.bind("mousedown"+T,function(e){n=e.pageX,t=f.position().left,u.addClass("in-scrolling"),e.stopPropagation(),e.preventDefault()}),e(document).bind("mousemove"+T,function(e){u.hasClass("in-scrolling")&&(C(t,e.pageX-n),e.stopPropagation(),e.preventDefault())}),e(document).bind("mouseup"+T,function(e){u.hasClass("in-scrolling")&&u.removeClass("in-scrolling")}),t=n=null},M=function(){var t,n;l.bind("mousedown"+T,function(e){n=e.pageY,t=l.position().top,a.addClass("in-scrolling");var r=parseInt(a.css("margin-top")),i=a[0].getBoundingClientRect();a.css({position:"fixed",left:i.left,top:i.top-r}),e.stopPropagation(),e.preventDefault()}),e(document).bind("mousemove"+T,function(e){a.hasClass("in-scrolling")&&(N(t,e.pageY-n),e.stopPropagation(),e.preventDefault())}),e(document).bind("mouseup"+T,function(e){a.hasClass("in-scrolling")&&(a.removeClass("in-scrolling"),a.css({position:"",left:"",top:""}),L())}),t=n=null},_=function(e,t){var n=o.scrollTop();if(e===0){if(!h)return!1;if(n===0&&t>0||n>=m-d&&t<0)return!s.wheelPropagation}var r=o.scrollLeft();if(t===0){if(!c)return!1;if(r===0&&e<0||r>=v-p&&e>0)return!s.wheelPropagation}return!0},D=function(){s.wheelSpeed/=10;var t=!1;o.bind("mousewheel"+T,function(n,r,i,u){var a=n.deltaX*n.deltaFactor||i,f=n.deltaY*n.deltaFactor||u;if(n&&n.target&&(n.target.type==="textarea"||n.target.type==="input")){n.stopImmediatePropagation(),n.preventDefault();var l=e(n.target).scrollTop(),p=0;n.originalEvent?n.originalEvent.wheelDelta?p=n.originalEvent.wheelDelta:n.originalEvent.deltaY?p=-n.originalEvent.deltaY*40:n.originalEvent.detail&&(p=n.originalEvent.detail):p=n.wheelDelta!==undefined?n.wheelDelta:n.deltaY,e(n.target).scrollTop(l-p);return}t=!1,s.useBothWheelAxes?h&&!c?(f?o.scrollTop(o.scrollTop()-f*s.wheelSpeed):o.scrollTop(o.scrollTop()+a*s.wheelSpeed),t=!0):c&&!h&&(a?o.scrollLeft(o.scrollLeft()+a*s.wheelSpeed):o.scrollLeft(o.scrollLeft()-f*s.wheelSpeed),t=!0):(o.scrollTop(o.scrollTop()-f*s.wheelSpeed),o.scrollLeft(o.scrollLeft()+a*s.wheelSpeed)),A(),t=t||_(a,f),t&&(n.stopPropagation(),n.preventDefault())}),o.bind("MozMousePixelScroll"+T,function(e){t&&e.preventDefault()})},P=function(){var t=!1;o.bind("mouseenter"+T,function(e){t=!0}),o.bind("mouseleave"+T,function(e){t=!1});var n=!1;e(document).bind("keydown"+T,function(r){if(!t||e(document.activeElement).is(":input,[contenteditable]"))return;var i=0,s=0;switch(r.which){case 37:i=-30;break;case 38:s=30;break;case 39:i=30;break;case 40:s=-30;break;case 33:s=90;break;case 32:case 34:s=-90;break;case 35:s=-d;break;case 36:s=d;break;default:return}o.scrollTop(o.scrollTop()-s),o.scrollLeft(o.scrollLeft()+i),n=_(i,s),n&&r.preventDefault()})},H=function(){var e=function(e){e.stopPropagation()};l.bind("click"+T,e),a.bind("click"+T,function(e){var t=parseInt(w/2,10),n=e.pageY-a.offset().top-t,r=x-w,i=n/r;i<0?i=0:i>1&&(i=1),o.scrollTop((m-d)*i)}),f.bind("click"+T,e),u.bind("click"+T,function(e){var t=parseInt(g/2,10),n=e.pageX-u.offset().left-t,r=p-g,i=n/r;i<0?i=0:i>1&&(i=1),o.scrollLeft((v-p)*i)})},B=function(){var t=function(e,t){o.scrollTop(o.scrollTop()-t),o.scrollLeft(o.scrollLeft()-e),A()},n={},r=0,i={},s=null,u=!1;e(window).bind("touchstart"+T,function(e){u=!0}),e(window).bind("touchend"+T,function(e){u=!1}),o.bind("touchstart"+T,function(e){var t=e.originalEvent.targetTouches[0];n.pageX=t.pageX,n.pageY=t.pageY,r=(new Date).getTime(),s!==null&&clearInterval(s),e.stopPropagation()}),o.bind("touchmove"+T,function(e){if(!u&&e.originalEvent.targetTouches.length===1){var s=e.originalEvent.targetTouches[0],o={};o.pageX=s.pageX,o.pageY=s.pageY;var a=o.pageX-n.pageX,f=o.pageY-n.pageY;t(a,f),n=o;var l=(new Date).getTime(),c=l-r;c>0&&(i.x=a/c,i.y=f/c,r=l),e.preventDefault()}}),o.bind("touchend"+T,function(e){clearInterval(s),s=setInterval(function(){if(Math.abs(i.x)<.01&&Math.abs(i.y)<.01){clearInterval(s);return}t(i.x*30,i.y*30),i.x*=.8,i.y*=.8},10)})},j=function(){o.bind("scroll"+T,function(e){A()})},F=function(){o.unbind(T),e(window).unbind(T),e(document).unbind(T),o.data("perfect-scrollbar",null),o.data("perfect-scrollbar-update",null),o.data("perfect-scrollbar-destroy",null),f.remove(),l.remove(),u.remove(),a.remove(),f=l=p=d=v=m=g=y=b=w=E=S=null},I=function(t){o.addClass("ie").addClass("ie"+t);var n=function(){var t=function(){e(this).addClass("hover")},n=function(){e(this).removeClass("hover")};o.bind("mouseenter"+T,t).bind("mouseleave"+T,n),u.bind("mouseenter"+T,t).bind("mouseleave"+T,n),a.bind("mouseenter"+T,t).bind("mouseleave"+T,n),f.bind("mouseenter"+T,t).bind("mouseleave"+T,n),l.bind("mouseenter"+T,t).bind("mouseleave"+T,n)},r=function(){L=function(){f.css({left:y+o.scrollLeft(),bottom:b,width:g}),l.css({top:E+o.scrollTop(),right:S,height:w}),f.hide().show(),l.hide().show()}};t===6&&(n(),r())},q="ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch,R=function(){var e=navigator.userAgent.toLowerCase().match(/(msie) ([\w.]+)/);e&&e[1]==="msie"&&I(parseInt(e[2],10)),A(),j(),O(),M(),H(),q&&B(),o.mousewheel&&D(),s.useKeyboard&&P(),o.data("perfect-scrollbar",o),o.data("perfect-scrollbar-update",A),o.data("perfect-scrollbar-destroy",F)};return R(),o})}});if(Common===undefined)var Common={};define("common/main/lib/component/Scroller",["jmousewheel","perfectscrollbar","common/main/lib/component/BaseView"],function(){"use strict";Common.UI.Scroller=function(){var e;return _.extend(Common.UI.BaseView.extend({options:{wheelSpeed:20,wheelPropagation:!1,minScrollbarLength:null,useBothWheelAxes:!1,useKeyboard:!0,suppressScrollX:!1,suppressScrollY:!1,scrollXMarginOffset:5,scrollYMarginOffset:5,includePadding:!0,includeMargin:!0,alwaysVisibleX:!1,alwaysVisibleY:!1},initialize:function(e){Common.UI.BaseView.prototype.initialize.call(this,e),this.options.el&&this.render()},render:function(){var e=this;return e.cmpEl=$(this.el),e.rendered||(e.cmpEl.perfectScrollbar(_.extend({},e.options)),e.rendered=!0,this.setAlwaysVisibleX(e.options.alwaysVisibleX),this.setAlwaysVisibleY(e.options.alwaysVisibleY)),this},remove:function(){this.destroy(),Backbone.View.prototype.remove.call(this)},update:function(t){var n=this.options;t?(this.destroy(),n=_.extend(this.options,t),this.cmpEl.perfectScrollbar(n)):this.cmpEl.perfectScrollbar("update"),this.setAlwaysVisibleX(n.alwaysVisibleX),this.setAlwaysVisibleY(n.alwaysVisibleY);var r=function(t){e=!0;var n=function(t){$(document).unbind("mouseup",n),_.delay(function(){e=!1},10)};$(document).mouseup(n)};$(".ps-scrollbar-x-rail, .ps-scrollbar-y-rail, .ps-scrollbar-x, .ps-scrollbar-y",this.cmpEl).off("mousedown",r).on("mousedown",r)},destroy:function(){this.cmpEl.perfectScrollbar("destroy")},scrollLeft:function(e){this.cmpEl.scrollLeft(e),this.update()},scrollTop:function(e){this.cmpEl.scrollTop(e),this.update()},getScrollTop:function(){return this.cmpEl.scrollTop()},getScrollLeft:function(){return this.cmpEl.scrollLeft()},setAlwaysVisibleX:function(e){e?($(this.el).find(".ps-scrollbar-x-rail").addClass("always-visible-x"),$(this.el).find(".ps-scrollbar-x").addClass("always-visible-x")):($(this.el).find(".ps-scrollbar-x-rail").removeClass("always-visible-x"),$(this.el).find(".ps-scrollbar-x").addClass("always-visible-x"))},setAlwaysVisibleY:function(e){e?($(this.el).find(".ps-scrollbar-y-rail").addClass("always-visible-y"),$(this.el).find(".ps-scrollbar-y").addClass("always-visible-y")):($(this.el).find(".ps-scrollbar-y-rail").removeClass("always-visible-y"),$(this.el).find(".ps-scrollbar-y").addClass("always-visible-y"))}}),{isMouseCapture:function(){return e}})}()});if(Common===undefined)var Common={};define("common/main/lib/component/Menu",["common/main/lib/extend/Bootstrap","common/main/lib/component/BaseView","common/main/lib/component/MenuItem","common/main/lib/component/Scroller"],function(){"use strict";Common.UI.Menu=function(){var e=function(){var e=[],t={};return{register:function(n){t[n.id]=n,n.on("show:after",function(t){e.push(t)}).on("hide:after",function(t){var n=e.indexOf(t);n>-1&&e.splice(n,1)})},unregister:function(n){var r=e.indexOf(n);delete t[n.id],r>-1&&e.splice(r,1),n.off("show:after").off("hide:after")},hideAll:function(){return Common.NotificationCenter.trigger("menumanager:hideall"),e&&e.length>0?(_.each(e,function(e){e&&e.hide()}),!0):!1}}}();return _.extend(Common.UI.BaseView.extend({options:{cls:"",style:"",itemTemplate:null,items:[],menuAlign:"tl-bl",menuAlignEl:null,offset:[0,0],cyclic:!0},template:_.template(['<ul class="dropdown-menu <%= options.cls %>" oo_editor_input="true" style="<%= options.style %>" role="menu"></ul>'].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t);var n=this;this.id=this.options.id||Common.UI.getId(),this.itemTemplate=this.options.itemTemplate||Common.UI.MenuItem.prototype.template,this.rendered=!1,this.items=[],this.offset=[0,0],this.menuAlign=this.options.menuAlign,this.menuAlignEl=this.options.menuAlignEl,this.options.cyclic||(this.options.cls+=" no-cyclic"),_.each(this.options.items,function(e){e instanceof Common.UI.MenuItem?n.items.push(e):n.items.push(new Common.UI.MenuItem(_.extend({tagName:"li",template:n.itemTemplate},e)))}),this.options.el&&this.render(),e.register(this)},remove:function(){e.unregister(this),Common.UI.BaseView.prototype.remove.call(this)},render:function(e){var t=this;this.trigger("render:before",this),this.cmpEl=$(this.el),e?(this.setElement(e,!1),t.rendered||(this.cmpEl=$(this.template({options:t.options})),e.append(this.cmpEl))):t.rendered||(this.cmpEl=this.template({options:t.options}),$(this.el).append(this.cmpEl));var n=this.cmpEl.parent(),r=n.attr("role")==="menu"?n:n.find("[role=menu]");return r&&(t.rendered||_.each(t.items||[],function(e){r.append(e.render().el),e.on("click",_.bind(t.onItemClick,t)),e.on("toggle",_.bind(t.onItemToggle,t))}),r.css({"max-height":t.options.maxHeight||"none",position:"fixed",right:"auto",left:-1e3,top:-1e3}),this.parentEl=r.parent(),this.parentEl.on("show.bs.dropdown",_.bind(t.onBeforeShowMenu,t)),this.parentEl.on("shown.bs.dropdown",_.bind(t.onAfterShowMenu,t)),this.parentEl.on("hide.bs.dropdown",_.bind(t.onBeforeHideMenu,t)),this.parentEl.on("hidden.bs.dropdown",_.bind(t.onAfterHideMenu,t)),this.parentEl.on("keydown.after.bs.dropdown",_.bind(t.onAfterKeydownMenu,t)),r.on("scroll",_.bind(t.onScroll,t)),r.hover(function(e){t.isOver=!0},function(e){t.isOver=!1})),this.rendered=!0,this.trigger("render:after",this),this},isVisible:function(){return this.rendered&&this.cmpEl.is(":visible")},show:function(){this.rendered&&this.parentEl&&!this.parentEl.hasClass("open")&&this.cmpEl.dropdown("toggle")},hide:function(){this.rendered&&this.parentEl&&(this.parentEl.hasClass("open")?this.cmpEl.dropdown("toggle"):this.parentEl.hasClass("over")&&this.parentEl.removeClass("over"))},insertItem:function(e,t){var n=this,r=this.cmpEl;t instanceof Common.UI.MenuItem||(t=new Common.UI.MenuItem(_.extend({tagName:"li",template:n.itemTemplate},t))),e<0||e>=n.items.length?n.items.push(t):n.items.splice(e,0,t);if(this.rendered){var i=r.attr("role")==="menu"?r:r.find("[role=menu]");i&&(e<0?i.append(t.render().el):e===0?i.prepend(t.render().el):$("li:nth-child("+(e+1)+")",i).before(t.render().el),t.on("click",_.bind(n.onItemClick,n)),t.on("toggle",_.bind(n.onItemToggle,n)))}},doLayout:function(){if(this.options.maxHeight>0){if(!this.rendered){this.mustLayout=!0;return}var e=this,t=this.cmpEl,n=t.attr("role")==="menu"?t:t.find("[role=menu]");if(!n.is(":visible")){var r=[n.css("left"),n.css("top")];n.css({left:"-1000px",top:"-1000px",display:"block"})}var i=n.find("li");if(i.height()*i.length>this.options.maxHeight){var s='<div class="menu-scroll top"></div>';n.prepend(s),s='<div class="menu-scroll bottom"></div>',n.append(s),n.css({"box-shadow":"none","overflow-y":"hidden","padding-top":"18px"}),n.find("> li:last-of-type").css("margin-bottom",18);var o=function(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e.attachEvent("on"+t,n)},u=/Firefox/i.test(navigator.userAgent)?"DOMMouseScroll":"mousewheel";o(n[0],u,_.bind(this.onMouseWheel,this)),n.find(".menu-scroll").on("click",_.bind(this.onScrollClick,this))}r&&n.css({display:"",left:r[0],top:r[1]})}},addItem:function(e){this.insertItem(-1,e)},removeItem:function(e){var t=this,n=t.items.indexOf(e);n>-1&&(t.items.splice(n,1),e.off("click").off("toggle"),e.remove())},removeItems:function(e,t){if(e>this.items.length-1)return;e+t>this.items.length&&(t=this.items.length-e);for(var n=e;n<e+t;n++)this.items[n].off("click").off("toggle"),this.items[n].remove();this.items.splice(e,t)},removeAll:function(){var e=this;_.each(e.items,function(e){e.off("click").off("toggle"),e.remove()}),e.items=[]},onBeforeShowMenu:function(e){Common.NotificationCenter.trigger("menu:show"),this.mustLayout&&(delete this.mustLayout,this.doLayout.call(this)),this.trigger("show:before",this,e),this.alignPosition()},onAfterShowMenu:function(e){this.trigger("show:after",this,e);if(this.$el.find("> ul > .menu-scroll").length){var t=this.$el.find("li .checked")[0];if(t){var n=t.offsetTop-this.options.maxHeight/2;this.scrollMenu(n<0?0:n)}}},onBeforeHideMenu:function(e){this.trigger("hide:before",this,e),Common.UI.Scroller.isMouseCapture()&&e.preventDefault()},onAfterHideMenu:function(e,t){this.trigger("hide:after",this,e,t),Common.NotificationCenter.trigger("menu:hide",this,t)},onAfterKeydownMenu:function(e){if(e.keyCode==Common.UI.Keys.RETURN){var t=$(e.target).closest("li");t.length<=0&&(t=$(e.target).parent().find("li .dataview")),t.length>0&&t.click(),t.hasClass("dropdown-submenu")||Common.UI.Menu.Manager.hideAll(),$(e.currentTarget).closest("li").hasClass("dropdown-submenu")&&e.stopPropagation()}else e.keyCode==Common.UI.Keys.UP||e.keyCode==Common.UI.Keys.DOWN?this.fromKeyDown=!0:e.keyCode==Common.UI.Keys.ESC},onScroll:function(e,t){if(this.fromKeyDown){var n=this.cmpEl.attr("role")==="menu"?this.cmpEl:this.cmpEl.find("[role=menu]");n.find(".menu-scroll.top").css("top",n.scrollTop()+"px"),n.find(".menu-scroll.bottom").css("bottom",-n.scrollTop()+"px")}},onItemClick:function(e,t){e.menu||(this.isOver=!1);if(e.options.stopPropagation){t.stopPropagation();var n=this;_.delay(function(){n.$el.parent().parent().find("[data-toggle=dropdown]").focus()},10);return}this.trigger("item:click",this,e,t)},onItemToggle:function(e,t,n){this.trigger("item:toggle",this,e,t,n)},onScrollClick:function(e){return this.scrollMenu(/top/.test(e.currentTarget.className)),!1},onMouseWheel:function(e){this.scrollMenu((e.detail&&-e.detail||e.wheelDelta)>0)},scrollMenu:function(e){this.fromKeyDown=!1;var t=this.cmpEl.attr("role")==="menu"?this.cmpEl:this.cmpEl.find("[role=menu]"),n=typeof e=="boolean"?t.scrollTop()+(e?-20:20):e;t.scrollTop(n),t.find(".menu-scroll.top").css("top",t.scrollTop()+"px"),t.find(".menu-scroll.bottom").css("bottom",-t.scrollTop()+"px")},setOffset:function(e,t){this.offset[0]=_.isUndefined(e)?this.offset[0]:e,this.offset[1]=_.isUndefined(t)?this.offset[1]:t,this.alignPosition()},getOffset:function(){return this.offset},alignPosition:function(){var e=this.cmpEl.attr("role")==="menu"?this.cmpEl:this.cmpEl.find("[role=menu]"),t=this.menuAlignEl||e.parent(),n=this.menuAlign.match(/^([a-z]+)-([a-z]+)/),r=t.offset(),i=Common.Utils.innerWidth(),s=Common.Utils.innerHeight()-10,o=e.outerWidth(),u=e.outerHeight(),a=t.outerWidth(),f=t.outerHeight(),l={tl:[0,0],bl:[0,u],tr:[o,0],br:[o,u]},c={tl:[0,0],tr:[a,0],bl:[0,f],br:[a,f]},h=r.left-l[n[1]][0]+c[n[2]][0]+this.offset[0],p=r.top-l[n[1]][1]+c[n[2]][1]+this.offset[1];h+o>i&&(t.is("li.dropdown-submenu")?h=r.left-o+2:h=i-o),p+u>s&&(p=s-u),p<0&&(p=0),this.options.additionalAlign?this.options.additionalAlign.call(this,e,h,p):e.css({left:h,top:p})}}),{Manager:function(){return e}()})}()}),define("spreadsheeteditor/main/app/view/DocumentHolder",["jquery","underscore","backbone","gateway","common/main/lib/component/Menu"],function(e,t,n,r){"use strict";SSE.Views.DocumentHolder=n.View.extend(t.extend({el:"#editor_sdk",template:null,events:{},initialize:function(){var e=this;this.setApi=function(t){return e.api=t,e}},render:function(){return this.fireEvent("render:before",this),this.cmpEl=e(this.el),this.fireEvent("render:after",this),this},focus:function(){var e=this;t.defer(function(){e.cmpEl.focus()},50)},createDelayedElements:function(){var t=this;t.pmiCut=new Common.UI.MenuItem({caption:t.txtCut,value:"cut"}),t.pmiCopy=new Common.UI.MenuItem({caption:t.txtCopy,value:"copy"}),t.pmiPaste=new Common.UI.MenuItem({caption:t.txtPaste,value:"paste"}),t.pmiSelectTable=new Common.UI.MenuItem({caption:t.txtSelect,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{caption:this.selectRowText,value:Asc.c_oAscChangeSelectionFormatTable.row},{caption:this.selectColumnText,value:Asc.c_oAscChangeSelectionFormatTable.column},{caption:this.selectDataText,value:Asc.c_oAscChangeSelectionFormatTable.data},{caption:this.selectTableText,value:Asc.c_oAscChangeSelectionFormatTable.all}]})}),t.pmiInsertEntire=new Common.UI.MenuItem({caption:t.txtInsert}),t.pmiInsertCells=new Common.UI.MenuItem({caption:t.txtInsert,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{caption:t.txtShiftRight,value:Asc.c_oAscInsertOptions.InsertCellsAndShiftRight},{caption:t.txtShiftDown,value:Asc.c_oAscInsertOptions.InsertCellsAndShiftDown},{caption:t.txtRow,value:Asc.c_oAscInsertOptions.InsertRows},{caption:t.txtColumn,value:Asc.c_oAscInsertOptions.InsertColumns}]})}),t.pmiInsertTable=new Common.UI.MenuItem({caption:t.txtInsert,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{caption:t.insertRowAboveText,value:Asc.c_oAscInsertOptions.InsertTableRowAbove},{caption:t.insertRowBelowText,value:Asc.c_oAscInsertOptions.InsertTableRowBelow},{caption:t.insertColumnLeftText,value:Asc.c_oAscInsertOptions.InsertTableColLeft},{caption:t.insertColumnRightText,value:Asc.c_oAscInsertOptions.InsertTableColRight}]})}),t.pmiDeleteEntire=new Common.UI.MenuItem({caption:t.txtDelete}),t.pmiDeleteCells=new Common.UI.MenuItem({caption:t.txtDelete,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{caption:t.txtShiftLeft,value:Asc.c_oAscDeleteOptions.DeleteCellsAndShiftLeft},{caption:t.txtShiftUp,value:Asc.c_oAscDeleteOptions.DeleteCellsAndShiftTop},{caption:t.txtRow,value:Asc.c_oAscDeleteOptions.DeleteRows},{caption:t.txtColumn,value:Asc.c_oAscDeleteOptions.DeleteColumns}]})}),t.pmiDeleteTable=new Common.UI.MenuItem({caption:t.txtDelete,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{caption:this.deleteRowText,value:Asc.c_oAscDeleteOptions.DeleteRows},{caption:this.deleteColumnText,value:Asc.c_oAscDeleteOptions.DeleteColumns},{caption:this.deleteTableText,value:Asc.c_oAscDeleteOptions.DeleteTable}]})}),t.pmiClear=new Common.UI.MenuItem({caption:t.txtClear,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{caption:t.txtClearAll,value:Asc.c_oAscCleanOptions.All},{caption:t.txtClearText,value:Asc.c_oAscCleanOptions.Text},{caption:t.txtClearFormat,value:Asc.c_oAscCleanOptions.Format},{caption:t.txtClearComments,value:Asc.c_oAscCleanOptions.Comments},{caption:t.txtClearHyper,value:Asc.c_oAscCleanOptions.Hyperlinks}]})}),t.pmiSortCells=new Common.UI.MenuItem({caption:t.txtSort,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{caption:t.txtAscending,value:Asc.c_oAscSortOptions.Ascending},{caption:t.txtDescending,value:Asc.c_oAscSortOptions.Descending},{caption:t.txtSortCellColor,value:Asc.c_oAscSortOptions.ByColorFill},{caption:t.txtSortFontColor,value:Asc.c_oAscSortOptions.ByColorFont}]})}),t.pmiFilterCells=new Common.UI.MenuItem({caption:t.txtFilter,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{caption:t.txtFilterValue,value:0},{caption:t.txtFilterCellColor,value:1},{caption:t.txtFilterFontColor,value:2}]})}),t.pmiReapply=new Common.UI.MenuItem({caption:t.txtReapply}),t.pmiInsFunction=new Common.UI.MenuItem({caption:t.txtFormula}),t.menuAddHyperlink=new Common.UI.MenuItem({caption:t.txtInsHyperlink,inCell:!0}),t.menuEditHyperlink=new Common.UI.MenuItem({caption:t.editHyperlinkText,inCell:!0}),t.menuRemoveHyperlink=new Common.UI.MenuItem({caption:t.removeHyperlinkText}),t.menuHyperlink=new Common.UI.MenuItem({caption:t.txtInsHyperlink,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[t.menuEditHyperlink,t.menuRemoveHyperlink]})}),t.pmiRowHeight=new Common.UI.MenuItem({caption:t.txtRowHeight,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{caption:t.txtAutoRowHeight,value:"auto-row-height"},{caption:t.txtCustomRowHeight,value:"row-height"}]})}),t.pmiColumnWidth=new Common.UI.MenuItem({caption:t.txtColumnWidth,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{caption:t.txtAutoColumnWidth,value:"auto-column-width"},{caption:t.txtCustomColumnWidth,value:"column-width"}]})}),t.pmiEntireHide=new Common.UI.MenuItem({caption:t.txtHide}),t.pmiEntireShow=new Common.UI.MenuItem({caption:t.txtShow}),t.pmiAddComment=new Common.UI.MenuItem({id:"id-context-menu-item-add-comment",caption:t.txtAddComment}),t.pmiCellMenuSeparator=new Common.UI.MenuItem({caption:"--"}),t.pmiAddNamedRange=new Common.UI.MenuItem({id:"id-context-menu-item-add-named-range",caption:t.txtAddNamedRange}),t.pmiFreezePanes=new Common.UI.MenuItem({caption:t.textFreezePanes}),t.pmiEntriesList=new Common.UI.MenuItem({caption:t.textEntriesList}),t.pmiSparklines=new Common.UI.MenuItem({caption:t.txtSparklines,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{caption:t.txtClearSparklines,value:Asc.c_oAscCleanOptions.Sparklines},{caption:t.txtClearSparklineGroups,value:Asc.c_oAscCleanOptions.SparklineGroups}]})}),t.ssMenu=new Common.UI.Menu({id:"id-context-menu-cell",items:[t.pmiCut,t.pmiCopy,t.pmiPaste,{caption:"--"},t.pmiSelectTable,t.pmiInsertEntire,t.pmiInsertCells,t.pmiInsertTable,t.pmiDeleteEntire,t.pmiDeleteCells,t.pmiDeleteTable,t.pmiClear,{caption:"--"},t.pmiSparklines,t.pmiSortCells,t.pmiFilterCells,t.pmiReapply,{caption:"--"},t.pmiAddComment,t.pmiCellMenuSeparator,t.pmiEntriesList,t.pmiAddNamedRange,t.pmiInsFunction,t.menuAddHyperlink,t.menuHyperlink,t.pmiRowHeight,t.pmiColumnWidth,t.pmiEntireHide,t.pmiEntireShow,t.pmiFreezePanes]}),t.mnuGroupImg=new Common.UI.MenuItem({caption:this.txtGroup,iconCls:"mnu-group",type:"group",value:"grouping"}),t.mnuUnGroupImg=new Common.UI.MenuItem({caption:this.txtUngroup,iconCls:"mnu-ungroup",type:"group",value:"ungrouping"}),t.mnuShapeSeparator=new Common.UI.MenuItem({caption:"--"}),t.mnuShapeAdvanced=new Common.UI.MenuItem({caption:t.advancedShapeText}),t.mnuImgAdvanced=new Common.UI.MenuItem({caption:t.advancedImgText}),t.mnuChartEdit=new Common.UI.MenuItem({caption:t.chartText}),t.pmiImgCut=new Common.UI.MenuItem({caption:t.txtCut,value:"cut"}),t.pmiImgCopy=new Common.UI.MenuItem({caption:t.txtCopy,value:"copy"}),t.pmiImgPaste=new Common.UI.MenuItem({caption:t.txtPaste,value:"paste"}),this.imgMenu=new Common.UI.Menu({items:[t.pmiImgCut,t.pmiImgCopy,t.pmiImgPaste,{caption:"--"},{caption:this.textArrangeFront,iconCls:"mnu-arrange-front",type:"arrange",value:Asc.c_oAscDrawingLayerType.BringToFront},{caption:this.textArrangeBack,iconCls:"mnu-arrange-back",type:"arrange",value:Asc.c_oAscDrawingLayerType.SendToBack},{caption:this.textArrangeForward,iconCls:"mnu-arrange-forward",type:"arrange",value:Asc.c_oAscDrawingLayerType.BringForward},{caption:this.textArrangeBackward,iconCls:"mnu-arrange-backward",type:"arrange",value:Asc.c_oAscDrawingLayerType.SendBackward},{caption:"--"},t.mnuGroupImg,t.mnuUnGroupImg,t.mnuShapeSeparator,t.mnuChartEdit,t.mnuShapeAdvanced,t.mnuImgAdvanced]}),this.menuParagraphVAlign=new Common.UI.MenuItem({caption:this.vertAlignText,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[t.menuParagraphTop=new Common.UI.MenuItem({caption:t.topCellText,checkable:!0,toggleGroup:"popupparagraphvalign",value:Asc.c_oAscVAlign.Top}),t.menuParagraphCenter=new Common.UI.MenuItem({caption:t.centerCellText,checkable:!0,toggleGroup:"popupparagraphvalign",value:Asc.c_oAscVAlign.Center}),this.menuParagraphBottom=new Common.UI.MenuItem({caption:t.bottomCellText,checkable:!0,toggleGroup:"popupparagraphvalign",value:Asc.c_oAscVAlign.Bottom})]})}),t.menuParagraphDirection=new Common.UI.MenuItem({caption:t.directionText,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[t.menuParagraphDirectH=new Common.UI.MenuItem({caption:t.directHText,iconCls:"mnu-direct-horiz",checkable:!0,checked:!1,toggleGroup:"popupparagraphdirect",direction:Asc.c_oAscVertDrawingText.normal}),t.menuParagraphDirect90=new Common.UI.MenuItem({caption:t.direct90Text,iconCls:"mnu-direct-rdown",checkable:!0,checked:!1,toggleGroup:"popupparagraphdirect",direction:Asc.c_oAscVertDrawingText.vert}),t.menuParagraphDirect270=new Common.UI.MenuItem({caption:t.direct270Text,iconCls:"mnu-direct-rup",checkable:!0,checked:!1,toggleGroup:"popupparagraphdirect",direction:Asc.c_oAscVertDrawingText.vert270})]})}),t.menuAddHyperlinkShape=new Common.UI.MenuItem({caption:t.txtInsHyperlink}),t.menuEditHyperlinkShape=new Common.UI.MenuItem({caption:t.editHyperlinkText}),t.menuRemoveHyperlinkShape=new Common.UI.MenuItem({caption:t.removeHyperlinkText}),t.menuHyperlinkShape=new Common.UI.MenuItem({caption:t.txtInsHyperlink,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[t.menuEditHyperlinkShape,t.menuRemoveHyperlinkShape]})}),this.pmiTextAdvanced=new Common.UI.MenuItem({caption:t.txtTextAdvanced}),t.pmiTextCut=new Common.UI.MenuItem({caption:t.txtCut,value:"cut"}),t.pmiTextCopy=new Common.UI.MenuItem({caption:t.txtCopy,value:"copy"}),t.pmiTextPaste=new Common.UI.MenuItem({caption:t.txtPaste,value:"paste"}),this.textInShapeMenu=new Common.UI.Menu({items:[t.pmiTextCut,t.pmiTextCopy,t.pmiTextPaste,{caption:"--"},t.menuParagraphVAlign,t.menuParagraphDirection,t.menuAddHyperlinkShape,t.menuHyperlinkShape,{caption:"--"},t.pmiTextAdvanced]}),this.entriesMenu=(new Common.UI.Menu({maxHeight:200,cyclic:!1,items:[]})).on("render:after",function(t){this.scroller=new Common.UI.Scroller({el:e(this.el).find(".dropdown-menu "),useKeyboard:this.enableKeyEvents&&!this.handleSelect,minScrollbarLength:40,alwaysVisibleY:!0})}).on("show:after",function(){this.scroller.update({alwaysVisibleY:!0})}),this.funcMenu=(new Common.UI.Menu({maxHeight:200,cyclic:!1,items:[]})).on("render:after",function(t){t.cmpEl.removeAttr("oo_editor_input").attr("oo_editor_keyboard",!0),this.scroller=new Common.UI.Scroller({el:e(this.el).find(".dropdown-menu "),useKeyboard:this.enableKeyEvents&&!this.handleSelect,minScrollbarLength:40,alwaysVisibleY:!0})}),t.fireEvent("createdelayedelements",[t])},setMenuItemCommentCaptionMode:function(e,t){this.pmiAddComment.setCaption(e?this.txtAddComment:t?this.txtEditComment:this.txtShowComment,!0)},txtSort:"Sort",txtAscending:"Ascending",txtDescending:"Descending",txtFormula:"Insert Function",txtInsHyperlink:"Hyperlink",txtCut:"Cut",txtCopy:"Copy",txtPaste:"Paste",txtInsert:"Insert",txtDelete:"Delete",txtClear:"Clear",txtClearAll:"All",txtClearText:"Text",txtClearFormat:"Format",txtClearHyper:"Hyperlink",txtClearComments:"Comments",txtShiftRight:"Shift cells right",txtShiftLeft:"Shift cells left",txtShiftUp:"Shift cells up",txtShiftDown:"Shift cells down",txtRow:"Entire Row",txtColumn:"Entire Column",txtColumnWidth:"Set Column Width",txtRowHeight:"Set Row Height",txtWidth:"Width",txtHide:"Hide",txtShow:"Show",textArrangeFront:"Bring To Front",textArrangeBack:"Send To Back",textArrangeForward:"Bring Forward",textArrangeBackward:"Send Backward",txtArrange:"Arrange",txtAddComment:"Add Comment",txtEditComment:"Edit Comment",txtUngroup:"Ungroup",txtGroup:"Group",topCellText:"Align Top",centerCellText:"Align Center",bottomCellText:"Align Bottom",vertAlignText:"Vertical Alignment",txtTextAdvanced:"Text Advanced Settings",editHyperlinkText:"Edit Hyperlink",removeHyperlinkText:"Remove Hyperlink",editChartText:"Edit Data",advancedShapeText:"Shape Advanced Settings",chartText:"Chart Advanced Settings",directionText:"Text Direction",directHText:"Horizontal",direct90Text:"Rotate at 90°",direct270Text:"Rotate at 270°",txtAddNamedRange:"Define Name",textFreezePanes:"Freeze Panes",textUnFreezePanes:"Unfreeze Panes",txtSelect:"Select",selectRowText:"Row",selectColumnText:"Entire Column",selectDataText:"Column Data",selectTableText:"Table",insertRowAboveText:"Row Above",insertRowBelowText:"Row Below",insertColumnLeftText:"Column Left",insertColumnRightText:"Column Right",deleteRowText:"Row",deleteColumnText:"Column",deleteTableText:"Table",txtFilter:"Filter",txtFilterValue:"Filter by Selected cell's value",txtFilterCellColor:"Filter by cell's color",txtFilterFontColor:"Filter by font color",txtReapply:"Reapply",txtSortCellColor:"Selected Cell Color on top",txtSortFontColor:"Selected Font Color on top",txtAutoColumnWidth:"Auto Fit Column Width",txtAutoRowHeight:"Auto Fit Row Height",txtCustomColumnWidth:"Custom Column Width",txtCustomRowHeight:"Custom Row Height",textEntriesList:"Select from drop-down list",txtSparklines:"Sparklines",txtClearSparklines:"Clear Selected Sparklines",txtClearSparklineGroups:"Clear Selected Sparkline Groups",txtShowComment:"Show Comment",advancedImgText:"Image Advanced Settings"},SSE.Views.DocumentHolder||{}))});if(Common===undefined)var Common={};define("common/main/lib/component/ComboBox",["common/main/lib/component/BaseView","common/main/lib/component/Scroller"],function(){"use strict";Common.UI.ComboBoxModel=Backbone.Model.extend({defaults:function(){return{id:Common.UI.getId(),value:null,displayValue:null}}}),Common.UI.ComboBoxStore=Backbone.Collection.extend({model:Common.UI.ComboBoxModel}),Common.UI.ComboBox=Common.UI.BaseView.extend(function(){return{options:{id:null,cls:"",style:"",hint:!1,editable:!0,disabled:!1,menuCls:"",menuStyle:"",displayField:"displayValue",valueField:"value",scrollAlwaysVisible:!1},template:_.template(['<span class="input-group combobox <%= cls %>" id="<%= id %>" style="<%= style %>">','<input type="text" class="form-control">','<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"><span class="caret img-commonctrl"></span></button>','<ul class="dropdown-menu <%= menuCls %>" style="<%= menuStyle %>" role="menu">',"<% _.each(items, function(item) { %>",'<li id="<%= item.id %>" data-value="<%= item.value %>"><a tabindex="-1" type="menuitem"><%= scope.getDisplayValue(item) %></a></li>',"<% }); %>","</ul>","</span>"].join("")),initialize:function(e){Common.UI.BaseView.prototype.initialize.call(this,e);var t=this,n=$(this.el);this.id=t.options.id||Common.UI.getId(),this.cls=t.options.cls,this.style=t.options.style,this.menuCls=t.options.menuCls,this.menuStyle=t.options.menuStyle,this.template=t.options.template||t.template,this.itemsTemplate=t.options.itemsTemplate,this.hint=t.options.hint,this.editable=t.options.editable,this.disabled=t.options.disabled,this.store=t.options.store||new Common.UI.ComboBoxStore,this.displayField=t.options.displayField,this.valueField=t.options.valueField,this.scrollAlwaysVisible=t.options.scrollAlwaysVisible,t.rendered=t.options.rendered||!1,this.lastValue=null,t.store.add(t.options.data),t.options.el&&t.render()},render:function(e){var t=this;if(!t.rendered){var n=this.store.toJSON();this.cmpEl=$(this.template({id:this.id,cls:this.cls,style:this.style,menuCls:this.menuCls,menuStyle:this.menuStyle,items:n,scope:t})),this.itemsTemplate&&this.cmpEl.find("ul").append($(this.itemsTemplate({items:n,scope:t}))),e?(this.setElement(e,!1),e.html(this.cmpEl)):$(this.el).html(this.cmpEl)}else this.cmpEl=$(this.el);if(!t.rendered){var r=this.cmpEl;this._input=r.find("input"),this._button=r.find(".btn"),r.on("click","a",_.bind(this.itemClicked,this)),r.on("mousedown","a",_.bind(this.itemMouseDown,this)),this.editable?(r.on("change","input",_.bind(this.onInputChanged,this)),r.on("keydown","input",_.bind(this.onInputKeyDown,this)),r.on("focusin","input",_.bind(this.onInputFocusIn,this)),r.on("click",".form-control",_.bind(this.onEditableInputClick,this))):(r.on("click",".form-control",_.bind(this.onInputClick,this)),this._input.attr("readonly","readonly"),this._input.attr("data-can-copy",!1)),t.options.hint&&(r.attr("data-toggle","tooltip"),r.tooltip({title:t.options.hint,placement:t.options.hintAnchor||"cursor"})),r.on("show.bs.dropdown",_.bind(t.onBeforeShowMenu,t)),r.on("shown.bs.dropdown",_.bind(t.onAfterShowMenu,t)),r.on("hide.bs.dropdown",_.bind(t.onBeforeHideMenu,t)),r.on("hidden.bs.dropdown",_.bind(t.onAfterHideMenu,t)),r.on("keydown.after.bs.dropdown",_.bind(t.onAfterKeydownMenu,t)),Common.NotificationCenter.on("menumanager:hideall",_.bind(t.closeMenu,t)),this.setDefaultSelection(),this.listenTo(this.store,"reset",this.onResetItems)}return t.rendered=!0,t.disabled&&t.setDisabled(t.disabled),this},setData:function(e){this.store.reset([]),this.store.add(e),this.setRawValue(""),this.onResetItems()},openMenu:function(e){var t=this;this.scroller||(this.scroller=new Common.UI.Scroller(_.extend({el:$(".dropdown-menu",this.cmpEl),minScrollbarLength:40,scrollYMarginOffset:30,includePadding:!0,alwaysVisibleY:this.scrollAlwaysVisible},this.options.scroller))),_.delay(function(){t.cmpEl.addClass("open")},e||0)},closeMenu:function(){this.cmpEl.removeClass("open")},isMenuOpen:function(){return this.cmpEl.hasClass("open")},onBeforeShowMenu:function(e){this.scroller||(this.scroller=new Common.UI.Scroller(_.extend({el:$(".dropdown-menu",this.cmpEl),minScrollbarLength:40,scrollYMarginOffset:30,includePadding:!0,alwaysVisibleY:this.scrollAlwaysVisible},this.options.scroller))),Common.NotificationCenter.trigger("menu:show"),this.trigger("show:before",this,e);if(this.options.hint){var t=this.cmpEl.data("bs.tooltip");t&&(t.dontShow===undefined&&(t.dontShow=!0),t.hide())}},onAfterShowMenu:function(e){var t=$(this.el).find("ul"),n=t.find("> li.selected");if(n.length){var r=n.position().top,i=n.height(),s=t.height();(r<0||r+i>s)&&t.scrollTop(t.scrollTop()+r+i-s/2)}this.scroller&&this.scroller.update({alwaysVisibleY:this.scrollAlwaysVisible}),this.trigger("show:after",this,e)},onBeforeHideMenu:function(e){this.trigger("hide:before",this,e),Common.UI.Scroller.isMouseCapture()&&e.preventDefault()},onAfterHideMenu:function(e,t){this.cmpEl.find(".dropdown-toggle").blur(),this.trigger("hide:after",this,e,t),Common.NotificationCenter.trigger("menu:hide",this,t)},onAfterKeydownMenu:function(e){if(e.keyCode==Common.UI.Keys.RETURN){$(e.target).click();var t=this;return this.rendered&&(Common.Utils.isIE?this._input.trigger("change",{onkeydown:!0}):this._input.blur()),!1}if(e.keyCode==Common.UI.Keys.ESC&&this.isMenuOpen())return this.closeMenu(),this.onAfterHideMenu(e),!1},onInputKeyDown:function(e){var t=this;e.keyCode==Common.UI.Keys.ESC?(this.closeMenu(),this.onAfterHideMenu(e)):e.keyCode==Common.UI.Keys.UP||e.keyCode==Common.UI.Keys.DOWN?(this.isMenuOpen()||this.openMenu(),_.delay(function(){t._skipInputChange=!0,t.cmpEl.find("ul li:first a").focus()},10)):e.keyCode==Common.UI.Keys.RETURN&&$(e.target).val()===t.lastValue?this._input.trigger("change",{reapply:!0}):t._skipInputChange=!1},onInputFocusIn:function(e){this.trigger("combo:focusin",this,e)},onInputChanged:function(e,t){if(t&&t.synthetic)return;if(this._skipInputChange){this._skipInputChange=!1;return}var n=$(e.target).val(),r={};if(this.lastValue===n&&(!t||!t.reapply)){t&&t.onkeydown&&this.trigger("combo:blur",this,e);return}r[this.valueField]=n,this.trigger("changed:before",this,r,e);if(e.isDefaultPrevented())return;var i;this._selectedItem=this.store.findWhere((i={},i[this.displayField]=n,i)),this._selectedItem&&(r=this._selectedItem.toJSON(),$(".selected",$(this.el)).removeClass("selected"),$("#"+this._selectedItem.get("id"),$(this.el)).addClass("selected")),this.trigger("changed:after",this,r,e)},onInputClick:function(e){this._button&&this._button.dropdown("toggle"),e.preventDefault(),e.stopPropagation()},onEditableInputClick:function(e){if(this.options.hint){var t=this.cmpEl.data("bs.tooltip");t&&(t.dontShow===undefined&&(t.dontShow=!0),t.hide())}this.isMenuOpen()&&e.which==1&&e.stopPropagation()},setDefaultSelection:function(){if(!this.rendered)return;var e=this._input.val(),t;e&&(this._selectedItem=this.store.findWhere((t={},t[this.displayField]=e,t)),this._selectedItem&&($(".selected",$(this.el)).removeClass("selected"),$("#"+this._selectedItem.get("id"),$(this.el)).addClass("selected")))},setDisabled:function(e){this.disabled=e;if(!this.rendered)return;e?this._input.attr("disabled",!0):this._input.removeAttr("disabled"),this.cmpEl.toggleClass("disabled",e),this._button.toggleClass("disabled",e)},isDisabled:function(){return this.disabled},setRawValue:function(e){this.rendered&&(this._input.val(e).trigger("change",{synthetic:!0}),this.lastValue=e!==null&&e!==undefined?e.toString():e)},getRawValue:function(){return this.rendered?this._input.val():null},setValue:function(e,t){if(!this.rendered)return;var n;this._selectedItem=this.store.findWhere((n={},n[this.valueField]=e,n)),$(".selected",$(this.el)).removeClass("selected"),this._selectedItem?(this.setRawValue(this._selectedItem.get(this.displayField)),$("#"+this._selectedItem.get("id"),$(this.el)).addClass("selected")):this.setRawValue(t!==undefined?t:e)},getValue:function(){return this.rendered?this._selectedItem&&!_.isUndefined(this._selectedItem.get(this.valueField))?this._selectedItem.get(this.valueField):this._input.val():null},getDisplayValue:function(e){return Common.Utils.String.htmlEncode(e[this.displayField])},getSelectedRecord:function(){return this.rendered?this._selectedItem&&!_.isUndefined(this._selectedItem.get(this.valueField))?_.extend({},this._selectedItem.toJSON()):null:null},selectRecord:function(e){if(!this.rendered||!e)return;this._selectedItem=e,$(".selected",$(this.el)).removeClass("selected"),this.setRawValue(this._selectedItem.get(this.displayField)),$("#"+this._selectedItem.get("id"),$(this.el)).addClass("selected")},itemClicked:function(e){var t=$(e.target).closest("li");this._selectedItem=this.store.findWhere({id:t.attr("id")}),this._selectedItem&&(this.lastValue=this._selectedItem.get(this.displayField),this._input.val(this.lastValue).trigger("change",{synthetic:!0}),$(".selected",$(this.el)).removeClass("selected"),t.addClass("selected"),this.trigger("selected",this,_.extend({},this._selectedItem.toJSON()),e),e.preventDefault()),this._isMouseDownMenu=!1},itemMouseDown:function(e){if(e.which!=1)return e.preventDefault(),e.stopPropagation(),!1;this._isMouseDownMenu=!0},onResetItems:function(){this.itemsTemplate?$(this.el).find("ul").html($(this.itemsTemplate({items:this.store.toJSON(),scope:this}))):$(this.el).find("ul").html(_.template(["<% _.each(items, function(item) { %>",'<li id="<%= item.id %>" data-value="<%= item.value %>"><a tabindex="-1" type="menuitem"><%= scope.getDisplayValue(item) %></a></li>',"<% }); %>"].join(""),{items:this.store.toJSON(),scope:this})),_.isUndefined(this.scroller)||(this.scroller.destroy(),delete this.scroller),this.scroller=new Common.UI.Scroller(_.extend({el:$(".dropdown-menu",this.cmpEl),minScrollbarLength:40,scrollYMarginOffset:30,includePadding:!0,alwaysVisibleY:this.scrollAlwaysVisible},this.options.scroller))}}}())}),function(e){var t=e.fn.tooltip;t.prototype=e.fn.tooltip.Constructor.prototype,e.extend(e.fn.tooltip.Constructor.DEFAULTS,{container:"body",delay:{show:500},arrow:!1});var n=function(e,t){this.init("tooltip",e,t)};n.prototype=e.extend({},e.fn.tooltip.Constructor.prototype,{constructor:n,init:function(){t.prototype.init.apply(this,arguments),this.options.placement=="cursor"&&/hover/.exec(this.options.trigger)&&this.$element.on("mousemove.tooltip",this.options.selector,e.proxy(this.mousemove,this)),this.options.zIndex&&this.tip().css("z-index",this.options.zIndex);var n=this;Common.NotificationCenter.on({"layout:changed":function(e){!n.options.hideonclick&&n.tip().is(":visible")&&n.hide()}})},mousemove:function(e){this.targetXY=[e.clientX*Common.Utils.zoom(),e.clientY*Common.Utils.zoom()]},leave:function(e){t.prototype.leave.apply(this,arguments),this.dontShow=undefined},show:function(n){if(this.hasContent()&&this.enabled&&!this.dontShow){if(!this.$element.is(":visible")&&this.$element.closest("[role=menu]").length>0)return;var r=this.tip(),i=typeof this.options.placement=="function"?this.options.placement.call(this,r[0],this.$element[0]):this.options.placement;this.options.arrow===!1&&r.addClass("arrow-free"),this.options.cls&&r.addClass(this.options.cls);var s=/^([a-zA-Z]+)-?([a-zA-Z]*)$/.exec(i);if(!n&&!s[2].length)t.prototype.show.apply(this,arguments);else{var o=e.Event("show.bs.tooltip");this.$element.trigger(o);if(o.isDefaultPrevented())return;this.setContent(),this.options.animation&&r.addClass("fade"),r.detach().css({top:0,left:0,display:"block"}),this.options.container?r.appendTo(this.options.container):r.insertAfter(this.$element);if(typeof n=="object"){var u={top:n[1]+15,left:n[0]+18},a=Common.Utils.innerWidth();u.left+r.width()>a&&(u.left=a-r.width()-30),r.offset(u).addClass("in")}else{var f=this.getPosition(),l=r[0].offsetWidth,c=r[0].offsetHeight;switch(s[1]){case"bottom":u={top:f.top+f.height+10};break;case"top":u={top:f.top-c-10}}switch(s[2]){case"left":u.left=f.left,this.$element.outerWidth()<=18&&(u.left-=4);break;case"right":u.left=f.left+f.width-l,this.$element.outerWidth()<=18&&(u.left+=4)}this.applyPlacement(u,s[1]),this.moveArrow(),r.addClass(s[1]).addClass(s[0])}this.$element.trigger("shown.bs.tooltip")}var h=this;clearTimeout(h.timeout),h.timeout=setTimeout(function(){h.hoverState=="in"&&h.hide(),h.dontShow=!1},5e3)}},moveArrow:function(){var e=this.tip().find(".tooltip-arrow, .arrow"),t=10;switch(this.options.placement){case"top-left":case"bottom-left":e.css("left",t);break;case"top-right":case"bottom-right":e.css("right",t)}},enter:function(t){if(t.type!=="mouseenter")return;var n=e(t.target);if(n.is("[role=menu]")||n.parentsUntil(t.currentTarget,"[role=menu]").length&&t.target!==t.currentTarget||this.tip().is(":visible"))return;var r=t instanceof this.constructor?t:e(t.currentTarget)[this.type](this.getDelegateOptions()).data("bs.tooltip");clearTimeout(r.timeout),r.hoverState="in",!r.options.delay||!r.options.delay.show?r.show():r.timeout=setTimeout(function(){r.hoverState=="in"&&r.show(r.options.placement=="cursor"?r.targetXY:undefined)},r.options.delay.show)},replaceArrow:function(e,n,r){this.options.arrow===!1?this.arrow().hide():t.prototype.replaceArrow.apply(this,arguments)},getCalculatedOffset:function(e,n,r,i){var s=t.prototype.getCalculatedOffset.apply(this,arguments);if(this.options.offset>0||this.options.offset<0)switch(/(bottom|top)/.exec(e)[1]){case"bottom":s.top+=this.options.offset;break;case"top":s.top-=this.options.offset}return s}});var r=e.fn.tooltip;e.fn.tooltip=function(t){return this.each(function(){var r=e(this),i=r.data("bs.tooltip"),s=typeof t=="object"&&t;i||r.data("bs.tooltip",i=new n(this,s)),typeof t=="string"&&i[t]()})},e.fn.tooltip.Constructor=n,e.fn.tooltip.noConflict=function(){return e.fn.tooltip=r,this}}(window.jQuery),define("tip",function(){}),define("common/main/lib/component/Tooltip",["tip","backbone"],function(){"use strict";var e=function(e){this.$element=this.placement=undefined,this.init.call(this,e)};_.extend(e.prototype,Backbone.Events,{init:function(e){this.$element=e.owner instanceof Backbone.View?e.owner.$el:$(e.owner),this.placement=e.placement,this.$element.data("bs.tooltip")&&this.$element.removeData("bs.tooltip"),this.$element.tooltip({title:e.title,trigger:"manual",placement:e.placement,offset:e.offset,cls:e.cls,html:e.html,hideonclick:e.hideonclick});if(e.hideonclick){var t=this.$element.data("bs.tooltip");t&&t.tip().on("click",function(){t.hide()})}this.$element.on("shown.bs.tooltip",_.bind(this.onTipShown,this)),this.$element.on("hidden.bs.tooltip",_.bind(this.onTipHidden,this))},show:function(e){this.getBSTip().show(e)},hide:function(e){this.getBSTip().hide(e)},setTitle:function(e){var t=this.getBSTip();t&&(t.options.title=e)},updateTitle:function(){var e=this.getBSTip();e.$tip.find(".tooltip-inner")[e.options.html?"html":"text"](e.options.title)},getBSTip:function(){return this.$element.data("bs.tooltip")},onTipShown:function(){this.trigger("tooltip:show",this)},onTipHidden:function(){this.trigger("tooltip:hide",this)},isVisible:function(){return this.getBSTip().tip().is(":visible")}}),Common.UI=Common.UI||{},Common.UI.Tooltip=e});if(Common===undefined)var Common={};define("common/main/lib/component/InputField",["common/main/lib/component/BaseView","common/main/lib/component/Tooltip"],function(){"use strict";Common.UI.InputField=Common.UI.BaseView.extend(function(){return{options:{id:null,cls:"",style:"",value:"",type:"text",name:"",validation:null,allowBlank:!0,placeHolder:"",blankError:null,spellcheck:!1,maskExp:"",validateOnChange:!1,validateOnBlur:!0,disabled:!1},template:_.template(['<div class="input-field" style="<%= style %>">',"<input ",'type="<%= type %>" ','name="<%= name %>" ','spellcheck="<%= spellcheck %>" ','class="form-control <%= cls %>" ','placeholder="<%= placeHolder %>" ','value="<%= value %>"',">",'<span class="input-error"/>',"</div>"].join("")),initialize:function(e){Common.UI.BaseView.prototype.initialize.call(this,e);var t=this,n=$(this.el);this.id=t.options.id||Common.UI.getId(),this.cls=t.options.cls,this.style=t.options.style,this.value=t.options.value,this.type=t.options.type,this.name=t.options.name,this.validation=t.options.validation,this.allowBlank=t.options.allowBlank,this.placeHolder=t.options.placeHolder,this.template=t.options.template||t.template,this.editable=t.options.editable||!0,this.disabled=t.options.disabled,this.spellcheck=t.options.spellcheck,this.blankError=t.options.blankError||"This field is required",this.validateOnChange=t.options.validateOnChange,this.validateOnBlur=t.options.validateOnBlur,this.maxLength=t.options.maxLength,t.rendered=t.options.rendered||!1,t.options.el&&t.render()},render:function(e){var t=this;t.rendered?this.cmpEl=$(this.el):(this.cmpEl=$(this.template({id:this.id,cls:this.cls,style:this.style,value:this.value,type:this.type,name:this.name,placeHolder:this.placeHolder,spellcheck:this.spellcheck,scope:t})),e?(this.setElement(e,!1),e.html(this.cmpEl)):$(this.el).html(this.cmpEl));if(!t.rendered){var n=this.cmpEl;this._input=this.cmpEl.find("input").andSelf().filter("input"),this.editable&&(this._input.on("blur",_.bind(this.onInputChanged,this)),this._input.on("keypress",_.bind(this.onKeyPress,this)),this._input.on("keyup",_.bind(this.onKeyUp,this)),this.validateOnChange&&this._input.on("input",_.bind(this.onInputChanging,this)),this.maxLength&&this._input.attr("maxlength",this.maxLength)),this.setEditable(this.editable),this.disabled&&this.setDisabled(this.disabled);if(this._input.closest(".asc-window").length>0)var r=function(){var e=n.find(".input-error").data("bs.tooltip");e&&e.tip().remove(),Common.NotificationCenter.off({"modal:close":r})};Common.NotificationCenter.on({"modal:close":r})}return t.rendered=!0,this},_doChange:function(e,t){if(t&&t.synthetic)return;var n=$(e.target).val(),r=this.value;this.trigger("changed:before",this,n,r,e);if(e.isDefaultPrevented())return;this.value=n,this.validateOnBlur&&this.checkValidate(),this.trigger("changed:after",this,n,r,e)},onInputChanged:function(e,t){this._doChange(e,t)},onInputChanging:function(e,t){var n=$(e.target).val(),r=this.value;if(e.isDefaultPrevented())return;this.value=n,this.validateOnBlur&&this.checkValidate(),this.trigger("changing",this,n,r,e)},onKeyPress:function(e){this.trigger("keypress:before",this,e);if(e.isDefaultPrevented())return;if(e.keyCode===Common.UI.Keys.RETURN)this._doChange(e);else if(this.options.maskExp&&!_.isEmpty(this.options.maskExp.source)){var t=String.fromCharCode(e.which);!this.options.maskExp.test(t)&&!e.ctrlKey&&e.keyCode!==Common.UI.Keys.DELETE&&e.keyCode!==Common.UI.Keys.BACKSPACE&&e.keyCode!==Common.UI.Keys.LEFT&&e.keyCode!==Common.UI.Keys.RIGHT&&e.keyCode!==Common.UI.Keys.HOME&&e.keyCode!==Common.UI.Keys.END&&e.keyCode!==Common.UI.Keys.ESC&&e.keyCode!==Common.UI.Keys.INSERT&&(e.preventDefault(),e.stopPropagation())}this.trigger("keypress:after",this,e)},onKeyUp:function(e){this.trigger("keyup:before",this,e);if(e.isDefaultPrevented())return;this.trigger("keyup:after",this,e)},setEditable:function(e){var t=this._input;this.editable=e,e&&t?(t.removeAttr("readonly"),t.removeAttr("data-can-copy")):(t.attr("readonly","readonly"),t.attr("data-can-copy",!1))},isEditable:function(){return this.editable},setDisabled:function(e){this.disabled=e,$(this.el).toggleClass("disabled",e),e?this._input.attr("disabled",!0):this._input.removeAttr("disabled")},isDisabled:function(){return this.disabled},setValue:function(e){this.value=e,this.rendered&&this._input.val(e)},getValue:function(){return this.value},focus:function(){this._input.focus()},checkValidate:function(){var e=this,t=[];!e.allowBlank&&_.isEmpty(e.value)&&t.push(e.blankError);if(_.isFunction(e.validation)){var n=e.validation.call(e,e.value);n!==!0&&(t=_.flatten(t.concat(n)))}if(!_.isEmpty(t)){if(e.cmpEl.hasClass("error")){var r=e.cmpEl.find(".input-error").data("bs.tooltip");return r&&(r.options.title=t.join("\n"),r.setContent()),t}e.cmpEl.addClass("error");var i=e.cmpEl.find(".input-error"),s=i.closest(".asc-window"),r=i.data("bs.tooltip");return r&&r.tip().remove(),i.attr("data-toggle","tooltip"),i.removeData("bs.tooltip"),i.tooltip({title:t.join("\n"),placement:"cursor"}),s.length>0&&i.data("bs.tooltip").tip().css("z-index",parseInt(s.css("z-index"))+10),t}return e.cmpEl.removeClass("error"),!0},showError:function(e){var t=this;if(!_.isEmpty(e)){t.cmpEl.addClass("error");var n=t.cmpEl.find(".input-error"),r=n.closest(".asc-window"),i=n.data("bs.tooltip");i&&i.tip().remove(),n.attr("data-toggle","tooltip"),n.removeData("bs.tooltip"),n.tooltip({title:e.join("\n"),placement:"cursor"}),r.length>0&&n.data("bs.tooltip").tip().css("z-index",parseInt(r.css("z-index"))+10)}else t.cmpEl.removeClass("error")}}}())});if(Common===undefined)var Common={};define("spreadsheeteditor/main/app/view/HyperlinkSettingsDialog",["common/main/lib/util/utils","common/main/lib/component/ComboBox","common/main/lib/component/InputField","common/main/lib/component/Window"],function(){"use strict";SSE.Views.HyperlinkSettingsDialog=Common.UI.Window.extend(_.extend({options:{width:350,style:"min-width: 230px;",cls:"modal-dlg"},initialize:function(e){_.extend(this.options,{title:this.textTitle},e||{}),this.template=['<div class="box">','<div class="input-row">',"<label>"+this.textLinkType+"</label>","</div>",'<div class="input-row" id="id-dlg-hyperlink-type" style="margin-bottom: 5px;">',"</div>",'<div id="id-dlg-hyperlink-external">','<div class="input-row">',"<label>"+this.strLinkTo+" *</label>","</div>",'<div id="id-dlg-hyperlink-url" class="input-row" style="margin-bottom: 5px;"></div>',"</div>",'<div id="id-dlg-hyperlink-internal" style="display: none;">','<div class="input-row">','<label style="width: 50%;">'+this.strSheet+"</label>",'<label style="width: 50%;">'+this.strRange+" *</label>","</div>",'<div class="input-row" style="margin-bottom: 5px;">','<div id="id-dlg-hyperlink-sheet" style="display: inline-block; width: 50%; padding-right: 10px; float: left;"></div>','<div id="id-dlg-hyperlink-range" style="display: inline-block; width: 50%;"></div>',"</div>","</div>",'<div class="input-row">',"<label>"+this.strDisplay+"</label>","</div>",'<div id="id-dlg-hyperlink-display" class="input-row" style="margin-bottom: 5px;"></div>','<div class="input-row">',"<label>"+this.textTipText+"</label>","</div>",'<div id="id-dlg-hyperlink-tip" class="input-row" style="margin-bottom: 5px;"></div>',"</div>",'<div class="footer right">','<button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px;">'+this.okButtonText+"</button>",'<button class="btn normal dlg-btn" result="cancel">'+this.cancelButtonText+"</button>","</div>"].join(""),this.options.tpl=_.template(this.template,this.options),this.api=this.options.api,Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this);var e=this.getChild(),t=this;t.cmbLinkType=(new Common.UI.ComboBox({el:$("#id-dlg-hyperlink-type"),cls:"input-group-nr",editable:!1,menuStyle:"min-width: 100%;",data:[{displayValue:this.textInternalLink,value:Asc.c_oAscHyperlinkType.RangeLink},{displayValue:this.textExternalLink,value:Asc.c_oAscHyperlinkType.WebLink}]})).on("selected",function(e,t){$("#id-dlg-hyperlink-external")[t.value==Asc.c_oAscHyperlinkType.WebLink?"show":"hide"](),$("#id-dlg-hyperlink-internal")[t.value!=Asc.c_oAscHyperlinkType.WebLink?"show":"hide"]()}),t.cmbLinkType.setValue(Asc.c_oAscHyperlinkType.WebLink),t.cmbSheets=new Common.UI.ComboBox({el:$("#id-dlg-hyperlink-sheet"),cls:"input-group-nr",editable:!1,menuStyle:"min-width: 100%;max-height: 150px;"}),t.inputUrl=new Common.UI.InputField({el:$("#id-dlg-hyperlink-url"),allowBlank:!1,blankError:t.txtEmpty,validateOnBlur:!1,style:"width: 100%;",validation:function(e){var n=t.api.asc_getUrlType($.trim(e));return t.isEmail=n==2,n>0?!0:t.txtNotUrl}}),t.inputRange=new Common.UI.InputField({el:$("#id-dlg-hyperlink-range"),allowBlank:!1,blankError:t.txtEmpty,style:"width: 100%;",validateOnChange:!0,validateOnBlur:!1,validation:function(e){var n=/^[A-Z]+[1-9]\d*:[A-Z]+[1-9]\d*$/.test(e);return n||(n=/^[A-Z]+[1-9]\d*$/.test(e)),n?!0:t.textInvalidRange}}),t.inputDisplay=new Common.UI.InputField({el:$("#id-dlg-hyperlink-display"),allowBlank:!0,validateOnBlur:!1,style:"width: 100%;"}),t.inputTip=new Common.UI.InputField({el:$("#id-dlg-hyperlink-tip"),style:"width: 100%;",maxLength:Asc.c_oAscMaxTooltipLength}),e.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this)),e.find("input").on("keypress",_.bind(this.onKeyPress,this))},show:function(){Common.UI.Window.prototype.show.apply(this,arguments);var e=this;_.delay(function(){e.focusedInput&&e.focusedInput.focus()},500)},setSettings:function(e){if(e){var t=this;this.cmbSheets.setData(e.sheets),e.props?(this.cmbLinkType.setValue(e.props.asc_getType()),this.cmbLinkType.setDisabled(!e.allowInternal),e.props.asc_getType()==Asc.c_oAscHyperlinkType.RangeLink?($("#id-dlg-hyperlink-external").hide(),$("#id-dlg-hyperlink-internal").show(),this.cmbSheets.setValue(e.props.asc_getSheet()),this.inputRange.setValue(e.props.asc_getRange()),this.focusedInput=this.inputRange.cmpEl.find("input")):(this.inputUrl.setValue(e.props.asc_getHyperlinkUrl().replace(new RegExp(" ","g"),"%20")),this.focusedInput=this.inputUrl.cmpEl.find("input"),this.cmbSheets.setValue(e.currentSheet)),this.inputDisplay.setValue(e.isLock?this.textDefault:e.props.asc_getText()),this.inputTip.setValue(e.props.asc_getTooltip())):(this.cmbLinkType.setValue(Asc.c_oAscHyperlinkType.WebLink),this.cmbLinkType.setDisabled(!e.allowInternal),this.inputDisplay.setValue(e.isLock?this.textDefault:e.text),this.focusedInput=this.inputUrl.cmpEl.find("input"),this.cmbSheets.setValue(e.currentSheet)),this.inputDisplay.setDisabled(e.isLock)}},getSettings:function(){var e=new Asc.asc_CHyperlink,t="";e.asc_setType(this.cmbLinkType.getValue());if(this.cmbLinkType.getValue()==Asc.c_oAscHyperlinkType.RangeLink)e.asc_setSheet(this.cmbSheets.getValue()),e.asc_setRange(this.inputRange.getValue()),t=this.cmbSheets.getValue()+"!"+this.inputRange.getValue();else{var n=this.inputUrl.getValue().replace(/^\s+|\s+$/g,"");/(((^https?)|(^ftp)):\/\/)|(^mailto:)/i.test(n)||(n=(this.isEmail?"mailto:":"http://")+n),n=n.replace(new RegExp("%20","g")," "),e.asc_setHyperlinkUrl(n),t=n}return this.inputDisplay.isDisabled()?e.asc_setText(null):(_.isEmpty(this.inputDisplay.getValue())&&this.inputDisplay.setValue(t),e.asc_setText(this.inputDisplay.getValue())),e.asc_setTooltip(this.inputTip.getValue()),e},onBtnClick:function(e){this._handleInput(e.currentTarget.attributes.result.value)},onKeyPress:function(e){if(e.keyCode==Common.UI.Keys.RETURN)return this._handleInput("ok"),!1},_handleInput:function(e){if(this.options.handler){if(e=="ok"){var t=this.cmbLinkType.getValue()===Asc.c_oAscHyperlinkType.WebLink?this.inputUrl.checkValidate():!0,n=this.cmbLinkType.getValue()===Asc.c_oAscHyperlinkType.RangeLink?this.inputRange.checkValidate():!0,r=this.inputDisplay.checkValidate();if(t!==!0){this.inputUrl.cmpEl.find("input").focus();return}if(n!==!0){this.inputRange.cmpEl.find("input").focus();return}if(r!==!0){this.inputDisplay.cmpEl.find("input").focus();return}}this.options.handler.call(this,this,e)}this.close()},textTitle:"Hyperlink Settings",textInternalLink:"Internal Data Range",textExternalLink:"Web Link",textEmptyLink:"Enter link here",textEmptyDesc:"Enter caption here",textEmptyTooltip:"Enter tooltip here",strSheet:"Sheet",strRange:"Range",textLinkType:"Link Type",strDisplay:"Display",textTipText:"Screen Tip Text",strLinkTo:"Link To",txtEmpty:"This field is required",textInvalidRange:"ERROR! Invalid cells range",txtNotUrl:'This field should be a URL in the format "http://www.example.com"',cancelButtonText:"Cancel",textDefault:"Selected range"},SSE.Views.HyperlinkSettingsDialog||{}))}),define("text!spreadsheeteditor/main/app/template/ParagraphSettingsAdvanced.template",[],function(){return'<div id="id-adv-paragraph-indents" class="settings-panel active">\r\n <div class="inner-content">\r\n <table cols="3" style="width: 100%;">\r\n <tr>\r\n <td class="padding-large">\r\n <label class="input-label"><%= scope.strIndentsFirstLine %></label>\r\n <div id="paragraphadv-spin-first-line" style="width: 85px;"></div>\r\n </td>\r\n <td class="padding-large">\r\n <label class="input-label"><%= scope.strIndentsLeftText %></label>\r\n <div id="paragraphadv-spin-indent-left"></div>\r\n </td>\r\n <td class="padding-large">\r\n <label class="input-label"><%= scope.strIndentsRightText %></label>\r\n <div id="paragraphadv-spin-indent-right"></div>\r\n </td>\r\n </tr>\r\n </table>\r\n </div>\r\n</div>\r\n<div id="id-adv-paragraph-font" class="settings-panel">\r\n <div class="inner-content">\r\n <table cols="2" style="width: 100%;">\r\n <tr>\r\n <td colspan=2 class="padding-small">\r\n <label class="header"><%= scope.textEffects %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <div id="paragraphadv-checkbox-strike"></div>\r\n </td>\r\n <td class="padding-small">\r\n <div id="paragraphadv-checkbox-subscript"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <div id="paragraphadv-checkbox-double-strike"></div>\r\n </td>\r\n <td class="padding-small">\r\n <div id="paragraphadv-checkbox-small-caps"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-large">\r\n <div id="paragraphadv-checkbox-superscript"></div>\r\n </td>\r\n <td class="padding-large">\r\n <div id="paragraphadv-checkbox-all-caps"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td colspan=2 class="padding-small">\r\n <label class="header"><%= scope.textCharacterSpacing %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td colspan=2 class="padding-large" width="50%">\r\n <div id="paragraphadv-spin-spacing"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td colspan=2>\r\n <div style="border: 1px solid #cbcbcb;">\r\n <div id="paragraphadv-font-img" style="width: 300px; height: 80px; position: relative;"></div>\r\n </div>\r\n </td>\r\n </tr>\r\n </table>\r\n </div>\r\n</div>\r\n<div id="id-adv-paragraph-tabs" class="settings-panel">\r\n <div class="inner-content">\r\n <div class="padding-small" style="display: inline-block;">\r\n <label class="input-label"><%= scope.textTabPosition %></label>\r\n <div id="paraadv-spin-tab"></div>\r\n </div>\r\n <div class="padding-small" style="display: inline-block; float: right;">\r\n <label class="input-label"><%= scope.textDefault %></label>\r\n <div id="paraadv-spin-default-tab"></div>\r\n </div>\r\n <div class="padding-large">\r\n <div id="paraadv-list-tabs" style="width:180px; height: 94px;"></div>\r\n </div>\r\n <div class="padding-large" >\r\n <label class="input-label padding-small" style="display: block;"><%= scope.textAlign %></label>\r\n <div id="paragraphadv-radio-left" class="padding-small" style="display: block;"></div>\r\n <div id="paragraphadv-radio-center" class="padding-small" style="display: block;"></div>\r\n <div id="paragraphadv-radio-right" style="display: block;"></div>\r\n </div>\r\n <div>\r\n <button type="button" class="btn btn-text-default" id="paraadv-button-add-tab" style="width:90px;margin-right: 4px;"><%= scope.textSet %></button>\r\n <button type="button" class="btn btn-text-default" id="paraadv-button-remove-tab" style="width:90px;margin-right: 4px;"><%= scope.textRemove %></button>\r\n <button type="button" class="btn btn-text-default" id="paraadv-button-remove-all" style="width:90px;margin-right: 4px;"><%= scope.textRemoveAll %></button>\r\n </div>\r\n </div>\r\n</div>'}),define("common/main/lib/view/AdvancedSettingsWindow",["common/main/lib/component/Window"],function(){"use strict";Common.Views.AdvancedSettingsWindow=Common.UI.Window.extend(_.extend({initialize:function(e){var t={};_.extend(t,{height:200,header:!0,cls:"advanced-settings-dlg",toggleGroup:"advanced-settings-group",contentTemplate:"",items:[]},e),this.template=e.template||['<div class="box" style="height:'+(t.height-85)+'px;">','<div class="menu-panel">',"<% _.each(items, function(item) { %>",'<button class="btn btn-category" style="margin-bottom: 2px;" content-target="<%= item.panelId %>"><span class=""><%= item.panelCaption %></span></button>',"<% }); %>","</div>",'<div class="separator"/>','<div class="content-panel" >'+t.contentTemplate+"</div>","</div>",'<div class="separator horizontal"/>','<div class="footer center">','<button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px;">'+this.okButtonText+"</button>",'<button class="btn normal dlg-btn" result="cancel">'+this.cancelButtonText+"</button>","</div>"].join(""),t.tpl=_.template(this.template,t),this.handler=t.handler,this.toggleGroup=t.toggleGroup,this.contentWidth=t.contentWidth,this.storageName=t.storageName,Common.UI.Window.prototype.initialize.call(this,t)},render:function(){Common.UI.Window.prototype.render.call(this);var e=this,t=this.getChild();t.find(".dlg-btn").on("click",_.bind(this.onDlgBtnClick,this)),this.btnsCategory=[],_.each(t.find(".btn-category"),function(t,n){var r=$(t),i=new Common.UI.Button({el:r,enableToggle:!0,toggleGroup:e.toggleGroup,allowDepress:!1,contentTarget:r.attr("content-target")});i.on("click",_.bind(e.onCategoryClick,e)),e.btnsCategory.push(i)});var n=t.find(".content-panel");n.width(this.contentWidth),t.width(t.find(".menu-panel").width()+n.outerWidth()+2),this.content_panels=t.find(".settings-panel"),this.btnsCategory.length>0&&this.btnsCategory[0].toggle(!0,!0)},setHeight:function(e){Common.UI.Window.prototype.setHeight.call(this,e);var t=this.getChild(),n=t.find(".body > .box");n.css("height",e-85)},onDlgBtnClick:function(e){var t=e.currentTarget.attributes.result.value;if(this.handler&&this.handler.call(this,t,t=="ok"?this.getSettings():undefined))return;this.close()},onCategoryClick:function(e,t){this.content_panels.filter(".active").removeClass("active"),$("#"+e.options.contentTarget).addClass("active")},getSettings:function(){return},onPrimary:function(){if(this.handler&&this.handler.call(this,"ok",this.getSettings()))return;return this.close(),!1},setActiveCategory:function(e){if(this.btnsCategory.length<1)return;var t=this.btnsCategory[e>=0&&e<this.btnsCategory.length?e:0];if(!t.isVisible()||t.isDisabled())for(var n=0;n<this.btnsCategory.length;n++){var r=this.btnsCategory[n];if(r.isVisible()&&!r.isDisabled()){t=r;break}}t.toggle(!0),this.onCategoryClick(t)},getActiveCategory:function(){var e=-1;return this.btnsCategory.forEach(function(t,n){t.pressed&&(e=n)}),e},close:function(e){this.storageName&&Common.localStorage.setItem(this.storageName,this.getActiveCategory()),Common.UI.Window.prototype.close.call(this,e)},cancelButtonText:"Cancel",okButtonText:"Ok"},Common.Views.AdvancedSettingsWindow||{}))});if(Common===undefined)var Common={};define("common/main/lib/component/MetricSpinner",["common/main/lib/component/BaseView"],function(){"use strict";Common.UI.MetricSpinner=Common.UI.BaseView.extend({options:{minValue:0,maxValue:100,step:1,defaultUnit:"px",allowAuto:!1,autoText:"Auto",hold:!0,speed:"medium",width:90,allowDecimal:!0},disabled:!1,value:"0 px",rendered:!1,template:'<input type="text" class="form-control"><div class="spinner-buttons"><button type="button" class="spinner-up"><i class="img-commonctrl"></i></button><button type="button" class="spinner-down"><i class="img-commonctrl"></i></button></div>',initialize:function(e){Common.UI.BaseView.prototype.initialize.call(this,e);var t=this,n=$(this.el);n.addClass("spinner"),n.on("mousedown",".spinner-up",_.bind(this.onMouseDown,this,!0)),n.on("mousedown",".spinner-down",_.bind(this.onMouseDown,this,!1)),n.on("mouseup",".spinner-up",_.bind(this.onMouseUp,this,!0)),n.on("mouseup",".spinner-down",_.bind(this.onMouseUp,this,!1)),n.on("mouseover",".spinner-up, .spinner-down",_.bind(this.onMouseOver,this)),n.on("mouseout",".spinner-up, .spinner-down",_.bind(this.onMouseOut,this)),n.on("keydown",".form-control",_.bind(this.onKeyDown,this)),n.on("keyup",".form-control",_.bind(this.onKeyUp,this)),n.on("blur",".form-control",_.bind(this.onBlur,this)),n.on("input",".form-control",_.bind(this.onInput,this)),this.options.allowDecimal||n.on("keypress",".form-control",_.bind(this.onKeyPress,this)),this.switches={count:1,enabled:!0,fromKeyDown:!1},this.options.speed==="medium"?this.switches.speed=300:this.options.speed==="fast"?this.switches.speed=100:this.switches.speed=500,this.render(),this.options.disabled&&this.setDisabled(this.options.disabled),this.options.value!==undefined&&(this.value=this.options.value),this.setRawValue(this.value),this.options.width&&$(this.el).width(this.options.width),this.options.defaultValue===undefined&&(this.options.defaultValue=this.options.minValue),this.oldValue=this.options.minValue,this.lastValue=null},render:function(){var e=$(this.el);return e.html(this.template),this.$input=e.find(".form-control"),this.rendered=!0,this.options.tabindex!=undefined&&this.$input.attr("tabindex",this.options.tabindex),this},setDisabled:function(e){var t=$(this.el);e!==this.disabled&&(t.find("button").toggleClass("disabled",e),t.toggleClass("disabled",e),e?this.$input.attr({disabled:e}):this.$input.removeAttr("disabled")),this.disabled=e},isDisabled:function(){return this.disabled},setDefaultUnit:function(e){if(this.options.defaultUnit!=e){var t=this.options.defaultUnit;this.options.defaultUnit=e,this.setMinValue(this._recalcUnits(this.options.minValue,t)),this.setMaxValue(this._recalcUnits(this.options.maxValue,t)),this.setValue(this._recalcUnits(this.getNumberValue(),t),!0)}},setMinValue:function(e){this.options.minValue=e},setMaxValue:function(e){this.options.maxValue=e},setStep:function(e){this.options.step=e},getNumberValue:function(){return this.options.allowAuto&&this.value==this.options.autoText?-1:parseFloat(this.value)},getUnitValue:function(){return this.options.defaultUnit},getValue:function(){return this.value},setRawValue:function(e){this.$input&&this.$input.val(e)},getRawValue:function(){return this.$input.val()},setValue:function(e,t){var n=!1;this._fromKeyDown=!1,this.lastValue=this.value;if(typeof e=="undefined"||e==="")this.value="";else if(this.options.allowAuto&&(Math.abs(parseFloat(e)+1)<1e-4||e==this.options.autoText))this.value=this.options.autoText;else{var r=this._add(parseFloat(e),0,this.options.allowDecimal?3:0);if(typeof e=="undefined"||isNaN(r))r=this.oldValue,n=!0;var i=this.options.defaultUnit;if(typeof e.match!="undefined"){var s=e.match(/(px|em|%|en|ex|pt|"|cm|mm|pc|s|ms|см|мм|пт|сек|мс)$/i);null!==s&&s[0]!=="undefined"&&(i=s[0].toLowerCase())}this.options.defaultUnit!==i&&!n&&(r=this._recalcUnits(r,i)),r>this.options.maxValue&&(r=this.options.maxValue,n=!0),r<this.options.minValue&&(r=this.options.minValue,n=!0),this.value=(r+" "+this.options.defaultUnit).trim(),this.oldValue=r}t!==!0&&this.lastValue!==this.value&&this.trigger("change",this,this.value,this.lastValue),t!==!0&&n&&this.trigger("inputerror",this,this.value),this.rendered?this.setRawValue(this.value):this.options.value=this.value},setMask:function(e){this.options.maskExp=e},onMouseDown:function(e,t){if(this.disabled)return;t&&$(t.currentTarget).addClass("active"),this.options.hold&&(this.switches.fromKeyDown=!1,this._startSpin(e,t))},onMouseUp:function(e,t){if(this.disabled)return;$(t.currentTarget).removeClass("active"),this.options.hold?this._stopSpin():this._step(e)},onMouseOver:function(e){if(this.disabled)return;$(e.currentTarget).addClass("over")},onMouseOut:function(e){if(this.disabled)return;$(e.currentTarget).removeClass("active over"),this.options.hold&&this._stopSpin()},onKeyDown:function(e){if(this.disabled)return;if(!this.options.hold||e.keyCode!=Common.UI.Keys.UP&&e.keyCode!=Common.UI.Keys.DOWN)if(e.keyCode==Common.UI.Keys.RETURN)if(this.options.defaultUnit&&this.options.defaultUnit.length){var t=this.getRawValue();if(this.value!=t)return this.onEnterValue(),this.value==t}else this.onEnterValue();else this._fromKeyDown=!0;else e.preventDefault(),e.stopPropagation(),this.switches.timeout===undefined&&(this.switches.fromKeyDown=!0,this._startSpin(e.keyCode==Common.UI.Keys.UP,e))},onKeyUp:function(e){if(this.disabled)return;if(e.keyCode==Common.UI.Keys.UP||e.keyCode==Common.UI.Keys.DOWN)e.stopPropagation(),e.preventDefault(),this.options.hold?this._stopSpin():this._step(e.keyCode==Common.UI.Keys.UP)},onKeyPress:function(e){if(this.disabled)return;var t=String.fromCharCode(e.charCode);t=="."||t==","?(e.preventDefault(),e.stopPropagation()):this.options.maskExp&&!this.options.maskExp.test(t)&&!e.ctrlKey&&e.keyCode!==Common.UI.Keys.DELETE&&e.keyCode!==Common.UI.Keys.BACKSPACE&&e.keyCode!==Common.UI.Keys.LEFT&&e.keyCode!==Common.UI.Keys.RIGHT&&e.keyCode!==Common.UI.Keys.HOME&&e.keyCode!==Common.UI.Keys.END&&e.keyCode!==Common.UI.Keys.ESC&&e.keyCode!==Common.UI.Keys.RETURN&&e.keyCode!==Common.UI.Keys.INSERT&&e.keyCode!==Common.UI.Keys.TAB&&(e.preventDefault(),e.stopPropagation())},onInput:function(e,t){if(this.disabled||e.isDefaultPrevented())return;this.trigger("changing",this,$(e.target).val(),e)},onEnterValue:function(){if(this.$input){var e=this.getRawValue();this.setValue(e===""?this.value:e),this.trigger("entervalue",this)}},onBlur:function(e){if(this.$input){var t=this.getRawValue();this.setValue(t===""?this.value:t),this.options.hold&&this.switches.fromKeyDown&&this._stopSpin()}},_startSpin:function(e,t){if(!this.disabled){var n=this.switches.count;n===1?(this._step(e,!0),n=1):n<3?n=1.5:n<8?n=2.5:n=6,this.switches.timeout=setTimeout($.proxy(function(){this._step(e,!0),this._startSpin(e)},this),this.switches.speed/n),this.switches.count++}},_stopSpin:function(e){this.switches.timeout!==undefined&&(clearTimeout(this.switches.timeout),this.switches.timeout=undefined,this.switches.count=1,this.trigger("change",this,this.value,this.lastValue))},_increase:function(e){var t=this;if(!t.readOnly){var n=t.options.step;t._fromKeyDown?(n=this.getRawValue(),n=_.isEmpty(n)?t.oldValue:parseFloat(n)):t.getValue()!==""?(t.options.allowAuto&&t.getValue()==t.options.autoText?n=t.options.minValue-t.options.step:n=parseFloat(t.getValue()),isNaN(n)&&(n=this.oldValue)):n=t.options.defaultValue,t.setValue((this._add(n,t.options.step,t.options.allowDecimal?3:0)+" "+this.options.defaultUnit).trim(),e)}},_decrease:function(e){var t=this;if(!t.readOnly){var n=t.options.step;if(t._fromKeyDown)n=this.getRawValue(),n=_.isEmpty(n)?t.oldValue:parseFloat(n);else if(t.getValue()!==""){t.options.allowAuto&&t.getValue()==t.options.autoText?n=t.options.minValue:n=parseFloat(t.getValue()),isNaN(n)&&(n=this.oldValue);if(t.options.allowAuto&&this._add(n,-t.options.step,t.options.allowDecimal?3:0)<t.options.minValue){t.setValue(t.options.autoText,!0);return}}else n=t.options.defaultValue;t.setValue((this._add(n,-t.options.step,t.options.allowDecimal?3:0)+" "+this.options.defaultUnit).trim(),e)}},_step:function(e,t){e?this._increase(t):this._decrease(t)},_add:function(e,t,n){var r=Math.pow(10,n||this.options.allowDecimal?2:0);return(Math.round(e*r)+Math.round(t*r))/r},_recalcUnits:function(e,t){if(t.match(/(s|ms|сек|мс)$/i)&&this.options.defaultUnit.match(/(s|ms|сек|мс)$/i)){var n=e;if(t=="ms"||t=="мс")n/=1e3;if(this.options.defaultUnit=="ms"||this.options.defaultUnit=="мс")n*=1e3;return n}if(t.match(/(pt|"|cm|mm|pc|см|мм|пт)$/i)===null||this.options.defaultUnit.match(/(pt|"|cm|mm|pc|см|мм|пт)$/i)===null)return e;var n=e;return t=="cm"||t=="см"?n*=10:t=="pt"||t=="пт"?n=n*25.4/72:t=='"'?n*=25.4:t=="pc"&&(n=n*25.4/6),this.options.defaultUnit=="cm"||this.options.defaultUnit=="см"?n/=10:this.options.defaultUnit=="pt"||this.options.defaultUnit=="пт"?n=parseFloat((n*72/25.4).toFixed(3)):this.options.defaultUnit=='"'?n=parseFloat((n/25.4).toFixed(3)):this.options.defaultUnit=="pc"&&(n=n*6/25.4),n}}),Common.UI.CustomSpinner=Common.UI.MetricSpinner.extend(_.extend({initialize:function(e){this.options.toCustomFormat=e.toCustomFormat?e.toCustomFormat:function(e){return e},this.options.fromCustomFormat=e.fromCustomFormat?e.fromCustomFormat:function(e){return e},Common.UI.MetricSpinner.prototype.initialize.call(this,e)},setRawValue:function(e){this.$input&&this.$input.val(this.options.toCustomFormat(e))},getRawValue:function(){return this.options.fromCustomFormat(this.$input.val())}},Common.UI.CustomSpinner||{}))});if(Common===undefined)var Common={};define("common/main/lib/component/CheckBox",["common/main/lib/component/BaseView","underscore"],function(e,t){"use strict";Common.UI.CheckBox=Common.UI.BaseView.extend({options:{labelText:""},disabled:!1,rendered:!1,indeterminate:!1,checked:!1,value:"unchecked",template:t.template('<label class="checkbox-indeterminate"><input type="button" class="img-commonctrl"><span><%= labelText %></span></label>'),initialize:function(e){Common.UI.BaseView.prototype.initialize.call(this,e);var n=this,r=$(this.el);this.render(),this.options.disabled&&this.setDisabled(this.options.disabled),this.options.value!==undefined&&this.setValue(this.options.value,!0),this.$chk.on("click",t.bind(this.onItemCheck,this))},render:function(){var e=$(this.el);return e.html(this.template({labelText:this.options.labelText})),this.$chk=e.find("input[type=button]"),this.$label=e.find("label"),this.rendered=!0,this},setDisabled:function(e){e=e===!0,e!==this.disabled&&(this.$label.toggleClass("disabled",e),e?this.$chk.attr({disabled:e}):this.$chk.removeAttr("disabled")),this.disabled=e},isDisabled:function(){return this.disabled},onItemCheck:function(e){this.disabled||(this.indeterminate?(this.indeterminate=!1,this.setValue(!1)):this.setValue(!this.checked))},setRawValue:function(e){this.checked=e===!0||e==="true"||e==="1"||e===1||e==="checked",this.indeterminate=e==="indeterminate",this.$chk.toggleClass("checked",this.checked),this.$chk.toggleClass("indeterminate",this.indeterminate),this.value=this.indeterminate?"indeterminate":this.checked?"checked":"unchecked"},setValue:function(e,t){this.rendered?(this.lastValue=this.value,this.setRawValue(e),t!==!0&&this.lastValue!==e&&this.trigger("change",this,this.value,this.lastValue)):this.options.value=e},getValue:function(){return this.value},isChecked:function(){return this.checked},setCaption:function(e){this.$label.find("span").text(e)}})});if(Common===undefined)var Common={};define("common/main/lib/component/RadioBox",["common/main/lib/component/BaseView","underscore"],function(e,t){"use strict";Common.UI.RadioBox=Common.UI.BaseView.extend({options:{labelText:""},disabled:!1,rendered:!1,template:t.template('<label class="radiobox"><input type="button" name="<%= name %>" class="img-commonctrl"><%= labelText %></label>'),initialize:function(e){Common.UI.BaseView.prototype.initialize.call(this,e);var n=this,r=$(this.el);this.name=this.options.name||Common.UI.getId(),this.render(),this.options.disabled&&this.setDisabled(this.options.disabled),this.options.checked!==undefined&&this.setValue(this.options.checked,!0),this.$radio.on("click",t.bind(this.onItemCheck,this))},render:function(){var e=$(this.el);return e.html(this.template({labelText:this.options.labelText,name:this.name})),this.$radio=e.find("input[type=button]"),this.rendered=!0,this},setDisabled:function(e){e!==this.disabled&&(this.$radio.toggleClass("disabled",e),e?this.$radio.attr({disabled:e}):this.$radio.removeAttr("disabled")),this.disabled=e},isDisabled:function(){return this.disabled},onItemCheck:function(e){this.disabled||this.setValue(!0)},setRawValue:function(e){var e=e===!0||e==="true"||e==="1"||e===1;$("input[type=button][name="+this.name+"]").removeClass("checked"),this.$radio.toggleClass("checked",e)},setValue:function(e,t){if(this.rendered){var n=this.$radio.hasClass("checked");this.setRawValue(e),t!==!0&&n!==e&&this.trigger("change",this,this.$radio.hasClass("checked"))}else this.options.checked=e},getValue:function(){return this.$radio.hasClass("checked")}})});if(Common===undefined)var Common={};define("common/main/lib/component/DataView",["common/main/lib/component/BaseView","common/main/lib/component/Scroller"],function(){"use strict";Common.UI.DataViewGroupModel=Backbone.Model.extend({defaults:function(){return{id:Common.UI.getId(),caption:"",inline:!1,headername:undefined}}}),Common.UI.DataViewGroupStore=Backbone.Collection.extend({model:Common.UI.DataViewGroupModel}),Common.UI.DataViewModel=Backbone.Model.extend({defaults:function(){return{id:Common.UI.getId(),selected:!1,allowSelected:!0,value:null,disabled:!1}}}),Common.UI.DataViewStore=Backbone.Collection.extend({model:Common.UI.DataViewModel}),Common.UI.DataViewItem=Common.UI.BaseView.extend({options:{},template:_.template(['<div id="<%= id %>"><%= value %></div>'].join("")),initialize:function(e){Common.UI.BaseView.prototype.initialize.call(this,e);var t=this;t.template=t.options.template||t.template,t.listenTo(t.model,"change",t.render),t.listenTo(t.model,"change:selected",t.onSelectChange),t.listenTo(t.model,"remove",t.remove)},render:function(){if(_.isUndefined(this.model.id))return this;var e=$(this.el);return e.html(this.template(this.model.toJSON())),e.addClass("item"),e.toggleClass("selected",this.model.get("selected")&&this.model.get("allowSelected")),e.off("click").on("click",_.bind(this.onClick,this)),e.off("dblclick").on("dblclick",_.bind(this.onDblClick,this)),e.off("contextmenu").on("contextmenu",_.bind(this.onContextMenu,this)),e.toggleClass("disabled",this.model.get("disabled")),_.isUndefined(this.model.get("cls"))||e.addClass(this.model.get("cls")),this.trigger("change",this,this.model),this},remove:function(){this.stopListening(this.model),this.trigger("remove",this,this.model),Common.UI.BaseView.prototype.remove.call(this)},onClick:function(e){if(this.model.get("disabled"))return!1;this.trigger("click",this,this.model,e)},onDblClick:function(e){if(this.model.get("disabled"))return!1;this.trigger("dblclick",this,this.model,e)},onContextMenu:function(e){this.trigger("contextmenu",this,this.model,e)},onSelectChange:function(e,t){this.trigger("select",this,e,t)}}),Common.UI.DataView=Common.UI.BaseView.extend({options:{multiSelect:!1,handleSelect:!0,enableKeyEvents:!0,keyMoveDirection:"both",restoreHeight:0,emptyText:"",listenStoreEvents:!0,allowScrollbar:!0,showLast:!0,useBSKeydown:!1},template:_.template(['<div class="dataview inner" style="<%= style %>">',"<% _.each(groups, function(group) { %>","<% if (group.headername !== undefined) { %>",'<div class="header-name"><%= group.headername %></div>',"<% } %>",'<div class="grouped-data <% if (group.inline) { %> inline <% } %> <% if (!_.isEmpty(group.caption)) { %> margin <% } %>" id="<%= group.id %>">',"<% if (!_.isEmpty(group.caption)) { %>",'<div class="group-description">',"<span><%= group.caption %></span>","</div>","<% } %>",'<div class="group-items-container">',"</div>","</div>","<% }); %>","</div>"].join("")),initialize:function(e){Common.UI.BaseView.prototype.initialize.call(this,e);var t=this;t.template=t.options.template||t.template,t.store=t.options.store||new Common.UI.DataViewStore,t.groups=t.options.groups||null,t.itemTemplate=t.options.itemTemplate||null,t.multiSelect=t.options.multiSelect,t.handleSelect=t.options.handleSelect,t.parentMenu=t.options.parentMenu,t.enableKeyEvents=t.options.enableKeyEvents,t.useBSKeydown=t.options.useBSKeydown,t.showLast=t.options.showLast,t.style=t.options.style||"",t.emptyText=t.options.emptyText||"",t.listenStoreEvents=t.options.listenStoreEvents!==undefined?t.options.listenStoreEvents:!0,t.allowScrollbar=t.options.allowScrollbar!==undefined?t.options.allowScrollbar:!0,t.rendered=!1,t.dataViewItems=[],t.options.keyMoveDirection=="vertical"?t.moveKeys=[Common.UI.Keys.UP,Common.UI.Keys.DOWN]:t.options.keyMoveDirection=="horizontal"?t.moveKeys=[Common.UI.Keys.LEFT,Common.UI.Keys.RIGHT]:t.moveKeys=[Common.UI.Keys.UP,Common.UI.Keys.DOWN,Common.UI.Keys.LEFT,Common.UI.Keys.RIGHT],t.options.el&&t.render()},render:function(e){var t=this;this.trigger("render:before",this),this.cmpEl=$(this.el),e?(this.setElement(e,!1),this.cmpEl=$(this.template({groups:t.groups?t.groups.toJSON():null,style:t.style})),e.html(this.cmpEl)):this.cmpEl.html(this.template({groups:t.groups?t.groups.toJSON():null,style:t.style})),this.rendered||(this.listenStoreEvents&&(this.listenTo(this.store,"add",this.onAddItem),this.listenTo(this.store,"reset",this.onResetItems)),this.onResetItems(),this.parentMenu&&(this.cmpEl.closest("li").css("height","100%"),this.cmpEl.css("height","100%"),this.parentMenu.on("show:after",_.bind(this.alignPosition,this))),this.enableKeyEvents&&this.parentMenu&&this.handleSelect&&(t.showLast||this.parentMenu.on("show:before",function(e){t.deselectAll()}),this.parentMenu.on("show:after",function(e){t.showLast&&t.showLastSelected(),Common.NotificationCenter.trigger("dataview:focus"),_.delay(function(){e.cmpEl.find(".dataview").focus()},10)}).on("hide:after",function(){Common.NotificationCenter.trigger("dataview:blur")}))),_.isUndefined(this.scroller)&&this.allowScrollbar&&(this.scroller=new Common.UI.Scroller({el:$(this.el).find(".inner").andSelf().filter(".inner"),useKeyboard:this.enableKeyEvents&&!this.handleSelect,minScrollbarLength:40,wheelSpeed:10}));var n=this.cmpEl.closest(".asc-window");return n.length>0&&(this.tipZIndex=parseInt(n.css("z-index"))+10),this.rendered=!0,this.cmpEl.on("click",function(e){if(/dataview/.test(e.target.className))return!1}),this.trigger("render:after",this),this},setStore:function(e){e&&(this.stopListening(this.store),this.store=e,this.listenStoreEvents&&(this.listenTo(this.store,"add",this.onAddItem),this.listenTo(this.store,"reset",this.onResetItems)))},selectRecord:function(e,t){if(!this.handleSelect)return;t&&this.suspendEvents(),this.multiSelect?e&&e.set({selected:!e.get("selected")}):(_.each(this.store.where({selected:!0}),function(e){e.set({selected:!1})}),e&&e.set({selected:!0})),t&&this.resumeEvents()},selectByIndex:function(e,t){this.store.length>0&&e>-1&&e<this.store.length&&this.selectRecord(this.store.at(e),t)},deselectAll:function(e){e&&this.suspendEvents(),_.each(this.store.where({selected:!0}),function(e){e.set({selected:!1})}),e&&this.resumeEvents()},getSelectedRec:function(){if(this.multiSelect){var e=[];return _.each(this.store.where({selected:!0}),function(t){e.push(t)}),e}return this.store.where({selected:!0})},onAddItem:function(e,t,n){var r=new Common.UI.DataViewItem({template:this.itemTemplate,model:e});if(r){var i=$(this.el).find(".inner").andSelf().filter(".inner");if(this.groups&&this.groups.length>0){var s=this.groups.findWhere({id:e.get("group")});s&&(i=i.find("#"+s.id+" "+".group-items-container"))}if(i){n&&n.at==0?i.prepend(r.render().el):i.append(r.render().el),i.find(".empty-text").remove(),this.dataViewItems.push(r);if(e.get("tip")){var o=$(r.el);o.attr("data-toggle","tooltip"),o.tooltip({title:e.get("tip"),placement:"cursor",zIndex:this.tipZIndex})}this.listenTo(r,"change",this.onChangeItem),this.listenTo(r,"remove",this.onRemoveItem),this.listenTo(r,"click",this.onClickItem),this.listenTo(r,"dblclick",this.onDblClickItem),this.listenTo(r,"select",this.onSelectItem),this.listenTo(r,"contextmenu",this.onContextMenuItem),this.isSuspendEvents||this.trigger("item:add",this,r,e)}}},onResetItems:function(){_.each(this.dataViewItems,function(e){var t=e.$el.data("bs.tooltip");t&&t.tip().remove()},this),$(this.el).html(this.template({groups:this.groups?this.groups.toJSON():null,style:this.style})),_.isUndefined(this.scroller)||(this.scroller.destroy(),delete this.scroller),this.store.length<1&&this.emptyText.length>0&&$(this.el).find(".inner").andSelf().filter(".inner").append('<table cellpadding="10" class="empty-text"><tr><td>'+this.emptyText+"</td></tr></table>"),_.each(this.dataViewItems,function(e){this.stopListening(e),e.stopListening(e.model)},this),this.dataViewItems=[],this.store.each(this.onAddItem,this),this.allowScrollbar&&(this.scroller=new Common.UI.Scroller({el:$(this.el).find(".inner").andSelf().filter(".inner"),useKeyboard:this.enableKeyEvents&&!this.handleSelect,minScrollbarLength:40,wheelSpeed:10})),this.attachKeyEvents(),this.lastSelectedRec=null,this._layoutParams=undefined},onChangeItem:function(e,t){this.isSuspendEvents||this.trigger("item:change",this,e,t)},onRemoveItem:function(e,t){this.stopListening(e),e.stopListening();if(this.store.length<1&&this.emptyText.length>0){var n=$(this.el).find(".inner").andSelf().filter(".inner");n.find(".empty-text").length<=0&&n.append('<table cellpadding="10" class="empty-text"><tr><td>'+this.emptyText+"</td></tr></table>")}for(var r=0;r<this.dataViewItems.length;r++)if(_.isEqual(e,this.dataViewItems[r])){this.dataViewItems.splice(r,1);break}this.isSuspendEvents||this.trigger("item:remove",this,e,t)},onClickItem:function(e,t,n){if(this.disabled)return;window._event=n,this.showLast&&this.selectRecord(t),this.lastSelectedRec=null;var r=e.$el.data("bs.tooltip");r&&r.tip().remove(),this.isSuspendEvents||this.trigger("item:click",this,e,t,n)},onDblClickItem:function(e,t,n){if(this.disabled)return;window._event=n,this.selectRecord(t),this.lastSelectedRec=null,this.isSuspendEvents||this.trigger("item:dblclick",this,e,t,n)},onSelectItem:function(e,t,n){this.isSuspendEvents||this.trigger(n?"item:select":"item:deselect",this,e,t,this._fromKeyDown)},onContextMenuItem:function(e,t,n){this.isSuspendEvents||this.trigger("item:contextmenu",this,e,t,n)},scrollToRecord:function(e){var t=$(this.el).find(".inner"),n=t.offset().top,r=_.indexOf(this.store.models,e),i=r>=0&&this.dataViewItems.length>r?$(this.dataViewItems[r].el):t.find("#"+e.get("id"));if(i.length<=0)return;var s=i.offset().top;if(s<n||s+i.outerHeight()>n+t.height())this.scroller&&this.allowScrollbar?this.scroller.scrollTop(t.scrollTop()+s-n,0):t.scrollTop(t.scrollTop()+s-n)},onKeyDown:function(e,t){if(this.disabled)return;t===undefined&&(t=e);if(_.indexOf(this.moveKeys,t.keyCode)>-1||t.keyCode==Common.UI.Keys.RETURN){t.preventDefault(),t.stopPropagation();var n=this.getSelectedRec()[0];this.lastSelectedRec===null&&(this.lastSelectedRec=n);if(t.keyCode==Common.UI.Keys.RETURN)this.lastSelectedRec=null,this.selectedBeforeHideRec&&(n=this.selectedBeforeHideRec),this.trigger("item:click",this,this,n,e),this.trigger("item:select",this,this,n,e),this.trigger("entervalue",this,n,e),this.parentMenu&&this.parentMenu.hide();else{var r=_.indexOf(this.store.models,n);if(r<0)if(t.keyCode==Common.UI.Keys.LEFT){var i=$(e.target).closest(".dropdown-submenu.over");i.length>0?(i.removeClass("over"),i.find("> a").focus()):r=0}else r=0;else if(this.options.keyMoveDirection=="both"){this._layoutParams===undefined&&this.fillIndexesArray();var s=this.dataViewItems[r].topIdx,o=this.dataViewItems[r].leftIdx;r=undefined;if(t.keyCode==Common.UI.Keys.LEFT)while(r===undefined){o--;if(o<0){var i=$(e.target).closest(".dropdown-submenu.over");if(i.length>0){i.removeClass("over"),i.find("> a").focus();break}o=this._layoutParams.columns-1}r=this._layoutParams.itemsIndexes[s][o]}else if(t.keyCode==Common.UI.Keys.RIGHT)while(r===undefined)o++,o>this._layoutParams.columns-1&&(o=0),r=this._layoutParams.itemsIndexes[s][o];else if(t.keyCode==Common.UI.Keys.UP)while(r===undefined)s--,s<0&&(s=this._layoutParams.rows-1),r=this._layoutParams.itemsIndexes[s][o];else while(r===undefined)s++,s>this._layoutParams.rows-1&&(s=0),r=this._layoutParams.itemsIndexes[s][o]}else r=t.keyCode==Common.UI.Keys.UP||t.keyCode==Common.UI.Keys.LEFT?Math.max(0,r-1):Math.min(this.store.length-1,r+1);r!==undefined&&r>=0&&(n=this.store.at(r)),n&&(this._fromKeyDown=!0,this.selectRecord(n),this._fromKeyDown=!1,this.scrollToRecord(n))}}else this.trigger("item:keydown",this,n,e)},attachKeyEvents:function(){if(this.enableKeyEvents&&this.handleSelect){var e=$(this.el).find(".inner").andSelf().filter(".inner");e.addClass("canfocused"),e.attr("tabindex","0"),e.on(this.parentMenu&&this.useBSKeydown?"dataview:keydown":"keydown",_.bind(this.onKeyDown,this))}},showLastSelected:function(){if(this.lastSelectedRec)this.selectRecord(this.lastSelectedRec,!0),this.scrollToRecord(this.lastSelectedRec),this.lastSelectedRec=null;else{var e=this.getSelectedRec()[0];e&&this.scrollToRecord(e)}},setDisabled:function(e){this.disabled=e,$(this.el).find(".inner").andSelf().filter(".inner").toggleClass("disabled",e)},isDisabled:function(){return this.disabled},setEmptyText:function(e){this.emptyText=e},alignPosition:function(){var e=this.parentMenu.cmpEl.attr("role")==="menu"?this.parentMenu.cmpEl:this.parentMenu.cmpEl.find("[role=menu]"),t=$(this.el).find(".inner").andSelf().filter(".inner"),n=Common.Utils.innerHeight(),r=e.outerHeight(),i=parseInt(e.css("top"));r>n?(t.css("max-height",n-parseInt(e.css("padding-top"))-parseInt(e.css("padding-bottom"))-5+"px"),this.allowScrollbar&&this.scroller.update({minScrollbarLength:40})):t.height()<this.options.restoreHeight&&(t.css("max-height",Math.min(n-parseInt(e.css("padding-top"))-parseInt(e.css("padding-bottom"))-5,this.options.restoreHeight)+"px"),r=e.outerHeight(),i+r>n&&e.css("top",0),this.allowScrollbar&&this.scroller.update({minScrollbarLength:40}))},fillIndexesArray:function(){if(this.dataViewItems.length<=0)return;this._layoutParams={itemsIndexes:[],columns:0,rows:0};var e=$(this.dataViewItems[0].el),t=e.outerWidth()+parseInt(e.css("margin-left"))+parseInt(e.css("margin-right")),n=this.$el.offset().left,r=-1,i=0,s=0;for(var o=0;o<this.dataViewItems.length;o++){var u=$(this.dataViewItems[o].el).offset().top;s=Math.floor(($(this.dataViewItems[o].el).offset().left-n)/t),u>r&&(r=u,this._layoutParams.itemsIndexes.push([]),i=this._layoutParams.itemsIndexes.length-1),this._layoutParams.itemsIndexes[i][s]=o,this.dataViewItems[o].topIdx=i,this.dataViewItems[o].leftIdx=s,this._layoutParams.columns<s&&(this._layoutParams.columns=s)}this._layoutParams.rows=this._layoutParams.itemsIndexes.length,this._layoutParams.columns++},onResize:function(){this._layoutParams=undefined}}),$(document).on("keydown.dataview","[data-toggle=dropdown], [role=menu]",function(e){if(e.keyCode!==Common.UI.Keys.UP&&e.keyCode!==Common.UI.Keys.DOWN&&e.keyCode!==Common.UI.Keys.LEFT&&e.keyCode!==Common.UI.Keys.RIGHT&&e.keyCode!==Common.UI.Keys.RETURN)return;_.defer(function(){var t=$(e.target).closest(".dropdown-toggle");t.length?t.parent().find(".inner.canfocused").trigger("dataview:keydown",e):$(e.target).closest(".dropdown-submenu").find(".inner.canfocused").trigger("dataview:keydown",e)},100)})});if(Common===undefined)var Common={};define("common/main/lib/component/ListView",["common/main/lib/component/DataView"],function(){"use strict";Common.UI.ListView=Common.UI.DataView.extend(function(){return{options:{handleSelect:!0,enableKeyEvents:!0,showLast:!0,simpleAddMode:!1,keyMoveDirection:"vertical",itemTemplate:_.template('<div id="<%= id %>" class="list-item" style=""><%= value %></div>')},template:_.template(['<div class="listview inner"></div>'].join("")),onResetItems:function(){this.innerEl=null,Common.UI.DataView.prototype.onResetItems.call(this)},onAddItem:function(e,t){var n=new Common.UI.DataViewItem({template:this.itemTemplate,model:e});this.innerEl||(this.innerEl=$(this.el).find(".inner"),this.innerEl.find(".empty-text").remove());if(n&&this.innerEl){if(this.options.simpleAddMode)this.innerEl.append(n.render().el);else{var r=_.indexOf(this.store.models,e),i=this.innerEl.find("> div");r>0?$(i.get(r-1)).after(n.render().el):i.length>0?$(i[r]).before(n.render().el):this.innerEl.append(n.render().el)}this.dataViewItems.push(n),this.listenTo(n,"change",this.onChangeItem),this.listenTo(n,"remove",this.onRemoveItem),this.listenTo(n,"click",this.onClickItem),this.listenTo(n,"dblclick",this.onDblClickItem),this.listenTo(n,"select",this.onSelectItem),this.isSuspendEvents||this.trigger("item:add",this,n,e)}}}}())}),define("spreadsheeteditor/main/app/view/ParagraphSettingsAdvanced",["text!spreadsheeteditor/main/app/template/ParagraphSettingsAdvanced.template","common/main/lib/view/AdvancedSettingsWindow","common/main/lib/component/MetricSpinner","common/main/lib/component/CheckBox","common/main/lib/component/RadioBox","common/main/lib/component/ListView"],function(e){"use strict";SSE.Views.ParagraphSettingsAdvanced=Common.Views.AdvancedSettingsWindow.extend(_.extend({options:{contentWidth:320,height:394,toggleGroup:"paragraph-adv-settings-group",storageName:"sse-para-settings-adv-category"},initialize:function(t){_.extend(this.options,{title:this.textTitle,items:[{panelId:"id-adv-paragraph-indents",panelCaption:this.strParagraphIndents},{panelId:"id-adv-paragraph-font",panelCaption:this.strParagraphFont},{panelId:"id-adv-paragraph-tabs",panelCaption:this.strTabs}],contentTemplate:_.template(e)({scope:this})},t),Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this,this.options),this._changedProps=null,this.checkGroup=0,this._noApply=!0,this._tabListChanged=!1,this.spinners=[],this.api=this.options.api,this._originalProps=new Asc.asc_CParagraphProperty(this.options.paragraphProps)},render:function(){Common.Views.AdvancedSettingsWindow.prototype.render.call(this);var e=this;this.numFirstLine=new Common.UI.MetricSpinner({el:$("#paragraphadv-spin-first-line"),step:.1,width:85,defaultUnit:"cm",defaultValue:0,value:"0 cm",maxValue:55.87,minValue:-55.87}),this.numFirstLine.on("change",_.bind(function(e,t,n,r){this._changedProps&&((this._changedProps.asc_getInd()===null||this._changedProps.asc_getInd()===undefined)&&this._changedProps.asc_putInd(new Asc.asc_CParagraphInd),this._changedProps.asc_getInd().asc_putFirstLine(Common.Utils.Metric.fnRecalcToMM(e.getNumberValue())))},this)),this.spinners.push(this.numFirstLine),this.numIndentsLeft=new Common.UI.MetricSpinner({el:$("#paragraphadv-spin-indent-left"),step:.1,width:85,defaultUnit:"cm",defaultValue:0,value:"0 cm",maxValue:55.87,minValue:-55.87}),this.numIndentsLeft.on("change",_.bind(function(e,t,n,r){this._changedProps&&((this._changedProps.asc_getInd()===null||this._changedProps.asc_getInd()===undefined)&&this._changedProps.asc_putInd(new Asc.asc_CParagraphInd),this._changedProps.asc_getInd().asc_putLeft(Common.Utils.Metric.fnRecalcToMM(e.getNumberValue())))},this)),this.spinners.push(this.numIndentsLeft),this.numIndentsRight=new Common.UI.MetricSpinner({el:$("#paragraphadv-spin-indent-right"),step:.1,width:85,defaultUnit:"cm",defaultValue:0,value:"0 cm",maxValue:55.87,minValue:-55.87}),this.numIndentsRight.on("change",_.bind(function(e,t,n,r){this._changedProps&&((this._changedProps.asc_getInd()===null||this._changedProps.asc_getInd()===undefined)&&this._changedProps.asc_putInd(new Asc.asc_CParagraphInd),this._changedProps.asc_getInd().asc_putRight(Common.Utils.Metric.fnRecalcToMM(e.getNumberValue())))},this)),this.spinners.push(this.numIndentsRight),this.chStrike=new Common.UI.CheckBox({el:$("#paragraphadv-checkbox-strike"),labelText:this.strStrike}),this.chStrike.on("change",_.bind(this.onStrikeChange,this)),this.chDoubleStrike=new Common.UI.CheckBox({el:$("#paragraphadv-checkbox-double-strike"),labelText:this.strDoubleStrike}),this.chDoubleStrike.on("change",_.bind(this.onDoubleStrikeChange,this)),this.chSuperscript=new Common.UI.CheckBox({el:$("#paragraphadv-checkbox-superscript"),labelText:this.strSuperscript}),this.chSuperscript.on("change",_.bind(this.onSuperscriptChange,this)),this.chSubscript=new Common.UI.CheckBox({el:$("#paragraphadv-checkbox-subscript"),labelText:this.strSubscript}),this.chSubscript.on("change",_.bind(this.onSubscriptChange,this)),this.chSmallCaps=new Common.UI.CheckBox({el:$("#paragraphadv-checkbox-small-caps"),labelText:this.strSmallCaps}),this.chSmallCaps.on("change",_.bind(this.onSmallCapsChange,this)),this.chAllCaps=new Common.UI.CheckBox({el:$("#paragraphadv-checkbox-all-caps"),labelText:this.strAllCaps}),this.chAllCaps.on("change",_.bind(this.onAllCapsChange,this)),this.numSpacing=new Common.UI.MetricSpinner({el:$("#paragraphadv-spin-spacing"),step:.01,width:100,defaultUnit:"cm",defaultValue:0,value:"0 cm",maxValue:55.87,minValue:-55.87}),this.numSpacing.on("change",_.bind(function(e,t,n,r){this._changedProps&&this._changedProps.asc_putTextSpacing(Common.Utils.Metric.fnRecalcToMM(e.getNumberValue()));if(this.api&&!this._noApply){var i=this._originalProps?this._originalProps:new Asc.asc_CParagraphProperty;i.asc_putTextSpacing(Common.Utils.Metric.fnRecalcToMM(e.getNumberValue())),this.api.asc_setDrawImagePlaceParagraph("paragraphadv-font-img",i)}},this)),this.spinners.push(this.numSpacing),this.numTab=new Common.UI.MetricSpinner({el:$("#paraadv-spin-tab"),step:.1,width:180,defaultUnit:"cm",value:"1.25 cm",maxValue:55.87,minValue:0}),this.spinners.push(this.numTab),this.numDefaultTab=new Common.UI.MetricSpinner({el:$("#paraadv-spin-default-tab"),step:.1,width:107,defaultUnit:"cm",value:"1.25 cm",maxValue:55.87,minValue:0}),this.numDefaultTab.on("change",_.bind(function(e,t,n,r){this._changedProps&&this._changedProps.asc_putDefaultTab(parseFloat(Common.Utils.Metric.fnRecalcToMM(e.getNumberValue()).toFixed(1)))},this)),this.spinners.push(this.numDefaultTab),this.tabList=new Common.UI.ListView({el:$("#paraadv-list-tabs"),emptyText:this.noTabs,store:new Common.UI.DataViewStore}),this.tabList.store.comparator=function(e){return e.get("tabPos")},this.tabList.on("item:select",_.bind(this.onSelectTab,this));var t=function(){e._noApply||(e._tabListChanged=!0)};this.listenTo(this.tabList.store,"add",t),this.listenTo(this.tabList.store,"remove",t),this.listenTo(this.tabList.store,"reset",t),this.radioLeft=new Common.UI.RadioBox({el:$("#paragraphadv-radio-left"),labelText:this.textTabLeft,name:"asc-radio-tab",checked:!0}),this.radioCenter=new Common.UI.RadioBox({el:$("#paragraphadv-radio-center"),labelText:this.textTabCenter,name:"asc-radio-tab"}),this.radioRight=new Common.UI.RadioBox({el:$("#paragraphadv-radio-right"),labelText:this.textTabRight,name:"asc-radio-tab"}),this.btnAddTab=new Common.UI.Button({el:$("#paraadv-button-add-tab")}),this.btnAddTab.on("click",_.bind(this.addTab,this)),this.btnRemoveTab=new Common.UI.Button({el:$("#paraadv-button-remove-tab")}),this.btnRemoveTab.on("click",_.bind(this.removeTab,this)),this.btnRemoveAll=new Common.UI.Button({el:$("#paraadv-button-remove-all")}),this.btnRemoveAll.on("click",_.bind(this.removeAllTabs,this)),this.on("show",function(e){e.getChild(".footer .primary").focus()}),this.afterRender()},getSettings:function(){return this._tabListChanged&&((this._changedProps.asc_getTabs()===null||this._changedProps.asc_getTabs()===undefined)&&this._changedProps.asc_putTabs(new Asc.asc_CParagraphTabs),this.tabList.store.each(function(e,t){var n=new Asc.asc_CParagraphTab(Common.Utils.Metric.fnRecalcToMM(e.get("tabPos")),e.get("tabAlign"));this._changedProps.asc_getTabs().add_Tab(n)},this)),{paragraphProps:this._changedProps}},_setDefaults:function(e){if(e){this._originalProps=new Asc.asc_CParagraphProperty(e),this.numFirstLine.setValue(e.asc_getInd()!==null&&e.asc_getInd().asc_getFirstLine()!==null?Common.Utils.Metric.fnRecalcFromMM(e.asc_getInd().asc_getFirstLine()):"",!0),this.numIndentsLeft.setValue(e.asc_getInd()!==null&&e.asc_getInd().asc_getLeft()!==null?Common.Utils.Metric.fnRecalcFromMM(e.asc_getInd().asc_getLeft()):"",!0),this.numIndentsRight.setValue(e.asc_getInd()!==null&&e.asc_getInd().asc_getRight()!==null?Common.Utils.Metric.fnRecalcFromMM(e.asc_getInd().asc_getRight()):"",!0),this._noApply=!0,this.chStrike.setValue(e.asc_getStrikeout()!==null&&e.asc_getStrikeout()!==undefined?e.asc_getStrikeout():"indeterminate",!0),this.chDoubleStrike.setValue(e.asc_getDStrikeout()!==null&&e.asc_getDStrikeout()!==undefined?e.asc_getDStrikeout():"indeterminate",!0),this.chSubscript.setValue(e.asc_getSubscript()!==null&&e.asc_getSubscript()!==undefined?e.asc_getSubscript():"indeterminate",!0),this.chSuperscript.setValue(e.asc_getSuperscript()!==null&&e.asc_getSuperscript()!==undefined?e.asc_getSuperscript():"indeterminate",!0),this.chSmallCaps.setValue(e.asc_getSmallCaps()!==null&&e.asc_getSmallCaps()!==undefined?e.asc_getSmallCaps():"indeterminate",!0),this.chAllCaps.setValue(e.asc_getAllCaps()!==null&&e.asc_getAllCaps()!==undefined?e.asc_getAllCaps():"indeterminate",!0),this.numSpacing.setValue(e.asc_getTextSpacing()!==null&&e.asc_getTextSpacing()!==undefined?Common.Utils.Metric.fnRecalcFromMM(e.asc_getTextSpacing()):"",!0),this.api.asc_setDrawImagePlaceParagraph("paragraphadv-font-img",this._originalProps),this.numDefaultTab.setValue(e.asc_getDefaultTab()!==null&&e.asc_getDefaultTab()!==undefined?Common.Utils.Metric.fnRecalcFromMM(parseFloat(e.asc_getDefaultTab().toFixed(1))):"",!0);var t=this.tabList.store,n=e.asc_getTabs();if(n){var r=[],i=n.asc_getCount();for(var s=0;s<i;s++){var o=n.asc_getTab(s),u=Common.Utils.Metric.fnRecalcFromMM(parseFloat(o.asc_getPos().toFixed(1))),a=new Common.UI.DataViewModel;a.set({tabPos:u,value:parseFloat(u.toFixed(3))+" "+Common.Utils.Metric.getCurrentMetricName(),tabAlign:o.asc_getValue()}),r.push(a)}t.reset(r,{silent:!1}),this.tabList.selectByIndex(0)}this._noApply=!1,this._changedProps=new Asc.asc_CParagraphProperty}},updateMetricUnit:function(){if(this.spinners)for(var e=0;e<this.spinners.length;e++){var t=this.spinners[e];t.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName()),t.el.id=="paragraphadv-spin-spacing"||t.el.id=="paragraphadv-spin-position"?t.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt?1:.01):t.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt?1:.1)}},afterRender:function(){this.updateMetricUnit(),this._setDefaults(this._originalProps);if(this.storageName){var e=Common.localStorage.getItem(this.storageName);this.setActiveCategory(e!==null?parseInt(e):0)}},onStrikeChange:function(e,t,n,r){this._changedProps&&this.checkGroup!=1&&this._changedProps.asc_putStrikeout(e.getValue()=="checked"),this.checkGroup=0,e.getValue()=="checked"&&(this.checkGroup=1,this.chDoubleStrike.setValue(0),this._changedProps&&this._changedProps.asc_putDStrikeout(!1),this.checkGroup=0);if(this.api&&!this._noApply){var i=this._originalProps?this._originalProps:new Asc.asc_CParagraphProperty;i.asc_putStrikeout(e.getValue()=="checked"),i.asc_putDStrikeout(this.chDoubleStrike.getValue()=="checked"),this.api.asc_setDrawImagePlaceParagraph("paragraphadv-font-img",i)}},onDoubleStrikeChange:function(e,t,n,r){this._changedProps&&this.checkGroup!=1&&this._changedProps.asc_putDStrikeout(e.getValue()=="checked"),this.checkGroup=0,e.getValue()=="checked"&&(this.checkGroup=1,this.chStrike.setValue(0),this._changedProps&&this._changedProps.asc_putStrikeout(!1),this.checkGroup=0);if(this.api&&!this._noApply){var i=this._originalProps?this._originalProps:new Asc.asc_CParagraphProperty;i.asc_putDStrikeout(e.getValue()=="checked"),i.asc_putStrikeout(this.chStrike.getValue()=="checked"),this.api.asc_setDrawImagePlaceParagraph("paragraphadv-font-img",i)}},onSuperscriptChange:function(e,t,n,r){this._changedProps&&this.checkGroup!=2&&this._changedProps.asc_putSuperscript(e.getValue()=="checked"),this.checkGroup=0,e.getValue()=="checked"&&(this.checkGroup=2,this.chSubscript.setValue(0),this._changedProps&&this._changedProps.asc_putSubscript(!1),this.checkGroup=0);if(this.api&&!this._noApply){var i=this._originalProps?this._originalProps:new Asc.asc_CParagraphProperty;i.asc_putSuperscript(e.getValue()=="checked"),i.asc_putSubscript(this.chSubscript.getValue()=="checked"),this.api.asc_setDrawImagePlaceParagraph("paragraphadv-font-img",i)}},onSubscriptChange:function(e,t,n,r){this._changedProps&&this.checkGroup!=2&&this._changedProps.asc_putSubscript(e.getValue()=="checked"),this.checkGroup=0,e.getValue()=="checked"&&(this.checkGroup=2,this.chSuperscript.setValue(0),this._changedProps&&this._changedProps.asc_putSuperscript(!1),this.checkGroup=0);if(this.api&&!this._noApply){var i=this._originalProps?this._originalProps:new Asc.asc_CParagraphProperty;i.asc_putSubscript(e.getValue()=="checked"),i.asc_putSuperscript(this.chSuperscript.getValue()=="checked"),this.api.asc_setDrawImagePlaceParagraph("paragraphadv-font-img",i)}},onSmallCapsChange:function(e,t,n,r){this._changedProps&&this.checkGroup!=3&&this._changedProps.asc_putSmallCaps(e.getValue()=="checked"),this.checkGroup=0,e.getValue()=="checked"&&(this.checkGroup=3,this.chAllCaps.setValue(0),this._changedProps&&this._changedProps.asc_putAllCaps(!1),this.checkGroup=0);if(this.api&&!this._noApply){var i=this._originalProps?this._originalProps:new Asc.asc_CParagraphProperty;i.asc_putSmallCaps(e.getValue()=="checked"),i.asc_putAllCaps(this.chAllCaps.getValue()=="checked"),this.api.asc_setDrawImagePlaceParagraph("paragraphadv-font-img",i)}},onAllCapsChange:function(e,t,n,r){this._changedProps&&this.checkGroup!=3&&this._changedProps.asc_putAllCaps(e.getValue()=="checked"),this.checkGroup=0,e.getValue()=="checked"&&(this.checkGroup=3,this.chSmallCaps.setValue(0),this._changedProps&&this._changedProps.asc_putSmallCaps(!1),this.checkGroup=0);if(this.api&&!this._noApply){var i=this._originalProps?this._originalProps:new Asc.asc_CParagraphProperty;i.asc_putAllCaps(e.getValue()=="checked"),i.asc_putSmallCaps(this.chSmallCaps.getValue()=="checked"),this.api.asc_setDrawImagePlaceParagraph("paragraphadv-font-img",i)}},addTab:function(e,t){var n=this.numTab.getNumberValue(),r=this.radioLeft.getValue()?1:this.radioCenter.getValue()?3:2,i=this.tabList.store,s=i.find(function(e){return Math.abs(e.get("tabPos")-n)<.001});s?s.set("tabAlign",r):(s=new Common.UI.DataViewModel,s.set({tabPos:n,value:n+" "+Common.Utils.Metric.getCurrentMetricName(),tabAlign:r}),i.add(s)),this.tabList.selectRecord(s),this.tabList.scrollToRecord(s)},removeTab:function(e,t){var n=this.tabList.getSelectedRec();if(n.length>0){var r=this.tabList.store,i=_.indexOf(r.models,n[0]);r.remove(n[0]),i>r.length-1&&(i=r.length-1),r.length>0&&(this.tabList.selectByIndex(i),this.tabList.scrollToRecord(r.at(i)))}},removeAllTabs:function(e,t){this.tabList.store.reset()},onSelectTab:function(e,t,n){var r={},i=_.isFunction(n.toJSON);if(i){if(!n.get("selected"))return;r=n.toJSON()}else r=n;this.numTab.setValue(r.tabPos),r.tabAlign==1?this.radioLeft.setValue(!0):r.tabAlign==3?this.radioCenter.setValue(!0):this.radioRight.setValue(!0)},textTitle:"Paragraph - Advanced Settings",strIndentsFirstLine:"First line",strIndentsLeftText:"Left",strIndentsRightText:"Right",strParagraphIndents:"Indents & Placement",strParagraphFont:"Font",cancelButtonText:"Cancel",okButtonText:"Ok",textEffects:"Effects",textCharacterSpacing:"Character Spacing",strDoubleStrike:"Double strikethrough",strStrike:"Strikethrough",strSuperscript:"Superscript",strSubscript:"Subscript",strSmallCaps:"Small caps",strAllCaps:"All caps",strTabs:"Tab",textSet:"Specify",textRemove:"Remove",textRemoveAll:"Remove All",textTabLeft:"Left",textTabRight:"Right",textTabCenter:"Center",textAlign:"Alignment",textTabPosition:"Tab Position",textDefault:"Default Tab",noTabs:"The specified tabs will appear in this field"},SSE.Views.ParagraphSettingsAdvanced||{}))}),define("text!spreadsheeteditor/main/app/template/ImageSettingsAdvanced.template",[],function(){return'<div id="id-adv-image-alttext" class="settings-panel active">\n <div class="inner-content">\n <table cols="1" width="100%">\n <tr>\n <td class="padding-large">\n <label class="header"><%= scope.textAltTitle %></label>\n <div id="image-advanced-alt-title"></div>\n </td>\n </tr>\n <tr>\n <td>\n <label class="header"><%= scope.textAltDescription %></label>\n <textarea id="image-advanced-alt-description" class="form-control" style="width: 100%; height: 70px;"></textarea>\n </td>\n </tr>\n <tr>\n <td>\n <label><%= scope.textAltTip %></label>\n </td>\n </tr>\n </table>\n </div>\n</div>'}),define("spreadsheeteditor/main/app/view/ImageSettingsAdvanced",["text!spreadsheeteditor/main/app/template/ImageSettingsAdvanced.template","common/main/lib/view/AdvancedSettingsWindow","common/main/lib/component/InputField"],function(e){"use strict";SSE.Views.ImageSettingsAdvanced=Common.Views.AdvancedSettingsWindow.extend(_.extend({options:{contentWidth:300,height:342,toggleGroup:"image-adv-settings-group",properties:null,storageName:"sse-image-settings-adv-category"},initialize:function(t){_.extend(this.options,{title:this.textTitle,items:[{panelId:"id-adv-image-alttext",panelCaption:this.textAlt}],contentTemplate:_.template(e)({scope:this})},t),Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this,this.options),this._originalProps=this.options.imageProps,this._changedProps=null},render:function(){Common.Views.AdvancedSettingsWindow.prototype.render.call(this);var e=this;this.inputAltTitle=(new Common.UI.InputField({el:$("#image-advanced-alt-title"),allowBlank:!0,validateOnBlur:!1,style:"width: 100%;"})).on("changed:after",function(){e.isAltTitleChanged=!0}),this.textareaAltDescription=this.$window.find("textarea"),this.textareaAltDescription.keydown(function(t){t.keyCode==Common.UI.Keys.RETURN&&t.stopPropagation(),e.isAltDescChanged=!0}),this.afterRender()},afterRender:function(){this._setDefaults(this._originalProps);if(this.storageName){var e=Common.localStorage.getItem(this.storageName);this.setActiveCategory(e!==null?parseInt(e):0)}},_setDefaults:function(e){if(e){var t=e.asc_getTitle();this.inputAltTitle.setValue(t?t:""),t=e.asc_getDescription(),this.textareaAltDescription.val(t?t:""),this._changedProps=new Asc.asc_CImgProperty}},getSettings:function(){return this.isAltTitleChanged&&this._changedProps.asc_putTitle(this.inputAltTitle.getValue()),this.isAltDescChanged&&this._changedProps.asc_putDescription(this.textareaAltDescription.val()),{imageProps:this._changedProps}},textTitle:"Image - Advanced Settings",cancelButtonText:"Cancel",okButtonText:"Ok",textAlt:"Alternative Text",textAltTitle:"Title",textAltDescription:"Description",textAltTip:"The alternative text-based representation of the visual object information, which will be read to the people with vision or cognitive impairments to help them better understand what information there is in the image, autoshape, chart or table."},SSE.Views.ImageSettingsAdvanced||{}))}),define("spreadsheeteditor/main/app/view/SetValueDialog",["common/main/lib/component/Window","common/main/lib/component/ComboBox"],function(){"use strict";SSE.Views.SetValueDialog=Common.UI.Window.extend(_.extend({options:{width:214,header:!0,style:"min-width: 214px;",cls:"modal-dlg"},initialize:function(e){_.extend(this.options,{title:this.textTitle},e||{}),this.template=['<div class="box">','<div class="input-row">','<div id="id-spin-set-value"></div>',"</div>",'<div class="footer center">','<button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px;">'+this.okButtonText+"</button>",'<button class="btn normal dlg-btn" result="cancel">'+this.cancelButtonText+"</button>","</div>"].join(""),this.options.tpl=_.template(this.template,this.options),this.startvalue=this.options.startvalue,this.maxvalue=this.options.maxvalue,this.defaultUnit=this.options.defaultUnit,this.step=this.options.step,Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this),this.spnSize=new Common.UI.MetricSpinner({el:$("#id-spin-set-value"),width:182,step:this.step,defaultUnit:this.defaultUnit,minValue:0,maxValue:this.maxvalue,value:this.startvalue!==null?this.startvalue+" "+this.defaultUnit:""});if(this.startvalue!==null){var e=this;setTimeout(function(){var t=e.spnSize.$input[0];document.selection?e.spnSize.$input.select():(t.selectionStart=0,t.selectionEnd=e.startvalue.toString().length)},10)}var t=this.getChild();t.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this)),this.spnSize.on("entervalue",_.bind(this.onPrimary,this)),this.spnSize.on("change",_.bind(this.onChange,this)),this.spnSize.$el.find("input").focus()},_handleInput:function(e){this.options.handler&&this.options.handler.call(this,this,e),this.close()},onBtnClick:function(e){this._handleInput(e.currentTarget.attributes.result.value)},onChange:function(){var e=this.spnSize.getNumberValue();e/=this.step,e=(e|e)*this.step,this.spnSize.setValue(e,!0)},getSettings:function(){return this.spnSize.getNumberValue()},onPrimary:function(){this._handleInput("ok")},cancelButtonText:"Cancel",okButtonText:"Ok",txtMinText:"The minimum value for this field is {0}",txtMaxText:"The maximum value for this field is {0}"},SSE.Views.SetValueDialog||{}))});if(Common===undefined)var Common={};define("common/main/lib/component/ColorPaletteExt",["common/main/lib/component/BaseView"],function(){"use strict";Common.UI.ColorPaletteExt=Common.UI.BaseView.extend({options:{dynamiccolors:10,allowReselect:!0,cls:"",style:""},template:_.template(['<div class="palette-color-ext">',"<% var me = this; %>","<% $(colors).each(function(num, item) { %>","<% if (me.isColor(item)) { %>",'<div class="palette-color-item palette-color color-<%=item%>" style="background:#<%=item%>" hidefocus="on">','<em><span style="background:#<%=item%>;" unselectable="on"> </span></em>',"</div>","<% } else if (me.isTransparent(item)) { %>",'<div class="palette-color-item color-<%=item%>" hidefocus="on">','<em><span unselectable="on"> </span></em>',"</div>","<% } else if (me.isEffect(item)) { %>",'<div effectid="<%=item.effectId%>" effectvalue="<%=item.effectValue%>" class="palette-color-item palette-color-effect color-<%=item.color%>" style="background:#<%=item.color%>" hidefocus="on">','<em><span style="background:#<%=item.color%>;" unselectable="on"> </span></em>',"</div>","<% } %>","<% }); %>","</div>"].join("")),colorRe:/(?:^|\s)color-(.{6})(?:\s|$)/,selectedCls:"selected",initialize:function(e){Common.UI.BaseView.prototype.initialize.call(this,e),this.id=this.options.id,this.cls=this.options.cls,this.style=this.options.style,this.colors=this.options.colors||[],this.value=this.options.value,this.options.el&&this.render(),this.options.value&&this.select(this.options.value,!0)},render:function(e){var t=this;return t.rendered?this.cmpEl=$(this.el):(this.cmpEl=$(this.template({id:this.id,cls:this.cls,style:this.style,colors:this.colors})),e?(this.setElement(e,!1),e.html(this.cmpEl)):$(this.el).html(this.cmpEl),this.cmpEl.on("click",_.bind(this.handleClick,this))),t.rendered=!0,this},isColor:function(e){return typeof e=="string"&&/[0-9A-F]{6}/.test(e)},isTransparent:function(e){return typeof e=="string"&&e=="transparent"},isEffect:function(e){return typeof e=="object"&&e.effectId!==undefined},getColor:function(){return this.value},handleClick:function(e){var t=this,n=$(e.target).closest("div.palette-color-item"),r,i;if(n.length==0)return;if(n.hasClass("color-transparent"))$(t.el).find("div."+t.selectedCls).removeClass(t.selectedCls),n.addClass(t.selectedCls),t.value="transparent",t.trigger("select",t,"transparent");else{if(!/^[a-fA-F0-9]{6}$/.test(t.value)||_.indexOf(t.colors,t.value)<0)t.value=!1;$(t.el).find("div."+t.selectedCls).removeClass(t.selectedCls),n.addClass(t.selectedCls),r=n[0].className.match(t.colorRe)[1];if(n.hasClass("palette-color-effect")){var s=parseInt(n.attr("effectid"));r&&(t.value=r.toUpperCase(),t.trigger("select",t,{color:r,effectId:s}))}else/#?[a-fA-F0-9]{6}/.test(r)&&(r=/#?([a-fA-F0-9]{6})/.exec(r)[1].toUpperCase(),t.value=r,t.trigger("select",t,r))}},select:function(e,t){var n=$(this.el);n.find("div."+this.selectedCls).removeClass(this.selectedCls);if(!e)return;if(typeof e=="object"){var r;e.effectId!==undefined?(r=n.find('div[effectid="'+e.effectId+'"]').first(),r.length>0?(r.addClass(this.selectedCls),this.value=r[0].className.match(this.colorRe)[1].toUpperCase()):this.value=!1):e.effectValue!==undefined&&(r=n.find('div[effectvalue="'+e.effectValue+'"].color-'+e.color.toUpperCase()).first(),r.length>0?(r.addClass(this.selectedCls),this.value=r[0].className.match(this.colorRe)[1].toUpperCase()):this.value=!1)}else{/#?[a-fA-F0-9]{6}/.test(e)&&(e=/#?([a-fA-F0-9]{6})/.exec(e)[1].toUpperCase(),this.value=e);if(/^[a-fA-F0-9]{6}|transparent$/.test(e)&&_.indexOf(this.colors,e)>=0){_.indexOf(this.colors,this.value)<0&&(this.value=!1);if(e!=this.value||this.options.allowReselect)e=="transparent"?n.find("div.color-transparent").addClass(this.selectedCls):n.find("div.palette-color.color-"+e).first().addClass(this.selectedCls),this.value=e,t!==!0&&this.fireEvent("select",this,e)}else{var i=n.find("#"+e).first();i.length==0&&(i=n.find('div[color="'+e+'"]').first()),i.length>0&&(i.addClass(this.selectedCls),this.value=e.toUpperCase())}}},updateColors:function(e){if(e===undefined)return;this.colors=e,this.cmpEl=$(this.template({id:this.id,cls:this.cls,style:this.style,colors:this.colors})),$(this.el).html(this.cmpEl),this.cmpEl.on("click",_.bind(this.handleClick,this))},clearSelection:function(e){$(this.el).find("div."+this.selectedCls).removeClass(this.selectedCls),this.value=undefined}})}),define("spreadsheeteditor/main/app/view/AutoFilterDialog",["common/main/lib/component/Window","common/main/lib/component/ColorPaletteExt"],function(){"use strict";SSE.Views=SSE.Views||{},SSE.Views.DigitalFilterDialog=Common.UI.Window.extend(_.extend({initialize:function(e){var t=this,n={};_.extend(n,{width:501,height:230,contentWidth:180,header:!0,cls:"filter-dlg",contentTemplate:"",title:t.txtTitle,items:[]},e),this.template=e.template||['<div class="box" style="height:'+(n.height-85)+'px;">','<div class="content-panel" >','<label class="header">',t.textShowRows,"</label>",'<div style="margin-top:15px;">','<div id="id-search-begin-digital-combo" class="input-group-nr" style="vertical-align:top;width:225px;display:inline-block;"></div>','<div id="id-sd-cell-search-begin" class="" style="width:225px;display:inline-block;margin-left:18px;"></div>',"</div>","<div>",'<div id="id-and-radio" class="padding-small" style="display: inline-block; margin-top:10px;"></div>','<div id="id-or-radio" class="padding-small" style="display: inline-block; margin-left:25px;"></div>',"</div>",'<div style="margin-top:10px;">','<div id="id-search-end-digital-combo" class="input-group-nr" style="vertical-align:top;width:225px;display:inline-block;"></div>','<div id="id-sd-cell-search-end" class="" style="width:225px;display:inline-block;margin-left:18px;"></div>',"</div>","</div>","</div>",'<div class="separator horizontal" style="width:100%"></div>','<div class="footer right" style="margin-left:-15px;">','<button class="btn normal dlg-btn primary" result="ok" style="margin-right:10px;">',t.okButtonText,"</button>",'<button class="btn normal dlg-btn" result="cancel">',t.cancelButtonText,"</button>","</div>"].join(""),this.api=e.api,this.handler=e.handler,this.type=e.type||"number",n.tpl=_.template(this.template,n),Common.UI.Window.prototype.initialize.call(this,n)},render:function(){Common.UI.Window.prototype.render.call(this),this.conditions=[{value:Asc.c_oAscCustomAutoFilter.equals,displayValue:this.capCondition1},{value:Asc.c_oAscCustomAutoFilter.doesNotEqual,displayValue:this.capCondition2},{value:Asc.c_oAscCustomAutoFilter.isGreaterThan,displayValue:this.capCondition3},{value:Asc.c_oAscCustomAutoFilter.isGreaterThanOrEqualTo,displayValue:this.capCondition4},{value:Asc.c_oAscCustomAutoFilter.isLessThan,displayValue:this.capCondition5},{value:Asc.c_oAscCustomAutoFilter.isLessThanOrEqualTo,displayValue:this.capCondition6}],this.type=="text"&&(this.conditions=this.conditions.concat([{value:Asc.c_oAscCustomAutoFilter.beginsWith,displayValue:this.capCondition7},{value:Asc.c_oAscCustomAutoFilter.doesNotBeginWith,displayValue:this.capCondition8},{value:Asc.c_oAscCustomAutoFilter.endsWith,displayValue:this.capCondition9},{value:Asc.c_oAscCustomAutoFilter.doesNotEndWith,displayValue:this.capCondition10},{value:Asc.c_oAscCustomAutoFilter.contains,displayValue:this.capCondition11},{value:Asc.c_oAscCustomAutoFilter.doesNotContain,displayValue:this.capCondition12}])),this.cmbCondition1=new Common.UI.ComboBox({el:$("#id-search-begin-digital-combo",this.$window),menuStyle:"min-width: 225px;max-height: 135px;",cls:"input-group-nr",data:this.conditions,scrollAlwaysVisible:!0,editable:!1}),this.cmbCondition1.setValue(Asc.c_oAscCustomAutoFilter.equals),this.conditions.splice(0,0,{value:0,displayValue:this.textNoFilter}),this.cmbCondition2=new Common.UI.ComboBox({el:$("#id-search-end-digital-combo",this.$window),menuStyle:"min-width: 225px;max-height: 135px;",cls:"input-group-nr",data:this.conditions,scrollAlwaysVisible:!0,editable:!1}),this.cmbCondition2.setValue(0),this.rbAnd=new Common.UI.RadioBox({el:$("#id-and-radio",this.$window),labelText:this.capAnd,name:"asc-radio-filter-tab",checked:!0}),this.rbOr=new Common.UI.RadioBox({el:$("#id-or-radio",this.$window),labelText:this.capOr,name:"asc-radio-filter-tab"}),this.cmbValue1=new Common.UI.ComboBox({el:$("#id-sd-cell-search-begin",this.$window),cls:"input-group-nr",menuStyle:"min-width: 225px;max-height: 135px;",scrollAlwaysVisible:!0,data:[]}),this.cmbValue2=new Common.UI.ComboBox({el:$("#id-sd-cell-search-end",this.$window),cls:"input-group-nr",menuStyle:"min-width: 225px;max-height: 135px;",scrollAlwaysVisible:!0,data:[]});var e=function(e,t){var n=e.get("intval"),r=t.get("intval"),i=n!==undefined,s=r!==undefined;return i!==s?i?-1:1:(!i&&(n=e.get("value").toLowerCase())&&(r=t.get("value").toLowerCase()),n==r?0:r==""||n!==""&&n<r?-1:1)};this.cmbValue1.store.comparator=this.cmbValue2.store.comparator=e,this.$window.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this)),this.loadDefaults()},show:function(){Common.UI.Window.prototype.show.call(this);var e=this;_.defer(function(){e.cmbValue1&&e.cmbValue1._input.focus()},500)},close:function(){this.api&&this.api.asc_enableKeyEvents(!0),Common.UI.Window.prototype.close.call(this)},onBtnClick:function(e){e.currentTarget.attributes&&e.currentTarget.attributes.result&&("ok"===e.currentTarget.attributes.result.value&&this.save(),this.close())},setSettings:function(e){this.properties=e},loadDefaults:function(){if(this.properties&&this.rbOr&&this.rbAnd&&this.cmbCondition1&&this.cmbCondition2&&this.cmbValue1&&this.cmbValue2){var e=[];this.properties.asc_getValues().forEach(function(t){var n=t.asc_getText();_.isEmpty(n)||e.push({value:n,displayValue:n,intval:!isNaN(parseFloat(n))&&isFinite(n)?parseFloat(n):undefined})}),this.cmbValue1.setData(e),this.cmbValue2.setData(e);var t=this.properties.asc_getFilterObj();if(t.asc_getType()==Asc.c_oAscAutoFilterTypes.CustomFilters){var n=t.asc_getFilter(),r=n.asc_getCustomFilters();n.asc_getAnd()?this.rbAnd.setValue(!0):this.rbOr.setValue(!0),this.cmbCondition1.setValue(r[0].asc_getOperator()||Asc.c_oAscCustomAutoFilter.equals),this.cmbCondition2.setValue(r.length>1?r[1].asc_getOperator()||0:0),this.cmbValue1.setValue(null===r[0].asc_getVal()?"":r[0].asc_getVal()),this.cmbValue2.setValue(r.length>1?null===r[1].asc_getVal()?"":r[1].asc_getVal():"")}}},save:function(){if(this.api&&this.properties&&this.rbOr&&this.rbAnd&&this.cmbCondition1&&this.cmbCondition2&&this.cmbValue1&&this.cmbValue2){var e=this.properties.asc_getFilterObj();e.asc_setFilter(new Asc.CustomFilters),e.asc_setType(Asc.c_oAscAutoFilterTypes.CustomFilters);var t=e.asc_getFilter();t.asc_setCustomFilters(this.cmbCondition2.getValue()==0?[new Asc.CustomFilter]:[new Asc.CustomFilter,new Asc.CustomFilter]);var n=t.asc_getCustomFilters();t.asc_setAnd(this.rbAnd.getValue()),n[0].asc_setOperator(this.cmbCondition1.getValue()),n[0].asc_setVal(this.cmbValue1.getValue()),this.cmbCondition2.getValue()!==0&&(n[1].asc_setOperator(this.cmbCondition2.getValue()||undefined),n[1].asc_setVal(this.cmbValue2.getValue())),this.api.asc_applyAutoFilter(this.properties)}},onPrimary:function(){return this.save(),this.close(),!1},cancelButtonText:"Cancel",capAnd:"And",capCondition1:"equals",capCondition10:"does not end with",capCondition11:"contains",capCondition12:"does not contain",capCondition2:"does not equal",capCondition3:"is greater than",capCondition4:"is greater than or equal to",capCondition5:"is less than",capCondition6:"is less than or equal to",capCondition7:"begins with",capCondition8:"does not begin with",capCondition9:"ends with",capOr:"Or",textNoFilter:"no filter",textShowRows:"Show rows where",textUse1:"Use ? to present any single character",textUse2:"Use * to present any series of character",txtTitle:"Custom Filter"},SSE.Views.DigitalFilterDialog||{})),SSE.Views.Top10FilterDialog=Common.UI.Window.extend(_.extend({initialize:function(e){var t=this,n={};_.extend(n,{width:318,height:160,contentWidth:180,header:!0,cls:"filter-dlg",contentTemplate:"",title:t.txtTitle,items:[]},e),this.template=e.template||['<div class="box" style="height:'+(n.height-85)+'px;">','<div class="content-panel" >','<div style="margin-right:15px; display: inline-block; vertical-align: middle;">','<label class="input-label">',t.textType,"</label>",'<div id="id-top10-type-combo" style=""></div>',"</div>",'<div style="margin-right:15px; display: inline-block; vertical-align: middle;">','<label class="input-label"></label>','<div id="id-top10-count-spin" class="input-group-nr" style=""></div>',"</div>",'<div style="display: inline-block; vertical-align: middle;">','<label class="input-label"></label>','<div id="id-top10-item-combo" class="input-group-nr" style=""></div>',"</div>","</div>","</div>",'<div class="separator horizontal" style="width:100%"></div>','<div class="footer center">','<button class="btn normal dlg-btn primary" result="ok" style="margin-right:10px;">',t.okButtonText,"</button>",'<button class="btn normal dlg-btn" result="cancel">',t.cancelButtonText,"</button>","</div>"].join(""),this.api=e.api,this.handler=e.handler,n.tpl=_.template(this.template,n),Common.UI.Window.prototype.initialize.call(this,n)},render:function(){Common.UI.Window.prototype.render.call(this),this.cmbType=new Common.UI.ComboBox({el:$("#id-top10-type-combo",this.$window),style:"width: 85px;",menuStyle:"min-width: 85px;",cls:"input-group-nr",data:[{value:!0,displayValue:this.txtTop},{value:!1,displayValue:this.txtBottom}],editable:!1}),this.cmbType.setValue(!0),this.cmbItem=new Common.UI.ComboBox({el:$("#id-top10-item-combo",this.$window),style:"width: 85px;",menuStyle:"min-width: 85px;",cls:"input-group-nr",data:[{value:!1,displayValue:this.txtItems},{value:!0,displayValue:this.txtPercent}],editable:!1}),this.cmbItem.setValue(!1),this.cmbItem.on("selected",_.bind(function(e,t){this.spnCount.setDefaultUnit(t.value?"%":"")},this)),this.spnCount=new Common.UI.MetricSpinner({el:$("#id-top10-count-spin"),step:1,width:85,defaultUnit:"",value:"10",maxValue:500,minValue:1}),this.$window.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this)),this.loadDefaults()},show:function(){Common.UI.Window.prototype.show.call(this);var e=this;_.defer(function(){e.spnCount&&e.spnCount.$input.focus()},500)},close:function(){this.api&&this.api.asc_enableKeyEvents(!0),Common.UI.Window.prototype.close.call(this)},onBtnClick:function(e){e.currentTarget.attributes&&e.currentTarget.attributes.result&&("ok"===e.currentTarget.attributes.result.value&&this.save(),this.close())},setSettings:function(e){this.properties=e},loadDefaults:function(){if(this.properties){var e=this.properties.asc_getFilterObj();if(e.asc_getType()==Asc.c_oAscAutoFilterTypes.Top10){var t=e.asc_getFilter(),n=t.asc_getTop(),r=t.asc_getPercent();this.cmbType.setValue(n||n===null),this.cmbItem.setValue(r||r===null),this.spnCount.setDefaultUnit(r||r===null?"%":""),this.spnCount.setValue(t.asc_getVal())}}},save:function(){if(this.api&&this.properties){var e=this.properties.asc_getFilterObj();e.asc_setFilter(new Asc.Top10),e.asc_setType(Asc.c_oAscAutoFilterTypes.Top10);var t=e.asc_getFilter();t.asc_setTop(this.cmbType.getValue()),t.asc_setPercent(this.cmbItem.getValue()),t.asc_setVal(this.spnCount.getNumberValue()),this.api.asc_applyAutoFilter(this.properties)}},onPrimary:function(){return this.save(),this.close(),!1},cancelButtonText:"Cancel",okButtonText:"OK",txtTitle:"Top 10 AutoFilter",textType:"Show",txtTop:"Top",txtBottom:"Bottom",txtItems:"Item",txtPercent:"Percent"},SSE.Views.Top10FilterDialog||{})),SSE.Views.AutoFilterDialog=Common.UI.Window.extend(_.extend({initialize:function(e){var t=this,n={};_.extend(n,{width:450,height:265,contentWidth:400,header:!1,cls:"filter-dlg",contentTemplate:"",title:t.txtTitle,modal:!1,animate:!1,items:[]},e),this.template=e.template||['<div class="box" style="height:'+n.height+'px;">','<div class="content-panel" style="width: 250px;">','<div class="">','<div id="id-sd-cell-search" style="height:22px; margin-bottom:10px;"></div>','<div class="border-values" style="">','<div id="id-dlg-filter-values" class="combo-values"/>',"</div>","</div>",'<div class="footer center">','<div id="id-apply-filter" style="display: inline-block;"></div>','<button class="btn normal dlg-btn" result="cancel">',t.cancelButtonText,"</button>","</div>","</div>",'<div class="separator"/>','<div class="menu-panel" style="width: 195px;">','<div id="menu-container-filters" style=""><div class="dropdown-toggle" data-toggle="dropdown"></div></div>',"</div>","</div>"].join(""),this.api=e.api,this.handler=e.handler,this.throughIndexes=[],this.filteredIndexes=[],n.tpl=_.template(this.template,n),Common.UI.Window.prototype.initialize.call(this,n)},render:function(){var e=this;Common.UI.Window.prototype.render.call(this),this.$window.find(".btn").on("click",_.bind(this.onBtnClick,this)),this.btnOk=new Common.UI.Button({cls:"btn normal dlg-btn primary",caption:this.okButtonText,style:"margin-right:10px;",enableToggle:!1,allowDepress:!1}),this.btnOk&&(this.btnOk.render($("#id-apply-filter",this.$window)),this.btnOk.on("click",_.bind(this.onApplyFilter,this))),this.miSortLow2High=new Common.UI.MenuItem({caption:this.txtSortLow2High,toggleGroup:"menufiltersort",checkable:!0,checked:!1}),this.miSortLow2High.on("click",_.bind(this.onSortType,this,Asc.c_oAscSortOptions.Ascending)),this.miSortHigh2Low=new Common.UI.MenuItem({caption:this.txtSortHigh2Low,toggleGroup:"menufiltersort",checkable:!0,checked:!1}),this.miSortHigh2Low.on("click",_.bind(this.onSortType,this,Asc.c_oAscSortOptions.Descending)),this.miSortCellColor=new Common.UI.MenuItem({caption:this.txtSortCellColor,toggleGroup:"menufiltersort",checkable:!0,checked:!1,menu:new Common.UI.Menu({style:"min-width: inherit; padding: 0px;",menuAlign:"tl-tr",items:[{template:_.template('<div id="filter-dlg-sort-cells-color" style="max-width: 147px; max-height: 120px;"></div>')}]})}),this.miSortFontColor=new Common.UI.MenuItem({caption:this.txtSortFontColor,toggleGroup:"menufiltersort",checkable:!0,checked:!1,menu:new Common.UI.Menu({style:"min-width: inherit; padding: 0px;",menuAlign:"tl-tr",items:[{template:_.template('<div id="filter-dlg-sort-font-color" style="max-width: 147px; max-height: 120px;"></div>')}]})}),this.miNumFilter=new Common.UI.MenuItem({caption:this.txtNumFilter,toggleGroup:"menufilterfilter",checkable:!0,checked:!1,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{value:Asc.c_oAscCustomAutoFilter.equals,caption:this.txtEquals,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters},{value:Asc.c_oAscCustomAutoFilter.doesNotEqual,caption:this.txtNotEquals,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters},{value:Asc.c_oAscCustomAutoFilter.isGreaterThan,caption:this.txtGreater,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters},{value:Asc.c_oAscCustomAutoFilter.isGreaterThanOrEqualTo,caption:this.txtGreaterEquals,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters},{value:Asc.c_oAscCustomAutoFilter.isLessThan,caption:this.txtLess,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters},{value:Asc.c_oAscCustomAutoFilter.isLessThanOrEqualTo,caption:this.txtLessEquals,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters},{value:-2,caption:this.txtBetween,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters},{value:Asc.c_oAscCustomAutoFilter.top10,caption:this.txtTop10,checkable:!0,type:Asc.c_oAscAutoFilterTypes.Top10},{value:Asc.c_oAscDynamicAutoFilter.aboveAverage,caption:this.txtAboveAve,checkable:!0,type:Asc.c_oAscAutoFilterTypes.DynamicFilter},{value:Asc.c_oAscDynamicAutoFilter.belowAverage,caption:this.txtBelowAve,checkable:!0,type:Asc.c_oAscAutoFilterTypes.DynamicFilter},{value:-1,caption:this.btnCustomFilter+"...",checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters}]})});var t=this.miNumFilter.menu.items;for(var n=0;n<t.length;n++)t[n].on("click",_.bind(t[n].options.type==Asc.c_oAscAutoFilterTypes.CustomFilters?this.onNumCustomFilterItemClick:t[n].options.type==Asc.c_oAscAutoFilterTypes.DynamicFilter?this.onNumDynamicFilterItemClick:this.onTop10FilterItemClick,this));this.miTextFilter=new Common.UI.MenuItem({caption:this.txtTextFilter,toggleGroup:"menufilterfilter",checkable:!0,checked:!1,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{value:Asc.c_oAscCustomAutoFilter.equals,caption:this.txtEquals,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters},{value:Asc.c_oAscCustomAutoFilter.doesNotEqual,caption:this.txtNotEquals,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters},{value:Asc.c_oAscCustomAutoFilter.beginsWith,caption:this.txtBegins,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters},{value:Asc.c_oAscCustomAutoFilter.doesNotBeginWith,caption:this.txtNotBegins,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters},{value:Asc.c_oAscCustomAutoFilter.endsWith,caption:this.txtEnds,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters},{value:Asc.c_oAscCustomAutoFilter.doesNotEndWith,caption:this.txtNotEnds,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters},{value:Asc.c_oAscCustomAutoFilter.contains,caption:this.txtContains,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters},{value:Asc.c_oAscCustomAutoFilter.doesNotContain,caption:this.txtNotContains,checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters},{value:-1,caption:this.btnCustomFilter+"...",checkable:!0,type:Asc.c_oAscAutoFilterTypes.CustomFilters}]})}),this.miTextFilter.menu.on("item:click",_.bind(this.onTextFilterMenuClick,this)),this.miFilterCellColor=new Common.UI.MenuItem({caption:this.txtFilterCellColor,toggleGroup:"menufilterfilter",checkable:!0,checked:!1,menu:new Common.UI.Menu({style:"min-width: inherit; padding: 0px;",menuAlign:"tl-tr",items:[{template:_.template('<div id="filter-dlg-filter-cells-color" style="max-width: 147px; max-height: 120px;"></div>')}]})}),this.miFilterFontColor=new Common.UI.MenuItem({caption:this.txtFilterFontColor,toggleGroup:"menufilterfilter",checkable:!0,checked:!1,menu:new Common.UI.Menu({style:"min-width: inherit; padding: 0px;",menuAlign:"tl-tr",items:[{template:_.template('<div id="filter-dlg-filter-font-color" style="max-width: 147px; max-height: 120px;"></div>')}]})}),this.miClear=new Common.UI.MenuItem({caption:this.txtClear,checkable:!1}),this.miClear.on("click",_.bind(this.onClear,this)),this.miReapply=new Common.UI.MenuItem({caption:this.txtReapply,checkable:!1}),this.miReapply.on("click",_.bind(this.onReapply,this)),this.filtersMenu=new Common.UI.Menu({items:[this.miSortLow2High,this.miSortHigh2Low,this.miSortCellColor,this.miSortFontColor,{caption:"--"},this.miNumFilter,this.miTextFilter,this.miFilterCellColor,this.miFilterFontColor,this.miClear,{caption:"--"},this.miReapply]});var r=this.$window.find("#menu-container-filters");this.filtersMenu.render(r),this.filtersMenu.cmpEl.attr({tabindex:"-1"}),this.mnuSortColorCellsPicker=new Common.UI.ColorPaletteExt({el:$("#filter-dlg-sort-cells-color"),colors:[]}),this.mnuSortColorCellsPicker.on("select",_.bind(this.onSortColorSelect,this,Asc.c_oAscSortOptions.ByColorFill)),this.mnuSortColorFontPicker=new Common.UI.ColorPaletteExt({el:$("#filter-dlg-sort-font-color"),colors:[]}),this.mnuSortColorFontPicker.on("select",_.bind(this.onSortColorSelect,this,Asc.c_oAscSortOptions.ByColorFont)),this.mnuFilterColorCellsPicker=new Common.UI.ColorPaletteExt({el:$("#filter-dlg-filter-cells-color"),colors:[]}),this.mnuFilterColorCellsPicker.on("select",_.bind(this.onFilterColorSelect,this,!0)),this.mnuFilterColorFontPicker=new Common.UI.ColorPaletteExt({el:$("#filter-dlg-filter-font-color"),colors:[]}),this.mnuFilterColorFontPicker.on("select",_.bind(this.onFilterColorSelect,this,!1)),this.input=(new Common.UI.InputField({el:$("#id-sd-cell-search",this.$window),allowBlank:!0,placeHolder:this.txtEmpty,validateOnChange:!0,validation:function(){return!0}})).on("changing",function(t,n){n.length?(n=n.replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1"),e.filter=new RegExp(n,"ig")):e.filter=undefined,e.setupDataCells()}),this.cells=new Common.UI.DataViewStore,this.filterExcludeCells=new Common.UI.DataViewStore,this.cells&&(this.cellsList=new Common.UI.ListView({el:$("#id-dlg-filter-values",this.$window),store:this.cells,simpleAddMode:!0,template:_.template(['<div class="listview inner" style="border:none;"></div>'].join("")),itemTemplate:_.template(["<div>",'<label class="checkbox-indeterminate" style="position:absolute;">','<% if (check=="indeterminate") { %>','<input type="button" class="indeterminate img-commonctrl"/>',"<% } else if (check) { %>",'<input type="button" class="checked img-commonctrl"/>',"<% } else { %>",'<input type="button" class="img-commonctrl"/>',"<% } %>","</label>",'<div id="<%= id %>" class="list-item" style="pointer-events:none;margin-left:20px;display:inline-block;width: 185px;"><%= Common.Utils.String.htmlEncode(value) %></div>',"</div>"].join(""))}),this.cellsList.store.comparator=function(e,t){if("0"==e.get("groupid"))return-1;if("0"==t.get("groupid"))return 1;if("2"==e.get("groupid"))return-1;if("2"==t.get("groupid"))return 1;var n=e.get("intval"),r=t.get("intval"),i=n!==undefined,s=r!==undefined;return i!==s?i?-1:1:(!i&&(n=e.get("cellvalue").toLowerCase())&&(r=t.get("cellvalue").toLowerCase()),n==r?0:r==""||n!==""&&n<r?-1:1)},this.cellsList.on("item:select",_.bind(this.onCellCheck,this)),this.cellsList.onKeyDown=_.bind(this.onListKeyDown,this)),this.setupDataCells(),this._setDefaults();var i=function(t){if(e._skipCheckDocumentClick)return;$(t.target).closest(".filter-dlg").length<=0&&e.close()};this.on("close",function(){$(document.body).off("mousedown",i)}),_.delay(function(){$(document.body).on("mousedown",i)},100,this)},show:function(e,t){Common.UI.Window.prototype.show.call(this,e,t);var n=this;this.input&&_.delay(function(){n.input.$el.find("input").focus()},500,this)},onBtnClick:function(e){e.currentTarget.attributes&&e.currentTarget.attributes.result&&"cancel"===e.currentTarget.attributes.result.value&&this.close()},onApplyFilter:function(){this.testFilter()&&(this.save(),this.close())},onSortType:function(e){this.api&&this.configTo&&this.api.asc_sortColFilter(e,this.configTo.asc_getCellId(),this.configTo.asc_getDisplayName()),this.close()},onNumCustomFilterItemClick:function(e){var t=this.configTo.asc_getFilterObj(),n="",r="",i=Asc.c_oAscCustomAutoFilter.equals,s=0,o=!0;if(t.asc_getType()==Asc.c_oAscAutoFilterTypes.CustomFilters){var u=t.asc_getFilter(),a=u.asc_getCustomFilters();o=u.asc_getAnd(),i=a[0].asc_getOperator(),s=a.length>1?a[1].asc_getOperator()||0:0,n=null===a[0].asc_getVal()?"":a[0].asc_getVal(),r=a.length>1?null===a[1].asc_getVal()?"":a[1].asc_getVal():""}if(e.value!==-1){var f=new Asc.CustomFilters;f.asc_setCustomFilters(e.value==-2?[new Asc.CustomFilter,new Asc.CustomFilter]:[new Asc.CustomFilter]);var l=f.asc_getCustomFilters();f.asc_setAnd(!0),l[0].asc_setOperator(e.value==-2?Asc.c_oAscCustomAutoFilter.isGreaterThanOrEqualTo:e.value),e.value==-2?(l[0].asc_setVal(i==Asc.c_oAscCustomAutoFilter.isGreaterThanOrEqualTo&&s==Asc.c_oAscCustomAutoFilter.isLessThanOrEqualTo?n:""),l[1].asc_setOperator(Asc.c_oAscCustomAutoFilter.isLessThanOrEqualTo),l[1].asc_setVal(i==Asc.c_oAscCustomAutoFilter.isGreaterThanOrEqualTo&&s==Asc.c_oAscCustomAutoFilter.isLessThanOrEqualTo?r:"")):l[0].asc_setVal(e.value==i?n:""),t.asc_setFilter(f),t.asc_setType(Asc.c_oAscAutoFilterTypes.CustomFilters)}var c=this,h=(new SSE.Views.DigitalFilterDialog({api:this.api,type:"number"})).on({close:function(){c.close()}});this.close(),h.setSettings(this.configTo),h.show()},onTextFilterMenuClick:function(e,t){var n=this.configTo.asc_getFilterObj(),r="",i="",s=Asc.c_oAscCustomAutoFilter.equals,o=0,u=!0;if(n.asc_getType()==Asc.c_oAscAutoFilterTypes.CustomFilters){var a=n.asc_getFilter(),f=a.asc_getCustomFilters();u=a.asc_getAnd(),s=f[0].asc_getOperator(),o=f.length>1?f[1].asc_getOperator()||0:0,r=null===f[0].asc_getVal()?"":f[0].asc_getVal(),i=f.length>1?null===f[1].asc_getVal()?"":f[1].asc_getVal():""}if(t.value!==-1){var l=new Asc.CustomFilters;l.asc_setCustomFilters([new Asc.CustomFilter]);var c=l.asc_getCustomFilters();l.asc_setAnd(!0),c[0].asc_setOperator(t.value),c[0].asc_setVal(t.value==s?r:""),n.asc_setFilter(l),n.asc_setType(Asc.c_oAscAutoFilterTypes.CustomFilters)}var h=this,p=(new SSE.Views.DigitalFilterDialog({api:this.api,type:"text"})).on({close:function(){h.close()}});this.close(),p.setSettings(this.configTo),p.show()},onNumDynamicFilterItemClick:function(e){var t=this.configTo.asc_getFilterObj();t.asc_getType()!==Asc.c_oAscAutoFilterTypes.DynamicFilter&&(t.asc_setFilter(new Asc.DynamicFilter),t.asc_setType(Asc.c_oAscAutoFilterTypes.DynamicFilter)),t.asc_getFilter().asc_setType(e.value),this.api.asc_applyAutoFilter(this.configTo),this.close()},onTop10FilterItemClick:function(e,t){var n=this,r=(new SSE.Views.Top10FilterDialog({api:this.api})).on({close:function(){n.close()}});this.close(),r.setSettings(this.configTo),r.show()},onFilterColorSelect:function(e,t,n){var r=this.configTo.asc_getFilterObj();r.asc_getType()!==Asc.c_oAscAutoFilterTypes.ColorFilter&&(r.asc_setFilter(new Asc.ColorFilter),r.asc_setType(Asc.c_oAscAutoFilterTypes.ColorFilter));var i=r.asc_getFilter();i.asc_setCellColor(e?null:!1),i.asc_setCColor(e&&n=="transparent"||!e&&n=="#000000"?null:Common.Utils.ThemeColor.getRgbColor(n)),this.api.asc_applyAutoFilter(this.configTo),this.close()},onSortColorSelect:function(e,t,n){if(this.api&&this.configTo){var r=e==Asc.c_oAscSortOptions.ByColorFill;this.api.asc_sortColFilter(e,this.configTo.asc_getCellId(),this.configTo.asc_getDisplayName(),r&&n=="transparent"||!r&&n=="#000000"?null:Common.Utils.ThemeColor.getRgbColor(n))}this.close()},onCellCheck:function(e,t,n){if(this.checkCellTrigerBlock)return;var r="",i="",s=!1,o=null,u=window.event?window.event:window._event;if(u){i=u.target.type,r=$(u.currentTarget).find(".list-item");if(r.length){o=r.get(0).getBoundingClientRect();var a=u.clientX*Common.Utils.zoom(),f=u.clientY*Common.Utils.zoom();o.left<a&&a<o.right&&o.top<f&&f<o.bottom&&(s=!0)}if(i==="button"||s)this.updateCellCheck(e,n),_.delay(function(){e.$el.find(".listview").focus()},100,this)}},onListKeyDown:function(e,t){var n=null,r=this.cellsList;if(r.disabled)return;_.isUndefined(undefined)&&(t=e),t.keyCode==Common.UI.Keys.SPACE?(t.preventDefault(),t.stopPropagation(),this.updateCellCheck(r,r.getSelectedRec()[0])):Common.UI.DataView.prototype.onKeyDown.call(this.cellsList,e,t)},updateCellCheck:function(e,t){if(t&&e){e.isSuspendEvents=!0;var n=!t.get("check"),r=this,i=r.filter?r.filteredIndexes:r.throughIndexes;if("0"==t.get("groupid"))this.cells.each(function(e){"2"!==e.get("groupid")&&(e.set("check",n),e.get("throughIndex")>1&&(i[parseInt(e.get("throughIndex"))]=n))});else{t.set("check",n),i[parseInt(t.get("throughIndex"))]=n;var s=n;for(var o=0;o<this.cells.length;o++){var u=this.cells.at(o);if("1"==u.get("groupid")&&u.get("check")!==n){s="indeterminate";break}}this.checkCellTrigerBlock=!0,this.cells.at(0).set("check",s),this.checkCellTrigerBlock=undefined}this.btnOk.setDisabled(!1),this.configTo.asc_getFilterObj().asc_setType(Asc.c_oAscAutoFilterTypes.Filters),e.isSuspendEvents=!1,e.scroller.update({minScrollbarLength:40,alwaysVisibleY:!0,suppressScrollX:!0})}},onClear:function(){this.api&&this.configTo&&this.api.asc_clearFilterColumn(this.configTo.asc_getCellId(),this.configTo.asc_getDisplayName()),this.close()},onReapply:function(){this.api&&this.configTo&&this.api.asc_reapplyAutoFilter(this.config.asc_getDisplayName()),this.close()},setSettings:function(e){this.config=e,this.configTo=e},_setDefaults:function(){this.initialFilterType=this.configTo.asc_getFilterObj().asc_getType();var e=this.configTo.asc_getFilterObj(),t=this.initialFilterType===Asc.c_oAscAutoFilterTypes.CustomFilters,n=this.initialFilterType===Asc.c_oAscAutoFilterTypes.DynamicFilter,r=this.initialFilterType===Asc.c_oAscAutoFilterTypes.Top10,i=this.configTo.asc_getIsTextFilter(),s=this.configTo.asc_getColorsFill(),o=this.configTo.asc_getColorsFont(),u=this.configTo.asc_getSortState(),a=this.configTo.asc_getSortColor();a&&(a=Common.Utils.ThemeColor.getHexColor(a.get_r(),a.get_g(),a.get_b()).toLocaleUpperCase()),this.miTextFilter.setVisible(i),this.miNumFilter.setVisible(!i),this.miTextFilter.setChecked(t&&i,!0),this.miNumFilter.setChecked((t||n||r)&&!i,!0),this.miSortLow2High.setChecked(u==Asc.c_oAscSortOptions.Ascending,!0),this.miSortHigh2Low.setChecked(u==Asc.c_oAscSortOptions.Descending,!0);var f=o&&o.length>0;this.miSortFontColor.setVisible(f),this.miFilterFontColor.setVisible(f);if(f){var l=[];o.forEach(function(e,t){e?l.push(Common.Utils.ThemeColor.getHexColor(e.get_r(),e.get_g(),e.get_b()).toLocaleUpperCase()):l.push("000000")}),this.mnuSortColorFontPicker.updateColors(l),this.mnuFilterColorFontPicker.updateColors(l),this.miFilterFontColor.setChecked(!1,!0),this.miSortFontColor.setChecked(u==Asc.c_oAscSortOptions.ByColorFont,!0),u==Asc.c_oAscSortOptions.ByColorFont&&this.mnuSortColorFontPicker.select(a?a:"000000",!0)}f=s&&s.length>0,this.miSortCellColor.setVisible(f),this.miFilterCellColor.setVisible(f);if(f){var l=[];s.forEach(function(e,t){e?l.push(Common.Utils.ThemeColor.getHexColor(e.get_r(),e.get_g(),e.get_b()).toLocaleUpperCase()):l.push("transparent")}),this.mnuSortColorCellsPicker.updateColors(l),this.mnuFilterColorCellsPicker.updateColors(l),this.miFilterCellColor.setChecked(!1,!0),this.miSortCellColor.setChecked(u==Asc.c_oAscSortOptions.ByColorFill,!0),u==Asc.c_oAscSortOptions.ByColorFill&&this.mnuSortColorCellsPicker.select(a?a:"transparent",!0)}if(t){var c=e.asc_getFilter(),h=c.asc_getCustomFilters(),p=c.asc_getAnd(),d=h[0].asc_getOperator(),v=h.length>1?h[1].asc_getOperator()||0:0,m=i?this.miTextFilter.menu.items:this.miNumFilter.menu.items,g=!0;h.length==1?m.forEach(function(e){var t=e.options.type==Asc.c_oAscAutoFilterTypes.CustomFilters&&e.value==d;e.setChecked(t,!0),t&&(g=!1)}):!i&&(d==Asc.c_oAscCustomAutoFilter.isGreaterThanOrEqualTo&&v==Asc.c_oAscCustomAutoFilter.isLessThanOrEqualTo||d==Asc.c_oAscCustomAutoFilter.isLessThanOrEqualTo&&v==Asc.c_oAscCustomAutoFilter.isGreaterThanOrEqualTo)&&(m[6].setChecked(!0,!0),g=!1),g&&m[m.length-1].setChecked(!0,!0)}else if(this.initialFilterType===Asc.c_oAscAutoFilterTypes.ColorFilter){var y=e.asc_getFilter(),b=y.asc_getCColor();b&&(b=Common.Utils.ThemeColor.getHexColor(b.get_r(),b.get_g(),b.get_b()).toLocaleUpperCase()),y.asc_getCellColor()===null?(this.miFilterCellColor.setChecked(!0,!0),this.mnuFilterColorCellsPicker.select(b?b:"transparent",!0)):y.asc_getCellColor()===!1&&(this.miFilterFontColor.setChecked(!0,!0),this.mnuFilterColorFontPicker.select(b?b:"000000",!0))}else if(n||r){var w=n?e.asc_getFilter().asc_getType():null,m=this.miNumFilter.menu.items;m.forEach(function(e){e.setChecked(n&&e.options.type==Asc.c_oAscAutoFilterTypes.DynamicFilter&&e.value==w||r&&e.options.type==Asc.c_oAscAutoFilterTypes.Top10,!0)})}this.miClear.setDisabled(this.initialFilterType===Asc.c_oAscAutoFilterTypes.None),this.miReapply.setDisabled(this.initialFilterType===Asc.c_oAscAutoFilterTypes.None),this.btnOk.setDisabled(this.initialFilterType!==Asc.c_oAscAutoFilterTypes.Filters&&this.initialFilterType!==Asc.c_oAscAutoFilterTypes.None)},setupDataCells:function(){function e(e){return!isNaN(parseFloat(e))&&isFinite(e)}var t=this,n,r,i=0,s=2,o=!0,u=!1,a=0,f=[],l=[],c=t.filter?t.filteredIndexes:t.throughIndexes;this.configTo.asc_getValues().forEach(function(u){r=u.asc_getText(),n=e(r),o=!0,t.filter?(null===r.match(t.filter)&&(o=!1),c[s]=o):c[s]==undefined&&(c[s]=u.asc_getVisible()),o?(f.push(new Common.UI.DataViewModel({id:++i,selected:!1,allowSelected:!0,cellvalue:r,value:n?r:r.length>0?r:t.textEmptyItem,intval:n?parseFloat(r):undefined,strval:n?"":r,groupid:"1",check:c[s],throughIndex:s})),c[s]&&a++):l.push(new Common.UI.DataViewModel({cellvalue:r})),++s}),a==f.length?u=!0:a>0&&(u="indeterminate");if(t.filter||c[0]==undefined)c[0]=!0;(!t.filter||f.length>0)&&f.unshift(new Common.UI.DataViewModel({id:++i,selected:!1,allowSelected:!0,value:t.filter?this.textSelectAllResults:this.textSelectAll,groupid:"0",check:c[0],throughIndex:0})),t.filter&&f.length>1&&(c[1]==undefined&&(c[1]=!1),f.splice(1,0,new Common.UI.DataViewModel({id:++i,selected:!1,allowSelected:!0,value:this.textAddSelection,groupid:"2",check:c[1],throughIndex:1}))),this.cells.reset(f),this.filterExcludeCells.reset(l),this.cells.length&&(this.checkCellTrigerBlock=!0,this.cells.at(0).set("check",u),this.checkCellTrigerBlock=undefined),this.btnOk.setDisabled(this.cells.length<1),this.cellsList.scroller.update({minScrollbarLength:40,alwaysVisibleY:!0,suppressScrollX:!0})},testFilter:function(){var e=this,t=!1;return this.cells&&(this.filter&&this.filteredIndexes[1]?t=!0:this.cells.forEach(function(e){if("1"==e.get("groupid")&&e.get("check"))return t=!0,!0})),t||(e._skipCheckDocumentClick=!0,Common.UI.warning({title:this.textWarning,msg:this.warnNoSelected,callback:function(){e._skipCheckDocumentClick=!1,_.delay(function(){e.input.$el.find("input").focus()},100,this)}})),t},save:function(){if(this.api&&this.configTo&&this.cells&&this.filterExcludeCells){var e=this.configTo.asc_getValues(),t=!1;if(this.filter&&this.filteredIndexes[1])this.initialFilterType===Asc.c_oAscAutoFilterTypes.CustomFilters&&e.forEach(function(e,t){e.asc_setVisible(!0)}),this.cells.each(function(t){"1"==t.get("groupid")&&e[parseInt(t.get("throughIndex"))-2].asc_setVisible(t.get("check"))}),e.forEach(function(e,n){if(e.asc_getVisible())return t=!0,!0});else{var n=this.filter?this.filteredIndexes:this.throughIndexes;e.forEach(function(e,t){e.asc_setVisible(n[t+2])}),t=!0}t&&(this.configTo.asc_getFilterObj().asc_setType(Asc.c_oAscAutoFilterTypes.Filters),this.api.asc_applyAutoFilter(this.configTo))}},onPrimary:function(){return this.save(),this.close(),!1},okButtonText:"Ok",btnCustomFilter:"Custom Filter",textSelectAll:"Select All",txtTitle:"Filter",warnNoSelected:"You must choose at least one value",textWarning:"Warning",cancelButtonText:"Cancel",textEmptyItem:"{Blanks}",txtEmpty:"Enter cell's filter",txtSortLow2High:"Sort Lowest to Highest",txtSortHigh2Low:"Sort Highest to Lowest",txtSortCellColor:"Sort by cells color",txtSortFontColor:"Sort by font color",txtNumFilter:"Number filter",txtTextFilter:"Text filter",txtFilterCellColor:"Filter by cells color",txtFilterFontColor:"Filter by font color",txtClear:"Clear",txtReapply:"Reapply",txtEquals:"Equals...",txtNotEquals:"Does not equal...",txtGreater:"Greater than...",txtGreaterEquals:"Greater than or equal to...",txtLess:"Less than...",txtLessEquals:"Less than or equal to...",txtBetween:"Between...",txtTop10:"Top 10",txtAboveAve:"Above average",txtBelowAve:"Below average",txtBegins:"Begins with...",txtNotBegins:"Does not begin with...",txtEnds:"Ends with...",txtNotEnds:"Does not end with...",txtContains:"Contains...",txtNotContains:"Does not contain...",textSelectAllResults:"Select All Search Results",textAddSelection:"Add current selection to filter"},SSE.Views.AutoFilterDialog||{}))}),define("spreadsheeteditor/main/app/controller/DocumentHolder",["core","common/main/lib/util/utils","common/main/lib/view/CopyWarningDialog","spreadsheeteditor/main/app/view/DocumentHolder","spreadsheeteditor/main/app/view/HyperlinkSettingsDialog","spreadsheeteditor/main/app/view/ParagraphSettingsAdvanced","spreadsheeteditor/main/app/view/ImageSettingsAdvanced","spreadsheeteditor/main/app/view/SetValueDialog","spreadsheeteditor/main/app/view/AutoFilterDialog"],function(){"use strict";SSE.Controllers.DocumentHolder=Backbone.Controller.extend(_.extend({models:[],collections:[],views:["DocumentHolder"],initialize:function(){var e=this;e.tooltips={hyperlink:{},comment:{},coauth:{ttHeight:20},row_column:{ttHeight:20}},e.mouse={},e.popupmenu=!1,e.rangeSelectionMode=!1,e.namedrange_locked=!1,e._currentMathObj=undefined,e._currentParaObjDisabled=!1,this.wrapEvents={apiHideComment:_.bind(this.onApiHideComment,this)},this.addListeners({DocumentHolder:{createdelayedelements:this.onCreateDelayedElements}});var t={};this.hkComments="alt+h",t[this.hkComments]=function(){e.onAddComment()},Common.util.Shortcuts.delegateShortcuts({shortcuts:t})},onLaunch:function(){var e=this;e.documentHolder=this.createView("DocumentHolder"),e.documentHolder.render(),e.documentHolder.el.tabIndex=-1,$(document).on("mousewheel",_.bind(e.onDocumentWheel,e)),$(document).on("mousedown",_.bind(e.onDocumentRightDown,e)),$(document).on("mouseup",_.bind(e.onDocumentRightUp,e)),$(document).on("keydown",_.bind(e.onDocumentKeyDown,e)),$(window).on("resize",_.bind(e.onDocumentResize,e));var t=SSE.getController("Viewport").getView("Viewport");t.hlayout.on("layout:resizedrag",_.bind(e.onDocumentResize,e)),Common.NotificationCenter.on({"window:show":function(t){e.hideHyperlinkTip()},"modal:show":function(t){e.hideCoAuthTips()},"layout:changed":function(t){e.hideHyperlinkTip(),e.hideCoAuthTips(),e.onDocumentResize()},"cells:range":function(t){e.onCellsRange(t)}})},onCreateDelayedElements:function(e){var t=this;e.pmiCut.on("click",_.bind(t.onCopyPaste,t)),e.pmiCopy.on("click",_.bind(t.onCopyPaste,t)),e.pmiPaste.on("click",_.bind(t.onCopyPaste,t)),e.pmiImgCut.on("click",_.bind(t.onCopyPaste,t)),e.pmiImgCopy.on("click",_.bind(t.onCopyPaste,t)),e.pmiImgPaste.on("click",_.bind(t.onCopyPaste,t)),e.pmiTextCut.on("click",_.bind(t.onCopyPaste,t)),e.pmiTextCopy.on("click",_.bind(t.onCopyPaste,t)),e.pmiTextPaste.on("click",_.bind(t.onCopyPaste,t)),e.pmiInsertEntire.on("click",_.bind(t.onInsertEntire,t)),e.pmiDeleteEntire.on("click",_.bind(t.onDeleteEntire,t)),e.pmiInsertCells.menu.on("item:click",_.bind(t.onInsertCells,t)),e.pmiDeleteCells.menu.on("item:click",_.bind(t.onDeleteCells,t)),e.pmiSparklines.menu.on("item:click",_.bind(t.onClear,t)),e.pmiSortCells.menu.on("item:click",_.bind(t.onSortCells,t)),e.pmiFilterCells.menu.on("item:click",_.bind(t.onFilterCells,t)),e.pmiReapply.on("click",_.bind(t.onReapply,t)),e.pmiClear.menu.on("item:click",_.bind(t.onClear,t)),e.pmiSelectTable.menu.on("item:click",_.bind(t.onSelectTable,t)),e.pmiInsertTable.menu.on("item:click",_.bind(t.onInsertTable,t)),e.pmiDeleteTable.menu.on("item:click",_.bind(t.onDeleteTable,t)),e.pmiInsFunction.on("click",_.bind(t.onInsFunction,t)),e.menuAddHyperlink.on("click",_.bind(t.onInsHyperlink,t)),e.menuEditHyperlink.on("click",_.bind(t.onInsHyperlink,t)),e.menuRemoveHyperlink.on("click",_.bind(t.onDelHyperlink,t)),e.pmiRowHeight.menu.on("item:click",_.bind(t.onSetSize,t)),e.pmiColumnWidth.menu.on("item:click",_.bind(t.onSetSize,t)),e.pmiEntireHide.on("click",_.bind(t.onEntireHide,t)),e.pmiEntireShow.on("click",_.bind(t.onEntireShow,t)),e.pmiFreezePanes.on("click",_.bind(t.onFreezePanes,t)),e.pmiEntriesList.on("click",_.bind(t.onEntriesList,t)),e.pmiAddComment.on("click",_.bind(t.onAddComment,t)),e.pmiAddNamedRange.on("click",_.bind(t.onAddNamedRange,t)),e.imgMenu.on("item:click",_.bind(t.onImgMenu,t)),e.menuParagraphVAlign.menu.on("item:click",_.bind(t.onParagraphVAlign,t)),e.menuParagraphDirection.menu.on("item:click",_.bind(t.onParagraphDirection,t)),e.menuAddHyperlinkShape.on("click",_.bind(t.onInsHyperlink,t)),e.menuEditHyperlinkShape.on("click",_.bind(t.onInsHyperlink,t)),e.menuRemoveHyperlinkShape.on("click",_.bind(t.onRemoveHyperlinkShape,t)),e.pmiTextAdvanced.on("click",_.bind(t.onTextAdvanced,t)),e.mnuShapeAdvanced.on("click",_.bind(t.onShapeAdvanced,t)),e.mnuChartEdit.on("click",_.bind(t.onChartEdit,t)),e.mnuImgAdvanced.on("click",_.bind(t.onImgAdvanced,t));var n=e.cmpEl;if(n){n.on({keydown:function(e){e.keyCode==e.F10&&e.shiftKey&&(e.stopEvent(),t.showObjectMenu(e))},mousedown:function(e){e.target.localName=="canvas"&&e.button!=2&&Common.UI.Menu.Manager.hideAll()},click:function(e){t.api&&(t.api.isTextAreaBlur=!1,e.target.localName=="canvas"&&!t.isEditFormula&&n.focus())}});var r=function(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e.attachEvent("on"+t,n)},i=/Firefox/i.test(navigator.userAgent)?"DOMMouseScroll":"mousewheel";r(e.el,i,_.bind(this.onDocumentWheel,this)),t.cellEditor=$("#ce-cell-content")}},loadConfig:function(e){this.editorConfig=e.config},setMode:function(e){this.permissions=e,this.permissions.canCoAuthoring&&this.permissions.isEdit&&this.permissions.canComments?Common.util.Shortcuts.resumeEvents(this.hkComments):Common.util.Shortcuts.suspendEvents(this.hkComments)},setApi:function(e){return this.api=e,this.api.asc_registerCallback("asc_onContextMenu",_.bind(this.onApiContextMenu,this)),this.api.asc_registerCallback("asc_onMouseMove",_.bind(this.onApiMouseMove,this)),this.api.asc_registerCallback("asc_onHideComment",this.wrapEvents.apiHideComment),this.api.asc_registerCallback("asc_onHyperlinkClick",_.bind(this.onApiHyperlinkClick,this)),this.api.asc_registerCallback("asc_onSetAFDialog",_.bind(this.onApiAutofilter,this)),this.api.asc_registerCallback("asc_onCoAuthoringDisconnect",_.bind(this.onApiCoAuthoringDisconnect,this)),Common.NotificationCenter.on("api:disconnect",_.bind(this.onApiCoAuthoringDisconnect,this)),this.api.asc_registerCallback("asc_onEditCell",_.bind(this.onApiEditCell,this)),this.api.asc_registerCallback("asc_onLockDefNameManager",_.bind(this.onLockDefNameManager,this)),this.api.asc_registerCallback("asc_onSelectionChanged",_.bind(this.onSelectionChanged,this)),this.api.asc_registerCallback("asc_onEntriesListMenu",_.bind(this.onEntriesListMenu,this)),this.api.asc_registerCallback("asc_onFormulaCompleteMenu",_.bind(this.onFormulaCompleteMenu,this)),this.api.asc_registerCallback("asc_onShowSpecialPasteOptions",_.bind(this.onShowSpecialPasteOptions,this)),this.api.asc_registerCallback("asc_onHideSpecialPasteOptions",_.bind(this.onHideSpecialPasteOptions,this)),this},resetApi:function(e){this.api.asc_unregisterCallback("asc_onHideComment",this.wrapEvents.apiHideComment),this.api.asc_registerCallback("asc_onHideComment",this.wrapEvents.apiHideComment)},onCopyPaste:function(e){var t=this;if(t.api){var n=e.value=="cut"?t.api.asc_Cut():e.value=="copy"?t.api.asc_Copy():t.api.asc_Paste();if(!n){var r=Common.localStorage.getItem("sse-hide-copywarning");(!r||parseInt(r)!=1)&&(new Common.Views.CopyWarningDialog({handler:function(e){e&&Common.localStorage.setItem("sse-hide-copywarning",1),Common.NotificationCenter.trigger("edit:complete",t.documentHolder)}})).show()}else Common.component.Analytics.trackEvent("ToolBar","Copy Warning")}Common.NotificationCenter.trigger("edit:complete",t.documentHolder)},onInsertEntire:function(e){if(this.api){switch(this.api.asc_getCellInfo().asc_getFlags().asc_getSelectionType()){case Asc.c_oAscSelectionType.RangeRow:this.api.asc_insertCells(Asc.c_oAscInsertOptions.InsertRows);break;case Asc.c_oAscSelectionType.RangeCol:this.api.asc_insertCells(Asc.c_oAscInsertOptions.InsertColumns)}Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Insert Entire")}},onInsertCells:function(e,t){this.api&&(this.api.asc_insertCells(t.value),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Insert Cells"))},onDeleteEntire:function(e){if(this.api){switch(this.api.asc_getCellInfo().asc_getFlags().asc_getSelectionType()){case Asc.c_oAscSelectionType.RangeRow:this.api.asc_deleteCells(Asc.c_oAscDeleteOptions.DeleteRows);break;case Asc.c_oAscSelectionType.RangeCol:this.api.asc_deleteCells(Asc.c_oAscDeleteOptions.DeleteColumns)}Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Delete Entire")}},onDeleteCells:function(e,t){this.api&&(this.api.asc_deleteCells(t.value),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Delete Cells"))},onSortCells:function(e,t){if(this.api){var n=this.api.asc_sortCellsRangeExpand();if(n){var r={width:500,title:this.txtSorting,msg:this.txtExpandSort,buttons:[{caption:this.txtExpand,primary:!0,value:"expand"},{caption:this.txtSortSelected,primary:!0,value:"sort"},"cancel"],callback:_.bind(function(e){(e=="expand"||e=="sort")&&this.api.asc_sortColFilter(t.value,"",undefined,t.value==Asc.c_oAscSortOptions.ByColorFill?this.documentHolder.ssMenu.cellColor:this.documentHolder.ssMenu.fontColor,e=="expand"),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Sort Cells")},this)};Common.UI.alert(r)}else this.api.asc_sortColFilter(t.value,"",undefined,t.value==Asc.c_oAscSortOptions.ByColorFill?this.documentHolder.ssMenu.cellColor:this.documentHolder.ssMenu.fontColor,n!==null),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Sort Cells")}},onFilterCells:function(e,t){if(this.api){var n=new Asc.AutoFiltersOptions,r=new Asc.AutoFilterObj;if(t.value>0){r.asc_setFilter(new Asc.ColorFilter),r.asc_setType(Asc.c_oAscAutoFilterTypes.ColorFilter);var i=r.asc_getFilter();i.asc_setCellColor(t.value==1?null:!1),i.asc_setCColor(t.value==1?this.documentHolder.ssMenu.cellColor:this.documentHolder.ssMenu.fontColor)}else{r.asc_setFilter(new Asc.CustomFilters),r.asc_setType(Asc.c_oAscAutoFilterTypes.CustomFilters);var s=r.asc_getFilter();s.asc_setCustomFilters([new Asc.CustomFilter]),s.asc_setAnd(!0);var o=s.asc_getCustomFilters();o[0].asc_setOperator(Asc.c_oAscCustomAutoFilter.equals)}n.asc_setFilterObj(r),this.api.asc_applyAutoFilterByType(n),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Filter Cells")}},onReapply:function(){this.api.asc_reapplyAutoFilter(this.documentHolder.ssMenu.formatTableName)},onClear:function(e,t){this.api&&(this.api.asc_emptyCells(t.value),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Clear"))},onSelectTable:function(e,t){this.api&&this.documentHolder.ssMenu.formatTableName&&(this.api.asc_changeSelectionFormatTable(this.documentHolder.ssMenu.formatTableName,t.value),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Select Table"))},onInsertTable:function(e,t){this.api&&this.documentHolder.ssMenu.formatTableName&&(this.api.asc_insertCellsInTable(this.documentHolder.ssMenu.formatTableName,t.value),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Insert to Table"))},onDeleteTable:function(e,t){this.api&&this.documentHolder.ssMenu.formatTableName&&(this.api.asc_deleteCellsInTable(this.documentHolder.ssMenu.formatTableName,t.value),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Delete from Table"))},onInsFunction:function(e){var t=this.getApplication().getController("FormulaDialog");t&&this.api&&t.showDialog()},onInsHyperlink:function(e){var t=this,n,r;if(t.api){var i=t.api.asc_getWorksheetsCount(),s=-1,o=[];while(++s<i)this.api.asc_isWorksheetHidden(s)||o.push({displayValue:t.api.asc_getWorksheetName(s),value:t.api.asc_getWorksheetName(s)});var u=function(e,n){n=="ok"&&(r=e.getSettings(),t.api.asc_insertHyperlink(r)),Common.NotificationCenter.trigger("edit:complete",t.documentHolder)},a=t.api.asc_getCellInfo();r=a.asc_getHyperlink(),n=new SSE.Views.HyperlinkSettingsDialog({api:t.api,handler:u}),n.show(),n.setSettings({sheets:o,currentSheet:t.api.asc_getWorksheetName(t.api.asc_getActiveWorksheetIndex()),props:r,text:a.asc_getText(),isLock:a.asc_getFlags().asc_getLockText(),allowInternal:e.options.inCell})}Common.component.Analytics.trackEvent("DocumentHolder","Add Hyperlink")},onDelHyperlink:function(e){this.api&&(this.api.asc_removeHyperlink(),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Remove Hyperlink"))},onSetSize:function(e,t){if(t.value=="row-height"||t.value=="column-width"){var n=this;(new SSE.Views.SetValueDialog({title:t.caption,startvalue:t.value=="row-height"?n.api.asc_getRowHeight():n.api.asc_getColumnWidth(),maxvalue:t.value=="row-height"?Asc.c_oAscMaxRowHeight:Asc.c_oAscMaxColumnWidth,step:t.value=="row-height"?.75:1,defaultUnit:t.value=="row-height"?Common.Utils.Metric.getMetricName(Common.Utils.Metric.c_MetricUnits.pt):n.textSym,handler:function(e,r){if(r=="ok"){var i=e.getSettings();isNaN(i)||(t.value=="row-height"?n.api.asc_setRowHeight(i):n.api.asc_setColumnWidth(i))}Common.NotificationCenter.trigger("edit:complete",n.documentHolder)}})).show()}else t.value=="auto-row-height"?this.api.asc_autoFitRowHeight():this.api.asc_autoFitColumnWidth(),Common.NotificationCenter.trigger("edit:complete",this.documentHolder)},onEntireHide:function(e){this.api&&this.api[e.isrowmenu?"asc_hideRows":"asc_hideColumns"]()},onEntireShow:function(e){this.api&&this.api[e.isrowmenu?"asc_showRows":"asc_showColumns"]()},onFreezePanes:function(e){this.api&&this.api.asc_freezePane()},onEntriesList:function(e){if(this.api){var t=this;setTimeout(function(){t.api.asc_showAutoComplete()},10)}},onAddComment:function(e){if(this.api&&this.permissions.canCoAuthoring&&this.permissions.isEdit&&this.permissions.canComments){var t=SSE.getController("Common.Controllers.Comments"),n=this.api.asc_getCellInfo();if(t){var r=n.asc_getComments();r.length?t.onEditComments(r):(this.permissions.canCoAuthoring||this.commentsCollection.getCommentsReplysCount()<3)&&t.addDummyComment()}}},onAddNamedRange:function(e){if(this.namedrange_locked){Common.NotificationCenter.trigger("namedrange:locked");return}var t=this,n=t.api.asc_getWorksheetsCount(),r=-1,i=[];while(++r<n)this.api.asc_isWorksheetHidden(r)||i.push({displayValue:t.api.asc_getWorksheetName(r),value:r});var s=function(e,n){e=="ok"&&n&&(t.api.asc_setDefinedNames(n),Common.component.Analytics.trackEvent("DocumentHolder","New Named Range")),Common.NotificationCenter.trigger("edit:complete",t.documentHolder)};(new SSE.Views.NamedRangeEditDlg({api:t.api,handler:s,sheets:i,currentSheet:t.api.asc_getActiveWorksheetIndex(),props:t.api.asc_getDefaultDefinedName(),isEdit:!1})).show()},onImgMenu:function(e,t){this.api&&(t.options.type=="arrange"?(this.api.asc_setSelectedDrawingObjectLayer(t.value),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Arrange")):t.options.type=="group"&&(this.api[t.value=="grouping"?"asc_groupGraphicsObjects":"asc_unGroupGraphicsObjects"](),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder",t.value=="grouping"?"Grouping":"Ungrouping")))},onParagraphVAlign:function(e,t){if(this.api){var n=new Asc.asc_CImgProperty;n.asc_putVerticalTextAlign(t.value),this.api.asc_setGraphicObjectProps(n),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Paragraph Vertical Align")}},onParagraphDirection:function(e,t){if(this.api){var n=new Asc.asc_CImgProperty;n.asc_putVert(t.options.direction),this.api.asc_setGraphicObjectProps(n),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Text Directio")}},onRemoveHyperlinkShape:function(e){this.api&&(this.api.asc_removeHyperlink(),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Remove Hyperlink"))},onTextAdvanced:function(e){var t=this;(new SSE.Views.ParagraphSettingsAdvanced({paragraphProps:e.textInfo,api:t.api,handler:function(e,n){e=="ok"&&t.api&&(t.api.asc_setGraphicObjectProps(n.paragraphProps),Common.component.Analytics.trackEvent("DocumentHolder","Apply advanced paragraph settings")),Common.NotificationCenter.trigger("edit:complete",t)}})).show()},onShapeAdvanced:function(e){var t=this;(new SSE.Views.ShapeSettingsAdvanced({shapeProps:e.shapeInfo,api:t.api,handler:function(e,n){e=="ok"&&t.api&&(t.api.asc_setGraphicObjectProps(n.shapeProps),Common.component.Analytics.trackEvent("DocumentHolder","Apply advanced shape settings")),Common.NotificationCenter.trigger("edit:complete",t)}})).show()},onImgAdvanced:function(e){var t=this;(new SSE.Views.ImageSettingsAdvanced({imageProps:e.imageInfo,api:t.api,handler:function(e,n){e=="ok"&&t.api&&(t.api.asc_setGraphicObjectProps(n.imageProps),Common.component.Analytics.trackEvent("DocumentHolder","Apply advanced image settings")),Common.NotificationCenter.trigger("edit:complete",t)}})).show()},onChartEdit:function(e){var t=this,n,r;t.api&&(r=t.api.asc_getChartObject(),r&&(new SSE.Views.ChartSettingsDlg({chartSettings:r,imageSettings:e.chartInfo,isChart:!0,api:t.api,handler:function(e,n){e=="ok"&&t.api&&(t.api.asc_editChartDrawingObject(n.chartSettings),n.imageSettings&&t.api.asc_setGraphicObjectProps(n.imageSettings)),Common.NotificationCenter.trigger("edit:complete",t)}})).show())},onApiCoAuthoringDisconnect:function(){this.permissions.isEdit=!1},hideCoAuthTips:function(){this.tooltips.coauth.ref&&($(this.tooltips.coauth.ref).remove(),this.tooltips.coauth.ref=undefined,this.tooltips.coauth.x_point=undefined,this.tooltips.coauth.y_point=undefined)},hideHyperlinkTip:function(){!this.tooltips.hyperlink.isHidden&&this.tooltips.hyperlink.ref&&(this.tooltips.hyperlink.ref.hide(),this.tooltips.hyperlink.isHidden=!0)},onApiMouseMove:function(e){if(!this._isFullscreenMenu&&e.length){var t,n,r,i,s;for(var o=e.length;o>0;o--)switch(e[o-1].asc_getType()){case Asc.c_oAscMouseMoveType.Hyperlink:t=o;break;case Asc.c_oAscMouseMoveType.Comment:n=o;break;case Asc.c_oAscMouseMoveType.LockedObject:r=o;break;case Asc.c_oAscMouseMoveType.ResizeColumn:i=o;break;case Asc.c_oAscMouseMoveType.ResizeRow:s=o}var u=this,a=[0,0],f=u.tooltips.coauth,l=u.tooltips.comment,c=u.tooltips.hyperlink,h=u.tooltips.row_column,p=[u.documentHolder.cmpEl.offset().left-$(window).scrollLeft(),u.documentHolder.cmpEl.offset().top-$(window).scrollTop()];c.isHidden=!1,h.isHidden=!1;var d=function(e){var t=SSE.getCollection("Common.Collections.Users");if(t){var n=t.findUser(e);if(n)return n.get("username")}return u.guestText};if(t){var v=e[t-1],m=v.asc_getHyperlink();if(m.asc_getType()==Asc.c_oAscHyperlinkType.WebLink){var g=m.asc_getTooltip();g?g=Common.Utils.String.htmlEncode(g)+"<br><b>"+u.textCtrlClick+"</b>":g=m.asc_getHyperlinkUrl()+"<br><b>"+u.textCtrlClick+"</b>"}else g=m.asc_getTooltip()||m.asc_getLocation();c.ref&&c.ref.isVisible()&&c.text!=g&&(c.ref.hide(),c.isHidden=!0);if(!c.ref||!c.ref.isVisible())c.text=g,c.ref=(new Common.UI.Tooltip({owner:u.documentHolder,html:!0,title:g})).on("tooltip:hide",function(e){c.ref=undefined,c.text=""}),c.ref.show([-1e4,-1e4]),c.isHidden=!1;a=[v.asc_getX(),v.asc_getY()],a[0]+=p[0]+6,a[1]+=p[1]-20,a[1]-=c.ref.getBSTip().$tip.height();var y=c.ref.getBSTip().$tip.width();a[0]+y>u.tooltips.coauth.bodyWidth&&(a[0]=u.tooltips.coauth.bodyWidth-y),c.ref.getBSTip().$tip.css({top:a[1]+"px",left:a[0]+"px"})}else u.hideHyperlinkTip();if(i!==undefined||s!==undefined){var v=e[i!==undefined?i-1:s-1],b=Common.Utils.String.format(i!==undefined?this.textChangeColumnWidth:this.textChangeRowHeight,v.asc_getSizeCCOrPt().toFixed(2),v.asc_getSizePx().toFixed());h.ref&&h.ref.isVisible()&&h.text!=b&&(h.text=b,h.ref.setTitle(b),h.ref.updateTitle());if(!h.ref||!h.ref.isVisible()){h.text=b,h.ref=(new Common.UI.Tooltip({owner:u.documentHolder,html:!0,title:b})).on("tooltip:hide",function(e){h.ref=undefined,h.text=""}),h.ref.show([-1e4,-1e4]),h.isHidden=!1,a=[v.asc_getX(),v.asc_getY()],a[0]+=p[0]+6,a[1]+=p[1]-20-h.ttHeight;var y=h.ref.getBSTip().$tip.width();a[0]+y>u.tooltips.coauth.bodyWidth&&(a[0]=u.tooltips.coauth.bodyWidth-y-20),h.ref.getBSTip().$tip.css({top:a[1]+"px",left:a[0]+"px"})}}else!h.isHidden&&h.ref&&(h.ref.hide(),h.isHidden=!0);if(u.permissions.isEdit){if(n&&!this.popupmenu){v=e[n-1];if(!l.editCommentId&&l.moveCommentId!=v.asc_getCommentIndexes()[0]){l.moveCommentId=v.asc_getCommentIndexes()[0],l.moveCommentTimer&&clearTimeout(l.moveCommentTimer);var w=v.asc_getCommentIndexes(),E=v.asc_getX(),S=v.asc_getY(),x=v.asc_getReverseX();l.moveCommentTimer=setTimeout(function(){if(l.moveCommentId&&!l.editCommentId){l.viewCommentId=l.moveCommentId;var e=u.getApplication().getController("Common.Controllers.Comments");e&&(e.isSelectedComment||e.onApiShowComment(w,E,S,x,!1,!0))}},400)}}else{l.moveCommentId=undefined;if(l.viewCommentId!=undefined){l={};var T=this.getApplication().getController("Common.Controllers.Comments");T&&(this.permissions.canCoAuthoring&&this.permissions.canComments?setTimeout(function(){T.onApiHideComment(!0)},200):T.onApiHideComment(!0))}}if(r){v=e[r-1],f.XY||u.onDocumentResize();if(f.x_point!=v.asc_getX()||f.y_point!=v.asc_getY()){u.hideCoAuthTips(),f.x_point=v.asc_getX(),f.y_point=v.asc_getY();var N=$(document.createElement("div")),C=v.asc_getLockedObjectType()==Asc.c_oAscMouseMoveLockedObjectType.Sheet||v.asc_getLockedObjectType()==Asc.c_oAscMouseMoveLockedObjectType.TableProperties;f.ref=N,N.addClass("username-tip"),N.css({height:f.ttHeight+"px",position:"absolute",zIndex:"900",visibility:"visible"}),$(document.body).append(N),a=[C?f.x_point+f.rightMenuWidth:f.bodyWidth-(f.x_point+f.XY[0]),f.y_point+f.XY[1]],a[1]>f.XY[1]&&a[1]+f.ttHeight<f.XY[1]+f.apiHeight&&(N.text(d(v.asc_getUserId())),f.bodyWidth-a[0]<f.ref.width()?N.css({visibility:"visible",left:"0px",top:a[1]-f.ttHeight+"px"}):N.css({visibility:"visible",right:a[0]+"px",top:a[1]+"px"}))}}else u.hideCoAuthTips()}}},onApiHideComment:function(){this.tooltips.comment.viewCommentId=this.tooltips.comment.editCommentId=this.tooltips.comment.moveCommentId=undefined},onApiHyperlinkClick:function(e){if(!e){Common.UI.alert({msg:this.errorInvalidLink,title:this.notcriticalErrorTitle,iconCls:"warn",buttons:["ok"],callback:_.bind(function(e){Common.NotificationCenter.trigger("edit:complete",this.documentHolder)},this)});return}if(this.api.asc_getUrlType(e)>0){var t=window.open(e,"_blank");t&&t.focus()}},onApiAutofilter:function(e){var t=this;if(t.permissions.isEdit&&!t.dlgFilter){t.dlgFilter=(new SSE.Views.AutoFilterDialog({api:this.api})).on({close:function(){t.api&&t.api.asc_enableKeyEvents(!0),t.dlgFilter=undefined}}),t.api&&t.api.asc_enableKeyEvents(!1),Common.UI.Menu.Manager.hideAll(),t.dlgFilter.setSettings(e);var n=t.documentHolder.cmpEl.offset(),r=e.asc_getCellCoord(),i=r.asc_getX()+r.asc_getWidth()+n.left,s=r.asc_getY()+r.asc_getHeight()+n.top,o=Common.Utils.innerWidth(),u=Common.Utils.innerHeight();i+t.dlgFilter.options.width>o&&(i=o-t.dlgFilter.options.width-5),s+t.dlgFilter.options.height>u&&(s=u-t.dlgFilter.options.height-5),t.dlgFilter.show(i,s)}},onApiContextMenu:function(e){var t=this;_.delay(function(){t.showObjectMenu.call(t,e)},10)},onAfterRender:function(e){},onDocumentResize:function(e){var t=this;t.documentHolder&&(t.tooltips.coauth.XY=[t.documentHolder.cmpEl.offset().left-$(window).scrollLeft(),t.documentHolder.cmpEl.offset().top-$(window).scrollTop()],t.tooltips.coauth.apiHeight=t.documentHolder.cmpEl.height(),t.tooltips.coauth.rightMenuWidth=$("#right-menu").width(),t.tooltips.coauth.bodyWidth=$(window).width())},onDocumentWheel:function(e){if(this.api&&!this.isEditCell){var t=_.isUndefined(e.originalEvent)?e.wheelDelta:e.originalEvent.wheelDelta;_.isUndefined(t)&&(t=e.deltaY);if((e.ctrlKey||e.metaKey)&&!e.altKey){var n=this.api.asc_getZoom();t<0?(n=Math.ceil(n*10)/10,n-=.1,n<.5||this.api.asc_setZoom(n)):t>0&&(n=Math.floor(n*10)/10,n+=.1,n>0&&!(n>2)&&this.api.asc_setZoom(n)),e.preventDefault(),e.stopPropagation()}}},onDocumentKeyDown:function(e){if(this.api){var t=e.keyCode;if((e.ctrlKey||e.metaKey)&&!e.shiftKey&&!e.altKey){if(t===Common.UI.Keys.NUM_PLUS||t===Common.UI.Keys.EQUALITY||Common.Utils.isOpera&&t==43){if(!this.api.isCellEdited){var n=Math.floor(this.api.asc_getZoom()*10)/10;return n+=.1,n>0&&!(n>2)&&this.api.asc_setZoom(n),e.preventDefault(),e.stopPropagation(),!1}}else if(t===Common.UI.Keys.NUM_MINUS||t===Common.UI.Keys.MINUS||Common.Utils.isOpera&&t==45)if(!this.api.isCellEdited)return n=Math.ceil(this.api.asc_getZoom()*10)/10,n-=.1,n<.5||this.api.asc_setZoom(n),e.preventDefault(),e.stopPropagation(),!1}else if(t==Common.UI.Keys.F10&&e.shiftKey)return this.showObjectMenu(e),e.preventDefault(),e.stopPropagation(),!1}},onDocumentRightDown:function(e){e.button==0&&(this.mouse.isLeftButtonDown=!0)},onDocumentRightUp:function(e){e.button==0&&(this.mouse.isLeftButtonDown=!1)},showObjectMenu:function(e){this.api&&this.permissions.isEdit&&!this.mouse.isLeftButtonDown&&!this.rangeSelectionMode&&this.fillMenuProps(this.api.asc_getCellInfo(),!0,e)},onSelectionChanged:function(e){this.permissions.isEdit&&!this.mouse.isLeftButtonDown&&!this.rangeSelectionMode&&this.currentMenu&&this.currentMenu.isVisible()&&this.fillMenuProps(e)},fillMenuProps:function(e,t,n){var r,i,s,o,u,a,f,l,c,h=this.documentHolder,p=e.asc_getFlags().asc_getSelectionType(),d=e.asc_getLocked(),v=e.asc_getLockedTable()===!0,m=!1,g=this.getApplication().getController("Common.Controllers.Comments"),y=!1,b=!1;if(this.permissions.isEditMailMerge)b=p==Asc.c_oAscSelectionType.RangeCells;else if(this.permissions.isEditDiagram)y=p==Asc.c_oAscSelectionType.RangeCells;else switch(p){case Asc.c_oAscSelectionType.RangeCells:r=!0;break;case Asc.c_oAscSelectionType.RangeRow:i=!0;break;case Asc.c_oAscSelectionType.RangeCol:s=!0;break;case Asc.c_oAscSelectionType.RangeMax:o=!0;break;case Asc.c_oAscSelectionType.RangeImage:a=!0;break;case Asc.c_oAscSelectionType.RangeShape:l=!0;break;case Asc.c_oAscSelectionType.RangeChart:u=!0;break;case Asc.c_oAscSelectionType.RangeChartText:c=!0;break;case Asc.c_oAscSelectionType.RangeShapeText:f=!0}if(a||l||u){if(!t&&!h.imgMenu.isVisible())return;a=l=u=!1;var w=!1,E=this.api.asc_getGraphicObjectProps();for(var S=0;S<E.length;S++)if(E[S].asc_getObjectType()==Asc.c_oAscTypeSelectElement.Image){var x=E[S].asc_getObjectValue();m=m||x.asc_getLocked();var T=x.asc_getShapeProperties();T?T.asc_getFromChart()?u=!0:(h.mnuShapeAdvanced.shapeInfo=x,l=!0):x.asc_getChartProperties()?(h.mnuChartEdit.chartInfo=x,u=!0,w=!0):(h.mnuImgAdvanced.imageInfo=x,a=!0)}h.mnuUnGroupImg.setDisabled(m||!this.api.asc_canUnGroupGraphicsObjects()),h.mnuGroupImg.setDisabled(m||!this.api.asc_canGroupGraphicsObjects()),h.mnuShapeAdvanced.setVisible(l&&!a&&!u),h.mnuShapeAdvanced.setDisabled(m),h.mnuChartEdit.setVisible(u&&!a&&!l&&w),h.mnuChartEdit.setDisabled(m),h.pmiImgCut.setDisabled(m),h.pmiImgPaste.setDisabled(m),h.mnuImgAdvanced.setVisible(a&&!l&&!u),h.mnuImgAdvanced.setDisabled(m),t&&this.showPopupMenu(h.imgMenu,{},n),h.mnuShapeSeparator.setVisible(h.mnuShapeAdvanced.isVisible()||h.mnuChartEdit.isVisible()||h.mnuImgAdvanced.isVisible())}else if(f||c){if(!t&&!h.textInShapeMenu.isVisible())return;h.pmiTextAdvanced.textInfo=undefined;var E=this.api.asc_getGraphicObjectProps(),N=!1;for(var S=0;S<E.length;S++){var C=E[S].asc_getObjectType();if(C==Asc.c_oAscTypeSelectElement.Image){var k=E[S].asc_getObjectValue(),L=k.asc_getVerticalTextAlign(),A=k.asc_getVert();m=m||k.asc_getLocked(),h.menuParagraphTop.setChecked(L==Asc.c_oAscVAlign.Top),h.menuParagraphCenter.setChecked(L==Asc.c_oAscVAlign.Center),h.menuParagraphBottom.setChecked(L==Asc.c_oAscVAlign.Bottom),h.menuParagraphDirectH.setChecked(A==Asc.c_oAscVertDrawingText.normal),h.menuParagraphDirect90.setChecked(A==Asc.c_oAscVertDrawingText.vert),h.menuParagraphDirect270.setChecked(A==Asc.c_oAscVertDrawingText.vert270)}else C==Asc.c_oAscTypeSelectElement.Paragraph?(h.pmiTextAdvanced.textInfo=E[S].asc_getObjectValue(),m=m||h.pmiTextAdvanced.textInfo.asc_getLocked()):C==Asc.c_oAscTypeSelectElement.Math&&(this._currentMathObj=E[S].asc_getObjectValue(),N=!0)}var O=e.asc_getHyperlink(),M=this.api.asc_canAddShapeHyperlink();h.menuHyperlinkShape.setVisible(f&&M!==!1&&O),h.menuAddHyperlinkShape.setVisible(f&&M!==!1&&!O),h.menuParagraphVAlign.setVisible(c!==!0&&!N),h.menuParagraphDirection.setVisible(c!==!0&&!N),h.pmiTextAdvanced.setVisible(h.pmiTextAdvanced.textInfo!==undefined),_.each(h.textInShapeMenu.items,function(e){e.setDisabled(m)}),h.pmiTextCopy.setDisabled(!1);var D=0;this._currentParaObjDisabled=m,N?D=this.addEquationMenu(4):this.clearEquationMenu(4),t&&this.showPopupMenu(h.textInShapeMenu,{},n),h.textInShapeMenu.items[3].setVisible(h.menuHyperlinkShape.isVisible()||h.menuAddHyperlinkShape.isVisible()||h.menuParagraphVAlign.isVisible()||N)}else if(!this.permissions.isEditMailMerge&&!this.permissions.isEditDiagram||p!==Asc.c_oAscSelectionType.RangeImage&&p!==Asc.c_oAscSelectionType.RangeShape&&p!==Asc.c_oAscSelectionType.RangeChart&&p!==Asc.c_oAscSelectionType.RangeChartText&&p!==Asc.c_oAscSelectionType.RangeShapeText){if(!t&&!h.ssMenu.isVisible())return;var P=this.api.isCellEdited,H=e.asc_getFormatTableInfo(),B=e.asc_getSparklineInfo()!==null,j=H!==null,F=e.asc_getFlags().asc_getMultiselect();h.ssMenu.formatTableName=j?H.asc_getTableName():null,h.ssMenu.cellColor=e.asc_getFill().asc_getColor(),h.ssMenu.fontColor=e.asc_getFont().asc_getColor(),h.pmiInsertEntire.setVisible(i||s),h.pmiInsertEntire.setCaption(i?this.textInsertTop:this.textInsertLeft),h.pmiDeleteEntire.setVisible(i||s),h.pmiInsertCells.setVisible(r&&!P&&!j),h.pmiDeleteCells.setVisible(r&&!P&&!j),h.pmiSelectTable.setVisible(r&&!P&&j),h.pmiInsertTable.setVisible(r&&!P&&j),h.pmiDeleteTable.setVisible(r&&!P&&j),h.pmiSparklines.setVisible(B),h.pmiSortCells.setVisible((r||o||b)&&!P),h.pmiFilterCells.setVisible((r||b)&&!P),h.pmiReapply.setVisible((r||o||b)&&!P),h.ssMenu.items[12].setVisible((r||o||b||B)&&!P),h.pmiInsFunction.setVisible(r||y),h.pmiAddNamedRange.setVisible(r&&!P),j&&(h.pmiInsertTable.menu.items[0].setDisabled(!H.asc_getIsInsertRowAbove()),h.pmiInsertTable.menu.items[1].setDisabled(!H.asc_getIsInsertRowBelow()),h.pmiInsertTable.menu.items[2].setDisabled(!H.asc_getIsInsertColumnLeft()),h.pmiInsertTable.menu.items[3].setDisabled(!H.asc_getIsInsertColumnRight()),h.pmiDeleteTable.menu.items[0].setDisabled(!H.asc_getIsDeleteRow()),h.pmiDeleteTable.menu.items[1].setDisabled(!H.asc_getIsDeleteColumn()),h.pmiDeleteTable.menu.items[2].setDisabled(!H.asc_getIsDeleteTable()));var O=e.asc_getHyperlink();h.menuHyperlink.setVisible(r&&O&&!P&&!F),h.menuAddHyperlink.setVisible(r&&!O&&!P&&!F),h.pmiRowHeight.setVisible(i||o),h.pmiColumnWidth.setVisible(s||o),h.pmiEntireHide.setVisible(s||i),h.pmiEntireShow.setVisible(s||i),h.pmiFreezePanes.setVisible(!P),h.pmiFreezePanes.setCaption(this.api.asc_getSheetViewSettings().asc_getIsFreezePane()?h.textUnFreezePanes:h.textFreezePanes),h.pmiEntriesList.setVisible(!P),h.ssMenu.items[17].setVisible(r&&!P&&this.permissions.canCoAuthoring&&this.permissions.canComments),h.pmiAddComment.setVisible(r&&!P&&this.permissions.canCoAuthoring&&this.permissions.canComments),h.pmiCellMenuSeparator.setVisible(r||i||s||o||y),h.pmiEntireHide.isrowmenu=i,h.pmiEntireShow.isrowmenu=i,h.setMenuItemCommentCaptionMode(e.asc_getComments().length<1,this.permissions.canEditComments),g&&g.blockPopover(!0),h.pmiClear.menu.items[1].setDisabled(P),h.pmiClear.menu.items[2].setDisabled(P),h.pmiClear.menu.items[3].setDisabled(P),h.pmiClear.menu.items[4].setDisabled(P),h.pmiClear.menu.items[3].setVisible(!this.permissions.isEditDiagram),h.pmiClear.menu.items[4].setVisible(!this.permissions.isEditDiagram);var I=e.asc_getAutoFilterInfo(),q=I?I.asc_getIsApplyAutoFilter():!1;I=I?I.asc_getIsAutoFilter():null,h.pmiInsertCells.menu.items[0].setDisabled(q),h.pmiDeleteCells.menu.items[0].setDisabled(q),h.pmiInsertCells.menu.items[1].setDisabled(q),h.pmiDeleteCells.menu.items[1].setDisabled(q),_.each(h.ssMenu.items,function(e){e.setDisabled(d)}),h.pmiCopy.setDisabled(!1),h.pmiInsertEntire.setDisabled(d||v),h.pmiInsertCells.setDisabled(d||v),h.pmiInsertTable.setDisabled(d||v),h.pmiDeleteEntire.setDisabled(d||v),h.pmiDeleteCells.setDisabled(d||v),h.pmiDeleteTable.setDisabled(d||v),h.pmiFilterCells.setDisabled(d||v||I==null),h.pmiSortCells.setDisabled(d||v||I==null),h.pmiReapply.setDisabled(d||v||q!==!0),t&&this.showPopupMenu(h.ssMenu,{},n)}else if(this.permissions.isEditDiagram&&p==Asc.c_oAscSelectionType.RangeChartText){if(!t&&!h.textInShapeMenu.isVisible())return;h.pmiTextAdvanced.textInfo=undefined,h.menuHyperlinkShape.setVisible(!1),h.menuAddHyperlinkShape.setVisible(!1),h.menuParagraphVAlign.setVisible(!1),h.menuParagraphDirection.setVisible(!1),h.pmiTextAdvanced.setVisible(!1),h.textInShapeMenu.items[3].setVisible(!1),h.textInShapeMenu.items[8].setVisible(!1),h.pmiTextCopy.setDisabled(!1),t&&this.showPopupMenu(h.textInShapeMenu,{},n)}},showPopupMenu:function(e,t,n){if(!_.isUndefined(e)&&e!==null){Common.UI.Menu.Manager.hideAll();var r=this,i=r.documentHolder,s=[n.pageX*Common.Utils.zoom()-i.cmpEl.offset().left,n.pageY*Common.Utils.zoom()-i.cmpEl.offset().top],o=i.cmpEl.find(Common.Utils.String.format("#menu-container-{0}",e.id));e.rendered||(o.length<1&&(o=$(Common.Utils.String.format('<div id="menu-container-{0}" style="position: absolute; z-index: 10000;"><div class="dropdown-toggle" data-toggle="dropdown"></div></div>',e.id)),i.cmpEl.append(o)),e.render(o),e.cmpEl.attr({tabindex:"-1"}));if(n.button!==2){var u=r.api.asc_getActiveCellCoord(),a={left:0,top:0};s[0]=u.asc_getX()+u.asc_getWidth()+a.left,s[1]=(u.asc_getY()<0?0:u.asc_getY())+u.asc_getHeight()+a.top}o.css({left:s[0],top:s[1]}),_.isFunction(e.options.initMenu)&&(e.options.initMenu(t),e.alignPosition()),_.delay(function(){e.cmpEl.focus()},10),e.show(),r.currentMenu=e}},onEntriesListMenu:function(e){if(e&&e.length>0){var t=this,n=t.documentHolder,r=n.entriesMenu,i=n.cmpEl.find(Common.Utils.String.format("#menu-container-{0}",r.id));for(var s=0;s<r.items.length;s++)r.removeItem(r.items[s]),s--;_.each(e,function(e,n){var i=(new Common.UI.MenuItem({caption:e})).on("click",function(e,n){t.api.asc_insertFormula(e.caption,Asc.c_oAscPopUpSelectorType.None,!1)});r.addItem(i)}),Common.UI.Menu.Manager.hideAll(),r.rendered||(i.length<1&&(i=$(Common.Utils.String.format('<div id="menu-container-{0}" style="position: absolute; z-index: 10000;"><div class="dropdown-toggle" data-toggle="dropdown"></div></div>',r.id)),n.cmpEl.append(i)),r.render(i),r.cmpEl.attr({tabindex:"-1"}));var o=t.api.asc_getActiveCellCoord(),u={left:0,top:0},a=[o.asc_getX()+u.left,(o.asc_getY()<0?0:o.asc_getY())+o.asc_getHeight()+u.top];i.css({left:a[0],top:a[1]}),r.show(),r.alignPosition(),_.delay(function(){r.cmpEl.focus()},10)}else this.documentHolder.entriesMenu.hide(),Common.UI.warning({title:this.notcriticalErrorTitle,maxwidth:600,msg:this.txtNoChoices,callback:_.bind(function(e){Common.NotificationCenter.trigger("edit:complete",this.documentHolder)},this)})},onFormulaCompleteMenu:function(e){if(e){var t=this,n=t.documentHolder,r=n.funcMenu,i=n.cmpEl.find("#menu-formula-selection");for(var s=0;s<r.items.length;s++)r.removeItem(r.items[s]),s--;_.each(e,function(e,n){var i=e.asc_getType(),s=(new Common.UI.MenuItem({iconCls:i==Asc.c_oAscPopUpSelectorType.Func?"mnu-popup-func":i==Asc.c_oAscPopUpSelectorType.Table?"mnu-popup-table":"mnu-popup-range",caption:e.asc_getName()})).on("click",function(e,n){setTimeout(function(){t.api.asc_insertFormula(e.caption,i,!1)},10)});r.addItem(s)}),r.rendered||(i.length<1&&(i=$(Common.Utils.String.format('<div id="menu-formula-selection" style="position: absolute; z-index: 10000;" class="no-stop-propagate"><div class="dropdown-toggle" data-toggle="dropdown"></div></div>')),n.cmpEl.append(i)),r.onAfterKeydownMenu=function(e){if(e.keyCode==Common.UI.Keys.RETURN&&(e.ctrlKey||e.altKey))return;var t;arguments.length>1&&arguments[1]instanceof KeyboardEvent&&(e=arguments[1]);if(i.hasClass("open"))if(e.keyCode==Common.UI.Keys.TAB||e.keyCode==Common.UI.Keys.RETURN&&!e.ctrlKey&&!e.altKey)t=i.find("a.focus").closest("li");else if(e.keyCode==Common.UI.Keys.UP||e.keyCode==Common.UI.Keys.DOWN){var n=r.cmpEl,s=n.offset().top,o=i.find("a.focus").closest("li"),u=o.offset().top;if(u<s||u+o.outerHeight()>s+n.height())r.scroller?r.scroller.scrollTop(n.scrollTop()+u-s,0):n.scrollTop(n.scrollTop()+u-s)}t&&(t.length>0&&t.click(),Common.UI.Menu.Manager.hideAll())},r.render(i),r.cmpEl.attr({tabindex:"-1"}));var o=t.api.asc_getActiveCellCoord(),u={left:0,top:0},a=[o.asc_getX()+u.left,(o.asc_getY()<0?0:o.asc_getY())+o.asc_getHeight()+u.top];i.css({left:a[0],top:a[1]}),r.alignPosition();var f=t.cellEditor.is(":focus");r.isVisible()||Common.UI.Menu.Manager.hideAll(),_.delay(function(){r.isVisible()||r.show(),r.scroller&&(r.scroller.update({alwaysVisibleY:!0}),r.scroller.scrollTop(0)),f&&t.cellEditor.focus(),r.cmpEl.toggleClass("from-cell-edit",f),_.delay(function(){r.cmpEl.find("li:first a").addClass("focus")},10),f||_.delay(function(){r.cmpEl.focus()},10)},1)}else this.documentHolder.funcMenu.hide()},onShowSpecialPasteOptions:function(e){var t=this,n=t.documentHolder,r=e.asc_getCellCoord(),i=n.cmpEl.find("#special-paste-container"),s=e.asc_getOptions();i.length<1&&(t._arrSpecialPaste=[],t._arrSpecialPaste[Asc.c_oSpecialPasteProps.paste]=t.txtPaste,t._arrSpecialPaste[Asc.c_oSpecialPasteProps.pasteOnlyFormula]=t.txtPasteFormulas,t._arrSpecialPaste[Asc.c_oSpecialPasteProps.formulaNumberFormat]=t.txtPasteFormulaNumFormat,t._arrSpecialPaste[Asc.c_oSpecialPasteProps.formulaAllFormatting]=t.txtPasteKeepSourceFormat,t._arrSpecialPaste[Asc.c_oSpecialPasteProps.formulaWithoutBorders]=t.txtPasteBorders,t._arrSpecialPaste[Asc.c_oSpecialPasteProps.formulaColumnWidth]=t.txtPasteColWidths,t._arrSpecialPaste[Asc.c_oSpecialPasteProps.mergeConditionalFormating]=t.txtPasteMerge,t._arrSpecialPaste[Asc.c_oSpecialPasteProps.pasteOnlyValues]=t.txtPasteValues,t._arrSpecialPaste[Asc.c_oSpecialPasteProps.valueNumberFormat]=t.txtPasteValNumFormat,t._arrSpecialPaste[Asc.c_oSpecialPasteProps.valueAllFormating]=t.txtPasteValFormat,t._arrSpecialPaste[Asc.c_oSpecialPasteProps.pasteOnlyFormating]=t.txtPasteFormat,t._arrSpecialPaste[Asc.c_oSpecialPasteProps.transpose]=t.txtPasteTranspose,t._arrSpecialPaste[Asc.c_oSpecialPasteProps.link]=t.txtPasteLink,t._arrSpecialPaste[Asc.c_oSpecialPasteProps.picture]=t.txtPastePicture,t._arrSpecialPaste[Asc.c_oSpecialPasteProps.linkedPicture]=t.txtPasteLinkPicture,t._arrSpecialPaste[Asc.c_oSpecialPasteProps.sourceformatting]=t.txtPasteSourceFormat,t._arrSpecialPaste[Asc.c_oSpecialPasteProps.destinationFormatting]=t.txtPasteDestFormat,i=$('<div id="special-paste-container" style="position: absolute;"><div id="id-document-holder-btn-special-paste"></div></div>'),n.cmpEl.append(i),t.btnSpecialPaste=new Common.UI.Button({cls:"btn-toolbar",iconCls:"btn-paste",menu:new Common.UI.Menu({items:[]})}),t.btnSpecialPaste.render($("#id-document-holder-btn-special-paste")));if(s.length>0){var o=t.btnSpecialPaste.menu;for(var u=0;u<o.items.length;u++)o.removeItem(o.items[u]),u--;var a=-1;_.each(s,function(e,n){var r=e<7?0:e>9?2:1;a!==r&&a>=0&&o.addItem(new Common.UI.MenuItem({caption:"--"})),a=r;var i=(new Common.UI.MenuItem({caption:t._arrSpecialPaste[e],value:e,checkable:!0,toggleGroup:"specialPasteGroup"})).on("click",function(e,n){var r=new Asc.SpecialPasteProps;r.asc_setProps(e.value),t.api.asc_SpecialPaste(r),setTimeout(function(){o.hide()},100)});o.addItem(i)}),o.items.length>0&&o.items[0].setChecked(!0,!0)}if(r.asc_getX()<0||r.asc_getY()<0)i.is(":visible")&&i.hide();else{var f=[r.asc_getX()+r.asc_getWidth()+3,r.asc_getY()+r.asc_getHeight()+3];i.css({left:f[0],top:f[1]}),i.show()}},onHideSpecialPasteOptions:function(){var e=this.documentHolder.cmpEl.find("#special-paste-container");e.is(":visible")&&e.hide()},onCellsRange:function(e){this.rangeSelectionMode=e!=Asc.c_oAscSelectionDialogType.None},onApiEditCell:function(e){this.isEditFormula=e==Asc.c_oAscCellEditorState.editFormula,this.isEditCell=e!=Asc.c_oAscCellEditorState.editEnd},onLockDefNameManager:function(e){this.namedrange_locked=e==Asc.c_oAscDefinedNameReason.LockDefNameManager},initEquationMenu:function(){if(!this._currentMathObj)return;var e=this,t=e._currentMathObj.get_Type(),n=e._currentMathObj,r,i=[];switch(t){case Asc.c_oAscMathInterfaceType.Accent:r=new Common.UI.MenuItem({caption:e.txtRemoveAccentChar,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:t,callback:"remove_AccentCharacter"}}),i.push(r);break;case Asc.c_oAscMathInterfaceType.BorderBox:r=new Common.UI.MenuItem({caption:e.txtBorderProps,equation:!0,disabled:e._currentParaObjDisabled,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{caption:n.get_HideTop()?e.txtAddTop:e.txtHideTop,equationProps:{type:t,callback:"put_HideTop",value:!n.get_HideTop()}},{caption:n.get_HideBottom()?e.txtAddBottom:e.txtHideBottom,equationProps:{type:t,callback:"put_HideBottom",value:!n.get_HideBottom()}},{caption:n.get_HideLeft()?e.txtAddLeft:e.txtHideLeft,equationProps:{type:t,callback:"put_HideLeft",value:!n.get_HideLeft()}},{caption:n.get_HideRight()?e.txtAddRight:e.txtHideRight,equationProps:{type:t,callback:"put_HideRight",value:!n.get_HideRight()}},{caption:n.get_HideHor()?e.txtAddHor:e.txtHideHor,equationProps:{type:t,callback:"put_HideHor",value:!n.get_HideHor()}},{caption:n.get_HideVer()?e.txtAddVer:e.txtHideVer,equationProps:{type:t,callback:"put_HideVer",value:!n.get_HideVer()}},{caption:n.get_HideTopLTR()?e.txtAddLT:e.txtHideLT,equationProps:{type:t,callback:"put_HideTopLTR",value:!n.get_HideTopLTR()}},{caption:n.get_HideTopRTL()?e.txtAddLB:e.txtHideLB,equationProps:{type:t,callback:"put_HideTopRTL",value:!n.get_HideTopRTL()}}]})}),i.push(r);break;case Asc.c_oAscMathInterfaceType.Bar:r=new Common.UI.MenuItem({caption:e.txtRemoveBar,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:t,callback:"remove_Bar"}}),i.push(r),r=new Common.UI.MenuItem({caption:n.get_Pos()==Asc.c_oAscMathInterfaceBarPos.Top?e.txtUnderbar:e.txtOverbar,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:t,callback:"put_Pos",value:n.get_Pos()==Asc.c_oAscMathInterfaceBarPos.Top?Asc.c_oAscMathInterfaceBarPos.Bottom:Asc.c_oAscMathInterfaceBarPos.Top}}),i.push(r);break;case Asc.c_oAscMathInterfaceType.Script:var s=n.get_ScriptType();if(s==Asc.c_oAscMathInterfaceScript.PreSubSup)r=new Common.UI.MenuItem({caption:e.txtScriptsAfter,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:t,callback:"put_ScriptType",value:Asc.c_oAscMathInterfaceScript.SubSup}}),i.push(r),r=new Common.UI.MenuItem({caption:e.txtRemScripts,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:t,callback:"put_ScriptType",value:Asc.c_oAscMathInterfaceScript.None}}),i.push(r);else{s==Asc.c_oAscMathInterfaceScript.SubSup&&(r=new Common.UI.MenuItem({caption:e.txtScriptsBefore,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:t,callback:"put_ScriptType",value:Asc.c_oAscMathInterfaceScript.PreSubSup}}),i.push(r));if(s==Asc.c_oAscMathInterfaceScript.SubSup||s==Asc.c_oAscMathInterfaceScript.Sub)r=new Common.UI.MenuItem({caption:e.txtRemSubscript,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:t,callback:"put_ScriptType",value:s==Asc.c_oAscMathInterfaceScript.SubSup?Asc.c_oAscMathInterfaceScript.Sup:Asc.c_oAscMathInterfaceScript.None}}),i.push(r);if(s==Asc.c_oAscMathInterfaceScript.SubSup||s==Asc.c_oAscMathInterfaceScript.Sup)r=new Common.UI.MenuItem({caption:e.txtRemSuperscript,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:t,callback:"put_ScriptType",value:s==Asc.c_oAscMathInterfaceScript.SubSup?Asc.c_oAscMathInterfaceScript.Sub:Asc.c_oAscMathInterfaceScript.None}}),i.push(r)}break;case Asc.c_oAscMathInterfaceType.Fraction:var o=n.get_FractionType();if(o==Asc.c_oAscMathInterfaceFraction.Skewed||o==Asc.c_oAscMathInterfaceFraction.Linear)r=new Common.UI.MenuItem({caption:e.txtFractionStacked,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:t,callback:"put_FractionType",value:Asc.c_oAscMathInterfaceFraction.Bar}}),i.push(r);if(o==Asc.c_oAscMathInterfaceFraction.Bar||o==Asc.c_oAscMathInterfaceFraction.Linear)r=new Common.UI.MenuItem({caption:e.txtFractionSkewed,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:t,callback:"put_FractionType",value:Asc.c_oAscMathInterfaceFraction.Skewed}}),i.push(r);if(o==Asc.c_oAscMathInterfaceFraction.Bar||o==Asc.c_oAscMathInterfaceFraction.Skewed)r=new Common.UI.MenuItem({caption:e.txtFractionLinear,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:t,callback:"put_FractionType",value:Asc.c_oAscMathInterfaceFraction.Linear}}),i.push(r);if(o==Asc.c_oAscMathInterfaceFraction.Bar||o==Asc.c_oAscMathInterfaceFraction.NoBar)r=new Common.UI.MenuItem({caption:o==Asc.c_oAscMathInterfaceFraction.Bar?e.txtRemFractionBar:e.txtAddFractionBar,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:t,callback:"put_FractionType",value:o==Asc.c_oAscMathInterfaceFraction.Bar?Asc.c_oAscMathInterfaceFraction.NoBar:Asc.c_oAscMathInterfaceFraction.Bar}}),i.push(r);break;case Asc.c_oAscMathInterfaceType.Limit:r=new Common.UI.MenuItem({caption:n.get_Pos()==Asc.c_oAscMathInterfaceLimitPos.Top?e.txtLimitUnder:e.txtLimitOver,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:t,callback:"put_Pos",value:n.get_Pos()==Asc.c_oAscMathInterfaceLimitPos.Top?Asc.c_oAscMathInterfaceLimitPos.Bottom:Asc.c_oAscMathInterfaceLimitPos.Top}}),i.push(r),r=new Common.UI.MenuItem({caption:e.txtRemLimit,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:t,callback:"put_Pos",value:Asc.c_oAscMathInterfaceLimitPos.None}}),i.push(r);break;case Asc.c_oAscMathInterfaceType.Matrix:r=new Common.UI.MenuItem({caption:n.get_HidePlaceholder()?e.txtShowPlaceholder:e.txtHidePlaceholder,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:t,callback:"put_HidePlaceholder",value:!n.get_HidePlaceholder()}}),i.push(r),r=new Common.UI.MenuItem({caption:e.insertText,equation:!0,disabled:e._currentParaObjDisabled,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{caption:e.insertRowAboveText,equationProps:{type:t,callback:"insert_MatrixRow",value:!0}},{caption:e.insertRowBelowText,equationProps:{type:t,callback:"insert_MatrixRow",value:!1}},{caption:e.insertColumnLeftText,equationProps:{type:t,callback:"insert_MatrixColumn",value:!0}},{caption:e.insertColumnRightText,equationProps:{type:t,callback:"insert_MatrixColumn",value:!1}}]})}),i.push(r),r=new Common.UI.MenuItem({caption:e.deleteText,equation:!0,disabled:e._currentParaObjDisabled,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{caption:e.deleteRowText,equationProps:{type:t,callback:"delete_MatrixRow"}},{caption:e.deleteColumnText,equationProps:{type:t,callback:"delete_MatrixColumn"}}]})}),i.push(r),r=new Common.UI.MenuItem({caption:e.txtMatrixAlign,equation:!0,disabled:e._currentParaObjDisabled,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{caption:e.txtTop,checkable:!0,checked:n.get_MatrixAlign()==Asc.c_oAscMathInterfaceMatrixMatrixAlign.Top,equationProps:{type:t,callback:"put_MatrixAlign",value:Asc.c_oAscMathInterfaceMatrixMatrixAlign.Top}},{caption:e.centerText,checkable:!0,checked:n.get_MatrixAlign()==Asc.c_oAscMathInterfaceMatrixMatrixAlign.Center,equationProps:{type:t,callback:"put_MatrixAlign",value:Asc.c_oAscMathInterfaceMatrixMatrixAlign.Center}},{caption:e.txtBottom,checkable:!0,checked:n.get_MatrixAlign()==Asc.c_oAscMathInterfaceMatrixMatrixAlign.Bottom,equationProps:{type:t,callback:"put_MatrixAlign",value:Asc.c_oAscMathInterfaceMatrixMatrixAlign.Bottom}}]})}),i.push(r),r=new Common.UI.MenuItem({caption:e.txtColumnAlign,equation:!0,disabled:e._currentParaObjDisabled,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{caption:e.leftText,checkable:!0,checked:n.get_ColumnAlign()==Asc.c_oAscMathInterfaceMatrixColumnAlign.Left,equationProps:{type:t,callback:"put_ColumnAlign",value:Asc.c_oAscMathInterfaceMatrixColumnAlign.Left}},{caption:e.centerText,checkable:!0,checked:n.get_ColumnAlign()==Asc.c_oAscMathInterfaceMatrixColumnAlign.Center,equationProps:{type:t,callback:"put_ColumnAlign",value:Asc.c_oAscMathInterfaceMatrixColumnAlign.Center}},{caption:e.rightText,checkable:!0,checked:n.get_ColumnAlign()==Asc.c_oAscMathInterfaceMatrixColumnAlign.Right,equationProps:{type:t,callback:"put_ColumnAlign",value:Asc.c_oAscMathInterfaceMatrixColumnAlign.Right}}]})}),i.push(r);break;case Asc.c_oAscMathInterfaceType.EqArray:r=new Common.UI.MenuItem({caption:e.txtInsertEqBefore,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:t,callback:"insert_Equation",value:!0}}),i.push(r),r=new Common.UI.MenuItem({caption:e.txtInsertEqAfter,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:t,callback:"insert_Equation",value:!1}}),i.push(r),r=new Common.UI.MenuItem({caption:e.txtDeleteEq,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:t,callback:"delete_Equation"}}),i.push(r),r=new Common.UI.MenuItem({caption:e.alignmentText,equation:!0,disabled:e._currentParaObjDisabled,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{caption:e.txtTop,checkable:!0,checked:n.get_Align()==Asc.c_oAscMathInterfaceEqArrayAlign.Top,equationProps:{type:t,callback:"put_Align",value:Asc.c_oAscMathInterfaceEqArrayAlign.Top}},{caption:e.centerText,checkable:!0,checked:n.get_Align()==Asc.c_oAscMathInterfaceEqArrayAlign.Center,equationProps:{type:t,callback:"put_Align",value:Asc.c_oAscMathInterfaceEqArrayAlign.Center}},{caption:e.txtBottom,checkable:!0,checked:n.get_Align()==Asc.c_oAscMathInterfaceEqArrayAlign.Bottom,equationProps:{type:t,callback:"put_Align",value:Asc.c_oAscMathInterfaceEqArrayAlign.Bottom}}]})}),i.push(r);break;case Asc.c_oAscMathInterfaceType.LargeOperator:r=new Common.UI.MenuItem({caption:e.txtLimitChange,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:t,callback:"put_LimitLocation",value:n.get_LimitLocation()==Asc.c_oAscMathInterfaceNaryLimitLocation.UndOvr?Asc.c_oAscMathInterfaceNaryLimitLocation.SubSup:Asc.c_oAscMathInterfaceNaryLimitLocation.UndOvr}}),i.push(r),n.get_HideUpper()!==undefined&&(r=new Common.UI.MenuItem({caption:n.get_HideUpper()?e.txtShowTopLimit:e.txtHideTopLimit,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:t,callback:"put_HideUpper",value:!n.get_HideUpper()}}),i.push(r)),n.get_HideLower()!==undefined&&(r=new Common.UI.MenuItem({caption:n.get_HideLower()?e.txtShowBottomLimit:e.txtHideBottomLimit,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:t,callback:"put_HideLower",value:!n.get_HideLower()}}),i.push(r));break;case Asc.c_oAscMathInterfaceType.Delimiter:r=new Common.UI.MenuItem({caption:e.txtInsertArgBefore,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:t,callback:"insert_DelimiterArgument",value:!0}}),i.push(r),r=new Common.UI.MenuItem({caption:e.txtInsertArgAfter,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:t,callback:"insert_DelimiterArgument",value:!1}}),i.push(r),n.can_DeleteArgument()&&(r=new Common.UI.MenuItem({caption:e.txtDeleteArg,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:t,callback:"delete_DelimiterArgument"}}),i.push(r)),r=new Common.UI.MenuItem({caption:n.has_Separators()?e.txtDeleteCharsAndSeparators:e.txtDeleteChars,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:t,callback:"remove_DelimiterCharacters"}}),i.push(r),r=new Common.UI.MenuItem({caption:n.get_HideOpeningBracket()?e.txtShowOpenBracket:e.txtHideOpenBracket,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:t,callback:"put_HideOpeningBracket",value:!n.get_HideOpeningBracket()}}),i.push(r),r=new Common.UI.MenuItem({caption:n.get_HideClosingBracket()?e.txtShowCloseBracket:e.txtHideCloseBracket,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:t,callback:"put_HideClosingBracket",value:!n.get_HideClosingBracket()}}),i.push(r),r=new Common.UI.MenuItem({caption:e.txtStretchBrackets,equation:!0,disabled:e._currentParaObjDisabled,checkable:!0,checked:n.get_StretchBrackets(),equationProps:{type:t,callback:"put_StretchBrackets",value:!n.get_StretchBrackets()}}),i.push(r),r=new Common.UI.MenuItem({caption:e.txtMatchBrackets,equation:!0,disabled:!n.get_StretchBrackets()||e._currentParaObjDisabled,checkable:!0,checked:n.get_StretchBrackets()&&n.get_MatchBrackets(),equationProps:{type:t,callback:"put_MatchBrackets",value:!n.get_MatchBrackets()}}),i.push(r);break;case Asc.c_oAscMathInterfaceType.GroupChar:n.can_ChangePos()&&(r=new Common.UI.MenuItem({caption:n.get_Pos()==Asc.c_oAscMathInterfaceGroupCharPos.Top?e.txtGroupCharUnder:e.txtGroupCharOver,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:t,callback:"put_Pos",value:n.get_Pos()==Asc.c_oAscMathInterfaceGroupCharPos.Top?Asc.c_oAscMathInterfaceGroupCharPos.Bottom:Asc.c_oAscMathInterfaceGroupCharPos.Top}}),i.push(r),r=new Common.UI.MenuItem({caption:e.txtDeleteGroupChar,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:t,callback:"put_Pos",value:Asc.c_oAscMathInterfaceGroupCharPos.None}}),i.push(r));break;case Asc.c_oAscMathInterfaceType.Radical:n.get_HideDegree()!==undefined&&(r=new Common.UI.MenuItem({caption:n.get_HideDegree()?e.txtShowDegree:e.txtHideDegree,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:t,callback:"put_HideDegree",value:!n.get_HideDegree()}}),i.push(r)),r=new Common.UI.MenuItem({caption:e.txtDeleteRadical,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:t,callback:"remove_Radical"}}),i.push(r)}return n.can_IncreaseArgumentSize()&&(r=new Common.UI.MenuItem({caption:e.txtIncreaseArg,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:t,callback:"increase_ArgumentSize"}}),i.push(r)),n.can_DecreaseArgumentSize()&&(r=new Common.UI.MenuItem({caption:e.txtDecreaseArg,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:t,callback:"decrease_ArgumentSize"}}),i.push(r)),n.can_InsertManualBreak()&&(r=new Common.UI.MenuItem({caption:e.txtInsertBreak,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:t,callback:"insert_ManualBreak"}}),i.push(r)),n.can_DeleteManualBreak()&&(r=new Common.UI.MenuItem({caption:e.txtDeleteBreak,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:t,callback:"delete_ManualBreak"}}),i.push(r)),n.can_AlignToCharacter()&&(r=new Common.UI.MenuItem({caption:e.txtAlignToChar,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:t,callback:"align_ToCharacter"}}),i.push(r)),i},addEquationMenu:function(e){var t=this;t.clearEquationMenu(e);var n=t.documentHolder.textInShapeMenu,r=t.initEquationMenu();return r.length>0&&_.each(r,function(r,i){r.menu?_.each(r.menu.items,function(e){e.on("click",_.bind(t.equationCallback,t,e.options.equationProps))}):r.on("click",_.bind(t.equationCallback,t,r.options.equationProps)),n.insertItem(e,r),e++}),r.length},clearEquationMenu:function(e){var t=this,n=t.documentHolder.textInShapeMenu;for(var r=e;r<n.items.length;r++){if(!n.items[r].options.equation)break;n.items[r].menu?_.each(n.items[r].menu.items,function(e){e.off("click")}):n.items[r].off("click"),n.removeItem(n.items[r]),r--}},equationCallback:function(e){var t=this;if(e){var n;switch(e.type){case Asc.c_oAscMathInterfaceType.Accent:n=new CMathMenuAccent;break;case Asc.c_oAscMathInterfaceType.BorderBox:n=new CMathMenuBorderBox;break;case Asc.c_oAscMathInterfaceType.Box:n=new CMathMenuBox;break;case Asc.c_oAscMathInterfaceType.Bar:n=new CMathMenuBar;break;case Asc.c_oAscMathInterfaceType.Script:n=new CMathMenuScript;break;case Asc.c_oAscMathInterfaceType.Fraction:n=new CMathMenuFraction;break;case Asc.c_oAscMathInterfaceType.Limit:n=new CMathMenuLimit;break;case Asc.c_oAscMathInterfaceType.Matrix:n=new CMathMenuMatrix;break;case Asc.c_oAscMathInterfaceType.EqArray:n=new CMathMenuEqArray;break;case Asc.c_oAscMathInterfaceType.LargeOperator:n=new CMathMenuNary;break;case Asc.c_oAscMathInterfaceType.Delimiter:n=new CMathMenuDelimiter;break;case Asc.c_oAscMathInterfaceType.GroupChar:n=new CMathMenuGroupCharacter;break;case Asc.c_oAscMathInterfaceType.Radical:n=new CMathMenuRadical;break;case Asc.c_oAscMathInterfaceType.Common:n=new CMathMenuBase}n&&(n[e.callback](e.value),t.api.asc_SetMathProps(n))}Common.NotificationCenter.trigger("edit:complete",t.documentHolder)},guestText:"Guest",textCtrlClick:"Press CTRL and click link",txtHeight:"Height",txtWidth:"Width",tipIsLocked:"This element is being edited by another user.",textChangeColumnWidth:"Column Width {0} symbols ({1} pixels)",textChangeRowHeight:"Row Height {0} points ({1} pixels)",textInsertLeft:"Insert Left",textInsertTop:"Insert Top",textSym:"sym",notcriticalErrorTitle:"Warning",errorInvalidLink:"The link reference does not exist. Please correct the link or delete it.",txtRemoveAccentChar:"Remove accent character",txtBorderProps:"Borders property",txtHideTop:"Hide top border",txtHideBottom:"Hide bottom border",txtHideLeft:"Hide left border",txtHideRight:"Hide right border",txtHideHor:"Hide horizontal line",txtHideVer:"Hide vertical line",txtHideLT:"Hide left top line",txtHideLB:"Hide left bottom line",txtAddTop:"Add top border",txtAddBottom:"Add bottom border",txtAddLeft:"Add left border",txtAddRight:"Add right border",txtAddHor:"Add horizontal line",txtAddVer:"Add vertical line",txtAddLT:"Add left top line",txtAddLB:"Add left bottom line",txtRemoveBar:"Remove bar",txtOverbar:"Bar over text",txtUnderbar:"Bar under text",txtRemScripts:"Remove scripts",txtRemSubscript:"Remove subscript",txtRemSuperscript:"Remove superscript",txtScriptsAfter:"Scripts after text",txtScriptsBefore:"Scripts before text",txtFractionStacked:"Change to stacked fraction",txtFractionSkewed:"Change to skewed fraction",txtFractionLinear:"Change to linear fraction",txtRemFractionBar:"Remove fraction bar",txtAddFractionBar:"Add fraction bar",txtRemLimit:"Remove limit",txtLimitOver:"Limit over text",txtLimitUnder:"Limit under text",txtHidePlaceholder:"Hide placeholder",txtShowPlaceholder:"Show placeholder",txtMatrixAlign:"Matrix alignment",txtColumnAlign:"Column alignment",txtTop:"Top",txtBottom:"Bottom",txtInsertEqBefore:"Insert equation before",txtInsertEqAfter:"Insert equation after",txtDeleteEq:"Delete equation",txtLimitChange:"Change limits location",txtHideTopLimit:"Hide top limit",txtShowTopLimit:"Show top limit",txtHideBottomLimit:"Hide bottom limit",txtShowBottomLimit:"Show bottom limit",txtInsertArgBefore:"Insert argument before",txtInsertArgAfter:"Insert argument after",txtDeleteArg:"Delete argument",txtHideOpenBracket:"Hide opening bracket",txtShowOpenBracket:"Show opening bracket",txtHideCloseBracket:"Hide closing bracket",txtShowCloseBracket:"Show closing bracket",txtStretchBrackets:"Stretch brackets",txtMatchBrackets:"Match brackets to argument height",txtGroupCharOver:"Char over text",txtGroupCharUnder:"Char under text",txtDeleteGroupChar:"Delete char",txtHideDegree:"Hide degree",txtShowDegree:"Show degree",txtIncreaseArg:"Increase argument size",txtDecreaseArg:"Decrease argument size",txtInsertBreak:"Insert manual break",txtDeleteBreak:"Delete manual break",txtAlignToChar:"Align to character",txtDeleteRadical:"Delete radical",txtDeleteChars:"Delete enclosing characters",txtDeleteCharsAndSeparators:"Delete enclosing characters and separators",insertText:"Insert",alignmentText:"Alignment",leftText:"Left",rightText:"Right",centerText:"Center",insertRowAboveText:"Row Above",insertRowBelowText:"Row Below",insertColumnLeftText:"Column Left",insertColumnRightText:"Column Right",deleteText:"Delete",deleteRowText:"Delete Row",deleteColumnText:"Delete Column",txtNoChoices:"There are no choices for filling the cell.<br>Only text values from the column can be selected for replacement.",txtExpandSort:"The data next to the selection will not be sorted. Do you want to expand the selection to include the adjacent data or continue with sorting the currently selected cells only?",txtExpand:"Expand and sort",txtSorting:"Sorting",txtSortSelected:"Sort selected",txtPaste:"Paste",txtPasteFormulas:"Paste only formula",txtPasteFormulaNumFormat:"Formula + number format",txtPasteKeepSourceFormat:"Formula + all formatting",txtPasteBorders:"Formula without borders",txtPasteColWidths:"Formula + column width",txtPasteMerge:"Merge conditional formatting",txtPasteTranspose:"Transpose",txtPasteValues:"Paste only value",txtPasteValNumFormat:"Value + number format",txtPasteValFormat:"Value + all formatting",txtPasteFormat:"Paste only formatting",txtPasteLink:"Paste Link",txtPastePicture:"Picture",txtPasteLinkPicture:"Linked Picture",txtPasteSourceFormat:"Source formatting",txtPasteDestFormat:"Destination formatting"},SSE.Controllers.DocumentHolder||{}))}),define("text!spreadsheeteditor/main/app/template/CellEditor.template",[],function(){return'<div class="ce-group-name">\r\n <input id="ce-cell-name" class="aslabel form-control" type="text">\r\n <div id="ce-cell-name-menu"></div>\r\n <button id="ce-func-label" type="button" class="btn small btn-toolbar"><span class="btn-icon"> </span></button>\r\n</div>\r\n<div class="ce-group-expand">\r\n <button id="ce-btn-expand" type="button" class="btn"><span class="caret img-commonctrl"> </span></button>\r\n</div>\r\n<div class="ce-group-content">\r\n <textarea id="ce-cell-content" class="form-control" spellcheck="false" rows="1" cols="20"></textarea>\r\n</div>\r\n'}),define("spreadsheeteditor/main/app/view/CellEditor",["text!spreadsheeteditor/main/app/template/CellEditor.template","common/main/lib/component/BaseView"],function(e){"use strict";SSE.Views.CellEditor=Common.UI.BaseView.extend(_.extend({template:_.template(e),initialize:function(e){Common.UI.BaseView.prototype.initialize.call(this,e)},render:function(){$(this.el).html(this.template()),this.btnNamedRanges=new Common.UI.Button({menu:(new Common.UI.Menu({style:"min-width: 70px;max-width:400px;",maxHeight:250,items:[{caption:this.textManager,value:"manager"},{caption:"--"}]})).on("render:after",function(e){this.scroller=new Common.UI.Scroller({el:$(this.el).find(".dropdown-menu "),useKeyboard:this.enableKeyEvents&&!this.handleSelect,minScrollbarLength:40})}).on("show:after",function(){this.scroller.update({alwaysVisibleY:!0})})}),this.btnNamedRanges.render($("#ce-cell-name-menu")),this.btnNamedRanges.setVisible(!1),this.btnNamedRanges.menu.setOffset(-55),this.$cellname=$("#ce-cell-name",this.el),this.$btnexpand=$("#ce-btn-expand",this.el),this.$btnfunc=$("#ce-func-label",this.el);var e=this;return this.$cellname.on("focusin",function(t){e.$cellname.select().one("mouseup",function(e){e.preventDefault()})}),this.$btnfunc.addClass("disabled"),this.$btnfunc.tooltip({title:this.tipFormula,placement:"cursor"}),this},updateCellInfo:function(e){e&&this.$cellname.val(typeof e=="string"?e:e.asc_getName())},cellNameDisabled:function(e){e?this.$cellname.attr("disabled","disabled"):this.$cellname.removeAttr("disabled"),this.btnNamedRanges.setDisabled(e)},tipFormula:"Insert Function",textManager:"Manager"},SSE.Views.CellEditor||{}))}),define("text!spreadsheeteditor/main/app/template/NameManagerDlg.template",[],function(){return'<div class="settings-panel active">\r\n <div class="inner-content">\r\n <table cols="2" style="width: 100%;">\r\n <tr>\r\n <td colspan=2 class="padding-small">\r\n <label class="header"><%= scope.textFilter %></label>\r\n <div id="name-manager-combo-filter" class="input-group-nr" style="width:210px;"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td colspan=2>\r\n <div style="width: 169px;display: inline-block;"><span id="name-manager-sort-name" class="header-sorted">\r\n <label class="header"><%= scope.textRanges %></label><div style="width: 6px;height: 6px;"></div><span id="name-manager-sort-name-span" class="sort-direction img-commonctrl"></span>\r\n </span></div>\r\n <div style="width: 92px;display: inline-block;"><span id="name-manager-sort-scope" class="header-sorted">\r\n <label class="header"><%= scope.textScope %></label><div style="width: 6px;height: 6px;"></div><span id="name-manager-sort-scope-span" class="sort-direction img-commonctrl"></div>\r\n </span></div>\r\n <label class="header" style=""><%= scope.textDataRange %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td colspan=2 class="padding-small">\r\n <div id="name-manager-range-list" class="range-tableview" style="width:100%; height: 143px;"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-large">\r\n <button type="button" class="btn btn-text-default" id="name-manager-btn-new" style="min-width: 100px;margin-right:5px;"><%= scope.textNew %></button>\r\n <button type="button" class="btn btn-text-default" id="name-manager-btn-edit" style="min-width: 100px;"><%= scope.textEdit %></button>\r\n </td>\r\n <td class="padding-large" style="text-align: right;width:90px;">\r\n <button type="button" class="btn btn-text-default" id="name-manager-btn-delete" style="min-width: 100px;"><%= scope.textDelete %></button>\r\n </td>\r\n </tr>\r\n </table>\r\n </div>\r\n</div>'}),define("spreadsheeteditor/main/app/view/NameManagerDlg",["text!spreadsheeteditor/main/app/template/NameManagerDlg.template","common/main/lib/view/AdvancedSettingsWindow","common/main/lib/component/ComboBox","common/main/lib/component/ListView","common/main/lib/component/InputField"],function(e){"use strict";SSE.Views=SSE.Views||{},SSE.Views.NameManagerDlg=Common.Views.AdvancedSettingsWindow.extend(_.extend({options:{alias:"NameManagerDlg",contentWidth:510,height:353},initialize:function(t){var n=this;_.extend(this.options,{title:this.txtTitle,template:['<div class="box" style="height:'+(this.options.height-85)+'px;">','<div class="content-panel" style="padding: 0;">'+_.template(e)({scope:this})+"</div>","</div>",'<div class="separator horizontal"/>','<div class="footer center">','<button class="btn normal dlg-btn" result="cancel" style="width: 86px;">'+this.closeButtonText+"</button>","</div>"].join("")},t),this.api=t.api,this.handler=t.handler,this.sheets=t.sheets||[],this.sheetNames=t.sheetNames||[],this.ranges=t.ranges||[],this.props=t.props,this.sort=t.sort||{type:"name",direction:1},this.locked=t.locked||!1,this.userTooltip=!0,this.currentNamedRange=undefined,this.rangesStore=new Common.UI.DataViewStore,this.wrapEvents={onRefreshDefNameList:_.bind(this.onRefreshDefNameList,this),onLockDefNameManager:_.bind(this.onLockDefNameManager,this)},Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this,this.options)},render:function(){Common.Views.AdvancedSettingsWindow.prototype.render.call(this);var e=this;this.cmbFilter=(new Common.UI.ComboBox({el:$("#name-manager-combo-filter"),menuStyle:"min-width: 100%;",editable:!1,cls:"input-group-nr",data:[{value:0,displayValue:this.textFilterAll},{value:1,displayValue:this.textFilterDefNames},{value:2,displayValue:this.textFilterTableNames},{value:3,displayValue:this.textFilterSheet},{value:4,displayValue:this.textFilterWorkbook}]})).on("selected",function(t,n){e.refreshRangeList(null,0)}),this.cmbFilter.setValue(0),this.rangeList=new Common.UI.ListView({el:$("#name-manager-range-list",this.$window),store:new Common.UI.DataViewStore,simpleAddMode:!0,emptyText:this.textEmpty,template:_.template(['<div class="listview inner" style=""></div>'].join("")),itemTemplate:_.template(['<div id="<%= id %>" class="list-item" style="width: 100%;display:inline-block;<% if (!lock) { %>pointer-events:none;<% } %>">','<div class="listitem-icon <% if (isTable) {%>listitem-table<%} %>"></div>','<div style="width:141px;padding-right: 5px;"><%= name %></div>','<div style="width:94px;padding-right: 5px;"><%= scopeName %></div>','<div style="width:212px;"><%= range %></div>',"<% if (lock) { %>",'<div class="lock-user"><%=lockuser%></div>',"<% } %>","</div>"].join(""))}),this.rangeList.store.comparator=function(t,n){var r=t.get(e.sort.type).toLowerCase(),i=n.get(e.sort.type).toLowerCase();return r==i?0:r<i?-e.sort.direction:e.sort.direction},this.rangeList.on("item:select",_.bind(this.onSelectRangeItem,this)).on("item:keydown",_.bind(this.onKeyDown,this)).on("item:dblclick",_.bind(this.onDblClickItem,this)).on("entervalue",_.bind(this.onDblClickItem,this)),this.btnNewRange=new Common.UI.Button({el:$("#name-manager-btn-new")}),this.btnNewRange.on("click",_.bind(this.onEditRange,this,!1)),this.btnEditRange=new Common.UI.Button({el:$("#name-manager-btn-edit")}),this.btnEditRange.on("click",_.bind(this.onEditRange,this,!0)),this.btnDeleteRange=new Common.UI.Button({el:$("#name-manager-btn-delete")}),this.btnDeleteRange.on("click",_.bind(this.onDeleteRange,this)),$("#name-manager-sort-name").on("click",_.bind(this.onSortNames,this,"name")),$("#name-manager-sort-scope").on("click",_.bind(this.onSortNames,this,"scopeName")),this.spanSortName=$("#name-manager-sort-name-span"),this.spanSortScope=$("#name-manager-sort-scope-span"),this.sort.type=="name"?this.spanSortScope.addClass("hidden"):this.spanSortName.addClass("hidden"),this.sort.direction<0&&(this.sort.type=="name"?this.spanSortName.addClass("sort-desc"):this.spanSortScope.addClass("sort-desc")),this.afterRender()},afterRender:function(){this._setDefaults(this.props)},_setDefaults:function(e){this.refreshRangeList(this.ranges,0),this.api.asc_registerCallback("asc_onLockDefNameManager",this.wrapEvents.onLockDefNameManager),this.api.asc_registerCallback("asc_onRefreshDefNameList",this.wrapEvents.onRefreshDefNameList)},onRefreshDefNameList:function(){this.refreshRangeList(this.api.asc_getDefinedNames(Asc.c_oAscGetDefinedNamesList.All),this.currentNamedRange)},refreshRangeList:function(e,t){if(e){this.ranges=e;var n=[];for(var r=0;r<this.ranges.length;r++){var i=this.ranges[r].asc_getScope(),s=this.ranges[r].asc_getIsLock();n.push({name:this.ranges[r].asc_getName(),scope:i,scopeName:i===null?this.textWorkbook:this.sheetNames[i],range:this.ranges[r].asc_getRef(),isTable:this.ranges[r].asc_getIsTable()===!0,lock:s!==null&&s!==undefined,lockuser:s?this.getUserName(s):this.guestText})}this.rangesStore.reset(n),this.rangeList.setEmptyText(this.rangesStore.length>0?this.textnoNames:this.textEmpty)}var o=this,u=this.rangeList.store,a=this.rangesStore.models,f=this.cmbFilter.getValue(),l=f<3?f==2:-1,c=f>2?f==4:-1;f>0&&(a=this.rangesStore.filter(function(e){return l!==-1?l===e.get("isTable"):c!==-1?c===(e.get("scope")===null):!1})),u.reset(a,{silent:!1}),f=u.length,this.btnEditRange.setDisabled(!f),this.btnDeleteRange.setDisabled(!f);if(f>0){if(t===undefined||t===null)t=0;if(_.isNumber(t))t>f-1&&(t=f-1),this.rangeList.selectByIndex(t),setTimeout(function(){o.rangeList.scrollToRecord(u.at(t))},50);else if(t){var h=u.findWhere({name:t.asc_getName(),scope:t.asc_getScope()});h&&(this.rangeList.selectRecord(h),setTimeout(function(){o.rangeList.scrollToRecord(h)},50))}this.userTooltip===!0&&this.rangeList.cmpEl.find(".lock-user").length>0&&this.rangeList.cmpEl.on("mouseover",_.bind(o.onMouseOverLock,o)).on("mouseout",_.bind(o.onMouseOutLock,o))}_.delay(function(){o.rangeList.cmpEl.find(".listview").focus(),o.rangeList.scroller.update({alwaysVisibleY:!0})},100,this)},onMouseOverLock:function(e,t,n){if(this.userTooltip===!0&&$(e.target).hasClass("lock-user")){var r=this,i=$(e.target).tooltip({title:this.tipIsLocked,trigger:"manual"}).data("bs.tooltip");this.userTooltip=i.tip(),this.userTooltip.css("z-index",parseInt(this.$window.css("z-index"))+10),i.show(),setTimeout(function(){r.userTipHide()},5e3)}},userTipHide:function(){typeof this.userTooltip=="object"&&(this.userTooltip.remove(),this.userTooltip=undefined,this.rangeList.cmpEl.off("mouseover").off("mouseout"))},onMouseOutLock:function(e,t,n){typeof this.userTooltip=="object"&&this.userTipHide()},onEditRange:function(e){if(this.locked){Common.NotificationCenter.trigger("namedrange:locked");return}var t=this,n=t.$window.offset(),r=this.rangeList.getSelectedRec(),i=_.indexOf(this.rangeList.store.models,r[0]),s=e&&r.length>0?new Asc.asc_CDefName(r[0].get("name"),r[0].get("range"),r[0].get("scope"),r[0].get("isTable")):null,o=(new SSE.Views.NamedRangeEditDlg({api:t.api,sheets:this.sheets,props:e?s:this.props,isEdit:e,handler:function(n,r){n=="ok"&&r&&(e?(t.currentNamedRange=r,t.api.asc_editDefinedNames(s,r)):(t.cmbFilter.setValue(0),t.currentNamedRange=r,t.api.asc_setDefinedNames(r)))}})).on("close",function(){t.show(),_.delay(function(){t.rangeList.cmpEl.find(".listview").focus()},100,t)});t.hide(),o.show(n.left+65,n.top+77)},onDeleteRange:function(){var e=this.rangeList.getSelectedRec();e.length>0&&(this.currentNamedRange=_.indexOf(this.rangeList.store.models,e[0]),this.api.asc_delDefinedNames(new Asc.asc_CDefName(e[0].get("name"),e[0].get("range"),e[0].get("scope"),e[0].get("isTable"))))},getSettings:function(){return this.sort},onPrimary:function(){return!0},onDlgBtnClick:function(e){this.handler&&this.handler.call(this,e.currentTarget.attributes.result.value),this.close()},onSortNames:function(e){e!==this.sort.type?(this.sort={type:e,direction:1},this.spanSortName.toggleClass("hidden"),this.spanSortScope.toggleClass("hidden")):this.sort.direction=-this.sort.direction;var t=e=="name"?this.spanSortName:this.spanSortScope;this.sort.direction>0?t.removeClass("sort-desc"):t.addClass("sort-desc"),this.rangeList.store.sort(),this.rangeList.onResetItems(),this.rangeList.scroller.update({alwaysVisibleY:!0})},getUserName:function(e){var t=SSE.getCollection("Common.Collections.Users");if(t){var n=t.findUser(e);if(n)return n.get("username")}return this.guestText},onSelectRangeItem:function(e,t,n){this.userTipHide();var r={},i=_.isFunction(n.toJSON);if(i){if(!n.get("selected"))return;r=n.toJSON(),this.currentNamedRange=_.indexOf(this.rangeList.store.models,n),this.btnEditRange.setDisabled(r.lock),this.btnDeleteRange.setDisabled(r.lock||r.isTable)}},hide:function(){this.userTipHide(),Common.UI.Window.prototype.hide.call(this)},close:function(){this.userTipHide(),this.api.asc_unregisterCallback("asc_onLockDefNameManager",this.wrapEvents.onLockDefNameManager),this.api.asc_unregisterCallback("asc_onRefreshDefNameList",this.wrapEvents.onRefreshDefNameList),Common.UI.Window.prototype.close.call(this)},onKeyDown:function(e,t,n){n.keyCode==Common.UI.Keys.DELETE&&!this.btnDeleteRange.isDisabled()&&this.onDeleteRange()},onDblClickItem:function(e,t,n){this.btnEditRange.isDisabled()||this.onEditRange(!0)},onLockDefNameManager:function(e){this.locked=e==Asc.c_oAscDefinedNameReason.LockDefNameManager},txtTitle:"Name Manager",closeButtonText:"Close",okButtonText:"Ok",textDataRange:"Data Range",textNew:"New",textEdit:"Edit",textDelete:"Delete",textRanges:"Named Ranges",textScope:"Scope",textFilter:"Filter",textEmpty:"No named ranges have been created yet.<br>Create at least one named range and it will appear in this field.",textnoNames:"No named ranges matching your filter could be found.",textFilterAll:"All",textFilterDefNames:"Defined names",textFilterTableNames:"Table names",textFilterSheet:"Names Scoped to Sheet",textFilterWorkbook:"Names Scoped to Workbook",textWorkbook:"Workbook",guestText:"Guest",tipIsLocked:"This element is being edited by another user."},SSE.Views.NameManagerDlg||{}))}),define("spreadsheeteditor/main/app/controller/CellEditor",["core","spreadsheeteditor/main/app/view/CellEditor","spreadsheeteditor/main/app/view/NameManagerDlg"],function(e){"use strict";SSE.Controllers.CellEditor=Backbone.Controller.extend({views:["CellEditor"],events:function(){return{"keyup input#ce-cell-name":_.bind(this.onCellName,this),"keyup textarea#ce-cell-content":_.bind(this.onKeyupCellEditor,this),"blur textarea#ce-cell-content":_.bind(this.onBlurCellEditor,this),"click button#ce-btn-expand":_.bind(this.expandEditorField,this),"click button#ce-func-label":_.bind(this.onInsertFunction,this)}},initialize:function(){this.addListeners({CellEditor:{},Viewport:{"layout:resizedrag":_.bind(this.onLayoutResize,this)}})},setApi:function(e){return this.api=e,this.api.isCEditorFocused=!1,this.api.asc_registerCallback("asc_onSelectionNameChanged",_.bind(this.onApiCellSelection,this)),this.api.asc_registerCallback("asc_onEditCell",_.bind(this.onApiEditCell,this)),this.api.asc_registerCallback("asc_onCoAuthoringDisconnect",_.bind(this.onApiDisconnect,this)),Common.NotificationCenter.on("api:disconnect",_.bind(this.onApiDisconnect,this)),Common.NotificationCenter.on("cells:range",_.bind(this.onCellsRange,this)),this.api.asc_registerCallback("asc_onLockDefNameManager",_.bind(this.onLockDefNameManager,this)),this.api.asc_registerCallback("asc_onInputKeyDown",_.bind(this.onInputKeyDown,this)),this},setMode:function(e){this.mode=e,this.editor.$btnfunc[this.mode.isEdit?"removeClass":"addClass"]("disabled"),this.editor.btnNamedRanges.setVisible(this.mode.isEdit&&!this.mode.isEditDiagram&&!this.mode.isEditMailMerge)},onInputKeyDown:function(e){if(Common.UI.Keys.UP===e.keyCode||Common.UI.Keys.DOWN===e.keyCode||Common.UI.Keys.TAB===e.keyCode||Common.UI.Keys.RETURN===e.keyCode||Common.UI.Keys.ESC===e.keyCode||Common.UI.Keys.LEFT===e.keyCode||Common.UI.Keys.RIGHT===e.keyCode){var t=$("#menu-formula-selection");t.hasClass("open")&&t.find(".dropdown-menu").trigger("keydown",e)}},onLaunch:function(){this.editor=this.createView("CellEditor",{el:"#cell-editing-box"}).render(),this.bindViewEvents(this.editor,this.events),this.editor.$el.parent().find(".after").css({zIndex:"4"}),this.editor.btnNamedRanges.menu.on("item:click",_.bind(this.onNamedRangesMenu,this)).on("show:before",_.bind(this.onNameBeforeShow,this)),this.namedrange_locked=!1},onApiEditCell:function(e){e==Asc.c_oAscCellEditorState.editStart?(this.api.isCellEdited=!0,this.editor.cellNameDisabled(!0)):e==Asc.c_oAscCellEditorState.editEnd&&(this.api.isCellEdited=!1,this.api.isCEditorFocused=!1,this.editor.cellNameDisabled(!1)),this.editor.$btnfunc.toggleClass("disabled",e==Asc.c_oAscCellEditorState.editText)},onApiCellSelection:function(e){this.editor.updateCellInfo(e)},onApiDisconnect:function(){this.mode.isEdit=!1;var e=this.getApplication().getController("FormulaDialog");e&&e.hideDialog(),this.mode.isEdit||($("#ce-func-label",this.editor.el).addClass("disabled"),this.editor.btnNamedRanges.setVisible(!1))},onCellsRange:function(e){this.editor.cellNameDisabled(e!=Asc.c_oAscSelectionDialogType.None),this.editor.$btnfunc.toggleClass("disabled",e!=Asc.c_oAscSelectionDialogType.None)},onLayoutResize:function(e,t){t=="cell:edit"&&(this.editor.$el.height()>19?this.editor.$btnexpand.hasClass("btn-collapse")||this.editor.$btnexpand.addClass("btn-collapse"):this.editor.$btnexpand.removeClass("btn-collapse"))},onCellName:function(e){if(e.keyCode==Common.UI.Keys.RETURN){var t=this.editor.$cellname.val();t&&t.length&&this.api.asc_findCell(t),Common.NotificationCenter.trigger("edit:complete",this.editor)}},onBlurCellEditor:function(){this.api.isCEditorFocused=="clear"?this.api.isCEditorFocused=undefined:this.api.isCellEdited&&(this.api.isCEditorFocused=!0)},onKeyupCellEditor:function(e){e.keyCode==Common.UI.Keys.RETURN&&!e.altKey&&(this.api.isCEditorFocused="clear")},expandEditorField:function(){this.editor.$el.height()>19?(this.editor.keep_height=this.editor.$el.height(),this.editor.$el.height(19),this.editor.$btnexpand.removeClass("btn-collapse")):(this.editor.$el.height(this.editor.keep_height||74),this.editor.$btnexpand.addClass("btn-collapse")),Common.NotificationCenter.trigger("layout:changed","celleditor"),Common.NotificationCenter.trigger("edit:complete",this.editor,{restorefocus:!0})},onInsertFunction:function(){if(this.mode.isEdit&&!this.editor.$btnfunc.hasClass("disabled")){var e=this.getApplication().getController("FormulaDialog");e&&($("#ce-func-label",this.editor.el).blur(),e.showDialog())}},onNamedRangesMenu:function(e,t){var n=this;if(t.options.value=="manager"){var r=this.api.asc_getWorksheetsCount(),i=-1,s=[],o=[];while(++i<r)this.api.asc_isWorksheetHidden(i)||(o[i]=this.api.asc_getWorksheetName(i),s.push({displayValue:o[i],value:i}));(new SSE.Views.NameManagerDlg({api:this.api,handler:function(e){Common.NotificationCenter.trigger("edit:complete",this.editor)},locked:this.namedrange_locked,sheets:s,sheetNames:o,ranges:this.api.asc_getDefinedNames(Asc.c_oAscGetDefinedNamesList.All),props:this.api.asc_getDefaultDefinedName(),sort:this.rangeListSort})).on("close",function(e){n.rangeListSort=e.getSettings()}).show()}else this.api.asc_findCell(t.caption),Common.NotificationCenter.trigger("edit:complete",this.editor)},onNameBeforeShow:function(){var e=this.api.asc_getDefinedNames(Asc.c_oAscGetDefinedNamesList.WorksheetWorkbook),t=this.editor.btnNamedRanges.menu,n="";t.removeItems(2,t.items.length-1),e.sort(function(e,t){var n=e.asc_getName().toLowerCase(),r=t.asc_getName().toLowerCase();return n==r?0:n<r?-1:1}),_.each(e,function(e,r){var i=e.asc_getName();n!==i&&t.addItem(new Common.UI.MenuItem({caption:e.asc_getName()})),n=i}),this.editor.btnNamedRanges.menu.items[1].setVisible(t.items.length>2)},onLockDefNameManager:function(e){this.namedrange_locked=e==Asc.c_oAscDefinedNameReason.LockDefNameManager}})}),define("common/main/lib/view/ImageFromUrlDialog",["common/main/lib/component/Window"],function(){"use strict";Common.Views.ImageFromUrlDialog=Common.UI.Window.extend(_.extend({options:{width:330,header:!1,cls:"modal-dlg"},initialize:function(e){_.extend(this.options,e||{}),this.template=['<div class="box">','<div class="input-row">',"<label>"+this.textUrl+"</label>","</div>",'<div id="id-dlg-url" class="input-row"></div>',"</div>",'<div class="footer right">','<button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px;">'+this.okButtonText+"</button>",'<button class="btn normal dlg-btn" result="cancel">'+this.cancelButtonText+"</button>","</div>"].join(""),this.options.tpl=_.template(this.template,this.options),Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this);var e=this;e.inputUrl=new Common.UI.InputField({el:$("#id-dlg-url"),allowBlank:!1,blankError:e.txtEmpty,style:"width: 100%;",validateOnBlur:!1,validation:function(t){return/((^https?)|(^ftp)):\/\/.+/i.test(t)?!0:e.txtNotUrl}});var t=this.getChild();t.find(".btn").on("click",_.bind(this.onBtnClick,this)),t.find("input").on("keypress",_.bind(this.onKeyPress,this))},show:function(){Common.UI.Window.prototype.show.apply(this,arguments);var e=this;_.delay(function(){e.getChild("input").focus()},500)},onKeyPress:function(e){e.keyCode==Common.UI.Keys.RETURN&&this._handleInput("ok")},onBtnClick:function(e){this._handleInput(e.currentTarget.attributes.result.value)},_handleInput:function(e){if(this.options.handler){if(e=="ok"&&this.inputUrl.checkValidate()!==!0){this.inputUrl.cmpEl.find("input").focus();return}this.options.handler.call(this,e,this.inputUrl.getValue())}this.close()},textUrl:"Paste an image URL:",cancelButtonText:"Cancel",okButtonText:"Ok",txtEmpty:"This field is required",txtNotUrl:'This field should be a URL in the format "http://www.example.com"'},Common.Views.ImageFromUrlDialog||{}))});if(Common===undefined)var Common={};define("common/main/lib/util/define",[],function(){"use strict";Common.define={},Common.define.c_oAscMathMainType={Symbol:0,Fraction:1,Script:2,Radical:3,Integral:4,LargeOperator:5,Bracket:6,Function:7,Accent:8,LimitLog:9,Operator:10,Matrix:11},Common.define.c_oAscMathType={Symbol_pm:0,Symbol_infinity:1,Symbol_equals:2,Symbol_neq:3,Symbol_about:4,Symbol_times:5,Symbol_div:6,Symbol_factorial:7,Symbol_propto:8,Symbol_less:9,Symbol_ll:10,Symbol_greater:11,Symbol_gg:12,Symbol_leq:13,Symbol_geq:14,Symbol_mp:15,Symbol_cong:16,Symbol_approx:17,Symbol_equiv:18,Symbol_forall:19,Symbol_additional:20,Symbol_partial:21,Symbol_sqrt:22,Symbol_cbrt:23,Symbol_qdrt:24,Symbol_cup:25,Symbol_cap:26,Symbol_emptyset:27,Symbol_percent:28,Symbol_degree:29,Symbol_fahrenheit:30,Symbol_celsius:31,Symbol_inc:32,Symbol_nabla:33,Symbol_exists:34,Symbol_notexists:35,Symbol_in:36,Symbol_ni:37,Symbol_leftarrow:38,Symbol_uparrow:39,Symbol_rightarrow:40,Symbol_downarrow:41,Symbol_leftrightarrow:42,Symbol_therefore:43,Symbol_plus:44,Symbol_minus:45,Symbol_not:46,Symbol_ast:47,Symbol_bullet:48,Symbol_vdots:49,Symbol_cdots:50,Symbol_rddots:51,Symbol_ddots:52,Symbol_aleph:53,Symbol_beth:54,Symbol_QED:55,Symbol_alpha:65536,Symbol_beta:65537,Symbol_gamma:65538,Symbol_delta:65539,Symbol_varepsilon:65540,Symbol_epsilon:65541,Symbol_zeta:65542,Symbol_eta:65543,Symbol_theta:65544,Symbol_vartheta:65545,Symbol_iota:65546,Symbol_kappa:65547,Symbol_lambda:65548,Symbol_mu:65549,Symbol_nu:65550,Symbol_xsi:65551,Symbol_o:65552,Symbol_pi:65553,Symbol_varpi:65554,Symbol_rho:65555,Symbol_varrho:65556,Symbol_sigma:65557,Symbol_varsigma:65558,Symbol_tau:65559,Symbol_upsilon:65560,Symbol_varphi:65561,Symbol_phi:65562,Symbol_chi:65563,Symbol_psi:65564,Symbol_omega:65565,Symbol_Alpha:131072,Symbol_Beta:131073,Symbol_Gamma:131074,Symbol_Delta:131075,Symbol_Epsilon:131076,Symbol_Zeta:131077,Symbol_Eta:131078,Symbol_Theta:131079,Symbol_Iota:131080,Symbol_Kappa:131081,Symbol_Lambda:131082,Symbol_Mu:131083,Symbol_Nu:131084,Symbol_Xsi:131085,Symbol_O:131086,Symbol_Pi:131087,Symbol_Rho:131088,Symbol_Sigma:131089,Symbol_Tau:131090,Symbol_Upsilon:131091,Symbol_Phi:131092,Symbol_Chi:131093,Symbol_Psi:131094,Symbol_Omega:131095,FractionVertical:16777216,FractionDiagonal:16777217,FractionHorizontal:16777218,FractionSmall:16777219,FractionDifferential_1:16842752,FractionDifferential_2:16842753,FractionDifferential_3:16842754,FractionDifferential_4:16842755,FractionPi_2:16842756,ScriptSup:33554432,ScriptSub:33554433,ScriptSubSup:33554434,ScriptSubSupLeft:33554435,ScriptCustom_1:33619968,ScriptCustom_2:33619969,ScriptCustom_3:33619970,ScriptCustom_4:33619971,RadicalSqrt:50331648,RadicalRoot_n:50331649,RadicalRoot_2:50331650,RadicalRoot_3:50331651,RadicalCustom_1:50397184,RadicalCustom_2:50397185,Integral:67108864,IntegralSubSup:67108865,IntegralCenterSubSup:67108866,IntegralDouble:67108867,IntegralDoubleSubSup:67108868,IntegralDoubleCenterSubSup:67108869,IntegralTriple:67108870,IntegralTripleSubSup:67108871,IntegralTripleCenterSubSup:67108872,IntegralOriented:67174400,IntegralOrientedSubSup:67174401,IntegralOrientedCenterSubSup:67174402,IntegralOrientedDouble:67174403,IntegralOrientedDoubleSubSup:67174404,IntegralOrientedDoubleCenterSubSup:67174405,IntegralOrientedTriple:67174406,IntegralOrientedTripleSubSup:67174407,IntegralOrientedTripleCenterSubSup:67174408,Integral_dx:67239936,Integral_dy:67239937,Integral_dtheta:67239938,LargeOperator_Sum:83886080,LargeOperator_Sum_CenterSubSup:83886081,LargeOperator_Sum_SubSup:83886082,LargeOperator_Sum_CenterSub:83886083,LargeOperator_Sum_Sub:83886084,LargeOperator_Prod:83951616,LargeOperator_Prod_CenterSubSup:83951617,LargeOperator_Prod_SubSup:83951618,LargeOperator_Prod_CenterSub:83951619,LargeOperator_Prod_Sub:83951620,LargeOperator_CoProd:83951621,LargeOperator_CoProd_CenterSubSup:83951622,LargeOperator_CoProd_SubSup:83951623,LargeOperator_CoProd_CenterSub:83951624,LargeOperator_CoProd_Sub:83951625,LargeOperator_Union:84017152,LargeOperator_Union_CenterSubSup:84017153,LargeOperator_Union_SubSup:84017154,LargeOperator_Union_CenterSub:84017155,LargeOperator_Union_Sub:84017156,LargeOperator_Intersection:84017157,LargeOperator_Intersection_CenterSubSup:84017158,LargeOperator_Intersection_SubSup:84017159,LargeOperator_Intersection_CenterSub:84017160,LargeOperator_Intersection_Sub:84017161,LargeOperator_Disjunction:84082688,LargeOperator_Disjunction_CenterSubSup:84082689,LargeOperator_Disjunction_SubSup:84082690,LargeOperator_Disjunction_CenterSub:84082691,LargeOperator_Disjunction_Sub:84082692,LargeOperator_Conjunction:84082693,LargeOperator_Conjunction_CenterSubSup:84082694,LargeOperator_Conjunction_SubSup:84082695,LargeOperator_Conjunction_CenterSub:84082696,LargeOperator_Conjunction_Sub:84082697,LargeOperator_Custom_1:84148224,LargeOperator_Custom_2:84148225,LargeOperator_Custom_3:84148226,LargeOperator_Custom_4:84148227,LargeOperator_Custom_5:84148228,Bracket_Round:100663296,Bracket_Square:100663297,Bracket_Curve:100663298,Bracket_Angle:100663299,Bracket_LowLim:100663300,Bracket_UppLim:100663301,Bracket_Line:100663302,Bracket_LineDouble:100663303,Bracket_Square_OpenOpen:100663304,Bracket_Square_CloseClose:100663305,Bracket_Square_CloseOpen:100663306,Bracket_SquareDouble:100663307,Bracket_Round_Delimiter_2:100728832,Bracket_Curve_Delimiter_2:100728833,Bracket_Angle_Delimiter_2:100728834,Bracket_Angle_Delimiter_3:100728835,Bracket_Round_OpenNone:100794368,Bracket_Round_NoneOpen:100794369,Bracket_Square_OpenNone:100794370,Bracket_Square_NoneOpen:100794371,Bracket_Curve_OpenNone:100794372,Bracket_Curve_NoneOpen:100794373,Bracket_Angle_OpenNone:100794374,Bracket_Angle_NoneOpen:100794375,Bracket_LowLim_OpenNone:100794376,Bracket_LowLim_NoneNone:100794377,Bracket_UppLim_OpenNone:100794378,Bracket_UppLim_NoneOpen:100794379,Bracket_Line_OpenNone:100794380,Bracket_Line_NoneOpen:100794381,Bracket_LineDouble_OpenNone:100794382,Bracket_LineDouble_NoneOpen:100794383,Bracket_SquareDouble_OpenNone:100794384,Bracket_SquareDouble_NoneOpen:100794385,Bracket_Custom_1:100859904,Bracket_Custom_2:100859905,Bracket_Custom_3:100859906,Bracket_Custom_4:100859907,Bracket_Custom_5:100925440,Bracket_Custom_6:100925441,Bracket_Custom_7:100925442,Function_Sin:117440512,Function_Cos:117440513,Function_Tan:117440514,Function_Csc:117440515,Function_Sec:117440516,Function_Cot:117440517,Function_1_Sin:117506048,Function_1_Cos:117506049,Function_1_Tan:117506050,Function_1_Csc:117506051,Function_1_Sec:117506052,Function_1_Cot:117506053,Function_Sinh:117571584,Function_Cosh:117571585,Function_Tanh:117571586,Function_Csch:117571587,Function_Sech:117571588,Function_Coth:117571589,Function_1_Sinh:117637120,Function_1_Cosh:117637121,Function_1_Tanh:117637122,Function_1_Csch:117637123,Function_1_Sech:117637124,Function_1_Coth:117637125,Function_Custom_1:117702656,Function_Custom_2:117702657,Function_Custom_3:117702658,Accent_Dot:134217728,Accent_DDot:134217729,Accent_DDDot:134217730,Accent_Hat:134217731,Accent_Check:134217732,Accent_Accent:134217733,Accent_Grave:134217734,Accent_Smile:134217735,Accent_Tilde:134217736,Accent_Bar:134217737,Accent_DoubleBar:134217738,Accent_CurveBracketTop:134217739,Accent_CurveBracketBot:134217740,Accent_GroupTop:134217741,Accent_GroupBot:134217742,Accent_ArrowL:134217743,Accent_ArrowR:134217744,Accent_ArrowD:134217745,Accent_HarpoonL:134217746,Accent_HarpoonR:134217747,Accent_BorderBox:134283264,Accent_BorderBoxCustom:134283265,Accent_BarTop:134348800,Accent_BarBot:134348801,Accent_Custom_1:134414336,Accent_Custom_2:134414337,Accent_Custom_3:134414338,LimitLog_LogBase:150994944,LimitLog_Log:150994945,LimitLog_Lim:150994946,LimitLog_Min:150994947,LimitLog_Max:150994948,LimitLog_Ln:150994949,LimitLog_Custom_1:151060480,LimitLog_Custom_2:151060481,Operator_ColonEquals:167772160,Operator_EqualsEquals:167772161,Operator_PlusEquals:167772162,Operator_MinusEquals:167772163,Operator_Definition:167772164,Operator_UnitOfMeasure:167772165,Operator_DeltaEquals:167772166,Operator_ArrowL_Top:167837696,Operator_ArrowR_Top:167837697,Operator_ArrowL_Bot:167837698,Operator_ArrowR_Bot:167837699,Operator_DoubleArrowL_Top:167837700,Operator_DoubleArrowR_Top:167837701,Operator_DoubleArrowL_Bot:167837702,Operator_DoubleArrowR_Bot:167837703,Operator_ArrowD_Top:167837704,Operator_ArrowD_Bot:167837705,Operator_DoubleArrowD_Top:167837706,Operator_DoubleArrowD_Bot:167837707,Operator_Custom_1:167903232,Operator_Custom_2:167903233,Matrix_1_2:184549376,Matrix_2_1:184549377,Matrix_1_3:184549378,Matrix_3_1:184549379,Matrix_2_2:184549380,Matrix_2_3:184549381,Matrix_3_2:184549382,Matrix_3_3:184549383,Matrix_Dots_Center:184614912,Matrix_Dots_Baseline:184614913,Matrix_Dots_Vertical:184614914,Matrix_Dots_Diagonal:184614915,Matrix_Identity_2:184680448,Matrix_Identity_2_NoZeros:184680449,Matrix_Identity_3:184680450,Matrix_Identity_3_NoZeros:184680451,Matrix_2_2_RoundBracket:184745984,Matrix_2_2_SquareBracket:184745985,Matrix_2_2_LineBracket:184745986,Matrix_2_2_DLineBracket:184745987,Matrix_Flat_Round:184811520,Matrix_Flat_Square:184811521}}),define("text!spreadsheeteditor/main/app/template/Toolbar.template",[],function(){return'<div class="toolbar" style="<%= (isCompactView || isEditDiagram || isEditMailMerge) ? \'height: 41px;\' : \'height: 67px;\' %>">\n <!----------------------->\n <!-- Edit diagram mode -->\n <!----------------------->\n <div id="id-toolbar-diagramm" style="<%= isEditDiagram ? \'display: table;\' : \'display: none;\' %> width: 100%;" >\n <div class="toolbar-group">\n <div class="toolbar-row">\n <span class="btn-placeholder split" id="id-toolbar-diagram-placeholder-btn-copy"></span>\n <span class="btn-placeholder split" id="id-toolbar-diagram-placeholder-btn-paste"></span>\n <span class="btn-placeholder split" id="id-toolbar-diagram-placeholder-btn-undo"></span>\n <span class="btn-placeholder" id="id-toolbar-diagram-placeholder-btn-redo"></span>\n </div>\n </div>\n <div class="separator short"></div>\n <div class="toolbar-group">\n <div class="toolbar-row">\n <span class="btn-placeholder split" id="id-toolbar-diagram-placeholder-btn-formula"></span>\n </div>\n </div>\n <div class="separator short" style="margin-left: 5px;"></div>\n <div class="toolbar-group">\n <div class="toolbar-row">\n <span class="btn-placeholder split" id="id-toolbar-diagram-placeholder-btn-digit-dec"></span>\n <span class="btn-placeholder split" id="id-toolbar-diagram-placeholder-btn-digit-inc"></span>\n <span class="btn-placeholder" id="id-toolbar-diagram-placeholder-btn-format" style="width: 84px; margin-left: 10px; vertical-align: middle;"></span>\n </div>\n </div>\n <div class="separator short"></div>\n <div class="toolbar-group">\n <div class="toolbar-row">\n <span class="btn-placeholder border" id="id-toolbar-diagram-placeholder-btn-chart" style="width: auto;"></span>\n </div>\n </div>\n <div class="toolbar-group" style="width: 100%;"></div>\n </div>\n <!----------------------->\n <!-- Edit mail merge mode -->\n <!----------------------->\n <div id="id-toolbar-merge" style="<%= isEditMailMerge ? \'display: table;\' : \'display: none;\' %> width: 100%;" >\n <div class="toolbar-group">\n <div class="toolbar-row">\n <span class="btn-placeholder split" id="id-toolbar-merge-placeholder-btn-copy"></span>\n <span class="btn-placeholder split" id="id-toolbar-merge-placeholder-btn-paste"></span>\n <span class="btn-placeholder split" id="id-toolbar-merge-placeholder-btn-undo"></span>\n <span class="btn-placeholder" id="id-toolbar-merge-placeholder-btn-redo"></span>\n </div>\n </div>\n <div class="separator short"></div>\n <div class="toolbar-group">\n <div class="toolbar-row">\n <span class="btn-placeholder split" id="id-toolbar-merge-placeholder-btn-sortdesc"></span>\n <span class="btn-placeholder" id="id-toolbar-merge-placeholder-btn-sortasc"></span>\n </div>\n </div>\n <div class="separator short" style="margin-left: 5px;"></div>\n <div class="toolbar-group">\n <div class="toolbar-row">\n <span class="btn-placeholder split" id="id-toolbar-merge-placeholder-btn-setfilter"></span>\n <span class="btn-placeholder" id="id-toolbar-merge-placeholder-btn-clear-filter"></span>\n </div>\n </div>\n <div class="separator short"></div>\n <div class="toolbar-group">\n <div class="toolbar-row">\n <span class="btn-placeholder" id="id-toolbar-merge-placeholder-btn-search"></span>\n </div>\n </div>\n <div class="toolbar-group" style="width: 100%;"></div>\n </div>\n <!------------------------>\n <!-- Short view toolbar -->\n <!------------------------>\n <div id="id-toolbar-short" style="<%= (!isCompactView || isEditDiagram || isEditMailMerge) ? \'display: none;\' : \'display: table;\' %> width: 100%;" >\n <div class="toolbar-group no-mask">\n <div class="toolbar-row">\n <span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-print"></span>\n <span class="btn-placeholder" id="id-toolbar-short-placeholder-btn-save"></span>\n </div>\n </div>\n <div class="separator short"></div>\n <div class="toolbar-group">\n <div class="toolbar-row">\n <span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-undo"></span>\n <span class="btn-placeholder" id="id-toolbar-short-placeholder-btn-redo"></span>\n </div>\n </div>\n <div class="separator short"></div>\n <div class="toolbar-group">\n <div class="toolbar-row" style="width: 140px; margin-top: -1px;">\n <span class="btn-placeholder" style="float: left; width: 90px;" id="id-toolbar-short-placeholder-field-fontname"></span>\n <span class="btn-placeholder" style="float: left; width: 45px; margin-left: 2px;" id="id-toolbar-short-placeholder-field-fontsize"></span>\n </div>\n </div>\n <div class="toolbar-group">\n <div class="toolbar-row">\n <span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-bold"></span>\n <span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-italic"></span>\n <span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-underline"></span>\n <span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-fontcolor"></span>\n <span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-fillparag"></span>\n </div>\n </div>\n <div class="separator short" style="margin-left: 5px;"></div>\n <div class="toolbar-group">\n <div class="toolbar-row">\n <span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-borders"></span>\n <span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-halign"></span>\n <span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-valign"></span>\n <span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-merge"></span>\n <span class="btn-placeholder" id="id-toolbar-short-placeholder-btn-wrap"></span>\n </div>\n </div>\n <div class="separator short"></div>\n <div class="toolbar-group">\n <div class="toolbar-row">\n <span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-insertimage"></span>\n <span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-inserthyperlink"></span>\n <span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-insertchart"></span>\n <span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-insertshape"></span>\n <span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-formula"></span>\n </div>\n </div>\n <div class="separator short" style="margin-left: 5px;"></div>\n <div class="toolbar-group">\n <div class="toolbar-row">\n <span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-filter"></span>\n <span class="btn-placeholder" id="id-toolbar-short-placeholder-btn-format" style="width: 84px; margin-left: 7px; vertical-align: middle;"></span>\n </div>\n </div>\n <div class="separator short"></div>\n <div class="toolbar-group">\n <div class="toolbar-row">\n <span class="btn-placeholder" id="id-toolbar-short-placeholder-btn-copystyle"></span>\n </div>\n </div>\n <!--<div class="separator short"></div>-->\n <!--<div class="toolbar-group">-->\n <!--<div class="toolbar-row">-->\n <!--<span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-cell-ins"></span>-->\n <!--<span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-cell-del"></span>-->\n <!--</div>-->\n <!--</div>-->\n <div class="toolbar-group" style="width: 100%;"></div>\n <div class="toolbar-group no-mask" style="padding-left:0;">\n <div class="toolbar-row">\n <span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-hidebars"></span>\n </div>\n </div>\n </div>\n <!------------------------>\n <!-- Fully view toolbar -->\n <!------------------------>\n <div id="id-toolbar-full" style="<%= (isCompactView || isEditDiagram || isEditMailMerge)? \'display: none;\' : \'display: table;\' %> width: 100%;" >\n <div class="toolbar-group toolbar-group-native">\n <div class="toolbar-row">\n <span class="btn-placeholder" id="id-toolbar-full-placeholder-btn-newdocument"></span>\n </div>\n <div class="toolbar-row">\n <span class="btn-placeholder" id="id-toolbar-full-placeholder-btn-opendocument"></span>\n </div>\n </div>\n <div class="toolbar-group no-mask">\n <div class="toolbar-row">\n <span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-print"></span>\n </div>\n <div class="toolbar-row">\n <span class="btn-placeholder" id="id-toolbar-full-placeholder-btn-save"></span>\n </div>\n </div>\n <div class="separator long" style="margin-left: 5px;"></div>\n <div class="toolbar-group">\n <div class="toolbar-row">\n <span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-copy"></span>\n <span class="btn-placeholder" id="id-toolbar-full-placeholder-btn-paste"></span>\n </div>\n <div class="toolbar-row">\n <span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-undo"></span>\n <span class="btn-placeholder" id="id-toolbar-full-placeholder-btn-redo"></span>\n </div>\n </div>\n <div class="separator long"></div>\n <div class="toolbar-group">\n <div class="toolbar-row">\n <span class="btn-placeholder" style="float: left; width: 90px;" id="id-toolbar-full-placeholder-field-fontname"></span>\n <span class="btn-placeholder" style="float: left; width: 45px; margin-left: 2px;" id="id-toolbar-full-placeholder-field-fontsize"></span>\n <span class="btn-placeholder border" id="id-toolbar-full-placeholder-btn-incfont" style="margin-left: 2px;"></span>\n <span class="btn-placeholder border" id="id-toolbar-full-placeholder-btn-decfont" style="margin-left: 2px;"></span>\n </div>\n <div class="toolbar-row">\n <span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-bold"></span>\n <span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-italic"></span>\n <span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-underline"></span>\n <span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-fontcolor"></span>\n <span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-fillparag"></span>\n <div class="separator short" style="margin: 0 6px;"></div>\n <span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-borders"></span>\n </div>\n </div>\n <div class="separator long"></div>\n <div class="toolbar-group">\n <div class="toolbar-row">\n <span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-top"></span>\n <span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-middle"></span>\n <span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-bottom"></span>\n <span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-wrap"></span>\n <span class="btn-placeholder" id="id-toolbar-full-placeholder-btn-text-orient"></span>\n </div>\n <div class="toolbar-row">\n <span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-align-left"></span>\n <span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-align-center"></span>\n <span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-align-right"></span>\n <span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-align-just"></span>\n <span class="btn-placeholder" id="id-toolbar-full-placeholder-btn-merge"></span>\n </div>\n </div>\n <div class="separator long"></div>\n <div class="toolbar-group">\n <div class="toolbar-row">\n <span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-insertimage"></span>\n <span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-insertchart"></span>\n <span class="btn-placeholder" id="id-toolbar-full-placeholder-btn-text"></span>\n </div>\n <div class="toolbar-row">\n <span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-inserthyperlink"></span>\n <span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-insertshape"></span>\n <span class="btn-placeholder" id="id-toolbar-full-placeholder-btn-insertequation"></span>\n </div>\n </div>\n <div class="separator long"></div>\n <div class="toolbar-group">\n <div class="toolbar-row">\n <span class="btn-placeholder" id="id-toolbar-full-placeholder-btn-formula"></span>\n </div>\n <div class="toolbar-row">\n <span class="btn-placeholder" id="id-toolbar-full-placeholder-btn-named-range"></span>\n </div>\n </div>\n <div class="separator long"></div>\n <div class="toolbar-group">\n <div class="toolbar-row">\n <span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-sortdesc"></span>\n <span class="btn-placeholder" id="id-toolbar-full-placeholder-btn-sortasc"></span>\n </div>\n <div class="toolbar-row">\n <span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-setfilter"></span>\n <span class="btn-placeholder" id="id-toolbar-full-placeholder-btn-clear-filter"></span>\n </div>\n </div>\n <div class="separator long"></div>\n <div class="toolbar-group">\n <div class="toolbar-row">\n <span class="btn-placeholder" id="id-toolbar-full-placeholder-btn-format" style="width: 100%"></span>\n </div>\n <div class="toolbar-row">\n <span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-percents"></span>\n <span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-currency"></span>\n <span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-digit-dec"></span>\n <span class="btn-placeholder" id="id-toolbar-full-placeholder-btn-digit-inc"></span>\n </div>\n </div>\n <div class="separator long"></div>\n <div class="toolbar-group">\n <div class="toolbar-row">\n <span class="btn-placeholder" id="id-toolbar-full-placeholder-btn-cell-ins"></span>\n </div>\n <div class="toolbar-row">\n <span class="btn-placeholder" id="id-toolbar-full-placeholder-btn-cell-del"></span>\n </div>\n </div>\n <div class="separator long"></div>\n <div class="toolbar-group">\n <div class="toolbar-row">\n <span class="btn-placeholder" id="id-toolbar-full-placeholder-btn-clear"></span>\n </div>\n <div class="toolbar-row">\n <span class="btn-placeholder" id="id-toolbar-full-placeholder-btn-copystyle"></span>\n </div>\n </div>\n <div class="toolbar-group">\n <div class="toolbar-row">\n <span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-colorschemas"></span>\n </div>\n <div class="toolbar-row">\n <span class="btn-placeholder" id="id-toolbar-full-placeholder-btn-table-tpl"></span>\n </div>\n </div>\n <div class="toolbar-group" id="id-toolbar-full-placeholder-field-styles" style="width: 100%; min-width: 160px;">\n </div>\n <div class="toolbar-group no-mask">\n <div class="toolbar-row">\n <span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-hidebars"></span>\n </div>\n <div class="toolbar-row">\n <span class="btn-placeholder" id="id-toolbar-full-placeholder-btn-settings"></span>\n </div>\n </div>\n </div>\n</div>'});if(Common===undefined)var Common={};Common.Models=Common.Models||{},define("common/main/lib/model/Font",["backbone"],function(e){"use strict";Common.Models.Font=e.Model.extend({defaults:function(){return{id:Common.UI.getId(),name:null,cloneid:null,imgidx:0,type:0}}})});if(Common===undefined)var Common={};Common.Collections=Common.Collections||{},define("common/main/lib/collection/Fonts",["backbone","common/main/lib/model/Font"],function(e){"use strict";Common.Collections.Fonts=e.Collection.extend({model:Common.Models.Font,comparator:function(e,t){var n=e.get("name").toLowerCase(),r=t.get("name").toLowerCase();return n==r?0:n<r?-1:1}})});if(Common===undefined)var Common={};define("common/main/lib/component/Button",["common/main/lib/component/BaseView","common/main/lib/component/ToggleManager"],function(){"use strict";Common.UI.Button=Common.UI.BaseView.extend({options:{id:null,hint:!1,enableToggle:!1,allowDepress:!0,toggleGroup:null,cls:"",iconCls:"",caption:"",menu:null,disabled:!1,pressed:!1,split:!1},template:_.template(["<% if (menu == null) { %>",'<button type="button" class="btn <%= cls %>" id="<%= id %>" style="<%= style %>">','<span class="caption"><%= caption %></span>','<% if (iconCls != "") { %>','<span class="btn-icon <%= iconCls %>"> </span>',"<% } %>","</button>","<% } else if (split == false) {%>",'<div class="btn-group" id="<%= id %>" style="<%= style %>">','<button type="button" class="btn dropdown-toggle <%= cls %>" data-toggle="dropdown">','<span class="caption"><%= caption %></span>','<% if (iconCls != "") { %>','<span class="btn-icon <%= iconCls %>"> </span>',"<% } %>",'<span class="caret img-commonctrl"></span>',"</button>","</div>","<% } else { %>",'<div class="btn-group split" id="<%= id %>" style="<%= style %>">','<button type="button" class="btn <%= cls %>">','<span class="caption"><%= caption %></span>','<% if (iconCls != "") { %>','<span class="btn-icon <%= iconCls %>"> </span>',"<% } %>","</button>",'<button type="button" class="btn <%= cls %> dropdown-toggle" data-toggle="dropdown">','<span class="caret img-commonctrl"></span>','<span class="sr-only"></span>',"</button>","</div>","<% } %>"].join("")),initialize:function(e){Common.UI.BaseView.prototype.initialize.call(this,e);var t=this;t.id=t.options.id||Common.UI.getId(),t.hint=t.options.hint,t.enableToggle=t.options.enableToggle,t.allowDepress=t.options.allowDepress,t.cls=t.options.cls,t.iconCls=t.options.iconCls,t.menu=t.options.menu,t.split=t.options.split,t.toggleGroup=t.options.toggleGroup,t.disabled=t.options.disabled,t.pressed=t.options.pressed,t.caption=t.options.caption,t.template=t.options.template||t.template,t.style=t.options.style,t.rendered=!1,t.options.el&&t.render()},render:function(e){var t=this;t.trigger("render:before",t),t.cmpEl=$(t.el),e&&(t.setElement(e,!1),t.rendered||(t.cmpEl=$(this.template({id:t.id,cls:t.cls,iconCls:t.iconCls,menu:t.menu,split:t.split,disabled:t.disabled,pressed:t.pressed,caption:t.caption,style:t.style})),t.menu&&_.isObject(t.menu)&&_.isFunction(t.menu.render)&&t.menu.render(t.cmpEl),e.html(t.cmpEl)));if(!t.rendered){var n=t.cmpEl,r=n.hasClass("btn-group"),i=n.hasClass("split");if(t.options.hint){var s=t.cmpEl.closest(".asc-window");t.cmpEl.attr("data-toggle","tooltip"),t.cmpEl.tooltip({title:t.options.hint,placement:t.options.hintAnchor||"cursor"}),s.length>0&&t.cmpEl.data("bs.tooltip").tip().css("z-index",parseInt(s.css("z-index"))+10)}_.isString(t.toggleGroup)&&(t.enableToggle=!0);var o=function(e){if(!t.disabled&&e.which==1){t.doToggle();if(t.options.hint){var n=t.cmpEl.data("bs.tooltip");n&&(n.dontShow===undefined&&(n.dontShow=!0),n.hide())}t.trigger("click",t,e)}},u=function(e,r){if(!e){var s=!1;_.each($("button",n),function(e){if($(e).is(":hover"))return s=!0,!1}),s||(n.removeClass("over"),$("button",n).removeClass("over"))}if(!e&&t.enableToggle&&t.allowDepress&&t.pressed)return;if(e&&!i&&t.enableToggle&&t.allowDepress&&!t.pressed){r.preventDefault();return}$("button:first",n).toggleClass("active",e),$("[data-toggle^=dropdown]",n).toggleClass("active",e),n.toggleClass("active",e)},a=function(e){if(!t.disabled&&e.which==1&&i){if(t.options.hint){var r=t.cmpEl.data("bs.tooltip");r&&(r.dontShow===undefined&&(r.dontShow=!0),r.hide())}var s=n.hasClass("open");u(!s,e)}},f=function(e,t){i?u(t,e):(n.toggleClass("active",t),$("button",n).toggleClass("active",t))},l=function(e){u(!0,e),$(document).on("mouseup",c)},c=function(e){u(!1,e),$(document).off("mouseup",c)},h=function(e,n){t.cmpEl.find(".dropdown-toggle").blur(),t.cmpEl.hasClass("active")!==t.pressed&&t.cmpEl.trigger("button.internal.active",[t.pressed])};r?(i&&($("[data-toggle^=dropdown]",n).on("mousedown",_.bind(a,this)),$("button",n).on("mousedown",_.bind(l,this))),n.on("hide.bs.dropdown",_.bind(u,t,!1)),n.on("show.bs.dropdown",_.bind(u,t,!0)),n.on("hidden.bs.dropdown",_.bind(h,t)),$("button:first",n).on("click",o)):n.on("click",o),n.on("button.internal.active",_.bind(f,t)),n.on("mouseover",function(e){t.disabled||(t.cmpEl.addClass("over"),t.trigger("mouseover",t,e))}),n.on("mouseout",function(e){t.disabled||(t.cmpEl.removeClass("over"),t.trigger("mouseout",t,e))}),Common.UI.ToggleManager.register(t)}return t.rendered=!0,t.pressed&&t.toggle(t.pressed,!0),t.disabled&&t.setDisabled(!(t.disabled=!1)),t.trigger("render:after",t),this},doToggle:function(){var e=this;e.enableToggle&&(e.allowDepress!==!1||!e.pressed)&&e.toggle()},toggle:function(e,t){var n=e===undefined?!this.pressed:!!e;this.pressed=n,this.cmpEl&&this.cmpEl.trigger("button.internal.active",[n]),t||this.trigger("toggle",this,n)},isActive:function(){return this.enableToggle?this.pressed:this.cmpEl.hasClass("active")},setDisabled:function(e){if(this.rendered&&this.disabled!=e){var t=this.cmpEl,n=t.hasClass("btn-group"),r=this;e=e===!0;if(e!==t.hasClass("disabled")){var i=function(t){t.toggleClass("disabled",e),r.options.allowMouseEventsOnDisabled||(e?t.attr({disabled:e}):t.removeAttr("disabled"))};i(t),n&&i(t.children("button"))}if(e||!Common.Utils.isGecko){var s=this.cmpEl.data("bs.tooltip");s&&(e&&s.hide(),!Common.Utils.isGecko&&(s.enabled=!e))}}this.disabled=e},isDisabled:function(){return this.disabled},setIconCls:function(e){var t=$(this.el).find("span.btn-icon"),n=this.iconCls;this.iconCls=e,t.removeClass(n),t.addClass(e||"")},setVisible:function(e){this.cmpEl&&this.cmpEl.toggleClass("hidden",!e)},updateHint:function(e){this.options.hint=e;if(!this.rendered)return;var t=this.cmpEl,n=t.closest(".asc-window");t.data("bs.tooltip")&&t.removeData("bs.tooltip"),t.attr("data-toggle","tooltip"),t.tooltip({title:e,placement:this.options.hintAnchor||"cursor"}),n.length>0&&t.data("bs.tooltip").tip().css("z-index",parseInt(n.css("z-index"))+10)},setCaption:function(e){if(this.caption!=e){this.caption=e;if(this.rendered){var t=this.cmpEl.find("button:first > .caption").andSelf().filter("button > .caption");t.length>0?t.text(e):this.cmpEl.find("button:first").andSelf().filter("button").text(e)}}},setMenu:function(e){e&&_.isObject(e)&&_.isFunction(e.render)&&(this.menu=e,this.rendered&&this.menu.render(this.cmpEl))}})});if(Common===undefined)var Common={};define("common/main/lib/component/ColorPalette",["common/main/lib/component/BaseView"],function(){"use strict";Common.UI.ColorPalette=Common.UI.BaseView.extend({options:{allowReselect:!0,cls:"",style:""},template:_.template(['<div class="palette-color">',"<% _.each(colors, function(color, index) { %>",'<span class="color-item" data-color="<%= color %>" style="background-color: #<%= color %>;"></span>',"<% }) %>","</div>"].join("")),initialize:function(e){Common.UI.BaseView.prototype.initialize.call(this,e);var t=this;this.id=t.options.id,this.cls=t.options.cls,this.style=t.options.style,this.colors=t.options.colors||[],this.value=t.options.value,t.options.el&&t.render()},render:function(e){var t=this;t.rendered?this.cmpEl=$(this.el):(this.cmpEl=$(this.template({id:this.id,cls:this.cls,style:this.style,colors:this.colors})),e?(this.setElement(e,!1),e.html(this.cmpEl)):$(this.el).html(this.cmpEl));if(!t.rendered){var n=this.cmpEl;n.on("click","span.color-item",_.bind(this.itemClick,this))}return t.rendered=!0,this},itemClick:function(e){var t=$(e.target);this.select(t.attr("data-color"))},select:function(e,t){if(this.value!=e){var n=this;$("span.color-item",this.cmpEl).removeClass("selected"),this.value=e,e&&/#?[a-fA-F0-9]{6}/.test(e)&&(e=/#?([a-fA-F0-9]{6})/.exec(e)[1].toUpperCase(),$("span[data-color="+e+"]",this.cmpEl).addClass("selected"),t||n.trigger("select",n,this.value))}}})}),define("text!common/main/lib/template/ExtendedColorDialog.template",[],function(){return'<div class="color-box">\r\n <div id="id-hsb-colorpicker" style="vertical-align:top;">\r\n </div>\r\n <div class="color-info" style="">\r\n <div style="margin-left:15px;">\r\n <label class="color-label"><%= txtNew %></label>\r\n <div id="field-new-color" class="color-cnt top"></div>\r\n <div id="field-start-color" class="color-cnt bottom"></div>\r\n <label class="color-label"><%= txtCurrent %></label>\r\n </div>\r\n <div style="padding:13px 0 2px 0;">\r\n <label class="input-label">R:</label>\r\n <div id="extended-spin-r" class="color-spin"></div>\r\n </div>\r\n <div style="padding:2px 0;">\r\n <label class="input-label">G:</label>\r\n <div id="extended-spin-g" class="color-spin"></div>\r\n </div>\r\n <div style="padding:2px 0;">\r\n <label class="input-label">B:</label>\r\n <div id="extended-spin-b" class="color-spin"></div>\r\n </div>\r\n <div style="padding:11px 0 0 0;">\r\n <label class="input-label" style="width:12px;">#:</label>\r\n <input id="extended-text-color" type="text" role="textbox" style="width:62px; height: 22px;">\r\n </div>\r\n </div>\r\n</div>\r\n<div class="footer center">\r\n <button class="btn normal dlg-btn primary" result="1"><%= txtAdd %></button>\r\n <button class="btn normal dlg-btn" result="0"><%= txtCancel %></button>\r\n</div>\r\n'});if(Common===undefined)var Common={};define("common/main/lib/component/HSBColorPicker",["common/main/lib/component/BaseView","common/main/lib/util/utils"],function(){"use strict";Common.UI.HSBColorPicker=Common.UI.BaseView.extend({template:_.template('<div class="hsb-colorpicker"><% if (this.showCurrentColor) { %><div class="top-panel"><span class="color-value"><span class="transparent-color img-colorpicker"></span></span><div class="color-text"></div></div><% } %><div><div class="cnt-hb img-colorpicker"><div class="cnt-hb-arrow img-colorpicker"></div></div><% if (this.changeSaturation) { %><div class="cnt-root"><div class="cnt-sat img-colorpicker"><div class="cnt-sat-arrow img-colorpicker"></div></div></div><% } %></div><% if (this.allowEmptyColor) { %><div class="empty-color"><%= this.textNoColor %></div><% } %></div>'),color:"#ff0000",options:{allowEmptyColor:!1,changeSaturation:!0,showCurrentColor:!0},initialize:function(e){Common.UI.BaseView.prototype.initialize.call(this,e);var t=this,n=$(this.el),r,i,s,o,u,a,f,l,c=0,h=100,p=100;t.allowEmptyColor=t.options.allowEmptyColor,t.changeSaturation=t.options.changeSaturation,t.showCurrentColor=t.options.showCurrentColor;var d=function(e,n){var r=new Common.Utils.RGBColor("hsb("+e.h+","+e.s+","+e.b+")"),i=r.toHex();t.color=n?"transparent":i,v(),t.trigger("changecolor",t,t.color)},v=function(){u.length>0&&a.length>0&&(t.color=="transparent"?a.show():(u.css("background-color",t.color),a.hide())),s.length>0&&s.css("background-color",(new Common.Utils.RGBColor("hsb("+c+", 100, 100)")).toHex()),f.length>0&&(f[0].innerHTML=t.color=="transparent"?t.textNoColor:t.color.toUpperCase()),r.length>0&&i.length>0&&(r.css("left",h+"%"),r.css("top",100-p+"%"),i.css("top",parseInt(c*100/360)+"%"))},m=function(e,t,n){if(r.length>0&&s.length>0){var i=[Math.max(0,Math.min(100,parseInt((e.pageX*Common.Utils.zoom()-s.offset().left)/s.width()*100))),Math.max(0,Math.min(100,parseInt((e.pageY*Common.Utils.zoom()-s.offset().top)/s.height()*100)))];r.css("left",i[0]+"%"),r.css("top",i[1]+"%"),h=i[0],p=100-i[1],d({h:c,s:h,b:p})}},g=function(e,t,n){if(i&&o){var r=Math.max(0,Math.min(100,parseInt((e.pageY*Common.Utils.zoom()-o.offset().top)/o.height()*100)));i.css("top",r+"%"),c=parseInt(360*r/100),d({h:c,s:h,b:p})}},y=function(e,t,n){$(document).on("mouseup",b),$(document).on("mousemove",m)},b=function(e,t,n){$(document).off("mouseup",b),$(document).off("mousemove",m),m(e,t,n)},w=function(e,t,n){$(document).on("mouseup",E),$(document).on("mousemove",g),g(e,t,n)},E=function(e,t,n){$(document).off("mouseup",E),$(document).off("mousemove",g)},S=function(e){var n=(new Common.util.RGBColor(t.color)).toHSB();d(n,!0)},x=function(e){var n=$(t.el),d;n&&(r=n.find(".cnt-hb-arrow"),i=n.find(".cnt-sat-arrow"),s=n.find(".cnt-hb"),o=n.find(".cnt-sat"),u=n.find(".color-value"),f=n.find(".color-text"),l=n.find(".empty-color"),u.length>0&&(a=u.find(".transparent-color")),s.length>0&&(s.off("mousedown"),s.on("mousedown",y)),o.length>0&&(o.off("mousedown"),o.on("mousedown",w)),l.length>0&&(l.off("click"),l.on("click",S)),t.color=="transparent"?d={h:0,s:100,b:100}:d=(new Common.Utils.RGBColor(t.color)).toHSB(),c=d.h,h=d.s,p=d.b,c==h&&c==p&&c==0&&(h=100),v())};t.setColor=function(e){if(t.color==e)return;var n;e=="transparent"?n={h:0,s:100,b:100}:n=(new Common.Utils.RGBColor(e)).toHSB(),c=n.h,h=n.s,p=n.b,c==h&&c==p&&c==0&&(h=100),t.color=e,v()},t.getColor=function(){return t.color},t.on("render:after",x),t.render()},render:function(){return $(this.el).html(this.template()),this.trigger("render:after",this),this},textNoColor:"No Color"})});if(Common===undefined)var Common={};define("common/main/lib/component/MaskedField",["common/main/lib/component/BaseView"],function(){"use strict";Common.UI.MaskedField=Common.UI.BaseView.extend({options:{maskExp:"",maxLength:999},initialize:function(e){Common.UI.BaseView.prototype.initialize.call(this,e);var t=this,n=$(this.el);n.addClass("masked-field user-select"),n.attr("maxlength",t.options.maxLength),n.on("keypress",function(e){var r=String.fromCharCode(e.which);!t.options.maskExp.test(r)&&!e.ctrlKey&&e.keyCode!==Common.UI.Keys.DELETE&&e.keyCode!==Common.UI.Keys.BACKSPACE&&e.keyCode!==Common.UI.Keys.LEFT&&e.keyCode!==Common.UI.Keys.RIGHT&&e.keyCode!==Common.UI.Keys.HOME&&e.keyCode!==Common.UI.Keys.END&&e.keyCode!==Common.UI.Keys.ESC&&e.keyCode!==Common.UI.Keys.INSERT&&e.keyCode!==Common.UI.Keys.TAB&&(e.keyCode==Common.UI.Keys.RETURN&&t.trigger("changed",t,n.val()),e.preventDefault(),e.stopPropagation())}),n.on("input",function(e){t.trigger("change",t,n.val())}),n.on("blur",function(e){t.trigger("changed",t,n.val())})},render:function(){return this},setValue:function(e){this.options.maskExp.test(e)&&e.length<=this.options.maxLength&&$(this.el).val(e)},getValue:function(){$(this.el).val()}})});if(Common===undefined)var Common={};define("common/main/lib/view/ExtendedColorDialog",["text!common/main/lib/template/ExtendedColorDialog.template","common/main/lib/component/HSBColorPicker","common/main/lib/component/MetricSpinner","common/main/lib/component/MaskedField","common/main/lib/component/Window"],function(e){"use strict";Common.UI.ExtendedColorDialog=Common.UI.Window.extend(_.extend({tpl:_.template(e),options:{},rendered:!1,initialize:function(e){Common.UI.Window.prototype.initialize.call(this,{cls:"extended-color-dlg",tpl:this.tpl({txtNew:this.textNew,txtCurrent:this.textCurrent,txtAdd:this.addButtonText,txtCancel:this.cancelButtonText}),header:!1,width:340,height:272}),this.hexRe=/\s*#?([0-9a-fA-F][0-9a-fA-F]?)([0-9a-fA-F][0-9a-fA-F]?)([0-9a-fA-F][0-9a-fA-F]?)\s*/},render:function(){function t(t){e.trigger("onmodalresult",parseInt(t.currentTarget.attributes.result.value)),e.close(!0)}var e=this;return Common.UI.Window.prototype.render.call(this),this.colorsPicker=new Common.UI.HSBColorPicker({el:$("#id-hsb-colorpicker"),showCurrentColor:!1}),this.colorsPicker.on("changecolor",_.bind(this.onChangeColor,this)),this.colorNew=$("#field-new-color"),this.colorSaved=$("#field-start-color"),this.spinR=new Common.UI.MetricSpinner({el:$("#extended-spin-r"),step:1,width:63,value:"0",defaultUnit:"",maxValue:255,minValue:0,tabindex:1,maskExp:/[0-9]/,allowDecimal:!1}),this.spinG=new Common.UI.MetricSpinner({el:$("#extended-spin-g"),step:1,width:63,value:"0",defaultUnit:"",maxValue:255,minValue:0,tabindex:2,maskExp:/[0-9]/,allowDecimal:!1}),this.spinB=new Common.UI.MetricSpinner({el:$("#extended-spin-b"),step:1,width:63,value:"0",defaultUnit:"",maxValue:255,minValue:0,tabindex:3,maskExp:/[0-9]/,allowDecimal:!1}),this.textColor=new Common.UI.MaskedField({el:$("#extended-text-color"),width:55,maskExp:/[a-fA-F0-9]/,maxLength:6}),this.spinR.on("change",_.bind(this.showColor,this,null,!0)).on("changing",_.bind(this.onChangingRGB,this,1)),this.spinG.on("change",_.bind(this.showColor,this,null,!0)).on("changing",_.bind(this.onChangingRGB,this,2)),this.spinB.on("change",_.bind(this.showColor,this,null,!0)).on("changing",_.bind(this.onChangingRGB,this,3)),this.textColor.on("change",_.bind(this.onChangeMaskedField,this)),this.textColor.on("changed",_.bind(this.onChangedMaskedField,this)),this.textColor.$el.attr("tabindex",4),this.spinR.$el.find("input").attr("maxlength",3),this.spinG.$el.find("input").attr("maxlength",3),this.spinB.$el.find("input").attr("maxlength",3),this.on("close",function(){e.trigger("onmodalresult",0)}),$(this)[0].getChild(".footer .dlg-btn").on("click",t),this.rendered=!0,this.color!==undefined&&this.setColor(this.color),this},onChangeColor:function(e,t){this.colorNew.css({"background-color":t}),this.stopevents=!0;var n=t.match(this.hexRe);this.spinR.setValue(parseInt(n[1],16)),this.spinG.setValue(parseInt(n[2],16)),this.spinB.setValue(parseInt(n[3],16)),this.textColor.setValue((n[1]+n[2]+n[3]).toUpperCase()),this.stopevents=!1},showColor:function(e,t){if(!this.stopevents){var n=this.spinR.getNumberValue(),r=n==null||n<0?0:n>255?255:n;t&&this.spinR.setValue(r,!0),r=r.toString(16),n=this.spinG.getNumberValue();var i=n==null||n<0?0:n>255?255:n;t&&this.spinG.setValue(i,!0),i=i.toString(16),n=this.spinB.getNumberValue();var s=n==null||n<0?0:n>255?255:n;t&&this.spinB.setValue(s,!0),s=s.toString(16);var o=(r.length==1?"0"+r:r)+(i.length==1?"0"+i:i)+(s.length==1?"0"+s:s);this.colorsPicker.setColor("#"+o),e!="hex"&&this.textColor.setValue(o.toUpperCase()),this.colorNew.css("background-color","#"+o)}},onChangingRGB:function(e,t,n,r){if(!this.stopevents){var i,s,o,u;n=_.isEmpty(n)||isNaN(parseInt(n))?parseInt(t.getValue()):parseInt(n);switch(e){case 1:i=(n==null||isNaN(n)||n<0?0:n>255?255:n).toString(16),u=this.spinG.getNumberValue(),s=(u==null||u<0?0:u>255?255:u).toString(16),u=this.spinB.getNumberValue(),o=(u==null||u<0?0:u>255?255:u).toString(16);break;case 2:u=this.spinR.getNumberValue(),i=(u==null||u<0?0:u>255?255:u).toString(16),s=(n==null||isNaN(n)||n<0?0:n>255?255:n).toString(16),u=this.spinB.getNumberValue(),o=(u==null||u<0?0:u>255?255:u).toString(16);break;case 3:u=this.spinR.getNumberValue(),i=(u==null||u<0?0:u>255?255:u).toString(16),u=this.spinG.getNumberValue(),s=(u==null||u<0?0:u>255?255:u).toString(16),o=(n==null||isNaN(n)||n<0?0:n>255?255:n).toString(16)}var a=(i.length==1?"0"+i:i)+(s.length==1?"0"+s:s)+(o.length==1?"0"+o:o);this.colorsPicker.setColor("#"+a),this.textColor.setValue(a.toUpperCase()),this.colorNew.css("background-color","#"+a)}},onChangeMaskedField:function(e,t){t=/^[a-fA-F0-9]{0,6}$/.test(t)?t:"000000",t="000000"+t;var n=t.match(/([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})$/i);this.stopevents=!0,this.spinR.setValue(parseInt(n[1],16)),this.spinG.setValue(parseInt(n[2],16)),this.spinB.setValue(parseInt(n[3],16)),this.stopevents=!1,this.rendered&&this.showColor("hex")},onChangedMaskedField:function(e,t){var n=this;(!/^[a-fA-F0-9]{0,6}$/.test(t)||_.isEmpty(t))&&e.setValue("000000"),this.rendered&&this.showColor("",!0)},getColor:function(){var e=/#?([a-fA-F0-9]{6})/.exec(this.colorsPicker.getColor());return e?e[1]:null},setColor:function(e){function r(){e=="transparent"?t.colorSaved.addClass("color-transparent"):(t.colorSaved.removeClass("color-transparent"),t.colorSaved.css("background-color","#"+e)),t.colorNew.css("background-color","#"+n)}var t=this;if(this.rendered!==!0){this.color=e;return}var n=/#?([a-fA-F0-9]{6})/.test(e)?e:"ff0000";t.colorsPicker.setColor("#"+n),r(),t.stopevents=!0;var i=t.hexRe.exec(n);t.spinR.setValue(parseInt(i[1],16)),t.spinG.setValue(parseInt(i[2],16)),t.spinB.setValue(parseInt(i[3],16)),t.textColor.setValue((i[1]+i[2]+i[3]).toUpperCase()),t.stopevents=!1},show:function(){Common.UI.Window.prototype.show.apply(this,arguments);var e=this;_.delay(function(){e.getChild("#extended-text-color").focus()},50)},cancelButtonText:"Cancel",addButtonText:"Add",textNew:"New",textCurrent:"Current",textRGBErr:"The entered value is incorrect.<br>Please enter a numeric value between 0 and 255.",textHexErr:"The entered value is incorrect.<br>Please enter a value between 000000 and FFFFFF."},Common.UI.ExtendedColorDialog||{}))});if(Common===undefined)var Common={};define("common/main/lib/component/ThemeColorPalette",["common/main/lib/component/BaseView","common/main/lib/view/ExtendedColorDialog"],function(){"use strict";Common.UI.ThemeColorPalette=Common.UI.BaseView.extend(_.extend({options:{dynamiccolors:10,standardcolors:10,themecolors:10,effects:5,allowReselect:!0,transparent:!1,value:"000000"},template:_.template('<div style="padding: 12px;"><% var me = this; %><% $(colors).each(function(num, item) { %><% if (me.isBlankSeparator(item)) { %> <div class="palette-color-spacer" style="width:100%;height:8px;float:left;"></div><% } else if (me.isSeparator(item)) { %> </div><div class="palette-color-separator" style="width:100%;height:1px;float:left;border-bottom: 1px solid #E0E0E0"></div><div style="padding: 12px;"><% } else if (me.isColor(item)) { %> <a class="palette-color color-<%=item%>" style="background:#<%=item%>" hidefocus="on"><em><span style="background:#<%=item%>;" unselectable="on"> </span></em></a><% } else if (me.isTransparent(item)) { %><a class="color-<%=item%>" hidefocus="on"><em><span unselectable="on"> </span></em></a><% } else if (me.isEffect(item)) { %><a effectid="<%=item.effectId%>" effectvalue="<%=item.effectValue%>" class="palette-color-effect color-<%=item.color%>" style="background:#<%=item.color%>" hidefocus="on"><em><span style="background:#<%=item.color%>;" unselectable="on"> </span></em></a><% } else if (me.isCaption(item)) { %><div class="palette-color-caption" style="width:100%;float:left;font-size: 11px;"><%=item%></div><% } %><% }); %></div><% if (me.options.dynamiccolors!==undefined) { %><div class="palette-color-spacer" style="width:100%;height:8px;float:left;"></div><div style="padding: 12px;"><% for (var i=0; i<me.options.dynamiccolors; i++) { %><a class="color-dynamic-<%=i%> dynamic-empty-color" style="background:#ffffff" color="" hidefocus="on"><em><span unselectable="on"> </span></em></a><% } %><% } %></div>'),colorRe:/(?:^|\s)color-(.{6})(?:\s|$)/,selectedCls:"selected",initialize:function(e){Common.UI.BaseView.prototype.initialize.call(this,e);var t=this,n=$(this.el);this.colors=t.options.colors||this.generateColorData(t.options.themecolors,t.options.effects,t.options.standardcolors,t.options.transparent),n.addClass("theme-colorpalette"),this.render(),this.options.updateColorsArr&&this.updateColors(this.options.updateColorsArr[0],this.options.updateColorsArr[1]),this.options.value&&this.select(this.options.value,!0),this.updateCustomColors(),n.closest(".btn-group").on("show.bs.dropdown",_.bind(this.updateCustomColors,this)),n.closest(".dropdown-submenu").on("show.bs.dropdown",_.bind(this.updateCustomColors,this)),n.on("click",_.bind(this.handleClick,this))},render:function(){return $(this.el).html(this.template({colors:this.colors})),this},isBlankSeparator:function(e){return typeof e=="string"&&e=="-"},isSeparator:function(e){return typeof e=="string"&&e=="--"},isColor:function(e){return typeof e=="string"&&/[0-9A-F]{6}/.test(e)},isTransparent:function(e){return typeof e=="string"&&e=="transparent"},isCaption:function(e){return typeof e=="string"&&e!="-"&&e!="--"&&!/[0-9A-F]{6}|transparent/.test(e)},isEffect:function(e){return typeof e=="object"&&e.effectId!==undefined},getColor:function(){return this.value},updateCustomColors:function(){var e=$(this.el);if(e){var t=Common.localStorage.getItem("asc."+Common.localStorage.getId()+".colors.custom");t=t?t.split(","):[];var n=-1,r,i=t.length<this.options.dynamiccolors?t.length:this.options.dynamiccolors;while(++n<i)r=e.find(".color-dynamic-"+n),r.removeClass("dynamic-empty-color").attr("color",t[n]),r.find("span").css({"background-color":"#"+t[n]})}},handleClick:function(e){var t=this,n=$(e.target).closest("a"),r,i;if(n.length==0)return;if(n.hasClass("color-transparent"))$(t.el).find("a."+t.selectedCls).removeClass(t.selectedCls),n.addClass(t.selectedCls),t.value="transparent",t.trigger("select",t,"transparent");else if(n[0].className.search("color-dynamic")<0){if(!/^[a-fA-F0-9]{6}$/.test(t.value)||_.indexOf(t.colors,t.value)<0)t.value=!1;$(t.el).find("a."+t.selectedCls).removeClass(t.selectedCls),n.addClass(t.selectedCls),r=n[0].className.match(t.colorRe)[1];if(n.hasClass("palette-color-effect")){var s=parseInt(n.attr("effectid"));r&&(t.value=r.toUpperCase(),t.trigger("select",t,{color:r,effectId:s}))}else/#?[a-fA-F0-9]{6}/.test(r)&&(r=/#?([a-fA-F0-9]{6})/.exec(r)[1].toUpperCase(),t.value=r,t.trigger("select",t,r))}else/dynamic-empty-color/.test(n[0].className)?setTimeout(function(){t.addNewColor()},10):($(t.el).find("a."+t.selectedCls).removeClass(t.selectedCls),n.addClass(t.selectedCls),r=n.attr("color"),r&&t.trigger("select",t,r),t.value=r.toUpperCase())},setCustomColor:function(e){var t=$(this.el);e=/#?([a-fA-F0-9]{6})/.exec(e);if(e){this.saveCustomColor(e[1]),t.find("a."+this.selectedCls).removeClass(this.selectedCls);var n=t.find(".dynamic-empty-color");n.length==0&&(this.updateCustomColors(),n=t.find(".color-dynamic-"+(this.options.dynamiccolors-1))),n.first().removeClass("dynamic-empty-color").addClass(this.selectedCls).attr("color",e[1]),n.first().find("span").css({"background-color":"#"+e[1]}),this.select(e[1],!0)}},saveCustomColor:function(e){var t="asc."+Common.localStorage.getId()+".colors.custom",n=Common.localStorage.getItem(t);n=n?n.split(","):[],n.push(e)>this.options.dynamiccolors&&n.shift(),Common.localStorage.setItem(t,n.join().toUpperCase())},addNewColor:function(e){var t=this,n=new Common.UI.ExtendedColorDialog({});n.on("onmodalresult",function(e){t._isdlgopen=!1,e==1&&(t.setCustomColor(n.getColor()),t.fireEvent("select",t,n.getColor()))}),t._isdlgopen=!0,n.setColor(t.value!==undefined&&t.value!==!1?t.value:e!==undefined?e:"000000"),n.show()},isDialogOpen:function(){return this._isdlgopen==1},select:function(e,t){var n=$(this.el);n.find("a."+this.selectedCls).removeClass(this.selectedCls);if(typeof e=="object"){var r;e.effectId!==undefined?(r=n.find('a[effectid="'+e.effectId+'"]').first(),r.length>0?(r.addClass(this.selectedCls),this.value=r[0].className.match(this.colorRe)[1].toUpperCase()):this.value=!1):e.effectValue!==undefined&&(r=n.find('a[effectvalue="'+e.effectValue+'"].color-'+e.color.toUpperCase()).first(),r.length>0?(r.addClass(this.selectedCls),this.value=r[0].className.match(this.colorRe)[1].toUpperCase()):this.value=!1)}else{/#?[a-fA-F0-9]{6}/.test(e)&&(e=/#?([a-fA-F0-9]{6})/.exec(e)[1].toUpperCase(),this.value=e);if(/^[a-fA-F0-9]{6}|transparent$/.test(e)&&_.indexOf(this.colors,e)>=0){_.indexOf(this.colors,this.value)<0&&(this.value=!1);if(e!=this.value||this.options.allowReselect)e=="transparent"?n.find("a.color-transparent").addClass(this.selectedCls):n.find("a.palette-color.color-"+e).first().addClass(this.selectedCls),this.value=e,t!==!0&&this.fireEvent("select",this,e)}else{var i=n.find("#"+e).first();i.length==0&&(i=n.find('a[color="'+e+'"]').first()),i.length>0&&(i.addClass(this.selectedCls),this.value=e.toUpperCase())}}},updateColors:function(e,t,n){if(e===undefined||t===undefined)return;var r=this,i=$(this.el);r.aColorElements===undefined&&(r.aColorElements=i.find("a.palette-color")),r.aEffectElements===undefined&&(r.aEffectElements=i.find("a.palette-color-effect"));var s,o=0,u=0;for(var a=0;a<r.colors.length;a++)if(typeof r.colors[a]=="string"&&/[0-9A-F]{6}/.test(r.colors[a])){if(o>=t.length)continue;s=$(r.aColorElements[o]),s.removeClass("color-"+r.colors[a]),r.colors[a]=t[o].toUpperCase(),s.addClass("color-"+r.colors[a]),s.css({background:"#"+r.colors[a]}),s.find("span").first().css({background:"#"+r.colors[a]}),o++}else if(typeof r.colors[a]=="object"&&r.colors[a].effectId!==undefined){if(u>=e.length)continue;s=$(r.aEffectElements[u]),e[u].color=e[u].color.toUpperCase(),r.colors[a].color!==e[u].color&&(s.removeClass("color-"+r.colors[a].color),s.addClass("color-"+e[u].color),s.css({background:"#"+e[u].color}),s.find("span").first().css({background:"#"+e[u].color})),r.colors[a].effectId!==e[u].effectId&&s.attr("effectid",""+e[u].effectId),r.colors[a].effectValue!==e[u].effectValue&&s.attr("effectvalue",""+e[u].effectValue),r.colors[a]=e[u],u++}if(n)this.select(n,!0);else{var f=$(this.el).find("a."+this.selectedCls);f.length&&f.hasClass("palette-color-effect")&&(this.value=f[0].className.match(this.colorRe)[1].toUpperCase())}this.options.updateColorsArr=undefined},clearSelection:function(e){$(this.el).find("a."+this.selectedCls).removeClass(this.selectedCls),this.value=undefined},generateColorData:function(e,t,n,r){var i=[],s=e>0&&t>0?e*t:0;if(e>0){i=[this.textThemeColors,"-"];for(var o=0;o<e;o++)i.push({color:"FFFFFF",effectId:1});t>0&&i.push("-");for(var o=0;o<s;o++)i.push({color:"FFFFFF",effectId:1});n&&i.push("-","--","-")}if(n){i.push(this.textStandartColors,"-"),r&&(i.push("transparent"),n--);for(var o=0;o<n;o++)i.push("FFFFFF")}return this.options.dynamiccolors&&(e||n)&&i.push("-","--"),i},textThemeColors:"Theme Colors",textStandartColors:"Standart Colors"},Common.UI.ThemeColorPalette||{}))});if(Common===undefined)var Common={};define("common/main/lib/component/DimensionPicker",["common/main/lib/component/BaseView"],function(){"use strict";Common.UI.DimensionPicker=Common.UI.BaseView.extend(function(){var e,t,n,r,i,s,o=0,u=0,a=function(t){e.setTableSize(Math.ceil((t.offsetX===undefined?t.originalEvent.layerX:t.offsetX*Common.Utils.zoom())/e.itemSize),Math.ceil((t.offsetY===undefined?t.originalEvent.layerY:t.offsetY*Common.Utils.zoom())/e.itemSize),t)},f=function(t){e.setTableSize(0,0,t)},l=function(t){e.trigger("select",e,o,u,t)};return{options:{itemSize:18,minRows:5,minColumns:5,maxRows:20,maxColumns:20},template:_.template(['<div style="width: 100%; height: 100%;">','<div class="dimension-picker-status">0x0</div>','<div class="dimension-picker-observecontainer">','<div class="dimension-picker-mousecatcher"></div>','<div class="dimension-picker-unhighlighted"></div>','<div class="dimension-picker-highlighted"></div>',"</div>","</div>"].join("")),initialize:function(c){Common.UI.BaseView.prototype.initialize.call(this,c),e=this,t=$(this.el),e.itemSize=e.options.itemSize,e.minRows=e.options.minRows,e.minColumns=e.options.minColumns,e.maxRows=e.options.maxRows,e.maxColumns=e.options.maxColumns,this.render(),t&&(n=t.find(".dimension-picker-mousecatcher"),r=t.find(".dimension-picker-unhighlighted"),i=t.find(".dimension-picker-highlighted"),s=t.find(".dimension-picker-status"),t.css({width:e.minColumns+"em"}),n.css("z-index",1),n.width(e.maxColumns+"em").height(e.maxRows+"em"),r.width(e.minColumns+"em").height(e.minRows+"em"),s.html(o+" x "+u),s.width(r.width())),n.on("mousemove",a),i.on("mousemove",a),r.on("mousemove",a),n.on("mouseleave",f),i.on("mouseleave",f),r.on("mouseleave",f),n.on("click",l),i.on("click",l),r.on("click",l)},render:function(){return $(this.el).html(this.template()),this},setTableSize:function(n,a,f){n>this.maxColumns&&(n=this.maxColumns),a>this.maxRows&&(a=this.maxRows);if(o!=n||u!=a)o=n,u=a,i.width(o+"em").height(u+"em"),r.width((o<e.minColumns?e.minColumns:o+1>e.maxColumns?e.maxColumns:o+1)+"em").height((u<e.minRows?e.minRows:u+1>e.maxRows?e.maxRows:u+1)+"em"),t.width(r.width()),s.html(o+" x "+u),s.width(r.width()),e.trigger("change",e,o,u,f)},getColumnsCount:function(){return o},getRowsCount:function(){return u}}}())});if(Common===undefined)var Common={};var FONT_TYPE_RECENT=4;define("common/main/lib/component/ComboBoxFonts",["common/main/lib/component/ComboBox"],function(){"use strict";Common.UI.ComboBoxFonts=Common.UI.ComboBox.extend(function(){var e=302,t=Asc.FONT_THUMBNAIL_HEIGHT||26,n=window.devicePixelRatio>1,r=document.createElement("canvas"),i=r.getContext("2d"),s="../../../../sdkjs/common/Images/fonts_thumbnail.png",o="../../../../sdkjs/common/Images/fonts_thumbnail@2x.png",u=36;return typeof window["AscDesktopEditor"]=="object"&&(s=window.AscDesktopEditor.getFontsSprite(),o=window.AscDesktopEditor.getFontsSprite(!0)),r.height=n?t*2:t,r.width=n?e*2:e,{template:_.template(['<div class="input-group combobox fonts <%= cls %>" id="<%= id %>" style="<%= style %>">','<input type="text" class="form-control">','<div style="display: table-cell;"></div>','<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"><span class="caret img-commonctrl"></span></button>','<ul class="dropdown-menu <%= menuCls %>" style="<%= menuStyle %>" role="menu">','<li class="divider">',"<% _.each(items, function(item) { %>",'<li id="<%= item.id %>">','<a class="font-item" tabindex="-1" type="menuitem" style="vertical-align:middle; margin: 0 0 0 -10px; height:<%=scope.getListItemHeight()%>px;"/>',"</li>","<% }); %>","</ul>","</div>"].join("")),initialize:function(e){Common.UI.ComboBox.prototype.initialize.call(this,_.extend(e,{displayField:"name",scroller:{alwaysVisibleY:!0,onChange:this.updateVisibleFontsTiles.bind(this)}})),this.recent=_.isNumber(e.recent)?e.recent:3,Common.NotificationCenter.on("fonts:change",_.bind(this.onApiChangeFont,this)),Common.NotificationCenter.on("fonts:load",_.bind(this.fillFonts,this))},render:function(e){var t=null;return _.isUndefined(this._input)||(t=this._input.val()),Common.UI.ComboBox.prototype.render.call(this,e),this.setRawValue(t),this._input.on("keyup",_.bind(this.onInputKeyUp,this)),this._input.on("keydown",_.bind(this.onInputKeyDown,this)),this},onAfterKeydownMenu:function(e){var t=this;if(e.keyCode==Common.UI.Keys.RETURN)return $(e.target).closest("input").length?this.lastValue!==this._input.val()&&this._input.trigger("change"):($(e.target).click(),this.rendered&&(Common.Utils.isIE?this._input.trigger("change",{onkeydown:!0}):this._input.blur())),!1;if(e.keyCode==Common.UI.Keys.ESC&&this.isMenuOpen())return this._input.val(this.lastValue),setTimeout(function(){t.closeMenu(),t.onAfterHideMenu(e)},10),!1;(e.keyCode==Common.UI.Keys.HOME||e.keyCode==Common.UI.Keys.END||e.keyCode==Common.UI.Keys.BACKSPACE)&&this.isMenuOpen()&&(t._input.focus(),setTimeout(function(){t._input[0].selectionStart=t._input[0].selectionEnd=e.keyCode==Common.UI.Keys.HOME?0:t._input[0].value.length},10)),this.updateVisibleFontsTiles()},onInputKeyUp:function(e){if(e.keyCode!=Common.UI.Keys.RETURN&&e.keyCode!==Common.UI.Keys.SHIFT&&e.keyCode!==Common.UI.Keys.CTRL&&e.keyCode!==Common.UI.Keys.ALT&&e.keyCode!==Common.UI.Keys.LEFT&&e.keyCode!==Common.UI.Keys.RIGHT&&e.keyCode!==Common.UI.Keys.HOME&&e.keyCode!==Common.UI.Keys.END&&e.keyCode!==Common.UI.Keys.ESC&&e.keyCode!==Common.UI.Keys.INSERT&&e.keyCode!==Common.UI.Keys.TAB){e.stopPropagation(),this.selectCandidate(e.keyCode==Common.UI.Keys.DELETE||e.keyCode==Common.UI.Keys.BACKSPACE);if(this._selectedItem){var t=this;t._timerSelection===undefined&&(t._timerSelection=setInterval(function(){if(new Date-t._inInputKeyDown<100||!t._selectedItem)return;clearInterval(t._timerSelection),t._timerSelection=undefined;var e=t._input[0],n=t._selectedItem.get(t.displayField),r=e.value;if(t.rendered)if(document.selection)document.selection.createRange().text=n;else if(e.selectionStart||e.selectionStart=="0")e.value=n,e.selectionStart=r.length,e.selectionEnd=n.length},10))}}},onInputKeyDown:function(e){this._inInputKeyDown=new Date;var t=this;e.keyCode==Common.UI.Keys.ESC?(this._input.val(this.lastValue),setTimeout(function(){t.closeMenu(),t.onAfterHideMenu(e)},10)):e.keyCode!=Common.UI.Keys.RETURN&&e.keyCode!=Common.UI.Keys.CTRL&&e.keyCode!=Common.UI.Keys.SHIFT&&e.keyCode!=Common.UI.Keys.ALT&&(!this.isMenuOpen()&&!e.ctrlKey&&this.openMenu(),e.keyCode==Common.UI.Keys.UP||e.keyCode==Common.UI.Keys.DOWN?_.delay(function(){var n=e.keyCode==Common.UI.Keys.DOWN?t.cmpEl.find("ul li.selected").nextAll("li:not(.divider)"):t.cmpEl.find("ul li.selected").prevAll("li:not(.divider)");n=n.length>0?n.eq(0):e.keyCode==Common.UI.Keys.DOWN?t.cmpEl.find("ul li:not(.divider):first"):t.cmpEl.find("ul li:not(.divider):last"),n=n.find("a"),t._skipInputChange=!0,n.focus(),t.updateVisibleFontsTiles()},10):t._skipInputChange=!1)},onInputChanged:function(e,t){if(t&&t.synthetic)return;if(this._skipInputChange){this._skipInputChange=!1;return}if(this._isMouseDownMenu){this._isMouseDownMenu=!1;return}var n=$(e.target).val(),r={};if(this.lastValue===n){t&&t.onkeydown&&this.trigger("combo:blur",this,e);return}r[this.valueField]=n,r[this.displayField]=n,this.trigger("changed:before",this,r,e);if(e.isDefaultPrevented())return;this._selectedItem?(r[this.valueField]=this._selectedItem.get(this.displayField),this.setRawValue(r[this.valueField]),this.trigger("selected",this,_.extend({},this._selectedItem.toJSON()),e),this.addItemToRecent(this._selectedItem),this.closeMenu()):(this.setRawValue(r[this.valueField]),r.isNewFont=!0,this.trigger("selected",this,r,e),this.closeMenu()),this.trigger("changed:after",this,r,e)},getImageUri:function(s){if(s.cloneid){var o=$(this.el).find("ul > li#"+s.cloneid+" img");return o!=null?o[0].src:undefined}return n?(i.clearRect(0,0,e*2,t*2),i.drawImage(this.spriteThumbs,0,-Asc.FONT_THUMBNAIL_HEIGHT*2*s.imgidx)):(i.clearRect(0,0,e,t),i.drawImage(this.spriteThumbs,0,-Asc.FONT_THUMBNAIL_HEIGHT*s.imgidx)),r.toDataURL()},getImageWidth:function(){return e},getImageHeight:function(){return t},getListItemHeight:function(){return u},loadSprite:function(e){e&&(this.spriteThumbs=new Image,this.spriteThumbs.onload=e,this.spriteThumbs.src=window.devicePixelRatio>1?o:s)},fillFonts:function(e,t){var n=this;this.loadSprite(function(){n.store.set(e.toJSON()),n.rendered=!1,n.render($(n.el)),n._fontsArray=n.store.toJSON(),n.recent>0&&(n.store.on("add",n.onInsertItem,n),n.store.on("remove",n.onRemoveItem,n))})},onApiChangeFont:function(e){var t=_.isFunction(e.get_Name)?e.get_Name():e.asc_getName();if(this.getRawValue()!==t){var n=this.store.findWhere({name:t});$(".selected",$(this.el)).removeClass("selected");if(n){this.setRawValue(n.get(this.displayField));var r=$("#"+n.get("id"),$(this.el)),i=$("ul.dropdown-menu",this.cmpEl);r&&i&&(r.addClass("selected"),this.recent<=0&&i.scrollTop(r.offset().top-i.offset().top))}else this.setRawValue(t)}},itemClicked:function(e){var t=$(e.target).closest("li"),n=this.store.findWhere({id:t.attr("id")});this.addItemToRecent(n),Common.UI.ComboBox.prototype.itemClicked.apply(this,arguments)},onInsertItem:function(e){$(this.el).find("ul").prepend(_.template(['<li id="<%= item.id %>">','<a class="font-item" tabindex="-1" type="menuitem" style="vertical-align:middle; margin: 0 0 0 -10px; height:<%=scope.getListItemHeight()%>px;"/>',"</li>"].join(""),{item:e.attributes,scope:this}))},onRemoveItem:function(e,t,n){$(this.el).find("ul > li#"+e.id).remove()},onBeforeShowMenu:function(e){Common.UI.ComboBox.prototype.onBeforeShowMenu.apply(this,arguments);if(!this.getSelectedRecord()&&!!this.getRawValue()){var t=this.store.where({name:this.getRawValue()});t&&t.length&&this.selectRecord(t[t.length-1])}},onAfterShowMenu:function(e){this.recent>0?(this.scroller&&!this._scrollerIsInited&&(this.scroller.update(),this._scrollerIsInited=!0),$(this.el).find("ul").scrollTop(0),this.trigger("show:after",this,e)):Common.UI.ComboBox.prototype.onAfterShowMenu.apply(this,arguments),this.flushVisibleFontsTiles(),this.updateVisibleFontsTiles(null,0)},onAfterHideMenu:function(e){this.lastValue!==this._input.val()&&this._input.val(this.lastValue),Common.UI.ComboBox.prototype.onAfterHideMenu.apply(this,arguments)},addItemToRecent:function(e){if(e.get("type")!=FONT_TYPE_RECENT&&!this.store.findWhere({name:e.get("name"),type:FONT_TYPE_RECENT})){var t=this.store.where({type:FONT_TYPE_RECENT});t.length<this.recent||this.store.remove(t[this.recent-1]);var n=e.clone();n.set({type:FONT_TYPE_RECENT,id:Common.UI.getId(),cloneid:e.id}),this.store.add(n,{at:0})}},selectCandidate:function(e){var t=this,n=this._input.val().toLowerCase();this._fontsArray||(this._fontsArray=this.store.toJSON());var r=_.find(this._fontsArray,function(r){return e?r[t.displayField].toLowerCase()==n:r[t.displayField].toLowerCase().indexOf(n)==0});r?this._selectedItem=this.store.findWhere({id:r.id}):this._selectedItem=null,$(".selected",$(this.el)).removeClass("selected");if(this._selectedItem){var i=$("#"+this._selectedItem.get("id"),$(this.el)),s=$("ul[role=menu]",$(this.el));if(i.length>0&&s.length>0){i.addClass("selected");var o=i.position().top,u=s.scrollTop();o!=0&&s.scrollTop(u+o)}}},updateVisibleFontsTiles:function(r,i){var s=this,o=0,a=s.store.length,f=0;s.tiles||(s.tiles=[]);if(a!==s.tiles.length)for(o=s.tiles.length;o<a;++o)s.tiles.unshift(null);_.isUndefined(i)&&(i=parseInt($(s.el).find(".ps-scrollbar-x-rail").css("bottom")));var l=$(s.el).find(".dropdown-menu").height(),c=Math.max(Math.floor(l/u)+3,0),h=Math.max(Math.floor(-(i/u))-1,0),p=h+c,d=$(s.el).find("a");for(o=0;o<a;++o)if(h<=o&&o<p){if(null===s.tiles[o]){var v=document.createElement("canvas"),m=v.getContext("2d");v.height=n?t*2:t,v.width=n?e*2:e,v.style.width=e+"px",v.style.height=t+"px",f=s.store.at(o).get("imgidx"),n?(m.clearRect(0,0,e*2,t*2),m.drawImage(s.spriteThumbs,0,-Asc.FONT_THUMBNAIL_HEIGHT*2*f)):(m.clearRect(0,0,e,t),m.drawImage(s.spriteThumbs,0,-Asc.FONT_THUMBNAIL_HEIGHT*f)),s.tiles[o]=v,$(d[o]).get(0).appendChild(v)}}else s.tiles[o]&&(s.tiles[o].parentNode.removeChild(s.tiles[o]),s.tiles[o]=null)},flushVisibleFontsTiles:function(){for(var e=this.tiles.length-1;e>=0;--e)this.tiles[e]&&(this.tiles[e].parentNode.removeChild(this.tiles[e]),this.tiles[e]=null)}}}())});if(Common===undefined)var Common={};define("common/main/lib/component/ComboDataView",["common/main/lib/component/BaseView","common/main/lib/component/DataView"],function(){"use strict";Common.UI.ComboDataView=Common.UI.BaseView.extend({options:{id:null,cls:"",style:"",hint:!1,itemWidth:80,itemHeight:40,menuMaxHeight:300,enableKeyEvents:!1,beforeOpenHandler:null,additionalMenuItems:null,showLast:!0},template:_.template(['<div id="<%= id %>" class="combo-dataview <%= cls %>" style="<%= style %>">','<div class="view"></div> ','<div class="button"></div> ',"</div>"].join("")),initialize:function(e){Common.UI.BaseView.prototype.initialize.call(this,e),this.id=this.options.id||Common.UI.getId(),this.cls=this.options.cls,this.style=this.options.style,this.hint=this.options.hint,this.store=this.options.store||new Common.UI.DataViewStore,this.itemWidth=this.options.itemWidth,this.itemHeight=this.options.itemHeight,this.menuMaxHeight=this.options.menuMaxHeight,this.beforeOpenHandler=this.options.beforeOpenHandler,this.showLast=this.options.showLast,this.rootWidth=0,this.rootHeight=0,this.rendered=!1,this.needFillComboView=!1,this.fieldPicker=new Common.UI.DataView({cls:"field-picker",allowScrollbar:!1,itemTemplate:_.template(['<div class="style" id="<%= id %>">','<img src="<%= imageUrl %>" width="'+this.itemWidth+'" height="'+this.itemHeight+'"/>','<% if (typeof title !== "undefined") {%>','<span class="title"><%= title %></span>',"<% } %>","</div>"].join(""))}),this.openButton=new Common.UI.Button({cls:"open-menu",menu:new Common.UI.Menu({menuAlign:"tl-tl",offset:[0,3],items:[{template:_.template('<div class="menu-picker-container"></div>')}]})}),this.options.additionalMenuItems!=null&&(this.openButton.menu.items=this.openButton.menu.items.concat(this.options.additionalMenuItems)),this.menuPicker=new Common.UI.DataView({cls:"menu-picker",parentMenu:this.openButton.menu,restoreHeight:this.menuMaxHeight,style:"max-height: "+this.menuMaxHeight+"px;",enableKeyEvents:this.options.enableKeyEvents,itemTemplate:_.template(['<div class="style" id="<%= id %>">','<img src="<%= imageUrl %>" width="'+this.itemWidth+'" height="'+this.itemHeight+'"/>','<% if (typeof title !== "undefined") {%>','<span class="title"><%= title %></span>',"<% } %>","</div>"].join(""))}),setInterval(_.bind(this.checkSize,this),500),this.options.el&&this.render()},render:function(e){if(!this.rendered){var t=this;t.trigger("render:before",t),t.cmpEl=$(t.el);var n=t.template({id:t.id,cls:t.cls,style:t.style});e?(t.setElement(e,!1),t.cmpEl=$(n),e.html(t.cmpEl)):t.cmpEl.html(n),t.rootWidth=t.cmpEl.width(),t.rootHeight=t.cmpEl.height(),t.fieldPicker.render($(".view",t.cmpEl)),t.openButton.render($(".button",t.cmpEl)),t.menuPicker.render($(".menu-picker-container",t.cmpEl)),t.openButton.menu.cmpEl&&t.openButton.menu.cmpEl&&(t.openButton.menu.menuAlignEl=t.cmpEl,t.openButton.menu.cmpEl.css("min-width",t.itemWidth),t.openButton.menu.on("show:before",_.bind(t.onBeforeShowMenu,t)),t.openButton.menu.on("show:after",_.bind(t.onAfterShowMenu,t)),t.openButton.cmpEl.on("hide.bs.dropdown",_.bind(t.onBeforeHideMenu,t)),t.openButton.cmpEl.on("hidden.bs.dropdown",_.bind(t.onAfterHideMenu,t))),t.options.hint&&(t.cmpEl.attr("data-toggle","tooltip"),t.cmpEl.tooltip({title:t.options.hint,placement:t.options.hintAnchor||"cursor"})),t.fieldPicker.on("item:select",_.bind(t.onFieldPickerSelect,t)),t.menuPicker.on("item:select",_.bind(t.onMenuPickerSelect,t)),t.fieldPicker.on("item:click",_.bind(t.onFieldPickerClick,t)),t.menuPicker.on("item:click",_.bind(t.onMenuPickerClick,t)),t.fieldPicker.on("item:contextmenu",_.bind(t.onPickerItemContextMenu,t)),t.menuPicker.on("item:contextmenu",_.bind(t.onPickerItemContextMenu,t)),t.fieldPicker.el.addEventListener("contextmenu",_.bind(t.onPickerComboContextMenu,t),!1),t.menuPicker.el.addEventListener("contextmenu",_.bind(t.onPickerComboContextMenu,t),!1),t.onResize(),t.rendered=!0,t.trigger("render:after",t)}return this},checkSize:function(){if(this.cmpEl&&this.cmpEl.is(":visible")){var e=this,t=this.cmpEl.width(),n=this.cmpEl.height();if(this.rootWidth!=t||this.rootHeight!=n)this.rootWidth=t,this.rootHeight=n,setTimeout(function(){e.openButton.menu.cmpEl.outerWidth(),e.rootWidth=e.cmpEl.width()},10),this.onResize()}},onResize:function(){if(this.openButton){var e=$("button",this.openButton.cmpEl);e&&e.css({width:$(".button",this.cmpEl).width(),height:$(".button",this.cmpEl).height()}),this.openButton.menu.hide();var t=this.menuPicker;if(t){var n=t.getSelectedRec();n&&(n=n[0],this.fillComboView(n||t.store.at(0),!!n,!0)),t.onResize()}}this.isSuspendEvents||this.trigger("resize",this)},onBeforeShowMenu:function(e){var t=this;if(_.isFunction(t.beforeOpenHandler))t.beforeOpenHandler(t,e);else if(t.openButton.menu.cmpEl){var n=0;try{var r=$($(".dropdown-menu .dataview.inner .style",t.cmpEl)[0]);n=r?parseInt(r.css("margin-left"))+parseInt(r.css("margin-right")):0}catch(e){}t.openButton.menu.cmpEl.css({width:Math.round((t.cmpEl.width()+n*t.fieldPicker.store.length)/t.itemWidth-.2)*(t.itemWidth+n),"min-height":this.cmpEl.height()})}if(t.options.hint){var i=t.cmpEl.data("bs.tooltip");i&&(i.dontShow===undefined&&(i.dontShow=!0),i.hide())}this.menuPicker.selectedBeforeHideRec=null},onBeforeHideMenu:function(e){this.trigger("hide:before",this,e),Common.UI.Scroller.isMouseCapture()&&e.preventDefault();if(this.isStylesNotClosable)return!1},onAfterShowMenu:function(e){var t=this;t.menuPicker.scroller&&t.menuPicker.scroller.update({includePadding:!0,suppressScrollX:!0,alwaysVisibleY:!0})},onAfterHideMenu:function(e,t){this.menuPicker.selectedBeforeHideRec=this.menuPicker.getSelectedRec()[0],this.showLast?this.menuPicker.showLastSelected():this.menuPicker.deselectAll(),this.trigger("hide:after",this,e,t)},onFieldPickerSelect:function(e,t,n){},onMenuPickerSelect:function(e,t,n,r){this.needFillComboView=this.disabled;if(this.disabled||r===!0)return;this.fillComboView(n,!1),n&&!this.isSuspendEvents&&this.trigger("select",this,n)},onFieldPickerClick:function(e,t,n){if(this.disabled)return;this.isSuspendEvents||this.trigger("click",this,n);if(this.options.hint){var r=this.cmpEl.data("bs.tooltip");r&&(r.dontShow===undefined&&(r.dontShow=!0),r.hide())}this.showLast||this.fieldPicker.deselectAll()},onMenuPickerClick:function(e,t,n){if(this.disabled)return;this.isSuspendEvents||this.trigger("click",this,n)},onPickerItemContextMenu:function(e,t,n,r){if(this.disabled)return;return this.isSuspendEvents||this.trigger("contextmenu",this,n,r),r.preventDefault(),r.stopPropagation(),!1},onPickerComboContextMenu:function(e){if(this.disabled)return;this.isSuspendEvents||this.trigger("contextmenu",this,undefined,e)},setDisabled:function(e){this.disabled=e;if(!this.rendered)return;this.cmpEl.toggleClass("disabled",e),$("button",this.openButton.cmpEl).toggleClass("disabled",e),this.fieldPicker.setDisabled(e);if(this.needFillComboView&&!e){var t=this.menuPicker;if(t){var n=t.getSelectedRec();n&&(n=n[0],this.fillComboView(n||t.store.at(0),!1))}}},isDisabled:function(){return this.disabled},fillComboView:function(e,t,n){if(!_.isUndefined(e)&&e instanceof Backbone.Model){this.needFillComboView=!1;var r=this,i=r.menuPicker.store,s=$(r.fieldPicker.el);if(i){if(n||!r.fieldPicker.store.findWhere({id:e.get("id")})){if(r.itemMarginLeft===undefined){var o=$($(this.menuPicker.el).find(".inner > div:not(.grouped-data):not(.ps-scrollbar-x-rail):not(.ps-scrollbar-y-rail)")[0]);o.length>0&&(r.itemMarginLeft=parseInt(o.css("margin-left")),r.itemMarginRight=parseInt(o.css("margin-right")),r.itemPaddingLeft=parseInt(o.css("padding-left")),r.itemPaddingRight=parseInt(o.css("padding-right")),r.itemBorderLeft=parseInt(o.css("border-left-width")),r.itemBorderRight=parseInt(o.css("border-right-width")))}r.fieldPicker.store.reset([]);var u=i.indexOf(e),a=i.length,f=Math.floor(s.width()/(r.itemWidth+(r.itemMarginLeft||0)+(r.itemMarginRight||0)+(r.itemPaddingLeft||0)+(r.itemPaddingRight||0)+(r.itemBorderLeft||0)+(r.itemBorderRight||0))),l=[];s.height()/r.itemHeight>2&&(f*=Math.floor(s.height()/r.itemHeight));if(u<0)return;u=Math.floor(u/f)*f,a-u<f&&(u=Math.max(a-f,0));for(var c=u,h=0;c<a&&h<f;c++,h++)l.push(i.at(c));r.fieldPicker.store.add(l)}if(t){var p=r.fieldPicker.store.findWhere({id:e.get("id")});p&&(r.suspendEvents(),r.fieldPicker.selectRecord(p,!0),r.resumeEvents())}}}},selectByIndex:function(e){e<0&&this.fieldPicker.deselectAll(),this.menuPicker.selectByIndex(e)},setItemWidth:function(e){this.itemWidth!=e&&(this.itemWidth=window.devicePixelRatio>1?e/2:e)},setItemHeight:function(e){this.itemHeight!=e&&(this.itemHeight=window.devicePixelRatio>1?e/2:e)},removeTips:function(){var e=this.menuPicker;_.each(e.dataViewItems,function(e){var t=e.$el.data("bs.tooltip");t&&t.tip().remove()},e)}})});if(Common===undefined)var Common={};define("common/main/lib/component/SynchronizeTip",["common/main/lib/component/BaseView"],function(){"use strict";Common.UI.SynchronizeTip=Common.UI.BaseView.extend(_.extend(function(){var e;return{options:{target:$(document.body),text:"",placement:"right"},template:_.template(['<div class="synch-tip-root <%= scope.placement %>">','<div class="asc-synchronizetip">','<div class="tip-arrow <%= scope.placement %>"></div>',"<div>",'<div class="tip-text" style="width: 260px;"><%= scope.text %></div>','<div class="close img-commonctrl"></div>',"</div>",'<div class="show-link"><label><%= scope.textDontShow %></label></div>',"</div>","</div>"].join("")),initialize:function(e){this.textSynchronize+=Common.Utils.String.platformKey("Ctrl+S"),Common.UI.BaseView.prototype.initialize.call(this,e),this.target=this.options.target,this.text=_.isEmpty(this.options.text)?this.textSynchronize:this.options.text,this.placement=this.options.placement},render:function(){return e=$(this.template({scope:this})),e.find(".close").on("click",_.bind(function(){this.trigger("closeclick")},this)),e.find(".show-link label").on("click",_.bind(function(){this.trigger("dontshowclick")},this)),$(document.body).append(e),this.applyPlacement(),this},show:function(){e?(this.applyPlacement(),e.show()):this.render()},hide:function(){e&&e.hide()},applyPlacement:function(){var t=this.target.offset();this.placement=="top"?e.css({bottom:Common.Utils.innerHeight()-t.top+"px",right:Common.Utils.innerWidth()-t.left-this.target.width()/2+"px"}):e.css({top:t.top+this.target.height()/2+"px",left:t.left+this.target.width()+"px"})},textDontShow:"Don't show this message again",textSynchronize:"The document has been changed by another user.<br/>Please click to save your changes and reload the updates."}}(),Common.UI.SynchronizeTip||{}))}),define("spreadsheeteditor/main/app/view/Toolbar",["jquery","underscore","backbone","text!spreadsheeteditor/main/app/template/Toolbar.template","common/main/lib/collection/Fonts","common/main/lib/component/Button","common/main/lib/component/ComboBox","common/main/lib/component/DataView","common/main/lib/component/ColorPalette","common/main/lib/component/ThemeColorPalette","common/main/lib/component/Menu","common/main/lib/component/DimensionPicker","common/main/lib/component/Window","common/main/lib/component/ComboBoxFonts","common/main/lib/component/ComboDataView","common/main/lib/component/SynchronizeTip"],function(e,t,n,r){"use strict";SSE.enumLock={editCell:"cell-editing",editFormula:"is-formula",editText:"is-text",selImage:"sel-image",selShape:"sel-shape",selShapeText:"sel-shape-txt",selChart:"sel-chart",selChartText:"sel-chart-txt",selRange:"sel-range",lostConnect:"disconnect",coAuth:"co-auth",coAuthText:"co-auth-text",ruleMerge:"rule-btn-merge",ruleFilter:"rule-filter",ruleDelFilter:"rule-clear-filter",menuFileOpen:"menu-file-open",cantPrint:"cant-print",multiselect:"is-multiselect",cantHyperlink:"cant-hyperlink"},SSE.Views.Toolbar=n.View.extend(t.extend({el:"#toolbar",template:t.template(r),events:{},initialize:function(){function i(){return{isDummy:!0,on:function(){}}}var n=this,r={};n.SchemeNames=[n.txtScheme1,n.txtScheme2,n.txtScheme3,n.txtScheme4,n.txtScheme5,n.txtScheme6,n.txtScheme7,n.txtScheme8,n.txtScheme9,n.txtScheme10,n.txtScheme11,n.txtScheme12,n.txtScheme13,n.txtScheme14,n.txtScheme15,n.txtScheme16,n.txtScheme17,n.txtScheme18,n.txtScheme19,n.txtScheme20,n.txtScheme21],n._state={hasCollaborativeChanges:undefined},n.btnSaveCls="btn-save",n.btnSaveTip=this.tipSave+Common.Utils.String.platformKey("Ctrl+S"),n.ascFormatOptions={General:"General",Number:"0.00",Currency:"$#,##0.00",Accounting:'_($* #,##0.00_);_($* (#,##0.00);_($* "-"??_);_(@_)',DateShort:"m/d/yyyy",DateLong:"[$-F800]dddd, mmmm dd, yyyy",Time:"[$-F400]h:mm:ss AM/PM",Percentage:"0.00%",Percent:"0%",Fraction:"# ?/?",Scientific:"0.00E+00",Text:"@"},n.numFormatData=[{value:Asc.c_oAscNumFormatType.General,format:this.ascFormatOptions.General,displayValue:this.txtGeneral,exampleval:"100"},{value:Asc.c_oAscNumFormatType.Number,format:this.ascFormatOptions.Number,displayValue:this.txtNumber,exampleval:"100,00"},{value:Asc.c_oAscNumFormatType.Scientific,format:this.ascFormatOptions.Scientific,displayValue:this.txtScientific,exampleval:"1,00E+02"},{value:Asc.c_oAscNumFormatType.Accounting,format:this.ascFormatOptions.Accounting,displayValue:this.txtAccounting,exampleval:"100,00 $"},{value:Asc.c_oAscNumFormatType.Currency,format:this.ascFormatOptions.Currency,displayValue:this.txtCurrency,exampleval:"100,00 $"},{value:Asc.c_oAscNumFormatType.Date,format:"MM-dd-yyyy",displayValue:this.txtDate,exampleval:"04-09-1900"},{value:Asc.c_oAscNumFormatType.Time,format:"HH:MM:ss",displayValue:this.txtTime,exampleval:"00:00:00"},{value:Asc.c_oAscNumFormatType.Percent,format:this.ascFormatOptions.Percentage,displayValue:this.txtPercentage,exampleval:"100,00%"},{value:Asc.c_oAscNumFormatType.Fraction,format:this.ascFormatOptions.Fraction,displayValue:this.txtFraction,exampleval:"100"},{value:Asc.c_oAscNumFormatType.Text,format:this.ascFormatOptions.Text,displayValue:this.txtText,exampleval:"100"}];var s=SSE.enumLock;n.cmbFontSize=new Common.UI.ComboBox({cls:"input-group-nr",menuStyle:"min-width: 55px;",hint:n.tipFontSize,lock:[s.selImage,s.editFormula,s.selRange,s.coAuth,s.coAuthText,s.lostConnect],data:[{value:8,displayValue:"8"},{value:9,displayValue:"9"},{value:10,displayValue:"10"},{value:11,displayValue:"11"},{value:12,displayValue:"12"},{value:14,displayValue:"14"},{value:16,displayValue:"16"},{value:18,displayValue:"18"},{value:20,displayValue:"20"},{value:22,displayValue:"22"},{value:24,displayValue:"24"},{value:26,displayValue:"26"},{value:28,displayValue:"28"},{value:36,displayValue:"36"},{value:48,displayValue:"48"},{value:72,displayValue:"72"}]}),n.btnNewDocument=new Common.UI.Button({id:"id-toolbar-btn-newdocument",cls:"btn-toolbar",iconCls:"btn-newdocument",lock:[s.lostConnect]}),n.btnOpenDocument=new Common.UI.Button({id:"id-toolbar-btn-opendocument",cls:"btn-toolbar",iconCls:"btn-opendocument",lock:[s.lostConnect]}),n.cmbFontName=new Common.UI.ComboBoxFonts({cls:"input-group-nr",menuCls:"scrollable-menu",menuStyle:"min-width: 325px;",hint:n.tipFontName,lock:[s.selImage,s.editFormula,s.selRange,s.coAuth,s.coAuthText,s.lostConnect],store:new Common.Collections.Fonts}),n.btnPrint=new Common.UI.Button({id:"id-toolbar-btn-print",cls:"btn-toolbar",iconCls:"btn-print",lock:[s.editCell,s.cantPrint]}),n.btnSave=new Common.UI.Button({id:"id-toolbar-btn-save",cls:"btn-toolbar",iconCls:n.btnSaveCls}),n.btnCopy=new Common.UI.Button({id:"id-toolbar-btn-copy",cls:"btn-toolbar",iconCls:"btn-copy"}),n.btnPaste=new Common.UI.Button({id:"id-toolbar-btn-paste",cls:"btn-toolbar",iconCls:"btn-paste",lock:[s.coAuth,s.lostConnect]}),n.btnUndo=new Common.UI.Button({id:"id-toolbar-btn-undo",cls:"btn-toolbar",iconCls:"btn-undo",disabled:!0,lock:[s.lostConnect]}),n.btnRedo=new Common.UI.Button({id:"id-toolbar-btn-redo",cls:"btn-toolbar",iconCls:"btn-redo",disabled:!0,lock:[s.lostConnect]}),n.btnIncFontSize=new Common.UI.Button({id:"id-toolbar-btn-incfont",cls:"btn-toolbar",iconCls:"btn-incfont",lock:[s.selImage,s.editFormula,s.selRange,s.coAuth,s.coAuthText,s.lostConnect]}),n.btnDecFontSize=new Common.UI.Button({id:"id-toolbar-btn-decfont",cls:"btn-toolbar",iconCls:"btn-decfont",lock:[s.selImage,s.editFormula,s.selRange,s.coAuth,s.coAuthText,s.lostConnect]}),n.btnBold=new Common.UI.Button({id:"id-toolbar-btn-bold",cls:"btn-toolbar",iconCls:"btn-bold",lock:[s.selImage,s.editFormula,s.selRange,s.coAuth,s.coAuthText,s.lostConnect],enableToggle:!0}),n.btnItalic=new Common.UI.Button({id:"id-toolbar-btn-italic",cls:"btn-toolbar",iconCls:"btn-italic",lock:[s.selImage,s.editFormula,s.selRange,s.coAuth,s.coAuthText,s.lostConnect],enableToggle:!0}),n.btnUnderline=new Common.UI.Button({id:"id-toolbar-btn-underline",cls:"btn-toolbar",iconCls:"btn-underline",lock:[s.selImage,s.editFormula,s.selRange,s.coAuth,s.coAuthText,s.lostConnect],enableToggle:!0}),n.mnuTextColorPicker=i(),n.btnTextColor=(new Common.UI.Button({id:"id-toolbar-btn-fontcolor",cls:"btn-toolbar",iconCls:"btn-fontcolor",split:!0,lock:[s.selImage,s.editFormula,s.selRange,s.coAuth,s.coAuthText,s.lostConnect],menu:new Common.UI.Menu({items:[{template:t.template('<div id="id-toolbar-menu-fontcolor" style="width: 169px; height: 220px; margin: 10px;"></div>')},{template:t.template('<a id="id-toolbar-menu-new-fontcolor" style="padding-left:12px;">'+n.textNewColor+"</a>")}]})})).on("render:after",function(t){var r=e('<div class="btn-color-value-line"></div>');e("button:first-child",t.cmpEl).append(r),r.css("background-color",t.currentColor||"transparent"),n.mnuTextColorPicker=new Common.UI.ThemeColorPalette({el:e("#id-toolbar-menu-fontcolor")})}),n.mnuBackColorPicker=i(),n.btnBackColor=(new Common.UI.Button({id:"id-toolbar-btn-fillparag",cls:"btn-toolbar",iconCls:"btn-fillparag",split:!0,lock:[s.selImage,s.editCell,s.coAuth,s.coAuthText,s.lostConnect],menu:new Common.UI.Menu({items:[{template:t.template('<div id="id-toolbar-menu-paracolor" style="width: 169px; height: 220px; margin: 10px;"></div>')},{template:t.template('<a id="id-toolbar-menu-new-paracolor" style="padding-left:12px;">'+n.textNewColor+"</a>")}]})})).on("render:after",function(t){var r=e('<div class="btn-color-value-line"></div>');e("button:first-child",t.cmpEl).append(r),r.css("background-color",t.currentColor||"transparent"),n.mnuBackColorPicker=new Common.UI.ThemeColorPalette({el:e("#id-toolbar-menu-paracolor"),transparent:!0})}),n.btnBorders=new Common.UI.Button({id:"id-toolbar-btn-borders",cls:"btn-toolbar",iconCls:"btn-border-out",icls:"btn-border-out",borderId:"outer",borderswidth:"thin",lock:[s.editCell,s.selChart,s.selChartText,s.selShape,s.selShapeText,s.selImage,s.lostConnect,s.coAuth],split:!0,menu:!0}),n.btnAlignLeft=new Common.UI.Button({id:"id-toolbar-btn-align-left",cls:"btn-toolbar",iconCls:"btn-align-left",enableToggle:!0,lock:[s.editCell,s.selChart,s.selChartText,s.selImage,s.lostConnect,s.coAuth,s.coAuthText],toggleGroup:"alignGroup"}),n.btnAlignCenter=new Common.UI.Button({id:"id-toolbar-btn-align-center",cls:"btn-toolbar",iconCls:"btn-align-center",enableToggle:!0,lock:[s.editCell,s.selChart,s.selChartText,s.selImage,s.lostConnect,s.coAuth,s.coAuthText],toggleGroup:"alignGroup"}),n.btnAlignRight=new Common.UI.Button({id:"id-toolbar-btn-align-right",cls:"btn-toolbar",iconCls:"btn-align-right",enableToggle:!0,lock:[s.editCell,s.selChart,s.selChartText,s.selImage,s.lostConnect,s.coAuth,s.coAuthText],toggleGroup:"alignGroup"}),n.btnAlignJust=new Common.UI.Button({id:"id-toolbar-btn-align-just",cls:"btn-toolbar",iconCls:"btn-align-just",enableToggle:!0,lock:[s.editCell,s.selChart,s.selChartText,s.selImage,s.lostConnect,s.coAuth,s.coAuthText],toggleGroup:"alignGroup"}),n.btnMerge=new Common.UI.Button({id:"id-toolbar-rtn-merge",cls:"btn-toolbar",iconCls:"btn-merge",enableToggle:!0,allowDepress:!0,split:!0,lock:[s.editCell,s.selShape,s.selShapeText,s.selChart,s.selChartText,s.selImage,s.lostConnect,s.coAuth,s.ruleMerge],menu:new Common.UI.Menu({items:[{caption:n.txtMergeCenter,value:Asc.c_oAscMergeOptions.MergeCenter},{caption:n.txtMergeAcross,value:Asc.c_oAscMergeOptions.MergeAcross},{caption:n.txtMergeCells,value:Asc.c_oAscMergeOptions.Merge},{caption:n.txtUnmerge,value:Asc.c_oAscMergeOptions.None}]})}),n.btnAlignTop=new Common.UI.Button({id:"id-toolbar-rtn-valign-top",cls:"btn-toolbar",iconCls:"btn-valign-top",lock:[s.editCell,s.selChart,s.selChartText,s.selImage,s.lostConnect,s.coAuth,s.coAuthText],enableToggle:!0,toggleGroup:"vAlignGroup"}),n.btnAlignMiddle=new Common.UI.Button({id:"id-toolbar-rtn-valign-middle",cls:"btn-toolbar",iconCls:"btn-valign-middle",enableToggle:!0,lock:[s.editCell,s.selChart,s.selChartText,s.selImage,s.lostConnect,s.coAuth,s.coAuthText],toggleGroup:"vAlignGroup"}),n.btnAlignBottom=new Common.UI.Button({id:"id-toolbar-rtn-valign-bottom",cls:"btn-toolbar",iconCls:"btn-valign-bottom",lock:[s.editCell,s.selChart,s.selChartText,s.selImage,s.lostConnect,s.coAuth,s.coAuthText],enableToggle:!0,toggleGroup:"vAlignGroup"}),n.btnWrap=new Common.UI.Button({id:"id-toolbar-rtn-wrap",cls:"btn-toolbar",iconCls:"btn-wrap",lock:[s.editCell,s.selChart,s.selChartText,s.selShape,s.selShapeText,s.selImage,s.lostConnect,s.coAuth],enableToggle:!0,allowDepress:!0}),n.btnTextOrient=new Common.UI.Button({id:"id-toolbar-rtn-textorient",cls:"btn-toolbar",iconCls:"btn-text-orient",lock:[s.editCell,s.selChart,s.selChartText,s.selShape,s.selShapeText,s.selImage,s.lostConnect,s.coAuth,s.coAuthText],menu:new Common.UI.Menu({items:[{caption:n.textHorizontal,iconCls:"mnu-direct-horiz",checkable:!0,toggleGroup:"textorientgroup",value:"horiz"},{caption:n.textCounterCw,iconCls:"mnu-direct-ccw",checkable:!0,toggleGroup:"textorientgroup",value:"countcw"},{caption:n.textClockwise,iconCls:"mnu-direct-cw",checkable:!0,toggleGroup:"textorientgroup",value:"clockwise"},{caption:n.textRotateUp,iconCls:"mnu-direct-rup",checkable:!0,toggleGroup:"textorientgroup",value:"rotateup"},{caption:n.textRotateDown,iconCls:"mnu-direct-rdown",checkable:!0,toggleGroup:"textorientgroup",value:"rotatedown"}]})}),n.btnInsertImage=new Common.UI.Button({id:"id-toolbar-btn-insertimage",cls:"btn-toolbar",iconCls:"btn-insertimage",lock:[s.editCell,s.selChartText,s.selImage,s.lostConnect,s.coAuth],menu:new Common.UI.Menu({items:[{caption:n.mniImageFromFile,value:"file"},{caption:n.mniImageFromUrl,value:"url"}]})}),n.btnInsertHyperlink=new Common.UI.Button({id:"id-toolbar-btn-inserthyperlink",cls:"btn-toolbar",iconCls:"btn-inserthyperlink",lock:[s.editCell,s.selChart,s.selChartText,s.selImage,s.selShape,s.cantHyperlink,s.multiselect,s.lostConnect,s.coAuth]}),n.btnInsertChart=new Common.UI.Button({id:"id-toolbar-btn-insertchart",cls:"btn-toolbar",iconCls:"btn-insertchart",lock:[s.editCell,s.selChartText,s.selShape,s.selShapeText,s.selImage,s.lostConnect,s.coAuth,s.coAuthText],menu:new Common.UI.Menu({style:"width: 435px;",items:[{template:t.template('<div id="id-toolbar-menu-insertchart" class="menu-insertchart" style="margin: 5px 5px 5px 10px;"></div>')}]})}),n.btnEditChart=new Common.UI.Button({id:"id-toolbar-rtn-edit-chart",cls:"btn-toolbar btn-text-value",caption:n.tipEditChart,lock:[s.lostConnect],style:"width: 120px;"}),n.btnInsertShape=new Common.UI.Button({id:"id-toolbar-btn-insertshape",cls:"btn-toolbar",iconCls:"btn-insertshape",enableToggle:!0,lock:[s.editCell,s.selChartText,s.selImage,s.lostConnect,s.coAuth],menu:new Common.UI.Menu({cls:"menu-shapes"})}),n.btnInsertText=new Common.UI.Button({id:"id-toolbar-btn-inserttext",cls:"btn-toolbar",iconCls:"btn-text",lock:[s.editCell,s.selChartText,s.selImage,s.lostConnect,s.coAuth],enableToggle:!0,split:!0,menu:new Common.UI.Menu({items:[{caption:this.textInsText,value:"text"},this.mnuInsertTextArt=new Common.UI.MenuItem({caption:this.textInsTextArt,value:"art",menu:new Common.UI.Menu({menuAlign:"tl-tr",cls:"menu-shapes",items:[{template:t.template('<div id="id-toolbar-menu-insart" style="width: 239px; margin-left: 5px;"></div>')}]})})]})}),this.btnInsertEquation=new Common.UI.Button({id:"id-toolbar-btn-insertequation",cls:"btn-toolbar",iconCls:"btn-insertequation",split:!0,lock:[s.editCell,s.selChartText,s.selImage,s.lostConnect,s.coAuth],menu:new Common.UI.Menu({cls:"menu-shapes"})}),n.btnSortDown=new Common.UI.Button({id:"id-toolbar-btn-sort-down",cls:"btn-toolbar",iconCls:"btn-sort-down",lock:[s.editCell,s.selChart,s.selChartText,s.selShape,s.selShapeText,s.selImage,s.lostConnect,s.coAuth,s.ruleFilter]}),n.btnSortUp=new Common.UI.Button({id:"id-toolbar-btn-sort-up",cls:"btn-toolbar",iconCls:"btn-sort-up",lock:[s.editCell,s.selChart,s.selChartText,s.selShape,s.selShapeText,s.selImage,s.lostConnect,s.coAuth,s.ruleFilter]}),n.btnSetAutofilter=new Common.UI.Button({id:"id-toolbar-btn-setautofilter",cls:"btn-toolbar",iconCls:"btn-autofilter",lock:[s.editCell,s.selChart,s.selChartText,s.selShape,s.selShapeText,s.selImage,s.lostConnect,s.coAuth,s.ruleFilter],enableToggle:!0}),n.btnClearAutofilter=new Common.UI.Button({id:"id-toolbar-btn-clearfilter",cls:"btn-toolbar",iconCls:"btn-clear-filter",lock:[s.editCell,s.selChart,s.selChartText,s.selShape,s.selShapeText,s.selImage,s.lostConnect,s.coAuth,s.ruleDelFilter]}),n.btnSearch=new Common.UI.Button({id:"id-toolbar-btn-search",cls:"btn-toolbar",iconCls:"btn-search",lock:[s.lostConnect]}),n.btnTableTemplate=new Common.UI.Button({id:"id-toolbar-btn-ttempl",cls:"btn-toolbar",iconCls:"btn-ttempl",lock:[s.editCell,s.selChart,s.selChartText,s.selShape,s.selShapeText,s.selImage,s.lostConnect,s.coAuth,s.ruleFilter,s.multiselect],menu:new Common.UI.Menu({items:[{template:t.template('<div id="id-toolbar-menu-table-templates" style="width: 288px; height: 300px; margin: 0px 4px;"></div>')}]})}),n.listStyles=new Common.UI.ComboDataView({cls:"combo-styles",enableKeyEvents:!0,itemWidth:112,itemHeight:38,hint:this.tipCellStyle,menuMaxHeight:226,lock:[s.editCell,s.selChart,s.selChartText,s.selShape,s.selShapeText,s.selImage,s.lostConnect,s.coAuth],beforeOpenHandler:function(t){var n=this,r=n.openButton.menu,i=6;if(r.cmpEl){var s=e(n.cmpEl.find(".dataview.inner .style").get(0)).parent(),o=-1,u=s.is(":visible")?parseInt(s.css("width")):n.itemWidth+parseInt(s.css("padding-left"))+parseInt(s.css("padding-right"))+parseInt(s.css("border-left-width"))+parseInt(s.css("border-right-width")),a=n.menuPicker.store.length>=i?i:n.menuPicker.store.length,f=Math.min(n.menuPicker.store.length,Math.round(e(".dataview",e(n.fieldPicker.el)).width()/(o+u)+.5));f=f<a?a:f,r.menuAlignEl=n.cmpEl,r.menuAlign="tl-tl";var l=n.cmpEl.width()-n.openButton.$el.width()-f*(o+u)-1;r.setOffset(Math.min(l,0)),r.cmpEl.css({width:f*(u+o),"min-height":n.cmpEl.height()})}}});var o=t.template(["<% _.each(items, function(item) { %>",'<li id="<%= item.id %>" data-value="<%= item.value %>"><a tabindex="-1" type="menuitem">','<div style="position: relative;"><div style="position: absolute; left: 0; width: 100px;"><%= scope.getDisplayValue(item) %></div>','<div style="display: inline-block; width: 100%; max-width: 300px; overflow: hidden; text-overflow: ellipsis; text-align: right; vertical-align: bottom; padding-left: 100px; color: silver;"><%= item.exampleval ? item.exampleval : "" %></div>',"</div></a></li>","<% }); %>",'<li class="divider">','<li id="id-toolbar-mnu-item-more-formats" data-value="-1"><a tabindex="-1" type="menuitem">'+n.textMoreFormats+"</a></li>"].join(""));n.cmbNumberFormat=new Common.UI.ComboBox({cls:"input-group-nr",menuStyle:"min-width: 180px;",hint:n.tipNumFormat,lock:[s.editCell,s.selChart,s.selChartText,s.selShape,s.selShapeText,s.selImage,s.selRange,s.lostConnect,s.coAuth],itemsTemplate:o,editable:!1,data:n.numFormatData}),n.btnPercentStyle=new Common.UI.Button({id:"id-toolbar-btn-percent-style",cls:"btn-toolbar",iconCls:"btn-percent-style",lock:[s.editCell,s.selChart,s.selChartText,s.selShape,s.selShapeText,s.selImage,s.lostConnect,s.coAuth],styleName:"Percent"}),n.btnCurrencyStyle=new Common.UI.Button({id:"id-toolbar-btn-accounting-style",cls:"btn-toolbar",iconCls:"btn-currency-style",lock:[s.editCell,s.selChart,s.selChartText,s.selShape,s.selShapeText,s.selImage,s.lostConnect,s.coAuth],styleName:"Currency",split:!0,menu:new Common.UI.Menu({style:"min-width: 120px;",items:[{caption:n.txtDollar,value:1033},{caption:n.txtEuro,value:1031},{caption:n.txtPound,value:2057},{caption:n.txtRouble,value:1049},{caption:n.txtYen,value:1041}]})}),n.btnDecDecimal=new Common.UI.Button({id:"id-toolbar-btn-decdecimal",cls:"btn-toolbar",iconCls:"btn-decdecimal",lock:[s.editCell,s.selChart,s.selChartText,s.selShape,s.selShapeText,s.selImage,s.lostConnect,s.coAuth]}),n.btnIncDecimal=new Common.UI.Button({id:"id-toolbar-btn-incdecimal",cls:"btn-toolbar",iconCls:"btn-incdecimal",lock:[s.editCell,s.selChart,s.selChartText,s.selShape,s.selShapeText,s.selImage,s.lostConnect,s.coAuth]}),n.btnInsertFormula=new Common.UI.Button({id:"id-toolbar-btn-insertformula",cls:"btn-toolbar",iconCls:"btn-formula",split:!0,lock:[s.editText,s.selChart,s.selChartText,s.selShape,s.selShapeText,s.selImage,s.selRange,s.lostConnect,s.coAuth],menu:new Common.UI.Menu({style:"min-width: 110px",items:[{caption:"SUM",value:"SUM"},{caption:"MIN",value:"MIN"},{caption:"MAX",value:"MAX"},{caption:"COUNT",value:"COUNT"},{caption:"--"},{caption:n.txtAdditional,value:"more"}]})}),n.btnNamedRange=new Common.UI.Button({id:"id-toolbar-btn-insertrange",cls:"btn-toolbar",iconCls:"btn-named-range",lock:[s.selChart,s.selChartText,s.selShape,s.selShapeText,s.selImage,s.lostConnect,s.coAuth,s.selRange],menu:new Common.UI.Menu({style:"min-width: 110px",items:[{caption:n.txtManageRange,lock:[s.editCell],value:"manage"},{caption:n.txtNewRange,lock:[s.editCell],value:"new"},{caption:n.txtPasteRange,value:"paste"}]})}),n.btnClearStyle=new Common.UI.Button({id:"id-toolbar-btn-clear",cls:"btn-toolbar",iconCls:"btn-clearstyle",lock:[s.lostConnect,s.coAuth,s.selRange],menu:new Common.UI.Menu({style:"min-width: 110px",items:[{caption:n.txtClearAll,value:Asc.c_oAscCleanOptions.All},{caption:n.txtClearText,lock:[s.editCell,s.selChart,s.selChartText,s.selShape,s.selShapeText,s.selImage,s.coAuth],value:Asc.c_oAscCleanOptions.Text},{caption:n.txtClearFormat,lock:[s.editCell,s.selChart,s.selChartText,s.selShape,s.selShapeText,s.selImage,s.coAuth],value:Asc.c_oAscCleanOptions.Format},{caption:n.txtClearComments,lock:[s.editCell,s.selChart,s.selChartText,s.selShape,s.selShapeText,s.selImage,s.coAuth],value:Asc.c_oAscCleanOptions.Comments},{caption:n.txtClearHyper,lock:[s.editCell,s.selChart,s.selChartText,s.selShape,s.selShapeText,s.selImage,s.coAuth],value:Asc.c_oAscCleanOptions.Hyperlinks}]})}),n.btnCopyStyle=new Common.UI.Button({id:"id-toolbar-btn-copystyle",cls:"btn-toolbar",iconCls:"btn-copystyle",lock:[s.editCell,s.lostConnect,s.coAuth,s.selChart],enableToggle:!0}),n.btnAddCell=new Common.UI.Button({id:"id-toolbar-btn-addcell",cls:"btn-toolbar",iconCls:"btn-addcell",lock:[s.editCell,s.selChart,s.selChartText,s.selShape,s.selShapeText,s.selImage,s.lostConnect,s.coAuth],menu:new Common.UI.Menu({items:[{caption:n.textInsRight,value:Asc.c_oAscInsertOptions.InsertCellsAndShiftRight},{caption:n.textInsDown,value:Asc.c_oAscInsertOptions.InsertCellsAndShiftDown},{caption:n.textEntireRow,value:Asc.c_oAscInsertOptions.InsertRows},{caption:n.textEntireCol,value:Asc.c_oAscInsertOptions.InsertColumns}]})}),n.btnDeleteCell=new Common.UI.Button({id:"id-toolbar-btn-delcell",cls:"btn-toolbar",iconCls:"btn-delcell",lock:[s.editCell,s.selChart,s.selChartText,s.selShape,s.selShapeText,s.selImage,s.lostConnect,s.coAuth],menu:new Common.UI.Menu({items:[{caption:n.textDelLeft,value:Asc.c_oAscDeleteOptions.DeleteCellsAndShiftLeft},{caption:n.textDelUp,value:Asc.c_oAscDeleteOptions.DeleteCellsAndShiftTop},{caption:n.textEntireRow,value:Asc.c_oAscDeleteOptions.DeleteRows},{caption:n.textEntireCol,value:Asc.c_oAscDeleteOptions.DeleteColumns}]})}),n.btnColorSchemas=new Common.UI.Button({id:"id-toolbar-btn-colorschemas",cls:"btn-toolbar",iconCls:"btn-colorschemas",lock:[s.editCell,s.selChart,s.selChartText,s.selShape,s.selShapeText,s.selImage,s.lostConnect,s.coAuth],menu:(new Common.UI.Menu({items:[],maxHeight:600,restoreHeight:600})).on("show:before",function(t){this.scroller||(this.scroller=new Common.UI.Scroller({el:e(this.el).find(".dropdown-menu "),useKeyboard:this.enableKeyEvents&&!this.handleSelect,minScrollbarLength:40,alwaysVisibleY:!0}))}).on("show:after",function(t,n){var r=e(this.el).find(".dropdown-menu "),i=Common.Utils.innerHeight(),s=r.outerHeight(),o=parseInt(r.css("top"));s>i?(r.css("max-height",i-parseInt(r.css("padding-top"))-parseInt(r.css("padding-bottom"))-5+"px"),this.scroller.update({minScrollbarLength:40})):r.height()<this.options.restoreHeight&&(r.css("max-height",Math.min(i-parseInt(r.css("padding-top"))-parseInt(r.css("padding-bottom"))-5,this.options.restoreHeight)+"px"),s=r.outerHeight(),o+s>i&&r.css("top",0),this.scroller.update({minScrollbarLength:40}))})}),n.mnuZoomIn=i(),n.mnuZoomOut=i();var u=function(e){var t={};for(var n in e)t[n]=typeof e[n]=="object"?u(e[n]):e[n];return t};this.mnuitemHideHeadings={conf:{checked:!1},setChecked:function(e){this.conf.checked=e},isChecked:function(){return this.conf.checked}},this.mnuitemHideGridlines=u(this.mnuitemHideHeadings),this.mnuitemFreezePanes=u(this.mnuitemHideHeadings),this.mnuZoom={options:{value:100}},n.btnShowMode=new Common.UI.Button({id:"id-toolbar-btn-showmode",cls:"btn-toolbar",iconCls:"btn-showmode",lock:[s.menuFileOpen,s.editCell],menu:!0}),n.btnSettings=new Common.UI.Button({id:"id-toolbar-btn-settings",cls:"btn-toolbar",iconCls:"btn-settings"}),n.btnHorizontalAlign=new Common.UI.Button({id:"id-toolbar-btn-halign",cls:"btn-toolbar",iconCls:"btn-align-left",icls:"btn-align-left",lock:[s.editCell,s.selChart,s.selChartText,s.lostConnect,s.coAuth,s.coAuthText],menu:new Common.UI.Menu({items:[{caption:n.tipAlignLeft,iconCls:"mnu-align-left",icls:"btn-align-left",checkable:!0,allowDepress:!0,toggleGroup:"halignGroup",checked:!0,value:"left"},{caption:n.tipAlignCenter,iconCls:"mnu-align-center",icls:"btn-align-center",checkable:!0,allowDepress:!0,toggleGroup:"halignGroup",value:"center"},{caption:n.tipAlignRight,iconCls:"mnu-align-right",icls:"btn-align-right",checkable:!0,allowDepress:!0,toggleGroup:"halignGroup",value:"right"},{caption:n.tipAlignJust,iconCls:"mnu-align-just",icls:"btn-align-just",checkable:!0,allowDepress:!0,toggleGroup:"halignGroup",value:"justify"}]})}),n.btnVerticalAlign=new Common.UI.Button({id:"id-toolbar-btn-valign",cls:"btn-toolbar",iconCls:"btn-valign-bottom",icls:"btn-valign-bottom",lock:[s.editCell,s.selChart,s.selChartText,s.lostConnect,s.coAuth,s.coAuthText],menu:new Common.UI.Menu({items:[{caption:n.tipAlignTop,iconCls:"mnu-valign-top",icls:"btn-valign-top",checkable:!0,allowDepress:!0,toggleGroup:"valignGroup",value:"top"},{caption:n.tipAlignCenter,iconCls:"mnu-valign-middle",icls:"btn-valign-middle",checkable:!0,allowDepress:!0,toggleGroup:"valignGroup",value:"center"},{caption:n.tipAlignBottom,iconCls:"mnu-valign-bottom",icls:"btn-valign-bottom",checkable:!0,allowDepress:!0,checked:!0,toggleGroup:"valignGroup",value:"bottom"}]})}),n.btnAutofilter=new Common.UI.Button({id:"id-toolbar-btn-autofilter",cls:"btn-toolbar",iconCls:"btn-autofilter",lock:[s.editCell,s.selChart,s.selChartText,s.selShape,s.selShapeText,s.selImage,s.lostConnect,s.coAuth,s.ruleFilter],menu:new Common.UI.Menu({items:[n.mnuitemSortAZ=new Common.UI.MenuItem({caption:n.txtSortAZ,iconCls:"mnu-sort-asc",lock:[s.selChart,s.selChartText,s.selShape,s.selShapeText,s.selImage,s.coAuth,s.ruleFilter],value:Asc.c_oAscSortOptions.Ascending}),n.mnuitemSortZA=new Common.UI.MenuItem({caption:n.txtSortZA,iconCls:"mnu-sort-desc",lock:[s.selChart,s.selChartText,s.selShape,s.selShapeText,s.selImage,s.coAuth,s.ruleFilter],value:Asc.c_oAscSortOptions.Descending}),n.mnuitemAutoFilter=new Common.UI.MenuItem({caption:n.txtFilter,iconCls:"mnu-filter-add",checkable:!0,lock:[s.selChart,s.selChartText,s.selShape,s.selShapeText,s.selImage,s.coAuth,s.ruleFilter],value:"set-filter"}),n.mnuitemClearFilter=new Common.UI.MenuItem({caption:n.txtClearFilter,iconCls:"mnu-filter-clear",lock:[s.editCell,s.selChart,s.selChartText,s.selShape,s.selShapeText,s.selImage,s.coAuth,s.ruleDelFilter],value:"clear-filter"})]})}),n.lockControls=[n.cmbFontName,n.cmbFontSize,n.btnIncFontSize,n.btnDecFontSize,n.btnBold,n.btnItalic,n.btnUnderline,n.btnTextColor,n.btnHorizontalAlign,n.btnAlignLeft,n.btnAlignCenter,n.btnAlignRight,n.btnAlignJust,n.btnVerticalAlign,n.btnAlignTop,n.btnAlignMiddle,n.btnAlignBottom,n.btnWrap,n.btnTextOrient,n.btnBackColor,n.btnMerge,n.btnInsertFormula,n.btnNamedRange,n.btnIncDecimal,n.btnInsertShape,n.btnInsertEquation,n.btnInsertText,n.btnSortUp,n.btnSortDown,n.btnSetAutofilter,n.btnClearAutofilter,n.btnTableTemplate,n.btnPercentStyle,n.btnCurrencyStyle,n.btnDecDecimal,n.btnAddCell,n.btnDeleteCell,n.cmbNumberFormat,n.btnBorders,n.btnInsertImage,n.btnInsertHyperlink,n.btnInsertChart,n.btnColorSchemas,n.btnAutofilter,n.btnCopy,n.btnPaste,n.btnSettings,n.listStyles,n.btnPrint,n.btnShowMode,n.btnClearStyle,n.btnCopyStyle];var a=Common.localStorage.getItem("sse-hide-synch");n.showSynchTip=!a||parseInt(a)!=1,n.needShowSynchTip=!1;var f=[n.cmbFontName,n.cmbFontSize,n.btnAlignLeft,n.btnAlignCenter,n.btnAlignRight,n.btnAlignJust,n.btnAlignTop,n.btnAlignMiddle,n.btnAlignBottom,n.btnHorizontalAlign,n.btnVerticalAlign,n.btnInsertImage,n.btnInsertText,n.btnInsertShape,n.btnInsertEquation,n.btnIncFontSize,n.btnDecFontSize,n.btnBold,n.btnItalic,n.btnUnderline,n.btnTextColor,n.btnBackColor,n.btnInsertHyperlink,n.btnBorders,n.btnTextOrient,n.btnPercentStyle,n.btnCurrencyStyle,n.btnColorSchemas,n.btnSettings,n.btnInsertFormula,n.btnNamedRange,n.btnDecDecimal,n.btnIncDecimal,n.cmbNumberFormat,n.btnWrap,n.btnInsertChart,n.btnMerge,n.btnAddCell,n.btnDeleteCell,n.btnShowMode,n.btnPrint,n.btnAutofilter,n.btnSortUp,n.btnSortDown,n.btnTableTemplate,n.btnSetAutofilter,n.btnClearAutofilter,n.btnSave,n.btnClearStyle,n.btnCopyStyle,n.btnCopy,n.btnPaste];return t.each(f,function(e){e&&t.isFunction(e.setDisabled)&&e.setDisabled(!0)}),this},lockToolbar:function(e,n,r){function s(e,r){if(t.contains(e.options.lock,r)){var i=e.keepState.indexOf(r);n?i<0&&e.keepState.push(r):i<0||e.keepState.splice(i,1)}}!r&&(r={});var i=r.array||this.lockControls;r.merge&&(i=t.union(this.lockControls,i)),t.each(i,function(n){t.isFunction(n.setDisabled)&&(!n.keepState&&(n.keepState=[]),r.clear&&r.clear.length>0&&n.keepState.length>0&&(n.keepState=t.difference(n.keepState,r.clear)),t.isArray(e)?t.each(e,function(e){s(n,e)}):s(n,e),n.keepState.length>0?!n.isDisabled()&&n.setDisabled(!0):n.isDisabled()&&n.setDisabled(!1))})},render:function(t){var n=this,r=e(this.el),i=JSON.parse(Common.localStorage.getItem("sse-toolbar-compact"));return i=!!(i!==null&&parseInt(i)==1||i===null&&t.customization&&t.customization.compactToolbar),this.trigger("render:before",this),r.html(this.template({isEditDiagram:t.isEditDiagram,isEditMailMerge:t.isEditMailMerge,isCompactView:i})),n.rendererComponents(t.isEditDiagram?"diagram":t.isEditMailMerge?"merge":i?"short":"full"),this.trigger("render:after",this),this},rendererComponents:function(t){var n=function(t,n){var r=e(t),i=r.get(0);i&&(n.rendered?(n.el=document.getElementById(n.id),n.el&&i.appendChild(document.getElementById(n.id))):n.render(r))};n("#id-toolbar-"+t+"-placeholder-field-fontname",this.cmbFontName),n("#id-toolbar-"+t+"-placeholder-field-fontsize",this.cmbFontSize),n("#id-toolbar-"+t+"-placeholder-btn-newdocument",this.btnNewDocument),n("#id-toolbar-"+t+"-placeholder-btn-opendocument",this.btnOpenDocument),n("#id-toolbar-"+t+"-placeholder-btn-print",this.btnPrint),n("#id-toolbar-"+t+"-placeholder-btn-save",this.btnSave),n("#id-toolbar-"+t+"-placeholder-btn-undo",this.btnUndo),n("#id-toolbar-"+t+"-placeholder-btn-redo",this.btnRedo),n("#id-toolbar-"+t+"-placeholder-btn-copy",this.btnCopy),n("#id-toolbar-"+t+"-placeholder-btn-paste",this.btnPaste),n("#id-toolbar-"+t+"-placeholder-btn-incfont",this.btnIncFontSize),n("#id-toolbar-"+t+"-placeholder-btn-decfont",this.btnDecFontSize),n("#id-toolbar-"+t+"-placeholder-btn-bold",this.btnBold),n("#id-toolbar-"+t+"-placeholder-btn-italic",this.btnItalic),n("#id-toolbar-"+t+"-placeholder-btn-underline",this.btnUnderline),n("#id-toolbar-"+t+"-placeholder-btn-fontcolor",this.btnTextColor),n("#id-toolbar-"+t+"-placeholder-btn-fillparag",this.btnBackColor),n("#id-toolbar-"+t+"-placeholder-btn-borders",this.btnBorders),n("#id-toolbar-"+t+"-placeholder-btn-align-left",this.btnAlignLeft),n("#id-toolbar-"+t+"-placeholder-btn-align-center",this.btnAlignCenter),n("#id-toolbar-"+t+"-placeholder-btn-align-right",this.btnAlignRight),n("#id-toolbar-"+t+"-placeholder-btn-align-just",this.btnAlignJust),n("#id-toolbar-"+t+"-placeholder-btn-merge",this.btnMerge),n("#id-toolbar-"+t+"-placeholder-btn-top",this.btnAlignTop),n("#id-toolbar-"+t+"-placeholder-btn-middle",this.btnAlignMiddle),n("#id-toolbar-"+t+"-placeholder-btn-bottom",this.btnAlignBottom),n("#id-toolbar-"+t+"-placeholder-btn-wrap",this.btnWrap),n("#id-toolbar-"+t+"-placeholder-btn-text-orient",this.btnTextOrient),n("#id-toolbar-"+t+"-placeholder-btn-insertimage",this.btnInsertImage),n("#id-toolbar-"+t+"-placeholder-btn-inserthyperlink",this.btnInsertHyperlink),n("#id-toolbar-"+t+"-placeholder-btn-insertshape",this.btnInsertShape),n("#id-toolbar-"+t+"-placeholder-btn-text",this.btnInsertText),n("#id-toolbar-"+t+"-placeholder-btn-insertequation",this.btnInsertEquation),n("#id-toolbar-"+t+"-placeholder-btn-sortdesc",this.btnSortDown),n("#id-toolbar-"+t+"-placeholder-btn-sortasc",this.btnSortUp),n("#id-toolbar-"+t+"-placeholder-btn-setfilter",this.btnSetAutofilter),n("#id-toolbar-"+t+"-placeholder-btn-clear-filter",this.btnClearAutofilter),n("#id-toolbar-"+t+"-placeholder-btn-table-tpl",this.btnTableTemplate),n("#id-toolbar-"+t+"-placeholder-btn-format",this.cmbNumberFormat),n("#id-toolbar-"+t+"-placeholder-btn-percents",this.btnPercentStyle),n("#id-toolbar-"+t+"-placeholder-btn-currency",this.btnCurrencyStyle),n("#id-toolbar-"+t+"-placeholder-btn-digit-dec",this.btnDecDecimal),n("#id-toolbar-"+t+"-placeholder-btn-digit-inc",this.btnIncDecimal),n("#id-toolbar-"+t+"-placeholder-btn-formula",this.btnInsertFormula),n("#id-toolbar-"+t+"-placeholder-btn-named-range",this.btnNamedRange),n("#id-toolbar-"+t+"-placeholder-btn-clear",this.btnClearStyle),n("#id-toolbar-"+t+"-placeholder-btn-copystyle",this.btnCopyStyle),n("#id-toolbar-"+t+"-placeholder-btn-cell-ins",this.btnAddCell),n("#id-toolbar-"+t+"-placeholder-btn-cell-del",this.btnDeleteCell),n("#id-toolbar-"+t+"-placeholder-btn-colorschemas",this.btnColorSchemas),n("#id-toolbar-"+t+"-placeholder-btn-hidebars",this.btnShowMode),n("#id-toolbar-"+t+"-placeholder-btn-settings",this.btnSettings),n("#id-toolbar-"+t+"-placeholder-btn-search",this.btnSearch),n("#id-toolbar-"+t+"-placeholder-btn-insertchart",this.btnInsertChart),n("#id-toolbar-diagram-placeholder-btn-chart",this.btnEditChart),n("#id-toolbar-short-placeholder-btn-halign",this.btnHorizontalAlign),n("#id-toolbar-short-placeholder-btn-valign",this.btnVerticalAlign),n("#id-toolbar-short-placeholder-btn-filter",this.btnAutofilter),n("#id-toolbar-full-placeholder-field-styles",this.listStyles)},createDelayedElements:function(){var n=this;this.btnNewDocument.updateHint(this.tipNewDocument),this.btnOpenDocument.updateHint(this.tipOpenDocument),this.btnPrint.updateHint(this.tipPrint+Common.Utils.String.platformKey("Ctrl+P")),this.btnSave.updateHint(this.btnSaveTip),this.btnCopy.updateHint(this.tipCopy+Common.Utils.String.platformKey("Ctrl+C")),this.btnPaste.updateHint(this.tipPaste+Common.Utils.String.platformKey("Ctrl+V")),this.btnUndo.updateHint(this.tipUndo+Common.Utils.String.platformKey("Ctrl+Z")),this.btnRedo.updateHint(this.tipRedo+Common.Utils.String.platformKey("Ctrl+Y")),this.btnIncFontSize.updateHint(this.tipIncFont+Common.Utils.String.platformKey("Ctrl+]")),this.btnDecFontSize.updateHint(this.tipDecFont+Common.Utils.String.platformKey("Ctrl+[")),this.btnBold.updateHint(this.textBold+Common.Utils.String.platformKey("Ctrl+B")),this.btnItalic.updateHint(this.textItalic+Common.Utils.String.platformKey("Ctrl+I")),this.btnUnderline.updateHint(this.textUnderline+Common.Utils.String.platformKey("Ctrl+U")),this.btnTextColor.updateHint(this.tipFontColor),this.btnBackColor.updateHint(this.tipPrColor),this.btnBorders.updateHint(this.tipBorders),this.btnAlignLeft.updateHint(this.tipAlignLeft),this.btnAlignCenter.updateHint(this.tipAlignCenter),this.btnAlignRight.updateHint(this.tipAlignRight),this.btnAlignJust.updateHint(this.tipAlignJust),this.btnMerge.updateHint(this.tipMerge),this.btnAlignTop.updateHint(this.tipAlignTop),this.btnAlignMiddle.updateHint(this.tipAlignMiddle),this.btnAlignBottom.updateHint(this.tipAlignBottom),this.btnWrap.updateHint(this.tipWrap),this.btnTextOrient.updateHint(this.tipTextOrientation),this.btnInsertImage.updateHint(this.tipInsertImage),this.btnInsertChart.updateHint(this.tipInsertChartSpark),this.btnInsertText.updateHint(this.tipInsertText),this.btnInsertHyperlink.updateHint(this.tipInsertHyperlink+Common.Utils.String.platformKey("Ctrl+K")),this.btnInsertShape.updateHint(this.tipInsertShape),this.btnInsertEquation.updateHint(this.tipInsertEquation),this.btnSortDown.updateHint(this.txtSortAZ),this.btnSortUp.updateHint(this.txtSortZA),this.btnSetAutofilter.updateHint(this.txtFilter+" (Ctrl+Shift+L)"),this.btnClearAutofilter.updateHint(this.txtClearFilter),this.btnSearch.updateHint(this.txtSearch),this.btnTableTemplate.updateHint(this.txtTableTemplate),this.btnPercentStyle.updateHint(this.tipDigStylePercent),this.btnCurrencyStyle.updateHint(this.tipDigStyleAccounting),this.btnDecDecimal.updateHint(this.tipDecDecimal),this.btnIncDecimal.updateHint(this.tipIncDecimal),this.btnInsertFormula.updateHint(this.txtFormula),this.btnNamedRange.updateHint(this.txtNamedRange),this.btnClearStyle.updateHint(this.tipClearStyle),this.btnCopyStyle.updateHint(this.tipCopyStyle),this.btnAddCell.updateHint(this.tipInsertOpt),this.btnDeleteCell.updateHint(this.tipDeleteOpt),this.btnColorSchemas.updateHint(this.tipColorSchemas),this.btnShowMode.updateHint(this.tipViewSettings),this.btnSettings.updateHint(this.tipAdvSettings),this.btnHorizontalAlign.updateHint(this.tipHAligh),this.btnVerticalAlign.updateHint(this.tipVAligh),this.btnAutofilter.updateHint(this.tipAutofilter);if(this.btnShowMode.rendered){this.btnShowMode.setMenu(new Common.UI.Menu({items:[this.mnuitemCompactToolbar=new Common.UI.MenuItem({caption:this.textCompactToolbar,checkable:!0,value:"compact"}),this.mnuitemHideTitleBar=new Common.UI.MenuItem({caption:this.textHideTBar,checkable:!0,value:"title"}),this.mnuitemHideFormulaBar=new Common.UI.MenuItem({caption:this.textHideFBar,checkable:!0,value:"formula"}),{caption:"--"},this.mnuitemHideHeadings=new Common.UI.MenuItem({caption:this.textHideHeadings,checkable:!0,checked:this.mnuitemHideHeadings.isChecked(),value:"headings"}),this.mnuitemHideGridlines=new Common.UI.MenuItem({caption:this.textHideGridlines,checkable:!0,checked:this.mnuitemHideGridlines.isChecked(),value:"gridlines"}),{caption:"--"},this.mnuitemFreezePanes=new Common.UI.MenuItem({caption:this.textFreezePanes,checkable:!0,checked:this.mnuitemFreezePanes.isChecked(),value:"freezepanes"}),{caption:"--"},this.mnuZoom=new Common.UI.MenuItem({template:t.template(['<div id="id-toolbar-menu-zoom" class="menu-zoom" style="height: 25px;" ',"<% if(!_.isUndefined(options.stopPropagation)) { %>",'data-stopPropagation="true"',"<% } %>",">",'<label class="title">'+this.textZoom+"</label>",'<button id="id-menu-zoom-in" type="button" style="float:right; margin: 2px 5px 0 0;" class="btn small btn-toolbar"><span class="btn-icon btn-zoomin"> </span></button>','<label class="zoom"><%= options.value %>%</label>','<button id="id-menu-zoom-out" type="button" style="float:right; margin-top: 2px;" class="btn small btn-toolbar"><span class="btn-icon btn-zoomout"> </span></button>',"</div>"].join("")),stopPropagation:!0,value:this.mnuZoom.options.value})]})),this.mnuZoomOut=new Common.UI.Button({el:e("#id-menu-zoom-out"),cls:"btn-toolbar"}),this.mnuZoomIn=new Common.UI.Button({el:e("#id-menu-zoom-in"),cls:"btn-toolbar"});var r={};JSON.parse(Common.localStorage.getItem("sse-hidden-title"))&&(r.title=!0),JSON.parse(Common.localStorage.getItem("sse-hidden-formula"))&&(r.formula=!0);var i=JSON.parse(Common.localStorage.getItem("sse-toolbar-compact"));i=!!(i!==null&&parseInt(i)==1||i===null&&this.mode.customization&&this.mode.customization.compactToolbar),this.mnuitemCompactToolbar.setChecked(i),this.mnuitemHideTitleBar.setChecked(!!r.title),this.mnuitemHideFormulaBar.setChecked(!!r.formula),this.mnuitemHideHeadings.setChecked(!!r.headings),(this.mode.isDesktopApp||this.mode.canBrandingExt&&this.mode.customization&&this.mode.customization.header===!1)&&this.mnuitemHideTitleBar.hide()}if(this.btnBorders.rendered){this.btnBorders.setMenu(new Common.UI.Menu({items:[{caption:this.textOutBorders,iconCls:"mnu-border-out",icls:"btn-border-out",borderId:"outer"},{caption:this.textAllBorders,iconCls:"mnu-border-all",icls:"btn-border-all",borderId:"all"},{caption:this.textTopBorders,iconCls:"mnu-border-top",icls:"btn-border-top",borderId:Asc.c_oAscBorderOptions.Top},{caption:this.textBottomBorders,iconCls:"mnu-border-bottom",icls:"btn-border-bottom",borderId:Asc.c_oAscBorderOptions.Bottom},{caption:this.textLeftBorders,iconCls:"mnu-border-left",icls:"btn-border-left",borderId:Asc.c_oAscBorderOptions.Left},{caption:this.textRightBorders,iconCls:"mnu-border-right",icls:"btn-border-right",borderId:Asc.c_oAscBorderOptions.Right},{caption:this.textNoBorders,iconCls:"mnu-border-no",icls:"btn-border-no",borderId:"none"},{caption:"--"},{caption:this.textInsideBorders,iconCls:"mnu-border-center",icls:"btn-border-center",borderId:"inner"},{caption:this.textCenterBorders,iconCls:"mnu-border-vmiddle",icls:"btn-border-vmiddle",borderId:Asc.c_oAscBorderOptions.InnerV},{caption:this.textMiddleBorders,iconCls:"mnu-border-hmiddle",icls:"btn-border-hmiddle",borderId:Asc.c_oAscBorderOptions.InnerH},{caption:this.textDiagUpBorder,iconCls:"mnu-border-diagup",icls:"btn-border-diagup",borderId:Asc.c_oAscBorderOptions.DiagU},{caption:this.textDiagDownBorder,iconCls:"mnu-border-diagdown",icls:"btn-border-diagdown",borderId:Asc.c_oAscBorderOptions.DiagD},{caption:"--"},{id:"id-toolbar-mnu-item-border-width",caption:this.textBordersStyle,iconCls:"mnu-icon-item mnu-border-width",template:t.template('<a id="<%= id %>" tabindex="-1" type="menuitem"><span class="menu-item-icon" style="background-image: none; width: 11px; height: 11px; margin: 2px 7px 0 -9px;"></span><%= caption %></a>'),menu:function(){var e=t.template('<a id="<%= id %>" tabindex="-1" type="menuitem"><div class="border-size-item" style="background-position: 0 -<%= options.offsety %>px;"></div></a>');return n.mnuBorderWidth=new Common.UI.Menu({style:"min-width: 100px;",menuAlign:"tl-tr",id:"toolbar-menu-borders-width",items:[{template:e,stopPropagation:!0,checkable:!0,toggleGroup:"border-width",value:Asc.c_oAscBorderStyles.Thin,offsety:0,checked:!0},{template:e,stopPropagation:!0,checkable:!0,toggleGroup:"border-width",value:Asc.c_oAscBorderStyles.Hair,offsety:20},{template:e,stopPropagation:!0,checkable:!0,toggleGroup:"border-width",value:Asc.c_oAscBorderStyles.Dotted,offsety:40},{template:e,stopPropagation:!0,checkable:!0,toggleGroup:"border-width",value:Asc.c_oAscBorderStyles.Dashed,offsety:60},{template:e,stopPropagation:!0,checkable:!0,toggleGroup:"border-width",value:Asc.c_oAscBorderStyles.DashDot,offsety:80},{template:e,stopPropagation:!0,checkable:!0,toggleGroup:"border-width",value:Asc.c_oAscBorderStyles.DashDotDot,offsety:100},{template:e,stopPropagation:!0,checkable:!0,toggleGroup:"border-width",value:Asc.c_oAscBorderStyles.Medium,offsety:120},{template:e,stopPropagation:!0,checkable:!0,toggleGroup:"border-width",value:Asc.c_oAscBorderStyles.MediumDashed,offsety:140},{template:e,stopPropagation:!0,checkable:!0,toggleGroup:"border-width",value:Asc.c_oAscBorderStyles.MediumDashDot,offsety:160},{template:e,stopPropagation:!0,checkable:!0,toggleGroup:"border-width",value:Asc.c_oAscBorderStyles.MediumDashDotDot,offsety:180},{template:e,stopPropagation:!0,checkable:!0,toggleGroup:"border-width",value:Asc.c_oAscBorderStyles.Thick,offsety:200}]}),n.mnuBorderWidth}()},this.mnuBorderColor=new Common.UI.MenuItem({id:"id-toolbar-mnu-item-border-color",caption:this.textBordersColor,iconCls:"mnu-icon-item mnu-border-color",template:t.template('<a id="<%= id %>"tabindex="-1" type="menuitem"><span class="menu-item-icon" style="background-image: none; width: 11px; height: 11px; margin: 2px 7px 0 -9px; border-style: solid; border-width: 3px; border-color: #000;"></span><%= caption %></a>'),menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{template:t.template('<div id="id-toolbar-menu-bordercolor" style="width: 169px; height: 220px; margin: 10px;"></div>'),stopPropagation:!0},{template:t.template('<a id="id-toolbar-menu-new-bordercolor" style="padding-left:12px;">'+this.textNewColor+"</a>"),stopPropagation:!0}]})})]}));var s=e('<div class="btn-color-value-line"></div>');e("button:first-child",this.btnBorders.cmpEl).append(s),s.css("background-color",this.btnBorders.currentColor||"transparent"),this.mnuBorderColorPicker=new Common.UI.ThemeColorPalette({el:e("#id-toolbar-menu-bordercolor")})}this.mnuInsertChartPicker=new Common.UI.DataView({el:e("#id-toolbar-menu-insertchart"),parentMenu:this.btnInsertChart.menu,showLast:!1,restoreHeight:539,groups:new Common.UI.DataViewGroupStore([{id:"menu-chart-group-bar",caption:n.textColumn,headername:n.textCharts},{id:"menu-chart-group-line",caption:n.textLine},{id:"menu-chart-group-pie",caption:n.textPie},{id:"menu-chart-group-hbar",caption:n.textBar},{id:"menu-chart-group-area",caption:n.textArea,inline:!0},{id:"menu-chart-group-scatter",caption:n.textPoint,inline:!0},{id:"menu-chart-group-stock",caption:n.textStock,inline:!0}]),store:new Common.UI.DataViewStore([{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barNormal,allowSelected:!0,iconCls:"column-normal",selected:!0},{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barStacked,allowSelected:!0,iconCls:"column-stack"},{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barStackedPer,allowSelected:!0,iconCls:"column-pstack"},{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barNormal3d,allowSelected:!0,iconCls:"column-3d-normal"},{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barStacked3d,allowSelected:!0,iconCls:"column-3d-stack"},{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barStackedPer3d,allowSelected:!0,iconCls:"column-3d-pstack"},{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barNormal3dPerspective,allowSelected:!0,iconCls:"column-3d-normal-per"},{group:"menu-chart-group-line",type:Asc.c_oAscChartTypeSettings.lineNormal,allowSelected:!0,iconCls:"line-normal"},{group:"menu-chart-group-line",type:Asc.c_oAscChartTypeSettings.lineStacked,allowSelected:!0,iconCls:"line-stack"},{group:"menu-chart-group-line",type:Asc.c_oAscChartTypeSettings.lineStackedPer,allowSelected:!0,iconCls:"line-pstack"},{group:"menu-chart-group-line",type:Asc.c_oAscChartTypeSettings.line3d,allowSelected:!0,iconCls:"line-3d"},{group:"menu-chart-group-pie",type:Asc.c_oAscChartTypeSettings.pie,allowSelected:!0,iconCls:"pie-normal"},{group:"menu-chart-group-pie",type:Asc.c_oAscChartTypeSettings.doughnut,allowSelected:!0,iconCls:"pie-doughnut"},{group:"menu-chart-group-pie",type:Asc.c_oAscChartTypeSettings.pie3d,allowSelected:!0,iconCls:"pie-3d-normal"},{group:"menu-chart-group-hbar",type:Asc.c_oAscChartTypeSettings.hBarNormal,allowSelected:!0,iconCls:"bar-normal"},{group:"menu-chart-group-hbar",type:Asc.c_oAscChartTypeSettings.hBarStacked,allowSelected:!0,iconCls:"bar-stack"},{group:"menu-chart-group-hbar",type:Asc.c_oAscChartTypeSettings.hBarStackedPer,allowSelected:!0,iconCls:"bar-pstack"},{group:"menu-chart-group-hbar",type:Asc.c_oAscChartTypeSettings.hBarNormal3d,allowSelected:!0,iconCls:"bar-3d-normal"},{group:"menu-chart-group-hbar",type:Asc.c_oAscChartTypeSettings.hBarStacked3d,allowSelected:!0,iconCls:"bar-3d-stack"},{group:"menu-chart-group-hbar",type:Asc.c_oAscChartTypeSettings.hBarStackedPer3d,allowSelected:!0,iconCls:"bar-3d-pstack"},{group:"menu-chart-group-area",type:Asc.c_oAscChartTypeSettings.areaNormal,allowSelected:!0,iconCls:"area-normal"},{group:"menu-chart-group-area",type:Asc.c_oAscChartTypeSettings.areaStacked,allowSelected:!0,iconCls:"area-stack"},{group:"menu-chart-group-area",type:Asc.c_oAscChartTypeSettings.areaStackedPer,allowSelected:!0,iconCls:"area-pstack"},{group:"menu-chart-group-scatter",type:Asc.c_oAscChartTypeSettings.scatter,allowSelected:!0,iconCls:"point-normal"},{group:"menu-chart-group-stock",type:Asc.c_oAscChartTypeSettings.stock,allowSelected:!0,iconCls:"stock-normal"}]),itemTemplate:t.template('<div id="<%= id %>" class="item-chartlist <%= iconCls %>"></div>')})},setApi:function(e){return this.api=e,!this.mode.isEditMailMerge&&!this.mode.isEditDiagram&&(this.api.asc_registerCallback("asc_onCollaborativeChanges",t.bind(this.onApiCollaborativeChanges,this)),this.api.asc_registerCallback("asc_onSendThemeColorSchemes",t.bind(this.onApiSendThemeColorSchemes,this)),this.api.asc_registerCallback("asc_onAuthParticipantsChanged",t.bind(this.onApiUsersChanged,this)),this.api.asc_registerCallback("asc_onParticipantsChanged",t.bind(this.onApiUsersChanged,this))),this},setMode:function(t){if(t.isDisconnected)this.lockToolbar(SSE.enumLock.lostConnect,!0),this.lockToolbar(SSE.enumLock.lostConnect,!0,{array:[this.btnEditChart,this.btnUndo,this.btnRedo,this.btnOpenDocument,this.btnNewDocument,this.btnSave]}),this.lockToolbar(SSE.enumLock.cantPrint,!t.canPrint||t.disableDownload,{array:[this.btnPrint]});else{this.mode=t;if(!t.nativeApp){var n=e(".toolbar-group-native");n&&n.hide()}t.isDesktopApp&&e(".toolbar-group-native").hide(),this.lockToolbar(SSE.enumLock.cantPrint,!t.canPrint,{array:[this.btnPrint]})}},onApiSendThemeColorSchemes:function(n){var r=this;this.mnuColorSchema=this.btnColorSchemas.menu,this.mnuColorSchema&&this.mnuColorSchema.items.length>0&&t.each(this.mnuColorSchema.items,function(e){e.remove()}),this.mnuColorSchema==null&&(this.mnuColorSchema=(new Common.UI.Menu({maxHeight:600,restoreHeight:600})).on("show:before",function(t){this.scroller=new Common.UI.Scroller({el:e(this.el).find(".dropdown-menu "),useKeyboard:this.enableKeyEvents&&!this.handleSelect,minScrollbarLength:40})})),this.mnuColorSchema.items=[];var i=t.template(['<a id="<%= id %>" class="<%= options.cls %>" tabindex="-1" type="menuitem">','<span class="colors">',"<% _.each(options.colors, function(color) { %>",'<span class="color" style="background: <%= color %>;"></span>',"<% }) %>","</span>",'<span class="text"><%= caption %></span>',"</a>"].join(""));t.each(n,function(e,t){var n=e.get_colors(),s=[];for(var o=2;o<7;o++){var u="#"+Common.Utils.ThemeColor.getHexColor(n[o].get_r(),n[o].get_g(),n[o].get_b());s.push(u)}t==21?this.mnuColorSchema.addItem({caption:"--"}):this.mnuColorSchema.addItem({template:i,cls:"color-schemas-menu",colors:s,caption:t<21?r.SchemeNames[t]||e.get_name():e.get_name(),value:t})},this)},onApiCollaborativeChanges:function(){if(this._state.hasCollaborativeChanges)return;if(!this.btnSave.rendered){this.needShowSynchTip=!0;return}this._state.hasCollaborativeChanges=!0;var t=e(".btn-icon",this.btnSave.cmpEl);t.removeClass(this.btnSaveCls),t.addClass("btn-synch"),this.showSynchTip?(this.btnSave.updateHint(""),this.synchTooltip===undefined&&this.createSynchTip(),this.synchTooltip.show()):this.btnSave.updateHint(this.tipSynchronize+Common.Utils.String.platformKey("Ctrl+S")),this.btnSave.setDisabled(!1),Common.Gateway.collaborativeChanges()},createSynchTip:function(){this.synchTooltip=new Common.UI.SynchronizeTip({target:e("#id-toolbar-btn-save")}),this.synchTooltip.on("dontshowclick",function(){this.showSynchTip=!1,this.synchTooltip.hide(),this.btnSave.updateHint(this.tipSynchronize+Common.Utils.String.platformKey("Ctrl+S")),Common.localStorage.setItem("sse-hide-synch",1)},this),this.synchTooltip.on("closeclick",function(){this.synchTooltip.hide(),this.btnSave.updateHint(this.tipSynchronize+Common.Utils.String.platformKey("Ctrl+S"))},this)},synchronizeChanges:function(){if(this.btnSave.rendered){var t=e(".btn-icon",this.btnSave.cmpEl);t.hasClass("btn-synch")&&(t.removeClass("btn-synch"),t.addClass(this.btnSaveCls),this.synchTooltip&&this.synchTooltip.hide(),this.btnSave.updateHint(this.btnSaveTip),this.btnSave.setDisabled(!this.mode.forcesave),this._state.hasCollaborativeChanges=!1)}},onApiUsersChanged:function(n){var r=[];t.each(n,function(e){e.asc_getView()||r.push(e)});var i=t.size(r),s=i>1?"btn-save-coauth":"btn-save";if(s!==this.btnSaveCls&&this.btnSave.rendered){this.btnSaveTip=(i>1?this.tipSaveCoauth:this.tipSave)+Common.Utils.String.platformKey("Ctrl+S");var o=e(".btn-icon",this.btnSave.cmpEl);o.hasClass("btn-synch")||(o.removeClass(this.btnSaveCls),o.addClass(s),this.btnSave.updateHint(this.btnSaveTip)),this.btnSaveCls=s}},textBold:"Bold",textItalic:"Italic",textUnderline:"Underline",tipFontName:"Font Name",tipFontSize:"Font Size",tipCellStyle:"Cell Style",tipCopy:"Copy",tipPaste:"Paste",tipUndo:"Undo",tipRedo:"Redo",tipPrint:"Print",tipSave:"Save",tipFontColor:"Font color",tipPrColor:"Background color",tipClearStyle:"Clear",tipCopyStyle:"Copy Style",tipBack:"Back",tipHAligh:"Horizontal Align",tipVAligh:"Vertical Align",tipAlignLeft:"Align Left",tipAlignRight:"Align Right",tipAlignCenter:"Align Center",tipAlignJust:"Justified",textAlignTop:"Align text to the top",textAlignMiddle:"Align text to the middle",textAlignBottom:"Align text to the bottom",tipNumFormat:"Number Format",txtNumber:"Number",txtInteger:"Integer",txtGeneral:"General",txtCustom:"Custom",txtCurrency:"Currency",txtDollar:"$ Dollar",txtEuro:"€ Euro",txtRouble:"₽ Rouble",txtPound:"£ Pound",txtYen:"¥ Yen",txtAccounting:"Accounting",txtDate:"Date",txtTime:"Time",txtDateTime:"Date & Time",txtPercentage:"Percentage",txtFraction:"Fraction",txtScientific:"Scientific",txtText:"Text",tipBorders:"Borders",textOutBorders:"Outside Borders",textAllBorders:"All Borders",textTopBorders:"Top Borders",textBottomBorders:"Bottom Borders",textLeftBorders:"Left Borders",textRightBorders:"Right Borders",textNoBorders:"No Borders",textInsideBorders:"Inside Borders",textMiddleBorders:"Inside Horizontal Borders",textCenterBorders:"Inside Vertical Borders",textDiagDownBorder:"Diagonal Down Border",textDiagUpBorder:"Diagonal Up Border",tipWrap:"Wrap Text",txtClearAll:"All",txtClearText:"Text",txtClearFormat:"Format",txtClearFormula:"Formula",txtClearHyper:"Hyperlink",txtClearComments:"Comments",tipMerge:"Merge",txtMergeCenter:"Merge Center",txtMergeAcross:"Merge Across",txtMergeCells:"Merge Cells",txtUnmerge:"Unmerge Cells",tipIncDecimal:"Increase Decimal",tipDecDecimal:"Decrease Decimal",tipAutofilter:"Set Autofilter",tipInsertImage:"Insert Picture",tipInsertHyperlink:"Add Hyperlink",tipSynchronize:"The document has been changed by another user. Please click to save your changes and reload the updates.",tipIncFont:"Increment font size",tipDecFont:"Decrement font size",tipInsertText:"Insert Text",tipInsertShape:"Insert Autoshape",tipDigStylePercent:"Percent Style",tipDigStyleAccounting:"Accounting Style",tipViewSettings:"View Settings",tipAdvSettings:"Advanced Settings",tipTextOrientation:"Orientation",tipInsertOpt:"Insert Cells",tipDeleteOpt:"Delete Cells",tipAlignTop:"Align Top",tipAlignMiddle:"Align Middle",tipAlignBottom:"Align Bottom",textBordersStyle:"Border Style",textBordersColor:"Borders Color",textAlignLeft:"Left align text",textAlignRight:"Right align text",textAlignCenter:"Center text",textAlignJust:"Justify",txtSort:"Sort",txtFormula:"Insert Function",txtNoBorders:"No borders",txtAdditional:"Additional",mniImageFromFile:"Picture from file",mniImageFromUrl:"Picture from url",textNewColor:"Add New Custom Color",tipInsertChart:"Insert Chart",tipEditChart:"Edit Chart",textPrint:"Print",textPrintOptions:"Print Options",tipColorSchemas:"Change Color Scheme",tipNewDocument:"New Document",tipOpenDocument:"Open Document",txtSortAZ:"Sort A to Z",txtSortZA:"Sort Z to A",txtFilter:"Filter",txtTableTemplate:"Format As Table Template",textHorizontal:"Horizontal Text",textCounterCw:"Angle Counterclockwise",textClockwise:"Angle Clockwise",textRotateUp:"Rotate Text Up",textRotateDown:"Rotate Text Down",textInsRight:"Shift Cells Right",textInsDown:"Shift Cells Down",textEntireRow:"Entire Row",textEntireCol:"Entire Column",textDelLeft:"Shift Cells Left",textDelUp:"Shift Cells Up",textZoom:"Zoom",textCompactToolbar:"Compact Toolbar",textHideTBar:"Hide Title Bar",textHideFBar:"Hide Formula Bar",textHideHeadings:"Hide Headings",textHideGridlines:"Hide Gridlines",textFreezePanes:"Freeze Panes",txtScheme1:"Office",txtScheme2:"Grayscale",txtScheme3:"Apex",txtScheme4:"Aspect",txtScheme5:"Civic",txtScheme6:"Concourse",txtScheme7:"Equity",txtScheme8:"Flow",txtScheme9:"Foundry",txtScheme10:"Median",txtScheme11:"Metro",txtScheme12:"Module",txtScheme13:"Opulent",txtScheme14:"Oriel",txtScheme15:"Origin",txtScheme16:"Paper",txtScheme17:"Solstice",txtScheme18:"Technic",txtScheme19:"Trek",txtScheme20:"Urban",txtScheme21:"Verve",txtClearFilter:"Clear Filter",tipSaveCoauth:"Save your changes for the other users to see them.",txtSearch:"Search",txtNamedRange:"Named Ranges",txtNewRange:"Define Name",txtManageRange:"Name manager",txtPasteRange:"Paste name",textInsText:"Insert text box",textInsTextArt:"Insert Text Art",textInsCharts:"Charts",textLine:"Line",textColumn:"Column",textBar:"Bar",textArea:"Area",textPie:"Pie",textPoint:"XY (Scatter)",textStock:"Stock",textLineSpark:"Line",textColumnSpark:"Column",textWinLossSpark:"Win/Loss",tipInsertEquation:"Insert Equation",textCharts:"Charts",textSparks:"Sparklines",tipInsertChartSpark:"Insert Chart or Sparkline",textMoreFormats:"More formats"},SSE.Views.Toolbar||{}))}),define("spreadsheeteditor/main/app/model/TableTemplate",["backbone"],function(e){"use strict";SSE.Models=SSE.Models||{},SSE.Models.TableTemplate=e.Model.extend({defaults:function(){return{id:Common.UI.getId(),name:null,caption:null,type:null,imageUrl:null}}})}),define("spreadsheeteditor/main/app/collection/TableTemplates",["backbone","spreadsheeteditor/main/app/model/TableTemplate"],function(e){"use strict";if(t===undefined)var t={};t.Collections=t.Collections||{},SSE.Collections.TableTemplates=e.Collection.extend({model:SSE.Models.TableTemplate})});if(Common===undefined)var Common={};define("spreadsheeteditor/main/app/view/TableOptionsDialog",["common/main/lib/component/ComboBox","common/main/lib/component/CheckBox","common/main/lib/component/InputField","common/main/lib/component/Window"],function(){"use strict";SSE.Views.TableOptionsDialog=Common.UI.Window.extend(_.extend({options:{width:350,cls:"modal-dlg",modal:!1},initialize:function(e){_.extend(this.options,{title:this.txtFormat},e),this.template=['<div class="box">','<div id="id-dlg-tableoptions-range" class="input-row" style="margin-bottom: 5px;"></div>','<div class="input-row" id="id-dlg-tableoptions-title" style="margin-top: 5px;"></div>',"</div>",'<div class="footer right">','<button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px;">'+this.okButtonText+"</button>",'<button class="btn normal dlg-btn" result="cancel">'+this.cancelButtonText+"</button>","</div>"].join(""),this.options.tpl=_.template(this.template,this.options),this.checkRangeType=Asc.c_oAscSelectionDialogType.FormatTable,Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this);var e=this.getChild(),t=this;t.inputRange=new Common.UI.InputField({el:$("#id-dlg-tableoptions-range"),name:"range",style:"width: 100%;",allowBlank:!1,blankError:this.txtEmpty,validateOnChange:!0}),t.cbTitle=new Common.UI.CheckBox({el:$("#id-dlg-tableoptions-title"),labelText:this.txtTitle}),e.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this)),t.inputRange.cmpEl.find("input").on("keypress",_.bind(this.onKeyPress,this)),this.on("close",_.bind(this.onClose,this))},onPrimary:function(){return this._handleInput("ok"),!1},setSettings:function(e){var t=this;if(e.api){t.api=e.api;if(e.range)t.cbTitle.setVisible(!1),t.setHeight(130),t.checkRangeType=Asc.c_oAscSelectionDialogType.FormatTableChangeRange,t.inputRange.setValue(e.range),t.api.asc_setSelectionDialogMode(Asc.c_oAscSelectionDialogType.FormatTable,e.range);else{var n=t.api.asc_getAddFormatTableOptions();t.inputRange.setValue(n.asc_getRange()),t.cbTitle.setValue(n.asc_getIsTitle()),t.api.asc_setSelectionDialogMode(Asc.c_oAscSelectionDialogType.FormatTable,n.asc_getRange())}e.title&&t.setTitle(e.title),t.api.asc_unregisterCallback("asc_onSelectionRangeChanged",_.bind(t.onApiRangeChanged,t)),t.api.asc_registerCallback("asc_onSelectionRangeChanged",_.bind(t.onApiRangeChanged,t)),Common.NotificationCenter.trigger("cells:range",Asc.c_oAscSelectionDialogType.FormatTable)}t.inputRange.validation=function(e){var n=t.api.asc_checkDataRange(t.checkRangeType,e,!1);return n==Asc.c_oAscError.ID.DataRangeError?t.txtInvalidRange:!0}},getSettings:function(){if(this.checkRangeType==Asc.c_oAscSelectionDialogType.FormatTable){var e=this.api.asc_getAddFormatTableOptions(this.inputRange.getValue());return e.asc_setIsTitle(this.cbTitle.checked),e}return this.inputRange.getValue()},onApiRangeChanged:function(e){this.inputRange.setValue(e),this.inputRange.cmpEl.hasClass("error")&&this.inputRange.cmpEl.removeClass("error")},isRangeValid:function(){var e=this.api.asc_checkDataRange(this.checkRangeType,this.inputRange.getValue(),!0);return e==Asc.c_oAscError.ID.No?!0:(e==Asc.c_oAscError.ID.AutoFilterDataRangeError?Common.UI.warning({msg:this.errorAutoFilterDataRange}):e==Asc.c_oAscError.ID.FTChangeTableRangeError?Common.UI.warning({msg:this.errorFTChangeTableRangeError}):e==Asc.c_oAscError.ID.FTRangeIncludedOtherTables&&Common.UI.warning({msg:this.errorFTRangeIncludedOtherTables}),!1)},onBtnClick:function(e){this._handleInput(e.currentTarget.attributes.result.value)},onClose:function(e){this.api&&this.api.asc_setSelectionDialogMode(Asc.c_oAscSelectionDialogType.None),Common.NotificationCenter.trigger("cells:range",Asc.c_oAscSelectionDialogType.None),Common.NotificationCenter.trigger("edit:complete",this),SSE.getController("RightMenu").SetDisabled(!1)},onKeyPress:function(e){e.keyCode==Common.UI.Keys.RETURN&&this._handleInput("ok")},_handleInput:function(e){if(this.options.handler){if(e=="ok"&&this.isRangeValid()!==!0)return;this.options.handler.call(this,this,e)}this.close()},show:function(){Common.UI.Window.prototype.show.call(this),SSE.getController("RightMenu").SetDisabled(!0)},txtTitle:"Title",txtFormat:"Create table",textCancel:"Cancel",txtEmpty:"This field is required",txtInvalidRange:"ERROR! Invalid cells range",errorAutoFilterDataRange:"The operation could not be done for the selected range of cells.<br>Select a uniform data range inside or outside the table and try again.",errorFTChangeTableRangeError:"Operation could not be completed for the selected cell range.<br>Select a range so that the first table row was on the same row<br>and the resulting table overlapped the current one.",errorFTRangeIncludedOtherTables:"Operation could not be completed for the selected cell range.<br>Select a range which does not include other tables."},SSE.Views.TableOptionsDialog||{}))}),define("spreadsheeteditor/main/app/view/NamedRangeEditDlg",["common/main/lib/view/AdvancedSettingsWindow","common/main/lib/component/ComboBox","common/main/lib/component/InputField"],function(){"use strict";SSE.Views=SSE.Views||{},SSE.Views.NamedRangeEditDlg=Common.Views.AdvancedSettingsWindow.extend(_.extend({options:{alias:"NamedRangeEditDlg",contentWidth:380,height:250},initialize:function(e){var t=this;_.extend(this.options,{title:this.txtTitleNew,template:['<div class="box" style="height:'+(t.options.height-85)+'px;">','<div class="content-panel" style="padding: 0;"><div class="inner-content">','<div class="settings-panel active">','<table cols="2" style="width: 100%;">',"<tr>",'<td colspan=2 class="padding-small">','<label class="header">',t.textName,"</label>",'<div id="named-range-txt-name" class="input-row" style="width:100%;"></div>',"</td>","</tr>","<tr>",'<td colspan=2 class="padding-small">','<label class="header">',t.textScope,"</label>",'<div id="named-range-combo-scope" class="input-group-nr" style="width:100%;"></div>',"</td>","</tr>","<tr>","<td colspan=2 >",'<label class="header">',t.textDataRange,"</label>","</td>","</tr>","<tr>",'<td class="padding-small">','<div id="named-range-txt-range" class="input-row" style="margin-right: 10px;"></div>',"</td>",'<td class="padding-small" style="text-align: right;" width="100">','<button type="button" class="btn btn-text-default" id="named-range-btn-data" style="min-width: 100px;width: auto;">',t.textSelectData,"</button>","</td>","</tr>","</table>","</div></div>","</div>","</div>",'<div class="separator horizontal"></div>','<div class="footer center">','<button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px; width: 86px;">'+t.okButtonText+"</button>",'<button class="btn normal dlg-btn" result="cancel" style="width: 86px;">'+t.cancelButtonText+"</button>","</div>"].join("")},e),this.api=e.api,this.handler=e.handler,this.isEdit=e.isEdit||!1,this.sheets=e.sheets||[],this.props=e.props,this.dataRangeValid="",this.wrapEvents={onRefreshDefNameList:_.bind(this.onRefreshDefNameList,this),onLockDefNameManager:_.bind(this.onLockDefNameManager,this)},Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this,this.options)},render:function(){Common.Views.AdvancedSettingsWindow.prototype.render.call(this);var e=this;this.inputName=(new Common.UI.InputField({el:$("#named-range-txt-name"),allowBlank:!1,placeHolder:this.namePlaceholder,blankError:this.txtEmpty,validateOnChange:!1,validateOnBlur:!1,style:"width: 100%;",validation:function(t){var n=e.api.asc_checkDefinedName(t,e.cmbScope.getValue()==-255?null:e.cmbScope.getValue());if(n.asc_getStatus()===!0)return!0;switch(n.asc_getReason()){case Asc.c_oAscDefinedNameReason.IsLocked:return e.textIsLocked;case Asc.c_oAscDefinedNameReason.Existed:return e.isEdit&&e.props.asc_getName().toLowerCase()==t.toLowerCase()?!0:e.textExistName;case Asc.c_oAscDefinedNameReason.NameReserved:return e.isEdit?e.textReservedName:!0;default:return e.textInvalidName}}})).on("keypress:after",function(t,n){n.keyCode===Common.UI.Keys.RETURN&&e.onDlgBtnClick("ok")}),this.cmbScope=new Common.UI.ComboBox({el:$("#named-range-combo-scope"),style:"width: 100%;",menuStyle:"min-width: 100%;max-height: 280px;",editable:!1,cls:"input-group-nr",data:[]}),this.txtDataRange=(new Common.UI.InputField({el:$("#named-range-txt-range"),name:"range",style:"width: 100%;",allowBlank:!0,blankError:this.txtEmpty,validateOnChange:!0,validation:function(t){if(_.isEmpty(t))return!0;var n=e.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.Chart,t,!1);return n!==Asc.c_oAscError.ID.DataRangeError||e.isEdit&&e.props.asc_getRef().toLowerCase()==t.toLowerCase()?!0:e.textInvalidRange}})).on("keypress:after",function(t,n){n.keyCode===Common.UI.Keys.RETURN&&e.onDlgBtnClick("ok")}),this.btnSelectData=new Common.UI.Button({el:$("#named-range-btn-data")}),this.btnSelectData.on("click",_.bind(this.onSelectData,this)),this.afterRender()},afterRender:function(){this._setDefaults(this.props),this.setTitle(this.isEdit?this.txtTitleEdit:this.txtTitleNew),this.api.asc_registerCallback("asc_onLockDefNameManager",this.wrapEvents.onLockDefNameManager),this.api.asc_registerCallback("asc_onRefreshDefNameList",this.wrapEvents.onRefreshDefNameList)},show:function(){Common.Views.AdvancedSettingsWindow.prototype.show.apply(this,arguments);var e=this;_.delay(function(){e.inputName.cmpEl.find("input").focus()},200)},_setDefaults:function(e){this.cmbScope.setData([{value:-255,displayValue:this.strWorkbook}].concat(this.sheets));if(e){var t=e.asc_getScope();this.cmbScope.setValue(t===null?-255:t),t=e.asc_getName(),_.isEmpty(t)||this.inputName.setValue(t),t=e.asc_getRef(),this.txtDataRange.setValue(t?t:""),this.dataRangeValid=t,this.txtDataRange.setDisabled(this.isEdit&&e.asc_getIsTable()),this.btnSelectData.setDisabled(this.isEdit&&e.asc_getIsTable())}else this.cmbScope.setValue(-255);this.cmbScope.setDisabled(this.isEdit)},onSelectData:function(){var e=this;if(e.api){var t=function(t,n){n=="ok"&&(e.dataRangeValid=t.getSettings(),e.txtDataRange.setValue(e.dataRangeValid),e.txtDataRange.checkValidate())},n=(new SSE.Views.CellRangeDialog({handler:t})).on("close",function(){e.show()}),r=e.$window.offset();e.hide(),n.show(r.left+65,r.top+77),n.setSettings({api:e.api,range:!_.isEmpty(e.txtDataRange.getValue())&&e.txtDataRange.checkValidate()==1?e.txtDataRange.getValue():e.dataRangeValid,type:Asc.c_oAscSelectionDialogType.Chart})}},getSettings:function(){return new Asc.asc_CDefName(this.inputName.getValue(),this.txtDataRange.getValue(),this.cmbScope.getValue()==-255?null:this.cmbScope.getValue(),this.props.asc_getIsTable())},onPrimary:function(){return!0},onDlgBtnClick:function(e){var t=this,n=typeof e=="object"?e.currentTarget.attributes.result.value:e;if(n=="ok"){if(this.locked){Common.UI.alert({closable:!1,msg:this.errorCreateDefName,title:this.notcriticalErrorTitle,iconCls:"warn",buttons:["ok"],callback:function(e){t.close()}});return}var r=this.inputName.checkValidate(),i=this.txtDataRange.checkValidate();if(r!==!0){this.inputName.cmpEl.find("input").focus();return}if(i!==!0){this.txtDataRange.cmpEl.find("input").focus();return}this.handler&&this.handler.call(this,n,n=="ok"?this.getSettings():undefined)}this.close()},onLockDefNameManager:function(e){this.locked=e==Asc.c_oAscDefinedNameReason.LockDefNameManager},onRefreshDefNameList:function(e){var t=Common.localStorage.getItem("sse-settings-coauthmode"),n=this;this.isEdit&&(t===null||parseInt(t)==1)&&e&&e.asc_getIsLock()&&e.asc_getName().toLowerCase()==this.props.asc_getName().toLowerCase()&&(e.asc_getScope()===null&&this.props.asc_getScope()===null||e.asc_getScope().toLowerCase()==this.props.asc_getScope().toLowerCase())&&!this._listRefreshed&&(this._listRefreshed=!0,Common.UI.alert({closable:!1,msg:this.errorCreateDefName,title:this.notcriticalErrorTitle,iconCls:"warn",buttons:["ok"],callback:function(e){n.close()}}))},close:function(){this.api.asc_unregisterCallback("asc_onLockDefNameManager",this.wrapEvents.onLockDefNameManager),this.api.asc_unregisterCallback("asc_onRefreshDefNameList",this.wrapEvents.onRefreshDefNameList),Common.UI.Window.prototype.close.call(this)},txtTitleNew:"New Name",txtTitleEdit:"Edit Name",cancelButtonText:"Cancel",okButtonText:"Ok",textSelectData:"Select Data",textName:"Name",textScope:"Scope",textDataRange:"Data Range",namePlaceholder:"Defined name",strWorkbook:"Workbook",txtEmpty:"This field is required",textInvalidRange:"ERROR! Invalid cells range",textInvalidName:"ERROR! Invalid range name",textExistName:"ERROR! Range with such a name already exists",textIsLocked:"This element is being edited by another user.",errorCreateDefName:"The existing named ranges cannot be edited and the new ones cannot be created<br>at the moment as some of them are being edited.",notcriticalErrorTitle:"Warning",textReservedName:"The name you are trying to use is already referenced in cell formulas. Please use some other name."},SSE.Views.NamedRangeEditDlg||{}))}),define("spreadsheeteditor/main/app/view/NamedRangePasteDlg",["common/main/lib/view/AdvancedSettingsWindow","common/main/lib/component/ListView"],function(){"use strict";SSE.Views=SSE.Views||{},SSE.Views.NamedRangePasteDlg=Common.Views.AdvancedSettingsWindow.extend(_.extend({options:{alias:"NamedRangePasteDlg",contentWidth:250,height:282},initialize:function(e){var t=this;_.extend(this.options,{title:this.txtTitle,template:['<div class="box" style="height:'+(t.options.height-85)+'px;">','<div class="content-panel" style="padding: 0;"><div class="inner-content">','<div class="settings-panel active">','<table cols="1" style="width: 100%;">',"<tr>",'<td class="padding-small">','<label class="input-label">',t.textNames,"</label>",'<div id="named-range-paste-list" class="range-tableview" style="width:100%; height: 150px;"></div>',"</td>","</tr>","</table>","</div></div>","</div>","</div>",'<div class="separator horizontal"></div>','<div class="footer center">','<button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px; width: 86px;">'+t.okButtonText+"</button>",'<button class="btn normal dlg-btn" result="cancel" style="width: 86px;">'+t.cancelButtonText+"</button>","</div>"].join("")},e),this.handler=e.handler,this.ranges=e.ranges||[],Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this,this.options)},render:function(){Common.Views.AdvancedSettingsWindow.prototype.render.call(this);var e=this;this.rangeList=new Common.UI.ListView({el:$("#named-range-paste-list",this.$window),store:new Common.UI.DataViewStore,simpleAddMode:!0,template:_.template(['<div class="listview inner" style=""></div>'].join("")),itemTemplate:_.template(['<div style="pointer-events:none;">','<div id="<%= id %>" class="list-item" style="pointer-events:none;width: 100%;display:inline-block;">','<div class="listitem-icon <% if (isTable) {%>listitem-table<%} %>"></div>','<div style="width:186px;padding-right: 5px;"><%= name %></div>',"</div>","</div>"].join(""))}),this.rangeList.store.comparator=function(e,t){var n=e.get("name").toLowerCase(),r=t.get("name").toLowerCase();return n==r?0:n<r?-1:1},this.rangeList.on("item:dblclick",_.bind(this.onDblClickFunction,this)),this.rangeList.on("entervalue",_.bind(this.onPrimary,this)),this.afterRender()},afterRender:function(){this._setDefaults()},_setDefaults:function(){if(this.ranges){var e=this,t=[],n="";for(var r=0;r<this.ranges.length;r++){var i=this.ranges[r].asc_getName();i!==n&&t.push({name:i,scope:this.ranges[r].asc_getScope(),range:this.ranges[r].asc_getRef(),isTable:this.ranges[r].asc_getIsTable()===!0}),n=i}this.rangeList.store.reset(t),this.rangeList.store.sort(),this.rangeList.store.length>0&&this.rangeList.selectByIndex(0),this.rangeList.scroller.update({alwaysVisibleY:!0}),_.delay(function(){e.rangeList.cmpEl.find(".listview").focus()},100,this)}},getSettings:function(){var e=this.rangeList.getSelectedRec();return e.length>0?new Asc.asc_CDefName(e[0].get("name"),e[0].get("range"),e[0].get("scope"),e[0].get("isTable")):null},onPrimary:function(){return this.handler&&this.handler.call(this,"ok",this.getSettings()),this.close(),!1},onDlgBtnClick:function(e){var t=e.currentTarget.attributes.result.value;this.handler&&this.handler.call(this,t,t=="ok"?this.getSettings():undefined),this.close()},onDblClickFunction:function(){this.handler&&this.handler.call(this,"ok",this.getSettings()),this.close()},txtTitle:"Paste Name",cancelButtonText:"Cancel",okButtonText:"Ok",textNames:"Named Ranges"},SSE.Views.NamedRangePasteDlg||{}))}),define("spreadsheeteditor/main/app/view/FormatSettingsDialog",["common/main/lib/util/utils","common/main/lib/component/MetricSpinner","common/main/lib/component/ComboBox","common/main/lib/view/AdvancedSettingsWindow"],function(){"use strict";SSE.Views.FormatSettingsDialog=Common.Views.AdvancedSettingsWindow.extend(_.extend({options:{contentWidth:284,height:340},initialize:function(e){var t=this;t.numFormatData=[{value:Asc.c_oAscNumFormatType.General,displayValue:this.txtGeneral},{value:Asc.c_oAscNumFormatType.Number,displayValue:this.txtNumber},{value:Asc.c_oAscNumFormatType.Scientific,displayValue:this.txtScientific},{value:Asc.c_oAscNumFormatType.Accounting,displayValue:this.txtAccounting},{value:Asc.c_oAscNumFormatType.Currency,displayValue:this.txtCurrency},{value:Asc.c_oAscNumFormatType.Date,displayValue:this.txtDate},{value:Asc.c_oAscNumFormatType.Time,displayValue:this.txtTime},{value:Asc.c_oAscNumFormatType.Percent,displayValue:this.txtPercentage},{value:Asc.c_oAscNumFormatType.Fraction,displayValue:this.txtFraction},{value:Asc.c_oAscNumFormatType.Text,displayValue:this.txtText},{value:Asc.c_oAscNumFormatType.Custom,displayValue:this.txtCustom}],t.FractionData=[{displayValue:this.txtUpto1,value:"# ?/?"},{displayValue:this.txtUpto2,value:"# ??/??"},{displayValue:this.txtUpto3,value:"# ???/???"},{displayValue:this.txtAs2,value:"# ?/2"},{displayValue:this.txtAs4,value:"# ?/4"},{displayValue:this.txtAs8,value:"# ?/8"},{displayValue:this.txtAs16,value:"# ??/16"},{displayValue:this.txtAs10,value:"# ?/10"},{displayValue:this.txtAs100,value:"# ??/100"}],t.CurrencySymbolsData=null,t.langId=1033,_.extend(this.options,{title:this.textTitle,template:['<div class="box" style="height:'+(t.options.height-85)+'px;">','<div class="content-panel" style="padding: 0 10px;"><div class="inner-content">','<div class="settings-panel active">','<table cols="1" style="width: 100%;">',"<tr>",'<td style="width:170px;padding-bottom: 3px;">','<label class="header">',t.textCategory,"</label>",'<div id="format-settings-combo-format" class="input-group-nr" style="width:264px;"></div>',"</td>","</tr>","<tr>",'<td class="padding-large" style="white-space: nowrap;">','<label style="vertical-align: middle; margin-right: 4px;">'+t.txtSample+"</label>",'<label id="format-settings-label-example" style="vertical-align: middle; max-width: 220px; overflow: hidden; text-overflow: ellipsis;>100</label>',"</td>","</tr>","<tr>",'<td class="padding-small">',"</td>","</tr>",'<tr class="format-decimal">','<td class="padding-large" style="vertical-align: bottom;">','<label class="header">',t.textDecimal,"</label>",'<div id="format-settings-spin-decimal"></div>',"</td>","</tr>",'<tr class="format-separator">','<td class="padding-large">','<div id="format-settings-checkbox-separator"></div>',"</td>","</tr>",'<tr class="format-symbols">','<td class="padding-large">','<label class="header">',t.textSymbols,"</label>",'<div id="format-settings-combo-symbols" class="input-group-nr" style="width:264px;"></div>',"</td>","</tr>",'<tr class="format-decimal">','<td class="padding-large format-negative">','<label class="header">',t.textFormat,"</label>",'<div id="format-settings-combo-negative" class="input-group-nr" style="width:264px;"></div>',"</td>","</tr>",'<tr class="format-type">','<td class="padding-large">','<label class="header">',t.textFormat,"</label>",'<div id="format-settings-combo-type" class="input-group-nr" style="width:264px;"></div>',"</td>","</tr>",'<tr class="format-code">','<td colspan="1" class="padding-large">','<label class="header">',t.textFormat,"</label>",'<div id="format-settings-combo-code" class="input-group-nr" style="width:264px;"></div>',"</td>","</tr>","</table>","</div></div>","</div>","</div>",'<div class="separator horizontal"/>','<div class="footer center">','<button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px; width: 86px;">'+t.textOk+"</button>",'<button class="btn normal dlg-btn" result="cancel" style="width: 86px;">'+t.textCancel+"</button>","</div>"].join("")},e),this.api=e.api,this.handler=e.handler,this.props=e.props,this._state={hasDecimal:!1,hasNegative:!1,hasSeparator:!1,hasType:!1,hasSymbols:!1,hasCode:!1},Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this,this.options),this.FormatType=Asc.c_oAscNumFormatType.General,this.Format="General",this.CustomFormat=null},render:function(){Common.Views.AdvancedSettingsWindow.prototype.render.call(this);var e=this;this.cmbFormat=new Common.UI.ComboBox({el:$("#format-settings-combo-format"),cls:"input-group-nr",menuStyle:"min-width: 264px;",editable:!1,data:this.numFormatData}),this.cmbFormat.setValue(this.FormatType),this.cmbFormat.on("selected",_.bind(this.onFormatSelect,this)),this.cmbNegative=new Common.UI.ComboBox({el:$("#format-settings-combo-negative"),cls:"input-group-nr",menuStyle:"min-width: 264px;max-height:235px;",editable:!1,data:[],scrollAlwaysVisible:!0}),this.cmbNegative.on("selected",_.bind(this.onNegativeSelect,this)),this.spnDecimal=new Common.UI.MetricSpinner({el:$("#format-settings-spin-decimal"),step:1,width:45,defaultUnit:"",value:2,maxValue:30,minValue:0,allowDecimal:!1}),this.spnDecimal.on("change",_.bind(this.onDecimalChange,this)),this.chSeparator=new Common.UI.CheckBox({el:$("#format-settings-checkbox-separator"),labelText:this.textSeparator}),this.chSeparator.on("change",_.bind(this.onSeparatorChange,this)),this.cmbSymbols=new Common.UI.ComboBox({el:$("#format-settings-combo-symbols"),cls:"input-group-nr",menuStyle:"min-width: 264px;max-height:235px;",editable:!1,data:[],scrollAlwaysVisible:!0}),this.cmbSymbols.on("selected",_.bind(this.onSymbolsSelect,this)),this.cmbType=new Common.UI.ComboBox({el:$("#format-settings-combo-type"),cls:"input-group-nr",menuStyle:"min-width: 264px;max-height:235px;",editable:!1,data:[],scrollAlwaysVisible:!0}),this.cmbType.on("selected",_.bind(this.onTypeSelect,this)),this.cmbCode=new Common.UI.ComboBox({el:$("#format-settings-combo-code"),cls:"input-group-nr",menuStyle:"min-width: 310px;max-height:235px;",editable:!1,data:[],scrollAlwaysVisible:!0}),this.cmbCode.on("selected",_.bind(this.onCodeSelect,this)),this._decimalPanel=this.$window.find(".format-decimal"),this._negativePanel=this.$window.find(".format-negative"),this._separatorPanel=this.$window.find(".format-separator"),this._typePanel=this.$window.find(".format-type"),this._symbolsPanel=this.$window.find(".format-symbols"),this._codePanel=this.$window.find(".format-code"),this.lblExample=this.$window.find("#format-settings-label-example"),this.afterRender()},afterRender:function(){this._setDefaults(this.props)},show:function(){Common.Views.AdvancedSettingsWindow.prototype.show.apply(this,arguments)},_setDefaults:function(e){if(e&&e.formatInfo){this.langId&&(this.langId=e.langId),this.cmbFormat.setValue(e.formatInfo.asc_getType(),this.txtCustom),e.formatInfo.asc_getType()==Asc.c_oAscNumFormatType.Custom&&e.format&&(this.CustomFormat=this.Format=e.format),this.onFormatSelect(this.cmbFormat,this.cmbFormat.getSelectedRecord(),null,e.formatInfo),this._state.hasDecimal&&this.spnDecimal.setValue(e.formatInfo.asc_getDecimalPlaces()),this._state.hasSeparator&&this.chSeparator.setValue(e.formatInfo.asc_getSeparator()),this._state.hasSymbols&&this.cmbSymbols.setValue(e.formatInfo.asc_getSymbol());if(e.format){if(this._state.hasNegative){var t=this.cmbNegative.store.findWhere({value:e.format});t?this.cmbNegative.selectRecord(t):this.cmbNegative.setValue(this.api.asc_getLocaleExample(e.format))}else if(this._state.hasType){var t=this.cmbType.store.findWhere({value:e.format});t?this.cmbType.selectRecord(t):e.formatInfo.asc_getType()==Asc.c_oAscNumFormatType.Fraction?this.cmbType.setValue(this.txtCustom):e.formatInfo.asc_getType()==Asc.c_oAscNumFormatType.Time?this.cmbType.setValue(this.api.asc_getLocaleExample(e.format,1.534)):this.cmbType.setValue(this.api.asc_getLocaleExample(e.format,38822))}this.Format=e.format,this.lblExample.text(this.api.asc_getLocaleExample(this.Format))}}},getSettings:function(){return{format:this.Format}},onDlgBtnClick:function(e){var t=this,n=typeof e=="object"?e.currentTarget.attributes.result.value:e;n=="ok"&&this.handler&&this.handler.call(this,n,n=="ok"?this.getSettings():undefined),this.close()},onPrimary:function(){return!0},onNegativeSelect:function(e,t){this.Format=t.value,this.lblExample.text(this.api.asc_getLocaleExample(this.Format))},onSymbolsSelect:function(e,t){var n=this,r=new Asc.asc_CFormatCellsInfo;r.asc_setType(this.FormatType),r.asc_setDecimalPlaces(this.spnDecimal.getNumberValue()),r.asc_setSeparator(!1),r.asc_setSymbol(t.value);var i=this.api.asc_getFormatCells(r),s=[];i.forEach(function(e){s.push({value:e,displayValue:n.api.asc_getLocaleExample(e,-1234.1234567890124)})}),this.cmbNegative.setData(s),this.cmbNegative.selectRecord(this.cmbNegative.store.at(0)),this.cmbNegative.cmpEl.find("li:nth-child(2) a, li:nth-child(4) a").css({color:"#ff0000"}),this.Format=i[0],this.lblExample.text(this.api.asc_getLocaleExample(this.Format))},onDecimalChange:function(e,t,n,r){var i=this,s=new Asc.asc_CFormatCellsInfo;s.asc_setType(this.FormatType),s.asc_setDecimalPlaces(e.getNumberValue()),s.asc_setSeparator(this.FormatType==Asc.c_oAscNumFormatType.Number?this.chSeparator.getValue()=="checked":!1),s.asc_setSymbol(this.FormatType==Asc.c_oAscNumFormatType.Currency||this.FormatType==Asc.c_oAscNumFormatType.Accounting?this.cmbSymbols.getValue():!1);var o=this.api.asc_getFormatCells(s);if(this.FormatType==Asc.c_oAscNumFormatType.Number||this.FormatType==Asc.c_oAscNumFormatType.Currency||this.FormatType==Asc.c_oAscNumFormatType.Accounting){var u=[];o.forEach(function(e){u.push({value:e,displayValue:i.api.asc_getLocaleExample(e,-1234.1234567890124)})}),this.cmbNegative.setData(u),this.cmbNegative.selectRecord(this.cmbNegative.store.at(0)),this.cmbNegative.cmpEl.find("li:nth-child(2) a, li:nth-child(4) a").css({color:"#ff0000"}),this.Format=o[0]}else this.Format=o[0];this.lblExample.text(this.api.asc_getLocaleExample(this.Format))},onSeparatorChange:function(e,t,n,r){var i=this,s=new Asc.asc_CFormatCellsInfo;s.asc_setType(this.FormatType),s.asc_setDecimalPlaces(this.spnDecimal.getNumberValue()),s.asc_setSeparator(e.getValue()=="checked");var o=this.api.asc_getFormatCells(s),u=[];o.forEach(function(e){u.push({value:e,displayValue:i.api.asc_getLocaleExample(e,-1234.1234567890124)})}),this.cmbNegative.setData(u),this.cmbNegative.selectRecord(this.cmbNegative.store.at(0)),this.cmbNegative.cmpEl.find("li:nth-child(2) a, li:nth-child(4) a").css({color:"#ff0000"}),this.Format=o[0],this.lblExample.text(this.api.asc_getLocaleExample(this.Format))},onTypeSelect:function(e,t){this.Format=t.value,this.lblExample.text(this.api.asc_getLocaleExample(this.Format))},onCodeSelect:function(e,t){this.Format=t.value,this.lblExample.text(this.api.asc_getLocaleExample(this.Format))},onFormatSelect:function(e,t,n,r){if(!t)return;this.FormatType=t.value;var i=t.value==Asc.c_oAscNumFormatType.Number||t.value==Asc.c_oAscNumFormatType.Scientific||t.value==Asc.c_oAscNumFormatType.Accounting||t.value==Asc.c_oAscNumFormatType.Currency||t.value==Asc.c_oAscNumFormatType.Percent,s=t.value==Asc.c_oAscNumFormatType.Number||t.value==Asc.c_oAscNumFormatType.Currency||t.value==Asc.c_oAscNumFormatType.Accounting,o=t.value==Asc.c_oAscNumFormatType.Number,u=t.value==Asc.c_oAscNumFormatType.Date||t.value==Asc.c_oAscNumFormatType.Time||t.value==Asc.c_oAscNumFormatType.Fraction,a=t.value==Asc.c_oAscNumFormatType.Accounting||t.value==Asc.c_oAscNumFormatType.Currency,f=t.value==Asc.c_oAscNumFormatType.Custom,l=this,c=r?r.asc_getDecimalPlaces():this.spnDecimal.getNumberValue(),h=r?r.asc_getSeparator():this.chSeparator.getValue()=="checked",p=r&&r.asc_getSymbol()?r.asc_getSymbol():this.langId;if(t.value!==Asc.c_oAscNumFormatType.Custom){var d=new Asc.asc_CFormatCellsInfo;d.asc_setType(t.value),d.asc_setDecimalPlaces(i?c:0),d.asc_setSeparator(o?h:!1);if(s||t.value==Asc.c_oAscNumFormatType.Date||t.value==Asc.c_oAscNumFormatType.Time){if(a){if(!l.CurrencySymbolsData){l.CurrencySymbolsData=[];var v=this.api.asc_getCurrencySymbols();for(var m in v)v.hasOwnProperty(m)&&l.CurrencySymbolsData.push({value:parseInt(m),displayValue:v[m]+" "+Common.util.LanguageInfo.getLocalLanguageName(m)[1]});this.cmbSymbols.setData(this.CurrencySymbolsData),this.cmbSymbols.setValue(p)}d.asc_setSymbol(this.cmbSymbols.getValue())}var g=this.api.asc_getFormatCells(d),y=[],b=t.value==Asc.c_oAscNumFormatType.Date?38822:t.value==Asc.c_oAscNumFormatType.Time?1.534:parseFloat("-1234.12345678901234567890");g.forEach(function(e){y.push({value:e,displayValue:l.api.asc_getLocaleExample(e,b)})}),s?(this.cmbNegative.setData(y),this.cmbNegative.selectRecord(this.cmbNegative.store.at(0)),this.cmbNegative.cmpEl.find("li:nth-child(2) a, li:nth-child(4) a").css({color:"#ff0000"})):(this.cmbType.setData(y),this.cmbType.selectRecord(this.cmbType.store.at(0))),this.Format=g[0]}else t.value==Asc.c_oAscNumFormatType.Fraction?(this.cmbType.setData(this.FractionData),this.cmbType.selectRecord(this.cmbType.store.at(0)),this.Format=this.cmbType.getValue()):this.Format=this.api.asc_getFormatCells(d)[0]}else{var d=new Asc.asc_CFormatCellsInfo;d.asc_setType(Asc.c_oAscNumFormatType.None),d.asc_setSymbol(p);var g=this.api.asc_getFormatCells(d),y=[],w=this.CustomFormat?!0:!1;g.forEach(function(e){y.push({value:e,displayValue:e}),l.CustomFormat==e&&(w=!1)}),w&&y.push({value:this.CustomFormat,displayValue:this.CustomFormat}),this.cmbCode.setData(y),this.cmbCode.setValue(this.Format)}this.lblExample.text(this.api.asc_getLocaleExample(this.Format)),this._decimalPanel.toggleClass("hidden",!i),this._negativePanel.css("visibility",s?"":"hidden"),this._separatorPanel.toggleClass("hidden",!o),this._typePanel.toggleClass("hidden",!u),this._symbolsPanel.toggleClass("hidden",!a),this._codePanel.toggleClass("hidden",!f),this._state={hasDecimal:i,hasNegative:s,hasSeparator:o,hasType:u,hasSymbols:a,hasCode:f}},textTitle:"Number Format",textCategory:"Category",textDecimal:"Decimal",textSeparator:"Use 1000 separator",textFormat:"Format",textSymbols:"Symbols",textCancel:"Cancel",textOk:"OK",txtGeneral:"General",txtNumber:"Number",txtCustom:"Custom",txtCurrency:"Currency",txtAccounting:"Accounting",txtDate:"Date",txtTime:"Time",txtPercentage:"Percentage",txtFraction:"Fraction",txtScientific:"Scientific",txtText:"Text",txtUpto1:"Up to one digit (1/3)",txtUpto2:"Up to two digits (12/25)",txtUpto3:"Up to three digits (131/135)",txtAs2:"As halfs (1/2)",txtAs8:"As eighths (4/8)",txtAs4:"As fourths (2/4)",txtAs16:"As sixteenths (8/16)",txtAs10:"As tenths (5/10)",txtAs100:"As hundredths (50/100)",txtSample:"Sample:"},SSE.Views.FormatSettingsDialog||{}))}),define("spreadsheeteditor/main/app/controller/Toolbar",["core","common/main/lib/component/Window","common/main/lib/view/CopyWarningDialog","common/main/lib/view/ImageFromUrlDialog","common/main/lib/util/define","spreadsheeteditor/main/app/view/Toolbar","spreadsheeteditor/main/app/collection/TableTemplates","spreadsheeteditor/main/app/view/HyperlinkSettingsDialog","spreadsheeteditor/main/app/view/TableOptionsDialog","spreadsheeteditor/main/app/view/NamedRangeEditDlg","spreadsheeteditor/main/app/view/NamedRangePasteDlg","spreadsheeteditor/main/app/view/NameManagerDlg","spreadsheeteditor/main/app/view/FormatSettingsDialog"],function(){"use strict";SSE.Controllers.Toolbar=Backbone.Controller.extend(_.extend({models:[],collections:[],views:["Toolbar"],initialize:function(){var e=this;this.addListeners({Statusbar:{"sheet:changed":_.bind(this.onApiSheetChanged,this)},LeftMenu:{"settings:apply":_.bind(this.applyFormulaSettings,this)}}),this.editMode=!0,this._isAddingShape=!1,this._state={prstyle:undefined,clrtext:undefined,pralign:undefined,clrback:undefined,valign:undefined,can_undo:undefined,can_redo:undefined,bold:undefined,italic:undefined,underline:undefined,wrap:undefined,merge:undefined,angle:undefined,controlsdisabled:{rows:undefined,cols:undefined,cells_right:undefined,cells_down:undefined,filters:undefined},selection_type:undefined,filter:undefined,filterapplied:!1,tablestylename:undefined,tablename:undefined,namedrange_locked:!1,fontsize:undefined,multiselect:!1,sparklines_disabled:!1,numformatinfo:undefined,numformattype:undefined,numformat:undefined,langId:undefined};var t=function(t,n){var r=$(t.target),i=r.closest("#editor_sdk"),s=r.closest("button").attr("id");s===undefined&&(s=r.closest(".btn-group").attr("id")),e.api&&e.api.asc_isAddAutoshape()&&(i.length<=0||n=="cancel")&&(e.toolbar.btnInsertText.pressed&&s!=e.toolbar.btnInsertText.id||e.toolbar.btnInsertShape.pressed&&s!=e.toolbar.btnInsertShape.id?(e._isAddingShape=!1,e._addAutoshape(!1),e.toolbar.btnInsertShape.toggle(!1,!0),e.toolbar.btnInsertText.toggle(!1,!0),Common.NotificationCenter.trigger("edit:complete",e.toolbar)):e.toolbar.btnInsertShape.pressed&&s==e.toolbar.btnInsertShape.id&&_.defer(function(){e.api.asc_endAddShape(),Common.NotificationCenter.trigger("edit:complete",e.toolbar)},100))};this.checkInsertAutoshape=function(e){t({},e.action)},this._addAutoshape=function(e,n){this.api&&(e?(this.api.asc_startAddShape(n),$(document.body).on("mouseup",t)):(this.api.asc_endAddShape(),$(document.body).off("mouseup",t)))},this.onApiEndAddShape=function(){this.toolbar.btnInsertShape.pressed&&this.toolbar.btnInsertShape.toggle(!1,!0),this.toolbar.btnInsertText.pressed&&this.toolbar.btnInsertText.toggle(!1,!0),$(document.body).off("mouseup",t)}},onLaunch:function(){this.toolbar=this.createView("Toolbar")},onToolbarAfterRender:function(e){var t=this;e.btnNewDocument.on("click",_.bind(this.onNewDocument,this)),e.btnOpenDocument.on("click",_.bind(this.onOpenDocument,this)),e.btnPrint.on("click",_.bind(this.onPrint,this)),e.btnSave.on("click",_.bind(this.onSave,this)),e.btnUndo.on("click",_.bind(this.onUndo,this)),e.btnRedo.on("click",_.bind(this.onRedo,this)),e.btnCopy.on("click",_.bind(this.onCopyPaste,this,!0)),e.btnPaste.on("click",_.bind(this.onCopyPaste,this,!1)),e.btnIncFontSize.on("click",_.bind(this.onIncreaseFontSize,this)),e.btnDecFontSize.on("click",_.bind(this.onDecreaseFontSize,this)),e.btnBold.on("click",_.bind(this.onBold,this)),e.btnItalic.on("click",_.bind(this.onItalic,this)),e.btnUnderline.on("click",_.bind(this.onUnderline,this)),e.btnTextColor.on("click",_.bind(this.onTextColor,this)),e.btnBackColor.on("click",_.bind(this.onBackColor,this)),e.mnuTextColorPicker.on("select",_.bind(this.onTextColorSelect,this)),e.mnuBackColorPicker.on("select",_.bind(this.onBackColorSelect,this)),e.btnBorders.on("click",_.bind(this.onBorders,this)),e.btnBorders.rendered&&(e.btnBorders.menu.on("item:click",_.bind(this.onBordersMenu,this)),e.mnuBorderWidth.on("item:toggle",_.bind(this.onBordersWidth,this)),e.mnuBorderColorPicker.on("select",_.bind(this.onBordersColor,this))),e.btnAlignLeft.on("click",_.bind(this.onHorizontalAlign,this,"left")),e.btnAlignCenter.on("click",_.bind(this.onHorizontalAlign,this,"center")),e.btnAlignRight.on("click",_.bind(this.onHorizontalAlign,this,"right")),e.btnAlignJust.on("click",_.bind(this.onHorizontalAlign,this,"justify")),e.btnHorizontalAlign.menu.on("item:click",_.bind(this.onHorizontalAlignMenu,this)),e.btnVerticalAlign.menu.on("item:click",_.bind(this.onVerticalAlignMenu,this)),e.btnMerge.on("click",_.bind(this.onMergeCellsMenu,this,e.btnMerge.menu,e.btnMerge.menu.items[0])),e.btnMerge.menu.on("item:click",_.bind(this.onMergeCellsMenu,this)),e.btnAlignTop.on("click",_.bind(this.onVerticalAlign,this,"top")),e.btnAlignMiddle.on("click",_.bind(this.onVerticalAlign,this,"center")),e.btnAlignBottom.on("click",_.bind(this.onVerticalAlign,this,"bottom")),e.btnWrap.on("click",_.bind(this.onWrap,this)),e.btnTextOrient.menu.on("item:click",_.bind(this.onTextOrientationMenu,this)),e.btnInsertImage.menu.on("item:click",_.bind(this.onInsertImageMenu,this)),e.btnInsertHyperlink.on("click",_.bind(this.onHyperlink,this)),e.mnuInsertChartPicker.on("item:click",_.bind(this.onSelectChart,this)),e.btnEditChart.on("click",_.bind(this.onEditChart,this)),e.btnInsertText.on("click",_.bind(this.onBtnInsertTextClick,this)),e.btnInsertText.menu.on("item:click",_.bind(this.onInsertTextClick,this)),e.btnInsertShape.menu.on("hide:after",_.bind(this.onInsertShapeHide,this)),e.btnInsertEquation.on("click",_.bind(this.onInsertEquationClick,this)),e.btnSortDown.on("click",_.bind(this.onSortType,this,Asc.c_oAscSortOptions.Ascending)),e.btnSortUp.on("click",_.bind(this.onSortType,this,Asc.c_oAscSortOptions.Descending)),e.mnuitemSortAZ.on("click",_.bind(this.onSortType,this,Asc.c_oAscSortOptions.Ascending)),e.mnuitemSortZA.on("click",_.bind(this.onSortType,this,Asc.c_oAscSortOptions.Descending)),e.btnSetAutofilter.on("click",_.bind(this.onAutoFilter,this)),e.mnuitemAutoFilter.on("click",_.bind(this.onAutoFilter,this)),e.btnClearAutofilter.on("click",_.bind(this.onClearFilter,this)),e.mnuitemClearFilter.on("click",_.bind(this.onClearFilter,this)),e.btnSearch.on("click",_.bind(this.onSearch,this)),e.btnTableTemplate.menu.on("show:after",_.bind(this.onTableTplMenuOpen,this)),e.btnPercentStyle.on("click",_.bind(this.onNumberFormat,this)),e.btnCurrencyStyle.on("click",_.bind(this.onNumberFormat,this)),e.btnDecDecimal.on("click",_.bind(this.onDecrement,this)),e.btnIncDecimal.on("click",_.bind(this.onIncrement,this)),e.btnInsertFormula.on("click",_.bind(this.onInsertFormulaMenu,this)),e.btnSettings.on("click",_.bind(this.onAdvSettingsClick,this)),e.btnInsertFormula.menu.on("item:click",_.bind(this.onInsertFormulaMenu,this)),e.btnNamedRange.menu.on("item:click",_.bind(this.onNamedRangeMenu,this)),e.btnNamedRange.menu.on("show:after",_.bind(this.onNamedRangeMenuOpen,this)),e.btnClearStyle.menu.on("item:click",_.bind(this.onClearStyleMenu,this)),e.btnAddCell.menu.on("item:click",_.bind(this.onCellInsertMenu,this)),e.btnCopyStyle.on("toggle",_.bind(this.onCopyStyleToggle,this)),e.btnDeleteCell.menu.on("item:click",_.bind(this.onCellDeleteMenu,this)),e.btnColorSchemas.menu.on("item:click",_.bind(this.onColorSchemaClick,this)),e.cmbFontName.on("selected",_.bind(this.onFontNameSelect,this)),e.cmbFontName.on("show:after",_.bind(this.onComboOpen,this,!0)),e.cmbFontName.on("hide:after",_.bind(this.onHideMenus,this)),e.cmbFontName.on("combo:blur",_.bind(this.onComboBlur,this)),e.cmbFontName.on("combo:focusin",_.bind(this.onComboOpen,this,!1)),e.cmbFontSize.on("selected",_.bind(this.onFontSizeSelect,this)),e.cmbFontSize.on("changed:before",_.bind(this.onFontSizeChanged,this,!0)),e.cmbFontSize.on("changed:after",_.bind(this.onFontSizeChanged,this,!1)),e.cmbFontSize.on("show:after",_.bind(this.onComboOpen,this,!0)),e.cmbFontSize.on("hide:after",_.bind(this.onHideMenus,this)),e.cmbFontSize.on("combo:blur",_.bind(this.onComboBlur,this)),e.cmbFontSize.on("combo:focusin",_.bind(this.onComboOpen,this,!1)),e.mnuZoomIn&&e.mnuZoomIn.on("click",_.bind(this.onZoomInClick,this)),e.mnuZoomOut&&e.mnuZoomOut.on("click",_.bind(this.onZoomOutClick,this)),e.btnShowMode.rendered&&e.btnShowMode.menu.on("item:click",_.bind(this.onHideMenu,this)),e.listStyles.on("click",_.bind(this.onListStyleSelect,this)),e.cmbNumberFormat.on("selected",_.bind(this.onNumberFormatSelect,this)),e.cmbNumberFormat.on("show:before",_.bind(this.onNumberFormatOpenBefore,this,!0)),e.cmbNumberFormat.cmpEl&&e.cmbNumberFormat.cmpEl.on("click","#id-toolbar-mnu-item-more-formats a",_.bind(this.onNumberFormatSelect,this)),e.btnCurrencyStyle.menu.on("item:click",_.bind(this.onNumberFormatMenu,this)),e.mnuitemCompactToolbar&&e.mnuitemCompactToolbar.on("toggle",_.bind(this.onChangeViewMode,this)),$("#id-toolbar-menu-new-fontcolor").on("click",_.bind(this.onNewTextColor,this)),$("#id-toolbar-menu-new-paracolor").on("click",_.bind(this.onNewBackColor,this)),$("#id-toolbar-menu-new-bordercolor").on("click",_.bind(this.onNewBorderColor,this)),this.onSetupCopyStyleButton()},setApi:function(e){this.api=e,this.api.asc_registerCallback("asc_onSendThemeColors",_.bind(this.onSendThemeColors,this)),this.api.asc_registerCallback("asc_onInitEditorStyles",_.bind(this.onApiInitEditorStyles,this)),this.api.asc_registerCallback("asc_onCoAuthoringDisconnect",_.bind(this.onApiCoAuthoringDisconnect,this,!0)),Common.NotificationCenter.on("api:disconnect",_.bind(this.onApiCoAuthoringDisconnect,this)),this.api.asc_registerCallback("asc_onLockDefNameManager",_.bind(this.onLockDefNameManager,this)),this.api.asc_registerCallback("asc_onZoomChanged",_.bind(this.onApiZoomChange,this)),this.api.asc_registerCallback("asc_onMathTypes",_.bind(this.onMathTypes,this))},onNewDocument:function(e,t){this.api&&this.api.asc_openNewDocument(),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","New Document")},onOpenDocument:function(e,t){this.api&&this.api.asc_loadDocumentFromDisk(),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Open Document")},onPrint:function(e){Common.NotificationCenter.trigger("print",this.toolbar)},onSave:function(e){if(this.api){var t=this.api.asc_isDocumentCanSave(),n=$(".btn-icon",this.toolbar.btnSave.cmpEl).hasClass("btn-synch");if(!t&&!n&&!this.toolbar.mode.forcesave)return;this.api.asc_Save()}Common.component.Analytics.trackEvent("Save"),Common.component.Analytics.trackEvent("ToolBar","Save")},onUndo:function(e,t){this.api&&this.api.asc_Undo(),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Undo")},onRedo:function(e,t){this.api&&this.api.asc_Redo(),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Redo")},onCopyPaste:function(e,t){var n=this;if(n.api){var r=e?n.api.asc_Copy():n.api.asc_Paste();if(!r){var i=Common.localStorage.getItem("sse-hide-copywarning");(!i||parseInt(i)!=1)&&(new Common.Views.CopyWarningDialog({handler:function(e){e&&Common.localStorage.setItem("sse-hide-copywarning",1),Common.NotificationCenter.trigger("edit:complete",n.toolbar)}})).show()}else Common.component.Analytics.trackEvent("ToolBar","Copy Warning")}Common.NotificationCenter.trigger("edit:complete",n.toolbar)},onIncreaseFontSize:function(e){this.api&&this.api.asc_increaseFontSize(),Common.NotificationCenter.trigger("edit:complete",this.toolbar,{restorefocus:!0}),Common.component.Analytics.trackEvent("ToolBar","Font Size")},onDecreaseFontSize:function(e){this.api&&this.api.asc_decreaseFontSize(),Common.NotificationCenter.trigger("edit:complete",this.toolbar,{restorefocus:!0}),Common.component.Analytics.trackEvent("ToolBar","Font Size")},onBold:function(e,t){this._state.bold=undefined,this.api&&this.api.asc_setCellBold(e.pressed),Common.NotificationCenter.trigger("edit:complete",this.toolbar,{restorefocus:!0}),Common.component.Analytics.trackEvent("ToolBar","Bold")},onItalic:function(e,t){this._state.italic=undefined,this.api&&this.api.asc_setCellItalic(e.pressed),Common.NotificationCenter.trigger("edit:complete",this.toolbar,{restorefocus:!0}),Common.component.Analytics.trackEvent("ToolBar","Italic")},onUnderline:function(e,t){this._state.underline=undefined,this.api&&this.api.asc_setCellUnderline(e.pressed),Common.NotificationCenter.trigger("edit:complete",this.toolbar,{restorefocus:!0}),Common.component.Analytics.trackEvent("ToolBar","Underline")},onTextColor:function(){this.toolbar.mnuTextColorPicker.trigger("select",this.toolbar.mnuTextColorPicker,this.toolbar.mnuTextColorPicker.currentColor,!0)},onBackColor:function(){this.toolbar.mnuBackColorPicker.trigger("select",this.toolbar.mnuBackColorPicker,this.toolbar.mnuBackColorPicker.currentColor,!0)},onTextColorSelect:function(e,t,n){this._state.clrtext_asccolor=this._state.clrtext=undefined;var r=typeof t=="object"?t.color:t;this.toolbar.btnTextColor.currentColor=t,$(".btn-color-value-line",this.toolbar.btnTextColor.cmpEl).css("background-color","#"+r),this.toolbar.mnuTextColorPicker.currentColor=t,this.api&&(this.toolbar.btnTextColor.ischanged=n!==!0,this.api.asc_setCellTextColor(Common.Utils.ThemeColor.getRgbColor(t)),this.toolbar.btnTextColor.ischanged=!1),Common.NotificationCenter.trigger("edit:complete",this.toolbar,{restorefocus:!0}),Common.component.Analytics.trackEvent("ToolBar","Text Color")},onBackColorSelect:function(e,t,n){this._state.clrshd_asccolor=this._state.clrback=undefined;var r=typeof t=="object"?t.color:t;this.toolbar.btnBackColor.currentColor=t,$(".btn-color-value-line",this.toolbar.btnBackColor.cmpEl).css("background-color",r=="transparent"?"transparent":"#"+r),this.toolbar.mnuBackColorPicker.currentColor=t,this.api&&(this.toolbar.btnBackColor.ischanged=n!==!0,this.api.asc_setCellBackgroundColor(t=="transparent"?null:Common.Utils.ThemeColor.getRgbColor(t)),this.toolbar.btnBackColor.ischanged=!1),Common.component.Analytics.trackEvent("ToolBar","Background Color")},onNewTextColor:function(e,t){this.toolbar.mnuTextColorPicker.addNewColor()},onNewBackColor:function(e,t){this.toolbar.mnuBackColorPicker.addNewColor()},onNewBorderColor:function(e,t){this.toolbar.btnBorders.menu.hide(),this.toolbar.btnBorders.toggle(!1,!0),this.toolbar.mnuBorderColorPicker.addNewColor()},onBorders:function(e){var t;_.each(e.menu.items,function(n){if(e.options.borderId==n.options.borderId)return t=n,!1}),t&&this.onBordersMenu(e.menu,t)},onBordersMenu:function(e,t){var n=this;if(n.api&&!_.isUndefined(t.options.borderId)){var r=n.toolbar.btnBorders,i=[],s=r.options.borderswidth,o=r.options.borderscolor;if(r.rendered){var u=$(".btn-icon",r.cmpEl);u&&(u.removeClass(r.options.icls),r.options.icls=t.options.icls,u.addClass(r.options.icls))}r.options.borderId=t.options.borderId,t.options.borderId=="inner"?(i[Asc.c_oAscBorderOptions.InnerV]=new Asc.asc_CBorder(s,o),i[Asc.c_oAscBorderOptions.InnerH]=new Asc.asc_CBorder(s,o)):t.options.borderId=="all"?(i[Asc.c_oAscBorderOptions.InnerV]=new Asc.asc_CBorder(s,o),i[Asc.c_oAscBorderOptions.InnerH]=new Asc.asc_CBorder(s,o),i[Asc.c_oAscBorderOptions.Left]=new Asc.asc_CBorder(s,o),i[Asc.c_oAscBorderOptions.Top]=new Asc.asc_CBorder(s,o),i[Asc.c_oAscBorderOptions.Right]=new Asc.asc_CBorder(s,o),i[Asc.c_oAscBorderOptions.Bottom]=new Asc.asc_CBorder(s,o)):t.options.borderId=="outer"?(i[Asc.c_oAscBorderOptions.Left]=new Asc.asc_CBorder(s,o),i[Asc.c_oAscBorderOptions.Top]=new Asc.asc_CBorder(s,o),i[Asc.c_oAscBorderOptions.Right]=new Asc.asc_CBorder(s,o),i[Asc.c_oAscBorderOptions.Bottom]=new Asc.asc_CBorder(s,o)):t.options.borderId!="none"&&(i[t.options.borderId]=new Asc.asc_CBorder(s,o)),n.api.asc_setCellBorders(i),Common.NotificationCenter.trigger("edit:complete",n.toolbar),Common.component.Analytics.trackEvent("ToolBar","Borders")}},onBordersWidth:function(e,t,n){n&&(this.toolbar.btnBorders.options.borderswidth=t.value,Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Border Width"))},onBordersColor:function(e,t){$("#id-toolbar-mnu-item-border-color .menu-item-icon").css("border-color","#"+(typeof t=="object"?t.color:t)),this.toolbar.mnuBorderColor.onUnHoverItem(),this.toolbar.btnBorders.options.borderscolor=Common.Utils.ThemeColor.getRgbColor(t),this.toolbar.mnuBorderColorPicker.currentColor=t,Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Border Color")},onHorizontalAlign:function(e,t,n){this._state.pralign=undefined,this.api&&(this.api.asc_setCellAlign(t.pressed?e:"none"),this.toolbar.btnWrap.allowDepress=e!="justify"),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Horizontal align")},onHorizontalAlignMenu:function(e,t){var n=this.toolbar.btnHorizontalAlign,r=$(".btn-icon",n.cmpEl);r&&(r.removeClass(n.options.icls),n.options.icls=t.checked?t.options.icls:"btn-align-left",r.addClass(n.options.icls)),this._state.pralign=undefined,this.api&&this.api.asc_setCellAlign(t.checked?t.value:"none"),this.toolbar.btnWrap.allowDepress=t.value!="justify",Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Horizontal Align")},onVerticalAlignMenu:function(e,t){var n=this.toolbar.btnVerticalAlign,r=$(".btn-icon",n.cmpEl);r&&(r.removeClass(n.options.icls),n.options.icls=t.checked?t.options.icls:"btn-valign-bottom",r.addClass(n.options.icls)),this._state.valign=undefined,this.api&&this.api.asc_setCellVertAlign(t.checked?t.value:"bottom"),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Vertical Align")},onVerticalAlign:function(e,t,n){this._state.valign=undefined,this.api&&this.api.asc_setCellVertAlign(t.pressed?e:"bottom"),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Vertical align")},onMergeCellsMenu:function(e,t){function r(e){n._state.merge=undefined,n.api.asc_mergeCells(e),Common.NotificationCenter.trigger("edit:complete",n.toolbar),Common.component.Analytics.trackEvent("ToolBar","Merge")}var n=this;if(n.api){var i=n.api.asc_getCellInfo().asc_getFlags().asc_getMerge();i!==Asc.c_oAscMergeOptions.Merge&&n.api.asc_mergeCellsDataLost(t.value)?Common.UI.warning({msg:n.warnMergeLostData,buttons:["yes","no"],primary:"yes",callback:function(e){e=="yes"?r(t.value):(n.toolbar.btnMerge.toggle(!1,!0),Common.NotificationCenter.trigger("edit:complete",n.toolbar),Common.component.Analytics.trackEvent("ToolBar","Merge"))}}):r(t.value)}Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Merge cells")},onWrap:function(e,t){this._state.wrap=undefined,this.api&&this.api.asc_setCellTextWrap(e.pressed),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Wrap")},onTextOrientationMenu:function(e,t){var n=0;switch(t.value){case"countcw":n=45;break;case"clockwise":n=-45;break;case"rotateup":n=90;break;case"rotatedown":n=-90}this._state.angle=undefined,this.api&&this.api.asc_setCellAngle(n),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Text orientation")},onInsertImageMenu:function(e,t,n){if(t.value==="file")this.toolbar.fireEvent("insertimage",this.toolbar),this.api&&this.api.asc_addImage(),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Image");else{var r=this;(new Common.Views.ImageFromUrlDialog({handler:function(e,t){if(e=="ok"){if(r.api){var n=t.replace(/\s/g,"");_.isEmpty(n)?Common.UI.warning({msg:this.textEmptyImgUrl}):(r.toolbar.fireEvent("insertimage",r.toolbar),r.api.asc_addImageDrawingObject(n),Common.component.Analytics.trackEvent("ToolBar","Image"))}Common.NotificationCenter.trigger("edit:complete",r.toolbar)}}})).show()}},onHyperlink:function(e){var t=this,n,r;if(t.api){var i=t.api.asc_getWorksheetsCount(),s=-1,o=[];while(++s<i)this.api.asc_isWorksheetHidden(s)||o.push({displayValue:t.api.asc_getWorksheetName(s),value:t.api.asc_getWorksheetName(s)});var u=function(e,n){n=="ok"&&(r=e.getSettings(),t.api.asc_insertHyperlink(r)),Common.NotificationCenter.trigger("edit:complete",t.toolbar)},a=t.api.asc_getCellInfo(),f=a.asc_getFlags().asc_getSelectionType();r=a.asc_getHyperlink(),n=new SSE.Views.HyperlinkSettingsDialog({api:t.api,handler:u}),n.show(),n.setSettings({sheets:o,currentSheet:t.api.asc_getWorksheetName(t.api.asc_getActiveWorksheetIndex()),props:r,text:a.asc_getText(),isLock:a.asc_getFlags().asc_getLockText(),allowInternal:f!==Asc.c_oAscSelectionType.RangeImage&&f!==Asc.c_oAscSelectionType.RangeShape&&f!==Asc.c_oAscSelectionType.RangeShapeText&&f!==Asc.c_oAscSelectionType.RangeChart&&f!==Asc.c_oAscSelectionType.RangeChartText})}Common.component.Analytics.trackEvent("ToolBar","Add Hyperlink")},onEditChart:function(e){if(!this.editMode)return;var t=this,n=t.api.asc_getCellInfo();if(n.asc_getFlags().asc_getSelectionType()!=Asc.c_oAscSelectionType.RangeImage){var r,i;if(t.api){i=t.api.asc_getChartObject();var s=t.api.asc_getGraphicObjectProps(),o=null;for(var u=0;u<s.length;u++)if(s[u].asc_getObjectType()==Asc.c_oAscTypeSelectElement.Image){var a=s[u].asc_getObjectValue();a.asc_getChartProperties()&&(o=a)}if(i){var f=t.toolbar.mode.isEditDiagram||n.asc_getFlags().asc_getSelectionType()==Asc.c_oAscSelectionType.RangeChart||n.asc_getFlags().asc_getSelectionType()==Asc.c_oAscSelectionType.RangeChartText;(new SSE.Views.ChartSettingsDlg({chartSettings:i,imageSettings:o,isChart:!0,api:t.api,handler:function(e,n){e=="ok"&&t.api&&(f?t.api.asc_editChartDrawingObject(n.chartSettings):t.api.asc_addChartDrawingObject(n.chartSettings),n.imageSettings&&t.api.asc_setGraphicObjectProps(n.imageSettings)),Common.NotificationCenter.trigger("edit:complete",t.toolbar)}})).show()}}}},onSelectChart:function(e,t,n,r){if(!this.editMode)return;var i=this,s=i.api.asc_getCellInfo(),o=s.asc_getFlags().asc_getSelectionType(),u=n.get("group"),a=u=="menu-chart-group-sparkcolumn"||u=="menu-chart-group-sparkline"||u=="menu-chart-group-sparkwin";if(o!=Asc.c_oAscSelectionType.RangeImage&&i.api){var f,l;if(!a||o!=Asc.c_oAscSelectionType.RangeCells&&o!=Asc.c_oAscSelectionType.RangeCol&&o!=Asc.c_oAscSelectionType.RangeRow&&o!=Asc.c_oAscSelectionType.RangeMax){if(!a){var h=o==Asc.c_oAscSelectionType.RangeChart||o==Asc.c_oAscSelectionType.RangeChartText;l=i.api.asc_getChartObject(),l&&(l.putType(n.get("type")),h?i.api.asc_editChartDrawingObject(l):i.api.asc_addChartDrawingObject(l))}}else{var c=s.asc_getSparklineInfo();if(!!c){var l=new Asc.sparklineGroup;l.asc_setType(n.get("type")),this.api.asc_setSparklineGroup(c.asc_getId(),l)}}}r.type!=="click"&&i.toolbar.btnInsertChart.menu.hide(),Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onBtnInsertTextClick:function(e,t){this.api&&this._addAutoshape(e.pressed,"textRect"),this.toolbar.btnInsertShape.pressed&&this.toolbar.btnInsertShape.toggle(!1,!0),Common.NotificationCenter.trigger("edit:complete",this.toolbar,this.toolbar.btnInsertShape),Common.component.Analytics.trackEvent("ToolBar","Add Text")},onInsertTextClick:function(e,t,n){t.value==="text"&&(this.api&&this._addAutoshape(!0,"textRect"),this.toolbar.btnInsertText.toggle(!0,!0),this.toolbar.btnInsertShape.pressed&&this.toolbar.btnInsertShape.toggle(!1,!0),Common.NotificationCenter.trigger("edit:complete",this.toolbar,this.toolbar.btnInsertShape),Common.component.Analytics.trackEvent("ToolBar","Add Text"))},onInsertShapeHide:function(e,t){this.toolbar.btnInsertShape.pressed&&!this._isAddingShape&&this.toolbar.btnInsertShape.toggle(!1,!0),this._isAddingShape=!1,Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onSortType:function(e,t){if(this.api){var n=this.api.asc_sortCellsRangeExpand();if(n){var r={width:500,title:this.txtSorting,msg:this.txtExpandSort,buttons:[{caption:this.txtExpand,primary:!0,value:"expand"},{caption:this.txtSortSelected,primary:!0,value:"sort"},"cancel"],callback:_.bind(function(t){(t=="expand"||t=="sort")&&this.api.asc_sortColFilter(e,"",undefined,undefined,t=="expand")},this)};Common.UI.alert(r)}else this.api.asc_sortColFilter(e,"",undefined,undefined,n!==null)}},onSearch:function(e,t){this.getApplication().getController("LeftMenu").showSearchDlg(!0)},onAutoFilter:function(e){var t=this._state.filter;this._state.filter=undefined,this.api&&(this._state.tablename||t?this.api.asc_changeAutoFilter(this._state.tablename,Asc.c_oAscChangeFilterOptions.filter,!t):this.api.asc_addAutoFilter()),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Auto filter")},onClearFilter:function(e){this.api&&this.api.asc_clearFilter(),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Clear filter")},onNumberFormat:function(e){this.api&&this.api.asc_setCellStyle(e.options.styleName),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Number Format")},onNumberFormatMenu:function(e,t){if(this.api){var n=new Asc.asc_CFormatCellsInfo;n.asc_setType(Asc.c_oAscNumFormatType.Accounting),n.asc_setSeparator(!1),n.asc_setSymbol(t.value);var r=this.api.asc_getFormatCells(n);r&&r.length>0&&this.api.asc_setCellFormat(r[0])}Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Number Format")},onNumberFormatSelect:function(e,t){t?this.api&&this.api.asc_setCellFormat(t.format):this.onCustomNumberFormat(),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Number Format")},onCustomNumberFormat:function(){var e=this,t=Common.localStorage.getItem("sse-settings-reg-settings");t=t!==null?parseInt(t):e.toolbar.mode.lang?parseInt(Common.util.LanguageInfo.getLocalLanguageCode(e.toolbar.mode.lang)):1033,(new SSE.Views.FormatSettingsDialog({api:e.api,handler:function(t,n){n&&e.api.asc_setCellFormat(n.format),Common.NotificationCenter.trigger("edit:complete",e.toolbar)},props:{format:e._state.numformat,formatInfo:e._state.numformatinfo,langId:t}})).show(),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Number Format")},onNumberFormatOpenBefore:function(e){if(this.api){var t=this,n=Common.localStorage.getItem("sse-settings-reg-settings");n=n!==null?parseInt(n):this.toolbar.mode.lang?parseInt(Common.util.LanguageInfo.getLocalLanguageCode(this.toolbar.mode.lang)):1033;if(this._state.langId!==n){this._state.langId=n;var r=new Asc.asc_CFormatCellsInfo;r.asc_setType(Asc.c_oAscNumFormatType.None),r.asc_setSymbol(this._state.langId);var i=this.api.asc_getFormatCells(r);t.toolbar.numFormatData.forEach(function(e,n){t.toolbar.numFormatData[n].format=i[n]})}t.toolbar.numFormatData.forEach(function(e,n){e.exampleval=t.api.asc_getLocaleExample(e.format)}),t.toolbar.cmbNumberFormat.setData(t.toolbar.numFormatData),t.toolbar.cmbNumberFormat.setValue(t._state.numformattype,t.toolbar.txtCustom)}},onDecrement:function(e){this.api&&this.api.asc_decreaseCellDigitNumbers(),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Decrement")},onIncrement:function(e){this.api&&this.api.asc_increaseCellDigitNumbers(),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Increment")},onInsertFormulaMenu:function(e,t,n){if(this.api)if(t.value==="more"){var r=this.getApplication().getController("FormulaDialog");r&&r.showDialog()}else t.value=t.value||"SUM",this.api.asc_insertFormula(this.api.asc_getFormulaLocaleName(t.value),Asc.c_oAscPopUpSelectorType.Func,!0),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Insert formula")},onNamedRangeMenu:function(e,t,n){if(this.api){var r=this;if(t.value==="paste")(new SSE.Views.NamedRangePasteDlg({handler:function(e,t){e=="ok"&&t&&(r.api.asc_insertFormula(t.asc_getName(),t.asc_getIsTable()?Asc.c_oAscPopUpSelectorType.Table:Asc.c_oAscPopUpSelectorType.Range,!1),Common.component.Analytics.trackEvent("ToolBar","Paste Named Range")),Common.NotificationCenter.trigger("edit:complete",r.toolbar)},ranges:r.api.asc_getDefinedNames(Asc.c_oAscGetDefinedNamesList.WorksheetWorkbook)})).show(),Common.component.Analytics.trackEvent("ToolBar","Paste Named Range");else{var i=r.api.asc_getWorksheetsCount(),s=-1,o=[],u=[];if(t.value==="new"){if(this._state.namedrange_locked){Common.NotificationCenter.trigger("namedrange:locked");return}while(++s<i)this.api.asc_isWorksheetHidden(s)||o.push({displayValue:r.api.asc_getWorksheetName(s),value:s});(new SSE.Views.NamedRangeEditDlg({api:r.api,handler:function(e,t){e=="ok"&&t&&(r.api.asc_setDefinedNames(t),Common.component.Analytics.trackEvent("ToolBar","New Named Range")),Common.NotificationCenter.trigger("edit:complete",r.toolbar)},sheets:o,props:r.api.asc_getDefaultDefinedName(),isEdit:!1})).show()}else{var a=this.getApplication().getController("CellEditor");while(++s<i)this.api.asc_isWorksheetHidden(s)||(u[s]=r.api.asc_getWorksheetName(s),o.push({displayValue:u[s],value:s}));(new SSE.Views.NameManagerDlg({api:r.api,handler:function(e){Common.component.Analytics.trackEvent("ToolBar","Name Manager"),Common.NotificationCenter.trigger("edit:complete",r.toolbar)},locked:r._state.namedrange_locked,sheets:o,sheetNames:u,ranges:r.api.asc_getDefinedNames(Asc.c_oAscGetDefinedNamesList.All),props:r.api.asc_getDefaultDefinedName(),sort:a.rangeListSort})).on("close",function(e){a.rangeListSort=e.getSettings()}).show()}}}},onNamedRangeMenuOpen:function(){if(this.api){var e=this.api.asc_getDefinedNames(Asc.c_oAscGetDefinedNamesList.WorksheetWorkbook);this.toolbar.btnNamedRange.menu.items[2].setDisabled(e.length<1)}},onClearStyleMenu:function(e,t,n){this.api&&this.api.asc_emptyCells(t.value),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Clear")},onCopyStyleToggle:function(e,t,n){this.api&&this.api.asc_formatPainter(t?1:0),Common.NotificationCenter.trigger("edit:complete",this.toolbar),this.modeAlwaysSetStyle=t},onCellInsertMenu:function(e,t,n){this.api&&this.api.asc_insertCells(t.value),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Cell insert")},onCellDeleteMenu:function(e,t,n){this.api&&this.api.asc_deleteCells(t.value),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Cell delete")},onColorSchemaClick:function(e,t){this.api&&(this.api.asc_ChangeColorScheme(t.value),Common.component.Analytics.trackEvent("ToolBar","Color Scheme")),Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onComboBlur:function(){Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onFontNameSelect:function(e,t){this.api&&(t.isNewFont?Common.UI.warning({width:500,closable:!1,msg:this.confirmAddFontName,buttons:["yes","no"],primary:"yes",callback:_.bind(function(e){e=="yes"?(this.api.asc_setCellFontName(t.name),Common.component.Analytics.trackEvent("ToolBar","Font Name")):this.toolbar.cmbFontName.setValue(this.api.asc_getCellInfo().asc_getFont().asc_getName()),Common.NotificationCenter.trigger("edit:complete",this.toolbar,{restorefocus:!0})},this)}):(this.api.asc_setCellFontName(t.name),Common.component.Analytics.trackEvent("ToolBar","Font Name"))),Common.NotificationCenter.trigger("edit:complete",this.toolbar,{restorefocus:!0})},onComboOpen:function(e,t){_.delay(function(){var n=$("input",t.cmpEl).select();e?n.focus():t.isMenuOpen()||n.one("mouseup",function(e){e.preventDefault()})},10)},onFontSizeSelect:function(e,t){this._state.fontsize=undefined,this.api&&this.api.asc_setCellFontSize(t.value),Common.NotificationCenter.trigger("edit:complete",this.toolbar,{restorefocus:!0}),Common.component.Analytics.trackEvent("ToolBar","Font Size")},onFontSizeChanged:function(e,t,n,r){var i,s=this;if(e){var o=t.store.findWhere({displayValue:n.value});if(!o){i=/^\+?(\d*\.?\d+)$|^\+?(\d+\.?\d*)$/.exec(n.value);if(!i)return i=this._getApiTextSize(),Common.UI.warning({msg:this.textFontSizeErr,callback:function(){_.defer(function(e){$("input",t.cmpEl).focus()})}}),t.setRawValue(i),r.preventDefault(),!1}}else i=parseFloat(n.value),i=i>409?409:i<1?1:Math.floor((i+.4)*2)/2,t.setRawValue(i),this._state.fontsize=undefined,this.api&&this.api.asc_setCellFontSize(i),Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onAdvSettingsClick:function(e,t){this.toolbar.fireEvent("file:settings",this),e.cmpEl.blur()},onZoomInClick:function(e){if(this.api){var t=Math.floor(this.api.asc_getZoom()*10)/10;t+=.1,t>0&&!(t>2)&&this.api.asc_setZoom(t)}Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onZoomOutClick:function(e){if(this.api){var t=Math.ceil(this.api.asc_getZoom()*10)/10;t-=.1,t<.5||this.api.asc_setZoom(t)}Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onHideMenu:function(e,t){var n={},r;switch(t.value){case"title":n.title=t.checked,r="sse-hidden-title";break;case"formula":n.formula=t.checked,r="sse-hidden-formula";break;case"headings":n.headings=t.checked;break;case"gridlines":n.gridlines=t.checked;break;case"freezepanes":n.freezepanes=t.checked}this.hideElements(n),r&&Common.localStorage.setItem(r,t.checked),Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onListStyleSelect:function(e,t){this._state.prstyle=undefined,this.api&&(this.api.asc_setCellStyle(t.get("name")),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Style"))},createDelayedElements:function(){var e=this;this.toolbar.createDelayedElements(),this.onToolbarAfterRender(this.toolbar),this.api.asc_registerCallback("asc_onShowChartDialog",_.bind(this.onApiChartDblClick,this)),this.api.asc_registerCallback("asc_onCanUndoChanged",_.bind(this.onApiCanRevert,this,"undo")),this.api.asc_registerCallback("asc_onCanRedoChanged",_.bind(this.onApiCanRevert,this,"redo")),this.api.asc_registerCallback("asc_onEditCell",_.bind(this.onApiEditCell,this)),this.api.asc_registerCallback("asc_onEndAddShape",_.bind(this.onApiEndAddShape,this)),this.api.asc_registerCallback("asc_onSheetsChanged",_.bind(this.onApiSheetChanged,this)),this.api.asc_registerCallback("asc_onStopFormatPainter",_.bind(this.onApiStyleChange,this)),this.api.asc_registerCallback("asc_onUpdateSheetViewSettings",_.bind(this.onApiSheetChanged,this)),Common.util.Shortcuts.delegateShortcuts({shortcuts:{"command+l,ctrl+l":function(t){if(e.editMode&&!e._state.multiselect){var n=e.api.asc_getCellInfo().asc_getFormatTableInfo();if(!n){_.isUndefined(e.toolbar.mnuTableTemplatePicker)&&e.onApiInitTableTemplates(e.api.asc_getTablePictures(n));var r=e.getCollection("TableTemplates");e._setTableFormat(r.at(23).get("name"))}}return!1},"command+shift+l,ctrl+shift+l":function(t){var n=e._state.filter;return e._state.filter=undefined,e.editMode&&e.api&&!e._state.multiselect&&(e._state.tablename||n?e.api.asc_changeAutoFilter(e._state.tablename,Asc.c_oAscChangeFilterOptions.filter,!n):e.api.asc_addAutoFilter()),!1},"command+s,ctrl+s":function(t){e.onSave(),t.preventDefault(),t.stopPropagation()},"command+k,ctrl+k":function(t){e.editMode&&!e.toolbar.mode.isEditMailMerge&&!e.toolbar.mode.isEditDiagram&&!e.api.isCellEdited&&!e._state.multiselect&&e.onHyperlink(),t.preventDefault()},"command+1,ctrl+1":function(t){return e.editMode&&!e.toolbar.mode.isEditMailMerge&&!e.api.isCellEdited&&!e.toolbar.cmbNumberFormat.isDisabled()&&e.onCustomNumberFormat(),!1}}}),this.wrapOnSelectionChanged=_.bind(this.onApiSelectionChanged,this),this.api.asc_registerCallback("asc_onSelectionChanged",this.wrapOnSelectionChanged),this.onApiSelectionChanged(this.api.asc_getCellInfo()),this.api.asc_registerCallback("asc_onEditorSelectionChanged",_.bind(this.onApiEditorSelectionChanged,this)),this.attachToControlEvents(),this.onApiSheetChanged(),this.applyFormulaSettings(),Common.NotificationCenter.on("cells:range",_.bind(this.onCellsRange,this))},onChangeViewMode:function(e,t){var n=this,r=$("#id-toolbar-full"),i=$("#id-toolbar-short");n.toolbar.isCompactView=t,r&&i&&(n.api.asc_unregisterCallback("asc_onSelectionChanged",n.wrapOnSelectionChanged),t?(i.css({display:"table"}),r.css({display:"none"}),i.parent().css({height:"41px"}),n.toolbar.rendererComponents("short")):(i.css({display:"none"}),r.css({display:"table"}),i.parent().css({height:"67px"}),n.toolbar.rendererComponents("full"),_.defer(function(){var e=n.toolbar.listStyles.rendered;n.toolbar.listStyles.menuPicker.store.length>0&&e&&n.toolbar.listStyles.fillComboView(n.toolbar.listStyles.menuPicker.getSelectedRec(),!0),n.toolbar.btnInsertText.rendered&&n.fillTextArt(),n.toolbar.btnTableTemplate.rendered&&n.fillTableTemplates(),n.toolbar.btnInsertEquation.rendered&&n.fillEquations()},100)),n._state.coauthdisable=undefined,n.api.asc_registerCallback("asc_onSelectionChanged",n.wrapOnSelectionChanged),n.onApiSelectionChanged(n.api.asc_getCellInfo()),Common.localStorage.setItem("sse-toolbar-compact",t?1:0),Common.NotificationCenter.trigger("layout:changed","toolbar"))},fillTableTemplates:function(){function t(t,n){var r=new Common.UI.DataView({el:t,parentMenu:n,restoreHeight:300,style:"max-height: 300px;",store:e.getCollection("TableTemplates"),itemTemplate:_.template('<div class="item-template"><img src="<%= imageUrl %>" id="<%= id %>"></div>')});return r.on("item:click",function(t,n,r){e.api&&(e._state.tablestylename=null,r||(r=t.store.at(23)),e._setTableFormat(r.get("name")),Common.NotificationCenter.trigger("edit:complete",e.toolbar),Common.component.Analytics.trackEvent("ToolBar","Table Templates"))}),r.scroller&&r.scroller.update({alwaysVisibleY:!0}),r}if(!this.toolbar.btnTableTemplate.rendered)return;var e=this;_.isUndefined(this.toolbar.mnuTableTemplatePicker)&&(this.toolbar.mnuTableTemplatePicker=t($("#id-toolbar-menu-table-templates"),this.toolbar.btnTableTemplate.menu))},onTableTplMenuOpen:function(e){this.onApiInitTableTemplates(this.api.asc_getTablePictures(this.api.asc_getCellInfo().asc_getFormatTableInfo()));var t=this.toolbar.mnuTableTemplatePicker.scroller;t&&(t.update({alwaysVisibleY:!0}),t.scrollTop(0));var n=this.toolbar.mnuTableTemplatePicker.store.findWhere({name:this._state.tablestylename});n?this.toolbar.mnuTableTemplatePicker.selectRecord(n):this.toolbar.mnuTableTemplatePicker.deselectAll()},onSendThemeColors:function(){this.toolbar.btnTableTemplate.rendered&&this.toolbar.btnTableTemplate.cmpEl.hasClass("open")&&this.onTableTplMenuOpen()},onApiInitTableTemplates:function(e){var t=this.getCollection("TableTemplates");if(t){var n=[];_.each(e,function(e){n.push({name:e.asc_getName(),caption:e.asc_getDisplayName(),type:e.asc_getType(),imageUrl:e.asc_getImage(),allowSelected:!0,selected:!1,tip:e.asc_getDisplayName()})}),t.reset(),t.add(n)}this.fillTableTemplates()},onApiInitEditorStyles:function(e){window.styles_loaded=!1;var t=this,n=t.toolbar.listStyles;if(!n){t.styles=e;return}n.menuPicker.store.reset([]);var r=e.asc_getDefaultStyles().concat(e.asc_getDocStyles());_.each(r,function(e){n.menuPicker.store.add({imageUrl:e.asc_getImage(),name:e.asc_getName(),uid:Common.UI.getId()})}),n.menuPicker.store.length>0&&n.rendered&&(n.fillComboView(n.menuPicker.store.at(0),!0),n.selectByIndex(0)),window.styles_loaded=!0},onApiCoAuthoringDisconnect:function(e){this.toolbar.setMode({isDisconnected:!0,disableDownload:!!e}),this.editMode=!1},onApiChartDblClick:function(){this.onEditChart(this.btnInsertChart)},onApiCanRevert:function(e,t){e=="undo"?this._state.can_undo!==t&&(this.toolbar.btnUndo.setDisabled(!t),this._state.can_undo=t):this._state.can_redo!==t&&(this.toolbar.btnRedo.setDisabled(!t),this._state.can_redo=t)},setDisabledComponents:function(e,t){_.each([].concat(e),function(e){e.isDisabled()!==t&&e.setDisabled(t)})},onApiEditCell:function(e){var t=this.toolbar;if(t.mode.isEditDiagram||t.mode.isEditMailMerge)n=e==Asc.c_oAscCellEditorState.editStart,t.lockToolbar(SSE.enumLock.editCell,e==Asc.c_oAscCellEditorState.editStart,{array:[t.btnDecDecimal,t.btnIncDecimal,t.cmbNumberFormat]});else if(e==Asc.c_oAscCellEditorState.editStart||e==Asc.c_oAscCellEditorState.editEnd){t.lockToolbar(SSE.enumLock.editCell,e==Asc.c_oAscCellEditorState.editStart,{array:[t.btnClearStyle.menu.items[1],t.btnClearStyle.menu.items[2],t.btnClearStyle.menu.items[3],t.btnClearStyle.menu.items[4],t.mnuitemClearFilter,t.btnNamedRange.menu.items[0],t.btnNamedRange.menu.items[1]],merge:!0,clear:[SSE.enumLock.editFormula,SSE.enumLock.editText]});var n=e==Asc.c_oAscCellEditorState.editStart;n?Common.util.Shortcuts.suspendEvents("command+l, ctrl+l, command+shift+l, ctrl+shift+l, command+k, ctrl+k, alt+h, command+1, ctrl+1"):Common.util.Shortcuts.resumeEvents("command+l, ctrl+l, command+shift+l, ctrl+shift+l, command+k, ctrl+k, alt+h, command+1, ctrl+1"),n&&(t.listStyles.suspendEvents(),t.listStyles.menuPicker.selectRecord(null),t.listStyles.resumeEvents(),this._state.prstyle=undefined)}else{if(e==Asc.c_oAscCellEditorState.editText)var r=!0,i=!1;else e==Asc.c_oAscCellEditorState.editFormula?r=!(i=!0):e==Asc.c_oAscCellEditorState.editEmptyCell&&(r=i=!1);t.lockToolbar(SSE.enumLock.editFormula,i,{array:[t.cmbFontName,t.cmbFontSize,t.btnIncFontSize,t.btnDecFontSize,t.btnBold,t.btnItalic,t.btnUnderline,t.btnTextColor]}),t.lockToolbar(SSE.enumLock.editText,r,{array:[t.btnInsertFormula]})}this._state.coauthdisable=undefined,this._state.selection_type=undefined,this.checkInsertAutoshape({action:"cancel"})},onApiZoomChange:function(e,t){switch(t){case 1:case 2:case 0:default:this.toolbar.mnuZoom.options.value=Math.floor((e+.005)*100),$(".menu-zoom .zoom",this.toolbar.el).html(Math.floor((e+.005)*100)+"%")}},onApiSheetChanged:function(){if(this.api){var e=this.api.asc_getSheetViewSettings();this.toolbar.mnuitemHideHeadings.setChecked(!e.asc_getShowRowColHeaders()),this.toolbar.mnuitemHideGridlines.setChecked(!e.asc_getShowGridLines()),this.toolbar.mnuitemFreezePanes.setChecked(e.asc_getIsFreezePane())}},onApiEditorSelectionChanged:function(e){if(!this.editMode)return;var t=this.toolbar,n,r=e.asc_getName();r!=t.cmbFontName.getValue()&&Common.NotificationCenter.trigger("fonts:change",e),!t.mode.isEditMailMerge&&!t.mode.isEditDiagram&&(n=e.asc_getBold(),this._state.bold!==n&&(t.btnBold.toggle(n===!0,!0),this._state.bold=n),n=e.asc_getItalic(),this._state.italic!==n&&(t.btnItalic.toggle(n===!0,!0),this._state.italic=n),n=e.asc_getUnderline(),this._state.underline!==n&&(t.btnUnderline.toggle(n===!0,!0),this._state.underline=n));var i=e.asc_getSize();this._state.fontsize!==i&&(t.cmbFontSize.setValue(i!==undefined?i:""),this._state.fontsize=i);var s,o,u=this.toolbar.mnuTextColorPicker;if(!t.btnTextColor.ischanged&&!u.isDummy){o=e.asc_getColor(),o&&(o.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?s={color:Common.Utils.ThemeColor.getHexColor(o.get_r(),o.get_g(),o.get_b()),effectValue:o.get_value()}:s=Common.Utils.ThemeColor.getHexColor(o.get_r(),o.get_g(),o.get_b()));var a=typeof s,f=typeof this._state.clrtext;if(a!==f||a=="object"&&(s.effectValue!==this._state.clrtext.effectValue||this._state.clrtext.color.indexOf(s.color)<0)||a!="object"&&this._state.clrtext!==undefined&&this._state.clrtext.indexOf(s)<0){if(_.isObject(s)){var l=!1;for(var c=0;c<10;c++)if(Common.Utils.ThemeColor.ThemeValues[c]==s.effectValue){u.select(s,!0),l=!0;break}l||u.clearSelection()}else u.select(s,!0);this._state.clrtext=s}this._state.clrtext_asccolor=o}},onApiSelectionChanged:function(e){if(!this.editMode)return;var t=e.asc_getFlags().asc_getSelectionType(),n=!this.toolbar.mode.isEditMailMerge&&!this.toolbar.mode.isEditDiagram?e.asc_getLocked()===!0||e.asc_getLockedTable()===!0:!1,r=this._disableEditOptions(t,n),i=this,s=this.toolbar,o=e.asc_getFont(),u,a=!1,f=o.asc_getName();f!=s.cmbFontName.getValue()&&Common.NotificationCenter.trigger("fonts:change",o);var l=o.asc_getSize();this._state.fontsize!==l&&(s.cmbFontSize.setValue(l!==undefined?l:""),this._state.fontsize=l),s.lockToolbar(SSE.enumLock.cantHyperlink,t==Asc.c_oAscSelectionType.RangeShapeText&&this.api.asc_canAddShapeHyperlink()===!1,{array:[s.btnInsertHyperlink]});if(r)return;!s.mode.isEditMailMerge&&!s.mode.isEditDiagram&&(u=o.asc_getBold(),this._state.bold!==u&&(s.btnBold.toggle(u===!0,!0),this._state.bold=u),u=o.asc_getItalic(),this._state.italic!==u&&(s.btnItalic.toggle(u===!0,!0),this._state.italic=u),u=o.asc_getUnderline(),this._state.underline!==u&&(s.btnUnderline.toggle(u===!0,!0),this._state.underline=u));var c,h,p=this.toolbar.mnuTextColorPicker,d=this.toolbar.mnuBackColorPicker;if(!s.btnTextColor.ischanged&&!p.isDummy){h=o.asc_getColor(),h&&(h.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?c={color:Common.Utils.ThemeColor.getHexColor(h.get_r(),h.get_g(),h.get_b()),effectValue:h.get_value()}:c=Common.Utils.ThemeColor.getHexColor(h.get_r(),h.get_g(),h.get_b()));var v=typeof c,m=typeof this._state.clrtext;if(v!==m||v=="object"&&(c.effectValue!==this._state.clrtext.effectValue||this._state.clrtext.color.indexOf(c.color)<0)||v!="object"&&this._state.clrtext!==undefined&&this._state.clrtext.indexOf(c)<0){if(_.isObject(c)){var g=!1;for(var y=0;y<10;y++)if(Common.Utils.ThemeColor.ThemeValues[y]==c.effectValue){p.select(c,!0),g=!0;break}g||p.clearSelection()}else p.select(c,!0);this._state.clrtext=c}this._state.clrtext_asccolor=h}if(!s.btnBackColor.ischanged&&!d.isDummy){h=e.asc_getFill().asc_getColor(),h?h.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?c={color:Common.Utils.ThemeColor.getHexColor(h.get_r(),h.get_g(),h.get_b()),effectValue:h.get_value()}:c=Common.Utils.ThemeColor.getHexColor(h.get_r(),h.get_g(),h.get_b()):c="transparent",v=typeof c,m=typeof this._state.clrback;if(v!==m||v=="object"&&(c.effectValue!==this._state.clrback.effectValue||this._state.clrback.color.indexOf(c.color)<0)||v!="object"&&this._state.clrback!==undefined&&this._state.clrback.indexOf(c)<0){if(_.isObject(c)){var g=!1;for(y=0;y<10;y++)if(Common.Utils.ThemeColor.ThemeValues[y]==c.effectValue){d.select(c,!0),g=!0;break}g||d.clearSelection()}else d.select(c,!0);this._state.clrback=c}this._state.clrshd_asccolor=h}if(t==Asc.c_oAscSelectionType.RangeChart||t==Asc.c_oAscSelectionType.RangeChartText)return;if(!s.mode.isEditDiagram){var b=e.asc_getAutoFilterInfo(),w=e.asc_getFormatTableInfo();if(!s.mode.isEditMailMerge){f=e.asc_getHorAlign();if(this._state.pralign!==f){this._state.pralign=f;var E=-1,S;switch(f){case"left":E=0,S="btn-align-left";break;case"center":E=1,S="btn-align-center";break;case"right":E=2,S="btn-align-right";break;case"justify":E=3,S="btn-align-just";break;default:E=-255,S="btn-align-left"}E<0?E==-255&&(s.btnAlignRight.toggle(!1,!0),s.btnAlignLeft.toggle(!1,!0),s.btnAlignCenter.toggle(!1,!0),s.btnAlignJust.toggle(!1,!0),this._clearChecked(s.btnHorizontalAlign.menu)):(s.btnAlignRight.toggle(E===2,!0),s.btnAlignLeft.toggle(E===0,!0),s.btnAlignCenter.toggle(E===1,!0),s.btnAlignJust.toggle(E===3,!0),s.btnHorizontalAlign.menu.items[E].setChecked(!0,!1));var x=this.toolbar.btnHorizontalAlign;if(x.rendered){var T=$(".btn-icon",x.cmpEl);T&&(T.removeClass(x.options.icls),x.options.icls=S,T.addClass(x.options.icls))}s.btnTextOrient.menu.items[1].setDisabled(f=="justify"),s.btnTextOrient.menu.items[2].setDisabled(f=="justify")}f=e.asc_getVertAlign();if(this._state.valign!==f){this._state.valign=f,E=-1,S="";switch(f){case"top":E=0,S="btn-valign-top";break;case"center":E=1,S="btn-valign-middle";break;case"bottom":E=2,S="btn-valign-bottom"}if(E>-1){s.btnAlignTop.toggle(E===0,!0),s.btnAlignMiddle.toggle(E===1,!0),s.btnAlignBottom.toggle(E===2,!0),s.btnVerticalAlign.menu.items[E].setChecked(!0,!1);var N=this.toolbar.btnVerticalAlign;if(N.rendered){var C=$(".btn-icon",N.cmpEl);C&&(C.removeClass(N.options.icls),N.options.icls=S,C.addClass(N.options.icls))}}}a=this._state.controlsdisabled.filters||w!==null||b&&b.asc_getIsAutoFilter()===null,s.lockToolbar(SSE.enumLock.ruleMerge,a,{array:[s.btnMerge]}),u=e.asc_getFlags().asc_getMerge(),this._state.merge!==u&&(s.btnMerge.toggle(u===Asc.c_oAscMergeOptions.Merge,!0),this._state.merge=u),s.btnWrap.isDisabled()||(u=e.asc_getFlags().asc_getWrapText(),this._state.wrap!==u&&(s.btnWrap.toggle(u===!0,!0),this._state.wrap=u))}u=b?b.asc_getIsAutoFilter():null,this._state.filter!==u&&(s.btnSetAutofilter.toggle(u===!0,!0),s.mnuitemAutoFilter.setChecked(u===!0,!0),this._state.filter=u),a=this._state.controlsdisabled.filters||u===null,s.lockToolbar(SSE.enumLock.ruleFilter,a,{array:[s.btnSortDown,s.btnSortUp,s.mnuitemSortAZ,s.mnuitemSortZA,s.btnTableTemplate,s.btnSetAutofilter,s.mnuitemAutoFilter,s.btnAutofilter]}),u=w?w.asc_getTableStyleName():null,this._state.tablestylename!==u&&this.toolbar.mnuTableTemplatePicker&&(u=this.toolbar.mnuTableTemplatePicker.store.findWhere({name:u}),u?(this.toolbar.mnuTableTemplatePicker.selectRecord(u),this._state.tablestylename=u.get("name")):(s.mnuTableTemplatePicker.deselectAll(),this._state.tablestylename=null)),a=this._state.controlsdisabled.filters||!b||b.asc_getIsApplyAutoFilter()!==!0,s.lockToolbar(SSE.enumLock.ruleDelFilter,a,{array:[s.btnClearAutofilter,s.mnuitemClearFilter]});var k=this._state.tablename;this._state.tablename=w?w.asc_getTableName():undefined;var L=this._state.filterapplied;this._state.filterapplied=this._state.filter&&b.asc_getIsApplyAutoFilter(),(this._state.tablename!==k||this._state.filterapplied!==L)&&this.getApplication().getController("Statusbar").onApiFilterInfo(!a),this._state.multiselect=e.asc_getFlags().asc_getMultiselect(),s.lockToolbar(SSE.enumLock.multiselect,this._state.multiselect,{array:[s.btnTableTemplate,s.btnInsertHyperlink]})}u=e.asc_getNumFormatInfo(),u&&(this._state.numformat=e.asc_getNumFormat(),this._state.numformatinfo=u,u=u.asc_getType(),this._state.numformattype!==u&&(s.cmbNumberFormat.setValue(u,s.txtCustom),this._state.numformattype=u)),u=e.asc_getAngle();if(this._state.angle!==u){this._clearChecked(s.btnTextOrient.menu);switch(u){case 45:s.btnTextOrient.menu.items[1].setChecked(!0,!0);break;case-45:s.btnTextOrient.menu.items[2].setChecked(!0,!0);break;case 90:s.btnTextOrient.menu.items[3].setChecked(!0,!0);break;case-90:s.btnTextOrient.menu.items[4].setChecked(!0,!0);break;default:s.btnTextOrient.menu.items[0].setChecked(!0,!0)}this._state.angle=u}u=e.asc_getStyleName();if(this._state.prstyle!=u&&!this.toolbar.listStyles.isDisabled()){var A=this.toolbar.listStyles,O=A.rendered;if(O){A.suspendEvents();var M=A.menuPicker.store.findWhere({name:u});this._state.prstyle=A.menuPicker.store.length>0?u:undefined,A.menuPicker.selectRecord(M),A.resumeEvents()}}u=t==Asc.c_oAscSelectionType.RangeRow,this._state.controlsdisabled.rows!==u&&(this._state.controlsdisabled.rows=u,s.btnAddCell.menu.items[3].setDisabled(u),s.btnDeleteCell.menu.items[3].setDisabled(u)),u=t==Asc.c_oAscSelectionType.RangeCol,this._state.controlsdisabled.cols!==u&&(this._state.controlsdisabled.cols=u,s.btnAddCell.menu.items[2].setDisabled(u),s.btnDeleteCell.menu.items[2].setDisabled(u)),u=b&&b.asc_getIsApplyAutoFilter(),this._state.controlsdisabled.cells_right!==(this._state.controlsdisabled.rows||u)&&(this._state.controlsdisabled.cells_right=this._state.controlsdisabled.rows||u,s.btnAddCell.menu.items[0].setDisabled(this._state.controlsdisabled.cells_right),s.btnDeleteCell.menu.items[0].setDisabled(this._state.controlsdisabled.cells_right)),this._state.controlsdisabled.cells_down!==(this._state.controlsdisabled.cols||u)&&(this._state.controlsdisabled.cells_down=this._state.controlsdisabled.cols||u,s.btnAddCell.menu.items[1].setDisabled(this._state.controlsdisabled.cells_down),s.btnDeleteCell.menu.items[1].setDisabled(this._state.controlsdisabled.cells_down))},onApiStyleChange:function(){this.toolbar.btnCopyStyle.toggle(!1,!0),this.modeAlwaysSetStyle=!1},updateThemeColors:function(){var e=function(e,t){if(e){var n,r=Common.Utils.ThemeColor.getEffectColors();for(var i=0;i<r.length;i++)typeof e.currentColor=="object"&&n===undefined&&e.currentColor.effectId==r[i].effectId&&(n=r[i]);e.updateColors(r,Common.Utils.ThemeColor.getStandartColors()),e.currentColor===undefined?e.currentColor=t:n!==undefined&&(e.currentColor=n)}};e(this.toolbar.mnuTextColorPicker,Common.Utils.ThemeColor.getStandartColors()[1]),this.toolbar.btnTextColor.currentColor===undefined?this.toolbar.btnTextColor.currentColor=Common.Utils.ThemeColor.getStandartColors()[1]:this.toolbar.btnTextColor.currentColor=this.toolbar.mnuTextColorPicker.currentColor.color||this.toolbar.mnuTextColorPicker.currentColor,$(".btn-color-value-line",this.toolbar.btnTextColor.cmpEl).css("background-color","#"+this.toolbar.btnTextColor.currentColor),e(this.toolbar.mnuBackColorPicker,Common.Utils.ThemeColor.getStandartColors()[3]),this.toolbar.btnBackColor.currentColor===undefined?this.toolbar.btnBackColor.currentColor=Common.Utils.ThemeColor.getStandartColors()[3]:this.toolbar.btnBackColor.currentColor=this.toolbar.mnuBackColorPicker.currentColor.color||this.toolbar.mnuBackColorPicker.currentColor,$(".btn-color-value-line",this.toolbar.btnBackColor.cmpEl).css("background-color",this.toolbar.btnBackColor.currentColor=="transparent"?"transparent":"#"+this.toolbar.btnBackColor.currentColor);if(this._state.clrtext_asccolor!==undefined||this._state.clrshd_asccolor!==undefined)this._state.clrtext=undefined,this._state.clrback=undefined,this.onApiSelectionChanged(this.api.asc_getCellInfo());this._state.clrtext_asccolor=undefined,this._state.clrshd_asccolor=undefined,this.toolbar.mnuBorderColorPicker&&(e(this.toolbar.mnuBorderColorPicker,Common.Utils.ThemeColor.getEffectColors()[1]),this.toolbar.btnBorders.options.borderscolor=this.toolbar.mnuBorderColorPicker.currentColor.color||this.toolbar.mnuBorderColorPicker.currentColor,$("#id-toolbar-mnu-item-border-color .menu-item-icon").css("border-color","#"+this.toolbar.btnBorders.options.borderscolor))},hideElements:function(e){if(!_.isUndefined(e.title)){var t=this.getApplication().getController("Viewport").getView("Common.Views.Header");t&&t.setVisible(!e.title),Common.NotificationCenter.trigger("layout:changed","header")}_.isUndefined(e.compact)||this.onChangeViewMode(e.compact);if(!_.isUndefined(e.formula)){var n=this.getApplication().getController("CellEditor").getView("CellEditor");n&&n.setVisible(!e.formula),Common.NotificationCenter.trigger("layout:changed","celleditor",e.formula?"hidden":"showed")}_.isUndefined(e.headings)||this.api&&this.api.asc_setDisplayHeadings(!e.headings),_.isUndefined(e.gridlines)||this.api&&this.api.asc_setDisplayGridlines(!e.gridlines),_.isUndefined(e.freezepanes)||this.api&&this.api.asc_freezePane(),Common.NotificationCenter.trigger("edit:complete",this.toolbar)},fillAutoShapes:function(){var e=this,t=this.getApplication().getCollection("ShapeGroups");for(var n=0;n<t.length;n++){var r=t.at(n),i=new Common.UI.MenuItem({caption:r.get("groupName"),menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{template:_.template('<div id="id-toolbar-menu-shapegroup'+n+'" class="menu-shape" style="width: '+(r.get("groupWidth")-8)+'px; margin-left: 5px;"></div>')}]})});e.toolbar.btnInsertShape.menu.addItem(i);var s=new Common.UI.DataView({el:$("#id-toolbar-menu-shapegroup"+n),store:r.get("groupStore"),parentMenu:i.menu,showLast:!1,itemTemplate:_.template('<div class="item-shape"><img src="<%= imageUrl %>" id="<%= id %>"></div>')});s.on("item:click",function(t,n,r,i){e.api&&(e._addAutoshape(!0,r.get("data").shapeType),e._isAddingShape=!0,e.toolbar.btnInsertText.pressed&&e.toolbar.btnInsertText.toggle(!1,!0),i.type!=="click"&&e.toolbar.btnInsertShape.menu.hide(),Common.NotificationCenter.trigger("edit:complete",e.toolbar,e.toolbar.btnInsertShape),Common.component.Analytics.trackEvent("ToolBar","Add Shape"))})}},fillTextArt:function(){if(!this.toolbar.btnInsertText.rendered)return;var e=this;if(this.toolbar.mnuTextArtPicker){var t=this.getApplication().getCollection("Common.Collections.TextArt").models,n=this.toolbar.mnuTextArtPicker.store.length;if(n>0&&n==t.length){var r=this.toolbar.mnuTextArtPicker.store.models;_.each(t,function(e,t){r[t].set("imageUrl",e.get("imageUrl"))})}else this.toolbar.mnuTextArtPicker.store.reset(t)}else this.toolbar.mnuTextArtPicker=new Common.UI.DataView({el:$("#id-toolbar-menu-insart"),store:this.getApplication().getCollection("Common.Collections.TextArt"),parentMenu:this.toolbar.mnuInsertTextArt.menu,showLast:!1,itemTemplate:_.template('<div class="item-art"><img src="<%= imageUrl %>" id="<%= id %>"></div>')}),this.toolbar.mnuTextArtPicker.on("item:click",function(t,n,r,i){e.api&&(e.toolbar.fireEvent("inserttextart",e.toolbar),e.api.asc_addTextArt(r.get("data")),e.toolbar.btnInsertShape.pressed&&e.toolbar.btnInsertShape.toggle(!1,!0),i.type!=="click"&&e.toolbar.btnInsertText.menu.hide(),Common.NotificationCenter.trigger("edit:complete",e.toolbar,e.toolbar.btnInsertText),Common.component.Analytics.trackEvent("ToolBar","Add Text Art"))})},fillEquations:function(){if(!this.toolbar.btnInsertEquation.rendered||this.toolbar.btnInsertEquation.menu.items.length>0)return;var e=this,t=this.getApplication().getCollection("EquationGroups");e.equationPickers=[],e.toolbar.btnInsertEquation.menu.removeAll();for(var n=0;n<t.length;++n){var r=t.at(n),i=new Common.UI.MenuItem({caption:r.get("groupName"),menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{template:_.template('<div id="id-toolbar-menu-equationgroup'+n+'" class="menu-shape" style="width:'+(r.get("groupWidth")+8)+"px; "+r.get("groupHeight")+'margin-left:5px;"></div>')}]})});e.toolbar.btnInsertEquation.menu.addItem(i);var s=new Common.UI.DataView({el:$("#id-toolbar-menu-equationgroup"+n),store:r.get("groupStore"),parentMenu:i.menu,showLast:!1,itemTemplate:_.template('<div class="item-equation" style="background-position:<%= posX %>px <%= posY %>px;" ><div style="width:<%= width %>px;height:<%= height %>px;" id="<%= id %>">')});r.get("groupHeight").length&&(e.equationPickers.push(s),e.toolbar.btnInsertEquation.menu.on("show:after",function(){if(e.equationPickers.length){var t=$(this.el).find(".over").find(".menu-shape");if(t.length)for(var n=0;n<e.equationPickers.length;++n)if(t[0].id==e.equationPickers[n].el.id){e.equationPickers[n].scroller.update({alwaysVisibleY:!0}),e.equationPickers.splice(n,1);return}}})),s.on("item:click",function(t,n,r,i){e.api&&(e.api.asc_AddMath(r.get("data").equationType),e.toolbar.btnInsertText.pressed&&e.toolbar.btnInsertText.toggle(!1,!0),e.toolbar.btnInsertShape.pressed&&e.toolbar.btnInsertShape.toggle(!1,!0),i.type!=="click"&&e.toolbar.btnInsertEquation.menu.hide(),Common.NotificationCenter.trigger("edit:complete",e.toolbar,e.toolbar.btnInsertEquation),Common.component.Analytics.trackEvent("ToolBar","Add Equation"))})}},onInsertEquationClick:function(){this.api&&(this.api.asc_AddMath(),Common.component.Analytics.trackEvent("ToolBar","Add Equation")),Common.NotificationCenter.trigger("edit:complete",this.toolbar,this.toolbar.btnInsertEquation)},onMathTypes:function(e){var t=[],n=this.getCollection("EquationGroups");n.reset();var r={};r[Common.define.c_oAscMathMainType.Symbol]=[this.textSymbols,11],r[Common.define.c_oAscMathMainType.Fraction]=[this.textFraction,4],r[Common.define.c_oAscMathMainType.Script]=[this.textScript,4],r[Common.define.c_oAscMathMainType.Radical]=[this.textRadical,4],r[Common.define.c_oAscMathMainType.Integral]=[this.textIntegral,3,!0],r[Common.define.c_oAscMathMainType.LargeOperator]=[this.textLargeOperator,5,!0],r[Common.define.c_oAscMathMainType.Bracket]=[this.textBracket,4,!0],r[Common.define.c_oAscMathMainType.Function]=[this.textFunction,3,!0],r[Common.define.c_oAscMathMainType.Accent]=[this.textAccent,4],r[Common.define.c_oAscMathMainType.LimitLog]=[this.textLimitAndLog,3],r[Common.define.c_oAscMathMainType.Operator]=[this.textOperator,4],r[Common.define.c_oAscMathMainType.Matrix]=[this.textMatrix,4,!0];var i={},s="",o="";for(s in Common.define.c_oAscMathType)if(Common.define.c_oAscMathType.hasOwnProperty(s)){var u=s.split("_");u.length==2&&u[0]=="Symbol"?o="txt"+u[0]+"_"+u[1].toLocaleLowerCase():o="txt"+s,i[Common.define.c_oAscMathType[s]]=this[o]}var a,f=0,l=0,c=0,h=0,p=0,d=null,v=null,m=null,g=null;if(e){l=e.get_Data().length;if(l){for(var y=0;y<l;++y){f=e.get_Data()[y].get_Id(),h=e.get_Data()[y].get_W(),p=e.get_Data()[y].get_H(),d=new Backbone.Collection([],{model:SSE.Models.EquationModel});if(d){var b=0,w=0,E=0;c=e.get_Data()[y].get_Data().length;for(a=0;a<c;++a){m=e.get_Data()[y].get_Data()[a],w=m.get_Data().length;for(var S=0;S<w;++S)g=m.get_Data()[S],E=g.get_Id(),o="",i.hasOwnProperty(E)&&(o=i[E]),d.add({data:{equationType:E},tip:o,allowSelected:!0,selected:!1,width:m.get_W(),height:m.get_H(),posX:-g.get_X(),posY:-g.get_Y()});b+=w}h=r[f][1]*(h+10);var x=parseInt(370/(p+10))*(p+10);t.push({groupName:r[f][0],groupStore:d,groupWidth:h,groupHeight:r[f][2]?" height:"+x+"px!important; ":""})}}n.add(t),this.fillEquations()}}},attachToControlEvents:function(){},onSheetChanged:function(){if(this.api){var e=this.api.asc_getSheetViewSettings(),t=this.getMenuHideOptions();t&&(t.items.getAt(3).setChecked(!e.asc_getShowRowColHeaders()),t.items.getAt(4).setChecked(!e.asc_getShowGridLines()))}},_disableEditOptions:function(e,t){if(this.api.isCellEdited)return!0;if(this.api.isRangeSelection)return!0;var n=this.toolbar,r=e==Asc.c_oAscSelectionType.RangeChartText,i=e==Asc.c_oAscSelectionType.RangeChart,s=e==Asc.c_oAscSelectionType.RangeShapeText,o=e==Asc.c_oAscSelectionType.RangeShape,u=e==Asc.c_oAscSelectionType.RangeImage,a=s||o||r||i,f=!1;if(!a&&!u&&this._state.selection_type===e&&this._state.coauthdisable===t)return e===Asc.c_oAscSelectionType.RangeImage;if(a){var l=this.api.asc_getGraphicObjectProps();for(var c=0;c<l.length;++c)l[c].asc_getObjectType()==Asc.c_oAscTypeSelectElement.Image&&(f=f||l[c].asc_getObjectValue().asc_getLocked())}if(t)n.lockToolbar(SSE.enumLock.coAuth,t);else{var h=SSE.enumLock,p=e;switch(e){case Asc.c_oAscSelectionType.RangeImage:p=h.selImage;break;case Asc.c_oAscSelectionType.RangeShape:p=h.selShape;break;case Asc.c_oAscSelectionType.RangeShapeText:p=h.selShapeText;break;case Asc.c_oAscSelectionType.RangeChart:p=h.selChart;break;case Asc.c_oAscSelectionType.RangeChartText:p=h.selChartText}n.lockToolbar(p,p!=e,{array:[n.btnClearStyle.menu.items[1],n.btnClearStyle.menu.items[2],n.btnClearStyle.menu.items[3],n.btnClearStyle.menu.items[4],n.mnuitemSortAZ,n.mnuitemSortZA,n.mnuitemAutoFilter,n.mnuitemClearFilter],merge:!0,clear:[h.selImage,h.selChart,h.selChartText,h.selShape,h.selShapeText,h.coAuth]}),n.lockToolbar(SSE.enumLock.coAuthText,f),n.lockToolbar(SSE.enumLock.coAuthText,f&&(e==Asc.c_oAscSelectionType.RangeChart||e==Asc.c_oAscSelectionType.RangeChartText),{array:[n.btnInsertChart]})}$("#ce-func-label").toggleClass("disabled",u||a||t),this._state.controlsdisabled.filters=u||a||t;if(u||a||t)n.listStyles.suspendEvents(),n.listStyles.menuPicker.selectRecord(null),n.listStyles.resumeEvents(),this._state.prstyle=undefined;return this._state.selection_type=e,this._state.coauthdisable=t,u},_getApiTextSize:function(){var e=this.api.asc_getCellInfo();return e?e.asc_getFont().asc_getSize():12},_clearChecked:function(e){_.each(e.items,function(e){e.setChecked&&e.setChecked(!1,!0)})},_setTableFormat:function(e){var t=this;if(t.api.isRangeSelection!==!0)if(!t.api.asc_getCellInfo().asc_getFormatTableInfo()){var n=function(n,r){r=="ok"&&(t._state.filter=undefined,t.api.asc_setSelectionDialogMode(Asc.c_oAscSelectionDialogType.None),t._state.tablename?t.api.asc_changeAutoFilter(t._state.tablename,Asc.c_oAscChangeFilterOptions.style,e):t.api.asc_addAutoFilter(e,n.getSettings())),Common.NotificationCenter.trigger("edit:complete",t.toolbar)},r=new SSE.Views.TableOptionsDialog({handler:n});r.show(),r.setSettings({api:t.api})}else t._state.filter=undefined,t._state.tablename?t.api.asc_changeAutoFilter(t._state.tablename,Asc.c_oAscChangeFilterOptions.style,e):t.api.asc_addAutoFilter(e)},onHideMenus:function(e){Common.NotificationCenter.trigger("edit:complete",this.toolbar,{restorefocus:!0})},onSetupCopyStyleButton:function(){this.modeAlwaysSetStyle=!1;var e={kOff:0,kOn:1,kMultiple:2},t=this;Common.NotificationCenter.on({"edit:complete":function(){t.api&&t.modeAlwaysSetStyle&&(t.api.asc_formatPainter(e.kOff),t.toolbar.btnCopyStyle.toggle(!1,!0),t.modeAlwaysSetStyle=!1)}}),$(t.toolbar.btnCopyStyle.cmpEl).dblclick(function(){t.api&&(t.modeAlwaysSetStyle=!0,t.toolbar.btnCopyStyle.toggle(!0,!0),t.api.asc_formatPainter(e.kMultiple))})},onCellsRange:function(e){this.api.isRangeSelection=e!=Asc.c_oAscSelectionDialogType.None,this.onApiEditCell(this.api.isRangeSelection?Asc.c_oAscCellEditorState.editStart:Asc.c_oAscCellEditorState.editEnd);var t=this.toolbar;t.lockToolbar(SSE.enumLock.selRange,this.api.isRangeSelection),this.setDisabledComponents([t.btnUndo],this.api.isRangeSelection||!this.api.asc_getCanUndo()),this.setDisabledComponents([t.btnRedo],this.api.isRangeSelection||!this.api.asc_getCanRedo()),this.onApiSelectionChanged(this.api.asc_getCellInfo())},onLockDefNameManager:function(e){this._state.namedrange_locked=e==Asc.c_oAscDefinedNameReason.LockDefNameManager},DisableToolbar:function(e){var t=$(".toolbar-mask");if(e&&t.length>0||!e&&t.length==0)return;var n=this.toolbar;n.$el.find(".toolbar").toggleClass("masked",e),this.toolbar.lockToolbar(SSE.enumLock.menuFileOpen,e,{array:[n.btnShowMode]});if(e){t=$("<div class='toolbar-mask'>").appendTo(n.$el);var r=n.isCompactView?75:n.mode.nativeApp?80:48;t.css("left",r+"px"),t.css("right",(n.isCompactView?0:45)+"px"),Common.util.Shortcuts.suspendEvents("command+l, ctrl+l, command+shift+l, ctrl+shift+l, command+k, ctrl+k, command+alt+h, ctrl+alt+h, command+1, ctrl+1")}else t.remove(),Common.util.Shortcuts.resumeEvents("command+l, ctrl+l, command+shift+l, ctrl+shift+l, command+k, ctrl+k, command+alt+h, ctrl+alt+h, command+1, ctrl+1")},applyFormulaSettings:function(){var e=this.toolbar.btnInsertFormula.menu.items;for(var t=0;t<Math.min(4,e.length);t++)e[t].setCaption(this.api.asc_getFormulaLocaleName(e[t].value))},textEmptyImgUrl:"You need to specify image URL.",warnMergeLostData:"Operation can destroy data in the selected cells.<br>Continue?",textWarning:"Warning",textFontSizeErr:"The entered value is incorrect.<br>Please enter a numeric value between 1 and 409",textCancel:"Cancel",confirmAddFontName:"The font you are going to save is not available on the current device.<br>The text style will be displayed using one of the device fonts, the saved font will be used when it is available.<br>Do you want to continue?",textSymbols:"Symbols",textFraction:"Fraction",textScript:"Script",textRadical:"Radical",textIntegral:"Integral",textLargeOperator:"Large Operator",textBracket:"Bracket",textFunction:"Function",textAccent:"Accent",textLimitAndLog:"Limit And Log",textOperator:"Operator",textMatrix:"Matrix",txtSymbol_pm:"Plus Minus",txtSymbol_infinity:"Infinity",txtSymbol_equals:"Equal",txtSymbol_neq:"Not Equal To",txtSymbol_about:"Approximately",txtSymbol_times:"Multiplication Sign",txtSymbol_div:"Division Sign",txtSymbol_factorial:"Factorial",txtSymbol_propto:"Proportional To",txtSymbol_less:"Less Than",txtSymbol_ll:"Much Less Than",txtSymbol_greater:"Greater Than",txtSymbol_gg:"Much Greater Than",txtSymbol_leq:"Less Than or Equal To",txtSymbol_geq:"Greater Than or Equal To",txtSymbol_mp:"Minus Plus",txtSymbol_cong:"Approximately Equal To",txtSymbol_approx:"Almost Equal To",txtSymbol_equiv:"Identical To",txtSymbol_forall:"For All",txtSymbol_additional:"Complement",txtSymbol_partial:"Partial Differential",txtSymbol_sqrt:"Radical Sign",txtSymbol_cbrt:"Cube Root",txtSymbol_qdrt:"Fourth Root",txtSymbol_cup:"Union",txtSymbol_cap:"Intersection",txtSymbol_emptyset:"Empty Set",txtSymbol_percent:"Percentage",txtSymbol_degree:"Degrees",txtSymbol_fahrenheit:"Degrees Fahrenheit",txtSymbol_celsius:"Degrees Celsius",txtSymbol_inc:"Increment",txtSymbol_nabla:"Nabla",txtSymbol_exists:"There Exist",txtSymbol_notexists:"There Does Not Exist",txtSymbol_in:"Element Of",txtSymbol_ni:"Contains as Member",txtSymbol_leftarrow:"Left Arrow",txtSymbol_uparrow:"Up Arrow",txtSymbol_rightarrow:"Right Arrow",txtSymbol_downarrow:"Down Arrow",txtSymbol_leftrightarrow:"Left-Right Arrow",txtSymbol_therefore:"Therefore",txtSymbol_plus:"Plus",txtSymbol_minus:"Minus",txtSymbol_not:"Not Sign",txtSymbol_ast:"Asterisk Operator",txtSymbol_bullet:"Bulet Operator",txtSymbol_vdots:"Vertical Ellipsis",txtSymbol_cdots:"Midline Horizontal Ellipsis",txtSymbol_rddots:"Up Right Diagonal Ellipsis",txtSymbol_ddots:"Down Right Diagonal Ellipsis",txtSymbol_aleph:"Alef",txtSymbol_beth:"Bet",txtSymbol_qed:"End of Proof",txtSymbol_alpha:"Alpha",txtSymbol_beta:"Beta",txtSymbol_gamma:"Gamma",txtSymbol_delta:"Delta",txtSymbol_varepsilon:"Epsilon Variant",txtSymbol_epsilon:"Epsilon",txtSymbol_zeta:"Zeta",txtSymbol_eta:"Eta",txtSymbol_theta:"Theta",txtSymbol_vartheta:"Theta Variant",txtSymbol_iota:"Iota",txtSymbol_kappa:"Kappa",txtSymbol_lambda:"Lambda",txtSymbol_mu:"Mu",txtSymbol_nu:"Nu",txtSymbol_xsi:"Xi",txtSymbol_o:"Omicron",txtSymbol_pi:"Pi",txtSymbol_varpi:"Pi Variant",txtSymbol_rho:"Rho",txtSymbol_varrho:"Rho Variant",txtSymbol_sigma:"Sigma",txtSymbol_varsigma:"Sigma Variant",txtSymbol_tau:"Tau",txtSymbol_upsilon:"Upsilon",txtSymbol_varphi:"Phi Variant",txtSymbol_phi:"Phi",txtSymbol_chi:"Chi",txtSymbol_psi:"Psi",txtSymbol_omega:"Omega",txtFractionVertical:"Stacked Fraction",txtFractionDiagonal:"Skewed Fraction",txtFractionHorizontal:"Linear Fraction",txtFractionSmall:"Small Fraction",txtFractionDifferential_1:"Differential",txtFractionDifferential_2:"Differential",txtFractionDifferential_3:"Differential",txtFractionDifferential_4:"Differential",txtFractionPi_2:"Pi Over 2",txtScriptSup:"Superscript",txtScriptSub:"Subscript",txtScriptSubSup:"Subscript-Superscript",txtScriptSubSupLeft:"Left Subscript-Superscript",txtScriptCustom_1:"Script",txtScriptCustom_2:"Script",txtScriptCustom_3:"Script",txtScriptCustom_4:"Script",txtRadicalSqrt:"Square Root",txtRadicalRoot_n:"Radical With Degree",txtRadicalRoot_2:"Square Root With Degree",txtRadicalRoot_3:"Cubic Root",txtRadicalCustom_1:"Radical",txtRadicalCustom_2:"Radical",txtIntegral:"Integral",txtIntegralSubSup:"Integral",txtIntegralCenterSubSup:"Integral",txtIntegralDouble:"Double Integral",txtIntegralDoubleSubSup:"Double Integral",txtIntegralDoubleCenterSubSup:"Double Integral",txtIntegralTriple:"Triple Integral",txtIntegralTripleSubSup:"Triple Integral",txtIntegralTripleCenterSubSup:"Triple Integral",txtIntegralOriented:"Contour Integral",txtIntegralOrientedSubSup:"Contour Integral",txtIntegralOrientedCenterSubSup:"Contour Integral",txtIntegralOrientedDouble:"Surface Integral",txtIntegralOrientedDoubleSubSup:"Surface Integral",txtIntegralOrientedDoubleCenterSubSup:"Surface Integral",txtIntegralOrientedTriple:"Volume Integral",txtIntegralOrientedTripleSubSup:"Volume Integral",txtIntegralOrientedTripleCenterSubSup:"Volume Integral",txtIntegral_dx:"Differential x",txtIntegral_dy:"Differential y",txtIntegral_dtheta:"Differential theta",txtLargeOperator_Sum:"Summation",txtLargeOperator_Sum_CenterSubSup:"Summation",txtLargeOperator_Sum_SubSup:"Summation",txtLargeOperator_Sum_CenterSub:"Summation",txtLargeOperator_Sum_Sub:"Summation",txtLargeOperator_Prod:"Product",txtLargeOperator_Prod_CenterSubSup:"Product",txtLargeOperator_Prod_SubSup:"Product",txtLargeOperator_Prod_CenterSub:"Product",txtLargeOperator_Prod_Sub:"Product",txtLargeOperator_CoProd:"Co-Product",txtLargeOperator_CoProd_CenterSubSup:"Co-Product",txtLargeOperator_CoProd_SubSup:"Co-Product",txtLargeOperator_CoProd_CenterSub:"Co-Product",txtLargeOperator_CoProd_Sub:"Co-Product",txtLargeOperator_Union:"Union",txtLargeOperator_Union_CenterSubSup:"Union",txtLargeOperator_Union_SubSup:"Union",txtLargeOperator_Union_CenterSub:"Union",txtLargeOperator_Union_Sub:"Union",txtLargeOperator_Intersection:"Intersection",txtLargeOperator_Intersection_CenterSubSup:"Intersection",txtLargeOperator_Intersection_SubSup:"Intersection",txtLargeOperator_Intersection_CenterSub:"Intersection",txtLargeOperator_Intersection_Sub:"Intersection",txtLargeOperator_Disjunction:"Vee",txtLargeOperator_Disjunction_CenterSubSup:"Vee",txtLargeOperator_Disjunction_SubSup:"Vee",txtLargeOperator_Disjunction_CenterSub:"Vee",txtLargeOperator_Disjunction_Sub:"Vee",txtLargeOperator_Conjunction:"Wedge",txtLargeOperator_Conjunction_CenterSubSup:"Wedge",txtLargeOperator_Conjunction_SubSup:"Wedge",txtLargeOperator_Conjunction_CenterSub:"Wedge",txtLargeOperator_Conjunction_Sub:"Wedge",txtLargeOperator_Custom_1:"Summation",txtLargeOperator_Custom_2:"Summation",txtLargeOperator_Custom_3:"Summation",txtLargeOperator_Custom_4:"Product",txtLargeOperator_Custom_5:"Union",txtBracket_Round:"Brackets",txtBracket_Square:"Brackets",txtBracket_Curve:"Brackets",txtBracket_Angle:"Brackets",txtBracket_LowLim:"Brackets",txtBracket_UppLim:"Brackets",txtBracket_Line:"Brackets",txtBracket_LineDouble:"Brackets",txtBracket_Square_OpenOpen:"Brackets",txtBracket_Square_CloseClose:"Brackets",txtBracket_Square_CloseOpen:"Brackets",txtBracket_SquareDouble:"Brackets",txtBracket_Round_Delimiter_2:"Brackets with Separators",txtBracket_Curve_Delimiter_2:"Brackets with Separators",txtBracket_Angle_Delimiter_2:"Brackets with Separators",txtBracket_Angle_Delimiter_3:"Brackets with Separators",txtBracket_Round_OpenNone:"Single Bracket",txtBracket_Round_NoneOpen:"Single Bracket",txtBracket_Square_OpenNone:"Single Bracket",txtBracket_Square_NoneOpen:"Single Bracket",txtBracket_Curve_OpenNone:"Single Bracket",txtBracket_Curve_NoneOpen:"Single Bracket",txtBracket_Angle_OpenNone:"Single Bracket",txtBracket_Angle_NoneOpen:"Single Bracket",txtBracket_LowLim_OpenNone:"Single Bracket",txtBracket_LowLim_NoneNone:"Single Bracket",txtBracket_UppLim_OpenNone:"Single Bracket",txtBracket_UppLim_NoneOpen:"Single Bracket",txtBracket_Line_OpenNone:"Single Bracket",txtBracket_Line_NoneOpen:"Single Bracket",txtBracket_LineDouble_OpenNone:"Single Bracket",txtBracket_LineDouble_NoneOpen:"Single Bracket",txtBracket_SquareDouble_OpenNone:"Single Bracket",txtBracket_SquareDouble_NoneOpen:"Single Bracket",txtBracket_Custom_1:"Case (Two Conditions)",txtBracket_Custom_2:"Cases (Three Conditions)",txtBracket_Custom_3:"Stack Object",txtBracket_Custom_4:"Stack Object",txtBracket_Custom_5:"Cases Example",txtBracket_Custom_6:"Binomial Coefficient",txtBracket_Custom_7:"Binomial Coefficient",txtFunction_Sin:"Sine Function",txtFunction_Cos:"Cosine Function",txtFunction_Tan:"Tangent Function",txtFunction_Csc:"Cosecant Function",txtFunction_Sec:"Secant Function",txtFunction_Cot:"Cotangent Function",txtFunction_1_Sin:"Inverse Sine Function",txtFunction_1_Cos:"Inverse Cosine Function",txtFunction_1_Tan:"Inverse Tangent Function",txtFunction_1_Csc:"Inverse Cosecant Function",txtFunction_1_Sec:"Inverse Secant Function",txtFunction_1_Cot:"Inverse Cotangent Function",txtFunction_Sinh:"Hyperbolic Sine Function",txtFunction_Cosh:"Hyperbolic Cosine Function",txtFunction_Tanh:"Hyperbolic Tangent Function",txtFunction_Csch:"Hyperbolic Cosecant Function",txtFunction_Sech:"Hyperbolic Secant Function",txtFunction_Coth:"Hyperbolic Cotangent Function",txtFunction_1_Sinh:"Hyperbolic Inverse Sine Function",txtFunction_1_Cosh:"Hyperbolic Inverse Cosine Function",txtFunction_1_Tanh:"Hyperbolic Inverse Tangent Function",txtFunction_1_Csch:"Hyperbolic Inverse Cosecant Function",txtFunction_1_Sech:"Hyperbolic Inverse Secant Function",txtFunction_1_Coth:"Hyperbolic Inverse Cotangent Function",txtFunction_Custom_1:"Sine theta",txtFunction_Custom_2:"Cos 2x",txtFunction_Custom_3:"Tangent formula",txtAccent_Dot:"Dot",txtAccent_DDot:"Double Dot",txtAccent_DDDot:"Triple Dot",txtAccent_Hat:"Hat",txtAccent_Check:"Check",txtAccent_Accent:"Acute",txtAccent_Grave:"Grave",txtAccent_Smile:"Breve",txtAccent_Tilde:"Tilde",txtAccent_Bar:"Bar",txtAccent_DoubleBar:"Double Overbar",txtAccent_CurveBracketTop:"Overbrace",txtAccent_CurveBracketBot:"Underbrace",txtAccent_GroupTop:"Grouping Character Above",txtAccent_GroupBot:"Grouping Character Below",txtAccent_ArrowL:"Leftwards Arrow Above",txtAccent_ArrowR:"Rightwards Arrow Above",txtAccent_ArrowD:"Right-Left Arrow Above",txtAccent_HarpoonL:"Leftwards Harpoon Above",txtAccent_HarpoonR:"Rightwards Harpoon Above",txtAccent_BorderBox:"Boxed Formula (With Placeholder)",txtAccent_BorderBoxCustom:"Boxed Formula (Example)",txtAccent_BarTop:"Overbar",txtAccent_BarBot:"Underbar",txtAccent_Custom_1:"Vector A",txtAccent_Custom_2:"ABC With Overbar",txtAccent_Custom_3:"x XOR y With Overbar",txtLimitLog_LogBase:"Logarithm",txtLimitLog_Log:"Logarithm",txtLimitLog_Lim:"Limit",txtLimitLog_Min:"Minimum",txtLimitLog_Max:"Maximum",txtLimitLog_Ln:"Natural Logarithm",txtLimitLog_Custom_1:"Limit Example",txtLimitLog_Custom_2:"Maximum Example",txtOperator_ColonEquals:"Colon Equal",txtOperator_EqualsEquals:"Equal Equal",txtOperator_PlusEquals:"Plus Equal",txtOperator_MinusEquals:"Minus Equal",txtOperator_Definition:"Equal to By Definition",txtOperator_UnitOfMeasure:"Measured By",txtOperator_DeltaEquals:"Delta Equal To",txtOperator_ArrowL_Top:"Leftwards Arrow Above",txtOperator_ArrowR_Top:"Rightwards Arrow Above",txtOperator_ArrowL_Bot:"Leftwards Arrow Below",txtOperator_ArrowR_Bot:"Rightwards Arrow Below",txtOperator_DoubleArrowL_Top:"Leftwards Arrow Above",txtOperator_DoubleArrowR_Top:"Rightwards Arrow Above",txtOperator_DoubleArrowL_Bot:"Leftwards Arrow Below",txtOperator_DoubleArrowR_Bot:"Rightwards Arrow Below",txtOperator_ArrowD_Top:"Right-Left Arrow Above",txtOperator_ArrowD_Bot:"Right-Left Arrow Above",txtOperator_DoubleArrowD_Top:"Right-Left Arrow Below",txtOperator_DoubleArrowD_Bot:"Right-Left Arrow Below",txtOperator_Custom_1:"Yileds",txtOperator_Custom_2:"Delta Yields",txtMatrix_1_2:"1x2 Empty Matrix",txtMatrix_2_1:"2x1 Empty Matrix",txtMatrix_1_3:"1x3 Empty Matrix",txtMatrix_3_1:"3x1 Empty Matrix",txtMatrix_2_2:"2x2 Empty Matrix",txtMatrix_2_3:"2x3 Empty Matrix",txtMatrix_3_2:"3x2 Empty Matrix",txtMatrix_3_3:"3x3 Empty Matrix",txtMatrix_Dots_Center:"Midline Dots",txtMatrix_Dots_Baseline:"Baseline Dots",txtMatrix_Dots_Vertical:"Vertical Dots",txtMatrix_Dots_Diagonal:"Diagonal Dots",txtMatrix_Identity_2:"2x2 Identity Matrix",txtMatrix_Identity_2_NoZeros:"3x3 Identity Matrix",txtMatrix_Identity_3:"3x3 Identity Matrix",txtMatrix_Identity_3_NoZeros:"3x3 Identity Matrix",txtMatrix_2_2_RoundBracket:"Empty Matrix with Brackets",txtMatrix_2_2_SquareBracket:"Empty Matrix with Brackets",txtMatrix_2_2_LineBracket:"Empty Matrix with Brackets",txtMatrix_2_2_DLineBracket:"Empty Matrix with Brackets",txtMatrix_Flat_Round:"Sparse Matrix",txtMatrix_Flat_Square:"Sparse Matrix",txtExpandSort:"The data next to the selection will not be sorted. Do you want to expand the selection to include the adjacent data or continue with sorting the currently selected cells only?",txtExpand:"Expand and sort",txtSorting:"Sorting",txtSortSelected:"Sort selected"},SSE.Controllers.Toolbar||{}))}),define("text!spreadsheeteditor/main/app/template/StatusBar.template",[],function(){return'\r\n<div class="statusbar">\r\n <div id="status-tabs-scroll" class="status-group">\r\n <button id="status-btn-tabfirst" type="button" class="btn small btn-toolbar"><span class="btn-icon btn-tab-first"> </span></button>\r\n <button id="status-btn-tabback" type="button" class="btn small btn-toolbar"><span class="btn-icon btn-tab-back"> </span></button>\r\n <button id="status-btn-tabnext" type="button" class="btn small btn-toolbar"><span class="btn-icon btn-tab-next"> </span></button>\r\n <button id="status-btn-tablast" type="button" class="btn small btn-toolbar"><span class="btn-icon btn-tab-last"> </span></button>\r\n </div>\r\n <div id="status-addtabs-box" class="status-group">\r\n <button id="status-btn-addtab" type="button" class="btn small btn-toolbar"><span class="btn-icon btn-zoom-up"> </span></button>\r\n </div>\r\n <div id="status-zoom-box" class="status-group">\r\n <div class="separator short" />\r\n <button id="status-btn-zoomdown" type="button" class="btn small btn-toolbar"><span class="btn-icon btn-zoom-down"> </span></button>\r\n <div class="cnt-zoom">\r\n <div class="dropdown-toggle" data-toggle="dropdown">\r\n <label id="status-label-zoom" class="status-label">Zoom 100%</label>\r\n </div>\r\n </div>\r\n <button id="status-btn-zoomup" type="button" class="btn small btn-toolbar" style="margin-right:40px;"><span class="btn-icon btn-zoom-up"> </span></button>\r\n </div>\r\n <!-- /** coauthoring begin **/ -->\r\n <div id="status-users-ct" class="status-group dropup" style="display:none;">\r\n <div class="separator short" />\r\n <div id="status-users-block" style="display:inline-block; cursor:pointer; margin-left: 12px;">\r\n <span id="status-users-icon" class="img-commonctrl" style="margin-bottom: 1px;"/>\r\n <label id="status-users-count" class="status-label" style="font-size: 14px; font-weight: normal; margin-top: -1px;">+</label>\r\n </div>\r\n <div id="status-users-menu" class="dropdown-menu">\r\n <label style="display: block;margin-right: 14px;"><%= scope.tipUsers %></label>\r\n <div id="status-users-list"></div>\r\n <label id="status-change-rights" class="link" style="margin-top: 15px;"><%= scope.txAccessRights %></label>\r\n </div>\r\n </div>\r\n <!-- /** coauthoring end **/ -->\r\n <div id="status-math-box" class="status-group">\r\n <div class="separator short" style="margin-right: 12px;" />\r\n <label id="status-math-average">AVERAGE: 10</label>\r\n <label id="status-math-count">COUNT: 3</label>\r\n <label id="status-math-sum">SUM: 5</label>\r\n </div>\r\n <div id="status-filtered-box" class="status-group">\r\n <div class="separator short" style="margin-right: 12px;" />\r\n <label id="status-filtered-records"></label>\r\n </div>\r\n <div id="status-sheets-bar-box">\r\n <div id="status-sheets-bar" class="status-group">\r\n </div>\r\n </div>\r\n</div>\r\n'});if(Common===undefined)var Common={};define("common/main/lib/component/Tab",["common/main/lib/component/BaseView"],function(e){"use strict";var t=function(e){return this.active=!1,this.label="Tab",this.cls="",this.template=_.template(['<li class="<% if(active){ %>active<% } %> <% if(cls.length){%><%= cls %><%}%>" data-label="<%= label %>">',"<a><%- label %></a>","</li>"].join("")),this.initialize.call(this,e),this};_.extend(t.prototype,{initialize:function(e){_.extend(this,e)},render:function(){var e=this.template(this);return this.$el=$(e),this.rendered=!0,this.disable(this.disabled),this},isActive:function(){return this.$el.hasClass("active")},activate:function(){this.$el.hasClass("active")||this.$el.addClass("active")},deactivate:function(){this.$el.removeClass("active")},on:function(){this.$el.on.apply(this,arguments)},disable:function(e){this.disabled=e,this.rendered&&(e&&!this.$el.hasClass("disabled")?this.$el.addClass("disabled"):this.$el.removeClass("disabled"))},addClass:function(e){e.length&&!this.$el.hasClass(e)&&this.$el.addClass(e)},removeClass:function(e){e.length&&this.$el.hasClass(e)&&this.$el.removeClass(e)},hasClass:function(e){return this.$el.hasClass(e)},setCaption:function(e){this.$el.find("> a").text(e)}}),Common.UI.Tab=t}),define("common/main/lib/component/TabBar",["common/main/lib/component/BaseView","common/main/lib/component/Tab"],function(){"use strict";var e={bind:function(){this.o||(this.o=$({})),this.o.on.apply(this.o,arguments)},unbind:function(){this.o&&this.o.off.apply(this.o,arguments)},trigger:function(){this.o||(this.o=$({})),this.o.trigger.apply(this.o,arguments)}},t=function(e){this.initialize.call(this,e)};_.extend(t.prototype,e),t.prototype.initialize=function(e){this.bar=e.bar},t.prototype.attach=function(e){e.changeState=$.proxy(function(){this.trigger("tab:change",e),this.bar.$el.find("ul > li.active").removeClass("active"),e.activate(),this.bar.trigger("tab:changed",this.bar,this.bar.tabs.indexOf(e),e)},this);var t=new function(){return{bounds:[],drag:undefined,calculateBounds:function(){var e=this,t=e.bar.tabs.length,n=e.bar.$bar.get(0).getBoundingClientRect();if(n){e.bounds=[],e.scrollLeft=e.bar.$bar.scrollLeft(),e.bar.scrollX=this.scrollLeft;for(var r=0;r<t;++r)this.bounds.push(e.bar.tabs[r].$el.get(0).getBoundingClientRect());e.tabBarLeft=e.bounds[0].left,e.tabBarRight=e.bounds[t-1].right,e.tabBarRight=Math.min(e.tabBarRight,n.right-1)}},setAbsTabs:function(){var e=this,t=null,n=this.bounds.length;for(var r=0;r<n;++r)t=e.bar.tabs[r].$el,t.css("position","absolute"),t.css("left",e.bounds[r].left-e.tabBarLeft-this.scrollLeft+"px"),t.hasClass("active")?t.css("top","1px"):t.css("top","0px")},updatePositions:function(){this.drag.place=undefined;var e,t,n,r=-1,i=-this.scrollLeft,s=this.bounds.length,o=this.drag.tab.$el.get(0).getBoundingClientRect();if(this.drag.moveX-this.drag.mouseX>0){for(e=s-1;e>=0;--e){t=this.bounds[e],n=(t.right+t.left)*.5;if(o.left<n&&n<o.right){r=e;break}}if(-1===r)for(e=s-1;e>=0;--e){t=o,n=(t.right+t.left)*.5;if(this.bounds[e].left<n&&n<this.bounds[e].right){r=e;break}}}else{for(e=0;e<s;++e){t=this.bounds[e],n=(t.right+t.left)*.5;if(o.left<n&&n<o.right){r=e;break}}if(-1===r)for(e=0;e<s;++e){t=o,n=(t.right+t.left)*.5;if(this.bounds[e].left<n&&n<this.bounds[e].right){r=e;break}}}if(-1!==r){this.drag.place=r;for(e=0;e<s;++e){e===r&&r<this.drag.index&&(i+=this.drag.tabWidth),r>this.drag.index&&e===r+1&&(i+=this.drag.tabWidth);if(e===this.drag.index){this.drag.index===r&&(i+=this.drag.tabWidth);continue}this.bar.tabs[e].$el.css("left",i+"px"),i+=this.bounds[e].width}}},setHook:function(e,t,n){function i(){if(!_.isUndefined(r.drag)){r.drag.tab.$el.css("z-index","");var e=null;for(var t=r.bar.tabs.length-1;t>=0;--t)e=r.bar.tabs[t].$el,e&&(e.css("top",""),e.css("position",""),e.css("left",""));_.isUndefined(r.drag.place)?(r.bar.trigger("tab:move",r.drag.index),r.bar.$bar.scrollLeft(r.scrollLeft),r.bar.scrollX=undefined):(r.bar.trigger("tab:move",r.drag.index,r.drag.place),r.bar.$bar.scrollLeft(r.scrollLeft),r.bar.scrollX=undefined),r.drag=undefined}}function s(e){if(!_.isUndefined(r.drag)){r.drag.moveX=e.clientX*Common.Utils.zoom();var t=Math.max(r.drag.moveX-r.drag.anchorX-r.tabBarLeft-r.scrollLeft,0);t=Math.min(t,r.tabBarRight-r.tabBarLeft-r.drag.tabWidth-r.scrollLeft),r.drag.tab.$el.css("left",t+"px"),r.drag.tab.$el.css("z-index","100"),r.updatePositions()}}function o(e){e.preventDefault()}var r=this;if(!_.isUndefined(t)&&!_.isUndefined(n)&&t.tabs.length>1){var u=t.tabs.indexOf(n),a=e.clientX*Common.Utils.zoom();r.bar=t,r.drag={tab:n,index:u},this.calculateBounds(),this.setAbsTabs(),r.drag.moveX=a,r.drag.mouseX=a,r.drag.anchorX=a-this.bounds[u].left,r.drag.tabWidth=this.bounds[u].width,document.addEventListener("dragstart",o),$(document).on("mousemove.tabbar",s),$(document).on("mouseup.tabbar",function(e){i(e),$(document).off("mouseup.tabbar"),$(document).off("mousemove.tabbar"),document.removeEventListener("dragstart",o)})}}}};e.$el.on({click:$.proxy(function(){!e.disabled&&!e.$el.hasClass("active")&&(e.control=="manual"?this.bar.trigger("tab:manual",this.bar,this.bar.tabs.indexOf(e),e):e.changeState())},this),dblclick:$.proxy(function(){this.trigger("tab:dblclick",this,this.tabs.indexOf(e),e)},this.bar),contextmenu:$.proxy(function(){this.trigger("tab:contextmenu",this,this.tabs.indexOf(e),e)},this.bar),mousedown:$.proxy(function(n){this.bar.options.draggable&&!_.isUndefined(t)&&3!==n.which&&(e.isLockTheDrag||t.setHook(n,this.bar,e))},this)})},t.prototype.detach=function(e){e.$el.off()},Common.UI.TabBar=Common.UI.BaseView.extend({config:{placement:"top",items:[],draggable:!1},tabs:[],template:_.template('<ul class="nav nav-tabs <%= placement %>" />'),initialize:function(e){_.extend(this.config,e),Common.UI.BaseView.prototype.initialize.call(this,e),this.saved=[]},render:function(){this.$el.html(this.template(this.config)),this.$bar=this.$el.find("ul");var e=function(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e.attachEvent("on"+t,n)},n=/Firefox/i.test(navigator.userAgent)?"DOMMouseScroll":"mousewheel";return e(this.$bar[0],n,_.bind(this._onMouseWheel,this)),this.manager=new t({bar:this}),this.insert(-1,this.config.items),this.insert(-1,this.saved),delete this.saved,this.rendered=!0,this},_onMouseWheel:function(e){var t=this.checkInvisible(!0),n=(e.detail&&-e.detail||e.wheelDelta)>0;n?t.last&&this.setTabVisible("forward"):t.first&&this.setTabVisible("backward")},add:function(e){return this.insert(-1,e)>0},insert:function(e,t){var n=0;if(t){t instanceof Array||(t=[t]);if(t.length){n=t.length;if(this.rendered){var r=this,i;if(e<0||e>r.tabs.length)for(var s=0;s<t.length;s++)i=new Common.UI.Tab(t[s]),r.$bar.append(i.render().$el),r.tabs.push(i),r.manager.attach(i);else for(s=t.length;s-->0;)i=new Common.UI.Tab(t[s]),e===0?(r.$bar.prepend(i.render().$el),r.tabs.unshift(i)):(r.$bar.find("li:nth-child("+e+")").before(i.render().$el),r.tabs.splice(e,0,i)),r.manager.attach(i)}else this.saved.push(t);this.checkInvisible()}}return n},remove:function(e){if(e>=0&&e<this.tabs.length){var t=this.tabs.splice(e,1)[0];this.manager.detach(t),t.$el.remove(),this.checkInvisible()}},empty:function(e){var t=this;this.tabs.forEach(function(e){t.manager.detach(e)}),this.$bar.empty(),t.tabs=[],this.checkInvisible(e)},setActive:function(e){if(e instanceof Common.UI.Tab)t=e;else if(typeof e=="number"&&e>=0&&e<this.tabs.length)var t=this.tabs[e];t&&t.control!="manual"&&!t.disabled&&!t.$el.hasClass("active")&&t.changeState(),this.checkInvisible()},getActive:function(e){return e?this.$bar.find("> li.active"):this.$bar.find("> li.active").index()},getAt:function(e){return e>=0&&e<this.tabs.length?this.tabs[e]:undefined},getCount:function(){return this.tabs.length},addClass:function(e){e.length&&!this.$bar.hasClass(e)&&this.$bar.addClass(e)},removeClass:function(e){e.length&&this.$bar.hasClass(e)&&this.$bar.removeClass(e)},hasClass:function(e){return this.$bar.hasClass(e)},setTabVisible:function(e,t){if(e<=0||e=="first")this.$bar.scrollLeft(0),this.checkInvisible(t);else if(e>=this.tabs.length-1||e=="last"){var n=this.tabs[this.tabs.length-1].$el;this.$bar.scrollLeft(this.$bar.scrollLeft()+(n.position().left+parseInt(n.css("width"))-this.$bar.width())+1),this.checkInvisible(t)}else{var r=this.$bar.width(),n,i,s;if(e=="forward")for(var o=0;o<this.tabs.length;o++){n=this.tabs[o].$el,i=n.position().left+parseInt(n.css("width"));if(i>r){this.$bar.scrollLeft(this.$bar.scrollLeft()+(i-r)+20),this.checkInvisible(t);break}}else if(e=="backward")for(o=this.tabs.length;o-->0;){n=this.tabs[o].$el,s=n.position().left;if(s<0){this.$bar.scrollLeft(this.$bar.scrollLeft()+s-26),this.checkInvisible(t);break}}else typeof e=="number"&&(n=this.tabs[e].$el,s=n.position().left,i=s+parseInt(n.css("width")),s<0?(this.$bar.scrollLeft(this.$bar.scrollLeft()+s-26),this.checkInvisible(t)):i>r&&(this.$bar.scrollLeft(this.$bar.scrollLeft()+(i-r)+20),this.checkInvisible(t)))}},checkInvisible:function(e){var t={first:!this.isTabVisible(0),last:!this.isTabVisible(this.tabs.length-1)};return!e&&this.fireEvent("tab:invisible",this,t),t},hasInvisible:function(){var e=this.$bar.offset().left,t=e+this.$bar.width();for(var n=this.tabs.length;n-->0;)if(!this.isTabVisible(n,e,t))return!0;return!1},isTabVisible:function(e){var t=arguments[1]||this.$bar.offset().left,n=arguments[2]||t+this.$bar.width(),r,i,s,o;return e<this.tabs.length&&e>=0?(s=this.tabs[e].$el,o=s.get(0).getBoundingClientRect(),r=o.left,i=o.right,!(r<t)&&!(i>n)):!1}})}),define("spreadsheeteditor/main/app/view/Statusbar",["text!spreadsheeteditor/main/app/template/StatusBar.template","tip","common/main/lib/component/TabBar","common/main/lib/component/Menu","common/main/lib/component/Window","common/main/lib/component/ThemeColorPalette"],function(e){"use strict";if(SSE.Views.Statusbar)var t=SSE.Views.Statusbar.RenameDialog,n=SSE.Views.Statusbar.CopyDialog;SSE.Views.Statusbar=Common.UI.BaseView.extend(_.extend({el:"#statusbar",template:_.template(e),storeUsers:undefined,tplUser:['<li id="status-chat-user-<%= user.get("id") %>" class="<% if (!user.get("online")) { %> offline <% } if (user.get("view")) {%> viewmode <% } %>">','<div class="color" style="background-color: <%= user.get("color") %>;" >','<label class="name"><%= scope.getUserName(user.get("username")) %></label>',"</div>","</li>"].join(""),templateUserList:_.template("<ul><% _.each(users, function(item) { %><%= _.template(usertpl, {user: item, scope: scope}) %><% }); %></ul>"),events:function(){return{"click #status-btn-tabfirst":_.bind(this.onBtnTabScroll,this,"first"),"click #status-btn-tabback":_.bind(this.onBtnTabScroll,this,"backward"),"click #status-btn-tabnext":_.bind(this.onBtnTabScroll,this,"forward"),"click #status-btn-tablast":_.bind(this.onBtnTabScroll,this,"last")}},api:undefined,initialize:function(e){_.extend(this,e)},render:function(){function r(){return{isDummy:!0,on:function(){}}}var e=this;$(this.el).html(this.template({scope:this})),this.editMode=!1,this.btnZoomDown=new Common.UI.Button({el:$("#status-btn-zoomdown",this.el),hint:this.tipZoomOut+" (Ctrl+-)",hintAnchor:"top"}),this.btnZoomUp=new Common.UI.Button({el:$("#status-btn-zoomup",this.el),hint:this.tipZoomIn+" (Ctrl++)",hintAnchor:"top-right"}),this.btnScrollFirst=new Common.UI.Button({el:$("#status-btn-tabfirst",this.el),hint:this.tipFirst,disabled:!0,hintAnchor:"top"}),this.btnScrollBack=new Common.UI.Button({el:$("#status-btn-tabback",this.el),hint:this.tipPrev,disabled:!0,hintAnchor:"top"}),this.btnScrollNext=new Common.UI.Button({el:$("#status-btn-tabnext",this.el),hint:this.tipNext,disabled:!0,hintAnchor:"top"}),this.btnScrollLast=new Common.UI.Button({el:$("#status-btn-tablast",this.el),hint:this.tipLast,disabled:!0,hintAnchor:"top"}),this.btnAddWorksheet=new Common.UI.Button({el:$("#status-btn-addtab",this.el),hint:this.tipAddTab,disabled:!0,hintAnchor:"top"}),this.cntZoom=new Common.UI.Button({el:$(".cnt-zoom",this.el),hint:this.tipZoomFactor,hintAnchor:"top"}),this.cntZoom.cmpEl.on({"show.bs.dropdown":function(){_.defer(function(){e.cntZoom.cmpEl.find("ul").focus()},100)},"hide.bs.dropdown":function(){_.defer(function(){e.api.asc_enableKeyEvents(!0)},100)}}),this.zoomMenu=new Common.UI.Menu({style:"margin-top:-5px;",menuAlign:"bl-tl",items:[{caption:"50%",value:50},{caption:"75%",value:75},{caption:"100%",value:100},{caption:"125%",value:125},{caption:"150%",value:150},{caption:"175%",value:175},{caption:"200%",value:200}]}),this.zoomMenu.render($(".cnt-zoom",this.el)),this.zoomMenu.cmpEl.attr({tabindex:-1}),this.labelZoom=$("#status-label-zoom",this.$el),this.panelUsersList=$("#status-users-list",this.el),this.storeUsers.bind({add:_.bind(this._onAddUser,this),change:_.bind(this._onUsersChanged,this),reset:_.bind(this._onResetUsers,this)}),this.panelUsers=$("#status-users-ct",this.el),this.panelUsers.on("shown.bs.dropdown",function(){e.panelUsersList.scroller.update({minScrollbarLength:40,alwaysVisibleY:!0});var t=e.panelUsersBlock.data("bs.tooltip");t&&t.hide()}),this.panelUsersBlock=this.panelUsers.find("#status-users-block"),this.panelUsersBlock.tooltip({title:this.tipAccessRights,html:!0,placement:"top"}),this.panelUsersBlock.on("click",_.bind(this.onUsersClick,this)),this.lblUserCount=this.panelUsers.find("#status-users-count"),this.lblChangeRights=this.panelUsers.find("#status-change-rights"),this.lblChangeRights.on("click",_.bind(this.onUsersClick,this)),this.$el.find("#status-users-menu").on("click",function(){return!1}),this.tabBarBox=$("#status-sheets-bar-box",this.el),this.tabbar=(new Common.UI.TabBar({el:"#status-sheets-bar",placement:"bottom",draggable:!1})).render(),this.tabbar.on({"tab:invisible":_.bind(this.onTabInvisible,this),"tab:changed":_.bind(this.onSheetChanged,this),"tab:contextmenu":_.bind(this.onTabMenu,this),"tab:dblclick":_.bind(function(){e.editMode&&e.rangeSelectionMode!==Asc.c_oAscSelectionDialogType.Chart&&e.rangeSelectionMode!==Asc.c_oAscSelectionDialogType.FormatTable&&e.fireEvent("sheet:changename")},this),"tab:move":_.bind(function(t,n){e.tabBarScroll={scrollLeft:e.tabbar.scrollX};if(_.isUndefined(n)||t===n)return;t<n&&++n,e.fireEvent("sheet:move",[!1,!0,t,n])},this)});var t=(new Common.UI.Menu({maxHeight:260,menuAlign:"tl-tr"})).on("render:after",function(e){this.scroller=new Common.UI.Scroller({el:$(this.el).find(".dropdown-menu "),useKeyboard:this.enableKeyEvents&&!this.handleSelect,minScrollbarLength:40,alwaysVisibleY:!0})}).on("show:after",function(){this.scroller.update({alwaysVisibleY:!0})});t.on("item:click",function(t,n,r){e.fireEvent("show:hidden",[e,n.value])});var n=new Common.UI.Menu({menuAlign:"tl-tr",cls:"color-tab",items:[{template:_.template('<div id="id-tab-menu-color" style="width: 169px; height: 220px; margin: 10px;"></div>')},{template:_.template('<a id="id-tab-menu-new-color" style="padding-left:12px;">'+e.textNewColor+"</a>")}]});return e.mnuTabColor=r(),this.tabMenu=(new Common.UI.Menu({menuAlign:"bl-tl",items:[{caption:this.itemInsert,value:"ins"},{caption:this.itemDelete,value:"del"},{caption:this.itemRename,value:"ren"},{caption:this.itemCopy,value:"copy"},{caption:this.itemMove,value:"move"},{caption:this.itemHide,value:"hide"},{caption:this.itemHidden,menu:t},{caption:this.itemTabColor,menu:n}]})).on("render:after",function(t){var n=$('<div class="btn-color-value-line"></div>');$("button:first-child",t.cmpEl).append(n),n.css("background-color",t.currentColor||"transparent"),e.mnuTabColor=new Common.UI.ThemeColorPalette({el:$("#id-tab-menu-color"),transparent:!0}),e.mnuTabColor.on("select",function(t,n){e.fireEvent("sheet:setcolor",[n])})}),this.tabbar.$el.append('<div class="dropdown-toggle" data-toggle="dropdown" style="width:0; height:0;"/>'),this.tabMenu.render(this.tabbar.$el),this.tabMenu.cmpEl.attr({tabindex:-1}),this.tabMenu.on("show:after",_.bind(this.onTabMenuAfterShow,this)),this.tabMenu.on("hide:after",_.bind(this.onTabMenuAfterHide,this)),this.tabMenu.on("item:click",_.bind(this.onTabMenuClick,this)),this.boxMath=$("#status-math-box",this.el),this.labelSum=$("#status-math-sum",this.boxMath),this.labelCount=$("#status-math-count",this.boxMath),this.labelAverage=$("#status-math-average",this.boxMath),this.boxMath.hide(),this.boxFiltered=$("#status-filtered-box",this.el),this.labelFiltered=$("#status-filtered-records",this.boxFiltered),this.boxFiltered.hide(),this.boxZoom=$("#status-zoom-box",this.el),this.boxZoom.find(".separator").css("border-left-color","transparent"),this},setApi:function(e){return this.api=e,this.api.asc_registerCallback("asc_onSheetsChanged",_.bind(this.update,this)),this.api.asc_registerCallback("asc_onAuthParticipantsChanged",_.bind(this.onApiUsersChanged,this)),this.api.asc_registerCallback("asc_onParticipantsChanged",_.bind(this.onApiUsersChanged,this)),this.api.asc_coAuthoringGetUsers(),this},setMode:function(e){this.mode=_.extend({},this.mode,e),this.btnAddWorksheet.setVisible(this.mode.isEdit),this.btnAddWorksheet.setDisabled(this.mode.isDisconnected),this.lblChangeRights[!this.mode.isOffline&&this.mode.sharingSettingsUrl&&this.mode.sharingSettingsUrl.length?"show":"hide"](),this.panelUsers[!this.mode.isOffline&&this.mode.sharingSettingsUrl&&this.mode.sharingSettingsUrl.length?"show":"hide"](),this.updateTabbarBorders()},setVisible:function(e){e?this.show():this.hide()},update:function(){var e=this;this.tabbar.empty(!0),this.tabMenu.items[6].menu.removeAll(),this.tabMenu.items[6].hide(),this.btnAddWorksheet.setDisabled(!0);if(this.api){var t=this.api.asc_getWorksheetsCount(),n=-1,r=[],i=[],s,o,u=this.api.asc_getActiveWorksheetIndex();while(++n<t)o=e.api.asc_isWorksheetLockedOrDeleted(n),s={sheetindex:n,active:u==n,label:e.api.asc_getWorksheetName(n),cls:o?"coauth-locked":"",isLockTheDrag:o},this.api.asc_isWorksheetHidden(n)?r.push(s):i.push(s);r.length&&(r.forEach(function(t){e.tabMenu.items[6].menu.addItem(new Common.UI.MenuItem({style:"white-space: pre-wrap",caption:Common.Utils.String.htmlEncode(t.label),value:t.sheetindex}))}),this.tabMenu.items[6].show()),this.tabbar.add(i),_.isUndefined(this.tabBarScroll)||(this.tabbar.$bar.scrollLeft(this.tabBarScroll.scrollLeft),this.tabBarScroll=undefined),this.tabbar.isTabVisible(u)||this.tabbar.setTabVisible(u),this.btnAddWorksheet.setDisabled(e.mode.isDisconnected||e.api.asc_isWorkbookLocked()),$("#status-label-zoom").text(Common.Utils.String.format(this.zoomText,Math.floor((this.api.asc_getZoom()+.005)*100))),e.fireEvent("sheet:changed",[e,u]),e.fireEvent("sheet:updateColors",[!0]),Common.NotificationCenter.trigger("comments:updatefilter",{property:"uid",value:new RegExp("^(doc_|sheet"+e.api.asc_getActiveWorksheetId()+"_)")},!1)}},setMathInfo:function(e){e.count>1?(this.boxMath.is(":visible")||this.boxMath.show(),this.labelCount.text(this.textCount+": "+e.count),this.labelSum.text(e.sum&&e.sum.length?this.textSum+": "+e.sum:""),this.labelAverage.text(e.average&&e.average.length?this.textAverage+": "+e.average:"")):this.boxMath.is(":visible")&&this.boxMath.hide();var t=this;_.delay(function(){t.onTabInvisible(undefined,t.tabbar.checkInvisible(!0))},30)},setFilteredInfo:function(e,t){if(e>0&&t>0)this.boxFiltered.is(":visible")||this.boxFiltered.show(),this.labelFiltered.text(Common.Utils.String.format(this.filteredRecordsText,e,t));else if(e)this.boxFiltered.is(":visible")||this.boxFiltered.show(),this.labelFiltered.text(this.filteredText);else if(e!==undefined&&e!==null)this.boxFiltered.is(":visible")&&this.boxFiltered.hide();else{var n=this.api.asc_getCellInfo().asc_getAutoFilterInfo(),r=!n||n.asc_getIsApplyAutoFilter()!==!0;this.setFilteredInfo(!r)}var i=this;_.delay(function(){i.onTabInvisible(undefined,i.tabbar.checkInvisible(!0))},30)},onUsersClick:function(){this.panelUsers.removeClass("open"),this.fireEvent("click:users",this)},onApiUsersChanged:function(e){var t=0;_.each(e,function(e){e.asc_getView()||t++}),this.panelUsers[t>1||this.mode.sharingSettingsUrl&&this.mode.sharingSettingsUrl.length?"show":"hide"](),this.updateTabbarBorders(),this.lblUserCount.css({"font-size":t>1?"11px":"14px","font-weight":t>1?"bold":"normal","margin-top":t>1?"0":"-1px"}),this.lblUserCount.text(t>1?t:"+"),$("#status-users-icon").css("margin-bottom",t>1?"0":"1px");var n=this.panelUsersBlock.data("bs.tooltip");n&&(n.options.title=t>1?this.tipViewUsers:this.tipAccessRights,n.setContent()),t>1?this.panelUsersBlock.attr("data-toggle","dropdown"):this.panelUsersBlock.removeAttr("data-toggle"),this.panelUsersBlock.toggleClass("dropdown-toggle",t>1),t>1?this.panelUsersBlock.off("click"):this.panelUsersBlock.on("click",_.bind(this.onUsersClick,this))},_onAddUser:function(e,t,n){this.panelUsersList&&(this.panelUsersList.find("ul").append(_.template(this.tplUser,{user:e,scope:this})),this.panelUsersList.scroller.update({minScrollbarLength:40,alwaysVisibleY:!0}))},_onUsersChanged:function(e){e.changed.online!=undefined&&this.panelUsersList&&(this.panelUsersList.find("#status-chat-user-"+e.get("id"))[e.changed.online?"removeClass":"addClass"]("offline"),this.panelUsersList.scroller.update({minScrollbarLength:40,alwaysVisibleY:!0}))},_onResetUsers:function(e,t){this.panelUsersList&&(this.panelUsersList.html(this.templateUserList({users:e.models,usertpl:this.tplUser,scope:this})),this.panelUsersList.scroller=new Common.UI.Scroller({el:$("#status-users-list ul"),useKeyboard:!0,minScrollbarLength:40,alwaysVisibleY:!0}))},getUserName:function(e){return Common.Utils.String.htmlEncode(e)},onSheetChanged:function(e,t,n){this.api.asc_showWorksheet(n.sheetindex),this.hasTabInvisible&&!this.tabbar.isTabVisible(t)&&this.tabbar.setTabVisible(t),this.fireEvent("sheet:changed",[this,n.sheetindex]),this.fireEvent("sheet:updateColors",[!0]),Common.NotificationCenter.trigger("comments:updatefilter",{property:"uid",value:new RegExp("^(doc_|sheet"+this.api.asc_getActiveWorksheetId()+"_)")},!1)},onTabMenu:function(e,t,n){if(this.mode.isEdit&&!this.isEditFormula&&this.rangeSelectionMode!==Asc.c_oAscSelectionDialogType.Chart&&this.rangeSelectionMode!==Asc.c_oAscSelectionDialogType.FormatTable&&!this.mode.isDisconnected&&n&&n.sheetindex>=0){var r=n.$el.get(0).getBoundingClientRect(),i=n.$el.offset(),s=n.$el.parent().offset();n.isActive()||this.tabbar.setActive(n);var o=this.api.asc_isWorksheetLockedOrDeleted(n.sheetindex),u=this.api.asc_isWorkbookLocked();this.tabMenu.items[0].setDisabled(u),this.tabMenu.items[1].setDisabled(o),this.tabMenu.items[2].setDisabled(o),this.tabMenu.items[3].setDisabled(o),this.tabMenu.items[4].setDisabled(o),this.tabMenu.items[5].setDisabled(o),this.tabMenu.items[6].setDisabled(u),this.tabMenu.items[7].setDisabled(o),this.api.asc_closeCellEditor(),this.api.asc_enableKeyEvents(!1),this.tabMenu.atposition=function(){return{top:r.top,left:r.left-s.left-2}}(),this.tabMenu.hide(),this.tabMenu.show();var a=this.tabMenu;_.defer(function(){a.cmpEl.focus()},10)}},onTabMenuAfterShow:function(e){e.atposition&&e.setOffset(e.atposition.left),this.enableKeyEvents=!0},onTabMenuAfterHide:function(){_.isUndefined(this.enableKeyEvents)||(this.api&&this.api.asc_enableKeyEvents(this.enableKeyEvents),this.enableKeyEvents=undefined)},onTabMenuClick:function(e,t){t&&this.api&&(this.enableKeyEvents=t.value==="ins"||t.value==="hide")},onTabInvisible:function(e,t){this.btnScrollFirst.isDisabled()!==!t.first&&(this.btnScrollFirst.setDisabled(!t.first),this.btnScrollBack.setDisabled(!t.first)),this.btnScrollNext.isDisabled()!==!t.last&&(this.btnScrollNext.setDisabled(!t.last),this.btnScrollLast.setDisabled(!t.last)),this.hasTabInvisible=t.first||t.last},onBtnTabScroll:function(e,t){this.tabbar.setTabVisible(e)},updateTabbarBorders:function(){var e=parseInt(this.boxZoom.css("width")),t=!1;this.boxMath.is(":visible")&&(e+=parseInt(this.boxMath.css("width")),t=!0),this.boxFiltered.is(":visible")&&(e+=parseInt(this.boxFiltered.css("width")),t=!0),this.panelUsers.is(":visible")&&(e+=parseInt(this.panelUsers.css("width")),t=!0),this.boxZoom.find(".separator").css("border-left-color",t?"":"transparent"),this.tabBarBox.css("right",e+"px")},changeViewMode:function(e){e?this.tabBarBox.css("left","152px"):this.tabBarBox.css("left",""),this.tabbar.options.draggable=e,this.editMode=e},tipZoomIn:"Zoom In",tipZoomOut:"Zoom Out",tipZoomFactor:"Magnification",tipFirst:"First Sheet",tipLast:"Last Sheet",tipPrev:"Previous Sheet",tipNext:"Next Sheet",tipAddTab:"Add Worksheet",itemInsert:"Insert",itemDelete:"Delete",itemRename:"Rename",itemCopy:"Copy",itemMove:"Move",itemHide:"Hide",itemHidden:"Hidden",itemTabColor:"Tab Color",textNoColor:"No Color",textNewColor:"Add New Custom Color",zoomText:"Zoom {0}%",textSum:"SUM",textCount:"COUNT",textAverage:"AVERAGE",tipUsers:"Document is currently being edited by several users.",tipAccessRights:"Manage document access rights",tipViewUsers:"View users and manage document access rights",txAccessRights:"Change access rights",filteredRecordsText:"{0} of {1} records filtered",filteredText:"Filter mode"},SSE.Views.Statusbar||{})),SSE.Views.Statusbar.RenameDialog=Common.UI.Window.extend(_.extend({options:{header:!1,width:280,cls:"modal-dlg"},template:'<div class="box"><div class="input-row"><label><%= label %></label></div><div class="input-row" id="txt-sheet-name" /></div><div class="footer right"><button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px;"><%= btns.ok %></button><button class="btn normal dlg-btn" result="cancel"><%= btns.cancel %></button></div>',initialize:function(e){_.extend(this.options,e||{},{label:this.labelSheetName,btns:{ok:this.okButtonText,cancel:this.cancelButtonText}}),this.options.tpl=_.template(this.template,this.options),Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this);var e=this.getChild();e.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this)),this.txtName=new Common.UI.InputField({el:e.find("#txt-sheet-name"),style:"width:100%;",value:this.options.current,allowBlank:!1,maxLength:31,validation:_.bind(this.nameValidator,this)}),this.txtName&&this.txtName.$el.on("keypress","input[type=text]",_.bind(this.onNameKeyPress,this))},show:function(e,t){Common.UI.Window.prototype.show.apply(this,arguments);var n=this.txtName.$el.find("input");_.delay(function(e){n.focus(),n.select()},100,this)},onBtnClick:function(e){this.doClose(e.currentTarget.attributes.result.value)},doClose:function(e){if(e=="ok"&&this.txtName.checkValidate()!==!0){_.delay(function(e){e.txtName.focus()},100,this);return}this.options.handler&&this.options.handler.call(this,e,this.txtName.getValue()),this.close()},onNameKeyPress:function(e){e.keyCode==Common.UI.Keys.RETURN&&this.doClose("ok")},nameValidator:function(e){var t=this.options.names;if(!t&&this.options.api){var n=this.options.api,r=n.asc_getActiveWorksheetIndex(),i=n.asc_getWorksheetsCount();t=[];while(i--)r!==i&&t.push(n.asc_getWorksheetName(i).toLowerCase())}if(t){var s=e.toLowerCase();for(var o=t.length-1;o>=0;--o)if(t[o]===s)return this.errNameExists}return e.length>2&&e[0]=='"'&&e[e.length-1]=='"'?!0:/[:\\\/\*\?\[\]\']/.test(e)?this.errNameWrongChar:!0},errNameExists:"Worksheet with such name already exist.",errNameWrongChar:"A sheet name cannot contains characters: \\, /, *, ?, [, ], :",labelSheetName:"Sheet Name"},t||{})),SSE.Views.Statusbar.CopyDialog=Common.UI.Window.extend(_.extend({options:{width:270,height:300,cls:"modal-dlg"},template:'<div class="box"><div class="input-row"><label><%= label %></label></div><div id="status-list-names" style="height: 170px;"/></div><div class="footer center"><button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px;"><%= btns.ok %></button><button class="btn normal dlg-btn" result="cancel"><%= btns.cancel %></button></div>',initialize:function(e){_.extend(this.options,e||{},{label:e.ismove?this.textMoveBefore:this.textCopyBefore,btns:{ok:this.okButtonText,cancel:this.cancelButtonText}}),this.options.tpl=_.template(this.template,this.options),Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this);var e=this.getChild();e.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this));var t=[];this.options.names.forEach(function(e){t.push(new Common.UI.DataViewModel(e))},this),t.length&&t.push(new Common.UI.DataViewModel({value:this.options.ismove?this.itemMoveToEnd:this.itemCopyToEnd,inindex:-255})),this.listNames=new Common.UI.ListView({el:$("#status-list-names",e),store:new Common.UI.DataViewStore(t),itemTemplate:_.template('<div id="<%= id %>" class="list-item" style="pointer-events:none;"><%= Common.Utils.String.htmlEncode(value) %></div>')}),this.listNames.selectByIndex(0),this.listNames.on("entervalue",_.bind(this.onPrimary,this)),this.listNames.on("item:dblclick",_.bind(this.onPrimary,this)),this.mask=$(".modals-mask"),this.mask.on("mousedown",_.bind(this.onUpdateFocus,this))},show:function(e,t){Common.UI.Window.prototype.show.apply(this,arguments),_.delay(function(e){e.listNames.$el.find(".listview").focus()},100,this)},hide:function(){Common.UI.Window.prototype.hide.apply(this,arguments),this.mask.off("mousedown",_.bind(this.onUpdateFocus,this))},onBtnClick:function(e){var t=this.listNames.getSelectedRec();this.options.handler&&this.options.handler.call(this,e.currentTarget.attributes.result.value,t[0].get("inindex")),this.close()},onPrimary:function(){this.options.handler&&this.options.handler.call(this,"ok",this.listNames.getSelectedRec()[0].get("inindex")),this.close()},onUpdateFocus:function(){_.delay(function(e){e.listNames.$el.find(".listview").focus()},100,this)},itemCopyToEnd:"(Copy to end)",itemMoveToEnd:"(Move to end)",textCopyBefore:"Copy before sheet",textMoveBefore:"Move before sheet"},n||{}))}),define("spreadsheeteditor/main/app/controller/Statusbar",["core","spreadsheeteditor/main/app/view/Statusbar"],function(){"use strict";SSE.Controllers.Statusbar=Backbone.Controller.extend(_.extend({models:[],collections:[],views:["Statusbar"],initialize:function(){this.addListeners({Statusbar:{"show:hidden":_.bind(function(e,t){this.hideWorksheet(!1,t)},this),"sheet:changename":_.bind(function(){this.api.asc_closeCellEditor(),this.renameWorksheet()},this),"sheet:setcolor":_.bind(this.setWorksheetColor,this),"sheet:updateColors":_.bind(this.updateTabsColors,this),"sheet:move":_.bind(this.moveWorksheet,this)}})},events:function(){return{"click #status-btn-zoomdown":_.bind(this.zoomDocument,this,"down"),"click #status-btn-zoomup":_.bind(this.zoomDocument,this,"up"),"click .cnt-zoom":_.bind(this.onZoomShow,this)}},onLaunch:function(){this.statusbar=this.createView("Statusbar",{storeUsers:this.getApplication().getCollection("Common.Collections.Users")}).render(),this.statusbar.$el.css("z-index",10),this.statusbar.labelZoom.css("min-width",70),this.statusbar.zoomMenu.on("item:click",_.bind(this.menuZoomClick,this)),this.bindViewEvents(this.statusbar,this.events),$("#id-tab-menu-new-color",this.statusbar.$el).on("click",_.bind(this.onNewBorderColor,this))},setApi:function(e){this.api=e,this.api.asc_registerCallback("asc_onZoomChanged",_.bind(this.onZoomChange,this)),this.api.asc_registerCallback("asc_onSelectionMathChanged",_.bind(this.onApiMathChanged,this)),this.api.asc_registerCallback("asc_onCoAuthoringDisconnect",_.bind(this.onApiDisconnect,this)),Common.NotificationCenter.on("api:disconnect",_.bind(this.onApiDisconnect,this)),this.api.asc_registerCallback("asc_onUpdateTabColor",_.bind(this.onApiUpdateTabColor,this)),this.api.asc_registerCallback("asc_onEditCell",_.bind(this.onApiEditCell,this)),this.api.asc_registerCallback("asc_onWorkbookLocked",_.bind(this.onWorkbookLocked,this)),this.api.asc_registerCallback("asc_onWorksheetLocked",_.bind(this.onWorksheetLocked,this)),this.api.asc_registerCallback("asc_onError",_.bind(this.onError,this)),this.api.asc_registerCallback("asc_onFilterInfo",_.bind(this.onApiFilterInfo,this)),this.statusbar.setApi(e)},zoomDocument:function(e,t){switch(e){case"up":var n=Math.floor(this.api.asc_getZoom()*10)/10;n+=.1,!(n>2)&&this.api.asc_setZoom(n);break;case"down":n=Math.ceil(this.api.asc_getZoom()*10)/10,n-=.1,!(n<.5)&&this.api.asc_setZoom(n)}Common.NotificationCenter.trigger("edit:complete",this.statusbar)},menuZoomClick:function(e,t){this.api.asc_setZoom(t.value/100),Common.NotificationCenter.trigger("edit:complete",this.statusbar)},onZoomChange:function(e,t){this.statusbar.labelZoom.text(Common.Utils.String.format(this.zoomText,Math.floor((e+.005)*100)))},onApiDisconnect:function(){this.statusbar.setMode({isDisconnected:!0}),this.statusbar.update()},onWorkbookLocked:function(e){this.statusbar.tabbar[e?"addClass":"removeClass"]("coauth-locked"),this.statusbar.btnAddWorksheet.setDisabled(e||this.statusbar.rangeSelectionMode==Asc.c_oAscSelectionDialogType.Chart||this.statusbar.rangeSelectionMode==Asc.c_oAscSelectionDialogType.FormatTable);var t,n=this.statusbar.tabbar.getCount();while(n-->0)t=this.statusbar.tabbar.getAt(n),t.sheetindex>=0||t.disable(e)},onWorksheetLocked:function(e,t){var n=this.statusbar.tabbar.getCount(),r;for(var i=n;i-->0;){r=this.statusbar.tabbar.getAt(i);if(e==r.sheetindex){r[t?"addClass":"removeClass"]("coauth-locked"),r.isLockTheDrag=t||this.statusbar.rangeSelectionMode==Asc.c_oAscSelectionDialogType.FormatTable;break}}},onApiMathChanged:function(e){this.statusbar.setMathInfo({count:e.asc_getCount(),average:e.asc_getAverage(),sum:e.asc_getSum()}),this.statusbar.updateTabbarBorders()},onApiFilterInfo:function(e,t){this.statusbar.setFilteredInfo(e,t),this.statusbar.updateTabbarBorders()},onApiEditCell:function(e){var t=e==Asc.c_oAscCellEditorState.editFormula,n=e!=Asc.c_oAscCellEditorState.editEnd,r=$(".statusbar-mask"),i=this.statusbar;i.isEditFormula=t,i.btnZoomUp.setDisabled(n),i.btnZoomDown.setDisabled(n),i.labelZoom[n?"addClass":"removeClass"]("disabled");if(t&&r.length>0||!t&&r.length==0)return;i.$el.find(".statusbar").toggleClass("masked",t),t?r=$("<div class='statusbar-mask'>").appendTo(i.$el):r.remove()},createDelayedElements:function(){this.statusbar.$el.css("z-index",""),this.statusbar.tabMenu.on("item:click",_.bind(this.onTabMenu,this)),this.statusbar.btnAddWorksheet.on("click",_.bind(this.onAddWorksheetClick,this)),Common.NotificationCenter.on("window:resize",_.bind(this.onWindowResize,this)),Common.NotificationCenter.on("cells:range",_.bind(this.onRangeDialogMode,this))},onWindowResize:function(e){this.statusbar.onTabInvisible(undefined,this.statusbar.tabbar.checkInvisible(!0))},onRangeDialogMode:function(e){var t=this.statusbar.tabbar.hasClass("coauth-locked"),n=this.api.asc_getActiveWorksheetIndex();this.statusbar.btnAddWorksheet.setDisabled(t||e!=Asc.c_oAscSelectionDialogType.None);var r,i=this.statusbar.tabbar.getCount();while(i-->0)r=this.statusbar.tabbar.getAt(i),r.sheetindex!==n&&r.disable(e==Asc.c_oAscSelectionDialogType.FormatTable),r.isLockTheDrag=r.hasClass("coauth-locked")||e!=Asc.c_oAscSelectionDialogType.None;this.statusbar.rangeSelectionMode=e},onTabMenu:function(e,t,n){switch(t.value){case"ins":this.api.asc_insertWorksheet(this.createSheetName());break;case"del":this.deleteWorksheet();break;case"ren":this.renameWorksheet();break;case"copy":this.moveWorksheet(!1);break;case"move":this.moveWorksheet(!0);break;case"hide":this.hideWorksheet(!0)}},createSheetName:function(){var e=[],t=this.api.asc_getWorksheetsCount();while(t--)e.push(this.api.asc_getWorksheetName(t).toLowerCase());var n=0,r;while(++n<1e3){r=this.strSheet+n;if(e.indexOf(r.toLowerCase())<0)break}return r},createCopyName:function(e){var t=this.api.asc_getWorksheetsCount(),n=[];while(t--)n.push(this.api.asc_getWorksheetName(t).toLowerCase());var r=/^(.*)\((\d)\)$/.exec(e),i=r?r[1]:e+" ",s=1,o;while(++s<1e3){o=i+"("+s+")";if(n.indexOf(o.toLowerCase())<0)break}return o},deleteWorksheet:function(){var e=this;this.statusbar.tabbar.tabs.length==1?Common.UI.warning({msg:this.errorLastSheet}):Common.UI.warning({msg:this.warnDeleteSheet,buttons:["ok","cancel"],callback:function(t){t=="ok"&&!e.api.asc_deleteWorksheet()&&_.delay(function(){Common.UI.error({msg:e.errorRemoveSheet})},10)}})},hideWorksheet:function(e,t){e?this.statusbar.tabbar.tabs.length==1?Common.UI.warning({msg:this.errorLastSheet}):this.api.asc_hideWorksheet(t):(this.api.asc_showWorksheet(t),this.loadTabColor(t))},renameWorksheet:function(){var e=this,t=e.api.asc_getWorksheetsCount(),n=null;if(t>0){var r=e.api.asc_getActiveWorksheetIndex();if(e.api.asc_isWorksheetLockedOrDeleted(r))return;var i=Common.localStorage.getItem("sse-settings-coauthmode");if(i!==null&&parseInt(i)==0){n=[];while(t--)r!==t&&n.push(e.api.asc_getWorksheetName(t).toLowerCase())}var s=e.statusbar.tabbar.tabs[e.statusbar.tabbar.getActive()],o=e.statusbar.$el.position().top-115,u=s.$el.offset().left,a=e.api.asc_getWorksheetName(e.api.asc_getActiveWorksheetIndex()),f=new SSE.Views.Statusbar.RenameDialog({current:a,names:n,api:e.api,handler:function(t,n){t=="ok"&&n!=a&&e.api.asc_renameWorksheet(n),e.api.asc_enableKeyEvents(!0)}});if(typeof f.options.width=="number"){var l=$("body").width();u+f.options.width>l&&(u=l-f.options.width-5)}f.show(u,o)}},moveWorksheet:function(e,t,n,r){var i=this,s=i.api.asc_getWorksheetsCount(),o=[],u=-1;while(++u<s)this.api.asc_isWorksheetHidden(u)||o.push({value:i.api.asc_getWorksheetName(u),inindex:u});if(!_.isUndefined(t)){i.api.asc_showWorksheet(o[n].inindex),Common.NotificationCenter.trigger("comments:updatefilter",{property:"uid",value:new RegExp("^(doc_|sheet"+this.api.asc_getActiveWorksheetId()+"_)")}),_.isUndefined(r)||i.api.asc_moveWorksheet(o.length===r?s:o[r].inindex);return}(new SSE.Views.Statusbar.CopyDialog({title:e?i.statusbar.itemMove:i.statusbar.itemCopy,ismove:e,names:o,handler:function(t,n){if(t=="ok")if(e)i.api.asc_moveWorksheet(n==-255?s:n);else{var r=i.createCopyName(i.api.asc_getWorksheetName(i.api.asc_getActiveWorksheetIndex()));i.api.asc_copyWorksheet(n==-255?s:n,r)}i.api.asc_enableKeyEvents(!0)}})).show()},onAddWorksheetClick:function(e,t,n){this.api&&(this.api.asc_closeCellEditor(),this.api.asc_addWorksheet(this.createSheetName()),Common.NotificationCenter.trigger("comments:updatefilter",{property:"uid",value:new RegExp("^(doc_|sheet"+this.api.asc_getActiveWorksheetId()+"_)")},!1)),Common.NotificationCenter.trigger("edit:complete",this.statusbar)},selectTab:function(e){if(this.api){var t=this.api.asc_isWorksheetHidden(e);if(!t){var n=_.findWhere(this.statusbar.tabbar.tabs,{sheetindex:e});n&&this.statusbar.tabbar.setActive(n)}}},moveCurrentTab:function(e){if(this.api){var t=0,n=this.statusbar.tabbar,r=this.api.asc_getActiveWorksheetIndex(),i=n.tabs.length;this.statusbar.tabMenu.hide(),this.api.asc_closeCellEditor();for(var s=0;s<i;++s)if(n.tabs[s].sheetindex===r){t=s,e>0?(t++,t>=i&&(t=0)):(t--,t<0&&(t=i-1)),n.setActive(t),this.api.asc_showWorksheet(n.getAt(t).sheetindex);break}}},onApiUpdateTabColor:function(e){this.loadTabColor(e)},setWorksheetColor:function(e){if(this.api){var t=this.api.asc_getActiveWorksheetIndex(),n=_.findWhere(this.statusbar.tabbar.tabs,{sheetindex:t});if(n)if("transparent"===e)this.api.asc_setWorksheetTabColor(t,null),n.$el.find("a").css("box-shadow","");else{var r=Common.Utils.ThemeColor.getRgbColor(e);r&&(this.api.asc_setWorksheetTabColor(t,r),this.setTabLineColor(n,r))}}},updateThemeColors:function(){var e=function(e,t){if(e){var n,r=Common.Utils.ThemeColor.getEffectColors();for(var i=0;i<r.length;++i)typeof e.currentColor=="object"&&n===undefined&&e.currentColor.effectId==r[i].effectId&&(n=r[i]);e.updateColors(r,Common.Utils.ThemeColor.getStandartColors()),e.currentColor===undefined?e.currentColor=r[t]:n!==undefined&&(e.currentColor=n)}};this.statusbar&&e(this.statusbar.mnuTabColor,1)},onNewBorderColor:function(){this.statusbar&&this.statusbar.mnuTabColor&&this.statusbar.mnuTabColor.addNewColor()},updateTabsColors:function(e){var t=-1,n=-1,r=null,i=null,s=!1,o=this.api.asc_getWorksheetsCount(),u=this.api.asc_getActiveWorksheetIndex();if(!_.isUndefined(e)){var a=this.application.getController("Toolbar");if(a){this.statusbar.mnuTabColor.updateCustomColors(),r=this.api.asc_getWorksheetTabColor(u),r&&(r.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?i={color:Common.Utils.ThemeColor.getHexColor(r.get_r(),r.get_g(),r.get_b()),effectValue:r.get_value()}:i=Common.Utils.ThemeColor.getHexColor(r.get_r(),r.get_g(),r.get_b()));if(_.isObject(i)){var f=!1;for(t=0;t<10;t++)if(Common.Utils.ThemeColor.ThemeValues[t]===i.effectValue){this.statusbar.mnuTabColor.select(i,!0),f=!0;break}f||this.statusbar.mnuTabColor.clearSelection()}else this.statusbar.mnuTabColor.select(i||"transparent",!0)}}t=-1;while(++t<o)++n,s=this.api.asc_isWorksheetHidden(t),s&&--n,s||this.setTabLineColor(this.statusbar.tabbar.getAt(n),this.api.asc_getWorksheetTabColor(t))},loadTabColor:function(e){if(this.api&&!this.api.asc_isWorksheetHidden(e)){var t=_.findWhere(this.statusbar.tabbar.tabs,{sheetindex:e});t&&this.setTabLineColor(t,this.api.asc_getWorksheetTabColor(e))}},setTabLineColor:function(e,t){e&&(null!==t?t="#"+Common.Utils.ThemeColor.getHexColor(t.get_r(),t.get_g(),t.get_b()):t="",t.length?(e.isActive()?t="0px 3px 0 "+t+" inset":t="0px 3px 0 "+Common.Utils.RGBColor(t).toRGBA(.7)+" inset",e.$el.find("a").css("box-shadow",t)):e.$el.find("a").css("box-shadow",""))},onZoomShow:function(e){if(e.target.classList.contains("disabled"))return!1},onError:function(e,t,n){e==Asc.c_oAscError.ID.LockedWorksheetRename&&this.statusbar.update()},zoomText:"Zoom {0}%",errorLastSheet:"Workbook must have at least one visible worksheet.",errorRemoveSheet:"Can't delete the worksheet.",warnDeleteSheet:"The worksheet maybe has data. Proceed operation?",strSheet:"Sheet"},SSE.Controllers.Statusbar||{}))}),define("text!spreadsheeteditor/main/app/template/RightMenu.template",[],function(){return'<div id="view-right-menu" class="tool-menu right">\n <div class="right-panel">\n <div id="id-table-settings" class="settings-panel">\n </div>\n <div id="id-shape-settings" class="settings-panel">\n </div>\n <div id="id-image-settings" class="settings-panel">\n </div>\n <div id="id-chart-settings" class="settings-panel">\n </div>\n <div id="id-paragraph-settings" class="settings-panel">\n </div>\n <div id="id-textart-settings" class="settings-panel">\n </div>\n </div>\n <div class="tool-menu-btns">\n <div class="ct-btn-category arrow-left" />\n <button id="id-right-menu-table" class="btn btn-category arrow-left" content-target="id-table-settings"><span class="btn-icon img-toolbarmenu btn-menu-table"> </span></button>\n <button id="id-right-menu-shape" class="btn btn-category arrow-left" content-target="id-shape-settings"><span class="btn-icon img-toolbarmenu btn-menu-shape"> </span></button>\n <button id="id-right-menu-image" class="btn btn-category arrow-left" content-target="id-image-settings"><span class="btn-icon img-toolbarmenu btn-menu-image"> </span></button>\n <button id="id-right-menu-chart" class="btn btn-category arrow-left" content-target="id-chart-settings"><span class="btn-icon img-toolbarmenu btn-menu-chart"> </span></button>\n <button id="id-right-menu-text" class="btn btn-category arrow-left" content-target="id-paragraph-settings"><span class="btn-icon img-toolbarmenu btn-menu-text"> </span></button>\n <button id="id-right-menu-textart" class="btn btn-category arrow-left" content-target="id-textart-settings"><span class="btn-icon img-toolbarmenu btn-menu-textart"> </span></button>\n </div>\n</div>'}),define("text!spreadsheeteditor/main/app/template/ParagraphSettings.template",[],function(){return'<table cols="2">\r\n <tr>\r\n <td colspan=2>\r\n <label class="header"><%= scope.strLineHeight %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small" width="50%">\r\n <div id="paragraph-combo-line-rule" style="width: 85px;"></div>\r\n </td>\r\n <td class="padding-small" width="50%">\r\n <div id="paragraph-spin-line-height"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td colspan=2>\r\n <label class="header"><%= scope.strParagraphSpacing %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small" width="50%">\r\n <label class="input-label"><%= scope.strSpacingBefore %></label>\r\n <div id="paragraph-spin-spacing-before"></div>\r\n </td>\r\n <td class="padding-small" width="50%">\r\n <label class="input-label"><%= scope.strSpacingAfter %></label>\r\n <div id="paragraph-spin-spacing-after"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small" colspan=2>\r\n <div class="separator horizontal"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td align="center" colspan=2>\r\n <label class="link" id="paragraph-advanced-link"><%= scope.textAdvanced %></label>\r\n </td>\r\n </tr>\r\n <tr class="finish-cell"></tr>\r\n</table>'});var c_paragraphLinerule={LINERULE_LEAST:0,LINERULE_AUTO:1,LINERULE_EXACT:2};define("spreadsheeteditor/main/app/view/ParagraphSettings",["text!spreadsheeteditor/main/app/template/ParagraphSettings.template","jquery","underscore","backbone","common/main/lib/component/ComboBox","common/main/lib/component/MetricSpinner","spreadsheeteditor/main/app/view/ParagraphSettingsAdvanced"],function(e,t,n,r){"use strict";SSE.Views.ParagraphSettings=r.View.extend(n.extend({el:"#id-paragraph-settings",template:n.template(e),events:{},options:{alias:"ParagraphSettings"},initialize:function(){this._initSettings=!0,this._state={LineRule:c_paragraphLinerule.LINERULE_AUTO,LineHeight:1.5,LineSpacingBefore:0,LineSpacingAfter:.35,DisabledControls:!1},this.spinners=[],this.lockedControls=[],this._locked=!1,this.render()},render:function(){var e=t(this.el);e.html(this.template({scope:this})),this.linkAdvanced=t("#paragraph-advanced-link")},setApi:function(e){return this.api=e,this.api&&this.api.asc_registerCallback("asc_onParaSpacingLine",n.bind(this._onLineSpacing,this)),this},onNumLineHeightChange:function(e,t,n,r){if(this.cmbLineRule.getRawValue()==="")return;this.api&&this.api.asc_putPrLineSpacing(this.cmbLineRule.getValue(),this.cmbLineRule.getValue()==c_paragraphLinerule.LINERULE_AUTO?e.getNumberValue():Common.Utils.Metric.fnRecalcToMM(e.getNumberValue())),Common.NotificationCenter.trigger("edit:complete",this)},onNumSpacingBeforeChange:function(e,t,n,r){if(this.api){var i=e.getNumberValue();i<0?this.api.asc_putLineSpacingBeforeAfter(0,-1):this.api.asc_putLineSpacingBeforeAfter(0,Common.Utils.Metric.fnRecalcToMM(e.getNumberValue()))}Common.NotificationCenter.trigger("edit:complete",this)},onNumSpacingAfterChange:function(e,t,n,r){if(this.api){var i=e.getNumberValue();i<0?this.api.asc_putLineSpacingBeforeAfter(1,-1):this.api.asc_putLineSpacingBeforeAfter(1,Common.Utils.Metric.fnRecalcToMM(e.getNumberValue()))}Common.NotificationCenter.trigger("edit:complete",this)},onLineRuleSelect:function(e,t){this.api&&this.api.asc_putPrLineSpacing(t.value,t.defaultValue),this.numLineHeight.setDefaultUnit(t.defaultUnit),this.numLineHeight.setMinValue(t.minValue),this.numLineHeight.setStep(t.step),Common.NotificationCenter.trigger("edit:complete",this)},_onLineSpacing:function(e){if(this._initSettings)return;var t=e.asc_getLineRule(),n=e.asc_getLine();if(this._state.LineRule!==t){var r,i=this.cmbLineRule.store.findWhere((r={},r.value=t,r));i||(i=this.cmbLineRule.store.at(0)),this.cmbLineRule.setValue(t!==null?t:""),this.numLineHeight.setMinValue(i.get("minValue")),this.numLineHeight.setDefaultUnit(i.get("defaultUnit")),this.numLineHeight.setStep(i.get("step")),this._state.LineRule=t}if(Math.abs(this._state.LineHeight-n)>.001||(this._state.LineHeight===null||n===null)&&this._state.LineHeight!==n){var s="";t==c_paragraphLinerule.LINERULE_AUTO?s=n:t!==null&&n!==null&&(s=Common.Utils.Metric.fnRecalcFromMM(n)),this.numLineHeight.setValue(s!==null?s:"",!0),this._state.LineHeight=n}},ChangeSettings:function(e){this._initSettings&&this.createDelayedElements(),this.disableControls(this._locked);if(e){var t={Line:e.asc_getSpacing().asc_getLine(),Before:e.asc_getSpacing().asc_getBefore(),After:e.asc_getSpacing().asc_getAfter(),LineRule:e.asc_getSpacing().asc_getLineRule()};if(this._state.LineRule!==t.LineRule){var n,r=this.cmbLineRule.store.findWhere((n={},n.value=t.LineRule,n));r||(r=this.cmbLineRule.store.at(0)),this.cmbLineRule.setValue(t.LineRule!==null?t.LineRule:""),this.numLineHeight.setMinValue(r.get("minValue")),this.numLineHeight.setDefaultUnit(r.get("defaultUnit")),this.numLineHeight.setStep(r.get("step")),this._state.LineRule=t.LineRule}if(Math.abs(this._state.LineHeight-t.Line)>.001||(this._state.LineHeight===null||t.Line===null)&&this._state.LineHeight!==t.Line){var i="";t.LineRule==c_paragraphLinerule.LINERULE_AUTO?i=t.Line:t.LineRule!==null&&t.Line!==null&&(i=Common.Utils.Metric.fnRecalcFromMM(t.Line)),this.numLineHeight.setValue(i!==null?i:"",!0),this._state.LineHeight=t.Line}if(Math.abs(this._state.LineSpacingBefore-t.Before)>.001||(this._state.LineSpacingBefore===null||t.Before===null)&&this._state.LineSpacingBefore!==t.Before)this.numSpacingBefore.setValue(t.Before!==null?t.Before<0?t.Before:Common.Utils.Metric.fnRecalcFromMM(t.Before):"",!0),this._state.LineSpacingBefore=t.Before;if(Math.abs(this._state.LineSpacingAfter-t.After)>.001||(this._state.LineSpacingAfter===null||t.After===null)&&this._state.LineSpacingAfter!==t.After)this.numSpacingAfter.setValue(t.After!==null?t.After<0?t.After:Common.Utils.Metric.fnRecalcFromMM(t.After):"",!0),this._state.LineSpacingAfter=t.After}},updateMetricUnit:function(){if(this.spinners)for(var e=0;e<this.spinners.length;e++){var t=this.spinners[e];t.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName()),t.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt?1:.01)}if(this.cmbLineRule){var n=this.cmbLineRule.store.at(1);n.set({defaultUnit:Common.Utils.Metric.getCurrentMetricName(),minValue:parseFloat(Common.Utils.Metric.fnRecalcFromMM(.3).toFixed(2)),step:Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt?1:.01});if(this._state.LineRule!==null){var r;n=this.cmbLineRule.store.findWhere((r={},r.value=this._state.LineRule,r)),n||(n=this.cmbLineRule.store.at(0)),this.numLineHeight.setDefaultUnit(n.get("defaultUnit")),this.numLineHeight.setStep(n.get("step"))}}},createDelayedControls:function(){var e=this;this._arrLineRule=[{displayValue:this.textAuto,defaultValue:1,value:c_paragraphLinerule.LINERULE_AUTO,minValue:.5,step:.01,defaultUnit:""},{displayValue:this.textExact,defaultValue:5,value:c_paragraphLinerule.LINERULE_EXACT,minValue:.03,step:.01,defaultUnit:"cm"}],this.cmbLineRule=new Common.UI.ComboBox({el:t("#paragraph-combo-line-rule"),cls:"input-group-nr",menuStyle:"min-width: 85px;",editable:!1,data:this._arrLineRule}),this.cmbLineRule.setValue(c_paragraphLinerule.LINERULE_AUTO),this.lockedControls.push(this.cmbLineRule),this.numLineHeight=new Common.UI.MetricSpinner({el:t("#paragraph-spin-line-height"),step:.01,width:85,value:"1.5",defaultUnit:"",maxValue:132,minValue:.5}),this.lockedControls.push(this.numLineHeight),this.numSpacingBefore=new Common.UI.MetricSpinner({el:t("#paragraph-spin-spacing-before"),step:.1,width:85,value:"0 cm",defaultUnit:"cm",maxValue:55.88,minValue:0,allowAuto:!0,autoText:this.txtAutoText}),this.spinners.push(this.numSpacingBefore),this.lockedControls.push(this.numSpacingBefore),this.numSpacingAfter=new Common.UI.MetricSpinner({el:t("#paragraph-spin-spacing-after"),step:.1,width:85,value:"0.35 cm",defaultUnit:"cm",maxValue:55.88,minValue:0,allowAuto:!0,autoText:this.txtAutoText}),this.spinners.push(this.numSpacingAfter),this.lockedControls.push(this.numSpacingAfter),this.numLineHeight.on("change",n.bind(this.onNumLineHeightChange,this)),this.numSpacingBefore.on("change",n.bind(this.onNumSpacingBeforeChange,this)),this.numSpacingAfter.on("change",n.bind(this.onNumSpacingAfterChange,this)),this.cmbLineRule.on("selected",n.bind(this.onLineRuleSelect,this)),this.cmbLineRule.on("hide:after",n.bind(this.onHideMenus,this)),t(this.el).on("click","#paragraph-advanced-link",n.bind(this.openAdvancedSettings,this))},createDelayedElements:function(){this.createDelayedControls(),this.updateMetricUnit(),this._initSettings=!1},openAdvancedSettings:function(e){if(this.linkAdvanced.hasClass("disabled"))return;var t=this,n;if(t.api&&!this._locked){var r=t.api.asc_getGraphicObjectProps();if(r&&r.length>0){var i,s;for(var o=r.length-1;o>=0;o--){i=r[o].asc_getObjectType(),s=r[o].asc_getObjectValue();if(Asc.c_oAscTypeSelectElement.Paragraph==i){(new SSE.Views.ParagraphSettingsAdvanced({paragraphProps:s,api:t.api,handler:function(e,n){e=="ok"&&t.api&&(t.borderAdvancedProps=n.borderProps,t.api.asc_setGraphicObjectProps(n.paragraphProps)),Common.NotificationCenter.trigger("edit:complete",t)}})).show();break}}}}},onHideMenus:function(e,t,n){n||Common.NotificationCenter.trigger("edit:complete",this)},setLocked:function(e){this._locked=e},disableControls:function(e){if(this._initSettings)return;this._state.DisabledControls!==e&&(this._state.DisabledControls=e,n.each(this.lockedControls,function(t){t.setDisabled(e)}),this.linkAdvanced.toggleClass("disabled",e))},strParagraphSpacing:"Paragraph Spacing",strLineHeight:"Line Spacing",strSpacingBefore:"Before",strSpacingAfter:"After",textAuto:"Multiple",textAtLeast:"At least",textExact:"Exactly",textAdvanced:"Show advanced settings",textAt:"At",txtAutoText:"Auto"},SSE.Views.ParagraphSettings||{}))}),define("text!spreadsheeteditor/main/app/template/ImageSettings.template",[],function(){return'<table cols="3">\r\n <tr>\r\n <td colspan=3>\r\n <label class="header"><%= scope.textSize %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small" width="88px">\r\n <label class="input-label"><%= scope.textWidth %></label>\r\n <div id="image-spin-width"></div>\r\n </td>\r\n <td class="padding-small" width="28px" style="vertical-align: bottom;">\r\n <div id="image-button-ratio"></div>\r\n </td>\r\n <td class="padding-small" width="88px">\r\n <label class="input-label"><%= scope.textHeight %></label>\r\n <div id="image-spin-height"></div>\r\n </td>\r\n </tr>\r\n</table>\r\n<table cols="2">\r\n <tr>\r\n <td class="padding-small" colspan=2>\r\n <button type="button" class="btn btn-text-default" id="image-button-original-size" style="width:100px;"><%= scope.textOriginalSize %></button>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small" colspan=2>\r\n <div class="separator horizontal"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td colspan=2>\r\n <label class="header" id="image-lbl-replace"><%= scope.textInsert %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td width="50%">\r\n <button type="button" class="btn btn-text-default" id="image-button-from-file" style="width:85px;"><%= scope.textFromFile %></button>\r\n </td>\r\n <td width="50%">\r\n <button type="button" class="btn btn-text-default" id="image-button-from-url" style="width:85px;"><%= scope.textFromUrl %></button>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small" colspan=2>\r\n <button type="button" class="btn btn-text-default hidden" id="image-button-edit-object" style="width:100px;"><%= scope.textEdit %></button>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small" colspan=2>\r\n <div class="separator horizontal"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td align="center" colspan=2>\r\n <label class="link" id="image-advanced-link"><%= scope.textAdvanced %></label>\r\n </td>\r\n </tr>\r\n <tr class="finish-cell"></tr>\r\n</table>'}),define("spreadsheeteditor/main/app/view/ImageSettings",["text!spreadsheeteditor/main/app/template/ImageSettings.template","jquery","underscore","backbone","common/main/lib/component/Button","common/main/lib/component/MetricSpinner","common/main/lib/view/ImageFromUrlDialog","spreadsheeteditor/main/app/view/ImageSettingsAdvanced"],function(e,t,n,r){"use strict";SSE.Views.ImageSettings=r.View.extend(n.extend({el:"#id-image-settings",template:n.template(e),events:{},options:{alias:"ImageSettings"},initialize:function(){this._initSettings=!0,this._nRatio=1,this._state={Width:0,Height:0,DisabledControls:!1,keepRatio:!1,isOleObject:!1},this.spinners=[],this.lockedControls=[],this._locked=!1,this._noApply=!1,this._originalProps=null,this.render()},render:function(){var e=t(this.el);e.html(this.template({scope:this})),this.linkAdvanced=t("#image-advanced-link")},setApi:function(e){if(e==undefined)return;return this.api=e,this},updateMetricUnit:function(){if(this.spinners)for(var e=0;e<this.spinners.length;e++){var t=this.spinners[e];t.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName()),t.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt?1:.1)}},createDelayedControls:function(){var e=this;this.spnWidth=new Common.UI.MetricSpinner({el:t("#image-spin-width"),step:.1,width:78,defaultUnit:"cm",value:"3 cm",maxValue:55.88,minValue:0}),this.spinners.push(this.spnWidth),this.lockedControls.push(this.spnWidth),this.spnHeight=new Common.UI.MetricSpinner({el:t("#image-spin-height"),step:.1,width:78,defaultUnit:"cm",value:"3 cm",maxValue:55.88,minValue:0}),this.spinners.push(this.spnHeight),this.lockedControls.push(this.spnHeight),this.btnRatio=new Common.UI.Button({cls:"btn-toolbar",iconCls:"advanced-btn-ratio",style:"margin-bottom: 1px;",enableToggle:!0,hint:this.textKeepRatio}),this.btnRatio.render(t("#image-button-ratio")),this.lockedControls.push(this.btnRatio),this.btnRatio.on("click",n.bind(function(e,t){e.pressed&&this.spnHeight.getNumberValue()>0&&(this._nRatio=this.spnWidth.getNumberValue()/this.spnHeight.getNumberValue());if(this.api){var n=new Asc.asc_CImgProperty;n.asc_putLockAspect(e.pressed),this.api.asc_setGraphicObjectProps(n)}},this)),this.btnOriginalSize=new Common.UI.Button({el:t("#image-button-original-size")}),this.lockedControls.push(this.btnOriginalSize),this.btnInsertFromFile=new Common.UI.Button({el:t("#image-button-from-file")}),this.lockedControls.push(this.btnInsertFromFile),this.btnInsertFromUrl=new Common.UI.Button({el:t("#image-button-from-url")}),this.lockedControls.push(this.btnInsertFromUrl),this.btnEditObject=new Common.UI.Button({el:t("#image-button-edit-object")}),this.lockedControls.push(this.btnEditObject),this.spnWidth.on("change",n.bind(this.onWidthChange,this)),this.spnHeight.on("change",n.bind(this.onHeightChange,this)),this.btnOriginalSize.on("click",n.bind(this.setOriginalSize,this)),this.btnInsertFromFile.on("click",n.bind(function(e){this.api&&this.api.asc_changeImageFromFile(),Common.NotificationCenter.trigger("edit:complete",this)},this)),this.btnEditObject.on("click",n.bind(function(e){this.api&&this.api.asc_startEditCurrentOleObject(),Common.NotificationCenter.trigger("edit:complete",this)},this)),this.btnInsertFromUrl.on("click",n.bind(this.insertFromUrl,this)),this.lblReplace=t("#image-lbl-replace"),t(this.el).on("click","#image-advanced-link",n.bind(this.openAdvancedSettings,this))},createDelayedElements:function(){this.createDelayedControls(),this.updateMetricUnit(),this._initSettings=!1},openAdvancedSettings:function(e){if(this.linkAdvanced.hasClass("disabled"))return;var t=this,n;if(t.api&&!this._locked){var r=t.api.asc_getGraphicObjectProps();if(r&&r.length>0){var i,s;for(var o=r.length-1;o>=0;o--){i=r[o].asc_getObjectType(),s=r[o].asc_getObjectValue();if(Asc.c_oAscTypeSelectElement.Image==i){(new SSE.Views.ImageSettingsAdvanced({imageProps:s,api:t.api,handler:function(e,n){e=="ok"&&t.api&&t.api.asc_setGraphicObjectProps(n.imageProps),Common.NotificationCenter.trigger("edit:complete",t)}})).show();break}}}}},ChangeSettings:function(e){this._initSettings&&this.createDelayedElements(),this.disableControls(this._locked);if(e){this._originalProps=new Asc.asc_CImgProperty(e);var t=e.asc_getWidth();if(Math.abs(this._state.Width-t)>.001||(this._state.Width===null||t===null)&&this._state.Width!==t)this.spnWidth.setValue(t!==null?Common.Utils.Metric.fnRecalcFromMM(t):"",!0),this._state.Width=t;t=e.asc_getHeight();if(Math.abs(this._state.Height-t)>.001||(this._state.Height===null||t===null)&&this._state.Height!==t)this.spnHeight.setValue(t!==null?Common.Utils.Metric.fnRecalcFromMM(t):"",!0),this._state.Height=t;e.asc_getHeight()>0&&(this._nRatio=e.asc_getWidth()/e.asc_getHeight()),t=e.asc_getLockAspect(),this._state.keepRatio!==t&&(this.btnRatio.toggle(t),this._state.keepRatio=t),this.btnOriginalSize.setDisabled(e.asc_getImageUrl()===null||e.asc_getImageUrl()===undefined||this._locked);var n=e.asc_getPluginGuid();t=n!==null&&n!==undefined,this._state.isOleObject!==t&&(this.btnInsertFromUrl.setVisible(!t),this.btnInsertFromFile.setVisible(!t),this.btnEditObject.setVisible(t),this.lblReplace.text(t?this.textEditObject:this.textInsert),this._state.isOleObject=t);if(this._state.isOleObject){var r=SSE.getCollection("Common.Collections.Plugins").findWhere({guid:n});this.btnEditObject.setDisabled(r===null||r===undefined||this._locked)}else this.btnInsertFromUrl.setDisabled(n===null||this._locked),this.btnInsertFromFile.setDisabled(n===null||this._locked)}},onWidthChange:function(e,t,n,r){var i=e.getNumberValue(),s=this.spnHeight.getNumberValue();this.btnRatio.pressed&&(s=i/this._nRatio,s>this.spnHeight.options.maxValue&&(s=this.spnHeight.options.maxValue,i=s*this._nRatio,this.spnWidth.setValue(i,!0)),this.spnHeight.setValue(s,!0));if(this.api){var o=new Asc.asc_CImgProperty;o.asc_putWidth(Common.Utils.Metric.fnRecalcToMM(i)),o.asc_putHeight(Common.Utils.Metric.fnRecalcToMM(s)),this.api.asc_setGraphicObjectProps(o)}Common.NotificationCenter.trigger("edit:complete",this)},onHeightChange:function(e,t,n,r){var i=e.getNumberValue(),s=this.spnWidth.getNumberValue();this.btnRatio.pressed&&(s=i*this._nRatio,s>this.spnWidth.options.maxValue&&(s=this.spnWidth.options.maxValue,i=s/this._nRatio,this.spnHeight.setValue(i,!0)),this.spnWidth.setValue(s,!0));if(this.api){var o=new Asc.asc_CImgProperty;o.asc_putWidth(Common.Utils.Metric.fnRecalcToMM(s)),o.asc_putHeight(Common.Utils.Metric.fnRecalcToMM(i)),this.api.asc_setGraphicObjectProps(o)}Common.NotificationCenter.trigger("edit:complete",this)},setOriginalSize:function(){if(this.api){var e=this.api.asc_getOriginalImageSize(),t=e.asc_getImageWidth(),n=e.asc_getImageHeight(),r=new Asc.asc_CImgProperty;r.asc_putWidth(t),r.asc_putHeight(n),this.api.asc_setGraphicObjectProps(r),Common.NotificationCenter.trigger("edit:complete",this)}},insertFromUrl:function(){var e=this;(new Common.Views.ImageFromUrlDialog({handler:function(t,r){if(t=="ok"&&e.api){var i=r.replace(/ /g,"");if(!n.isEmpty(i)){var s=new Asc.asc_CImgProperty;s.asc_putImageUrl(i),e.api.asc_setGraphicObjectProps(s)}}Common.NotificationCenter.trigger("edit:complete",e)}})).show()},setLocked:function(e){this._locked=e},disableControls:function(e){if(this._initSettings)return;this._state.DisabledControls!==e&&(this._state.DisabledControls=e,n.each(this.lockedControls,function(t){t.setDisabled(e)}),this.linkAdvanced.toggleClass("disabled",e))},textKeepRatio:"Constant Proportions",textSize:"Size",textWidth:"Width",textHeight:"Height",textOriginalSize:"Default Size",textInsert:"Replace Image",textFromUrl:"From URL",textFromFile:"From File",textEditObject:"Edit Object",textEdit:"Edit",textAdvanced:"Show advanced settings"},SSE.Views.ImageSettings||{}))}),define("text!spreadsheeteditor/main/app/template/ChartSettings.template",[],function(){return'<table cols="3" id="chart-panel-size">\r\n <tr>\r\n <td colspan=3>\r\n <label class="header"><%= scope.textSize %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small" width="88px">\r\n <label class="input-label"><%= scope.textWidth %></label>\r\n <div id="chart-spin-width"></div>\r\n </td>\r\n <td class="padding-small" width="28px" style="vertical-align: bottom;">\r\n <div id="chart-button-ratio"></div>\r\n </td>\r\n <td class="padding-small" width="88px">\r\n <label class="input-label"><%= scope.textHeight %></label>\r\n <div id="chart-spin-height"></div>\r\n </td>\r\n </tr>\r\n</table>\r\n<table cols="1" id="chart-panel-types">\r\n <tr>\r\n <td class="padding-small">\r\n <div class="separator horizontal"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <label class="header"><%= scope.textType %></label>\r\n <div id="chart-button-type" style=""></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <label class="header" style=""><%= scope.textStyle %></label>\r\n <div class="" id="chart-combo-style" style="width: 100%;"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <div class="separator horizontal"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <label class="header"><%= scope.textRanges %></label>\r\n <button type="button" class="btn btn-text-default" id="chart-btn-select-data" style="min-width: 100px; width: auto; display: block;"><%= scope.textSelectData %></button>\r\n </td>\r\n </tr>\r\n</table>\r\n<table cols="1" id="spark-panel-types">\r\n <tr>\r\n <td>\r\n <label class="header"><%= scope.textType %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <div id="spark-button-type" style=""></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <div class="separator horizontal"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td>\r\n <label class="header"><%= scope.textStyle %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <label class="input-label" style=""><%= scope.strTemplate %></label>\r\n <div class="" id="spark-combo-style" style="width: 100%;"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <div style="display:inline-block;vertical-align: middle;width:55px;">\r\n <label class="input-label" style=""><%= scope.strSparkColor %></label>\r\n <div id="spark-color-btn" style=""></div>\r\n </div>\r\n <div style="display:inline-block;vertical-align: middle;">\r\n <label class="input-label" style=""><%= scope.strLineWeight %></label>\r\n <div id="spark-combo-line-type" style="width: 93px;"></div>\r\n </div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <div class="separator horizontal"></div>\r\n </td>\r\n </tr>\r\n</table>\r\n<table cols="1" id="spark-panel-points">\r\n <tr>\r\n <td class="padding-small">\r\n <label class="header" style="margin-bottom: 4px;"><%= scope.textShow %></label>\r\n <div style="width: 100%; height: 25px; margin-bottom: 8px;">\r\n <div id="spark-checkbox-high" style="display: inline-block;margin-top: 4px;"></div>\r\n <div id="spark-high-color-btn" style="display: inline-block; float:right;"></div>\r\n </div>\r\n <div style="width: 100%; height: 25px; margin-bottom: 8px;">\r\n <div id="spark-checkbox-low" style="display: inline-block;margin-top: 4px;"></div>\r\n <div id="spark-low-color-btn" style="display: inline-block; float:right;"></div>\r\n </div>\r\n <div style="width: 100%; height: 25px; margin-bottom: 8px;">\r\n <div id="spark-checkbox-negative" style="display: inline-block;margin-top: 4px;"></div>\r\n <div id="spark-negative-color-btn" style="display: inline-block; float:right;"></div>\r\n </div>\r\n <div style="width: 100%; height: 25px; margin-bottom: 8px;">\r\n <div id="spark-checkbox-first" style="display: inline-block;margin-top: 4px;"></div>\r\n <div id="spark-first-color-btn" style="display: inline-block; float:right;"></div>\r\n </div>\r\n <div style="width: 100%; height: 25px; margin-bottom: 8px;">\r\n <div id="spark-checkbox-last" style="display: inline-block;margin-top: 4px;"></div>\r\n <div id="spark-last-color-btn" style="display: inline-block; float:right;"></div>\r\n </div>\r\n <div style="width: 100%; height: 25px;">\r\n <div id="spark-checkbox-markers" style="display: inline-block;margin-top: 4px;"></div>\r\n <div id="spark-markers-color-btn" style="display: inline-block; float:right;"></div>\r\n </div>\r\n </td>\r\n </tr>\r\n</table>\r\n<table cols="1">\r\n <tr>\r\n <td class="padding-small">\r\n <div class="separator horizontal"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td align="center">\r\n <label class="link" id="chart-advanced-link"><%= scope.textAdvanced %></label>\r\n </td>\r\n </tr>\r\n <tr class="finish-cell"></tr>\r\n</table>'}),define("text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template",[],function(){return'<div id="id-chart-settings-dlg-style" class="settings-panel active">\r\n <div class="inner-content">\r\n <table cols="1" style="">\r\n <tr>\r\n <td class="padding-large">\r\n <label class="header"><%= scope.textType %></label>\r\n <div id="chart-dlg-button-type" style="margin-right: 15px;"></div>\r\n </td>\r\n </tr>\r\n </table>\r\n </div>\r\n <div class="separator horizontal padding-large"></div>\r\n <div class="inner-content">\r\n <table cols="2" style="width: 100%;">\r\n <tr>\r\n <td colspan=2 >\r\n <label class="header"><%= scope.textDataRange %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small" width="200">\r\n <div id="chart-dlg-txt-range" class="input-row" style="margin-right: 10px;"></div>\r\n </td>\r\n <td class="padding-small" style="text-align: right;">\r\n <button type="button" class="btn btn-text-default" id="chart-dlg-btn-data" style="min-width: 100px;width: auto;"><%= scope.textSelectData %></button>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td colspan=2 class="padding-small">\r\n <label class="input-label"><%= scope.textDataSeries %></label>\r\n <div id="chart-dlg-combo-range" class="input-group-nr" style="width:120px;"></div>\r\n </td>\r\n </tr>\r\n </table>\r\n </div>\r\n</div>\r\n<div id="id-chart-settings-dlg-layout" class="settings-panel">\r\n <div class="inner-content">\r\n <table cols="2" style="width: 100%;">\r\n <tr>\r\n <td class="padding-small" width="50%">\r\n <label class="input-label"><%= scope.textChartTitle %></label>\r\n <div id="chart-dlg-combo-chart-title" class="input-group-nr" style="margin-right: 7px;"></div>\r\n </td>\r\n <td class="padding-small" width="50%">\r\n <label class="input-label" style="margin-left: 7px;"><%= scope.textLegendPos %></label>\r\n <div id="chart-dlg-combo-legend-pos" class="input-group-nr" style="margin-left: 7px;" />\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small" width="50%">\r\n <label class="input-label"><%= scope.textDataLabels %></label>\r\n <div id="chart-dlg-combo-data-labels" class="input-group-nr" style="margin-right: 7px;"></div>\r\n </td>\r\n <td rowspan="2" class="padding-small" width="50%">\r\n <div id="chart-dlg-check-series" style="margin: 20px 0 9px 7px;"></div>\r\n <div id="chart-dlg-check-category" style="margin: 0 0 9px 7px;"></div>\r\n <div id="chart-dlg-check-value" style="margin: 0 0 5px 7px;"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small" width="50%">\r\n <label class="input-label"><%= scope.textSeparator %></label>\r\n <div id="chart-dlg-txt-separator" class="input-row" style="margin-right: 7px;"/>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td width="50%">\r\n <label id="chart-dlg-label-lines" class="input-label"><%= scope.textLines %></label>\r\n <div id="chart-dlg-combo-lines" class="input-group-nr padding-small" style="margin-right: 7px;"></div>\r\n </td>\r\n <td style="vertical-align: bottom;" width="50%">\r\n <div id="chart-dlg-check-markers" style="margin: 0 0 12px 7px;"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td colspan="2">\r\n <label class="header padding-small" style="padding-top: 8px;"><%= scope.textAxisSettings %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small" width="50%">\r\n <label class="input-label"><%= scope.textHorAxis %></label>\r\n <div id="chart-dlg-combo-hor-show" class="input-group-nr" style="margin-right: 7px;"></div>\r\n </td>\r\n <td class="padding-small" width="50%">\r\n <label class="input-label" style="margin-left: 7px;"><%= scope.textVertAxis %></label>\r\n <div id="chart-dlg-combo-vert-show" class="input-group-nr" style="margin-left: 7px;" />\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-large" width="50%">\r\n <label class="input-label"><%= scope.textHorTitle %></label>\r\n <div id="chart-dlg-combo-hor-title" class="input-group-nr" style="margin-right: 7px;"></div>\r\n </td>\r\n <td class="padding-large" width="50%">\r\n <label class="input-label" style="margin-left: 7px;"><%= scope.textVertTitle %></label>\r\n <div id="chart-dlg-combo-vert-title" class="input-group-nr" style="margin-left: 7px;" />\r\n </td>\r\n </tr>\r\n <tr>\r\n <td colspan="2">\r\n <label class="header padding-small"><%= scope.textGridLines %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small" width="50%">\r\n <label class="input-label"><%= scope.textHorGrid %></label>\r\n <div id="chart-dlg-combo-hor-grid" class="input-group-nr" style="margin-right: 7px;"></div>\r\n </td>\r\n <td class="padding-small" width="50%">\r\n <label class="input-label" style="margin-left: 7px;"><%= scope.textVertGrid %></label>\r\n <div id="chart-dlg-combo-vert-grid" class="input-group-nr" style="margin-left: 7px;" />\r\n </td>\r\n </tr>\r\n </table>\r\n </div>\r\n</div>\r\n<div id="id-chart-settings-dlg-vert" class="settings-panel">\r\n <div class="inner-content">\r\n <table cols="3" style="width: 100%">\r\n <tr>\r\n <td colspan="3">\r\n <label class="header padding-small"><%= scope.textAxisOptions %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small" width="100">\r\n <label class="input-label"><%= scope.textMinValue %></label>\r\n </td>\r\n <td class="padding-small" width="115" style="padding-right: 10px;">\r\n <div id="chart-dlg-combo-mintype"></div>\r\n </td>\r\n <td class="padding-small" width="90">\r\n <div id="chart-dlg-input-min-value"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-large" width="100">\r\n <label class="input-label"><%= scope.textMaxValue %></label>\r\n </td>\r\n <td class="padding-large" width="115" style="padding-right: 10px;">\r\n <div id="chart-dlg-combo-maxtype"></div>\r\n </td>\r\n <td class="padding-large" width="90">\r\n <div id="chart-dlg-input-max-value"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-large" width="100">\r\n <label class="input-label"><%= scope.textAxisCrosses %></label>\r\n </td>\r\n <td class="padding-large" width="115" style="padding-right: 10px;">\r\n <div id="chart-dlg-combo-v-crosstype"></div>\r\n </td>\r\n <td class="padding-large" width="90">\r\n <div id="chart-dlg-input-v-axis-crosses"></div>\r\n </td>\r\n </tr>\r\n </table>\r\n </div>\r\n <div class="inner-content">\r\n <table cols="1" style="width: 100%;">\r\n <tr>\r\n <td class="padding-large">\r\n <label class="input-label"><%= scope.textUnits %></label>\r\n <div id="chart-dlg-combo-units" class="input-group-nr" style="width:140px;"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-large">\r\n <div id="chart-dlg-check-v-reverse"></div>\r\n </td>\r\n </tr>\r\n </table>\r\n </div>\r\n <div class="separator horizontal padding-large"></div>\r\n <div class="inner-content">\r\n <table cols="2" style="width: 100%;">\r\n <tr>\r\n <td colspan=2 class="padding-small">\r\n <label class="header"><%= scope.textTickOptions %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-large">\r\n <label class="input-label"><%= scope.textMajorType %></label>\r\n <div id="chart-dlg-combo-v-major-type" class="input-group-nr"></div>\r\n </td>\r\n <td class="padding-large">\r\n <label class="input-label" style="margin-left: 15px;"><%= scope.textMinorType %></label>\r\n <div id="chart-dlg-combo-v-minor-type" class="input-group-nr" style="margin-left: 15px;" />\r\n </td>\r\n </tr>\r\n </table>\r\n </div>\r\n <div class="separator horizontal padding-large"></div>\r\n <div class="inner-content">\r\n <table cols="1" style="width: 100%;">\r\n <tr>\r\n <td class="padding-small">\r\n <label class="header"><%= scope.textLabelOptions %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td>\r\n <label class="input-label"><%= scope.textLabelPos %></label>\r\n <div id="chart-dlg-combo-v-label-pos" class="input-group-nr" style="width:140px;"></div>\r\n </td>\r\n </tr>\r\n </table>\r\n </div>\r\n</div>\r\n<div id="id-chart-settings-dlg-hor" class="settings-panel">\r\n <div class="inner-content">\r\n <table cols="3" style="width: 100%">\r\n <tr>\r\n <td colspan="3">\r\n <label class="header padding-small"><%= scope.textAxisOptions %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small" width="100">\r\n <label class="input-label"><%= scope.textAxisCrosses %></label>\r\n </td>\r\n <td class="padding-small" width="115" style="padding-right: 10px;">\r\n <div id="chart-dlg-combo-h-crosstype"></div>\r\n </td>\r\n <td class="padding-small" width="90">\r\n <div id="chart-dlg-input-h-axis-crosses"></div>\r\n </td>\r\n </tr>\r\n </table>\r\n </div>\r\n <div class="inner-content">\r\n <table cols="1" style="width: 100%;">\r\n <tr>\r\n <td class="padding-large" width="140">\r\n <label class="input-label"><%= scope.textAxisPos %></label>\r\n <div id="chart-dlg-combo-axis-pos" class="input-group-nr" style="width:140px;"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-large">\r\n <div id="chart-dlg-check-h-reverse"></div>\r\n </td>\r\n </tr>\r\n </table>\r\n </div>\r\n <div class="separator horizontal padding-large"></div>\r\n <div class="inner-content">\r\n <table cols="2" style="width: 100%;">\r\n <tr>\r\n <td colspan=2 class="padding-small">\r\n <label class="header"><%= scope.textTickOptions %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small" width="140">\r\n <label class="input-label"><%= scope.textMajorType %></label>\r\n <div id="chart-dlg-combo-h-major-type" class="input-group-nr"></div>\r\n </td>\r\n <td class="padding-small">\r\n <label class="input-label" style="margin-left: 15px;"><%= scope.textMinorType %></label>\r\n <div id="chart-dlg-combo-h-minor-type" class="input-group-nr" style="margin-left: 15px;"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td width="100%" colspan="2">\r\n <label class="input-label"><%= scope.textMarksInterval %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-large" width="140">\r\n <div id="chart-dlg-input-marks-interval"></div>\r\n </td>\r\n <td class="padding-large">\r\n </td>\r\n </tr>\r\n </table>\r\n </div>\r\n <div class="separator horizontal padding-large"></div>\r\n <div class="inner-content">\r\n <table cols="2" style="width: 100%;">\r\n <tr>\r\n <td colspan=2 class="padding-small">\r\n <label class="header"><%= scope.textLabelOptions %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small" width="140">\r\n <label class="input-label"><%= scope.textLabelPos %></label>\r\n <div id="chart-dlg-combo-h-label-pos" class="input-group-nr"></div>\r\n </td>\r\n <td class="padding-small">\r\n <label class="input-label" style="margin-left: 15px;"><%= scope.textLabelDist %></label>\r\n <div id="chart-dlg-input-label-dist" style="margin-left: 15px;"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td width="100%" colspan="2">\r\n <label class="input-label"><%= scope.textLabelInterval %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td width="140">\r\n <div id="chart-dlg-combo-label-int" class="input-group-nr"></div>\r\n </td>\r\n <td style="vertical-align: bottom;">\r\n <div id="chart-dlg-input-label-int" style="margin-left: 15px;"></div>\r\n </td>\r\n </tr>\r\n </table>\r\n </div>\r\n</div>\r\n<div id="id-spark-settings-dlg-style" class="settings-panel">\r\n <div class="inner-content padding-large">\r\n <table cols="2" style="">\r\n <tr>\r\n <td class="padding-large">\r\n <label class="header"><%= scope.textType %></label>\r\n <div id="spark-dlg-button-type" style="margin-right: 15px;"></div>\r\n </td>\r\n <td class="padding-large">\r\n <label class="header"><%= scope.textStyle %></label>\r\n <div id="spark-dlg-combo-style" style="width: 190px;"></div>\r\n </td>\r\n </tr>\r\n </table>\r\n </div>\r\n <div class="inner-content">\r\n <!--<div class="padding-large" >-->\r\n <!--<label class="header padding-small" style="display: block;"><%= scope.textSparkRanges %></label>-->\r\n <!--<div id="spark-dlg-radio-group" class="padding-small" style="display: block;"></div>-->\r\n <!--<div id="spark-dlg-radio-single" style="display: block;"></div>-->\r\n <!--</div>-->\r\n <table cols="2" style="width: 100%;">\r\n <!--<tr>-->\r\n <!--<td colspan=2 >-->\r\n <!--<label class="header"><%= scope.textDataRange %></label>-->\r\n <!--</td>-->\r\n <!--</tr>-->\r\n <!--<tr>-->\r\n <!--<td class="padding-small" width="200">-->\r\n <!--<div id="spark-dlg-txt-range" class="input-row" style="margin-right: 10px;"></div>-->\r\n <!--</td>-->\r\n <!--<td class="padding-small" style="text-align: right;">-->\r\n <!--<button type="button" class="btn btn-text-default" id="spark-dlg-btn-data" style="min-width: 100px;"><%= scope.textSelectData %></button>-->\r\n <!--</td>-->\r\n <!--</tr>-->\r\n <!--<tr>-->\r\n <!--<td colspan=2 >-->\r\n <!--<label class="header"><%= scope.textLocationRange %></label>-->\r\n <!--</td>-->\r\n <!--</tr>-->\r\n <!--<tr>-->\r\n <!--<td class="padding-large" width="200">-->\r\n <!--<div id="spark-dlg-txt-location" class="input-row" style="margin-right: 10px;"></div>-->\r\n <!--</td>-->\r\n <!--<td class="padding-large" style="text-align: right;">-->\r\n <!--<button type="button" class="btn btn-text-default" id="spark-dlg-btn-location-data" style="min-width: 100px;"><%= scope.textSelectData %></button>-->\r\n <!--</td>-->\r\n <!--</tr>-->\r\n <!--<tr>-->\r\n <!--<td colspan=2 class="padding-large"></td>-->\r\n <!--</tr>-->\r\n <tr>\r\n <td colspan=2 class="padding-small">\r\n <label class="header"><%= scope.textEmptyCells %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small" width="200">\r\n <label class="input-label"><%= scope.textShowEmptyCells %></label>\r\n <div id="spark-dlg-combo-empty" class="input-group-nr" style="margin-right: 10px;"></div>\r\n </td>\r\n <td></td>\r\n </tr>\r\n <tr>\r\n <td colspan=2>\r\n <div id="spark-dlg-check-show-data"></div>\r\n </td>\r\n </tr>\r\n </table>\r\n </div>\r\n</div>\r\n<div id="id-spark-settings-dlg-axis" class="settings-panel">\r\n <div class="inner-content">\r\n <div class="padding-large" >\r\n <label class="header padding-small" style="display: block;"><%= scope.textHorAxis %></label>\r\n <div id="spark-dlg-check-show" class="padding-small" style="display: block;"></div>\r\n <div id="spark-dlg-check-reverse" class="padding-small" style="display: block;"></div>\r\n </div>\r\n <table cols="3" style="width: 100%">\r\n <tr>\r\n <td colspan="3">\r\n <label class="header padding-small"><%= scope.textVertAxis %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small" width="100">\r\n <label class="input-label"><%= scope.textMinValue %></label>\r\n </td>\r\n <td class="padding-small" width="115" style="padding-right: 10px;">\r\n <div id="spark-dlg-combo-mintype"></div>\r\n </td>\r\n <td class="padding-small" width="90">\r\n <div id="spark-dlg-input-min-value"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-large" width="100">\r\n <label class="input-label"><%= scope.textMaxValue %></label>\r\n </td>\r\n <td class="padding-large" width="115" style="padding-right: 10px;">\r\n <div id="spark-dlg-combo-maxtype"></div>\r\n </td>\r\n <td class="padding-large" width="90">\r\n <div id="spark-dlg-input-max-value"></div>\r\n </td>\r\n </tr>\r\n </table>\r\n </div>\r\n</div>\r\n<div id="id-chart-settings-dlg-alttext" class="settings-panel">\r\n <div class="inner-content">\r\n <table cols="1" width="100%">\r\n <tr>\r\n <td class="padding-large">\r\n <label class="header"><%= scope.textAltTitle %></label>\r\n <div id="chart-advanced-alt-title"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td>\r\n <label class="header"><%= scope.textAltDescription %></label>\r\n <textarea id="chart-advanced-alt-description" class="form-control" style="width: 100%; height: 120px;"></textarea>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td>\r\n <label><%= scope.textAltTip %></label>\r\n </td>\r\n </tr>\r\n </table>\r\n </div>\r\n</div>'});if(Common===undefined)var Common={};define("spreadsheeteditor/main/app/view/CellRangeDialog",["common/main/lib/component/InputField","common/main/lib/component/Window"],function(){"use strict";SSE.Views.CellRangeDialog=Common.UI.Window.extend(_.extend({options:{width:350,cls:"modal-dlg",modal:!1},initialize:function(e){_.extend(this.options,{title:this.txtTitle},e),this.template=['<div class="box">','<div id="id-dlg-cell-range" class="input-row" style="margin-bottom: 5px;"></div>',"</div>",'<div class="footer right">','<button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px;">'+this.okButtonText+"</button>",'<button class="btn normal dlg-btn" result="cancel">'+this.cancelButtonText+"</button>","</div>"].join(""),this.options.tpl=_.template(this.template,this.options),Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this);var e=this.getChild(),t=this;t.inputRange=new Common.UI.InputField({el:$("#id-dlg-cell-range"),name:"range",style:"width: 100%;",allowBlank:!1,blankError:this.txtEmpty,validateOnChange:!0}),e.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this)),t.inputRange.cmpEl.find("input").on("keypress",_.bind(this.onKeyPress,this)),this.on("close",_.bind(this.onClose,this))},onPrimary:function(){return this._handleInput("ok"),!1},setSettings:function(e){var t=this;this.inputRange.setValue(e.range?e.range:""),e.type===undefined&&(e.type=Asc.c_oAscSelectionDialogType.Chart),e.api&&(t.api=e.api,t.api.asc_setSelectionDialogMode(e.type,e.range?e.range:""),t.api.asc_unregisterCallback("asc_onSelectionRangeChanged",_.bind(t.onApiRangeChanged,t)),t.api.asc_registerCallback("asc_onSelectionRangeChanged",_.bind(t.onApiRangeChanged,t)),Common.NotificationCenter.trigger("cells:range",e.type)),t.inputRange.validation=function(n){if(e.validation)return e.validation.call(t,n);var r=t.api.asc_checkDataRange(e.type,n,!1);return r==Asc.c_oAscError.ID.DataRangeError?t.txtInvalidRange:!0}},getSettings:function(){return this.inputRange.getValue()},onApiRangeChanged:function(e){this.inputRange.setValue(e),this.inputRange.cmpEl.hasClass("error")&&this.inputRange.cmpEl.removeClass("error")},onBtnClick:function(e){this._handleInput(e.currentTarget.attributes.result.value)},onClose:function(e){this.api&&this.api.asc_setSelectionDialogMode(Asc.c_oAscSelectionDialogType.None),Common.NotificationCenter.trigger("cells:range",Asc.c_oAscSelectionDialogType.None),SSE.getController("RightMenu").SetDisabled(!1)},onKeyPress:function(e){e.keyCode==Common.UI.Keys.RETURN&&this._handleInput("ok")},_handleInput:function(e){if(this.options.handler){if(e=="ok"&&this.inputRange.checkValidate()!==!0)return;this.options.handler.call(this,this,e)}this.close()},show:function(){Common.UI.Window.prototype.show.call(this),SSE.getController("RightMenu").SetDisabled(!0)},txtTitle:"Select Data Range",textCancel:"Cancel",txtEmpty:"This field is required",txtInvalidRange:"ERROR! Invalid cells range",errorMaxRows:"ERROR! The maximum number of data series per chart is 255.",errorStockChart:"Incorrect row order. To build a stock chart place the data on the sheet in the following order:<br> opening price, max price, min price, closing price."},SSE.Views.CellRangeDialog||{}))}),define("spreadsheeteditor/main/app/view/ChartSettingsDlg",["text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template","common/main/lib/view/AdvancedSettingsWindow","common/main/lib/component/CheckBox","common/main/lib/component/InputField","spreadsheeteditor/main/app/view/CellRangeDialog"],function(e){"use strict";SSE.Views.ChartSettingsDlg=Common.Views.AdvancedSettingsWindow.extend(_.extend({options:{contentWidth:322,height:535,toggleGroup:"chart-settings-dlg-group",storageName:"sse-chart-settings-adv-category"},initialize:function(t){_.extend(this.options,{title:this.textTitle,items:[{panelId:"id-chart-settings-dlg-style",panelCaption:this.textTypeData},{panelId:"id-chart-settings-dlg-layout",panelCaption:this.textLayout},{panelId:"id-chart-settings-dlg-vert",panelCaption:this.textVertAxis},{panelId:"id-chart-settings-dlg-hor",panelCaption:this.textHorAxis},{panelId:"id-spark-settings-dlg-style",panelCaption:this.textTypeData},{panelId:"id-spark-settings-dlg-axis",panelCaption:this.textAxisOptions},{panelId:"id-chart-settings-dlg-alttext",panelCaption:this.textAlt}],contentTemplate:_.template(e)({scope:this})},t),this.options.handler=function(e,n){if(e!="ok"||this.isRangeValid()){t.handler&&t.handler.call(this,e,n);return}return!0},Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this,this.options),this._state={ChartType:Asc.c_oAscChartTypeSettings.barNormal,SparkType:-1},this._noApply=!0,this._changedProps=null,this.api=this.options.api,this.chartSettings=this.options.chartSettings,this.imageSettings=this.options.imageSettings,this.isChart=this.options.isChart,this.vertAxisProps=null,this.horAxisProps=null,this.currentAxisProps=null,this.dataRangeValid="",this.sparkDataRangeValid="",this.dataLocationRangeValid="",this.currentChartType=this._state.ChartType,this.storageName=this.isChart?"sse-chart-settings-adv-category":"sse-spark-settings-adv-category"},render:function(){Common.Views.AdvancedSettingsWindow.prototype.render.call(this);var e=this,t=this.getChild(),n=function(e,n,r){var i=this;t.hasClass("notransform")?(e.css({left:n,top:r}),i.options.additionalAlign=null):(t.addClass("notransform"),e.addClass("hidden"),setTimeout(function(){e.removeClass("hidden"),e.css({left:n,top:r}),i.options.additionalAlign=null},500))};this.btnChartType=new Common.UI.Button({cls:"btn-large-dataview",iconCls:"item-chartlist bar-normal",menu:new Common.UI.Menu({style:"width: 435px; padding-top: 12px;",additionalAlign:n,items:[{template:_.template('<div id="id-chart-dlg-menu-type" class="menu-insertchart" style="margin: 5px 5px 5px 10px;"></div>')}]})}),this.btnChartType.on("render:after",function(t){e.mnuChartTypePicker=new Common.UI.DataView({el:$("#id-chart-dlg-menu-type"),parentMenu:t.menu,restoreHeight:421,groups:new Common.UI.DataViewGroupStore([{id:"menu-chart-group-bar",caption:e.textColumn},{id:"menu-chart-group-line",caption:e.textLine},{id:"menu-chart-group-pie",caption:e.textPie},{id:"menu-chart-group-hbar",caption:e.textBar},{id:"menu-chart-group-area",caption:e.textArea,inline:!0},{id:"menu-chart-group-scatter",caption:e.textPoint,inline:!0},{id:"menu-chart-group-stock",caption:e.textStock,inline:!0}]),store:new Common.UI.DataViewStore([{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barNormal,iconCls:"column-normal",selected:!0},{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barStacked,iconCls:"column-stack"},{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barStackedPer,iconCls:"column-pstack"},{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barNormal3d,iconCls:"column-3d-normal"},{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barStacked3d,iconCls:"column-3d-stack"},{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barStackedPer3d,iconCls:"column-3d-pstack"},{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barNormal3dPerspective,iconCls:"column-3d-normal-per"},{group:"menu-chart-group-line",type:Asc.c_oAscChartTypeSettings.lineNormal,iconCls:"line-normal"},{group:"menu-chart-group-line",type:Asc.c_oAscChartTypeSettings.lineStacked,iconCls:"line-stack"},{group:"menu-chart-group-line",type:Asc.c_oAscChartTypeSettings.lineStackedPer,iconCls:"line-pstack"},{group:"menu-chart-group-line",type:Asc.c_oAscChartTypeSettings.line3d,iconCls:"line-3d"},{group:"menu-chart-group-pie",type:Asc.c_oAscChartTypeSettings.pie,iconCls:"pie-normal"},{group:"menu-chart-group-pie",type:Asc.c_oAscChartTypeSettings.doughnut,iconCls:"pie-doughnut"},{group:"menu-chart-group-pie",type:Asc.c_oAscChartTypeSettings.pie3d,iconCls:"pie-3d-normal"},{group:"menu-chart-group-hbar",type:Asc.c_oAscChartTypeSettings.hBarNormal,iconCls:"bar-normal"},{group:"menu-chart-group-hbar",type:Asc.c_oAscChartTypeSettings.hBarStacked,iconCls:"bar-stack"},{group:"menu-chart-group-hbar",type:Asc.c_oAscChartTypeSettings.hBarStackedPer,iconCls:"bar-pstack"},{group:"menu-chart-group-hbar",type:Asc.c_oAscChartTypeSettings.hBarNormal3d,iconCls:"bar-3d-normal"},{group:"menu-chart-group-hbar",type:Asc.c_oAscChartTypeSettings.hBarStacked3d,iconCls:"bar-3d-stack"},{group:"menu-chart-group-hbar",type:Asc.c_oAscChartTypeSettings.hBarStackedPer3d,iconCls:"bar-3d-pstack"},{group:"menu-chart-group-area",type:Asc.c_oAscChartTypeSettings.areaNormal,iconCls:"area-normal"},{group:"menu-chart-group-area",type:Asc.c_oAscChartTypeSettings.areaStacked,iconCls:"area-stack"},{group:"menu-chart-group-area",type:Asc.c_oAscChartTypeSettings.areaStackedPer,iconCls:"area-pstack"},{group:"menu-chart-group-scatter",type:Asc.c_oAscChartTypeSettings.scatter,iconCls:"point-normal"},{group:"menu-chart-group-stock",type:Asc.c_oAscChartTypeSettings.stock,iconCls:"stock-normal"}]),itemTemplate:_.template('<div id="<%= id %>" class="item-chartlist <%= iconCls %>"></div>')})}),this.btnChartType.render($("#chart-dlg-button-type")),this.mnuChartTypePicker.on("item:click",_.bind(this.onSelectType,this,this.btnChartType)),this.cmbDataDirect=new Common.UI.ComboBox({el:$("#chart-dlg-combo-range"),menuStyle:"min-width: 120px;",editable:!1,cls:"input-group-nr",data:[{value:0,displayValue:this.textDataRows},{value:1,displayValue:this.textDataColumns}]}),this.txtDataRange=new Common.UI.InputField({el:$("#chart-dlg-txt-range"),name:"range",style:"width: 100%;",allowBlank:!0,blankError:this.txtEmpty,validateOnChange:!0}),this.btnSelectData=new Common.UI.Button({el:$("#chart-dlg-btn-data")}),this.btnSelectData.on("click",_.bind(this.onSelectData,this)),this.cmbChartTitle=new Common.UI.ComboBox({el:$("#chart-dlg-combo-chart-title"),menuStyle:"min-width: 140px;",editable:!1,cls:"input-group-nr",data:[{value:Asc.c_oAscChartTitleShowSettings.none,displayValue:this.textNone},{value:Asc.c_oAscChartTitleShowSettings.overlay,displayValue:this.textOverlay},{value:Asc.c_oAscChartTitleShowSettings.noOverlay,displayValue:this.textNoOverlay}]}),this.cmbLegendPos=new Common.UI.ComboBox({el:$("#chart-dlg-combo-legend-pos"),menuStyle:"min-width: 140px;",editable:!1,cls:"input-group-nr",data:[{value:Asc.c_oAscChartLegendShowSettings.none,displayValue:this.textNone},{value:Asc.c_oAscChartLegendShowSettings.bottom,displayValue:this.textLegendBottom},{value:Asc.c_oAscChartLegendShowSettings.top,displayValue:this.textLegendTop},{value:Asc.c_oAscChartLegendShowSettings.right,displayValue:this.textLegendRight},{value:Asc.c_oAscChartLegendShowSettings.left,displayValue:this.textLegendLeft},{value:Asc.c_oAscChartLegendShowSettings.leftOverlay,displayValue:this.textLeftOverlay},{value:Asc.c_oAscChartLegendShowSettings.rightOverlay,displayValue:this.textRightOverlay}]}),this.cmbHorTitle=(new Common.UI.ComboBox({el:$("#chart-dlg-combo-hor-title"),menuStyle:"min-width: 140px;",editable:!1,cls:"input-group-nr",data:[{value:Asc.c_oAscChartHorAxisLabelShowSettings.none,displayValue:this.textNone},{value:Asc.c_oAscChartHorAxisLabelShowSettings.noOverlay,displayValue:this.textNoOverlay}]})).on("selected",_.bind(function(e,t){this.chartSettings&&this.chartSettings.putHorAxisLabel(t.value)},this)),this.cmbVertTitle=(new Common.UI.ComboBox({el:$("#chart-dlg-combo-vert-title"),menuStyle:"min-width: 140px;",editable:!1,cls:"input-group-nr",data:[{value:Asc.c_oAscChartVertAxisLabelShowSettings.none,displayValue:this.textNone},{value:Asc.c_oAscChartVertAxisLabelShowSettings.rotated,displayValue:this.textRotated},{value:Asc.c_oAscChartVertAxisLabelShowSettings.horizontal,displayValue:this.textHorizontal}]})).on("selected",_.bind(function(e,t){this.chartSettings&&this.chartSettings.putVertAxisLabel(t.value)},this)),this.cmbHorShow=(new Common.UI.ComboBox({el:$("#chart-dlg-combo-hor-show"),menuStyle:"min-width: 140px;",editable:!1,cls:"input-group-nr",data:[{value:!0,displayValue:this.textShow},{value:!1,displayValue:this.textHide}]})).on("selected",_.bind(function(e,t){this.chartSettings&&this.chartSettings.putShowHorAxis(t.value)},this)),this.cmbVertShow=(new Common.UI.ComboBox({el:$("#chart-dlg-combo-vert-show"),menuStyle:"min-width: 140px;",editable:!1,cls:"input-group-nr",data:[{value:!0,displayValue:this.textShow},{value:!1,displayValue:this.textHide}]})).on("selected",_.bind(function(e,t){this.chartSettings&&this.chartSettings.putShowVerAxis(t.value)},this)),this.cmbHorGrid=(new Common.UI.ComboBox({el:$("#chart-dlg-combo-hor-grid"),menuStyle:"min-width: 140px;",editable:!1,cls:"input-group-nr",data:[{value:Asc.c_oAscGridLinesSettings.none,displayValue:this.textNone},{value:Asc.c_oAscGridLinesSettings.major,displayValue:this.textMajor},{value:Asc.c_oAscGridLinesSettings.minor,displayValue:this.textMinor},{value:Asc.c_oAscGridLinesSettings.majorMinor,displayValue:this.textMajorMinor}]})).on("selected",_.bind(function(e,t){this.chartSettings&&this.chartSettings.putHorGridLines(t.value)},this)),this.cmbVertGrid=(new Common.UI.ComboBox({el:$("#chart-dlg-combo-vert-grid"),menuStyle:"min-width: 140px;",editable:!1,cls:"input-group-nr",data:[{value:Asc.c_oAscGridLinesSettings.none,displayValue:this.textNone},{value:Asc.c_oAscGridLinesSettings.major,displayValue:this.textMajor},{value:Asc.c_oAscGridLinesSettings.minor,displayValue:this.textMinor},{value:Asc.c_oAscGridLinesSettings.majorMinor,displayValue:this.textMajorMinor}]})).on("selected",_.bind(function(e,t){this.chartSettings&&this.chartSettings.putVertGridLines(t.value)},this)),this.cmbDataLabels=new Common.UI.ComboBox({el:$("#chart-dlg-combo-data-labels"),menuStyle:"min-width: 140px;",editable:!1,cls:"input-group-nr",data:[{value:Asc.c_oAscChartDataLabelsPos.none,displayValue:this.textNone},{value:Asc.c_oAscChartDataLabelsPos.ctr,displayValue:this.textCenter},{value:Asc.c_oAscChartDataLabelsPos.inBase,displayValue:this.textInnerBottom},{value:Asc.c_oAscChartDataLabelsPos.inEnd,displayValue:this.textInnerTop},{value:Asc.c_oAscChartDataLabelsPos.outEnd,displayValue:this.textOuterTop}]}),this.cmbDataLabels.on("selected",_.bind(e.onSelectDataLabels,this)),this.txtSeparator=new Common.UI.InputField({el:$("#chart-dlg-txt-separator"),name:"range",style:"width: 100%;",allowBlank:!0,blankError:this.txtEmpty}),this.chSeriesName=new Common.UI.CheckBox({el:$("#chart-dlg-check-series"),labelText:this.textSeriesName}),this.chCategoryName=new Common.UI.CheckBox({el:$("#chart-dlg-check-category"),labelText:this.textCategoryName}),this.chValue=new Common.UI.CheckBox({el:$("#chart-dlg-check-value"),labelText:this.textValue}),this.cmbLines=(new Common.UI.ComboBox({el:$("#chart-dlg-combo-lines"),menuStyle:"min-width: 140px;",editable:!1,cls:"input-group-nr",data:[{value:0,displayValue:this.textNone},{value:1,displayValue:this.textStraight},{value:2,displayValue:this.textSmooth}]})).on("selected",_.bind(function(e,t){this.chartSettings&&(this.chartSettings.putLine(t.value!==0),t.value>0&&this.chartSettings.putSmooth(t.value==2))},this)),this.chMarkers=(new Common.UI.CheckBox({el:$("#chart-dlg-check-markers"),labelText:this.textMarkers})).on("change",_.bind(function(e,t){this.chartSettings&&this.chartSettings.putShowMarker(t=="checked")},this)),this.lblLines=$("#chart-dlg-label-lines"),this.cmbMinType=(new Common.UI.ComboBox({el:$("#chart-dlg-combo-mintype"),cls:"input-group-nr",menuStyle:"min-width: 100px;",editable:!1,data:[{displayValue:this.textAuto,value:Asc.c_oAscValAxisRule.auto},{displayValue:this.textFixed,value:Asc.c_oAscValAxisRule.fixed}]})).on("selected",_.bind(function(e,t){this.currentAxisProps&&(this.currentAxisProps.putMinValRule(t.value),t.value==Asc.c_oAscValAxisRule.auto&&this.spnMinValue.setValue(this._originalAxisVValues.minAuto,!0))},this)),this.spnMinValue=(new Common.UI.MetricSpinner({el:$("#chart-dlg-input-min-value"),maxValue:1e6,minValue:-1e6,step:.1,defaultUnit:"",defaultValue:0,value:""})).on("change",_.bind(function(e,t,n){this.cmbMinType.suspendEvents(),this.cmbMinType.setValue(Asc.c_oAscValAxisRule.fixed),this.cmbMinType.resumeEvents(),this.currentAxisProps&&(this.currentAxisProps.putMinValRule(Asc.c_oAscValAxisRule.fixed),this.currentAxisProps.putMinVal(e.getNumberValue()))},this)),this.cmbMaxType=(new Common.UI.ComboBox({el:$("#chart-dlg-combo-maxtype"),cls:"input-group-nr",menuStyle:"min-width: 100px;",editable:!1,data:[{displayValue:this.textAuto,value:Asc.c_oAscValAxisRule.auto},{displayValue:this.textFixed,value:Asc.c_oAscValAxisRule.fixed}]})).on("selected",_.bind(function(e,t){this.currentAxisProps&&(this.currentAxisProps.putMaxValRule(t.value),t.value==Asc.c_oAscValAxisRule.auto&&this.spnMaxValue.setValue(this._originalAxisVValues.maxAuto,!0))},this)),this.spnMaxValue=(new Common.UI.MetricSpinner({el:$("#chart-dlg-input-max-value"),maxValue:1e6,minValue:-1e6,step:.1,defaultUnit:"",defaultValue:0,value:""})).on("change",_.bind(function(e,t,n){this.cmbMaxType.suspendEvents(),this.cmbMaxType.setValue(Asc.c_oAscValAxisRule.fixed),this.cmbMaxType.resumeEvents(),this.currentAxisProps&&(this.currentAxisProps.putMaxValRule(Asc.c_oAscValAxisRule.fixed),this.currentAxisProps.putMaxVal(e.getNumberValue()))},this)),this.cmbVCrossType=(new Common.UI.ComboBox({el:$("#chart-dlg-combo-v-crosstype"),cls:"input-group-nr",menuStyle:"min-width: 100px;",editable:!1,data:[{displayValue:this.textAuto,value:Asc.c_oAscCrossesRule.auto},{displayValue:this.textValue,value:Asc.c_oAscCrossesRule.value},{displayValue:this.textMinValue,value:Asc.c_oAscCrossesRule.minValue},{displayValue:this.textMaxValue,value:Asc.c_oAscCrossesRule.maxValue}]})).on("selected",_.bind(function(e,t){if(this.currentAxisProps){this.currentAxisProps.putCrossesRule(t.value);var n;switch(t.value){case Asc.c_oAscCrossesRule.minValue:this.spnVAxisCrosses.setValue(this.spnMinValue.getNumberValue(),!0);break;case Asc.c_oAscCrossesRule.maxValue:this.spnVAxisCrosses.setValue(this.spnMaxValue.getNumberValue(),!0);break;case Asc.c_oAscCrossesRule.auto:this.spnVAxisCrosses.setValue(this._originalAxisVValues.crossesAuto,!0)}}},this)),this.spnVAxisCrosses=(new Common.UI.MetricSpinner({el:$("#chart-dlg-input-v-axis-crosses"),maxValue:1e6,minValue:-1e6,step:.1,defaultUnit:"",defaultValue:0,value:""})).on("change",_.bind(function(e,t,n){this.cmbVCrossType.suspendEvents(),this.cmbVCrossType.setValue(Asc.c_oAscCrossesRule.value),this.cmbVCrossType.resumeEvents(),this.currentAxisProps&&(this.currentAxisProps.putCrossesRule(Asc.c_oAscCrossesRule.value),this.currentAxisProps.putCrosses(e.getNumberValue()))},this)),this.cmbUnits=(new Common.UI.ComboBox({el:$("#chart-dlg-combo-units"),cls:"input-group-nr",menuStyle:"min-width: 140px;",editable:!1,data:[{displayValue:this.textNone,value:Asc.c_oAscValAxUnits.none},{displayValue:this.textHundreds,value:Asc.c_oAscValAxUnits.HUNDREDS},{displayValue:this.textThousands,value:Asc.c_oAscValAxUnits.THOUSANDS},{displayValue:this.textTenThousands,value:Asc.c_oAscValAxUnits.TEN_THOUSANDS},{displayValue:this.textHundredThousands,value:Asc.c_oAscValAxUnits.HUNDRED_THOUSANDS},{displayValue:this.textMillions,value:Asc.c_oAscValAxUnits.MILLIONS},{displayValue:this.textTenMillions,value:Asc.c_oAscValAxUnits.TEN_MILLIONS},{displayValue:this.textHundredMil,value:Asc.c_oAscValAxUnits.HUNDRED_MILLIONS},{displayValue:this.textBillions,value:Asc.c_oAscValAxUnits.BILLIONS},{displayValue:this.textTrillions,value:Asc.c_oAscValAxUnits.TRILLIONS}]})).on("selected",_.bind(function(e,t){this.currentAxisProps&&this.currentAxisProps.putDispUnitsRule(t.value)},this)),this.chVReverse=(new Common.UI.CheckBox({el:$("#chart-dlg-check-v-reverse"),labelText:this.textReverse})).on("change",_.bind(function(e,t){this.currentAxisProps&&this.currentAxisProps.putInvertValOrder(t=="checked")},this)),this.cmbVMajorType=(new Common.UI.ComboBox({el:$("#chart-dlg-combo-v-major-type"),cls:"input-group-nr",menuStyle:"min-width: 140px;",editable:!1,data:[{displayValue:this.textNone,value:Asc.c_oAscTickMark.TICK_MARK_NONE},{displayValue:this.textCross,value:Asc.c_oAscTickMark.TICK_MARK_CROSS},{displayValue:this.textIn,value:Asc.c_oAscTickMark.TICK_MARK_IN},{displayValue:this.textOut,value:Asc.c_oAscTickMark.TICK_MARK_OUT}]})).on("selected",_.bind(function(e,t){this.currentAxisProps&&this.currentAxisProps.putMajorTickMark(t.value)},this)),this.cmbVMinorType=(new Common.UI.ComboBox({el:$("#chart-dlg-combo-v-minor-type"),cls:"input-group-nr",menuStyle:"min-width: 140px;",editable:!1,data:[{displayValue:this.textNone,value:Asc.c_oAscTickMark.TICK_MARK_NONE},{displayValue:this.textCross,value:Asc.c_oAscTickMark.TICK_MARK_CROSS},{displayValue:this.textIn,value:Asc.c_oAscTickMark.TICK_MARK_IN},{displayValue:this.textOut,value:Asc.c_oAscTickMark.TICK_MARK_OUT}]})).on("selected",_.bind(function(e,t){this.currentAxisProps&&this.currentAxisProps.putMinorTickMark(t.value)},this)),this.cmbVLabelPos=(new Common.UI.ComboBox({el:$("#chart-dlg-combo-v-label-pos"),cls:"input-group-nr",menuStyle:"min-width: 140px;",editable:!1,data:[{displayValue:this.textNone,value:Asc.c_oAscTickLabelsPos.TICK_LABEL_POSITION_NONE},{displayValue:this.textLow,value:Asc.c_oAscTickLabelsPos.TICK_LABEL_POSITION_LOW},{displayValue:this.textHigh,value:Asc.c_oAscTickLabelsPos.TICK_LABEL_POSITION_HIGH},{displayValue:this.textNextToAxis,value:Asc.c_oAscTickLabelsPos.TICK_LABEL_POSITION_NEXT_TO}]})).on("selected",_.bind(function(e,t){this.currentAxisProps&&this.currentAxisProps.putTickLabelsPos(t.value)},this)),this.cmbHCrossType=(new Common.UI.ComboBox({el:$("#chart-dlg-combo-h-crosstype"),cls:"input-group-nr",menuStyle:"min-width: 100px;",editable:!1,data:[{displayValue:this.textAuto,value:Asc.c_oAscCrossesRule.auto},{displayValue:this.textValue,value:Asc.c_oAscCrossesRule.value},{displayValue:this.textMinValue,value:Asc.c_oAscCrossesRule.minValue},{displayValue:this.textMaxValue,value:Asc.c_oAscCrossesRule.maxValue}]})).on("selected",_.bind(function(e,t){this.currentAxisProps&&(this.currentAxisProps.putCrossesRule(t.value),t.value==Asc.c_oAscCrossesRule.auto?this.spnHAxisCrosses.setValue(this._originalAxisHValues.crossesAuto,!0):t.value==Asc.c_oAscCrossesRule.minValue?this.spnHAxisCrosses.setValue(this._originalAxisHValues.minAuto,!0):t.value==Asc.c_oAscCrossesRule.maxValue&&this.spnHAxisCrosses.setValue(this._originalAxisHValues.maxAuto,!0))},this)),this.spnHAxisCrosses=(new Common.UI.MetricSpinner({el:$("#chart-dlg-input-h-axis-crosses"),maxValue:1e6,minValue:-1e6,step:.1,defaultUnit:"",defaultValue:0,value:""})).on("change",_.bind(function(e,t,n){this.cmbHCrossType.suspendEvents(),this.cmbHCrossType.setValue(Asc.c_oAscCrossesRule.value),this.cmbHCrossType.resumeEvents(),this.currentAxisProps&&(this.currentAxisProps.putCrossesRule(Asc.c_oAscCrossesRule.value),this.currentAxisProps.putCrosses(e.getNumberValue()))},this)),this.cmbAxisPos=(new Common.UI.ComboBox({el:$("#chart-dlg-combo-axis-pos"),cls:"input-group-nr",menuStyle:"min-width: 140px;",editable:!1,data:[{displayValue:this.textOnTickMarks,value:Asc.c_oAscLabelsPosition.byDivisions},{displayValue:this.textBetweenTickMarks,value:Asc.c_oAscLabelsPosition.betweenDivisions}]})).on("selected",_.bind(function(e,t){this.currentAxisProps&&this.currentAxisProps.putLabelsPosition(t.value)},this)),this.chHReverse=(new Common.UI.CheckBox({el:$("#chart-dlg-check-h-reverse"),labelText:this.textReverse})).on("change",_.bind(function(e,t){this.currentAxisProps&&this.currentAxisProps.putInvertCatOrder(t=="checked")},this)),this.cmbHMajorType=(new Common.UI.ComboBox({el:$("#chart-dlg-combo-h-major-type"),cls:"input-group-nr",menuStyle:"min-width: 140px;",editable:!1,data:[{displayValue:this.textNone,value:Asc.c_oAscTickMark.TICK_MARK_NONE},{displayValue:this.textCross,value:Asc.c_oAscTickMark.TICK_MARK_CROSS},{displayValue:this.textIn,value:Asc.c_oAscTickMark.TICK_MARK_IN},{displayValue:this.textOut,value:Asc.c_oAscTickMark.TICK_MARK_OUT}]})).on("selected",_.bind(function(e,t){this.currentAxisProps&&this.currentAxisProps.putMajorTickMark(t.value)},this)),this.cmbHMinorType=(new Common.UI.ComboBox({el:$("#chart-dlg-combo-h-minor-type"),cls:"input-group-nr",menuStyle:"min-width: 140px;",editable:!1,data:[{displayValue:this.textNone,value:Asc.c_oAscTickMark.TICK_MARK_NONE},{displayValue:this.textCross,value:Asc.c_oAscTickMark.TICK_MARK_CROSS},{displayValue:this.textIn,value:Asc.c_oAscTickMark.TICK_MARK_IN},{displayValue:this.textOut,value:Asc.c_oAscTickMark.TICK_MARK_OUT}]})).on("selected",_.bind(function(e,t){this.currentAxisProps&&this.currentAxisProps.putMinorTickMark(t.value)},this)),this.spnMarksInterval=(new Common.UI.MetricSpinner({el:$("#chart-dlg-input-marks-interval"),width:140,maxValue:1e6,minValue:1,step:1,defaultUnit:"",value:""})).on("change",_.bind(function(e,t,n){this.currentAxisProps&&this.currentAxisProps.putIntervalBetweenTick(e.getNumberValue())},this)),this.cmbHLabelPos=(new Common.UI.ComboBox({el:$("#chart-dlg-combo-h-label-pos"),cls:"input-group-nr",menuStyle:"min-width: 140px;",editable:!1,data:[{displayValue:this.textNone,value:Asc.c_oAscTickLabelsPos.TICK_LABEL_POSITION_NONE},{displayValue:this.textLow,value:Asc.c_oAscTickLabelsPos.TICK_LABEL_POSITION_LOW},{displayValue:this.textHigh,value:Asc.c_oAscTickLabelsPos.TICK_LABEL_POSITION_HIGH},{displayValue:this.textNextToAxis,value:Asc.c_oAscTickLabelsPos.TICK_LABEL_POSITION_NEXT_TO}]})).on("selected",_.bind(function(e,t){this.currentAxisProps&&this.currentAxisProps.putTickLabelsPos(t.value)},this)),this.spnLabelDist=(new Common.UI.MetricSpinner({el:$("#chart-dlg-input-label-dist"),width:140,maxValue:1e3,minValue:0,step:1,defaultUnit:"",value:""})).on("change",_.bind(function(e,t,n){this.currentAxisProps&&this.currentAxisProps.putLabelsAxisDistance(e.getNumberValue())},this)),this.spnLabelInterval=(new Common.UI.MetricSpinner({el:$("#chart-dlg-input-label-int"),width:140,maxValue:1e6,minValue:1,step:1,defaultUnit:"",value:""})).on("change",_.bind(function(e,t,n){this.cmbLabelInterval.suspendEvents(),this.cmbLabelInterval.setValue(Asc.c_oAscBetweenLabelsRule.manual),this.cmbLabelInterval.resumeEvents(),this.currentAxisProps&&(this.currentAxisProps.putIntervalBetweenLabelsRule(Asc.c_oAscBetweenLabelsRule.manual),this.currentAxisProps.putIntervalBetweenLabels(e.getNumberValue()))},this)),this.cmbLabelInterval=(new Common.UI.ComboBox({el:$("#chart-dlg-combo-label-int"),cls:"input-group-nr",menuStyle:"min-width: 140px;",editable:!1,data:[{displayValue:this.textAuto,value:Asc.c_oAscBetweenLabelsRule.auto},{displayValue:this.textManual,value:Asc.c_oAscBetweenLabelsRule.manual}]})).on("selected",_.bind(function(e,t){this.currentAxisProps&&(this.currentAxisProps.putIntervalBetweenLabelsRule(t.value),t.value==Asc.c_oAscBetweenLabelsRule.auto&&this.spnLabelInterval.setValue(1,!0))},this)),this.btnsCategory[2].on("click",_.bind(this.onVCategoryClick,this)),this.btnsCategory[3].on("click",_.bind(this.onHCategoryClick,this)),this.btnSparkType=new Common.UI.Button({cls:"btn-large-dataview",iconCls:"item-chartlist spark-column",menu:new Common.UI.Menu({style:"width: 200px; padding-top: 12px;",additionalAlign:n,items:[{template:_.template('<div id="id-spark-dlg-menu-type" class="menu-insertchart" style="margin: 5px 5px 0 10px;"></div>')}]})}),this.btnSparkType.on("render:after",function(t){e.mnuSparkTypePicker=new Common.UI.DataView({el:$("#id-spark-dlg-menu-type"),parentMenu:t.menu,restoreHeight:120,groups:new Common.UI.DataViewGroupStore([{id:"menu-chart-group-sparkcolumn",inline:!0},{id:"menu-chart-group-sparkline",inline:!0},{id:"menu-chart-group-sparkwin",inline:!0}]),store:new Common.UI.DataViewStore([{group:"menu-chart-group-sparkcolumn",type:Asc.c_oAscSparklineType.Column,allowSelected:!0,iconCls:"spark-column",tip:e.textColumnSpark},{group:"menu-chart-group-sparkline",type:Asc.c_oAscSparklineType.Line,allowSelected:!0,iconCls:"spark-line",tip:e.textLineSpark},{group:"menu-chart-group-sparkwin",type:Asc.c_oAscSparklineType.Stacked,allowSelected:!0,iconCls:"spark-win",tip:e.textWinLossSpark}]),itemTemplate:_.template('<div id="<%= id %>" class="item-chartlist <%= iconCls %>"></div>')})}),this.btnSparkType.render($("#spark-dlg-button-type")),this.mnuSparkTypePicker.on("item:click",_.bind(this.onSelectSparkType,this,this.btnSparkType)),this.cmbSparkStyle=new Common.UI.ComboDataView({itemWidth:50,itemHeight:50,menuMaxHeight:272,enableKeyEvents:!0,cls:"combo-spark-style"}),this.cmbSparkStyle.render($("#spark-dlg-combo-style")),this.cmbSparkStyle.openButton.menu.cmpEl.css({"min-width":178,"max-width":178}),this.cmbSparkStyle.on("click",_.bind(this.onSelectSparkStyle,this)),this.cmbSparkStyle.openButton.menu.on("show:after",function(){e.cmbSparkStyle.menuPicker.scroller.update({alwaysVisibleY:!0})}),this._arrEmptyCells=[{value:Asc.c_oAscEDispBlanksAs.Gap,displayValue:this.textGaps},{value:Asc.c_oAscEDispBlanksAs.Zero,displayValue:this.textZero},{value:Asc.c_oAscEDispBlanksAs.Span,displayValue:this.textEmptyLine}],this.cmbEmptyCells=new Common.UI.ComboBox({el:$("#spark-dlg-combo-empty"),menuStyle:"min-width: 188px;",editable:!1,cls:"input-group-nr"}),this.cmbEmptyCells.on("selected",_.bind(function(e,t){this._changedProps&&this._changedProps.asc_setDisplayEmpty(t.value)},this)),this.chShowEmpty=new Common.UI.CheckBox({el:$("#spark-dlg-check-show-data"),labelText:this.textShowData}),this.chShowEmpty.on("change",_.bind(function(e,t,n,r){this._changedProps&&this._changedProps.asc_setDisplayHidden(e.getValue()=="checked")},this)),this.chShowAxis=new Common.UI.CheckBox({el:$("#spark-dlg-check-show"),labelText:this.textShowSparkAxis}),this.chShowAxis.on("change",_.bind(function(e,t,n,r){this._changedProps&&this._changedProps.asc_setDisplayXAxis(e.getValue()=="checked")},this)),this.chReverse=new Common.UI.CheckBox({el:$("#spark-dlg-check-reverse"),labelText:this.textReverseOrder}),this.chReverse.on("change",_.bind(function(e,t,n,r){this._changedProps&&this._changedProps.asc_setRightToLeft(e.getValue()=="checked")},this)),this.cmbSparkMinType=(new Common.UI.ComboBox({el:$("#spark-dlg-combo-mintype"),cls:"input-group-nr",menuStyle:"min-width: 100px;",editable:!1,data:[{displayValue:this.textAutoEach,value:Asc.c_oAscSparklineAxisMinMax.Individual},{displayValue:this.textSameAll,value:Asc.c_oAscSparklineAxisMinMax.Group},{displayValue:this.textFixed,value:Asc.c_oAscSparklineAxisMinMax.Custom}]})).on("selected",_.bind(function(e,t){this.spnSparkMinValue.setDisabled(t.value!==Asc.c_oAscSparklineAxisMinMax.Custom),this._changedProps&&this._changedProps.asc_setMinAxisType(t.value),t.value==Asc.c_oAscSparklineAxisMinMax.Custom&&_.isEmpty(this.spnSparkMinValue.getValue())&&this.spnSparkMinValue.setValue(0)},this)),this.spnSparkMinValue=(new Common.UI.MetricSpinner({el:$("#spark-dlg-input-min-value"),maxValue:1e6,minValue:-1e6,step:.1,defaultUnit:"",defaultValue:0,value:""})).on("change",_.bind(function(e,t,n){this._changedProps&&this._changedProps.asc_setManualMin(e.getNumberValue())},this)),this.cmbSparkMaxType=(new Common.UI.ComboBox({el:$("#spark-dlg-combo-maxtype"),cls:"input-group-nr",menuStyle:"min-width: 100px;",editable:!1,data:[{displayValue:this.textAutoEach,value:Asc.c_oAscSparklineAxisMinMax.Individual},{displayValue:this.textSameAll,value:Asc.c_oAscSparklineAxisMinMax.Group},{displayValue:this.textFixed,value:Asc.c_oAscSparklineAxisMinMax.Custom}]})).on("selected",_.bind(function(e,t){this.spnSparkMaxValue.setDisabled(t.value!==Asc.c_oAscSparklineAxisMinMax.Custom),this._changedProps&&this._changedProps.asc_setMaxAxisType(t.value),t.value==Asc.c_oAscSparklineAxisMinMax.Custom&&_.isEmpty(this.spnSparkMaxValue.getValue())&&this.spnSparkMaxValue.setValue(0)},this)),this.spnSparkMaxValue=(new Common.UI.MetricSpinner({el:$("#spark-dlg-input-max-value"),maxValue:1e6,minValue:-1e6,step:.1,defaultUnit:"",defaultValue:0,value:""})).on("change",_.bind(function(e,t,n){this._changedProps&&this._changedProps.asc_setManualMax(e.getNumberValue())},this)),this.inputAltTitle=(new Common.UI.InputField({el:$("#chart-advanced-alt-title"),allowBlank:!0,validateOnBlur:!1,style:"width: 100%;"})).on("changed:after",function(){e.isAltTitleChanged=!0}),this.textareaAltDescription=this.$window.find("textarea"),this.textareaAltDescription.keydown(function(t){t.keyCode==Common.UI.Keys.RETURN&&t.stopPropagation(),e.isAltDescChanged=!0}),this.afterRender()},afterRender:function(){this._setDefaults(this.chartSettings),this.setTitle(this.isChart?this.textTitle:this.textTitleSparkline),this.isChart?(this.btnsCategory[4].setVisible(!1),this.btnsCategory[5].setVisible(!1)):(this.btnsCategory[0].setVisible(!1),this.btnsCategory[1].setVisible(!1),this.btnsCategory[2].setVisible(!1),this.btnsCategory[3].setVisible(!1),this.btnsCategory[6].setVisible(!1));if(this.storageName){var e=Common.localStorage.getItem(this.storageName);this.setActiveCategory(e!==null?parseInt(e):0),e=this.getActiveCategory(),e==2?this.onVCategoryClick():e==3&&this.onHCategoryClick()}},onSelectType:function(e,t,n,r){if(this._noApply)return;var i={},s=_.isFunction(r.toJSON);if(s){if(!r.get("selected"))return;i=r.toJSON()}else i=r;this.btnChartType.setIconCls("item-chartlist "+i.iconCls),this.chartSettings.changeType(i.type),this.updateAxisProps(i.type,!0),this.vertAxisProps=this.chartSettings.getVertAxisProps(),this.horAxisProps=this.chartSettings.getHorAxisProps(),this.updateDataLabels(i.type,this.cmbDataLabels.getValue()),this.currentChartType=i.type},updateAxisProps:function(e,t){var n=e==Asc.c_oAscChartTypeSettings.lineNormal||e==Asc.c_oAscChartTypeSettings.lineStacked||e==Asc.c_oAscChartTypeSettings.lineStackedPer||e==Asc.c_oAscChartTypeSettings.scatter;this.chMarkers.setVisible(n),this.cmbLines.setVisible(n),this.lblLines.toggleClass("hidden",!n),n&&(this.chMarkers.setValue(this.chartSettings.getShowMarker(),!0),this.cmbLines.setValue(this.chartSettings.getLine()?this.chartSettings.getSmooth()?2:1:0)),n=e==Asc.c_oAscChartTypeSettings.pie||e==Asc.c_oAscChartTypeSettings.doughnut||e==Asc.c_oAscChartTypeSettings.pie3d,this.btnsCategory[2].setDisabled(n),this.btnsCategory[3].setDisabled(n),this.cmbHorShow.setDisabled(n),this.cmbVertShow.setDisabled(n),this.cmbHorTitle.setDisabled(n),this.cmbVertTitle.setDisabled(n),this.cmbHorGrid.setDisabled(n),this.cmbVertGrid.setDisabled(n),this.cmbHorShow.setValue(this.chartSettings.getShowHorAxis()),this.cmbVertShow.setValue(this.chartSettings.getShowVerAxis()),this.cmbHorTitle.setValue(this.chartSettings.getHorAxisLabel()),this.cmbVertTitle.setValue(this.chartSettings.getVertAxisLabel()),this.cmbHorGrid.setValue(this.chartSettings.getHorGridLines()),this.cmbVertGrid.setValue(this.chartSettings.getVertGridLines()),n=e==Asc.c_oAscChartTypeSettings.barNormal3d||e==Asc.c_oAscChartTypeSettings.barStacked3d||e==Asc.c_oAscChartTypeSettings.barStackedPer3d||e==Asc.c_oAscChartTypeSettings.hBarNormal3d||e==Asc.c_oAscChartTypeSettings.hBarStacked3d||e==Asc.c_oAscChartTypeSettings.hBarStackedPer3d||e==Asc.c_oAscChartTypeSettings.barNormal3dPerspective,this.cmbAxisPos.setDisabled(n),n=e==Asc.c_oAscChartTypeSettings.hBarNormal||e==Asc.c_oAscChartTypeSettings.hBarStacked||e==Asc.c_oAscChartTypeSettings.hBarStackedPer||e==Asc.c_oAscChartTypeSettings.hBarNormal3d||e==Asc.c_oAscChartTypeSettings.hBarStacked3d||e==Asc.c_oAscChartTypeSettings.hBarStackedPer3d,this.btnsCategory[2].options.contentTarget=n?"id-chart-settings-dlg-hor":"id-chart-settings-dlg-vert",this.btnsCategory[3].options.contentTarget=n||e==Asc.c_oAscChartTypeSettings.scatter?"id-chart-settings-dlg-vert":"id-chart-settings-dlg-hor"},updateDataLabels:function(e,t){if(e!==this.currentChartType){var n=[{value:Asc.c_oAscChartDataLabelsPos.none,displayValue:this.textNone},{value:Asc.c_oAscChartDataLabelsPos.ctr,displayValue:this.textCenter}];e==Asc.c_oAscChartTypeSettings.barNormal||e==Asc.c_oAscChartTypeSettings.hBarNormal?n.push({value:Asc.c_oAscChartDataLabelsPos.inBase,displayValue:this.textInnerBottom},{value:Asc.c_oAscChartDataLabelsPos.inEnd,displayValue:this.textInnerTop},{value:Asc.c_oAscChartDataLabelsPos.outEnd,displayValue:this.textOuterTop}):e==Asc.c_oAscChartTypeSettings.barStacked||e==Asc.c_oAscChartTypeSettings.barStackedPer||e==Asc.c_oAscChartTypeSettings.hBarStacked||e==Asc.c_oAscChartTypeSettings.hBarStackedPer?n.push({value:Asc.c_oAscChartDataLabelsPos.inBase,displayValue:this.textInnerBottom},{value:Asc.c_oAscChartDataLabelsPos.inEnd,displayValue:this.textInnerTop}):e==Asc.c_oAscChartTypeSettings.lineNormal||e==Asc.c_oAscChartTypeSettings.lineStacked||e==Asc.c_oAscChartTypeSettings.lineStackedPer||e==Asc.c_oAscChartTypeSettings.stock||e==Asc.c_oAscChartTypeSettings.scatter?n.push({value:Asc.c_oAscChartDataLabelsPos.l,displayValue:this.textLeft},{value:Asc.c_oAscChartDataLabelsPos.r,displayValue:this.textRight},{value:Asc.c_oAscChartDataLabelsPos.t,displayValue:this.textTop},{value:Asc.c_oAscChartDataLabelsPos.b,displayValue:this.textBottom}):(e==Asc.c_oAscChartTypeSettings.pie||e==Asc.c_oAscChartTypeSettings.pie3d)&&n.push({value:Asc.c_oAscChartDataLabelsPos.bestFit,displayValue:this.textFit},{value:Asc.c_oAscChartDataLabelsPos.inEnd,displayValue:this.textInnerTop},{value:Asc.c_oAscChartDataLabelsPos.outEnd,displayValue:this.textOuterTop}),this.cmbDataLabels.setData(n)}if(t!==undefined){var r=this.cmbDataLabels.store.findWhere({value:t});r||(t=Asc.c_oAscChartDataLabelsPos.ctr)}else t=Asc.c_oAscChartDataLabelsPos.none;this.cmbDataLabels.setValue(t),this.onSelectDataLabels(this.cmbDataLabels,{value:t})},onVCategoryClick:function(){this.vertAxisProps.getAxisType()==Asc.c_oAscAxisType.val?this.fillVProps(this.vertAxisProps):this.fillHProps(this.vertAxisProps)},onHCategoryClick:function(){this.horAxisProps.getAxisType()==Asc.c_oAscAxisType.val?this.fillVProps(this.horAxisProps):this.fillHProps(this.horAxisProps)},fillVProps:function(e){if(e.getAxisType()!==Asc.c_oAscAxisType.val)return;this._originalAxisVValues==undefined&&(this._originalAxisVValues={minAuto:e.getMinVal()==null?0:e.getMinVal(),maxAuto:e.getMaxVal()==null?10:e.getMaxVal(),crossesAuto:e.getCrosses()==null?0:e.getCrosses()}),this.cmbMinType.setValue(e.getMinValRule());var t=e.getMinValRule()==Asc.c_oAscValAxisRule.auto?this._originalAxisVValues.minAuto:e.getMinVal();this.spnMinValue.setValue(t==null?"":t,!0),this.cmbMaxType.setValue(e.getMaxValRule()),t=e.getMaxValRule()==Asc.c_oAscValAxisRule.auto?this._originalAxisVValues.maxAuto:e.getMaxVal(),this.spnMaxValue.setValue(t==null?"":t,!0),t=e.getCrossesRule(),this.cmbVCrossType.setValue(t);switch(t){case Asc.c_oAscCrossesRule.minValue:t=this.spnMinValue.getNumberValue();break;case Asc.c_oAscCrossesRule.maxValue:t=this.spnMaxValue.getNumberValue();break;case Asc.c_oAscCrossesRule.auto:t=this._originalAxisVValues.crossesAuto;break;default:t=e.getCrosses()}this.spnVAxisCrosses.setValue(t==null?"":t,!0),this.cmbUnits.setValue(e.getDispUnitsRule()),this.chVReverse.setValue(e.getInvertValOrder(),!0),this.cmbVMajorType.setValue(e.getMajorTickMark()),this.cmbVMinorType.setValue(e.getMinorTickMark()),this.cmbVLabelPos.setValue(e.getTickLabelsPos()),this.currentAxisProps=e},fillHProps:function(e){if(e.getAxisType()!==Asc.c_oAscAxisType.cat)return;this._originalAxisHValues==undefined&&(this._originalAxisHValues={minAuto:e.getCrossMinVal()==null?0:e.getCrossMinVal(),maxAuto:e.getCrossMaxVal()==null?10:e.getCrossMaxVal(),crossesAuto:e.getCrosses()==null?0:e.getCrosses()});var t=e.getCrossesRule();this.cmbHCrossType.setValue(t);switch(t){case Asc.c_oAscCrossesRule.minValue:t=this._originalAxisHValues.minAuto;break;case Asc.c_oAscCrossesRule.maxValue:t=this._originalAxisHValues.maxAuto;break;case Asc.c_oAscCrossesRule.auto:t=this._originalAxisHValues.crossesAuto;break;default:t=e.getCrosses()}this.spnHAxisCrosses.setValue(t==null?"":t,!0),this.cmbAxisPos.setValue(e.getLabelsPosition()),this.chHReverse.setValue(e.getInvertCatOrder(),!0),this.cmbHMajorType.setValue(e.getMajorTickMark()),this.cmbHMinorType.setValue(e.getMinorTickMark()),this.spnMarksInterval.setValue(e.getIntervalBetweenTick(),!0),this.cmbHLabelPos.setValue(e.getTickLabelsPos()),this.spnLabelDist.setValue(e.getLabelsAxisDistance(),!0),t=e.getIntervalBetweenLabelsRule(),this.cmbLabelInterval.setValue(t),this.spnLabelInterval.setValue(t===Asc.c_oAscBetweenLabelsRule.manual?e.getIntervalBetweenLabels():1,!0),this.currentAxisProps=e},updateSparkStyles:function(e){if(e&&e.length>1){var t=this.cmbSparkStyle.menuPicker,n=t.store;if(n.length==e.length-1){var r=n.models;for(var i=0;i<e.length-1;i++)r[i].set("imageUrl",e[i])}else{var s=[],o=e[e.length-1];for(var i=0;i<e.length-1;i++)s.push({imageUrl:e[i],data:i});n.reset(s,{silent:!1}),this.cmbSparkStyle.fillComboView(n.at(o<0?0:o),o>-1)}}},onSelectSparkType:function(e,t,n,r){if(this._noApply)return;var i={},s=_.isFunction(r.toJSON);if(s){if(!r.get("selected"))return;i=r.toJSON()}else i=r;this.btnSparkType.setIconCls("item-chartlist "+i.iconCls),this._changedProps&&this._changedProps.asc_setType(i.type),this.chartSettings.asc_setType(i.type),this._state.SparkType=i.type;var o=!1,u=this.cmbEmptyCells.getValue();i.type!==Asc.c_oAscSparklineType.Line&&this._arrEmptyCells.length>2?(this._arrEmptyCells.pop(),o=!0):i.type==Asc.c_oAscSparklineType.Line&&this._arrEmptyCells.length<3&&(this._arrEmptyCells.push({value:Asc.c_oAscEDispBlanksAs.Span,displayValue:this.textEmptyLine}),o=!0),o&&(this.cmbEmptyCells.setData(this._arrEmptyCells),this.cmbEmptyCells.setValue(i.type!==Asc.c_oAscSparklineType.Line&&u==Asc.c_oAscEDispBlanksAs.Span?this.textEmptyLine:u)),this.updateSparkStyles(this.chartSettings.asc_getStyles())},onSelectSparkStyle:function(e,t){if(this._noApply)return;this._changedProps&&this._changedProps.asc_setStyle(t.get("data"))},_setDefaults:function(e){var t=this;if(e){this.chartSettings=e;if(this.isChart){this._state.ChartType=e.getType(),this._noApply=!0;var n=this.mnuChartTypePicker.store.findWhere({type:this._state.ChartType});this.mnuChartTypePicker.selectRecord(n,!0),n&&this.btnChartType.setIconCls("item-chartlist "+n.get("iconCls")),this._noApply=!1;var r=e.getRange();this.txtDataRange.setValue(r?r:""),this.dataRangeValid=r,this.txtDataRange.validation=function(e){if(_.isEmpty(e))return t.cmbDataDirect.isDisabled()||t.cmbDataDirect.setDisabled(!0),!0;t.cmbDataDirect.isDisabled()&&t.cmbDataDirect.setDisabled(!1);var n=t.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.Chart,e,!1);return n==Asc.c_oAscError.ID.DataRangeError?t.textInvalidRange:!0},this.cmbDataDirect.setDisabled(r===null),this.cmbDataDirect.setValue(e.getInColumns()?1:0),this.cmbChartTitle.setValue(e.getTitle()),this.cmbLegendPos.setValue(e.getLegendPos()),this.updateDataLabels(this._state.ChartType,e.getDataLabelsPos()),this.chSeriesName.setValue(this.chartSettings.getShowSerName(),!0),this.chCategoryName.setValue(this.chartSettings.getShowCatName(),!0),this.chValue.setValue(this.chartSettings.getShowVal(),!0),r=e.getSeparator(),this.txtSeparator.setValue(r?r:""),this.vertAxisProps=e.getVertAxisProps(),this.horAxisProps=e.getHorAxisProps(),this.updateAxisProps(this._state.ChartType),this.currentChartType=this._state.ChartType,this.imageSettings&&(r=this.imageSettings.asc_getTitle(),this.inputAltTitle.setValue(r?r:""),r=this.imageSettings.asc_getDescription(),this.textareaAltDescription.val(r?r:""))}else{this._state.SparkType=e.asc_getType();var n=this.mnuSparkTypePicker.store.findWhere({type:this._state.SparkType});this.mnuSparkTypePicker.selectRecord(n,!0),n&&this.btnSparkType.setIconCls("item-chartlist "+n.get("iconCls")),this.updateSparkStyles(e.asc_getStyles()),this._state.SparkType!==Asc.c_oAscSparklineType.Line&&this._arrEmptyCells.pop(),this.cmbEmptyCells.setData(this._arrEmptyCells);var r=e.asc_getDisplayEmpty();this.cmbEmptyCells.setValue(this._state.SparkType!==Asc.c_oAscSparklineType.Line&&r==Asc.c_oAscEDispBlanksAs.Span?this.textEmptyLine:r),this.chShowEmpty.setValue(e.asc_getDisplayHidden(),!0),this.chShowAxis.setValue(e.asc_getDisplayXAxis(),!0),this.chReverse.setValue(e.asc_getRightToLeft(),!0),this.cmbSparkMinType.setValue(e.asc_getMinAxisType(),!0),this.cmbSparkMaxType.setValue(e.asc_getMaxAxisType(),!0),this.spnSparkMinValue.setDisabled(e.asc_getMinAxisType()!==Asc.c_oAscSparklineAxisMinMax.Custom),this.spnSparkMaxValue.setDisabled(e.asc_getMaxAxisType()!==Asc.c_oAscSparklineAxisMinMax.Custom),this.spnSparkMinValue.setValue(e.asc_getManualMin()!==null?e.asc_getManualMin():"",!0),this.spnSparkMaxValue.setValue(e.asc_getManualMax()!==null?e.asc_getManualMax():"",!0),this._changedProps=new Asc.sparklineGroup,this._noApply=!1}}},getSettings:function(){var e,t=this.mnuChartTypePicker.getSelectedRec()[0].get("type");if(this.isChart){this.chartSettings.putType(t),this.chartSettings.putInColumns(this.cmbDataDirect.getValue()==1),this.chartSettings.putRange(this.txtDataRange.getValue()),this.chartSettings.putTitle(this.cmbChartTitle.getValue()),this.chartSettings.putLegendPos(this.cmbLegendPos.getValue()),this.chartSettings.putShowHorAxis(this.cmbHorShow.getValue()),this.chartSettings.putShowVerAxis(this.cmbVertShow.getValue()),this.chartSettings.putHorAxisLabel(this.cmbHorTitle.getValue()),this.chartSettings.putVertAxisLabel(this.cmbVertTitle.getValue()),this.chartSettings.putHorGridLines(this.cmbHorGrid.getValue()),this.chartSettings.putVertGridLines(this.cmbVertGrid.getValue()),this.chartSettings.putDataLabelsPos(this.cmbDataLabels.getValue()),this.chartSettings.putShowSerName(this.chSeriesName.getValue()=="checked"),this.chartSettings.putShowCatName(this.chCategoryName.getValue()=="checked"),this.chartSettings.putShowVal(this.chValue.getValue()=="checked"),this.chartSettings.putSeparator(_.isEmpty(this.txtSeparator.getValue())?" ":this.txtSeparator.getValue()),this.chartSettings.putShowMarker(this.chMarkers.getValue()=="checked"),e=t==Asc.c_oAscChartTypeSettings.lineNormal||t==Asc.c_oAscChartTypeSettings.lineStacked||t==Asc.c_oAscChartTypeSettings.lineStackedPer||t==Asc.c_oAscChartTypeSettings.scatter,e&&(e=this.cmbLines.getValue(),this.chartSettings.putLine(e!==0),e>0&&this.chartSettings.putSmooth(e==2)),this.chartSettings.putVertAxisProps(this.vertAxisProps),this.chartSettings.putHorAxisProps(this.horAxisProps);var n=this.isAltTitleChanged||this.isAltDescChanged?new Asc.asc_CImgProperty:null;return this.isAltTitleChanged&&n.asc_putTitle(this.inputAltTitle.getValue()),this.isAltDescChanged&&n.asc_putDescription(this.textareaAltDescription.val()),{chartSettings:this.chartSettings,imageSettings:n}}return{chartSettings:this._changedProps}},isRangeValid:function(){if(this.isChart){var e;if(!_.isEmpty(this.txtDataRange.getValue())){e=this.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.Chart,this.txtDataRange.getValue(),!0,this.cmbDataDirect.getValue()==0,this.mnuChartTypePicker.getSelectedRec()[0].get("type"));if(e==Asc.c_oAscError.ID.No)return!0}else this.txtDataRange.showError([this.txtEmpty]);return this.setActiveCategory(0),e==Asc.c_oAscError.ID.StockChartError?Common.UI.warning({msg:this.errorStockChart}):e==Asc.c_oAscError.ID.MaxDataSeriesError?Common.UI.warning({msg:this.errorMaxRows}):this.txtDataRange.cmpEl.find("input").focus(),!1}return!0},onSelectData:function(){var e=this;if(e.api){var t=function(t,n){n=="ok"&&(e.dataRangeValid=t.getSettings(),e.txtDataRange.setValue(e.dataRangeValid),e.txtDataRange.checkValidate())},n=(new SSE.Views.CellRangeDialog({handler:t})).on("close",function(){e.show()}),r=e.$window.offset();e.hide(),n.show(r.left+160,r.top+125),n.setSettings({api:e.api,isRows:e.cmbDataDirect.getValue()==0,range:!_.isEmpty(e.txtDataRange.getValue())&&e.txtDataRange.checkValidate()==1?e.txtDataRange.getValue():e.dataRangeValid,type:Asc.c_oAscSelectionDialogType.Chart})}},onSelectDataLabels:function(e,t,n){var r=t.value==Asc.c_oAscChartDataLabelsPos.none;this.chSeriesName.setDisabled(r),this.chCategoryName.setDisabled(r),this.chValue.setDisabled(r),this.txtSeparator.setDisabled(r),!r&&this.chSeriesName.getValue()!=="checked"&&this.chCategoryName.getValue()!=="checked"&&this.chValue.getValue()!=="checked"&&this.chValue.setValue("checked",!0)},onSelectSparkData:function(){var e=this;if(e.api){var t=function(t,n){n=="ok"&&(e.sparkDataRangeValid=t.getSettings(),e.txtSparkDataRange.setValue(e.sparkDataRangeValid),e.txtSparkDataRange.checkValidate())},n=(new SSE.Views.CellRangeDialog({handler:t})).on("close",function(){e.show()}),r=e.$window.offset();e.hide(),n.show(r.left+160,r.top+125),n.setSettings({api:e.api,range:!_.isEmpty(e.txtSparkDataRange.getValue())&&e.txtSparkDataRange.checkValidate()==1?e.txtSparkDataRange.getValue():e.sparkDataRangeValid,type:Asc.c_oAscSelectionDialogType.Chart})}},onSelectLocationData:function(){var e=this;if(e.api){var t=function(t,n){n=="ok"&&(e.dataLocationRangeValid=t.getSettings(),e.txtSparkDataLocation.setValue(e.dataLocationRangeValid),e.txtSparkDataLocation.checkValidate())},n=(new SSE.Views.CellRangeDialog({handler:t})).on("close",function(){e.show()}),r=e.$window.offset();e.hide(),n.show(r.left+160,r.top+125),n.setSettings({api:e.api,range:!_.isEmpty(e.txtSparkDataLocation.getValue())&&e.txtSparkDataLocation.checkValidate()==1?e.txtSparkDataLocation.getValue():e.dataLocationRangeValid,type:Asc.c_oAscSelectionDialogType.FormatTable})}},show:function(){Common.Views.AdvancedSettingsWindow.prototype.show.apply(this,arguments);var e=this;_.delay(function(){e.txtDataRange.cmpEl.find("input").focus()},50)},close:function(){this.api.asc_onCloseChartFrame(),Common.Views.AdvancedSettingsWindow.prototype.close.apply(this,arguments)},textTitle:"Chart - Advanced Settings",textShowValues:"Display chart values",textShowBorders:"Display chart borders",textLine:"Line",textColumn:"Column",textBar:"Bar",textArea:"Area",textPie:"Pie",textPoint:"XY (Scatter)",textStock:"Stock",textDataRows:"in rows",textDataColumns:"in columns",textDisplayLegend:"Display Legend",textLegendBottom:"Bottom",textLegendTop:"Top",textLegendRight:"Right",textLegendLeft:"Left",textShowAxis:"Display Axis",textShowGrid:"Grid Lines",textDataRange:"Data Range",textChartTitle:"Chart Title",textXAxisTitle:"X Axis Title",textYAxisTitle:"Y Axis Title",txtEmpty:"This field is required",textInvalidRange:"ERROR! Invalid cells range",cancelButtonText:"Cancel",textTypeStyle:"Chart Type, Style &<br/>Data Range",textChartElementsLegend:"Chart Elements &<br/>Chart Legend",textLayout:"Layout",textLegendPos:"Legend",textHorTitle:"Horizontal Axis Title",textVertTitle:"Vertical Axis Title",textDataLabels:"Data Labels",textSeparator:"Data Labels Separator",textSeriesName:"Series Name",textCategoryName:"Category Name",textValue:"Value",textAxisOptions:"Axis Options",textMinValue:"Minimum Value",textMaxValue:"Maximum Value",textAxisCrosses:"Axis Crosses",textUnits:"Display Units",textTickOptions:"Tick Options",textMajorType:"Major Type",textMinorType:"Minor Type",textLabelOptions:"Label Options",textLabelPos:"Label Position",textReverse:"Values in reverse order",textVertAxis:"Vertical Axis",textHorAxis:"Horizontal Axis",textMarksInterval:"Interval between Marks",textLabelDist:"Axis Label Distance",textLabelInterval:"Interval between Labels",textAxisPos:"Axis Position",textLeftOverlay:"Left Overlay",textRightOverlay:"Right Overlay",textOverlay:"Overlay",textNoOverlay:"No Overlay",textRotated:"Rotated",textHorizontal:"Horizontal",textInnerBottom:"Inner Bottom",textInnerTop:"Inner Top",textOuterTop:"Outer Top",textNone:"None",textCenter:"Center",textFixed:"Fixed",textAuto:"Auto",textCross:"Cross",textIn:"In",textOut:"Out",textLow:"Low",textHigh:"High",textNextToAxis:"Next to axis",textHundreds:"Hundreds",textThousands:"Thousands",textTenThousands:"10 000",textHundredThousands:"100 000",textMillions:"Millions",textTenMillions:"10 000 000",textHundredMil:"100 000 000",textBillions:"Billions",textTrillions:"Trillions",textCustom:"Custom",textManual:"Manual",textBetweenTickMarks:"Between Tick Marks",textOnTickMarks:"On Tick Marks",textHorGrid:"Horizontal Gridlines",textVertGrid:"Vertical Gridlines",textLines:"Lines",textMarkers:"Markers",textMajor:"Major",textMinor:"Minor",textMajorMinor:"Major and Minor",textStraight:"Straight",textSmooth:"Smooth",textType:"Type",textTypeData:"Type & Data",textStyle:"Style",textSelectData:"Select Data",textDataSeries:"Data series",errorMaxRows:"ERROR! The maximum number of data series per chart is 255.",errorStockChart:"Incorrect row order. To build a stock chart place the data on the sheet in the following order:<br> opening price, max price, min price, closing price.",textAxisSettings:"Axis Settings",textGridLines:"Gridlines",textShow:"Show",textHide:"Hide",textLeft:"Left",textRight:"Right",textTop:"Top",textBottom:"Bottom",textFit:"Fit Width",textSparkRanges:"Sparkline Ranges",textLocationRange:"Location Range",textEmptyCells:"Hidden and Empty cells",textShowEmptyCells:"Show empty cells as",textShowData:"Show data in hidden rows and columns",textGroup:"Group Sparkline",textSingle:"Single Sparkline",textGaps:"Gaps",textZero:"Zero",textEmptyLine:"Connect data points with line",textLineSpark:"Line",textColumnSpark:"Column",textWinLossSpark:"Win/Loss",textShowSparkAxis:"Show Axis",textReverseOrder:"Reverse order",textAutoEach:"Auto for Each",textSameAll:"Same for All",textTitleSparkline:"Sparkline - Advanced Settings",textAlt:"Alternative Text",textAltTitle:"Title",textAltDescription:"Description",textAltTip:"The alternative text-based representation of the visual object information, which will be read to the people with vision or cognitive impairments to help them better understand what information there is in the image, autoshape, chart or table."},SSE.Views.ChartSettingsDlg||{}))}),define("spreadsheeteditor/main/app/view/ChartSettings",["text!spreadsheeteditor/main/app/template/ChartSettings.template","jquery","underscore","backbone","common/main/lib/component/Button","common/main/lib/component/MetricSpinner","common/main/lib/component/ComboDataView","spreadsheeteditor/main/app/view/ChartSettingsDlg"],function(e,t,n,r){"use strict";SSE.Views.ChartSettings=r.View.extend(n.extend({el:"#id-chart-settings",template:n.template(e),events:{},options:{alias:"ChartSettings"},initialize:function(){this._initSettings=!0,this.txtPt=Common.Utils.Metric.getMetricName(Common.Utils.Metric.c_MetricUnits.pt),this._state={Width:0,Height:0,ChartStyle:1,ChartType:-1,SeveralCharts:!1,DisabledControls:!1,keepRatio:!1,SparkType:-1,SparkStyle:1,LineWeight:1,MarkersPoint:!1,HighPoint:!1,LowPoint:!1,FirstPoint:!1,LastPoint:!1,NegativePoint:!1,SparkColor:"000000",MarkersColor:this.defColor,HighColor:this.defColor,LowColor:this.defColor,FirstColor:this.defColor,LastColor:this.defColor,NegativeColor:this.defColor,SparkId:undefined},this._nRatio=1,this.spinners=[],this.chPoints=[],this.lockedControls=[],this._locked=!1,this.defColor={color:"4f81bd",effectId:24},this.isChart=!0,this._noApply=!1,this._originalProps=null,this.render(),this.ChartSizeContainer=t("#chart-panel-size"),this.ChartTypesContainer=t("#chart-panel-types"),this.SparkTypesContainer=t("#spark-panel-types"),this.SparkPointsContainer=t("#spark-panel-points")},render:function(){var e=t(this.el);e.html(this.template({scope:this}))},setApi:function(e){return this.api=e,this.api&&this.api.asc_registerCallback("asc_onUpdateChartStyles",n.bind(this._onUpdateChartStyles,this)),this},ChangeSettings:function(e){this._initSettings&&this.createDelayedElements(),this.ShowHideElem(!!(e&&e.asc_getChartProperties&&e.asc_getChartProperties())),this.disableControls(this._locked);if(this.api&&e)if(e.asc_getChartProperties&&e.asc_getChartProperties()){this._originalProps=new Asc.asc_CImgProperty(e),this.isChart=!0,this._noApply=!0,this.chartProps=e.asc_getChartProperties();var t=e.asc_getSeveralCharts()||this._locked;this._state.SeveralCharts!==t&&(this.linkAdvanced.toggleClass("disabled",t),this._state.SeveralCharts=t),t=e.asc_getSeveralChartTypes();if(this._state.SeveralCharts&&t)this.btnChartType.setIconCls(""),this._state.ChartType=null;else{var r=this.chartProps.getType();if(this._state.ChartType!==r){var i=this.mnuChartTypePicker.store.findWhere({type:r});this.mnuChartTypePicker.selectRecord(i,!0),i&&this.btnChartType.setIconCls("item-chartlist "+i.get("iconCls")),this.updateChartStyles(this.api.asc_getChartPreviews(r)),this._state.ChartType=r}}t=e.asc_getSeveralChartStyles();if(this._state.SeveralCharts&&t)this.cmbChartStyle.fieldPicker.deselectAll(),this.cmbChartStyle.menuPicker.deselectAll(),this._state.ChartStyle=null;else{t=this.chartProps.getStyle();if(this._state.ChartStyle!==t||this._isChartStylesChanged){this.cmbChartStyle.suspendEvents();var s=this.cmbChartStyle.menuPicker.store.findWhere({data:t});this.cmbChartStyle.menuPicker.selectRecord(s),this.cmbChartStyle.resumeEvents(),this._isChartStylesChanged&&(s?this.cmbChartStyle.fillComboView(this.cmbChartStyle.menuPicker.getSelectedRec()[0],!0):this.cmbChartStyle.fillComboView(this.cmbChartStyle.menuPicker.store.at(0),!0)),this._state.ChartStyle=t}}this._isChartStylesChanged=!1,this._noApply=!1,t=e.asc_getWidth();if(Math.abs(this._state.Width-t)>.001||(this._state.Width===null||t===null)&&this._state.Width!==t)this.spnWidth.setValue(t!==null?Common.Utils.Metric.fnRecalcFromMM(t):"",!0),this._state.Width=t;t=e.asc_getHeight();if(Math.abs(this._state.Height-t)>.001||(this._state.Height===null||t===null)&&this._state.Height!==t)this.spnHeight.setValue(t!==null?Common.Utils.Metric.fnRecalcFromMM(t):"",!0),this._state.Height=t;e.asc_getHeight()>0&&(this._nRatio=e.asc_getWidth()/e.asc_getHeight()),t=e.asc_getLockAspect(),this._state.keepRatio!==t&&(this.btnRatio.toggle(t),this._state.keepRatio=t)}else{this._originalProps=e,this.isChart=!1,this._state.SparkId=e.asc_getId();var r=e.asc_getType(),o=!1;if(this._state.SparkType!==r){var i=this.mnuSparkTypePicker.store.findWhere({type:r});this.mnuSparkTypePicker.selectRecord(i,!0),i&&this.btnSparkType.setIconCls("item-chartlist "+i.get("iconCls")),this._state.SparkType=r,o=!0}var u=e.asc_getLineWeight(),a=Math.abs(this._state.LineWeight-u)<.001&&!(new RegExp(this.txtPt+"\\s*$")).test(this.cmbBorderSize.getRawValue());if(Math.abs(this._state.LineWeight-u)>.001||a||(this._state.LineWeight===null||u===null)&&this._state.LineWeight!==u){this._state.LineWeight=u;var f=u===null?u:n.find(this.cmbBorderSize.store.models,function(e){if(u<e.attributes.value+.01&&u>e.attributes.value-.01)return!0});f?this.cmbBorderSize.selectRecord(f):this.cmbBorderSize.setValue(u!==null?parseFloat(u.toFixed(2))+" "+this.txtPt:""),this.BorderSize=u}this.cmbBorderSize.setDisabled(this._locked||this._state.SparkType!==Asc.c_oAscSparklineType.Line);var l=e.asc_getColorSeries();if(l){this.SparkColor=l.asc_getType()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?{color:Common.Utils.ThemeColor.getHexColor(l.asc_getR(),l.asc_getG(),l.asc_getB()),effectValue:l.asc_getValue()}:Common.Utils.ThemeColor.getHexColor(l.asc_getR(),l.asc_getG(),l.asc_getB());var c=typeof this.SparkColor,h=typeof this._state.SparkColor;if(c!==h||c=="object"&&(this.SparkColor.effectValue!==this._state.SparkColor.effectValue||this._state.SparkColor.color.indexOf(this.SparkColor.color)<0)||c!="object"&&(this._state.SparkColor.indexOf(this.SparkColor)<0||typeof this.btnSparkColor.color=="object")){this.btnSparkColor.setColor(this.SparkColor);if(typeof this.SparkColor=="object"){var p=!1;for(var d=0;d<10;d++)if(Common.Utils.ThemeColor.ThemeValues[d]==this.SparkColor.effectValue){this.colorsSpark.select(this.SparkColor,!0),p=!0;break}p||this.colorsSpark.clearSelection()}else this.colorsSpark.select(this.SparkColor,!0);this._state.SparkColor=this.SparkColor}}var v=e.asc_getMarkersPoint();l=e.asc_getColorMarkers(),this._state.MarkersPoint!==v&&(this.chMarkersPoint.setValue(v!==null&&v!==undefined?v:"indeterminate",!0),this._state.MarkersPoint=v,o=!0),this.chMarkersPoint.setDisabled(this._locked||this._state.SparkType!==Asc.c_oAscSparklineType.Line),this.btnMarkersColor.setDisabled(this._locked||this._state.SparkType!==Asc.c_oAscSparklineType.Line);if(l){this.MarkersColor=l.asc_getType()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?{color:Common.Utils.ThemeColor.getHexColor(l.asc_getR(),l.asc_getG(),l.asc_getB()),effectValue:l.asc_getValue()}:Common.Utils.ThemeColor.getHexColor(l.asc_getR(),l.asc_getG(),l.asc_getB());var c=typeof this.MarkersColor,h=typeof this._state.MarkersColor;if(c!==h||c=="object"&&(this.MarkersColor.effectValue!==this._state.MarkersColor.effectValue||this._state.MarkersColor.color.indexOf(this.MarkersColor.color)<0)||c!="object"&&(this._state.MarkersColor.indexOf(this.MarkersColor)<0||typeof this.btnMarkersColor.color=="object")){this.btnMarkersColor.setColor(this.MarkersColor);if(typeof this.MarkersColor=="object"){var p=!1;for(var d=0;d<10;d++)if(Common.Utils.ThemeColor.ThemeValues[d]==this.MarkersColor.effectValue){this.colorsMarkers.select(this.MarkersColor,!0),p=!0;break}p||this.colorsMarkers.clearSelection()}else this.colorsMarkers.select(this.MarkersColor,!0);this._state.MarkersColor=this.MarkersColor,o=!0}}v=e.asc_getHighPoint(),l=e.asc_getColorHigh(),this._state.HighPoint!==v&&(this.chHighPoint.setValue(v!==null&&v!==undefined?v:"indeterminate",!0),this._state.HighPoint=v,o=!0);if(l){this.HighColor=l.asc_getType()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?{color:Common.Utils.ThemeColor.getHexColor(l.asc_getR(),l.asc_getG(),l.asc_getB()),effectValue:l.asc_getValue()}:Common.Utils.ThemeColor.getHexColor(l.asc_getR(),l.asc_getG(),l.asc_getB());var c=typeof this.HighColor,h=typeof this._state.HighColor;if(c!==h||c=="object"&&(this.HighColor.effectValue!==this._state.HighColor.effectValue||this._state.HighColor.color.indexOf(this.HighColor.color)<0)||c!="object"&&(this._state.HighColor.indexOf(this.HighColor)<0||typeof this.btnHighColor.color=="object")){this.btnHighColor.setColor(this.HighColor);if(typeof this.HighColor=="object"){var p=!1;for(var d=0;d<10;d++)if(Common.Utils.ThemeColor.ThemeValues[d]==this.HighColor.effectValue){this.colorsHigh.select(this.HighColor,!0),p=!0;break}p||this.colorsHigh.clearSelection()}else this.colorsHigh.select(this.HighColor,!0);this._state.HighColor=this.HighColor,o=!0}}v=e.asc_getLowPoint(),l=e.asc_getColorLow(),this._state.LowPoint!==v&&(this.chLowPoint.setValue(v!==null&&v!==undefined?v:"indeterminate",!0),this._state.LowPoint=v,o=!0);if(l){this.LowColor=l.asc_getType()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?{color:Common.Utils.ThemeColor.getHexColor(l.asc_getR(),l.asc_getG(),l.asc_getB()),effectValue:l.asc_getValue()}:Common.Utils.ThemeColor.getHexColor(l.asc_getR(),l.asc_getG(),l.asc_getB());var c=typeof this.LowColor,h=typeof this._state.LowColor;if(c!==h||c=="object"&&(this.LowColor.effectValue!==this._state.LowColor.effectValue||this._state.LowColor.color.indexOf(this.LowColor.color)<0)||c!="object"&&(this._state.LowColor.indexOf(this.LowColor)<0||typeof this.btnLowColor.color=="object")){this.btnLowColor.setColor(this.LowColor);if(typeof this.LowColor=="object"){var p=!1;for(var d=0;d<10;d++)if(Common.Utils.ThemeColor.ThemeValues[d]==this.LowColor.effectValue){this.colorsLow.select(this.LowColor,!0),p=!0;break}p||this.colorsLow.clearSelection()}else this.colorsLow.select(this.LowColor,!0);this._state.LowColor=this.LowColor,o=!0}}v=e.asc_getFirstPoint(),l=e.asc_getColorFirst(),this._state.FirstPoint!==v&&(this.chFirstPoint.setValue(v!==null&&v!==undefined?v:"indeterminate",!0),this._state.FirstPoint=v,o=!0);if(l){this.FirstColor=l.asc_getType()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?{color:Common.Utils.ThemeColor.getHexColor(l.asc_getR(),l.asc_getG(),l.asc_getB()),effectValue:l.asc_getValue()}:Common.Utils.ThemeColor.getHexColor(l.asc_getR(),l.asc_getG(),l.asc_getB());var c=typeof this.FirstColor,h=typeof this._state.FirstColor;if(c!==h||c=="object"&&(this.FirstColor.effectValue!==this._state.FirstColor.effectValue||this._state.FirstColor.color.indexOf(this.FirstColor.color)<0)||c!="object"&&(this._state.FirstColor.indexOf(this.FirstColor)<0||typeof this.btnFirstColor.color=="object")){this.btnFirstColor.setColor(this.FirstColor);if(typeof this.FirstColor=="object"){var p=!1;for(var d=0;d<10;d++)if(Common.Utils.ThemeColor.ThemeValues[d]==this.FirstColor.effectValue){this.colorsFirst.select(this.FirstColor,!0),p=!0;break}p||this.colorsFirst.clearSelection()}else this.colorsFirst.select(this.FirstColor,!0);this._state.FirstColor=this.FirstColor,o=!0}}v=e.asc_getLastPoint(),l=e.asc_getColorLast(),this._state.LastPoint!==v&&(this.chLastPoint.setValue(v!==null&&v!==undefined?v:"indeterminate",!0),this._state.LastPoint=v,o=!0);if(l){this.LastColor=l.asc_getType()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?{color:Common.Utils.ThemeColor.getHexColor(l.asc_getR(),l.asc_getG(),l.asc_getB()),effectValue:l.asc_getValue()}:Common.Utils.ThemeColor.getHexColor(l.asc_getR(),l.asc_getG(),l.asc_getB());var c=typeof this.LastColor,h=typeof this._state.LastColor;if(c!==h||c=="object"&&(this.LastColor.effectValue!==this._state.LastColor.effectValue||this._state.LastColor.color.indexOf(this.LastColor.color)<0)||c!="object"&&(this._state.LastColor.indexOf(this.LastColor)<0||typeof this.btnLastColor.color=="object")){this.btnLastColor.setColor(this.LastColor);if(typeof this.LastColor=="object"){var p=!1;for(var d=0;d<10;d++)if(Common.Utils.ThemeColor.ThemeValues[d]==this.LastColor.effectValue){this.colorsLast.select(this.LastColor,!0),p=!0;break}p||this.colorsLast.clearSelection()}else this.colorsLast.select(this.LastColor,!0);this._state.LastColor=this.LastColor,o=!0}}v=e.asc_getNegativePoint(),l=e.asc_getColorNegative(),this._state.NegativePoint!==v&&(this.chNegativePoint.setValue(v!==null&&v!==undefined?v:"indeterminate",!0),this._state.NegativePoint=v,o=!0);if(l){this.NegativeColor=l.asc_getType()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?{color:Common.Utils.ThemeColor.getHexColor(l.asc_getR(),l.asc_getG(),l.asc_getB()),effectValue:l.asc_getValue()}:Common.Utils.ThemeColor.getHexColor(l.asc_getR(),l.asc_getG(),l.asc_getB());var c=typeof this.NegativeColor,h=typeof this._state.NegativeColor;if(c!==h||c=="object"&&(this.NegativeColor.effectValue!==this._state.NegativeColor.effectValue||this._state.NegativeColor.color.indexOf(this.NegativeColor.color)<0)||c!="object"&&(this._state.NegativeColor.indexOf(this.NegativeColor)<0||typeof this.btnNegativeColor.color=="object")){this.btnNegativeColor.setColor(this.NegativeColor);if(typeof this.NegativeColor=="object"){var p=!1;for(var d=0;d<10;d++)if(Common.Utils.ThemeColor.ThemeValues[d]==this.NegativeColor.effectValue){this.colorsNegative.select(this.NegativeColor,!0),p=!0;break}p||this.colorsNegative.clearSelection()}else this.colorsNegative.select(this.NegativeColor,!0);this._state.NegativeColor=this.NegativeColor,o=!0}}o&&this.updateSparkStyles(e.asc_getStyles())}},updateMetricUnit:function(){if(this.spinners)for(var e=0;e<this.spinners.length;e++){var t=this.spinners[e];t.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName()),t.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt?1:.1)}},UpdateThemeColors:function(){var e;this.btnSparkColor||(e=this.defColor,this.btnSparkColor=new Common.UI.ColorButton({style:"width:45px;",menu:new Common.UI.Menu({items:[{template:n.template('<div id="spark-color-menu" style="width: 169px; height: 220px; margin: 10px;"></div>')},{template:n.template('<a id="spark-color-new" style="padding-left:12px;">'+this.textNewColor+"</a>")}]})}),this.btnSparkColor.render(t("#spark-color-btn")),this.btnSparkColor.setColor("000000"),this.lockedControls.push(this.btnSparkColor),this.colorsSpark=new Common.UI.ThemeColorPalette({el:t("#spark-color-menu"),value:"000000"}),this.colorsSpark.on("select",n.bind(this.onColorsSparkSelect,this)),t(this.el).on("click","#spark-color-new",n.bind(this.addNewColor,this,this.colorsSpark,this.btnSparkColor)),this.btnHighColor=(new Common.UI.ColorButton({style:"width:45px;",menu:new Common.UI.Menu({items:[{template:n.template('<div id="spark-high-color-menu" style="width: 169px; height: 220px; margin: 10px;"></div>')},{template:n.template('<a id="spark-high-color-new" style="padding-left:12px;">'+this.textNewColor+"</a>")}]})})).render(t("#spark-high-color-btn")),this.btnHighColor.setColor(this.defColor.color),this.lockedControls.push(this.btnHighColor),this.colorsHigh=new Common.UI.ThemeColorPalette({el:t("#spark-high-color-menu")}),this.colorsHigh.on("select",n.bind(this.onColorsPointSelect,this,0,this.btnHighColor)),t(this.el).on("click","#spark-high-color-new",n.bind(this.addNewColor,this,this.colorsHigh,this.btnHighColor)),this.btnLowColor=(new Common.UI.ColorButton({style:"width:45px;",menu:new Common.UI.Menu({items:[{template:n.template('<div id="spark-low-color-menu" style="width: 169px; height: 220px; margin: 10px;"></div>')},{template:n.template('<a id="spark-low-color-new" style="padding-left:12px;">'+this.textNewColor+"</a>")}]})})).render(t("#spark-low-color-btn")),this.btnLowColor.setColor(this.defColor.color),this.lockedControls.push(this.btnLowColor),this.colorsLow=new Common.UI.ThemeColorPalette({el:t("#spark-low-color-menu")}),this.colorsLow.on("select",n.bind(this.onColorsPointSelect,this,1,this.btnLowColor)),t(this.el).on("click","#spark-low-color-new",n.bind(this.addNewColor,this,this.colorsLow,this.btnLowColor)),this.btnNegativeColor=(new Common.UI.ColorButton({style:"width:45px;",menu:new Common.UI.Menu({items:[{template:n.template('<div id="spark-negative-color-menu" style="width: 169px; height: 220px; margin: 10px;"></div>')},{template:n.template('<a id="spark-negative-color-new" style="padding-left:12px;">'+this.textNewColor+"</a>")}]})})).render(t("#spark-negative-color-btn")),this.btnNegativeColor.setColor(this.defColor.color),this.lockedControls.push(this.btnNegativeColor),this.colorsNegative=new Common.UI.ThemeColorPalette({el:t("#spark-negative-color-menu")}),this.colorsNegative.on("select",n.bind(this.onColorsPointSelect,this,2,this.btnNegativeColor)),t(this.el).on("click","#spark-negative-color-new",n.bind(this.addNewColor,this,this.colorsNegative,this.btnNegativeColor)),this.btnFirstColor=(new Common.UI.ColorButton({style:"width:45px;",menu:new Common.UI.Menu({items:[{template:n.template('<div id="spark-first-color-menu" style="width: 169px; height: 220px; margin: 10px;"></div>')},{template:n.template('<a id="spark-first-color-new" style="padding-left:12px;">'+this.textNewColor+"</a>")}]})})).render(t("#spark-first-color-btn")),this.lockedControls.push(this.btnFirstColor),this.colorsFirst=new Common.UI.ThemeColorPalette({el:t("#spark-first-color-menu")}),this.colorsFirst.on("select",n.bind(this.onColorsPointSelect,this,3,this.btnFirstColor)),t(this.el).on("click","#spark-first-color-new",n.bind(this.addNewColor,this,this.colorsFirst,this.btnFirstColor)),this.btnFirstColor.setColor(this.defColor.color),this.btnLastColor=(new Common.UI.ColorButton({style:"width:45px;",menu:new Common.UI.Menu({items:[{template:n.template('<div id="spark-last-color-menu" style="width: 169px; height: 220px; margin: 10px;"></div>')},{template:n.template('<a id="spark-last-color-new" style="padding-left:12px;">'+this.textNewColor+"</a>")}]})})).render(t("#spark-last-color-btn")),this.btnLastColor.setColor(this.defColor.color),this.lockedControls.push(this.btnLastColor),this.colorsLast=new Common.UI.ThemeColorPalette({el:t("#spark-last-color-menu")}),this.colorsLast.on("select",n.bind(this.onColorsPointSelect,this,4,this.btnLastColor)),t(this.el).on("click","#spark-last-color-new",n.bind(this.addNewColor,this,this.colorsLast,this.btnLastColor)),this.btnMarkersColor=(new Common.UI.ColorButton({style:"width:45px;",menu:new Common.UI.Menu({items:[{template:n.template('<div id="spark-markers-color-menu" style="width: 169px; height: 220px; margin: 10px;"></div>')},{template:n.template('<a id="spark-markers-color-new" style="padding-left:12px;">'+this.textNewColor+"</a>")}]})})).render(t("#spark-markers-color-btn")),this.btnMarkersColor.setColor(this.defColor.color),this.lockedControls.push(this.btnMarkersColor),this.colorsMarkers=new Common.UI.ThemeColorPalette({el:t("#spark-markers-color-menu")}),this.colorsMarkers.on("select",n.bind(this.onColorsPointSelect,this,5,this.btnMarkersColor)),t(this.el).on("click","#spark-markers-color-new",n.bind(this.addNewColor,this,this.colorsMarkers,this.btnMarkersColor))),this.colorsSpark.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors()),this.colorsHigh.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors(),e),this.colorsLow.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors(),e),this.colorsNegative.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors(),e),this.colorsFirst.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors(),e),this.colorsLast.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors(),e),this.colorsMarkers.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors(),e),this.btnSparkColor.setColor(this.colorsSpark.getColor()),this.btnHighColor.setColor(this.colorsHigh.getColor()),this.btnLowColor.setColor(this.colorsLow.getColor()),this.btnNegativeColor.setColor(this.colorsNegative.getColor()),this.btnFirstColor.setColor(this.colorsFirst.getColor()),this.btnLastColor.setColor(this.colorsLast.getColor()),this.btnMarkersColor.setColor(this.colorsMarkers.getColor())},createDelayedControls:function(){var e=this;this.btnChartType=new Common.UI.Button({cls:"btn-large-dataview",iconCls:"item-chartlist bar-normal",menu:new Common.UI.Menu({style:"width: 435px; padding-top: 12px;",items:[{template:n.template('<div id="id-chart-menu-type" class="menu-insertchart" style="margin: 5px 5px 5px 10px;"></div>')}]})}),this.btnChartType.on("render:after",function(r){e.mnuChartTypePicker=new Common.UI.DataView({el:t("#id-chart-menu-type"),parentMenu:r.menu,restoreHeight:421,groups:new Common.UI.DataViewGroupStore([{id:"menu-chart-group-bar",caption:e.textColumn},{id:"menu-chart-group-line",caption:e.textLine},{id:"menu-chart-group-pie",caption:e.textPie},{id:"menu-chart-group-hbar",caption:e.textBar},{id:"menu-chart-group-area",caption:e.textArea,inline:!0},{id:"menu-chart-group-scatter",caption:e.textPoint,inline:!0},{id:"menu-chart-group-stock",caption:e.textStock,inline:!0}]),store:new Common.UI.DataViewStore([{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barNormal,iconCls:"column-normal",selected:!0},{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barStacked,iconCls:"column-stack"},{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barStackedPer,iconCls:"column-pstack"},{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barNormal3d,iconCls:"column-3d-normal"},{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barStacked3d,iconCls:"column-3d-stack"},{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barStackedPer3d,iconCls:"column-3d-pstack"},{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barNormal3dPerspective,iconCls:"column-3d-normal-per"},{group:"menu-chart-group-line",type:Asc.c_oAscChartTypeSettings.lineNormal,iconCls:"line-normal"},{group:"menu-chart-group-line",type:Asc.c_oAscChartTypeSettings.lineStacked,iconCls:"line-stack"},{group:"menu-chart-group-line",type:Asc.c_oAscChartTypeSettings.lineStackedPer,iconCls:"line-pstack"},{group:"menu-chart-group-line",type:Asc.c_oAscChartTypeSettings.line3d,iconCls:"line-3d"},{group:"menu-chart-group-pie",type:Asc.c_oAscChartTypeSettings.pie,iconCls:"pie-normal"},{group:"menu-chart-group-pie",type:Asc.c_oAscChartTypeSettings.doughnut,iconCls:"pie-doughnut"},{group:"menu-chart-group-pie",type:Asc.c_oAscChartTypeSettings.pie3d,iconCls:"pie-3d-normal"},{group:"menu-chart-group-hbar",type:Asc.c_oAscChartTypeSettings.hBarNormal,iconCls:"bar-normal"},{group:"menu-chart-group-hbar",type:Asc.c_oAscChartTypeSettings.hBarStacked,iconCls:"bar-stack"},{group:"menu-chart-group-hbar",type:Asc.c_oAscChartTypeSettings.hBarStackedPer,iconCls:"bar-pstack"},{group:"menu-chart-group-hbar",type:Asc.c_oAscChartTypeSettings.hBarNormal3d,iconCls:"bar-3d-normal"},{group:"menu-chart-group-hbar",type:Asc.c_oAscChartTypeSettings.hBarStacked3d,iconCls:"bar-3d-stack"},{group:"menu-chart-group-hbar",type:Asc.c_oAscChartTypeSettings.hBarStackedPer3d,iconCls:"bar-3d-pstack"},{group:"menu-chart-group-area",type:Asc.c_oAscChartTypeSettings.areaNormal,iconCls:"area-normal"},{group:"menu-chart-group-area",type:Asc.c_oAscChartTypeSettings.areaStacked,iconCls:"area-stack"},{group:"menu-chart-group-area",type:Asc.c_oAscChartTypeSettings.areaStackedPer,iconCls:"area-pstack"},{group:"menu-chart-group-scatter",type:Asc.c_oAscChartTypeSettings.scatter,iconCls:"point-normal"},{group:"menu-chart-group-stock",type:Asc.c_oAscChartTypeSettings.stock,iconCls:"stock-normal"}]),itemTemplate:n.template('<div id="<%= id %>" class="item-chartlist <%= iconCls %>"></div>')})}),this.btnChartType.render(t("#chart-button-type")),this.mnuChartTypePicker.on("item:click",n.bind(this.onSelectType,this,this.btnChartType)),this.lockedControls.push(this.btnChartType),this.spnWidth=new Common.UI.MetricSpinner({el:t("#chart-spin-width"),step:.1,width:78,defaultUnit:"cm",value:"3 cm",maxValue:55.88,minValue:0}),this.spinners.push(this.spnWidth),this.lockedControls.push(this.spnWidth),this.spnHeight=new Common.UI.MetricSpinner({el:t("#chart-spin-height"),step:.1,width:78,defaultUnit:"cm",value:"3 cm",maxValue:55.88,minValue:0}),this.spinners.push(this.spnHeight),this.lockedControls.push(this.spnHeight),this.spnWidth.on("change",n.bind(this.onWidthChange,this)),this.spnHeight.on("change",n.bind(this.onHeightChange,this)),this.btnRatio=new Common.UI.Button({cls:"btn-toolbar",iconCls:"advanced-btn-ratio",style:"margin-bottom: 1px;",enableToggle:!0,hint:this.textKeepRatio}),this.btnRatio.render(t("#chart-button-ratio")),this.lockedControls.push(this.btnRatio),this.btnRatio.on("click",n.bind(function(e,t){e.pressed&&this.spnHeight.getNumberValue()>0&&(this._nRatio=this.spnWidth.getNumberValue()/this.spnHeight.getNumberValue());if(this.api){var n=new Asc.asc_CImgProperty;n.asc_putLockAspect(e.pressed),this.api.asc_setGraphicObjectProps(n)}},this)),this.btnSparkType=new Common.UI.Button({cls:"btn-large-dataview",iconCls:"item-chartlist spark-column",menu:new Common.UI.Menu({style:"width: 200px; padding-top: 12px;",items:[{template:n.template('<div id="id-spark-menu-type" class="menu-insertchart" style="margin: 5px 5px 0 10px;"></div>')}]})}),this.btnSparkType.on("render:after",function(r){e.mnuSparkTypePicker=new Common.UI.DataView({el:t("#id-spark-menu-type"),parentMenu:r.menu,restoreHeight:120,allowScrollbar:!1,groups:new Common.UI.DataViewGroupStore([{id:"menu-chart-group-sparkcolumn",inline:!0},{id:"menu-chart-group-sparkline",inline:!0},{id:"menu-chart-group-sparkwin",inline:!0}]),store:new Common.UI.DataViewStore([{group:"menu-chart-group-sparkcolumn",type:Asc.c_oAscSparklineType.Column,allowSelected:!0,iconCls:"spark-column",tip:e.textColumnSpark},{group:"menu-chart-group-sparkline",type:Asc.c_oAscSparklineType.Line,allowSelected:!0,iconCls:"spark-line",tip:e.textLineSpark},{group:"menu-chart-group-sparkwin",type:Asc.c_oAscSparklineType.Stacked,allowSelected:!0,iconCls:"spark-win",tip:e.textWinLossSpark}]),itemTemplate:n.template('<div id="<%= id %>" class="item-chartlist <%= iconCls %>"></div>')})}),this.btnSparkType.render(t("#spark-button-type")),this.mnuSparkTypePicker.on("item:click",n.bind(this.onSelectSparkType,this,this.btnSparkType)),this.lockedControls.push(this.btnSparkType),this.cmbBorderSize=(new Common.UI.ComboBorderSizeEditable({el:t("#spark-combo-line-type"),style:"width: 90px;",allowNoBorders:!1})).on("selected",n.bind(this.onBorderSizeSelect,this)).on("changed:before",n.bind(this.onBorderSizeChanged,this,!0)).on("changed:after",n.bind(this.onBorderSizeChanged,this,!1)),this.BorderSize=this.cmbBorderSize.store.at(1).get("value"),this.cmbBorderSize.setValue(this.BorderSize),this.lockedControls.push(this.cmbBorderSize),this.chHighPoint=new Common.UI.CheckBox({el:t("#spark-checkbox-high"),labelText:this.textHighPoint}),this.lockedControls.push(this.chHighPoint),this.chPoints.push(this.chHighPoint),this.chLowPoint=new Common.UI.CheckBox({el:t("#spark-checkbox-low"),labelText:this.textLowPoint}),this.lockedControls.push(this.chLowPoint),this.chPoints.push(this.chLowPoint),this.chNegativePoint=new Common.UI.CheckBox({el:t("#spark-checkbox-negative"),labelText:this.textNegativePoint}),this.lockedControls.push(this.chNegativePoint),this.chPoints.push(this.chNegativePoint),this.chFirstPoint=new Common.UI.CheckBox({el:t("#spark-checkbox-first"),labelText:this.textFirstPoint}),this.lockedControls.push(this.chFirstPoint),this.chPoints.push(this.chFirstPoint),this.chLastPoint=new Common.UI.CheckBox({el:t("#spark-checkbox-last"),labelText:this.textLastPoint}),this.lockedControls.push(this.chLastPoint),this.chPoints.push(this.chLastPoint),this.chMarkersPoint=new Common.UI.CheckBox({el:t("#spark-checkbox-markers"),labelText:this.textMarkers}),this.lockedControls.push(this.chMarkersPoint),this.chPoints.push(this.chMarkersPoint),this.chHighPoint.on("change",n.bind(this.onCheckPointChange,this,0)),this.chLowPoint.on("change",n.bind(this.onCheckPointChange,this,1)),this.chNegativePoint.on("change",n.bind(this.onCheckPointChange,this,2)),this.chFirstPoint.on("change",n.bind(this.onCheckPointChange,this,3)),this.chLastPoint.on("change",n.bind(this.onCheckPointChange,this,4)),this.chMarkersPoint.on("change",n.bind(this.onCheckPointChange,this,5)),this.btnSelectData=new Common.UI.Button({el:t("#chart-btn-select-data")}),this.btnSelectData.on("click",n.bind(this.onSelectData,this)),this.lockedControls.push(this.btnSelectData),this.linkAdvanced=t("#chart-advanced-link"),t(this.el).on("click","#chart-advanced-link",n.bind(this.openAdvancedSettings,this))},createDelayedElements:function(){this.createDelayedControls(),this.updateMetricUnit(),this.UpdateThemeColors(),this._initSettings=!1},ShowHideElem:function(e){this.ChartSizeContainer.toggleClass("settings-hidden",!e),this.ChartTypesContainer.toggleClass("settings-hidden",!e),this.SparkTypesContainer.toggleClass("settings-hidden",e),this.SparkPointsContainer.toggleClass("settings-hidden",e)},onWidthChange:function(e,t,n,r){var i=e.getNumberValue(),s=this.spnHeight.getNumberValue();this.btnRatio.pressed&&(s=i/this._nRatio,s>this.spnHeight.options.maxValue&&(s=this.spnHeight.options.maxValue,i=s*this._nRatio,this.spnWidth.setValue(i,!0)),this.spnHeight.setValue(s,!0));if(this.api){var o=new Asc.asc_CImgProperty;o.asc_putWidth(Common.Utils.Metric.fnRecalcToMM(i)),o.asc_putHeight(Common.Utils.Metric.fnRecalcToMM(s)),this.api.asc_setGraphicObjectProps(o)}Common.NotificationCenter.trigger("edit:complete",this)},onHeightChange:function(e,t,n,r){var i=e.getNumberValue(),s=this.spnWidth.getNumberValue();this.btnRatio.pressed&&(s=i*this._nRatio,s>this.spnWidth.options.maxValue&&(s=this.spnWidth.options.maxValue,i=s/this._nRatio,this.spnHeight.setValue(i,!0)),this.spnWidth.setValue(s,!0));if(this.api){var o=new Asc.asc_CImgProperty;o.asc_putWidth(Common.Utils.Metric.fnRecalcToMM(s)),o.asc_putHeight(Common.Utils.Metric.fnRecalcToMM(i)),this.api.asc_setGraphicObjectProps(o)}Common.NotificationCenter.trigger("edit:complete",this)},openAdvancedSettings:function(){if(this.linkAdvanced.hasClass("disabled"))return;var e=this,t,n;e.api&&(n=e.isChart?e.api.asc_getChartObject():e._originalProps,n&&(new SSE.Views.ChartSettingsDlg({chartSettings:n,imageSettings:e.isChart?e._originalProps:null,isChart:e.isChart,api:e.api,handler:function(t,n){t=="ok"&&e.api&&(e.isChart?(e.api.asc_editChartDrawingObject(n.chartSettings),n.imageSettings&&e.api.asc_setGraphicObjectProps(n.imageSettings)):e.api.asc_setSparklineGroup(e._state.SparkId,n.chartSettings)),Common.NotificationCenter.trigger("edit:complete",e)}})).show())},onSelectData:function(){var e=this;if(e.api){var t=e.api.asc_getChartObject(),r=function(n,r){r=="ok"&&(t.putRange(n.getSettings()),e.api.asc_setSelectionDialogMode(Asc.c_oAscSelectionDialogType.None),e.api.asc_editChartDrawingObject(t)),Common.NotificationCenter.trigger("edit:complete",e.toolbar)},i=function(r){var i;return n.isEmpty(r)?"":(i=e.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.Chart,r,!0,!t.getInColumns(),e._state.ChartType),i==Asc.c_oAscError.ID.No?!0:i==Asc.c_oAscError.ID.StockChartError?this.errorStockChart:i==Asc.c_oAscError.ID.MaxDataSeriesError?this.errorMaxRows:this.txtInvalidRange)},s=new SSE.Views.CellRangeDialog({handler:r});s.show(),s.setSettings({api:e.api,range:t.getRange(),validation:i,type:Asc.c_oAscSelectionDialogType.Chart})}},onSelectType:function(e,t,r,i){if(this._noApply)return;var s={},o=n.isFunction(i.toJSON);if(o){if(!i.get("selected"))return;s=i.toJSON()}else s=i;this.btnChartType.setIconCls("item-chartlist "+s.iconCls),this._state.ChartType=-1;if(this.api&&!this._noApply&&this.chartProps){var u=new Asc.asc_CImgProperty;this.chartProps.changeType(s.type),u.asc_putChartProperties(this.chartProps),this.api.asc_setGraphicObjectProps(u)}Common.NotificationCenter.trigger("edit:complete",this)},onSelectStyle:function(e,t){if(this._noApply)return;if(this.api&&!this._noApply&&this.chartProps){var n=new Asc.asc_CImgProperty;this.chartProps.putStyle(t.get("data")),n.asc_putChartProperties(this.chartProps),this.api.asc_setGraphicObjectProps(n)}Common.NotificationCenter.trigger("edit:complete",this)},_onUpdateChartStyles:function(){this.api&&this._state.ChartType!==null&&this._state.ChartType>-1&&this.updateChartStyles(this.api.asc_getChartPreviews(this._state.ChartType))},updateChartStyles:function(e){var r=this;this._isChartStylesChanged=!0,this.cmbChartStyle||(this.cmbChartStyle=new Common.UI.ComboDataView({itemWidth:50,itemHeight:50,menuMaxHeight:270,enableKeyEvents:!0,cls:"combo-chart-style"}),this.cmbChartStyle.render(t("#chart-combo-style")),this.cmbChartStyle.openButton.menu.cmpEl.css({"min-width":178,"max-width":178}),this.cmbChartStyle.on("click",n.bind(this.onSelectStyle,this)),this.cmbChartStyle.openButton.menu.on("show:after",function(){r.cmbChartStyle.menuPicker.scroller.update({alwaysVisibleY:!0})}),this.lockedControls.push(this.cmbChartStyle));if(e&&e.length>0){var i=this.cmbChartStyle.menuPicker.store;if(i){var s=i.length;if(s>0&&s==e.length){var o=i.models;n.each(e,function(e,t){o[t].set("imageUrl",e.asc_getImageUrl())})}else{var u=[],a=-1;n.each(e,function(e,t){u.push({imageUrl:e.asc_getImageUrl(),data:e.asc_getStyle(),tip:r.textStyle+" "+e.asc_getStyle()})}),i.reset(u,{silent:!1})}}}},updateSparkStyles:function(e){var r=this;this.cmbSparkStyle||(this.cmbSparkStyle=new Common.UI.ComboDataView({itemWidth:50,itemHeight:50,menuMaxHeight:272,enableKeyEvents:!0,cls:"combo-spark-style"}),this.cmbSparkStyle.render(t("#spark-combo-style")),this.cmbSparkStyle.openButton.menu.cmpEl.css({"min-width":178,"max-width":178}),this.cmbSparkStyle.on("click",n.bind(this.onSelectSparkStyle,this)),this.cmbSparkStyle.openButton.menu.on("show:after",function(){r.cmbSparkStyle.menuPicker.scroller.update({alwaysVisibleY:!0})}),this.lockedControls.push(this.cmbSparkStyle));if(e&&e.length>1){var i=this.cmbSparkStyle.menuPicker.store,s=e[e.length-1];if(i.length==e.length-1){var o=i.models;for(var u=0;u<e.length-1;u++)o[u].set("imageUrl",e[u]);s<0?(this.cmbSparkStyle.fillComboView(i.at(0),!1),this.cmbSparkStyle.fieldPicker.deselectAll(),this.cmbSparkStyle.menuPicker.deselectAll()):this.cmbSparkStyle.menuPicker.selectRecord(i.at(s))}else{var a=[];for(var u=0;u<e.length-1;u++)a.push({imageUrl:e[u],data:u});i.reset(a,{silent:!1}),this.cmbSparkStyle.fillComboView(i.at(s<0?0:s),s>-1)}}},onSelectSparkType:function(e,t,r,i){var s={},o=n.isFunction(i.toJSON);if(o){if(!i.get("selected"))return;s=i.toJSON()}else s=i;this.btnSparkType.setIconCls("item-chartlist "+s.iconCls),this._state.SparkType=-1;if(this.api&&!this._noApply&&this._originalProps){var u=new Asc.sparklineGroup;u.asc_setType(s.type),this.api.asc_setSparklineGroup(this._state.SparkId,u)}Common.NotificationCenter.trigger("edit:complete",this)},onSelectSparkStyle:function(e,t){if(this._noApply)return;if(this.api&&!this._noApply&&this._originalProps){var n=new Asc.sparklineGroup;n.asc_setStyle(t.get("data")),this.api.asc_setSparklineGroup(this._state.SparkId,n)}Common.NotificationCenter.trigger("edit:complete",this)},applyBorderSize:function(e){e=parseFloat(e),e=isNaN(e)?1:Math.max(.01,Math.min(1584,e)),this.BorderSize=e;if(this.api&&!this._noApply&&this._originalProps){var t=new Asc.sparklineGroup;t.asc_setLineWeight(this.BorderSize),this.api.asc_setSparklineGroup(this._state.SparkId,t),Common.NotificationCenter.trigger("edit:complete",this)}},onBorderSizeChanged:function(e,t,r,i){var s=this;if(e){var o=parseFloat(r.value),u=new RegExp("^\\s*(\\d*(\\.|,)?\\d+)\\s*("+s.txtPt+")?\\s*$");if(!u.exec(r.value)||o<.01||o>1584)this._state.LineWeight=-1,Common.UI.error({msg:this.textBorderSizeErr,callback:function(){n.defer(function(e){Common.NotificationCenter.trigger("edit:complete",s)})}})}else this.applyBorderSize(r.value)},onBorderSizeSelect:function(e,t){this.applyBorderSize(t.value)},onColorsSparkSelect:function(e,t){this.btnSparkColor.setColor(t);if(this.api&&!this._noApply&&this._originalProps){var n=new Asc.sparklineGroup;n.asc_setColorSeries(Common.Utils.ThemeColor.getRgbColor(t)),this.api.asc_setSparklineGroup(this._state.SparkId,n)}Common.NotificationCenter.trigger("edit:complete",this)},addNewColor:function(e,t){e.addNewColor(typeof t.color=="object"?t.color.color:t.color)},onCheckPointChange:function(e,t,n,r,i){if(this.api&&!this._noApply&&this._originalProps){var s=new Asc.sparklineGroup;switch(e){case 0:s.asc_setHighPoint(t.getValue()=="checked");break;case 1:s.asc_setLowPoint(t.getValue()=="checked");break;case 2:s.asc_setNegativePoint(t.getValue()=="checked");break;case 3:s.asc_setFirstPoint(t.getValue()=="checked");break;case 4:s.asc_setLastPoint(t.getValue()=="checked");break;case 5:s.asc_setMarkersPoint(t.getValue()=="checked")}this.api.asc_setSparklineGroup(this._state.SparkId,s)}Common.NotificationCenter.trigger("edit:complete",this)},onColorsPointSelect:function(e,t,n,r){t.setColor(r),this.chPoints[e].getValue()!=="checked"&&this.chPoints[e].setValue(!0,!0);if(this.api&&!this._noApply&&this._originalProps){var i=new Asc.sparklineGroup;switch(e){case 0:i.asc_setHighPoint(!0),i.asc_setColorHigh(Common.Utils.ThemeColor.getRgbColor(r));break;case 1:i.asc_setLowPoint(!0),i.asc_setColorLow(Common.Utils.ThemeColor.getRgbColor(r));break;case 2:i.asc_setNegativePoint(!0),i.asc_setColorNegative(Common.Utils.ThemeColor.getRgbColor(r));break;case 3:i.asc_setFirstPoint(!0),i.asc_setColorFirst(Common.Utils.ThemeColor.getRgbColor(r));break;case 4:i.asc_setLastPoint(!0),i.asc_setColorLast(Common.Utils.ThemeColor.getRgbColor(r));break;case 5:i.asc_setMarkersPoint(!0),i.asc_setColorMarkers(Common.Utils.ThemeColor.getRgbColor(r))}this.api.asc_setSparklineGroup(this._state.SparkId,i)}Common.NotificationCenter.trigger("edit:complete",this)},setLocked:function(e){this._locked=e},disableControls:function(e){if(this._initSettings)return;this._state.DisabledControls!==e&&(this._state.DisabledControls=e,n.each(this.lockedControls,function(t){t.setDisabled(e)}),this.linkAdvanced.toggleClass("disabled",e))},textKeepRatio:"Constant Proportions",textSize:"Size",textWidth:"Width",textHeight:"Height",textEditData:"Edit Data and Location",textChartType:"Change Chart Type",textLine:"Line",textColumn:"Column",textBar:"Bar",textArea:"Area",textPie:"Pie",textPoint:"XY (Scatter)",textStock:"Stock",textStyle:"Style",textAdvanced:"Show advanced settings",strSparkColor:"Color",strLineWeight:"Line Weight",textMarkers:"Markers",textNewColor:"Add New Custom Color",textLineSpark:"Line",textColumnSpark:"Column",textWinLossSpark:"Win/Loss",textHighPoint:"High Point",textLowPoint:"Low Point",textNegativePoint:"Negative Point",textFirstPoint:"First Point",textLastPoint:"Last Point",strTemplate:"Template",textShow:"Show",textType:"Type",textSelectData:"Select Data",textRanges:"Data Range",textBorderSizeErr:"The entered value is incorrect.<br>Please enter a value between 0 pt and 1584 pt."},SSE.Views.ChartSettings||{}))}),define("text!spreadsheeteditor/main/app/template/ShapeSettings.template",[],function(){return'<table cols="1">\r\n <tr>\r\n <td>\r\n <label class="header"><%= scope.strFill %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <div id="shape-combo-fill-src" style="width: 100%;"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td>\r\n <div id="shape-panel-color-fill" class="padding-small" style="width: 100%;">\r\n <div id="shape-back-color-btn" style=""></div>\r\n </div>\r\n <div id="shape-panel-image-fill" class="settings-hidden padding-small" style="width: 100%;">\r\n <table cols="2" style="width: 100%;">\r\n <tr>\r\n <td class="padding-small" width="50%">\r\n <button type="button" class="btn btn-text-default" id="shape-button-from-file" style="width:90px;"><%= scope.textFromFile %></button>\r\n </td>\r\n <td class="padding-small" width="50%">\r\n <button type="button" class="btn btn-text-default" id="shape-button-from-url" style="width:90px;float:right;"><%= scope.textFromUrl %></button>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td style="vertical-align: top">\r\n <div id="shape-combo-fill-type" style="width: 90px;"></div>\r\n </td>\r\n <td rowspan="2">\r\n <div style="width: 90px; height: 80px; padding: 14px 20px; border: 1px solid #AFAFAF; border-radius: 2px; background: #ffffff;float:right;">\r\n <div id="shape-texture-img" style="width: 50px;height: 50px;"></div>\r\n </div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td style="vertical-align: bottom">\r\n <label class="input-label" style=""><%= scope.textTexture %></label>\r\n <div id="shape-combo-fill-texture" style="width: 90px;"></div>\r\n </td>\r\n </tr>\r\n </table>\r\n </div>\r\n <div id="shape-panel-pattern-fill" class="settings-hidden padding-small" style="width: 100%;">\r\n <label class="input-label" style="margin-top: 3px;"><%= scope.strPattern %></label>\r\n <div id="shape-combo-pattern" style="width: 100%; height: 42px; margin-bottom: 8px;"></div>\r\n <div style="width: 100%; height: 25px; margin-bottom: 8px;">\r\n <label class="input-label" style="margin-top: 3px;"><%= scope.strForeground %></label>\r\n <div id="shape-foreground-color-btn" style="display: inline-block; float:right;"></div>\r\n </div>\r\n <div style="width: 100%; height: 25px;">\r\n <label class="input-label" style="margin-top: 3px;"><%= scope.strBackground %></label>\r\n <div id="shape-background-color-btn" style="display: inline-block; float:right;"></div>\r\n </div>\r\n </div>\r\n <div id="shape-panel-gradient-fill" class="settings-hidden padding-small" style="width: 100%;">\r\n <div style="height:80px;">\r\n <div style="display: inline-block;">\r\n <label class="input-label" style=""><%= scope.textStyle %></label>\r\n <div id="shape-combo-grad-type" style="width: 90px;"></div>\r\n </div>\r\n <div style="display: inline-block;float: right;">\r\n <label class="input-label" style=""><%= scope.textDirection %></label>\r\n <div id="shape-button-direction" style=""></div>\r\n </div>\r\n </div>\r\n <label class="header" style="display:block;margin-bottom: 5px;"><%= scope.textGradient %></label>\r\n <div style="display: inline-block; margin-top: 3px;">\r\n <div id="shape-slider-gradient" style="display: inline-block; vertical-align: middle;"></div>\r\n </div>\r\n <div id="shape-gradient-color-btn" style="display: inline-block;float: right;"></div>\r\n </div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td>\r\n <div class="padding-small" id="shape-panel-transparent-fill" style="width: 100%;">\r\n <label class="header" style="display:block;"><%= scope.strTransparency %></label>\r\n <div style="display: inline-block; margin-top: 3px;">\r\n <label id="shape-lbl-transparency-start">0</label>\r\n <div id="shape-slider-transparency" style="display: inline-block;margin: 0 4px; vertical-align: middle;"></div>\r\n <label id="shape-lbl-transparency-end">100</label>\r\n </div>\r\n <div id="shape-spin-transparency" style="display: inline-block;float: right;"></div>\r\n </div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <div class="separator horizontal"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td>\r\n <label class="header"><%= scope.strStroke %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td>\r\n <div style="display:inline-block;width:100px;vertical-align: middle;">\r\n <label class="input-label" style=""><%= scope.strSize %></label>\r\n <div id="shape-combo-border-size" style="width: 93px;"></div>\r\n </div>\r\n <div style="display:inline-block;vertical-align: middle;">\r\n <label class="input-label" style=""><%= scope.strColor %></label>\r\n <div id="shape-border-color-btn" style=""></div>\r\n </div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <div style="display:inline-block;width:100px;vertical-align: middle;">\r\n <label class="input-label" style=""><%= scope.strType %></label>\r\n <div id="shape-combo-border-type" style="width: 93px;"></div>\r\n </div>\r\n </td>\r\n </tr>\r\n <tr class="shape-only">\r\n <td class="padding-small"></td>\r\n </tr>\r\n <tr class="shape-only">\r\n <td class="padding-small">\r\n <div class="separator horizontal"></div>\r\n </td>\r\n </tr>\r\n <tr class="shape-only change-type">\r\n <td class="padding-small">\r\n <label class="header" style="margin-top: 3px;"><%= scope.strChange %></label>\r\n <div id="shape-btn-change" style="display: inline-block; float:right;"></div>\r\n </td>\r\n </tr>\r\n <tr class="shape-only change-type">\r\n <td class="padding-small">\r\n <div class="separator horizontal"></div>\r\n </td>\r\n </tr>\r\n <tr class="shape-only">\r\n <td align="center">\r\n <label class="link" id="shape-advanced-link"><%= scope.textAdvanced %></label>\r\n </td>\r\n </tr>\r\n <tr class="finish-cell"></tr>\r\n</table>'});if(Common===undefined)var Common={};define("common/main/lib/component/ComboBorderSize",["common/main/lib/component/ComboBox"],function(){"use strict";Common.UI.BordersModel=Backbone.Model.extend({defaults:function(){return{value:null,displayValue:null,pxValue:null,id:Common.UI.getId(),offsety:undefined}}}),Common.UI.BordersStore=Backbone.Collection.extend({model:Common.UI.BordersModel}),Common.UI.ComboBorderSize=Common.UI.ComboBox.extend(_.extend({template:_.template(['<div class="input-group combobox combo-border-size input-group-nr <%= cls %>" id="<%= id %>" style="<%= style %>">','<div class="form-control" style="<%= style %>"></div>','<div style="display: table-cell;"></div>','<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"><span class="caret img-commonctrl"></span></button>','<ul class="dropdown-menu <%= menuCls %>" style="<%= menuStyle %>" role="menu">',"<% _.each(items, function(item) { %>",'<li id="<%= item.id %>" data-value="<%= item.value %>"><a tabindex="-1" type="menuitem">',"<span><%= item.displayValue %></span>","<% if (item.offsety!==undefined) { %>",'<img src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" align="right" style="background-position: 0 -<%= item.offsety %>px;">',"<% } %>","</a></li>","<% }); %>","</ul>","</div>"].join("")),initialize:function(e){var t=Common.Utils.Metric.getMetricName(Common.Utils.Metric.c_MetricUnits.pt),n=[{displayValue:"0.5 "+t,value:.5,pxValue:.5,offsety:0},{displayValue:"1 "+t,value:1,pxValue:1,offsety:20},{displayValue:"1.5 "+t,value:1.5,pxValue:2,offsety:40},{displayValue:"2.25 "+t,value:2.25,pxValue:3,offsety:60},{displayValue:"3 "+t,value:3,pxValue:4,offsety:80},{displayValue:"4.5 "+t,value:4.5,pxValue:5,offsety:100},{displayValue:"6 "+t,value:6,pxValue:6,offsety:120}];e.allowNoBorders!==!1&&n.unshift({displayValue:this.txtNoBorders,value:0,pxValue:0}),Common.UI.ComboBox.prototype.initialize.call(this,_.extend({editable:!1,store:new Common.UI.BordersStore,data:n,menuStyle:"min-width: 150px;"},e))},render:function(e){return Common.UI.ComboBox.prototype.render.call(this,e),this},itemClicked:function(e){var t=$(e.currentTarget).parent();this._selectedItem=this.store.findWhere({id:t.attr("id")}),this._selectedItem&&($(".selected",$(this.el)).removeClass("selected"),t.addClass("selected"),this.updateFormControl(this._selectedItem),this.trigger("selected",this,_.extend({},this._selectedItem.toJSON()),e),e.preventDefault())},updateFormControl:function(e){var t=$(this.el).find(".form-control");e.get("value")>0?(t[0].innerHTML="",t.removeClass("text").addClass("image"),t.css("background-position","0 -"+e.get("offsety")+"px")):(t[0].innerHTML=this.txtNoBorders,t.removeClass("image").addClass("text"))},setValue:function(e){this._selectedItem=e===null||e===undefined?undefined:_.find(this.store.models,function(t){if(e<t.attributes.value+.01&&e>t.attributes.value-.01)return!0}),$(".selected",$(this.el)).removeClass("selected");if(this._selectedItem)this.updateFormControl(this._selectedItem),$("#"+this._selectedItem.get("id"),$(this.el)).addClass("selected");else{var t=$(this.el).find(".form-control");t[0].innerHTML="",t.removeClass("image").addClass("text")}},txtNoBorders:"No Borders"},Common.UI.ComboBorderSize||{})),Common.UI.ComboBorderSizeEditable=Common.UI.ComboBox.extend(_.extend({template:_.template(['<span class="input-group combobox combo-border-size input-group-nr <%= cls %>" id="<%= id %>" style="<%= style %>">','<input type="text" class="form-control text">','<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"><span class="caret img-commonctrl"></span></button>','<ul class="dropdown-menu <%= menuCls %>" style="<%= menuStyle %>" role="menu">',"<% _.each(items, function(item) { %>",'<li id="<%= item.id %>" data-value="<%= item.value %>"><a tabindex="-1" type="menuitem">',"<span><%= item.displayValue %></span>","<% if (item.offsety!==undefined) { %>",'<img src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" align="right" style="background-position: 0 -<%= item.offsety %>px;">',"<% } %>","</a></li>","<% }); %>","</ul>","</span>"].join("")),initialize:function(e){this.txtNoBorders=e.txtNoBorders||this.txtNoBorders;var t=Common.Utils.Metric.getMetricName(Common.Utils.Metric.c_MetricUnits.pt),n=[{displayValue:"0.5 "+t,value:.5,pxValue:.5,offsety:0},{displayValue:"1 "+t,value:1,pxValue:1,offsety:20},{displayValue:"1.5 "+t,value:1.5,pxValue:2,offsety:40},{displayValue:"2.25 "+t,value:2.25,pxValue:3,offsety:60},{displayValue:"3 "+t,value:3,pxValue:4,offsety:80},{displayValue:"4.5 "+t,value:4.5,pxValue:5,offsety:100},{displayValue:"6 "+t,value:6,pxValue:6,offsety:120}];e.allowNoBorders!==!1&&n.unshift({displayValue:this.txtNoBorders,value:0,pxValue:0}),Common.UI.ComboBox.prototype.initialize.call(this,_.extend({editable:!0,store:new Common.UI.BordersStore,data:n,menuStyle:"min-width: 150px;"},e))},render:function(e){return Common.UI.ComboBox.prototype.render.call(this,e),this},txtNoBorders:"No Borders"},Common.UI.ComboBorderSizeEditable||{})),Common.UI.ComboBorderType=Common.UI.ComboBorderSize.extend(_.extend({template:_.template(['<div class="input-group combobox combo-border-size input-group-nr <%= cls %>" id="<%= id %>" style="<%= style %>">','<div class="form-control" style="<%= style %>"></div>','<div style="display: table-cell;"></div>','<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"><span class="caret img-commonctrl"></span></button>','<ul class="dropdown-menu <%= menuCls %>" style="<%= menuStyle %>" role="menu">',"<% _.each(items, function(item) { %>",'<li id="<%= item.id %>" data-value="<%= item.value %>"><a tabindex="-1" type="menuitem" style="padding: 2px 0;">','<span style="margin-top: 0;"></span>',"<% if (item.offsety!==undefined) { %>",'<img src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" align="left" style="background-position: 0 -<%= item.offsety %>px;">',"<% } %>","</a></li>","<% }); %>","</ul>","</div>"].join("")),initialize:function(e){Common.UI.ComboBorderSize.prototype.initialize.call(this,_.extend({store:new Common.UI.BordersStore,data:[{value:Asc.c_oDashType.solid,offsety:140},{value:Asc.c_oDashType.sysDot,offsety:160},{value:Asc.c_oDashType.sysDash,offsety:180},{value:Asc.c_oDashType.dash,offsety:200},{value:Asc.c_oDashType.dashDot,offsety:220},{value:Asc.c_oDashType.lgDash,offsety:240},{value:Asc.c_oDashType.lgDashDot,offsety:260},{value:Asc.c_oDashType.lgDashDotDot,offsety:280}]},e))},render:function(e){return Common.UI.ComboBorderSize.prototype.render.call(this,e),this},updateFormControl:function(e){var t=$(this.el).find(".form-control");t[0].innerHTML="",t.removeClass("text").addClass("image"),t.css("background-position","0 -"+e.get("offsety")+"px")}},Common.UI.ComboBorderType||{}))});if(Common===undefined)var Common={};define("common/main/lib/component/ColorButton",["common/main/lib/component/Button"],function(){"use strict";Common.UI.ColorButton=Common.UI.Button.extend({options:{hint:!1,enableToggle:!1},template:_.template(['<div class="btn-group" id="<%= id %>">','<button type="button" class="btn btn-color dropdown-toggle <%= cls %>" data-toggle="dropdown" style="<%= style %>">',"<span> </span>","</button>","</div>"].join("")),setColor:function(e){var t,n,r=$(this.cmpEl).find("button span");this.color=e,e=="transparent"?(t="#BEBEBE",n=e,r.addClass("color-transparent")):(t="transparent",n=typeof e=="object"?"#"+e.color:"#"+e,r.removeClass("color-transparent")),r.css({"background-color":n,"border-color":t})}})});if(Common===undefined)var Common={};define("common/main/lib/component/Slider",["common/main/lib/component/BaseView","underscore"],function(e,t){"use strict";Common.UI.SingleSlider=Common.UI.BaseView.extend({options:{width:100,minValue:0,maxValue:100,step:1,value:100,enableKeyEvents:!1},disabled:!1,template:t.template(['<div class="slider single-slider" style="">','<div class="track">','<div class="track-left img-commonctrl"></div>','<div class="track-center img-commonctrl"></div>','<div class="track-right img-commonctrl" style=""></div>',"</div>",'<div class="thumb img-commonctrl" style=""></div>',"<% if (this.options.enableKeyEvents) { %>",'<input type="text" style="position: absolute; top:-10px; width: 1px; height: 1px;">',"<% } %>","</div>"].join("")),initialize:function(e){Common.UI.BaseView.prototype.initialize.call(this,e);var t=this,n=$(this.el);t.width=t.options.width,t.minValue=t.options.minValue,t.maxValue=t.options.maxValue,t.delta=100/(t.maxValue-t.minValue),t.step=t.options.step,t.options.el&&t.render(),this.setValue(t.options.value)},render:function(e){var n=this;n.rendered?this.cmpEl=$(this.el):(this.cmpEl=$(this.template({})),e?(this.setElement(e,!1),e.html(this.cmpEl)):$(this.el).html(this.cmpEl)),this.cmpEl.find(".track-center").width(n.options.width-14),this.cmpEl.width(n.options.width),this.thumb=this.cmpEl.find(".thumb");var r=function(e){e.preventDefault(),e.stopPropagation();var t=Math.max(0,Math.min(100,Math.round((e.pageX*Common.Utils.zoom()-n.cmpEl.offset().left-n._dragstart)/n.width*100)));n.setThumbPosition(t),n.lastValue=n.value,n.value=t/n.delta+n.minValue,n.thumb.removeClass("active"),$(document).off("mouseup",r),$(document).off("mousemove",i),n._dragstart=undefined,n.trigger("changecomplete",n,n.value,n.lastValue)},i=function(e){if(n.disabled)return;if(n._dragstart===undefined)return;e.preventDefault(),e.stopPropagation();var t=Math.max(0,Math.min(100,Math.round((e.pageX*Common.Utils.zoom()-n.cmpEl.offset().left-n._dragstart)/n.width*100)));n.setThumbPosition(t),n.lastValue=n.value,n.value=t/n.delta+n.minValue,Math.abs(n.value-n.lastValue)>.001&&n.trigger("change",n,n.value,n.lastValue)},s=function(e){if(n.disabled)return;n._dragstart=e.pageX*Common.Utils.zoom()-n.thumb.offset().left-7,n.thumb.addClass("active"),$(document).on("mouseup",r),$(document).on("mousemove",i),n.options.enableKeyEvents&&setTimeout(function(){n.input.focus()},10)},o=function(e){if(n.disabled)return;var t=Math.max(0,Math.min(100,Math.round((e.pageX*Common.Utils.zoom()-n.cmpEl.offset().left)/n.width*100)));n.setThumbPosition(t),n.lastValue=n.value,n.value=t/n.delta+n.minValue,n.trigger("change",n,n.value,n.lastValue),n.trigger("changecomplete",n,n.value,n.lastValue)},u,a=function(e){n.lastValue=n.value,n.value=Math.max(n.minValue,Math.min(n.maxValue,n.value+(e?n.step:-n.step))),n.setThumbPosition(Math.round((n.value-n.minValue)*n.delta)),n.trigger("change",n,n.value,n.lastValue)},f=function(e){if(n.disabled)return;if(e.keyCode==Common.UI.Keys.UP||e.keyCode==Common.UI.Keys.DOWN||e.keyCode==Common.UI.Keys.LEFT||e.keyCode==Common.UI.Keys.RIGHT)e.preventDefault(),e.stopPropagation(),c.off("keydown","input",f),u=setInterval(t.bind(a,n,e.keyCode==Common.UI.Keys.UP||e.keyCode==Common.UI.Keys.RIGHT),100)},l=function(e){if(n.disabled)return;if(e.keyCode==Common.UI.Keys.UP||e.keyCode==Common.UI.Keys.DOWN||Common.UI.Keys.LEFT||Common.UI.Keys.RIGHT)e.stopPropagation(),e.preventDefault(),clearInterval(u),a(e.keyCode==Common.UI.Keys.UP||e.keyCode==Common.UI.Keys.RIGHT),c.on("keydown","input",f),n.trigger("changecomplete",n,n.value,n.lastValue)};if(!n.rendered){var c=n.cmpEl;c.on("mousedown",".thumb",s),c.on("mousedown",".track",o),this.options.enableKeyEvents&&(c.on("keydown","input",f),c.on("keyup","input",l))}return n.rendered=!0,this},setThumbPosition:function(e){this.thumb.css({left:e+"%"})},setValue:function(e){this.lastValue=this.value,this.value=Math.max(this.minValue,Math.min(this.maxValue,e)),this.setThumbPosition(Math.round((e-this.minValue)*this.delta))},getValue:function(){return this.value},setDisabled:function(e){e!==this.disabled&&this.cmpEl.toggleClass("disabled",e),this.disabled=e}}),Common.UI.MultiSlider=Common.UI.BaseView.extend({options:{width:100,minValue:0,maxValue:100,values:[0,100]},disabled:!1,template:t.template(['<div class="slider multi-slider">','<div class="track">','<div class="track-left"></div>','<div class="track-center""></div>','<div class="track-right" style=""></div>',"</div>","<% _.each(items, function(item) { %>",'<div class="thumb" style=""></div>',"<% }); %>","</div>"].join("")),initialize:function(e){Common.UI.BaseView.prototype.initialize.call(this,e);var t=this,n=$(this.el);t.width=t.options.width,t.minValue=t.options.minValue,t.maxValue=t.options.maxValue,t.delta=100/(t.maxValue-t.minValue),t.thumbs=[],t.options.el&&t.render()},render:function(e){var n=this;n.rendered?this.cmpEl=$(this.el):(this.cmpEl=$(this.template({items:this.options.values})),e?(this.setElement(e,!1),e.html(this.cmpEl)):$(this.el).html(this.cmpEl));var r=this.cmpEl;r.find(".track-center").width(n.options.width-14),r.width(n.options.width);var i=function(e){e.preventDefault(),e.stopPropagation();var t=e.data,r=n.thumbs[t].value,o=t-1<0?0:n.thumbs[t-1].position,u=t+1<n.thumbs.length?n.thumbs[t+1].position:100,a=Math.max(o,Math.min(u,Math.round((e.pageX*Common.Utils.zoom()-n.cmpEl.offset().left-n._dragstart)/n.width*100))),f=a/n.delta+n.minValue;n.setThumbPosition(t,a),n.thumbs[t].value=f,$(document).off("mouseup",i),$(document).off("mousemove",s),n._dragstart=undefined,n.trigger("changecomplete",n,f,r)},s=function(e){if(n.disabled)return;if(n._dragstart===undefined)return;e.preventDefault(),e.stopPropagation();var t=e.data,r=n.thumbs[t].value,i=t-1<0?0:n.thumbs[t-1].position,s=t+1<n.thumbs.length?n.thumbs[t+1].position:100,o=Math.max(i,Math.min(s,Math.round((e.pageX*Common.Utils.zoom()-n.cmpEl.offset().left-n._dragstart)/n.width*100))),u=o/n.delta+n.minValue;n.setThumbPosition(t,o),n.thumbs[t].value=u,Math.abs(u-r)>.001&&n.trigger("change",n,u,r)},o=function(e){if(n.disabled)return;var r=e.data,o=n.thumbs[r].thumb;n._dragstart=e.pageX*Common.Utils.zoom()-o.offset().left-o.width()/2,n.setActiveThumb(r),t.each(n.thumbs,function(e,t){r==t?e.thumb.css("z-index",500):e.thumb.css("z-index","")}),$(document).on("mouseup",null,r,i),$(document).on("mousemove",null,r,s)},u=function(e){if(n.disabled)return;var t=Math.max(0,Math.min(100,Math.round((e.pageX*Common.Utils.zoom()-n.cmpEl.offset().left)/n.width*100))),r=a(t),i=n.thumbs[r].value,s=t/n.delta+n.minValue;n.setThumbPosition(r,t),n.thumbs[r].value=s,n.trigger("change",n,s,i),n.trigger("changecomplete",n,s,i)},a=function(e){var t=100,r=0,i=n.thumbs.length,s;for(var o=0;o<i;o++){s=Math.abs(n.thumbs[o].position-e);if(Math.abs(s<=t)){var u=n.thumbs[o+1],a=n.thumbs[o-1];if(a!==undefined&&e<a.position)continue;if(u!==undefined&&e>u.position)continue;r=o,t=s}}return r};return this.$thumbs=r.find(".thumb"),t.each(this.$thumbs,function(e,t){var r=$(e);n.thumbs.push({thumb:r,index:t}),n.setValue(t,n.options.values[t]),r.on("mousedown",null,t,o)}),n.setActiveThumb(0,!0),n.rendered||r.on("mousedown",".track",u),n.rendered=!0,this},setActiveThumb:function(e,t){this.currentThumb=e,this.$thumbs.removeClass("active"),this.thumbs[e].thumb.addClass("active"),t!==!0&&this.trigger("thumbclick",this,e)},setThumbPosition:function(e,t){this.thumbs[e].position=t,this.thumbs[e].thumb.css({left:t+"%"})},setValue:function(e,t){this.thumbs[e].value=Math.max(this.minValue,Math.min(this.maxValue,t)),this.setThumbPosition(e,Math.round((t-this.minValue)*this.delta))},getValue:function(e){return this.thumbs[e].value},getValues:function(){var e=[];return t.each(this.thumbs,function(t){e.push(t.value)}),e},setDisabled:function(e){e!==this.disabled&&this.cmpEl.toggleClass("disabled",e),this.disabled=e}})});if(Common===undefined)var Common={};define("common/main/lib/component/MultiSliderGradient",["common/main/lib/component/Slider","underscore"],function(e,t){"use strict";Common.UI.MultiSliderGradient=Common.UI.MultiSlider.extend({options:{width:100,minValue:0,maxValue:100,values:[0,100],colorValues:["#000000","#ffffff"],currentThumb:0},disabled:!1,template:t.template(['<div class="slider multi-slider-gradient">','<div class="track"></div>',"<% _.each(items, function(item) { %>",'<div class="thumb img-commonctrl" style="">','<div class="thumb-top"></div>','<div class="thumb-bottom"></div>',"</div>","<% }); %>","</div>"].join("")),initialize:function(e){this.styleStr="",Common.Utils.isChrome&&Common.Utils.chromeVersion<10||Common.Utils.isSafari&&Common.Utils.safariVersion<5.1?this.styleStr="-webkit-gradient(linear, left top, right top, color-stop({1}%,{0}), color-stop({3}%,{2})); /* Chrome,Safari4+ */":Common.Utils.isChrome||Common.Utils.isSafari?this.styleStr="-webkit-linear-gradient(left, {0} {1}%, {2} {3}%)":Common.Utils.isGecko?this.styleStr="-moz-linear-gradient(left, {0} {1}%, {2} {3}%)":Common.Utils.isOpera&&Common.Utils.operaVersion>11?this.styleStr="-o-linear-gradient(left, {0} {1}%, {2} {3}%)":Common.Utils.isIE&&(this.styleStr="-ms-linear-gradient(left, {0} {1}%, {2} {3}%)"),this.colorValues=this.options.colorValues,Common.UI.MultiSlider.prototype.initialize.call(this,e)},render:function(e){Common.UI.MultiSlider.prototype.render.call(this,e);var n=this,r="";n.trackEl=n.cmpEl.find(".track");for(var i=0;i<n.thumbs.length;i++)n.thumbs[i].thumb.on("dblclick",null,function(){n.trigger("thumbdblclick",n)}),n.thumbs[i].thumbcolor=n.thumbs[i].thumb.find("> div");n.styleStr!==""&&(r=Common.Utils.String.format(n.styleStr,n.colorValues[0],0,n.colorValues[1],100),n.trackEl.css("background",r)),Common.Utils.isIE&&(r=Common.Utils.String.format("progid:DXImageTransform.Microsoft.gradient( startColorstr={0}, endColorstr={1},GradientType=1 )",n.colorValues[0],n.colorValues[1]),n.trackEl.css("filter",r)),r=Common.Utils.String.format("linear-gradient(to right, {0} {1}%, {2} {3}%)",n.colorValues[0],0,n.colorValues[1],100),n.trackEl.css("background",r),n.on("change",t.bind(n.changeGradientStyle,n))},setColorValue:function(e,t){var n=t!==undefined?t:this.currentThumb;this.colorValues[n]=e,this.thumbs[n].thumbcolor.css("background-color",e),this.changeGradientStyle()},getColorValue:function(e){var t=e!==undefined?e:this.currentThumb;return this.colorValues[t]},setValue:function(e,t){Common.UI.MultiSlider.prototype.setValue.call(this,e,t),this.changeGradientStyle()},changeGradientStyle:function(){if(!this.rendered)return;var e;this.styleStr!==""&&(e=Common.Utils.String.format(this.styleStr,this.colorValues[0],this.getValue(0),this.colorValues[1],this.getValue(1)),this.trackEl.css("background",e)),Common.Utils.isIE&&(e=Common.Utils.String.format("progid:DXImageTransform.Microsoft.gradient( startColorstr={0}, endColorstr={1},GradientType=1 )",this.colorValues[0],this.colorValues[1]),this.trackEl.css("filter",e)),e=Common.Utils.String.format("linear-gradient(to right, {0} {1}%, {2} {3}%)",this.colorValues[0],this.getValue(0),this.colorValues[1],this.getValue(1)),this.trackEl.css("background",e)}})}),define("text!spreadsheeteditor/main/app/template/ShapeSettingsAdvanced.template",[],function(){return'<div id="id-adv-shape-width" class="settings-panel active">\r\n <div class="inner-content">\r\n <table cols="3">\r\n <tr>\r\n <td width="108px">\r\n <label class="input-label"><%= scope.textWidth %></label>\r\n <div id="shape-advanced-spin-width"></div>\r\n </td>\r\n <td width="28px" style="vertical-align: bottom;">\r\n <div id="shape-advanced-button-ratio"></div>\r\n </td>\r\n <td width="108px">\r\n <label class="input-label"><%= scope.textHeight %></label>\r\n <div id="shape-advanced-spin-height"></div>\r\n </td>\r\n </tr>\r\n </table>\r\n </div>\r\n</div>\r\n<div id="id-adv-shape-shape" class="settings-panel">\r\n <div class="inner-content">\r\n <table cols="2" style="width: 100%;">\r\n <tr>\r\n <td colspan=2 class="padding-small">\r\n <label class="header"><%= scope.textLineStyle %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-large" width="125px">\r\n <label class="input-label"><%= scope.textCapType %></label>\r\n <div id="shape-advanced-cap-type" style="width: 100px;"></div>\r\n </td>\r\n <td class="padding-large">\r\n <label class="input-label"><%= scope.textJoinType %></label>\r\n <div id="shape-advanced-join-type" style="width: 100px;"></div>\r\n </td>\r\n </tr>\r\n </table>\r\n </div>\r\n <div class="separator horizontal padding-large"></div>\r\n <div class="inner-content">\r\n <table cols="2" style="width: 100%;">\r\n <tr>\r\n <td colspan=2 class="padding-small">\r\n <label class="header"><%= scope.textArrows %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small" width="125px">\r\n <label class="input-label"><%= scope.textBeginStyle %></label>\r\n <div id="shape-advanced-begin-style" style="width: 100px;"></div>\r\n </td>\r\n <td class="padding-small">\r\n <label class="input-label"><%= scope.textEndStyle %></label>\r\n <div id="shape-advanced-end-style" style="width: 100px;"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <label class="input-label"><%= scope.textBeginSize %></label>\r\n <div id="shape-advanced-begin-size" style="width: 100px;"></div>\r\n </td>\r\n <td class="padding-small">\r\n <label class="input-label"><%= scope.textEndSize %></label>\r\n <div id="shape-advanced-end-size" style="width: 100px;"></div>\r\n </td>\r\n </tr>\r\n </table>\r\n </div>\r\n</div>\r\n<div id="id-adv-shape-margins" class="settings-panel">\r\n <div class="inner-content">\r\n <table cols="2" style="width: 100%;">\r\n <tr>\r\n <td class="padding-small" width="125px">\r\n <label class="input-label"><%= scope.textTop %></label>\r\n <div id="shape-margin-top"></div>\r\n </td>\r\n <td class="padding-small">\r\n <label class="input-label"><%= scope.textLeft %></label>\r\n <div id="shape-margin-left"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <label class="input-label"><%= scope.textBottom %></label>\r\n <div id="shape-margin-bottom"></div>\r\n </td>\r\n <td class="padding-small">\r\n <label class="input-label"><%= scope.textRight %></label>\r\n <div id="shape-margin-right"></div>\r\n </td>\r\n </tr>\r\n </table>\r\n </div>\r\n</div>\r\n<div id="id-adv-shape-alttext" class="settings-panel">\r\n <div class="inner-content">\r\n <table cols="1" width="100%">\r\n <tr>\r\n <td class="padding-large">\r\n <label class="header"><%= scope.textAltTitle %></label>\r\n <div id="shape-advanced-alt-title"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td>\r\n <label class="header"><%= scope.textAltDescription %></label>\r\n <textarea id="shape-advanced-alt-description" class="form-control" style="width: 100%; height: 70px;"></textarea>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td>\r\n <label><%= scope.textAltTip %></label>\r\n </td>\r\n </tr>\r\n </table>\r\n </div>\r\n</div>'}),define("spreadsheeteditor/main/app/view/ShapeSettingsAdvanced",["text!spreadsheeteditor/main/app/template/ShapeSettingsAdvanced.template","common/main/lib/view/AdvancedSettingsWindow","common/main/lib/component/ComboBox","common/main/lib/component/MetricSpinner"],function(e){"use strict";SSE.Views.ShapeSettingsAdvanced=Common.Views.AdvancedSettingsWindow.extend(_.extend({options:{contentWidth:300,height:342,toggleGroup:"shape-adv-settings-group",sizeOriginal:{width:0,height:0},sizeMax:{width:55.88,height:55.88},properties:null,storageName:"sse-shape-settings-adv-category"},initialize:function(t){_.extend(this.options,{title:this.textTitle,items:[{panelId:"id-adv-shape-width",panelCaption:this.textSize},{panelId:"id-adv-shape-shape",panelCaption:this.textWeightArrows},{panelId:"id-adv-shape-margins",panelCaption:this.strMargins},{panelId:"id-adv-shape-alttext",panelCaption:this.textAlt}],contentTemplate:_.template(e)({scope:this})},t),Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this,this.options),this.spinners=[],this.Margins=undefined,this._nRatio=1,this._originalProps=this.options.shapeProps,this._changedProps=null},render:function(){Common.Views.AdvancedSettingsWindow.prototype.render.call(this);var e=this;this.spnWidth=new Common.UI.MetricSpinner({el:$("#shape-advanced-spin-width"),step:.1,width:100,defaultUnit:"cm",value:"3 cm",maxValue:55.88,minValue:0}),this.spnWidth.on("change",_.bind(function(e,t,n,r){if(this.btnRatio.pressed){var i=e.getNumberValue(),s=i/this._nRatio;s>this.spnHeight.options.maxValue&&(s=this.spnHeight.options.maxValue,i=s*this._nRatio,this.spnWidth.setValue(i,!0)),this.spnHeight.setValue(s,!0)}this._changedProps&&(this._changedProps.asc_putWidth(Common.Utils.Metric.fnRecalcToMM(e.getNumberValue())),this._changedProps.asc_putHeight(Common.Utils.Metric.fnRecalcToMM(this.spnHeight.getNumberValue())))},this)),this.spinners.push(this.spnWidth),this.spnHeight=new Common.UI.MetricSpinner({el:$("#shape-advanced-spin-height"),step:.1,width:100,defaultUnit:"cm",value:"3 cm",maxValue:55.88,minValue:0}),this.spnHeight.on("change",_.bind(function(e,t,n,r){var i=e.getNumberValue(),s=null;this.btnRatio.pressed&&(s=i*this._nRatio,s>this.spnWidth.options.maxValue&&(s=this.spnWidth.options.maxValue,i=s/this._nRatio,this.spnHeight.setValue(i,!0)),this.spnWidth.setValue(s,!0)),this._changedProps&&(this._changedProps.asc_putHeight(Common.Utils.Metric.fnRecalcToMM(e.getNumberValue())),this._changedProps.asc_putWidth(Common.Utils.Metric.fnRecalcToMM(this.spnWidth.getNumberValue())))},this)),this.spinners.push(this.spnHeight),this.btnRatio=new Common.UI.Button({cls:"btn-toolbar",iconCls:"advanced-btn-ratio",style:"margin-bottom: 1px;",enableToggle:!0,hint:this.textKeepRatio}),this.btnRatio.render($("#shape-advanced-button-ratio")),this.btnRatio.on("click",_.bind(function(e,t){e.pressed&&this.spnHeight.getNumberValue()>0&&(this._nRatio=this.spnWidth.getNumberValue()/this.spnHeight.getNumberValue()),this._changedProps&&this._changedProps.asc_putLockAspect(e.pressed)},this)),this.spnMarginTop=new Common.UI.MetricSpinner({el:$("#shape-margin-top"),step:.1,width:100,defaultUnit:"cm",value:"0 cm",maxValue:55.87,minValue:0}),this.spnMarginTop.on("change",_.bind(function(e,t,n,r){this._changedProps&&((this._changedProps.asc_getShapeProperties()===null||this._changedProps.asc_getShapeProperties()===undefined)&&this._changedProps.asc_putShapeProperties(new Asc.asc_CShapeProperty),this._changedProps.asc_getShapeProperties().asc_getPaddings()===null&&this._changedProps.asc_getShapeProperties().asc_putPaddings(new Asc.asc_CPaddings),this._changedProps.asc_getShapeProperties().asc_getPaddings().asc_putTop(Common.Utils.Metric.fnRecalcToMM(e.getNumberValue())))},this)),this.spinners.push(this.spnMarginTop),this.spnMarginBottom=new Common.UI.MetricSpinner({el:$("#shape-margin-bottom"),step:.1,width:100,defaultUnit:"cm",value:"0 cm",maxValue:55.87,minValue:0}),this.spnMarginBottom.on("change",_.bind(function(e,t,n,r){this._changedProps&&((this._changedProps.asc_getShapeProperties()===null||this._changedProps.asc_getShapeProperties()===undefined)&&this._changedProps.asc_putShapeProperties(new Asc.asc_CShapeProperty),this._changedProps.asc_getShapeProperties().asc_getPaddings()===null&&this._changedProps.asc_getShapeProperties().asc_putPaddings(new Asc.asc_CPaddings),this._changedProps.asc_getShapeProperties().asc_getPaddings().asc_putBottom(Common.Utils.Metric.fnRecalcToMM(e.getNumberValue())))},this)),this.spinners.push(this.spnMarginBottom),this.spnMarginLeft=new Common.UI.MetricSpinner({el:$("#shape-margin-left"),step:.1,width:100,defaultUnit:"cm",value:"0.19 cm",maxValue:9.34,minValue:0}),this.spnMarginLeft.on("change",_.bind(function(e,t,n,r){this._changedProps&&((this._changedProps.asc_getShapeProperties()===null||this._changedProps.asc_getShapeProperties()===undefined)&&this._changedProps.asc_putShapeProperties(new Asc.asc_CShapeProperty),this._changedProps.asc_getShapeProperties().asc_getPaddings()===null&&this._changedProps.asc_getShapeProperties().asc_putPaddings(new Asc.asc_CPaddings),this._changedProps.asc_getShapeProperties().asc_getPaddings().asc_putLeft(Common.Utils.Metric.fnRecalcToMM(e.getNumberValue())))},this)),this.spinners.push(this.spnMarginLeft),this.spnMarginRight=new Common.UI.MetricSpinner({el:$("#shape-margin-right"),step:.1,width:100,defaultUnit:"cm",value:"0.19 cm",maxValue:9.34,minValue:0}),this.spnMarginRight.on("change",_.bind(function(e,t,n,r){this._changedProps&&((this._changedProps.asc_getShapeProperties()===null||this._changedProps.asc_getShapeProperties()===undefined)&&this._changedProps.asc_putShapeProperties(new Asc.asc_CShapeProperty),this._changedProps.asc_getShapeProperties().asc_getPaddings()===null&&this._changedProps.asc_getShapeProperties().asc_putPaddings(new Asc.asc_CPaddings),this._changedProps.asc_getShapeProperties().asc_getPaddings().asc_putRight(Common.Utils.Metric.fnRecalcToMM(e.getNumberValue())))},this)),this.spinners.push(this.spnMarginRight),this._arrCapType=[{displayValue:this.textFlat,value:Asc.c_oAscLineCapType.Flat},{displayValue:this.textRound,value:Asc.c_oAscLineCapType.Round},{displayValue:this.textSquare,value:Asc.c_oAscLineCapType.Square}],this.cmbCapType=new Common.UI.ComboBox({el:$("#shape-advanced-cap-type"),cls:"input-group-nr",menuStyle:"min-width: 100px;",editable:!1,data:this._arrCapType}),this.cmbCapType.setValue(Asc.c_oAscLineCapType.Flat),this.cmbCapType.on("selected",_.bind(function(e,t){this._changedProps&&((this._changedProps.asc_getShapeProperties()===null||this._changedProps.asc_getShapeProperties()===undefined)&&this._changedProps.asc_putShapeProperties(new Asc.asc_CShapeProperty),this._changedProps.asc_getShapeProperties().asc_getStroke()===null&&this._changedProps.asc_getShapeProperties().asc_putStroke(new Asc.asc_CStroke),this._changedProps.asc_getShapeProperties().asc_getStroke().asc_putLinecap(t.value))},this)),this._arrJoinType=[{displayValue:this.textRound,value:Asc.c_oAscLineJoinType.Round},{displayValue:this.textBevel,value:Asc.c_oAscLineJoinType.Bevel},{displayValue:this.textMiter,value:Asc.c_oAscLineJoinType.Miter}],this.cmbJoinType=new Common.UI.ComboBox({el:$("#shape-advanced-join-type"),cls:"input-group-nr",menuStyle:"min-width: 100px;",editable:!1,data:this._arrJoinType}),this.cmbJoinType.setValue(Asc.c_oAscLineJoinType.Round),this.cmbJoinType.on("selected",_.bind(function(e,t){this._changedProps&&((this._changedProps.asc_getShapeProperties()===null||this._changedProps.asc_getShapeProperties()===undefined)&&this._changedProps.asc_putShapeProperties(new Asc.asc_CShapeProperty),this._changedProps.asc_getShapeProperties().asc_getStroke()===null&&this._changedProps.asc_getShapeProperties().asc_putStroke(new Asc.asc_CStroke),this._changedProps.asc_getShapeProperties().asc_getStroke().asc_putLinejoin(t.value))},this));var t=[],n=[];for(var r=0;r<6;r++)t.push({value:r,offsetx:80*r+10,offsety:0});t[0].type=Asc.c_oAscLineBeginType.None,t[1].type=Asc.c_oAscLineBeginType.Triangle,t[2].type=Asc.c_oAscLineBeginType.Arrow,t[3].type=Asc.c_oAscLineBeginType.Stealth,t[4].type=Asc.c_oAscLineBeginType.Diamond,t[5].type=Asc.c_oAscLineBeginType.Oval;for(r=0;r<9;r++)n.push({value:r,offsetx:90,offsety:20*(r+1)});n[0].type=Asc.c_oAscLineBeginSize.small_small,n[1].type=Asc.c_oAscLineBeginSize.small_mid,n[2].type=Asc.c_oAscLineBeginSize.small_large,n[3].type=Asc.c_oAscLineBeginSize.mid_small,n[4].type=Asc.c_oAscLineBeginSize.mid_mid,n[5].type=Asc.c_oAscLineBeginSize.mid_large,n[6].type=Asc.c_oAscLineBeginSize.large_small,n[7].type=Asc.c_oAscLineBeginSize.large_mid,n[8].type=Asc.c_oAscLineBeginSize.large_large,this.btnBeginStyle=new Common.UI.ComboBox({el:$("#shape-advanced-begin-style"),template:_.template(['<div class="input-group combobox combo-dataview-menu input-group-nr dropdown-toggle combo-arrow-style" data-toggle="dropdown">','<div class="form-control image" style="width: 100px;"></div>','<div style="display: table-cell;"></div>','<button type="button" class="btn btn-default"><span class="caret img-commonctrl"></span></button>',"</div>"].join(""))}),this.btnBeginStyleMenu=(new Common.UI.Menu({style:"min-width: 105px;",items:[{template:_.template('<div id="shape-advanced-menu-begin-style" style="width: 105px; margin: 0 5px;"></div>')}]})).render($("#shape-advanced-begin-style")),this.mnuBeginStylePicker=new Common.UI.DataView({el:$("#shape-advanced-menu-begin-style"),parentMenu:this.btnBeginStyleMenu,store:new Common.UI.DataViewStore(t),itemTemplate:_.template('<div id="<%= id %>" class="item-arrow" style="background-position: -<%= offsetx %>px -<%= offsety %>px;"></div>')}),this.mnuBeginStylePicker.on("item:click",_.bind(this.onSelectBeginStyle,this)),this._selectStyleItem(this.btnBeginStyle,null),this.btnBeginSize=new Common.UI.ComboBox({el:$("#shape-advanced-begin-size"),template:_.template(['<div class="input-group combobox combo-dataview-menu input-group-nr dropdown-toggle combo-arrow-style" data-toggle="dropdown">','<div class="form-control image" style="width: 100px;"></div>','<div style="display: table-cell;"></div>','<button type="button" class="btn btn-default"><span class="caret img-commonctrl"></span></button>',"</div>"].join(""))}),this.btnBeginSizeMenu=(new Common.UI.Menu({style:"min-width: 160px;",items:[{template:_.template('<div id="shape-advanced-menu-begin-size" style="width: 160px; margin: 0 5px;"></div>')}]})).render($("#shape-advanced-begin-size")),this.mnuBeginSizePicker=new Common.UI.DataView({el:$("#shape-advanced-menu-begin-size"),parentMenu:this.btnBeginSizeMenu,store:new Common.UI.DataViewStore(n),itemTemplate:_.template('<div id="<%= id %>" class="item-arrow" style="background-position: -<%= offsetx %>px -<%= offsety %>px;"></div>')}),this.mnuBeginSizePicker.on("item:click",_.bind(this.onSelectBeginSize,this)),this._selectStyleItem(this.btnBeginSize,null);for(r=0;r<t.length;r++)t[r].offsety+=200;for(r=0;r<n.length;r++)n[r].offsety+=200;this.btnEndStyle=new Common.UI.ComboBox({el:$("#shape-advanced-end-style"),template:_.template(['<div class="input-group combobox combo-dataview-menu input-group-nr dropdown-toggle combo-arrow-style" data-toggle="dropdown">','<div class="form-control image" style="width: 100px;"></div>','<div style="display: table-cell;"></div>','<button type="button" class="btn btn-default"><span class="caret img-commonctrl"></span></button>',"</div>"].join(""))}),this.btnEndStyleMenu=(new Common.UI.Menu({style:"min-width: 105px;",items:[{template:_.template('<div id="shape-advanced-menu-end-style" style="width: 105px; margin: 0 5px;"></div>')}]})).render($("#shape-advanced-end-style")),this.mnuEndStylePicker=new Common.UI.DataView({el:$("#shape-advanced-menu-end-style"),parentMenu:this.btnEndStyleMenu,store:new Common.UI.DataViewStore(t),itemTemplate:_.template('<div id="<%= id %>" class="item-arrow" style="background-position: -<%= offsetx %>px -<%= offsety %>px;"></div>')}),this.mnuEndStylePicker.on("item:click",_.bind(this.onSelectEndStyle,this)),this._selectStyleItem(this.btnEndStyle,null),this.btnEndSize=new Common.UI.ComboBox({el:$("#shape-advanced-end-size"),template:_.template(['<div class="input-group combobox combo-dataview-menu input-group-nr dropdown-toggle combo-arrow-style" data-toggle="dropdown">','<div class="form-control image" style="width: 100px;"></div>','<div style="display: table-cell;"></div>','<button type="button" class="btn btn-default"><span class="caret img-commonctrl"></span></button>',"</div>"].join(""))}),this.btnEndSizeMenu=(new Common.UI.Menu({style:"min-width: 160px;",items:[{template:_.template('<div id="shape-advanced-menu-end-size" style="width: 160px; margin: 0 5px;"></div>')}]})).render($("#shape-advanced-end-size")),this.mnuEndSizePicker=new Common.UI.DataView({el:$("#shape-advanced-menu-end-size"),parentMenu:this.btnEndSizeMenu,store:new Common.UI.DataViewStore(n),itemTemplate:_.template('<div id="<%= id %>" class="item-arrow" style="background-position: -<%= offsetx %>px -<%= offsety %>px;"></div>')}),this.mnuEndSizePicker.on("item:click",_.bind(this.onSelectEndSize,this)),this._selectStyleItem(this.btnEndSize,null),this.on("show",function(e){e.getChild(".footer .primary").focus()}),this.inputAltTitle=(new Common.UI.InputField({el:$("#shape-advanced-alt-title"),allowBlank:!0,validateOnBlur:!1,style:"width: 100%;"})).on("changed:after",function(){e.isAltTitleChanged=!0}),this.textareaAltDescription=this.$window.find("textarea"),this.textareaAltDescription.keydown(function(t){t.keyCode==Common.UI.Keys.RETURN&&t.stopPropagation(),e.isAltDescChanged=!0}),this.afterRender()},afterRender:function(){this.updateMetricUnit(),this._setDefaults(this._originalProps);if(this.storageName){var e=Common.localStorage.getItem(this.storageName);this.setActiveCategory(e!==null?parseInt(e):0)}},_setDefaults:function(e){if(e&&e.asc_getShapeProperties()){var t=e.asc_getShapeProperties();this.spnWidth.setValue(Common.Utils.Metric.fnRecalcFromMM(e.asc_getWidth()).toFixed(2),!0),this.spnHeight.setValue(Common.Utils.Metric.fnRecalcFromMM(e.asc_getHeight()).toFixed(2),!0),e.asc_getHeight()>0&&(this._nRatio=e.asc_getWidth()/e.asc_getHeight());var n=e.asc_getLockAspect();this.btnRatio.toggle(n),this._setShapeDefaults(t);var r=t.asc_getPaddings();if(r){var i=r.asc_getLeft();this.spnMarginLeft.setValue(null!==i&&undefined!==i?Common.Utils.Metric.fnRecalcFromMM(i):"",!0),i=r.asc_getTop(),this.spnMarginTop.setValue(null!==i&&undefined!==i?Common.Utils.Metric.fnRecalcFromMM(i):"",!0),i=r.asc_getRight(),this.spnMarginRight.setValue(null!==i&&undefined!==i?Common.Utils.Metric.fnRecalcFromMM(i):"",!0),i=r.asc_getBottom(),this.spnMarginBottom.setValue(null!==i&&undefined!==i?Common.Utils.Metric.fnRecalcFromMM(i):"",!0)}this.btnsCategory[2].setDisabled(null===r),n=e.asc_getTitle(),this.inputAltTitle.setValue(n?n:""),n=e.asc_getDescription(),this.textareaAltDescription.val(n?n:""),this._changedProps=new Asc.asc_CImgProperty}},getSettings:function(){return this.isAltTitleChanged&&this._changedProps.asc_putTitle(this.inputAltTitle.getValue()),this.isAltDescChanged&&this._changedProps.asc_putDescription(this.textareaAltDescription.val()),{shapeProps:this._changedProps}},_setShapeDefaults:function(e){if(e){var t=e.asc_getStroke();if(t){var n=t.asc_getLinejoin();for(var r=0;r<this._arrJoinType.length;r++)if(n==this._arrJoinType[r].value){this.cmbJoinType.setValue(n);break}n=t.asc_getLinecap();for(r=0;r<this._arrCapType.length;r++)if(n==this._arrCapType[r].value){this.cmbCapType.setValue(n);break}var i=t.asc_getCanChangeArrows();this.btnBeginStyle.setDisabled(!i),this.btnEndStyle.setDisabled(!i),this.btnBeginSize.setDisabled(!i),this.btnEndSize.setDisabled(!i);if(i){n=t.asc_getLinebeginsize();var s=this.mnuBeginSizePicker.store.findWhere({type:n});s?this._beginSizeIdx=s.get("value"):(this._beginSizeIdx=null,this._selectStyleItem(this.btnBeginSize,null)),n=t.asc_getLinebeginstyle(),s=this.mnuBeginStylePicker.store.findWhere({type:n}),s?(this.mnuBeginStylePicker.selectRecord(s,!0),this._updateSizeArr(this.btnBeginSize,this.mnuBeginSizePicker,s,this._beginSizeIdx),this._selectStyleItem(this.btnBeginStyle,s)):this._selectStyleItem(this.btnBeginStyle,null),n=t.asc_getLineendsize(),s=this.mnuEndSizePicker.store.findWhere({type:n}),s?this._endSizeIdx=s.get("value"):(this._endSizeIdx=null,this._selectStyleItem(this.btnEndSize,null)),n=t.asc_getLineendstyle(),s=this.mnuEndStylePicker.store.findWhere({type:n}),s?(this.mnuEndStylePicker.selectRecord(s,!0),this._updateSizeArr(this.btnEndSize,this.mnuEndSizePicker,s,this._endSizeIdx),this._selectStyleItem(this.btnEndStyle,s)):this._selectStyleItem(this.btnEndStyle,null)}else this._selectStyleItem(this.btnBeginStyle),this._selectStyleItem(this.btnEndStyle),this._selectStyleItem(this.btnBeginSize),this._selectStyleItem(this.btnEndSize)}}},updateMetricUnit:function(){if(this.spinners)for(var e=0;e<this.spinners.length;e++){var t=this.spinners[e];t.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName()),t.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt?1:.01)}this.sizeMax={width:Common.Utils.Metric.fnRecalcFromMM(this.options.sizeMax.width*10),height:Common.Utils.Metric.fnRecalcFromMM(this.options.sizeMax.height*10)},this.options.sizeOriginal&&(this.sizeOriginal={width:Common.Utils.Metric.fnRecalcFromMM(this.options.sizeOriginal.width),height:Common.Utils.Metric.fnRecalcFromMM(this.options.sizeOriginal.height)})},_updateSizeArr:function(e,t,n,r){n.get("value")>0?(t.store.each(function(e){e.set({offsetx:n.get("value")*80+10})},this),e.setDisabled(!1),r!==null?(t.selectByIndex(r,!0),this._selectStyleItem(e,t.store.at(r))):this._selectStyleItem(e,null)):(this._selectStyleItem(e,null),e.setDisabled(!0))},_selectStyleItem:function(e,t){var n=$(e.el).find(".form-control");n.css("background-position",(t?-t.get("offsetx")+20+"px":"0")+" "+(t?"-"+t.get("offsety")+"px":"-30px"))},onSelectBeginStyle:function(e,t,n){this._changedProps&&((this._changedProps.asc_getShapeProperties()===null||this._changedProps.asc_getShapeProperties()===undefined)&&this._changedProps.asc_putShapeProperties(new Asc.asc_CShapeProperty),this._changedProps.asc_getShapeProperties().asc_getStroke()===null&&this._changedProps.asc_getShapeProperties().asc_putStroke(new Asc.asc_CStroke),this._changedProps.asc_getShapeProperties().asc_getStroke().asc_putLinebeginstyle(n.get("type")));if(this._beginSizeIdx===null||this._beginSizeIdx===undefined)this._beginSizeIdx=4;this._updateSizeArr(this.btnBeginSize,this.mnuBeginSizePicker,n,this._beginSizeIdx),this._selectStyleItem(this.btnBeginStyle,n)},onSelectBeginSize:function(e,t,n){this._changedProps&&((this._changedProps.asc_getShapeProperties()===null||this._changedProps.asc_getShapeProperties()===undefined)&&this._changedProps.asc_putShapeProperties(new Asc.asc_CShapeProperty),this._changedProps.asc_getShapeProperties().asc_getStroke()===null&&this._changedProps.asc_getShapeProperties().asc_putStroke(new Asc.asc_CStroke),this._changedProps.asc_getShapeProperties().asc_getStroke().asc_putLinebeginsize(n.get("type"))),this._beginSizeIdx=n.get("value"),this._selectStyleItem(this.btnBeginSize,n)},onSelectEndStyle:function(e,t,n){this._changedProps&&((this._changedProps.asc_getShapeProperties()===null||this._changedProps.asc_getShapeProperties()===undefined)&&this._changedProps.asc_putShapeProperties(new Asc.asc_CShapeProperty),this._changedProps.asc_getShapeProperties().asc_getStroke()===null&&this._changedProps.asc_getShapeProperties().asc_putStroke(new Asc.asc_CStroke),this._changedProps.asc_getShapeProperties().asc_getStroke().asc_putLineendstyle(n.get("type")));if(this._endSizeIdx===null||this._endSizeIdx===undefined)this._endSizeIdx=4;this._updateSizeArr(this.btnEndSize,this.mnuEndSizePicker,n,this._endSizeIdx),this._selectStyleItem(this.btnEndStyle,n)},onSelectEndSize:function(e,t,n){this._changedProps&&((this._changedProps.asc_getShapeProperties()===null||this._changedProps.asc_getShapeProperties()===undefined)&&this._changedProps.asc_putShapeProperties(new Asc.asc_CShapeProperty),this._changedProps.asc_getShapeProperties().asc_getStroke()===null&&this._changedProps.asc_getShapeProperties().asc_putStroke(new Asc.asc_CStroke),this._changedProps.asc_getShapeProperties().asc_getStroke().asc_putLineendsize(n.get("type"))),this._endSizeIdx=n.get("value"),this._selectStyleItem(this.btnEndSize,n)},textTop:"Top",textLeft:"Left",textBottom:"Bottom",textRight:"Right",textSize:"Size",textWidth:"Width",textHeight:"Height",textKeepRatio:"Constant Proportions",cancelButtonText:"Cancel",okButtonText:"Ok",textTitle:"Shape - Advanced Settings",strMargins:"Text Padding",textRound:"Round",textMiter:"Miter",textSquare:"Square",textFlat:"Flat",textBevel:"Bevel",textArrows:"Arrows",textLineStyle:"Line Style",textCapType:"Cap Type",textJoinType:"Join Type",textBeginStyle:"Begin Style",textBeginSize:"Begin Size",textEndStyle:"End Style",textEndSize:"End Size",textWeightArrows:"Weights & Arrows",textAlt:"Alternative Text",textAltTitle:"Title",textAltDescription:"Description",textAltTip:"The alternative text-based representation of the visual object information, which will be read to the people with vision or cognitive impairments to help them better understand what information there is in the image, autoshape, chart or table."},SSE.Views.ShapeSettingsAdvanced||{}))}),define("spreadsheeteditor/main/app/view/ShapeSettings",["text!spreadsheeteditor/main/app/template/ShapeSettings.template","jquery","underscore","backbone","common/main/lib/component/ComboBox","common/main/lib/component/ComboBorderSize","common/main/lib/component/MetricSpinner","common/main/lib/component/ThemeColorPalette","common/main/lib/component/ColorButton","common/main/lib/component/ComboDataView","common/main/lib/component/Slider","common/main/lib/component/MultiSliderGradient","common/main/lib/view/ImageFromUrlDialog","spreadsheeteditor/main/app/view/ShapeSettingsAdvanced"],function(e,t,n,r){"use strict";SSE.Views.ShapeSettings=r.View.extend(n.extend({el:"#id-shape-settings",template:n.template(e),events:{},options:{alias:"ShapeSettings"},initialize:function(){this._initSettings=!0,this._originalProps=null,this._noApply=!0,this.imgprops=null,this._sendUndoPoint=!0,this._sliderChanged=!1,this.txtPt=Common.Utils.Metric.getMetricName(Common.Utils.Metric.c_MetricUnits.pt),this._state={Transparency:null,FillType:Asc.c_oAscFill.FILL_TYPE_SOLID,ShapeColor:"transparent",BlipFillType:Asc.c_oAscFillBlipType.STRETCH,StrokeType:Asc.c_oAscStrokeType.STROKE_COLOR,StrokeWidth:this._pt2mm(1),StrokeColor:"000000",StrokeBorderType:Asc.c_oDashType.solid,FGColor:"000000",BGColor:"ffffff",GradColor:"000000",GradFillType:Asc.c_oAscFillGradType.GRAD_LINEAR,DisabledFillPanels:!1,DisabledControls:!1,HideShapeOnlySettings:!1,HideChangeTypeSettings:!1},this.lockedControls=[],this._locked=!1,this.OriginalFillType=Asc.c_oAscFill.FILL_TYPE_SOLID,this.ShapeColor={Value:1,Color:"transparent"},this.BlipFillType=Asc.c_oAscFillBlipType.STRETCH,this.GradFillType=Asc.c_oAscFillGradType.GRAD_LINEAR,this.GradColor={values:[0,100],colors:["000000","ffffff"],currentIdx:0},this.GradRadialDirectionIdx=0,this.GradLinearDirectionType=0,this.PatternFillType=0,this.FGColor={Value:1,Color:"000000"},this.BGColor={Value:1,Color:"ffffff"},this.BorderColor={Value:1,Color:"transparent"},this.BorderSize=0,this.BorderType=Asc.c_oDashType.solid,this.textureNames=[this.txtCanvas,this.txtCarton,this.txtDarkFabric,this.txtGrain,this.txtGranite,this.txtGreyPaper,this.txtKnit,this.txtLeather,this.txtBrownPaper,this.txtPapyrus,this.txtWood],this.fillControls=[],this.render(),this.FillColorContainer=t("#shape-panel-color-fill"),this.FillImageContainer=t("#shape-panel-image-fill"),this.FillPatternContainer=t("#shape-panel-pattern-fill"),this.FillGradientContainer=t("#shape-panel-gradient-fill"),this.TransparencyContainer=t("#shape-panel-transparent-fill"),this.ShapeOnlySettings=t(".shape-only"),this.CanChangeType=t(".change-type")},render:function(){var e=t(this.el);e.html(this.template({scope:this}))},setApi:function(e){return this.api=e,this.api&&(this.api.asc_setInterfaceDrawImagePlaceShape("shape-texture-img"),this.api.asc_registerCallback("asc_onInitStandartTextures",n.bind(this.onInitStandartTextures,this))),this},onFillSrcSelect:function(e,t){this.ShowHideElem(t.value);switch(t.value){case Asc.c_oAscFill.FILL_TYPE_SOLID:this._state.FillType=Asc.c_oAscFill.FILL_TYPE_SOLID;if(!this._noApply){var n=new Asc.asc_CShapeProperty,r=new Asc.asc_CShapeFill;r.asc_putType(Asc.c_oAscFill.FILL_TYPE_SOLID),r.asc_putFill(new Asc.asc_CFillSolid),r.asc_getFill().asc_putColor(Common.Utils.ThemeColor.getRgbColor(this.ShapeColor.Color=="transparent"?{color:"4f81bd",effectId:24}:this.ShapeColor.Color)),n.asc_putFill(r),this.imgprops.asc_putShapeProperties(n),this.api.asc_setGraphicObjectProps(this.imgprops)}break;case Asc.c_oAscFill.FILL_TYPE_GRAD:this._state.FillType=Asc.c_oAscFill.FILL_TYPE_GRAD;if(!this._noApply){var n=new Asc.asc_CShapeProperty,r=new Asc.asc_CShapeFill;r.asc_putType(Asc.c_oAscFill.FILL_TYPE_GRAD),r.asc_putFill(new Asc.asc_CFillGrad),r.asc_getFill().asc_putGradType(this.GradFillType),this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR&&(r.asc_getFill().asc_putLinearAngle(this.GradLinearDirectionType*6e4),r.asc_getFill().asc_putLinearScale(!0));if(this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_GRAD){var i=Common.Utils.ThemeColor.getRgbColor(this.GradColor.colors[0]).get_color().get_hex(),s=Common.Utils.ThemeColor.getRgbColor(this.GradColor.colors[1]).get_color().get_hex();i==="ffffff"&&s==="ffffff"?i={color:"4f81bd",effectId:24}:i=this.GradColor.colors[0],r.asc_getFill().asc_putPositions([this.GradColor.values[0]*1e3,this.GradColor.values[1]*1e3]),r.asc_getFill().asc_putColors([Common.Utils.ThemeColor.getRgbColor(i),Common.Utils.ThemeColor.getRgbColor(this.GradColor.colors[1])])}n.asc_putFill(r),this.imgprops.asc_putShapeProperties(n),this.api.asc_setGraphicObjectProps(this.imgprops)}break;case Asc.c_oAscFill.FILL_TYPE_BLIP:this._state.FillType=Asc.c_oAscFill.FILL_TYPE_BLIP;break;case Asc.c_oAscFill.FILL_TYPE_PATT:this._state.FillType=Asc.c_oAscFill.FILL_TYPE_PATT;if(!this._noApply){var n=new Asc.asc_CShapeProperty,r=new Asc.asc_CShapeFill;r.asc_putType(Asc.c_oAscFill.FILL_TYPE_PATT),r.asc_putFill(new Asc.asc_CFillHatch),r.asc_getFill().asc_putPatternType(this.PatternFillType);var o=Common.Utils.ThemeColor.getRgbColor(this.FGColor.Color).get_color().get_hex(),u=Common.Utils.ThemeColor.getRgbColor(this.BGColor.Color).get_color().get_hex();u==="ffffff"&&o==="ffffff"?o={color:"4f81bd",effectId:24}:o=this.FGColor.Color,r.asc_getFill().asc_putColorFg(Common.Utils.ThemeColor.getRgbColor(o)),r.asc_getFill().asc_putColorBg(Common.Utils.ThemeColor.getRgbColor(this.BGColor.Color)),n.asc_putFill(r),this.imgprops.asc_putShapeProperties(n),this.api.asc_setGraphicObjectProps(this.imgprops)}break;case Asc.c_oAscFill.FILL_TYPE_NOFILL:this._state.FillType=Asc.c_oAscFill.FILL_TYPE_NOFILL;if(!this._noApply){var n=new Asc.asc_CShapeProperty,r=new Asc.asc_CShapeFill;r.asc_putType(Asc.c_oAscFill.FILL_TYPE_NOFILL),r.asc_putFill(null),n.asc_putFill(r),this.imgprops.asc_putShapeProperties(n),this.api.asc_setGraphicObjectProps(this.imgprops)}}Common.NotificationCenter.trigger("edit:complete",this)},onColorsBackSelect:function(e,t){this.btnBackColor.setColor(t),this.ShapeColor={Value:1,Color:t};if(this.api&&!this._noApply){var n=new Asc.asc_CShapeProperty,r=new Asc.asc_CShapeFill;this.ShapeColor.Color=="transparent"?(r.asc_putType(Asc.c_oAscFill.FILL_TYPE_NOFILL),r.asc_putFill(null)):(r.asc_putType(Asc.c_oAscFill.FILL_TYPE_SOLID),r.asc_putFill(new Asc.asc_CFillSolid),r.asc_getFill().asc_putColor(Common.Utils.ThemeColor.getRgbColor(this.ShapeColor.Color))),n.asc_putFill(r),this.imgprops.asc_putShapeProperties(n),this.api.asc_setGraphicObjectProps(this.imgprops)}Common.NotificationCenter.trigger("edit:complete",this)},addNewColor:function(e,t){e.addNewColor(typeof t.color=="object"?t.color.color:t.color)},onPatternSelect:function(e,t){if(this.api&&!this._noApply){this.PatternFillType=t.get("type");var n=new Asc.asc_CShapeProperty,r=new Asc.asc_CShapeFill;r.asc_putType(Asc.c_oAscFill.FILL_TYPE_PATT),r.asc_putFill(new Asc.asc_CFillHatch),r.asc_getFill().asc_putPatternType(this.PatternFillType),this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_PATT&&(r.asc_getFill().asc_putColorFg(Common.Utils.ThemeColor.getRgbColor(this.FGColor.Color)),r.asc_getFill().asc_putColorBg(Common.Utils.ThemeColor.getRgbColor(this.BGColor.Color))),n.asc_putFill(r),this.imgprops.asc_putShapeProperties(n),this.api.asc_setGraphicObjectProps(this.imgprops)}Common.NotificationCenter.trigger("edit:complete",this)},onColorsFGSelect:function(e,t){this.btnFGColor.setColor(t),this.FGColor={Value:1,Color:t};if(this.api&&!this._noApply){var n=new Asc.asc_CShapeProperty,r=new Asc.asc_CShapeFill;r.asc_putType(Asc.c_oAscFill.FILL_TYPE_PATT),r.asc_putFill(new Asc.asc_CFillHatch),r.asc_getFill().asc_putColorFg(Common.Utils.ThemeColor.getRgbColor(this.FGColor.Color)),this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_PATT&&(r.asc_getFill().asc_putPatternType(this.PatternFillType),r.asc_getFill().asc_putColorBg(Common.Utils.ThemeColor.getRgbColor(this.BGColor.Color))),n.asc_putFill(r),this.imgprops.asc_putShapeProperties(n),this.api.asc_setGraphicObjectProps(this.imgprops)}Common.NotificationCenter.trigger("edit:complete",this)},onColorsBGSelect:function(e,t){this.btnBGColor.setColor(t),this.BGColor={Value:1,Color:t};if(this.api&&!this._noApply){var n=new Asc.asc_CShapeProperty,r=new Asc.asc_CShapeFill;r.asc_putType(Asc.c_oAscFill.FILL_TYPE_PATT),r.asc_putFill(new Asc.asc_CFillHatch),this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_PATT&&(r.asc_getFill().asc_putPatternType(this.PatternFillType),r.asc_getFill().asc_putColorFg(Common.Utils.ThemeColor.getRgbColor(this.FGColor.Color))),r.asc_getFill().asc_putColorBg(Common.Utils.ThemeColor.getRgbColor(this.BGColor.Color)),n.asc_putFill(r),this.imgprops.asc_putShapeProperties(n),this.api.asc_setGraphicObjectProps(this.imgprops)}Common.NotificationCenter.trigger("edit:complete",this)},onFillTypeSelect:function(e,t){this.BlipFillType=t.value;if(this.api&&this._fromTextureCmb!==!0&&this.OriginalFillType==Asc.c_oAscFill.FILL_TYPE_BLIP){var n=new Asc.asc_CShapeProperty,r=new Asc.asc_CShapeFill;r.asc_putType(Asc.c_oAscFill.FILL_TYPE_BLIP),r.asc_putFill(new Asc.asc_CFillBlip),r.asc_getFill().asc_putType(this.BlipFillType),n.asc_putFill(r),this.imgprops.asc_putShapeProperties(n),this.api.asc_setGraphicObjectProps(this.imgprops)}Common.NotificationCenter.trigger("edit:complete",this)},onNumTransparencyChange:function(e,t,n,r){this.sldrTransparency.setValue(e.getNumberValue(),!0);if(this.api){var i=e.getNumberValue(),s=new Asc.asc_CShapeProperty,o=new Asc.asc_CShapeFill;o.asc_putTransparent(i*2.55),s.asc_putFill(o),this.imgprops.asc_putShapeProperties(s),this.api.asc_setGraphicObjectProps(this.imgprops)}Common.NotificationCenter.trigger("edit:complete",this)},onTransparencyChange:function(e,t,r){this._sliderChanged=t,this.numTransparency.setValue(t,!0),this._sendUndoPoint&&(this.api.setStartPointHistory(),this._sendUndoPoint=!1,this.updateslider=setInterval(n.bind(this._transparencyApplyFunc,this),100))},onTransparencyChangeComplete:function(e,t,n){clearInterval(this.updateslider),this._sliderChanged=t,this.api.setEndPointHistory(),this._transparencyApplyFunc(),this._sendUndoPoint=!0},_transparencyApplyFunc:function(){if(this._sliderChanged!==undefined){var e=new Asc.asc_CShapeProperty,t=new Asc.asc_CShapeFill;t.asc_putTransparent(this._sliderChanged*2.55),e.asc_putFill(t),this.imgprops.asc_putShapeProperties(e),this.api.asc_setGraphicObjectProps(this.imgprops),this._sliderChanged=undefined}},onGradTypeSelect:function(e,t){this.GradFillType=t.value;if(this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR){this.mnuDirectionPicker.store.reset(this._viewDataLinear),this.mnuDirectionPicker.cmpEl.width(175),this.mnuDirectionPicker.restoreHeight=174;var t=this.mnuDirectionPicker.store.findWhere({type:this.GradLinearDirectionType});this.mnuDirectionPicker.selectRecord(t,!0),t?this.btnDirection.setIconCls("item-gradient "+t.get("iconcls")):this.btnDirection.setIconCls("")}else this.GradFillType==Asc.c_oAscFillGradType.GRAD_PATH&&(this.mnuDirectionPicker.store.reset(this._viewDataRadial),this.mnuDirectionPicker.cmpEl.width(60),this.mnuDirectionPicker.restoreHeight=58,this.mnuDirectionPicker.selectByIndex(this.GradRadialDirectionIdx,!0),this.GradRadialDirectionIdx>=0?this.btnDirection.setIconCls("item-gradient "+this._viewDataRadial[this.GradRadialDirectionIdx].iconcls):this.btnDirection.setIconCls(""));if(this.api&&!this._noApply){var n=new Asc.asc_CShapeProperty,r=new Asc.asc_CShapeFill;r.asc_putType(Asc.c_oAscFill.FILL_TYPE_GRAD),r.asc_putFill(new Asc.asc_CFillGrad),r.asc_getFill().asc_putGradType(this.GradFillType),this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR&&(r.asc_getFill().asc_putLinearAngle(this.GradLinearDirectionType*6e4),r.asc_getFill().asc_putLinearScale(!0)),n.asc_putFill(r),this.imgprops.asc_putShapeProperties(n),this.api.asc_setGraphicObjectProps(this.imgprops)}Common.NotificationCenter.trigger("edit:complete",this)},onSelectGradient:function(e,t,r,i){if(this._noApply)return;var s={},o=n.isFunction(i.toJSON);if(o){if(!i.get("selected"))return;s=i.toJSON()}else s=i;this.btnDirection.setIconCls("item-gradient "+s.iconcls),this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR?this.GradLinearDirectionType=s.type:this.GradRadialDirectionIdx=0;if(this.api&&this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR){var u=new Asc.asc_CShapeProperty,a=new Asc.asc_CShapeFill;a.asc_putType(Asc.c_oAscFill.FILL_TYPE_GRAD),a.asc_putFill(new Asc.asc_CFillGrad),a.asc_getFill().asc_putGradType(this.GradFillType),a.asc_getFill().asc_putLinearAngle(s.type*6e4),a.asc_getFill().asc_putLinearScale(!0),u.asc_putFill(a),this.imgprops.asc_putShapeProperties(u),this.api.asc_setGraphicObjectProps(this.imgprops)}Common.NotificationCenter.trigger("edit:complete",this)},onColorsGradientSelect:function(e,t){this.btnGradColor.setColor(t),this.GradColor.colors[this.GradColor.currentIdx]=t,this.sldrGradient.setColorValue(Common.Utils.String.format("#{0}",typeof t=="object"?t.color:t));if(this.api&&!this._noApply){var n=new Asc.asc_CShapeProperty,r=new Asc.asc_CShapeFill;r.asc_putType(Asc.c_oAscFill.FILL_TYPE_GRAD),r.asc_putFill(new Asc.asc_CFillGrad),r.asc_getFill().asc_putGradType(this.GradFillType),r.asc_getFill().asc_putColors([Common.Utils.ThemeColor.getRgbColor(this.GradColor.colors[0]),Common.Utils.ThemeColor.getRgbColor(this.GradColor.colors[1])]),this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_GRAD&&(this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR&&(r.asc_getFill().asc_putLinearAngle(this.GradLinearDirectionType*6e4),r.asc_getFill().asc_putLinearScale(!0)),r.asc_getFill().asc_putPositions([this.GradColor.values[0]*1e3,this.GradColor.values[1]*1e3])),n.asc_putFill(r),this.imgprops.asc_putShapeProperties(n),this.api.asc_setGraphicObjectProps(this.imgprops)}Common.NotificationCenter.trigger("edit:complete",this)},onGradientChange:function(e,t,r){this.GradColor.values=e.getValues(),this._sliderChanged=!0,this.api&&!this._noApply&&this._sendUndoPoint&&(this.api.setStartPointHistory(),this._sendUndoPoint=!1,this.updateslider=setInterval(n.bind(this._gradientApplyFunc,this),100))},onGradientChangeComplete:function(e,t,n){clearInterval(this.updateslider),this._sliderChanged=!0,this.api.setEndPointHistory(),this._gradientApplyFunc(),this._sendUndoPoint=!0},_gradientApplyFunc:function(){if(this._sliderChanged){var e=new Asc.asc_CShapeProperty,t=new Asc.asc_CShapeFill;t.asc_putType(Asc.c_oAscFill.FILL_TYPE_GRAD),t.asc_putFill(new Asc.asc_CFillGrad),t.asc_getFill().asc_putGradType(this.GradFillType),t.asc_getFill().asc_putPositions([this.GradColor.values[0]*1e3,this.GradColor.values[1]*1e3]),this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_GRAD&&(this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR&&(t.asc_getFill().asc_putLinearAngle(this.GradLinearDirectionType*6e4),t.asc_getFill().asc_putLinearScale(!0)),t.asc_getFill().asc_putColors([Common.Utils.ThemeColor.getRgbColor(this.GradColor.colors[0]),Common.Utils.ThemeColor.getRgbColor(this.GradColor.colors[1])])),e.asc_putFill(t),this.imgprops.asc_putShapeProperties(e),this.api.asc_setGraphicObjectProps(this.imgprops),this._sliderChanged=!1}},applyBorderSize:function(e){e=parseFloat(e),e=isNaN(e)?0:Math.max(0,Math.min(1584,e)),this.BorderSize=e;if(this.api&&!this._noApply){var t=new Asc.asc_CShapeProperty,n=new Asc.asc_CStroke;this.BorderSize<.01?(n.asc_putType(Asc.c_oAscStrokeType.STROKE_NONE),this._state.StrokeType=this._state.StrokeWidth=-1):(n.asc_putType(Asc.c_oAscStrokeType.STROKE_COLOR),this.BorderColor.Color=="transparent"||this.BorderColor.Color.color=="transparent"?n.asc_putColor(Common.Utils.ThemeColor.getRgbColor({color:"000000",effectId:29})):(this._state.StrokeType==Asc.c_oAscStrokeType.STROKE_NONE||this._state.StrokeType===null)&&n.asc_putColor(Common.Utils.ThemeColor.getRgbColor(Common.Utils.ThemeColor.colorValue2EffectId(this.BorderColor.Color))),n.asc_putPrstDash(this.BorderType),n.asc_putWidth(this._pt2mm(this.BorderSize))),t.asc_putStroke(n),this.imgprops.asc_putShapeProperties(t),this.api.asc_setGraphicObjectProps(this.imgprops),Common.NotificationCenter.trigger("edit:complete",this)}},onComboBlur:function(){Common.NotificationCenter.trigger("edit:complete",this)},onBorderSizeChanged:function(e,t,r,i){var s=this;if(e){var o=parseFloat(r.value),u=new RegExp("^\\s*(\\d*(\\.|,)?\\d+)\\s*("+s.txtPt+")?\\s*$");if(!u.exec(r.value)||o<0||o>1584)this._state.StrokeType=this._state.StrokeWidth=-1,Common.UI.error({msg:this.textBorderSizeErr,callback:function(){n.defer(function(e){Common.NotificationCenter.trigger("edit:complete",s)})}})}else this.applyBorderSize(r.value)},onBorderSizeSelect:function(e,t){this.applyBorderSize(t.value)},onBorderTypeSelect:function(e,t){this.BorderType=t.value;if(this.api&&!this._noApply){var n=new Asc.asc_CShapeProperty,r=new Asc.asc_CStroke;this.BorderSize<.01?r.put_type(Asc.c_oAscStrokeType.STROKE_NONE):(r.put_type(Asc.c_oAscStrokeType.STROKE_COLOR),r.put_color(Common.Utils.ThemeColor.getRgbColor(this.BorderColor.Color)),r.put_width(this._pt2mm(this.BorderSize)),r.asc_putPrstDash(this.BorderType)),n.put_stroke(r),this.imgprops.asc_putShapeProperties(n),this.api.asc_setGraphicObjectProps(this.imgprops)}Common.NotificationCenter.trigger("edit:complete",this)},onColorsBorderSelect:function(e,t){this.btnBorderColor.setColor(t),this.BorderColor={Value:1,Color:t};if(this.api&&this.BorderSize>0&&!this._noApply){var n=new Asc.asc_CShapeProperty,r=new Asc.asc_CStroke;this.BorderSize<.01?r.asc_putType(Asc.c_oAscStrokeType.STROKE_NONE):(r.asc_putType(Asc.c_oAscStrokeType.STROKE_COLOR),r.asc_putColor(Common.Utils.ThemeColor.getRgbColor(this.BorderColor.Color)),r.asc_putWidth(this._pt2mm(this.BorderSize)),r.asc_putPrstDash(this.BorderType)),n.asc_putStroke(r),this.imgprops.asc_putShapeProperties(n),this.api.asc_setGraphicObjectProps(this.imgprops)}Common.NotificationCenter.trigger("edit:complete",this)},insertFromUrl:function(){var e=this;(new Common.Views.ImageFromUrlDialog({handler:function(t,r){if(t=="ok"&&e.api){var i=r.replace(/ /g,"");if(!n.isEmpty(i)&&e.BlipFillType!==null){var s=new Asc.asc_CShapeProperty,o=new Asc.asc_CShapeFill;o.asc_putType(Asc.c_oAscFill.FILL_TYPE_BLIP),o.asc_putFill(new Asc.asc_CFillBlip),o.asc_getFill().asc_putType(e.BlipFillType),o.asc_getFill().asc_putUrl(i),s.asc_putFill(o),e.imgprops.asc_putShapeProperties(s),e.api.asc_setGraphicObjectProps(e.imgprops)}}Common.NotificationCenter.trigger("edit:complete",e)}})).show()},openAdvancedSettings:function(e){if(this.linkAdvanced.hasClass("disabled"))return;var t=this,n;if(t.api&&!this._locked){var r=t.api.asc_getGraphicObjectProps();if(r&&r.length>0){var i,s;for(var o=r.length-1;o>=0;o--){i=r[o].asc_getObjectType();if(Asc.c_oAscTypeSelectElement.Image==i){s=r[o].asc_getObjectValue(),(new SSE.Views.ShapeSettingsAdvanced({shapeProps:s,handler:function(e,n){e=="ok"&&t.api&&t.api.asc_setGraphicObjectProps(n.shapeProps),Common.NotificationCenter.trigger("edit:complete",t)}})).show();break}}}}},ChangeSettings:function(e){this._initSettings&&this.createDelayedElements(),this.imgprops==null&&(this.imgprops=new Asc.asc_CImgProperty);if(e&&e.asc_getShapeProperties()){var r=e.asc_getShapeProperties(),i=r.asc_getType();this._originalProps=r,this._noApply=!0,this.disableControls(this._locked,!r.asc_getCanFill()),this.hideShapeOnlySettings(r.asc_getFromChart()),this.hideChangeTypeSettings(i=="line"||i=="bentConnector2"||i=="bentConnector3"||i=="bentConnector4"||i=="bentConnector5"||i=="curvedConnector2"||i=="curvedConnector3"||i=="curvedConnector4"||i=="curvedConnector5"||i=="straightConnector1");var s=null,o=r.asc_getFill(),u=o.asc_getType(),a=null,f=o.asc_getTransparent();if(Math.abs(this._state.Transparency-f)>.001||Math.abs(this.numTransparency.getNumberValue()-f)>.001||(this._state.Transparency===null||f===null)&&(this._state.Transparency!==f||this.numTransparency.getNumberValue()!==f))f!==undefined&&(this.sldrTransparency.setValue(f===null?100:f/255*100,!0),this.numTransparency.setValue(this.sldrTransparency.getValue(),!0)),this._state.Transparency=f;if(o===null||u===null)this.OriginalFillType=null;else if(u==Asc.c_oAscFill.FILL_TYPE_NOFILL)this.OriginalFillType=Asc.c_oAscFill.FILL_TYPE_NOFILL;else if(u==Asc.c_oAscFill.FILL_TYPE_SOLID)o=o.asc_getFill(),a=o.asc_getColor(),a?a.asc_getType()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?this.ShapeColor={Value:1,Color:{color:Common.Utils.ThemeColor.getHexColor(a.asc_getR(),a.asc_getG(),a.asc_getB()),effectValue:a.asc_getValue()}}:this.ShapeColor={Value:1,Color:Common.Utils.ThemeColor.getHexColor(a.asc_getR(),a.asc_getG(),a.asc_getB())}:this.ShapeColor={Value:0,Color:"transparent"},this.OriginalFillType=Asc.c_oAscFill.FILL_TYPE_SOLID,this.FGColor=this.ShapeColor.Color!=="transparent"?{Value:1,Color:Common.Utils.ThemeColor.colorValue2EffectId(this.ShapeColor.Color)}:{Value:1,Color:"000000"},this.BGColor={Value:1,Color:"ffffff"},this.GradColor.colors[0]=this.ShapeColor.Color!=="transparent"?Common.Utils.ThemeColor.colorValue2EffectId(this.ShapeColor.Color):"000000",this.GradColor.colors[1]="ffffff";else if(u==Asc.c_oAscFill.FILL_TYPE_BLIP)o=o.asc_getFill(),this.BlipFillType=o.asc_getType(),this._state.BlipFillType!==this.BlipFillType&&(this.BlipFillType==Asc.c_oAscFillBlipType.STRETCH||this.BlipFillType==Asc.c_oAscFillBlipType.TILE?this.cmbFillType.setValue(this.BlipFillType):this.cmbFillType.setValue(""),this._state.BlipFillType=this.BlipFillType),this.OriginalFillType=Asc.c_oAscFill.FILL_TYPE_BLIP;else if(u==Asc.c_oAscFill.FILL_TYPE_PATT){o=o.asc_getFill(),this.PatternFillType=o.asc_getPatternType();if(this._state.PatternFillType!==this.PatternFillType){this.cmbPattern.suspendEvents();var s=this.cmbPattern.menuPicker.store.findWhere({type:this.PatternFillType});this.cmbPattern.menuPicker.selectRecord(s),this.cmbPattern.resumeEvents(),this._state.PatternFillType=this.PatternFillType}a=o.asc_getColorFg(),a?a.asc_getType()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?this.FGColor={Value:1,Color:{color:Common.Utils.ThemeColor.getHexColor(a.asc_getR(),a.asc_getG(),a.asc_getB()),effectValue:a.asc_getValue()}}:this.FGColor={Value:1,Color:Common.Utils.ThemeColor.getHexColor(a.asc_getR(),a.asc_getG(),a.asc_getB())}:this.FGColor={Value:1,Color:"000000"},a=o.asc_getColorBg(),a?a.asc_getType()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?this.BGColor={Value:1,Color:{color:Common.Utils.ThemeColor.getHexColor(a.asc_getR(),a.asc_getG(),a.asc_getB()),effectValue:a.asc_getValue()}}:this.BGColor={Value:1,Color:Common.Utils.ThemeColor.getHexColor(a.asc_getR(),a.asc_getG(),a.asc_getB())}:this.BGColor={Value:1,Color:"ffffff"},this.OriginalFillType=Asc.c_oAscFill.FILL_TYPE_PATT,this.ShapeColor={Value:1,Color:Common.Utils.ThemeColor.colorValue2EffectId(this.FGColor.Color)},this.GradColor.colors[0]=Common.Utils.ThemeColor.colorValue2EffectId(this.FGColor.Color),this.GradColor.colors[1]="ffffff"}else if(u==Asc.c_oAscFill.FILL_TYPE_GRAD){o=o.asc_getFill();var l=o.asc_getGradType();if(this._state.GradFillType!==l||this.GradFillType!==l)this.GradFillType=l,s=undefined,this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR||this.GradFillType==Asc.c_oAscFillGradType.GRAD_PATH?(this.cmbGradType.setValue(this.GradFillType),s=this.cmbGradType.store.findWhere({value:this.GradFillType}),this.onGradTypeSelect(this.cmbGradType,s.attributes)):(this.cmbGradType.setValue(""),this.btnDirection.setIconCls("")),this._state.GradFillType=this.GradFillType;if(this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR){var c=Math.floor(o.asc_getLinearAngle()/6e4);if(Math.abs(this.GradLinearDirectionType-c)>.001){this.GradLinearDirectionType=c;var h=this.mnuDirectionPicker.store.findWhere({type:c});this.mnuDirectionPicker.selectRecord(h,!0),h?this.btnDirection.setIconCls("item-gradient "+h.get("iconcls")):this.btnDirection.setIconCls("")}}var p=o.asc_getColors();p&&p.length>0&&(a=p[0],a?a.asc_getType()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?(this.GradColor.colors[0]={color:Common.Utils.ThemeColor.getHexColor(a.asc_getR(),a.asc_getG(),a.asc_getB()),effectValue:a.asc_getValue()},Common.Utils.ThemeColor.colorValue2EffectId(this.GradColor.colors[0])):this.GradColor.colors[0]=Common.Utils.ThemeColor.getHexColor(a.asc_getR(),a.asc_getG(),a.asc_getB()):this.GradColor.colors[0]="000000",a=p[1],a?a.asc_getType()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?(this.GradColor.colors[1]={color:Common.Utils.ThemeColor.getHexColor(a.asc_getR(),a.asc_getG(),a.asc_getB()),effectValue:a.asc_getValue()},Common.Utils.ThemeColor.colorValue2EffectId(this.GradColor.colors[1])):this.GradColor.colors[1]=Common.Utils.ThemeColor.getHexColor(a.asc_getR(),a.asc_getG(),a.asc_getB()):this.GradColor.colors[1]="ffffff");var d=o.asc_getPositions();if(d&&d.length>0){var v=d[0];v!==null&&(v/=1e3,this.GradColor.values[0]=v),v=d[1],v!==null&&(v/=1e3,this.GradColor.values[1]=v)}this.sldrGradient.setColorValue(Common.Utils.String.format("#{0}",typeof this.GradColor.colors[0]=="object"?this.GradColor.colors[0].color:this.GradColor.colors[0]),0),this.sldrGradient.setColorValue(Common.Utils.String.format("#{0}",typeof this.GradColor.colors[1]=="object"?this.GradColor.colors[1].color:this.GradColor.colors[1]),1),this.sldrGradient.setValue(0,this.GradColor.values[0]),this.sldrGradient.setValue(1,this.GradColor.values[1]),this.OriginalFillType=Asc.c_oAscFill.FILL_TYPE_GRAD,this.FGColor={Value:1,Color:this.GradColor.colors[0]},this.BGColor={Value:1,Color:"ffffff"},this.ShapeColor={Value:1,Color:this.GradColor.colors[0]}}this._state.FillType!==this.OriginalFillType&&(this.cmbFillSrc.setValue(this.OriginalFillType===null?"":this.OriginalFillType),this._state.FillType=this.OriginalFillType,this.ShowHideElem(this.OriginalFillType)),t(this.btnTexture.el).find(".form-control").prop("innerHTML",this.textSelectTexture);var m=typeof this.ShapeColor.Color,g=typeof this._state.ShapeColor;if(m!==g||m=="object"&&(this.ShapeColor.Color.effectValue!==this._state.ShapeColor.effectValue||this._state.ShapeColor.color.indexOf(this.ShapeColor.Color.color)<0)||m!="object"&&this._state.ShapeColor.indexOf(this.ShapeColor.Color)<0){this.btnBackColor.setColor(this.ShapeColor.Color);if(typeof this.ShapeColor.Color=="object"){var y=!1;for(var b=0;b<10;b++)if(Common.Utils.ThemeColor.ThemeValues[b]==this.ShapeColor.Color.effectValue){this.colorsBack.select(this.ShapeColor.Color,!0),y=!0;break}y||this.colorsBack.clearSelection()}else this.colorsBack.select(this.ShapeColor.Color,!0);this._state.ShapeColor=this.ShapeColor.Color}var w=r.asc_getStroke(),E=w.asc_getType(),S;w?(E==Asc.c_oAscStrokeType.STROKE_COLOR?(a=w.asc_getColor(),a?a.asc_getType()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?this.BorderColor={Value:1,Color:{color:Common.Utils.ThemeColor.getHexColor(a.asc_getR(),a.asc_getG(),a.asc_getB()),effectValue:a.asc_getValue()}}:this.BorderColor={Value:1,Color:Common.Utils.ThemeColor.getHexColor(a.asc_getR(),a.asc_getG(),a.asc_getB())}:this.BorderColor={Value:1,Color:"transparent"}):this.BorderColor={Value:1,Color:"transparent"},S=w.asc_getPrstDash()):(E=null,this.BorderColor={Value:0,Color:"transparent"}),m=typeof this.BorderColor.Color,g=typeof this._state.StrokeColor;if(m!==g||m=="object"&&(this.BorderColor.Color.effectValue!==this._state.StrokeColor.effectValue||this._state.StrokeColor.color.indexOf(this.BorderColor.Color.color)<0)||m!="object"&&(this._state.StrokeColor.indexOf(this.BorderColor.Color)<0||typeof this.btnBorderColor.color=="object")){this.btnBorderColor.setColor(this.BorderColor.Color);if(typeof this.BorderColor.Color=="object"){var y=!1;for(var b=0;b<10;b++)if(Common.Utils.ThemeColor.ThemeValues[b]==this.BorderColor.Color.effectValue){this.colorsBorder.select(this.BorderColor.Color,!0),y=!0;break}y||this.colorsBorder.clearSelection()}else this.colorsBorder.select(this.BorderColor.Color,!0);this._state.StrokeColor=this.BorderColor.Color}if(this._state.StrokeType!==E||E==Asc.c_oAscStrokeType.STROKE_COLOR){if(E==Asc.c_oAscStrokeType.STROKE_COLOR){var x=w.asc_getWidth(),T=Math.abs(this._state.StrokeWidth-x)<.001&&!(new RegExp(this.txtPt+"\\s*$")).test(this.cmbBorderSize.getRawValue());if(Math.abs(this._state.StrokeWidth-x)>.001||T||(this._state.StrokeWidth===null||x===null)&&this._state.StrokeWidth!==x){this._state.StrokeWidth=x,x!==null&&(x=this._mm2pt(x));var N=x===null?x:n.find(this.cmbBorderSize.store.models,function(e){if(x<e.attributes.value+.01&&x>e.attributes.value-.01)return!0});N?this.cmbBorderSize.selectRecord(N):this.cmbBorderSize.setValue(x!==null?parseFloat(x.toFixed(2))+" "+this.txtPt:""),this.BorderSize=x}}else E==Asc.c_oAscStrokeType.STROKE_NONE?(this._state.StrokeWidth=0,this.BorderSize=this.cmbBorderSize.store.at(0).get("value"),this.cmbBorderSize.setValue(this.BorderSize)):(this._state.StrokeWidth=null,this.BorderSize=-1,this.cmbBorderSize.setValue(null));this._state.StrokeType=E}this._state.StrokeBorderType!==S&&(this.BorderType=this._state.StrokeBorderType=S,this.cmbBorderType.setValue(S)),m=typeof this.FGColor.Color,g=typeof this._state.FGColor;if(m!==g||m=="object"&&(this.FGColor.Color.effectValue!==this._state.FGColor.effectValue||this._state.FGColor.color.indexOf(this.FGColor.Color.color)<0)||m!="object"&&this._state.FGColor.indexOf(this.FGColor.Color)<0){this.btnFGColor.setColor(this.FGColor.Color);if(typeof this.FGColor.Color=="object"){var y=!1;for(var b=0;b<10;b++)if(Common.Utils.ThemeColor.ThemeValues[b]==this.FGColor.Color.effectValue){this.colorsFG.select(this.FGColor.Color,!0),y=!0;break}y||this.colorsFG.clearSelection()}else this.colorsFG.select(this.FGColor.Color,!0);this._state.FGColor=this.FGColor.Color}m=typeof this.BGColor.Color,g=typeof this._state.BGColor;if(m!==g||m=="object"&&(this.BGColor.Color.effectValue!==this._state.BGColor.effectValue||this._state.BGColor.color.indexOf(this.BGColor.Color.color)<0)||m!="object"&&this._state.BGColor.indexOf(this.BGColor.Color)<0){this.btnBGColor.setColor(this.BGColor.Color);if(typeof this.BGColor.Color=="object"){var y=!1;for(var b=0;b<10;b++)if(Common.Utils.ThemeColor.ThemeValues[b]==this.BGColor.Color.effectValue){this.colorsBG.select(this.BGColor.Color,!0),y=!0;break}y||this.colorsBG.clearSelection()}else this.colorsBG.select(this.BGColor.Color,!0);this._state.BGColor=this.BGColor.Color}a=this.GradColor.colors[this.GradColor.currentIdx],m=typeof a,g=typeof this._state.GradColor;if(m!==g||m=="object"&&(a.effectValue!==this._state.GradColor.effectValue||this._state.GradColor.color.indexOf(a.color)<0)||m!="object"&&this._state.GradColor.indexOf(a)<0){this.btnGradColor.setColor(a);if(typeof a=="object"){var y=!1;for(var b=0;b<10;b++)if(Common.Utils.ThemeColor.ThemeValues[b]==a.effectValue){this.colorsGrad.select(a,!0),y=!0;break}y||this.colorsGrad.clearSelection()}else this.colorsGrad.select(a,!0);this._state.GradColor=a}this._noApply=!1}},createDelayedControls:function(){var e=this;this._arrFillSrc=[{displayValue:this.textColor,value:Asc.c_oAscFill.FILL_TYPE_SOLID},{displayValue:this.textGradientFill,value:Asc.c_oAscFill.FILL_TYPE_GRAD},{displayValue:this.textImageTexture,value:Asc.c_oAscFill.FILL_TYPE_BLIP},{displayValue:this.textPatternFill,value:Asc.c_oAscFill.FILL_TYPE_PATT},{displayValue:this.textNoFill,value:Asc.c_oAscFill.FILL_TYPE_NOFILL}],this.cmbFillSrc=new Common.UI.ComboBox({el:t("#shape-combo-fill-src"),cls:"input-group-nr",style:"width: 100%;",menuStyle:"min-width: 190px;",editable:!1,data:this._arrFillSrc}),this.cmbFillSrc.setValue(this._arrFillSrc[0].value),this.cmbFillSrc.on("selected",n.bind(this.onFillSrcSelect,this)),this.fillControls.push(this.cmbFillSrc),this.cmbPattern=new Common.UI.ComboDataView({itemWidth:28,itemHeight:28,menuMaxHeight:300,enableKeyEvents:!0,cls:"combo-pattern"}),this.cmbPattern.menuPicker.itemTemplate=this.cmbPattern.fieldPicker.itemTemplate=n.template(['<div class="style" id="<%= id %>">','<img src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" class="combo-pattern-item" ','width="'+this.cmbPattern.itemWidth+'" height="'+this.cmbPattern.itemHeight+'" ','style="background-position: -<%= offsetx %>px -<%= offsety %>px;"/>',"</div>"].join("")),this.cmbPattern.render(t("#shape-combo-pattern")),this.cmbPattern.openButton.menu.cmpEl.css({"min-width":178,"max-width":178}),this.cmbPattern.on("click",n.bind(this.onPatternSelect,this)),this.cmbPattern.openButton.menu.on("show:after",function(){e.cmbPattern.menuPicker.scroller.update({alwaysVisibleY:!0})}),this.fillControls.push(this.cmbPattern),this.btnInsertFromFile=new Common.UI.Button({el:t("#shape-button-from-file")}),this.fillControls.push(this.btnInsertFromFile),this.btnInsertFromUrl=new Common.UI.Button({el:t("#shape-button-from-url")}),this.fillControls.push(this.btnInsertFromUrl),this.btnInsertFromFile.on("click",n.bind(function(e){this.api&&this.api.asc_changeShapeImageFromFile(),Common.NotificationCenter.trigger("edit:complete",this)},this)),this.btnInsertFromUrl.on("click",n.bind(this.insertFromUrl,this)),this._arrFillType=[{displayValue:this.textStretch,value:Asc.c_oAscFillBlipType.STRETCH},{displayValue:this.textTile,value:Asc.c_oAscFillBlipType.TILE}],this.cmbFillType=new Common.UI.ComboBox({el:t("#shape-combo-fill-type"),cls:"input-group-nr",menuStyle:"min-width: 90px;",editable:!1,data:this._arrFillType}),this.cmbFillType.setValue(this._arrFillType[0].value),this.cmbFillType.on("selected",n.bind(this.onFillTypeSelect,this)),this.fillControls.push(this.cmbFillType),this.numTransparency=new Common.UI.MetricSpinner({el:t("#shape-spin-transparency"),step:1,width:62,value:"100 %",defaultUnit:"%",maxValue:100,minValue:0}),this.numTransparency.on("change",n.bind(this.onNumTransparencyChange,this)),this.fillControls.push(this.numTransparency),this.sldrTransparency=new Common.UI.SingleSlider({el:t("#shape-slider-transparency"),width:75,minValue:0,maxValue:100,value:100}),this.sldrTransparency.on("change",n.bind(this.onTransparencyChange,this)),this.sldrTransparency.on("changecomplete",n.bind(this.onTransparencyChangeComplete,this)),this.fillControls.push(this.sldrTransparency),this.lblTransparencyStart=t(this.el).find("#shape-lbl-transparency-start"),this.lblTransparencyEnd=t(this.el).find("#shape-lbl-transparency-end"),this._arrGradType=[{displayValue:this.textLinear,value:Asc.c_oAscFillGradType.GRAD_LINEAR},{displayValue:this.textRadial,value:Asc.c_oAscFillGradType.GRAD_PATH}],this.cmbGradType=new Common.UI.ComboBox({el:t("#shape-combo-grad-type"),cls:"input-group-nr",menuStyle:"min-width: 90px;",editable:!1,data:this._arrGradType}),this.cmbGradType.setValue(this._arrGradType[0].value),this.cmbGradType.on("selected",n.bind(this.onGradTypeSelect,this)),this.fillControls.push(this.cmbGradType),this._viewDataLinear=[{offsetx:0,offsety:0,type:45,subtype:-1,iconcls:"gradient-left-top"},{offsetx:50,offsety:0,type:90,subtype:4,iconcls:"gradient-top"},{offsetx:100,offsety:0,type:135,subtype:5,iconcls:"gradient-right-top"},{offsetx:0,offsety:50,type:0,subtype:6,iconcls:"gradient-left",cls:"item-gradient-separator",selected:!0},{offsetx:100,offsety:50,type:180,subtype:1,iconcls:"gradient-right"},{offsetx:0,offsety:100,type:315,subtype:2,iconcls:"gradient-left-bottom"},{offsetx:50,offsety:100,type:270,subtype:3,iconcls:"gradient-bottom"},{offsetx:100,offsety:100,type:225,subtype:7,iconcls:"gradient-right-bottom"}],this._viewDataRadial=[{offsetx:100,offsety:150,type:2,subtype:5,iconcls:"gradient-radial-center"}],this.btnDirection=new Common.UI.Button({cls:"btn-large-dataview",iconCls:"item-gradient gradient-left",menu:new Common.UI.Menu({style:"min-width: 60px;",menuAlign:"tr-br",items:[{template:n.template('<div id="id-shape-menu-direction" style="width: 175px; margin: 0 5px;"></div>')}]})}),this.btnDirection.on("render:after",function(r){e.mnuDirectionPicker=new Common.UI.DataView({el:t("#id-shape-menu-direction"),parentMenu:r.menu,restoreHeight:174,store:new Common.UI.DataViewStore(e._viewDataLinear),itemTemplate:n.template('<div id="<%= id %>" class="item-gradient" style="background-position: -<%= offsetx %>px -<%= offsety %>px;"></div>')})}),this.btnDirection.render(t("#shape-button-direction")),this.mnuDirectionPicker.on("item:click",n.bind(this.onSelectGradient,this,this.btnDirection)),this.fillControls.push(this.btnDirection),this.sldrGradient=new Common.UI.MultiSliderGradient({el:t("#shape-slider-gradient"),width:125,minValue:0,maxValue:100,values:[0,100]}),this.sldrGradient.on("change",n.bind(this.onGradientChange,this)),this.sldrGradient.on("changecomplete",n.bind(this.onGradientChangeComplete,this)),this.sldrGradient.on("thumbclick",function(t,n){e.GradColor.currentIdx=n;var r=e.GradColor.colors[e.GradColor.currentIdx];e.btnGradColor.setColor(r),e.colorsGrad.select(r,!1)}),this.sldrGradient.on("thumbdblclick",function(t){e.btnGradColor.cmpEl.find("button").dropdown("toggle")}),this.fillControls.push(this.sldrGradient),this.cmbBorderSize=(new Common.UI.ComboBorderSizeEditable({el:t("#shape-combo-border-size"),style:"width: 93px;",txtNoBorders:this.txtNoBorders})).on("selected",n.bind(this.onBorderSizeSelect,this)).on("changed:before",n.bind(this.onBorderSizeChanged,this,!0)).on("changed:after",n.bind(this.onBorderSizeChanged,this,!1)).on("combo:blur",n.bind(this.onComboBlur,this,!1)),this.BorderSize=this.cmbBorderSize.store.at(2).get("value"),this.cmbBorderSize.setValue(this.BorderSize),this.lockedControls.push(this.cmbBorderSize),this.cmbBorderType=(new Common.UI.ComboBorderType({el:t("#shape-combo-border-type"),style:"width: 93px;",menuStyle:"min-width: 93px;"})).on("selected",n.bind(this.onBorderTypeSelect,this)).on("combo:blur",n.bind(this.onComboBlur,this,!1)),this.BorderType=Asc.c_oDashType.solid,this.cmbBorderType.setValue(this.BorderType),this.lockedControls.push(this.cmbBorderType),this.btnChangeShape=new Common.UI.Button({cls:"btn-icon-default",iconCls:"btn-change-shape",menu:new Common.UI.Menu({menuAlign:"tr-br",cls:"menu-shapes",items:[]})}),this.btnChangeShape.render(t("#shape-btn-change")),this.lockedControls.push(this.btnChangeShape),t(this.el).on("click","#shape-advanced-link",n.bind(this.openAdvancedSettings,this)),this.linkAdvanced=t("#shape-advanced-link")},createDelayedElements:function(){this.createDelayedControls();var e=[0,1,3,2,4,53,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,22,23,24,25,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,49,50,51,52];this.patternViewData=[];for(var t=0;t<13;t++)for(var n=0;n<4;n++){var r=t*4+n;this.patternViewData[r]={offsetx:n*28,offsety:t*28,type:e[r]}}this.patternViewData.splice(this.patternViewData.length-2,2);for(var t=0;t<this.patternViewData.length;t++)this.patternViewData[t].id=Common.UI.getId();this.cmbPattern.menuPicker.store.add(this.patternViewData),this.cmbPattern.menuPicker.store.length>0&&(this.cmbPattern.fillComboView(this.cmbPattern.menuPicker.store.at(0),!0),this.PatternFillType=this.patternViewData[0].type),this.fillAutoShapes(),this.UpdateThemeColors(),this._initSettings=!1},onInitStandartTextures:function(e){var r=this;if(e&&e.length>0){this.btnTexture||(this.btnTexture=new Common.UI.ComboBox({el:t("#shape-combo-fill-texture"),template:n.template(['<div class="input-group combobox combo-dataview-menu input-group-nr dropdown-toggle" tabindex="0" data-toggle="dropdown">','<div class="form-control text" style="width: 90px;">'+this.textSelectTexture+"</div>",'<div style="display: table-cell;"></div>','<button type="button" class="btn btn-default"><span class="caret img-commonctrl"></span></button>',"</div>"].join(""))}),this.textureMenu=new Common.UI.Menu({items:[{template:n.template('<div id="id-shape-menu-texture" style="width: 233px; margin: 0 5px;"></div>')}]}),this.textureMenu.render(t("#shape-combo-fill-texture")),this.fillControls.push(this.btnTexture));var i=[];n.each(e,function(e){i.push({imageUrl:e.asc_getImage(),name:r.textureNames[e.asc_getId()],type:e.asc_getId(),selected:!1})});var s=new Common.UI.DataView({el:t("#id-shape-menu-texture"),restoreHeight:174,parentMenu:r.textureMenu,showLast:!1,store:new Common.UI.DataViewStore(i),itemTemplate:n.template('<div class="item-shape"><img src="<%= imageUrl %>" id="<%= id %>"></div>')});s.on("item:click",n.bind(this.onSelectTexture,this))}},onSelectTexture:function(e,n,r){this._fromTextureCmb=!0,this.cmbFillType.setValue(this._arrFillType[1].value),this._fromTextureCmb=!1;if(this.api){var i=new Asc.asc_CShapeProperty,s=new Asc.asc_CShapeFill;s.asc_putType(Asc.c_oAscFill.FILL_TYPE_BLIP),s.asc_putFill(new Asc.asc_CFillBlip),s.asc_getFill().asc_putType(Asc.c_oAscFillBlipType.TILE),s.asc_getFill().asc_putTextureId(r.get("type")),i.asc_putFill(s),this.imgprops.asc_putShapeProperties(i),this.api.asc_setGraphicObjectProps(this.imgprops)}t(this.btnTexture.el).find(".form-control").prop("innerHTML",r.get("name")),Common.NotificationCenter.trigger("edit:complete",this)},fillAutoShapes:function(){var e=this,r=this.application.getCollection("ShapeGroups"),i=r.length;for(var s=0;s<i-1;s++){var o=r.at(s),u=new Common.UI.MenuItem({caption:o.get("groupName"),menu:new Common.UI.Menu({menuAlign:"tr-tl",items:[{template:n.template('<div id="id-shape-menu-shapegroup'+s+'" class="menu-shape" style="width: '+(o.get("groupWidth")-8)+'px; margin-left: 5px;"></div>')}]})});e.btnChangeShape.menu.addItem(u);var a=new Common.UI.DataView({el:t("#id-shape-menu-shapegroup"+s),store:o.get("groupStore"),parentMenu:u.menu,showLast:!1,itemTemplate:n.template('<div class="item-shape"><img src="<%= imageUrl %>" id="<%= id %>"></div>')});a.on("item:click",function(t,n,r,i){e.api&&(e.api.asc_changeShapeType(r.get("data").shapeType),Common.NotificationCenter.trigger("edit:complete",e)),i.type!=="click"&&e.btnChangeShape.menu.hide()})}},UpdateThemeColors:function(){this.btnBackColor||(this.btnBackColor=new Common.UI.ColorButton({style:"width:45px;",menu:new Common.UI.Menu({items:[{template:n.template('<div id="shape-back-color-menu" style="width: 169px; height: 220px; margin: 10px;"></div>')},{template:n.template('<a id="shape-back-color-new" style="padding-left:12px;">'+this.textNewColor+"</a>")}]})}),this.btnBackColor.render(t("#shape-back-color-btn")),this.btnBackColor.setColor("transparent"),this.fillControls.push(this.btnBackColor),this.colorsBack=new Common.UI.ThemeColorPalette({el:t("#shape-back-color-menu"),value:"transparent",transparent:!0}),this.colorsBack.on("select",n.bind(this.onColorsBackSelect,this)),t(this.el).on("click","#shape-back-color-new",n.bind(this.addNewColor,this,this.colorsBack,this.btnBackColor)),this.btnBorderColor=new Common.UI.ColorButton({style:"width:45px;",menu:new Common.UI.Menu({items:[{template:n.template('<div id="shape-border-color-menu" style="width: 169px; height: 220px; margin: 10px;"></div>')},{template:n.template('<a id="shape-border-color-new" style="padding-left:12px;">'+this.textNewColor+"</a>")}]})}),this.btnBorderColor.render(t("#shape-border-color-btn")),this.btnBorderColor.setColor("000000"),this.lockedControls.push(this.btnBorderColor),this.colorsBorder=new Common.UI.ThemeColorPalette({el:t("#shape-border-color-menu"),value:"000000"}),this.colorsBorder.on("select",n.bind(this.onColorsBorderSelect,this)),t(this.el).on("click","#shape-border-color-new",n.bind(this.addNewColor,this,this.colorsBorder,this.btnBorderColor)),this.btnFGColor=new Common.UI.ColorButton({style:"width:45px;",menu:new Common.UI.Menu({items:[{template:n.template('<div id="shape-foreground-color-menu" style="width: 169px; height: 220px; margin: 10px;"></div>')},{template:n.template('<a id="shape-foreground-color-new" style="padding-left:12px;">'+this.textNewColor+"</a>")}]})}),this.btnFGColor.render(t("#shape-foreground-color-btn")),this.btnFGColor.setColor("000000"),this.fillControls.push(this.btnFGColor),this.colorsFG=new Common.UI.ThemeColorPalette({el:t("#shape-foreground-color-menu"),value:"000000"}),this.colorsFG.on("select",n.bind(this.onColorsFGSelect,this)),t(this.el).on("click","#shape-foreground-color-new",n.bind(this.addNewColor,this,this.colorsFG,this.btnFGColor)),this.btnBGColor=new Common.UI.ColorButton({style:"width:45px;",menu:new Common.UI.Menu({items:[{template:n.template('<div id="shape-background-color-menu" style="width: 169px; height: 220px; margin: 10px;"></div>')},{template:n.template('<a id="shape-background-color-new" style="padding-left:12px;">'+this.textNewColor+"</a>")}]})}),this.btnBGColor.render(t("#shape-background-color-btn")),this.btnBGColor.setColor("ffffff"),this.fillControls.push(this.btnBGColor),this.colorsBG=new Common.UI.ThemeColorPalette({el:t("#shape-background-color-menu"),value:"ffffff"}),this.colorsBG.on("select",n.bind(this.onColorsBGSelect,this)),t(this.el).on("click","#shape-background-color-new",n.bind(this.addNewColor,this,this.colorsBG,this.btnBGColor)),this.btnGradColor=new Common.UI.ColorButton({style:"width:45px;",menu:new Common.UI.Menu({items:[{template:n.template('<div id="shape-gradient-color-menu" style="width: 169px; height: 220px; margin: 10px;"></div>')},{template:n.template('<a id="shape-gradient-color-new" style="padding-left:12px;">'+this.textNewColor+"</a>")}]})}),this.btnGradColor.render(t("#shape-gradient-color-btn")),this.btnGradColor.setColor("000000"),this.fillControls.push(this.btnGradColor),this.colorsGrad=new Common.UI.ThemeColorPalette({el:t("#shape-gradient-color-menu"),value:"000000"}),this.colorsGrad.on("select",n.bind(this.onColorsGradientSelect,this)),t(this.el).on("click","#shape-gradient-color-new",n.bind(this.addNewColor,this,this.colorsGrad,this.btnGradColor))),this.colorsBorder.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors()),this.colorsBack.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors()),this.colorsFG.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors()),this.colorsBG.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors()),this.colorsGrad.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors())},_pt2mm:function(e){return e*25.4/72},_mm2pt:function(e){return e*72/25.4},disableFillPanels:function(e){this._state.DisabledFillPanels!==e&&(this._state.DisabledFillPanels=e,n.each(this.fillControls,function(t){t.setDisabled(e)}),this.lblTransparencyStart.toggleClass("disabled",e),this.lblTransparencyEnd.toggleClass("disabled",e))},ShowHideElem:function(e){this.FillColorContainer.toggleClass("settings-hidden",e!==Asc.c_oAscFill.FILL_TYPE_SOLID),this.FillImageContainer.toggleClass("settings-hidden",e!==Asc.c_oAscFill.FILL_TYPE_BLIP),this.FillPatternContainer.toggleClass("settings-hidden",e!==Asc.c_oAscFill.FILL_TYPE_PATT),this.FillGradientContainer.toggleClass("settings-hidden",e!==Asc.c_oAscFill.FILL_TYPE_GRAD),this.TransparencyContainer.toggleClass("settings-hidden",e===Asc.c_oAscFill.FILL_TYPE_NOFILL||e===null)},setLocked:function(e){this._locked=e},disableControls:function(e,t){if(this._initSettings)return;this.disableFillPanels(e||t),this._state.DisabledControls!==e&&(this._state.DisabledControls=e,n.each(this.lockedControls,function(t){t.setDisabled(e)}),this.linkAdvanced.toggleClass("disabled",e))},hideShapeOnlySettings:function(e){this._state.HideShapeOnlySettings!==e&&(this._state.HideShapeOnlySettings=e,this.ShapeOnlySettings.toggleClass("hidden",e==1))},hideChangeTypeSettings:function(e){this._state.HideChangeTypeSettings!==e&&(this._state.HideChangeTypeSettings=e,this.CanChangeType.toggleClass("hidden",e==1))},txtNoBorders:"No Line",strStroke:"Stroke",strColor:"Color",strSize:"Size",strChange:"Change Autoshape",strFill:"Fill",textColor:"Color Fill",textImageTexture:"Picture or Texture",textTexture:"From Texture",textFromUrl:"From URL",textFromFile:"From File",textStretch:"Stretch",textTile:"Tile",txtCanvas:"Canvas",txtCarton:"Carton",txtDarkFabric:"Dark Fabric",txtGrain:"Grain",txtGranite:"Granite",txtGreyPaper:"Grey Paper",txtKnit:"Knit",txtLeather:"Leather",txtBrownPaper:"Brown Paper",txtPapyrus:"Papyrus",txtWood:"Wood",textNewColor:"Add New Custom Color",textAdvanced:"Show advanced settings",strTransparency:"Opacity",textNoFill:"No Fill",textSelectTexture:"Select",textGradientFill:"Gradient Fill",textPatternFill:"Pattern",strBackground:"Background color",strForeground:"Foreground color",strPattern:"Pattern",textEmptyPattern:"No Pattern",textLinear:"Linear",textRadial:"Radial",textDirection:"Direction",textStyle:"Style",textGradient:"Gradient",textBorderSizeErr:"The entered value is incorrect.<br>Please enter a value between 0 pt and 1584 pt.",strType:"Type"},SSE.Views.ShapeSettings||{}))}),define("text!spreadsheeteditor/main/app/template/TextArtSettings.template",[],function(){return'<table cols="1">\r\n <tr>\r\n <td>\r\n <label class="header"><%= scope.textTemplate %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <div class="" id="textart-combo-template" style="width: 100%; height: 64px;"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <div class="separator horizontal"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td>\r\n <label class="header"><%= scope.strFill %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <div id="textart-combo-fill-src" style="width: 100%;"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td>\r\n <div id="textart-panel-color-fill" class="padding-small" style="width: 100%;">\r\n <div id="textart-back-color-btn" style=""></div>\r\n </div>\r\n <div id="textart-panel-image-fill" class="settings-hidden padding-small" style="width: 100%;">\r\n <table cols="2" style="width: 100%;">\r\n <tr>\r\n <td class="padding-small" width="50%">\r\n <button type="button" class="btn btn-text-default" id="textart-button-from-file" style="width:90px;"><%= scope.textFromFile %></button>\r\n </td>\r\n <td class="padding-small" width="50%">\r\n <button type="button" class="btn btn-text-default" id="textart-button-from-url" style="width:90px;float:right;"><%= scope.textFromUrl %></button>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td style="vertical-align: top">\r\n <div id="textart-combo-fill-type" style="width: 90px;"></div>\r\n </td>\r\n <td rowspan="2">\r\n <div style="width: 90px; height: 80px; padding: 14px 20px; border: 1px solid #AFAFAF; border-radius: 2px; background: #ffffff;float:right;">\r\n <div id="textart-texture-img" style="width: 50px;height: 50px;"></div>\r\n </div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td style="vertical-align: bottom">\r\n <label class="input-label" style=""><%= scope.textTexture %></label>\r\n <div id="textart-combo-fill-texture" style="width: 90px;"></div>\r\n </td>\r\n </tr>\r\n </table>\r\n </div>\r\n <div id="textart-panel-pattern-fill" class="settings-hidden padding-small" style="width: 100%;">\r\n <label class="input-label" style="margin-top: 3px;"><%= scope.strPattern %></label>\r\n <div id="textart-combo-pattern" style="width: 100%; height: 42px; margin-bottom: 8px;"></div>\r\n <div style="width: 100%; height: 25px; margin-bottom: 8px;">\r\n <label class="input-label" style="margin-top: 3px;"><%= scope.strForeground %></label>\r\n <div id="textart-foreground-color-btn" style="display: inline-block; float:right;"></div>\r\n </div>\r\n <div style="width: 100%; height: 25px;">\r\n <label class="input-label" style="margin-top: 3px;"><%= scope.strBackground %></label>\r\n <div id="textart-background-color-btn" style="display: inline-block; float:right;"></div>\r\n </div>\r\n </div>\r\n <div id="textart-panel-gradient-fill" class="settings-hidden padding-small" style="width: 100%;">\r\n <div style="height:80px;">\r\n <div style="display: inline-block;">\r\n <label class="input-label" style=""><%= scope.textStyle %></label>\r\n <div id="textart-combo-grad-type" style="width: 90px;"></div>\r\n </div>\r\n <div style="display: inline-block;float: right;">\r\n <label class="input-label" style=""><%= scope.textDirection %></label>\r\n <div id="textart-button-direction" style=""></div>\r\n </div>\r\n </div>\r\n <label class="header" style="display:block;margin-bottom: 5px;"><%= scope.textGradient %></label>\r\n <div style="display: inline-block; margin-top: 3px;">\r\n <div id="textart-slider-gradient" style="display: inline-block; vertical-align: middle;"></div>\r\n </div>\r\n <div id="textart-gradient-color-btn" style="display: inline-block;float: right;"></div>\r\n </div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td>\r\n <div class="padding-small" id="textart-panel-transparent-fill" style="width: 100%;">\r\n <label class="header" style="display:block;"><%= scope.strTransparency %></label>\r\n <div style="display: inline-block; margin-top: 3px;">\r\n <label id="textart-lbl-transparency-start">0</label>\r\n <div id="textart-slider-transparency" style="display: inline-block;margin: 0 4px; vertical-align: middle;"></div>\r\n <label id="textart-lbl-transparency-end">100</label>\r\n </div>\r\n <div id="textart-spin-transparency" style="display: inline-block;float: right;"></div>\r\n </div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <div class="separator horizontal"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td>\r\n <label class="header"><%= scope.strStroke %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <div style="display:inline-block;width:100px;vertical-align: middle;">\r\n <label class="input-label" style=""><%= scope.strSize %></label>\r\n <div id="textart-combo-border-size" style="width: 93px;"></div>\r\n </div>\r\n <div style="display:inline-block;vertical-align: middle;">\r\n <label class="input-label" style=""><%= scope.strColor %></label>\r\n <div id="textart-border-color-btn" style=""></div>\r\n </div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <div style="display:inline-block;width:100px;vertical-align: middle;">\r\n <label class="input-label" style=""><%= scope.strType %></label>\r\n <div id="textart-combo-border-type" style="width: 93px;"></div>\r\n </div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <div class="separator horizontal"></div>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td>\r\n <label class="header"><%= scope.textTransform %></label>\r\n </td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small">\r\n <div class="" id="textart-combo-transform" style="width: 100%; height: 42px;"></div>\r\n </td>\r\n </tr>\r\n <tr class="finish-cell"></tr>\r\n</table>'}),define("spreadsheeteditor/main/app/view/TextArtSettings",["text!spreadsheeteditor/main/app/template/TextArtSettings.template","jquery","underscore","backbone","common/main/lib/component/ComboBox","common/main/lib/component/ComboBorderSize","common/main/lib/component/MetricSpinner","common/main/lib/component/ThemeColorPalette","common/main/lib/component/ColorButton","common/main/lib/component/ComboDataView","common/main/lib/component/Slider","common/main/lib/component/MultiSliderGradient","common/main/lib/view/ImageFromUrlDialog"],function(e,t,n,r){"use strict";SSE.Views.TextArtSettings=r.View.extend(n.extend({el:"#id-textart-settings",template:n.template(e),events:{},options:{alias:"TextArtSettings"},initialize:function(){this._initSettings=!0,this._noApply=!0,this.imgprops=null,this.shapeprops=null,this._sendUndoPoint=!0,this._sliderChanged=!1,this.txtPt=Common.Utils.Metric.getMetricName(Common.Utils.Metric.c_MetricUnits.pt),this._state={Transparency:null,FillType:Asc.c_oAscFill.FILL_TYPE_SOLID,ShapeColor:"transparent",BlipFillType:Asc.c_oAscFillBlipType.STRETCH,StrokeType:Asc.c_oAscStrokeType.STROKE_COLOR,StrokeWidth:this._pt2mm(1),StrokeColor:"000000",StrokeBorderType:Asc.c_oDashType.solid,FGColor:"000000",BGColor:"ffffff",GradColor:"000000",GradFillType:Asc.c_oAscFillGradType.GRAD_LINEAR,FormId:null,DisabledControls:!1},this.lockedControls=[],this._locked=!1,this.OriginalFillType=Asc.c_oAscFill.FILL_TYPE_SOLID,this.ShapeColor={Value:1,Color:"transparent"},this.BlipFillType=Asc.c_oAscFillBlipType.STRETCH,this.GradFillType=Asc.c_oAscFillGradType.GRAD_LINEAR,this.GradColor={values:[0,100],colors:["000000","ffffff"],currentIdx:0},this.GradRadialDirectionIdx=0,this.GradLinearDirectionType=0,this.PatternFillType=0,this.FGColor={Value:1,Color:"000000"},this.BGColor={Value:1,Color:"ffffff"},this.BorderColor={Value:1,Color:"transparent"},this.BorderSize=0,this.BorderType=Asc.c_oDashType.solid,this.textureNames=[this.txtCanvas,this.txtCarton,this.txtDarkFabric,this.txtGrain,this.txtGranite,this.txtGreyPaper,this.txtKnit,this.txtLeather,this.txtBrownPaper,this.txtPapyrus,this.txtWood],this.render(),this.FillColorContainer=t("#textart-panel-color-fill"),this.FillImageContainer=t("#textart-panel-image-fill"),this.FillPatternContainer=t("#textart-panel-pattern-fill"),this.FillGradientContainer=t("#textart-panel-gradient-fill"),this.TransparencyContainer=t("#textart-panel-transparent-fill")},render:function(){var e=t(this.el);e.html(this.template({scope:this}))},setApi:function(e){return this.api=e,this.api&&(this.api.asc_setInterfaceDrawImagePlaceTextArt("textart-texture-img"),this.api.asc_registerCallback("asc_onInitStandartTextures",n.bind(this.onInitStandartTextures,this))),this},onFillSrcSelect:function(e,t){this.ShowHideElem(t.value);switch(t.value){case Asc.c_oAscFill.FILL_TYPE_SOLID:this._state.FillType=Asc.c_oAscFill.FILL_TYPE_SOLID;if(!this._noApply){var n=new Asc.asc_TextArtProperties,r=new Asc.asc_CShapeFill;r.asc_putType(Asc.c_oAscFill.FILL_TYPE_SOLID),r.asc_putFill(new Asc.asc_CFillSolid),r.asc_getFill().asc_putColor(Common.Utils.ThemeColor.getRgbColor(this.ShapeColor.Color=="transparent"?{color:"4f81bd",effectId:24}:this.ShapeColor.Color)),n.asc_putFill(r),this.shapeprops.put_TextArtProperties(n),this.api.asc_setGraphicObjectProps(this.imgprops)}break;case Asc.c_oAscFill.FILL_TYPE_GRAD:this._state.FillType=Asc.c_oAscFill.FILL_TYPE_GRAD;if(!this._noApply){var n=new Asc.asc_TextArtProperties,r=new Asc.asc_CShapeFill;r.asc_putType(Asc.c_oAscFill.FILL_TYPE_GRAD),r.asc_putFill(new Asc.asc_CFillGrad),r.asc_getFill().asc_putGradType(this.GradFillType),this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR&&(r.asc_getFill().asc_putLinearAngle(this.GradLinearDirectionType*6e4),r.asc_getFill().asc_putLinearScale(!0));if(this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_GRAD){var i=Common.Utils.ThemeColor.getRgbColor(this.GradColor.colors[0]).get_color().get_hex(),s=Common.Utils.ThemeColor.getRgbColor(this.GradColor.colors[1]).get_color().get_hex();i==="ffffff"&&s==="ffffff"?i={color:"4f81bd",effectId:24}:i=this.GradColor.colors[0],r.asc_getFill().asc_putPositions([this.GradColor.values[0]*1e3,this.GradColor.values[1]*1e3]),r.asc_getFill().asc_putColors([Common.Utils.ThemeColor.getRgbColor(i),Common.Utils.ThemeColor.getRgbColor(this.GradColor.colors[1])])}n.asc_putFill(r),this.shapeprops.put_TextArtProperties(n),this.api.asc_setGraphicObjectProps(this.imgprops)}break;case Asc.c_oAscFill.FILL_TYPE_BLIP:this._state.FillType=Asc.c_oAscFill.FILL_TYPE_BLIP;break;case Asc.c_oAscFill.FILL_TYPE_PATT:this._state.FillType=Asc.c_oAscFill.FILL_TYPE_PATT;if(!this._noApply){var n=new Asc.asc_TextArtProperties,r=new Asc.asc_CShapeFill;r.asc_putType(Asc.c_oAscFill.FILL_TYPE_PATT),r.asc_putFill(new Asc.asc_CFillHatch),r.asc_getFill().asc_putPatternType(this.PatternFillType);var o=Common.Utils.ThemeColor.getRgbColor(this.FGColor.Color).get_color().get_hex(),u=Common.Utils.ThemeColor.getRgbColor(this.BGColor.Color).get_color().get_hex();u==="ffffff"&&o==="ffffff"?o={color:"4f81bd",effectId:24}:o=this.FGColor.Color,r.asc_getFill().asc_putColorFg(Common.Utils.ThemeColor.getRgbColor(o)),r.asc_getFill().asc_putColorBg(Common.Utils.ThemeColor.getRgbColor(this.BGColor.Color)),n.asc_putFill(r),this.shapeprops.put_TextArtProperties(n),this.api.asc_setGraphicObjectProps(this.imgprops)}break;case Asc.c_oAscFill.FILL_TYPE_NOFILL:this._state.FillType=Asc.c_oAscFill.FILL_TYPE_NOFILL;if(!this._noApply){var n=new Asc.asc_TextArtProperties,r=new Asc.asc_CShapeFill;r.asc_putType(Asc.c_oAscFill.FILL_TYPE_NOFILL),r.asc_putFill(null),n.asc_putFill(r),this.shapeprops.put_TextArtProperties(n),this.api.asc_setGraphicObjectProps(this.imgprops)}}Common.NotificationCenter.trigger("edit:complete",this)},onColorsBackSelect:function(e,t){this.btnBackColor.setColor(t),this.ShapeColor={Value:1,Color:t};if(this.api&&!this._noApply){var n=new Asc.asc_TextArtProperties,r=new Asc.asc_CShapeFill;this.ShapeColor.Color=="transparent"?(r.asc_putType(Asc.c_oAscFill.FILL_TYPE_NOFILL),r.asc_putFill(null)):(r.asc_putType(Asc.c_oAscFill.FILL_TYPE_SOLID),r.asc_putFill(new Asc.asc_CFillSolid),r.asc_getFill().asc_putColor(Common.Utils.ThemeColor.getRgbColor(this.ShapeColor.Color))),n.asc_putFill(r),this.shapeprops.put_TextArtProperties(n),this.api.asc_setGraphicObjectProps(this.imgprops)}Common.NotificationCenter.trigger("edit:complete",this)},addNewColor:function(e,t){e.addNewColor(typeof t.color=="object"?t.color.color:t.color)},onPatternSelect:function(e,t){if(this.api&&!this._noApply){this.PatternFillType=t.get("type");var n=new Asc.asc_TextArtProperties,r=new Asc.asc_CShapeFill;r.asc_putType(Asc.c_oAscFill.FILL_TYPE_PATT),r.asc_putFill(new Asc.asc_CFillHatch),r.asc_getFill().asc_putPatternType(this.PatternFillType),this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_PATT&&(r.asc_getFill().asc_putColorFg(Common.Utils.ThemeColor.getRgbColor(this.FGColor.Color)),r.asc_getFill().asc_putColorBg(Common.Utils.ThemeColor.getRgbColor(this.BGColor.Color))),n.asc_putFill(r),this.shapeprops.put_TextArtProperties(n),this.api.asc_setGraphicObjectProps(this.imgprops)}Common.NotificationCenter.trigger("edit:complete",this)},onColorsFGSelect:function(e,t){this.btnFGColor.setColor(t),this.FGColor={Value:1,Color:t};if(this.api&&!this._noApply){var n=new Asc.asc_TextArtProperties,r=new Asc.asc_CShapeFill;r.asc_putType(Asc.c_oAscFill.FILL_TYPE_PATT),r.asc_putFill(new Asc.asc_CFillHatch),r.asc_getFill().asc_putColorFg(Common.Utils.ThemeColor.getRgbColor(this.FGColor.Color)),this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_PATT&&(r.asc_getFill().asc_putPatternType(this.PatternFillType),r.asc_getFill().asc_putColorBg(Common.Utils.ThemeColor.getRgbColor(this.BGColor.Color))),n.asc_putFill(r),this.shapeprops.put_TextArtProperties(n),this.api.asc_setGraphicObjectProps(this.imgprops)}Common.NotificationCenter.trigger("edit:complete",this)},onColorsBGSelect:function(e,t){this.btnBGColor.setColor(t),this.BGColor={Value:1,Color:t};if(this.api&&!this._noApply){var n=new Asc.asc_TextArtProperties,r=new Asc.asc_CShapeFill;r.asc_putType(Asc.c_oAscFill.FILL_TYPE_PATT),r.asc_putFill(new Asc.asc_CFillHatch),this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_PATT&&(r.asc_getFill().asc_putPatternType(this.PatternFillType),r.asc_getFill().asc_putColorFg(Common.Utils.ThemeColor.getRgbColor(this.FGColor.Color))),r.asc_getFill().asc_putColorBg(Common.Utils.ThemeColor.getRgbColor(this.BGColor.Color)),n.asc_putFill(r),this.shapeprops.put_TextArtProperties(n),this.api.asc_setGraphicObjectProps(this.imgprops)}Common.NotificationCenter.trigger("edit:complete",this)},onFillTypeSelect:function(e,t){this.BlipFillType=t.value;if(this.api&&this._fromTextureCmb!==!0&&this.OriginalFillType==Asc.c_oAscFill.FILL_TYPE_BLIP){var n=new Asc.asc_TextArtProperties,r=new Asc.asc_CShapeFill;r.asc_putType(Asc.c_oAscFill.FILL_TYPE_BLIP),r.asc_putFill(new Asc.asc_CFillBlip),r.asc_getFill().asc_putType(this.BlipFillType),n.asc_putFill(r),this.shapeprops.put_TextArtProperties(n),this.api.asc_setGraphicObjectProps(this.imgprops)}Common.NotificationCenter.trigger("edit:complete",this)},onNumTransparencyChange:function(e,t,n,r){this.sldrTransparency.setValue(e.getNumberValue(),!0);if(this.api){var i=e.getNumberValue(),s=new Asc.asc_TextArtProperties,o=new Asc.asc_CShapeFill;o.asc_putTransparent(i*2.55),s.asc_putFill(o),this.shapeprops.put_TextArtProperties(s),this.api.asc_setGraphicObjectProps(this.imgprops)}Common.NotificationCenter.trigger("edit:complete",this)},onTransparencyChange:function(e,t,r){this._sliderChanged=t,this.numTransparency.setValue(t,!0),this._sendUndoPoint&&(this.api.setStartPointHistory(),this._sendUndoPoint=!1,this.updateslider=setInterval(n.bind(this._transparencyApplyFunc,this),100))},onTransparencyChangeComplete:function(e,t,n){clearInterval(this.updateslider),this._sliderChanged=t,this.api.setEndPointHistory(),this._transparencyApplyFunc(),this._sendUndoPoint=!0},_transparencyApplyFunc:function(){if(this._sliderChanged!==undefined){var e=new Asc.asc_TextArtProperties,t=new Asc.asc_CShapeFill;t.asc_putTransparent(this._sliderChanged*2.55),e.asc_putFill(t),this.shapeprops.put_TextArtProperties(e),this.api.asc_setGraphicObjectProps(this.imgprops),this._sliderChanged=undefined}},onGradTypeSelect:function(e,t){this.GradFillType=t.value;if(this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR){this.mnuDirectionPicker.store.reset(this._viewDataLinear),this.mnuDirectionPicker.cmpEl.width(175),this.mnuDirectionPicker.restoreHeight=174;var t=this.mnuDirectionPicker.store.findWhere({type:this.GradLinearDirectionType});this.mnuDirectionPicker.selectRecord(t,!0),t?this.btnDirection.setIconCls("item-gradient "+t.get("iconcls")):this.btnDirection.setIconCls("")}else this.GradFillType==Asc.c_oAscFillGradType.GRAD_PATH&&(this.mnuDirectionPicker.store.reset(this._viewDataRadial),this.mnuDirectionPicker.cmpEl.width(60),this.mnuDirectionPicker.restoreHeight=58,this.mnuDirectionPicker.selectByIndex(this.GradRadialDirectionIdx,!0),this.GradRadialDirectionIdx>=0?this.btnDirection.setIconCls("item-gradient "+this._viewDataRadial[this.GradRadialDirectionIdx].iconcls):this.btnDirection.setIconCls(""));if(this.api&&!this._noApply){var n=new Asc.asc_TextArtProperties,r=new Asc.asc_CShapeFill;r.asc_putType(Asc.c_oAscFill.FILL_TYPE_GRAD),r.asc_putFill(new Asc.asc_CFillGrad),r.asc_getFill().asc_putGradType(this.GradFillType),this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR&&(r.asc_getFill().asc_putLinearAngle(this.GradLinearDirectionType*6e4),r.asc_getFill().asc_putLinearScale(!0)),n.asc_putFill(r),this.shapeprops.put_TextArtProperties(n),this.api.asc_setGraphicObjectProps(this.imgprops)}Common.NotificationCenter.trigger("edit:complete",this)},onSelectGradient:function(e,t,r,i){if(this._noApply)return;var s={},o=n.isFunction(i.toJSON);if(o){if(!i.get("selected"))return;s=i.toJSON()}else s=i;this.btnDirection.setIconCls("item-gradient "+s.iconcls),this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR?this.GradLinearDirectionType=s.type:this.GradRadialDirectionIdx=0;if(this.api&&this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR){var u=new Asc.asc_TextArtProperties,a=new Asc.asc_CShapeFill;a.asc_putType(Asc.c_oAscFill.FILL_TYPE_GRAD),a.asc_putFill(new Asc.asc_CFillGrad),a.asc_getFill().asc_putGradType(this.GradFillType),a.asc_getFill().asc_putLinearAngle(s.type*6e4),a.asc_getFill().asc_putLinearScale(!0),u.asc_putFill(a),this.shapeprops.put_TextArtProperties(u),this.api.asc_setGraphicObjectProps(this.imgprops)}Common.NotificationCenter.trigger("edit:complete",this)},onColorsGradientSelect:function(e,t){this.btnGradColor.setColor(t),this.GradColor.colors[this.GradColor.currentIdx]=t,this.sldrGradient.setColorValue(Common.Utils.String.format("#{0}",typeof t=="object"?t.color:t));if(this.api&&!this._noApply){var n=new Asc.asc_TextArtProperties,r=new Asc.asc_CShapeFill;r.asc_putType(Asc.c_oAscFill.FILL_TYPE_GRAD),r.asc_putFill(new Asc.asc_CFillGrad),r.asc_getFill().asc_putGradType(this.GradFillType),r.asc_getFill().asc_putColors([Common.Utils.ThemeColor.getRgbColor(this.GradColor.colors[0]),Common.Utils.ThemeColor.getRgbColor(this.GradColor.colors[1])]),this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_GRAD&&(this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR&&(r.asc_getFill().asc_putLinearAngle(this.GradLinearDirectionType*6e4),r.asc_getFill().asc_putLinearScale(!0)),r.asc_getFill().asc_putPositions([this.GradColor.values[0]*1e3,this.GradColor.values[1]*1e3])),n.asc_putFill(r),this.shapeprops.put_TextArtProperties(n),this.api.asc_setGraphicObjectProps(this.imgprops)}Common.NotificationCenter.trigger("edit:complete",this)},onGradientChange:function(e,t,r){this.GradColor.values=e.getValues(),this._sliderChanged=!0,this.api&&!this._noApply&&this._sendUndoPoint&&(this.api.setStartPointHistory(),this._sendUndoPoint=!1,this.updateslider=setInterval(n.bind(this._gradientApplyFunc,this),100))},onGradientChangeComplete:function(e,t,n){clearInterval(this.updateslider),this._sliderChanged=!0,this.api.setEndPointHistory(),this._gradientApplyFunc(),this._sendUndoPoint=!0},_gradientApplyFunc:function(){if(this._sliderChanged){var e=new Asc.asc_TextArtProperties,t=new Asc.asc_CShapeFill;t.asc_putType(Asc.c_oAscFill.FILL_TYPE_GRAD),t.asc_putFill(new Asc.asc_CFillGrad),t.asc_getFill().asc_putGradType(this.GradFillType),t.asc_getFill().asc_putPositions([this.GradColor.values[0]*1e3,this.GradColor.values[1]*1e3]),this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_GRAD&&(this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR&&(t.asc_getFill().asc_putLinearAngle(this.GradLinearDirectionType*6e4),t.asc_getFill().asc_putLinearScale(!0)),t.asc_getFill().asc_putColors([Common.Utils.ThemeColor.getRgbColor(this.GradColor.colors[0]),Common.Utils.ThemeColor.getRgbColor(this.GradColor.colors[1])])),e.asc_putFill(t),this.shapeprops.put_TextArtProperties(e),this.api.asc_setGraphicObjectProps(this.imgprops),this._sliderChanged=!1}},applyBorderSize:function(e){e=parseFloat(e),e=isNaN(e)?0:Math.max(0,Math.min(1584,e)),this.BorderSize=e;if(this.api&&!this._noApply){var t=new Asc.asc_TextArtProperties,n=new Asc.asc_CStroke;this.BorderSize<.01?(n.asc_putType(Asc.c_oAscStrokeType.STROKE_NONE),this._state.StrokeType=this._state.StrokeWidth=-1):(n.asc_putType(Asc.c_oAscStrokeType.STROKE_COLOR),this.BorderColor.Color=="transparent"||this.BorderColor.Color.color=="transparent"?n.asc_putColor(Common.Utils.ThemeColor.getRgbColor({color:"000000",effectId:29})):(this._state.StrokeType==Asc.c_oAscStrokeType.STROKE_NONE||this._state.StrokeType===null)&&n.asc_putColor(Common.Utils.ThemeColor.getRgbColor(Common.Utils.ThemeColor.colorValue2EffectId(this.BorderColor.Color))),n.asc_putPrstDash(this.BorderType),n.asc_putWidth(this._pt2mm(this.BorderSize))),t.asc_putLine(n),this.shapeprops.put_TextArtProperties(t),this.api.asc_setGraphicObjectProps(this.imgprops)}Common.NotificationCenter.trigger("edit:complete",this)},onComboBlur:function(){Common.NotificationCenter.trigger("edit:complete",this)},onBorderSizeChanged:function(e,t,r,i){var s=this;if(e){var o=parseFloat(r.value),u=new RegExp("^\\s*(\\d*(\\.|,)?\\d+)\\s*("+s.txtPt+")?\\s*$");if(!u.exec(r.value)||o<0||o>1584)this._state.StrokeType=this._state.StrokeWidth=-1,Common.UI.error({msg:this.textBorderSizeErr,callback:function(){n.defer(function(e){Common.NotificationCenter.trigger("edit:complete",s)})}})}else this.applyBorderSize(r.value)},onBorderSizeSelect:function(e,t){this.applyBorderSize(t.value)},onBorderTypeSelect:function(e,t){this.BorderType=t.value;if(this.api&&!this._noApply){var n=new Asc.asc_TextArtProperties,r=new Asc.asc_CStroke;this.BorderSize<.01?r.put_type(Asc.c_oAscStrokeType.STROKE_NONE):(r.put_type(Asc.c_oAscStrokeType.STROKE_COLOR),r.put_color(Common.Utils.ThemeColor.getRgbColor(this.BorderColor.Color)),r.put_width(this._pt2mm(this.BorderSize)),r.asc_putPrstDash(this.BorderType)),n.asc_putLine(r),this.shapeprops.put_TextArtProperties(n),this.api.asc_setGraphicObjectProps(this.imgprops)}Common.NotificationCenter.trigger("edit:complete",this)},onColorsBorderSelect:function(e,t){this.btnBorderColor.setColor(t),this.BorderColor={Value:1,Color:t};if(this.api&&this.BorderSize>0&&!this._noApply){var n=new Asc.asc_TextArtProperties,r=new Asc.asc_CStroke;this.BorderSize<.01?r.asc_putType(Asc.c_oAscStrokeType.STROKE_NONE):(r.asc_putType(Asc.c_oAscStrokeType.STROKE_COLOR),r.asc_putColor(Common.Utils.ThemeColor.getRgbColor(this.BorderColor.Color)),r.asc_putWidth(this._pt2mm(this.BorderSize)),r.asc_putPrstDash(this.BorderType)),n.asc_putLine(r),this.shapeprops.put_TextArtProperties(n),this.api.asc_setGraphicObjectProps(this.imgprops)}Common.NotificationCenter.trigger("edit:complete",this)},insertFromUrl:function(){var e=this;(new Common.Views.ImageFromUrlDialog({handler:function(t,r){if(t=="ok"&&e.api){var i=r.replace(/ /g,"");if(!n.isEmpty(i)&&e.BlipFillType!==null){var s=new Asc.asc_TextArtProperties,o=new Asc.asc_CShapeFill;o.asc_putType(Asc.c_oAscFill.FILL_TYPE_BLIP),o.asc_putFill(new Asc.asc_CFillBlip),o.asc_getFill().asc_putType(e.BlipFillType),o.asc_getFill().asc_putUrl(i),s.asc_putFill(o),e.shapeprops.put_TextArtProperties(s),e.api.asc_setGraphicObjectProps(e.imgprops)}}Common.NotificationCenter.trigger("edit:complete",e)}})).show()},ChangeSettings:function(e){this.imgprops==null&&(this.imgprops=new Asc.asc_CImgProperty,this.imgprops.asc_putShapeProperties(new Asc.asc_CShapeProperty),this.shapeprops=this.imgprops.asc_getShapeProperties()),this._initSettings&&this.createDelayedElements();if(e&&e.asc_getShapeProperties()&&e.asc_getShapeProperties().get_TextArtProperties()){var r=e.asc_getShapeProperties().get_TextArtProperties();this._noApply=!0,this.disableControls(this._locked);var i=null,s=r.asc_getFill(),o=s?s.asc_getType():null,u=null;if(s){var a=s.asc_getTransparent();if(Math.abs(this._state.Transparency-a)>.001||Math.abs(this.numTransparency.getNumberValue()-a)>.001||(this._state.Transparency===null||a===null)&&(this._state.Transparency!==a||this.numTransparency.getNumberValue()!==a))a!==undefined&&(this.sldrTransparency.setValue(a===null?100:a/255*100,!0),this.numTransparency.setValue(this.sldrTransparency.getValue(),!0)),this._state.Transparency=a}if(s===null||s===undefined||o===null)this.OriginalFillType=null;else if(o==Asc.c_oAscFill.FILL_TYPE_NOFILL)this.OriginalFillType=Asc.c_oAscFill.FILL_TYPE_NOFILL;else if(o==Asc.c_oAscFill.FILL_TYPE_SOLID)s=s.asc_getFill(),u=s.asc_getColor(),u?u.asc_getType()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?this.ShapeColor={Value:1,Color:{color:Common.Utils.ThemeColor.getHexColor(u.asc_getR(),u.asc_getG(),u.asc_getB()),effectValue:u.asc_getValue()}}:this.ShapeColor={Value:1,Color:Common.Utils.ThemeColor.getHexColor(u.asc_getR(),u.asc_getG(),u.asc_getB())}:this.ShapeColor={Value:0,Color:"transparent"},this.OriginalFillType=Asc.c_oAscFill.FILL_TYPE_SOLID,this.FGColor=this.ShapeColor.Color!=="transparent"?{Value:1,Color:Common.Utils.ThemeColor.colorValue2EffectId(this.ShapeColor.Color)}:{Value:1,Color:"000000"},this.BGColor={Value:1,Color:"ffffff"},this.GradColor.colors[0]=this.ShapeColor.Color!=="transparent"?Common.Utils.ThemeColor.colorValue2EffectId(this.ShapeColor.Color):"000000",this.GradColor.colors[1]="ffffff";else if(o==Asc.c_oAscFill.FILL_TYPE_BLIP)s=s.asc_getFill(),this.BlipFillType=s.asc_getType(),this._state.BlipFillType!==this.BlipFillType&&(this.BlipFillType==Asc.c_oAscFillBlipType.STRETCH||this.BlipFillType==Asc.c_oAscFillBlipType.TILE?this.cmbFillType.setValue(this.BlipFillType):this.cmbFillType.setValue(""),this._state.BlipFillType=this.BlipFillType),this.OriginalFillType=Asc.c_oAscFill.FILL_TYPE_BLIP;else if(o==Asc.c_oAscFill.FILL_TYPE_PATT){s=s.asc_getFill(),this.PatternFillType=s.asc_getPatternType();if(this._state.PatternFillType!==this.PatternFillType){this.cmbPattern.suspendEvents();var i=this.cmbPattern.menuPicker.store.findWhere({type:this.PatternFillType});this.cmbPattern.menuPicker.selectRecord(i),this.cmbPattern.resumeEvents(),this._state.PatternFillType=this.PatternFillType}u=s.asc_getColorFg(),u?u.asc_getType()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?this.FGColor={Value:1,Color:{color:Common.Utils.ThemeColor.getHexColor(u.asc_getR(),u.asc_getG(),u.asc_getB()),effectValue:u.asc_getValue()}}:this.FGColor={Value:1,Color:Common.Utils.ThemeColor.getHexColor(u.asc_getR(),u.asc_getG(),u.asc_getB())}:this.FGColor={Value:1,Color:"000000"},u=s.asc_getColorBg(),u?u.asc_getType()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?this.BGColor={Value:1,Color:{color:Common.Utils.ThemeColor.getHexColor(u.asc_getR(),u.asc_getG(),u.asc_getB()),effectValue:u.asc_getValue()}}:this.BGColor={Value:1,Color:Common.Utils.ThemeColor.getHexColor(u.asc_getR(),u.asc_getG(),u.asc_getB())}:this.BGColor={Value:1,Color:"ffffff"},this.OriginalFillType=Asc.c_oAscFill.FILL_TYPE_PATT,this.ShapeColor={Value:1,Color:Common.Utils.ThemeColor.colorValue2EffectId(this.FGColor.Color)},this.GradColor.colors[0]=Common.Utils.ThemeColor.colorValue2EffectId(this.FGColor.Color),this.GradColor.colors[1]="ffffff"}else if(o==Asc.c_oAscFill.FILL_TYPE_GRAD){s=s.asc_getFill();var f=s.asc_getGradType();if(this._state.GradFillType!==f||this.GradFillType!==f)this.GradFillType=f,i=undefined,this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR||this.GradFillType==Asc.c_oAscFillGradType.GRAD_PATH?(this.cmbGradType.setValue(this.GradFillType),i=this.cmbGradType.store.findWhere({value:this.GradFillType}),this.onGradTypeSelect(this.cmbGradType,i.attributes)):(this.cmbGradType.setValue(""),this.btnDirection.setIconCls("")),this._state.GradFillType=this.GradFillType;if(this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR){var l=Math.floor(s.asc_getLinearAngle()/6e4);if(Math.abs(this.GradLinearDirectionType-l)>.001){this.GradLinearDirectionType=l;var c=this.mnuDirectionPicker.store.findWhere({type:l});this.mnuDirectionPicker.selectRecord(c,!0),c?this.btnDirection.setIconCls("item-gradient "+c.get("iconcls")):this.btnDirection.setIconCls("")}}var h=s.asc_getColors();h&&h.length>0&&(u=h[0],u?u.asc_getType()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?(this.GradColor.colors[0]={color:Common.Utils.ThemeColor.getHexColor(u.asc_getR(),u.asc_getG(),u.asc_getB()),effectValue:u.asc_getValue()},Common.Utils.ThemeColor.colorValue2EffectId(this.GradColor.colors[0])):this.GradColor.colors[0]=Common.Utils.ThemeColor.getHexColor(u.asc_getR(),u.asc_getG(),u.asc_getB()):this.GradColor.colors[0]="000000",u=h[1],u?u.asc_getType()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?(this.GradColor.colors[1]={color:Common.Utils.ThemeColor.getHexColor(u.asc_getR(),u.asc_getG(),u.asc_getB()),effectValue:u.asc_getValue()},Common.Utils.ThemeColor.colorValue2EffectId(this.GradColor.colors[1])):this.GradColor.colors[1]=Common.Utils.ThemeColor.getHexColor(u.asc_getR(),u.asc_getG(),u.asc_getB()):this.GradColor.colors[1]="ffffff");var p=s.asc_getPositions();if(p&&p.length>0){var d=p[0];d!==null&&(d/=1e3,this.GradColor.values[0]=d),d=p[1],d!==null&&(d/=1e3,this.GradColor.values[1]=d)}this.sldrGradient.setColorValue(Common.Utils.String.format("#{0}",typeof this.GradColor.colors[0]=="object"?this.GradColor.colors[0].color:this.GradColor.colors[0]),0),this.sldrGradient.setColorValue(Common.Utils.String.format("#{0}",typeof this.GradColor.colors[1]=="object"?this.GradColor.colors[1].color:this.GradColor.colors[1]),1),this.sldrGradient.setValue(0,this.GradColor.values[0]),this.sldrGradient.setValue(1,this.GradColor.values[1]),this.OriginalFillType=Asc.c_oAscFill.FILL_TYPE_GRAD,this.FGColor={Value:1,Color:this.GradColor.colors[0]},this.BGColor={Value:1,Color:"ffffff"},this.ShapeColor={Value:1,Color:this.GradColor.colors[0]}}this._state.FillType!==this.OriginalFillType&&(this.cmbFillSrc.setValue(this.OriginalFillType===null?"":this.OriginalFillType),this._state.FillType=this.OriginalFillType,this.ShowHideElem(this.OriginalFillType)),t(this.btnTexture.el).find(".form-control").prop("innerHTML",this.textSelectTexture);var v=typeof this.ShapeColor.Color,m=typeof this._state.ShapeColor;if(v!==m||v=="object"&&(this.ShapeColor.Color.effectValue!==this._state.ShapeColor.effectValue||this._state.ShapeColor.color.indexOf(this.ShapeColor.Color.color)<0)||v!="object"&&this._state.ShapeColor.indexOf(this.ShapeColor.Color)<0){this.btnBackColor.setColor(this.ShapeColor.Color);if(typeof this.ShapeColor.Color=="object"){var g=!1;for(var y=0;y<10;y++)if(Common.Utils.ThemeColor.ThemeValues[y]==this.ShapeColor.Color.effectValue){this.colorsBack.select(this.ShapeColor.Color,!0),g=!0;break}g||this.colorsBack.clearSelection()}else this.colorsBack.select(this.ShapeColor.Color,!0);this._state.ShapeColor=this.ShapeColor.Color}var b=r.asc_getLine(),w=b?b.asc_getType():null,E;b?(w==Asc.c_oAscStrokeType.STROKE_COLOR?(u=b.asc_getColor(),u?u.asc_getType()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?this.BorderColor={Value:1,Color:{color:Common.Utils.ThemeColor.getHexColor(u.asc_getR(),u.asc_getG(),u.asc_getB()),effectValue:u.asc_getValue()}}:this.BorderColor={Value:1,Color:Common.Utils.ThemeColor.getHexColor(u.asc_getR(),u.asc_getG(),u.asc_getB())}:this.BorderColor={Value:1,Color:"transparent"}):this.BorderColor={Value:1,Color:"transparent"},E=b.asc_getPrstDash()):this.BorderColor={Value:0,Color:"transparent"},v=typeof this.BorderColor.Color,m=typeof this._state.StrokeColor;if(v!==m||v=="object"&&(this.BorderColor.Color.effectValue!==this._state.StrokeColor.effectValue||this._state.StrokeColor.color.indexOf(this.BorderColor.Color.color)<0)||v!="object"&&(this._state.StrokeColor.indexOf(this.BorderColor.Color)<0||typeof this.btnBorderColor.color=="object")){this.btnBorderColor.setColor(this.BorderColor.Color);if(typeof this.BorderColor.Color=="object"){var g=!1;for(var y=0;y<10;y++)if(Common.Utils.ThemeColor.ThemeValues[y]==this.BorderColor.Color.effectValue){this.colorsBorder.select(this.BorderColor.Color,!0),g=!0;break}g||this.colorsBorder.clearSelection()}else this.colorsBorder.select(this.BorderColor.Color,!0);this._state.StrokeColor=this.BorderColor.Color}if(this._state.StrokeType!==w||w==Asc.c_oAscStrokeType.STROKE_COLOR){if(w==Asc.c_oAscStrokeType.STROKE_COLOR){var S=b.asc_getWidth(),x=Math.abs(this._state.StrokeWidth-S)<.001&&!(new RegExp(this.txtPt+"\\s*$")).test(this.cmbBorderSize.getRawValue());if(Math.abs(this._state.StrokeWidth-S)>.001||x||(this._state.StrokeWidth===null||S===null)&&this._state.StrokeWidth!==S){this._state.StrokeWidth=S,S!==null&&(S=this._mm2pt(S));var T=S===null?S:n.find(this.cmbBorderSize.store.models,function(e){if(S<e.attributes.value+.01&&S>e.attributes.value-.01)return!0});T?this.cmbBorderSize.selectRecord(T):this.cmbBorderSize.setValue(S!==null?parseFloat(S.toFixed(2))+" "+this.txtPt:""),this.BorderSize=S}}else w==Asc.c_oAscStrokeType.STROKE_NONE?(this._state.StrokeWidth=0,this.BorderSize=this.cmbBorderSize.store.at(0).get("value"),this.cmbBorderSize.setValue(this.BorderSize)):(this._state.StrokeWidth=null,this.BorderSize=-1,this.cmbBorderSize.setValue(null));this._state.StrokeType=w}this._state.StrokeBorderType!==E&&(this.BorderType=this._state.StrokeBorderType=E,this.cmbBorderType.setValue(E)),v=typeof this.FGColor.Color,m=typeof this._state.FGColor;if(v!==m||v=="object"&&(this.FGColor.Color.effectValue!==this._state.FGColor.effectValue||this._state.FGColor.color.indexOf(this.FGColor.Color.color)<0)||v!="object"&&this._state.FGColor.indexOf(this.FGColor.Color)<0){this.btnFGColor.setColor(this.FGColor.Color);if(typeof this.FGColor.Color=="object"){var g=!1;for(var y=0;y<10;y++)if(Common.Utils.ThemeColor.ThemeValues[y]==this.FGColor.Color.effectValue){this.colorsFG.select(this.FGColor.Color,!0),g=!0;break}g||this.colorsFG.clearSelection()}else this.colorsFG.select(this.FGColor.Color,!0);this._state.FGColor=this.FGColor.Color}v=typeof this.BGColor.Color,m=typeof this._state.BGColor;if(v!==m||v=="object"&&(this.BGColor.Color.effectValue!==this._state.BGColor.effectValue||this._state.BGColor.color.indexOf(this.BGColor.Color.color)<0)||v!="object"&&this._state.BGColor.indexOf(this.BGColor.Color)<0){this.btnBGColor.setColor(this.BGColor.Color);if(typeof this.BGColor.Color=="object"){var g=!1;for(var y=0;y<10;y++)if(Common.Utils.ThemeColor.ThemeValues[y]==this.BGColor.Color.effectValue){this.colorsBG.select(this.BGColor.Color,!0),g=!0;break}g||this.colorsBG.clearSelection()}else this.colorsBG.select(this.BGColor.Color,!0);this._state.BGColor=this.BGColor.Color}u=this.GradColor.colors[this.GradColor.currentIdx],v=typeof u,m=typeof this._state.GradColor;if(v!==m||v=="object"&&(u.effectValue!==this._state.GradColor.effectValue||this._state.GradColor.color.indexOf(u.color)<0)||v!="object"&&this._state.GradColor.indexOf(u)<0){this.btnGradColor.setColor(u);if(typeof u=="object"){var g=!1;for(var y=0;y<10;y++)if(Common.Utils.ThemeColor.ThemeValues[y]==u.effectValue){this.colorsGrad.select(u,!0),g=!0;break}g||this.colorsGrad.clearSelection()}else this.colorsGrad.select(u,!0);this._state.GradColor=u}var N=r.asc_getForm();if(this._state.FormId!==N){this.cmbTransform.suspendEvents();var i=this.cmbTransform.menuPicker.store.findWhere({type:N});this.cmbTransform.menuPicker.selectRecord(i),this.cmbTransform.resumeEvents(),this._state.FormId=N}this._noApply=!1}},createDelayedControls:function(){var e=this;this._arrFillSrc=[{displayValue:this.textColor,value:Asc.c_oAscFill.FILL_TYPE_SOLID},{displayValue:this.textGradientFill,value:Asc.c_oAscFill.FILL_TYPE_GRAD},{displayValue:this.textImageTexture,value:Asc.c_oAscFill.FILL_TYPE_BLIP},{displayValue:this.textPatternFill,value:Asc.c_oAscFill.FILL_TYPE_PATT},{displayValue:this.textNoFill,value:Asc.c_oAscFill.FILL_TYPE_NOFILL}],this.cmbFillSrc=new Common.UI.ComboBox({el:t("#textart-combo-fill-src"),cls:"input-group-nr",style:"width: 100%;",menuStyle:"min-width: 190px;",editable:!1,data:this._arrFillSrc}),this.cmbFillSrc.setValue(this._arrFillSrc[0].value),this.cmbFillSrc.on("selected",n.bind(this.onFillSrcSelect,this)),this.lockedControls.push(this.cmbFillSrc),this.cmbPattern=new Common.UI.ComboDataView({itemWidth:28,itemHeight:28,menuMaxHeight:300,enableKeyEvents:!0,cls:"combo-pattern"}),this.cmbPattern.menuPicker.itemTemplate=this.cmbPattern.fieldPicker.itemTemplate=n.template(['<div class="style" id="<%= id %>">','<img src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" class="combo-pattern-item" ','width="'+this.cmbPattern.itemWidth+'" height="'+this.cmbPattern.itemHeight+'" ','style="background-position: -<%= offsetx %>px -<%= offsety %>px;"/>',"</div>"].join("")),this.cmbPattern.render(t("#textart-combo-pattern")),this.cmbPattern.openButton.menu.cmpEl.css({"min-width":178,"max-width":178}),this.cmbPattern.on("click",n.bind(this.onPatternSelect,this)),this.cmbPattern.openButton.menu.on("show:after",function(){e.cmbPattern.menuPicker.scroller.update({alwaysVisibleY:!0})}),this.lockedControls.push(this.cmbPattern),this.btnInsertFromFile=new Common.UI.Button({el:t("#textart-button-from-file")}),this.lockedControls.push(this.btnInsertFromFile),this.btnInsertFromUrl=new Common.UI.Button({el:t("#textart-button-from-url")}),this.lockedControls.push(this.btnInsertFromUrl),this.btnInsertFromFile.on("click",n.bind(function(e){this.api&&this.api.asc_changeArtImageFromFile(),Common.NotificationCenter.trigger("edit:complete",this)},this)),this.btnInsertFromUrl.on("click",n.bind(this.insertFromUrl,this)),this._arrFillType=[{displayValue:this.textStretch,value:Asc.c_oAscFillBlipType.STRETCH},{displayValue:this.textTile,value:Asc.c_oAscFillBlipType.TILE}],this.cmbFillType=new Common.UI.ComboBox({el:t("#textart-combo-fill-type"),cls:"input-group-nr",menuStyle:"min-width: 90px;",editable:!1,data:this._arrFillType}),this.cmbFillType.setValue(this._arrFillType[0].value),this.cmbFillType.on("selected",n.bind(this.onFillTypeSelect,this)),this.lockedControls.push(this.cmbFillType),this.numTransparency=new Common.UI.MetricSpinner({el:t("#textart-spin-transparency"),step:1,width:62,value:"100 %",defaultUnit:"%",maxValue:100,minValue:0}),this.numTransparency.on("change",n.bind(this.onNumTransparencyChange,this)),this.lockedControls.push(this.numTransparency),this.sldrTransparency=new Common.UI.SingleSlider({el:t("#textart-slider-transparency"),width:75,minValue:0,maxValue:100,value:100}),this.sldrTransparency.on("change",n.bind(this.onTransparencyChange,this)),this.sldrTransparency.on("changecomplete",n.bind(this.onTransparencyChangeComplete,this)),this.lockedControls.push(this.sldrTransparency),this.lblTransparencyStart=t(this.el).find("#textart-lbl-transparency-start"),this.lblTransparencyEnd=t(this.el).find("#textart-lbl-transparency-end"),this._arrGradType=[{displayValue:this.textLinear,value:Asc.c_oAscFillGradType.GRAD_LINEAR},{displayValue:this.textRadial,value:Asc.c_oAscFillGradType.GRAD_PATH}],this.cmbGradType=new Common.UI.ComboBox({el:t("#textart-combo-grad-type"),cls:"input-group-nr",menuStyle:"min-width: 90px;",editable:!1,data:this._arrGradType}),this.cmbGradType.setValue(this._arrGradType[0].value),this.cmbGradType.on("selected",n.bind(this.onGradTypeSelect,this)),this.lockedControls.push(this.cmbGradType),this._viewDataLinear=[{offsetx:0,offsety:0,type:45,subtype:-1,iconcls:"gradient-left-top"},{offsetx:50,offsety:0,type:90,subtype:4,iconcls:"gradient-top"},{offsetx:100,offsety:0,type:135,subtype:5,iconcls:"gradient-right-top"},{offsetx:0,offsety:50,type:0,subtype:6,iconcls:"gradient-left",cls:"item-gradient-separator",selected:!0},{offsetx:100,offsety:50,type:180,subtype:1,iconcls:"gradient-right"},{offsetx:0,offsety:100,type:315,subtype:2,iconcls:"gradient-left-bottom"},{offsetx:50,offsety:100,type:270,subtype:3,iconcls:"gradient-bottom"},{offsetx:100,offsety:100,type:225,subtype:7,iconcls:"gradient-right-bottom"}],this._viewDataRadial=[{offsetx:100,offsety:150,type:2,subtype:5,iconcls:"gradient-radial-center"}],this.btnDirection=new Common.UI.Button({cls:"btn-large-dataview",iconCls:"item-gradient gradient-left",menu:new Common.UI.Menu({style:"min-width: 60px;",menuAlign:"tr-br",items:[{template:n.template('<div id="id-textart-menu-direction" style="width: 175px; margin: 0 5px;"></div>')}]})}),this.btnDirection.on("render:after",function(r){e.mnuDirectionPicker=new Common.UI.DataView({el:t("#id-textart-menu-direction"),parentMenu:r.menu,restoreHeight:174,store:new Common.UI.DataViewStore(e._viewDataLinear),itemTemplate:n.template('<div id="<%= id %>" class="item-gradient" style="background-position: -<%= offsetx %>px -<%= offsety %>px;"></div>')})}),this.btnDirection.render(t("#textart-button-direction")),this.mnuDirectionPicker.on("item:click",n.bind(this.onSelectGradient,this,this.btnDirection)),this.lockedControls.push(this.btnDirection),this.sldrGradient=new Common.UI.MultiSliderGradient({el:t("#textart-slider-gradient"),width:125,minValue:0,maxValue:100,values:[0,100]}),this.sldrGradient.on("change",n.bind(this.onGradientChange,this)),this.sldrGradient.on("changecomplete",n.bind(this.onGradientChangeComplete,this)),this.sldrGradient.on("thumbclick",function(t,n){e.GradColor.currentIdx=n;var r=e.GradColor.colors[e.GradColor.currentIdx];e.btnGradColor.setColor(r),e.colorsGrad.select(r,!1)}),this.sldrGradient.on("thumbdblclick",function(t){e.btnGradColor.cmpEl.find("button").dropdown("toggle")}),this.lockedControls.push(this.sldrGradient),this.cmbBorderSize=(new Common.UI.ComboBorderSizeEditable({el:t("#textart-combo-border-size"),style:"width: 93px;",txtNoBorders:this.txtNoBorders})).on("selected",n.bind(this.onBorderSizeSelect,this)).on("changed:before",n.bind(this.onBorderSizeChanged,this,!0)).on("changed:after",n.bind(this.onBorderSizeChanged,this,!1)).on("combo:blur",n.bind(this.onComboBlur,this,!1)),this.BorderSize=this.cmbBorderSize.store.at(2).get("value"),this.cmbBorderSize.setValue(this.BorderSize),this.lockedControls.push(this.cmbBorderSize),this.cmbBorderType=(new Common.UI.ComboBorderType({el:t("#textart-combo-border-type"),style:"width: 93px;",menuStyle:"min-width: 93px;"})).on("selected",n.bind(this.onBorderTypeSelect,this)).on("combo:blur",n.bind(this.onComboBlur,this,!1)),this.BorderType=Asc.c_oDashType.solid,this.cmbBorderType.setValue(this.BorderType),this.lockedControls.push(this.cmbBorderType),this.cmbTransform=new Common.UI.ComboDataView({itemWidth:50,itemHeight:50,menuMaxHeight:300,enableKeyEvents:!0,cls:"combo-textart"}),this.cmbTransform.render(t("#textart-combo-transform")),this.cmbTransform.openButton.menu.cmpEl.css({"min-width":178,"max-width":178}),this.cmbTransform.on("click",n.bind(this.onTransformSelect,this)),this.cmbTransform.openButton.menu.on("show:after",function(){e.cmbTransform.menuPicker.scroller.update({alwaysVisibleY:!0})}),this.lockedControls.push(this.cmbTransform)},createDelayedElements:function(){this.createDelayedControls();var e=[0,1,3,2,4,53,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,22,23,24,25,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,49,50,51,52];this.patternViewData=[];for(var t=0;t<13;t++)for(var n=0;n<4;n++){var r=t*4+n;this.patternViewData[r]={offsetx:n*28,offsety:t*28,type:e[r]}}this.patternViewData.splice(this.patternViewData.length-2,2);for(var t=0;t<this.patternViewData.length;t++)this.patternViewData[t].id=Common.UI.getId();this.cmbPattern.menuPicker.store.add(this.patternViewData),this.cmbPattern.menuPicker.store.length>0&&(this.cmbPattern.fillComboView(this.cmbPattern.menuPicker.store.at(0),!0),this.PatternFillType=this.patternViewData[0].type),this.UpdateThemeColors(),this.fillTransform(this.api.asc_getPropertyEditorTextArts()),this._initSettings=!1},onInitStandartTextures:function(e){var r=this;if(e&&e.length>0){this.btnTexture=new Common.UI.ComboBox({el:t("#textart-combo-fill-texture"),template:n.template(['<div class="input-group combobox combo-dataview-menu input-group-nr dropdown-toggle" tabindex="0" data-toggle="dropdown">','<div class="form-control text" style="width: 90px;">'+this.textSelectTexture+"</div>",'<div style="display: table-cell;"></div>','<button type="button" class="btn btn-default"><span class="caret img-commonctrl"></span></button>',"</div>"].join(""))}),this.textureMenu=new Common.UI.Menu({items:[{template:n.template('<div id="id-textart-menu-texture" style="width: 233px; margin: 0 5px;"></div>')}]}),this.textureMenu.render(t("#textart-combo-fill-texture")),this.lockedControls.push(this.btnTexture);var i=[];n.each(e,function(e){i.push({imageUrl:e.get_image(),name:r.textureNames[e.get_id()],type:e.get_id(),selected:!1})});var s=new Common.UI.DataView({el:t("#id-textart-menu-texture"),restoreHeight:174,parentMenu:r.textureMenu,showLast:!1,store:new Common.UI.DataViewStore(i),itemTemplate:n.template('<div><img src="<%= imageUrl %>" id="<%= id %>"></div>')});s.on("item:click",n.bind(this.onSelectTexture,this))}},onSelectTexture:function(e,n,r){this._fromTextureCmb=!0,this.cmbFillType.setValue(this._arrFillType[1].value),this._fromTextureCmb=!1;if(this.api){var i=new Asc.asc_TextArtProperties,s=new Asc.asc_CShapeFill;s.asc_putType(Asc.c_oAscFill.FILL_TYPE_BLIP),s.asc_putFill(new Asc.asc_CFillBlip),s.asc_getFill().asc_putType(Asc.c_oAscFillBlipType.TILE),s.asc_getFill().asc_putTextureId(r.get("type")),i.asc_putFill(s),this.shapeprops.put_TextArtProperties(i),this.api.asc_setGraphicObjectProps(this.imgprops)}t(this.btnTexture.el).find(".form-control").prop("innerHTML",r.get("name")),Common.NotificationCenter.trigger("edit:complete",this)},fillTextArt:function(){var e=this;this.cmbTextArt||(this.cmbTextArt=new Common.UI.ComboDataView({itemWidth:50,itemHeight:50,menuMaxHeight:300,enableKeyEvents:!0,showLast:!1,cls:"combo-textart"}),this.cmbTextArt.render(t("#textart-combo-template")),this.cmbTextArt.openButton.menu.cmpEl.css({"min-width":178,"max-width":178}),this.cmbTextArt.on("click",n.bind(this.onTextArtSelect,this)),this.cmbTextArt.openButton.menu.on("show:after",function(){e.cmbTextArt.menuPicker.scroller.update({alwaysVisibleY:!0})}),this.lockedControls.push(this.cmbTextArt));var r=this.application.getCollection("Common.Collections.TextArt").models,i=this.cmbTextArt.menuPicker.store.length;if(i>0&&i==r.length){var s=this.cmbTextArt.menuPicker.store.models;n.each(r,function(e,t){s[t].set("imageUrl",e.get("imageUrl"))})}else this.cmbTextArt.menuPicker.store.reset(r),this.cmbTextArt.menuPicker.store.length>0&&this.cmbTextArt.fillComboView(this.cmbTextArt.menuPicker.store.at(0))},onTextArtSelect:function(e,t){if(this.api&&!this._noApply){var n=new Asc.asc_TextArtProperties;n.asc_putStyle(t.get("data")),this.shapeprops.put_TextArtProperties(n),this.api.asc_setGraphicObjectProps(this.imgprops)}Common.NotificationCenter.trigger("edit:complete",this)},fillTransform:function(e){if(e&&e.length>1&&e[1]){var t=this,r=[],i=e[1];for(var s=0;s<i.length;s++){var o=i[s];o&&o.length>0&&n.each(o,function(e){r.push({imageUrl:e.Image,type:e.Type,selected:!1})})}this.cmbTransform.menuPicker.store.add(r),this.cmbTransform.menuPicker.store.length>0&&this.cmbTransform.fillComboView(this.cmbTransform.menuPicker.store.at(0),!0)}},onTransformSelect:function(e,t){if(this.api&&!this._noApply){var n=new Asc.asc_TextArtProperties;n.asc_putForm(t.get("type")),this.shapeprops.put_TextArtProperties(n),this.api.asc_setGraphicObjectProps(this.imgprops)}Common.NotificationCenter.trigger("edit:complete",this)},UpdateThemeColors:function(){this.btnBackColor||(this.btnBorderColor=new Common.UI.ColorButton({style:"width:45px;",menu:new Common.UI.Menu({items:[{template:n.template('<div id="textart-border-color-menu" style="width: 169px; height: 220px; margin: 10px;"></div>')},{template:n.template('<a id="textart-border-color-new" style="padding-left:12px;">'+this.textNewColor+"</a>")}]})}),this.btnBorderColor.render(t("#textart-border-color-btn")),this.btnBorderColor.setColor("000000"),this.lockedControls.push(this.btnBorderColor),this.colorsBorder=new Common.UI.ThemeColorPalette({el:t("#textart-border-color-menu"),value:"000000"}),this.colorsBorder.on("select",n.bind(this.onColorsBorderSelect,this)),t(this.el).on("click","#textart-border-color-new",n.bind(this.addNewColor,this,this.colorsBorder,this.btnBorderColor)),this.btnBackColor=new Common.UI.ColorButton({style:"width:45px;",menu:new Common.UI.Menu({items:[{template:n.template('<div id="textart-back-color-menu" style="width: 169px; height: 220px; margin: 10px;"></div>')},{template:n.template('<a id="textart-back-color-new" style="padding-left:12px;">'+this.textNewColor+"</a>")}]})}),this.btnBackColor.render(t("#textart-back-color-btn")),this.btnBackColor.setColor("transparent"),this.lockedControls.push(this.btnBackColor),this.colorsBack=new Common.UI.ThemeColorPalette({el:t("#textart-back-color-menu"),value:"transparent",transparent:!0}),this.colorsBack.on("select",n.bind(this.onColorsBackSelect,this)),t(this.el).on("click","#textart-back-color-new",n.bind(this.addNewColor,this,this.colorsBack,this.btnBackColor)),this.btnFGColor=new Common.UI.ColorButton({style:"width:45px;",menu:new Common.UI.Menu({items:[{template:n.template('<div id="textart-foreground-color-menu" style="width: 169px; height: 220px; margin: 10px;"></div>')},{template:n.template('<a id="textart-foreground-color-new" style="padding-left:12px;">'+this.textNewColor+"</a>")}]})}),this.btnFGColor.render(t("#textart-foreground-color-btn")),this.btnFGColor.setColor("000000"),this.lockedControls.push(this.btnFGColor),this.colorsFG=new Common.UI.ThemeColorPalette({el:t("#textart-foreground-color-menu"),value:"000000"}),this.colorsFG.on("select",n.bind(this.onColorsFGSelect,this)),t(this.el).on("click","#textart-foreground-color-new",n.bind(this.addNewColor,this,this.colorsFG,this.btnFGColor)),this.btnBGColor=new Common.UI.ColorButton({style:"width:45px;",menu:new Common.UI.Menu({items:[{template:n.template('<div id="textart-background-color-menu" style="width: 169px; height: 220px; margin: 10px;"></div>')},{template:n.template('<a id="textart-background-color-new" style="padding-left:12px;">'+this.textNewColor+"</a>")}]})}),this.btnBGColor.render(t("#textart-background-color-btn")),this.btnBGColor.setColor("ffffff"),this.lockedControls.push(this.btnBGColor),this.colorsBG=new Common.UI.ThemeColorPalette({el:t("#textart-background-color-menu"),value:"ffffff"}),this.colorsBG.on("select",n.bind(this.onColorsBGSelect,this)),t(this.el).on("click","#textart-background-color-new",n.bind(this.addNewColor,this,this.colorsBG,this.btnBGColor)),this.btnGradColor=new Common.UI.ColorButton({style:"width:45px;",menu:new Common.UI.Menu({items:[{template:n.template('<div id="textart-gradient-color-menu" style="width: 169px; height: 220px; margin: 10px;"></div>')},{template:n.template('<a id="textart-gradient-color-new" style="padding-left:12px;">'+this.textNewColor+"</a>")}]})}),this.btnGradColor.render(t("#textart-gradient-color-btn")),this.btnGradColor.setColor("000000"),this.lockedControls.push(this.btnGradColor),this.colorsGrad=new Common.UI.ThemeColorPalette({el:t("#textart-gradient-color-menu"),value:"000000"}),this.colorsGrad.on("select",n.bind(this.onColorsGradientSelect,this)),t(this.el).on("click","#textart-gradient-color-new",n.bind(this.addNewColor,this,this.colorsGrad,this.btnGradColor))),this.colorsBorder.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors()),this.colorsBack.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors()),this.colorsFG.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors()),this.colorsBG.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors()),this.colorsGrad.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors())},_pt2mm:function(e){return e*25.4/72},_mm2pt:function(e){return e*72/25.4},ShowHideElem:function(e){this.FillColorContainer.toggleClass("settings-hidden",e!==Asc.c_oAscFill.FILL_TYPE_SOLID),this.FillImageContainer.toggleClass("settings-hidden",e!==Asc.c_oAscFill.FILL_TYPE_BLIP),this.FillPatternContainer.toggleClass("settings-hidden",e!==Asc.c_oAscFill.FILL_TYPE_PATT),this.FillGradientContainer.toggleClass("settings-hidden",e!==Asc.c_oAscFill.FILL_TYPE_GRAD),this.TransparencyContainer.toggleClass("settings-hidden",e===Asc.c_oAscFill.FILL_TYPE_NOFILL||e===null)},setLocked:function(e){this._locked=e},disableControls:function(e){if(this._initSettings)return;this._state.DisabledControls!==e&&(this._state.DisabledControls=e,n.each(this.lockedControls,function(t){t.setDisabled(e)}))},txtNoBorders:"No Line",strStroke:"Stroke",strColor:"Color",strSize:"Size",strFill:"Fill",textColor:"Color Fill",textImageTexture:"Picture or Texture",textTexture:"From Texture",textFromUrl:"From URL",textFromFile:"From File",textStretch:"Stretch",textTile:"Tile",txtCanvas:"Canvas",txtCarton:"Carton",txtDarkFabric:"Dark Fabric",txtGrain:"Grain",txtGranite:"Granite",txtGreyPaper:"Grey Paper",txtKnit:"Knit",txtLeather:"Leather",txtBrownPaper:"Brown Paper",txtPapyrus:"Papyrus",txtWood:"Wood",textNewColor:"Add New Custom Color",strTransparency:"Opacity",textNoFill:"No Fill",textSelectTexture:"Select",textGradientFill:"Gradient Fill",textPatternFill:"Pattern",strBackground:"Background color",strForeground:"Foreground color",strPattern:"Pattern",textEmptyPattern:"No Pattern",textLinear:"Linear",textRadial:"Radial",textDirection:"Direction",textStyle:"Style",textGradient:"Gradient",textBorderSizeErr:"The entered value is incorrect.<br>Please enter a value between 0 pt and 1584 pt.",textTransform:"Transform",textTemplate:"Template",strType:"Type"},SSE.Views.TextArtSettings||{}))}),define("text!spreadsheeteditor/main/app/template/TableSettings.template",[],function(){return'<table cols="2">\n <tr>\n <td width="50%">\n <label class="header"><%= scope.textRows %></label>\n </td>\n <td width="50%">\n <label class="header"><%= scope.textColumns %></label>\n </td>\n </tr>\n <tr>\n <td class="padding-small">\n <div id="table-checkbox-header"></div>\n </td>\n <td class="padding-small">\n <div id="table-checkbox-first"></div>\n </td>\n </tr>\n <tr>\n <td class="padding-small">\n <div id="table-checkbox-total"></div>\n </td>\n <td class="padding-small">\n <div id="table-checkbox-last"></div>\n </td>\n </tr>\n <tr>\n <td class="padding-small">\n <div id="table-checkbox-banded"></div>\n </td>\n <td class="padding-small">\n <div id="table-checkbox-col-banded"></div>\n </td>\n </tr>\n <tr>\n <td colspan=2 class="padding-small">\n <div id="table-checkbox-filter"></div>\n </td>\n </tr>\n <tr>\n <td colspan=2>\n <label class="header"><%= scope.textTemplate %></label>\n </td>\n </tr>\n <tr>\n <td colspan=2 class="padding-small">\n <div class="" id="table-combo-template" style="width: 100%; height: 60px;"></div>\n </td>\n </tr>\n <tr>\n <td class="padding-small" colspan=2>\n <div class="separator horizontal"></div>\n </td>\n </tr>\n <tr class="hidden">\n <td colspan=2>\n <label class="header"><%= scope.textTableName %></label>\n </td>\n </tr>\n <tr class="hidden">\n <td colspan=2 class="padding-small">\n <div id="table-txt-name" class="input-row" style="width: 100%;"></div>\n </td>\n </tr>\n <tr>\n <td class="padding-large" colspan=2>\n <label class="header" style="margin-top: 3px;"><%= scope.textResize %></label>\n <button type="button" class="btn btn-text-default" id="table-btn-select-data" style="display: inline-block; float:right; min-width: 100px;width: auto;"><%= scope.textSelectData %></button>\n </td>\n </tr>\n <tr>\n <td class="padding-small" colspan=2>\n <label class="header" style="margin-top: 3px;"><%= scope.textEdit %></label>\n <div id="table-btn-edit" style="display: inline-block; float:right;"></div>\n </td>\n </tr>\n <tr>\n <td class="padding-small" colspan=2>\n <button type="button" class="btn btn-text-default" id="table-btn-convert-range" style="width:100%;"><%= scope.textConvertRange %></button>\n </td>\n </tr>\n <tr>\n <td class="padding-small" colspan=2>\n <div class="separator horizontal"></div>\n </td>\n </tr>\n <tr>\n <td align="center" colspan=2>\n <label class="link" id="table-advanced-link"><%= scope.textAdvanced %></label>\n </td>\n </tr>\n <tr class="finish-cell"></tr>\n</table>'}),define("text!spreadsheeteditor/main/app/template/TableSettingsAdvanced.template",[],function(){return'<div id="id-adv-table-alttext" class="settings-panel active">\n <div class="inner-content">\n <table cols="1" width="100%">\n <tr>\n <td class="padding-large">\n <label class="header"><%= scope.textAltTitle %></label>\n <div id="table-advanced-alt-title"></div>\n </td>\n </tr>\n <tr>\n <td>\n <label class="header"><%= scope.textAltDescription %></label>\n <textarea id="table-advanced-alt-description" class="form-control" style="width: 100%; height: 70px;"></textarea>\n </td>\n </tr>\n <tr>\n <td>\n <label><%= scope.textAltTip %></label>\n </td>\n </tr>\n </table>\n </div>\n</div>'}),define("spreadsheeteditor/main/app/view/TableSettingsAdvanced",["text!spreadsheeteditor/main/app/template/TableSettingsAdvanced.template","common/main/lib/view/AdvancedSettingsWindow","common/main/lib/component/InputField"],function(e){"use strict";SSE.Views.TableSettingsAdvanced=Common.Views.AdvancedSettingsWindow.extend(_.extend({options:{contentWidth:300,height:342,toggleGroup:"table-adv-settings-group",properties:null,storageName:"sse-table-settings-adv-category"},initialize:function(t){_.extend(this.options,{title:this.textTitle,items:[{panelId:"id-adv-table-alttext",panelCaption:this.textAlt}],contentTemplate:_.template(e)({scope:this})},t),Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this,this.options),this._originalProps=this.options.tableProps,this._changedProps=null},render:function(){Common.Views.AdvancedSettingsWindow.prototype.render.call(this);var e=this;this.inputAltTitle=(new Common.UI.InputField({el:$("#table-advanced-alt-title"),allowBlank:!0,validateOnBlur:!1,style:"width: 100%;"})).on("changed:after",function(){e.isAltTitleChanged=!0}),this.textareaAltDescription=this.$window.find("textarea"),this.textareaAltDescription.keydown(function(t){t.keyCode==Common.UI.Keys.RETURN&&t.stopPropagation(),e.isAltDescChanged=!0}),this.afterRender()},afterRender:function(){this._setDefaults(this._originalProps);if(this.storageName){var e=Common.localStorage.getItem(this.storageName);this.setActiveCategory(e!==null?parseInt(e):0)}},_setDefaults:function(e){if(e){var t=e.asc_getTitle();this.inputAltTitle.setValue(t?t:""),t=e.asc_getDescription(),this.textareaAltDescription.val(t?t:"")}},getSettings:function(){if(this.isAltTitleChanged||this.isAltDescChanged){var e=new Asc.AdvancedTableInfoSettings;return e.asc_setTitle(this.inputAltTitle.getValue()),e.asc_setDescription(this.textareaAltDescription.val()),e}},textTitle:"Table - Advanced Settings",cancelButtonText:"Cancel",okButtonText:"Ok",textAlt:"Alternative Text",textAltTitle:"Title",textAltDescription:"Description",textAltTip:"The alternative text-based representation of the visual object information, which will be read to the people with vision or cognitive impairments to help them better understand what information there is in the image, autoshape, chart or table."},SSE.Views.TableSettingsAdvanced||{}))}),define("spreadsheeteditor/main/app/view/TableSettings",["text!spreadsheeteditor/main/app/template/TableSettings.template","jquery","underscore","backbone","common/main/lib/component/Button","common/main/lib/component/CheckBox","common/main/lib/component/ComboDataView","spreadsheeteditor/main/app/view/TableOptionsDialog","spreadsheeteditor/main/app/view/TableSettingsAdvanced"],function(e,t,n,r){"use strict";SSE.Views.TableSettings=r.View.extend(n.extend({el:"#id-table-settings",template:n.template(e),events:{},options:{alias:"TableSettings"},initialize:function(){this._initSettings=!0,this._state={TableName:"",TemplateName:"",Range:"",CheckHeader:!1,CheckTotal:!1,CheckBanded:!1,CheckFirst:!1,CheckLast:!1,CheckColBanded:!1,CheckFilter:!1,DisabledControls:!1,TableNameError:!1},this.lockedControls=[],this._locked=!1,this._originalProps=null,this._noApply=!1,this.render()},onCheckTemplateChange:function(e,t,n,r,i,s){this._state[t]=undefined,this.api&&this.api.asc_changeFormatTableInfo(this._state.TableName,e,r=="checked"),Common.NotificationCenter.trigger("edit:complete",this)},onTableTemplateSelect:function(e,t){this.api&&!this._noApply&&this.api.asc_changeAutoFilter(this._state.TableName,Asc.c_oAscChangeFilterOptions.style,t.get("name")),Common.NotificationCenter.trigger("edit:complete",this)},onEditClick:function(e,t,n){this.api&&(t.options.idx>=0&&t.options.idx<4?this.api.asc_changeSelectionFormatTable(this._state.TableName,t.value):t.options.idx>=4&&t.options.idx<8?this.api.asc_insertCellsInTable(this._state.TableName,t.value):this.api.asc_deleteCellsInTable(this._state.TableName,t.value)),Common.NotificationCenter.trigger("edit:complete",this)},onTableNameChanged:function(e,t,n){var r=this._state.TableName;this._state.TableName="";if(r.toLowerCase()==t.toLowerCase()){Common.NotificationCenter.trigger("edit:complete",this);return}var i=this,s=this.api.asc_checkDefinedName(t,null);if(s.asc_getStatus()===!0)s=!0;else switch(s.asc_getReason()){case Asc.c_oAscDefinedNameReason.IsLocked:s=this.textIsLocked;break;case Asc.c_oAscDefinedNameReason.Existed:s=this.textExistName;break;case Asc.c_oAscDefinedNameReason.NameReserved:s=this.textReservedName;break;default:s=this.textInvalidName}s===!0?(this.api.asc_changeDisplayNameTable(r,t),Common.NotificationCenter.trigger("edit:complete",this)):this._state.TableNameError||(this._state.TableNameError=!0,Common.UI.alert({msg:s,title:this.notcriticalErrorTitle,iconCls:"warn",buttons:["ok"],callback:function(e){Common.NotificationCenter.trigger("edit:complete",this),i._state.TableNameError=!1}}))},render:function(){var e=t(this.el);e.html(this.template({scope:this})),this.linkAdvanced=t("#table-advanced-link")},setApi:function(e){return this.api=e,e&&this.api.asc_registerCallback("asc_onSendThemeColors",n.bind(this.onSendThemeColors,this)),this},createDelayedControls:function(){var e=this;this.chHeader=new Common.UI.CheckBox({el:t("#table-checkbox-header"),labelText:this.textHeader}),this.lockedControls.push(this.chHeader),this.chTotal=new Common.UI.CheckBox({el:t("#table-checkbox-total"),labelText:this.textTotal}),this.lockedControls.push(this.chTotal),this.chBanded=new Common.UI.CheckBox({el:t("#table-checkbox-banded"),labelText:this.textBanded}),this.lockedControls.push(this.chBanded),this.chFirst=new Common.UI.CheckBox({el:t("#table-checkbox-first"),labelText:this.textFirst}),this.lockedControls.push(this.chFirst),this.chLast=new Common.UI.CheckBox({el:t("#table-checkbox-last"),labelText:this.textLast}),this.lockedControls.push(this.chLast),this.chColBanded=new Common.UI.CheckBox({el:t("#table-checkbox-col-banded"),labelText:this.textBanded}),this.lockedControls.push(this.chColBanded),this.chFilter=new Common.UI.CheckBox({el:t("#table-checkbox-filter"),labelText:this.textFilter}),this.lockedControls.push(this.chFilter),this.chHeader.on("change",n.bind(this.onCheckTemplateChange,this,Asc.c_oAscChangeTableStyleInfo.rowHeader,"CheckHeader")),this.chTotal.on("change",n.bind(this.onCheckTemplateChange,this,Asc.c_oAscChangeTableStyleInfo.rowTotal,"CheckTotal")),this.chBanded.on("change",n.bind(this.onCheckTemplateChange,this,Asc.c_oAscChangeTableStyleInfo.rowBanded,"CheckBanded")),this.chFirst.on("change",n.bind(this.onCheckTemplateChange,this,Asc.c_oAscChangeTableStyleInfo.columnFirst,"CheckFirst")),this.chLast.on("change",n.bind(this.onCheckTemplateChange,this,Asc.c_oAscChangeTableStyleInfo.columnLast,"CheckLast")),this.chColBanded.on("change",n.bind(this.onCheckTemplateChange,this,Asc.c_oAscChangeTableStyleInfo.columnBanded,"CheckColBanded")),this.chFilter.on("change",n.bind(this.onCheckTemplateChange,this,Asc.c_oAscChangeTableStyleInfo.filterButton,"CheckFilter")),this.txtTableName=new Common.UI.InputField({el:t("#table-txt-name"),name:"tablename",style:"width: 100%;",validateOnBlur:!1}),this.txtTableName.on("changed:after",n.bind(this.onTableNameChanged,this)),this.lockedControls.push(this.txtTableName),this.btnSelectData=new Common.UI.Button({el:t("#table-btn-select-data")}),this.btnSelectData.on("click",n.bind(this.onSelectData,this)),this.lockedControls.push(this.btnSelectData),this.btnEdit=new Common.UI.Button({cls:"btn-icon-default",iconCls:"btn-edit-table",menu:new Common.UI.Menu({menuAlign:"tr-br",items:[{caption:this.selectRowText,value:Asc.c_oAscChangeSelectionFormatTable.row,idx:0},{caption:this.selectColumnText,value:Asc.c_oAscChangeSelectionFormatTable.column,idx:1},{caption:this.selectDataText,value:Asc.c_oAscChangeSelectionFormatTable.data,idx:2},{caption:this.selectTableText,value:Asc.c_oAscChangeSelectionFormatTable.all,idx:3},{caption:"--"},{caption:this.insertRowAboveText,value:Asc.c_oAscInsertOptions.InsertTableRowAbove,idx:4},{caption:this.insertRowBelowText,value:Asc.c_oAscInsertOptions.InsertTableRowBelow,idx:5},{caption:this.insertColumnLeftText,value:Asc.c_oAscInsertOptions.InsertTableColLeft,idx:6},{caption:this.insertColumnRightText,value:Asc.c_oAscInsertOptions.InsertTableColRight,idx:7},{caption:"--"},{caption:this.deleteRowText,value:Asc.c_oAscDeleteOptions.DeleteRows,idx:8},{caption:this.deleteColumnText,value:Asc.c_oAscDeleteOptions.DeleteColumns,idx:9},{caption:this.deleteTableText,value:Asc.c_oAscDeleteOptions.DeleteTable,idx:10}]})}),this.btnEdit.render(t("#table-btn-edit")),this.btnEdit.menu.on("show:after",n.bind(function(e){this.api&&(e.items[5].setDisabled(!this._originalProps.asc_getIsInsertRowAbove()),e.items[6].setDisabled(!this._originalProps.asc_getIsInsertRowBelow()),e.items[7].setDisabled(!this._originalProps.asc_getIsInsertColumnLeft()),e.items[8].setDisabled(!this._originalProps.asc_getIsInsertColumnRight()),e.items[10].setDisabled(!this._originalProps.asc_getIsDeleteRow()),e.items[11].setDisabled(!this._originalProps.asc_getIsDeleteColumn()),e.items[12].setDisabled(!this._originalProps.asc_getIsDeleteTable()))},this)),this.btnEdit.menu.on("item:click",n.bind(this.onEditClick,this)),this.lockedControls.push(this.btnEdit),this.btnConvertRange=new Common.UI.Button({el:t("#table-btn-convert-range")}),this.btnConvertRange.on("click",n.bind(function(e){this.api&&this.api.asc_convertTableToRange(this._state.TableName),Common.NotificationCenter.trigger("edit:complete",this)},this)),this.lockedControls.push(this.btnConvertRange),t(this.el).on("click","#table-advanced-link",n.bind(this.openAdvancedSettings,this)),this._initSettings=!1},openAdvancedSettings:function(e){if(this.linkAdvanced.hasClass("disabled"))return;var t=this,n;t.api&&!this._locked&&(new SSE.Views.TableSettingsAdvanced({tableProps:t._originalProps,api:t.api,handler:function(e,n){e=="ok"&&t.api&&n&&t.api.asc_changeFormatTableInfo(t._state.TableName,Asc.c_oAscChangeTableStyleInfo.advancedSettings,n),Common.NotificationCenter.trigger("edit:complete",t)}})).show()},ChangeSettings:function(e){this._initSettings&&this.createDelayedControls(),this.disableControls(this._locked);if(e){this._originalProps=e;var t=e.asc_getTableName();this._state.TableName!==t&&(this.txtTableName.setValue(t),this._state.TableName=t),this._state.Range=e.asc_getTableRange();var n=!1;t=e.asc_getFirstRow(),this._state.CheckHeader!==t&&(this.chHeader.setValue(t,!0),this._state.CheckHeader=t,n=!0),t=e.asc_getLastRow(),this._state.CheckTotal!==t&&(this.chTotal.setValue(t,!0),this._state.CheckTotal=t,n=!0),t=e.asc_getBandHor(),this._state.CheckBanded!==t&&(this.chBanded.setValue(t,!0),this._state.CheckBanded=t,n=!0),t=e.asc_getFirstCol(),this._state.CheckFirst!==t&&(this.chFirst.setValue(t,!0),this._state.CheckFirst=t,n=!0),t=e.asc_getLastCol(),this._state.CheckLast!==t&&(this.chLast.setValue(t,!0),this._state.CheckLast=t,n=!0),t=e.asc_getBandVer(),this._state.CheckColBanded!==t&&(this.chColBanded.setValue(t,!0),this._state.CheckColBanded=t,n=!0),t=e.asc_getFilterButton(),this._state.CheckFilter!==t&&(this.chFilter.setValue(t,!0),this._state.CheckFilter=t),this.chFilter.isDisabled()!==(!this._state.CheckHeader||this._locked||t===null)&&this.chFilter.setDisabled(!this._state.CheckHeader||this._locked||t===null),n&&this.onApiInitTableTemplates(this.api.asc_getTablePictures(e)),t=e.asc_getTableStyleName();if(this._state.TemplateName!==t||this._isTemplatesChanged){this.cmbTableTemplate.suspendEvents();var r=this.cmbTableTemplate.menuPicker.store.findWhere({name:t});this.cmbTableTemplate.menuPicker.selectRecord(r),this.cmbTableTemplate.resumeEvents(),this._isTemplatesChanged&&(r?this.cmbTableTemplate.fillComboView(this.cmbTableTemplate.menuPicker.getSelectedRec()[0],!0):this.cmbTableTemplate.fillComboView(this.cmbTableTemplate.menuPicker.store.at(0),!0)),this._state.TemplateName=t}this._isTemplatesChanged=!1}},onSendThemeColors:function(){this.cmbTableTemplate&&(this.onApiInitTableTemplates(this.api.asc_getTablePictures(this._originalProps)),this.cmbTableTemplate.menuPicker.scroller.update({alwaysVisibleY:!0}))},onApiInitTableTemplates:function(e){var r=this;this._isTemplatesChanged=!0,this.cmbTableTemplate||(this.cmbTableTemplate=new Common.UI.ComboDataView({itemWidth:61,itemHeight:46,menuMaxHeight:300,enableKeyEvents:!0}),this.cmbTableTemplate.render(t("#table-combo-template")),this.cmbTableTemplate.openButton.menu.cmpEl.css({"min-width":175,"max-width":175}),this.cmbTableTemplate.on("click",n.bind(this.onTableTemplateSelect,this)),this.cmbTableTemplate.openButton.menu.on("show:after",function(){r.cmbTableTemplate.menuPicker.scroller.update({alwaysVisibleY:!0})}),this.lockedControls.push(this.cmbTableTemplate),this._locked&&this.cmbTableTemplate.setDisabled(this._locked));var i=r.cmbTableTemplate.menuPicker.store.length;if(i>0&&i==e.length){var s=r.cmbTableTemplate.menuPicker.store.models;n.each(e,function(e,t){s[t].set("imageUrl",e.asc_getImage())})}else{r.cmbTableTemplate.menuPicker.store.reset([]);var o=[];n.each(e,function(e){o.push({id:Common.UI.getId(),name:e.asc_getName(),caption:e.asc_getDisplayName(),type:e.asc_getType(),imageUrl:e.asc_getImage(),allowSelected:!0,selected:!1,tip:e.asc_getDisplayName()})}),r.cmbTableTemplate.menuPicker.store.add(o)}},onSelectData:function(){var e=this;if(e.api){var t=function(t,n){n=="ok"&&(e.api.asc_setSelectionDialogMode(Asc.c_oAscSelectionDialogType.None),e.api.asc_changeTableRange(e._state.TableName,t.getSettings())),Common.NotificationCenter.trigger("edit:complete",e.toolbar)},n=new SSE.Views.TableOptionsDialog({handler:t});n.show(),n.setSettings({api:e.api,range:e._state.Range,title:e.textResize})}},setLocked:function(e){this._locked=e},disableControls:function(e){if(this._initSettings)return;this._state.DisabledControls!==e&&(this._state.DisabledControls=e,n.each(this.lockedControls,function(t){t.setDisabled(e)}),this.linkAdvanced.toggleClass("disabled",e))},textEdit:"Rows & Columns",selectRowText:"Select Row",selectColumnText:"Select Entire Column",selectDataText:"Select Column Data",selectTableText:"Select Table",insertRowAboveText:"Insert Row Above",insertRowBelowText:"Insert Row Below",insertColumnLeftText:"Insert Column Left",insertColumnRightText:"Insert Column Right",deleteRowText:"Delete Row",deleteColumnText:"Delete Column",deleteTableText:"Delete Table",textOK:"OK",textCancel:"Cancel",textTemplate:"Select From Template",textRows:"Rows",textColumns:"Columns",textHeader:"Header",textTotal:"Total",textBanded:"Banded",textFirst:"First",textLast:"Last",textEmptyTemplate:"No templates",textFilter:"Filter button",textTableName:"Table Name",textResize:"Resize table",textSelectData:"Select Data",textInvalidName:"ERROR! Invalid table name",textExistName:"ERROR! Range with such a name already exists",textIsLocked:"This element is being edited by another user.",notcriticalErrorTitle:"Warning",textReservedName:"The name you are trying to use is already referenced in cell formulas. Please use some other name.",textAdvanced:"Show advanced settings",textConvertRange:"Convert to range"},SSE.Views.TableSettings||{}))});var SCALE_MIN=40,MENU_SCALE_PART=260;define("spreadsheeteditor/main/app/view/RightMenu",["text!spreadsheeteditor/main/app/template/RightMenu.template","jquery","underscore","backbone","common/main/lib/component/Button","common/main/lib/component/MetricSpinner","common/main/lib/component/CheckBox","spreadsheeteditor/main/app/view/ParagraphSettings","spreadsheeteditor/main/app/view/ImageSettings","spreadsheeteditor/main/app/view/ChartSettings","spreadsheeteditor/main/app/view/ShapeSettings","spreadsheeteditor/main/app/view/TextArtSettings","spreadsheeteditor/main/app/view/TableSettings","common/main/lib/component/Scroller"],function(e,t,n,r){"use strict";SSE.Views.RightMenu=r.View.extend(n.extend({el:"#right-menu",template:n.template(e),events:{},initialize:function(){return this.minimizedMode=!0,this.btnText=new Common.UI.Button({hint:this.txtParagraphSettings,asctype:Common.Utils.documentSettingsType.Paragraph,enableToggle:!0,disabled:!0,toggleGroup:"tabpanelbtnsGroup",allowMouseEventsOnDisabled:!0}),this.btnImage=new Common.UI.Button({hint:this.txtImageSettings,asctype:Common.Utils.documentSettingsType.Image,enableToggle:!0,disabled:!0,toggleGroup:"tabpanelbtnsGroup",allowMouseEventsOnDisabled:!0}),this.btnChart=new Common.UI.Button({hint:this.txtChartSettings,asctype:Common.Utils.documentSettingsType.Chart,enableToggle:!0,disabled:!0,toggleGroup:"tabpanelbtnsGroup",allowMouseEventsOnDisabled:!0}),this.btnShape=new Common.UI.Button({hint:this.txtShapeSettings,asctype:Common.Utils.documentSettingsType.Shape,enableToggle:!0,disabled:!0,toggleGroup:"tabpanelbtnsGroup",allowMouseEventsOnDisabled:!0}),this.btnTextArt=new Common.UI.Button({hint:this.txtTextArtSettings,asctype:Common.Utils.documentSettingsType.TextArt,enableToggle:!0,disabled:!0,toggleGroup:"tabpanelbtnsGroup",allowMouseEventsOnDisabled:!0}),this.btnTable=new Common.UI.Button({hint:this.txtTableSettings,asctype:Common.Utils.documentSettingsType.Table,enableToggle:!0,disabled:!0,toggleGroup:"tabpanelbtnsGroup",allowMouseEventsOnDisabled:!0}),this._settings=[],this._settings[Common.Utils.documentSettingsType.Paragraph]={panel:"id-paragraph-settings",btn:this.btnText},this._settings[Common.Utils.documentSettingsType.Image]={panel:"id-image-settings",btn:this.btnImage},this._settings[Common.Utils.documentSettingsType.Shape]={panel:"id-shape-settings",btn:this.btnShape},this._settings[Common.Utils.documentSettingsType.Chart]={panel:"id-chart-settings",btn:this.btnChart},this._settings[Common.Utils.documentSettingsType.TextArt]={panel:"id-textart-settings",btn:this.btnTextArt},this._settings[Common.Utils.documentSettingsType.Table]={panel:"id-table-settings",btn:this.btnTable},this},render:function(){var e=t(this.el);return this.trigger("render:before",this),e.css("width","40px"),e.css("z-index",101),e.show(),e.html(this.template({})),this.btnText.el=t("#id-right-menu-text"),this.btnText.render(),this.btnImage.el=t("#id-right-menu-image"),this.btnImage.render(),this.btnChart.el=t("#id-right-menu-chart"),this.btnChart.render(),this.btnShape.el=t("#id-right-menu-shape"),this.btnShape.render(),this.btnTextArt.el=t("#id-right-menu-textart"),this.btnTextArt.render(),this.btnTable.el=t("#id-right-menu-table"),this.btnTable.render(),this.btnText.on("click",n.bind(this.onBtnMenuClick,this)),this.btnImage.on("click",n.bind(this.onBtnMenuClick,this)),this.btnChart.on("click",n.bind(this.onBtnMenuClick,this)),this.btnShape.on("click",n.bind(this.onBtnMenuClick,this)),this.btnTextArt.on("click",n.bind(this.onBtnMenuClick,this)),this.btnTable.on("click",n.bind(this.onBtnMenuClick,this)),this.paragraphSettings=new SSE.Views.ParagraphSettings,this.imageSettings=new SSE.Views.ImageSettings,this.chartSettings=new SSE.Views.ChartSettings,this.shapeSettings=new SSE.Views.ShapeSettings,this.textartSettings=new SSE.Views.TextArtSettings,this.tableSettings=new SSE.Views.TableSettings,n.isUndefined(this.scroller)&&(this.scroller=new Common.UI.Scroller({el:t(this.el).find(".right-panel"),suppressScrollX:!0,useKeyboard:!1})),this.trigger("render:after",this),this},setApi:function(e){this.api=e,this.paragraphSettings.setApi(e),this.imageSettings.setApi(e),this.chartSettings.setApi(e),this.shapeSettings.setApi(e),this.textartSettings.setApi(e),this.tableSettings.setApi(e)},setMode:function(e){},onBtnMenuClick:function(e,n){var r=t("#"+this._settings[e.options.asctype].panel),i=r.parent();e.pressed?(this.minimizedMode&&(t(this.el).width(MENU_SCALE_PART),i.css("display","inline-block"),this.minimizedMode=!1,Common.localStorage.setItem("sse-hide-right-settings",0)),i.find("> .active").removeClass("active"),r.addClass("active"),this.scroller&&this.scroller.scrollTop(0)):(i.css("display","none"),t(this.el).width(SCALE_MIN),this.minimizedMode=!0,Common.localStorage.setItem("sse-hide-right-settings",1)),this.fireEvent("rightmenuclick",[this,e.options.asctype,this.minimizedMode])},SetActivePane:function(e,n){if(this.minimizedMode&&n!==!0||this._settings[e]===undefined)return;if(this.minimizedMode)this._settings[e].btn.toggle(!0,!1),this._settings[e].btn.trigger("click",this._settings[e].btn);else{var r=t("#"+this._settings[e].panel);r.hasClass("active")||(r.parent().find("> .active").removeClass("active"),r.addClass("active"),this.scroller&&this.scroller.update()),this._settings[e].btn.isActive()||this._settings[e].btn.toggle(!0,!1)}},GetActivePane:function(){return this.minimizedMode?null:this.$el.find(".settings-panel.active")[0].id},clearSelection:function(){var e=t(".right-panel");e.find("> .active").removeClass("active"),this._settings.forEach(function(e){e.btn.isActive()&&e.btn.toggle(!1,!0)}),e.css("display","none"),t(this.el).width(SCALE_MIN),this.minimizedMode=!0,Common.NotificationCenter.trigger("layout:changed","rightmenu")},txtParagraphSettings:"Paragraph Settings",txtImageSettings:"Image Settings",txtShapeSettings:"Shape Settings",txtTextArtSettings:"Text Art Settings",txtChartSettings:"Chart Settings",txtSparklineSettings:"Sparkline Settings",txtTableSettings:"Table Settings"},SSE.Views.RightMenu||{}))}),define("spreadsheeteditor/main/app/controller/RightMenu",["core","spreadsheeteditor/main/app/view/RightMenu"],function(){"use strict";SSE.Controllers.RightMenu=Backbone.Controller.extend({models:[],collections:[],views:["RightMenu"],initialize:function(){this.editMode=!0,this._state={},this.addListeners({RightMenu:{rightmenuclick:this.onRightMenuClick}})},onLaunch:function(){this.rightmenu=this.createView("RightMenu"),this.rightmenu.on("render:after",_.bind(this.onRightMenuAfterRender,this))},onRightMenuAfterRender:function(e){e.shapeSettings.application=e.textartSettings.application=this.getApplication(),this._settings=[],this._settings[Common.Utils.documentSettingsType.Paragraph]={panelId:"id-paragraph-settings",panel:e.paragraphSettings,btn:e.btnText,hidden:1,locked:!1},this._settings[Common.Utils.documentSettingsType.Image]={panelId:"id-image-settings",panel:e.imageSettings,btn:e.btnImage,hidden:1,locked:!1},this._settings[Common.Utils.documentSettingsType.Shape]={panelId:"id-shape-settings",panel:e.shapeSettings,btn:e.btnShape,hidden:1,locked:!1},this._settings[Common.Utils.documentSettingsType.TextArt]={panelId:"id-textart-settings",panel:e.textartSettings,btn:e.btnTextArt,hidden:1,locked:!1},this._settings[Common.Utils.documentSettingsType.Chart]={panelId:"id-chart-settings",panel:e.chartSettings,btn:e.btnChart,hidden:1,locked:!1},this._settings[Common.Utils.documentSettingsType.Table]={panelId:"id-table-settings",panel:e.tableSettings,btn:e.btnTable,hidden:1,locked:!1}},setApi:function(e){this.api=e,this.api.asc_registerCallback("asc_onCoAuthoringDisconnect",_.bind(this.onCoAuthoringDisconnect,this)),Common.NotificationCenter.on("api:disconnect",_.bind(this.onCoAuthoringDisconnect,this)),Common.NotificationCenter.on("cells:range",_.bind(this.onCellsRange,this))},setMode:function(e){this.editMode=e.isEdit},onRightMenuClick:function(e,t,n){if(!n&&this.editMode){var r=this._settings[t].panel,i=this._settings[t].props;i&&r&&r.ChangeSettings.call(r,i)}Common.NotificationCenter.trigger("layout:changed","rightmenu"),Common.NotificationCenter.trigger("edit:complete",this.rightmenu)},onSelectionChanged:function(e){if(this.rangeSelectionMode)return;var t=[],n=e.asc_getFlags().asc_getSelectionType(),r=e.asc_getFormatTableInfo(),i=e.asc_getSparklineInfo();if(n==Asc.c_oAscSelectionType.RangeImage||n==Asc.c_oAscSelectionType.RangeShape||n==Asc.c_oAscSelectionType.RangeChart||n==Asc.c_oAscSelectionType.RangeChartText||n==Asc.c_oAscSelectionType.RangeShapeText)t=this.api.asc_getGraphicObjectProps();t.length<=0&&!r&&!i&&!this.rightmenu.minimizedMode&&(this.rightmenu.clearSelection(),this._openRightMenu=!0);var s=e.asc_getLocked(),o=e.asc_getLockedTable()===!0,u=e.asc_getLockedSparkline()===!0;this.onFocusObject(t,r,i,s,o,u)},onFocusObject:function(e,t,n,r,i,s){if(!this.editMode)return;for(var o=0;o<this._settings.length;++o)this._settings[o]&&(this._settings[o].hidden=1,this._settings[o].locked=!1);for(o=0;o<e.length;++o){var u=e[o].asc_getObjectType(),a=this.getDocumentSettingsType(u);if(a===undefined||a>=this._settings.length||this._settings[a]===undefined)continue;var f=e[o].asc_getObjectValue();a==Common.Utils.documentSettingsType.Image&&(f.asc_getChartProperties()!==null?(a=Common.Utils.documentSettingsType.Chart,this._settings[a].btn.updateHint(this.rightmenu.txtChartSettings)):f.asc_getShapeProperties()!==null&&(a=Common.Utils.documentSettingsType.Shape,f.asc_getShapeProperties().asc_getTextArtProperties()&&(this._settings[Common.Utils.documentSettingsType.TextArt].props=f,this._settings[Common.Utils.documentSettingsType.TextArt].hidden=0,this._settings[Common.Utils.documentSettingsType.TextArt].locked=f.asc_getLocked()))),this._settings[a].props=f,this._settings[a].hidden=0,this._settings[a].locked=f.asc_getLocked()}t&&(a=Common.Utils.documentSettingsType.Table,this._settings[a].props=t,this._settings[a].locked=i,this._settings[a].hidden=0),n&&(a=Common.Utils.documentSettingsType.Chart,this._settings[a].props=n,this._settings[a].locked=s,this._settings[a].hidden=0,this._settings[a].btn.updateHint(this.rightmenu.txtSparklineSettings));var l=-1,c,h=-1,p=this.rightmenu.GetActivePane();for(o=0;o<this._settings.length;++o){var d=this._settings[o];if(d===undefined)continue;d.hidden?(d.btn.isDisabled()||d.btn.setDisabled(!0),p==d.panelId&&(c=-1)):(d.btn.isDisabled()&&d.btn.setDisabled(!1),l=o,d.needShow?(d.needShow=!1,h=o):p==d.panelId&&(c=o),d.panel.setLocked(d.locked))}if(!this.rightmenu.minimizedMode||this._openRightMenu){var v;h>-1?v=h:l>=0&&c<0?v=l:c>=0&&(v=c),v==undefined&&this._openRightMenu&&l>=0&&(v=l),v!==undefined&&(this.rightmenu.SetActivePane(v,this._openRightMenu),this._settings[v].panel.ChangeSettings.call(this._settings[v].panel,this._settings[v].props),this._openRightMenu=!1)}this._settings[Common.Utils.documentSettingsType.Image].needShow=!1,this._settings[Common.Utils.documentSettingsType.Chart].needShow=!1},onCoAuthoringDisconnect:function(){this.SetDisabled(!0),this.setMode({isEdit:!1})},onInsertImage:function(){this._settings[Common.Utils.documentSettingsType.Image].needShow=!0},onInsertChart:function(){this._settings[Common.Utils.documentSettingsType.Chart].needShow=!0},onInsertShape:function(){this._settings[Common.Utils.documentSettingsType.Shape].needShow=!0},onInsertTextArt:function(){this._settings[Common.Utils.documentSettingsType.TextArt].needShow=!0},UpdateThemeColors:function(){this.rightmenu.shapeSettings.UpdateThemeColors(),this.rightmenu.textartSettings.UpdateThemeColors(),this.rightmenu.chartSettings.UpdateThemeColors()},updateMetricUnit:function(){this.rightmenu.paragraphSettings.updateMetricUnit(),this.rightmenu.chartSettings.updateMetricUnit(),this.rightmenu.imageSettings.updateMetricUnit()},fillTextArt:function(){this.rightmenu.textartSettings.fillTextArt()},createDelayedElements:function(){var e=this;if(this.api){var t=Common.localStorage.getItem("sse-hide-right-settings");this._openRightMenu=t===null||parseInt(t)==0,this.api.asc_registerCallback("asc_onFocusObject",_.bind(this.onFocusObject,this)),this.api.asc_registerCallback("asc_onSelectionChanged",_.bind(this.onSelectionChanged,this)),this.api.asc_registerCallback("asc_doubleClickOnObject",_.bind(this.onDoubleClickOnObject,this)),this.rightmenu.shapeSettings.createDelayedElements(),this.onSelectionChanged(this.api.asc_getCellInfo())}},onDoubleClickOnObject:function(e){if(!this.editMode)return;var t=e.asc_getObjectType(),n=this.getDocumentSettingsType(t);if(n===undefined||n>=this._settings.length||this._settings[n]===undefined)return;var r=e.asc_getObjectValue();n==Common.Utils.documentSettingsType.Image&&(r.asc_getChartProperties()!==null?n=Common.Utils.documentSettingsType.Chart:r.asc_getShapeProperties()!==null&&(n=Common.Utils.documentSettingsType.Shape)),n!==Common.Utils.documentSettingsType.Paragraph&&(this.rightmenu.SetActivePane(n,!0),this._settings[n].panel.ChangeSettings.call(this._settings[n].panel,this._settings[n].props))},getDocumentSettingsType:function(e){switch(e){case Asc.c_oAscTypeSelectElement.Paragraph:return Common.Utils.documentSettingsType.Paragraph;case Asc.c_oAscTypeSelectElement.Image:return Common.Utils.documentSettingsType.Image}},SetDisabled:function(e){this.rightmenu&&(this.rightmenu.paragraphSettings.disableControls(e),this.rightmenu.shapeSettings.disableControls(e),this.rightmenu.imageSettings.disableControls(e),this.rightmenu.chartSettings.disableControls(e),this.rightmenu.tableSettings.disableControls(e),e?(this.rightmenu.btnText.setDisabled(e),this.rightmenu.btnTable.setDisabled(e),this.rightmenu.btnImage.setDisabled(e),this.rightmenu.btnShape.setDisabled(e),this.rightmenu.btnTextArt.setDisabled(e),this.rightmenu.btnChart.setDisabled(e)):this.onSelectionChanged(this.api.asc_getCellInfo()))},onCellsRange:function(e){this.rangeSelectionMode=e!=Asc.c_oAscSelectionDialogType.None}})}),function(e){function l(e,t){var n=e.length;while(n--)if(e[n]===t)return n;return-1}function c(e,t){if(e.length!=t.length)return!1;for(var n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function p(e){for(t in r)r[t]=e[h[t]]}function d(e){var t,i,o,u,c,h;t=e.keyCode,l(a,t)==-1&&a.push(t);if(t==93||t==224)t=91;if(t in r){r[t]=!0;for(o in s)s[o]==t&&(g[o]=!0);return}p(e);if(!g.filter.call(this,e))return;if(!(t in n))return;h=x();for(u=0;u<n[t].length;u++){i=n[t][u];if(i.scope==h||i.scope=="all"){c=i.mods.length>0;for(o in r)if(!r[o]&&l(i.mods,+o)>-1||r[o]&&l(i.mods,+o)==-1)c=!1;if(i.mods.length==0&&!r[16]&&!r[18]&&!r[17]&&!r[91]||c)if(f===!0||i.locked||i.method(e,i)===!1)e.preventDefault?e.preventDefault():e.returnValue=!1,e.stopPropagation&&e.stopPropagation(),e.cancelBubble&&(e.cancelBubble=!0)}}}function v(e){var t=e.keyCode,n,i=l(a,t);i>=0&&a.splice(i,1);if(t==93||t==224)t=91;if(t in r){r[t]=!1;for(n in s)s[n]==t&&(g[n]=!1)}}function m(){for(t in r)r[t]=!1;for(t in s)g[t]=!1}function g(e,t,r){var i,s;i=N(e),r===undefined&&(r=t,t="all");for(var o=0;o<i.length;o++)s=[],e=i[o].split("+"),e.length>1&&(s=C(e),e=[e[e.length-1]]),e=e[0],e=u(e),e in n||(n[e]=[]),n[e].push({shortcut:i[o],scope:t,method:r,key:i[o],mods:s})}function y(e,t){var r,i,s=[],o,a,f;r=N(e);for(a=0;a<r.length;a++){i=r[a].split("+"),i.length>1&&(s=C(i),e=i[i.length-1]),e=u(e),t===undefined&&(t=x());if(!n[e])return;for(o in n[e])f=n[e][o],f.scope===t&&c(f.mods,s)&&(n[e][o]={})}}function b(e){return typeof e=="string"&&(e=u(e)),l(a,e)!=-1}function w(){return a.slice(0)}function E(e){var t=(e.target||e.srcElement).tagName;return t!="INPUT"&&t!="SELECT"&&t!="TEXTAREA"}function S(e){i=e||"all"}function x(){return i||"all"}function T(e){var t,r,i;for(t in n){r=n[t];for(i=0;i<r.length;)r[i].scope===e?r.splice(i,1):i++}}function N(e){var t;return e=e.replace(/\s/g,""),t=e.split(","),t[t.length-1]==""&&(t[t.length-2]+=","),t}function C(e){var t=e.slice(0,e.length-1);for(var n=0;n<t.length;n++)t[n]=s[t[n]];return t}function k(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e.attachEvent&&e.attachEvent("on"+t,function(){n(window.event)})}function A(){var t=e.key;return e.key=L,t}function O(e,t,r,i){var s,o=[],a,f,l=N(e);for(var h=l.length;h--;){s=l[h].split("+"),s.length>1&&(o=C(s),e=s[s.length-1]),e=u(e),t===undefined&&(t=x());if(n[e])for(a in n[e])f=n[e][a],f.scope===t&&c(f.mods,o)&&(n[e][a][r]=i)}}function M(e,t){e?O(e,t,"locked",!0):f=!0}function _(e,t){e?O(e,t,"locked",!1):f=!1}var t,n={},r={16:!1,18:!1,17:!1,91:!1},i="all",s={"⇧":16,shift:16,"⌥":18,alt:18,option:18,"⌃":17,ctrl:17,control:17,"⌘":91,command:91},o={backspace:8,tab:9,clear:12,enter:13,"return":13,esc:27,escape:27,space:32,left:37,up:38,right:39,down:40,del:46,"delete":46,home:36,end:35,pageup:33,pagedown:34,",":188,".":190,"/":191,"`":192,"-":189,"=":187,";":186,"'":222,"[":219,"]":221,"\\":220},u=function(e){return o[e]||e.toUpperCase().charCodeAt(0)},a=[],f;for(t=1;t<20;t++)o["f"+t]=111+t;var h={16:"shiftKey",18:"altKey",17:"ctrlKey",91:"metaKey"};for(t in s)g[t]=!1;k(document,"keydown",function(e){d(e)}),k(document,"keyup",v),k(window,"focus",m);var L=e.key;e.key=g,e.key.setScope=S,e.key.getScope=x,e.key.deleteScope=T,e.key.filter=E,e.key.isPressed=b,e.key.getPressedKeyCodes=w,e.key.noConflict=A,e.key.unbind=y,e.key.suspend=M,e.key.resume=_,typeof module!="undefined"&&(module.exports=key)}(this),define("keymaster",function(){});if(Common===undefined)var Common={};Common.util=Common.util||{},define("common/main/lib/util/Shortcuts",["backbone","keymaster"],function(e){"use strict";var t=function(e){return this.cid=_.uniqueId("shortcuts"),this.initialize.apply(this,arguments),this};_.extend(t.prototype,e.Events,{initialize:function(){window.key.filter=function(e){return!0},Common.NotificationCenter.on({"modal:show":function(e){window.key.suspend()},"modal:close":function(e){window.key.resume()},"modal:hide":function(e){window.key.resume()}})},delegateShortcuts:function(e){if(!e||!e.shortcuts)return;this.removeShortcuts(e);var t,n,r,i,s,o,u=[];for(s in e.shortcuts){t=e.shortcuts[s];if(!_.isFunction(t)){r=e[t];if(!r)throw new Error("Method "+t+" does not exist")}else r=t;n=s.match(/^(\S+)\s*(.*)$/),o=n[1],i=n[2].length?n[2]:"all",r=_.bind(r,this),u.push(window.key(o,i,r))}},removeShortcuts:function(e){if(!e||!e.shortcuts)return;var t,n,r,i,s=[];for(r in e.shortcuts)t=r.match(/^(\S+)\s*(.*)$/),i=t[1],n=t[2].length?t[2]:"all",window.key.unbind(i,n)},suspendEvents:function(e,t){window.key.suspend(e,t)},resumeEvents:function(e,t){window.key.resume(e,t)}}),t.extend=e.View.extend,Common.util.Shortcuts=new t}),define("text!spreadsheeteditor/main/app/template/LeftMenu.template",[],function(){return'<div id="view-left-menu" class="tool-menu left">\r\n <div class="tool-menu-btns">\r\n <button id="left-btn-file" class="btn btn-category" content-target="left-panel-file"><span class="btn-icon img-toolbarmenu btn-menu-file"> </span></button>\r\n <button id="left-btn-search" class="btn btn-category" content-target=""><span class="btn-icon img-toolbarmenu btn-menu-search"> </span></button>\r\n <!-- /** coauthoring begin **/ -->\r\n <button id="left-btn-comments" class="btn btn-category" content-target="left-panel-comments"><span class="btn-icon img-toolbarmenu btn-menu-comments"> </span></button>\r\n <button id="left-btn-chat" class="btn btn-category" content-target="left-panel-chat"><span class="btn-icon img-toolbarmenu btn-menu-chat"> </span></button>\r\n <!-- /** coauthoring end **/ -->\r\n <button id="left-btn-plugins" class="btn btn-category" content-target=""><span class="btn-icon img-toolbarmenu btn-menu-plugin"> </span></button>\r\n <button id="left-btn-support" class="btn btn-category" content-target=""><span class="btn-icon img-toolbarmenu btn-menu-support"> </span></button>\r\n <button id="left-btn-about" class="btn btn-category" content-target=""><span class="btn-icon img-toolbarmenu btn-menu-about"> </span></button>\r\n </div>\r\n <div class="left-panel" style="">\r\n <!-- /** coauthoring begin **/ -->\r\n <div id="left-panel-comments" class="" style="display: none;" />\r\n <div id="left-panel-chat" class="" style="display: none;" />\r\n <!-- /** coauthoring end **/ -->\r\n <div id="left-panel-plugins" class="" style="display: none; height: 100%;" />\r\n </div>\r\n</div>'}),define("common/main/lib/view/About",["common/main/lib/component/BaseView","common/main/lib/component/Scroller"],function(){"use strict";Common.Views.About=Common.UI.BaseView.extend(_.extend({menu:undefined,options:{alias:"Common.Views.About"},initialize:function(e){Common.UI.BaseView.prototype.initialize.call(this,arguments),this.txtVersionNum="0.0.0",this.txtAscMail="support@onlyoffice.com",this.txtAscTelNum="+371 660-16425",this.txtAscUrl="www.onlyoffice.com",this.txtAscName="Ascensio System SIA",this.template=_.template(['<table id="id-about-licensor-logo" cols="1" style="width: 100%; margin-top: 20px;">',"<tr>",'<td align="center"><div class="asc-about-office"/></td>',"</tr>","<tr>",'<td align="center"><label class="asc-about-version">'+e.appName.toUpperCase()+"</label></td>","</tr>","<tr>",'<td align="center"><label class="asc-about-version" id="id-about-licensor-version-name">'+this.txtVersion+this.txtVersionNum+"</label></td>","</tr>","</table>",'<table id="id-about-licensor-info" cols="3" style="width: 100%;" class="margin-bottom">',"<tr>",'<td colspan="3" align="center" style="padding: 20px 0 10px 0;"><label class="asc-about-companyname">'+this.txtAscName+"</label></td>","</tr>","<tr>",'<td colspan="3" align="center" class="padding-small">','<label class="asc-about-desc-name">'+this.txtAddress+"</label>",'<label class="asc-about-desc">'+this.txtAscAddress+"</label>","</td>","</tr>","<tr>",'<td colspan="3" align="center" class="padding-small">','<label class="asc-about-desc-name">'+this.txtMail+"</label>",'<a href="mailto:'+this.txtAscMail+'">'+this.txtAscMail+"</a>","</td>","</tr>","<tr>",'<td colspan="3" align="center" class="padding-small">','<label class="asc-about-desc-name">'+this.txtTel+"</label>",'<label class="asc-about-desc">'+this.txtAscTelNum+"</label>","</td>","</tr>","<tr>",'<td colspan="3" align="center">','<a href="http://'+this.txtAscUrl+'" target="_blank">'+this.txtAscUrl+"</a>","</td>","</tr>","</table>",'<table id="id-about-licensee-info" cols="1" style="width: 100%; margin-top: 20px;" class="hidden margin-bottom"><tbody>',"<tr>",'<td align="center" class="padding-small"><div id="id-about-company-logo"/></td>',"</tr>","<tr>",'<td align="center"><label class="asc-about-version">'+e.appName.toUpperCase()+"</label></td>","</tr>","<tr>",'<td align="center"><label style="padding-bottom: 29px;" class="asc-about-version" id="id-about-licensee-version-name">'+this.txtVersion+this.txtVersionNum+"</label></td>","</tr>","<tr>",'<td align="center" class="padding-small">','<label class="asc-about-companyname" id="id-about-company-name"></label>',"</td>","</tr>","<tr>",'<td align="center" class="padding-small">','<label class="asc-about-desc-name">'+this.txtAddress+"</label>",'<label class="asc-about-desc" id="id-about-company-address"></label>',"</td>","</tr>","<tr>",'<td align="center" class="padding-small">','<label class="asc-about-desc-name">'+this.txtMail+"</label>",'<a href="mailto:" id="id-about-company-mail"></a>',"</td>","</tr>","<tr>",'<td align="center" class="padding-small">','<a href="" target="_blank" id="id-about-company-url"></a>',"</td>","</tr>","<tr>",'<td align="center">','<label class="asc-about-lic" id="id-about-company-lic"></label>',"</td>","</tr>","</table>",'<table id="id-about-licensor-short" cols="1" style="width: 100%; margin-top: 31px;" class="hidden"><tbody>',"<tr>",'<td style="width:50%;"><div class="separator horizontal short left"/></td>','<td align="center"><label class="asc-about-header">'+this.txtPoweredBy+"</label></td>",'<td style="width:50%;"><div class="separator horizontal short"/></td>',"</tr>","<tr>",'<td colspan="3" align="center" style="padding: 9px 0 10px;"><label class="asc-about-companyname">'+this.txtAscName+"</label></td>","</tr>","<tr>",'<td colspan="3" align="center">','<label class="asc-about-desc">'+this.txtAscUrl+"</label>","</td>","</tr>","</table>"].join("")),this.menu=e.menu},render:function(){var e=$(this.el);return e.html(this.template({scope:this})),e.addClass("about-dlg"),this.cntLicenseeInfo=$("#id-about-licensee-info"),this.cntLicensorInfo=$("#id-about-licensor-info"),this.divCompanyLogo=$("#id-about-company-logo"),this.lblCompanyName=$("#id-about-company-name"),this.lblCompanyAddress=$("#id-about-company-address"),this.lblCompanyMail=$("#id-about-company-mail"),this.lblCompanyUrl=$("#id-about-company-url"),this.lblCompanyLic=$("#id-about-company-lic"),_.isUndefined(this.scroller)&&(this.scroller=new Common.UI.Scroller({el:$(this.el),suppressScrollX:!0})),this},setLicInfo:function(e){if(e&&typeof e=="object"&&typeof e.customer=="object"){var t=e.customer;$("#id-about-licensor-logo").addClass("hidden"),$("#id-about-licensor-short").removeClass("hidden"),this.cntLicensorInfo.addClass("hidden"),this.cntLicenseeInfo.removeClass("hidden"),this.cntLicensorInfo.removeClass("margin-bottom");var n=t.name;n&&n.length?this.lblCompanyName.text(n):this.lblCompanyName.parents("tr").addClass("hidden"),n=t.address,n&&n.length?this.lblCompanyAddress.text(n):this.lblCompanyAddress.parents("tr").addClass("hidden"),(n=t.mail)&&n.length?this.lblCompanyMail.attr("href","mailto:"+n).text(n):this.lblCompanyMail.parents("tr").addClass("hidden");if((n=t.www)&&n.length){var r=/^https?:\/{2}/i.test(n)?"":"http://";this.lblCompanyUrl.attr("href",r+n).text(n)}else this.lblCompanyUrl.parents("tr").addClass("hidden");(n=t.info)&&n.length?this.lblCompanyLic.text(n):this.lblCompanyLic.parents("tr").addClass("hidden"),(n=t.logo)&&n.length?this.divCompanyLogo.html('<img src="'+n+'" style="max-width:216px; max-height: 35px;" />'):this.divCompanyLogo.parents("tr").addClass("hidden")}else this.cntLicenseeInfo.addClass("hidden"),this.cntLicensorInfo.addClass("margin-bottom")},show:function(){Common.UI.BaseView.prototype.show.call(this,arguments),this.fireEvent("show",this)},hide:function(){Common.UI.BaseView.prototype.hide.call(this,arguments),this.fireEvent("hide",this)},setMode:function(e){e.isLightVersion&&($("#id-about-licensor-version-name").text(this.txtEdition+this.txtVersion+this.txtVersionNum),$("#id-about-licensee-version-name").text(this.txtEdition+this.txtVersion+this.txtVersionNum))},txtPoweredBy:"Powered by",txtVersion:"Version ",txtLicensor:"LICENSOR",txtLicensee:"LICENSEE",txtAddress:"address: ",txtAscAddress:"Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021",txtMail:"email: ",txtTel:"tel.: ",txtEdition:"Integration Edition "},Common.Views.About||{}))}),define("text!common/main/lib/template/Comments.template",[],function(){return'<% if (!hide) { %>\r\n <div id="<%= id %>" class="user-comment-item">\r\n\r\n <!-- comment block -->\r\n\r\n <div class="user-name"><%=scope.getUserName(username)%></div>\r\n <div class="user-date"><%=date%></div>\r\n <% if (quote!==null) { %>\r\n <div class="user-quote"><%=scope.getFixedQuote(quote)%></div>\r\n <% } %>\r\n <% if (!editText) { %>\r\n <div class="user-message" data-can-copy="true"><%=scope.pickLink(comment)%></div>\r\n <% } else { %>\r\n <div class="inner-edit-ct">\r\n <textarea class="msg-reply user-select" maxlength="maxCommLength"><%=comment%></textarea>\r\n <button class="btn normal dlg-btn primary btn-inner-edit" id="id-comments-change">textEdit</button>\r\n <button class="btn normal dlg-btn btn-inner-close">textCancel</button>\r\n </div>\r\n <% } %>\r\n\r\n <!-- replys elements -->\r\n\r\n <% if (replys.length) { %>\r\n <div class="reply-arrow img-commonctrl"></div>\r\n <% _.each(replys, function (item) { %>\r\n <div class="reply-item-ct">\r\n <div class="user-name"><%=scope.getUserName(item.get("username"))%></div>\r\n <div class="user-date"><%=item.get("date")%></div>\r\n <% if (!item.get("editText")) { %>\r\n <div class="user-message" data-can-copy="true"><%=scope.pickLink(item.get("reply"))%></div>\r\n <div class="btns-reply-ct">\r\n <% if (item.get("editable")) { %>\r\n <div class="btn-edit img-commonctrl" data-value="<%=item.get("id")%>"></div>\r\n <% } %>\r\n <div class="btn-delete img-commonctrl" data-value="<%=item.get("id")%>"></div>\r\n </div>\r\n <% } else { %>\r\n <div class="inner-edit-ct">\r\n <textarea class="msg-reply textarea-fix user-select" maxlength="maxCommLength"><%=item.get("reply")%></textarea>\r\n <button class="btn normal dlg-btn primary btn-inner-edit btn-fix" id="id-comments-change">textEdit</button>\r\n <button class="btn normal dlg-btn btn-inner-close">textClose</button>\r\n </div>\r\n <% } %>\r\n </div>\r\n <% }); %>\r\n <% } %>\r\n\r\n <!-- add reply button -->\r\n\r\n <% if (!showReply) { %>\r\n <% if (replys.length) { %>\r\n <label class="user-reply" style="margin-left: 20px; margin-top: 5px;" role="presentation" tabindex="-1">textAddReply</label>\r\n <% } else { %>\r\n <label class="user-reply" role="presentation" tabindex="-1">textAddReply</label>\r\n <% } %>\r\n <% } %>\r\n\r\n <!-- edit buttons -->\r\n\r\n <% if (!editText && !lock) { %>\r\n <div class="edit-ct">\r\n <% if (editable) { %>\r\n <div class="btn-edit img-commonctrl"></div>\r\n <% } %>\r\n <div class="btn-delete img-commonctrl"></div>\r\n <% if (resolved) { %>\r\n <div class="btn-resolve-check img-commonctrl" data-toggle="tooltip"></div>\r\n <% } else { %>\r\n <div class="btn-resolve img-commonctrl" data-toggle="tooltip"></div>\r\n <% } %>\r\n </div>\r\n <% } %>\r\n\r\n <!-- reply -->\r\n\r\n <% if (showReply) { %>\r\n <div class="reply-ct">\r\n <textarea class="msg-reply user-select" placeholder="textAddReply" maxlength="maxCommLength"></textarea>\r\n <button class="btn normal dlg-btn primary btn-reply" id="id-comments-change">textReply</button>\r\n <button class="btn normal dlg-btn btn-close">textClose</button>\r\n </div>\r\n <% } %>\r\n <% if (lock) { %>\r\n <div class="lock-area"></div>\r\n <div class="lock-author"><%=lockuserid%></div>\r\n <% } %>\r\n <% if (!last) { %>\r\n <div class="separator-cmt"></div>\r\n <% } %>\r\n </div>\r\n<% } %>\r\n'}),define("text!common/main/lib/template/CommentsPanel.template",[],function(){return'<div id="comments-box" class="layout-ct vbox">\r\n <div class="layout-item messages-ct"/>\r\n <div class="layout-item add-link-ct">\r\n <label class="btn new"><%=textAddCommentToDoc%></label>\r\n </div>\r\n <div style="display: none;" class="layout-item new-comment-ct">\r\n <div class="inner-ct">\r\n <textarea id="comment-msg-new" class="user-select" placeholder="<%=textEnterCommentHint%>" maxlength="<%=maxCommLength%>"/>\r\n </div>\r\n <button class="btn add normal dlg-btn primary"><%=textAddComment%></button>\r\n <button class="btn cancel normal dlg-btn"><%=textCancel%></button>\r\n </div>\r\n</div>\r\n'}),define("text!common/main/lib/template/CommentsPopover.template",[],function(){return'<div id="<%=id%>" class="user-comment-item">\r\n\r\n <!-- comment block -->\r\n\r\n <div class="user-name"><%=scope.getUserName(username)%></div>\r\n <div class="user-date"><%=date%></div>\r\n <% if (!editTextInPopover || hint) { %>\r\n <div class="user-message"><%=scope.pickLink(comment)%></div>\r\n <% } else { %>\r\n <div class="inner-edit-ct">\r\n <textarea class="msg-reply user-select" maxlength="maxCommLength"><%=comment%></textarea>\r\n <% if (hideAddReply) { %>\r\n <button class="btn normal dlg-btn primary btn-inner-edit" id="id-comments-change-popover">textAdd</button>\r\n <% } else { %>\r\n <button class="btn normal dlg-btn primary btn-inner-edit" id="id-comments-change-popover">textEdit</button>\r\n <% } %>\r\n <button class="btn normal dlg-btn btn-inner-close">textCancel</button>\r\n </div>\r\n <% } %>\r\n\r\n <!-- replys elements -->\r\n\r\n <% if (replys.length) { %>\r\n <div class="reply-arrow img-commonctrl"></div>\r\n <% _.each(replys, function (item) { %>\r\n <div class="reply-item-ct">\r\n <div class="user-name"><%=scope.getUserName(item.get("username"))%></div>\r\n <div class="user-date"><%=item.get("date")%></div>\r\n <% if (!item.get("editTextInPopover")) { %>\r\n <div class="user-message"><%=scope.pickLink(item.get("reply"))%></div>\r\n <% if (!hint) { %>\r\n <div class="btns-reply-ct">\r\n <% if (item.get("editable")) { %>\r\n <div class="btn-edit img-commonctrl" data-value="<%=item.get("id")%>"></div>\r\n <%}%>\r\n <div class="btn-delete img-commonctrl" data-value="<%=item.get("id")%>"></div>\r\n </div>\r\n <%}%>\r\n <% } else { %>\r\n <div class="inner-edit-ct">\r\n <textarea class="msg-reply textarea-fix user-select" maxlength="maxCommLength"><%=item.get("reply")%></textarea>\r\n <button class="btn normal dlg-btn primary btn-inner-edit btn-fix" id="id-comments-change-popover">textEdit</button>\r\n <button class="btn normal dlg-btn btn-inner-close">textClose</button>\r\n </div>\r\n <% } %>\r\n </div>\r\n <% }); %>\r\n\r\n <% } %>\r\n\r\n <!-- add reply button -->\r\n\r\n <% if (!showReplyInPopover && !hideAddReply && !hint) { %>\r\n <% if (replys.length) { %>\r\n <label class="user-reply" style="margin-left: 20px; margin-top: 5px;" role="presentation" tabindex="-1">textAddReply</label>\r\n <% } else { %>\r\n <label class="user-reply" role="presentation" tabindex="-1">textAddReply</label>\r\n <% } %>\r\n <% } %>\r\n\r\n <!-- edit buttons -->\r\n\r\n <% if (!editTextInPopover && !lock && !hint) { %>\r\n <div class="edit-ct">\r\n <% if (editable) { %>\r\n <div class="btn-edit img-commonctrl"></div>\r\n <% } %>\r\n <div class="btn-delete img-commonctrl"></div>\r\n <% if (resolved) { %>\r\n <div class="btn-resolve-check img-commonctrl" data-toggle="tooltip"></div>\r\n <% } else { %>\r\n <div class="btn-resolve img-commonctrl" data-toggle="tooltip"></div>\r\n <% } %>\r\n </div>\r\n <% } %>\r\n\r\n <!-- reply -->\r\n\r\n <% if (showReplyInPopover) { %>\r\n <div class="reply-ct">\r\n <textarea class="msg-reply user-select" placeholder="textAddReply" maxlength="maxCommLength"></textarea>\r\n <button class="btn normal dlg-btn primary btn-reply" id="id-comments-change-popover">textReply</button>\r\n <button class="btn normal dlg-btn btn-close">textClose</button>\r\n </div>\r\n <% } %>\r\n\r\n <!-- locked user -->\r\n\r\n <% if (lock) { %>\r\n <div class="lock-area" style="cursor: default;"></div>\r\n <div class="lock-author" style="cursor: default;"><%=lockuserid%></div>\r\n <% } %>\r\n\r\n</div>'});if(Common===undefined)var Common={};Common.Views=Common.Views||{},define("common/main/lib/view/Comments",["text!common/main/lib/template/Comments.template","text!common/main/lib/template/CommentsPanel.template","text!common/main/lib/template/CommentsPopover.template","common/main/lib/util/utils","common/main/lib/component/Button","common/main/lib/component/ComboBox","common/main/lib/component/DataView","common/main/lib/component/Layout","common/main/lib/component/Window"],function(e,t,n){"use strict";function r(e,t){var n,r,i=e;for(n in t)undefined!==n&&(r=t[n],i=i.replace(new RegExp(n,"g"),r));return i}Common.Views.CommentsPopover=Common.UI.Window.extend({initialize:function(e){var t={};_.extend(t,{closable:!1,width:265,height:120,header:!1,modal:!1},e),this.template=e.template||['<div class="box">','<div id="id-comments-popover" class="comments-popover"></div>','<div id="id-comments-arrow" class="comments-arrow"></div>',"</div>"].join(""),this.store=e.store,this.delegate=e.delegate,t.tpl=_.template(this.template,t),this.arrow={margin:20,width:12,height:34},this.sdkBounds={width:0,height:0,padding:10,paddingTop:20},Common.UI.Window.prototype.initialize.call(this,t)},render:function(){Common.UI.Window.prototype.render.call(this);var e=this,t=this.delegate,i=this.$window;i.css({height:"",minHeight:"",overflow:"hidden",position:"absolute",zIndex:"990"});var s=i.find(".body");s&&s.css("position","relative"),i.on("click",_.bind(function(){i.css({zIndex:"991"}),Common.NotificationCenter.trigger("comments:click")},this)),Common.NotificationCenter.on("review:click",function(){i.css({zIndex:"990"})});var o=Common.UI.DataView.extend(function(){var t=e;return{options:{handleSelect:!1,scrollable:!0,template:_.template('<div class="dataview-ct inner" style="overflow-y: hidden;"></div>')},getTextBox:function(){var e=$(this.el).find("textarea");return e&&e.length?e:undefined},setFocusToTextBox:function(e){var t=$(this.el).find("textarea");if(e)t.blur();else if(t&&t.length){var n=t.val();t.focus(),t.val(""),t.val(n)}},getActiveTextBoxVal:function(){var e=$(this.el).find("textarea");return e&&e.length?e.val().trim():""},autoHeightTextBox:function(){function l(){u=$(n.scroller.el).scrollTop(),i.scrollHeight>i.clientHeight?(r.css({height:i.scrollHeight+o+"px"}),t.calculateSizeOfContent()):(a=i.clientHeight,a>=s&&(r.css({height:s+"px"}),i.scrollHeight>i.clientHeight&&(f=Math.max(i.scrollHeight+o,s),r.css({height:f+"px"})),t.calculateSizeOfContent(),t.setLeftTop(e.arrowPosX,e.arrowPosY,e.leftX),t.calculateSizeOfContent())),n.scroller.scrollTop(u),n.autoScrollToEditButtons()}var n=this,r=this.$el.find("textarea"),i=null,s=50,o=0,u=0,a=0,f=0;r&&r.length&&(i=r.get(0),i&&(o=parseInt(r.css("lineHeight"),10)*.25,l(),r.bind("input propertychange",l))),this.textBox=r},clearTextBoxBind:function(){this.textBox&&(this.textBox.unbind("input propertychange"),this.textBox=undefined)},autoScrollToEditButtons:function(){var e=$("#id-comments-change-popover"),t=null,n=this.el.getBoundingClientRect(),r=0,i=7;e.length&&(t=e.get(0).getBoundingClientRect(),t&&n&&(r=n.bottom-(t.bottom+i),r<0&&this.scroller.scrollTop(this.scroller.getScrollTop()-r)))}}}());if(o)if(this.commentsView)this.commentsView.render($("#id-comments-popover")),this.commentsView.onResetItems();else{this.commentsView=new o({el:$("#id-comments-popover"),store:e.store,itemTemplate:_.template(r(n,{textAddReply:t.textAddReply,textAdd:t.textAdd,textCancel:t.textCancel,textEdit:t.textEdit,textReply:t.textReply,textClose:t.textClose,maxCommLength:Asc.c_oAscMaxCellOrCommentLength}))});var u=function(e,n,r){n.tipsArray&&n.tipsArray.forEach(function(e){e.remove()});var i=[],s=$(n.el).find(".btn-resolve");s.tooltip({title:t.textResolve,placement:"cursor"}),s.each(function(e,t){i.push($(t).data("bs.tooltip").tip())}),s=$(n.el).find(".btn-resolve-check"),s.tooltip({title:t.textOpenAgain,placement:"cursor"}),s.each(function(e,t){i.push($(t).data("bs.tooltip").tip())}),n.tipsArray=i},a=function(){e._isMouseOver=!0},f=function(){e._isMouseOver=!1};this.commentsView.on("item:add",u),this.commentsView.on("item:remove",u),this.commentsView.on("item:change",u),this.commentsView.cmpEl.on("mouseover",a).on("mouseout",f),this.commentsView.on("item:click",function(n,r,i,s){function h(){e.update()}var o,u,a,f,l,c;o=$(s.target);if(o){u=i.get("editTextInPopover"),a=i.get("showReplyInPopover"),c=i.get("hideAddReply"),f=i.get("uid"),l=o.attr("data-value");if(i.get("hint")){t.fireEvent("comment:disableHint",[i]);return}if(o.hasClass("btn-edit"))_.isUndefined(l)?u||(t.fireEvent("comment:closeEditing"),i.set("editTextInPopover",!0),t.fireEvent("comment:show",[f]),this.autoHeightTextBox(),e.calculateSizeOfContent(),e.setLeftTop(e.arrowPosX,e.arrowPosY,e.leftX),e.calculateSizeOfContent(),h(),e.hookTextBox(),this.autoScrollToEditButtons(),this.setFocusToTextBox()):(t.fireEvent("comment:closeEditing",[f]),t.fireEvent("comment:editReply",[f,l,!0]),this.replyId=l,this.autoHeightTextBox(),e.calculateSizeOfContent(),e.setLeftTop(e.arrowPosX,e.arrowPosY,e.leftX),e.calculateSizeOfContent(),h(),e.hookTextBox(),this.autoScrollToEditButtons(),this.setFocusToTextBox());else if(o.hasClass("btn-delete"))_.isUndefined(l)?t.fireEvent("comment:remove",[f]):(t.fireEvent("comment:removeReply",[f,l]),e.calculateSizeOfContent(),e.setLeftTop(e.arrowPosX,e.arrowPosY,e.leftX),e.calculateSizeOfContent()),t.fireEvent("comment:closeEditing"),h();else if(o.hasClass("user-reply"))t.fireEvent("comment:closeEditing"),i.set("showReplyInPopover",!0),e.calculateSizeOfContent(),e.setLeftTop(e.arrowPosX,e.arrowPosY,e.leftX),e.calculateSizeOfContent(),h(),this.autoHeightTextBox(),e.hookTextBox(),this.autoScrollToEditButtons(),this.setFocusToTextBox();else if(o.hasClass("btn-reply",!1))a&&(this.clearTextBoxBind(),t.fireEvent("comment:addReply",[f,this.getActiveTextBoxVal()]),t.fireEvent("comment:closeEditing"),h());else if(o.hasClass("btn-close",!1))t.fireEvent("comment:closeEditing",[f]),e.calculateSizeOfContent(),t.fireEvent("comment:show",[f]),h();else if(o.hasClass("btn-inner-edit",!1)){if(i.get("dummy")){t.fireEvent("comment:addDummyComment",[this.getActiveTextBoxVal()]);return}this.clearTextBoxBind(),_.isUndefined(this.replyId)?u&&(t.fireEvent("comment:change",[f,this.getActiveTextBoxVal()]),t.fireEvent("comment:closeEditing"),e.calculateSizeOfContent()):(t.fireEvent("comment:changeReply",[f,this.replyId,this.getActiveTextBoxVal()]),this.replyId=undefined,t.fireEvent("comment:closeEditing")),h()}else if(o.hasClass("btn-inner-close",!1)){if(i.get("dummy")){e.hide();return}c&&this.getActiveTextBoxVal().length>0?(e.saveText(),i.set("hideAddReply",!1),this.getTextBox().val(e.textVal),this.autoHeightTextBox()):(this.clearTextBoxBind(),t.fireEvent("comment:closeEditing",[f])),this.replyId=undefined,e.calculateSizeOfContent(),e.setLeftTop(e.arrowPosX,e.arrowPosY,e.leftX),e.calculateSizeOfContent(),h()}else if(o.hasClass("btn-resolve",!1)){var p=o.data("bs.tooltip");p&&(p.dontShow=!0),t.fireEvent("comment:resolve",[f]),h()}else if(o.hasClass("btn-resolve-check",!1)){var p=o.data("bs.tooltip");p&&(p.dontShow=!0),t.fireEvent("comment:resolve",[f]),h()}}}),e.on({show:function(){e.commentsView.autoHeightTextBox(),e.$window.find("textarea").keydown(function(t){t.keyCode==Common.UI.Keys.ESC&&e.hide()})},"animate:before":function(){var t=e.$window.find("textarea");t&&t.length&&t.focus()}})}},show:function(e,t,n,r){this.options.animate=e;var i=this,s=this.commentsView.getTextBox();t&&this.textVal&&s&&s.val(this.textVal),r&&r.length&&s&&s.val(r),Common.UI.Window.prototype.show.call(this),this.commentsView.scroller&&this.commentsView.scroller.update({minScrollbarLength:40,alwaysVisibleY:!0}),this.hookTextBox()},hide:function(){this.handlerHide&&this.handlerHide(),Common.UI.Window.prototype.hide.call(this),!_.isUndefined(this.e)&&this.e.keyCode==Common.UI.Keys.ESC&&(this.e.preventDefault(),this.e.stopImmediatePropagation(),this.e=undefined)},update:function(){this.commentsView&&this.commentsView.scroller&&this.commentsView.scroller.update({minScrollbarLength:40,alwaysVisibleY:!0})},isVisible:function(){return this.$window&&this.$window.is(":visible")},setLeftTop:function(e,t,n,r,i){this.$window||this.render(),r&&(e=this.arrowPosX,t=this.arrowPosY,n=this.leftX);if(_.isUndefined(e)&&_.isUndefined(t))return;this.arrowPosX=e,this.arrowPosY=t,this.leftX=n;var s=$("#id-comments-popover"),o=$("#id-comments-arrow"),u=$("#editor_sdk"),a=null,f=0,l=0,c=0,h="",p=0,d="",v=0,m="",g=0,y="",b=0,w=0,E=0,S=0,x=0,T=0;s&&o&&u&&u.get(0)&&(a=u.get(0).getBoundingClientRect(),a&&(f=a.height-this.sdkBounds.padding*2,this.$window.css({maxHeight:f+"px"}),this.sdkBounds.width=a.width,this.sdkBounds.height=a.height,_.isUndefined(e)||(h=$("#id_vertical_scroll"),h.length?p=h.css("display")!=="none"?h.width():0:(h=$("#ws-v-scrollbar"),h.length&&(p=h.css("display")!=="none"?h.width():0)),this.sdkBounds.width-=p,d=$("#id_panel_left"),d.length&&(v=d.css("display")!=="none"?d.width():0),m=$("#id_panel_thumbnails"),m.length&&(g=m.css("display")!=="none"?m.width():0,this.sdkBounds.width-=g),w=Math.min(c+e+this.arrow.width,c+this.sdkBounds.width-this.$window.outerWidth()-25),w=Math.max(c+v+this.arrow.width,w),o.removeClass("right").addClass("left"),_.isUndefined(n)||(E=this.$window.outerWidth(),E&&(e+E>this.sdkBounds.width-this.arrow.width+5&&this.leftX>E?(w=this.leftX-E+c-this.arrow.width,o.removeClass("left").addClass("right")):w=c+e+this.arrow.width)),this.$window.css("left",w+"px")),_.isUndefined(t)||(y=$("#id_panel_top"),T=l,y.length?(b=y.css("display")!=="none"?y.height():0,T+=this.sdkBounds.paddingTop):(y=$("#ws-h-scrollbar"),y.length&&(b=y.css("display")!=="none"?y.height():0)),this.sdkBounds.height-=b,S=this.$window.outerHeight(),x=Math.min(l+f-S,this.arrowPosY+l-this.arrow.height),x=Math.max(x,T),this.$window.css("top",x+"px")))),i||this.calculateSizeOfContent()},calculateSizeOfContent:function(e){if(e&&!this.$window.is(":visible"))return;this.$window.css({overflow:"hidden"});var t=$("#id-comments-arrow"),n=$("#id-comments-popover"),r=null,i=null,s=null,o=0,u=0,a=0,f="",l=0,c=0,h=0,p=0,d=0,v=0;n&&t&&n.get(0)&&(n.css({height:"100%"}),r=n.get(0).getBoundingClientRect(),r&&(i=$("#editor_sdk"),i&&i.get(0)&&(s=i.get(0).getBoundingClientRect(),s&&(o=s.height-this.sdkBounds.padding*2,v=u,h=this.$window.outerHeight(),f=$("#id_panel_top"),f.length?(l=f.css("display")!=="none"?f.height():0,v+=this.sdkBounds.paddingTop):(f=$("#ws-h-scrollbar"),f.length&&(l=f.css("display")!=="none"?f.height():0)),p=Math.max(n.outerHeight(),this.$window.outerHeight()),o<=p?(this.$window.css({maxHeight:o-l+"px",top:u+l+"px"}),n.css({height:o-l-3+"px"}),c=Math.min(c,o-(l+this.arrow.margin+this.arrow.width)),t.css({top:c+"px"})):(p=h,p>0&&(r.top+p>o+u||r.height===0)&&(d=Math.min(u+o-p,this.arrowPosY+u-this.arrow.height),d=Math.max(d,v),this.$window.css({top:d+"px"})),c=Math.max(this.arrow.margin,this.arrowPosY-(o-p)-this.arrow.width),c=Math.min(c,p-this.arrow.margin-this.arrow.width),t.css({top:c+"px"})))))),this.$window.css({overflow:""})},saveText:function(e){this.commentsView&&this.commentsView.cmpEl.find(".lock-area").length<1&&(this.textVal=undefined,e?this.commentsView.clearTextBoxBind():this.textVal=this.commentsView.getActiveTextBoxVal())},loadText:function(){this.textVal&&this.commentsView&&this.commentsView.getTextBox().val(this.textVal)},getEditText:function(){return this.commentsView?this.commentsView.getActiveTextBoxVal():undefined},hookTextBox:function(){var e=this,t=this.commentsView.getTextBox();t&&t.keydown(function(t){if((t.ctrlKey||t.metaKey)&&!t.altKey&&t.keyCode===Common.UI.Keys.RETURN){var n=$("#id-comments-change-popover");n&&n.length&&n.click(),t.stopImmediatePropagation()}else if(t.keyCode===Common.UI.Keys.TAB){var r,i,s;s=this.selectionStart,i=this.selectionEnd,r=$(this),r.val(r.val().substring(0,s)+" "+r.val().substring(i)),this.selectionStart=this.selectionEnd=s+1,t.stopImmediatePropagation(),t.preventDefault()}e.e=t})},hideTips:function(){this.commentsView&&_.each(this.commentsView.dataViewItems,function(e){e.tipsArray&&e.tipsArray.forEach(function(e){e.hide()})},this)},isCommentsViewMouseOver:function(){return this._isMouseOver}}),Common.Views.Comments=Common.UI.BaseView.extend(_.extend({el:"#left-panel-comments",template:_.template(t),addCommentHeight:45,newCommentHeight:110,textBoxAutoSizeLocked:undefined,initialize:function(e){Common.UI.BaseView.prototype.initialize.call(this,e),this.store=this.options.store,this.popoverComments=this.options.popoverComments},render:function(){var t=this;this.$el.html(this.template({textAddCommentToDoc:t.textAddCommentToDoc,textAddComment:t.textAddComment,textCancel:t.textCancel,textEnterCommentHint:t.textEnterCommentHint,maxCommLength:Asc.c_oAscMaxCellOrCommentLength})),this.buttonAddCommentToDoc=new Common.UI.Button({el:$(".btn.new",this.$el),enableToggle:!1}),this.buttonAdd=new Common.UI.Button({action:"add",el:$(".btn.add",this.$el),enableToggle:!1}),this.buttonCancel=new Common.UI.Button({el:$(".btn.cancel",this.$el),enableToggle:!1}),this.buttonAddCommentToDoc.on("click",_.bind(this.onClickShowBoxDocumentComment,this)),this.buttonAdd.on("click",_.bind(this.onClickAddDocumentComment,this)),this.buttonCancel.on("click",_.bind(this.onClickCancelDocumentComment,this)),this.txtComment=$("#comment-msg-new",this.el),this.txtComment.keydown(function(e){if((e.ctrlKey||e.metaKey)&&!e.altKey&&e.keyCode==Common.UI.Keys.RETURN)t.onClickAddDocumentComment(),e.stopImmediatePropagation();else if(e.keyCode===Common.UI.Keys.TAB){var n,r,i;i=this.selectionStart,r=this.selectionEnd,n=$(this),n.val(n.val().substring(0,i)+" "+n.val().substring(r)),this.selectionStart=this.selectionEnd=i+1,e.stopImmediatePropagation(),e.preventDefault()}});var n=Common.UI.DataView.extend(function(){var e=t;return{options:{handleSelect:!1,scrollable:!0,listenStoreEvents:!1,template:_.template('<div class="dataview-ct inner"></div>')},getTextBox:function(){var e=$(this.el).find("textarea");return e&&e.length?e:undefined},setFocusToTextBox:function(){var e=$(this.el).find("textarea");if(e&&e.length){var t=e.val();e.focus(),e.val(""),e.val(t)}},getActiveTextBoxVal:function(){var e=$(this.el).find("textarea");return e&&e.length?e.val().trim():""},autoHeightTextBox:function(){function a(){n.scrollHeight>n.clientHeight?t.css({height:n.scrollHeight+i+"px"}):(o=n.clientHeight,o>=r&&(t.css({height:r+"px"}),n.scrollHeight>n.clientHeight&&(u=Math.max(n.scrollHeight+i,r),t.css({height:u+"px"})))),e.autoScrollToEditButtons()}var e=this,t=$(this.el).find("textarea"),n=null,r=50,i=0,s=0,o=0,u=0;t&&t.length&&(n=t.get(0),n&&(i=parseInt(t.css("lineHeight"),10)*.25,a(),t.bind("input propertychange",a))),this.textBox=t},clearTextBoxBind:function(){this.textBox&&(this.textBox.unbind("input propertychange"),this.textBox=undefined)},autoScrollToEditButtons:function(){var e=$("#id-comments-change"),t=null,n=this.el.getBoundingClientRect(),r=0,i=7;e.length&&(t=e.get(0).getBoundingClientRect(),t&&n&&(r=n.bottom-(t.bottom+i),r<0&&this.scroller.scrollTop(this.scroller.getScrollTop()-r)))}}}());if(n)if(this.commentsView)this.commentsView.render($(".messages-ct",t.el)),this.commentsView.onResetItems();else{this.commentsView=new n({el:$(".messages-ct",t.el),store:t.store,itemTemplate:_.template(r(e,{textAddReply:t.textAddReply,textAdd:t.textAdd,textCancel:t.textCancel,textEdit:t.textEdit,textReply:t.textReply,textClose:t.textClose,maxCommLength:Asc.c_oAscMaxCellOrCommentLength}))});var i=function(e,n,r){n.tipsArray&&n.tipsArray.forEach(function(e){e.remove()});var i=[],s=$(n.el).find(".btn-resolve");s.tooltip({title:t.textResolve,placement:"cursor"}),s.each(function(e,t){i.push($(t).data("bs.tooltip").tip())}),s=$(n.el).find(".btn-resolve-check"),s.tooltip({title:t.textOpenAgain,placement:"cursor"}),s.each(function(e,t){i.push($(t).data("bs.tooltip").tip())}),n.tipsArray=i};this.commentsView.on("item:add",i),this.commentsView.on("item:remove",i),this.commentsView.on("item:change",i),this.commentsView.on("item:click",function(e,n,r,i){function c(){t.update()}var s,o,u,a,f,l;s=$(i.target);if(s){o=r.get("editText"),u=r.get("showReply"),a=r.get("uid"),f=s.attr("data-value");if(s.hasClass("btn-edit"))_.isUndefined(f)?o||(t.fireEvent("comment:closeEditing"),r.set("editText",!0),this.autoHeightTextBox(),c(),this.setFocusToTextBox(),t.hookTextBox()):(t.fireEvent("comment:closeEditing",[a]),t.fireEvent("comment:editReply",[a,f]),t.commentsView.reply=f,this.autoHeightTextBox(),c(),t.hookTextBox(),this.autoScrollToEditButtons(),this.setFocusToTextBox());else if(s.hasClass("btn-delete"))_.isUndefined(f)?t.fireEvent("comment:remove",[a]):t.fireEvent("comment:removeReply",[a,f]),t.fireEvent("comment:closeEditing"),c();else if(s.hasClass("user-reply"))t.fireEvent("comment:closeEditing"),r.set("showReply",!0),c(),this.autoHeightTextBox(),t.hookTextBox(),this.autoScrollToEditButtons(),this.setFocusToTextBox();else if(s.hasClass("btn-reply",!1))u&&(t.fireEvent("comment:addReply",[a,this.getActiveTextBoxVal()]),t.fireEvent("comment:closeEditing"),c());else if(s.hasClass("btn-close",!1))t.fireEvent("comment:closeEditing",[a]);else if(s.hasClass("btn-inner-edit",!1))_.isUndefined(t.commentsView.reply)?o&&t.fireEvent("comment:change",[a,this.getActiveTextBoxVal()]):(t.fireEvent("comment:changeReply",[a,t.commentsView.reply,this.getActiveTextBoxVal()]),t.commentsView.reply=undefined),t.fireEvent("comment:closeEditing"),c();else if(s.hasClass("btn-inner-close",!1))t.fireEvent("comment:closeEditing"),t.commentsView.reply=undefined,c();else if(s.hasClass("btn-resolve",!1)){var h=s.data("bs.tooltip");h&&(h.dontShow=!0),t.fireEvent("comment:resolve",[a]),c()}else if(s.hasClass("btn-resolve-check",!1)){var h=s.data("bs.tooltip");h&&(h.dontShow=!0),t.fireEvent("comment:resolve",[a]),c()}else!s.hasClass("msg-reply")&&!s.hasClass("btn-resolve-check")&&!s.hasClass("btn-resolve")&&t.fireEvent("comment:show",[a,!1])}})}return this.setupLayout(),this.update(),this},update:function(){this.updateLayout(),this.updateScrolls()},updateScrolls:function(){this.commentsView&&this.commentsView.scroller&&this.commentsView.scroller.update({minScrollbarLength:40,alwaysVisibleY:!0})},getPopover:function(e){return _.isUndefined(this.popover)&&(this.popover=new Common.Views.CommentsPopover({store:this.popoverComments,delegate:this,renderTo:e})),this.popover},showEditContainer:function(e){var t=$(".add-link-ct",this.el),n=$(".new-comment-ct",this.el),r=$(".messages-ct",this.el),i=$("#comments-box",this.el);this.layout.freezePanels(!e),e?(t.css({display:"none"}),n.css({display:"table-row"}),this.txtComment.val(""),this.txtComment.focus(),this.textBoxAutoSizeLocked=undefined):(t.css({display:"table-row"}),n.css({display:"none"})),this.updateLayout(),this.updateScrolls()},onClickShowBoxDocumentComment:function(){this.fireEvent("comment:closeEditing"),this.showEditContainer(!0)},onClickAddDocumentComment:function(){this.fireEvent("comment:add",[this,this.txtComment.val().trim(),undefined,!1,!0]),this.txtComment.val("")},onClickCancelDocumentComment:function(){this.showEditContainer(!1)},hookTextBox:function(){var e=this,t=this.commentsView.getTextBox();t&&t.keydown(function(e){if((e.ctrlKey||e.metaKey)&&!e.altKey&&e.keyCode==Common.UI.Keys.RETURN){var t=$("#id-comments-change");t&&t.length&&t.click(),e.stopImmediatePropagation()}else if(e.keyCode===Common.UI.Keys.TAB){var n,r,i;i=this.selectionStart,r=this.selectionEnd,n=$(this),n.val(n.val().substring(0,i)+" "+n.val().substring(r)),this.selectionStart=this.selectionEnd=i+1,e.stopImmediatePropagation(),e.preventDefault()}})},setupLayout:function(){var e=this,t=$(e.el),n=$(".new-comment-ct",e.el),r=$(".add-link-ct",e.el),i=$("#comments-box",e.el),s=i.find(" > .layout-item");e.layout=new Common.UI.VBoxLayout({box:i,freeze:!0,items:[{el:s[0],rely:!0,resize:{hidden:!1,autohide:!1,fmin:function(){var t=i.height();return n.css("display")!=="none"&&t*.5<e.newCommentHeight?t-e.newCommentHeight:t*.5},fmax:function(){return n.css("display")!=="none"?i.height()-e.newCommentHeight:i.height()-e.addCommentHeight}}},{el:s[1],stretch:!0},{el:s[2],stretch:!0}]}),e.layout.on("layout:resizedrag",function(){e.updateScrolls(),e.textBoxAutoSizeLocked=!0},this),$(window).on("resize",function(){if(t.css("display")!=="none"){var n=$("#comments-box",e.el).height(),r=$(".new-comment-ct",e.el),i=$(".add-link-ct",e.el);r.css("display")!=="none"?e.layout.setResizeValue(0,Math.max(-e.newCommentHeight,Math.min(n-(r.height()+4),n-e.newCommentHeight))):e.layout.setResizeValue(0,Math.max(-e.addCommentHeight,Math.min(n-i.height(),n-e.addCommentHeight))),e.updateScrolls()}}),this.autoHeightTextBox()},updateLayout:function(){var e=$("#comments-box",this.el),t=$(".new-comment-ct",this.el);t.css("display")!=="none"?this.layout.setResizeValue(0,e.height()-this.newCommentHeight):this.layout.setResizeValue(0,e.height()-this.addCommentHeight)},autoHeightTextBox:function(){function s(){var t,i,s,o,u,a=48;t=$("#comment-msg-new",e.el),o=$("#comments-box",e.el).height();if(0==t.val().length){e.layout.setResizeValue(0,Math.max(-e.newCommentHeight,o-e.newCommentHeight)),e.textBoxAutoSizeLocked=undefined;return}if(!_.isUndefined(e.textBoxAutoSizeLocked))return;i=t.height(),s=t.get(0).scrollHeight,t.css({height:r+"px"}),i=t.height(),s=Math.max(t.get(0).scrollHeight+n,a),t.css({height:"100%"}),o=$("#comments-box",e.el).height(),e.layout.setResizeValue(0,Math.max(-e.newCommentHeight,Math.min(o-s-a,o-e.newCommentHeight)))}var e=this,t=null,n=0,r=44,i=$("#comment-msg-new",this.el);n=parseInt(i.css("lineHeight"),10)*.25,s(),i.bind("input propertychange",s),this.textBox=i},getFixedQuote:function(e){return Common.Utils.String.ellipsis(Common.Utils.String.htmlEncode(e),120,!0)},getUserName:function(e){return Common.Utils.String.ellipsis(Common.Utils.String.htmlEncode(e),22,!0)},pickLink:function(e){var t=[],n,r;e=Common.Utils.String.htmlEncode(e),e.replace(Common.Utils.ipStrongRe,function(e){return n=arguments[arguments.length-2],t.push({start:n,end:e.length+n,str:'<a href="'+e+'" target="_blank" data-can-copy="true">'+e+"</a>"}),""}),(e.length<1e3||e.search(/\S{255,}/)<0)&&e.replace(Common.Utils.hostnameStrongRe,function(e){var i=/(((^https?)|(^ftp)):\/\/)/i.test(e)?e:"http://"+e;n=arguments[arguments.length-2],r=e.length;var s=_.find(t,function(e){return n>=e.start&&n<e.end||n<=e.start&&n+r>e.start});return s||t.push({start:n,end:r+n,str:'<a href="'+i+'" target="_blank" data-can-copy="true">'+e+"</a>"}),""}),e.replace(Common.Utils.emailStrongRe,function(e){var i=/((^mailto:)\/\/)/i.test(e)?e:"mailto:"+e;n=arguments[arguments.length-2],r=e.length;var s=_.find(t,function(e){return n>=e.start&&n<e.end||n<=e.start&&n+r>e.start});return s||t.push({start:n,end:r+n,str:'<a href="'+i+'">'+e+"</a>"}),""}),t=_.sortBy(t,function(e){return e.start});var i=t.length>0?e.substring(0,t[0].start)+t[0].str:e;for(var s=1;s<t.length;s++)i+=e.substring(t[s-1].end,t[s].start)+t[s].str;return t.length>0&&(i+=e.substring(t[s-1].end,e.length)),i},textComments:"Comments",textAnonym:"Guest",textAddCommentToDoc:"Add Comment to Document",textAddComment:"Add Comment",textCancel:"Cancel",textAddReply:"Add Reply",textReply:"Reply",textClose:"Close",textResolved:"Resolved",textResolve:"Resolve",textEnterCommentHint:"Enter your comment here",textEdit:"Edit",textAdd:"Add",textOpenAgain:"Open Again"},Common.Views.Comments||{}))}),define("text!common/main/lib/template/Chat.template",[],function(){return'<div id="chat-box" class="layout-ct vbox">\r\n <div id="chat-users" class="layout-item area">\r\n <div id="chat-user-ct"></div>\r\n </div>\r\n <div id="chat-messages" class="layout-item area">\r\n <div id="chat-message-ct"></div>\r\n </div>\r\n <div id="chat-options" class="layout-item">\r\n <div id="chat-options-ct">\r\n <textarea id="chat-msg-text" class="user-select" maxlength="<%=maxMsgLength%>"></textarea>\r\n <button id="chat-msg-btn-add" class="btn normal dlg-btn primary"><%=scope.textSend%></button>\r\n </div>\r\n </div>\r\n</div>'});if(Common===undefined)var Common={};Common.Views=Common.Views||{},define("common/main/lib/view/Chat",["text!common/main/lib/template/Chat.template","common/main/lib/util/utils","common/main/lib/component/BaseView","common/main/lib/component/Layout"],function(e){"use strict";Common.Views.Chat=Common.UI.BaseView.extend(_.extend({el:"#left-panel-chat",template:_.template(e),storeUsers:undefined,storeMessages:undefined,tplUser:['<li id="chat-user-<%= user.get("id") %>"<% if (!user.get("online")) { %> class="offline"<% } %>>','<div class="color" style="background-color: <%= user.get("color") %>;" >','<label class="name"><%= scope.getUserName(user.get("username")) %></label>',"</div>","</li>"].join(""),templateUserList:_.template("<ul><% _.each(users, function(item) { %><%= _.template(usertpl, {user: item, scope: scope}) %><% }); %></ul>"),tplMsg:["<li>",'<% if (msg.get("type")==1) { %>','<div class="message service" data-can-copy="true"><%= msg.get("message") %></div>',"<% } else { %>",'<div class="user" data-can-copy="true" style="color: <%= msg.get("usercolor") %>;"><%= scope.getUserName(msg.get("username")) %></div>','<label class="message user-select" data-can-copy="true"><%= msg.get("message") %></label>',"<% } %>","</li>"].join(""),templateMsgList:_.template("<ul><% _.each(messages, function(item) { %><%= _.template(msgtpl, {msg: item, scope: scope}) %><% }); %></ul>"),events:{},usersBoxHeight:72,messageBoxHeight:70,addMessageBoxHeight:110,initialize:function(e){_.extend(this,e),Common.UI.BaseView.prototype.initialize.call(this,arguments),this.storeUsers.bind({add:_.bind(this._onAddUser,this),change:_.bind(this._onUsersChanged,this),reset:_.bind(this._onResetUsers,this)}),this.storeMessages.bind({add:_.bind(this._onAddMessage,this),reset:_.bind(this._onResetMessages,this)})},render:function(e){return e=e||this.el,$(e).html(this.template({scope:this,maxMsgLength:Asc.c_oAscMaxCellOrCommentLength})),this.panelBox=$("#chat-box",this.el),this.panelUsers=$("#chat-users",this.el),this.panelMessages=$("#chat-messages",this.el),this.txtMessage=$("#chat-msg-text",this.el),this.panelOptions=$("#chat-options",this.el),this.panelUsers.scroller=new Common.UI.Scroller({el:$("#chat-users"),useKeyboard:!0,minScrollbarLength:25}),this.panelMessages.scroller=new Common.UI.Scroller({el:$("#chat-messages"),includePadding:!0,useKeyboard:!0,minScrollbarLength:40}),$("#chat-msg-btn-add",this.el).on("click",_.bind(this._onBtnAddMessage,this)),this.txtMessage.on("keydown",_.bind(this._onKeyDown,this)),this.setupLayout(),this},focus:function(){var e=this;_.defer(function(){e.txtMessage.focus()},100),this.updateLayout(!0),this.setupAutoSizingTextBox()},_onKeyDown:function(e){e.keyCode==Common.UI.Keys.RETURN?(e.ctrlKey||e.metaKey)&&!e.altKey&&this._onBtnAddMessage(e):e.keyCode==Common.UI.Keys.ESC&&this.hide()},_onAddUser:function(e,t,n){this.panelUsers&&(this.panelUsers.find("ul").append(_.template(this.tplUser,{user:e,scope:this})),this.panelUsers.scroller.update({minScrollbarLength:25,alwaysVisibleY:!0}))},_onUsersChanged:function(e){e.changed.online!=undefined&&this.panelUsers&&(this.panelUsers.find("#chat-user-"+e.get("id"))[e.changed.online?"removeClass":"addClass"]("offline"),this.panelUsers.scroller.update({minScrollbarLength:25,alwaysVisibleY:!0}))},_onResetUsers:function(e,t){this.panelUsers&&(this.panelUsers.html(this.templateUserList({users:e.models,usertpl:this.tplUser,scope:this})),this.panelUsers.scroller.update({minScrollbarLength:25,alwaysVisibleY:!0}))},_onAddMessage:function(e,t,n){if(this.panelMessages){var r=this.panelMessages.find("ul");r&&r.length&&(this._prepareMessage(e),r.append(_.template(this.tplMsg,{msg:e,scope:this})),this.panelMessages.scroller.update({minScrollbarLength:40,alwaysVisibleY:!0}),this.panelMessages.scroller.scrollTop(r.get(0).getBoundingClientRect().height))}},_onResetMessages:function(e,t){if(this.panelMessages){var n,r;e.each(function(e){this._prepareMessage(e)},this),this.panelMessages.html(this.templateMsgList({messages:e.models,msgtpl:this.tplMsg,scope:this})),this.panelMessages.scroller.update({minScrollbarLength:40,alwaysVisibleY:!0})}},_onBtnAddMessage:function(e){this.txtMessage&&(this.fireEvent("message:add",[this,this.txtMessage.val().trim()]),this.txtMessage.val(""),this.focus())},_prepareMessage:function(e){var t=this.storeUsers.findUser(e.get("userid"));e.set({usercolor:t?t.get("color"):"#000",message:this._pickLink(Common.Utils.String.htmlEncode(e.get("message")))},{silent:!0})},_pickLink:function(e){var t=[],n,r;e.replace(Common.Utils.ipStrongRe,function(e){return n=arguments[arguments.length-2],t.push({start:n,end:e.length+n,str:'<a href="'+e+'" target="_blank" data-can-copy="true">'+e+"</a>"}),""}),(e.length<1e3||e.search(/\S{255,}/)<0)&&e.replace(Common.Utils.hostnameStrongRe,function(e){var i=/(((^https?)|(^ftp)):\/\/)/i.test(e)?e:"http://"+e;n=arguments[arguments.length-2],r=e.length;var s=_.find(t,function(e){return n>=e.start&&n<e.end||n<=e.start&&n+r>e.start});return s||t.push({start:n,end:r+n,str:'<a href="'+i+'" target="_blank" data-can-copy="true">'+e+"</a>"}),""}),e.replace(Common.Utils.emailStrongRe,function(e){var i=/((^mailto:)\/\/)/i.test(e)?e:"mailto:"+e;n=arguments[arguments.length-2],r=e.length;var s=_.find(t,function(e){return n>=e.start&&n<e.end||n<=e.start&&n+r>e.start});return s||t.push({start:n,end:r+n,str:'<a href="'+i+'">'+e+"</a>"}),""}),t=_.sortBy(t,function(e){return e.start});var i=t.length>0?e.substring(0,t[0].start)+t[0].str:e;for(var s=1;s<t.length;s++)i+=e.substring(t[s-1].end,t[s].start)+t[s].str;return t.length>0&&(i+=e.substring(t[s-1].end,e.length)),i},getUserName:function(e){return Common.Utils.String.htmlEncode(e)},hide:function(){Common.UI.BaseView.prototype.hide.call(this,arguments),this.fireEvent("hide",this),this.textBoxAutoSizeLocked=undefined},setupLayout:function(){var e=this,t=$(e.el),n=this.panelBox.find(" > .layout-item");e.layout=new Common.UI.VBoxLayout({box:this.panelBox,items:[{el:n[0],rely:!0,behaviour:"splitter",resize:{hidden:!1,autohide:!1,fmin:function(){return e.usersBoxHeight},fmax:function(){return e.panelBox.height()*.5-e.messageBoxHeight}}},{el:n[1],rely:!0,behaviour:"splitter",resize:{hidden:!1,autohide:!1,fmin:function(){return Math.max(e.messageBoxHeight+e.usersBoxHeight,e.panelBox.height()*.5)},fmax:function(){return e.panelBox.height()-e.addMessageBoxHeight}}},{el:n[2],stretch:!0}]}),e.layout.on("layout:resizedrag",function(t){e.updateScrolls(),e.usersCachedHeigt=e.panelUsers.height()+8+1,t.index||(e.textBoxAutoSizeLocked=!0)},this),$(window).on("resize",function(){t.css("display")!=="none"&&e.updateLayout()}),this.updateLayout();var r=this.panelBox.height();this.layout.setResizeValue(0,this.usersBoxHeight),this.layout.setResizeValue(1,Math.max(this.addMessageBoxHeight,Math.max(r*.5,r-e.panelOptions.height()-4))),this.setupAutoSizingTextBox(),this.txtMessage.bind("input propertychange",_.bind(this.updateHeightTextBox,this))},updateLayout:function(e){var t=this,n=this.panelBox.height();t.layout.setResizeValue(1,Math.max(t.addMessageBoxHeight,Math.max(n*.5,n-t.panelOptions.height()-4)));if(e){var r=this.panelUsers.css("height");this.panelUsers.css("height","1px");var i=this.panelUsers.get(0).scrollHeight;t.layout.setResizeValue(0,Math.max(t.usersBoxHeight,Math.min(i+2,Math.floor(n*.5)-t.messageBoxHeight)))}else t.layout.setResizeValue(0,Math.max(t.usersBoxHeight,Math.min(t.usersCachedHeigt+2,Math.floor(n*.5)-t.messageBoxHeight)));t.updateScrolls(),t.updateHeightTextBox(null)},setupAutoSizingTextBox:function(){this.lineHeight=0,this.minHeight=44,this.lineHeight=parseInt(this.txtMessage.css("lineHeight"),10)*1.25,this.updateHeightTextBox(!0)},updateHeightTextBox:function(e){var t=this.txtMessage,n,r,i,s=40;i=this.panelBox.height();if(e&&0==t.val().length){this.layout.setResizeValue(1,Math.max(this.addMessageBoxHeight,i-this.addMessageBoxHeight)),this.textBoxAutoSizeLocked=undefined;return}if(!_.isUndefined(this.textBoxAutoSizeLocked))return;n=t.height(),r=t.get(0).scrollHeight,t.css({height:this.minHeight+"px"}),n=t.height(),r=Math.max(t.get(0).scrollHeight+this.lineHeight,1),t.css({height:"100%"}),i=this.panelBox.height(),this.layout.setResizeValue(1,Math.max(this.addMessageBoxHeight,Math.min(i-r-s,i-this.addMessageBoxHeight)))},updateScrolls:function(){this.panelUsers&&this.panelUsers.scroller&&this.panelMessages&&this.panelMessages.scroller&&(this.panelUsers.scroller.update({minScrollbarLength:25,alwaysVisibleY:!0}),this.panelMessages.scroller.update({minScrollbarLength:40,alwaysVisibleY:!0}))},textSend:"Send"},Common.Views.Chat||{}))}),define("common/main/lib/view/SearchDialog",["common/main/lib/component/Window"],function(){"use strict";Common.UI.SearchDialog=Common.UI.Window.extend(_.extend({options:{width:550,title:"Search & Replace",modal:!1,cls:"search",toolclose:"hide",alias:"SearchDialog"},initialize:function(e){_.extend(this.options,e||{}),this.template=['<div class="box">','<div class="input-row">','<span class="btn-placeholder" id="search-placeholder-btn-options"></span>','<input type="text" id="sd-text-search" class="form-control" maxlength="100" placeholder="'+this.textSearchStart+'">',"</div>",'<div class="input-row">','<input type="text" id="sd-text-replace" class="form-control" maxlength="100" placeholder="'+this.textReplaceDef+'">',"</div>",'<div class="input-row">','<label class="link" id="search-label-replace" result="replaceshow">'+this.txtBtnReplace+"</label>","</div>","</div>",'<div class="separator horizontal"/>','<div class="footer right">','<button class="btn normal dlg-btn" result="replace" style="margin-right: 6px;">'+this.txtBtnReplace+"</button>",'<button class="btn normal dlg-btn" result="replaceall" style="margin-right: 10px;">'+this.txtBtnReplaceAll+"</button>",'<button class="btn normal dlg-btn iconic" result="back" style="margin-right: 6px;"><span class="icon img-commonctrl back" /></button>','<button class="btn normal dlg-btn iconic" result="next"><span class="icon img-commonctrl next" /></button>',"</div>"].join(""),this.options.tpl=_.template(this.template,this.options),Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){return Common.UI.Window.prototype.render.call(this),this.miMatchCase=new Common.UI.MenuItem({caption:this.textMatchCase,checkable:!0}),this.miMatchWord=new Common.UI.MenuItem({caption:this.options.matchwordstr||this.textWholeWords,checkable:!0}),this.miHighlight=new Common.UI.MenuItem({caption:this.textHighlight,checkable:!0}),this.btnOptions=new Common.UI.Button({id:"search-btn-options",cls:"btn-toolbar",iconCls:"btn-settings",menu:new Common.UI.Menu({items:[this.miMatchCase,this.miMatchWord,this.miHighlight]})}),this.options.extraoptions&&(this.btnOptions.menu.addItem({caption:"--"}),this.options.extraoptions.forEach(function(e){this.btnOptions.menu.addItem(e)},this)),this.btnOptions.render(this.$window.find("#search-placeholder-btn-options")),this.options.matchcase||this.miMatchCase.hide(),this.options.matchword||this.miMatchWord.hide(),this.options.markresult?this.options.markresult.applied&&this.miHighlight.setChecked(!0,!0):this.miHighlight.hide(),this.options.mode==="search"&&$(this.$window.find(".input-row").get(2)).hide(),this.txtSearch=this.$window.find("#sd-text-search"),this.txtReplace=this.$window.find("#sd-text-replace"),this.lblReplace=this.$window.find("#search-label-replace"),this.miHighlight.on("toggle",_.bind(this.onHighlight,this)),this.$window.find(".btn[result=back]").on("click",_.bind(this.onBtnClick,this,"back")),this.$window.find(".btn[result=next]").on("click",_.bind(this.onBtnClick,this,"next")),this.$window.find(".btn[result=replace]").on("click",_.bind(this.onBtnClick,this,"replace")),this.$window.find(".btn[result=replaceall]").on("click",_.bind(this.onBtnClick,this,"replaceall")),this.$window.find("label[result=replaceshow]").on("click",_.bind(this.onShowReplace,this)),this.txtSearch.on("keydown",null,"search",_.bind(this.onKeyPress,this)),this.txtReplace.on("keydown",null,"replace",_.bind(this.onKeyPress,this)),this.on("animate:before",_.bind(this.focus,this)),this},show:function(e){Common.UI.Window.prototype.show.call(this),!this.mode&&!e&&(e="search"),e&&this.mode!=e&&this.setMode(e),this.options.markresult&&this.miHighlight.checked&&this.fireEvent("search:highlight",[this,!0]),this.focus()},focus:function(){var e=this;setTimeout(function(){e.txtSearch.focus(),e.txtSearch.select()},10)},onKeyPress:function(e){this.isLocked()||(e.keyCode==Common.UI.Keys.RETURN?(e.data=="search"?this.onBtnClick("next",e):e.data=="replace"&&this.mode=="replace"&&this.onBtnClick("replace",e),e.preventDefault(),e.stopPropagation()):e.keyCode==Common.UI.Keys.ESC&&$(".asc-loadmask").length<1&&(this.hide(),e.preventDefault(),e.stopPropagation()))},onBtnClick:function(e,t){if($(".asc-loadmask").length)return;var n={textsearch:this.txtSearch.val(),textreplace:this.txtReplace.val(),matchcase:this.miMatchCase.checked,matchword:this.miMatchWord.checked,highlight:this.miHighlight.checked};this.fireEvent("search:"+e,[this,n])},setMode:function(e){this.mode=e;var t=this.$window.find(".input-row");e==="no-replace"?(this.setTitle(this.textTitle2),t.eq(1).hide(),t.eq(2).hide(),this.$window.find(".btn[result=replace]").hide(),this.$window.find(".btn[result=replaceall]").hide(),this.options.matchcase||this.options.matchword||this.options.markresult||(this.txtSearch.addClass("clear"),this.btnOptions.hide()),this.setHeight(170)):(this.txtSearch.removeClass("clear"),this.setTitle(this.textTitle),e==="search"?(t.eq(2).show(),this.lblReplace.text(this.txtBtnReplace),t.eq(1).hide(),this.$window.find(".btn[result=replace]").hide(),this.$window.find(".btn[result=replaceall]").hide(),this.setHeight(200)):(t.eq(2).show(),this.lblReplace.text(this.txtBtnHideReplace),t.eq(1).show(),this.$window.find(".btn[result=replace]").show(),this.$window.find(".btn[result=replaceall]").show(),this.setHeight(230)))},onShowReplace:function(e){this.setMode(this.mode=="replace"?"search":"replace");var t=this;_.defer(function(){t.mode=="replace"?t.txtReplace.focus():t.txtSearch.focus()},300)},onHighlight:function(e,t){this.fireEvent("search:highlight",[this,t])},getSettings:function(){return{textsearch:this.txtSearch.val(),casesensitive:this.miMatchCase.checked,wholewords:this.miMatchWord.checked}},textTitle:"Search & Replace",textTitle2:"Search",txtBtnReplace:"Replace",txtBtnReplaceAll:"Replace All",textMatchCase:"Case sensitive",textWholeWords:"Whole words only",textHighlight:"Highlight results",textReplaceDef:"Enter the replacement text",textSearchStart:"Enter text for search",txtBtnHideReplace:"Hide Replace"},Common.UI.SearchDialog||{}))});if(Common===undefined)var Common={};Common.Views=Common.Views||{},define("common/main/lib/view/Plugins",["common/main/lib/util/utils","common/main/lib/component/BaseView","common/main/lib/component/Layout","common/main/lib/component/Window"],function(e){"use strict";Common.Views.Plugins=Common.UI.BaseView.extend(_.extend({el:"#left-panel-plugins",storePlugins:undefined,template:_.template(['<div id="plugins-box" class="layout-ct vbox">','<label id="plugins-header"><%= scope.strPlugins %></label>','<div id="plugins-list" class="">',"</div>","</div>",'<div id="current-plugin-box" class="layout-ct vbox hidden">','<div id="current-plugin-header">',"<label></label>",'<div id="id-plugin-close" class="plugin-close img-commonctrl"></div>',"</div>",'<div id="current-plugin-frame" class="">',"</div>","</div>",'<div id="plugins-mask" style="display: none;">'].join("")),initialize:function(e){_.extend(this,e),this._locked=!1,this._state={DisabledControls:!0},this.lockedControls=[],Common.UI.BaseView.prototype.initialize.call(this,arguments)},render:function(e){return e=e||this.el,$(e).html(this.template({scope:this})),this.$el=$(e),this.viewPluginsList=new Common.UI.DataView({el:$("#plugins-list"),store:this.storePlugins,enableKeyEvents:!1,itemTemplate:_.template(['<div id="<%= id %>" class="item-plugins" style="display: block;">','<div class="plugin-icon" style="background-image: url(<%= baseUrl %><%= variations[currentVariation].get("icons")[(window.devicePixelRatio > 1) ? 1 : 0] %>);"></div>',"<% if (variations.length>1) { %>",'<div class="plugin-caret img-commonctrl"></div>',"<% } %>","<%= name %>","</div>"].join(""))}),this.lockedControls.push(this.viewPluginsList),this.viewPluginsList.cmpEl.off("click"),this.pluginName=$("#current-plugin-header label"),this.pluginsPanel=$("#plugins-box"),this.pluginsMask=$("#plugins-mask"),this.currentPluginPanel=$("#current-plugin-box"),this.currentPluginFrame=$("#current-plugin-frame"),this.pluginMenu=new Common.UI.Menu({menuAlign:"tr-br",items:[]}),this.trigger("render:after",this),this},setLocked:function(e){this._locked=e},ChangeSettings:function(e){this.disableControls(this._locked)},disableControls:function(e){this._state.DisabledControls!==e&&(this._state.DisabledControls=e,_.each(this.lockedControls,function(t){t.setDisabled(e)}),this.pluginsMask.css("display",e?"block":"none"))},openInsideMode:function(e,t){return this.pluginsPanel?(this.pluginsPanel.toggleClass("hidden",!0),this.currentPluginPanel.toggleClass("hidden",!1),this.pluginName.text(e),this.iframePlugin||(this.iframePlugin=document.createElement("iframe"),this.iframePlugin.id="plugin_iframe",this.iframePlugin.name="pluginFrameEditor",this.iframePlugin.width="100%",this.iframePlugin.height="100%",this.iframePlugin.align="top",this.iframePlugin.frameBorder=0,this.iframePlugin.scrolling="no",this.iframePlugin.onload=_.bind(this._onLoad,this),this.currentPluginFrame.append(this.iframePlugin),this.loadMask||(this.loadMask=new Common.UI.LoadMask({owner:this.currentPluginFrame})),this.loadMask.setTitle(this.textLoading),this.loadMask.show(),this.iframePlugin.src=t),!0):!1},closeInsideMode:function(){if(!this.pluginsPanel)return;this.iframePlugin&&(this.currentPluginFrame.empty(),this.iframePlugin=null),this.currentPluginPanel.toggleClass("hidden",!0),this.pluginsPanel.toggleClass("hidden",!1)},openNotVisualMode:function(e){var t=this.viewPluginsList.store.findWhere({guid:e});t&&this.viewPluginsList.cmpEl.find("#"+t.get("id")).parent().addClass("selected")},closeNotVisualMode:function(){this.viewPluginsList.cmpEl.find(".selected").removeClass("selected")},_onLoad:function(){this.loadMask&&this.loadMask.hide()},strPlugins:"Plugins",textLoading:"Loading",textStart:"Start"},Common.Views.Plugins||{})),Common.Views.PluginDlg=Common.UI.Window.extend(_.extend({initialize:function(e){var t={};_.extend(t,{cls:"advanced-settings-dlg",header:!0,enableKeyEvents:!1},e);var n=t.buttons&&_.size(t.buttons)>0?85:34;t.width=Common.Utils.innerWidth()-t.width<0?Common.Utils.innerWidth():t.width,t.height+=n,t.height=Common.Utils.innerHeight()-t.height<0?Common.Utils.innerHeight():t.height,this.template=['<div id="id-plugin-container" class="box" style="height:'+(t.height-n)+'px;">','<div id="id-plugin-placeholder" style="width: 100%;height: 100%;"></div>',"</div>","<% if (_.size(buttons) > 0) { %>",'<div class="separator horizontal"/>','<div class="footer" style="text-align: center;">',"<% for(var bt in buttons) { %>",'<button class="btn normal dlg-btn <%= buttons[bt].cls %>" result="<%= bt %>" style="margin-right: 10px;"><%= buttons[bt].text %></button>',"<% } %>","</div>","<% } %>"].join(""),t.tpl=_.template(this.template,t),this.url=e.url||"",Common.UI.Window.prototype.initialize.call(this,t)},render:function(){Common.UI.Window.prototype.render.call(this),this.$window.find("> .body").css({height:"auto",overflow:"hidden"}),this.boxEl=this.$window.find(".body > .box"),this._headerFooterHeight=this.options.buttons&&_.size(this.options.buttons)>0?85:34,this._headerFooterHeight+=parseInt(this.$window.css("border-top-width"))+parseInt(this.$window.css("border-bottom-width"));var e=document.createElement("iframe");e.id="plugin_iframe",e.name="pluginFrameEditor",e.width="100%",e.height="100%",e.align="top",e.frameBorder=0,e.scrolling="no",e.onload=_.bind(this._onLoad,this);var t=this;setTimeout(function(){if(t.isLoaded)return;t.loadMask=new Common.UI.LoadMask({owner:$("#id-plugin-placeholder")}),t.loadMask.setTitle(t.textLoading),t.loadMask.show(),t.isLoaded&&t.loadMask.hide()},500),e.src=this.url,$("#id-plugin-placeholder").append(e),this.on("resizing",function(e){t.boxEl.css("height",parseInt(t.$window.css("height"))-t._headerFooterHeight)})},_onLoad:function(){this.isLoaded=!0,this.loadMask&&this.loadMask.hide()},setInnerSize:function(e,t){var n=Common.Utils.innerHeight(),r=Common.Utils.innerWidth(),i=parseInt(this.$window.css("border-left-width"))+parseInt(this.$window.css("border-right-width"));n<t+this._headerFooterHeight&&(t=n-this._headerFooterHeight),r<e+i&&(e=r-i),this.boxEl.css("height",t),Common.UI.Window.prototype.setHeight.call(this,t+this._headerFooterHeight),Common.UI.Window.prototype.setWidth.call(this,e+i),this.$window.css("left",(r-e-i)/2),this.$window.css("top",(n-t-this._headerFooterHeight)/2*.9)},textLoading:"Loading"},Common.Views.PluginDlg||{}))}),define("text!spreadsheeteditor/main/app/template/FileMenu.template",[],function(){return'<div class="panel-menu">\r\n <li class="fm-first-item"/>\r\n <li id="fm-btn-return" class="fm-btn" />\r\n <li class="devider" />\r\n <li id="fm-btn-save" class="fm-btn" />\r\n <li id="fm-btn-edit" class="fm-btn" />\r\n <li id="fm-btn-download" class="fm-btn" />\r\n <li id="fm-btn-save-desktop" class="fm-btn" />\r\n <li id="fm-btn-print" class="fm-btn" />\r\n <li id="fm-btn-rename" class="fm-btn" />\r\n <li class="devider" />\r\n <li id="fm-btn-recent" class="fm-btn" />\r\n <li id="fm-btn-create" class="fm-btn" />\r\n <li class="devider" />\r\n <li id="fm-btn-info" class="fm-btn" />\r\n <li id="fm-btn-rights" class="fm-btn" />\r\n <li class="devider" class="fm-btn" />\r\n <li id="fm-btn-settings" class="fm-btn" />\r\n <li class="devider" />\r\n <li id="fm-btn-help" class="fm-btn" />\r\n <li class="devider" />\r\n <li id="fm-btn-back" class="fm-btn" />\r\n</div>\r\n<div class="panel-context">\r\n <div id="panel-saveas" class="content-box" />\r\n <div id="panel-recentfiles" class="content-box" />\r\n <div id="panel-createnew" class="content-box" />\r\n <div id="panel-info" class="content-box" />\r\n <div id="panel-rights" class="content-box" />\r\n <div id="panel-settings" class="content-box" />\r\n <div id="panel-help" class="content-box" />\r\n</div>'}),define("spreadsheeteditor/main/app/view/FileMenu",["text!spreadsheeteditor/main/app/template/FileMenu.template","underscore","common/main/lib/component/BaseView"],function(e,t){"use strict";SSE.Views.FileMenu=Common.UI.BaseView.extend(t.extend({el:"#file-menu-panel",template:t.template(e),events:function(){return{"click .fm-btn":t.bind(function(e){var n=$(e.currentTarget);n.hasClass("active")||($(".fm-btn",this.el).removeClass("active"),n.addClass("active"));var r=t.findWhere(this.items,{el:e.currentTarget});if(r){var i=this.panels[r.options.action];this.fireEvent("item:click",[this,r.options.action,!!i]),i&&(this.$el.find(".content-box:visible").hide(),this.active=r.options.action,i.show())}},this)}},initialize:function(){},render:function(){this.$el=$(this.el),this.$el.html(this.template()),this.items=[],this.items.push(new Common.UI.MenuItem({el:$("#fm-btn-return",this.el),action:"back",caption:this.btnCloseMenuCaption,canFocused:!1}),new Common.UI.MenuItem({el:$("#fm-btn-save",this.el),action:"save",caption:this.btnSaveCaption,canFocused:!1}),new Common.UI.MenuItem({el:$("#fm-btn-edit",this.el),action:"edit",caption:this.btnToEditCaption,canFocused:!1}),new Common.UI.MenuItem({el:$("#fm-btn-download",this.el),action:"saveas",caption:this.btnDownloadCaption,canFocused:!1}),new Common.UI.MenuItem({el:$("#fm-btn-save-desktop",this.el),action:"save-desktop",caption:this.btnSaveAsCaption,canFocused:!1}),new Common.UI.MenuItem({el:$("#fm-btn-print",this.el),action:"print",caption:this.btnPrintCaption,canFocused:!1}),new Common.UI.MenuItem({el:$("#fm-btn-rename",this.el),action:"rename",caption:this.btnRenameCaption,canFocused:!1}),new Common.UI.MenuItem({el:$("#fm-btn-recent",this.el),action:"recent",caption:this.btnRecentFilesCaption,canFocused:!1}),new Common.UI.MenuItem({el:$("#fm-btn-create",this.el),action:"new",caption:this.btnCreateNewCaption,canFocused:!1}),new Common.UI.MenuItem({el:$("#fm-btn-info",this.el),action:"info",caption:this.btnInfoCaption,canFocused:!1}),new Common.UI.MenuItem({el:$("#fm-btn-rights",this.el),action:"rights",caption:this.btnRightsCaption,canFocused:!1}),new Common.UI.MenuItem({el:$("#fm-btn-settings",this.el),action:"opts",caption:this.btnSettingsCaption,canFocused:!1}),new Common.UI.MenuItem({el:$("#fm-btn-help",this.el),action:"help",caption:this.btnHelpCaption,canFocused:!1}),new Common.UI.MenuItem({el:$("#fm-btn-back",this.el),action:"exit",caption:this.btnBackCaption,canFocused:!1}));var e=this;return e.panels={saveas:(new SSE.Views.FileMenuPanels.ViewSaveAs({menu:e})).render(),opts:(new SSE.Views.FileMenuPanels.Settings({menu:e})).render(),info:(new SSE.Views.FileMenuPanels.DocumentInfo({menu:e})).render(),rights:(new SSE.Views.FileMenuPanels.DocumentRights({menu:e})).render(),help:(new SSE.Views.FileMenuPanels.Help({menu:e})).render()},e.$el.find(".content-box").hide(),this},show:function(e){if(this.isVisible()&&e===undefined)return;e||(e=this.active||(this.mode.canDownload&&(!this.mode.isDesktopApp||!this.mode.isOffline)?"saveas":"info")),this.$el.show(),this.selectMenu(e),this.mode.isEdit&&SSE.getController("Toolbar").DisableToolbar(!0),this.api.asc_enableKeyEvents(!1)},hide:function(){this.$el.hide(),this.mode.isEdit&&SSE.getController("Toolbar").DisableToolbar(!1),this.api.asc_enableKeyEvents(!0)},applyMode:function(){this.items[5][this.mode.canPrint?"show":"hide"](),this.items[6][this.mode.canRename&&!this.mode.isDesktopApp?"show":"hide"](),this.items[6].$el.find("+.devider")[this.mode.isDisconnected?"hide":"show"](),this.items[7][this.mode.canOpenRecent?"show":"hide"](),this.items[8][this.mode.canCreateNew?"show":"hide"](),this.items[8].$el.find("+.devider")[this.mode.canCreateNew?"show":"hide"](),this.items[3][this.mode.canDownload&&(!this.mode.isDesktopApp||!this.mode.isOffline)?"show":"hide"](),this.items[4][this.mode.canDownload&&this.mode.isDesktopApp&&this.mode.isOffline?"show":"hide"](),this.items[1][this.mode.isEdit?"show":"hide"](),this.items[2][!this.mode.isEdit&&this.mode.canEdit&&this.mode.canRequestEditRights?"show":"hide"](),this.items[10][!this.mode.isOffline&&this.document&&this.document.info&&(this.document.info.sharingSettings&&this.document.info.sharingSettings.length>0||this.mode.sharingSettingsUrl&&this.mode.sharingSettingsUrl.length)?"show":"hide"](),this.items[11][this.mode.isEdit?"show":"hide"](),this.items[11].$el.find("+.devider")[this.mode.isEdit?"show":"hide"](),this.mode.canBack?this.$el.find("#fm-btn-back").show().prev().show():this.$el.find("#fm-btn-back").hide().prev().hide(),this.panels.opts.setMode(this.mode),this.panels.info.setMode(this.mode).updateInfo(this.document),this.panels.rights.setMode(this.mode).updateInfo(this.document),this.mode.canCreateNew&&this.mode.templates&&this.mode.templates.length&&($("a",this.items[8].$el).text(this.btnCreateNewCaption+"..."),this.panels["new"]=(new SSE.Views.FileMenuPanels.CreateNew({menu:this,docs:this.mode.templates})).render()),this.mode.canOpenRecent&&this.mode.recent&&(this.panels.recent=(new SSE.Views.FileMenuPanels.RecentFiles({menu:this,recent:this.mode.recent})).render()),this.panels.help.setLangConfig(this.mode.lang)},setMode:function(e,t){e.isDisconnected?(this.mode.canEdit=this.mode.isEdit=!1,this.mode.canOpenRecent=this.mode.canCreateNew=!1,this.mode.isDisconnected=e.isDisconnected,this.mode.canRename=!1,this.mode.canPrint=!1,this.mode.canDownload=!1):this.mode=e,t||this.applyMode()},setApi:function(e){this.api=e,this.panels.opts&&this.panels.opts.setApi(e),this.api.asc_registerCallback("asc_onDocumentName",t.bind(this.onDocumentName,this))},loadDocument:function(e){this.document=e.doc},selectMenu:function(e){if(e){var t=this._getMenuItem(e),n=this.panels[e];t&&n&&($(".fm-btn",this.el).removeClass("active"),t.$el.addClass("active"),this.$el.find(".content-box:visible").hide(),n.show(),this.active=e)}},_getMenuItem:function(e){return t.find(this.items,function(t){return t.options.action==e})},onDocumentName:function(e){this.document.title=e,this.panels.info.updateInfo(this.document)},btnSaveCaption:"Save",btnDownloadCaption:"Download as...",btnInfoCaption:"Document Info...",btnRightsCaption:"Access Rights...",btnCreateNewCaption:"Create New",btnRecentFilesCaption:"Open Recent...",btnPrintCaption:"Print",btnHelpCaption:"Help...",btnReturnCaption:"Back to Document",btnToEditCaption:"Edit Document",btnBackCaption:"Go to Documents",btnSettingsCaption:"Advanced Settings...",btnSaveAsCaption:"Save as",btnRenameCaption:"Rename...",btnCloseMenuCaption:"Close Menu"},SSE.Views.FileMenu||{}))}),define("spreadsheeteditor/main/app/view/LeftMenu",["text!spreadsheeteditor/main/app/template/LeftMenu.template","jquery","underscore","backbone","common/main/lib/component/Button","common/main/lib/view/About","common/main/lib/view/Comments","common/main/lib/view/Chat","common/main/lib/view/SearchDialog","common/main/lib/view/Plugins","spreadsheeteditor/main/app/view/FileMenu"],function(e,t,n,r){"use strict";var i=40,s=300;SSE.Views.LeftMenu=r.View.extend(n.extend({el:"#left-menu",template:n.template(e),events:function(){return{"click #left-btn-comments":n.bind(this.onCoauthOptions,this),"click #left-btn-chat":n.bind(this.onCoauthOptions,this),"click #left-btn-plugins":n.bind(this.onCoauthOptions,this),"click #left-btn-support":function(){var e=this.mode.customization;!e||!e.feedback||!e.feedback.url?window.open("http://support.onlyoffice.com"):window.open(e.feedback.url)}}},initialize:function(){this.minimizedMode=!0},render:function(){var e=t(this.el);e.html(this.template({})),this.btnFile=new Common.UI.Button({action:"file",el:t("#left-btn-file",this.el),hint:this.tipFile+Common.Utils.String.platformKey("Alt+F"),enableToggle:!0,disabled:!0,toggleGroup:"leftMenuGroup"}),this.btnSearch=new Common.UI.Button({action:"search",el:t("#left-btn-search",this.el),hint:this.tipSearch+Common.Utils.String.platformKey("Ctrl+F"),disabled:!0,enableToggle:!0}),this.btnAbout=new Common.UI.Button({action:"about",el:t("#left-btn-about",this.el),hint:this.tipAbout,enableToggle:!0,disabled:!0,toggleGroup:"leftMenuGroup"}),this.btnSupport=new Common.UI.Button({action:"support",el:t("#left-btn-support",this.el),hint:this.tipSupport,disabled:!0}),this.btnComments=new Common.UI.Button({el:t("#left-btn-comments",this.el),hint:this.tipComments+Common.Utils.String.platformKey("Ctrl+Shift+H"),enableToggle:!0,disabled:!0,toggleGroup:"leftMenuGroup"}),this.btnChat=new Common.UI.Button({el:t("#left-btn-chat",this.el),hint:this.tipChat+Common.Utils.String.platformKey("Alt+Q"),enableToggle:!0,disabled:!0,toggleGroup:"leftMenuGroup"}),this.btnComments.hide(),this.btnChat.hide(),this.btnComments.on("click",n.bind(this.onBtnMenuClick,this)),this.btnChat.on("click",n.bind(this.onBtnMenuClick,this)),this.btnPlugins=new Common.UI.Button({el:t("#left-btn-plugins"),hint:this.tipPlugins,enableToggle:!0,disabled:!0,toggleGroup:"leftMenuGroup"}),this.btnPlugins.hide(),this.btnPlugins.on("click",n.bind(this.onBtnMenuClick,this)),this.btnSearch.on("click",n.bind(this.onBtnMenuClick,this)),this.btnAbout.on("toggle",n.bind(this.onBtnMenuToggle,this)),this.btnFile.on("toggle",n.bind(this.onBtnMenuToggle,this));var r=new SSE.Views.FileMenu({});return r.options={alias:"FileMenu"},this.btnFile.panel=r.render(),this.btnAbout.panel=(new Common.Views.About({el:t("#about-menu-panel"),appName:"Spreadsheet Editor"})).render(),this},onBtnMenuToggle:function(e,t){t?(this.btnFile.pressed&&this.fireEvent("file:show",this),e.panel.show(),this.$el.width(i),this.btnSearch.isActive()&&this.btnSearch.toggle(!1)):(this.btnFile.id==e.id&&this.fireEvent("file:hide",this),e.panel.hide()),this.mode.isEdit&&SSE.getController("Toolbar").DisableToolbar(t==1),Common.NotificationCenter.trigger("layout:changed","leftmenu")},onBtnMenuClick:function(e,t){this.btnFile.toggle(!1),this.btnAbout.toggle(!1),e.options.action!="search"&&(e.pressed?this.$el.width()>i||this.$el.width(Common.localStorage.getItem("sse-mainmenu-width")||s):(Common.localStorage.setItem("sse-mainmenu-width",this.$el.width()),this.$el.width(i))),Common.NotificationCenter.trigger("layout:changed","leftmenu")},onCoauthOptions:function(e){this.mode.canCoAuthoring&&(this.mode.canComments&&(this.btnComments.pressed&&this.btnComments.$el.hasClass("notify")&&this.btnComments.$el.removeClass("notify"),this.panelComments[this.btnComments.pressed?"show":"hide"](),this.fireEvent(this.btnComments.pressed?"comments:show":"comments:hide",this)),this.mode.canChat&&(this.btnChat.pressed?(this.btnChat.$el.hasClass("notify")&&this.btnChat.$el.removeClass("notify"),this.panelChat.show(),this.panelChat.focus()):this.panelChat.hide())),this.mode.canPlugins&&this.panelPlugins&&(this.btnPlugins.pressed?this.panelPlugins.show():this.panelPlugins.hide())},setOptionsPanel:function(e,t){e=="chat"?this.panelChat=t.render("#left-panel-chat"):e=="comment"?this.panelComments=t:e=="plugins"&&!this.panelPlugins&&(this.panelPlugins=t.render("#left-panel-plugins"))},markCoauthOptions:function(e,t){e=="chat"&&this.btnChat.isVisible()&&!this.btnChat.isDisabled()&&!this.btnChat.pressed&&this.btnChat.$el.addClass("notify"),e=="comments"&&this.btnComments.isVisible()&&!this.btnComments.pressed&&(!this.btnComments.isDisabled()||t)&&this.btnComments.$el.addClass("notify")},close:function(e){this.btnFile.toggle(!1),this.btnAbout.toggle(!1),this.$el.width(i),this.mode.canCoAuthoring&&(this.mode.canComments&&(this.panelComments.hide(),this.btnComments.pressed&&this.fireEvent("comments:hide",this),this.btnComments.toggle(!1,!0)),this.mode.canChat&&(this.panelChat.hide(),this.btnChat.toggle(!1,!0))),this.mode.canPlugins&&this.panelPlugins&&(this.panelPlugins.hide(),this.btnPlugins.toggle(!1,!0))},isOpened:function(){var e=this.btnFile.pressed||this.btnSearch.pressed;return!e&&(e=this.btnComments.pressed||this.btnChat.pressed),e},disableMenu:function(e,t){this.btnFile.setDisabled(!1),this.btnAbout.setDisabled(!1),this.btnSupport.setDisabled(!1),this.btnSearch.setDisabled(!1),this.btnComments.setDisabled(!1),this.btnChat.setDisabled(!1),this.btnPlugins.setDisabled(!1)},showMenu:function(e){var t=/^(\w+):?(\w*)$/.exec(e);t[1]=="file"&&this.btnFile.isVisible()?(this.btnFile.pressed||(this.btnFile.toggle(!0),this.btnFile.$el.focus()),this.btnFile.panel.show(t[2].length?t[2]:undefined)):e=="chat"?this.btnChat.isVisible()&&!this.btnChat.isDisabled()&&!this.btnChat.pressed&&(this.btnChat.toggle(!0),this.onBtnMenuClick(this.btnChat),this.onCoauthOptions(),this.panelChat.focus()):e=="comments"&&this.btnComments.isVisible()&&!this.btnComments.isDisabled()&&!this.btnComments.pressed&&(this.btnComments.toggle(!0),this.onBtnMenuClick(this.btnComments),this.onCoauthOptions(),this.btnComments.$el.focus())},getMenu:function(e){switch(e){case"file":return this.btnFile.panel;case"about":return this.btnAbout.panel;default:return null}},setMode:function(e){return this.mode=e,this.btnAbout.panel.setMode(e),this},setDeveloperMode:function(e){if(!this.$el.is(":visible"))return;this.developerHint||(this.developerHint=t('<div id="developer-hint">'+this.txtDeveloper+"</div>").appendTo(this.$el),this.devHeight=this.developerHint.outerHeight(),t(window).on("resize",n.bind(this.onWindowResize,this))),this.developerHint.toggleClass("hidden",!e);var r=this.$el.find("button.btn-category:visible:last-of-type");this.minDevPosition=r.offset().top-r.offsetParent().offset().top+r.height()+20,this.onWindowResize()},onWindowResize:function(){this.developerHint.css("top",Math.max((this.$el.height()-this.devHeight)/2,this.minDevPosition))},tipComments:"Comments",tipChat:"Chat",tipAbout:"About",tipSupport:"Feedback & Support",tipFile:"File",tipSearch:"Search",tipPlugins:"Plugins",txtDeveloper:"DEVELOPER MODE"},SSE.Views.LeftMenu||{}))}),define("spreadsheeteditor/main/app/controller/LeftMenu",["core","common/main/lib/util/Shortcuts","spreadsheeteditor/main/app/view/LeftMenu","spreadsheeteditor/main/app/view/FileMenu"],function(){"use strict";SSE.Controllers.LeftMenu=Backbone.Controller.extend(_.extend({views:["LeftMenu","FileMenu"],initialize:function(){this.addListeners({"Common.Views.Chat":{hide:_.bind(this.onHideChat,this)},Statusbar:{"click:users":_.bind(this.clickStatusbarUsers,this)},LeftMenu:{"file:show":_.bind(this.fileShowHide,this,!0),"file:hide":_.bind(this.fileShowHide,this,!1),"comments:show":_.bind(this.commentsShowHide,this,!0),"comments:hide":_.bind(this.commentsShowHide,this,!1)},"Common.Views.About":{show:_.bind(this.aboutShowHide,this,!0),hide:_.bind(this.aboutShowHide,this,!1)},FileMenu:{"item:click":_.bind(this.clickMenuFileItem,this),"saveas:format":_.bind(this.clickSaveAsFormat,this),"settings:apply":_.bind(this.applySettings,this),"create:new":_.bind(this.onCreateNew,this),"recent:open":_.bind(this.onOpenRecent,this)},Toolbar:{"file:settings":_.bind(this.clickToolbarSettings,this)},SearchDialog:{hide:_.bind(this.onSearchDlgHide,this),"search:back":_.bind(this.onQuerySearch,this,"back"),"search:next":_.bind(this.onQuerySearch,this,"next"),"search:replace":_.bind(this.onQueryReplace,this),"search:replaceall":_.bind(this.onQueryReplaceAll,this)}})},onLaunch:function(){this.leftMenu=this.createView("LeftMenu").render(),this.leftMenu.btnSearch.on("toggle",_.bind(this.onMenuSearch,this)),Common.util.Shortcuts.delegateShortcuts({shortcuts:{"command+shift+s,ctrl+shift+s":_.bind(this.onShortcut,this,"save"),"command+f,ctrl+f":_.bind(this.onShortcut,this,"search"),"command+h,ctrl+h":_.bind(this.onShortcut,this,"replace"),"alt+f":_.bind(this.onShortcut,this,"file"),esc:_.bind(this.onShortcut,this,"escape"),"alt+q":_.bind(this.onShortcut,this,"chat"),"command+shift+h,ctrl+shift+h":_.bind(this.onShortcut,this,"comments"),f1:_.bind(this.onShortcut,this,"help")}}),Common.util.Shortcuts.suspendEvents();var e=this;this.leftMenu.$el.find("button").each(function(){$(this).on("keydown",function(t){if(Common.UI.Keys.RETURN===t.keyCode||Common.UI.Keys.SPACE===t.keyCode)e.leftMenu.btnFile.toggle(!1),e.leftMenu.btnAbout.toggle(!1),this.blur(),t.preventDefault(),e.api.asc_enableKeyEvents(!0)})})},setApi:function(e){this.api=e,this.api.asc_registerCallback("asc_onRenameCellTextEnd",_.bind(this.onRenameText,this)),this.api.asc_registerCallback("asc_onCoAuthoringDisconnect",_.bind(this.onApiServerDisconnect,this,!0)),Common.NotificationCenter.on("api:disconnect",_.bind(this.onApiServerDisconnect,this));if(this.mode.canCoAuthoring){this.mode.canChat&&this.api.asc_registerCallback("asc_onCoAuthoringChatReceiveMessage",_.bind(this.onApiChatMessage,this));if(this.mode.canComments){this.api.asc_registerCallback("asc_onAddComment",_.bind(this.onApiAddComment,this)),this.api.asc_registerCallback("asc_onAddComments",_.bind(this.onApiAddComments,this));var t=this.getApplication().getCollection("Common.Collections.Comments");for(var n=0;n<t.length;++n)if(t.at(n).get("userid")!==this.mode.user.id){this.leftMenu.markCoauthOptions("comments",!0);break}}}return!this.mode.isEditMailMerge&&!this.mode.isEditDiagram&&this.api.asc_registerCallback("asc_onEditCell",_.bind(this.onApiEditCell,this)),this.leftMenu.getMenu("file").setApi(e),this},setMode:function(e){return this.mode=e,this.leftMenu.setMode(e),this.leftMenu.getMenu("file").setMode(e),this},createDelayedElements:function(){return this.mode.canCoAuthoring?(this.leftMenu.btnComments[this.mode.isEdit&&this.mode.canComments&&!this.mode.isLightVersion?"show":"hide"](),this.mode.canComments&&this.leftMenu.setOptionsPanel("comment",this.getApplication().getController("Common.Controllers.Comments").getView("Common.Views.Comments")),this.leftMenu.btnChat[this.mode.canChat&&!this.mode.isLightVersion?"show":"hide"](),this.mode.canChat&&this.leftMenu.setOptionsPanel("chat",this.getApplication().getController("Common.Controllers.Chat").getView("Common.Views.Chat"))):(this.leftMenu.btnChat.hide(),this.leftMenu.btnComments.hide()),this.mode.isTrial&&this.leftMenu.setDeveloperMode(!0),Common.util.Shortcuts.resumeEvents(),!this.mode.isEditMailMerge&&!this.mode.isEditDiagram&&Common.NotificationCenter.on("cells:range",_.bind(this.onCellsRange,this)),this},enablePlugins:function(){this.mode.canPlugins?(this.leftMenu.btnPlugins.show(),this.leftMenu.setOptionsPanel("plugins",this.getApplication().getController("Common.Controllers.Plugins").getView("Common.Views.Plugins"))):this.leftMenu.btnPlugins.hide(),this.mode.isTrial&&this.leftMenu.setDeveloperMode(!0)},clickMenuFileItem:function(e,t,n){var r=!0;switch(t){case"back":break;case"save":this.api.asc_Save();break;case"save-desktop":this.api.asc_DownloadAs();break;case"print":Common.NotificationCenter.trigger("print",this.leftMenu);break;case"exit":Common.NotificationCenter.trigger("goback");break;case"edit":Common.Gateway.requestEditRights();break;case"new":n?r=!1:this.onCreateNew(undefined,"blank");break;case"rename":var i=this,s=i.api.asc_getDocumentName();(new Common.Views.RenameDialog({filename:s,handler:function(e,t){e=="ok"&&!_.isEmpty(t.trim())&&s!==t.trim()&&Common.Gateway.requestRename(t),Common.NotificationCenter.trigger("edit:complete",i)}})).show();break;default:r=!1}r&&(e.hide(),this.leftMenu.btnFile.toggle(!1,!0))},clickSaveAsFormat:function(e,t){t==Asc.c_oAscFileType.CSV?Common.UI.warning({closable:!1,title:this.textWarning,msg:this.warnDownloadAs,buttons:["ok","cancel"],callback:_.bind(function(n){n=="ok"&&(this.api.asc_DownloadAs(t),e.hide(),this.leftMenu.btnFile.toggle(!1,!0))},this)}):(this.api.asc_DownloadAs(t),e.hide(),this.leftMenu.btnFile.toggle(!1,!0))},applySettings:function(e){this.api.asc_setFontRenderingMode(parseInt(Common.localStorage.getItem("sse-settings-fontrender")));var t=Common.localStorage.getItem("sse-settings-livecomment");t===null||parseInt(t)!=0?this.api.asc_showComments():this.api.asc_hideComments(),this.mode.isEdit&&!this.mode.isOffline&&this.mode.canCoAuthoring&&(t=Common.localStorage.getItem("sse-settings-coauthmode"),this.api.asc_SetFastCollaborative(t===null||parseInt(t)==1)),t=Common.localStorage.getItem("sse-settings-autosave"),this.api.asc_setAutoSaveGap(parseInt(t)),t=Common.localStorage.getItem("sse-settings-func-locale"),t&&(t=SSE.Views.FormulaLang.get(t)),t!==null&&this.api.asc_setLocalization(t),t=Common.localStorage.getItem("sse-settings-reg-settings"),t!==null&&this.api.asc_setLocale(parseInt(t)),e.hide(),this.leftMenu.btnFile.toggle(!1,!0),this.leftMenu.fireEvent("settings:apply")},onCreateNew:function(e,t){if(this.mode.nativeApp===!0)this.api.asc_openNewDocument(t=="blank"?"":t);else{var n=window.open(t=="blank"?this.mode.createUrl:t,"_blank");n&&n.focus()}e&&(e.hide(),this.leftMenu.btnFile.toggle(!1,!0))},onOpenRecent:function(e,t){e&&(e.hide(),this.leftMenu.btnFile.toggle(!1,!0));var n=window.open(t);n&&n.focus(),Common.component.Analytics.trackEvent("Open Recent")},clickToolbarSettings:function(e){this.leftMenu.btnFile.pressed&&this.leftMenu.btnFile.panel.active=="opts"?this.leftMenu.close():this.leftMenu.showMenu("file:opts")},clickStatusbarUsers:function(){this.leftMenu.btnFile.panel.panels.rights.changeAccessRights()},onHideChat:function(){$(this.leftMenu.btnChat.el).blur(),Common.NotificationCenter.trigger("layout:changed","leftmenu")},onQuerySearch:function(e,t,n){if(n.textsearch&&n.textsearch.length){var r=this.dlgSearch.findOptions;r.asc_setFindWhat(n.textsearch),r.asc_setScanForward(e!="back"),r.asc_setIsMatchCase(n.matchcase),r.asc_setIsWholeCell(n.matchword),r.asc_setScanOnOnlySheet(this.dlgSearch.menuWithin.menu.items[0].checked),r.asc_setScanByRows(this.dlgSearch.menuSearch.menu.items[0].checked),r.asc_setLookIn(this.dlgSearch.menuLookin.menu.items[0].checked?Asc.c_oAscFindLookIn.Formulas:Asc.c_oAscFindLookIn.Value);if(!this.api.asc_findText(r)){var i=this;Common.UI.info({msg:this.textNoTextFound,callback:function(){i.dlgSearch.focus()}})}}},onQueryReplace:function(e,t){if(!_.isEmpty(t.textsearch)){this.api.isReplaceAll=!1;var n=this.dlgSearch.findOptions;n.asc_setFindWhat(t.textsearch),n.asc_setReplaceWith(t.textreplace),n.asc_setIsMatchCase(t.matchcase),n.asc_setIsWholeCell(t.matchword),n.asc_setScanOnOnlySheet(this.dlgSearch.menuWithin.menu.items[0].checked),n.asc_setScanByRows(this.dlgSearch.menuSearch.menu.items[0].checked),n.asc_setLookIn(this.dlgSearch.menuLookin.menu.items[0].checked?Asc.c_oAscFindLookIn.Formulas:Asc.c_oAscFindLookIn.Value),n.asc_setIsReplaceAll(!1),this.api.asc_replaceText(n)}},onQueryReplaceAll:function(e,t){if(!_.isEmpty(t.textsearch)){this.api.isReplaceAll=!0;var n=this.dlgSearch.findOptions;n.asc_setFindWhat(t.textsearch),n.asc_setReplaceWith(t.textreplace),n.asc_setIsMatchCase(t.matchcase),n.asc_setIsWholeCell(t.matchword),n.asc_setScanOnOnlySheet(this.dlgSearch.menuWithin.menu.items[0].checked),n.asc_setScanByRows(this.dlgSearch.menuSearch.menu.items[0].checked),n.asc_setLookIn(this.dlgSearch.menuLookin.menu.items[0].checked?Asc.c_oAscFindLookIn.Formulas:Asc.c_oAscFindLookIn.Value),n.asc_setIsReplaceAll(!0),this.api.asc_replaceText(n)}},showSearchDlg:function(e,t){if(!this.dlgSearch){var n=new Common.UI.MenuItem({caption:this.textWithin,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{caption:this.textSheet,toggleGroup:"searchWithih",checkable:!0,checked:!0},{caption:this.textWorkbook,toggleGroup:"searchWithih",checkable:!0,checked:!1}]})}),r=new Common.UI.MenuItem({caption:this.textSearch,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{caption:this.textByRows,toggleGroup:"searchByrows",checkable:!0,checked:!0},{caption:this.textByColumns,toggleGroup:"searchByrows",checkable:!0,checked:!1}]})}),i=new Common.UI.MenuItem({caption:this.textLookin,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{caption:this.textFormulas,toggleGroup:"searchLookin",checkable:!0,checked:!0},{caption:this.textValues,toggleGroup:"searchLookin",checkable:!0,checked:!1}]})});this.dlgSearch=new Common.UI.SearchDialog({matchcase:!0,matchword:!0,matchwordstr:this.textItemEntireCell,markresult:!1,extraoptions:[n,r,i]}),this.dlgSearch.menuWithin=n,this.dlgSearch.menuSearch=r,this.dlgSearch.menuLookin=i,this.dlgSearch.findOptions=new Asc.asc_CFindOptions}if(e){var s=this.mode.isEdit?t||undefined:"no-replace";this.dlgSearch.isVisible()?(this.dlgSearch.setMode(s),this.dlgSearch.focus()):this.dlgSearch.show(s),this.api.asc_closeCellEditor()}else this.dlgSearch.hide()},onMenuSearch:function(e,t){this.showSearchDlg(t)},onSearchDlgHide:function(){this.leftMenu.btnSearch.toggle(!1,!0),$(this.leftMenu.btnSearch.el).blur(),this.api.asc_enableKeyEvents(!0)},onRenameText:function(e,t){var n=this;if(this.api.isReplaceAll)Common.UI.info({msg:e?!e-t?Common.Utils.String.format(this.textReplaceSuccess,t):Common.Utils.String.format(this.textReplaceSkipped,e-t):this.textNoTextFound,callback:function(){n.dlgSearch.focus()}});else{var r=this.dlgSearch.getSettings(),i=this.dlgSearch.findOptions;i.asc_setFindWhat(r.textsearch),i.asc_setScanForward(!0),i.asc_setIsMatchCase(r.matchcase),i.asc_setIsWholeCell(r.matchword),i.asc_setScanOnOnlySheet(this.dlgSearch.menuWithin.menu.items[0].checked),i.asc_setScanByRows(this.dlgSearch.menuSearch.menu.items[0].checked),i.asc_setLookIn(this.dlgSearch.menuLookin.menu.items[0].checked?Asc.c_oAscFindLookIn.Formulas:Asc.c_oAscFindLookIn.Value),n.api.asc_findText(i)||Common.UI.info({msg:this.textNoTextFound,callback:function(){n.dlgSearch.focus()}})}},onApiServerDisconnect:function(e){this.mode.isEdit=!1,this.leftMenu.close(),this.leftMenu.btnComments.setDisabled(!0),this.leftMenu.btnChat.setDisabled(!0),this.leftMenu.btnPlugins.setDisabled(!0),this.leftMenu.getMenu("file").setMode({isDisconnected:!0,disableDownload:!!e}),this.dlgSearch&&(this.leftMenu.btnSearch.toggle(!1,!0),this.dlgSearch.hide())},onApiChatMessage:function(){this.leftMenu.markCoauthOptions("chat")},onApiAddComment:function(e,t){t&&t.asc_getUserId()!==this.mode.user.id&&this.leftMenu.markCoauthOptions("comments")},onApiAddComments:function(e){for(var t=0;t<e.length;++t)if(e[t].asc_getUserId()!==this.mode.user.id){this.leftMenu.markCoauthOptions("comments");break}},commentsShowHide:function(e){if(this.api){var t=Common.localStorage.getItem("sse-settings-livecomment");t!==null&&parseInt(t)==0&&(e?this.api.asc_showComments():this.api.asc_hideComments()),e&&this.getApplication().getController("Common.Controllers.Comments").onAfterShow(),e||$(this.leftMenu.btnComments.el).blur()}},fileShowHide:function(e){this.api&&(this.api.asc_closeCellEditor(),this.api.asc_enableKeyEvents(!e),e||$(this.leftMenu.btnFile.el).blur())},aboutShowHide:function(e){this.api&&(this.api.asc_closeCellEditor(),this.api.asc_enableKeyEvents(!e),e||$(this.leftMenu.btnAbout.el).blur())},onShortcut:function(e,t){if(this.mode.isEditDiagram&&e!="escape")return!1;if(this.mode.isEditMailMerge&&e!="escape"&&e!="search")return!1;switch(e){case"replace":case"search":return this.leftMenu.btnSearch.isDisabled()||(Common.UI.Menu.Manager.hideAll(),this.showSearchDlg(!0,e),this.leftMenu.btnSearch.toggle(!0,!0),this.leftMenu.btnFile.toggle(!1),this.leftMenu.btnAbout.toggle(!1)),!1;case"save":return this.mode.canDownload&&!this.leftMenu.btnFile.isDisabled()&&(this.mode.isDesktopApp&&this.mode.isOffline?this.api.asc_DownloadAs():(Common.UI.Menu.Manager.hideAll(),this.leftMenu.showMenu("file:saveas"))),!1;case"help":return this.leftMenu.btnFile.isDisabled()||(Common.UI.Menu.Manager.hideAll(),this.api.asc_closeCellEditor(),this.leftMenu.showMenu("file:help")),!1;case"file":return this.leftMenu.btnFile.isDisabled()||(Common.UI.Menu.Manager.hideAll(),this.leftMenu.showMenu("file")),!1;case"escape":var n=SSE.getController("Statusbar"),r=n.statusbar.$el.find('.open > [data-toggle="dropdown"]');if(r.length)return $.fn.dropdown.Constructor.prototype.keydown.call(r[0],t),!1;if(this.mode.canPlugins&&this.leftMenu.panelPlugins&&this.api.isCellEdited!==!0){r=this.leftMenu.panelPlugins.$el.find('#menu-plugin-container.open > [data-toggle="dropdown"]');if(r.length)return $.fn.dropdown.Constructor.prototype.keydown.call(r[0],t),!1}if(this.leftMenu.btnFile.pressed||this.leftMenu.btnAbout.pressed||($(t.target).parents("#left-menu").length||this.leftMenu.btnPlugins.pressed||this.leftMenu.btnComments.pressed)&&this.api.isCellEdited!==!0)return this.leftMenu.close(),Common.NotificationCenter.trigger("layout:changed","leftmenu"),!1;if(this.mode.isEditDiagram||this.mode.isEditMailMerge){r=$(document.body).find(".open > .dropdown-menu");if(!this.api.isCellEdited&&!r.length)return Common.Gateway.internalMessage("shortcut",{key:"escape"}),!1}break;case"chat":return this.mode.canCoAuthoring&&this.mode.canChat&&!this.mode.isLightVersion&&(Common.UI.Menu.Manager.hideAll(),this.leftMenu.showMenu("chat")),!1;case"comments":return this.mode.canCoAuthoring&&this.mode.isEdit&&this.mode.canComments&&!this.mode.isLightVersion&&(Common.UI.Menu.Manager.hideAll(),this.leftMenu.showMenu("comments"),this.getApplication().getController("Common.Controllers.Comments").onAfterShow()),!1}},onCellsRange:function(e){var t=e!=Asc.c_oAscSelectionDialogType.None;this.leftMenu.btnFile.setDisabled(t),this.leftMenu.btnAbout.setDisabled(t),this.leftMenu.btnSearch.setDisabled(t),this.mode.canPlugins&&this.leftMenu.panelPlugins&&(this.leftMenu.panelPlugins.setLocked(t),this.leftMenu.panelPlugins.disableControls(t))},onApiEditCell:function(e){var t=e==Asc.c_oAscCellEditorState.editFormula;this.leftMenu.btnFile.setDisabled(t),this.leftMenu.btnAbout.setDisabled(t),this.leftMenu.btnSearch.setDisabled(t),this.mode.canPlugins&&this.leftMenu.panelPlugins&&(this.leftMenu.panelPlugins.setLocked(t),this.leftMenu.panelPlugins.disableControls(t))},textNoTextFound:"Text not found",newDocumentTitle:"Unnamed document",textItemEntireCell:"Entire cell contents",requestEditRightsText:"Requesting editing rights...",textReplaceSuccess:"Search has been done. {0} occurrences have been replaced",textReplaceSkipped:"The replacement has been made. {0} occurrences were skipped.",warnDownloadAs:"If you continue saving in this format all features except the text will be lost.<br>Are you sure you want to continue?",textWarning:"Warning",textSheet:"Sheet",textWorkbook:"Workbook",textByColumns:"By columns",textByRows:"By rows",textFormulas:"Formulas",textValues:"Values",textWithin:"Within",textSearch:"Search",textLookin:"Look in"},SSE.Controllers.LeftMenu||{}))});if(Common===undefined)var Common={};Common.IrregularStack=function(e){var t=[],n=function(e,t){return typeof e=="object"&&typeof t=="object"&&window.JSON?window.JSON.stringify(e)===window.JSON.stringify(t):e===t};e=e||{};var r=e.strongCompare||n,i=e.weakCompare||n,s=function(e,n){for(var r=t.length-1;r>=0;r--)if(n(t[r],e))return r;return-1},o=function(e){t.push(e)},u=function(e){var n=s(e,r);if(n!=-1){var i=t.splice(n,1);return i[0]}return undefined},a=function(e){var n=s(e,i);return n!=-1?t[n]:undefined},f=function(e){return!(s(e,r)<0)};return{push:o,pop:u,get:a,exist:f}},define("irregularstack",function(){});if(Common===undefined)var Common={};define("common/main/lib/component/LoadMask",["common/main/lib/component/BaseView"],function(){"use strict";Common.UI.LoadMask=Common.UI.BaseView.extend(function(){var e,t,n;return{options:{cls:"",style:"",title:"Loading...",owner:document.body},template:_.template(['<div id="<%= id %>" class="asc-loadmask-body <%= cls %>" role="presentation" tabindex="-1">','<div class="asc-loadmask-image"></div>','<div class="asc-loadmask-title"><%= title %></div>',"</div>"].join("")),initialize:function(e){Common.UI.BaseView.prototype.initialize.call(this,e),this.template=this.options.template||this.template,this.cls=this.options.cls,this.style=this.options.style,this.title=this.options.title,this.owner=this.options.owner},render:function(){return this},show:function(){if(t||n)return;e=this.owner instanceof Common.UI.BaseView?$(this.owner.el):$(this.owner);if(e.hasClass("masked"))return this;var r=this;return t=$('<div class="asc-loadmask"></div>'),n=$(this.template({id:r.id,cls:r.cls,style:r.style,title:r.title})),e.addClass("masked"),e.append(t),e.append(n),n.css({top:Math.round(e.height()/2-(n.height()+parseInt(n.css("padding-top"))+parseInt(n.css("padding-bottom")))/2)+"px",left:Math.round(e.width()/2-(n.width()+parseInt(n.css("padding-left"))+parseInt(n.css("padding-right")))/2)+"px"}),Common.util.Shortcuts.suspendEvents(),this},hide:function(){e&&e.removeClass("masked"),t&&t.remove(),n&&n.remove(),t=null,n=null,Common.util.Shortcuts.resumeEvents()},setTitle:function(t){this.title=t,e&&e.hasClass("masked")&&n&&$(".asc-loadmask-title",n).html(t)},isVisible:function(){return!_.isEmpty(n)}}}())});if(Common===undefined)var Common={};Common.Controllers=Common.Controllers||{},define("common/main/lib/controller/Fonts",["core","common/main/lib/collection/Fonts"],function(){"use strict";Common.Controllers.Fonts=Backbone.Controller.extend(function(){function t(t,n){var r=n.get("type")==e,i=-1,s=t.length,o,u=n.get("name");while(!r&&++i<s){o=t.at(i);if(o.get("type")!=e)break;r=o.get("name")==u}return r}function n(e,n){e.showlastused&&!t(e.store,n)}function r(e){Common.NotificationCenter.trigger("fonts:change",e)}function i(e,t){var n=[];_.each(e,function(e){var t=e.asc_getFontId();n.push({id:_.isEmpty(t)?Common.UI.getId():t,name:e.asc_getFontName(),imgidx:e.asc_getFontThumbnail(),type:e.asc_getFontType()})});var r=this.getCollection("Common.Collections.Fonts");r&&(r.add(n),r.sort()),Common.NotificationCenter.trigger("fonts:load",r,t)}var e=4;return{models:["Common.Models.Fonts"],collections:["Common.Collections.Fonts"],views:[],initialize:function(){Common.NotificationCenter.on("fonts:select",_.bind(n,this))},onLaunch:function(){},setApi:function(e){this.api=e,this.api.asc_registerCallback("asc_onInitEditorFonts",_.bind(i,this)),this.api.asc_registerCallback("asc_onFontFamily",_.bind(r,this))}}}())});if(Common===undefined)var Common={};Common.Collections=Common.Collections||{},define("common/main/lib/collection/TextArt",["backbone"],function(e){"use strict";Common.Collections.TextArt=e.Collection.extend({model:e.Model.extend({defaults:function(){return{id:Common.UI.getId(),imageUrl:null,data:null}}})})}),define("common/main/lib/view/OpenDialog",["common/main/lib/component/Window"],function(){"use strict";Common.Views.OpenDialog=Common.UI.Window.extend(_.extend({applyFunction:undefined,initialize:function(e){var t=this,n={};_.extend(n,{closable:!1,width:250,height:e.type==Asc.c_oAscAdvancedOptionsID.CSV?205:155,contentWidth:390,header:!0,cls:"open-dlg",contentTemplate:"",title:e.type==Asc.c_oAscAdvancedOptionsID.DRM?t.txtTitleProtected:t.txtTitle.replace("%1",e.type==Asc.c_oAscAdvancedOptionsID.CSV?"CSV":"TXT")},e),this.template=e.template||['<div class="box" style="height:'+(n.height-85)+'px;">','<div class="content-panel" >',"<% if (type == Asc.c_oAscAdvancedOptionsID.DRM) { %>",'<label class="header">'+t.txtPassword+"</label>",'<div id="id-password-txt" style="margin-bottom:15px;"></div>',"<% } else { %>",'<label class="header">'+t.txtEncoding+"</label>",'<div id="id-codepages-combo" class="input-group-nr" style="margin-bottom:15px;"></div>',"<% if (type == Asc.c_oAscAdvancedOptionsID.CSV) { %>",'<label class="header">'+t.txtDelimiter+"</label>",'<div id="id-delimiters-combo" class="input-group-nr" style="max-width: 110px;"></div>',"<% } %>","<% } %>","</div>","</div>",'<div class="separator horizontal"/>','<div class="footer center">','<button class="btn normal dlg-btn primary" result="ok" style="margin-right:10px;">'+t.okButtonText+"</button>","</div>"].join(""),this.handler=e.handler,this.type=e.type,this.codepages=e.codepages,this.settings=e.settings,n.tpl=_.template(this.template,n),Common.UI.Window.prototype.initialize.call(this,n)},render:function(){Common.UI.Window.prototype.render.call(this);if(this.$window){this.$window.find(".tool").hide(),this.$window.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this));if(this.type==Asc.c_oAscAdvancedOptionsID.DRM)this.inputPwd=new Common.UI.InputField({el:$("#id-password-txt"),type:"password",allowBlank:!1,validateOnBlur:!1}),this.$window.find("input").on("keypress",_.bind(this.onKeyPress,this));else{var e=this;this.initCodePages(),this.onPrimary=function(){return e.onBtnClick(),!1}}}},show:function(){Common.UI.Window.prototype.show.apply(this,arguments);if(this.type==Asc.c_oAscAdvancedOptionsID.DRM){var e=this;setTimeout(function(){e.inputPwd.cmpEl.find("input").focus()},500)}},onBtnClick:function(e){this.handler&&(this.cmbEncoding?this.handler.call(this,this.cmbEncoding.getValue(),this.cmbDelimiter?this.cmbDelimiter.getValue():null):this.handler.call(this,this.inputPwd.getValue())),this.close()},onKeyPress:function(e){e.keyCode==Common.UI.Keys.RETURN&&this.onBtnClick()},initCodePages:function(){var e,t,n,r=[],i=[],s=0;if(this.codepages){r=[];for(e=0;e<this.codepages.length;++e)n=this.codepages[e],t=[],t[0]=n.asc_getCodePage(),t[1]=n.asc_getCodePageName(),r.push(t)}else r=[[37,"IBM EBCDIC (US-Canada)"],[437,"OEM United States"],[500,"IBM EBCDIC (International)"],[708,"Arabic (ASMO 708)"],[720,"Arabic (DOS)"],[737,"Greek (DOS)"],[775,"Baltic (DOS)"],[850,"Western European (DOS)"],[852,"Central European (DOS)"],[855,"OEM Cyrillic"],[857,"Turkish (DOS)"],[858,"OEM Multilingual Latin I"],[860,"Portuguese (DOS)"],[861,"Icelandic (DOS)"],[862,"Hebrew (DOS)"],[863,"French Canadian (DOS)"],[864,"Arabic (864) "],[865,"Nordic (DOS)"],[866,"Cyrillic (DOS)"],[869,"Greek, Modern (DOS)"],[870,"IBM EBCDIC (Multilingual Latin-2)"],[874,"Thai (Windows)"],[875,"IBM EBCDIC (Greek Modern)"],[932,"Japanese (Shift-JIS)"],[936,"Chinese Simplified (GB2312)"],[949,"Korean"],[950,"Chinese Traditional (Big5)"],[1026,"IBM EBCDIC (Turkish Latin-5)"],[1047,"IBM Latin-1"],[1140,"IBM EBCDIC (US-Canada-Euro)"],[1141,"IBM EBCDIC (Germany-Euro)"],[1142,"IBM EBCDIC (Denmark-Norway-Euro)"],[1143,"IBM EBCDIC (Finland-Sweden-Euro)"],[1144,"IBM EBCDIC (Italy-Euro)"],[1145,"IBM EBCDIC (Spain-Euro)"],[1146,"IBM EBCDIC (UK-Euro)"],[1147,"IBM EBCDIC (France-Euro)"],[1148,"IBM EBCDIC (International-Euro)"],[1149,"IBM EBCDIC (Icelandic-Euro)"],[1200,"Unicode"],[1201,"Unicode (Big-Endian)"],[1250,"Central European (Windows)"],[1251,"Cyrillic (Windows)"],[1252,"Western European (Windows)"],[1253,"Greek (Windows)"],[1254,"Turkish (Windows)"],[1255,"Hebrew (Windows) "],[1256,"Arabic (Windows) "],[1257,"Baltic (Windows)"],[1258,"Vietnamese (Windows)"],[1361,"Korean (Johab)"],[1e4,"Western European (Mac)"],[10001,"Japanese (Mac)"],[10002,"Chinese Traditional (Mac)"],[10003,"Korean (Mac)"],[10004,"Arabic (Mac) "],[10005,"Hebrew (Mac)"],[10006,"Greek (Mac) "],[10007,"Cyrillic (Mac)"],[10008,"Chinese Simplified (Mac)"],[10010,"Romanian (Mac)"],[10017,"Ukrainian (Mac)"],[10021,"Thai (Mac)"],[10029,"Central European (Mac) "],[10079,"Icelandic (Mac)"],[10081,"Turkish (Mac)"],[10082,"Croatian (Mac)"],[12e3,"Unicode (UTF-32)"],[12001,"Unicode (UTF-32 Big-Endian)"],[2e4,"Chinese Traditional (CNS)"],[20001,"TCA Taiwan"],[20002,"Chinese Traditional (Eten)"],[20003,"IBM5550 Taiwan"],[20004,"TeleText Taiwan"],[20005,"Wang Taiwan"],[20105,"Western European (IA5)"],[20106,"German (IA5)"],[20107,"Swedish (IA5) "],[20108,"Norwegian (IA5) "],[20127,"US-ASCII"],[20261,"T.61 "],[20269,"ISO-6937"],[20273,"IBM EBCDIC (Germany)"],[20277,"IBM EBCDIC (Denmark-Norway) "],[20278,"IBM EBCDIC (Finland-Sweden)"],[20280,"IBM EBCDIC (Italy)"],[20284,"IBM EBCDIC (Spain)"],[20285,"IBM EBCDIC (UK)"],[20290,"IBM EBCDIC (Japanese katakana)"],[20297,"IBM EBCDIC (France)"],[20420,"IBM EBCDIC (Arabic)"],[20423,"IBM EBCDIC (Greek)"],[20424,"IBM EBCDIC (Hebrew)"],[20833,"IBM EBCDIC (Korean Extended)"],[20838,"IBM EBCDIC (Thai)"],[20866,"Cyrillic (KOI8-R)"],[20871,"IBM EBCDIC (Icelandic) "],[20880,"IBM EBCDIC (Cyrillic Russian)"],[20905,"IBM EBCDIC (Turkish)"],[20924,"IBM Latin-1 "],[20932,"Japanese (JIS 0208-1990 and 0212-1990)"],[20936,"Chinese Simplified (GB2312-80) "],[20949,"Korean Wansung "],[21025,"IBM EBCDIC (Cyrillic Serbian-Bulgarian)"],[21866,"Cyrillic (KOI8-U)"],[28591,"Western European (ISO) "],[28592,"Central European (ISO)"],[28593,"Latin 3 (ISO)"],[28594,"Baltic (ISO)"],[28595,"Cyrillic (ISO) "],[28596,"Arabic (ISO)"],[28597,"Greek (ISO) "],[28598,"Hebrew (ISO-Visual)"],[28599,"Turkish (ISO)"],[28603,"Estonian (ISO)"],[28605,"Latin 9 (ISO)"],[29001,"Europa"],[38598,"Hebrew (ISO-Logical)"],[50220,"Japanese (JIS)"],[50221,"Japanese (JIS-Allow 1 byte Kana) "],[50222,"Japanese (JIS-Allow 1 byte Kana - SO/SI)"],[50225,"Korean (ISO)"],[50227,"Chinese Simplified (ISO-2022)"],[51932,"Japanese (EUC)"],[51936,"Chinese Simplified (EUC) "],[51949,"Korean (EUC)"],[52936,"Chinese Simplified (HZ)"],[54936,"Chinese Simplified (GB18030)"],[57002,"ISCII Devanagari "],[57003,"ISCII Bengali "],[57004,"ISCII Tamil"],[57005,"ISCII Telugu "],[57006,"ISCII Assamese "],[57007,"ISCII Oriya"],[57008,"ISCII Kannada"],[57009,"ISCII Malayalam "],[57010,"ISCII Gujarati"],[57011,"ISCII Punjabi"],[65e3,"Unicode (UTF-7)"],[65001,"Unicode (UTF-8)"]];s=r.length;if(s){for(e=0;e<s;++e)i.push({value:r[e][0],displayValue:r[e][1]});this.cmbEncoding=new Common.UI.ComboBox({el:$("#id-codepages-combo",this.$window),menuStyle:"min-width: 218px; max-height: 200px;",cls:"input-group-nr",menuCls:"scrollable-menu",data:i,editable:!1}),this.cmbEncoding.setValue(this.settings&&this.settings.asc_getCodePage()?this.settings.asc_getCodePage():r[0][0]),this.type==Asc.c_oAscAdvancedOptionsID.CSV&&(this.cmbDelimiter=new Common.UI.ComboBox({el:$("#id-delimiters-combo",this.$window),menuStyle:"min-width: 110px;",cls:"input-group-nr",data:[{value:4,displayValue:","},{value:2,displayValue:";"},{value:3,displayValue:":"},{value:1,displayValue:this.txtTab},{value:5,displayValue:this.txtSpace}],editable:!1}),this.cmbDelimiter.setValue(this.settings&&this.settings.asc_getDelimiter()?this.settings.asc_getDelimiter():4))}},okButtonText:"OK",cancelButtonText:"Cancel",txtDelimiter:"Delimiter",txtEncoding:"Encoding ",txtSpace:"Space",txtTab:"Tab",txtTitle:"Choose %1 options",txtPassword:"Password",txtTitleProtected:"Protected File"},Common.Views.OpenDialog||{}))});if(Common===undefined)var Common={};Common.util=Common.util||{},Common.util.LanguageInfo=new function(){var e={54:["af","Afrikaans"],1078:["af-ZA","Afrikaans (Suid Afrika)"],28:["sq","Shqipe"],1052:["sq-AL","Shqipe (Shqipëria)"],132:["gsw","Elsässisch"],1156:["gsw-FR","Elsässisch (Frànkrisch)"],94:["am","አማርኛ"],1118:["am-ET","አማርኛ (ኢትዮጵያ)"],1:["ar","العربية"],5121:["ar-DZ","العربية (الجزائر)"],15361:["ar-BH","العربية (البحرين)"],3073:["ar-EG","العربية (مصر)"],2049:["ar-IQ","العربية (العراق)"],11265:["ar-JO","العربية (الأردن)"],13313:["ar-KW","العربية (الكويت)"],12289:["ar-LB","العربية (لبنان)"],4097:["ar-LY","العربية (ليبيا)"],6145:["ar-MA","العربية (المملكة المغربية)"],8193:["ar-OM","العربية (عمان)"],16385:["ar-QA","العربية (قطر)"],1025:["ar-SA","العربية (المملكة العربية السعودية)"],10241:["ar-SY","العربية (سوريا)"],7169:["ar-TN","العربية (تونس)"],14337:["ar-AE","العربية (الإمارات العربية المتحدة)"],9217:["ar-YE","العربية (اليمن)"],43:["hy","Հայերեն"],1067:["hy-AM","Հայերեն (Հայաստան)"],77:["as","অসমীয়া"],1101:["as-IN","অসমীয়া (ভাৰত)"],44:["az","Azərbaycanılı"],29740:["az-Cyrl","Азәрбајҹан дили"],2092:["az-Cyrl-AZ","Азәрбајҹан (Азәрбајҹан)"],30764:["az-Latn","Azərbaycanılı"],1068:["az-Latn-AZ","Azərbaycanılı (Azərbaycan)"],109:["ba","Башҡорт"],1133:["ba-RU","Башҡорт (Россия)"],45:["eu","Euskara"],1069:["eu-ES","Euskara (Euskara)"],35:["be","Беларускі"],1059:["be-BY","Беларускі (Беларусь)"],69:["bn","বাংলা"],2117:["bn-BD","বাংলা (বাংলাদেশ)"],1093:["bn-IN","বাংলা (ভারত)"],30746:["bs","bosanski"],25626:["bs-Cyrl","Босански (Ћирилица)"],8218:["bs-Cyrl-BA","Босански (Босна и Херцеговина)"],26650:["bs-Latn","Bosanski (Latinica)"],5146:["bs-Latn-BA","Bosanski (Bosna i Hercegovina)"],126:["br","Brezhoneg"],1150:["br-FR","Brezhoneg (Frañs)"],2:["bg","Български"],1026:["bg-BG","Български (България)"],3:["ca","Català"],1027:["ca-ES","Català (Català)"],2051:["ca-ES-valencia","Català (Valencià)"],30724:["zh","中文"],4:["zh-Hans","中文(简体)"],2052:["zh-CN","中文(中华人民共和国)"],4100:["zh-SG","中文(新加坡)"],31748:["zh-Hant","中文(繁體)"],3076:["zh-HK","中文(香港特別行政區)"],5124:["zh-MO","中文(澳門特別行政區)"],1028:["zh-TW","中文(台灣)"],131:["co","Corsu"],1155:["co-FR","Corsu (France)"],26:["hr","Hrvatski"],1050:["hr-HR","Hrvatski (Hrvatska)"],4122:["hr-BA","Hrvatski (Bosna i Hercegovina)"],5:["cs","Čeština"],1029:["cs-CZ","Čeština (Česká republika)"],6:["da","Dansk"],1030:["da-DK","Dansk (Danmark)"],140:["prs","درى"],1164:["prs-AF","درى (افغانستان)"],101:["dv","ދިވެހިބަސް"],1125:["dv-MV","ދިވެހިބަސް (ދިވެހި ރާއްޖެ)"],19:["nl","Nederlands"],2067:["nl-BE","Nederlands (België)"],1043:["nl-NL","Nederlands (Nederland)"],9:["en","English"],3081:["en-AU","English (Australia)"],10249:["en-BZ","English (Belize)"],4105:["en-CA","English (Canada)"],9225:["en-029","English (Caribbean)"],16393:["en-IN","English (India)"],6153:["en-IE","English (Ireland)"],8201:["en-JM","English (Jamaica)"],17417:["en-MY","English (Malaysia)"],5129:["en-NZ","English (New Zealand)"],13321:["en-PH","English (Philippines)"],18441:["en-SG","English (Singapore)"],7177:["en-ZA","English (South Africa)"],11273:["en-TT","English (Trinidad y Tobago)"],2057:["en-GB","English (United Kingdom)"],1033:["en-US","English (United States)"],12297:["en-ZW","English (Zimbabwe)"],37:["et","Eesti"],1061:["et-EE","Eesti (Eesti)"],56:["fo","Føroyskt"],1080:["fo-FO","Føroyskt (Føroyar)"],100:["fil","Filipino"],1124:["fil-PH","Filipino (Pilipinas)"],11:["fi","Suomi"],1035:["fi-FI","Suomi (Suomi)"],12:["fr","Français"],2060:["fr-BE","Français (Belgique)"],3084:["fr-CA","Français (Canada)"],1036:["fr-FR","Français (France)"],5132:["fr-LU","Français (Luxembourg)"],6156:["fr-MC","Français (Principauté de Monaco)"],4108:["fr-CH","Français (Suisse)"],98:["fy","Frysk"],1122:["fy-NL","Frysk (Nederlân)"],86:["gl","Galego"],1110:["gl-ES","Galego (Galego)"],55:["ka","ქართული"],1079:["ka-GE","ქართული (საქართველო)"],7:["de","Deutsch"],3079:["de-AT","Deutsch (Österreich)"],1031:["de-DE","Deutsch (Deutschland)"],5127:["de-LI","Deutsch (Liechtenstein)"],4103:["de-LU","Deutsch (Luxemburg)"],2055:["de-CH","Deutsch (Schweiz)"],8:["el","Ελληνικά"],1032:["el-GR","Ελληνικά (Ελλάδα)"],111:["kl","Kalaallisut"],1135:["kl-GL","Kalaallisut (Kalaallit Nunaat)"],71:["gu","ગુજરાતી"],1095:["gu-IN","ગુજરાતી (ભારત)"],104:["ha","Hausa"],31848:["ha-Latn","Hausa (Latin)"],1128:["ha-Latn-NG","Hausa (Nigeria)"],13:["he","עברית"],1037:["he-IL","עברית (ישראל)"],57:["hi","हिंदी"],1081:["hi-IN","हिंदी (भारत)"],14:["hu","Magyar"],1038:["hu-HU","Magyar (Magyarország)"],15:["is","Íslenska"],1039:["is-IS","Íslenska (Ísland)"],112:["ig","Igbo"],1136:["ig-NG","Igbo (Nigeria)"],33:["id","Bahasa Indonesia"],1057:["id-ID","Bahasa Indonesia (Indonesia)"],93:["iu","Inuktitut"],31837:["iu-Latn","Inuktitut (Qaliujaaqpait)"],2141:["iu-Latn-CA","Inuktitut"],30813:["iu-Cans","ᐃᓄᒃᑎᑐᑦ (ᖃᓂᐅᔮᖅᐸᐃᑦ)"],1117:["iu-Cans-CA","ᐃᓄᒃᑎᑐᑦ (ᑲᓇᑕᒥ)"],60:["ga","Gaeilge"],2108:["ga-IE","Gaeilge (Éire)"],52:["xh","isiXhosa"],1076:["xh-ZA","isiXhosa (uMzantsi Afrika)"],53:["zu","isiZulu"],1077:["zu-ZA","isiZulu (iNingizimu Afrika)"],16:["it","Italiano"],1040:["it-IT","Italiano (Italia)"],2064:["it-CH","Italiano (Svizzera)"],17:["ja","日本語"],1041:["ja-JP","日本語 (日本)"],75:["kn","ಕನ್ನಡ"],1099:["kn-IN","ಕನ್ನಡ (ಭಾರತ)"],63:["kk","Қазақ"],1087:["kk-KZ","Қазақ (Қазақстан)"],83:["km","ខ្មែរ"],1107:["km-KH","ខ្មែរ (កម្ពុជា)"],134:["qut","K'iche"],1158:["qut-GT","K'iche (Guatemala)"],135:["rw","Kinyarwanda"],1159:["rw-RW","Kinyarwanda (Rwanda)"],65:["sw","Kiswahili"],1089:["sw-KE","Kiswahili (Kenya)"],87:["kok","कोंकणी"],1111:["kok-IN","कोंकणी (भारत)"],18:["ko","한국어"],1042:["ko-KR","한국어 (대한민국)"],64:["ky","Кыргыз"],1088:["ky-KG","Кыргыз (Кыргызстан)"],84:["lo","ລາວ"],1108:["lo-LA","ລາວ (ສ.ປ.ປ. ລາວ)"],38:["lv","Latviešu"],1062:["lv-LV","Latviešu (Latvija)"],39:["lt","Lietuvių"],1063:["lt-LT","Lietuvių (Lietuva)"],31790:["dsb","Dolnoserbšćina"],2094:["dsb-DE","Dolnoserbšćina (Nimska)"],110:["lb","Lëtzebuergesch"],1134:["lb-LU","Lëtzebuergesch (Luxembourg)"],1071:["mk-MK","Македонски јазик (Македонија)"],47:["mk","Македонски јазик"],62:["ms","Bahasa Melayu"],2110:["ms-BN","Bahasa Melayu (Brunei Darussalam)"],1086:["ms-MY","Bahasa Melayu (Malaysia)"],76:["ml","മലയാളം"],1100:["ml-IN","മലയാളം (ഭാരതം)"],58:["mt","Malti"],1082:["mt-MT","Malti (Malta)"],129:["mi","Reo Māori"],1153:["mi-NZ","Reo Māori (Aotearoa)"],122:["arn","Mapudungun"],1146:["arn-CL","Mapudungun (Chile)"],78:["mr","मराठी"],1102:["mr-IN","मराठी (भारत)"],124:["moh","Kanien'kéha"],1148:["moh-CA","Kanien'kéha"],80:["mn","Монгол хэл"],30800:["mn-Cyrl","Монгол хэл"],1104:["mn-MN","Монгол хэл (Монгол улс)"],31824:["mn-Mong","ᠮᠤᠨᠭᠭᠤᠯ ᠬᠡᠯᠡ"],2128:["mn-Mong-CN","ᠮᠤᠨᠭᠭᠤᠯ ᠬᠡᠯᠡ (ᠪᠦᠭᠦᠳᠡ ᠨᠠᠢᠷᠠᠮᠳᠠᠬᠤ ᠳᠤᠮᠳᠠᠳᠤ ᠠᠷᠠᠳ ᠣᠯᠣᠰ)"],97:["ne","नेपाली"],1121:["ne-NP","नेपाली (नेपाल)"],20:["no","Norsk"],31764:["nb","Norsk (bokmål)"],30740:["nn","Norsk (Nynorsk)"],1044:["nb-NO","Norsk, bokmål (Norge)"],2068:["nn-NO","Norsk, nynorsk (Noreg)"],130:["oc","Occitan"],1154:["oc-FR","Occitan (França)"],72:["or","ଓଡ଼ିଆ"],1096:["or-IN","ଓଡ଼ିଆ (ଭାରତ)"],99:["ps","پښتو"],1123:["ps-AF","پښتو (افغانستان)"],41:["fa","فارسى"],1065:["fa-IR","فارسى (ایران)"],21:["pl","Polski"],1045:["pl-PL","Polski (Polska)"],22:["pt","Português"],1046:["pt-BR","Português (Brasil)"],2070:["pt-PT","Português (Portugal)"],70:["pa","ਪੰਜਾਬੀ"],1094:["pa-IN","ਪੰਜਾਬੀ (ਭਾਰਤ)"],107:["quz","Runasimi"],1131:["quz-BO","Runasimi (Qullasuyu)"],2155:["quz-EC","Runasimi (Ecuador)"],3179:["quz-PE","Runasimi (Piruw)"],24:["ro","Română"],1048:["ro-RO","Română (România)"],23:["rm","Rumantsch"],1047:["rm-CH","Rumantsch (Svizra)"],25:["ru","Русский"],1049:["ru-RU","Русский (Россия)"],28731:["smn","Sämikielâ"],31803:["smj","Julevusámegiella"],59:["se","Davvisámegiella"],29755:["sms","Sääm´ǩiõll"],30779:["sma","åarjelsaemiengiele"],9275:["smn-FI","Sämikielâ (Suomâ)"],4155:["smj-NO","Julevusámegiella (Vuodna)"],5179:["smj-SE","Julevusámegiella (Svierik)"],3131:["se-FI","Davvisámegiella (Suopma)"],1083:["se-NO","Davvisámegiella (Norga)"],2107:["se-SE","Davvisámegiella (Ruoŧŧa)"],8251:["sms-FI","Sääm´ǩiõll (Lää´ddjânnam)"],6203:["sma-NO","åarjelsaemiengiele (Nöörje)"],7227:["sma-SE","åarjelsaemiengiele (Sveerje)"],79:["sa","संस्कृत"],1103:["sa-IN","संस्कृत (भारतम्)"],145:["gd","Gàidhlig"],1169:["gd-GB","Gàidhlig (An Rìoghachd Aonaichte)"],31770:["sr","Srpski"],27674:["sr-Cyrl","Српски (Ћирилица)"],7194:["sr-Cyrl-BA","Српски (Босна и Херцеговина)"],12314:["sr-Cyrl-ME","Српски (Црна Гора)"],3098:["sr-Cyrl-CS","Српски (Србија и Црна Гора (Претходно))"],10266:["sr-Cyrl-RS","Српски (Србија)"],28698:["sr-Latn","Srpski (Latinica)"],6170:["sr-Latn-BA","Srpski (Bosna i Hercegovina)"],11290:["sr-Latn-ME","Srpski (Crna Gora)"],2074:["sr-Latn-CS","Srpski (Srbija i Crna Gora (Prethodno))"],9242:["sr-Latn-RS","Srpski (Srbija, Latinica)"],108:["nso","Sesotho sa Leboa"],1132:["nso-ZA","Sesotho sa Leboa (Afrika Borwa)"],50:["tn","Setswana"],1074:["tn-ZA","Setswana (Aforika Borwa)"],91:["si","සිංහ"],1115:["si-LK","සිංහ (ශ්රී ලංකා)"],27:["sk","Slovenčina"],1051:["sk-SK","Slovenčina (Slovenská republika)"],36:["sl","Slovenski"],1060:["sl-SI","Slovenski (Slovenija)"],10:["es","Español"],11274:["es-AR","Español (Argentina)"],16394:["es-BO","Español (Bolivia)"],13322:["es-CL","Español (Chile)"],9226:["es-CO","Español (Colombia)"],5130:["es-CR","Español (Costa Rica)"],7178:["es-DO","Español (República Dominicana)"],12298:["es-EC","Español (Ecuador)"],17418:["es-SV","Español (El Salvador)"],4106:["es-GT","Español (Guatemala)"],18442:["es-HN","Español (Honduras)"],2058:["es-MX","Español (México)"],19466:["es-NI","Español (Nicaragua)"],6154:["es-PA","Español (Panamá)"],15370:["es-PY","Español (Paraguay)"],10250:["es-PE","Español (Perú)"],20490:["es-PR","Español (Puerto Rico)"],3082:["es-ES","Español (España, alfabetización internacional)"],21514:["es-US","Español (Estados Unidos)"],14346:["es-UY","Español (Uruguay)"],8202:["es-VE","Español (Republica Bolivariana de Venezuela)"],29:["sv","Svenska"],2077:["sv-FI","Svenska (Finland)"],1053:["sv-SE","Svenska (Sverige)"],90:["syr","ܣܘܪܝܝܐ"],1114:["syr-SY","ܣܘܪܝܝܐ (سوريا)"],40:["tg","Тоҷикӣ"],31784:["tg-Cyrl","Тоҷикӣ"],1064:["tg-Cyrl-TJ","Тоҷикӣ (Тоҷикистон)"],95:["tzm","Tamazight"],31839:["tzm-Latn","Tamazight (Latin)"],2143:["tzm-Latn-DZ","Tamazight (Djazaïr)"],73:["ta","தமிழ்"],1097:["ta-IN","தமிழ் (இந்தியா)"],68:["tt","Татар"],1092:["tt-RU","Татар (Россия)"],74:["te","తెలుగు"],1098:["te-IN","తెలుగు (భారత దేశం)"],30:["th","ไทย"],1054:["th-TH","ไทย (ไทย)"],81:["bo","བོད་ཡིག"],1105:["bo-CN","བོད་ཡིག (ཀྲུང་ཧྭ་མི་དམངས་སྤྱི་མཐུན་རྒྱལ་ཁབ།)"],31:["tr","Türkçe"],1055:["tr-TR","Türkçe (Türkiye)"],66:["tk","Türkmençe"],1090:["tk-TM","Türkmençe (Türkmenistan)"],34:["uk","Українська"],1058:["uk-UA","Українська (Україна)"],46:["hsb","Hornjoserbšćina"],1070:["hsb-DE","Hornjoserbšćina (Němska)"],32:["ur","اُردو"],1056:["ur-PK","اُردو (پاکستان)"],128:["ug","ئۇيغۇر يېزىقى"],1152:["ug-CN","(ئۇيغۇر يېزىقى (جۇڭخۇا خەلق جۇمھۇرىيىتى"],30787:["uz-Cyrl","Ўзбек"],2115:["uz-Cyrl-UZ","Ўзбек (Ўзбекистон)"],67:["uz","U'zbek"],31811:["uz-Latn","U'zbek"],1091:["uz-Latn-UZ","U'zbek (U'zbekiston Respublikasi)"],42:["vi","Tiếng Việt"],1066:["vi-VN","Tiếng Việt (Việt Nam)"],82:["cy","Cymraeg"],1106:["cy-GB","Cymraeg (y Deyrnas Unedig)"],136:["wo","Wolof"],1160:["wo-SN","Wolof (Sénégal)"],133:["sah","Саха"],1157:["sah-RU","Саха (Россия)"],120:["ii","ꆈꌠꁱꂷ"],1144:["ii-CN","ꆈꌠꁱꂷ (ꍏꉸꏓꂱꇭꉼꇩ)"],106:["yo","Yoruba"],1130:["yo-NG","Yoruba (Nigeria)"],2129:["bo-BT","Tibetan, Bhutan"],1126:["bin-NG","Bini, Nigeria"],1116:["chr-US","Cherokee, United States"],15369:["en-HK","English, Hong Kong"],14345:["en-ID","English, Indonesia"],1034:["es-ES_tradnl","Spanish"],15372:["fr-HT","French, Haiti"],9228:["fr-CG","French, Congo"],12300:["fr-CI","French, Cote d'Ivoire"],11276:["fr-CM","French, Cameroon"],14348:["fr-MA","French, Morocco"],13324:["fr-ML","French, Mali"],8204:["fr-RE","French, Reunion"],10252:["fr-SN","French, Senegal"],7180:["fr-West","French"],1127:["fuv-NG","Nigerian Fulfulde, Nigeria"],1138:["gaz-ET","West Central Oromo, Ethiopia"],1140:["gn-PY","Guarani, Paraguay"],1141:["haw-US","Hawaiian, UnitedStates"],1129:["ibb-NG","Ibibio, Nigeria"],1137:["kr-NG","Kanuri, Nigeria"],1112:["mni","Manipuri"],1109:["my-MM","Burmese, Myanmar"],2145:["ne-IN","Nepali, India"],1145:["pap-AN","Papiamento, Netherlands Antilles"],2118:["pa-PK","Panjabi, Pakistan"],1165:["plt-MG","Plateau Malagasy, Madagascar"],2072:["ro-MO","Romanian, Macao"],2073:["ru-MO","Russian, Macao"],1113:["sd-IN","Sindhi, India"],2137:["sd-PK","Sindhi, Pakistan"],1143:["so-SO","Somali, Somalia"],1072:["st-ZA","Southern Sotho, South Africa"],1139:["ti-ER","Tigrinya, Eritrea"],2163:["ti-ET","Tigrinya, Ethiopia"],1119:["tmz","Tamanaku"],3167:["tmz-MA","Tamanaku, Morocco"],1073:["ts-ZA","Tsonga, South Africa"],2080:["ur-IN","Urdu, India"],1075:["ven-ZA","South Africa"]};return{getLocalLanguageName:function(t){return e[t]||["",t]},getLocalLanguageCode:function(t){for(var n in e)if(e[n][0].toLowerCase()===t.toLowerCase())return n;return null}}},define("common/main/lib/util/LanguageInfo",function(){}),define("common/main/lib/util/LocalStorage",["gateway"],function(){Common.localStorage=new function(){var e,t,n={},r=function(e){e.type=="localstorage"&&(n=e.keys)};Common.Gateway.on("internalcommand",r);var i=function(){a||Common.Gateway.internalMessage("localstorage",{cmd:"get",keys:t})},s=function(){a||Common.Gateway.internalMessage("localstorage",{cmd:"set",keys:n})},o=function(e,t,r){a?localStorage.setItem(e,t):(n[e]=t,r===!0&&Common.Gateway.internalMessage("localstorage",{cmd:"set",keys:{name:t}}))},u=function(e){return a?localStorage.getItem(e):n[e]===undefined?null:n[e]};try{var a=!!window.localStorage}catch(f){a=!1}return{getId:function(){return e},setId:function(t){e=t},getItem:u,setItem:o,setKeysFilter:function(e){t=e},sync:i,save:s}}}),define("spreadsheeteditor/main/app/model/ShapeGroup",["backbone"],function(e){"use strict";SSE.Models=SSE.Models||{},SSE.Models.ShapeModel=e.Model.extend({defaults:function(){return{id:Common.UI.getId(),imageUrl:null,data:null}}}),SSE.Models.ShapeGroup=e.Model.extend({defaults:function(){return{id:Common.UI.getId(),groupName:null,groupId:null,groupStore:null}}})}),define("spreadsheeteditor/main/app/collection/ShapeGroups",["backbone","spreadsheeteditor/main/app/model/ShapeGroup"],function(e){"use strict";if(t===undefined)var t={};t.Collections=t.Collections||{},SSE.Collections.ShapeGroups=e.Collection.extend({model:SSE.Models.ShapeGroup})}),define("spreadsheeteditor/main/app/model/EquationGroup",["backbone"],function(e){"use strict";SSE.Models=SSE.Models||{},SSE.Models.EquationModel=e.Model.extend({defaults:function(){return{id:Common.UI.getId(),data:null,width:0,height:0,posX:0,posY:0}}}),SSE.Models.EquationGroup=e.Model.extend({defaults:function(){return{id:Common.UI.getId(),groupName:null,groupId:null,groupStore:null}}})}),define("spreadsheeteditor/main/app/collection/EquationGroups",["backbone","spreadsheeteditor/main/app/model/EquationGroup"],function(e){"use strict";if(t===undefined)var t={};t.Collections=t.Collections||{},SSE.Collections.EquationGroups=e.Collection.extend({model:SSE.Models.EquationGroup})}),define("spreadsheeteditor/main/app/model/Formula",["backbone"],function(e){"use strict";SSE.Models=SSE.Models||{},SSE.Models.FormulaModel=e.Model.extend({defaults:function(){return{id:Common.UI.getId(),index:0,group:null,name:null,args:null}}}),SSE.Models.FormulaGroup=e.Model.extend({defaults:function(){return{id:Common.UI.getId(),index:0,name:null,store:null,functions:[]}}})}),define("spreadsheeteditor/main/app/collection/FormulaGroups",["backbone","spreadsheeteditor/main/app/model/Formula"],function(e){"use strict";SSE.Collections=SSE.Collections||{},SSE.Collections.FormulaGroups=e.Collection.extend({model:SSE.Models.FormulaGroup})}),define("spreadsheeteditor/main/app/view/FormulaDialog",["common/main/lib/component/Window","spreadsheeteditor/main/app/collection/FormulaGroups"],function(){"use strict";SSE.Views=SSE.Views||{},SSE.Views.FormulaDialog=Common.UI.Window.extend(_.extend({applyFunction:undefined,initialize:function(e){var t=this,n={};_.extend(n,{width:310,height:490,contentWidth:390,header:!0,cls:"formula-dlg",contentTemplate:"",title:t.txtTitle,items:[]},e),this.template=e.template||['<div class="box" style="height:'+(n.height-85)+'px;">','<div class="content-panel" >','<label class="header">'+t.textGroupDescription+"</label>",'<div id="formula-dlg-combo-group" class="input-group-nr" style="margin-top: 10px"/>','<label class="header" style="margin-top:10px">'+t.textListDescription+"</label>",'<div id="formula-dlg-combo-functions" class="combo-functions"/>','<label id="formula-dlg-args" style="margin-top: 7px"></label>','<label id="formula-dlg-desc" style="margin-top: 4px"></label>',"</div>","</div>",'<div class="separator horizontal"/>','<div class="footer center">','<button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px;">'+t.okButtonText+"</button>",'<button class="btn normal dlg-btn" result="cancel">'+t.cancelButtonText+"</button>","</div>"].join(""),this.api=e.api,this.formulasGroups=e.formulasGroups,this.handler=e.handler,n.tpl=_.template(this.template,n),Common.UI.Window.prototype.initialize.call(this,n)},render:function(){Common.UI.Window.prototype.render.call(this),this.$window.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this)),this.syntaxLabel=$("#formula-dlg-args"),this.descLabel=$("#formula-dlg-desc"),this.translationTable={};var e="",t="",n=["All","Cube","Database","DateAndTime","Engineering","Financial","Information","Logical","LookupAndReference","Mathematic","Statistical","TextAndData"];for(var r=0;r<n.length;r++)e=n[r],t="sCategory"+e,this.translationTable[e]={en:this[t],de:this[t+"_de"],ru:this[t+"_ru"]};this.fillFormulasGroups(),this.fillFunctions("All")},show:function(){if(this.$window){var e,t,n,r,i=this.initConfig.height;window.innerHeight===undefined?(e=document.documentElement.offsetWidth,t=document.documentElement.offsetHeight):(e=Common.Utils.innerWidth(),t=Common.Utils.innerHeight()),n=(parseInt(t,10)-parseInt(i,10))/2*.9,r=(parseInt(e,10)-parseInt(this.initConfig.width,10))/2,this.$window.css("left",Math.floor(r)),this.$window.css("top",Math.floor(n))}Common.UI.Window.prototype.show.call(this),this.mask=$(".modals-mask"),this.mask.on("mousedown",_.bind(this.onUpdateFocus,this)),this.$window.on("mousedown",_.bind(this.onUpdateFocus,this)),this.cmbListFunctions&&_.delay(function(e){e.cmbListFunctions.$el.find(".listview").focus()},100,this)},hide:function(){this.mask.off("mousedown",_.bind(this.onUpdateFocus,this)),this.$window.off("mousedown",_.bind(this.onUpdateFocus,this)),Common.UI.Window.prototype.hide.call(this)},onBtnClick:function(e){"ok"===e.currentTarget.attributes.result.value&&this.handler&&this.handler.call(this,this.applyFunction),this.hide()},onDblClickFunction:function(){this.handler&&this.handler.call(this,this.applyFunction),this.hide()},onSelectGroup:function(e,t){!_.isUndefined(t)&&!_.isUndefined(t.value)&&t.value<this.formulasGroups.length&&this.fillFunctions(this.formulasGroups.at(t.value).get("name")),this.onUpdateFocus()},onSelectFunction:function(e,t,n){var r,i,s;this.formulasGroups&&(r=n.get("id"),_.isUndefined(r)||(i=this.formulasGroups.at(0).get("functions"),i&&(s=_.find(i,function(e){return e.get("index")===r?e:null}),s&&(this.applyFunction=s.get("name"),this.syntaxLabel.text(this.applyFunction+s.get("args")),this.descLabel.text(s.get("desc"))))))},onPrimary:function(e,t,n){this.handler&&this.handler.call(this,this.applyFunction),this.hide()},onUpdateFocus:function(){_.delay(function(e){e.cmbListFunctions.$el.find(".listview").focus()},100,this)},fillFormulasGroups:function(){if(this.formulasGroups){var e=Common.localStorage.getItem("sse-settings-func-locale");_.isEmpty(e)&&(e="en");var t,n=[],r=this.formulasGroups.length;for(t=0;t<r;++t)this.formulasGroups.at(t).get("functions").length&&n.push({value:this.formulasGroups.at(t).get("index"),displayValue:this.translationTable[this.formulasGroups.at(t).get("name")][e]});this.cmbFuncGroup?this.cmbFuncGroup.setData(n):(this.cmbFuncGroup=new Common.UI.ComboBox({el:$("#formula-dlg-combo-group"),menuStyle:"min-width: 268px;",cls:"input-group-nr",data:n,editable:!1}),this.cmbFuncGroup.on("selected",_.bind(this.onSelectGroup,this))),this.cmbFuncGroup.setValue(0)}},fillFunctions:function(e){if(this.formulasGroups){!this.cmbListFunctions&&!this.functions&&(this.functions=new Common.UI.DataViewStore,this.cmbListFunctions=new Common.UI.ListView({el:$("#formula-dlg-combo-functions"),store:this.functions,itemTemplate:_.template('<div id="<%= id %>" class="list-item" style="pointer-events:none;"><%= value %></div>')}),this.cmbListFunctions.on("item:select",_.bind(this.onSelectFunction,this)),this.cmbListFunctions.on("item:dblclick",_.bind(this.onDblClickFunction,this)),this.cmbListFunctions.on("entervalue",_.bind(this.onPrimary,this)),this.cmbListFunctions.onKeyDown=_.bind(this.onKeyDown,this.cmbListFunctions),this.cmbListFunctions.$el.find(".listview").focus(),this.cmbListFunctions.scrollToRecord=_.bind(this.onScrollToRecordCustom,this.cmbListFunctions));if(this.functions){this.functions.reset();var t=0,n=0,r=null,i=this.formulasGroups.findWhere({name:e});if(i){r=i.get("functions");if(r&&r.length){n=r.length;for(t=0;t<n;++t)this.functions.push(new Common.UI.DataViewModel({id:r[t].get("index"),selected:t<1,allowSelected:!0,value:r[t].get("name")}));this.applyFunction=r[0].get("name"),this.syntaxLabel.text(this.applyFunction+r[0].get("args")),this.descLabel.text(r[0].get("desc")),this.cmbListFunctions.scroller.update({minScrollbarLength:40,alwaysVisibleY:!0})}}}}},onKeyDown:function(e,t){function p(e){i.selectRecord(e),i.scrollToRecord(e),f=$(i.el).find(".inner"),i.scroller.scrollTop(f.scrollTop(),0),t.preventDefault(),t.stopPropagation()}var n=0,r=null,i=this,s="",o="",u=null,a=!1,f=null,l=!1,c=null,h=!1;if(this.disabled)return;_.isUndefined(undefined)&&(t=e),s=String.fromCharCode(e.keyCode);if(e.keyCode>64&&e.keyCode<91&&s&&s.length){c=this.store.findWhere({selected:!0}),c&&(o=c.get("value"),l=o&&o.length&&o[0]===s);for(n=0;n<this.store.length;++n){r=this.store.at(n),o=r.get("value");if(o[0]===s){null===u&&(u=r);if(l){c===r&&(l=!1);continue}if(r.get("selected"))continue;p(r);return}}if(u){p(u);return}}Common.UI.DataView.prototype.onKeyDown.call(this,e,t)},onScrollToRecordCustom:function(e){var t=$(this.el).find(".inner"),n=t.offset().top,r=t.find("#"+e.get("id")).parent(),i=r.offset().top;if(i<n||i+r.height()>n+t.height())this.scroller?this.scroller.scrollTop(t.scrollTop()+i-n,0):t.scrollTop(t.scrollTop()+i-n)},cancelButtonText:"Cancel",okButtonText:"Ok",sCategoryAll:"All",sCategoryLogical:"Logical",sCategoryCube:"Cube",sCategoryDatabase:"Database",sCategoryDateAndTime:"Date and time",sCategoryEngineering:"Engineering",sCategoryFinancial:"Financial",sCategoryInformation:"Information",sCategoryLookupAndReference:"LookupAndReference",sCategoryMathematic:"Math and trigonometry",sCategoryStatistical:"Statistical",sCategoryTextAndData:"Text and data",textGroupDescription:"Select Function Group",textListDescription:"Select Function",sDescription:"Description",sCategoryAll_de:"Alle",sCategoryCube_de:"Cube",sCategoryDatabase_de:"Datenbank",sCategoryDateAndTime_de:"Datum und Uhrzeit",sCategoryEngineering_de:"Konstruktion",sCategoryFinancial_de:"Finanzmathematik",sCategoryInformation_de:"Information",sCategoryLogical_de:"Logisch",sCategoryLookupAndReference_de:"Suchen und Bezüge",sCategoryMathematic_de:"Mathematik und Trigonometrie",sCategoryStatistical_de:"Statistik",sCategoryTextAndData_de:"Text und Daten",sCategoryAll_ru:"Все",sCategoryCube_ru:"Кубические",sCategoryDatabase_ru:"Базы данных",sCategoryDateAndTime_ru:"Дата и время",sCategoryEngineering_ru:"Инженерные",sCategoryFinancial_ru:"Финансовые",sCategoryInformation_ru:"Информационные",sCategoryLogical_ru:"Логические",sCategoryLookupAndReference_ru:"Поиск и ссылки",sCategoryMathematic_ru:"Математические",sCategoryStatistical_ru:"Статистические",sCategoryTextAndData_ru:"Текст и данные",txtTitle:"Insert Function"},SSE.Views.FormulaDialog||{}))}),define("spreadsheeteditor/main/app/controller/FormulaDialog",["core","spreadsheeteditor/main/app/collection/FormulaGroups","spreadsheeteditor/main/app/view/FormulaDialog"],function(){"use strict";SSE.Controllers=SSE.Controllers||{},SSE.Controllers.FormulaDialog=Backbone.Controller.extend({models:[],views:["FormulaDialog"],collections:["FormulaGroups"],initialize:function(){var e=this;this.addListeners({FileMenu:{"settings:apply":function(){e.needUpdateFormula=!0}}})},setApi:function(e){this.api=e;if(this.formulasGroups&&this.api){this.loadingFormulas();var t=this;this.formulas=new SSE.Views.FormulaDialog({api:this.api,toolclose:"hide",formulasGroups:this.formulasGroups,handler:function(e){e&&t.api&&t.api.asc_insertFormula(e,Asc.c_oAscPopUpSelectorType.Func)}}),this.formulas.on({hide:function(){t.api&&t.api.asc_enableKeyEvents(!0)}})}return this},setMode:function(e){return this.mode=e,this},onLaunch:function(){this.formulasGroups=this.getApplication().getCollection("FormulaGroups")},showDialog:function(){this.formulas&&(this.needUpdateFormula&&this.updateFormulas(),this.needUpdateFormula=!1,this.formulas.show())},hideDialog:function(){this.formulas&&this.formulas.isVisible()&&this.formulas.hide()},loadingFormulas:function(){var e=0,t=0,n,r,i,s=this.formulasGroups,o=null,u=0,a=0,f=null,l=[],c=null;if(s){var h=Common.localStorage.getItem("sse-settings-func-locale");h===null&&(h=(this.mode.lang?this.mode.lang:"en").split("-")[0].toLowerCase()),h=SSE.Views.FormulaLang.getDescription(h),c=new SSE.Models.FormulaGroup({name:"All",index:u,store:s});if(c){u+=1,s.push(c),f=this.api.asc_getFormulasInfo();for(e=0;e<f.length;e+=1){n=f[e].asc_getGroupName(),r=f[e].asc_getFormulasArray(),o=new SSE.Models.FormulaGroup({name:n,index:u,store:s}),u+=1,i=[];for(t=0;t<r.length;t+=1){var p=r[t].asc_getName(),d=new SSE.Models.FormulaModel({index:a,group:n,name:r[t].asc_getLocaleName(),args:h&&h[p]?h[p].a:"",desc:h&&h[p]?h[p].d:""});a+=1,i.push(d),l.push(d)}o.set("functions",i),s.push(o)}c.set("functions",_.sortBy(l,function(e){return e.get("name")}))}}},updateFormulas:function(){this.formulasGroups.reset(),this.loadingFormulas(),this.formulas.$window&&(this.formulas.fillFormulasGroups(),this.formulas.fillFunctions("All"))}})}),define("spreadsheeteditor/main/app/view/FormulaLang",[],function(){"use strict";SSE.Views=SSE.Views||{},SSE.Views.FormulaLang=new function(){var langJson={},langDescJson={},_createXMLHTTPObject=function(){var e;try{e=new ActiveXObject("Msxml2.XMLHTTP")}catch(t){try{e=new ActiveXObject("Microsoft.XMLHTTP")}catch(n){e=!1}}return!e&&typeof XMLHttpRequest!="undefined"&&(e=new XMLHttpRequest),e},_get=function(lang){if(!lang)return"";lang=lang.toLowerCase();if(langJson[lang])return langJson[lang];if(lang=="en")return undefined;try{var xhrObj=_createXMLHTTPObject();if(xhrObj&&lang)return xhrObj.open("GET","resources/formula-lang/"+lang+".json",!1),xhrObj.send(""),langJson[lang]=eval("("+xhrObj.responseText+")"),langJson[lang]}catch(e){}return null},_getDescription=function(lang){if(!lang)return"";lang=lang.toLowerCase();if(langDescJson[lang])return langDescJson[lang];try{var xhrObj=_createXMLHTTPObject();if(xhrObj&&lang)return xhrObj.open("GET","resources/formula-lang/"+lang+"_desc.json",!1),xhrObj.send(""),xhrObj.status==200?langDescJson[lang]=eval("("+xhrObj.responseText+")"):(xhrObj.open("GET","resources/formula-lang/en_desc.json",!1),xhrObj.send(""),langDescJson[lang]=eval("("+xhrObj.responseText+")")),langDescJson[lang]}catch(e){}return null};return{get:_get,getDescription:_getDescription}}}),define("spreadsheeteditor/main/app/controller/Main",["core","irregularstack","common/main/lib/component/Window","common/main/lib/component/LoadMask","common/main/lib/component/Tooltip","common/main/lib/controller/Fonts","common/main/lib/collection/TextArt","common/main/lib/view/OpenDialog","common/main/lib/util/LanguageInfo","common/main/lib/util/LocalStorage","spreadsheeteditor/main/app/collection/ShapeGroups","spreadsheeteditor/main/app/collection/TableTemplates","spreadsheeteditor/main/app/collection/EquationGroups","spreadsheeteditor/main/app/controller/FormulaDialog","spreadsheeteditor/main/app/view/FormulaLang"],function(){"use strict";SSE.Controllers.Main=Backbone.Controller.extend(_.extend(function(){var InitApplication=-254,ApplyEditRights=-255,LoadingDocument=-256,mapCustomizationElements={about:"button#left-btn-about",feedback:"button#left-btn-support",goback:"#fm-btn-back > a, #header-back > div"},mapCustomizationExtElements={toolbar:"#viewport #toolbar",leftMenu:"#viewport #left-menu, #viewport #id-toolbar-full-placeholder-btn-settings, #viewport #id-toolbar-short-placeholder-btn-settings",rightMenu:"#viewport #right-menu",header:"#viewport #header",statusBar:"#statusbar"};return Common.localStorage.setId("table"),Common.localStorage.setKeysFilter("sse-,asc.table"),Common.localStorage.sync(),{models:[],collections:["ShapeGroups","EquationGroups","TableTemplates","Common.Collections.TextArt"],views:[],initialize:function(){this.addListeners({FileMenu:{"settings:apply":_.bind(this.applySettings,this)}})},onLaunch:function(){this._state={isDisconnected:!1,usersCount:1,fastCoauth:!0,lostEditingRights:!1,licenseWarning:!1};if(!Common.Utils.isBrowserSupported()){Common.Utils.showBrowserRestriction(),Common.Gateway.reportError(undefined,this.unsupportedBrowserErrorText);return}var e=Common.localStorage.getItem("sse-settings-fontrender");e===null&&(e=window.devicePixelRatio>1?"1":"3"),this.api=new Asc.spreadsheet_api({"id-view":"editor_sdk","id-input":"ce-cell-content"}),this.api.asc_setFontRenderingMode(parseInt(e)),this.api.asc_registerCallback("asc_onOpenDocumentProgress",_.bind(this.onOpenDocument,this)),this.api.asc_registerCallback("asc_onEndAction",_.bind(this.onLongActionEnd,this)),this.api.asc_registerCallback("asc_onError",_.bind(this.onError,this)),this.api.asc_registerCallback("asc_onCoAuthoringDisconnect",_.bind(this.onCoAuthoringDisconnect,this)),this.api.asc_registerCallback("asc_onAdvancedOptions",_.bind(this.onAdvancedOptions,this)),this.api.asc_registerCallback("asc_onDocumentUpdateVersion",_.bind(this.onUpdateVersion,this)),this.api.asc_registerCallback("asc_onServerVersion",_.bind(this.onServerVersion,this)),this.api.asc_registerCallback("asc_onDocumentName",_.bind(this.onDocumentName,this)),this.api.asc_registerCallback("asc_onPrintUrl",_.bind(this.onPrintUrl,this)),this.api.asc_registerCallback("asc_onMeta",_.bind(this.onMeta,this)),Common.NotificationCenter.on("api:disconnect",_.bind(this.onCoAuthoringDisconnect,this)),Common.NotificationCenter.on("goback",_.bind(this.goBack,this)),Common.NotificationCenter.on("namedrange:locked",_.bind(this.onNamedRangeLocked,this)),this.stackLongActions=new Common.IrregularStack({strongCompare:this._compareActionStrong,weakCompare:this._compareActionWeak}),this.stackLongActions.push({id:InitApplication,type:Asc.c_oAscAsyncActionType.BlockInteraction}),this.isShowOpenDialog=!1,this.editorConfig={},this.plugins=undefined,this.UICustomizePlugins=[],Common.Gateway.on("init",_.bind(this.loadConfig,this)),Common.Gateway.on("showmessage",_.bind(this.onExternalMessage,this)),Common.Gateway.on("opendocument",_.bind(this.loadDocument,this)),Common.Gateway.on("internalcommand",_.bind(this.onInternalCommand,this)),Common.Gateway.ready(),this.getApplication().getController("Viewport").setApi(this.api);var t=this;$(document.body).on("focus","input, textarea:not(#ce-cell-content)",function(e){if(t.isAppDisabled===!0)return;e&&e.target&&!/area_id/.test(e.target.id)&&(/msg-reply/.test(e.target.className)?t.dontCloseDummyComment=!0:/chat-msg-text/.test(e.target.id)&&(t.dontCloseChat=!0))}),$(document.body).on("blur","input, textarea",function(e){if(t.isAppDisabled===!0||t.isFrameClosed)return;!t.isModalShowed&&(!t.loadMask||!t.loadMask.isVisible())&&(!e.relatedTarget||!/area_id/.test(e.target.id)&&$(e.target).parent().find(e.relatedTarget).length<1&&(e.relatedTarget.localName!="input"||!/form-control/.test(e.relatedTarget.className))&&(e.relatedTarget.localName!="textarea"||/area_id/.test(e.relatedTarget.id)))&&(t.api.asc_enableKeyEvents(!0),/msg-reply/.test(e.target.className)?t.dontCloseDummyComment=!1:/chat-msg-text/.test(e.target.id)&&(t.dontCloseChat=!1))}).on("dragover",function(e){var t=e.originalEvent;if(t.target&&$(t.target).closest("#editor_sdk").length<1)return t.preventDefault(),t.dataTransfer.dropEffect="none",!1}),Common.NotificationCenter.on({"modal:show":function(e){t.isModalShowed=!0,t.api.asc_enableKeyEvents(!1)},"modal:close":function(e){e&&e.$lastmodal&&e.$lastmodal.size()<1&&(t.isModalShowed=!1,t.api.asc_enableKeyEvents(!0))},"modal:hide":function(e){e&&e.$lastmodal&&e.$lastmodal.size()<1&&(t.isModalShowed=!1,t.api.asc_enableKeyEvents(!0))},"dataview:focus":function(e){},"dataview:blur":function(e){t.isModalShowed||t.api.asc_enableKeyEvents(!0)},"menu:show":function(e){},"menu:hide":function(e,n){!t.isModalShowed&&(!e||!e.cmpEl.hasClass("from-cell-edit"))&&!n&&(t.api.asc_InputClearKeyboardElement(),t.api.asc_enableKeyEvents(!0))},"edit:complete":_.bind(this.onEditComplete,this),"settings:unitschanged":_.bind(this.unitsChanged,this)}),this.initNames(),Common.util.Shortcuts.delegateShortcuts({shortcuts:{"command+s,ctrl+s":_.bind(function(e){e.preventDefault(),e.stopPropagation()},this)}})},loadConfig:function(e){this.editorConfig=$.extend(this.editorConfig,e.config),this.appOptions={},this.editorConfig.user=this.appOptions.user=Common.Utils.fillUserInfo(this.editorConfig.user,this.editorConfig.lang,this.textAnonymous),this.appOptions.nativeApp=this.editorConfig.nativeApp===!0,this.appOptions.isDesktopApp=this.editorConfig.targetApp=="desktop",this.appOptions.canCreateNew=!_.isEmpty(this.editorConfig.createUrl)&&!this.appOptions.isDesktopApp,this.appOptions.canOpenRecent=this.editorConfig.nativeApp!==!0&&this.editorConfig.recent!==undefined&&!this.appOptions.isDesktopApp,this.appOptions.templates=this.editorConfig.templates,this.appOptions.recent=this.editorConfig.recent,this.appOptions.createUrl=this.editorConfig.createUrl,this.appOptions.lang=this.editorConfig.lang,this.appOptions.location=typeof this.editorConfig.location=="string"?this.editorConfig.location.toLowerCase():"",this.appOptions.canAutosave=!1,this.appOptions.canAnalytics=!1,this.appOptions.sharingSettingsUrl=this.editorConfig.sharingSettingsUrl,this.appOptions.isEditDiagram=this.editorConfig.mode=="editdiagram",this.appOptions.isEditMailMerge=this.editorConfig.mode=="editmerge",this.appOptions.customization=this.editorConfig.customization,this.appOptions.canBackToFolder=this.editorConfig.canBackToFolder!==!1&&typeof this.editorConfig.customization=="object"&&typeof this.editorConfig.customization.goback=="object"&&!_.isEmpty(this.editorConfig.customization.goback.url),this.appOptions.canBack=this.editorConfig.nativeApp!==!0&&this.appOptions.canBackToFolder===!0,this.appOptions.canPlugins=!1,this.plugins=this.editorConfig.plugins,this.headerView=this.getApplication().getController("Viewport").getView("Common.Views.Header"),this.headerView.setCanBack(this.appOptions.canBackToFolder===!0);var t=Common.localStorage.getItem("sse-settings-reg-settings");t!==null?this.api.asc_setLocale(parseInt(t)):this.api.asc_setLocale(this.editorConfig.lang?parseInt(Common.util.LanguageInfo.getLocalLanguageCode(this.editorConfig.lang)):1033),t=Common.localStorage.getItem("sse-settings-func-locale");if(t===null){var n=(this.editorConfig.lang?this.editorConfig.lang:"en").split("-")[0].toLowerCase();n!=="en"&&(t=SSE.Views.FormulaLang.get(n))}else t=SSE.Views.FormulaLang.get(t);t&&this.api.asc_setLocalization(t),(this.appOptions.location=="us"||this.appOptions.location=="ca")&&Common.Utils.Metric.setDefaultMetric(Common.Utils.Metric.c_MetricUnits.inch),this.isFrameClosed=this.appOptions.isEditDiagram||this.appOptions.isEditMailMerge},loadDocument:function(e){this.appOptions.spreadsheet=e.doc,this.permissions={};var t={};if(e.doc){this.permissions=_.extend(this.permissions,e.doc.permissions);var n=new Asc.asc_CUserInfo;n.put_Id(this.appOptions.user.id),n.put_FullName(this.appOptions.user.fullname),t=new Asc.asc_CDocInfo,t.put_Id(e.doc.key),t.put_Url(e.doc.url),t.put_Title(e.doc.title),t.put_Format(e.doc.fileType),t.put_VKey(e.doc.vkey),t.put_Options(e.doc.options),t.put_UserInfo(n),t.put_CallbackUrl(this.editorConfig.callbackUrl),t.put_Token(e.doc.token),this.headerView.setDocumentCaption(e.doc.title)}this.api.asc_registerCallback("asc_onGetEditorPermissions",_.bind(this.onEditorPermissions,this)),this.api.asc_setDocInfo(t),this.api.asc_getEditorPermissions(this.editorConfig.licenseUrl,this.editorConfig.customerId)},onProcessSaveResult:function(e){this.api.asc_OnSaveEnd(e.result),e&&e.result===!1&&Common.UI.error({title:this.criticalErrorTitle,msg:_.isEmpty(e.message)?this.errorProcessSaveResult:e.message})},onProcessRightsChange:function(e){if(e&&e.enabled===!1){var t=this,n=this._state.lostEditingRights;this._state.lostEditingRights=!this._state.lostEditingRights,this.api.asc_coAuthoringDisconnect(),this.getApplication().getController("LeftMenu").leftMenu.getMenu("file").panels.rights.onLostEditRights(),Common.NotificationCenter.trigger("api:disconnect"),n||Common.UI.warning({title:this.notcriticalErrorTitle,maxwidth:600,msg:_.isEmpty(e.message)?this.warnProcessRightsChange:e.message,callback:function(){t._state.lostEditingRights=!1,t.onEditComplete()}})}},onDownloadAs:function(){this.api.asc_DownloadAs(Asc.c_oAscFileType.XLSX,!0)},onProcessMouse:function(e){if(e.type=="mouseup"){var t=document.getElementById("editor_sdk");if(t){var n=t.getBoundingClientRect(),r=e.event||{};this.api.asc_onMouseUp(r,e.x-n.left,e.y-n.top)}}},goBack:function(e){var t=this.appOptions.customization.goback.url;e?window.open(t,"_blank"):parent.location.href=t},onEditComplete:function(e,t){t&&t.restorefocus&&this.api.isCEditorFocused?(this.formulaInput.blur(),this.formulaInput.focus()):(this.getApplication().getController("DocumentHolder").getView("DocumentHolder").focus(),this.api.isCEditorFocused=!1)},onSelectionChanged:function(e){this._isChartDataReady||(this._isChartDataReady=!0,Common.Gateway.internalMessage("chartDataReady"))},onLongActionBegin:function(e,t){var n={id:t,type:e};this.stackLongActions.push(n),this.setLongActionView(n)},onLongActionEnd:function(e,t){var n={id:t,type:e};this.stackLongActions.pop(n),this.headerView.setDocumentCaption(this.api.asc_getDocumentName()),this.updateWindowTitle(this.api.asc_isDocumentModified(),!0),e===Asc.c_oAscAsyncActionType.BlockInteraction&&t==Asc.c_oAscAsyncAction.Open&&(Common.Gateway.internalMessage("documentReady",{}),this.onDocumentReady()),n=this.stackLongActions.get({type:Asc.c_oAscAsyncActionType.Information}),n&&this.setLongActionView(n),t==Asc.c_oAscAsyncAction.Save&&this.toolbarView.synchronizeChanges(),n=this.stackLongActions.get({type:Asc.c_oAscAsyncActionType.BlockInteraction}),n?this.setLongActionView(n):(this.loadMask&&(this.loadMask.isVisible()&&!this.dontCloseDummyComment&&!this.dontCloseChat&&this.api.asc_enableKeyEvents(!0),this.loadMask.hide()),e==Asc.c_oAscAsyncActionType.BlockInteraction&&(t!=Asc.c_oAscAsyncAction["LoadDocumentFonts"]&&t!=Asc.c_oAscAsyncAction["ApplyChanges"]||!this.dontCloseDummyComment&&!this.dontCloseChat)&&this.onEditComplete(this.loadMask,{restorefocus:!0}))},setLongActionView:function(e){var t="";switch(e.id){case Asc.c_oAscAsyncAction.Open:t=this.openTitleText;break;case Asc.c_oAscAsyncAction.Save:t=this.saveTitleText;break;case Asc.c_oAscAsyncAction.ForceSaveTimeout:break;case Asc.c_oAscAsyncAction.ForceSaveButton:break;case Asc.c_oAscAsyncAction.LoadDocumentFonts:t=this.loadFontsTitleText;break;case Asc.c_oAscAsyncAction.LoadDocumentImages:t=this.loadImagesTitleText;break;case Asc.c_oAscAsyncAction.LoadFont:t=this.loadFontTitleText;break;case Asc.c_oAscAsyncAction.LoadImage:t=this.loadImageTitleText;break;case Asc.c_oAscAsyncAction.DownloadAs:t=this.downloadTitleText;break;case Asc.c_oAscAsyncAction.Print:t=this.printTitleText;break;case Asc.c_oAscAsyncAction.UploadImage:t=this.uploadImageTitleText;break;case Asc.c_oAscAsyncAction.Recalc:t=this.titleRecalcFormulas;break;case Asc.c_oAscAsyncAction.SlowOperation:t=this.textPleaseWait;break;case Asc.c_oAscAsyncAction.PrepareToSave:t=this.savePreparingText;break;case ApplyEditRights:t=this.txtEditingMode;break;case LoadingDocument:t=this.loadingDocumentTitleText}e.type==Asc.c_oAscAsyncActionType.BlockInteraction&&(!this.loadMask&&(this.loadMask=new Common.UI.LoadMask({owner:$("#viewport")})),this.loadMask.setTitle(t),this.isShowOpenDialog||(this.api.asc_enableKeyEvents(!1),this.loadMask.show()))},onApplyEditRights:function(e){e&&!e.allowed&&Common.UI.info({title:this.requestEditFailedTitleText,msg:e.message||this.requestEditFailedMessageText})},onDocumentReady:function(){function m(){if(!window.AscDesktopEditor){var t=[];Common.Utils.isIE9m&&t.push(e.warnBrowserIE9),t.length&&e.showTips(t)}document.removeEventListener("visibilitychange",m)}if(this._isDocReady)return;var e=this,t;e._isDocReady=!0,e.hidePreloader(),e.onLongActionEnd(Asc.c_oAscAsyncActionType.BlockInteraction,LoadingDocument),t=this.appOptions.isEditMailMerge||this.appOptions.isEditDiagram?100:Common.localStorage.getItem("sse-settings-zoom");var n=t!==null?parseInt(t)/100:this.appOptions.customization&&this.appOptions.customization.zoom?parseInt(this.appOptions.customization.zoom)/100:1;this.api.asc_setZoom(n>0?n:1),t=Common.localStorage.getItem("sse-settings-livecomment"),this.isLiveCommenting=t===null||parseInt(t)!=0,this.isLiveCommenting?this.api.asc_showComments():this.api.asc_hideComments(),this.appOptions.isEdit&&!this.appOptions.isOffline&&this.appOptions.canCoAuthoring?(t=Common.localStorage.getItem("sse-settings-coauthmode"),t===null&&Common.localStorage.getItem("sse-settings-autosave")===null&&this.appOptions.customization&&this.appOptions.customization.autosave===!1&&(t=0),this._state.fastCoauth=t===null||parseInt(t)==1):this._state.fastCoauth=!1,this.api.asc_SetFastCollaborative(this._state.fastCoauth),e.api.asc_registerCallback("asc_onStartAction",_.bind(e.onLongActionBegin,e)),e.api.asc_registerCallback("asc_onConfirmAction",_.bind(e.onConfirmAction,e)),e.api.asc_registerCallback("asc_onActiveSheetChanged",_.bind(e.onActiveSheetChanged,e)),e.api.asc_registerCallback("asc_onPrint",_.bind(e.onPrint,e));var r=e.getApplication();e.headerView.setDocumentCaption(e.api.asc_getDocumentName()),e.updateWindowTitle(e.api.asc_isDocumentModified(),!0);var i=r.getController("Toolbar"),s=r.getController("Statusbar"),o=r.getController("DocumentHolder"),u=r.getController("RightMenu"),a=r.getController("LeftMenu"),f=r.getController("CellEditor"),l=s.getView("Statusbar"),c=a.getView("LeftMenu"),h=o.getView("DocumentHolder"),p=r.getController("Common.Controllers.Chat"),d=r.getController("Common.Controllers.Plugins");c.getMenu("file").loadDocument({doc:e.appOptions.spreadsheet}),a.setMode(e.appOptions).createDelayedElements().setApi(e.api),!e.appOptions.isEditMailMerge&&!e.appOptions.isEditDiagram&&(d.setApi(e.api),e.updatePlugins(e.plugins,!1),e.requestPlugins("../../../../plugins.json"),e.api.asc_registerCallback("asc_onPluginsInit",_.bind(e.updatePluginsList,e))),c.disableMenu("all",!1),!e.appOptions.isEditMailMerge&&!e.appOptions.isEditDiagram&&e.appOptions.canBranding&&e.getApplication().getController("LeftMenu").leftMenu.getMenu("about").setLicInfo(e.editorConfig.customization),o.setApi(e.api).loadConfig({config:e.editorConfig}),p.setApi(this.api).setMode(this.appOptions),s.createDelayedElements(),s.setApi(e.api),h.setApi(e.api),l.update(),this.formulaInput=f.getView("CellEditor").$el.find("textarea");if(e.appOptions.isEdit){e.appOptions.canAutosave?(t=Common.localStorage.getItem("sse-settings-autosave"),t===null&&e.appOptions.customization&&e.appOptions.customization.autosave===!1&&(t=0),t=!e._state.fastCoauth&&t!==null?parseInt(t):e.appOptions.canCoAuthoring?1:0):t=0,e.api.asc_setAutoSaveGap(t),e.appOptions.canForcesave&&(t=Common.localStorage.getItem("sse-settings-forcesave"),e.appOptions.forcesave=t===null?e.appOptions.canForcesave:parseInt(t)==1,e.api.asc_setIsForceSaveOnUserSave(e.appOptions.forcesave)),e.needToUpdateVersion&&(Common.NotificationCenter.trigger("api:disconnect"),i.onApiCoAuthoringDisconnect());var v=setInterval(function(){if(window.styles_loaded||e.appOptions.isEditDiagram||e.appOptions.isEditMailMerge){clearInterval(v),Common.NotificationCenter.trigger("comments:updatefilter",{property:"uid",value:new RegExp("^(doc_|sheet"+e.api.asc_getActiveWorksheetId()+"_)")}),h.createDelayedElements(),i.createDelayedElements();if(!e.appOptions.isEditMailMerge&&!e.appOptions.isEditDiagram){var t=e.api.asc_getPropertyEditorShapes();t&&e.fillAutoShapes(t[0],t[1]),e.fillTextArt(e.api.asc_getTextArtPreviews()),e.updateThemeColors()}u.createDelayedElements(),e.api.asc_registerCallback("asc_onDocumentModifiedChanged",_.bind(e.onDocumentModifiedChanged,e)),e.api.asc_registerCallback("asc_onDocumentCanSaveChanged",_.bind(e.onDocumentCanSaveChanged,e)),e.api.asc_registerCallback("asc_OnTryUndoInFastCollaborative",_.bind(e.onTryUndoInFastCollaborative,e)),e.onDocumentModifiedChanged(e.api.asc_isDocumentModified());var n=r.getController("FormulaDialog");n&&n.setMode(e.appOptions).setApi(e.api),e.needToUpdateVersion&&i.onApiCoAuthoringDisconnect(),e.appOptions.canBrandingExt&&Common.NotificationCenter.trigger("document:ready","main")}},50)}else e.appOptions.canBrandingExt&&Common.NotificationCenter.trigger("document:ready","main");e.appOptions.canAnalytics&&!1&&Common.component.Analytics.initialize("UA-12442749-13","Spreadsheet Editor"),Common.Gateway.on("applyeditrights",_.bind(e.onApplyEditRights,e)),Common.Gateway.on("processsaveresult",_.bind(e.onProcessSaveResult,e)),Common.Gateway.on("processrightschange",_.bind(e.onProcessRightsChange,e)),Common.Gateway.on("processmouse",_.bind(e.onProcessMouse,e)),Common.Gateway.on("downloadas",_.bind(e.onDownloadAs,e)),Common.Gateway.sendInfo({mode:e.appOptions.isEdit?"edit":"view"}),$(document).on("contextmenu",_.bind(e.onContextMenu,e)),typeof document.hidden!="undefined"&&document.hidden?document.addEventListener("visibilitychange",m):m()},onOpenDocument:function(e){var t=document.getElementById("loadmask-text"),n=(e.asc_getCurrentFont()+e.asc_getCurrentImage())/(e.asc_getFontsCount()+e.asc_getImagesCount());n=this.textLoadingDocument+": "+Math.min(Math.round(n*100),100)+"%",t?t.innerHTML=n:this.loadMask.setTitle(n)},onEditorPermissions:function(e){var t=e?e.asc_getLicenseType():Asc.c_oLicenseResult.Error;if(e&&!this.appOptions.isEditDiagram&&!this.appOptions.isEditMailMerge){if(this.onServerVersion(e.asc_getBuildVersion()))return;e.asc_getRights()!==Asc.c_oRights.Edit&&(this.permissions.edit=!1),this.appOptions.canAutosave=!0,this.appOptions.canAnalytics=e.asc_getIsAnalyticsEnable(),this.appOptions.isOffline=this.api.asc_isOffline(),this.appOptions.canLicense=t===Asc.c_oLicenseResult.Success||t===Asc.c_oLicenseResult.SuccessLimit,this.appOptions.isLightVersion=e.asc_getIsLight(),this.appOptions.canCoAuthoring=!this.appOptions.isLightVersion,this.appOptions.canComments=(t===Asc.c_oLicenseResult.Success||t===Asc.c_oLicenseResult.SuccessLimit)&&(typeof this.editorConfig.customization!="object"||this.editorConfig.customization.comments!==!1),this.appOptions.canChat=(t===Asc.c_oLicenseResult.Success||t===Asc.c_oLicenseResult.SuccessLimit)&&!this.appOptions.isOffline&&(typeof this.editorConfig.customization!="object"||this.editorConfig.customization.chat!==!1),this.appOptions.canRename=!!this.permissions.rename,this.appOptions.isTrial=e.asc_getTrial(),this.appOptions.canBranding=t===Asc.c_oLicenseResult.Success&&typeof this.editorConfig.customization=="object",this.appOptions.canBranding&&this.headerView.setBranding(this.editorConfig.customization),this.appOptions.canBrandingExt=e.asc_getCanBranding()&&(typeof this.editorConfig.customization=="object"||this.editorConfig.plugins),this.appOptions.canBrandingExt&&this.updatePlugins(this.plugins,!0),this.appOptions.canRename&&this.headerView.setCanRename(!0)}this.appOptions.canRequestEditRights=this.editorConfig.canRequestEditRights,this.appOptions.canEdit=this.permissions.edit!==!1&&(this.editorConfig.canRequestEditRights||this.editorConfig.mode!=="view"),this.appOptions.isEdit=(this.appOptions.canLicense||this.appOptions.isEditDiagram||this.appOptions.isEditMailMerge)&&this.permissions.edit!==!1&&this.editorConfig.mode!=="view",this.appOptions.canDownload=!this.appOptions.nativeApp&&this.permissions.download!==!1,this.appOptions.canPrint=this.permissions.print!==!1,this.appOptions.canForcesave=this.appOptions.isEdit&&!this.appOptions.isOffline&&!this.appOptions.isEditDiagram&&!this.appOptions.isEditMailMerge&&typeof this.editorConfig.customization=="object"&&!!this.editorConfig.customization.forcesave,this.appOptions.forcesave=this.appOptions.canForcesave,this.appOptions.canEditComments=this.appOptions.isOffline||typeof this.editorConfig.customization!="object"||!this.editorConfig.customization.commentAuthorOnly,this._state.licenseWarning=!this.appOptions.isEditDiagram&&!this.appOptions.isEditMailMerge&&t===Asc.c_oLicenseResult.Connections&&this.appOptions.canEdit&&this.editorConfig.mode!=="view",this.applyModeCommonElements(),this.applyModeEditorElements(),this.api.asc_setViewMode(!this.appOptions.isEdit),this.appOptions.isEditMailMerge||this.appOptions.isEditDiagram?this.api.asc_LoadEmptyDocument():this.api.asc_LoadDocument(),this.appOptions.isEdit||(this.hidePreloader(),this.onLongActionBegin(Asc.c_oAscAsyncActionType.BlockInteraction,LoadingDocument))},applyModeCommonElements:function(){window.editor_elements_prepared=!0;var e=Common.localStorage.getItem("sse-hidden-title");e=this.appOptions.isEdit&&e!==null&&parseInt(e)==1;var t=this.getApplication(),n=t.getController("Viewport").getView("Viewport"),r=t.getController("Statusbar").getView("Statusbar");this.headerView&&(this.headerView.setHeaderCaption(this.appOptions.isEdit?"Spreadsheet Editor":"Spreadsheet Viewer"),this.headerView.setVisible(!this.appOptions.nativeApp&&!e&&!this.appOptions.isEditMailMerge&&!this.appOptions.isDesktopApp&&!this.appOptions.isEditDiagram)),n&&n.setMode(this.appOptions,!0),r&&r.setMode(this.appOptions),t.getController("DocumentHolder").setMode(this.appOptions);if(this.appOptions.isEditMailMerge||this.appOptions.isEditDiagram)r.hide(),t.getController("LeftMenu").getView("LeftMenu").hide(),$(window).mouseup(function(e){Common.Gateway.internalMessage("processMouse",{event:"mouse:up"})}).mousemove($.proxy(function(e){this.isDiagramDrag&&Common.Gateway.internalMessage("processMouse",{event:"mouse:move",pagex:e.pageX*Common.Utils.zoom(),pagey:e.pageY*Common.Utils.zoom()})},this));if(this.api){var i=new Asc.asc_CChartTranslate;i.asc_setTitle(this.txtDiagramTitle),i.asc_setXAxis(this.txtXAxis),i.asc_setYAxis(this.txtYAxis),i.asc_setSeries(this.txtSeries),this.api.asc_setChartTranslate(i);var s=new Asc.asc_TextArtTranslate;s.asc_setDefaultText(this.txtArt),this.api.asc_setTextArtTranslate(s)}if(!this.appOptions.isEditMailMerge&&!this.appOptions.isEditDiagram){this.api.asc_registerCallback("asc_onSendThemeColors",_.bind(this.onSendThemeColors,this)),this.api.asc_registerCallback("asc_onDownloadUrl",_.bind(this.onDownloadUrl,this));var o=t.getController("Print");o&&this.api&&o.setApi(this.api)}var u=this.getApplication().getController("CellEditor");u&&u.setApi(this.api).setMode(this.appOptions)},applyModeEditorElements:function(e){if(this.appOptions.isEdit){var t=this,n=this.getApplication(),r=n.getController("Toolbar"),i=n.getController("Statusbar"),s=n.getController("RightMenu"),o=n.getController("Common.Controllers.Comments"),u=n.getController("Common.Controllers.Fonts");u&&u.setApi(t.api),r&&r.setApi(t.api),o&&(o.setMode(this.appOptions),o.setConfig({config:t.editorConfig,sdkviewname:"#ws-canvas-outer",hintmode:!0},t.api)),s&&s.setApi(t.api),i&&i.getView("Statusbar").changeViewMode(!0),e=="view"&&o&&Common.NotificationCenter.trigger("comments:updatefilter",{property:"uid",value:new RegExp("^(doc_|sheet"+this.api.asc_getActiveWorksheetId()+"_)")});var a=this.getApplication().getController("Viewport").getView("Viewport");a.applyEditorMode(),this.toolbarView=r.getView("Toolbar"),_.each([this.toolbarView,s.getView("RightMenu")],function(e){e&&(e.setMode(t.appOptions),e.setApi(t.api))}),this.toolbarView&&(this.toolbarView.on("insertimage",_.bind(t.onInsertImage,t)),this.toolbarView.on("insertshape",_.bind(t.onInsertShape,t)),this.toolbarView.on("insertchart",_.bind(t.onInsertChart,t)),this.toolbarView.on("inserttextart",_.bind(t.onInsertTextArt,t)));var f=Common.localStorage.getItem("sse-settings-unit");Common.Utils.Metric.setCurrentMetric(f!==null?parseInt(f):Common.Utils.Metric.getDefaultMetric());if(!t.appOptions.isEditMailMerge&&!t.appOptions.isEditDiagram){var l={};JSON.parse(Common.localStorage.getItem("sse-hidden-title"))&&(l.title=!0),JSON.parse(Common.localStorage.getItem("sse-hidden-formula"))&&(l.formula=!0),n.getController("Toolbar").hideElements(l)}else s.getView("RightMenu").hide();t.api.asc_registerCallback("asc_onAuthParticipantsChanged",_.bind(t.onAuthParticipantsChanged,t)),t.api.asc_registerCallback("asc_onParticipantsChanged",_.bind(t.onAuthParticipantsChanged,t)),t.appOptions.isEditDiagram&&t.api.asc_registerCallback("asc_onSelectionChanged",_.bind(t.onSelectionChanged,t)),t.stackLongActions.exist({id:ApplyEditRights,type:Asc.c_oAscAsyncActionType.BlockInteraction})?t.onLongActionEnd(Asc.c_oAscAsyncActionType.BlockInteraction,ApplyEditRights):this._isDocReady||(t.hidePreloader(),t.onLongActionBegin(Asc.c_oAscAsyncActionType.BlockInteraction,LoadingDocument)),window.onbeforeunload=_.bind(t.onBeforeUnload,t),window.onunload=_.bind(t.onUnload,t)}},onExternalMessage:function(e){e&&e.msg&&(e.msg=e.msg.toString(),this.showTips([e.msg.charAt(0).toUpperCase()+e.msg.substring(1)]),Common.component.Analytics.trackEvent("External Error",e.title))},onError:function(e,t,n){this.hidePreloader(),this.onLongActionEnd(Asc.c_oAscAsyncActionType.BlockInteraction,LoadingDocument);var r={closable:!1};switch(e){case Asc.c_oAscError.ID.Unknown:r.msg=this.unknownErrorText;break;case Asc.c_oAscError.ID.ConvertationTimeout:r.msg=this.convertationTimeoutText;break;case Asc.c_oAscError.ID.ConvertationOpenError:r.msg=this.openErrorText;break;case Asc.c_oAscError.ID.ConvertationSaveError:r.msg=this.saveErrorText;break;case Asc.c_oAscError.ID.DownloadError:r.msg=this.downloadErrorText;break;case Asc.c_oAscError.ID.UplImageSize:r.msg=this.uploadImageSizeMessage;break;case Asc.c_oAscError.ID.UplImageExt:r.msg=this.uploadImageExtMessage;break;case Asc.c_oAscError.ID.UplImageFileCount:r.msg=this.uploadImageFileCountMessage;break;case Asc.c_oAscError.ID.PastInMergeAreaError:r.msg=this.pastInMergeAreaError;break;case Asc.c_oAscError.ID.FrmlWrongCountParentheses:r.msg=this.errorWrongBracketsCount,r.closable=!0;break;case Asc.c_oAscError.ID.FrmlWrongOperator:r.msg=this.errorWrongOperator,r.closable=!0;break;case Asc.c_oAscError.ID.FrmlWrongMaxArgument:r.msg=this.errorCountArgExceed,r.closable=!0;break;case Asc.c_oAscError.ID.FrmlWrongCountArgument:r.msg=this.errorCountArg,r.closable=!0;break;case Asc.c_oAscError.ID.FrmlWrongFunctionName:r.msg=this.errorFormulaName,r.closable=!0;break;case Asc.c_oAscError.ID.FrmlAnotherParsingError:r.msg=this.errorFormulaParsing,r.closable=!0;break;case Asc.c_oAscError.ID.FrmlWrongArgumentRange:r.msg=this.errorArgsRange,r.closable=!0;break;case Asc.c_oAscError.ID.UnexpectedGuid:r.msg=this.errorUnexpectedGuid;break;case Asc.c_oAscError.ID.Database:r.msg=this.errorDatabaseConnection;break;case Asc.c_oAscError.ID.FileRequest:r.msg=this.errorFileRequest;break;case Asc.c_oAscError.ID.FileVKey:r.msg=this.errorFileVKey;break;case Asc.c_oAscError.ID.StockChartError:r.msg=this.errorStockChart;break;case Asc.c_oAscError.ID.DataRangeError:r.msg=this.errorDataRange;break;case Asc.c_oAscError.ID.FrmlOperandExpected:r.msg=this.errorOperandExpected;break;case Asc.c_oAscError.ID.VKeyEncrypt:r.msg=this.errorToken;break;case Asc.c_oAscError.ID.KeyExpire:r.msg=this.errorTokenExpire;break;case Asc.c_oAscError.ID.UserCountExceed:r.msg=this.errorUsersExceed;break;case Asc.c_oAscError.ID.CannotMoveRange:r.msg=this.errorMoveRange;break;case Asc.c_oAscError.ID.UplImageUrl:r.msg=this.errorBadImageUrl;break;case Asc.c_oAscError.ID.CoAuthoringDisconnect:r.msg=this.errorViewerDisconnect;break;case Asc.c_oAscError.ID.ConvertationPassword:r.msg=this.errorFilePassProtect;break;case Asc.c_oAscError.ID.AutoFilterDataRangeError:r.msg=this.errorAutoFilterDataRange;break;case Asc.c_oAscError.ID.AutoFilterChangeFormatTableError:r.msg=this.errorAutoFilterChangeFormatTable;break;case Asc.c_oAscError.ID.AutoFilterChangeError:r.msg=this.errorAutoFilterChange;break;case Asc.c_oAscError.ID.AutoFilterMoveToHiddenRangeError:r.msg=this.errorAutoFilterHiddenRange;break;case Asc.c_oAscError.ID.CannotFillRange:r.msg=this.errorFillRange;break;case Asc.c_oAscError.ID.UserDrop:if(this._state.lostEditingRights){this._state.lostEditingRights=!1;return}this._state.lostEditingRights=!0,r.msg=this.errorUserDrop;break;case Asc.c_oAscError.ID.InvalidReferenceOrName:r.msg=this.errorInvalidRef;break;case Asc.c_oAscError.ID.LockCreateDefName:r.msg=this.errorCreateDefName;break;case Asc.c_oAscError.ID.PasteMaxRangeError:r.msg=this.errorPasteMaxRange;break;case Asc.c_oAscError.ID.LockedAllError:r.msg=this.errorLockedAll;break;case Asc.c_oAscError.ID.Warning:r.msg=this.errorConnectToServer;break;case Asc.c_oAscError.ID.LockedWorksheetRename:r.msg=this.errorLockedWorksheetRename;break;case Asc.c_oAscError.ID.OpenWarning:r.msg=this.errorOpenWarning;break;case Asc.c_oAscError.ID.FrmlWrongReferences:r.msg=this.errorFrmlWrongReferences;break;case Asc.c_oAscError.ID.CopyMultiselectAreaError:r.msg=this.errorCopyMultiselectArea;break;case Asc.c_oAscError.ID.PrintMaxPagesCount:r.msg=this.errorPrintMaxPagesCount;break;case Asc.c_oAscError.ID.SessionAbsolute:r.msg=this.errorSessionAbsolute;break;case Asc.c_oAscError.ID.SessionIdle:r.msg=this.errorSessionIdle;break;case Asc.c_oAscError.ID.SessionToken:r.msg=this.errorSessionToken;break;case Asc.c_oAscError.ID.AccessDeny:r.msg=this.errorAccessDeny;break;default:r.msg=this.errorDefaultMessage.replace("%1",e)}t==Asc.c_oAscError.Level.Critical?(Common.Gateway.reportError(e,r.msg),r.title=this.criticalErrorTitle,r.iconCls="error",this.appOptions.canBackToFolder&&(r.msg+="<br/><br/>"+this.criticalErrorExtText,r.callback=function(e){e=="ok"&&Common.NotificationCenter.trigger("goback")})):(r.title=this.notcriticalErrorTitle,r.iconCls="warn",r.buttons=["ok"],r.callback=_.bind(function(t){e==Asc.c_oAscError.ID.Warning&&t=="ok"&&this.appOptions.canDownload&&(Common.UI.Menu.Manager.hideAll(),this.appOptions.isDesktopApp&&this.appOptions.isOffline?this.api.asc_DownloadAs():this.getApplication().getController("LeftMenu").leftMenu.showMenu("file:saveas")),this._state.lostEditingRights=!1,this.onEditComplete()},this)),$(".asc-window.modal.alert:visible").length<1&&(Common.UI.alert(r),Common.component.Analytics.trackEvent("Internal Error",e.toString()))},onCoAuthoringDisconnect:function(){this.getApplication().getController("Viewport").getView("Viewport").setMode({isDisconnected:!0}),this.getApplication().getController("Viewport").getView("Common.Views.Header").setCanRename(!1),this.appOptions.canRename=!1,this._state.isDisconnected=!0},showTips:function(e){function n(){var n=e.shift();n&&(n+="\n"+t.textCloseTip,r.setTitle(n),r.show())}var t=this;if(!e.length)return;typeof e!="object"&&(e=[e]),this.tooltip||(this.tooltip=new Common.UI.Tooltip({owner:this.getApplication().getController("Toolbar").getView("Toolbar"),hideonclick:!0,placement:"bottom",cls:"main-info",offset:30}));var r=this.tooltip;r.on("tooltip:hide",function(){setTimeout(n,300)}),n()},updateWindowTitle:function(e,t){if(this._state.isDocModified!==e||t){var n=this.defaultTitleText;_.isEmpty(this.headerView.getDocumentCaption())||(n=this.headerView.getDocumentCaption()+" - "+n);if(e)clearTimeout(this._state.timerCaption),_.isUndefined(n)||(n="* "+n,this.headerView.setDocumentCaption(this.headerView.getDocumentCaption(),!0));else if(this._state.fastCoauth&&this._state.usersCount>1){var r=this;this._state.timerCaption=setTimeout(function(){r.headerView.setDocumentCaption(r.headerView.getDocumentCaption(),!1)},500)}else this.headerView.setDocumentCaption(this.headerView.getDocumentCaption(),!1);window.document.title!=n&&(window.document.title=n),Common.Gateway.setDocumentModified(e),this._state.isDocModified=e}},onDocumentChanged:function(){},onDocumentModifiedChanged:function(e){this.updateWindowTitle(e),Common.Gateway.setDocumentModified(e);if(this.toolbarView&&this.api){var t=$(".btn-icon",this.toolbarView.btnSave.cmpEl).hasClass("btn-synch"),n=this.appOptions.forcesave,r=this.api.asc_isDocumentCanSave();this.toolbarView.btnSave.isDisabled()!==(!r&&!t&&!n||this._state.isDisconnected||this._state.fastCoauth&&this._state.usersCount>1&&!n)&&this.toolbarView.btnSave.setDisabled(!r&&!t&&!n||this._state.isDisconnected||this._state.fastCoauth&&this._state.usersCount>1&&!n)}},onDocumentCanSaveChanged:function(e){if(this.toolbarView){var t=$(".btn-icon",this.toolbarView.btnSave.cmpEl).hasClass("btn-synch"),n=this.appOptions.forcesave;this.toolbarView.btnSave.isDisabled()!==(!e&&!t&&!n||this._state.isDisconnected||this._state.fastCoauth&&this._state.usersCount>1&&!n)&&this.toolbarView.btnSave.setDisabled(!e&&!t&&!n||this._state.isDisconnected||this._state.fastCoauth&&this._state.usersCount>1&&!n)}},onBeforeUnload:function(){Common.localStorage.save();var e=this.permissions.edit!==!1&&this.editorConfig.mode!=="view"&&this.editorConfig.mode!=="editdiagram";if(e&&this.api.asc_isDocumentModified()){var t=this;return this.api.asc_stopSaving(),this.continueSavingTimer=window.setTimeout(function(){t.api.asc_continueSaving()},500),this.leavePageText}},onUnload:function(){this.continueSavingTimer&&clearTimeout(this.continueSavingTimer)},hidePreloader:function(){this._state.customizationDone||(this._state.customizationDone=!0,this.appOptions.customization&&(this.appOptions.isDesktopApp?this.appOptions.customization.about=!1:this.appOptions.canBrandingExt||(this.appOptions.customization.about=!0)),Common.Utils.applyCustomization(this.appOptions.customization,mapCustomizationElements),this.appOptions.canBrandingExt&&(Common.Utils.applyCustomization(this.appOptions.customization,mapCustomizationExtElements),Common.Utils.applyCustomizationPlugins(this.UICustomizePlugins))),this.stackLongActions.pop({id:InitApplication,type:Asc.c_oAscAsyncActionType.BlockInteraction}),Common.NotificationCenter.trigger("layout:changed","main"),$("#loading-mask").hide().remove()},onDownloadUrl:function(e){Common.Gateway.downloadAs(e)},onUpdateVersion:function(e){var t=this;t.needToUpdateVersion=!0,t.onLongActionEnd(Asc.c_oAscAsyncActionType.BlockInteraction,LoadingDocument),Common.UI.error({msg:this.errorUpdateVersion,callback:function(){_.defer(function(){Common.Gateway.updateVersion(),e&&e.call(t),t.onLongActionBegin(Asc.c_oAscAsyncActionType.BlockInteraction,LoadingDocument)})}})},onServerVersion:function(e){return!1},onAdvancedOptions:function(e){var t=e.asc_getOptionId(),n=this,r;t==Asc.c_oAscAdvancedOptionsID.CSV?r=new Common.Views.OpenDialog({type:t,codepages:e.asc_getOptions().asc_getCodePages(),settings:e.asc_getOptions().asc_getRecommendedSettings(),handler:function(e,r){n.isShowOpenDialog=!1,n&&n.api&&(n.api.asc_setAdvancedOptions(t,new Asc.asc_CCSVAdvancedOptions(e,r)),n.loadMask&&n.loadMask.show())}}):t==Asc.c_oAscAdvancedOptionsID.DRM&&(r=new Common.Views.OpenDialog({type:t,handler:function(e){n.isShowOpenDialog=!1,n&&n.api&&(n.api.asc_setAdvancedOptions(t,new Asc.asc_CDRMAdvancedOptions(e)),n.loadMask&&n.loadMask.show())}})),r&&(this.isShowOpenDialog=!0,this.loadMask&&this.loadMask.hide(),this.onLongActionEnd(Asc.c_oAscAsyncActionType.BlockInteraction,LoadingDocument),r.show())},onActiveSheetChanged:function(e){!this.appOptions.isEditMailMerge&&!this.appOptions.isEditDiagram&&window.editor_elements_prepared&&(this.application.getController("Statusbar").selectTab(e),this.appOptions.isEdit&&!this.dontCloseDummyComment&&Common.NotificationCenter.trigger("comments:updatefilter",{property:"uid",value:new RegExp("^(doc_|sheet"+this.api.asc_getWorksheetId(e)+"_)")},!1))},onConfirmAction:function(e,t){var n=this;e==Asc.c_oAscConfirm.ConfirmReplaceRange?Common.UI.warning({title:this.notcriticalErrorTitle,msg:this.confirmMoveCellRange,buttons:["yes","no"],primary:"yes",callback:_.bind(function(e){t&&t(e==="yes"),e=="yes"&&n.onEditComplete(n.application.getController("DocumentHolder").getView("DocumentHolder"))},this)}):e==Asc.c_oAscConfirm.ConfirmPutMergeRange&&Common.UI.warning({closable:!1,title:this.notcriticalErrorTitle,msg:this.confirmPutMergeRange,buttons:["ok"],primary:"ok",callback:_.bind(function(e){t&&t(),n.onEditComplete(n.application.getController("DocumentHolder").getView("DocumentHolder"))},this)})},initNames:function(){this.shapeGroupNames=[this.txtBasicShapes,this.txtFiguredArrows,this.txtMath,this.txtCharts,this.txtStarsRibbons,this.txtCallouts,this.txtButtons,this.txtRectangles,this.txtLines]},fillAutoShapes:function(e,t){if(_.isEmpty(t)||_.isEmpty(e)||t.length!=e.length)return;var n=this,r=[],i=this.getCollection("ShapeGroups");i.reset();var s=e.length;_.each(e,function(e,i){var s=new Backbone.Collection([],{model:SSE.Models.ShapeModel}),o=t[i].length>18?7:6,u=Math.ceil(t[i].length/o)*35+3,a=30*o;_.each(t[i],function(e,t){s.add({imageUrl:e.Image,data:{shapeType:e.Type},tip:n.textShape+" "+(t+1),allowSelected:!0,selected:!1})}),r.push({groupName:n.shapeGroupNames[i],groupStore:s,groupWidth:a,groupHeight:u})}),i.add(r),setTimeout(function(){n.getApplication().getController("Toolbar").fillAutoShapes()},50)},fillTextArt:function(e){if(_.isEmpty(e))return;var t=this,n=[],r=this.getCollection("Common.Collections.TextArt");_.each(e,function(e,t){n.push({imageUrl:e,data:t,allowSelected:!0,selected:!1})}),r.reset(n),setTimeout(function(){t.getApplication().getController("Toolbar").fillTextArt()},50),setTimeout(function(){t.getApplication().getController("RightMenu").fillTextArt()},50)},updateThemeColors:function(){var e=this;setTimeout(function(){e.getApplication().getController("RightMenu").UpdateThemeColors()},50),setTimeout(function(){e.getApplication().getController("Toolbar").updateThemeColors()},50),setTimeout(function(){e.getApplication().getController("Statusbar").updateThemeColors()},50)},onSendThemeColors:function(e,t){Common.Utils.ThemeColor.setColors(e,t),window.styles_loaded&&!this.appOptions.isEditMailMerge&&!this.appOptions.isEditDiagram&&(this.updateThemeColors(),this.fillTextArt(this.api.asc_getTextArtPreviews()))},loadLanguages:function(){},onInsertImage:function(){this.getApplication().getController("RightMenu").onInsertImage()},onInsertChart:function(){this.getApplication().getController("RightMenu").onInsertChart()},onInsertShape:function(){this.getApplication().getController("RightMenu").onInsertShape()},onInsertTextArt:function(){this.getApplication().getController("RightMenu").onInsertTextArt()},onInternalCommand:function(e){if(e)switch(e.command){case"setChartData":this.setChartData(e.data);break;case"getChartData":this.getChartData();break;case"clearChartData":this.clearChartData();break;case"setMergeData":this.setMergeData(e.data);break;case"getMergeData":this.getMergeData();break;case"setAppDisabled":this.isAppDisabled=e.data;break;case"queryClose":$("body .asc-window:visible").length===0&&(this.isFrameClosed=!0,this.api.asc_closeCellEditor(),Common.Gateway.internalMessage("canClose",{mr:e.data.mr,answer:!0}));break;case"window:drag":this.isDiagramDrag=e.data;break;case"processmouse":this.onProcessMouse(e.data)}},setChartData:function(e){typeof e=="object"&&this.api&&(this.api.asc_addChartDrawingObject(e),this.isFrameClosed=!1)},getChartData:function(){if(this.api){var e=this.api.asc_getWordChartObject();typeof e=="object"&&Common.Gateway.internalMessage("chartData",{data:e})}},clearChartData:function(){this.api&&this.api.asc_closeCellEditor()},setMergeData:function(e){typeof e=="object"&&this.api&&(this.api.asc_setData(e),this.isFrameClosed=!1)},getMergeData:function(){if(this.api){var e=this.api.asc_getData();typeof e=="object"&&Common.Gateway.internalMessage("mergeData",{data:e})}},unitsChanged:function(e){var t=Common.localStorage.getItem("sse-settings-unit");Common.Utils.Metric.setCurrentMetric(t!==null?parseInt(t):Common.Utils.Metric.getDefaultMetric()),this.getApplication().getController("RightMenu").updateMetricUnit(),this.getApplication().getController("Print").getView("MainSettingsPrint").updateMetricUnit()},_compareActionStrong:function(e,t){return e.id===t.id&&e.type===t.type},_compareActionWeak:function(e,t){return e.type===t.type},onContextMenu:function(e){var t=e.target.getAttribute("data-can-copy"),n=e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement;if(n&&t==="false"||!n&&t!=="true")return e.stopPropagation(),e.preventDefault(),!1},onNamedRangeLocked:function(){$(".asc-window.modal.alert:visible").length<1&&Common.UI.alert({closable:!1,msg:this.errorCreateDefName,title:this.notcriticalErrorTitle,iconCls:"warn",buttons:["ok"],callback:_.bind(function(e){this.onEditComplete()},this)})},onTryUndoInFastCollaborative:function(){var e=window.localStorage.getItem("sse-hide-try-undoredo");(!e||parseInt(e)!=1)&&Common.UI.info({width:500,msg:this.textTryUndoRedo,iconCls:"info",buttons:["custom","cancel"],primary:"custom",customButtonText:this.textStrict,dontshow:!0,callback:_.bind(function(e,t){t&&window.localStorage.setItem("sse-hide-try-undoredo",1),e=="custom"&&(Common.localStorage.setItem("sse-settings-coauthmode",0),this.api.asc_SetFastCollaborative(!1),this._state.fastCoauth=!1),this.onEditComplete()},this)})},onAuthParticipantsChanged:function(e){var t=0;_.each(e,function(e){e.asc_getView()||t++}),this._state.usersCount=t},applySettings:function(){if(this.appOptions.isEdit&&!this.appOptions.isOffline&&this.appOptions.canCoAuthoring){var e=Common.localStorage.getItem("sse-settings-coauthmode"),t=this._state.fastCoauth;this._state.fastCoauth=e===null||parseInt(e)==1,this._state.fastCoauth&&!t&&this.toolbarView.synchronizeChanges()}this.appOptions.canForcesave&&(e=Common.localStorage.getItem("sse-settings-forcesave"),this.appOptions.forcesave=e===null?this.appOptions.canForcesave:parseInt(e)==1,this.api.asc_setIsForceSaveOnUserSave(this.appOptions.forcesave))},onDocumentName:function(e){this.headerView.setDocumentCaption(e),this.updateWindowTitle(this.api.asc_isDocumentModified(),!0)},onMeta:function(e){var t=this.getApplication(),n=t.getController("LeftMenu").getView("LeftMenu").getMenu("file");t.getController("Viewport").getView("Common.Views.Header").setDocumentCaption(e.title),this.updateWindowTitle(this.api.asc_isDocumentModified(),!0),this.appOptions.spreadsheet.title=e.title,n.loadDocument({doc:this.appOptions.spreadsheet}),n.panels.info.updateInfo(this.appOptions.spreadsheet),Common.Gateway.metaChange(e)},onPrint:function(){if(!this.appOptions.canPrint)return;Common.NotificationCenter.trigger("print",this)},onPrintUrl:function(e){this.iframePrint&&(this.iframePrint.parentNode.removeChild(this.iframePrint),this.iframePrint=null);if(!this.iframePrint){var t=this;this.iframePrint=document.createElement("iframe"),this.iframePrint.id="id-print-frame",this.iframePrint.style.display="none",this.iframePrint.style.visibility="hidden",this.iframePrint.style.position="fixed",this.iframePrint.style.right="0",this.iframePrint.style.bottom="0",document.body.appendChild(this.iframePrint),this.iframePrint.onload=function(){t.iframePrint.contentWindow.focus(),t.iframePrint.contentWindow.print(),t.iframePrint.contentWindow.blur(),window.focus()}}e&&(this.iframePrint.src=e)},requestPlugins:function(pluginsPath){if(!pluginsPath)return;var _createXMLHTTPObject=function(){var e;try{e=new ActiveXObject("Msxml2.XMLHTTP")}catch(t){try{e=new ActiveXObject("Microsoft.XMLHTTP")}catch(n){e=!1}}return!e&&typeof XMLHttpRequest!="undefined"&&(e=new XMLHttpRequest),e},_getPluginJson=function(plugin){if(!plugin)return"";try{var xhrObj=_createXMLHTTPObject();if(xhrObj&&plugin){xhrObj.open("GET",plugin,!1),xhrObj.send("");var pluginJson=eval("("+xhrObj.responseText+")");return pluginJson}}catch(e){}return null},value=_getPluginJson(pluginsPath);value&&this.updatePlugins(value,!1)},updatePlugins:function(plugins,uiCustomize){if(!plugins)return;var pluginsData=uiCustomize?plugins.UIpluginsData:plugins.pluginsData;if(!pluginsData||pluginsData.length<1)return;var _createXMLHTTPObject=function(){var e;try{e=new ActiveXObject("Msxml2.XMLHTTP")}catch(t){try{e=new ActiveXObject("Microsoft.XMLHTTP")}catch(n){e=!1}}return!e&&typeof XMLHttpRequest!="undefined"&&(e=new XMLHttpRequest),e},_getPluginJson=function(plugin){if(!plugin)return"";try{var xhrObj=_createXMLHTTPObject();if(xhrObj&&plugin){xhrObj.open("GET",plugin,!1),xhrObj.send("");var pluginJson=eval("("+xhrObj.responseText+")");return pluginJson}}catch(e){}return null},arr=[],baseUrl=_.isEmpty(plugins.url)?"":plugins.url;baseUrl!==""&&console.log("Obsolete: The url parameter is deprecated. Please check the documentation for new plugin connection configuration."),pluginsData.forEach(function(e){e=baseUrl+e;var t=_getPluginJson(e);t&&(t.baseUrl=e.substring(0,e.lastIndexOf("config.json")),t.oldVersion=baseUrl!=="",arr.push(t))}),arr.length>0&&this.updatePluginsList({autoStartGuid:plugins.autoStartGuid,pluginsData:arr},!!uiCustomize)},updatePluginsList:function(e,t){var n=this.getApplication().getCollection("Common.Collections.Plugins"),r=this.appOptions.isEdit;if(e){var i=[],s=[];e.pluginsData.forEach(function(e){if(t!==undefined&&(n.findWhere({baseUrl:e.baseUrl})||n.findWhere({guid:e.guid})))return;var o=e.variations,u=[];o.forEach(function(t){var n=!1;for(var i=0;i<t.EditorsSupport.length;i++)if(t.EditorsSupport[i]=="cell"){n=!0;break}if(n&&(r||t.isViewer)){var o=t.icons;e.oldVersion&&(o=[],t.icons.forEach(function(e){o.push(e.substring(e.lastIndexOf("/")+1))})),e.isUICustomizer?s.push(e.baseUrl+t.url):u.push(new Common.Models.PluginVariation({description:t.description,index:u.length,url:e.oldVersion?t.url.substring(t.url.lastIndexOf("/")+1):t.url,icons:o,isViewer:t.isViewer,EditorsSupport:t.EditorsSupport,isVisual:t.isVisual,isModal:t.isModal,isInsideMode:t.isInsideMode,initDataType:t.initDataType,initData:t.initData,isUpdateOleOnResize:t.isUpdateOleOnResize,buttons:t.buttons,size:t.size,initOnSelectionChanged:t.initOnSelectionChanged}))}}),u.length>0&&!e.isUICustomizer&&i.push(new Common.Models.Plugin({name:e.name,guid:e.guid,baseUrl:e.baseUrl,variations:u,currentVariation:0}))}),t!==!1&&(this.UICustomizePlugins=s),t===undefined?(n&&n.reset(i),this.appOptions.canPlugins=n.length>0):t||(n&&n.add(i),this.appOptions.canPlugins=n.length>0)}else t||(this.appOptions.canPlugins=!1);this.appOptions.canPlugins&&(this.getApplication().getController("Common.Controllers.Plugins").setMode(this.appOptions),e.autoStartGuid&&this.api.asc_pluginRun(e.autoStartGuid,0,"")),t||this.getApplication().getController("LeftMenu").enablePlugins()},leavePageText:"You have unsaved changes in this document. Click 'Stay on this Page' then 'Save' to save them. Click 'Leave this Page' to discard all the unsaved changes.",criticalErrorTitle:"Error",notcriticalErrorTitle:"Warning",errorDefaultMessage:"Error code: %1",criticalErrorExtText:'Press "Ok" to to back to document list.',openTitleText:"Opening Document",openTextText:"Opening document...",saveTitleText:"Saving Document",saveTextText:"Saving document...",loadFontsTitleText:"Loading Data",loadFontsTextText:"Loading data...",loadImagesTitleText:"Loading Images",loadImagesTextText:"Loading images...",loadFontTitleText:"Loading Data",loadFontTextText:"Loading data...",loadImageTitleText:"Loading Image",loadImageTextText:"Loading image...",downloadTitleText:"Downloading Document",downloadTextText:"Downloading document...",printTitleText:"Printing Document",printTextText:"Printing document...",uploadImageTitleText:"Uploading Image",uploadImageTextText:"Uploading image...",savePreparingText:"Preparing to save",savePreparingTitle:"Preparing to save. Please wait...",loadingDocumentTitleText:"Loading spreadsheet",uploadImageSizeMessage:"Maximium image size limit exceeded.",uploadImageExtMessage:"Unknown image format.",uploadImageFileCountMessage:"No images uploaded.",reloadButtonText:"Reload Page",unknownErrorText:"Unknown error.",convertationTimeoutText:"Convertation timeout exceeded.",downloadErrorText:"Download failed.",unsupportedBrowserErrorText:"Your browser is not supported.",requestEditFailedTitleText:"Access denied",requestEditFailedMessageText:"Someone is editing this document right now. Please try again later.",warnBrowserZoom:"Your browser's current zoom setting is not fully supported. Please reset to the default zoom by pressing Ctrl+0.",warnBrowserIE9:"The application has low capabilities on IE9. Use IE10 or higher",pastInMergeAreaError:"Cannot change part of a merged cell",titleRecalcFormulas:"Calculating formulas...",textRecalcFormulas:"Calculating formulas...",textPleaseWait:"It's working hard. Please wait...",errorWrongBracketsCount:"Found an error in the formula entered.<br>Wrong cout of brackets.",errorWrongOperator:"An error in the entered formula. Wrong operator is used.<br>Please correct the error or use the Esc button to cancel the formula editing.",errorCountArgExceed:"Found an error in the formula entered.<br>Count of arguments exceeded.",errorCountArg:"Found an error in the formula entered.<br>Invalid number of arguments.",errorFormulaName:"Found an error in the formula entered.<br>Incorrect formula name.",errorFormulaParsing:"Internal error while the formula parsing.",errorArgsRange:"Found an error in the formula entered.<br>Incorrect arguments range.",errorUnexpectedGuid:"External error.<br>Unexpected Guid. Please, contact support.",errorDatabaseConnection:"External error.<br>Database connection error. Please, contact support.",errorFileRequest:"External error.<br>File Request. Please, contact support.",errorFileVKey:"External error.<br>Incorrect securety key. Please, contact support.",errorStockChart:"Incorrect row order. To build a stock chart place the data on the sheet in the following order:<br> opening price, max price, min price, closing price.",errorDataRange:"Incorrect data range.",errorOperandExpected:"Operand expected",errorKeyEncrypt:"Unknown key descriptor",errorKeyExpire:"Key descriptor expired",errorUsersExceed:"Count of users was exceed",errorMoveRange:"Cann't change a part of merged cell",errorBadImageUrl:"Image url is incorrect",errorCoAuthoringDisconnect:"Server connection lost. You can't edit anymore.",errorFilePassProtect:"The document is password protected.",errorLockedAll:"The operation could not be done as the sheet has been locked by another user.",txtEditingMode:"Set editing mode...",textLoadingDocument:"Loading spreadsheet",textConfirm:"Confirmation",confirmMoveCellRange:"The destination cell's range can contain data. Continue the operation?",textYes:"Yes",textNo:"No",textAnonymous:"Anonymous",txtBasicShapes:"Basic Shapes",txtFiguredArrows:"Figured Arrows",txtMath:"Math",txtCharts:"Charts",txtStarsRibbons:"Stars & Ribbons",txtCallouts:"Callouts",txtButtons:"Buttons",txtRectangles:"Rectangles",txtLines:"Lines",txtDiagramTitle:"Chart Title",txtXAxis:"X Axis",txtYAxis:"Y Axis",txtSeries:"Seria",warnProcessRightsChange:"You have been denied the right to edit the file.",errorProcessSaveResult:"Saving is failed.",errorAutoFilterDataRange:"The operation could not be done for the selected range of cells.<br>Select a uniform data range inside or outside the table and try again.",errorAutoFilterChangeFormatTable:"The operation could not be done for the selected cells as you cannot move a part of the table.<br>Select another data range so that the whole table was shifted and try again.",errorAutoFilterHiddenRange:"The operation cannot be performed because the area contains filtered cells.<br>Please unhide the filtered elements and try again.",errorAutoFilterChange:"The operation is not allowed, as it is attempting to shift cells in a table on your worksheet.",textCloseTip:"Click to close the tip.",textShape:"Shape",errorFillRange:"Could not fill the selected range of cells.<br>All the merged cells need to be the same size.",errorUpdateVersion:"The file version has been changed. The page will be reloaded.",defaultTitleText:"ONLYOFFICE Spreadsheet Editor",errorUserDrop:"The file cannot be accessed right now.",txtArt:"Your text here",errorInvalidRef:"Enter a correct name for the selection or a valid reference to go to.",errorCreateDefName:"The existing named ranges cannot be edited and the new ones cannot be created<br>at the moment as some of them are being edited.",errorPasteMaxRange:"The copy and paste area does not match. Please select an area with the same size or click the first cell in a row to paste the copied cells.",errorConnectToServer:' The document could not be saved. Please check connection settings or contact your administrator.<br>When you click the \'OK\' button, you will be prompted to download the document.<br><br>Find more information about connecting Document Server <a href="https://api.onlyoffice.com/editors/callback" target="_blank">here</a>',errorLockedWorksheetRename:"The sheet cannot be renamed at the moment as it is being renamed by another user",textTryUndoRedo:"The Undo/Redo functions are disabled for the Fast co-editing mode.<br>Click the 'Strict mode' button to switch to the Strict co-editing mode to edit the file without other users interference and send your changes only after you save them. You can switch between the co-editing modes using the editor Advanced settings.",textStrict:"Strict mode",errorOpenWarning:"The length of one of the formulas in the file exceeded<br>the allowed number of characters and it was removed.",errorFrmlWrongReferences:"The function refers to a sheet that does not exist.<br>Please check the data and try again.",textBuyNow:"Visit website",textNoLicenseTitle:"ONLYOFFICE open source version",warnNoLicense:"You are using an open source version of ONLYOFFICE. The version has limitations for concurrent connections to the document server (20 connections at a time).<br>If you need more please consider purchasing a commercial license.",textContactUs:"Contact sales",confirmPutMergeRange:"The source data contains merged cells.<br>They will be unmerged before they are pasted into the table.",errorViewerDisconnect:"Connection is lost. You can still view the document,<br>but will not be able to download or print until the connection is restored.",warnLicenseExp:"Your license has expired.<br>Please update your license and refresh the page.",titleLicenseExp:"License expired",openErrorText:"An error has occurred while opening the file",saveErrorText:"An error has occurred while saving the file",errorCopyMultiselectArea:"This command cannot be used with multiple selections.<br>Select a single range and try again.",errorPrintMaxPagesCount:"Unfortunately, it’s not possible to print more than 1500 pages at once in the current version of the program.<br>This restriction will be eliminated in upcoming releases.",errorToken:"The document security token is not correctly formed.<br>Please contact your Document Server administrator.",errorTokenExpire:"The document security token has expired.<br>Please contact your Document Server administrator.",errorSessionAbsolute:"The document editing session has expired. Please reload the page.",errorSessionIdle:"The document has not been edited for quite a long time. Please reload the page.",errorSessionToken:"The connection to the server has been interrupted. Please reload the page.",errorAccessDeny:"You are trying to perform an action you do not have rights for.<br>Please contact your Document Server administrator.",titleServerVersion:"Editor updated",errorServerVersion:"The editor version has been updated. The page will be reloaded to apply the changes."}}(),SSE.Controllers.Main||{}))}),define("common/main/lib/view/DocumentAccessDialog",["common/main/lib/component/Window","common/main/lib/component/LoadMask"],function(){"use strict";Common.Views.DocumentAccessDialog=Common.UI.Window.extend(_.extend({initialize:function(e){var t={};_.extend(t,{title:this.textTitle,width:850,height:536,header:!0},e),this.template=['<div id="id-sharing-placeholder"></div>'].join(""),t.tpl=_.template(this.template,t),this.settingsurl=e.settingsurl||"",Common.UI.Window.prototype.initialize.call(this,t)},render:function(){Common.UI.Window.prototype.render.call(this),this.$window.find("> .body").css({height:"auto",overflow:"hidden"});var e=document.createElement("iframe");e.width="100%",e.height=500,e.align="top",e.frameBorder=0,e.scrolling="no",e.onload=_.bind(this._onLoad,this),$("#id-sharing-placeholder").append(e),this.loadMask=new Common.UI.LoadMask({owner:$("#id-sharing-placeholder")}),this.loadMask.setTitle(this.textLoading),this.loadMask.show(),e.src=this.settingsurl;var t=this;this._eventfunc=function(e){t._onWindowMessage(e)},this._bindWindowEvents.call(this),this.on("close",function(e){t._unbindWindowEvents()})},_bindWindowEvents:function(){window.addEventListener?window.addEventListener("message",this._eventfunc,!1):window.attachEvent&&window.attachEvent("onmessage",this._eventfunc)},_unbindWindowEvents:function(){window.removeEventListener?window.removeEventListener("message",this._eventfunc):window.detachEvent&&window.detachEvent("onmessage",this._eventfunc)},_onWindowMessage:function(e){if(e&&window.JSON)try{this._onMessage.call(this,window.JSON.parse(e.data))}catch(t){}},_onMessage:function(e){e&&e.needUpdate&&this.trigger("accessrights",this,e.sharingSettings),Common.NotificationCenter.trigger("window:close",this)},_onLoad:function(){this.loadMask&&this.loadMask.hide()},textTitle:"Sharing Settings",textLoading:"Loading"},Common.Views.DocumentAccessDialog||{}))}),define("spreadsheeteditor/main/app/view/FileMenuPanels",["common/main/lib/view/DocumentAccessDialog"],function(){"use strict";!SSE.Views.FileMenuPanels&&(SSE.Views.FileMenuPanels={}),SSE.Views.FileMenuPanels.ViewSaveAs=Common.UI.BaseView.extend({el:"#panel-saveas",menu:undefined,formats:[[{name:"XLSX",imgCls:"xlsx",type:Asc.c_oAscFileType.XLSX},{name:"PDF",imgCls:"pdf",type:Asc.c_oAscFileType.PDF},{name:"ODS",imgCls:"ods",type:Asc.c_oAscFileType.ODS},{name:"CSV",imgCls:"csv",type:Asc.c_oAscFileType.CSV}]],template:_.template(["<table><tbody>","<% _.each(rows, function(row) { %>","<tr>","<% _.each(row, function(item) { %>",'<td><span class="btn-doc-format <%= item.imgCls %>" /></td>',"<% }) %>","</tr>","<% }) %>","</tbody></table>"].join("")),initialize:function(e){Common.UI.BaseView.prototype.initialize.call(this,arguments),this.menu=e.menu},render:function(){return $(this.el).html(this.template({rows:this.formats})),$(".btn-doc-format",this.el).on("click",_.bind(this.onFormatClick,this)),_.isUndefined(this.scroller)&&(this.scroller=new Common.UI.Scroller({el:$(this.el),suppressScrollX:!0})),this.flatFormats=_.flatten(this.formats),this},onFormatClick:function(e){var t=/\s(\w+)/.exec(e.currentTarget.className);if(t){t=t[1];var n=_.findWhere(this.flatFormats,{imgCls:t});n&&this.menu&&this.menu.fireEvent("saveas:format",[this.menu,n.type])}}}),SSE.Views.FileMenuPanels.Settings=Common.UI.BaseView.extend(_.extend({el:"#panel-settings",menu:undefined,template:_.template(['<div style="width:100%; height:100%; position: relative;">','<div id="id-settings-menu" style="position: absolute; width:200px; top: 0; bottom: 0;" class="no-padding"></div>','<div id="id-settings-content" style="position: absolute; left: 200px; top: 0; right: 0; bottom: 0;" class="no-padding">','<div id="panel-settings-general" style="width:100%; height:100%;" class="no-padding main-settings-panel active"></div>','<div id="panel-settings-print" style="width:100%; height:100%;" class="no-padding main-settings-panel"></div>',"</div>","</div>"].join("")),initialize:function(e){Common.UI.BaseView.prototype.initialize.call(this,arguments),this.menu=e.menu},render:function(){return $(this.el).html(this.template()),this.generalSettings=new SSE.Views.FileMenuPanels.MainSettingsGeneral({menu:this.menu}),this.generalSettings.options={alias:"MainSettingsGeneral"},this.generalSettings.render(),this.printSettings=SSE.getController("Print").getView("MainSettingsPrint"),this.printSettings.menu=this.menu,this.printSettings.render($("#panel-settings-print")),this.viewSettingsPicker=new Common.UI.DataView({el:$("#id-settings-menu"),store:new Common.UI.DataViewStore([{name:this.txtGeneral,panel:this.generalSettings,iconCls:"mnu-settings-general",selected:!0},{name:this.txtPageSettings,panel:this.printSettings,iconCls:"mnu-print"}]),itemTemplate:_.template(['<div id="<%= id %>" class="settings-item-wrap">','<div class="settings-icon <%= iconCls %>" style="display: inline-block;" >',"</div><%= name %>","</div>"].join(""))}),this.viewSettingsPicker.on("item:select",_.bind(function(e,t,n){var r=n.get("panel");$("#id-settings-content > div").removeClass("active"),r.$el.addClass("active"),r.show()},this)),this},show:function(){Common.UI.BaseView.prototype.show.call(this,arguments);var e=this.viewSettingsPicker.getSelectedRec();e[0]&&e[0].get("panel").show()},setMode:function(e){this.mode=e,this.mode.canPrint||this.viewSettingsPicker.store.pop(),this.generalSettings&&this.generalSettings.setMode(this.mode)},setApi:function(e){this.generalSettings&&this.generalSettings.setApi(e)},txtGeneral:"General",txtPageSettings:"Page Settings"},SSE.Views.FileMenuPanels.Settings||{})),SSE.Views.MainSettingsPrint=Common.UI.BaseView.extend(_.extend({menu:undefined,template:_.template(['<table class="main"><tbody>',"<tr>",'<td class="left"><label><%= scope.textSettings %></label></td>','<td class="right"><div id="advsettings-print-combo-sheets" class="input-group-nr" /></td>',"</tr>",'<tr class="divider"></tr>','<tr class="divider"></tr>',"<tr>",'<td class="left"><label><%= scope.textPageSize %></label></td>','<td class="right"><div id="advsettings-print-combo-pages" class="input-group-nr" /></td>',"</tr>",'<tr class="divider"></tr>',"<tr>",'<td class="left"><label><%= scope.textPageOrientation %></label></td>','<td class="right"><span id="advsettings-print-combo-orient" /></td>',"</tr>",'<tr class="divider"></tr>',"<tr>",'<td class="left"><label><%= scope.textPageScaling %></label></td>','<td class="right"><span id="advsettings-print-combo-layout" /></td>',"</tr>",'<tr class="divider"></tr>',"<tr>",'<td class="left" style="vertical-align: top;"><label><%= scope.strMargins %></label></td>','<td class="right" style="vertical-align: top;"><div id="advsettings-margins">','<table cols="2" class="no-padding">',"<tr>","<td><label><%= scope.strTop %></label></td>","<td><label><%= scope.strBottom %></label></td>","</tr>","<tr>",'<td><div id="advsettings-spin-margin-top"></div></td>','<td><div id="advsettings-spin-margin-bottom"></div></td>',"</tr>","<tr>","<td><label><%= scope.strLeft %></label></td>","<td><label><%= scope.strRight %></label></td>","</tr>","<tr>",'<td><div id="advsettings-spin-margin-left"></div></td>','<td><div id="advsettings-spin-margin-right"></div></td>',"</tr>","</table>","</div></td>","</tr>",'<tr class="divider"></tr>',"<tr>",'<td class="left" style="vertical-align: top;"><label><%= scope.strPrint %></label></td>','<td class="right" style="vertical-align: top;"><div id="advsettings-print">','<div id="advsettings-print-chb-grid" style="margin-bottom: 10px;"/>','<div id="advsettings-print-chb-rows"/>',"</div></td>","</tr>",'<tr class="divider"></tr>','<tr class="divider"></tr>',"<tr>",'<td class="left"></td>','<td class="right"><button id="advsettings-print-button-save" class="btn normal dlg-btn primary"><%= scope.okButtonText %></button></td>',"</tr>","</tbody></table>"].join("")),initialize:function(e){Common.UI.BaseView.prototype.initialize.call(this,arguments),this.menu=e.menu,this.spinners=[],this._initSettings=!0},render:function(e){return e&&this.setElement(e,!1),$(this.el).html(this.template({scope:this})),this.cmbSheet=new Common.UI.ComboBox({el:$("#advsettings-print-combo-sheets"),style:"width: 242px;",menuStyle:"min-width: 242px;max-height: 280px;",editable:!1,cls:"input-group-nr",data:[]}),this.cmbPaperSize=new Common.UI.ComboBox({el:$("#advsettings-print-combo-pages"),style:"width: 242px;",menuStyle:"max-height: 280px; min-width: 242px;",editable:!1,cls:"input-group-nr",data:[{value:"215.9|279.4",displayValue:"US Letter (21,59cm x 27,94cm)",caption:"US Letter"},{value:"215.9|355.6",displayValue:"US Legal (21,59cm x 35,56cm)",caption:"US Legal"},{value:"210|297",displayValue:"A4 (21cm x 29,7cm)",caption:"A4"},{value:"148.1|209.9",displayValue:"A5 (14,81cm x 20,99cm)",caption:"A5"},{value:"176|250.1",displayValue:"B5 (17,6cm x 25,01cm)",caption:"B5"},{value:"104.8|241.3",displayValue:"Envelope #10 (10,48cm x 24,13cm)",caption:"Envelope #10"},{value:"110.1|220.1",displayValue:"Envelope DL (11,01cm x 22,01cm)",caption:"Envelope DL"},{value:"279.4|431.7",displayValue:"Tabloid (27,94cm x 43,17cm)",caption:"Tabloid"},{value:"297|420.1",displayValue:"A3 (29,7cm x 42,01cm)",caption:"A3"},{value:"304.8|457.1",displayValue:"Tabloid Oversize (30,48cm x 45,71cm)",caption:"Tabloid Oversize"},{value:"196.8|273",displayValue:"ROC 16K (19,68cm x 27,3cm)",caption:"ROC 16K"},{value:"119.9|234.9",displayValue:"Envelope Choukei 3 (11,99cm x 23,49cm)",caption:"Envelope Choukei 3"},{value:"330.2|482.5",displayValue:"Super B/A3 (33,02cm x 48,25cm)",caption:"Super B/A3"}]}),this.cmbPaperOrientation=new Common.UI.ComboBox({el:$("#advsettings-print-combo-orient"),style:"width: 132px;",menuStyle:"min-width: 132px;",editable:!1,cls:"input-group-nr",data:[{value:Asc.c_oAscPageOrientation.PagePortrait,displayValue:this.strPortrait},{value:Asc.c_oAscPageOrientation.PageLandscape,displayValue:this.strLandscape}]}),this.cmbLayout=new Common.UI.ComboBox({el:$("#advsettings-print-combo-layout"),style:"width: 242px;",menuStyle:"min-width: 242px;",editable:!1,cls:"input-group-nr",data:[{value:0,displayValue:this.textActualSize},{value:1,displayValue:this.textFitPage},{value:2,displayValue:this.textFitCols},{value:3,displayValue:this.textFitRows}]}),this.chPrintGrid=new Common.UI.CheckBox({el:$("#advsettings-print-chb-grid"),labelText:this.textPrintGrid}),this.chPrintRows=new Common.UI.CheckBox({el:$("#advsettings-print-chb-rows"),labelText:this.textPrintHeadings}),this.spnMarginTop=new Common.UI.MetricSpinner({el:$("#advsettings-spin-margin-top"),step:.1,width:110,defaultUnit:"cm",value:"0 cm",maxValue:48.25,minValue:0}),this.spinners.push(this.spnMarginTop),this.spnMarginBottom=new Common.UI.MetricSpinner({el:$("#advsettings-spin-margin-bottom"),step:.1,width:110,defaultUnit:"cm",value:"0 cm",maxValue:48.25,minValue:0}),this.spinners.push(this.spnMarginBottom),this.spnMarginLeft=new Common.UI.MetricSpinner({el:$("#advsettings-spin-margin-left"),step:.1,width:110,defaultUnit:"cm",value:"0.19 cm",maxValue:48.25,minValue:0}),this.spinners.push(this.spnMarginLeft),this.spnMarginRight=new Common.UI.MetricSpinner({el:$("#advsettings-spin-margin-right"),step:.1,width:110,defaultUnit:"cm",value:"0.19 cm",maxValue:48.25,minValue:0}),this.spinners.push(this.spnMarginRight),this.btnOk=new Common.UI.Button({el:"#advsettings-print-button-save"}),_.isUndefined(this.scroller)&&(this.scroller=new Common.UI.Scroller({el:$(this.el),suppressScrollX:!0})),this.fireEvent("render:after",this),this},updateMetricUnit:function(){if(this.spinners)for(var e=0;e<this.spinners.length;e++){var t=this.spinners[e];t.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName()),t.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt?1:.1)}var n=this.cmbPaperSize.store;for(var e=0;e<n.length;e++){var r=n.at(e),i=r.get("value"),s=/^\d{3}\.?\d*/.exec(i),o=/\d{3}\.?\d*$/.exec(i);r.set("displayValue",r.get("caption")+" ("+parseFloat(Common.Utils.Metric.fnRecalcFromMM(s).toFixed(2))+Common.Utils.Metric.getCurrentMetricName()+" x "+parseFloat(Common.Utils.Metric.fnRecalcFromMM(o).toFixed(2))+Common.Utils.Metric.getCurrentMetricName()+")")}this.cmbPaperSize.onResetItems()},applySettings:function(){this.menu&&this.menu.fireEvent("settings:apply",[this.menu])},show:function(){Common.UI.BaseView.prototype.show.call(this,arguments),this._initSettings&&(this.updateMetricUnit(),this._initSettings=!1),this.fireEvent("show",this)},okButtonText:"Save",strPortrait:"Portrait",strLandscape:"Landscape",textPrintGrid:"Print Gridlines",textPrintHeadings:"Print Rows and Columns Headings",strLeft:"Left",strRight:"Right",strTop:"Top",strBottom:"Bottom",strMargins:"Margins",textPageSize:"Page Size",textPageOrientation:"Page Orientation",strPrint:"Print",textSettings:"Settings for",textPageScaling:"Scaling",textActualSize:"Actual Size",textFitPage:"Fit Sheet on One Page",textFitCols:"Fit All Columns on One Page",textFitRows:"Fit All Rows on One Page"},SSE.Views.MainSettingsPrint||{})),SSE.Views.FileMenuPanels.MainSettingsGeneral=Common.UI.BaseView.extend(_.extend({el:"#panel-settings-general",menu:undefined,template:_.template(['<table class="main"><tbody>','<tr class="coauth">','<td class="left"><label><%= scope.txtLiveComment %></label></td>','<td class="right"><div id="fms-chb-live-comment"/></td>',"</tr>",'<tr class="divider coauth"></tr>','<tr class="autosave">','<td class="left"><label id="fms-lbl-autosave"><%= scope.textAutoSave %></label></td>','<td class="right"><span id="fms-chb-autosave" /></td>',"</tr>",'<tr class="divider autosave"></tr>','<tr class="forcesave">','<td class="left"><label id="fms-lbl-forcesave"><%= scope.textForceSave %></label></td>','<td class="right"><span id="fms-chb-forcesave" /></td>',"</tr>",'<tr class="divider forcesave"></tr>','<tr class="coauth changes">','<td class="left"><label><%= scope.strCoAuthMode %></label></td>','<td class="right">','<div><div id="fms-cmb-coauth-mode" style="display: inline-block; margin-right: 15px;"/>','<label id="fms-lbl-coauth-mode" style="vertical-align: middle;"><%= scope.strCoAuthModeDescFast %></label></div></td>',"</tr>",'<tr class="divider coauth changes"></tr>',"<tr>",'<td class="left"><label><%= scope.strZoom %></label></td>','<td class="right"><div id="fms-cmb-zoom" class="input-group-nr" /></td>',"</tr>",'<tr class="divider"></tr>',"<tr>",'<td class="left"><label><%= scope.strFontRender %></label></td>','<td class="right"><span id="fms-cmb-font-render" /></td>',"</tr>",'<tr class="divider"></tr>','<tr class="edit">','<td class="left"><label><%= scope.strUnit %></label></td>','<td class="right"><span id="fms-cmb-unit" /></td>',"</tr>",'<tr class="divider edit"></tr>','<tr class="edit">','<td class="left"><label><%= scope.strFuncLocale %></label></td>','<td class="right">','<div><div id="fms-cmb-func-locale" style="display: inline-block; margin-right: 15px;"/>','<label id="fms-lbl-func-locale" style="vertical-align: middle;"><%= scope.strFuncLocaleEx %></label></div></td>',"</tr>",'<tr class="divider edit"></tr>',"<tr>",'<td class="left"><label><%= scope.strRegSettings %></label></td>','<td class="right">','<div><div id="fms-cmb-reg-settings" style="display: inline-block; margin-right: 15px;"/>','<label id="fms-lbl-reg-settings" style="vertical-align: middle;"></label></div></td>',"</tr>",'<tr class="divider"></tr>',"<tr>",'<td class="left"></td>','<td class="right"><button id="fms-btn-apply" class="btn normal dlg-btn primary"><%= scope.okButtonText %></button></td>',"</tr>","</tbody></table>"].join("")),initialize:function(e){Common.UI.BaseView.prototype.initialize.call(this,arguments),this.menu=e.menu},render:function(){return $(this.el).html(this.template({scope:this})),this.chLiveComment=new Common.UI.CheckBox({el:$("#fms-chb-live-comment"),labelText:this.strLiveComment}),this.cmbCoAuthMode=(new Common.UI.ComboBox({el:$("#fms-cmb-coauth-mode"),style:"width: 160px;",editable:!1,cls:"input-group-nr",data:[{value:1,displayValue:this.strFast,descValue:this.strCoAuthModeDescFast},{value:0,displayValue:this.strStrict,descValue:this.strCoAuthModeDescStrict}]})).on("selected",_.bind(function(e,t){t.value==1&&this.chAutosave.getValue()!=="checked"&&this.chAutosave.setValue(1),this.lblCoAuthMode.text(t.descValue)},this)),this.lblCoAuthMode=$("#fms-lbl-coauth-mode"),this.cmbZoom=new Common.UI.ComboBox({el:$("#fms-cmb-zoom"),style:"width: 160px;",editable:!1,cls:"input-group-nr",menuStyle:"max-height: 210px;",data:[{value:50,displayValue:"50%"},{value:60,displayValue:"60%"},{value:70,displayValue:"70%"},{value:80,displayValue:"80%"},{value:90,displayValue:"90%"},{value:100,displayValue:"100%"},{value:110,displayValue:"110%"},{value:120,displayValue:"120%"},{value:150,displayValue:"150%"},{value:175,displayValue:"175%"},{value:200,displayValue:"200%"}]}),this.cmbFontRender=new Common.UI.ComboBox({el:$("#fms-cmb-font-render"),style:"width: 160px;",editable:!1,cls:"input-group-nr",data:[{value:Asc.c_oAscFontRenderingModeType.hintingAndSubpixeling,displayValue:this.txtWin},{value:Asc.c_oAscFontRenderingModeType.noHinting,displayValue:this.txtMac},{value:Asc.c_oAscFontRenderingModeType.hinting,displayValue:this.txtNative}]}),this.chAutosave=(new Common.UI.CheckBox({el:$("#fms-chb-autosave"),labelText:this.strAutosave})).on("change",_.bind(function(e,t,n,r){e.getValue()!=="checked"&&this.cmbCoAuthMode.getValue()&&(this.cmbCoAuthMode.setValue(0),this.lblCoAuthMode.text(this.strCoAuthModeDescStrict))},this)),this.lblAutosave=$("#fms-lbl-autosave"),this.chForcesave=new Common.UI.CheckBox({el:$("#fms-chb-forcesave"),labelText:this.strForcesave}),this.cmbUnit=new Common.UI.ComboBox({el:$("#fms-cmb-unit"),style:"width: 160px;",editable:!1,cls:"input-group-nr",data:[{value:Common.Utils.Metric.c_MetricUnits.cm,displayValue:this.txtCm},{value:Common.Utils.Metric.c_MetricUnits.pt,displayValue:this.txtPt},{value:Common.Utils.Metric.c_MetricUnits.inch,displayValue:this.txtInch}]}),this.cmbFuncLocale=(new Common.UI.ComboBox({el:$("#fms-cmb-func-locale"),style:"width: 160px;",editable:!1,cls:"input-group-nr",data:[{value:"en",displayValue:this.txtEn,exampleValue:this.txtExampleEn},{value:"de",displayValue:this.txtDe,exampleValue:this.txtExampleDe},{value:"ru",displayValue:this.txtRu,exampleValue:this.txtExampleRu},{value:"pl",displayValue:this.txtPl,exampleValue:this.txtExamplePl}]})).on("selected",_.bind(function(e,t){this.updateFuncExample(t.exampleValue)},this)),this.cmbRegSettings=(new Common.UI.ComboBox({el:$("#fms-cmb-reg-settings"),style:"width: 160px;",menuStyle:"max-height: 185px;",editable:!1,cls:"input-group-nr",data:[{value:1068,displayValue:Common.util.LanguageInfo.getLocalLanguageName(1068)[1]},{value:1029,displayValue:Common.util.LanguageInfo.getLocalLanguageName(1029)[1]},{value:1031,displayValue:Common.util.LanguageInfo.getLocalLanguageName(1031)[1]},{value:1032,displayValue:Common.util.LanguageInfo.getLocalLanguageName(1032)[1]},{value:3081,displayValue:Common.util.LanguageInfo.getLocalLanguageName(3081)[1]},{value:2057,displayValue:Common.util.LanguageInfo.getLocalLanguageName(2057)[1]},{value:1033,displayValue:Common.util.LanguageInfo.getLocalLanguageName(1033)[1]},{value:3082,displayValue:Common.util.LanguageInfo.getLocalLanguageName(3082)[1]},{value:1035,displayValue:Common.util.LanguageInfo.getLocalLanguageName(1035)[1]},{value:1036,displayValue:Common.util.LanguageInfo.getLocalLanguageName(1036)[1]},{value:1040,displayValue:Common.util.LanguageInfo.getLocalLanguageName(1040)[1]},{value:1041,displayValue:Common.util.LanguageInfo.getLocalLanguageName(1041)[1]},{value:1042,displayValue:Common.util.LanguageInfo.getLocalLanguageName(1042)[1]},{value:1062,displayValue:Common.util.LanguageInfo.getLocalLanguageName(1062)[1]},{value:1045,displayValue:Common.util.LanguageInfo.getLocalLanguageName(1045)[1]},{value:1046,displayValue:Common.util.LanguageInfo.getLocalLanguageName(1046)[1]},{value:2070,displayValue:Common.util.LanguageInfo.getLocalLanguageName(2070)[1]},{value:1049,displayValue:Common.util.LanguageInfo.getLocalLanguageName(1049)[1]},{value:1060,displayValue:Common.util.LanguageInfo.getLocalLanguageName(1060)[1]},{value:1055,displayValue:Common.util.LanguageInfo.getLocalLanguageName(1055)[1]},{value:1058,displayValue:Common.util.LanguageInfo.getLocalLanguageName(1058)[1]},{value:1066,displayValue:Common.util.LanguageInfo.getLocalLanguageName(1066)[1]},{value:2052,displayValue:Common.util.LanguageInfo.getLocalLanguageName(2052)[1]}]})).on("selected",_.bind(function(e,t){this.updateRegionalExample(t.value)},this)),this.btnApply=new Common.UI.Button({el:"#fms-btn-apply"}),this.btnApply.on("click",_.bind(this.applySettings,this)),_.isUndefined(this.scroller)&&(this.scroller=new Common.UI.Scroller({el:$(this.el),suppressScrollX:!0})),this},show:function(){Common.UI.BaseView.prototype.show.call(this,arguments),this.updateSettings()},setMode:function(e){this.mode=e,$("tr.autosave",this.el)[e.isEdit?"show":"hide"](),this.mode.isDesktopApp&&this.mode.isOffline&&(this.chAutosave.setCaption(this.strAutoRecover),this.lblAutosave.text(this.textAutoRecover)),$("tr.forcesave",this.el)[e.canForcesave?"show":"hide"](),$("tr.coauth",this.el)[e.canCoAuthoring&&e.isEdit?"show":"hide"](),$("tr.coauth.changes",this.el)[e.isEdit&&!e.isOffline&&e.canCoAuthoring?"show":"hide"]()},setApi:function(e){this.api=e},updateSettings:function(){var e=Common.localStorage.getItem("sse-settings-zoom");e=e!==null?parseInt(e):this.mode.customization&&this.mode.customization.zoom?parseInt(this.mode.customization.zoom):100;var t=this.cmbZoom.store.findWhere({value:e});this.cmbZoom.setValue(t?parseInt(t.get("value")):e>0?e+"%":100),e=Common.localStorage.getItem("sse-settings-livecomment"),this.chLiveComment.setValue(e===null||parseInt(e)!=0),e=Common.localStorage.getItem("sse-settings-coauthmode"),e===null&&Common.localStorage.getItem("sse-settings-autosave")===null&&this.mode.customization&&this.mode.customization.autosave===!1&&(e=0);var n=(e===null||parseInt(e)==1)&&(!this.mode.isDesktopApp||!this.mode.isOffline)&&this.mode.canCoAuthoring;t=this.cmbCoAuthMode.store.findWhere({value:parseInt(e)}),this.cmbCoAuthMode.setValue(t?t.get("value"):1),this.lblCoAuthMode.text(t?t.get("descValue"):this.strCoAuthModeDescFast),e=Common.localStorage.getItem("sse-settings-fontrender"),t=this.cmbFontRender.store.findWhere({value:parseInt(e)}),this.cmbFontRender.setValue(t?t.get("value"):window.devicePixelRatio>1?Asc.c_oAscFontRenderingModeType.noHinting:Asc.c_oAscFontRenderingModeType.hintingAndSubpixeling),e=Common.localStorage.getItem("sse-settings-unit"),t=this.cmbUnit.store.findWhere({value:parseInt(e)}),this.cmbUnit.setValue(t?parseInt(t.get("value")):Common.Utils.Metric.getDefaultMetric()),this._oldUnits=this.cmbUnit.getValue(),e=Common.localStorage.getItem("sse-settings-autosave"),e===null&&this.mode.customization&&this.mode.customization.autosave===!1&&(e=0),this.chAutosave.setValue(n||(e===null?this.mode.canCoAuthoring:parseInt(e)==1)),this.mode.canForcesave&&(e=Common.localStorage.getItem("sse-settings-forcesave"),e=e===null?this.mode.canForcesave:parseInt(e)==1,this.chForcesave.setValue(e)),e=Common.localStorage.getItem("sse-settings-func-locale"),e===null&&(e=(this.mode.lang?this.mode.lang:"en").toLowerCase()),t=this.cmbFuncLocale.store.findWhere({value:e}),t||(t=this.cmbFuncLocale.store.findWhere({value:e.split("-")[0]})),this.cmbFuncLocale.setValue(t?t.get("value"):"en"),this.updateFuncExample(t?t.get("exampleValue"):this.txtExampleEn),e=Common.localStorage.getItem("sse-settings-reg-settings");if(e!==null)t=this.cmbRegSettings.store.findWhere({value:parseInt(e)}),this.cmbRegSettings.setValue(t?t.get("value"):1033);else if(this.mode.lang){var r=this.mode.lang.toLowerCase(),i=r.split("-")[0].toLowerCase(),s=Common.util.LanguageInfo.getLocalLanguageCode(r),o,u;this.cmbRegSettings.store.each(function(e){var t=e.get("value"),n=Common.util.LanguageInfo.getLocalLanguageName(t)[0].toLowerCase();n==r&&(o=t),n.indexOf(i)==0&&(u=t)}),s=o?o:u?u:s?Common.util.LanguageInfo.getLocalLanguageName(s)[1]:1033,this.cmbRegSettings.setValue(s)}else this.cmbRegSettings.setValue(1033);this.updateRegionalExample(this.cmbRegSettings.getValue())},applySettings:function(){Common.localStorage.setItem("sse-settings-zoom",this.cmbZoom.getValue()),Common.localStorage.setItem("sse-settings-livecomment",this.chLiveComment.isChecked()?1:0),this.mode.isEdit&&!this.mode.isOffline&&this.mode.canCoAuthoring&&Common.localStorage.setItem("sse-settings-coauthmode",this.cmbCoAuthMode.getValue()),Common.localStorage.setItem("sse-settings-fontrender",this.cmbFontRender.getValue()),Common.localStorage.setItem("sse-settings-unit",this.cmbUnit.getValue()),Common.localStorage.setItem("sse-settings-autosave",this.chAutosave.isChecked()?1:0),this.mode.canForcesave&&Common.localStorage.setItem("sse-settings-forcesave",this.chForcesave.isChecked()?1:0),Common.localStorage.setItem("sse-settings-func-locale",this.cmbFuncLocale.getValue()),this.cmbRegSettings.getSelectedRecord()&&Common.localStorage.setItem("sse-settings-reg-settings",this.cmbRegSettings.getValue()),Common.localStorage.save(),this.menu&&(this.menu.fireEvent("settings:apply",[this.menu]),this._oldUnits!==this.cmbUnit.getValue()&&Common.NotificationCenter.trigger("settings:unitschanged",this))},updateRegionalExample:function(e){if(this.api){var t="";if(e){var n=new Asc.asc_CFormatCellsInfo;n.asc_setType(Asc.c_oAscNumFormatType.None),n.asc_setSymbol(e);var r=this.api.asc_getFormatCells(n);t=this.api.asc_getLocaleExample(r[4],1000.01,e),t=t+" "+this.api.asc_getLocaleExample(r[5],(new Date).getExcelDateWithTime(),e),t=t+" "+this.api.asc_getLocaleExample(r[6],(new Date).getExcelDateWithTime(),e)}$("#fms-lbl-reg-settings").text(_.isEmpty(t)?"":this.strRegSettingsEx+t)}},updateFuncExample:function(e){$("#fms-lbl-func-locale").text(_.isEmpty(e)?"":this.strRegSettingsEx+e)},strLiveComment:"Turn on option",strZoom:"Default Zoom Value",okButtonText:"Apply",txtLiveComment:"Live Commenting",txtWin:"as Windows",txtMac:"as OS X",txtNative:"Native",strFontRender:"Font Hinting",strUnit:"Unit of Measurement",txtCm:"Centimeter",txtPt:"Point",strAutosave:"Turn on autosave",textAutoSave:"Autosave",txtEn:"English",txtDe:"Deutsch",txtRu:"Russian",txtPl:"Polish",txtExampleEn:" SUM; MIN; MAX; COUNT",txtExampleDe:" SUMME; MIN; MAX; ANZAHL",txtExampleRu:" СУММ; МИН; МАКС; СЧЁТ",txtExamplePl:" SUMA; MIN; MAX; ILE.LICZB",strFuncLocale:"Formula Language",strFuncLocaleEx:"Example: SUM; MIN; MAX; COUNT",strRegSettings:"Regional Settings",strRegSettingsEx:"Example: ",strCoAuthMode:"Co-editing mode",strCoAuthModeDescFast:"Other users will see your changes at once",strCoAuthModeDescStrict:"You will need to accept changes before you can see them",strFast:"Fast",strStrict:"Strict",textAutoRecover:"Autorecover",strAutoRecover:"Turn on autorecover",txtInch:"Inch",textForceSave:"Save to Server",strForcesave:"Always save to server (otherwise save to server on document close)"},SSE.Views.FileMenuPanels.MainSettingsGeneral||{})),SSE.Views.FileMenuPanels.RecentFiles=Common.UI.BaseView.extend({el:"#panel-recentfiles",menu:undefined,template:_.template(['<div id="id-recent-view" style="margin: 20px 0;"></div>'].join("")),initialize:function(e){Common.UI.BaseView.prototype.initialize.call(this,arguments),this.menu=e.menu,this.recent=e.recent},render:function(){return $(this.el).html(this.template()),this.viewRecentPicker=new Common.UI.DataView({el:$("#id-recent-view"),store:new Common.UI.DataViewStore(this.recent),itemTemplate:_.template(['<div class="recent-wrap">','<div class="recent-icon"></div>','<div class="file-name"><%= Common.Utils.String.htmlEncode(title) %></div>','<div class="file-info"><%= Common.Utils.String.htmlEncode(folder) %></div>',"</div>"].join(""))}),this.viewRecentPicker.on("item:click",_.bind(this.onRecentFileClick,this)),_.isUndefined(this.scroller)&&(this.scroller=new Common.UI.Scroller({el:$(this.el),suppressScrollX:!0})),this},onRecentFileClick:function(e,t,n){this.menu&&this.menu.fireEvent("recent:open",[this.menu,n.get("url")])}}),SSE.Views.FileMenuPanels.CreateNew=Common.UI.BaseView.extend(_.extend({el:"#panel-createnew",menu:undefined,events:function(){return{"click .blank-document-btn":_.bind(this._onBlankDocument,this),"click .thumb-list .thumb-wrap":_.bind(this._onDocumentTemplate,this)}},template:_.template(['<h3 style="margin-top: 20px;"><%= scope.fromBlankText %></h3><hr noshade />','<div class="blank-document">','<div class="blank-document-btn"></div>','<div class="blank-document-info">',"<h3><%= scope.newDocumentText %></h3>","<%= scope.newDescriptionText %>","</div>","</div>","<h3><%= scope.fromTemplateText %></h3><hr noshade />",'<div class="thumb-list">',"<% _.each(docs, function(item) { %>",'<div class="thumb-wrap" template="<%= item.url %>">','<div class="thumb"<% if (!_.isEmpty(item.icon)) { %> style="background-image: url(<%= item.icon %>);" <% } %> />','<div class="title"><%= item.name %></div>',"</div>","<% }) %>","</div>"].join("")),initialize:function(e){Common.UI.BaseView.prototype.initialize.call(this,arguments),this.menu=e.menu},render:function(){return $(this.el).html(this.template({scope:this,docs:this.options[0].docs})),_.isUndefined(this.scroller)&&(this.scroller=new Common.UI.Scroller({el:$(this.el),suppressScrollX:!0})),this},_onBlankDocument:function(){this.menu&&this.menu.fireEvent("create:new",[this.menu,"blank"])},_onDocumentTemplate:function(e){this.menu&&this.menu.fireEvent("create:new",[this.menu,e.currentTarget.attributes.template.value])},fromBlankText:"From Blank",newDocumentText:"New Spreadsheet",newDescriptionText:"Create a new blank text document which you will be able to style and format after it is created during the editing. Or choose one of the templates to start a document of a certain type or purpose where some styles have already been pre-applied.",fromTemplateText:"From Template"},SSE.Views.FileMenuPanels.CreateNew||{})),SSE.Views.FileMenuPanels.DocumentInfo=Common.UI.BaseView.extend(_.extend({el:"#panel-info",menu:undefined,initialize:function(e){Common.UI.BaseView.prototype.initialize.call(this,arguments),this.rendered=!1,this.template=_.template(['<table class="main">',"<tr>",'<td class="left"><label>'+this.txtTitle+"</label></td>",'<td class="right"><label id="id-info-title">-</label></td>',"</tr>",'<tr class="author">','<td class="left"><label>'+this.txtAuthor+"</label></td>",'<td class="right"><span class="userLink" id="id-info-author">-</span></td>',"</tr>",'<tr class="placement">','<td class="left"><label>'+this.txtPlacement+"</label></td>",'<td class="right"><label id="id-info-placement">-</label></td>',"</tr>",'<tr class="date">','<td class="left"><label>'+this.txtDate+"</label></td>",'<td class="right"><label id="id-info-date">-</label></td>',"</tr>",'<tr class="divider date"></tr>',"</table>"].join("")),this.menu=e.menu},render:function(){return $(this.el).html(this.template()),this.lblTitle=$("#id-info-title"),this.lblPlacement=$("#id-info-placement"),this.lblDate=$("#id-info-date"),this.lblAuthor=$("#id-info-author"),this.rendered=!0,this.updateInfo(this.doc),_.isUndefined(this.scroller)&&(this.scroller=new Common.UI.Scroller({el:$(this.el),suppressScrollX:!0})),this},show:function(){Common.UI.BaseView.prototype.show.call(this,arguments)},hide:function(){Common.UI.BaseView.prototype.hide.call(this,arguments)},updateInfo:function(e){this.doc=e;if(!this.rendered)return;e=e||{},this.lblTitle.text(e.title?e.title:"-"),e.info?(e.info.author&&this.lblAuthor.text(e.info.author),this._ShowHideInfoItem("author",e.info.author!==undefined&&e.info.author!==null),e.info.created&&this.lblDate.text(e.info.created),this._ShowHideInfoItem("date",e.info.created!==undefined&&e.info.created!==null),e.info.folder&&this.lblPlacement.text(e.info.folder),this._ShowHideInfoItem("placement",e.info.folder!==undefined&&e.info.folder!==null)):this._ShowHideDocInfo(!1)},_ShowHideInfoItem:function(e,t){$("tr."+e,this.el)[t?"show":"hide"]()},_ShowHideDocInfo:function(e){this._ShowHideInfoItem("date",e),this._ShowHideInfoItem("placement",e),this._ShowHideInfoItem("author",e)},setMode:function(e){return this},txtTitle:"Document Title",txtAuthor:"Author",txtPlacement:"Placement",txtDate:"Creation Date"},SSE.Views.FileMenuPanels.DocumentInfo||{})),SSE.Views.FileMenuPanels.DocumentRights=Common.UI.BaseView.extend(_.extend({el:"#panel-rights",menu:undefined,initialize:function(e){Common.UI.BaseView.prototype.initialize.call(this,arguments),this.rendered=!1,this.template=_.template(['<table class="main">','<tr class="rights">','<td class="left" style="vertical-align: top;"><label>'+this.txtRights+"</label></td>",'<td class="right"><div id="id-info-rights"></div></td>',"</tr>",'<tr class="edit-rights">','<td class="left"></td><td class="right"><button id="id-info-btn-edit" class="btn normal dlg-btn primary custom" style="margin-right: 10px;">'+this.txtBtnAccessRights+"</button></td>","</tr>","</table>"].join("")),this.templateRights=_.template(["<table>","<% _.each(users, function(item) { %>","<tr>",'<td><span class="userLink <% if (item.isLink) { %>sharedLink<% } %>"></span><span><%= Common.Utils.String.htmlEncode(item.user) %></span></td>',"<td><%= Common.Utils.String.htmlEncode(item.permissions) %></td>","</tr>","<% }); %>","</table>"].join("")),this.menu=e.menu},render:function(){return $(this.el).html(this.template()),this.cntRights=$("#id-info-rights"),this.btnEditRights=new Common.UI.Button({el:"#id-info-btn-edit"}),this.btnEditRights.on("click",_.bind(this.changeAccessRights,this)),this.rendered=!0,this.updateInfo(this.doc),_.isUndefined(this.scroller)&&(this.scroller=new Common.UI.Scroller({el:$(this.el),suppressScrollX:!0})),this},show:function(){Common.UI.BaseView.prototype.show.call(this,arguments)},hide:function(){Common.UI.BaseView.prototype.hide.call(this,arguments)},updateInfo:function(e){this.doc=e;if(!this.rendered)return;e=e||{},e.info?(e.info.sharingSettings&&this.cntRights.html(this.templateRights({users:e.info.sharingSettings})),this._ShowHideInfoItem("rights",e.info.sharingSettings!==undefined&&e.info.sharingSettings!==null&&e.info.sharingSettings.length>0),this._ShowHideInfoItem("edit-rights",!!this.sharingSettingsUrl&&this.sharingSettingsUrl.length&&this._readonlyRights!==!0)):this._ShowHideDocInfo(!1)},_ShowHideInfoItem:function(e,t){$("tr."+e,this.el)[t?"show":"hide"]()},_ShowHideDocInfo:function(e){this._ShowHideInfoItem("rights",e),this._ShowHideInfoItem("edit-rights",e)},setMode:function(e){return this.sharingSettingsUrl=e.sharingSettingsUrl,this},changeAccessRights:function(e,t,n){if(this._docAccessDlg)return;var r=this;r._docAccessDlg=new Common.Views.DocumentAccessDialog({settingsurl:this.sharingSettingsUrl}),r._docAccessDlg.on("accessrights",function(e,t){r.doc.info.sharingSettings=t,r._ShowHideInfoItem("rights",r.doc.info.sharingSettings!==undefined&&r.doc.info.sharingSettings!==null&&r.doc.info.sharingSettings.length>0),r.cntRights.html(r.templateRights({users:r.doc.info.sharingSettings}))}).on("close",function(e){r._docAccessDlg=undefined}),r._docAccessDlg.show()},onLostEditRights:function(){this._readonlyRights=!0;if(!this.rendered)return;this._ShowHideInfoItem("edit-rights",!1)},txtRights:"Persons who have rights",txtBtnAccessRights:"Change access rights"},SSE.Views.FileMenuPanels.DocumentRights||{})),SSE.Views.FileMenuPanels.Help=Common.UI.BaseView.extend({el:"#panel-help",menu:undefined,template:_.template(['<div style="width:100%; height:100%; position: relative;">','<div id="id-help-contents" style="position: absolute; width:200px; top: 0; bottom: 0;" class="no-padding"></div>','<div id="id-help-frame" style="position: absolute; left: 200px; top: 0; right: 0; bottom: 0;" class="no-padding"></div>',"</div>"].join("")),initialize:function(e){Common.UI.BaseView.prototype.initialize.call(this,arguments),this.menu=e.menu,this.urlPref="resources/help/en/",this.en_data=[{src:"UsageInstructions/OpenCreateNew.htm",name:"Create a new spreadsheet or open an existing one",headername:"Usage Instructions",selected:!0},{src:"UsageInstructions/ManageSheets.htm",name:"Manage sheets"},{src:"UsageInstructions/InsertDeleteCells.htm",name:"Insert or delete cells, rows, and columns"},{src:"UsageInstructions/CopyPasteData.htm",name:"Copy and paste data"},{src:"UsageInstructions/FontTypeSizeStyle.htm",name:"Set font type, size, style, and colors"},{src:"UsageInstructions/AlignText.htm",name:"Align data in cells"},{src:"UsageInstructions/AddBorders.htm",name:"Add borders"},{src:"UsageInstructions/MergeCells.htm",name:"Merge cells"},{src:"UsageInstructions/ClearFormatting.htm",name:"Clear text, format in a cell"},{src:"UsageInstructions/SortData.htm",name:"Sort data"},{src:"UsageInstructions/InsertFunction.htm",name:"Insert function"},{src:"UsageInstructions/ChangeNumberFormat.htm",name:"Change number format"},{src:"UsageInstructions/UndoRedo.htm",name:"Undo/redo your actions"},{src:"UsageInstructions/ViewDocInfo.htm",name:"View file information"},{src:"UsageInstructions/SavePrintDownload.htm",name:"Save/print/download your spreadsheet"},{src:"HelpfulHints/About.htm",name:"About ONLYOFFICE Spreadsheet Editor",headername:"Helpful Hints"},{src:"HelpfulHints/SupportedFormats.htm",name:"Supported Formats of Spreadsheets"},{src:"HelpfulHints/Navigation.htm",name:"Navigation through Your Spreadsheet"},{src:"HelpfulHints/Search.htm",name:"Search Function"},{src:"HelpfulHints/KeyboardShortcuts.htm",name:"Keyboard Shortcuts"}],Common.Utils.isIE&&(window.onhelp=function(){return!1})},render:function(){var e=this;return $(this.el).html(this.template()),this.viewHelpPicker=new Common.UI.DataView({el:$("#id-help-contents"),store:new Common.UI.DataViewStore([]),keyMoveDirection:"vertical",itemTemplate:_.template(['<div id="<%= id %>" class="help-item-wrap">','<div class="caption"><%= name %></div>',"</div>"].join(""))}),this.viewHelpPicker.on("item:add",function(e,t,n){n.has("headername")&&$(t.el).before('<div class="header-name">'+n.get("headername")+"</div>")}),this.viewHelpPicker.on("item:select",function(t,n,r){e.iFrame.src=e.urlPref+r.get("src")}),this.iFrame=document.createElement("iframe"),this.iFrame.src="",this.iFrame.align="top",this.iFrame.frameBorder="0",this.iFrame.width="100%",this.iFrame.height="100%",Common.Gateway.on("internalcommand",function(t){if(t.type=="help:hyperlink"){var n=t.data,r=e.viewHelpPicker.store.find(function(e){return n.indexOf(e.get("src"))>0});r&&(e.viewHelpPicker.selectRecord(r,!0),e.viewHelpPicker.scrollToRecord(r))}}),$("#id-help-frame").append(this.iFrame),this},setLangConfig:function(e){var t=this,n=this.viewHelpPicker.store;if(e){e=e.split("-")[0];var r={dataType:"json",error:function(){t.urlPref.indexOf("resources/help/en/")<0?(t.urlPref="resources/help/en/",n.url="resources/help/en/Contents.json",n.fetch(r)):(t.urlPref="resources/help/en/",n.reset(t.en_data))},success:function(){var e=n.at(0);t.viewHelpPicker.selectRecord(e),t.iFrame.src=t.urlPref+e.get("src")}};n.url="resources/help/"+e+"/Contents.json",n.fetch(r),this.urlPref="resources/help/"+e+"/"}},show:function(){Common.UI.BaseView.prototype.show.call(this),this._scrollerInited||(this.viewHelpPicker.scroller.update(),this._scrollerInited=!0)}})}),define("text!spreadsheeteditor/main/app/template/PrintSettings.template",[],function(){return'<div class="settings-panel active">\r\n <div class="padding-large inner-content" >\r\n <div id="printadv-dlg-combo-range" class="input-group-nr" /> </div>\r\n <div class="padding-large"/>\r\n <div class="padding-large inner-content" >\r\n <div id="printadv-dlg-combo-sheets" class="input-group-nr" />\r\n </div>\r\n <div class="padding-large inner-content" >\r\n <div id="printadv-dlg-combo-pages" class="input-group-nr" />\r\n </div>\r\n <div class="padding-large inner-content" >\r\n <span id="printadv-dlg-combo-orient" />\r\n </div>\r\n <div class="padding-large inner-content" >\r\n <span id="printadv-dlg-combo-layout" />\r\n </div>\r\n <div id="printadv-dlg-content-to-hide">\r\n <div class="padding-large inner-content" >\r\n <table cols="2" class="no-padding">\r\n <tr>\r\n <td><label><%= scope.strTop %></label></td>\r\n <td><label><%= scope.strBottom %></label></td>\r\n </tr>\r\n <tr>\r\n <td class="padding-small"><div id="printadv-dlg-spin-margin-top" style="margin-right: 19px;"></div></td>\r\n <td class="padding-small"><div id="printadv-dlg-spin-margin-bottom"></div></td>\r\n </tr>\r\n <tr>\r\n <td><label><%= scope.strLeft %></label></td>\r\n <td><label><%= scope.strRight %></label></td>\r\n </tr>\r\n <tr>\r\n <td><div id="printadv-dlg-spin-margin-left" style="margin-right: 15px;"></div></td>\r\n <td><div id="printadv-dlg-spin-margin-right"></div></td>\r\n </tr>\r\n </table>\r\n </div>\r\n <div class="padding-small"/>\r\n <div class="inner-content">\r\n <div id="printadv-dlg-chb-grid" style="margin-bottom: 10px;"/>\r\n <div id="printadv-dlg-chb-rows"/>\r\n </div>\r\n </div>\r\n</div>\r\n'}),define("spreadsheeteditor/main/app/view/PrintSettings",["text!spreadsheeteditor/main/app/template/PrintSettings.template","common/main/lib/view/AdvancedSettingsWindow","common/main/lib/component/MetricSpinner","common/main/lib/component/CheckBox","common/main/lib/component/RadioBox","common/main/lib/component/ListView"],function(e){"use strict";SSE.Views.PrintSettings=Common.Views.AdvancedSettingsWindow.extend(_.extend({options:{alias:"PrintSettings",contentWidth:280,height:471},initialize:function(t){_.extend(this.options,{title:this.textTitle,template:['<div class="box" style="height:'+(this.options.height-85)+'px;">','<div class="menu-panel" style="overflow: hidden;">','<div style="height: 42px; line-height: 42px;" class="div-category">'+this.textPrintRange+"</div>",'<div style="height: 52px; line-height: 66px;" class="div-category">'+this.textSettings+"</div>",'<div style="height: 38px; line-height: 38px;" class="div-category">'+this.textPageSize+"</div>",'<div style="height: 38px; line-height: 38px;" class="div-category">'+this.textPageOrientation+"</div>",'<div style="height: 38px; line-height: 38px;" class="div-category">'+this.textPageScaling+"</div>",'<div style="height: 108px; line-height: 33px;" class="div-category">'+this.strMargins+"</div>",'<div style="height: 58px; line-height: 40px;" class="div-category">'+this.strPrint+"</div>","</div>",'<div class="content-panel">'+_.template(e)({scope:this})+"</div>","</div>",'<div class="separator horizontal"/>','<div class="footer justify">','<button id="printadv-dlg-btn-hide" class="btn btn-text-default" style="margin-right: 55px; width: 100px;">'+this.textHideDetails+"</button>",'<button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px; width: 150px;">'+this.btnPrint+"</button>",'<button class="btn normal dlg-btn" result="cancel" style="width: 86px;">'+this.cancelButtonText+"</button>","</div>"].join("")},t),Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this,this.options),this.spinners=[]},render:function(){Common.Views.AdvancedSettingsWindow.prototype.render.call(this),this.cmbRange=new Common.UI.ComboBox({el:$("#printadv-dlg-combo-range"),style:"width: 132px;",menuStyle:"min-width: 132px;max-height: 280px;",editable:!1,cls:"input-group-nr",data:[{value:Asc.c_oAscPrintType.ActiveSheets,displayValue:this.textCurrentSheet},{value:Asc.c_oAscPrintType.EntireWorkbook,displayValue:this.textAllSheets},{value:Asc.c_oAscPrintType.Selection,displayValue:this.textSelection}]}),this.cmbRange.on("selected",_.bind(this.comboRangeChange,this)),this.cmbSheet=new Common.UI.ComboBox({el:$("#printadv-dlg-combo-sheets"),style:"width: 242px;",menuStyle:"min-width: 242px;max-height: 280px;",editable:!1,cls:"input-group-nr",data:[]}),this.cmbPaperSize=new Common.UI.ComboBox({el:$("#printadv-dlg-combo-pages"),style:"width: 242px;",menuStyle:"max-height: 280px; min-width: 242px;",editable:!1,cls:"input-group-nr",data:[{value:"215.9|279.4",displayValue:"US Letter (21,59cm x 27,94cm)",caption:"US Letter"},{value:"215.9|355.6",displayValue:"US Legal (21,59cm x 35,56cm)",caption:"US Legal"},{value:"210|297",displayValue:"A4 (21cm x 29,7cm)",caption:"A4"},{value:"148.1|209.9",displayValue:"A5 (14,81cm x 20,99cm)",caption:"A5"},{value:"176|250.1",displayValue:"B5 (17,6cm x 25,01cm)",caption:"B5"},{value:"104.8|241.3",displayValue:"Envelope #10 (10,48cm x 24,13cm)",caption:"Envelope #10"},{value:"110.1|220.1",displayValue:"Envelope DL (11,01cm x 22,01cm)",caption:"Envelope DL"},{value:"279.4|431.7",displayValue:"Tabloid (27,94cm x 43,17cm)",caption:"Tabloid"},{value:"297|420.1",displayValue:"A3 (29,7cm x 42,01cm)",caption:"A3"},{value:"304.8|457.1",displayValue:"Tabloid Oversize (30,48cm x 45,71cm)",caption:"Tabloid Oversize"},{value:"196.8|273",displayValue:"ROC 16K (19,68cm x 27,3cm)",caption:"ROC 16K"},{value:"119.9|234.9",displayValue:"Envelope Choukei 3 (11,99cm x 23,49cm)",caption:"Envelope Choukei 3"},{value:"330.2|482.5",displayValue:"Super B/A3 (33,02cm x 48,25cm)",caption:"Super B/A3"}]}),this.cmbPaperOrientation=new Common.UI.ComboBox({el:$("#printadv-dlg-combo-orient"),style:"width: 132px;",menuStyle:"min-width: 132px;",editable:!1,cls:"input-group-nr",data:[{value:Asc.c_oAscPageOrientation.PagePortrait,displayValue:this.strPortrait},{value:Asc.c_oAscPageOrientation.PageLandscape,displayValue:this.strLandscape}]}),this.chPrintGrid=new Common.UI.CheckBox({el:$("#printadv-dlg-chb-grid"),labelText:this.textPrintGrid}),this.chPrintRows=new Common.UI.CheckBox({el:$("#printadv-dlg-chb-rows"),labelText:this.textPrintHeadings}),this.spnMarginTop=new Common.UI.MetricSpinner({el:$("#printadv-dlg-spin-margin-top"),step:.1,width:110,defaultUnit:"cm",value:"0 cm",maxValue:48.25,minValue:0}),this.spinners.push(this.spnMarginTop),this.spnMarginBottom=new Common.UI.MetricSpinner({el:$("#printadv-dlg-spin-margin-bottom"),step:.1,width:110,defaultUnit:"cm",value:"0 cm",maxValue:48.25,minValue:0}),this.spinners.push(this.spnMarginBottom),this.spnMarginLeft=new Common.UI.MetricSpinner({el:$("#printadv-dlg-spin-margin-left"),step:.1,width:110,defaultUnit:"cm",value:"0.19 cm",maxValue:48.25,minValue:0}),this.spinners.push(this.spnMarginLeft),this.spnMarginRight=new Common.UI.MetricSpinner({el:$("#printadv-dlg-spin-margin-right"),step:.1,width:110,defaultUnit:"cm",value:"0.19 cm",maxValue:48.25,minValue:0}),this.spinners.push(this.spnMarginRight),this.cmbLayout=new Common.UI.ComboBox({el:$("#printadv-dlg-combo-layout"),style:"width: 242px;",menuStyle:"min-width: 242px;",editable:!1,cls:"input-group-nr",data:[{value:0,displayValue:this.textActualSize},{value:1,displayValue:this.textFitPage},{value:2,displayValue:this.textFitCols},{value:3,displayValue:this.textFitRows}]}),this.btnHide=new Common.UI.Button({el:$("#printadv-dlg-btn-hide")}),this.btnHide.on("click",_.bind(this.handlerShowDetails,this)),this.panelDetails=$("#printadv-dlg-content-to-hide"),this.updateMetricUnit(),this.options.afterrender&&this.options.afterrender.call(this);var e=Common.localStorage.getItem("sse-hide-print-settings");this.extended=e!==null&&parseInt(e)==0,this.handlerShowDetails(this.btnHide)},setRange:function(e){this.cmbRange.setValue(e)},getRange:function(){return this.cmbRange.getValue()},comboRangeChange:function(e,t){this.fireEvent("changerange",this)},updateMetricUnit:function(){if(this.spinners)for(var e=0;e<this.spinners.length;e++){var t=this.spinners[e];t.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName()),t.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt?1:.1)}var n=this.cmbPaperSize.store;for(var e=0;e<n.length;e++){var r=n.at(e),i=r.get("value"),s=/^\d{3}\.?\d*/.exec(i),o=/\d{3}\.?\d*$/.exec(i);r.set("displayValue",r.get("caption")+" ("+parseFloat(Common.Utils.Metric.fnRecalcFromMM(s).toFixed(2))+Common.Utils.Metric.getCurrentMetricName()+" x "+parseFloat(Common.Utils.Metric.fnRecalcFromMM(o).toFixed(2))+Common.Utils.Metric.getCurrentMetricName()+")")}this.cmbPaperSize.onResetItems()},handlerShowDetails:function(e){this.extended?(this.extended=!1,this.panelDetails.css({display:"block"}),this.setHeight(471),e.setCaption(this.textHideDetails),Common.localStorage.setItem("sse-hide-print-settings",0)):(this.extended=!0,this.panelDetails.css({display:"none"}),this.setHeight(303),e.setCaption(this.textShowDetails),Common.localStorage.setItem("sse-hide-print-settings",1))},textTitle:"Print Settings",strLeft:"Left",strRight:"Right",strTop:"Top",strBottom:"Bottom",strPortrait:"Portrait",strLandscape:"Landscape",textPrintGrid:"Print Gridlines",textPrintHeadings:"Print Rows and Columns Headings",textPageSize:"Page Size",textPageOrientation:"Page Orientation",strMargins:"Margins",strPrint:"Print",btnPrint:"Save & Print",textPrintRange:"Print Range",textLayout:"Layout",textCurrentSheet:"Current Sheet",textAllSheets:"All Sheets",textSelection:"Selection",textActualSize:"Actual Size",textFitPage:"Fit Sheet on One Page",textFitCols:"Fit All Columns on One Page",textFitRows:"Fit All Rows on One Page",textShowDetails:"Show Details",cancelButtonText:"Cancel",textHideDetails:"Hide Details",textPageScaling:"Scaling",textSettings:"Sheet Settings"},SSE.Views.PrintSettings||{}))}),define("spreadsheeteditor/main/app/controller/Print",["core","spreadsheeteditor/main/app/view/FileMenuPanels","spreadsheeteditor/main/app/view/PrintSettings"],function(){"use strict";SSE.Controllers.Print=Backbone.Controller.extend(_.extend({views:["MainSettingsPrint"],initialize:function(){var e=Common.localStorage.getItem("sse-print-settings-range");e=e!==null?parseInt(e):Asc.c_oAscPrintType.ActiveSheets,this.adjPrintParams=new Asc.asc_CAdjustPrint,this.adjPrintParams.asc_setPrintType(e),this._changedProps=null,this.addListeners({MainSettingsPrint:{show:_.bind(this.onShowMainSettingsPrint,this),"render:after":_.bind(this.onAfterRender,this)},PrintSettings:{changerange:_.bind(this.onChangeRange,this)}})},onLaunch:function(){this.printSettings=this.createView("MainSettingsPrint")},onAfterRender:function(e){this.printSettings.cmbSheet.on("selected",_.bind(this.comboSheetsChange,this,this.printSettings)),this.printSettings.btnOk.on("click",_.bind(this.querySavePrintSettings,this)),Common.NotificationCenter.on("print",_.bind(this.openPrintSettings,this)),this.registerControlEvents(this.printSettings)},setApi:function(e){this.api=e,this.api.asc_registerCallback("asc_onSheetsChanged",_.bind(this.updateSheetsInfo,this))},updateSheetsInfo:function(){this.printSettings.isVisible()?this.updateSettings(this.printSettings):this.isFillSheets=!1},updateSettings:function(e){var t=this.api.asc_getWorksheetsCount(),n=-1,r=[];while(++n<t)this.api.asc_isWorksheetHidden(n)||r.push({displayValue:this.api.asc_getWorksheetName(n),value:n});e.cmbSheet.store.reset(r);var i=e.cmbSheet.store.findWhere({value:e.cmbSheet.getValue()})||e.cmbSheet.store.findWhere({value:this.api.asc_getActiveWorksheetIndex()});i&&e.cmbSheet.setValue(i.get("value"))},comboSheetsChange:function(e,t,n){this.fillPageOptions(e,this._changedProps[n.value]?this._changedProps[n.value]:this.api.asc_getPageOptions(n.value))},fillPageOptions:function(e,t){var n=t.asc_getPageSetup(),r=e.cmbPaperOrientation.store.findWhere({value:n.asc_getOrientation()});r&&e.cmbPaperOrientation.setValue(r.get("value"));var i=n.asc_getWidth(),s=n.asc_getHeight();r=e.cmbPaperSize.store.findWhere({value:i+"|"+s}),r?e.cmbPaperSize.setValue(r.get("value")):e.cmbPaperSize.setValue("Custom ("+i+" x "+s);var o=n.asc_getFitToWidth(),u=n.asc_getFitToHeight();!o&&!u?e.cmbLayout.setValue(0):o&&u?e.cmbLayout.setValue(1):o&&!u?e.cmbLayout.setValue(2):e.cmbLayout.setValue(3),r=e.cmbPaperOrientation.store.findWhere({value:n.asc_getOrientation()}),r&&e.cmbPaperOrientation.setValue(r.get("value")),n=t.asc_getPageMargins(),e.spnMarginLeft.setValue(Common.Utils.Metric.fnRecalcFromMM(n.asc_getLeft()),!0),e.spnMarginTop.setValue(Common.Utils.Metric.fnRecalcFromMM(n.asc_getTop()),!0),e.spnMarginRight.setValue(Common.Utils.Metric.fnRecalcFromMM(n.asc_getRight()),!0),e.spnMarginBottom.setValue(Common.Utils.Metric.fnRecalcFromMM(n.asc_getBottom()),!0),e.chPrintGrid.setValue(t.asc_getGridLines(),!0),e.chPrintRows.setValue(t.asc_getHeadings(),!0)},fillPrintOptions:function(e){this.printSettingsDlg.setRange(e.asc_getPrintType()),this.onChangeRange()},onChangeRange:function(){var e=this.printSettingsDlg.getRange(),t=this.printSettingsDlg.cmbSheet.store,n=e!==Asc.c_oAscPrintType.EntireWorkbook?t.findWhere({value:this.api.asc_getActiveWorksheetIndex()}):t.at(0);n&&(this.printSettingsDlg.cmbSheet.setValue(n.get("value")),this.comboSheetsChange(this.printSettingsDlg,this.printSettingsDlg.cmbSheet,n.toJSON())),this.printSettingsDlg.cmbSheet.setDisabled(e!==Asc.c_oAscPrintType.EntireWorkbook)},getPageOptions:function(e){var t=new Asc.asc_CPageOptions;t.asc_setGridLines(e.chPrintGrid.getValue()=="indeterminate"?undefined:e.chPrintGrid.getValue()=="checked"?1:0),t.asc_setHeadings(e.chPrintRows.getValue()=="indeterminate"?undefined:e.chPrintRows.getValue()=="checked"?1:0);var n=new Asc.asc_CPageSetup;n.asc_setOrientation(e.cmbPaperOrientation.getValue()=="-"?undefined:e.cmbPaperOrientation.getValue());var r=/^\d{3}\.?\d*/.exec(e.cmbPaperSize.getValue()),i=/\d{3}\.?\d*$/.exec(e.cmbPaperSize.getValue());n.asc_setWidth(r?parseFloat(r[0]):undefined),n.asc_setHeight(i?parseFloat(i[0]):undefined);var s=e.cmbLayout.getValue();return n.asc_setFitToWidth(s==1||s==2),n.asc_setFitToHeight(s==1||s==3),t.asc_setPageSetup(n),n=new Asc.asc_CPageMargins,n.asc_setLeft(e.spnMarginLeft.getValue()=="-"?undefined:Common.Utils.Metric.fnRecalcToMM(e.spnMarginLeft.getNumberValue())),n.asc_setTop(e.spnMarginTop.getValue()=="-"?undefined:Common.Utils.Metric.fnRecalcToMM(e.spnMarginTop.getNumberValue())),n.asc_setRight(e.spnMarginRight.getValue()=="-"?undefined:Common.Utils.Metric.fnRecalcToMM(e.spnMarginRight.getNumberValue())),n.asc_setBottom(e.spnMarginBottom.getValue()=="-"?undefined:Common.Utils.Metric.fnRecalcToMM(e.spnMarginBottom.getNumberValue())),t.asc_setPageMargins(n),t},savePageOptions:function(e){var t=this.api.asc_getWorksheetsCount(),n=-1;while(++n<t)this._changedProps[n]&&this.api.asc_setPageOptions(this._changedProps[n],n)},onShowMainSettingsPrint:function(){this._changedProps=[],this.isFillSheets||(this.isFillSheets=!0,this.updateSettings(this.printSettings));var e=this.printSettings.cmbSheet.store.findWhere({value:this.api.asc_getActiveWorksheetIndex()});e&&(this.printSettings.cmbSheet.setValue(e.get("value")),this.comboSheetsChange(this.printSettings,this.printSettings.cmbSheet,e.toJSON()))},openPrintSettings:function(e){this.api&&(this.printSettingsDlg=new SSE.Views.PrintSettings({handler:_.bind(this.resultPrintSettings,this),afterrender:_.bind(function(){this._changedProps=[],this.updateSettings(this.printSettingsDlg),this.printSettingsDlg.cmbSheet.on("selected",_.bind(this.comboSheetsChange,this,this.printSettingsDlg)),this.fillPrintOptions(this.adjPrintParams),this.registerControlEvents(this.printSettingsDlg)},this)}),this.printSettingsDlg.show())},resultPrintSettings:function(e,t){var n=SSE.getController("Toolbar").getView("Toolbar");if(e=="ok"){if(!this.checkMargins(this.printSettingsDlg))return!0;this.savePageOptions(this.printSettingsDlg);var r=this.printSettingsDlg.getRange();this.adjPrintParams.asc_setPrintType(r),Common.localStorage.setItem("sse-print-settings-range",r),this.api.asc_Print(this.adjPrintParams,Common.Utils.isChrome||Common.Utils.isSafari||Common.Utils.isOpera),Common.component.Analytics.trackEvent("Print"),Common.component.Analytics.trackEvent("ToolBar","Print"),Common.NotificationCenter.trigger("edit:complete",n)}else Common.NotificationCenter.trigger("edit:complete",n)},querySavePrintSettings:function(){this.checkMargins(this.printSettings)&&(this.savePageOptions(this.printSettings),this.printSettings.applySettings())},checkMargins:function(e){if(e.cmbPaperOrientation.getValue()==Asc.c_oAscPageOrientation.PagePortrait)var t=/^\d{3}\.?\d*/.exec(e.cmbPaperSize.getValue()),n=/\d{3}\.?\d*$/.exec(e.cmbPaperSize.getValue());else n=/^\d{3}\.?\d*/.exec(e.cmbPaperSize.getValue()),t=/\d{3}\.?\d*$/.exec(e.cmbPaperSize.getValue());t=parseFloat(t[0]),n=parseFloat(n[0]);var r=Common.Utils.Metric.fnRecalcToMM(e.spnMarginLeft.getNumberValue()),i=Common.Utils.Metric.fnRecalcToMM(e.spnMarginRight.getNumberValue()),s=Common.Utils.Metric.fnRecalcToMM(e.spnMarginTop.getNumberValue()),o=Common.Utils.Metric.fnRecalcToMM(e.spnMarginBottom.getNumberValue()),u=!1;return r>t?u="left":i>t-r?u="right":s>n?u="top":o>n-s&&(u="bottom"),u?(Common.UI.warning({title:this.textWarning,msg:this.warnCheckMargings,callback:function(t,n){switch(u){case"left":e.spnMarginLeft.$el.focus();return;case"right":e.spnMarginRight.$el.focus();return;case"top":e.spnMarginTop.$el.focus();return;case"bottom":e.spnMarginBottom.$el.focus();return}}}),!1):!0},registerControlEvents:function(e){e.cmbPaperSize.on("selected",_.bind(this.propertyChange,this,e)),e.cmbPaperOrientation.on("selected",_.bind(this.propertyChange,this,e)),e.cmbLayout.on("selected",_.bind(this.propertyChange,this,e)),e.spnMarginTop.on("change",_.bind(this.propertyChange,this,e)),e.spnMarginBottom.on("change",_.bind(this.propertyChange,this,e)),e.spnMarginLeft.on("change",_.bind(this.propertyChange,this,e)),e.spnMarginRight.on("change",_.bind(this.propertyChange,this,e)),e.chPrintGrid.on("change",_.bind(this.propertyChange,this,e)),e.chPrintRows.on("change",_.bind(this.propertyChange,this,e))},propertyChange:function(e){this._changedProps&&(this._changedProps[e.cmbSheet.getValue()]=this.getPageOptions(e))},warnCheckMargings:"Margins are incorrect",strAllSheets:"All Sheets",textWarning:"Warning"},SSE.Controllers.Print||{}))});if(Common===undefined)var Common={};Common.Models=Common.Models||{},define("common/main/lib/model/Comment",["underscore","backbone","common/main/lib/component/BaseView"],function(e,t){"use strict";Common.Models.Comment=t.Model.extend({defaults:{uid:0,userid:0,username:"Guest",date:undefined,quote:"",comment:"",resolved:!1,lock:!1,lockuserid:"",unattached:!1,id:Common.UI.getId(),time:0,showReply:!1,showReplyInPopover:!1,editText:!1,editTextInPopover:!1,last:undefined,replys:[],hideAddReply:!1,scope:null,hide:!1,hint:!1,dummy:undefined,editable:!0}}),Common.Models.Reply=t.Model.extend({defaults:{time:0,userid:0,username:"Guest",reply:"",date:undefined,id:Common.UI.getId(),editText:!1,editTextInPopover:!1,scope:null,editable:!0}})});if(Common===undefined)var Common={};Common.Collections=Common.Collections||{},define("common/main/lib/collection/Comments",["underscore","backbone","common/main/lib/model/Comment"],function(e,t){"use strict";Common.Collections.Comments=t.Collection.extend({model:Common.Models.Comment,clearEditing:function(){this.each(function(e){e.set("editText",!1),e.set("editTextInPopover",!1),e.set("showReply",!1),e.set("showReplyInPopover",!1),e.set("hideAddReply",!1)})},getCommentsReplysCount:function(e){var t=0;return this.each(function(n){n.get("userid")==e&&t++;var r=n.get("replys");r&&r.length>0&&r.forEach(function(n){n.get("userid")==e&&t++})}),t}})});if(Common===undefined)var Common={};Common.Controllers=Common.Controllers||{},define("common/main/lib/controller/Comments",["core","common/main/lib/model/Comment","common/main/lib/collection/Comments","common/main/lib/view/Comments"],function(){"use strict";function e(){return typeof Asc.asc_CCommentDataWord!="undefined"?new Asc.asc_CCommentDataWord(null):new Asc.asc_CCommentData(null)}Common.Controllers.Comments=Backbone.Controller.extend(_.extend({models:[],collections:["Common.Collections.Comments"],views:["Common.Views.Comments","Common.Views.CommentsPopover"],sdkViewName:"#id_main",subEditStrings:{},filter:undefined,hintmode:!1,isSelectedComment:!1,uids:[],oldUids:[],isDummyComment:!1,initialize:function(){this.addListeners({"Common.Views.Comments":{"comment:add":_.bind(this.onCreateComment,this),"comment:change":_.bind(this.onChangeComment,this),"comment:remove":_.bind(this.onRemoveComment,this),"comment:resolve":_.bind(this.onResolveComment,this),"comment:show":_.bind(this.onShowComment,this),"comment:addReply":_.bind(this.onAddReplyComment,this),"comment:changeReply":_.bind(this.onChangeReplyComment,this),"comment:removeReply":_.bind(this.onRemoveReplyComment,this),"comment:editReply":_.bind(this.onShowEditReplyComment,this),"comment:closeEditing":_.bind(this.closeEditing,this),"comment:disableHint":_.bind(this.disableHint,this),"comment:addDummyComment":_.bind(this.onAddDummyComment,this)}}),Common.NotificationCenter.on("comments:updatefilter",_.bind(this.onUpdateFilter,this))},onLaunch:function(){this.collection=this.getApplication().getCollection("Common.Collections.Comments"),this.collection&&(this.collection.comparator=function(e){return-e.get("time")}),this.popoverComments=new Common.Collections.Comments,this.popoverComments&&(this.popoverComments.comparator=function(e){return-e.get("time")}),this.view=this.createView("Common.Views.Comments",{store:this.collection,popoverComments:this.popoverComments}),this.view.render(),this.bindViewEvents(this.view,this.events)},setConfig:function(e,t){this.setApi(t),e&&(this.currentUserId=e.config.user.id,this.currentUserName=e.config.user.fullname,this.sdkViewName=e.sdkviewname||this.sdkViewName,this.hintmode=e.hintmode||!1)},setApi:function(e){e&&(this.api=e,this.api.asc_registerCallback("asc_onAddComment",_.bind(this.onApiAddComment,this)),this.api.asc_registerCallback("asc_onAddComments",_.bind(this.onApiAddComments,this)),this.api.asc_registerCallback("asc_onRemoveComment",_.bind(this.onApiRemoveComment,this)),this.api.asc_registerCallback("asc_onChangeComments",_.bind(this.onChangeComments,this)),this.api.asc_registerCallback("asc_onRemoveComments",_.bind(this.onRemoveComments,this)),this.api.asc_registerCallback("asc_onChangeCommentData",_.bind(this.onApiChangeCommentData,this)),this.api.asc_registerCallback("asc_onLockComment",_.bind(this.onApiLockComment,this)),this.api.asc_registerCallback("asc_onUnLockComment",_.bind(this.onApiUnLockComment,this)),this.api.asc_registerCallback("asc_onShowComment",_.bind(this.onApiShowComment,this)),this.api.asc_registerCallback("asc_onHideComment",_.bind(this.onApiHideComment,this)),this.api.asc_registerCallback("asc_onUpdateCommentPosition",_.bind(this.onApiUpdateCommentPosition,this)),this.api.asc_registerCallback("asc_onDocumentPlaceChanged",_.bind(this.onDocumentPlaceChanged,this)))},setMode:function(e){return this.mode=e,this.isModeChanged=!0,this},onCreateComment:function(t,n,r,i,s){if(this.api&&n&&n.length>0){var o=e();o&&(this.showPopover=!0,this.editPopover=r?!0:!1,this.hidereply=i,this.isSelectedComment=!1,this.uids=[],o.asc_putText(n),o.asc_putTime(this.utcDateToString(new Date)),o.asc_putUserId(this.currentUserId),o.asc_putUserName(this.currentUserName),o.asc_putSolved(!1),_.isUndefined(o.asc_putDocumentFlag)||o.asc_putDocumentFlag(s),this.api.asc_addComment(o),this.view.showEditContainer(!1))}this.view.txtComment.focus()},onRemoveComment:function(e){this.api&&e&&this.api.asc_removeComment(e)},onResolveComment:function(t,n){var r=this,i=null,s=null,o=e(),u=r.findComment(t,n);return _.isUndefined(t)&&(t=u.get("uid")),o&&u?(o.asc_putText(u.get("comment")),o.asc_putQuoteText(u.get("quote")),o.asc_putTime(r.utcDateToString(new Date(u.get("time")))),o.asc_putUserId(r.currentUserId),o.asc_putUserName(r.currentUserName),o.asc_putSolved(!u.get("resolved")),_.isUndefined(o.asc_putDocumentFlag)||o.asc_putDocumentFlag(u.get("unattached")),i=u.get("replys"),i&&i.length&&i.forEach(function(t){s=e(),s&&(s.asc_putText(t.get("reply")),s.asc_putTime(r.utcDateToString(new Date(t.get("time")))),s.asc_putUserId(t.get("userid")),s.asc_putUserName(t.get("username")),o.asc_addReply(s))}),r.api.asc_changeComment(t,o),!0):!1},onShowComment:function(e,t){var n=this.findComment(e,undefined);if(n)if(null!==n.get("quote")){if(this.api){if(this.hintmode){this.animate=!0;if(n.get("unattached")&&this.getPopover()){this.getPopover().hide();return}}else{var r=this.popoverComments.findWhere({uid:e});if(r)return}!_.isUndefined(t)&&this.hintmode&&(this.isSelectedComment=t),this.api.asc_selectComment(e),this._dontScrollToComment=!0,this.api.asc_showComment(e,!1)}}else this.hintmode&&this.api.asc_selectComment(e),this.getPopover()&&this.getPopover().hide(),this.isSelectedComment=!1,this.uids=[]},onChangeComment:function(t,n){if(n&&n.length>0){var r=this,i=null,s=null,o=null,u=e(),a=r.findComment(t);if(a&&u)return u.asc_putText(n),u.asc_putQuoteText(a.get("quote")),u.asc_putTime(r.utcDateToString(new Date(a.get("time")))),u.asc_putUserId(r.currentUserId),u.asc_putUserName(r.currentUserName),u.asc_putSolved(a.get("resolved")),_.isUndefined(u.asc_putDocumentFlag)||u.asc_putDocumentFlag(a.get("unattached")),a.set("editTextInPopover",!1),i=r.findPopupComment(t),i&&i.set("editTextInPopover",!1),r.subEditStrings[t]&&delete r.subEditStrings[t],r.subEditStrings[t+"-R"]&&delete r.subEditStrings[t+"-R"],s=a.get("replys"),s&&s.length&&s.forEach(function(t){o=e(),o&&(o.asc_putText(t.get("reply")),o.asc_putTime(r.utcDateToString(new Date(t.get("time")))),o.asc_putUserId(t.get("userid")),o.asc_putUserName(t.get("username")),u.asc_addReply(o))}),r.api.asc_changeComment(t,u),!0}return!1},onChangeReplyComment:function(t,n,r){if(r&&r.length>0){var i=this,s=null,o=null,u=e(),a=i.findComment(t);if(u&&a)return u.asc_putText(a.get("comment")),u.asc_putQuoteText(a.get("quote")),u.asc_putTime(i.utcDateToString(new Date(a.get("time")))),u.asc_putUserId(a.get("userid")),u.asc_putUserName(a.get("username")),u.asc_putSolved(a.get("resolved")),_.isUndefined(u.asc_putDocumentFlag)||u.asc_putDocumentFlag(a.get("unattached")),s=a.get("replys"),s&&s.length&&s.forEach(function(t){o=e(),o&&(t.get("id")===n&&!_.isUndefined(r)?(o.asc_putText(r),o.asc_putUserId(i.currentUserId),o.asc_putUserName(i.currentUserName)):(o.asc_putText(t.get("reply")),o.asc_putUserId(t.get("userid")),o.asc_putUserName(t.get("username"))),o.asc_putTime(i.utcDateToString(new Date(t.get("time")))),u.asc_addReply(o))}),i.api.asc_changeComment(t,u),!0}return!1},onAddReplyComment:function(t,n){if(n.length>0){var r=this,i=null,s=null,o=null,u=e(),a=r.findComment(t);if(u&&a){i=a.get("uid"),i&&(r.subEditStrings[i]&&delete r.subEditStrings[i],r.subEditStrings[i+"-R"]&&delete r.subEditStrings[i+"-R"],a.set("showReplyInPopover",!1)),u.asc_putText(a.get("comment")),u.asc_putQuoteText(a.get("quote")),u.asc_putTime(r.utcDateToString(new Date(a.get("time")))),u.asc_putUserId(a.get("userid")),u.asc_putUserName(a.get("username")),u.asc_putSolved(a.get("resolved")),_.isUndefined(u.asc_putDocumentFlag)||u.asc_putDocumentFlag(a.get("unattached")),s=a.get("replys"),s&&s.length&&s.forEach(function(t){o=e(),o&&(o.asc_putText(t.get("reply")),o.asc_putTime(r.utcDateToString(new Date(t.get("time")))),o.asc_putUserId(t.get("userid")),o.asc_putUserName(t.get("username")),u.asc_addReply(o))}),o=e();if(o)return o.asc_putText(n),o.asc_putTime(r.utcDateToString(new Date)),o.asc_putUserId(r.currentUserId),o.asc_putUserName(r.currentUserName),u.asc_addReply(o),r.api.asc_changeComment(t,u),!0}}return!1},onRemoveReplyComment:function(t,n){if(!_.isUndefined(t)&&!_.isUndefined(n)){var r=this,i=null,s=null,o=e(),u=r.findComment(t);if(o&&u)return o.asc_putText(u.get("comment")),o.asc_putQuoteText(u.get("quote")),o.asc_putTime(r.utcDateToString(new Date(u.get("time")))),o.asc_putUserId(u.get("userid")),o.asc_putUserName(u.get("username")),o.asc_putSolved(u.get("resolved")),_.isUndefined(o.asc_putDocumentFlag)||o.asc_putDocumentFlag(u.get("unattached")),i=u.get("replys"),i&&i.length&&i.forEach(function(t){t.get("id")!==n&&(s=e(),s&&(s.asc_putText(t.get("reply")),s.asc_putTime(r.utcDateToString(new Date(t.get("time")))),s.asc_putUserId(t.get("userid")),s.asc_putUserName(t.get("username")),o.asc_addReply(s)))}),r.api.asc_changeComment(t,o),!0}return!1},onShowEditReplyComment:function(e,t,n){var r,i,s,o;if(!_.isUndefined(e)&&!_.isUndefined(t))if(n){i=this.popoverComments.findWhere({uid:e});if(i){s=i.get("replys"),o=_.clone(i.get("replys"));if(o)for(r=0;r<o.length;++r)if(t===o[r].get("id"))return o[r].set("editTextInPopover",!0),s.length=0,i.set("replys",o),!0}}else{i=this.collection.findWhere({uid:e});if(i){s=i.get("replys"),o=_.clone(i.get("replys"));if(o)for(r=0;r<o.length;++r)if(t===o[r].get("id"))return o[r].set("editText",!0),s.length=0,i.set("replys",o),!0}}return!1},onUpdateFilter:function(e,t){if(e){this.filter={property:e.property,value:e.value},t||this.getPopover()&&this.getPopover().hide();var n=this,r=null;this.collection.each(function(e){var t=e.get(n.filter.property);t&&e.set("hide",null===t.match(n.filter.value)),e.get("last")&&e.set("last",!1),e.get("hide")||(r=e)}),r&&r.set("last",!0)}},onApiAddComment:function(e,t){var n=this.readSDKComment(e,t);n&&(this.collection.push(n),this.updateComments(!0),this.showPopover&&(null!==t.asc_getQuoteText()&&(this.api.asc_selectComment(e),this._dontScrollToComment=!0,this.api.asc_showComment(e,!0)),this.showPopover=undefined,this.editPopover=!1))},onApiAddComments:function(e){for(var t=0;t<e.length;++t){var n=this.readSDKComment(e[t].asc_getId(),e[t]);this.collection.push(n)}this.updateComments(!0)},onApiRemoveComment:function(e,t){if(this.collection.length){var n=this.collection.findWhere({uid:e});n&&(this.collection.remove(n),t||this.updateComments(!0)),this.popoverComments.length&&(n=this.popoverComments.findWhere({uid:e}),n&&(this.popoverComments.remove(n),0===this.popoverComments.length&&this.getPopover()&&this.getPopover().hide()))}},onChangeComments:function(e){for(var t=0;t<e.length;++t)this.onApiChangeCommentData(e[t].Comment.Id,e[t].Comment,!0);this.updateComments(!0)},onRemoveComments:function(e){for(var t=0;t<e.length;++t)this.onApiRemoveComment(e[t],!0);this.updateComments(!0)},onApiChangeCommentData:function(e,t,n){var r=this,i=0,s=null,o=null,u=0,a=null,f=this.findComment(e);if(f){r=this,s=t.asc_getTime()==""?new Date:new Date(this.stringUtcToLocalDate(t.asc_getTime())),f.set("comment",t.asc_getText()),f.set("userid",t.asc_getUserId()),f.set("username",t.asc_getUserName()),f.set("resolved",t.asc_getSolved()),f.set("quote",t.asc_getQuoteText()),f.set("time",s.getTime()),f.set("date",r.dateToLocaleTimeString(s)),o=_.clone(f.get("replys")),o.length=0,u=t.asc_getRepliesCount();for(i=0;i<u;++i)a=t.asc_getReply(i).asc_getTime()==""?new Date:new Date(this.stringUtcToLocalDate(t.asc_getReply(i).asc_getTime())),o.push(new Common.Models.Reply({id:Common.UI.getId(),userid:t.asc_getReply(i).asc_getUserId(),username:t.asc_getReply(i).asc_getUserName(),date:r.dateToLocaleTimeString(a),reply:t.asc_getReply(i).asc_getText(),time:a.getTime(),editText:!1,editTextInPopover:!1,showReplyInPopover:!1,scope:r.view,editable:r.mode.canEditComments||t.asc_getReply(i).asc_getUserId()==r.currentUserId}));o.sort(function(e,t){return e.get("time")-t.get("time")}),f.set("replys",o),n||(this.updateComments(!1,!0),this.getPopover()&&this.getPopover().isVisible()&&(this._dontScrollToComment=!0,this.api.asc_showComment(e,!0)))}},onApiLockComment:function(e,t){var n=this.findComment(e),r=null,i=null;n&&(r=this.getApplication().getCollection("Common.Collections.Users"),r&&(i=r.findWhere({id:t}),i&&(this.getPopover()&&this.getPopover().saveText(),n.set("lock",!0),n.set("lockuserid",this.view.getUserName(i.get("username"))))))},onApiUnLockComment:function(e){var t=this.findComment(e);t&&(t.set("lock",!1),this.getPopover()&&this.getPopover().loadText())},onApiShowComment:function(e,t,n,r,i,s){this.isModeChanged=!1;if(s&&this.isSelectedComment&&0===_.difference(this.uids,e).length)return;this.mode&&!this.mode.canComments&&(s=!0);if(this.getPopover()){this.clearDummyComment();if(this.isSelectedComment&&0===_.difference(this.uids,e).length){this.api&&(this.getPopover().commentsView.setFocusToTextBox(!0),this.api.asc_enableKeyEvents(!0));return}var o=0,u="",a="",f=null,l="",c=!0;this.popoverComments.reset();for(o=0;o<e.length;++o)u=e[o],a=e[o]+"-R",f=this.findComment(u),this.subEditStrings[u]&&!s?(f.set("editTextInPopover",!0),l=this.subEditStrings[u]):this.subEditStrings[a]&&!s&&(f.set("showReplyInPopover",!0),l=this.subEditStrings[a]),f.set("hint",_.isUndefined(s)?!1:s),!s&&this.hintmode&&(0===_.difference(this.uids,e).length&&this.uids.length===0&&(c=!1),this.oldUids.length&&0===_.difference(this.oldUids,e).length&&(c=!1,this.oldUids=[])),this.animate&&(c=this.animate,this.animate=!1),this.isSelectedComment=!s||!this.hintmode,this.uids=_.clone(e),this.popoverComments.push(f),this._dontScrollToComment||this.view.commentsView.scrollToRecord(f),this._dontScrollToComment=!1;this.getPopover().isVisible()&&this.getPopover().hide(),this.getPopover().setLeftTop(t,n,r),this.getPopover().show(c,!1,!0,l)}},onApiHideComment:function(e){var t=this;if(this.getPopover()){if(this.isSelectedComment&&e)return;if(e&&this.getPopover().isCommentsViewMouseOver())return;this.popoverComments.each(function(e){e.get("editTextInPopover")&&(t.subEditStrings[e.get("uid")]=t.getPopover().getEditText()),e.get("showReplyInPopover")&&(t.subEditStrings[e.get("uid")+"-R"]=t.getPopover().getEditText())}),this.getPopover().saveText(!0),this.getPopover().hide(),this.collection.clearEditing(),this.popoverComments.clearEditing(),this.oldUids=_.clone(this.uids),this.isSelectedComment=!1,this.uids=[],this.popoverComments.reset()}},onApiUpdateCommentPosition:function(e,t,n,r){var i,s=!1,o=null,u=undefined,a="",f="";if(this.getPopover()){this.getPopover().saveText(),this.getPopover().hideTips();if(n<0||this.getPopover().sdkBounds.height<n||!_.isUndefined(r)&&this.getPopover().sdkBounds.width<r)this.getPopover().hide();else{this.isModeChanged&&this.onApiShowComment(e,t,n,r);if(0===this.popoverComments.length){this.popoverComments.reset();for(i=0;i<e.length;++i)a=e[i],f=e[i]+"-R",o=this.findComment(a),this.subEditStrings[a]?(o.set("editTextInPopover",!0),u=this.subEditStrings[a]):this.subEditStrings[f]&&(o.set("showReplyInPopover",!0),u=this.subEditStrings[f]),this.popoverComments.push(o);s=!0,this.getPopover().show(s,undefined,undefined,u)}else this.getPopover().isVisible()||this.getPopover().show(!1,undefined,undefined,u);this.getPopover().setLeftTop(t,n,r,undefined,!0)}}},onDocumentPlaceChanged:function(){if(this.isDummyComment&&this.getPopover()&&this.getPopover().isVisible()){var e=this.api.asc_getAnchorPosition();e&&this.getPopover().setLeftTop(e.asc_getX()+e.asc_getWidth(),e.asc_getY(),this.hintmode?e.asc_getX():undefined)}},updateComments:function(e,t){var n=this;n.updateCommentsTime=new Date,n.timerUpdateComments===undefined&&(n.timerUpdateComments=setInterval(function(){new Date-n.updateCommentsTime>100&&(clearInterval(n.timerUpdateComments),n.timerUpdateComments=undefined,n.updateCommentsView(e,t))},25))},updateCommentsView:function(e,t){var n,r=!0;_.isUndefined(t)&&this.collection.sort();if(e){for(n=this.collection.length-1;n>=0;--n)r?this.collection.at(n).set("last",!0,{silent:!0}):this.collection.at(n).get("last")&&this.collection.at(n).set("last",!1,{silent:!0}),r=!1;this.onUpdateFilter(this.filter,!0),this.view.render()}this.view.update()},findComment:function(e,t){return _.isUndefined(e)?this.collection.findWhere({id:t}):this.collection.findWhere({uid:e})},findPopupComment:function(e){return this.popoverComments.findWhere({id:e})},closeEditing:function(e){var t=this;if(!_.isUndefined(e)){var n=this.findPopupComment(e);n&&(n.set("editTextInPopover",!1),n.set("showReplyInPopover",!1)),this.subEditStrings[e]&&delete this.subEditStrings[e],this.subEditStrings[e+"-R"]&&delete this.subEditStrings[e+"-R"]}this.collection.clearEditing(),this.collection.each(function(e){var t=_.clone(e.get("replys"));e.get("replys").length=0,t.forEach(function(e){e.get("editText")&&e.set("editText",!1),e.get("editTextInPopover")&&e.set("editTextInPopover",!1)}),e.set("replys",t)}),this.view.showEditContainer(!1),this.view.update()},disableHint:function(e){e&&this.mode.canComments&&(e.set("hint",!1),this.api.asc_showComment(e.get("uid"),!1),this.isSelectedComment=!0)},blockPopover:function(e){this.isSelectedComment=e,e&&this.getPopover().isVisible()&&this.getPopover().hide()},getPopover:function(){return this.view.getPopover(this.sdkViewName)},readSDKComment:function(e,t){var n=t.asc_getTime()==""?new Date:new Date(this.stringUtcToLocalDate(t.asc_getTime())),r=new Common.Models.Comment({uid:e,userid:t.asc_getUserId(),username:t.asc_getUserName(),date:this.dateToLocaleTimeString(n),quote:t.asc_getQuoteText(),comment:t.asc_getText(),resolved:t.asc_getSolved(),unattached:_.isUndefined(t.asc_getDocumentFlag)?!1:t.asc_getDocumentFlag(),id:Common.UI.getId(),time:n.getTime(),showReply:!1,editText:!1,last:undefined,editTextInPopover:this.editPopover?!0:!1,showReplyInPopover:!1,hideAddReply:_.isUndefined(this.hidereply)?this.showPopover?!0:!1:this.hidereply,scope:this.view,editable:this.mode.canEditComments||t.asc_getUserId()==this.currentUserId});if(r){var i=this.readSDKReplies(t);i.length&&r.set("replys",i)}return r},readSDKReplies:function(e){var t=0,n=[],r=null,i=e.asc_getRepliesCount();if(i){for(t=0;t<i;++t)r=e.asc_getReply(t).asc_getTime()==""?new Date:new Date(this.stringUtcToLocalDate(e.asc_getReply(t).asc_getTime())),n.push(new Common.Models.Reply({id:Common.UI.getId(),userid:e.asc_getReply(t).asc_getUserId(),username:e.asc_getReply(t).asc_getUserName(),date:this.dateToLocaleTimeString(r),reply:e.asc_getReply(t).asc_getText(),time:r.getTime(),editText:!1,editTextInPopover:!1,showReplyInPopover:!1,scope:this.view,editable:this.mode.canEditComments||e.asc_getReply(t).asc_getUserId()==this.currentUserId}));n.sort(function(e,t){return e.get("time")-t.get("time")})}return n},addDummyComment:function(){if(this.api){var e=this,t=null,n=new Date,r=this.getPopover();if(r){if(this.popoverComments.length){_.delay(function(){r.commentsView.setFocusToTextBox()},200);return}var i=new Common.Models.Comment({id:-1,time:n.getTime(),date:this.dateToLocaleTimeString(n),userid:this.currentUserId,username:this.currentUserName,editTextInPopover:!0,showReplyInPopover:!1,hideAddReply:!0,scope:this.view,dummy:!0});this.popoverComments.reset(),this.popoverComments.push(i),this.uids=[],this.isSelectedComment=!0,this.isDummyComment=!0,_.isUndefined(this.api.asc_SetDocumentPlaceChangedEnabled)||e.api.asc_SetDocumentPlaceChangedEnabled(!0),r.handlerHide=function(){},r.isVisible()&&r.hide(),r.handlerHide=function(){e.clearDummyComment()},t=this.api.asc_getAnchorPosition(),t&&(r.setLeftTop(t.asc_getX()+t.asc_getWidth(),t.asc_getY(),this.hintmode?t.asc_getX():undefined),r.show(!0,!1,!0))}}},onAddDummyComment:function(t){if(this.api&&t&&t.length>0){var n=e();n&&(this.showPopover=!0,this.editPopover=!1,this.hidereply=!1,this.isSelectedComment=!1,this.uids=[],this.isDummyComment=!1,this.popoverComments.reset(),this.getPopover().isVisible()&&this.getPopover().hide(),n.asc_putText(t),n.asc_putTime(this.utcDateToString(new Date)),n.asc_putUserId(this.currentUserId),n.asc_putUserName(this.currentUserName),n.asc_putSolved(!1),_.isUndefined(n.asc_putDocumentFlag)||n.asc_putDocumentFlag(!1),this.api.asc_addComment(n),this.view.showEditContainer(!1),_.isUndefined(this.api.asc_SetDocumentPlaceChangedEnabled)||this.api.asc_SetDocumentPlaceChangedEnabled(!1))}},clearDummyComment:function(){if(this.isDummyComment){this.isDummyComment=!1,this.showPopover=!0,this.editPopover=!1,this.hidereply=!1,this.isSelectedComment=!1,this.uids=[];var e=this.getPopover();e&&(e.handlerHide=function(){},e.isVisible()&&e.hide()),this.popoverComments.reset(),_.isUndefined(this.api.asc_SetDocumentPlaceChangedEnabled)||this.api.asc_SetDocumentPlaceChangedEnabled(!1)}},onEditComments:function(e){if(this.api){var t=0,n=this,r=null,i=this.api.asc_getAnchorPosition();if(i){this.isSelectedComment=!0,this.popoverComments.reset();for(t=0;t<e.length;++t)r=this.findComment(e[t].asc_getId()),r&&(r.set("editTextInPopover",n.mode.canEditComments),r.set("hint",!1),this.popoverComments.push(r));this.getPopover()&&this.popoverComments.length>0&&(this.getPopover().isVisible()&&this.getPopover().hide(),this.getPopover().setLeftTop(i.asc_getX()+i.asc_getWidth(),i.asc_getY(),this.hintmode?i.asc_getX():undefined),this.getPopover().show(!0,!1,!0))}}},onAfterShow:function(){if(this.view&&this.api){var e=$(".new-comment-ct",this.view.el);e&&e.length&&("none"!==e.css("display")&&this.view.txtComment.focus(),this.view.update())}},onBeforeHide:function(){this.view&&this.view.showEditContainer(!1)},timeZoneOffsetInMs:(new Date).getTimezoneOffset()*6e4,stringUtcToLocalDate:function(e){return typeof e=="string"?parseInt(e)+this.timeZoneOffsetInMs:0},utcDateToString:function(e){return Object.prototype.toString.call(e)==="[object Date]"?(e.getTime()-this.timeZoneOffsetInMs).toString():""},dateToLocaleTimeString:function(e){function t(e){var t,n=e.getHours(),r=e.getMinutes(),i=n>=12?"pm":"am";return n%=12,n=n?n:12,r=r<10?"0"+r:r,t=n+":"+r+" "+i,t}return e.getMonth()+1+"/"+e.getDate()+"/"+e.getFullYear()+" "+t(e)}},Common.Controllers.Comments||{}))}),define("common/main/lib/model/User",["backbone"],function(e){"use strict";Common.Models=Common.Models||{},Common.Models.User=e.Model.extend({defaults:{id:undefined,username:"Guest",color:"#fff",colorval:null,online:!1,view:!1}})}),define("common/main/lib/collection/Users",["backbone","common/main/lib/model/User"],function(e){"use strict";Common.Collections=Common.Collections||{},Common.Collections.Users=e.Collection.extend({model:Common.Models.User,getOnlineCount:function(){var e=0;return this.each(function(t){t.online&&e++}),e},findUser:function(e){return this.find(function(t){return t.get("id")==e})}}),Common.Collections.HistoryUsers=e.Collection.extend({model:Common.Models.User,findUser:function(e){return this.find(function(t){return t.get("id")==e})}})}),define("common/main/lib/model/ChatMessage",["backbone"],function(e){"use strict";Common.Models=Common.Models||{},Common.Models.ChatMessage=e.Model.extend({defaults:{type:0,userid:null,username:"",message:""}})}),define("common/main/lib/collection/ChatMessages",["backbone","common/main/lib/model/ChatMessage"],function(e){"use strict";!Common.Collections&&(Common.Collections={}),Common.Collections.ChatMessages=e.Collection.extend({model:Common.Models.ChatMessage})}),define("common/main/lib/controller/Chat",["core","common/main/lib/collection/Users","common/main/lib/collection/ChatMessages","common/main/lib/view/Chat"],function(){"use strict";Common.Controllers.Chat=Backbone.Controller.extend(_.extend({models:[],collections:["Common.Collections.Users","Common.Collections.ChatMessages"],views:["Common.Views.Chat"],initialize:function(){this.addListeners({"Common.Views.Chat":{"message:add":_.bind(this.onSendMessage,this)}})},events:{},onLaunch:function(){this.panelChat=this.createView("Common.Views.Chat",{storeUsers:this.getApplication().getCollection("Common.Collections.Users"),storeMessages:this.getApplication().getCollection("Common.Collections.ChatMessages")})},setMode:function(e){return this.mode=e,this.api&&(this.mode.canCoAuthoring&&this.mode.canChat&&this.api.asc_registerCallback("asc_onCoAuthoringChatReceiveMessage",_.bind(this.onReceiveMessage,this)),!this.mode.isEditDiagram&&!this.mode.isEditMailMerge&&(this.api.asc_registerCallback("asc_onAuthParticipantsChanged",_.bind(this.onUsersChanged,this)),this.api.asc_registerCallback("asc_onConnectionStateChanged",_.bind(this.onUserConnection,this)),this.api.asc_coAuthoringGetUsers()),this.mode.canCoAuthoring&&this.mode.canChat&&this.api.asc_coAuthoringChatGetMessages()),this},setApi:function(e){return this.api=e,this},onUsersChanged:function(e){if(!this.mode.canLicense||!this.mode.canCoAuthoring){var t=0;for(i in e)undefined!==i&&t++;if(t>1&&this._isCoAuthoringStopped==undefined){this._isCoAuthoringStopped=!0,this.api.asc_coAuthoringDisconnect(),Common.NotificationCenter.trigger("api:disconnect");return}}var n=this.getApplication().getCollection("Common.Collections.Users");if(n){var r=[],i,s;for(i in e)undefined!==i&&(s=e[i],s&&r.push(new Common.Models.User({id:s.asc_getId(),username:s.asc_getUserName(),online:!0,color:s.asc_getColor(),view:s.asc_getView()})));n[n.size()>0?"add":"reset"](r)}},onUserConnection:function(e){var t=this.getApplication().getCollection("Common.Collections.Users");if(t){var n=t.findUser(e.asc_getId());n?n.set({online:e.asc_getState()}):t.add(new Common.Models.User({id:e.asc_getId(),username:e.asc_getUserName(),online:e.asc_getState(),color:e.asc_getColor(),view:e.asc_getView()}))}},onReceiveMessage:function(e,t){var n=this.getApplication().getCollection("Common.Collections.ChatMessages");if(n){var r=[];e.forEach(function(e){r.push(new Common.Models.ChatMessage({userid:e.user,message:e.message,username:e.username}))}),n[n.size()<1||t?"reset":"add"](r)}},onSendMessage:function(e,t){if(t.length>0){var n=function(e,t){var n=[];while(e){if(e.length<t){n.push(e);break}n.push(e.substr(0,t)),e=e.substr(t)}return n},r=this;n(t,2048).forEach(function(e){r.api.asc_coAuthoringChatSendMessage(e)})}},notcriticalErrorTitle:"Warning",textUserLimit:'You are using ONLYOFFICE Editors free version.<br>Only two users can co-edit the document simultaneously.<br>Want more? Consider buying ONLYOFFICE Editors Pro version.<br><a href="http://www.onlyoffice.com" target="_blank">Read more</a>'},Common.Controllers.Chat||{}))});if(Common===undefined)var Common={};Common.Models=Common.Models||{},define("common/main/lib/model/Plugin",["underscore","backbone","common/main/lib/component/BaseView"],function(e,t){"use strict";Common.Models.PluginVariation=t.Model.extend({defaults:function(){return{description:"",url:"",index:0,icons:undefined,isViewer:!1,EditorsSupport:["word","cell","slide"],isVisual:!1,isModal:!1,isInsideMode:!1,initDataType:0,initData:"",isUpdateOleOnResize:!1,buttons:[],size:[800,600],initOnSelectionChanged:!1}}}),Common.Models.Plugin=t.Model.extend({defaults:function(){return{id:Common.UI.getId(),name:"",baseUrl:"",guid:Common.UI.getId(),variations:[],currentVariation:0,pluginObj:undefined,allowSelected:!1,selected:!1}}})});if(Common===undefined)var Common={};Common.Collections=Common.Collections||{},define("common/main/lib/collection/Plugins",["underscore","backbone","common/main/lib/model/Plugin"],function(e,t){"use strict";Common.Collections.Plugins=t.Collection.extend({model:Common.Models.Plugin})}),define("common/main/lib/controller/Plugins",["core","common/main/lib/collection/Plugins","common/main/lib/view/Plugins"],function(){"use strict";Common.Controllers.Plugins=Backbone.Controller.extend(_.extend({models:[],collections:["Common.Collections.Plugins"],views:["Common.Views.Plugins"],initialize:function(){},events:function(){return{"click #id-plugin-close":_.bind(this.onToolClose,this)}},onLaunch:function(){this.panelPlugins=this.createView("Common.Views.Plugins",{storePlugins:this.getApplication().getCollection("Common.Collections.Plugins")}),this.panelPlugins.on("render:after",_.bind(this.onAfterRender,this)),this._moveOffset={x:0,y:0}},setApi:function(e){return this.api=e,this.api.asc_registerCallback("asc_onPluginShow",_.bind(this.onPluginShow,this)),this.api.asc_registerCallback("asc_onPluginClose",_.bind(this.onPluginClose,this)),this.api.asc_registerCallback("asc_onPluginResize",_.bind(this.onPluginResize,this)),this.api.asc_registerCallback("asc_onPluginMouseUp",_.bind(this.onPluginMouseUp,this)),this.api.asc_registerCallback("asc_onPluginMouseMove",_.bind(this.onPluginMouseMove,this)),this},setMode:function(e){e.canPlugins&&this.updatePluginsList()},onAfterRender:function(e){e.viewPluginsList.on("item:click",_.bind(this.onSelectPlugin,this)),this.bindViewEvents(this.panelPlugins,this.events);var t=this;Common.NotificationCenter.on({"layout:resizestart":function(e){if(t.panelPlugins.isVisible()){var n=t.panelPlugins.currentPluginFrame.offset();t._moveOffset={x:n.left+parseInt(t.panelPlugins.currentPluginFrame.css("padding-left")),y:n.top+parseInt(t.panelPlugins.currentPluginFrame.css("padding-top"))},t.api.asc_pluginEnableMouseEvents(!0)}},"layout:resizestop":function(e){t.panelPlugins.isVisible()&&t.api.asc_pluginEnableMouseEvents(!1)}})},updatePluginsList:function(){var e=this,t=this.getApplication().getCollection("Common.Collections.Plugins"),n=[];t.each(function(e){var t=new Asc.CPlugin;t.set_Name(e.get("name")),t.set_Guid(e.get("guid")),t.set_BaseUrl(e.get("baseUrl"));var r=e.get("variations"),i=[];r.forEach(function(e){var t=new Asc.CPluginVariation;t.set_Description(e.get("description")),t.set_Url(e.get("url")),t.set_Icons(e.get("icons")),t.set_Visual(e.get("isVisual")),t.set_Viewer(e.get("isViewer")),t.set_EditorsSupport(e.get("EditorsSupport")),t.set_Modal(e.get("isModal")),t.set_InsideMode(e.get("isInsideMode")),t.set_InitDataType(e.get("initDataType")),t.set_InitData(e.get("initData")),t.set_UpdateOleOnResize(e.get("isUpdateOleOnResize")),t.set_Buttons(e.get("buttons")),t.set_Size(e.get("size")),t.set_InitOnSelectionChanged(e.get("initOnSelectionChanged")),i.push(t)}),t.set_Variations(i),e.set("pluginObj",t),n.push(t)}),this.api.asc_pluginsRegister("",n)},onSelectPlugin:function(e,t,n,r){var i=$(r.target);if(i&&i.hasClass("plugin-caret")){var s=this.panelPlugins.pluginMenu;if(s.isVisible()){s.hide();return}var o,u=this,a=$(r.currentTarget),f=$(this.panelPlugins.el),l=a.offset(),c=f.offset();o=[l.left-c.left+a.width(),l.top-c.top+a.height()/2];if(n!=undefined){for(var h=0;h<s.items.length;h++)s.removeItem(s.items[h]),h--;s.removeAll();var p=n.get("variations");for(var h=0;h<p.length;h++){var d=p[h],v=(new Common.UI.MenuItem({caption:h>0?d.get("description"):u.panelPlugins.textStart,value:parseInt(d.get("index"))})).on("click",function(e,t){u.api&&u.api.asc_pluginRun(n.get("guid"),e.value,"")});s.addItem(v)}}var m=f.find("#menu-plugin-container");s.rendered||(m.length<1&&(m=$('<div id="menu-plugin-container" style="position: absolute; z-index: 10000;"><div class="dropdown-toggle" data-toggle="dropdown"></div></div>',s.id),f.append(m)),s.render(m),s.cmpEl.attr({tabindex:"-1"}),s.on("show:after",function(e){e&&e.menuAlignEl&&e.menuAlignEl.toggleClass("over",!0)}).on("hide:after",function(e){e&&e.menuAlignEl&&e.menuAlignEl.toggleClass("over",!1)})),m.css({left:o[0],top:o[1]}),s.menuAlignEl=a,s.setOffset(-20,-a.height()/2-3),s.show(),_.delay(function(){s.cmpEl.focus()},10),r.stopPropagation(),r.preventDefault()}else this.api.asc_pluginRun(n.get("guid"),0,"")},onPluginShow:function(e,t){var n=e.get_Variations()[t];if(n.get_Visual()){var r=n.get_Url();r=(e.get_BaseUrl().length==0?r:e.get_BaseUrl())+r;if(n.get_InsideMode())this.panelPlugins.openInsideMode(e.get_Name(),r)||this.api.asc_pluginButtonClick(-1);else{var i=this,s=n.get_Buttons(),o={},u=n.get_Size();if(!u||u.length<2)u=[800,600];_.isArray(s)&&_.each(s,function(e,t){o[t]={text:e.text,cls:"custom"+(e.primary?" primary":"")}}),i.pluginDlg=new Common.Views.PluginDlg({title:e.get_Name(),width:u[0],height:u[1],url:r,buttons:o,toolcallback:_.bind(this.onToolClose,this)}),i.pluginDlg.on("render:after",function(e){e.getChild(".footer .dlg-btn").on("click",_.bind(i.onDlgBtnClick,i)),i.pluginContainer=i.pluginDlg.$window.find("#id-plugin-container")}).on("close",function(e){i.pluginDlg=undefined}).on("drag",function(e){i.api.asc_pluginEnableMouseEvents(e[1]=="start")}).on("resize",function(e){i.api.asc_pluginEnableMouseEvents(e[1]=="start")}),i.pluginDlg.show()}}else this.panelPlugins.openNotVisualMode(e.get_Guid())},onPluginClose:function(){this.pluginDlg?this.pluginDlg.close():this.panelPlugins.iframePlugin?this.panelPlugins.closeInsideMode():this.panelPlugins.closeNotVisualMode()},onPluginResize:function(e,t,n,r){if(this.pluginDlg){var i=t&&t.length>1&&n&&n.length>1&&(n[0]>t[0]||n[1]>t[1]||n[0]==0||n[1]==0);this.pluginDlg.setResizable(i,t,n),this.pluginDlg.setInnerSize(e[0],e[1]),r&&r.call()}},onDlgBtnClick:function(e){var t=e.currentTarget.attributes.result.value;this.api.asc_pluginButtonClick(parseInt(t))},onToolClose:function(){this.api.asc_pluginButtonClick(-1)},onPluginMouseUp:function(e,t){this.pluginDlg?(this.pluginDlg.binding.dragStop&&this.pluginDlg.binding.dragStop(),this.pluginDlg.binding.resizeStop&&this.pluginDlg.binding.resizeStop()):Common.NotificationCenter.trigger("frame:mouseup",{pageX:e*Common.Utils.zoom()+this._moveOffset.x,pageY:t*Common.Utils.zoom()+this._moveOffset.y})},onPluginMouseMove:function(e,t){if(this.pluginDlg){var n=this.pluginContainer.offset();this.pluginDlg.binding.drag&&this.pluginDlg.binding.drag({pageX:e*Common.Utils.zoom()+n.left,pageY:t*Common.Utils.zoom()+n.top}),this.pluginDlg.binding.resize&&this.pluginDlg.binding.resize({pageX:e*Common.Utils.zoom()+n.left,pageY:t*Common.Utils.zoom()+n.top})}else Common.NotificationCenter.trigger("frame:mousemove",{pageX:e*Common.Utils.zoom()+this._moveOffset.x,pageY:t*Common.Utils.zoom()+this._moveOffset.y})}},Common.Controllers.Plugins||{}))});var reqerr;require.config({baseUrl:"../../",paths:{jquery:"../vendor/jquery/jquery",underscore:"../vendor/underscore/underscore",backbone:"../vendor/backbone/backbone",bootstrap:"../vendor/bootstrap/dist/js/bootstrap",text:"../vendor/requirejs-text/text",perfectscrollbar:"common/main/lib/mods/perfect-scrollbar",jmousewheel:"../vendor/perfect-scrollbar/src/jquery.mousewheel",xregexp:"../vendor/xregexp/xregexp-all-min",sockjs:"../vendor/sockjs/sockjs.min",jsziputils:"../vendor/jszip-utils/jszip-utils.min",jsrsasign:"../vendor/jsrsasign/jsrsasign-latest-all-min",allfonts:"../../sdkjs/common/AllFonts",sdk:"../../sdkjs/cell/sdk-all-min",api:"api/documents/api",core:"common/main/lib/core/application",notification:"common/main/lib/core/NotificationCenter",keymaster:"common/main/lib/core/keymaster",tip:"common/main/lib/util/Tip",localstorage:"common/main/lib/util/LocalStorage",analytics:"common/Analytics",gateway:"common/Gateway",locale:"common/locale",irregularstack:"common/IrregularStack"},shim:{underscore:{exports:"_"},backbone:{deps:["underscore","jquery"],exports:"Backbone"},bootstrap:{deps:["jquery"]},perfectscrollbar:{deps:["jmousewheel"]},notification:{deps:["backbone"]},core:{deps:["backbone","notification","irregularstack"]},sdk:{deps:["jquery","underscore","allfonts","xregexp","sockjs","jsziputils","jsrsasign"]},gateway:{deps:["jquery"]},analytics:{deps:["jquery"]}}}),require(["backbone","bootstrap","core","sdk","api","analytics","gateway","locale"],function(e,t,n){e.history.start();var r=new e.Application({nameSpace:"SSE",autoCreate:!1,controllers:["Viewport","DocumentHolder","CellEditor","FormulaDialog","Print","Toolbar","Statusbar","RightMenu","LeftMenu","Main","Common.Controllers.Fonts","Common.Controllers.Chat","Common.Controllers.Comments","Common.Controllers.Plugins"]});Common.Locale.apply(),require(["spreadsheeteditor/main/app/controller/Viewport","spreadsheeteditor/main/app/controller/DocumentHolder","spreadsheeteditor/main/app/controller/CellEditor","spreadsheeteditor/main/app/controller/Toolbar","spreadsheeteditor/main/app/controller/Statusbar","spreadsheeteditor/main/app/controller/RightMenu","spreadsheeteditor/main/app/controller/LeftMenu","spreadsheeteditor/main/app/controller/Main","spreadsheeteditor/main/app/controller/Print","spreadsheeteditor/main/app/view/FileMenuPanels","spreadsheeteditor/main/app/view/ParagraphSettings","spreadsheeteditor/main/app/view/ImageSettings","spreadsheeteditor/main/app/view/ChartSettings","spreadsheeteditor/main/app/view/ShapeSettings","spreadsheeteditor/main/app/view/TextArtSettings","common/main/lib/util/utils","common/main/lib/util/LocalStorage","common/main/lib/controller/Fonts","common/main/lib/controller/Comments","common/main/lib/controller/Chat","common/main/lib/controller/Plugins"],function(){r.start()})},function(e){if(e.requireType=="timeout"&&!reqerr){var t=function(){var e,t=/\+/g,n=/([^&=]+)=?([^&]*)/g,r=function(e){return decodeURIComponent(e.replace(t," "))},i=window.location.search.substring(1),s={};while(e=n.exec(i))s[r(e[1])]=r(e[2]);return s},n=function(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")},r=(t().lang||"en").split("-")[0];r=="de"?reqerr="Die Verbindung ist zu langsam, einige Komponenten konnten nicht geladen werden. Aktualisieren Sie bitte die Seite.":r=="es"?reqerr="La conexión es muy lenta, algunos de los componentes no han podido cargar. Por favor recargue la página.":r=="fr"?reqerr="La connexion est trop lente, certains des composants n'ons pas pu être chargé. Veuillez recharger la page.":r=="ru"?reqerr="Слишком медленное соединение, не удается загрузить некоторые компоненты. Пожалуйста, обновите страницу.":reqerr="The connection is too slow, some of the components could not be loaded. Please reload the page.",window.alert(reqerr),window.location.reload()}}),define("../apps/spreadsheeteditor/main/app.js",function(){}); |