diff --git a/CHANGELOG.md b/CHANGELOG.md index 04b57386b..c8d4d8a9b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,49 @@ +# Pending + +* remove round corners on limit bar +* update prompts related to password protection in various modals +* script to identify unused translations +* offline mode for file app +* display subscribe button on home page if subscriptions are supported +* display a home page notice via application_config.js via supplied HTML +* link to our sponsors websites via their logos +* OnlyOffice sheets + * use configured language from CryptPad + * fix a sorting issue caused by the overly eager suppression of a modal +* rich text + * use white background for rich text documents even in dark mode + * display button to adjust document width inline instead of in toolbar + * display comments inline on mobile instead of on the right +* translations + * russian +* style fixes + * text media-tags use markdown's block styles + * 404 page + * uses the dark theme's background color correctly + * remove an unnecessary scrollbar + * assert page uses dark mode +* separate archive deletion code from inactive pad removal +* darkfix branch + * removed unused colors + * admin support last message is no longer red + * sidebar hint uses new grey name + * more severe fade on drive icon hover + * drive info box inline links are now styled + * autocomplete dropdown styles weren't applied + * notifications bell now uses same text color as toolbar title + * filepicker background color +* chat colors + * in pads + * in the contacts app +* server updates + * `npm i` to get latest dependencies + * messages are not acknowledged or broadcast until they have been validated and written to the disk + * see [#553](https://github.com/xwiki-labs/cryptpad/issues/553) + * optimized GET_OLDER_HISTORY +* debugging app + * serverHash is included in the history of decrypted messages +* link to the docs from the support page's ticket creation interface + # 4.1.0 (B) ## Goals diff --git a/customize.dist/pages.js b/customize.dist/pages.js index 436c3be93..85141f975 100644 --- a/customize.dist/pages.js +++ b/customize.dist/pages.js @@ -181,11 +181,11 @@ define([ Pages.subscribeButton = function (onClick) { var _link = h('a', { - href: "/accounts/", + href: AppConfig.upgradeURL || "/accounts/", }); var subscribe = h('button', [ - Msg.subscribe_button + Msg.features_f_subscribe, ]); $(subscribe).click(function () { diff --git a/customize.dist/pages/index.js b/customize.dist/pages/index.js index d099640e4..f15d1819b 100644 --- a/customize.dist/pages/index.js +++ b/customize.dist/pages/index.js @@ -72,6 +72,14 @@ define([ }); UI.addTooltips(); + var subscribeButton; + /* Display a subscribe button if they are enabled and the button's translation key exists */ + if (Config.allowSubscriptions) { + subscribeButton = Pages.subscribeButton(function () { + Feedback.send('HOME_SUBSCRIBE_CRYPTPAD'); + }); + } + var blocks = [ h('div.row.cp-page-section', [ h('div.col-sm-6', @@ -104,6 +112,7 @@ define([ h('div.col-sm-6', [ h('h2', Msg.home_support_title), Pages.setHTML(h('span'), Msg.home_support), + subscribeButton, Pages.crowdfundingButton(function () { Feedback.send('HOME_SUPPORT_CRYPTPAD'); }), @@ -111,6 +120,17 @@ define([ ]) ]; + var notice; +/* Admins can specify a notice to display in application_config.js via the `homeNotice` attribute. + If the text is the key for the translation system then then the most appropriate translated text + will be displayed. Otherwise, the direct text will be included as HTML. +*/ + if (AppConfig.homeNotice) { + notice = h('div.alert.alert-info', Pages.setHTML(h('span'), [ + Msg[AppConfig.homeNotice] || AppConfig.homeNotice + ])); + } + return [ h('div#cp-main', [ Pages.infopageTopbar(), @@ -129,6 +149,7 @@ define([ icons, ]) ]), + notice, blocks ]), Pages.infopageFooter(), diff --git a/customize.dist/pages/what-is-cryptpad.js b/customize.dist/pages/what-is-cryptpad.js index c100782ce..b5d2f8ac4 100644 --- a/customize.dist/pages/what-is-cryptpad.js +++ b/customize.dist/pages/what-is-cryptpad.js @@ -7,6 +7,15 @@ define([ ], function (Config, h, Msg, Pages, Feedback) { var urlArgs = Config.requireConf.urlArgs; + var logoLink = function (alt, src, url, cls) { + var img = h('img' + (cls || ''), { + src: src + '?' + urlArgs, + alt: alt, + }); + if (!url) { return img; } + return h('a', { href: url, }, img); + }; + return function () { return h('div#cp-main', [ Pages.infopageTopbar(), @@ -66,26 +75,17 @@ define([ }), ]), h('div.col-md-6.order-md-1.small-logos', [ - h('img.cp-img-invert', { - src: '/customize/images/logo_ngi.png?' + urlArgs, - alt: 'NGI Award 2019' - }), - h('img.cp-img-invert', { - src: '/customize/images/logo_nlnet.svg?' + urlArgs, - alt: 'NLNet Foundation logo' - }), - h('img', { - src: '/customize/images/logo_bpifrance.svg?' + urlArgs, - alt: 'BPI France logo' - }), - h('img', { - src: '/customize/images/logo_moss.jpg?' + urlArgs, - alt: 'Mozilla Open Source Support logo' - }), - h('img', { - src: '/customize/images/logo_ngi_trust.png?' + urlArgs, - alt: 'NGI Trust logo' - }), + logoLink('NGI Award 2019', '/customize/images/logo_ngi.png', + 'https://www.ngi.eu/', '.cp-img-invert'), + logoLink('NLnet Foundation logo', '/customize/images/logo_nlnet.svg', + 'https://nlnet.nl', '.cp-img-invert'), + + logoLink('BPI France logo', '/customize/images/logo_bpifrance.svg', + 'https://bpifrance.com'), + logoLink('Mozilla Open Source Support logo', '/customize/images/logo_moss.jpg', + 'https://www.mozilla.org/en-US/moss/'), + logoLink('NGI Trust logo', '/customize/images/logo_ngi_trust.png', + 'https://www.ngi.eu/ngi-projects/ngi-trust/'), ]), ]), h('div.row.cp-page-section', [ diff --git a/customize.dist/src/less2/include/colortheme-dark.less b/customize.dist/src/less2/include/colortheme-dark.less index eb578ad68..fc17d7d24 100644 --- a/customize.dist/src/less2/include/colortheme-dark.less +++ b/customize.dist/src/less2/include/colortheme-dark.less @@ -31,16 +31,6 @@ @cryptpad_color_brand_fader: fade(@cryptpad_color_brand, 50%); @cryptpad_color_brand_fadest: fade(@cryptpad_color_brand, 25%); -@cryptpad_color_hint_grey: #777; -@cryptpad_color_dark_grey: #999999; -@cryptpad_color_neutral_grey: #aaaaaa; -@cryptpad_color_neutral2_grey: #cccccc; -@cryptpad_color_help_grey: #dddddd; -@cryptpad_color_grey: #e0e0e0; -@cryptpad_color_toolbar_grey: #EEEEEE; -@cryptpad_color_light_grey: #f1f1f1; -@cryptpad_color_lighter_grey: #f9f9f9; - @cryptpad_color_white: #FFF; @cryptpad_color_grey_50: #FAFAFA; @cryptpad_color_grey_100: #F5F5F5; @@ -278,8 +268,8 @@ // Support @cp_support-bg: @cryptpad_color_grey_800; @cp_support-msg-fg: @cryptpad_text_col; -@cp_support-msg-bg: @cryptpad_color_grey_900; -@cp_support-header-bg: @cryptpad_color_grey_800; +@cp_support-msg-bg: @cryptpad_color_grey_700; +@cp_support-header-bg: @cryptpad_color_grey_700; // Toolbar @cp_toolbar-bg: @cryptpad_color_grey_850; @@ -328,13 +318,11 @@ @cp_accounts-tab-hover: @cryptpad_color_grey_700; @cp_accounts-tab-border: @cryptpad_color_grey_600; -// Admin -@cp_admin-isadmin-fg: @cryptpad_color_brand; -@cp_admin-isadmin-bg: @cryptpad_color_white; -@cp_admin-premium-fg: @cryptpad_color_light_red; +// Admin Support +@cp_admin-isadmin-bg: @cryptpad_color_brand_fadest; @cp_admin-premium-bg: @cryptpad_color_red_fader; -@cp_admin-last-fg: @cryptpad_color_light_red; -@cp_admin-last-bg: @cryptpad_color_red_fader; +@cp_admin-last-fg: @cryptpad_text_col; +@cp_admin-last-bg: @cryptpad_color_grey_700; // Code @cp_preview-bg: @cryptpad_color_grey_900; @@ -387,6 +375,7 @@ // Rich text @cp_pad-fg: @cryptpad_text_col; @cp_pad-icon-filter: invert(); +@cp_pad-resize: @cryptpad_color_grey_800; // Comments @cp_comments-fg: @cryptpad_text_col; @cp_comments-bg: @cryptpad_color_grey_800; diff --git a/customize.dist/src/less2/include/colortheme.less b/customize.dist/src/less2/include/colortheme.less index d96ce4e0f..f353758c8 100644 --- a/customize.dist/src/less2/include/colortheme.less +++ b/customize.dist/src/less2/include/colortheme.less @@ -31,16 +31,6 @@ @cryptpad_color_brand_fader: fade(@cryptpad_color_brand, 50%); @cryptpad_color_brand_fadest: fade(@cryptpad_color_brand, 25%); -@cryptpad_color_hint_grey: #777; -@cryptpad_color_dark_grey: #999999; -@cryptpad_color_neutral_grey: #aaaaaa; -@cryptpad_color_neutral2_grey: #cccccc; -@cryptpad_color_help_grey: #dddddd; -@cryptpad_color_grey: #e0e0e0; -@cryptpad_color_toolbar_grey: #EEEEEE; -@cryptpad_color_light_grey: #f1f1f1; -@cryptpad_color_lighter_grey: #f9f9f9; - @cryptpad_color_white: #FFF; @cryptpad_color_grey_50: #FAFAFA; @cryptpad_color_grey_100: #F5F5F5; @@ -76,7 +66,7 @@ @cryptpad_color_yellow_fade: fade(#FFE69C, 50%); // different from dark @cryptpad_color_lighter_blue: #d2e1f2; -@cryptpad_color_link: #0275D8; +@cryptpad_color_link: @cryptpad_color_brand; // Premium plans colors @cryptpad_color_basic: #DDEFFF; @@ -112,7 +102,7 @@ @cp_alertify-log-bg: fade(@cryptpad_color_brand, 90%); @cp_alertify-log-fg: @cryptpad_color_white; @cp_alertify-warn-bg: rgba(205, 37, 50); -@cp_alertify-disable-border: @cryptpad_color_dark_grey; +@cp_alertify-disable-border: @cryptpad_color_grey_500; // Forms @cp_forms-fg: @cryptpad_text_col; @@ -157,18 +147,18 @@ @cp_buttons-cancel-border: #949494; // Sidebar layout -@cp_sidebar-left-bg: @cryptpad_color_toolbar_grey; +@cp_sidebar-left-bg: @cryptpad_color_grey_200; @cp_sidebar-left-fg: @cryptpad_text_col; @cp_sidebar-right-bg: @cryptpad_color_white; @cp_sidebar-right-fg: @cryptpad_text_col; @cp_sidebar-left-active: @cp_sidebar-right-bg; -@cp_sidebar-hint: @cryptpad_color_hint_grey; +@cp_sidebar-hint: @cryptpad_color_grey_600; // Drive @cp_drive-bg: @cp_sidebar-right-bg; @cp_drive-fg: @cp_sidebar-right-fg; @cp_drive-header-fg: fade(@cryptpad_text_col, 70%); -@cp_drive-icon-hover: fade(@cryptpad_text_col, 5%); +@cp_drive-icon-hover: fade(@cryptpad_text_col, 15%); @cp_drive-icon-border: fade(@cryptpad_text_col, 20%); @cp_drive-thumb-bg: transparent; @cp_drive-selected-bg: fade(@cryptpad_text_col, 10%); @@ -199,18 +189,18 @@ // Dropdown @cp_dropdown-fg: @cryptpad_text_col; -@cp_dropdown-bg: @cryptpad_color_lighter_grey; -@cp_dropdown-bg-hover: @cryptpad_color_light_grey; -@cp_dropdown-bg-active: @cryptpad_color_grey; +@cp_dropdown-bg: @cryptpad_color_grey_100; +@cp_dropdown-bg-hover: @cryptpad_color_grey_100; +@cp_dropdown-bg-active: @cryptpad_color_grey_300; // Rendered Markdown -@cp_markdown-bg: @cryptpad_color_lighter_grey; +@cp_markdown-bg: @cryptpad_color_grey_100; @cp_markdown-border: @cryptpad_color_grey_400; @cp_markdown-block-fg: @cryptpad_text_col; @cp_markdown-block-bg: @cryptpad_color_grey_200; // Avatar -@cp_avatar-bg: @cryptpad_color_grey; +@cp_avatar-bg: @cryptpad_color_grey_300; @cp_avatar-fg: @cryptpad_text_col; // Corner @@ -224,7 +214,7 @@ @cp_creation-button-bg: @cryptpad_color_brand; @cp_creation-button-fg: @cryptpad_color_white; @cp_creation-error-bg: @cryptpad_color_blue; -@cp_creation-error-fg: @cryptpad_color_light_grey; +@cp_creation-error-fg: @cryptpad_color_grey_100; // Export @cp_export-bg: @cryptpad_color_grey_200; @@ -235,20 +225,20 @@ // File upload @cp_upload-fg: @cryptpad_color_brand; -@cp_upload-header: @cryptpad_color_help_grey; -@cp_upload-progress: @cryptpad_color_help_grey; +@cp_upload-header: @cryptpad_color_grey_300; +@cp_upload-progress: @cryptpad_color_grey_300; // Help -@cp_help-bg: @cryptpad_color_help_grey; +@cp_help-bg: @cryptpad_color_grey_300; @cp_help-fg: @cryptpad_text_col; @cp_help-link: @cryptpad_color_link; // Static pages -@cp_static-bg: @cryptpad_color_toolbar_grey; +@cp_static-bg: @cryptpad_color_grey_200; @cp_static-fg: @cryptpad_text_col; @cp_static-link: @cryptpad_color_brand; @cp_static-title: @cryptpad_color_brand; -@cp_static-footer: @cryptpad_color_help_grey; +@cp_static-footer: @cryptpad_color_grey_300; @cp_static-footer-border: @cryptpad_color_white; @cp_static-topbar-fg: @cryptpad_color_brand; @cp_static-card-bg: @cryptpad_color_white; @@ -262,8 +252,8 @@ @cp-limit-bar-above: @cryptpad_color_red; // Mentions -@cp_mentions-bg: @cryptpad_color_grey; -@cp_mentions-hover: @cryptpad_color_help_grey; +@cp_mentions-bg: @cryptpad_color_grey_300; +@cp_mentions-hover: @cryptpad_color_grey_300; // Autocomplete @cp_autocomplete-bg: @cryptpad_color_grey_100; @@ -273,13 +263,13 @@ // Modals @cp_access-overlay: fade(@cryptpad_color_white, 50%); -@cp_snapshots-hover: @cryptpad_color_help_grey; +@cp_snapshots-hover: @cryptpad_color_grey_300; // Support -@cp_support-bg: @cryptpad_color_lighter_grey; +@cp_support-bg: @cryptpad_color_grey_200; @cp_support-msg-fg: @cryptpad_text_col; -@cp_support-msg-bg: @cryptpad_color_grey; -@cp_support-header-bg: @cryptpad_color_help_grey; +@cp_support-msg-bg: @cryptpad_color_grey_300; +@cp_support-header-bg: @cryptpad_color_grey_300; // Toolbar @cp_toolbar-bg: @cryptpad_color_grey_200; @@ -297,9 +287,9 @@ @cp_history-fg: @cp_toolbar-bottom-fg; // Tokenfield -@cp_token-bg: @cryptpad_color_neutral2_grey; +@cp_token-bg: @cryptpad_color_grey_400; @cp_token-fg: @cryptpad_text_col; -@cp_token-bg-hover: @cryptpad_color_neutral_grey; +@cp_token-bg-hover: @cryptpad_color_grey_500; @cp_token-invalid: @cryptpad_color_warn_red; // Usergrid @@ -311,7 +301,7 @@ @cp_shadow-color: fade(@cryptpad_color_black, 40%); // Apps -@cp_app-bg: @cryptpad_color_light_grey; +@cp_app-bg: @cryptpad_color_grey_100; @cp_app-fg: @cryptpad_text_col; // Accounts @@ -321,20 +311,18 @@ @cp_accounts-active: @cryptpad_color_light_green; @cp_accounts-inactive: @cryptpad_color_light_red; @cp_accounts-mysubs-alert: @cryptpad_color_white; -@cp_accounts-mysubs-bg: @cryptpad_color_toolbar_grey; +@cp_accounts-mysubs-bg: @cryptpad_color_grey_200; @cp_accounts-mysubs-fg: @cryptpad_text_col; @cp_accounts-contact-hover: fade(@cryptpad_color_black, 20%); -@cp_accounts-tab-bg: @cryptpad_color_toolbar_grey; -@cp_accounts-tab-hover: @cryptpad_color_grey; -@cp_accounts-tab-border: @cryptpad_color_neutral_grey; +@cp_accounts-tab-bg: @cryptpad_color_grey_200; +@cp_accounts-tab-hover: @cryptpad_color_grey_300; +@cp_accounts-tab-border: @cryptpad_color_grey_500; // Admin -@cp_admin-isadmin-fg: @cryptpad_color_brand; -@cp_admin-isadmin-bg: @cryptpad_color_white; -@cp_admin-premium-fg: @cryptpad_color_warn_red; -@cp_admin-premium-bg: lighten(@cryptpad_color_warn_red, 25%); -@cp_admin-last-fg: @cryptpad_color_warn_red; -@cp_admin-last-bg: lighten(@cryptpad_color_orange, 25%); +@cp_admin-isadmin-bg: @cryptpad_color_brand_fadest; +@cp_admin-premium-bg: @cryptpad_color_red_fader; +@cp_admin-last-fg: @cryptpad_text_col; +@cp_admin-last-bg: @cryptpad_color_grey_300; // Code @cp_preview-bg: @cryptpad_color_white; @@ -343,7 +331,7 @@ // Debug @cp_debug-hover: fade(@cryptpad_color_black, 10%); -@cp_debug-icon-hover: @cryptpad_color_dark_grey; +@cp_debug-icon-hover: @cryptpad_color_grey_300; // Mediatag @cp_mediatag-text-bg: @cryptpad_color_white; @@ -387,6 +375,7 @@ // Rich text @cp_pad-fg: @cryptpad_text_col; @cp_pad-icon-filter: none; +@cp_pad-resize: @cryptpad_text_col; // Comments @cp_comments-fg: @cryptpad_text_col; @cp_comments-bg: @cryptpad_color_white; @@ -396,14 +385,14 @@ // Poll @cp_poll-th-bg: @cryptpad_color_lighter_blue; @cp_poll-th-fg: @cryptpad_text_col; -@cp_poll-uncommitted-bg: @cryptpad_color_toolbar_grey; -@cp_poll-border-color: @cryptpad_color_hint_grey; +@cp_poll-uncommitted-bg: @cryptpad_color_grey_200; +@cp_poll-border-color: @cryptpad_color_grey_600; @cp_poll-cell-fg: @cryptpad_text_col; -@cp_poll-unset: @cryptpad_color_help_grey; +@cp_poll-unset: @cryptpad_color_grey_300; @cp_poll-yes: @cryptpad_color_light_green; @cp_poll-no: @cryptpad_color_light_red; @cp_poll-maybe: @cryptpad_color_light_yellow; -@cp_poll-hint: @cryptpad_color_dark_grey; +@cp_poll-hint: @cryptpad_color_grey_500; // Profile @cp_profile-border: @cryptpad_color_grey_400; @@ -422,6 +411,6 @@ // Whiteboard @cp_whiteboard-board-bg: @cryptpad_color_white; -@cp_whiteboard-board-border: @cryptpad_color_hint_grey; +@cp_whiteboard-board-border: @cryptpad_color_grey_600; @cp_whiteboard-bg: @cp_app-bg; @cp_whiteboard-fg: @cryptpad_text_col; diff --git a/customize.dist/src/less2/include/drive.less b/customize.dist/src/less2/include/drive.less index 30d369ff5..c0f0d3a7c 100644 --- a/customize.dist/src/less2/include/drive.less +++ b/customize.dist/src/less2/include/drive.less @@ -456,6 +456,10 @@ background: @cp_drive-infobox-bg; color: @cp_drive-infobox-fg; cursor: default; + a { + color: @cryptpad_color_link; + text-decoration: underline; + } span { cursor: pointer; float: right; diff --git a/customize.dist/src/less2/include/dropdown.less b/customize.dist/src/less2/include/dropdown.less index f67a51dc6..ddba87cd7 100644 --- a/customize.dist/src/less2/include/dropdown.less +++ b/customize.dist/src/less2/include/dropdown.less @@ -7,12 +7,12 @@ --LessLoader_require: LessLoader_currentFile(); } & { - .ui-autocomplete { + ul.ui-autocomplete { background-color: @cp_autocomplete-bg; color: @cp_autocomplete-fg; } - ul.ui-menu { - border: 1px solid @cp_autocomplete-border; // FIXME doesn't work + ul.ui-menu.ui-widget { + border: 1px solid @cp_autocomplete-border; .ui-state-active { background-color: @cp_autocomplete-hover; color: @cp_autocomplete-fg; diff --git a/customize.dist/src/less2/include/limit-bar.less b/customize.dist/src/less2/include/limit-bar.less index 33c733efd..324daf722 100644 --- a/customize.dist/src/less2/include/limit-bar.less +++ b/customize.dist/src/less2/include/limit-bar.less @@ -17,7 +17,6 @@ max-width: 100%; margin: 5px; box-sizing: border-box; - border-radius: 3px; background: @cp-limit-bar-bg; position: relative; text-align: center; diff --git a/customize.dist/src/less2/include/markdown.less b/customize.dist/src/less2/include/markdown.less index 7c7d3f41b..717b49990 100644 --- a/customize.dist/src/less2/include/markdown.less +++ b/customize.dist/src/less2/include/markdown.less @@ -52,13 +52,6 @@ text-overflow: ellipsis; } } - - div.plain-text-reader { - background: @cp_markdown-bg; - padding: 10px; - color: black; - text-align: left; - } } .mediatag_cryptpad() { @@ -154,6 +147,13 @@ color: @cryptpad_text_col; background-color: @cp_markdown-block-bg; } + + div.plain-text-reader { + background: @cp_markdown-block-bg; + padding: 10px; + color: @cp_markdown-block-fg; + text-align: left; + } } .markdown_cryptpad() { diff --git a/customize.dist/src/less2/include/messenger.less b/customize.dist/src/less2/include/messenger.less index a47f738e8..e3599f74e 100644 --- a/customize.dist/src/less2/include/messenger.less +++ b/customize.dist/src/less2/include/messenger.less @@ -10,7 +10,7 @@ @invert: @bg-color; @msg-bg-color-light: contrast(@invert, lighten(@bg-color, 5%), darken(@bg-color, 5%)); @msg-bg-color-lighter: contrast(@invert, lighten(@bg-color, 10%), darken(@bg-color, 10%)); - @msg-bg-color-dark: contrast(@bg-color, lighten(@bg-color, 5%), darken(@bg-color, 5%)); + @msg-bg-color-dark: fade(@cp_messenger-fg, 10%); @msg-bg-color-darker: contrast(@bg-color, lighten(@bg-color, 10%), darken(@bg-color, 10%)); }; .messenger_main( @@ -275,8 +275,8 @@ } .cp-app-contacts-tips { margin: 1em; - background-color: @msg-bg-color-light; - background-color: var(--msg-bg-color-light); + background-color: @msg-bg-color-dark; + background-color: var(--msg-bg-color-dark); font-size: 14px; padding: 10px; position: relative; diff --git a/customize.dist/src/less2/include/sidebar-layout.less b/customize.dist/src/less2/include/sidebar-layout.less index 275bf769b..ef93eae4a 100644 --- a/customize.dist/src/less2/include/sidebar-layout.less +++ b/customize.dist/src/less2/include/sidebar-layout.less @@ -110,7 +110,7 @@ input { flex: 1; //border-radius: 0.25em 0 0 0.25em; - border: 1px solid @cryptpad_color_neutral_grey; + border: 1px solid @cryptpad_color_grey_500; border-right: 0px; } button { diff --git a/customize.dist/src/less2/include/tokenfield.less b/customize.dist/src/less2/include/tokenfield.less index a8a9805ce..e71d43c96 100644 --- a/customize.dist/src/less2/include/tokenfield.less +++ b/customize.dist/src/less2/include/tokenfield.less @@ -5,7 +5,7 @@ --LessLoader_require: LessLoader_currentFile(); } & { - .ui-autocomplete { + ul.ui-autocomplete { z-index: 100001; // alertify + 1 } .tokenfield { diff --git a/customize.dist/src/less2/include/toolbar.less b/customize.dist/src/less2/include/toolbar.less index 7b4e43d0d..3f19aa433 100644 --- a/customize.dist/src/less2/include/toolbar.less +++ b/customize.dist/src/less2/include/toolbar.less @@ -399,6 +399,9 @@ button { .toolbar_button; + &.cp-notifications-bell { + color: @cryptpad_text_col; + } } .cp-toolbar-limit { diff --git a/customize.dist/src/less2/pages/page-404.less b/customize.dist/src/less2/pages/page-404.less index 575efa19c..bcacdf1ee 100644 --- a/customize.dist/src/less2/pages/page-404.less +++ b/customize.dist/src/less2/pages/page-404.less @@ -3,14 +3,13 @@ html, body { .font_main(); + height: 100%; margin: 0px; padding: 0px; - background-color: @cp_static-bg; // FIXME doesn't get applied + background-color: @cp_static-bg !important; color: @cryptpad_text_col; font-family: "IBM Plex Mono"; #cp-main { - - height: 100vh; margin: 0px; width: 100%; padding-top: 5%; diff --git a/customize.dist/src/less2/pages/page-assert.less b/customize.dist/src/less2/pages/page-assert.less new file mode 100644 index 000000000..1d1442ff5 --- /dev/null +++ b/customize.dist/src/less2/pages/page-assert.less @@ -0,0 +1,13 @@ +@import (reference) "../include/colortheme-all.less"; +@import (reference) "../include/font.less"; + +html, body { + .font_main(); + height: 100%; + margin: 0px; + padding: 0px; + background-color: @cp_static-bg !important; + color: @cryptpad_text_col; + font-family: "IBM Plex Mono"; +} + diff --git a/lib/eviction.js b/lib/eviction.js index 84db87d13..673c7313f 100644 --- a/lib/eviction.js +++ b/lib/eviction.js @@ -30,8 +30,16 @@ Env = { */ -module.exports = function (Env, cb) { - var complete = Util.once(Util.mkAsync(cb)); +// the number of ms artificially introduced between CPU-intensive operations +var THROTTLE_FACTOR = 10; + +var evictArchived = function (Env, cb) { + var Log; + var store; + var pinStore; + var blobs; + var retentionTime = +new Date() - (Env.archiveRetentionTime * 24 * 3600 * 1000); + var report = { // archivedChannelsRemoved, // archivedAccountsRemoved, @@ -53,67 +61,7 @@ module.exports = function (Env, cb) { // runningTime, }; - // the administrator should have set an 'inactiveTime' in their config - // if they didn't, just exit. - if (!Env.inactiveTime || typeof(Env.inactiveTime) !== "number") { - return void complete("NO_INACTIVE_TIME"); - } - // get a list of premium accounts on this instance - // pre-converted to the 'safeKey' format so we can easily compare - // them against ids we see on the filesystem - var premiumSafeKeys = Object.keys(Env.limits || {}) - .map(function (id) { - return Keys.canonicalize(id); - }) - .filter(Boolean) - .map(Util.escapeKeyCharacters); - - // files which have not been changed since before this date can be considered inactive - var inactiveTime = +new Date() - (Env.inactiveTime * 24 * 3600 * 1000); - - // files which were archived before this date can be considered safe to remove - var retentionTime = +new Date() - (Env.archiveRetentionTime * 24 * 3600 * 1000); - - var store; - var pinStore; - var Log; - var blobs; - - /* It's fairly easy to know if a channel or blob is active - but knowing whether it is pinned requires that we - keep the set of pinned documents in memory. - - Some users will share the same set of documents in their pin lists, - so the representation of pinned documents should scale sub-linearly - with the number of users and pinned documents. - - That said, sub-linear isn't great... - A Bloom filter is "a space-efficient probabilistic data structure" - which lets us check whether an item is _probably_ or _definitely not_ - in a set. This is good enough for our purposes since we just want to - know whether something can safely be removed and false negatives - (not safe to remove when it actually is) are acceptable. - - We set our capacity to some large number, and the error rate to whatever - we think is acceptable. - - TODO make this configurable ? - */ - var BLOOM_CAPACITY = (1 << 20) - 1; // over a million items - var BLOOM_ERROR = 1 / 10000; // an error rate of one in a thousand - // the number of ms artificially introduced between CPU-intensive operations - var THROTTLE_FACTOR = 10; - - // we'll use one filter for the set of active documents - var activeDocs = Bloom.optimalFilter(BLOOM_CAPACITY, BLOOM_ERROR); - // and another one for the set of pinned documents - var pinnedDocs = Bloom. optimalFilter(BLOOM_CAPACITY, BLOOM_ERROR); - - var startTime = +new Date(); - var msSinceStart = function () { - return (+new Date()) - startTime; - }; var loadStorage = function () { store = Env.store; @@ -237,6 +185,105 @@ module.exports = function (Env, cb) { })); }; + nThen(loadStorage) + .nThen(removeArchivedChannels) + .nThen(removeArchivedBlobProofs) + .nThen(removeArchivedBlobs) + .nThen(function () { + cb(); + }); +}; + +module.exports = function (Env, cb) { + var complete = Util.once(Util.mkAsync(cb)); + var report = { + // archivedChannelsRemoved, + // archivedAccountsRemoved, + // archivedBlobProofsRemoved, + // archivedBlobsRemoved, + + // totalChannels, + // activeChannels, + + // totalBlobs, + // activeBlobs, + + // totalAccounts, + // activeAccounts, + + // channelsArchived, + + launchTime: +new Date(), + // runningTime, + }; + + // the administrator should have set an 'inactiveTime' in their config + // if they didn't, just exit. + if (!Env.inactiveTime || typeof(Env.inactiveTime) !== "number") { + return void complete("NO_INACTIVE_TIME"); + } + + // get a list of premium accounts on this instance + // pre-converted to the 'safeKey' format so we can easily compare + // them against ids we see on the filesystem + var premiumSafeKeys = Object.keys(Env.limits || {}) + .map(function (id) { + return Keys.canonicalize(id); + }) + .filter(Boolean) + .map(Util.escapeKeyCharacters); + + // files which have not been changed since before this date can be considered inactive + var inactiveTime = +new Date() - (Env.inactiveTime * 24 * 3600 * 1000); + + // files which were archived before this date can be considered safe to remove + var retentionTime = +new Date() - (Env.archiveRetentionTime * 24 * 3600 * 1000); + + var store; + var pinStore; + var Log; + var blobs; + + /* It's fairly easy to know if a channel or blob is active + but knowing whether it is pinned requires that we + keep the set of pinned documents in memory. + + Some users will share the same set of documents in their pin lists, + so the representation of pinned documents should scale sub-linearly + with the number of users and pinned documents. + + That said, sub-linear isn't great... + A Bloom filter is "a space-efficient probabilistic data structure" + which lets us check whether an item is _probably_ or _definitely not_ + in a set. This is good enough for our purposes since we just want to + know whether something can safely be removed and false negatives + (not safe to remove when it actually is) are acceptable. + + We set our capacity to some large number, and the error rate to whatever + we think is acceptable. + + TODO make this configurable ? + */ + var BLOOM_CAPACITY = (1 << 20) - 1; // over a million items + var BLOOM_ERROR = 1 / 10000; // an error rate of one in a thousand + + // we'll use one filter for the set of active documents + var activeDocs = Bloom.optimalFilter(BLOOM_CAPACITY, BLOOM_ERROR); + // and another one for the set of pinned documents + var pinnedDocs = Bloom. optimalFilter(BLOOM_CAPACITY, BLOOM_ERROR); + + var startTime = +new Date(); + var msSinceStart = function () { + return (+new Date()) - startTime; + }; + + var loadStorage = function () { + store = Env.store; + pinStore = Env.pinStore; + Log = Env.Log; + blobs = Env.blobStore; + }; + var categorizeChannelsByActivity = function (w) { var channels = 0; var active = 0; @@ -566,9 +613,6 @@ module.exports = function (Env, cb) { }; nThen(loadStorage) - .nThen(removeArchivedChannels) - .nThen(removeArchivedBlobProofs) - .nThen(removeArchivedBlobs) // iterate over all documents and add them to a bloom filter if they have been active .nThen(categorizeChannelsByActivity) @@ -590,3 +634,5 @@ module.exports = function (Env, cb) { complete(void 0, report); }); }; + +module.exports.archived = evictArchived; diff --git a/lib/historyKeeper.js b/lib/historyKeeper.js index cfdb14717..30b311eb7 100644 --- a/lib/historyKeeper.js +++ b/lib/historyKeeper.js @@ -18,11 +18,11 @@ module.exports.create = function (Env, cb) { id: Env.id, - channelMessage: function (Server, channel, msgStruct) { + channelMessage: function (Server, channel, msgStruct, cb) { // netflux-server emits 'channelMessage' events whenever someone broadcasts to a channel // historyKeeper stores these messages if the channel id indicates that they are // a channel type with permanent history - HK.onChannelMessage(Env, Server, channel, msgStruct); + HK.onChannelMessage(Env, Server, channel, msgStruct, cb); }, channelClose: function (channelName) { // netflux-server emits 'channelClose' events whenever everyone leaves a channel diff --git a/lib/hk-util.js b/lib/hk-util.js index cea5e5636..f141bf35a 100644 --- a/lib/hk-util.js +++ b/lib/hk-util.js @@ -300,9 +300,10 @@ var trimMapByOffset = function (map, offset) { * the fix is to use callbacks and implement queueing for writes * to guarantee that offset computation is always atomic with writes */ -const storeMessage = function (Env, channel, msg, isCp, optionalMessageHash) { +const storeMessage = function (Env, channel, msg, isCp, optionalMessageHash, cb) { const id = channel.id; const Log = Env.Log; + if (typeof(cb) !== "function") { cb = function () {}; } Env.queueStorage(id, function (next) { const msgBin = Buffer.from(msg + '\n', 'utf8'); @@ -321,6 +322,7 @@ const storeMessage = function (Env, channel, msg, isCp, optionalMessageHash) { // TODO make it possible to respond to clients with errors so they know // their message wasn't stored + cb(err); return void next(); } })); @@ -332,6 +334,8 @@ const storeMessage = function (Env, channel, msg, isCp, optionalMessageHash) { if (err) { Log.warn("HK_STORE_MESSAGE_INDEX", err.stack); // non-critical, we'll be able to get the channel index later + // cb with no error so that the message is broadcast + cb(); return void next(); } if (typeof (index.line) === "number") { index.line++; } @@ -357,13 +361,17 @@ const storeMessage = function (Env, channel, msg, isCp, optionalMessageHash) { if (offsetCount < 0) { Log.warn('OFFSET_TRIM_OOO', { channel: id, - map: index.OffsetByHash + map: index.offsetByHash }); } else if (offsetCount > 0) { trimOffsetByOrder(index.offsetByHash, index.offsets); index.offsets = checkOffsetMap(index.offsetByHash); } } + + // Message stored, call back + cb(); + index.size += msgBin.length; // handle the next element in the queue @@ -445,6 +453,14 @@ const getHistoryOffset = (Env, channelName, lastKnownHash, _cb) => { return void cb(new Error('EUNKNOWN')); } + // If we asked for a lastKnownHash but didn't find it AND if + // this channel has checkpoints, send EUNKNOWN so that the + // client can ask for normal history (without lastKnownHash) + if (lastKnownHash && !lkh && index.cpIndex.length) { + waitFor.abort(); + return void cb(new Error('EUNKNOWN')); + } + // Otherwise use our lastKnownHash cb(null, lkh); })); @@ -496,7 +512,7 @@ const getHistoryAsync = (Env, channelName, lastKnownHash, beforeHash, handler, c const start = (beforeHash) ? 0 : offset; store.readMessagesBin(channelName, start, (msgObj, readMore, abort) => { if (beforeHash && msgObj.offset >= offset) { return void abort(); } - var parsed = tryParse(Env, msgObj.buff.toString('utf8')); + const parsed = tryParse(Env, msgObj.buff.toString('utf8')); if (!parsed) { return void readMore(); } handler(parsed, readMore); }, waitFor(function (err) { @@ -846,7 +862,9 @@ HK.onDirectMessage = function (Env, Server, seq, userId, json) { * adds timestamps to incoming messages * writes messages to the store */ -HK.onChannelMessage = function (Env, Server, channel, msgStruct) { +HK.onChannelMessage = function (Env, Server, channel, msgStruct, cb) { + if (typeof(cb) !== "function") { cb = function () {}; } + //console.log(+new Date(), "onChannelMessage"); const Log = Env.Log; @@ -856,7 +874,7 @@ HK.onChannelMessage = function (Env, Server, channel, msgStruct) { // we should probably just change this to expect a channel id directly // don't store messages if the channel id indicates that it's an ephemeral message - if (!channel.id || channel.id.length === EPHEMERAL_CHANNEL_LENGTH) { return; } + if (!channel.id || channel.id.length === EPHEMERAL_CHANNEL_LENGTH) { return void cb(); } const isCp = /^cp\|/.test(msgStruct[4]); let id; @@ -868,7 +886,7 @@ HK.onChannelMessage = function (Env, Server, channel, msgStruct) { // more straightforward and reliable. if (Array.isArray(id) && id[2] && id[2] === channel.lastSavedCp) { // Reject duplicate checkpoints - return; + return void cb('DUPLICATE'); } } @@ -881,7 +899,10 @@ HK.onChannelMessage = function (Env, Server, channel, msgStruct) { metadata = _metadata; // don't write messages to expired channels - if (checkExpired(Env, Server, channel)) { return void w.abort(); } + if (checkExpired(Env, Server, channel)) { + cb('EEXPIRED'); + return void w.abort(); + } })); }).nThen(function (w) { // if there's no validateKey present skip to the next block @@ -910,6 +931,7 @@ HK.onChannelMessage = function (Env, Server, channel, msgStruct) { Log.info("HK_SIGNED_MESSAGE_REJECTED", 'Channel '+channel.id); } // always abort if there was an error... + cb('FAILED_VALIDATION'); return void w.abort(); }); }); @@ -942,7 +964,7 @@ HK.onChannelMessage = function (Env, Server, channel, msgStruct) { // storeMessage //console.log(+new Date(), "Storing message"); - storeMessage(Env, channel, JSON.stringify(msgStruct), isCp, getHash(msgStruct[4], Log)); + storeMessage(Env, channel, JSON.stringify(msgStruct), isCp, getHash(msgStruct[4], Log), cb); //console.log(+new Date(), "Message stored"); }); }; diff --git a/lib/workers/db-worker.js b/lib/workers/db-worker.js index 5750ff7ac..a8aa8f154 100644 --- a/lib/workers/db-worker.js +++ b/lib/workers/db-worker.js @@ -348,7 +348,10 @@ const getOlderHistory = function (data, cb) { if (hash === oldestKnownHash) { found = true; } - messages.push(parsed); + messages.push({ + msg: parsed, + hash: hash, + }); }, function (err) { var toSend = []; if (typeof (desiredMessages) === "number") { @@ -356,14 +359,14 @@ const getOlderHistory = function (data, cb) { } else if (untilHash) { for (var j = messages.length - 1; j >= 0; j--) { toSend.unshift(messages[j]); - if (Array.isArray(messages[j]) && HK.getHash(messages[j][4]) === untilHash) { + if (messages[j] && messages[j].hash === untilHash) { break; } } } else { let cpCount = 0; for (var i = messages.length - 1; i >= 0; i--) { - if (/^cp\|/.test(messages[i][4]) && i !== (messages.length - 1)) { + if (/^cp\|/.test(messages[i].msg[4]) && i !== (messages.length - 1)) { cpCount++; } toSend.unshift(messages[i]); diff --git a/package-lock.json b/package-lock.json index eb0d82927..c2e5071b3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -403,9 +403,9 @@ } }, "chainpad-server": { - "version": "4.0.9", - "resolved": "https://registry.npmjs.org/chainpad-server/-/chainpad-server-4.0.9.tgz", - "integrity": "sha512-8h1W41ktE05TM6LuXrklpW2TUxWeNyIDiRaQygKsXaA/7pyJxF7+AmPVS+xW0c31VkHjQDPiaMzPoxhcxXnIyA==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/chainpad-server/-/chainpad-server-5.0.0.tgz", + "integrity": "sha512-rfJxcWdF5InMPnNkhMWD+VRwzKUcUQktMG7DpEs90zuB7w6e8rs4MAOTEmc2rgK5EB0fYTlOMdSft58hKnbgHw==", "requires": { "nthen": "0.1.8", "pull-stream": "^3.6.9", diff --git a/package.json b/package.json index 4f150fc38..f87caf8b8 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "dependencies": { "@mcrowe/minibloom": "^0.2.0", "chainpad-crypto": "^0.2.5", - "chainpad-server": "^4.0.9", + "chainpad-server": "^5.0.0", "express": "~4.16.0", "fs-extra": "^7.0.0", "get-folder-size": "^2.0.1", diff --git a/scripts/evict-archived.js b/scripts/evict-archived.js new file mode 100644 index 000000000..7f90f9ff5 --- /dev/null +++ b/scripts/evict-archived.js @@ -0,0 +1,102 @@ +var Eviction = require("../lib/eviction"); +var nThen = require("nthen"); +var Store = require("../lib/storage/file"); +var BlobStore = require("../lib/storage/blob"); + +var Quota = require("../lib/commands/quota"); +var Environment = require("../lib/env"); +var Decrees = require("../lib/decrees"); + +var config = require("../lib/load-config"); + +var Env = Environment.create(config); + +var loadPremiumAccounts = function (Env, cb) { + nThen(function (w) { + // load premium accounts + Quota.updateCachedLimits(Env, w(function (err) { + if (err) { + Env.Log.error('EVICT_LOAD_PREMIUM_ACCOUNTS', { + error: err, + }); + } + })); + }).nThen(function (w) { + // load and apply decrees + Decrees.load(Env, w(function (err) { + if (err) { + Env.Log.error('EVICT_LOAD_DECREES', { + error: err.code || err, + message: err.message, + }); + } + })); + }).nThen(function () { + //console.log(Env.limits); + cb(); + }); +}; + +var prepareEnv = function (Env, cb) { + //Quota.applyCustomLimits(Env); + + nThen(function (w) { + /* Database adaptors + */ + + // load the store which will be used for iterating over channels + // and performing operations like archival and deletion + Store.create(config, w(function (err, _) { + if (err) { + w.abort(); + throw err; + } + Env.store = _; + })); + + Store.create({ + filePath: config.pinPath, + }, w(function (err, _) { + if (err) { + w.abort(); + throw err; + } + Env.pinStore = _; + })); + + // load the logging module so that you have a record of which + // files were archived or deleted at what time + var Logger = require("../lib/log"); + Logger.create(config, w(function (_) { + Env.Log = _; + })); + + config.getSession = function () {}; + BlobStore.create(config, w(function (err, _) { + if (err) { + w.abort(); + return console.error(err); + } + Env.blobStore = _; + })); + }).nThen(function (w) { + loadPremiumAccounts(Env, w(function (/* err */) { + //if (err) { } + })); + }).nThen(function () { + cb(); + }); +}; + +//console.log("starting"); +nThen(function (w) { + // load database adaptors and configuration values into the environment + prepareEnv(Env, w(function () { + //console.log("env prepared"); + + })); +}).nThen(function (w) { + Eviction.archived(Env, w(function () { + + })); +}); diff --git a/scripts/unused-translations.js b/scripts/unused-translations.js new file mode 100644 index 000000000..9c09ad54e --- /dev/null +++ b/scripts/unused-translations.js @@ -0,0 +1,139 @@ +var Messages = require("../www/common/translations/messages.json"); +var Exec = require("child_process").exec; + +var ignoreLines = function (source, pattern) { + if (!pattern.test(source)) { return source; } + return source.split('\n') + .map(function (line) { + if (pattern.test(line)) { return ''; } + return line; + }) + .filter(Boolean) + .join("\n"); +}; + +var GENERATED_PATTERNS = [ + /(admin|settings)_.*(Hint|Title|Button)/, + /settings_colortheme/, + /loading_(state|drive|pad)_/, + /(admin|notifications|support|team|settings)_cat_/, + /features_f/, +]; +var isPossiblyGenerated = function (key) { + return GENERATED_PATTERNS.some(function (patt) { + return patt.test(key); + }); +}; + +var grep = function (pattern, cb) { + var exclude = [ + 'www/common/translations/*', + 'www/common/onlyoffice/*', + 'www/lib/*', + 'www/common/pdfjs/*', + '*.css', + 'www/common/highlight/*', + '*.min.js', + '.lesshintrc', + 'CHANGELOG.md', + 'LICENSE', + 'package*.json', + 'www/debug/chainpad.dist.js', + 'www/pad/mathjax/*', + 'www/common/hyperscript.js', + 'www/common/jscolor.js', + './/scripts/*', + './lib/*', + './docs/*', + './github/*', + '*.svg', + '*.md', + './config/*', + ].map(function (patt) { + return "':(exclude)" + patt + "'"; + }).join(' '); + + // grep this repository, ignoring binary files and excluding anything matching the above patterns + //var ignoreBinaries= '--binary-files=without-match '; + var command = 'git grep ' + pattern + " -- ':/' " + exclude; + + Exec(command, function (err, stdout /*, stderr */) { + if (err && err.code === 1 && err.killed === false) { + if (isPossiblyGenerated(pattern)) { + return cb(void 0, true, 'POSSIBLY_GENERATED'); + } + return cb(void 0, true, "NOT_FOUND", stdout); + } + stdout = ignoreLines(stdout, /Binary file/); + + if (err) { + if (err.code === 'ERR_CHILD_PROCESS_STDIO_MAXBUFFER') { + return cb(void 0, true, 'TOO_MUCH', stdout); + } + return void cb(err); + } + if (/data\-localization/.test(stdout)) { + return cb(void 0, true, "DATA_LOCALIZATION", stdout); + } + if (/(Messages|Msg|messages)\./.test(stdout)) { + return cb(void 0, false); + } + + //console.log(pattern, arguments); + cb(void 0, true, 'OTHER', stdout); + }); +}; + +var keys = Object.keys(Messages).sort(); +var total = keys.length; + +var limit = total; + +var lineCount = function (s) { + var i = 0; + s.replace(/\n/g, function () { i++; return ''; }); + return i; +}; + +var conditionallyPrintContent = function (output) { + if (!output) { return; } + if (lineCount(output) < 12) { + output.split('\n').map(function (line) { + if (!line) { return; } + console.log('\t> ' + line); + }); + //console.log(output); + console.log(); + } else { + console.log("\t> too much content to print"); + } +}; + +var next = function () { + var key = keys[0]; + if (!key) { return; } + keys.shift(); + + if (!limit) { return void console.log("[DONE]"); } + limit--; + + grep(key, function (err, flagged, reason, output) { + if (err) { + console.error("[%s]", key, err); + console.log(); + return; + } else if (!flagged) { + + } else if (reason === 'OTHER') { + console.log('[%s] flagged for [OTHER]', key); + conditionallyPrintContent(output); + } else { + console.log("[%s] flagged for [%s]", key, reason || '???'); + conditionallyPrintContent(output); + } + + next(); + }); +}; + +next(); diff --git a/www/admin/app-admin.less b/www/admin/app-admin.less index da4703203..6d8b5c2b0 100644 --- a/www/admin/app-admin.less +++ b/www/admin/app-admin.less @@ -104,7 +104,6 @@ color: fade(@cryptpad_text_col, 80%); .cp-support-ispremium { padding: 0 5px; - color: @cp_admin-premium-fg; background-color: @cp_admin-premium-bg; } } @@ -118,19 +117,19 @@ } } .cp-support-list-message { + .cp-support-showdata { + background-color: lighten(@cp_admin-last-bg, 5%); + } &:last-child:not(.cp-support-fromadmin) { color: @cp_admin-last-fg; background-color: @cp_admin-last-bg; - .cp-support-showdata { - background-color: lighten(@cp_admin-last-bg, 5%); - } } &:last-child { &.cp-support-frompremium { background-color: @cp_admin-premium-bg; .cp-support-showdata { - background-color: lighten(@cp_admin-premium-bg, 30%); + background-color: fade(@cp_admin-premium-bg, 10%); } } } @@ -160,10 +159,10 @@ } .cp-support-fromadmin { - color: @cp_admin-isadmin-fg; - background-color: @cp_admin-isadmin-bg; - .cp-support-message-content { - color: @cp_admin-isadmin-fg; + background-color: @cp_admin-isadmin-bg !important; + .cp-support-message-from, .cp-support-showdata { + color: @cryptpad_text_col; + background-color: fade(@cp_admin-isadmin-bg, 10%) !important; } } diff --git a/www/assert/main.js b/www/assert/main.js index db417c761..f40a8e006 100644 --- a/www/assert/main.js +++ b/www/assert/main.js @@ -13,6 +13,7 @@ define([ '/common/outer/login-block.js', '/bower_components/tweetnacl/nacl-fast.min.js', + 'less!/customize/src/less2/pages/page-assert.less', ], function ($, Hyperjson, Sortify, Drive, Test, Hash, Util, Thumb, Wire, Flat, MediaTag, Block) { window.Hyperjson = Hyperjson; window.Sortify = Sortify; diff --git a/www/common/onlyoffice/inner.js b/www/common/onlyoffice/inner.js index f68463f9e..577c1d286 100644 --- a/www/common/onlyoffice/inner.js +++ b/www/common/onlyoffice/inner.js @@ -64,9 +64,9 @@ define([ var CURRENT_VERSION = 'v2b'; //var READONLY_REFRESH_TO = 15000; - var debug = function (x) { + var debug = function (x, type) { if (!window.CP_DEV_MODE) { return; } - console.debug(x); + console.debug(x, type); }; var stringify = function (obj) { @@ -812,10 +812,16 @@ define([ }; // Get all existing locks + var getUserLock = function (id) { + var l = content.locks[id] || {}; + return Object.keys(l).map(function (uid) { return l[uid]; }); + }; var getLock = function () { - return Object.keys(content.locks).map(function (id) { - return content.locks[id]; + var locks = []; + Object.keys(content.locks).forEach(function (id) { + Array.prototype.push.apply(locks, getUserLock(id)); }); + return locks; }; // Update the userlist in onlyoffice @@ -831,37 +837,38 @@ define([ }; // Update the locks status in onlyoffice var handleNewLocks = function (o, n) { - Object.keys(n).forEach(function (id) { - // New lock - if (!o[id]) { - ooChannel.send({ - type: "getLock", - locks: getLock() - }); - return; - } - // Updated lock - if (stringify(n[id]) !== stringify(o[id])) { - ooChannel.send({ - type: "releaseLock", - locks: [o[id]] - }); - ooChannel.send({ - type: "getLock", - locks: getLock() - }); - } + var hasNew = false; + // Check if we have at least one new lock + Object.keys(n).some(function (id) { + if (typeof(n[id]) !== "object") { return; } // Ignore old format + // n[id] = { uid: lock, uid2: lock2 }; + return Object.keys(n[id]).some(function (uid) { + // New lock + if (!o[id] || !o[id][uid]) { + hasNew = true; + return true; + } + }); }); + // Remove old locks Object.keys(o).forEach(function (id) { - // Removed lock - if (!n[id]) { - ooChannel.send({ - type: "releaseLock", - locks: [o[id]] - }); - return; - } + if (typeof(o[id]) !== "object") { return; } // Ignore old format + Object.keys(o[id]).forEach(function (uid) { + // Removed lock + if (!n[id] || !n[id][uid]) { + ooChannel.send({ + type: "releaseLock", + locks: [o[id][uid]] + }); + } + }); }); + if (hasNew) { + ooChannel.send({ + type: "getLock", + locks: getLock() + }); + } }; // Remove locks from offline users @@ -871,9 +878,11 @@ define([ Object.keys(locks).forEach(function (id) { var nId = id.slice(0,32); if (users.indexOf(nId) === -1) { + // Offline locks: support old format + var l = typeof(locks[id]) === "object" ? getUserLock(id) : [locks[id]]; ooChannel.send({ type: "releaseLock", - locks: [locks[id]] + locks: l }); delete content.locks[id]; } @@ -927,6 +936,8 @@ define([ data: {"type":"open","status":"ok","data":{"Editor.bin":obj.openCmd.url}} }); + /* + // TODO: make sure we don't have new popups that can break our integration var observer = new MutationObserver(function(mutations) { mutations.forEach(function(mutation) { if (mutation.type === "childList") { @@ -942,6 +953,7 @@ define([ observer.observe(window.frames[0].document.body, { childList: true, }); + */ }; var handleLock = function (obj, send) { @@ -964,7 +976,9 @@ define([ block: obj.block && obj.block[0], }; var myId = getId(); - content.locks[myId] = msg; + content.locks[myId] = content.locks[myId] || {}; + var uid = Util.uid(); + content.locks[myId][uid] = msg; oldLocks = JSON.parse(JSON.stringify(content.locks)); // Remove old locks deleteOfflineLocks(); @@ -1047,7 +1061,7 @@ define([ type: "saveChanges", changes: parseChanges(obj.changes), changesIndex: ooChannel.cpIndex || 0, - locks: [content.locks[getId()]], + locks: getUserLock(getId()), excelAdditionalInfo: null }, null, function (err, hash) { if (err) { @@ -1072,7 +1086,7 @@ define([ ooChannel.lastHash = hash; // Check if a checkpoint is needed makeCheckpoint(); - // Remove my lock + // Remove my locks delete content.locks[getId()]; oldLocks = JSON.parse(JSON.stringify(content.locks)); APP.onLocal(); @@ -1094,12 +1108,12 @@ define([ APP.chan = chan; var send = ooChannel.send = function (obj) { - debug(obj); + debug(obj, 'toOO'); chan.event('CMD', obj); }; chan.on('CMD', function (obj) { - debug(obj); + debug(obj, 'fromOO'); switch (obj.type) { case "auth": handleAuth(obj, send); @@ -1144,7 +1158,7 @@ define([ if (obj.releaseLocks && content.locks && content.locks[getId()]) { send({ type: "releaseLock", - locks: [content.locks[getId()]] + locks: getUserLock(getId()) }); delete content.locks[getId()]; APP.onLocal(); @@ -1198,9 +1212,10 @@ define([ "user": { "id": String(myOOId), //"c0c3bf82-20d7-4663-bf6d-7fa39c598b1d", "firstname": metadataMgr.getUserData().name || Messages.anonymous, + "name": metadataMgr.getUserData().name || Messages.anonymous, }, "mode": "edit", - "lang": (navigator.language || navigator.userLanguage || '').slice(0,2) + "lang": (window.cryptpadLanguage || navigator.language || navigator.userLanguage || '').slice(0,2) }, "events": { "onAppReady": function(/*evt*/) { @@ -2459,7 +2474,7 @@ define([ if (content.hashes) { var latest = getLastCp(true); var newLatest = getLastCp(); - if (newLatest.index > latest.index) { + if (newLatest.index > latest.index || (newLatest.index && !latest.index)) { ooChannel.queue = []; ooChannel.ready = false; // New checkpoint diff --git a/www/common/onlyoffice/v2b/web-apps/apps/spreadsheeteditor/main/app.js b/www/common/onlyoffice/v2b/web-apps/apps/spreadsheeteditor/main/app.js index 7fb071c12..82c9e70be 100644 --- a/www/common/onlyoffice/v2b/web-apps/apps/spreadsheeteditor/main/app.js +++ b/www/common/onlyoffice/v2b/web-apps/apps/spreadsheeteditor/main/app.js @@ -20,21 +20,21 @@ t.asc_setTooltip(this.inputTip.getValue()),t},onBtnClick:function(t){this._handl this.store.length<1&&this.emptyText.length>0&&$(this.el).find(".inner").addBack().filter(".inner").append('
'+this.emptyText+"
"),_.each(this.dataViewItems,function(t){this.stopListening(t),t.stopListening(t.model)},this),this.dataViewItems=[],this.store.each(this.onAddItem,this),this.allowScrollbar&&(this.scroller=new Common.UI.Scroller({el:$(this.el).find(".inner").addBack().filter(".inner"),useKeyboard:this.enableKeyEvents&&!this.handleSelect,minScrollbarLength:40,wheelSpeed:10,alwaysVisibleY:this.scrollAlwaysVisible})),this.disabled&&this.setDisabled(this.disabled),this.attachKeyEvents(),this.lastSelectedRec=null,this._layoutParams=void 0},onChangeItem:function(t,e){this.isSuspendEvents||this.trigger("item:change",this,t,e)},onRemoveItem:function(t,e){var i=t.$el.data("bs.tooltip");if(i&&(void 0===i.dontShow&&(i.dontShow=!0),i.tip().remove()),this.stopListening(t),t.stopListening(),this.store.length<1&&this.emptyText.length>0){var n=$(this.el).find(".inner").addBack().filter(".inner");n.find(".empty-text").length<=0&&n.append('
'+this.emptyText+"
")}for(var o=0;o=0&&this.dataViewItems.length>n?$(this.dataViewItems[n].el):e.find("#"+t.get("id"));if(!(o.length<=0)){var s=o.offset().top,a=$(this.dataViewItems[0].el),l=a.length>0?a[0].offsetTop:0;(si+e.height())&&(this.scroller&&this.allowScrollbar?this.scroller.scrollTop(e.scrollTop()+s-i-l,0):e.scrollTop(e.scrollTop()+s-i-l))}}},onKeyDown:function(t,e){if(!this.disabled)if(void 0===e&&(e=t),_.indexOf(this.moveKeys,e.keyCode)>-1||e.keyCode==Common.UI.Keys.RETURN){e.preventDefault(),e.stopPropagation();var i=this.getSelectedRec();if(null===this.lastSelectedRec&&(this.lastSelectedRec=i),e.keyCode==Common.UI.Keys.RETURN)this.lastSelectedRec=null,this.selectedBeforeHideRec&&(i=this.selectedBeforeHideRec),this.trigger("item:click",this,this,i,t),this.trigger("item:select",this,this,i,t),this.trigger("entervalue",this,i,t),this.parentMenu&&this.parentMenu.hide();else{var n=_.indexOf(this.store.models,i);if(n<0)if(e.keyCode==Common.UI.Keys.LEFT){var o=$(t.target).closest(".dropdown-submenu.over");o.length>0?(o.removeClass("over"),o.find("> a").focus()):n=0}else n=0;else if("both"==this.options.keyMoveDirection){void 0===this._layoutParams&&this.fillIndexesArray();var s=this.dataViewItems[n].topIdx,a=this.dataViewItems[n].leftIdx;if(n=void 0,e.keyCode==Common.UI.Keys.LEFT)for(;void 0===n;){if(--a<0){var o=$(t.target).closest(".dropdown-submenu.over");if(o.length>0){o.removeClass("over"),o.find("> a").focus();break}a=this._layoutParams.columns-1}n=this._layoutParams.itemsIndexes[s][a]}else if(e.keyCode==Common.UI.Keys.RIGHT)for(;void 0===n;)a++,a>this._layoutParams.columns-1&&(a=0),n=this._layoutParams.itemsIndexes[s][a];else if(e.keyCode==Common.UI.Keys.UP)for(;void 0===n;)s--,s<0&&(s=this._layoutParams.rows-1),n=this._layoutParams.itemsIndexes[s][a];else for(;void 0===n;)s++,s>this._layoutParams.rows-1&&(s=0),n=this._layoutParams.itemsIndexes[s][a]}else n=e.keyCode==Common.UI.Keys.UP||e.keyCode==Common.UI.Keys.LEFT?Math.max(0,n-1):Math.min(this.store.length-1,n+1);void 0!==n&&n>=0&&(i=this.store.at(n)),i&&(this._fromKeyDown=!0,this.selectRecord(i),this._fromKeyDown=!1,this.scrollToRecord(i))}}else this.trigger("item:keydown",this,i,t)},attachKeyEvents:function(){if(this.enableKeyEvents&&this.handleSelect){var t=$(this.el).find(".inner").addBack().filter(".inner");t.addClass("canfocused"),t.attr("tabindex","0"),t.on(this.parentMenu&&this.useBSKeydown?"dataview:keydown":"keydown",_.bind(this.onKeyDown,this))}},showLastSelected:function(){this.lastSelectedRec?(this.selectRecord(this.lastSelectedRec,!0),this.scrollToRecord(this.lastSelectedRec),this.lastSelectedRec=null):this.scrollToRecord(this.getSelectedRec())},setDisabled:function(t){this.disabled=t,$(this.el).find(".inner").addBack().filter(".inner").toggleClass("disabled",t)},isDisabled:function(){return this.disabled},setEmptyText:function(t){this.emptyText=t},alignPosition:function(){var t="menu"===this.parentMenu.cmpEl.attr("role")?this.parentMenu.cmpEl:this.parentMenu.cmpEl.find("[role=menu]"),e=Common.Utils.innerHeight()-10,i=$(this.el).find(".inner").addBack().filter(".inner"),n=i.parent(),o=parseInt(n.css("margin-top"))+parseInt(n.css("margin-bottom"))+parseInt(t.css("margin-top")),s=parseInt(t.css("padding-top"))+parseInt(t.css("padding-bottom")),a=t.outerHeight(),l=parseInt(t.css("top")),r={minScrollbarLength:40};this.scrollAlwaysVisible&&(r.alwaysVisibleY=this.scrollAlwaysVisible),l+a>e?(i.css("max-height",e-l-s-o+"px"),this.allowScrollbar&&this.scroller.update(r)):l+ao&&(o=r,this._layoutParams.itemsIndexes.push([]),s=this._layoutParams.itemsIndexes.length-1),this._layoutParams.itemsIndexes[s][a]=l,this.dataViewItems[l].topIdx=s,this.dataViewItems[l].leftIdx=a,this._layoutParams.columns<%= value %>')},template:_.template(['
'].join("")),onResetItems:function(){this.innerEl=null,Common.UI.DataView.prototype.onResetItems.call(this),this.trigger("items:reset",this)},onAddItem:function(t,e,i){var n=new Common.UI.DataViewItem({template:this.itemTemplate,model:t});if(this.innerEl||(this.innerEl=$(this.el).find(".inner")),n&&this.innerEl){if(this.dataViewItems.length<1&&this.innerEl.find(".empty-text").remove(),this.options.simpleAddMode)this.innerEl.append(n.render().el),this.dataViewItems.push(n);else{var o=_.indexOf(this.store.models,t),s=this.innerEl.find("> div");o>0?$(s.get(o-1)).after(n.render().el):s.length>0?$(s[o]).before(n.render().el):this.innerEl.append(n.render().el),this.dataViewItems=this.dataViewItems.slice(0,o).concat(n).concat(this.dataViewItems.slice(o))}if(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),t.get("tip")){var a=$(n.el);a.attr("data-toggle","tooltip"),a.tooltip({title:t.get("tip"),placement:"cursor",zIndex:this.tipZIndex})}this.isSuspendEvents||this.trigger("item:add",this,n,t)}}}}())}),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(t){"use strict";SSE.Views.ParagraphSettingsAdvanced=Common.Views.AdvancedSettingsWindow.extend(_.extend({options:{contentWidth:370,height:394,toggleGroup:"paragraph-adv-settings-group",storageName:"sse-para-settings-adv-category"},initialize:function(e){var i=this;_.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(t)({scope:this})},e),Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this,this.options),this._changedProps=null,this.checkGroup=0,this._noApply=!0,this._tabListChanged=!1,this.spinners=[],this.FirstLine=void 0,this.Spacing=null,this.api=this.options.api,this._originalProps=new Asc.asc_CParagraphProperty(this.options.paragraphProps),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"}];var n=this._originalProps.asc_getSpacing().asc_getLineRule(),o=_.findWhere(this._arrLineRule,{value:n});this.CurLineRuleIdx=this._arrLineRule.indexOf(o),this._arrTextAlignment=[{displayValue:this.textTabLeft,value:c_paragraphTextAlignment.LEFT},{displayValue:this.textTabCenter,value:c_paragraphTextAlignment.CENTERED},{displayValue:this.textTabRight,value:c_paragraphTextAlignment.RIGHT},{displayValue:this.textJustified,value:c_paragraphTextAlignment.JUSTIFIED}],this._arrSpecial=[{displayValue:this.textNoneSpecial,value:c_paragraphSpecial.NONE_SPECIAL,defaultValue:0},{displayValue:this.textFirstLine,value:c_paragraphSpecial.FIRST_LINE,defaultValue:12.7},{displayValue:this.textHanging,value:c_paragraphSpecial.HANGING,defaultValue:12.7}],this._arrTabAlign=[{value:1,displayValue:this.textTabLeft},{value:3,displayValue:this.textTabCenter},{value:2,displayValue:this.textTabRight}],this._arrKeyTabAlign=[],this._arrTabAlign.forEach(function(t){i._arrKeyTabAlign[t.value]=t.displayValue})},render:function(){Common.Views.AdvancedSettingsWindow.prototype.render.call(this);var t=this;this.cmbTextAlignment=new Common.UI.ComboBox({el:$("#paragraphadv-spin-text-alignment"),cls:"input-group-nr",editable:!1,data:this._arrTextAlignment,style:"width: 173px;",menuStyle:"min-width: 173px;"}),this.cmbTextAlignment.setValue(""),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:0}),this.numIndentsLeft.on("change",_.bind(function(t,e,i,n){var o=t.getNumberValue();this._changedProps&&(null!==this._changedProps.asc_getInd()&&void 0!==this._changedProps.asc_getInd()||this._changedProps.put_Ind(new Asc.asc_CParagraphInd),this._changedProps.asc_getInd().put_Left(Common.Utils.Metric.fnRecalcToMM(o)))},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:0}),this.numIndentsRight.on("change",_.bind(function(t,e,i,n){this._changedProps&&(null!==this._changedProps.asc_getInd()&&void 0!==this._changedProps.asc_getInd()||this._changedProps.put_Ind(new Asc.asc_CParagraphInd),this._changedProps.asc_getInd().put_Right(Common.Utils.Metric.fnRecalcToMM(t.getNumberValue())))},this)),this.spinners.push(this.numIndentsRight),this.cmbSpecial=new Common.UI.ComboBox({el:$("#paragraphadv-spin-special"),cls:"input-group-nr",editable:!1,data:this._arrSpecial,style:"width: 85px;",menuStyle:"min-width: 85px;"}),this.cmbSpecial.setValue(""),this.cmbSpecial.on("selected",_.bind(this.onSpecialSelect,this)),this.numSpecialBy=new Common.UI.MetricSpinner({el:$("#paragraphadv-spin-special-by"),step:.1,width:85,defaultUnit:"cm",defaultValue:0,value:"0 cm",maxValue:55.87,minValue:0}),this.spinners.push(this.numSpecialBy),this.numSpecialBy.on("change",_.bind(this.onFirstLineChange,this)),this.numSpacingBefore=new Common.UI.MetricSpinner({el:$("#paragraphadv-spin-spacing-before"),step:.1,width:85,value:"",defaultUnit:"cm",maxValue:55.88,minValue:0,allowAuto:!0,autoText:this.txtAutoText}),this.numSpacingBefore.on("change",_.bind(function(t,e,i,n){if(null===this.Spacing){var o=this._originalProps?this._originalProps:new Asc.asc_CParagraphProperty;this.Spacing=o.asc_getSpacing()}this.Spacing.Before=Common.Utils.Metric.fnRecalcToMM(t.getNumberValue())},this)),this.spinners.push(this.numSpacingBefore),this.numSpacingAfter=new Common.UI.MetricSpinner({el:$("#paragraphadv-spin-spacing-after"),step:.1,width:85,value:"",defaultUnit:"cm",maxValue:55.88,minValue:0,allowAuto:!0,autoText:this.txtAutoText}),this.numSpacingAfter.on("change",_.bind(function(t,e,i,n){if(null===this.Spacing){var o=this._originalProps?this._originalProps:new Asc.asc_CParagraphProperty;this.Spacing=o.asc_getSpacing()}this.Spacing.After=Common.Utils.Metric.fnRecalcToMM(t.getNumberValue())},this)),this.spinners.push(this.numSpacingAfter),this.cmbLineRule=new Common.UI.ComboBox({el:$("#paragraphadv-spin-line-rule"),cls:"input-group-nr",editable:!1,data:this._arrLineRule,style:"width: 85px;",menuStyle:"min-width: 85px;"}),this.cmbLineRule.setValue(this.CurLineRuleIdx),this.cmbLineRule.on("selected",_.bind(this.onLineRuleSelect,this)),this.numLineHeight=new Common.UI.MetricSpinner({el:$("#paragraphadv-spin-line-height"),step:.01,width:85,value:"",defaultUnit:"",maxValue:132,minValue:.5}),this.spinners.push(this.numLineHeight),this.numLineHeight.on("change",_.bind(this.onNumLineHeightChange,this)),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(t,e,i,n){if(this._changedProps&&this._changedProps.asc_putTextSpacing(Common.Utils.Metric.fnRecalcToMM(t.getNumberValue())),this.api&&!this._noApply){var o=this._originalProps?this._originalProps:new Asc.asc_CParagraphProperty;o.asc_putTextSpacing(Common.Utils.Metric.fnRecalcToMM(t.getNumberValue())),this.api.asc_setDrawImagePlaceParagraph("paragraphadv-font-img",o)}},this)),this.spinners.push(this.numSpacing),this.numTab=new Common.UI.MetricSpinner({el:$("#paraadv-spin-tab"),step:.1,width:108,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:108,defaultUnit:"cm",value:"1.25 cm",maxValue:55.87,minValue:0}),this.numDefaultTab.on("change",_.bind(function(t,e,i,n){this._changedProps&&this._changedProps.asc_putDefaultTab(parseFloat(Common.Utils.Metric.fnRecalcToMM(t.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,template:_.template(['
'].join("")),itemTemplate:_.template(['
','
<%= value %>
','
<%= displayTabAlign %>
',"
"].join(""))}),this.tabList.store.comparator=function(t){return t.get("tabPos")},this.tabList.on("item:select",_.bind(this.onSelectTab,this));var e=function(){t._noApply||(t._tabListChanged=!0)};this.listenTo(this.tabList.store,"add",e),this.listenTo(this.tabList.store,"remove",e),this.listenTo(this.tabList.store,"reset",e),this.cmbAlign=new Common.UI.ComboBox({el:$("#paraadv-cmb-align"),style:"width: 108px;",menuStyle:"min-width: 108px;",editable:!1,cls:"input-group-nr",data:this._arrTabAlign}),this.cmbAlign.setValue(1),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(t){t.getChild(".footer .primary").focus()}),this.afterRender()},getSettings:function(){this._tabListChanged&&(null!==this._changedProps.asc_getTabs()&&void 0!==this._changedProps.asc_getTabs()||this._changedProps.asc_putTabs(new Asc.asc_CParagraphTabs),this.tabList.store.each(function(t,e){var i=new Asc.asc_CParagraphTab(Common.Utils.Metric.fnRecalcToMM(t.get("tabPos")),t.get("tabAlign"));this._changedProps.asc_getTabs().add_Tab(i)},this));var t=this.cmbTextAlignment.getValue();return this._changedProps.asc_putJc(void 0!==t&&null!==t?t:c_paragraphTextAlignment.LEFT),null!==this.Spacing&&this._changedProps.asc_putSpacing(this.Spacing),{paragraphProps:this._changedProps}},_setDefaults:function(t){if(t){this._originalProps=new Asc.asc_CParagraphProperty(t),this.FirstLine=null!==t.asc_getInd()?t.asc_getInd().asc_getFirstLine():null,this.numIndentsLeft.setValue(null!==t.asc_getInd()&&null!==t.asc_getInd().asc_getLeft()?Common.Utils.Metric.fnRecalcFromMM(t.asc_getInd().asc_getLeft()):"",!0),this.numIndentsRight.setValue(null!==t.asc_getInd()&&null!==t.asc_getInd().asc_getRight()?Common.Utils.Metric.fnRecalcFromMM(t.asc_getInd().asc_getRight()):"",!0),this.cmbTextAlignment.setValue(void 0!==t.asc_getJc()&&null!==t.asc_getJc()?t.asc_getJc():c_paragraphTextAlignment.CENTERED,!0),void 0===this.CurSpecial&&(this.CurSpecial=0===t.asc_getInd().asc_getFirstLine()?c_paragraphSpecial.NONE_SPECIAL:t.asc_getInd().asc_getFirstLine()>0?c_paragraphSpecial.FIRST_LINE:c_paragraphSpecial.HANGING),this.cmbSpecial.setValue(this.CurSpecial),this.numSpecialBy.setValue(null!==this.FirstLine?Math.abs(Common.Utils.Metric.fnRecalcFromMM(this.FirstLine)):"",!0),this.numSpacingBefore.setValue(null!==t.asc_getSpacing()&&null!==t.asc_getSpacing().asc_getBefore()?Common.Utils.Metric.fnRecalcFromMM(t.asc_getSpacing().asc_getBefore()):"",!0),this.numSpacingAfter.setValue(null!==t.asc_getSpacing()&&null!==t.asc_getSpacing().asc_getAfter()?Common.Utils.Metric.fnRecalcFromMM(t.asc_getSpacing().asc_getAfter()):"",!0);var e=t.asc_getSpacing().asc_getLineRule();this.cmbLineRule.setValue(null!==e?e:"",!0),null!==t.asc_getSpacing()&&null!==t.asc_getSpacing().asc_getLine()?this.numLineHeight.setValue(e==c_paragraphLinerule.LINERULE_AUTO?t.asc_getSpacing().asc_getLine():Common.Utils.Metric.fnRecalcFromMM(t.asc_getSpacing().asc_getLine()),!0):this.numLineHeight.setValue("",!0),this._noApply=!0,this.chStrike.setValue(null!==t.asc_getStrikeout()&&void 0!==t.asc_getStrikeout()?t.asc_getStrikeout():"indeterminate",!0),this.chDoubleStrike.setValue(null!==t.asc_getDStrikeout()&&void 0!==t.asc_getDStrikeout()?t.asc_getDStrikeout():"indeterminate",!0),this.chSubscript.setValue(null!==t.asc_getSubscript()&&void 0!==t.asc_getSubscript()?t.asc_getSubscript():"indeterminate",!0),this.chSuperscript.setValue(null!==t.asc_getSuperscript()&&void 0!==t.asc_getSuperscript()?t.asc_getSuperscript():"indeterminate",!0),this.chSmallCaps.setValue(null!==t.asc_getSmallCaps()&&void 0!==t.asc_getSmallCaps()?t.asc_getSmallCaps():"indeterminate",!0),this.chAllCaps.setValue(null!==t.asc_getAllCaps()&&void 0!==t.asc_getAllCaps()?t.asc_getAllCaps():"indeterminate",!0),this.numSpacing.setValue(null!==t.asc_getTextSpacing()&&void 0!==t.asc_getTextSpacing()?Common.Utils.Metric.fnRecalcFromMM(t.asc_getTextSpacing()):"",!0),this.api.asc_setDrawImagePlaceParagraph("paragraphadv-font-img",this._originalProps),this.numDefaultTab.setValue(null!==t.asc_getDefaultTab()&&void 0!==t.asc_getDefaultTab()?Common.Utils.Metric.fnRecalcFromMM(parseFloat(t.asc_getDefaultTab().toFixed(1))):"",!0);var i=this.tabList.store,n=t.asc_getTabs();if(n){for(var o=[],s=n.asc_getCount(),a=0;an.length-1&&(o=n.length-1),n.length>0&&(this.tabList.selectByIndex(o),this.tabList.scrollToRecord(n.at(o)))}},removeAllTabs:function(t,e){this.tabList.store.reset()},onSelectTab:function(t,e,i){var n={};if(_.isFunction(i.toJSON)){if(!i.get("selected"))return;n=i.toJSON()}else n=i;this.numTab.setValue(n.tabPos),this.cmbAlign.setValue(n.tabAlign)},onSpecialSelect:function(t,e){if(this.CurSpecial=e.value,this.CurSpecial===c_paragraphSpecial.NONE_SPECIAL&&this.numSpecialBy.setValue(0,!0),this._changedProps){null!==this._changedProps.asc_getInd()&&void 0!==this._changedProps.asc_getInd()||this._changedProps.put_Ind(new Asc.asc_CParagraphInd);var i=Common.Utils.Metric.fnRecalcToMM(this.numSpecialBy.getNumberValue());0===i&&(this.numSpecialBy.setValue(Common.Utils.Metric.fnRecalcFromMM(this._arrSpecial[e.value].defaultValue),!0),i=this._arrSpecial[e.value].defaultValue),this.CurSpecial===c_paragraphSpecial.HANGING&&(i=-i),this._changedProps.asc_getInd().put_FirstLine(i)}},onFirstLineChange:function(t,e,i,n){if(this._changedProps){null!==this._changedProps.asc_getInd()&&void 0!==this._changedProps.asc_getInd()||this._changedProps.put_Ind(new Asc.asc_CParagraphInd);var o=Common.Utils.Metric.fnRecalcToMM(t.getNumberValue());this.CurSpecial===c_paragraphSpecial.HANGING?o=-o:this.CurSpecial===c_paragraphSpecial.NONE_SPECIAL&&o>0?(this.CurSpecial=c_paragraphSpecial.FIRST_LINE,this.cmbSpecial.setValue(c_paragraphSpecial.FIRST_LINE)):0===o&&(this.CurSpecial=c_paragraphSpecial.NONE_SPECIAL,this.cmbSpecial.setValue(c_paragraphSpecial.NONE_SPECIAL)),this._changedProps.asc_getInd().put_FirstLine(o)}},onLineRuleSelect:function(t,e){if(null===this.Spacing){var i=this._originalProps?this._originalProps:new Asc.asc_CParagraphProperty;this.Spacing=i.asc_getSpacing()}this.Spacing.LineRule=e.value;var n=_.findWhere(this._arrLineRule,{value:e.value}),o=this._arrLineRule.indexOf(n);this.CurLineRuleIdx!==o&&(this.numLineHeight.setDefaultUnit(this._arrLineRule[o].defaultUnit),this.numLineHeight.setMinValue(this._arrLineRule[o].minValue),this.numLineHeight.setStep(this._arrLineRule[o].step),this.Spacing.LineRule===c_paragraphLinerule.LINERULE_AUTO?this.numLineHeight.setValue(this._arrLineRule[o].defaultValue):this.numLineHeight.setValue(Common.Utils.Metric.fnRecalcFromMM(this._arrLineRule[o].defaultValue)),this.CurLineRuleIdx=o)},onNumLineHeightChange:function(t,e,i,n){if(""!==this.cmbLineRule.getRawValue()){if(null===this.Spacing){var o=this._originalProps?this._originalProps:new Asc.asc_CParagraphProperty;this.Spacing=o.asc_getSpacing()}this.Spacing.Line=this.cmbLineRule.getValue()==c_paragraphLinerule.LINERULE_AUTO?t.getNumberValue():Common.Utils.Metric.fnRecalcToMM(t.getNumberValue())}},textTitle:"Paragraph - Advanced Settings",strIndentsLeftText:"Left",strIndentsRightText:"Right",strParagraphIndents:"Indents & Spacing",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",textJustified:"Justified",strIndentsSpecial:"Special",textNoneSpecial:"(none)",textFirstLine:"First line",textHanging:"Hanging",strIndentsSpacingBefore:"Before",strIndentsSpacingAfter:"After",strIndentsLineSpacing:"Line Spacing",txtAutoText:"Auto",textAuto:"Multiple",textExact:"Exactly",strIndent:"Indents",strSpacing:"Spacing"},SSE.Views.ParagraphSettingsAdvanced||{}))}),define("text!spreadsheeteditor/main/app/template/ImageSettingsAdvanced.template",[],function(){ return'
\n
\n
\n \n
\n
\n
\n
\n
\n \n \n \n \n \n \n \n \n
\n \n \n
\n
\n
\n
\n
\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n
\n \n
\n
\n \n \n
\n \n
\n
\n
'}),define("spreadsheeteditor/main/app/view/ImageSettingsAdvanced",["text!spreadsheeteditor/main/app/template/ImageSettingsAdvanced.template","common/main/lib/view/AdvancedSettingsWindow","common/main/lib/component/InputField","common/main/lib/component/MetricSpinner","common/main/lib/component/CheckBox"],function(t){"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(e){_.extend(this.options,{title:this.textTitle,items:[{panelId:"id-adv-image-rotate",panelCaption:this.textRotation},{panelId:"id-adv-image-alttext",panelCaption:this.textAlt}],contentTemplate:_.template(t)({scope:this})},e),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 t=this;this.spnAngle=new Common.UI.MetricSpinner({el:$("#image-advanced-spin-angle"),step:1,width:80,defaultUnit:"°",value:"0 °",maxValue:3600,minValue:-3600}),this.chFlipHor=new Common.UI.CheckBox({el:$("#image-advanced-checkbox-hor"),labelText:this.textHorizontally}),this.chFlipVert=new Common.UI.CheckBox({el:$("#image-advanced-checkbox-vert"),labelText:this.textVertically}),this.inputAltTitle=new Common.UI.InputField({el:$("#image-advanced-alt-title"),allowBlank:!0,validateOnBlur:!1,style:"width: 100%;"}).on("changed:after",function(){t.isAltTitleChanged=!0}),this.textareaAltDescription=this.$window.find("textarea"),this.textareaAltDescription.keydown(function(e){e.keyCode==Common.UI.Keys.RETURN&&e.stopPropagation(),t.isAltDescChanged=!0}),this.afterRender()},afterRender:function(){if(this._setDefaults(this._originalProps),this.storageName){var t=Common.localStorage.getItem(this.storageName);this.setActiveCategory(null!==t?parseInt(t):0)}},_setDefaults:function(t){if(t){var e=t.asc_getTitle();this.inputAltTitle.setValue(e||""),e=t.asc_getDescription(),this.textareaAltDescription.val(e||""),e=t.asc_getRot(),this.spnAngle.setValue(void 0==e||null===e?"":Math.floor(180*e/3.14159265358979+.5),!0),this.chFlipHor.setValue(t.asc_getFlipH()),this.chFlipVert.setValue(t.asc_getFlipV());var i=t.asc_getPluginGuid();this.btnsCategory[0].setVisible(null===i||void 0===i),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()),this._changedProps.asc_putRot(3.14159265358979*this.spnAngle.getNumberValue()/180),this._changedProps.asc_putFlipH("checked"==this.chFlipHor.getValue()),this._changedProps.asc_putFlipV("checked"==this.chFlipVert.getValue()),{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.",textRotation:"Rotation",textAngle:"Angle",textFlipped:"Flipped",textHorizontally:"Horizontally",textVertically:"Vertically"},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(t){_.extend(this.options,{title:this.textTitle},t||{}),this.template=['
','
','
',"
",'"].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(){if(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:null!==this.startvalue?this.startvalue+" "+this.defaultUnit:""}),null!==this.startvalue){var t=this;setTimeout(function(){var e=t.spnSize.$input[0];document.selection?t.spnSize.$input.select():(e.selectionStart=0,e.selectionEnd=t.startvalue.toString().length)},10)}this.getChild().find(".dlg-btn").on("click",_.bind(this.onBtnClick,this)),this.spnSize.on("entervalue",_.bind(this.onPrimary,this)),this.options.rounding&&this.spnSize.on("change",_.bind(this.onChange,this)),this.spnSize.$el.find("input").focus()},_handleInput:function(t){this.options.handler&&this.options.handler.call(this,this,t),this.close()},onBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value)},onChange:function(){var t=this.spnSize.getNumberValue();t/=this.step,t=(t|t)*this.step,this.spnSize.setValue(t,!0)},getSettings:function(){return this.spnSize.getNumberValue()},onPrimary:function(){return this._handleInput("ok"),!1},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||{}))}),void 0===Common)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(['
',"<% var me = this; %>","<% $(colors).each(function(num, item) { %>","<% if (me.isColor(item)) { %>",'
',' ',"
","<% } else if (me.isTransparent(item)) { %>",'
',' ',"
","<% } else if (me.isEffect(item)) { %>",'
',' ',"
","<% } %>","<% }); %>","
"].join("")),colorRe:/(?:^|\s)color-(.{6})(?:\s|$)/,selectedCls:"selected",initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t),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(t){var e=this;return e.rendered?this.cmpEl=$(this.el):(this.cmpEl=$(this.template({id:this.id,cls:this.cls,style:this.style,colors:this.colors})),t?(this.setElement(t,!1),t.html(this.cmpEl)):$(this.el).html(this.cmpEl),this.cmpEl.on("click",_.bind(this.handleClick,this))),e.rendered=!0,this},isColor:function(t){return"string"==typeof t&&/[0-9A-F]{6}/.test(t)},isTransparent:function(t){return"string"==typeof t&&"transparent"==t},isEffect:function(t){return"object"==typeof t&&void 0!==t.effectId},getColor:function(){return this.value},handleClick:function(t){var e,i=this,n=$(t.target).closest("div.palette-color-item");if(0!=n.length)if(n.hasClass("color-transparent"))$(i.el).find("div."+i.selectedCls).removeClass(i.selectedCls),n.addClass(i.selectedCls),i.value="transparent",i.trigger("select",i,"transparent");else if((!/^[a-fA-F0-9]{6}$/.test(i.value)||_.indexOf(i.colors,i.value)<0)&&(i.value=!1),$(i.el).find("div."+i.selectedCls).removeClass(i.selectedCls),n.addClass(i.selectedCls),e=n[0].className.match(i.colorRe)[1],n.hasClass("palette-color-effect")){var o=parseInt(n.attr("effectid"));e&&(i.value=e.toUpperCase(),i.trigger("select",i,{color:e,effectId:o}))}else/#?[a-fA-F0-9]{6}/.test(e)&&(e=/#?([a-fA-F0-9]{6})/.exec(e)[1].toUpperCase(),i.value=e,i.trigger("select",i,e))},select:function(t,e){var i=$(this.el);if(i.find("div."+this.selectedCls).removeClass(this.selectedCls),t)if("object"==typeof t){var n;void 0!==t.effectId?(n=i.find('div[effectid="'+t.effectId+'"]').first(),n.length>0?(n.addClass(this.selectedCls),this.value=n[0].className.match(this.colorRe)[1].toUpperCase()):this.value=!1):void 0!==t.effectValue&&(n=i.find('div[effectvalue="'+t.effectValue+'"].color-'+t.color.toUpperCase()).first(),n.length>0?(n.addClass(this.selectedCls),this.value=n[0].className.match(this.colorRe)[1].toUpperCase()):this.value=!1)}else if(/#?[a-fA-F0-9]{6}/.test(t)&&(t=/#?([a-fA-F0-9]{6})/.exec(t)[1].toUpperCase(),this.value=t),/^[a-fA-F0-9]{6}|transparent$/.test(t)&&_.indexOf(this.colors,t)>=0)_.indexOf(this.colors,this.value)<0&&(this.value=!1),(t!=this.value||this.options.allowReselect)&&("transparent"==t?i.find("div.color-transparent").addClass(this.selectedCls):i.find("div.palette-color.color-"+t).first().addClass(this.selectedCls),this.value=t,!0!==e&&this.fireEvent("select",this,t));else{var o=i.find("#"+t).first();0==o.length&&(o=i.find('div[color="'+t+'"]').first()),o.length>0&&(o.addClass(this.selectedCls),this.value=t.toUpperCase())}},updateColors:function(t){void 0!==t&&(this.colors=t,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(t){$(this.el).find("div."+this.selectedCls).removeClass(this.selectedCls),this.value=void 0}})}),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(t){var e=this,i={};_.extend(i,{width:501,height:230,contentWidth:180,header:!0,cls:"filter-dlg",contentTemplate:"",title:e.txtTitle,items:[]},t),this.template=t.template||['
','
','",'
','
','
',"
","
",'
','
',"
",'
','
','
',"
","
","
",'
','"].join(""),this.api=t.api,this.handler=t.handler,this.type=t.type||"number",i.tpl=_.template(this.template)(i),Common.UI.Window.prototype.initialize.call(this,i)},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}],"text"==this.type&&(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 t=function(t,e){var i=t.get("intval"),n=e.get("intval"),o=void 0!==i;return o!==(void 0!==n)?o?-1:1:(!o&&(i=t.get("value").toLowerCase())&&(n=e.get("value").toLowerCase()),i==n?0:""==n||""!==i&&i1?n[1].asc_getOperator()||0:0),this.cmbValue1.setValue(null===n[0].asc_getVal()?"":n[0].asc_getVal()),this.cmbValue2.setValue(n.length>1?null===n[1].asc_getVal()?"":n[1].asc_getVal():"")}}},save:function(){if(this.api&&this.properties&&this.rbOr&&this.rbAnd&&this.cmbCondition1&&this.cmbCondition2&&this.cmbValue1&&this.cmbValue2){var t=this.properties.asc_getFilterObj();t.asc_setFilter(new Asc.CustomFilters),t.asc_setType(Asc.c_oAscAutoFilterTypes.CustomFilters);var e=t.asc_getFilter();e.asc_setCustomFilters(0==this.cmbCondition2.getValue()?[new Asc.CustomFilter]:[new Asc.CustomFilter,new Asc.CustomFilter]);var i=e.asc_getCustomFilters();e.asc_setAnd(this.rbAnd.getValue()),i[0].asc_setOperator(this.cmbCondition1.getValue()),i[0].asc_setVal(this.cmbValue1.getValue()),0!==this.cmbCondition2.getValue()&&(i[1].asc_setOperator(this.cmbCondition2.getValue()||void 0),i[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(t){var e=this,i={};_.extend(i,{width:318,height:160,contentWidth:180,header:!0,cls:"filter-dlg",contentTemplate:"",title:e.txtTitle,items:[]},t),this.template=t.template||['
','
','
','",'
',"
",'
','','
',"
",'
','','
',"
","
","
",'
','"].join(""),this.api=t.api,this.handler=t.handler,i.tpl=_.template(this.template)(i),Common.UI.Window.prototype.initialize.call(this,i)},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(t,e){this.spnCount.setDefaultUnit(e.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 t=this;_.defer(function(){t.spnCount&&t.spnCount.$input.focus()},500)},close:function(){this.api&&this.api.asc_enableKeyEvents(!0),Common.UI.Window.prototype.close.call(this)},onBtnClick:function(t){t.currentTarget.attributes&&t.currentTarget.attributes.result&&("ok"===t.currentTarget.attributes.result.value&&this.save(),this.close())},setSettings:function(t){this.properties=t},loadDefaults:function(){if(this.properties){var t=this.properties.asc_getFilterObj();if(t.asc_getType()==Asc.c_oAscAutoFilterTypes.Top10){var e=t.asc_getFilter(),i=e.asc_getTop(),n=e.asc_getPercent();this.cmbType.setValue(i||null===i),this.cmbItem.setValue(n||null===n),this.spnCount.setDefaultUnit(n||null===n?"%":""),this.spnCount.setValue(e.asc_getVal())}}},save:function(){if(this.api&&this.properties){var t=this.properties.asc_getFilterObj();t.asc_setFilter(new Asc.Top10),t.asc_setType(Asc.c_oAscAutoFilterTypes.Top10);var e=t.asc_getFilter();e.asc_setTop(this.cmbType.getValue()),e.asc_setPercent(this.cmbItem.getValue()),e.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(t){var e=this,i={},n=void 0,o=void 0;Common.Utils.InternalSettings.get("sse-settings-size-filter-window")&&(n=Common.Utils.InternalSettings.get("sse-settings-size-filter-window")[0],o=Common.Utils.InternalSettings.get("sse-settings-size-filter-window")[1]),_.extend(i,{width:n||450,height:o||265,contentWidth:n-50||400,header:!1,cls:"filter-dlg",contentTemplate:"",title:e.txtTitle,modal:!1,animate:!1,items:[],resizable:!0,minwidth:450,minheight:265},t),this.template=t.template||['
','
','
','','
','
',"
","
",'","
",'","
"].join(""),this.api=t.api,this.handler=t.handler,this.throughIndexes=[],this.filteredIndexes=[],this.curSize=null,i.tpl=_.template(this.template)(i),Common.UI.Window.prototype.initialize.call(this,i),this.on("resizing",_.bind(this.onWindowResizing,this)),this.on("resize",_.bind(this.onWindowResize,this))},render:function(){var t=this;Common.UI.Window.prototype.render.call(this);var e=this.$window.find(".resize-border");this.$window.find(".resize-border.left, .resize-border.top").css({cursor:"default"}),e.css({background:"none",border:"none"}),e.removeClass("left"),e.removeClass("top"),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('
')}]})}),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('
')}]})}),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}]})});for(var i=this.miNumFilter.menu.items,n=0;n
')}]})}),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('
')}]})}),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 o=this.$window.find("#menu-container-filters");this.filtersMenu.render(o),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(e,i){i.length?(i=i.replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1"),t.filter=new RegExp(i,"ig")):t.filter=void 0,t.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(['
'].join("")),itemTemplate:_.template(["
",'",'
','
<%= Common.Utils.String.htmlEncode(value) %>
','<% if (typeof count !=="undefined" && count) { %>','
<%= count%>
',"<% } %>","
","
"].join(""))}),this.cellsList.store.comparator=function(t,e){if("0"==t.get("groupid"))return-1;if("0"==e.get("groupid"))return 1;if("2"==t.get("groupid"))return-1;if("2"==e.get("groupid"))return 1;var i=t.get("intval"),n=e.get("intval"),o=void 0!==i;return o!==(void 0!==n)?o?-1:1:(!o&&(i=t.get("cellvalue").toLowerCase())&&(n=e.get("cellvalue").toLowerCase()),i==n?0:""==n||""!==i&&i1?r[1].asc_getOperator()||0:0,i=null===r[0].asc_getVal()?"":r[0].asc_getVal(),n=r.length>1?null===r[1].asc_getVal()?"":r[1].asc_getVal():""}if(-1!==t.value){var c=new Asc.CustomFilters;c.asc_setCustomFilters(-2==t.value?[new Asc.CustomFilter,new Asc.CustomFilter]:[new Asc.CustomFilter]);var h=c.asc_getCustomFilters();if(h[0].asc_setOperator(-2==t.value?Asc.c_oAscCustomAutoFilter.isGreaterThanOrEqualTo:t.value),-2==t.value){var d=o==Asc.c_oAscCustomAutoFilter.isGreaterThanOrEqualTo&&s==Asc.c_oAscCustomAutoFilter.isLessThanOrEqualTo;c.asc_setAnd(!d||a),h[0].asc_setVal(d?i:""),h[1].asc_setOperator(Asc.c_oAscCustomAutoFilter.isLessThanOrEqualTo),h[1].asc_setVal(d?n:"")}else c.asc_setAnd(!0),h[0].asc_setVal(t.value==o?i:"");e.asc_setFilter(c),e.asc_setType(Asc.c_oAscAutoFilterTypes.CustomFilters)}var p=this,m=new SSE.Views.DigitalFilterDialog({api:this.api,type:"number"}).on({close:function(){p.close()}});this.close(),m.setSettings(this.configTo),m.show()},onTextFilterMenuClick:function(t,e){var i=this.configTo.asc_getFilterObj(),n="",o=Asc.c_oAscCustomAutoFilter.equals;if(i.asc_getType()==Asc.c_oAscAutoFilterTypes.CustomFilters){var s=i.asc_getFilter(),a=s.asc_getCustomFilters();s.asc_getAnd(),o=a[0].asc_getOperator(),a.length>1?a[1].asc_getOperator()||0:0,n=null===a[0].asc_getVal()?"":a[0].asc_getVal(),a.length>1?null===a[1].asc_getVal()?"":a[1].asc_getVal():""}if(-1!==e.value){var l=new Asc.CustomFilters;l.asc_setCustomFilters([new Asc.CustomFilter]);var r=l.asc_getCustomFilters();l.asc_setAnd(!0),r[0].asc_setOperator(e.value),r[0].asc_setVal(e.value==o?n:""),i.asc_setFilter(l),i.asc_setType(Asc.c_oAscAutoFilterTypes.CustomFilters)}var c=this,h=new SSE.Views.DigitalFilterDialog({api:this.api,type:"text"}).on({close:function(){c.close()}});this.close(),h.setSettings(this.configTo),h.show()},onNumDynamicFilterItemClick:function(t){var e=this.configTo.asc_getFilterObj();e.asc_getType()!==Asc.c_oAscAutoFilterTypes.DynamicFilter&&(e.asc_setFilter(new Asc.DynamicFilter),e.asc_setType(Asc.c_oAscAutoFilterTypes.DynamicFilter)),e.asc_getFilter().asc_setType(t.value),this.api.asc_applyAutoFilter(this.configTo),this.close()},onTop10FilterItemClick:function(t,e){var i=this,n=new SSE.Views.Top10FilterDialog({api:this.api}).on({close:function(){i.close()}});this.close(),n.setSettings(this.configTo),n.show()},onFilterColorSelect:function(t,e,i){var n=this.configTo.asc_getFilterObj();n.asc_getType()!==Asc.c_oAscAutoFilterTypes.ColorFilter&&(n.asc_setFilter(new Asc.ColorFilter),n.asc_setType(Asc.c_oAscAutoFilterTypes.ColorFilter));var o=n.asc_getFilter();o.asc_setCellColor(!!t&&null),o.asc_setCColor(t&&"transparent"==i||!t&&"#000000"==i?null:Common.Utils.ThemeColor.getRgbColor(i)),this.api.asc_applyAutoFilter(this.configTo),this.close()},onSortColorSelect:function(t,e,i){if(this.api&&this.configTo){var n=t==Asc.c_oAscSortOptions.ByColorFill;this.api.asc_sortColFilter(t,this.configTo.asc_getCellId(),this.configTo.asc_getDisplayName(),n&&"transparent"==i||!n&&"#000000"==i?null:Common.Utils.ThemeColor.getRgbColor(i))}this.close()},onCellCheck:function(t,e,i){if(!this.checkCellTrigerBlock){var n="",o="",s=!1,a=null,l=window.event?window.event:window._event;if(l){if(o=l.target.type,n=$(l.currentTarget).find(".list-item"),n.length){a=n.get(0).getBoundingClientRect();var r=l.clientX*Common.Utils.zoom(),c=l.clientY*Common.Utils.zoom();a.left1&&(o[parseInt(t.get("throughIndex"))]=i))});else{e.set("check",i),o[parseInt(e.get("throughIndex"))]=i;for(var s=i,a=0;a0;if(this.miSortFontColor.setVisible(c),this.miFilterFontColor.setVisible(c),c){var h=[];a.forEach(function(t,e){t?h.push(Common.Utils.ThemeColor.getHexColor(t.get_r(),t.get_g(),t.get_b()).toLocaleUpperCase()):h.push("000000")}),this.mnuSortColorFontPicker.updateColors(h),this.mnuFilterColorFontPicker.updateColors(h),this.miFilterFontColor.setChecked(!1,!0),this.miSortFontColor.setChecked(l==Asc.c_oAscSortOptions.ByColorFont,!0),l==Asc.c_oAscSortOptions.ByColorFont&&this.mnuSortColorFontPicker.select(r||"000000",!0)}if(c=s&&s.length>0,this.miSortCellColor.setVisible(c),this.miFilterCellColor.setVisible(c),c){var h=[];s.forEach(function(t,e){t?h.push(Common.Utils.ThemeColor.getHexColor(t.get_r(),t.get_g(),t.get_b()).toLocaleUpperCase()):h.push("transparent")}),this.mnuSortColorCellsPicker.updateColors(h),this.mnuFilterColorCellsPicker.updateColors(h),this.miFilterCellColor.setChecked(!1,!0),this.miSortCellColor.setChecked(l==Asc.c_oAscSortOptions.ByColorFill,!0),l==Asc.c_oAscSortOptions.ByColorFill&&this.mnuSortColorCellsPicker.select(r||"transparent",!0)}if(e){var d=t.asc_getFilter(),p=d.asc_getCustomFilters(),m=(d.asc_getAnd(),p[0].asc_getOperator()),u=p.length>1?p[1].asc_getOperator()||0:0,g=o?this.miTextFilter.menu.items:this.miNumFilter.menu.items,b=!0;1==p.length?g.forEach(function(t){var e=t.options.type==Asc.c_oAscAutoFilterTypes.CustomFilters&&t.value==m;t.setChecked(e,!0),e&&(b=!1)}):!o&&(m==Asc.c_oAscCustomAutoFilter.isGreaterThanOrEqualTo&&u==Asc.c_oAscCustomAutoFilter.isLessThanOrEqualTo||m==Asc.c_oAscCustomAutoFilter.isLessThanOrEqualTo&&u==Asc.c_oAscCustomAutoFilter.isGreaterThanOrEqualTo)&&(g[6].setChecked(!0,!0),b=!1),b&&g[g.length-1].setChecked(!0,!0)}else if(this.initialFilterType===Asc.c_oAscAutoFilterTypes.ColorFilter){var f=t.asc_getFilter(),C=f.asc_getCColor();C&&(C=Common.Utils.ThemeColor.getHexColor(C.get_r(),C.get_g(),C.get_b()).toLocaleUpperCase()),null===f.asc_getCellColor()?(this.miFilterCellColor.setChecked(!0,!0),this.mnuFilterColorCellsPicker.select(C||"transparent",!0)):!1===f.asc_getCellColor()&&(this.miFilterFontColor.setChecked(!0,!0),this.mnuFilterColorFontPicker.select(C||"000000",!0))}else if(i||n){var v=i?t.asc_getFilter().asc_getType():null,g=this.miNumFilter.menu.items;g.forEach(function(t){t.setChecked(i&&t.options.type==Asc.c_oAscAutoFilterTypes.DynamicFilter&&t.value==v||n&&t.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 t(t){return!isNaN(parseFloat(t))&&isFinite(t)}var e,i,n,o=this,s=0,a=2,l=!0,r=!1,c=0,h=[],d=[],p=o.filter?o.filteredIndexes:o.throughIndexes;this.configTo.asc_getValues().forEach(function(r){i=r.asc_getText(),e=t(i),l=!0,n=r.asc_getRepeats?r.asc_getRepeats():void 0,o.filter?(null===i.match(o.filter)&&(l=!1),p[a]=l):void 0==p[a]&&(p[a]=r.asc_getVisible()),l?(h.push(new Common.UI.DataViewModel({id:++s,selected:!1,allowSelected:!0,cellvalue:i,value:e?i:i.length>0?i:o.textEmptyItem,intval:e?parseFloat(i):void 0,strval:e?"":i,groupid:"1",check:p[a],throughIndex:a,count:n?n.toString():""})),p[a]&&c++):d.push(new Common.UI.DataViewModel({cellvalue:i})),++a}),c==h.length?r=!0:c>0&&(r="indeterminate"),(o.filter||void 0==p[0])&&(p[0]=!0),(!o.filter||h.length>0)&&h.unshift(new Common.UI.DataViewModel({id:++s,selected:!1,allowSelected:!0,value:o.filter?this.textSelectAllResults:this.textSelectAll,groupid:"0",check:p[0],throughIndex:0})),o.filter&&h.length>1&&(void 0==p[1]&&(p[1]=!1),h.splice(1,0,new Common.UI.DataViewModel({id:++s,selected:!1,allowSelected:!0,value:this.textAddSelection,groupid:"2",check:p[1],throughIndex:1}))),this.cells.reset(h),this.filterExcludeCells.reset(d),this.cells.length&&(this.checkCellTrigerBlock=!0,this.cells.at(0).set("check",r),this.checkCellTrigerBlock=void 0),this.btnOk.setDisabled(this.cells.length<1),this.cellsList.scroller.update({minScrollbarLength:40,alwaysVisibleY:!0,suppressScrollX:!0}),this.cellsList.cmpEl.toggleClass("scroll-padding",this.cellsList.scroller.isVisible())},testFilter:function(){var t=this,e=!1;return this.cells&&(this.filter&&this.filteredIndexes[1]?e=!0:this.cells.forEach(function(t){if("1"==t.get("groupid")&&t.get("check"))return e=!0,!0})),e||(t._skipCheckDocumentClick=!0,Common.UI.warning({title:this.textWarning,msg:this.warnNoSelected,callback:function(){t._skipCheckDocumentClick=!1,_.delay(function(){t.input.$el.find("input").focus()},100,this)}})),e},save:function(){if(this.api&&this.configTo&&this.cells&&this.filterExcludeCells){var t=this.configTo.asc_getValues(),e=!1;if(this.filter&&this.filteredIndexes[1])this.initialFilterType===Asc.c_oAscAutoFilterTypes.CustomFilters&&t.forEach(function(t,e){t.asc_setVisible(!0)}),this.cells.each(function(e){"1"==e.get("groupid")&&t[parseInt(e.get("throughIndex"))-2].asc_setVisible(e.get("check"))}),t.forEach(function(t,i){if(t.asc_getVisible())return e=!0,!0});else{var i=this.filter?this.filteredIndexes:this.throughIndexes;t.forEach(function(t,e){t.asc_setVisible(i[e+2])}),e=!0}e&&(this.configTo.asc_getFilterObj().asc_setType(Asc.c_oAscAutoFilterTypes.Filters),this.api.asc_applyAutoFilter(this.configTo))}},onPrimary:function(){return this.save(),this.close(),!1},onWindowResize:function(t){if(t&&"start"==t[1])this.curSize={resize:!1,height:this.getSize()[1]};else if(this.curSize.resize){var e=this.getSize();this.$window.find(".combo-values").css({height:e[1]-100+"px"}),this.cellsList.scroller.update({minScrollbarLength:40,alwaysVisibleY:!0,suppressScrollX:!0})}},onWindowResizing:function(){if(this.curSize){var t=this.getSize();t[1]!==this.curSize.height&&(this.curSize.resize||(this.curSize.resize=!0,this.cellsList.scroller.update({minScrollbarLength:40,alwaysVisibleY:!1,suppressScrollX:!0})),this.$window.find(".combo-values").css({height:t[1]-100+"px"}),this.curSize.height=t[1]),Common.Utils.InternalSettings.set("sse-settings-size-filter-window",t)}},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||{}))});var c_paragraphLinerule={LINERULE_AUTO:1,LINERULE_EXACT:2},c_paragraphTextAlignment={RIGHT:0,LEFT:1,CENTERED:2,JUSTIFIED:3},c_paragraphSpecial={NONE_SPECIAL:0,FIRST_LINE:1,HANGING:2};if(define("spreadsheeteditor/main/app/controller/DocumentHolder",["core","common/main/lib/util/utils","common/main/lib/util/Shortcuts","common/main/lib/view/CopyWarningDialog","common/main/lib/view/OpenDialog","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 t=this;t.tooltips={hyperlink:{},comment:{},coauth:{ttHeight:20},row_column:{ttHeight:20},filter:{ttHeight:40},func_arg:{},input_msg:{}},t.mouse={},t.popupmenu=!1,t.rangeSelectionMode=!1,t.namedrange_locked=!1,t._currentMathObj=void 0,t._currentParaObjDisabled=!1,t._isDisabled=!1,t._state={},this.wrapEvents={apiHideComment:_.bind(this.onApiHideComment,this)},this.addListeners({DocumentHolder:{createdelayedelements:this.onCreateDelayedElements}});var e={};this.hkComments="alt+h",e[this.hkComments]=function(){return t.onAddComment(),!1},Common.util.Shortcuts.delegateShortcuts({shortcuts:e})},onLaunch:function(){var t=this;t.documentHolder=this.createView("DocumentHolder"),t.documentHolder.render(),t.documentHolder.el.tabIndex=-1,$(document).on("mousewheel",_.bind(t.onDocumentWheel,t)),$(document).on("mousedown",_.bind(t.onDocumentRightDown,t)),$(document).on("mouseup",_.bind(t.onDocumentRightUp,t)),$(document).on("keydown",_.bind(t.onDocumentKeyDown,t)),$(document).on("mousemove",_.bind(t.onDocumentMouseMove,t)),$(window).on("resize",_.bind(t.onDocumentResize,t)),SSE.getController("Viewport").getView("Viewport").hlayout.on("layout:resizedrag",_.bind(t.onDocumentResize,t)),Common.NotificationCenter.on({"window:show":function(e){t.hideHyperlinkTip()},"modal:show":function(e){t.hideCoAuthTips()},"layout:changed":function(e){t.hideHyperlinkTip(),t.hideCoAuthTips(),t.onDocumentResize()},"cells:range":function(e){t.onCellsRange(e)}}),Common.Gateway.on("processmouse",_.bind(t.onProcessMouse,t))},onCreateDelayedElements:function(t){var e=this;e.permissions.isEdit?(t.pmiCut.on("click",_.bind(e.onCopyPaste,e)),t.pmiCopy.on("click",_.bind(e.onCopyPaste,e)),t.pmiPaste.on("click",_.bind(e.onCopyPaste,e)),t.pmiImgCut.on("click",_.bind(e.onCopyPaste,e)),t.pmiImgCopy.on("click",_.bind(e.onCopyPaste,e)),t.pmiImgPaste.on("click",_.bind(e.onCopyPaste,e)),t.pmiTextCut.on("click",_.bind(e.onCopyPaste,e)),t.pmiTextCopy.on("click",_.bind(e.onCopyPaste,e)),t.pmiTextPaste.on("click",_.bind(e.onCopyPaste,e)),t.pmiCommonCut.on("click",_.bind(e.onCopyPaste,e)),t.pmiCommonCopy.on("click",_.bind(e.onCopyPaste,e)),t.pmiCommonPaste.on("click",_.bind(e.onCopyPaste,e)),t.pmiInsertEntire.on("click",_.bind(e.onInsertEntire,e)),t.pmiDeleteEntire.on("click",_.bind(e.onDeleteEntire,e)),t.pmiInsertCells.menu.on("item:click",_.bind(e.onInsertCells,e)),t.pmiDeleteCells.menu.on("item:click",_.bind(e.onDeleteCells,e)),t.pmiSparklines.menu.on("item:click",_.bind(e.onClear,e)),t.pmiSortCells.menu.on("item:click",_.bind(e.onSortCells,e)),t.pmiFilterCells.menu.on("item:click",_.bind(e.onFilterCells,e)),t.pmiReapply.on("click",_.bind(e.onReapply,e)),t.pmiClear.menu.on("item:click",_.bind(e.onClear,e)),t.pmiSelectTable.menu.on("item:click",_.bind(e.onSelectTable,e)),t.pmiInsertTable.menu.on("item:click",_.bind(e.onInsertTable,e)),t.pmiDeleteTable.menu.on("item:click",_.bind(e.onDeleteTable,e)),t.pmiInsFunction.on("click",_.bind(e.onInsFunction,e)),t.menuAddHyperlink.on("click",_.bind(e.onInsHyperlink,e)),t.menuEditHyperlink.on("click",_.bind(e.onInsHyperlink,e)),t.menuRemoveHyperlink.on("click",_.bind(e.onDelHyperlink,e)),t.pmiRowHeight.menu.on("item:click",_.bind(e.onSetSize,e)),t.pmiColumnWidth.menu.on("item:click",_.bind(e.onSetSize,e)),t.pmiEntireHide.on("click",_.bind(e.onEntireHide,e)),t.pmiEntireShow.on("click",_.bind(e.onEntireShow,e)),t.pmiFreezePanes.on("click",_.bind(e.onFreezePanes,e)),t.pmiEntriesList.on("click",_.bind(e.onEntriesList,e)),t.pmiAddComment.on("click",_.bind(e.onAddComment,e)),t.pmiAddNamedRange.on("click",_.bind(e.onAddNamedRange,e)),t.menuImageArrange.menu.on("item:click",_.bind(e.onImgMenu,e)),t.menuImgRotate.menu.on("item:click",_.bind(e.onImgMenu,e)),t.menuImgCrop.menu.on("item:click",_.bind(e.onImgCrop,e)),t.menuImageAlign.menu.on("item:click",_.bind(e.onImgMenuAlign,e)),t.menuParagraphVAlign.menu.on("item:click",_.bind(e.onParagraphVAlign,e)),t.menuParagraphDirection.menu.on("item:click",_.bind(e.onParagraphDirection,e)),t.menuParagraphBullets.menu.on("item:click",_.bind(e.onSelectNoneBullet,e)),t.menuAddHyperlinkShape.on("click",_.bind(e.onInsHyperlink,e)),t.menuEditHyperlinkShape.on("click",_.bind(e.onInsHyperlink,e)),t.menuRemoveHyperlinkShape.on("click",_.bind(e.onRemoveHyperlinkShape,e)),t.pmiTextAdvanced.on("click",_.bind(e.onTextAdvanced,e)),t.mnuShapeAdvanced.on("click",_.bind(e.onShapeAdvanced,e)),t.mnuChartEdit.on("click",_.bind(e.onChartEdit,e)),t.mnuImgAdvanced.on("click",_.bind(e.onImgAdvanced,e)),t.textInShapeMenu.on("render:after",_.bind(e.onTextInShapeAfterRender,e)),t.menuSignatureEditSign.on("click",_.bind(e.onSignatureClick,e)),t.menuSignatureEditSetup.on("click",_.bind(e.onSignatureClick,e)),t.menuImgOriginalSize.on("click",_.bind(e.onOriginalSizeClick,e)),t.menuImgReplace.menu.on("item:click",_.bind(e.onImgReplace,e)),t.pmiNumFormat.menu.on("item:click",_.bind(e.onNumberFormatSelect,e)),t.pmiNumFormat.menu.on("show:after",_.bind(e.onNumberFormatOpenAfter,e)),t.pmiAdvancedNumFormat.on("click",_.bind(e.onCustomNumberFormat,e))):(t.menuViewCopy.on("click",_.bind(e.onCopyPaste,e)),t.menuViewUndo.on("click",_.bind(e.onUndo,e)),t.menuViewAddComment.on("click",_.bind(e.onAddComment,e)),t.menuSignatureViewSign.on("click",_.bind(e.onSignatureClick,e)),t.menuSignatureDetails.on("click",_.bind(e.onSignatureClick,e)),t.menuSignatureViewSetup.on("click",_.bind(e.onSignatureClick,e)),t.menuSignatureRemove.on("click",_.bind(e.onSignatureClick,e)));var i=t.cmpEl;if(i){i.on({mousedown:function(t){"canvas"==t.target.localName&&2!=t.button&&Common.UI.Menu.Manager.hideAll()},click:function(t){e.api&&(e.api.isTextAreaBlur=!1,"canvas"!=t.target.localName||e.isEditFormula||i.focus())}});var n=/Firefox/i.test(navigator.userAgent)?"DOMMouseScroll":"mousewheel";!function(t,e,i){t.addEventListener?t.addEventListener(e,i,!1):t.attachEvent("on"+e,i)}(t.el,n,_.bind(this.onDocumentWheel,this)),e.cellEditor=$("#ce-cell-content")}},loadConfig:function(t){this.editorConfig=t.config},setMode:function(t){this.permissions=t,this.permissions.canCoAuthoring&&this.permissions.canComments?Common.util.Shortcuts.resumeEvents(this.hkComments):Common.util.Shortcuts.suspendEvents(this.hkComments)},setApi:function(t){return this.api=t,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_onCoAuthoringDisconnect",_.bind(this.onApiCoAuthoringDisconnect,this)),Common.NotificationCenter.on("api:disconnect",_.bind(this.onApiCoAuthoringDisconnect,this)),this.api.asc_registerCallback("asc_onSelectionChanged",_.bind(this.onSelectionChanged,this)),!0===this.permissions.isEdit&&(this.api.asc_registerCallback("asc_onSetAFDialog",_.bind(this.onApiAutofilter,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_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.api.asc_registerCallback("asc_onToggleAutoCorrectOptions",_.bind(this.onToggleAutoCorrectOptions,this)),this.api.asc_registerCallback("asc_onFormulaInfo",_.bind(this.onFormulaInfo,this)),this.api.asc_registerCallback("asc_ChangeCropState",_.bind(this.onChangeCropState,this)),this.api.asc_registerCallback("asc_onInputMessage",_.bind(this.onInputMessage,this))),this},resetApi:function(t){this.api.asc_unregisterCallback("asc_onHideComment",this.wrapEvents.apiHideComment),this.api.asc_registerCallback("asc_onHideComment",this.wrapEvents.apiHideComment)},onCopyPaste:function(t){var e=this;if(e.api){if("cut"==t.value?e.api.asc_Cut():"copy"==t.value?e.api.asc_Copy():e.api.asc_Paste())Common.component.Analytics.trackEvent("ToolBar","Copy Warning");else{var i=Common.localStorage.getItem("sse-hide-copywarning");i&&1==parseInt(i)||new Common.Views.CopyWarningDialog({handler:function(t){t&&Common.localStorage.setItem("sse-hide-copywarning",1),Common.NotificationCenter.trigger("edit:complete",e.documentHolder)}}).show()}}Common.NotificationCenter.trigger("edit:complete",e.documentHolder)},onInsertEntire:function(t){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(t,e){this.api&&(this.api.asc_insertCells(e.value),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Insert Cells"))},onDeleteEntire:function(t){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(t,e){this.api&&(this.api.asc_deleteCells(e.value),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Delete Cells"))},onSortCells:function(t,e){if(this.api){var i=this.api.asc_sortCellsRangeExpand();if(i){var n={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){"expand"!=t&&"sort"!=t||this.api.asc_sortColFilter(e.value,"",void 0,e.value==Asc.c_oAscSortOptions.ByColorFill?this.documentHolder.ssMenu.cellColor:this.documentHolder.ssMenu.fontColor,"expand"==t),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Sort Cells")},this)};Common.UI.alert(n)}else this.api.asc_sortColFilter(e.value,"",void 0,e.value==Asc.c_oAscSortOptions.ByColorFill?this.documentHolder.ssMenu.cellColor:this.documentHolder.ssMenu.fontColor,null!==i),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Sort Cells")}},onFilterCells:function(t,e){if(this.api){var i=new Asc.AutoFiltersOptions,n=new Asc.AutoFilterObj;if(e.value>0){n.asc_setFilter(new Asc.ColorFilter),n.asc_setType(Asc.c_oAscAutoFilterTypes.ColorFilter);var o=n.asc_getFilter();o.asc_setCellColor(1==e.value&&null),o.asc_setCColor(1==e.value?this.documentHolder.ssMenu.cellColor:this.documentHolder.ssMenu.fontColor)}else{n.asc_setFilter(new Asc.CustomFilters),n.asc_setType(Asc.c_oAscAutoFilterTypes.CustomFilters);var s=n.asc_getFilter();s.asc_setCustomFilters([new Asc.CustomFilter]),s.asc_setAnd(!0);s.asc_getCustomFilters()[0].asc_setOperator(Asc.c_oAscCustomAutoFilter.equals)}i.asc_setFilterObj(n),this.api.asc_applyAutoFilterByType(i),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(t,e){this.api&&(this.api.asc_emptyCells(e.value),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Clear"))},onSelectTable:function(t,e){this.api&&this.documentHolder.ssMenu.formatTableName&&(this.api.asc_changeSelectionFormatTable(this.documentHolder.ssMenu.formatTableName,e.value),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Select Table"))},onInsertTable:function(t,e){this.api&&this.documentHolder.ssMenu.formatTableName&&(this.api.asc_insertCellsInTable(this.documentHolder.ssMenu.formatTableName,e.value),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Insert to Table"))},onDeleteTable:function(t,e){this.api&&this.documentHolder.ssMenu.formatTableName&&(this.api.asc_deleteCellsInTable(this.documentHolder.ssMenu.formatTableName,e.value),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Delete from Table"))},onInsFunction:function(t){var e=this.getApplication().getController("FormulaDialog");e&&this.api&&e.showDialog()},onInsHyperlink:function(t){var e,i,n=this;if(n.api){for(var o=n.api.asc_getWorksheetsCount(),s=-1,a=[];++s-1&&e.value<6?(this.api.asc_setSelectedDrawingObjectAlign(e.value),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Objects Align")):6==e.value?(this.api.asc_DistributeSelectedDrawingObjectHor(),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Distribute")):7==e.value&&(this.api.asc_DistributeSelectedDrawingObjectVer(),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Distribute")))},onParagraphVAlign:function(t,e){if(this.api){var i=new Asc.asc_CImgProperty;i.asc_putVerticalTextAlign(e.value),this.api.asc_setGraphicObjectProps(i),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Paragraph Vertical Align")}},onParagraphDirection:function(t,e){if(this.api){var i=new Asc.asc_CImgProperty;i.asc_putVert(e.options.direction),this.api.asc_setGraphicObjectProps(i),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Text Direction")}},onSelectNoneBullet:function(t,e){this.api&&-1==e.options.value&&(this.api.asc_setListType(e.options.value),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","List Type"))},onSelectBullets:function(t,e,i,n){var o={};if(_.isFunction(i.toJSON)){if(!i.get("selected"))return;o=i.toJSON()}else o=i;this.api&&this.api.asc_setListType(o.type,o.subtype),"click"!==n.type&&this.documentHolder.textInShapeMenu.hide(),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","List Type")},onRemoveHyperlinkShape:function(t){this.api&&(this.api.asc_removeHyperlink(),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Remove Hyperlink"))},onTextAdvanced:function(t){var e=this;new SSE.Views.ParagraphSettingsAdvanced({paragraphProps:t.textInfo,api:e.api,handler:function(t,i){"ok"==t&&e.api&&(e.api.asc_setGraphicObjectProps(i.paragraphProps),Common.component.Analytics.trackEvent("DocumentHolder","Apply advanced paragraph settings")),Common.NotificationCenter.trigger("edit:complete",e)}}).show()},onShapeAdvanced:function(t){var e=this;new SSE.Views.ShapeSettingsAdvanced({shapeProps:t.shapeInfo,api:e.api,handler:function(t,i){"ok"==t&&e.api&&(e.api.asc_setGraphicObjectProps(i.shapeProps),Common.component.Analytics.trackEvent("DocumentHolder","Apply advanced shape settings")),Common.NotificationCenter.trigger("edit:complete",e)}}).show()},onImgAdvanced:function(t){var e=this;new SSE.Views.ImageSettingsAdvanced({imageProps:t.imageInfo,api:e.api,handler:function(t,i){"ok"==t&&e.api&&(e.api.asc_setGraphicObjectProps(i.imageProps),Common.component.Analytics.trackEvent("DocumentHolder","Apply advanced image settings")),Common.NotificationCenter.trigger("edit:complete",e)}}).show()},onChartEdit:function(t){var e,i=this;i.api&&(e=i.api.asc_getChartObject())&&new SSE.Views.ChartSettingsDlg({chartSettings:e,imageSettings:t.chartInfo,isChart:!0,api:i.api,handler:function(t,e){"ok"==t&&i.api&&(i.api.asc_editChartDrawingObject(e.chartSettings),e.imageSettings&&i.api.asc_setGraphicObjectProps(e.imageSettings)),Common.NotificationCenter.trigger("edit:complete",i)}}).show()},onApiCoAuthoringDisconnect:function(){this.permissions.isEdit=!1},hideCoAuthTips:function(){this.tooltips.coauth.ref&&($(this.tooltips.coauth.ref).remove(),this.tooltips.coauth.ref=void 0,this.tooltips.coauth.x_point=void 0,this.tooltips.coauth.y_point=void 0)},hideHyperlinkTip:function(){!this.tooltips.hyperlink.isHidden&&this.tooltips.hyperlink.ref&&(this.tooltips.hyperlink.ref.hide(),this.tooltips.hyperlink.ref=void 0,this.tooltips.hyperlink.text="",this.tooltips.hyperlink.isHidden=!0)},onApiMouseMove:function(t){if(!this._isFullscreenMenu&&t.length){for(var e,i,n,o,s,a,l=t.length;l>0;l--)switch(t[l-1].asc_getType()){case Asc.c_oAscMouseMoveType.Hyperlink:e=l;break;case Asc.c_oAscMouseMoveType.Comment:i=l;break;case Asc.c_oAscMouseMoveType.LockedObject:n=l;break;case Asc.c_oAscMouseMoveType.ResizeColumn:o=l;break;case Asc.c_oAscMouseMoveType.ResizeRow:s=l;break;case Asc.c_oAscMouseMoveType.Filter:a=l}var r=this,c=[0,0],h=r.tooltips.coauth,d=r.tooltips.comment,p=r.tooltips.hyperlink,m=r.tooltips.row_column,u=r.tooltips.filter,g=[r.documentHolder.cmpEl.offset().left-$(window).scrollLeft(),r.documentHolder.cmpEl.offset().top-$(window).scrollTop()];if(e||r.hideHyperlinkTip(),void 0===o&&void 0===s&&!m.isHidden&&m.ref&&(m.ref.hide(),m.ref=void 0,m.text="",m.isHidden=!0),(r.permissions.isEdit||r.permissions.canViewComments)&&(!i||this.popupmenu)&&(d.moveCommentId=void 0,void 0!=d.viewCommentId)){d={};var b=this.getApplication().getController("Common.Controllers.Comments");b&&(this.permissions.canCoAuthoring&&this.permissions.canViewComments?setTimeout(function(){b.onApiHideComment(!0)},200):b.onApiHideComment(!0))}r.permissions.isEdit&&(n||r.hideCoAuthTips()),(void 0===a||r.dlgFilter&&r.dlgFilter.isVisible()||r.currentMenu&&r.currentMenu.isVisible())&&!u.isHidden&&u.ref&&(u.ref.hide(),u.ref=void 0,u.text="",u.isHidden=!0);if(e){p.parentEl||(p.parentEl=$('
'),r.documentHolder.cmpEl.append(p.parentEl));var f=t[e-1],C=f.asc_getHyperlink();if(C.asc_getType()==Asc.c_oAscHyperlinkType.WebLink){var v=C.asc_getTooltip();v=v?Common.Utils.String.htmlEncode(v)+"
"+r.textCtrlClick+"":C.asc_getHyperlinkUrl()+"
"+r.textCtrlClick+""}else v=C.asc_getTooltip()||C.asc_getLocation(),v+="
"+r.textCtrlClick+"";if(p.ref&&p.ref.isVisible()&&p.text!=v&&(p.ref.hide(),p.ref=void 0,p.text="",p.isHidden=!0),!p.ref||!p.ref.isVisible()){p.text=v,p.ref=new Common.UI.Tooltip({owner:p.parentEl,html:!0,title:v}),p.ref.show([-1e4,-1e4]),p.isHidden=!1,c=[f.asc_getX(),f.asc_getY()],c[0]+=g[0]+6,c[1]+=g[1]-20,c[1]-=p.ref.getBSTip().$tip.height();var _=p.ref.getBSTip().$tip.width();c[0]+_>r.tooltips.coauth.bodyWidth&&(c[0]=r.tooltips.coauth.bodyWidth-_),p.ref.getBSTip().$tip.css({top:c[1]+"px",left:c[0]+"px"})}}if(void 0!==o||void 0!==s){m.parentEl||(m.parentEl=$('
'),r.documentHolder.cmpEl.append(m.parentEl));var f=t[void 0!==o?o-1:s-1],y=Common.Utils.String.format(void 0!==o?this.textChangeColumnWidth:this.textChangeRowHeight,f.asc_getSizeCCOrPt().toFixed(2),f.asc_getSizePx().toFixed());if(m.ref&&m.ref.isVisible()&&m.text!=y&&(m.text=y,m.ref.setTitle(y),m.ref.updateTitle()),!m.ref||!m.ref.isVisible()){m.text=y,m.ref=new Common.UI.Tooltip({owner:m.parentEl,html:!0,title:y}),m.ref.show([-1e4,-1e4]),m.isHidden=!1,c=[f.asc_getX(),f.asc_getY()],c[0]+=g[0]+6,c[1]+=g[1]-20-m.ttHeight;var _=m.ref.getBSTip().$tip.width();c[0]+_>r.tooltips.coauth.bodyWidth&&(c[0]=r.tooltips.coauth.bodyWidth-_-20),m.ref.getBSTip().$tip.css({top:c[1]+"px",left:c[0]+"px"})}}if((r.permissions.isEdit||r.permissions.canViewComments)&&i&&!this.popupmenu&&(f=t[i-1],!d.editCommentId&&d.moveCommentId!=f.asc_getCommentIndexes()[0])){d.moveCommentId=f.asc_getCommentIndexes()[0],d.moveCommentTimer&&clearTimeout(d.moveCommentTimer);var x=f.asc_getCommentIndexes(),w=f.asc_getX(),S=f.asc_getY(),A=f.asc_getReverseX();d.moveCommentTimer=setTimeout(function(){if(d.moveCommentId&&!d.editCommentId){d.viewCommentId=d.moveCommentId;var t=r.getApplication().getController("Common.Controllers.Comments");t&&(t.isSelectedComment||t.onApiShowComment(x,w,S,A,!1,!0))}},400)}if(r.permissions.isEdit&&n&&(f=t[n-1],h.XY||r.onDocumentResize(),h.x_point!=f.asc_getX()||h.y_point!=f.asc_getY())){r.hideCoAuthTips(),h.x_point=f.asc_getX(),h.y_point=f.asc_getY();var k=$(document.createElement("div")),T=f.asc_getLockedObjectType()==Asc.c_oAscMouseMoveLockedObjectType.Sheet||f.asc_getLockedObjectType()==Asc.c_oAscMouseMoveLockedObjectType.TableProperties;h.ref=k,k.addClass("username-tip"),k.css({height:h.ttHeight+"px",position:"absolute",zIndex:"900",visibility:"visible"}),$(document.body).append(k),c=[T?h.x_point+h.rightMenuWidth:h.bodyWidth-(h.x_point+h.XY[0]),h.y_point+h.XY[1]],c[1]>=h.XY[1]&&c[1]+h.ttHeight
'),r.documentHolder.cmpEl.append(u.parentEl));var f=t[a-1],y=r.makeFilterTip(f.asc_getFilter());if(u.ref&&u.ref.isVisible()&&u.text!=y&&(u.text=y,u.ref.setTitle(y),u.ref.updateTitle()),!u.ref||!u.ref.isVisible()){u.text=y,u.ref=new Common.UI.Tooltip({owner:u.parentEl,html:!0,title:y,cls:"auto-tooltip"}),u.ref.show([-1e4,-1e4]),u.isHidden=!1,c=[f.asc_getX()+g[0]-10,f.asc_getY()+g[1]+20];u.ref.getBSTip().$tip.width();c[1]+u.ttHeight>r.tooltips.coauth.bodyHeight&&(c[1]=r.tooltips.coauth.bodyHeight-u.ttHeight-5,c[0]+=20);var _=u.ref.getBSTip().$tip.width();c[0]+_>r.tooltips.coauth.bodyWidth&&(c[0]=r.tooltips.coauth.bodyWidth-_-20),u.ref.getBSTip().$tip.css({top:c[1]+"px",left:c[0]+"px"})}}}},onApiHideComment:function(){this.tooltips.comment.viewCommentId=this.tooltips.comment.editCommentId=this.tooltips.comment.moveCommentId=void 0},onApiHyperlinkClick:function(t){if(!t)return void Common.UI.alert({msg:this.errorInvalidLink,title:this.notcriticalErrorTitle,iconCls:"warn",buttons:["ok"],callback:_.bind(function(t){Common.NotificationCenter.trigger("edit:complete",this.documentHolder)},this)});if(this.api.asc_getUrlType(t)>0)try{window.parent.APP.openURL(t)}catch(i){console.error(i);var e=window.open(t,"_blank");e&&e.focus()}},onApiAutofilter:function(t){var e=this;if(!e.tooltips.filter.isHidden&&e.tooltips.filter.ref&&(e.tooltips.filter.ref.hide(),e.tooltips.filter.ref=void 0,e.tooltips.filter.text="",e.tooltips.filter.isHidden=!0),e.permissions.isEdit&&!e.dlgFilter){e.dlgFilter=new SSE.Views.AutoFilterDialog({api:this.api}).on({close:function(){e.api&&e.api.asc_enableKeyEvents(!0),e.dlgFilter=void 0}}),e.api&&e.api.asc_enableKeyEvents(!1),Common.UI.Menu.Manager.hideAll(),e.dlgFilter.setSettings(t);var i=e.documentHolder.cmpEl.offset(),n=t.asc_getCellCoord(),o=n.asc_getX()+n.asc_getWidth()+i.left,s=n.asc_getY()+n.asc_getHeight()+i.top,a=Common.Utils.innerWidth(),l=Common.Utils.innerHeight();o+e.dlgFilter.options.width>a&&(o=a-e.dlgFilter.options.width-5),s+e.dlgFilter.options.height>l&&(s=l-e.dlgFilter.options.height-5),e.dlgFilter.show(o,s)}},makeFilterTip:function(t){var e=t.asc_getFilterObj(),i=e.asc_getType(),n=(t.asc_getIsTextFilter(),t.asc_getColorsFill(),t.asc_getColorsFont(),"");if(i===Asc.c_oAscAutoFilterTypes.CustomFilters){var o=e.asc_getFilter(),s=o.asc_getCustomFilters();n=this.getFilterName(Asc.c_oAscAutoFilterTypes.CustomFilters,s[0].asc_getOperator())+' "'+s[0].asc_getVal()+'"',s.length>1&&(n=n+" "+(o.asc_getAnd()?this.txtAnd:this.txtOr),n=n+" "+this.getFilterName(Asc.c_oAscAutoFilterTypes.CustomFilters,s[1].asc_getOperator())+' "'+s[1].asc_getVal()+'"')}else if(i===Asc.c_oAscAutoFilterTypes.ColorFilter){var a=e.asc_getFilter();null===a.asc_getCellColor()?n=this.txtEqualsToCellColor:!1===a.asc_getCellColor()&&(n=this.txtEqualsToFontColor)}else if(i===Asc.c_oAscAutoFilterTypes.DynamicFilter)n=this.getFilterName(Asc.c_oAscAutoFilterTypes.DynamicFilter,e.asc_getFilter().asc_getType());else if(i===Asc.c_oAscAutoFilterTypes.Top10){var l=e.asc_getFilter(),r=l.asc_getPercent();n=this.getFilterName(Asc.c_oAscAutoFilterTypes.Top10,l.asc_getTop()),n+=" "+l.asc_getVal()+" "+(r||null===r?this.txtPercent:this.txtItems)}else if(i===Asc.c_oAscAutoFilterTypes.Filters){var c=0,h=0,d=void 0,p=t.asc_getValues();p.forEach(function(t){t.asc_getVisible()&&(h++,c<100&&t.asc_getText()&&(n+=t.asc_getText()+"; ",c=n.length)),t.asc_getText()||(d=t.asc_getVisible())}),h==p.length?n=this.txtAll:1==h&&d?n=this.txtEquals+' "'+this.txtBlanks+'"':h==p.length-1&&0==d?n=this.txtNotEquals+' "'+this.txtBlanks+'"':(d&&(n+=this.txtBlanks+"; "),n=this.txtEquals+' "'+n.substring(0,n.length-2)+'"')}else i===Asc.c_oAscAutoFilterTypes.None&&(n=this.txtAll);return n.length>100&&(n=n.substring(0,100)+"..."),n=""+(t.asc_getColumnName()||"("+this.txtColumn+" "+t.asc_getSheetColumnName()+")")+":
"+n},getFilterName:function(t,e){var i="";if(t==Asc.c_oAscAutoFilterTypes.CustomFilters)switch(e){case Asc.c_oAscCustomAutoFilter.equals:i=this.txtEquals;break;case Asc.c_oAscCustomAutoFilter.isGreaterThan:i=this.txtGreater;break;case Asc.c_oAscCustomAutoFilter.isGreaterThanOrEqualTo:i=this.txtGreaterEquals;break;case Asc.c_oAscCustomAutoFilter.isLessThan:i=this.txtLess;break;case Asc.c_oAscCustomAutoFilter.isLessThanOrEqualTo:i=this.txtLessEquals;break;case Asc.c_oAscCustomAutoFilter.doesNotEqual:i=this.txtNotEquals;break;case Asc.c_oAscCustomAutoFilter.beginsWith:i=this.txtBegins;break;case Asc.c_oAscCustomAutoFilter.doesNotBeginWith:i=this.txtNotBegins;break;case Asc.c_oAscCustomAutoFilter.endsWith:i=this.txtEnds;break;case Asc.c_oAscCustomAutoFilter.doesNotEndWith:i=this.txtNotEnds;break;case Asc.c_oAscCustomAutoFilter.contains:i=this.txtContains;break;case Asc.c_oAscCustomAutoFilter.doesNotContain:i=this.txtNotContains}else if(t==Asc.c_oAscAutoFilterTypes.DynamicFilter)switch(e){case Asc.c_oAscDynamicAutoFilter.aboveAverage:i=this.txtAboveAve;break;case Asc.c_oAscDynamicAutoFilter.belowAverage:i=this.txtBelowAve}else t==Asc.c_oAscAutoFilterTypes.Top10&&(i=e||null===e?this.txtFilterTop:this.txtFilterBottom);return i},onUndo:function(){this.api&&(this.api.asc_Undo(),Common.NotificationCenter.trigger("edit:complete",this.documentHolder))},onApiContextMenu:function(t){var e=this;_.delay(function(){e.showObjectMenu.call(e,t)},10)},onAfterRender:function(t){},onDocumentResize:function(t){var e=this;e.documentHolder&&(e.tooltips.coauth.XY=[e.documentHolder.cmpEl.offset().left-$(window).scrollLeft(),e.documentHolder.cmpEl.offset().top-$(window).scrollTop()],e.tooltips.coauth.apiHeight=e.documentHolder.cmpEl.height(),e.tooltips.coauth.rightMenuWidth=$("#right-menu").width(),e.tooltips.coauth.bodyWidth=$(window).width(),e.tooltips.coauth.bodyHeight=$(window).height())},onDocumentWheel:function(t){if(this.api&&!this.isEditCell){var e=_.isUndefined(t.originalEvent)?t.wheelDelta:t.originalEvent.wheelDelta;if(_.isUndefined(e)&&(e=t.deltaY),(t.ctrlKey||t.metaKey)&&!t.altKey){var i=this.api.asc_getZoom();e<0?(i=Math.ceil(10*i)/10,(i-=.1)<.5||this.api.asc_setZoom(i)):e>0&&(i=Math.floor(10*i)/10,(i+=.1)>0&&!(i>2)&&this.api.asc_setZoom(i)),t.preventDefault(),t.stopPropagation()}}},onDocumentKeyDown:function(t){if(this.api){var e=t.keyCode;if(!t.ctrlKey&&!t.metaKey||t.shiftKey||t.altKey){if(e==Common.UI.Keys.F10&&t.shiftKey)return this.showObjectMenu(t),t.preventDefault(),t.stopPropagation(),!1}else if(e===Common.UI.Keys.NUM_PLUS||e===Common.UI.Keys.EQUALITY||Common.Utils.isGecko&&e===Common.UI.Keys.EQUALITY_FF||Common.Utils.isOpera&&43==e){if(!this.api.isCellEdited){var i=Math.floor(10*this.api.asc_getZoom())/10;return i+=.1,i>0&&!(i>2)&&this.api.asc_setZoom(i),t.preventDefault(),t.stopPropagation(),!1}}else if((e===Common.UI.Keys.NUM_MINUS||e===Common.UI.Keys.MINUS||Common.Utils.isGecko&&e===Common.UI.Keys.MINUS_FF||Common.Utils.isOpera&&45==e)&&!this.api.isCellEdited)return i=Math.ceil(10*this.api.asc_getZoom())/10,i-=.1,i<.5||this.api.asc_setZoom(i),t.preventDefault(),t.stopPropagation(),!1}},onDocumentRightDown:function(t){0==t.button&&(this.mouse.isLeftButtonDown=!0)},onDocumentRightUp:function(t){0==t.button&&(this.mouse.isLeftButtonDown=!1)},onProcessMouse:function(t){"mouseup"==t.type&&(this.mouse.isLeftButtonDown=!1)},onDocumentMouseMove:function(t){"canvas"!==t.target.localName&&this.hideHyperlinkTip()},showObjectMenu:function(t){!this.api||this.mouse.isLeftButtonDown||this.rangeSelectionMode||(this.permissions.isEdit&&!this._isDisabled?this.fillMenuProps(this.api.asc_getCellInfo(),!0,t):this.fillViewMenuProps(this.api.asc_getCellInfo(),!0,t))},onSelectionChanged:function(t){!this.mouse.isLeftButtonDown&&!this.rangeSelectionMode&&this.currentMenu&&this.currentMenu.isVisible()&&(this.permissions.isEdit&&!this._isDisabled?this.fillMenuProps(t,!0):this.fillViewMenuProps(t,!0))},fillMenuProps:function(t,e,i){var n,o,s,a,l,r,c,h,d,p,m=this.documentHolder,u=t.asc_getFlags().asc_getSelectionType(),g=t.asc_getLocked(),b=!0===t.asc_getLockedTable(),f=!1,C=this.getApplication().getController("Common.Controllers.Comments"),v=this.permissions.isEditMailMerge||this.permissions.isEditDiagram;switch(u){case Asc.c_oAscSelectionType.RangeCells:n=!0;break;case Asc.c_oAscSelectionType.RangeRow:o=!0;break;case Asc.c_oAscSelectionType.RangeCol:s=!0;break;case Asc.c_oAscSelectionType.RangeMax:a=!0;break;case Asc.c_oAscSelectionType.RangeImage:r=!v;break;case Asc.c_oAscSelectionType.RangeShape:h=!v;break;case Asc.c_oAscSelectionType.RangeChart:l=!v;break;case Asc.c_oAscSelectionType.RangeChartText:d=!v;break;case Asc.c_oAscSelectionType.RangeShapeText:c=!v}if(this.api.asc_getHeaderFooterMode()){if(!m.copyPasteMenu||!e&&!m.copyPasteMenu.isVisible())return;e&&this.showPopupMenu(m.copyPasteMenu,{},i)}else if(r||h||l){if(!m.imgMenu||!e&&!m.imgMenu.isVisible())return;r=h=l=!1,m.mnuImgAdvanced.imageInfo=void 0;for(var y,x=!1,w=this.api.asc_getGraphicObjectProps(),S=0;S',t.id)),o.cmpEl.append(a)),t.render(a),t.cmpEl.attr({tabindex:"-1"})),2!==i.button){var l=n.api.asc_getActiveCellCoord(),r={left:0,top:0};s[0]=l.asc_getX()+l.asc_getWidth()+r.left,s[1]=(l.asc_getY()<0?0:l.asc_getY())+l.asc_getHeight()+r.top}a.css({left:s[0],top:s[1]}),_.isFunction(t.options.initMenu)&&(t.options.initMenu(e),t.alignPosition()),_.delay(function(){t.cmpEl.focus()},10),t.show(),n.currentMenu=t}},onEntriesListMenu:function(t){if(t&&t.length>0){for(var e=this,i=e.documentHolder,n=i.entriesMenu,o=i.cmpEl.find(Common.Utils.String.format("#menu-container-{0}",n.id)),s=0;s',n.id)),i.cmpEl.append(o)),n.render(o),n.cmpEl.attr({tabindex:"-1"}));var a=e.api.asc_getActiveCellCoord(),l={left:0,top:0},r=[a.asc_getX()+l.left,(a.asc_getY()<0?0:a.asc_getY())+a.asc_getHeight()+l.top];o.css({left:r[0],top:r[1]}),n.show(),n.alignPosition(),_.delay(function(){n.cmpEl.focus()},10)}else this.documentHolder.entriesMenu.hide(),Common.UI.warning({title:this.notcriticalErrorTitle,maxwidth:600,msg:this.txtNoChoices,callback:_.bind(function(t){Common.NotificationCenter.trigger("edit:complete",this.documentHolder)},this)})},onFormulaCompleteMenu:function(t){if(this.documentHolder.funcMenu)if(t){for(var e=this,i=e.documentHolder,n=i.funcMenu,o=i.cmpEl.find("#menu-formula-selection"),s=e.getApplication().getController("FormulaDialog").getDescription(Common.Utils.InternalSettings.get("sse-settings-func-locale")),a=0;an?1:0}),_.each(t,function(t,i){var o=t.asc_getType(),a=t.asc_getName(!0),l=e.api.asc_getFormulaNameByLocale(a),r=new Common.UI.MenuItem({iconCls:o==Asc.c_oAscPopUpSelectorType.Func?"mnu-popup-func":o==Asc.c_oAscPopUpSelectorType.Table?"mnu-popup-table":"mnu-popup-range",caption:a,hint:s&&s[l]?s[l].d:""}).on("click",function(t,i){setTimeout(function(){e.api.asc_insertFormula(t.caption,o,!1)},10)});n.addItem(r)}),n.rendered||(o.length<1&&(o=$(Common.Utils.String.format('')),i.cmpEl.append(o)),n.onAfterKeydownMenu=function(t){if(t.keyCode!=Common.UI.Keys.RETURN||!t.ctrlKey&&!t.altKey){var e;if(arguments.length>1&&arguments[1]instanceof KeyboardEvent&&(t=arguments[1]),o.hasClass("open"))if(t.keyCode==Common.UI.Keys.TAB||t.keyCode==Common.UI.Keys.RETURN&&!t.ctrlKey&&!t.altKey)e=o.find("a.focus").closest("li");else if(t.keyCode==Common.UI.Keys.UP||t.keyCode==Common.UI.Keys.DOWN){var i=n.cmpEl,s=i.offset().top,a=o.find("a.focus").closest("li"),l=a.offset().top;(ls+i.height())&&(n.scroller?n.scroller.scrollTop(i.scrollTop()+l-s,0):i.scrollTop(i.scrollTop()+l-s))}e&&(e.length>0&&e.click(),Common.UI.Menu.Manager.hideAll())}},n.on("hide:after",function(){for(var t=0;t'),this.documentHolder.cmpEl.append(e.parentEl));var i=this.getApplication().getController("FormulaDialog").getDescription(Common.Utils.InternalSettings.get("sse-settings-func-locale")),n=(i&&i[t]?this.api.asc_getFormulaLocaleName(t)+i[t].a:"").replace(/[,;]/g,this.api.asc_getFunctionArgumentSeparator());if(e.ref&&e.ref.isVisible()&&e.text!=n&&(e.ref.hide(),e.ref=void 0,e.text="",e.isHidden=!0),!n)return;e.ref&&e.ref.isVisible()||(e.text=n,e.ref=new Common.UI.Tooltip({owner:e.parentEl,html:!0,title:n,cls:"auto-tooltip"}),e.ref.show([-1e4,-1e4]),e.isHidden=!1);var o=[this.documentHolder.cmpEl.offset().left-$(window).scrollLeft(),this.documentHolder.cmpEl.offset().top-$(window).scrollTop()],s=this.api.asc_getActiveCellCoord(),a=[s.asc_getX()+o[0]-3,s.asc_getY()+o[1]-e.ref.getBSTip().$tip.height()-5],l=e.ref.getBSTip().$tip.width();a[0]+l>this.tooltips.coauth.bodyWidth&&(a[0]=this.tooltips.coauth.bodyWidth-l),e.ref.getBSTip().$tip.css({top:a[1]+"px",left:a[0]+"px"})}else!e.isHidden&&e.ref&&(e.ref.hide(),e.ref=void 0,e.text="",e.isHidden=!0)},onInputMessage:function(t,e){var i=this.tooltips.input_msg;if(e){i.parentEl||(i.parentEl=$('
'),this.documentHolder.cmpEl.append(i.parentEl));var n=t?""+(t||"")+"
":"";n+=e||"",i.ref&&i.ref.isVisible()&&i.text!=n&&(i.ref.hide(),i.ref=void 0,i.text="",i.isHidden=!0),i.ref&&i.ref.isVisible()||(i.text=n,i.ref=new Common.UI.Tooltip({owner:i.parentEl,html:!0,title:n}),i.ref.show([-1e4,-1e4]),i.isHidden=!1);var o=[this.documentHolder.cmpEl.offset().left-$(window).scrollLeft(),this.documentHolder.cmpEl.offset().top-$(window).scrollTop()],s=this.api.asc_getActiveCellCoord(),a=[s.asc_getX()+o[0]-3,s.asc_getY()+o[1]-i.ref.getBSTip().$tip.height()-5],l=i.ref.getBSTip().$tip.width();a[0]+l>this.tooltips.coauth.bodyWidth&&(a[0]=this.tooltips.coauth.bodyWidth-l),i.ref.getBSTip().$tip.css({top:a[1]+"px",left:a[0]+"px"})}else!i.isHidden&&i.ref&&(i.ref.hide(),i.ref=void 0,i.text="",i.isHidden=!0)},onShowSpecialPasteOptions:function(t){var e=this,i=e.documentHolder,n=t.asc_getCellCoord(),o=i.cmpEl.find("#special-paste-container"),s=t.asc_getOptions();if(s){if(o.length<1&&(e._arrSpecialPaste=[],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.paste]=[e.txtPaste,0],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.pasteOnlyFormula]=[e.txtPasteFormulas,0],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.formulaNumberFormat]=[e.txtPasteFormulaNumFormat,0],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.formulaAllFormatting]=[e.txtPasteKeepSourceFormat,0],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.formulaWithoutBorders]=[e.txtPasteBorders,0],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.formulaColumnWidth]=[e.txtPasteColWidths,0],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.mergeConditionalFormating]=[e.txtPasteMerge,0],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.transpose]=[e.txtPasteTranspose,0],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.pasteOnlyValues]=[e.txtPasteValues,1],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.valueNumberFormat]=[e.txtPasteValNumFormat,1],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.valueAllFormating]=[e.txtPasteValFormat,1],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.pasteOnlyFormating]=[e.txtPasteFormat,2],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.link]=[e.txtPasteLink,2],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.picture]=[e.txtPastePicture,2],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.linkedPicture]=[e.txtPasteLinkPicture,2],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.sourceformatting]=[e.txtPasteSourceFormat,2],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.destinationFormatting]=[e.txtPasteDestFormat,2],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.keepTextOnly]=[e.txtKeepTextOnly,2],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.useTextImport]=[e.txtUseTextImport,3],o=$('
'),i.cmpEl.append(o),e.btnSpecialPaste=new Common.UI.Button({cls:"btn-toolbar",iconCls:"btn-paste",menu:new Common.UI.Menu({items:[]})}),e.btnSpecialPaste.render($("#id-document-holder-btn-special-paste"))),s.length>0){for(var a=e.btnSpecialPaste.menu,l=0;l0&&(a.addItem(new Common.UI.MenuItem({caption:"--"})),h=!1),_.each(r[l],function(t,e){a.addItem(t),h=!0});a.items.length>0&&a.items[0].setChecked(!0,!0),e._state.lastSpecPasteChecked=a.items.length>0?a.items[0]:null,c&&(a.addItem(new Common.UI.MenuItem({caption:"--"})),a.addItem(c))}if(n[0].asc_getX()<0||n[0].asc_getY()<0)return void(o.is(":visible")&&o.hide());var d=n[0],p=n[1],m=e.tooltips.coauth.bodyWidth-e.tooltips.coauth.XY[0]-e.tooltips.coauth.rightMenuWidth-15,u=e.tooltips.coauth.apiHeight-15,g=[],b=[31,20],f=d.asc_getX()+d.asc_getWidth()+3+b[0],C=d.asc_getY()+d.asc_getHeight()+3+b[1];f>m?(g[0]=void 0!==p?p.asc_getX():m-b[0]-3,C>u&&(g[0]-=b[0]+3),g[0]<0&&(g[0]=m-3-b[0])):g[0]=f-b[0],g[1]=C>u?u-3-b[1]:C-b[1],o.css({left:g[0],top:g[1]}),o.show()}},onHideSpecialPasteOptions:function(){var t=this.documentHolder.cmpEl.find("#special-paste-container");t.is(":visible")&&t.hide()},onToggleAutoCorrectOptions:function(t){if(!t){var e=this.documentHolder.cmpEl.find("#autocorrect-paste-container");return void(e.is(":visible")&&e.hide())}var i=this,n=i.documentHolder,o=t.asc_getCellCoord(),e=n.cmpEl.find("#autocorrect-paste-container"),s=t.asc_getOptions();if(e.length<1&&(i._arrAutoCorrectPaste=[],i._arrAutoCorrectPaste[Asc.c_oAscAutoCorrectOptions.UndoTableAutoExpansion]=i.txtUndoExpansion,i._arrAutoCorrectPaste[Asc.c_oAscAutoCorrectOptions.RedoTableAutoExpansion]=i.txtRedoExpansion,e=$('
'),n.cmpEl.append(e),i.btnAutoCorrectPaste=new Common.UI.Button({cls:"btn-toolbar",iconCls:"btn-paste",menu:new Common.UI.Menu({items:[]})}),i.btnAutoCorrectPaste.render($("#id-document-holder-btn-autocorrect-paste"))),s.length>0){for(var a=i.btnAutoCorrectPaste.menu,l=0;lr||p>c||o.asc_getX()<0||o.asc_getY()<0?e.is(":visible")&&e.hide():(e.css({left:d-h[0],top:p-h[1]}),e.show())},onCellsRange:function(t){this.rangeSelectionMode=t!=Asc.c_oAscSelectionDialogType.None},onApiEditCell:function(t){this.isEditFormula=t==Asc.c_oAscCellEditorState.editFormula,this.isEditCell=t!=Asc.c_oAscCellEditorState.editEnd},onLockDefNameManager:function(t){this.namedrange_locked=t==Asc.c_oAscDefinedNameReason.LockDefNameManager},onChangeCropState:function(t){this.documentHolder.menuImgCrop.menu.items[0].setChecked(t,!0)},initEquationMenu:function(){if(this._currentMathObj){var t,e=this,i=e._currentMathObj.get_Type(),n=e._currentMathObj,o=[];switch(i){case Asc.c_oAscMathInterfaceType.Accent:t=new Common.UI.MenuItem({caption:e.txtRemoveAccentChar,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"remove_AccentCharacter"}}),o.push(t);break;case Asc.c_oAscMathInterfaceType.BorderBox:t=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:i,callback:"put_HideTop",value:!n.get_HideTop()}},{caption:n.get_HideBottom()?e.txtAddBottom:e.txtHideBottom,equationProps:{type:i,callback:"put_HideBottom",value:!n.get_HideBottom()}},{caption:n.get_HideLeft()?e.txtAddLeft:e.txtHideLeft,equationProps:{type:i,callback:"put_HideLeft",value:!n.get_HideLeft()}},{caption:n.get_HideRight()?e.txtAddRight:e.txtHideRight,equationProps:{type:i,callback:"put_HideRight",value:!n.get_HideRight()}},{caption:n.get_HideHor()?e.txtAddHor:e.txtHideHor,equationProps:{type:i,callback:"put_HideHor",value:!n.get_HideHor()}},{caption:n.get_HideVer()?e.txtAddVer:e.txtHideVer,equationProps:{type:i,callback:"put_HideVer",value:!n.get_HideVer()}},{caption:n.get_HideTopLTR()?e.txtAddLT:e.txtHideLT,equationProps:{type:i,callback:"put_HideTopLTR",value:!n.get_HideTopLTR()}},{caption:n.get_HideTopRTL()?e.txtAddLB:e.txtHideLB,equationProps:{type:i,callback:"put_HideTopRTL",value:!n.get_HideTopRTL()}}]})}),o.push(t);break;case Asc.c_oAscMathInterfaceType.Bar:t=new Common.UI.MenuItem({caption:e.txtRemoveBar,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"remove_Bar"}}),o.push(t),t=new Common.UI.MenuItem({caption:n.get_Pos()==Asc.c_oAscMathInterfaceBarPos.Top?e.txtUnderbar:e.txtOverbar,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_Pos",value:n.get_Pos()==Asc.c_oAscMathInterfaceBarPos.Top?Asc.c_oAscMathInterfaceBarPos.Bottom:Asc.c_oAscMathInterfaceBarPos.Top}}),o.push(t);break;case Asc.c_oAscMathInterfaceType.Script:var s=n.get_ScriptType();s==Asc.c_oAscMathInterfaceScript.PreSubSup?(t=new Common.UI.MenuItem({caption:e.txtScriptsAfter,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_ScriptType",value:Asc.c_oAscMathInterfaceScript.SubSup}}),o.push(t),t=new Common.UI.MenuItem({caption:e.txtRemScripts,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_ScriptType",value:Asc.c_oAscMathInterfaceScript.None}}),o.push(t)):(s==Asc.c_oAscMathInterfaceScript.SubSup&&(t=new Common.UI.MenuItem({caption:e.txtScriptsBefore,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_ScriptType",value:Asc.c_oAscMathInterfaceScript.PreSubSup}}),o.push(t)),s!=Asc.c_oAscMathInterfaceScript.SubSup&&s!=Asc.c_oAscMathInterfaceScript.Sub||(t=new Common.UI.MenuItem({caption:e.txtRemSubscript,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_ScriptType",value:s==Asc.c_oAscMathInterfaceScript.SubSup?Asc.c_oAscMathInterfaceScript.Sup:Asc.c_oAscMathInterfaceScript.None}}),o.push(t)),s!=Asc.c_oAscMathInterfaceScript.SubSup&&s!=Asc.c_oAscMathInterfaceScript.Sup||(t=new Common.UI.MenuItem({caption:e.txtRemSuperscript,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_ScriptType",value:s==Asc.c_oAscMathInterfaceScript.SubSup?Asc.c_oAscMathInterfaceScript.Sub:Asc.c_oAscMathInterfaceScript.None}}),o.push(t)));break;case Asc.c_oAscMathInterfaceType.Fraction:var a=n.get_FractionType();a!=Asc.c_oAscMathInterfaceFraction.Skewed&&a!=Asc.c_oAscMathInterfaceFraction.Linear||(t=new Common.UI.MenuItem({caption:e.txtFractionStacked,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_FractionType",value:Asc.c_oAscMathInterfaceFraction.Bar}}),o.push(t)),a!=Asc.c_oAscMathInterfaceFraction.Bar&&a!=Asc.c_oAscMathInterfaceFraction.Linear||(t=new Common.UI.MenuItem({caption:e.txtFractionSkewed,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_FractionType",value:Asc.c_oAscMathInterfaceFraction.Skewed}}),o.push(t)),a!=Asc.c_oAscMathInterfaceFraction.Bar&&a!=Asc.c_oAscMathInterfaceFraction.Skewed||(t=new Common.UI.MenuItem({caption:e.txtFractionLinear,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_FractionType",value:Asc.c_oAscMathInterfaceFraction.Linear}}),o.push(t)),a!=Asc.c_oAscMathInterfaceFraction.Bar&&a!=Asc.c_oAscMathInterfaceFraction.NoBar||(t=new Common.UI.MenuItem({caption:a==Asc.c_oAscMathInterfaceFraction.Bar?e.txtRemFractionBar:e.txtAddFractionBar,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_FractionType",value:a==Asc.c_oAscMathInterfaceFraction.Bar?Asc.c_oAscMathInterfaceFraction.NoBar:Asc.c_oAscMathInterfaceFraction.Bar}}),o.push(t));break;case Asc.c_oAscMathInterfaceType.Limit:t=new Common.UI.MenuItem({caption:n.get_Pos()==Asc.c_oAscMathInterfaceLimitPos.Top?e.txtLimitUnder:e.txtLimitOver,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_Pos",value:n.get_Pos()==Asc.c_oAscMathInterfaceLimitPos.Top?Asc.c_oAscMathInterfaceLimitPos.Bottom:Asc.c_oAscMathInterfaceLimitPos.Top}}),o.push(t),t=new Common.UI.MenuItem({caption:e.txtRemLimit,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_Pos",value:Asc.c_oAscMathInterfaceLimitPos.None}}),o.push(t);break;case Asc.c_oAscMathInterfaceType.Matrix:t=new Common.UI.MenuItem({caption:n.get_HidePlaceholder()?e.txtShowPlaceholder:e.txtHidePlaceholder,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_HidePlaceholder",value:!n.get_HidePlaceholder()}}),o.push(t),t=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:i,callback:"insert_MatrixRow",value:!0}},{caption:e.insertRowBelowText,equationProps:{type:i,callback:"insert_MatrixRow",value:!1}},{caption:e.insertColumnLeftText,equationProps:{type:i,callback:"insert_MatrixColumn",value:!0}},{caption:e.insertColumnRightText,equationProps:{type:i,callback:"insert_MatrixColumn",value:!1}}]})}),o.push(t),t=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:i,callback:"delete_MatrixRow"}},{caption:e.deleteColumnText,equationProps:{type:i,callback:"delete_MatrixColumn"}}]})}),o.push(t),t=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:i,callback:"put_MatrixAlign",value:Asc.c_oAscMathInterfaceMatrixMatrixAlign.Top}},{caption:e.centerText,checkable:!0,checked:n.get_MatrixAlign()==Asc.c_oAscMathInterfaceMatrixMatrixAlign.Center,equationProps:{type:i,callback:"put_MatrixAlign",value:Asc.c_oAscMathInterfaceMatrixMatrixAlign.Center}},{caption:e.txtBottom,checkable:!0,checked:n.get_MatrixAlign()==Asc.c_oAscMathInterfaceMatrixMatrixAlign.Bottom,equationProps:{type:i,callback:"put_MatrixAlign",value:Asc.c_oAscMathInterfaceMatrixMatrixAlign.Bottom}}]})}),o.push(t),t=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:i,callback:"put_ColumnAlign",value:Asc.c_oAscMathInterfaceMatrixColumnAlign.Left}},{caption:e.centerText,checkable:!0,checked:n.get_ColumnAlign()==Asc.c_oAscMathInterfaceMatrixColumnAlign.Center,equationProps:{type:i,callback:"put_ColumnAlign",value:Asc.c_oAscMathInterfaceMatrixColumnAlign.Center}},{caption:e.rightText,checkable:!0,checked:n.get_ColumnAlign()==Asc.c_oAscMathInterfaceMatrixColumnAlign.Right,equationProps:{type:i,callback:"put_ColumnAlign",value:Asc.c_oAscMathInterfaceMatrixColumnAlign.Right}}]})}),o.push(t);break;case Asc.c_oAscMathInterfaceType.EqArray:t=new Common.UI.MenuItem({caption:e.txtInsertEqBefore,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"insert_Equation",value:!0}}),o.push(t),t=new Common.UI.MenuItem({caption:e.txtInsertEqAfter,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"insert_Equation",value:!1}}),o.push(t),t=new Common.UI.MenuItem({caption:e.txtDeleteEq,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"delete_Equation"}}),o.push(t),t=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:i,callback:"put_Align",value:Asc.c_oAscMathInterfaceEqArrayAlign.Top}},{caption:e.centerText,checkable:!0,checked:n.get_Align()==Asc.c_oAscMathInterfaceEqArrayAlign.Center,equationProps:{type:i,callback:"put_Align",value:Asc.c_oAscMathInterfaceEqArrayAlign.Center}},{caption:e.txtBottom,checkable:!0,checked:n.get_Align()==Asc.c_oAscMathInterfaceEqArrayAlign.Bottom,equationProps:{type:i,callback:"put_Align",value:Asc.c_oAscMathInterfaceEqArrayAlign.Bottom}}]})}),o.push(t);break;case Asc.c_oAscMathInterfaceType.LargeOperator:t=new Common.UI.MenuItem({caption:e.txtLimitChange,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_LimitLocation",value:n.get_LimitLocation()==Asc.c_oAscMathInterfaceNaryLimitLocation.UndOvr?Asc.c_oAscMathInterfaceNaryLimitLocation.SubSup:Asc.c_oAscMathInterfaceNaryLimitLocation.UndOvr}}),o.push(t),void 0!==n.get_HideUpper()&&(t=new Common.UI.MenuItem({caption:n.get_HideUpper()?e.txtShowTopLimit:e.txtHideTopLimit,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_HideUpper",value:!n.get_HideUpper()}}),o.push(t)),void 0!==n.get_HideLower()&&(t=new Common.UI.MenuItem({caption:n.get_HideLower()?e.txtShowBottomLimit:e.txtHideBottomLimit,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_HideLower",value:!n.get_HideLower()}}),o.push(t));break;case Asc.c_oAscMathInterfaceType.Delimiter:t=new Common.UI.MenuItem({caption:e.txtInsertArgBefore,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"insert_DelimiterArgument",value:!0}}),o.push(t),t=new Common.UI.MenuItem({caption:e.txtInsertArgAfter,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"insert_DelimiterArgument",value:!1}}),o.push(t),n.can_DeleteArgument()&&(t=new Common.UI.MenuItem({caption:e.txtDeleteArg,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"delete_DelimiterArgument"}}),o.push(t)),t=new Common.UI.MenuItem({caption:n.has_Separators()?e.txtDeleteCharsAndSeparators:e.txtDeleteChars,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"remove_DelimiterCharacters"}}),o.push(t),t=new Common.UI.MenuItem({caption:n.get_HideOpeningBracket()?e.txtShowOpenBracket:e.txtHideOpenBracket,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_HideOpeningBracket",value:!n.get_HideOpeningBracket()}}),o.push(t),t=new Common.UI.MenuItem({caption:n.get_HideClosingBracket()?e.txtShowCloseBracket:e.txtHideCloseBracket,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_HideClosingBracket",value:!n.get_HideClosingBracket()}}),o.push(t),t=new Common.UI.MenuItem({caption:e.txtStretchBrackets,equation:!0,disabled:e._currentParaObjDisabled,checkable:!0,checked:n.get_StretchBrackets(),equationProps:{type:i,callback:"put_StretchBrackets",value:!n.get_StretchBrackets()}}),o.push(t),t=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:i,callback:"put_MatchBrackets",value:!n.get_MatchBrackets()}}),o.push(t);break;case Asc.c_oAscMathInterfaceType.GroupChar:n.can_ChangePos()&&(t=new Common.UI.MenuItem({caption:n.get_Pos()==Asc.c_oAscMathInterfaceGroupCharPos.Top?e.txtGroupCharUnder:e.txtGroupCharOver,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_Pos",value:n.get_Pos()==Asc.c_oAscMathInterfaceGroupCharPos.Top?Asc.c_oAscMathInterfaceGroupCharPos.Bottom:Asc.c_oAscMathInterfaceGroupCharPos.Top}}),o.push(t),t=new Common.UI.MenuItem({caption:e.txtDeleteGroupChar,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_Pos",value:Asc.c_oAscMathInterfaceGroupCharPos.None}}),o.push(t));break;case Asc.c_oAscMathInterfaceType.Radical:void 0!==n.get_HideDegree()&&(t=new Common.UI.MenuItem({caption:n.get_HideDegree()?e.txtShowDegree:e.txtHideDegree,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_HideDegree",value:!n.get_HideDegree()}}),o.push(t)),t=new Common.UI.MenuItem({caption:e.txtDeleteRadical,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"remove_Radical"}}),o.push(t)}return n.can_IncreaseArgumentSize()&&(t=new Common.UI.MenuItem({caption:e.txtIncreaseArg,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"increase_ArgumentSize"}}),o.push(t)),n.can_DecreaseArgumentSize()&&(t=new Common.UI.MenuItem({caption:e.txtDecreaseArg,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"decrease_ArgumentSize"}}),o.push(t)),n.can_InsertManualBreak()&&(t=new Common.UI.MenuItem({caption:e.txtInsertBreak,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"insert_ManualBreak"}}),o.push(t)),n.can_DeleteManualBreak()&&(t=new Common.UI.MenuItem({caption:e.txtDeleteBreak,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"delete_ManualBreak"}}),o.push(t)),n.can_AlignToCharacter()&&(t=new Common.UI.MenuItem({caption:e.txtAlignToChar,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"align_ToCharacter"}}),o.push(t)),o}},addEquationMenu:function(t){var e=this;e.clearEquationMenu(t);var i=e.documentHolder.textInShapeMenu,n=e.initEquationMenu();return n.length>0&&_.each(n,function(n,o){n.menu?_.each(n.menu.items,function(t){t.on("click",_.bind(e.equationCallback,e,t.options.equationProps))}):n.on("click",_.bind(e.equationCallback,e,n.options.equationProps)),i.insertItem(t,n),t++}),n.length},clearEquationMenu:function(t){for(var e=this,i=e.documentHolder.textInShapeMenu,n=t;n')}),e.paraBulletsPicker.on("item:click",_.bind(this.onSelectBullets,this)),i&&e.paraBulletsPicker.selectRecord(i.rec,!0)},onSignatureClick:function(t){var e=t.cmpEl.attr("data-value");switch(t.value){case 0:Common.NotificationCenter.trigger("protect:sign",e);break;case 1:this.api.asc_ViewCertificate(e);break;case 2:Common.NotificationCenter.trigger("protect:signature","visible",this._isDisabled,e);break;case 3:this.api.asc_RemoveSignature(e)}},onOriginalSizeClick:function(t){if(this.api){var e=this.api.asc_getOriginalImageSize(),i=e.asc_getImageWidth(),n=e.asc_getImageHeight(),o=new Asc.asc_CImgProperty;o.asc_putWidth(i),o.asc_putHeight(n),o.put_ResetCrop(!0),this.api.asc_setGraphicObjectProps(o),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Set Image Original Size")}},onImgReplace:function(t,e){var i=this;this.api&&("file"==e.value?setTimeout(function(){i.api&&i.api.asc_changeImageFromFile(),Common.NotificationCenter.trigger("edit:complete",i.documentHolder)},10):new Common.Views.ImageFromUrlDialog({handler:function(t,e){if("ok"==t&&i.api){var n=e.replace(/ /g,"");if(!_.isEmpty(n)){var o=new Asc.asc_CImgProperty;o.asc_putImageUrl(n),i.api.asc_setGraphicObjectProps(o)}}Common.NotificationCenter.trigger("edit:complete",i.documentHolder)}}).show())},onNumberFormatSelect:function(t,e){void 0!==e.value&&"advanced"!==e.value&&this.api&&this.api.asc_setCellFormat(e.options.format),Common.NotificationCenter.trigger("edit:complete",this.documentHolder)},onCustomNumberFormat:function(t){var e=this,i=e.api.asc_getLocale();!i&&(i=e.permissions.lang?parseInt(Common.util.LanguageInfo.getLocalLanguageCode(e.permissions.lang)):1033),new SSE.Views.FormatSettingsDialog({api:e.api,handler:function(t,i){i&&e.api.asc_setCellFormat(i.format),Common.NotificationCenter.trigger("edit:complete",e.documentHolder)},props:{format:t.options.numformat,formatInfo:t.options.numformatinfo,langId:i}}).show(),Common.NotificationCenter.trigger("edit:complete",this.documentHolder)},onNumberFormatOpenAfter:function(t){if(this.api){var e=this,i=e.api.asc_getLocale();if(!i&&(i=e.permissions.lang?parseInt(Common.util.LanguageInfo.getLocalLanguageCode(e.permissions.lang)):1033),this._state.langId!==i){this._state.langId=i;var n=new Asc.asc_CFormatCellsInfo -;n.asc_setType(Asc.c_oAscNumFormatType.None),n.asc_setSymbol(this._state.langId);for(var o=this.api.asc_getFormatCells(n),s=0;sOnly 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",txtKeepTextOnly:"Keep text only",txtUseTextImport:"Use text import wizard",txtUndoExpansion:"Undo table autoexpansion",txtRedoExpansion:"Redo table autoexpansion",txtAnd:"and",txtOr:"or",txtEquals:"Equals",txtNotEquals:"Does not equal",txtGreater:"Greater than",txtGreaterEquals:"Greater than or equal to",txtLess:"Less than",txtLessEquals:"Less than or equal to",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",txtFilterTop:"Top",txtFilterBottom:"Bottom",txtItems:"items",txtPercent:"percent",txtEqualsToCellColor:"Equals to cell color",txtEqualsToFontColor:"Equals to font color",txtAll:"(All)",txtBlanks:"(Blanks)",txtColumn:"Column",txtImportWizard:"Text Import Wizard"},SSE.Controllers.DocumentHolder||{}))}),define("text!spreadsheeteditor/main/app/template/CellEditor.template",[],function(){return'
\r\n \r\n
\r\n \r\n
\r\n
\r\n \r\n
\r\n
\r\n \r\n
\r\n'}),define("spreadsheeteditor/main/app/view/CellEditor",["text!spreadsheeteditor/main/app/template/CellEditor.template","common/main/lib/component/BaseView"],function(t){"use strict";SSE.Views.CellEditor=Common.UI.BaseView.extend(_.extend({template:_.template(t),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t)},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:"--"}]})}),this.btnNamedRanges.render($("#ce-cell-name-menu")),this.btnNamedRanges.setVisible(!1),this.btnNamedRanges.menu.setOffset(-81),this.$cellname=$("#ce-cell-name",this.el),this.$btnexpand=$("#ce-btn-expand",this.el),this.$btnfunc=$("#ce-func-label",this.el);var t=this;return this.$cellname.on("focus",function(e){var i=t.$cellname[0];i.selectionStart=0,i.selectionEnd=i.value.length,i.scrollLeft=i.scrollWidth}),this.$btnfunc.addClass("disabled"),this.$btnfunc.tooltip({title:this.tipFormula,placement:"cursor"}),this},updateCellInfo:function(t){t&&this.$cellname.val("string"==typeof t?t:t.asc_getName())},cellNameDisabled:function(t){t?this.$cellname.attr("disabled","disabled"):this.$cellname.removeAttr("disabled"),this.btnNamedRanges.setDisabled(t)},tipFormula:"Insert Function",textManager:"Manager"},SSE.Views.CellEditor||{}))}),define("text!spreadsheeteditor/main/app/template/NameManagerDlg.template",[],function(){return'
\r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n \r\n
\r\n
\r\n
\r\n \r\n \r\n \r\n \r\n
\r\n
\r\n
'}),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(t){"use strict";SSE.Views=SSE.Views||{},SSE.Views.NameManagerDlg=Common.Views.AdvancedSettingsWindow.extend(_.extend({options:{alias:"NameManagerDlg",contentWidth:510,height:353},initialize:function(e){_.extend(this.options,{title:this.txtTitle,template:['
','
'+_.template(t)({scope:this})+"
","
",'
','"].join("")},e),this.api=e.api,this.handler=e.handler,this.sheets=e.sheets||[],this.sheetNames=e.sheetNames||[],this.ranges=e.ranges||[],this.props=e.props,this.sort=e.sort||{type:"name",direction:1},this.locked=e.locked||!1,this.userTooltip=!0,this.currentNamedRange=void 0,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 t=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(e,i){t.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(['
'].join("")),itemTemplate:_.template(['
','
','
<%= name %>
','
<%= scopeName %>
','
<%= range %>
',"<% if (lock) { %>",'
<%=lockuser%>
',"<% } %>","
"].join(""))}),this.rangeList.store.comparator=function(e,i){var n=e.get(t.sort.type).toLowerCase(),o=i.get(t.sort.type).toLowerCase();return n==o?0:n0?this.textnoNames:this.textEmpty)}var a=this,l=this.rangeList.store,r=this.rangesStore.models,c=this.cmbFilter.getValue(),h=c<3?2==c:-1,d=c>2?4==c:-1;if(c>0&&(r=this.rangesStore.filter(function(t){return-1!==h?h===t.get("isTable"):-1!==d&&d===(null===t.get("scope"))})),l.reset(r,{silent:!1}),c=l.length,this.btnEditRange.setDisabled(!c),this.btnDeleteRange.setDisabled(!c),c>0){if(void 0!==e&&null!==e||(e=0),_.isNumber(e))e>c-1&&(e=c-1),this.rangeList.selectByIndex(e),setTimeout(function(){a.rangeList.scrollToRecord(l.at(e))},50);else if(e){var p=l.findWhere({name:e.asc_getName(!0),scope:e.asc_getScope()});p&&(this.rangeList.selectRecord(p),setTimeout(function(){a.rangeList.scrollToRecord(p)},50))}!0===this.userTooltip&&this.rangeList.cmpEl.find(".lock-user").length>0&&this.rangeList.cmpEl.on("mouseover",_.bind(a.onMouseOverLock,a)).on("mouseout",_.bind(a.onMouseOutLock,a))}_.delay(function(){a.rangeList.cmpEl.find(".listview").focus(),a.rangeList.scroller.update({alwaysVisibleY:!0})},100,this)},onMouseOverLock:function(t,e,i){if(!0===this.userTooltip&&$(t.target).hasClass("lock-user")){var n=this,o=$(t.target).tooltip({title:this.tipIsLocked,trigger:"manual"}).data("bs.tooltip");this.userTooltip=o.tip(),this.userTooltip.css("z-index",parseInt(this.$window.css("z-index"))+10),o.show(),setTimeout(function(){n.userTipHide()},5e3)}},userTipHide:function(){"object"==typeof this.userTooltip&&(this.userTooltip.remove(),this.userTooltip=void 0,this.rangeList.cmpEl.off("mouseover").off("mouseout"))},onMouseOutLock:function(t,e,i){"object"==typeof this.userTooltip&&this.userTipHide()},onEditRange:function(t){if(this.locked)return void Common.NotificationCenter.trigger("namedrange:locked");var e=this,i=e.$window.offset(),n=this.rangeList.getSelectedRec(),o=(_.indexOf(this.rangeList.store.models,n),t&&n?new Asc.asc_CDefName(n.get("name"),n.get("range"),n.get("scope"),n.get("isTable"),void 0,void 0,void 0,!0):null),s=new SSE.Views.NamedRangeEditDlg({api:e.api,sheets:this.sheets,props:t?o:this.props,isEdit:t,handler:function(i,n){"ok"==i&&n&&(t?(e.currentNamedRange=n,e.api.asc_editDefinedNames(o,n)):(e.cmbFilter.setValue(0),e.currentNamedRange=n,e.api.asc_setDefinedNames(n)))}}).on("close",function(){e.show(),_.delay(function(){e.rangeList.cmpEl.find(".listview").focus()},100,e)});e.hide(),s.show(i.left+65,i.top+77)},onDeleteRange:function(){var t=this.rangeList.getSelectedRec();t&&(this.currentNamedRange=_.indexOf(this.rangeList.store.models,t),this.api.asc_delDefinedNames(new Asc.asc_CDefName(t.get("name"),t.get("range"),t.get("scope"),t.get("isTable"),void 0,void 0,void 0,!0)))},getSettings:function(){return this.sort},onPrimary:function(){return!0},onDlgBtnClick:function(t){this.handler&&this.handler.call(this,t.currentTarget.attributes.result.value),this.close()},onSortNames:function(t){t!==this.sort.type?(this.sort={type:t,direction:1},this.spanSortName.toggleClass("hidden"),this.spanSortScope.toggleClass("hidden")):this.sort.direction=-this.sort.direction;var e="name"==t?this.spanSortName:this.spanSortScope;this.sort.direction>0?e.removeClass("sort-desc"):e.addClass("sort-desc"),this.rangeList.store.sort(),this.rangeList.onResetItems(),this.rangeList.scroller.update({alwaysVisibleY:!0})},getUserName:function(t){var e=SSE.getCollection("Common.Collections.Users");if(e){var i=e.findUser(t);if(i)return i.get("username")}return this.guestText},onSelectRangeItem:function(t,e,i){this.userTipHide();var n={};if(_.isFunction(i.toJSON)){if(!i.get("selected"))return;n=i.toJSON(),this.currentNamedRange=_.indexOf(this.rangeList.store.models,i),this.btnEditRange.setDisabled(n.lock),this.btnDeleteRange.setDisabled(n.lock||n.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(t,e,i){i.keyCode!=Common.UI.Keys.DELETE||this.btnDeleteRange.isDisabled()||this.onDeleteRange()},onDblClickItem:function(t,e,i){this.btnEditRange.isDisabled()||this.onEditRange(!0)},onLockDefNameManager:function(t){this.locked=t==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.
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(t){"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)},"Common.Views.Header":{"formulabar:hide":function(t){this.editor.setVisible(!t),Common.localStorage.setBool("sse-hidden-formula",t),Common.NotificationCenter.trigger("layout:changed","celleditor",t?"hidden":"showed")}.bind(this)}})},setApi:function(t){return this.api=t,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(t){this.mode=t,this.editor.$btnfunc[this.mode.isEdit?"removeClass":"addClass"]("disabled"),this.editor.btnNamedRanges.setVisible(this.mode.isEdit&&!this.mode.isEditDiagram&&!this.mode.isEditMailMerge),this.mode.isEdit&&this.api.asc_registerCallback("asc_onSelectionChanged",_.bind(this.onApiSelectionChanged,this))},onInputKeyDown:function(t){if(Common.UI.Keys.UP===t.keyCode||Common.UI.Keys.DOWN===t.keyCode||Common.UI.Keys.TAB===t.keyCode||Common.UI.Keys.RETURN===t.keyCode||Common.UI.Keys.ESC===t.keyCode||Common.UI.Keys.LEFT===t.keyCode||Common.UI.Keys.RIGHT===t.keyCode){var e=$("#menu-formula-selection");e.hasClass("open")&&e.find(".dropdown-menu").trigger("keydown",t)}},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(t){t==Asc.c_oAscCellEditorState.editStart?(this.api.isCellEdited=!0,this.editor.cellNameDisabled(!0)):t==Asc.c_oAscCellEditorState.editInCell?this.api.isCEditorFocused="clear":t==Asc.c_oAscCellEditorState.editEnd&&(this.api.isCellEdited=!1,this.api.isCEditorFocused=!1,this.editor.cellNameDisabled(!1)),this.editor.$btnfunc.toggleClass("disabled",t==Asc.c_oAscCellEditorState.editText)},onApiCellSelection:function(t){this.editor.updateCellInfo(t)},onApiSelectionChanged:function(t){var e=t.asc_getFlags().asc_getSelectionType(),i=!this.mode.isEditMailMerge&&!this.mode.isEditDiagram&&(!0===t.asc_getLocked()||!0===t.asc_getLockedTable()),n=e==Asc.c_oAscSelectionType.RangeChartText,o=e==Asc.c_oAscSelectionType.RangeChart,s=e==Asc.c_oAscSelectionType.RangeShapeText,a=e==Asc.c_oAscSelectionType.RangeShape,l=e==Asc.c_oAscSelectionType.RangeImage,r=s||a||n||o;this.editor.$btnfunc.toggleClass("disabled",l||r||i)},onApiDisconnect:function(){this.mode.isEdit=!1;var t=this.getApplication().getController("FormulaDialog");t&&t.hideDialog(),this.mode.isEdit||($("#ce-func-label",this.editor.el).addClass("disabled"),this.editor.btnNamedRanges.setVisible(!1))},onCellsRange:function(t){this.editor.cellNameDisabled(t!=Asc.c_oAscSelectionDialogType.None),this.editor.$btnfunc.toggleClass("disabled",t!=Asc.c_oAscSelectionDialogType.None)},onLayoutResize:function(t,e){"cell:edit"==e&&(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(t){if(t.keyCode==Common.UI.Keys.RETURN){var e=this.editor.$cellname.val();e&&e.length&&this.api.asc_findCell(e),Common.NotificationCenter.trigger("edit:complete",this.editor)}},onBlurCellEditor:function(){"clear"==this.api.isCEditorFocused?this.api.isCEditorFocused=void 0:this.api.isCellEdited&&(this.api.isCEditorFocused=!0)},onKeyupCellEditor:function(t){t.keyCode!=Common.UI.Keys.RETURN||t.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 t=this.getApplication().getController("FormulaDialog");t&&($("#ce-func-label",this.editor.el).blur(),t.showDialog())}},onNamedRangesMenu:function(t,e){var i=this;if("manager"==e.options.value){for(var n=this.api.asc_getWorksheetsCount(),o=-1,s=[],a=[];++o2)},onLockDefNameManager:function(t){this.namedrange_locked=t==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(t){_.extend(this.options,t||{}),this.template=['
','
',"","
",'
',"
",'"].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 t=this;t.inputUrl=new Common.UI.InputField({el:$("#id-dlg-url"),allowBlank:!1,blankError:t.txtEmpty,style:"width: 100%;",validateOnBlur:!1,validation:function(e){return!!/((^https?)|(^ftp)):\/\/.+/i.test(e)||t.txtNotUrl}}),this.getChild().find(".btn").on("click",_.bind(this.onBtnClick,this))},show:function(){Common.UI.Window.prototype.show.apply(this,arguments);var t=this;_.delay(function(){t.getChild("input").focus()},500)},onPrimary:function(t){return this._handleInput("ok"),!1},onBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value)},_handleInput:function(t){if(this.options.handler){if("ok"==t&&!0!==this.inputUrl.checkValidate())return void this.inputUrl.cmpEl.find("input").focus();this.options.handler.call(this,t,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||{}))}),void 0===Common)var Common={};if(define("common/main/lib/component/LoadMask",["common/main/lib/component/BaseView"],function(){"use strict";Common.UI.LoadMask=Common.UI.BaseView.extend(function(){var t,e,i;return{options:{cls:"",style:"",title:"Loading...",owner:document.body},template:_.template(['"].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t),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(!e&&!i){if(t=this.owner instanceof Common.UI.BaseView?$(this.owner.el):$(this.owner),t.hasClass("masked"))return this;var n=this;return e=$('
'),i=$(this.template({id:n.id,cls:n.cls,style:n.style,title:n.title})),t.addClass("masked"),t.append(e),t.append(i),i.css({top:Math.round(t.height()/2-(i.height()+parseInt(i.css("padding-top"))+parseInt(i.css("padding-bottom")))/2)+"px",left:Math.round(t.width()/2-(i.width()+parseInt(i.css("padding-left"))+parseInt(i.css("padding-right")))/2)+"px"}),(t.height()<1||t.width()<1)&&i.css({visibility:"hidden"}),Common.util.Shortcuts.suspendEvents(),this}},hide:function(){t&&t.removeClass("masked"),e&&e.remove(),i&&i.remove(),e=null,i=null,Common.util.Shortcuts.resumeEvents()},setTitle:function(e){this.title=e,t&&t.hasClass("masked")&&i&&$(".asc-loadmask-title",i).html(e)},isVisible:function(){return!_.isEmpty(i)},updatePosition:function(){t&&t.hasClass("masked")&&i&&(i.css({top:Math.round(t.height()/2-(i.height()+parseInt(i.css("padding-top"))+parseInt(i.css("padding-bottom")))/2)+"px",left:Math.round(t.width()/2-(i.width()+parseInt(i.css("padding-left"))+parseInt(i.css("padding-right")))/2)+"px"}),i.css({visibility:"visible"}))}}}())}),define("common/main/lib/view/SelectFileDlg",["common/main/lib/component/Window","common/main/lib/component/LoadMask"],function(){"use strict";Common.Views.SelectFileDlg=Common.UI.Window.extend(_.extend({initialize:function(t){var e={};_.extend(e,{title:this.textTitle,width:1024,height:621,header:!0},t),this.template=['
'].join(""),e.tpl=_.template(this.template)(e),this.fileChoiceUrl=t.fileChoiceUrl||"",Common.UI.Window.prototype.initialize.call(this,e)},render:function(){Common.UI.Window.prototype.render.call(this),this.$window.find("> .body").css({height:"auto",overflow:"hidden"});var t=document.createElement("iframe");t.width="100%",t.height=585,t.align="top",t.frameBorder=0,t.scrolling="no",t.onload=_.bind(this._onLoad,this),$("#id-select-file-placeholder").append(t),this.loadMask=new Common.UI.LoadMask({owner:$("#id-select-file-placeholder")}),this.loadMask.setTitle(this.textLoading),this.loadMask.show(), -t.src=this.fileChoiceUrl;var e=this;this._eventfunc=function(t){e._onWindowMessage(t)},this._bindWindowEvents.call(this),this.on("close",function(t){e._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(t){if(t&&window.JSON)try{this._onMessage.call(this,window.JSON.parse(t.data))}catch(t){}},_onMessage:function(t){if(t&&"onlyoffice"==t.Referer&&void 0!==t.file){Common.NotificationCenter.trigger("window:close",this);var e=this;setTimeout(function(){_.isEmpty(t.file)||e.trigger("selectfile",e,t.file)},50)}},_onLoad:function(){this.loadMask&&this.loadMask.hide()},textTitle:"Select Data Source",textLoading:"Loading"},Common.Views.SelectFileDlg||{}))}),void 0===Common)var Common={};if(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'
\n
\n
\n <%= tabsmarkup %>\n
\n
\n
\n
\n
\n
\n \n
\n
\n \n
\n
\n
\n
\n
\n \n \n
\n
\n \n \n
\n
\n
\n
\n
\n
\n
\n
\n \n \n \n \n
\n
\n \n \n \n \n \n \n \n \n
\n
\n
\n
\n
\n \n \n \n \n \n
\n
\n \n \n \n \n \n
\n
\n
\n
\n
\n \n
\n
\n \n
\n
\n
\n
\n
\n \n \n
\n
\n \n \n
\n
\n
\n
\n
\n \n
\n
\n \n \n \n \n
\n
\n
\n
\n
\n \n
\n
\n \n
\n
\n
\n
\n
\n \n \n
\n
\n \n \n
\n
\n
\n
\n
\n
\n \n
\n
\n
\n \n \n \n \n \n
\n
\n
\n \n \n
\n
\n
\n \n
\n
\n
\n
\n \n \n \n \n \n
\n
\n
\n \n \n \n \n
\n
\n
\n
\n \n
\n
\n
\n \n \n \n \n \n \n \n \n \n
\n
\n
\n
\n
\n \n \n
\n
\n \n \n
\n
\n
\n
\n \n
\n
\n
\n \n \n
\n \x3c!--
--\x3e\n \x3c!--
--\x3e\n \x3c!----\x3e\n \x3c!--
--\x3e\n \x3c!--
--\x3e\n \x3c!----\x3e\n \x3c!--
--\x3e\n \x3c!--
--\x3e\n
\n
\n
\n
'}),define("text!spreadsheeteditor/main/app/template/ToolbarAnother.template",[],function(){return'
\n <% if ( isEditDiagram ) { %>\n \x3c!-----------------------\x3e\n \x3c!-- Edit diagram mode --\x3e\n \x3c!-----------------------\x3e\n
\n
\n
\n \n \n \n \n
\n
\n
\n
\n
\n \n
\n
\n
\n
\n
\n \n \n \n
\n
\n
\n
\n
\n \n
\n
\n
\n
\n <% } else if ( isEditMailMerge ) { %>\n \x3c!-----------------------\x3e\n \x3c!-- Edit mail merge mode --\x3e\n \x3c!-----------------------\x3e\n
\n
\n
\n \n \n \n \n
\n
\n
\n
\n
\n \n \n
\n
\n
\n
\n
\n \n \n
\n
\n
\n
\n
\n \n
\n
\n
\n
\n <% } %>\n
'}),define("text!spreadsheeteditor/main/app/template/ToolbarView.template",[],function(){return'
\n
\n
\n <%= tabsmarkup %>\n
\n
\n
\n
\n
\n
\n
\n
'}),void 0===Common)var Common={};if(Common.Models=Common.Models||{},define("common/main/lib/model/Font",["backbone"],function(t){"use strict";Common.Models.Font=t.Model.extend({defaults:function(){return{id:Common.UI.getId(),name:null,cloneid:null,imgidx:0,type:0}}})}),void 0===Common)var Common={};if(Common.Collections=Common.Collections||{},define("common/main/lib/collection/Fonts",["backbone","common/main/lib/model/Font"],function(t){"use strict";Common.Collections.Fonts=t.Collection.extend({model:Common.Models.Font,comparator:function(t,e){var i=t.get("name").toLowerCase(),n=e.get("name").toLowerCase();return i==n?0:i","<% if (iconImg) { print(''); } else { %>","<% if (iconCls != \"\") { if (/svgicon/.test(iconCls)) {print('');} else print(' '); }} %>","<% } %>","<% if ( !menu ) { %>",'","<% } else if (split == false) {%>",'
','","
","<% } else { %>",'
','",'","
","<% } %>"].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t);var e=this;e.id=e.options.id||Common.UI.getId(),e.hint=e.options.hint,e.enableToggle=e.options.enableToggle,e.allowDepress=e.options.allowDepress,e.cls=e.options.cls,e.iconCls=e.options.iconCls,e.menu=e.options.menu,e.split=e.options.split,e.toggleGroup=e.options.toggleGroup,e.disabled=e.options.disabled,e.visible=e.options.visible,e.pressed=e.options.pressed,e.caption=e.options.caption,e.template=e.options.template||e.template,e.style=e.options.style,e.rendered=!1,e.options.el&&e.render()},render:function(t){var e=this;if(e.trigger("render:before",e),e.cmpEl=$(e.el),t&&(e.setElement(t,!1),e.rendered||(/icon-top/.test(e.cls)&&e.caption&&/huge/.test(e.cls)&&(!0===e.split?(!!e.cls&&(e.cls=e.cls.replace(/\s?(?:x-huge|icon-top)/g,"")),this.template=_.template('
')):e.menu?this.template=_.template('
'):this.template=_.template('')),e.cmpEl=$(this.template({id:e.id,cls:e.cls,iconCls:e.iconCls,iconImg:e.options.iconImg,menu:e.menu,split:e.split,disabled:e.disabled,pressed:e.pressed,caption:e.caption,style:e.style})),e.menu&&_.isObject(e.menu)&&_.isFunction(e.menu.render)&&e.menu.render(e.cmpEl),t.html(e.cmpEl),e.$icon=e.$el.find(".icon"))),!e.rendered){var i=e.cmpEl,n=i.hasClass("btn-group"),o=i.hasClass("split");if(e.options.hint){var s=e.cmpEl.closest(".asc-window");if("object"==typeof e.options.hint&&e.options.hint.length>1&&$("button",i).length>0){var a=$("button",i);e.btnEl=$(a[0]),e.btnMenuEl=$(a[1])}else e.btnEl=e.cmpEl,e.btnEl.attr("data-toggle","tooltip");e.btnEl.tooltip({ -title:"string"==typeof e.options.hint?e.options.hint:e.options.hint[0],placement:e.options.hintAnchor||"cursor"}),e.btnMenuEl&&e.btnMenuEl.tooltip({title:e.options.hint[1],placement:e.options.hintAnchor||"cursor"}),s.length>0&&(e.btnEl.data("bs.tooltip").tip().css("z-index",parseInt(s.css("z-index"))+10),e.btnMenuEl&&e.btnMenuEl.data("bs.tooltip").tip().css("z-index",parseInt(s.css("z-index"))+10))}_.isString(e.toggleGroup)&&(e.enableToggle=!0);var l,r=function(t){if(!e.disabled&&1==t.which){if(e.doToggle(),e.options.hint){var i=e.btnEl.data("bs.tooltip");i&&(void 0===i.dontShow&&(i.dontShow=!0),i.hide())}e.trigger("click",e,t)}},c=function(t,n,s){if(!t){var a=!1;$("button",i).each(function(t,e){if($(e).is(":hover"))return a=!0,!1}),a||(i.removeClass("over"),$("button",i).removeClass("over"))}if("button"==n){if(!t&&e.enableToggle&&e.allowDepress&&e.pressed)return;if(t&&!o&&e.enableToggle&&e.allowDepress&&!e.pressed)return void s.preventDefault();$("button:first",i).toggleClass("active",t)}else $("[data-toggle^=dropdown]",i).toggleClass("active",t);i.toggleClass("active",t)},h=function(t){if(!e.disabled&&1==t.which&&o){if(e.options.hint){var n=(e.btnMenuEl?e.btnMenuEl:e.btnEl).data("bs.tooltip");n&&(void 0===n.dontShow&&(n.dontShow=!0),n.hide())}var s=i.hasClass("open");c(!s,"arrow",t)}},d=function(t,e){o?c(e,"button",t):(i.toggleClass("active",e),$("button",i).toggleClass("active",e))},p=function(t){l=t.currentTarget.className.match(/dropdown/)?"arrow":"button",c(!0,l,t),$(document).on("mouseup",m)},m=function(t){c(!1,l,t),$(document).off("mouseup",m)},u=function(t,i){e.cmpEl.find(".dropdown-toggle").blur(),e.cmpEl.hasClass("active")!==e.pressed&&e.cmpEl.trigger("button.internal.active",[e.pressed])};n?(o&&($("[data-toggle^=dropdown]",i).on("mousedown",_.bind(h,this)),$("button",i).on("mousedown",_.bind(p,this)),e.options.width>0&&$("button:first",i).css("width",e.options.width-$("[data-toggle^=dropdown]",i).outerWidth())),i.on("hide.bs.dropdown",_.bind(c,e,!1,"arrow")),i.on("show.bs.dropdown",_.bind(c,e,!0,"arrow")),i.on("hidden.bs.dropdown",_.bind(u,e)),$("button:first",i).on("click",r)):i.on("click",r),i.on("button.internal.active",_.bind(d,e)),i.on("mouseover",function(t){e.disabled||(e.cmpEl.addClass("over"),e.trigger("mouseover",e,t))}),i.on("mouseout",function(t){e.cmpEl.removeClass("over"),e.disabled||e.trigger("mouseout",e,t)}),Common.UI.ToggleManager.register(e)}return e.rendered=!0,e.pressed&&e.toggle(e.pressed,!0),e.disabled&&e.setDisabled(!(e.disabled=!1)),e.visible||e.setVisible(e.visible),e.trigger("render:after",e),this},doToggle:function(){var t=this;!t.enableToggle||!1===t.allowDepress&&t.pressed||t.toggle()},toggle:function(t,e){var i=void 0===t?!this.pressed:!!t;this.pressed=i,this.cmpEl&&this.cmpEl.trigger("button.internal.active",[i]),e||this.trigger("toggle",this,i)},isActive:function(){return this.enableToggle?this.pressed:this.cmpEl.hasClass("active")},setDisabled:function(t){if(this.rendered&&this.disabled!=t){var e=this.cmpEl,i=e.hasClass("btn-group"),n=this;if((t=!0===t)!==e.hasClass("disabled")){var o=function(e){e.toggleClass("disabled",t),n.options.allowMouseEventsOnDisabled||(t?e.attr({disabled:t}):e.removeAttr("disabled"))};o(e),i&&o(e.children("button"))}if((t||!Common.Utils.isGecko)&&this.options.hint){var s=this.btnEl.data("bs.tooltip");s&&(t&&s.hide(),!Common.Utils.isGecko&&(s.enabled=!t)),this.btnMenuEl&&(s=this.btnMenuEl.data("bs.tooltip"))&&(t&&s.hide(),!Common.Utils.isGecko&&(s.enabled=!t))}if(t&&this.menu&&_.isObject(this.menu)&&this.menu.rendered&&this.menu.isVisible()&&setTimeout(function(){n.menu.hide()},1),n.options.signals){n.options.signals.indexOf("disabled")<0||n.trigger("disabled",n,t)}}this.disabled=t},isDisabled:function(){return this.disabled},setIconCls:function(t){var e=$(this.el).find(".icon"),i=this.iconCls;this.iconCls=t,e.removeClass(i),e.addClass(t||"")},setVisible:function(t){this.cmpEl&&this.cmpEl.toggleClass("hidden",!t),this.visible=t},isVisible:function(){return this.cmpEl?this.cmpEl.is(":visible"):$(this.el).is(":visible")},updateHint:function(t){if(this.options.hint=t,this.rendered){var e=this.cmpEl,i=e.closest(".asc-window");if(!this.btnEl)if("object"==typeof this.options.hint&&this.options.hint.length>1&&$("button",e).length>0){var n=$("button",e);this.btnEl=$(n[0]),this.btnMenuEl=$(n[1])}else this.btnEl=e,this.btnEl.attr("data-toggle","tooltip");if(this.btnEl.data("bs.tooltip")&&this.btnEl.removeData("bs.tooltip"),this.btnMenuEl&&this.btnMenuEl.data("bs.tooltip")&&this.btnMenuEl.removeData("bs.tooltip"),this.btnEl.tooltip({title:"string"==typeof t?t:t[0],placement:this.options.hintAnchor||"cursor"}),this.btnMenuEl&&this.btnMenuEl.tooltip({title:t[1],placement:this.options.hintAnchor||"cursor"}),i.length>0&&(this.btnEl.data("bs.tooltip").tip().css("z-index",parseInt(i.css("z-index"))+10),this.btnMenuEl&&this.btnMenuEl.data("bs.tooltip").tip().css("z-index",parseInt(i.css("z-index"))+10)),this.disabled||!Common.Utils.isGecko){var o=this.btnEl.data("bs.tooltip");o&&(this.disabled&&o.hide(),!Common.Utils.isGecko&&(o.enabled=!this.disabled)),this.btnMenuEl&&(o=this.btnMenuEl.data("bs.tooltip"))&&(this.disabled&&o.hide(),!Common.Utils.isGecko&&(o.enabled=!this.disabled))}}},setCaption:function(t){if(this.caption!=t&&(this.caption=t,this.rendered)){var e=this.cmpEl.find("button:first > .caption").addBack().filter("button > .caption");e.length>0?e.text(t):this.cmpEl.find("button:first").addBack().filter("button").text(t)}},setMenu:function(t){t&&_.isObject(t)&&_.isFunction(t.render)&&(this.menu=t,this.rendered&&this.menu.render(this.cmpEl))}})}),void 0===Common)var Common={};if(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(['
',"<% _.each(colors, function(color, index) { %>",'',"<% }) %>","
"].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t);var e=this;this.id=e.options.id,this.cls=e.options.cls,this.style=e.options.style,this.colors=e.options.colors||[],this.value=e.options.value,e.options.el&&e.render()},render:function(t){var e=this;if(e.rendered?this.cmpEl=$(this.el):(this.cmpEl=$(this.template({id:this.id,cls:this.cls,style:this.style,colors:this.colors})),t?(this.setElement(t,!1),t.html(this.cmpEl)):$(this.el).html(this.cmpEl)),!e.rendered){this.cmpEl.on("click","span.color-item",_.bind(this.itemClick,this))}return e.rendered=!0,this},itemClick:function(t){var e=$(t.target);this.select(e.attr("data-color"))},select:function(t,e){if(this.value!=t){var i=this;$("span.color-item",this.cmpEl).removeClass("selected"),this.value=t,t&&/#?[a-fA-F0-9]{6}/.test(t)&&(t=/#?([a-fA-F0-9]{6})/.exec(t)[1].toUpperCase(),$("span[data-color="+t+"]",this.cmpEl).addClass("selected"),e||i.trigger("select",i,this.value))}}})}),define("text!common/main/lib/template/ExtendedColorDialog.template",[],function(){return'
\r\n
\r\n
\r\n
\r\n
\r\n \r\n
\r\n
\r\n \r\n
\r\n
\r\n \r\n
\r\n
\r\n
\r\n \r\n
\r\n
\r\n
\r\n \r\n
\r\n
\r\n
\r\n \r\n \r\n
\r\n
\r\n
\r\n\r\n'}),void 0===Common)var Common={};if(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('
<% if (this.showCurrentColor) { %>
<% } %>
<% if (this.changeSaturation) { %>
<% } %>
<% if (this.allowEmptyColor) { %>
<%= this.textNoColor %>
<% } %>
'),color:"#ff0000",options:{allowEmptyColor:!1,changeSaturation:!0,showCurrentColor:!0},initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t);var e,i,n,o,s,a,l,r,c=this,h=($(this.el),0),d=100,p=100;c.allowEmptyColor=c.options.allowEmptyColor,c.changeSaturation=c.options.changeSaturation,c.showCurrentColor=c.options.showCurrentColor;var m=function(t,e){var i=new Common.Utils.RGBColor("hsb("+t.h+","+t.s+","+t.b+")"),n=i.toHex();c.color=e?"transparent":n,u(),c.trigger("changecolor",c,c.color)},u=function(){s.length>0&&a.length>0&&("transparent"==c.color?a.show():(s.css("background-color",c.color),a.hide())),n.length>0&&n.css("background-color",new Common.Utils.RGBColor("hsb("+h+", 100, 100)").toHex()),l.length>0&&(l[0].innerHTML="transparent"==c.color?c.textNoColor:c.color.toUpperCase()),e.length>0&&i.length>0&&(e.css("left",d+"%"),e.css("top",100-p+"%"),i.css("top",parseInt(100*h/360)+"%"))},g=function(t,i,o){if(e.length>0&&n.length>0){var s=[Math.max(0,Math.min(100,parseInt((t.pageX*Common.Utils.zoom()-n.offset().left)/n.width()*100))),Math.max(0,Math.min(100,parseInt((t.pageY*Common.Utils.zoom()-n.offset().top)/n.height()*100)))];e.css("left",s[0]+"%"),e.css("top",s[1]+"%"),d=s[0],p=100-s[1],m({h:h,s:d,b:p})}},b=function(t,e,n){if(i&&o){var s=Math.max(0,Math.min(100,parseInt((t.pageY*Common.Utils.zoom()-o.offset().top)/o.height()*100)));i.css("top",s+"%"),h=parseInt(360*s/100),m({h:h,s:d,b:p})}},f=function(t,e,i){$(document).on("mouseup",C),$(document).on("mousemove",g)},C=function(t,e,i){$(document).off("mouseup",C),$(document).off("mousemove",g),g(t)},v=function(t,e,i){$(document).on("mouseup",_),$(document).on("mousemove",b),b(t)},_=function(t,e,i){$(document).off("mouseup",_),$(document).off("mousemove",b)},y=function(t){var e=new Common.util.RGBColor(c.color).toHSB();m(e,!0)},x=function(t){var m,g=$(c.el);g&&(e=g.find(".cnt-hb-arrow"),i=g.find(".cnt-sat-arrow"),n=g.find(".cnt-hb"),o=g.find(".cnt-sat"),s=g.find(".color-value"),l=g.find(".color-text"),r=g.find(".empty-color"),s.length>0&&(a=s.find(".transparent-color")),n.length>0&&(n.off("mousedown"),n.on("mousedown",f)),o.length>0&&(o.off("mousedown"),o.on("mousedown",v)),r.length>0&&(r.off("click"),r.on("click",y)),m="transparent"==c.color?{h:0,s:100,b:100}:new Common.Utils.RGBColor(c.color).toHSB(),h=m.h,d=m.s,p=m.b,h==d&&h==p&&0==h&&(d=100),u())};c.setColor=function(t){if(c.color!=t){var e;e="transparent"==t?{h:0,s:100,b:100}:new Common.Utils.RGBColor(t).toHSB(),h=e.h,d=e.s,p=e.b,h==d&&h==p&&0==h&&(d=100),c.color=t,u()}},c.getColor=function(){return c.color},c.on("render:after",x),c.render()},render:function(){return $(this.el).html(this.template()),this.trigger("render:after",this),this},textNoColor:"No Color"})}),void 0===Common)var Common={};if(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(t){Common.UI.BaseView.prototype.initialize.call(this,t);var e=this,i=$(this.el);i.addClass("masked-field user-select"),i.attr("maxlength",e.options.maxLength),i.on("keypress",function(t){var n=String.fromCharCode(t.which);e.options.maskExp.test(n)||t.ctrlKey||(t.keyCode==Common.UI.Keys.RETURN&&e.trigger("changed",e,i.val()),t.preventDefault(),t.stopPropagation())}),i.on("input",function(t){e.trigger("change",e,i.val())}),i.on("blur",function(t){e.trigger("changed",e,i.val())})},render:function(){return this},setValue:function(t){this.options.maskExp.test(t)&&t.length<=this.options.maxLength&&$(this.el).val(t)},getValue:function(){$(this.el).val()}})}),void 0===Common)var Common={};if(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(t){"use strict";Common.UI.ExtendedColorDialog=Common.UI.Window.extend(_.extend({tpl:_.template(t),options:{},rendered:!1,initialize:function(t){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,void 0!==this.color&&this.setColor(this.color),this},onChangeColor:function(t,e){this.colorNew.css({"background-color":e}),this.stopevents=!0;var i=e.match(this.hexRe);this.spinR.setValue(parseInt(i[1],16)),this.spinG.setValue(parseInt(i[2],16)),this.spinB.setValue(parseInt(i[3],16)),this.textColor.setValue((i[1]+i[2]+i[3]).toUpperCase()),this.stopevents=!1},showColor:function(t,e){if(!this.stopevents){var i=this.spinR.getNumberValue(),n=null==i||i<0?0:i>255?255:i;e&&this.spinR.setValue(n,!0),n=n.toString(16),i=this.spinG.getNumberValue();var o=null==i||i<0?0:i>255?255:i;e&&this.spinG.setValue(o,!0),o=o.toString(16),i=this.spinB.getNumberValue();var s=null==i||i<0?0:i>255?255:i;e&&this.spinB.setValue(s,!0),s=s.toString(16);var a=(1==n.length?"0"+n:n)+(1==o.length?"0"+o:o)+(1==s.length?"0"+s:s);this.colorsPicker.setColor("#"+a),"hex"!=t&&this.textColor.setValue(a.toUpperCase()),this.colorNew.css("background-color","#"+a)}},onChangingRGB:function(t,e,i,n){if(!this.stopevents){var o,s,a,l;switch(i=_.isEmpty(i)||isNaN(parseInt(i))?parseInt(e.getValue()):parseInt(i),t){case 1:o=(null==i||isNaN(i)||i<0?0:i>255?255:i).toString(16),l=this.spinG.getNumberValue(),s=(null==l||l<0?0:l>255?255:l).toString(16),l=this.spinB.getNumberValue(),a=(null==l||l<0?0:l>255?255:l).toString(16);break;case 2:l=this.spinR.getNumberValue(),o=(null==l||l<0?0:l>255?255:l).toString(16),s=(null==i||isNaN(i)||i<0?0:i>255?255:i).toString(16),l=this.spinB.getNumberValue(),a=(null==l||l<0?0:l>255?255:l).toString(16);break;case 3:l=this.spinR.getNumberValue(),o=(null==l||l<0?0:l>255?255:l).toString(16),l=this.spinG.getNumberValue(),s=(null==l||l<0?0:l>255?255:l).toString(16),a=(null==i||isNaN(i)||i<0?0:i>255?255:i).toString(16)}var r=(1==o.length?"0"+o:o)+(1==s.length?"0"+s:s)+(1==a.length?"0"+a:a);this.colorsPicker.setColor("#"+r),this.textColor.setValue(r.toUpperCase()),this.colorNew.css("background-color","#"+r)}},onChangeMaskedField:function(t,e){e=/^[a-fA-F0-9]{0,6}$/.test(e)?e:"000000",e="000000"+e;var i=e.match(/([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})$/i);this.stopevents=!0,this.spinR.setValue(parseInt(i[1],16)),this.spinG.setValue(parseInt(i[2],16)),this.spinB.setValue(parseInt(i[3],16)),this.stopevents=!1,this.rendered&&this.showColor("hex")},onChangedMaskedField:function(t,e){/^[a-fA-F0-9]{0,6}$/.test(e)&&!_.isEmpty(e)||t.setValue("000000"),this.rendered&&this.showColor("",!0)},getColor:function(){var t=/#?([a-fA-F0-9]{6})/.exec(this.colorsPicker.getColor());return t?t[1]:null},setColor:function(t){var e=this;if(!0!==this.rendered)return void(this.color=t);var i=/#?([a-fA-F0-9]{6})/.test(t)?t:"ff0000";e.colorsPicker.setColor("#"+i),function(){"transparent"==t?e.colorSaved.addClass("color-transparent"):(e.colorSaved.removeClass("color-transparent"),e.colorSaved.css("background-color","#"+t)),e.colorNew.css("background-color","#"+i)}(),e.stopevents=!0;var n=e.hexRe.exec(i);e.spinR.setValue(parseInt(n[1],16)),e.spinG.setValue(parseInt(n[2],16)),e.spinB.setValue(parseInt(n[3],16)),e.textColor.setValue((n[1]+n[2]+n[3]).toUpperCase()),e.stopevents=!1},show:function(){Common.UI.Window.prototype.show.apply(this,arguments);var t=this;_.delay(function(){t.getChild("#extended-text-color").focus()},50)},onPrimary:function(){return this.trigger("onmodalresult",1),this.close(!0),!1},cancelButtonText:"Cancel",addButtonText:"Add",textNew:"New",textCurrent:"Current",textRGBErr:"The entered value is incorrect.
Please enter a numeric value between 0 and 255.",textHexErr:"The entered value is incorrect.
Please enter a value between 000000 and FFFFFF."},Common.UI.ExtendedColorDialog||{}))}),void 0===Common)var Common={};if(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('
<% var me = this; %><% $(colors).each(function(num, item) { %><% if (me.isBlankSeparator(item)) { %>
<% } else if (me.isSeparator(item)) { %>
<% } else if (me.isColor(item)) { %>  <% } else if (me.isTransparent(item)) { %> <% } else if (me.isEffect(item)) { %> <% } else if (me.isCaption(item)) { %>
<%=item%>
<% } %><% }); %>
<% if (me.options.dynamiccolors!==undefined) { %>
<% for (var i=0; i <% } %><% } %>
'),colorRe:/(?:^|\s)color-(.{6})(?:\s|$)/,selectedCls:"selected",initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t);var e=this,i=$(this.el);this.colors=e.options.colors||this.generateColorData(e.options.themecolors,e.options.effects,e.options.standardcolors,e.options.transparent),i.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(),i.closest(".btn-group").on("show.bs.dropdown",_.bind(this.updateCustomColors,this)),i.closest(".dropdown-submenu").on("show.bs.dropdown",_.bind(this.updateCustomColors,this)),i.on("click",_.bind(this.handleClick,this))},render:function(){return $(this.el).html(this.template({colors:this.colors})),this},isBlankSeparator:function(t){return"string"==typeof t&&"-"==t},isSeparator:function(t){return"string"==typeof t&&"--"==t},isColor:function(t){return"string"==typeof t&&/[0-9A-F]{6}/.test(t)},isTransparent:function(t){return"string"==typeof t&&"transparent"==t},isCaption:function(t){return"string"==typeof t&&"-"!=t&&"--"!=t&&!/[0-9A-F]{6}|transparent/.test(t)},isEffect:function(t){return"object"==typeof t&&void 0!==t.effectId},getColor:function(){return this.value},updateCustomColors:function(){var t=$(this.el);if(t){var e=t.find("a."+this.selectedCls),i=e.length>0&&/color-dynamic/.test(e[0].className)?e.attr("color"):void 0;i&&(i=i.toUpperCase(),e.removeClass(this.selectedCls));var n=Common.localStorage.getItem("asc."+Common.localStorage.getId()+".colors.custom");n=n?n.split(","):[];for(var o,s=-1,a=n.lengththis.options.dynamiccolors&&i.shift(),Common.localStorage.setItem(e,i.join().toUpperCase())},addNewColor:function(t){var e=this,i=new Common.UI.ExtendedColorDialog({});i.on("onmodalresult",function(t){e._isdlgopen=!1,1==t&&(e.setCustomColor(i.getColor()),e.fireEvent("select",e,i.getColor()))}),e._isdlgopen=!0,i.setColor(void 0!==e.value&&!1!==e.value?e.value:void 0!==t?t:"000000"),i.show()},isDialogOpen:function(){return 1==this._isdlgopen},select:function(t,e){var i=$(this.el);if(i.find("a."+this.selectedCls).removeClass(this.selectedCls),"object"==typeof t){var n;void 0!==t.effectId?(n=i.find('a[effectid="'+t.effectId+'"]').first(),n.length>0?(n.addClass(this.selectedCls),this.value=n[0].className.match(this.colorRe)[1].toUpperCase()):this.value=!1):void 0!==t.effectValue&&(n=i.find('a[effectvalue="'+t.effectValue+'"].color-'+t.color.toUpperCase()).first(),n.length>0?(n.addClass(this.selectedCls),this.value=n[0].className.match(this.colorRe)[1].toUpperCase()):this.value=!1)}else if(/#?[a-fA-F0-9]{6}/.test(t)&&(t=/#?([a-fA-F0-9]{6})/.exec(t)[1].toUpperCase(),this.value=t),/^[a-fA-F0-9]{6}|transparent$/.test(t)&&_.indexOf(this.colors,t)>=0)_.indexOf(this.colors,this.value)<0&&(this.value=!1),(t!=this.value||this.options.allowReselect)&&("transparent"==t?i.find("a.color-transparent").addClass(this.selectedCls):i.find("a.palette-color.color-"+t).first().addClass(this.selectedCls),this.value=t,!0!==e&&this.fireEvent("select",this,t));else{var o=i.find("#"+t).first();0==o.length&&(o=i.find('a[color="'+t+'"]').first()),o.length>0&&(o.addClass(this.selectedCls),this.value=t.toUpperCase())}},selectByRGB:function(t,e){var i=$(this.el);i.find("a."+this.selectedCls).removeClass(this.selectedCls);var n="object"==typeof t?t.color:t;if(/#?[a-fA-F0-9]{6}/.test(n)&&(n=/#?([a-fA-F0-9]{6})/.exec(n)[1].toUpperCase()),/^[a-fA-F0-9]{6}|transparent$/.test(n)&&(n!=this.value||this.options.allowReselect)){var o="transparent"==n?i.find("a.color-transparent"):i.find("a.color-"+n).first();0==o.length&&(o=i.find("#"+n).first()),0==o.length&&(o=i.find('a[color="'+n+'"]').first()),o.length>0&&(o.addClass(this.selectedCls),this.value=n),!0!==e&&this.fireEvent("select",this,n)}},updateColors:function(t,e,i){if(void 0!==t&&void 0!==e){var n=this,o=$(this.el);void 0===n.aColorElements&&(n.aColorElements=o.find("a.palette-color")),void 0===n.aEffectElements&&(n.aEffectElements=o.find("a.palette-color-effect"));for(var s,a=0,l=0,r=0;r=e.length)continue;s=$(n.aColorElements[a]),s.removeClass("color-"+n.colors[r]),n.colors[r]=e[a].toUpperCase(),s.addClass("color-"+n.colors[r]),s.css({background:"#"+n.colors[r]}),s.find("span").first().css({background:"#"+n.colors[r]}),a++}else if("object"==typeof n.colors[r]&&void 0!==n.colors[r].effectId){if(l>=t.length)continue;s=$(n.aEffectElements[l]),t[l].color=t[l].color.toUpperCase(),n.colors[r].color!==t[l].color&&(s.removeClass("color-"+n.colors[r].color),s.addClass("color-"+t[l].color),s.css({background:"#"+t[l].color}),s.find("span").first().css({background:"#"+t[l].color})),n.colors[r].effectId!==t[l].effectId&&s.attr("effectid",""+t[l].effectId),n.colors[r].effectValue!==t[l].effectValue&&s.attr("effectvalue",""+t[l].effectValue),n.colors[r]=t[l],l++}if(i)this.select(i,!0);else{var c=$(this.el).find("a."+this.selectedCls);c.length&&c.hasClass("palette-color-effect")&&(this.value=c[0].className.match(this.colorRe)[1].toUpperCase())}this.options.updateColorsArr=void 0}},clearSelection:function(t){$(this.el).find("a."+this.selectedCls).removeClass(this.selectedCls),this.value=void 0},generateColorData:function(t,e,i,n){var o=[],s=t>0&&e>0?t*e:0;if(t>0){o=[this.textThemeColors,"-"];for(var a=0;a0&&o.push("-");for(var a=0;a','
0x0
','
','
','
','
',"
","
"].join("")),initialize:function(d){Common.UI.BaseView.prototype.initialize.call(this,d),t=this,e=$(this.el),t.itemSize=t.options.itemSize,t.minRows=t.options.minRows,t.minColumns=t.options.minColumns,t.maxRows=t.options.maxRows,t.maxColumns=t.options.maxColumns,this.render(),e&&(i=e.find(".dimension-picker-mousecatcher"),n=e.find(".dimension-picker-unhighlighted"),o=e.find(".dimension-picker-highlighted"),s=e.find(".dimension-picker-status"),e.css({width:t.minColumns+"em"}),i.css("z-index",1),i.width(t.maxColumns+"em").height(t.maxRows+"em"),n.width(t.minColumns+"em").height(t.minRows+"em"),s.html(a+" x "+l),s.width(n.width())),i.on("mousemove",r),o.on("mousemove",r),n.on("mousemove",r),i.on("mouseleave",c),o.on("mouseleave",c),n.on("mouseleave",c),i.on("click",h),o.on("click",h),n.on("click",h)},render:function(){return $(this.el).html(this.template()),this},setTableSize:function(i,r,c){i>this.maxColumns&&(i=this.maxColumns),r>this.maxRows&&(r=this.maxRows),a==i&&l==r||(a=i,l=r,o.width(a+"em").height(l+"em"),n.width((at.maxColumns?t.maxColumns:a+1)+"em").height((lt.maxRows?t.maxRows:l+1)+"em"),e.width(n.width()),s.html(a+" x "+l),s.width(n.width()),t.trigger("change",t,a,l,c))},getColumnsCount:function(){return a},getRowsCount:function(){return l}}}())}),void 0===Common)var Common={};var FONT_TYPE_RECENT=4;if(define("common/main/lib/component/ComboBoxFonts",["common/main/lib/component/ComboBox"],function(){"use strict";Common.UI.ComboBoxFonts=Common.UI.ComboBox.extend(function(){var t=Asc.FONT_THUMBNAIL_HEIGHT||26,e=window.devicePixelRatio>1,i=document.createElement("canvas"),n=i.getContext("2d"),o="../../../../sdkjs/common/Images/fonts_thumbnail.png?"+window.CP_urlArgs,s="../../../../sdkjs/common/Images/fonts_thumbnail@2x.png?"+window.CP_urlArgs;return"object"==typeof window.AscDesktopEditor&&(o=window.AscDesktopEditor.getFontsSprite(), -s=window.AscDesktopEditor.getFontsSprite(!0)),i.height=e?2*t:t,i.width=e?604:302,{template:_.template(['
',' ','
','','","
"].join("")),initialize:function(t){Common.UI.ComboBox.prototype.initialize.call(this,_.extend(t,{displayField:"name",scroller:{wheelSpeed:20,alwaysVisibleY:!0,onChange:this.updateVisibleFontsTiles.bind(this)}})),this.recent=_.isNumber(t.recent)?t.recent:5;var e=Common.localStorage.getKeysFilter();this.appPrefix=e&&e.length?e.split(",")[0]:"",Common.NotificationCenter.on("fonts:load",_.bind(this.fillFonts,this))},render:function(t){var e=null;return _.isUndefined(this._input)||(e=this._input.val()),Common.UI.ComboBox.prototype.render.call(this,t),this.setRawValue(e),this._input.on("keyup",_.bind(this.onInputKeyUp,this)),this._input.on("keydown",_.bind(this.onInputKeyDown,this)),this._input.on("focus",_.bind(function(){this.inFormControl=!0},this)),this._input.on("blur",_.bind(function(){this.inFormControl=!1},this)),this},onAfterKeydownMenu:function(t){var e=this;return t.keyCode==Common.UI.Keys.RETURN?($(t.target).closest("input").length?this.lastValue!==this._input.val()&&this._input.trigger("change"):($(t.target).click(),this.rendered&&(Common.Utils.isIE?this._input.trigger("change",{onkeydown:!0}):this._input.blur())),!1):t.keyCode==Common.UI.Keys.ESC&&this.isMenuOpen()?(this._input.val(this.lastValue),setTimeout(function(){e.closeMenu(),e.onAfterHideMenu(t)},10),!1):((t.keyCode==Common.UI.Keys.HOME&&!t.shiftKey||t.keyCode==Common.UI.Keys.END&&!t.shiftKey||t.keyCode==Common.UI.Keys.BACKSPACE&&!e._input.is(":focus"))&&this.isMenuOpen()&&(e._input.focus(),setTimeout(function(){e._input[0].selectionStart=e._input[0].selectionEnd=t.keyCode==Common.UI.Keys.HOME?0:e._input[0].value.length},10)),void this.updateVisibleFontsTiles())},onInputKeyUp:function(t){if(t.keyCode!=Common.UI.Keys.RETURN&&t.keyCode!==Common.UI.Keys.SHIFT&&t.keyCode!==Common.UI.Keys.CTRL&&t.keyCode!==Common.UI.Keys.ALT&&t.keyCode!==Common.UI.Keys.LEFT&&t.keyCode!==Common.UI.Keys.RIGHT&&t.keyCode!==Common.UI.Keys.HOME&&t.keyCode!==Common.UI.Keys.END&&t.keyCode!==Common.UI.Keys.ESC&&t.keyCode!==Common.UI.Keys.INSERT&&t.keyCode!==Common.UI.Keys.TAB&&(t.stopPropagation(),this.selectCandidate(t.keyCode==Common.UI.Keys.DELETE||t.keyCode==Common.UI.Keys.BACKSPACE),this._selectedItem)){var e=this;void 0===e._timerSelection&&(e._timerSelection=setInterval(function(){if(!(new Date-e._inInputKeyDown<100)&&e._selectedItem){clearInterval(e._timerSelection),e._timerSelection=void 0;var t=e._input[0],i=e._selectedItem.get(e.displayField),n=t.value;e.rendered&&(document.selection?document.selection.createRange().text=i:(t.selectionStart||"0"==t.selectionStart)&&(t.value=i,t.selectionStart=n.length,t.selectionEnd=i.length))}},10))}},onInputKeyDown:function(t){this._inInputKeyDown=new Date;var e=this;t.keyCode==Common.UI.Keys.ESC?(this._input.val(this.lastValue),setTimeout(function(){e.closeMenu(),e.onAfterHideMenu(t)},10)):t.keyCode!=Common.UI.Keys.RETURN&&t.keyCode!=Common.UI.Keys.CTRL&&t.keyCode!=Common.UI.Keys.SHIFT&&t.keyCode!=Common.UI.Keys.ALT?(this.isMenuOpen()||t.ctrlKey||this.openMenu(),t.keyCode==Common.UI.Keys.UP||t.keyCode==Common.UI.Keys.DOWN?_.delay(function(){var i=t.keyCode==Common.UI.Keys.DOWN?e.cmpEl.find("ul li.selected").nextAll("li:not(.divider)"):e.cmpEl.find("ul li.selected").prevAll("li:not(.divider)");i=i.length>0?i.eq(0):t.keyCode==Common.UI.Keys.DOWN?e.cmpEl.find("ul li:not(.divider):first"):e.cmpEl.find("ul li:not(.divider):last"),i=i.find("a"),e._skipInputChange=!0,i.focus(),e.updateVisibleFontsTiles()},10):e._skipInputChange=!1):t.keyCode==Common.UI.Keys.RETURN&&this._input.val()===e.lastValue&&this._input.trigger("change",{reapply:!0})},onInputChanged:function(t,e){if(!e||!e.synthetic){if(this._skipInputChange)return void(this._skipInputChange=!1);if(this._isMouseDownMenu)return void(this._isMouseDownMenu=!1);var i=$(t.target).val(),n={};if(!(this.lastValue!==i||e&&e.reapply))return void(e&&e.onkeydown&&this.trigger("combo:blur",this,t));n[this.valueField]=i,n[this.displayField]=i,this.trigger("changed:before",this,n,t),t.isDefaultPrevented()||(this._selectedItem?(n[this.valueField]=this._selectedItem.get(this.displayField),this.setRawValue(n[this.valueField]),this.trigger("selected",this,_.extend({},this._selectedItem.toJSON()),t),this.addItemToRecent(this._selectedItem),this.closeMenu()):(this.setRawValue(n[this.valueField]),n.isNewFont=!0,this.trigger("selected",this,n,t),this.closeMenu()),this.trigger("changed:after",this,n,t))}},getImageUri:function(o){if(o.cloneid){var s=$(this.el).find("ul > li#"+o.cloneid+" img");return null!=s?s[0].src:void 0}return e?(n.clearRect(0,0,604,2*t),n.drawImage(this.spriteThumbs,0,2*-Asc.FONT_THUMBNAIL_HEIGHT*o.imgidx)):(n.clearRect(0,0,302,t),n.drawImage(this.spriteThumbs,0,-Asc.FONT_THUMBNAIL_HEIGHT*o.imgidx)),i.toDataURL()},getImageWidth:function(){return 302},getImageHeight:function(){return t},getListItemHeight:function(){return 26},loadSprite:function(t){t&&(this.spriteThumbs=new Image,this.spriteThumbs.onload=t,this.spriteThumbs.src=window.devicePixelRatio>1?s:o)},fillFonts:function(t,e){var i=this;this.loadSprite(function(){if(i.store.set(t.toJSON()),i.rendered=!1,_.isUndefined(i.scroller)||(i.scroller.destroy(),delete i.scroller),i._scrollerIsInited=!1,i.render($(i.el)),i._fontsArray=i.store.toJSON(),i.recent>0){i.store.on("add",i.onInsertItem,i),i.store.on("remove",i.onRemoveItem,i),Common.Utils.InternalSettings.set(i.appPrefix+"-settings-recent-fonts",Common.localStorage.getItem(i.appPrefix+"-settings-recent-fonts"));var e=Common.Utils.InternalSettings.get(i.appPrefix+"-settings-recent-fonts");e=e?e.split(";"):[],e.reverse().forEach(function(t){t&&i.addItemToRecent(i.store.findWhere({name:t}),!0)})}})},onApiChangeFont:function(t){var e=this;setTimeout(function(){e.onApiChangeFontInternal(t)},100)},onApiChangeFontInternal:function(t){if(!this.inFormControl){var e=_.isFunction(t.get_Name)?t.get_Name():t.asc_getName();if(this.getRawValue()!==e){var i=this.store.findWhere({name:e});if($(".selected",$(this.el)).removeClass("selected"),i){this.setRawValue(i.get(this.displayField));var n=$("#"+i.get("id"),$(this.el)),o=$("ul.dropdown-menu",this.cmpEl);n&&o&&(n.addClass("selected"),this.recent<=0&&o.scrollTop(n.offset().top-o.offset().top))}else this.setRawValue(e)}}},itemClicked:function(t){Common.UI.ComboBox.prototype.itemClicked.apply(this,arguments);var e=$(t.target).closest("li"),i=this.store.findWhere({id:e.attr("id")});this.addItemToRecent(i)},onInsertItem:function(t){$(this.el).find("ul").prepend(_.template(['
  • ','',"
  • "].join(""))({item:t.attributes,scope:this}))},onRemoveItem:function(t,e,i){$(this.el).find("ul > li#"+t.id).remove()},onBeforeShowMenu:function(t){if(this.store.length<1)return void t.preventDefault();if(Common.UI.ComboBox.prototype.onBeforeShowMenu.apply(this,arguments),!this.getSelectedRecord()&&this.getRawValue()){var e=this.store.where({name:this.getRawValue()});e&&e.length&&this.selectRecord(e[e.length-1])}},onAfterShowMenu:function(t){this.recent>0?(this.scroller&&!this._scrollerIsInited&&(this.scroller.update(),this._scrollerIsInited=!0),$(this.el).find("ul").scrollTop(0),this.trigger("show:after",this,t),this.flushVisibleFontsTiles(),this.updateVisibleFontsTiles(null,0)):Common.UI.ComboBox.prototype.onAfterShowMenu.apply(this,arguments)},onAfterHideMenu:function(t){this.lastValue!==this._input.val()&&this._input.val(this.lastValue),Common.UI.ComboBox.prototype.onAfterHideMenu.apply(this,arguments)},addItemToRecent:function(t,e){if(!(this.recent<1)){var i=this.store.findWhere({name:t.get("name"),type:FONT_TYPE_RECENT});i&&this.store.remove(i);var n=this.store.where({type:FONT_TYPE_RECENT});n.length0&&s.length>0){o.addClass("selected");var a=o.position().top,l=s.scrollTop();0!=a&&s.scrollTop(l+a)}}},updateVisibleFontsTiles:function(i,n){var o=this,s=0,a=o.store.length,l=0;if(o.tiles||(o.tiles=[]),a!==o.tiles.length)for(s=o.tiles.length;s=0;--t)this.tiles[t]&&(this.tiles[t].parentNode.removeChild(this.tiles[t]),this.tiles[t]=null)}}}())}),void 0===Common)var Common={};if(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,minWidth:-1},template:_.template(['
    ','
    ','
    ',"
    "].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t),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.minWidth=this.options.minWidth,this.fieldPicker=new Common.UI.DataView({cls:"field-picker",allowScrollbar:!1,itemTemplate:_.template(['
    ','','<% if (typeof title !== "undefined") {%>','<%= title %>',"<% } %>","
    "].join(""))}),this.openButton=new Common.UI.Button({cls:"open-menu",menu:new Common.UI.Menu({menuAlign:"tl-tl",offset:[0,3],items:[{template:_.template('')}]})}),null!=this.options.additionalMenuItems&&(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,store:this.store,itemTemplate:_.template(['
    ','','<% if (typeof title !== "undefined") {%>','<%= title %>',"<% } %>","
    "].join(""))}),setInterval(_.bind(this.checkSize,this),500),this.options.el&&this.render()},render:function(t){if(!this.rendered){var e=this;e.trigger("render:before",e),e.cmpEl=$(e.el);var i=e.template({id:e.id,cls:e.cls,style:e.style});t?(e.setElement(t,!1),e.cmpEl=$(i),t.html(e.cmpEl)):e.cmpEl.html(i),e.rootWidth=e.cmpEl.width(),e.rootHeight=e.cmpEl.height(),e.fieldPicker.render($(".view",e.cmpEl)),e.openButton.render($(".button",e.cmpEl)),e.menuPicker.render($(".menu-picker-container",e.cmpEl)),e.openButton.menu.cmpEl&&e.openButton.menu.cmpEl&&(e.openButton.menu.menuAlignEl=e.cmpEl,e.openButton.menu.cmpEl.css("min-width",e.itemWidth),e.openButton.menu.on("show:before",_.bind(e.onBeforeShowMenu,e)),e.openButton.menu.on("show:after",_.bind(e.onAfterShowMenu,e)),e.openButton.cmpEl.on("hide.bs.dropdown",_.bind(e.onBeforeHideMenu,e)),e.openButton.cmpEl.on("hidden.bs.dropdown",_.bind(e.onAfterHideMenu,e))),e.options.hint&&(e.cmpEl.attr("data-toggle","tooltip"),e.cmpEl.tooltip({title:e.options.hint,placement:e.options.hintAnchor||"cursor"})),e.fieldPicker.on("item:select",_.bind(e.onFieldPickerSelect,e)),e.menuPicker.on("item:select",_.bind(e.onMenuPickerSelect,e)),e.fieldPicker.on("item:click",_.bind(e.onFieldPickerClick,e)),e.menuPicker.on("item:click",_.bind(e.onMenuPickerClick,e)),e.fieldPicker.on("item:contextmenu",_.bind(e.onPickerItemContextMenu,e)),e.menuPicker.on("item:contextmenu",_.bind(e.onPickerItemContextMenu,e)),e.fieldPicker.el.addEventListener("contextmenu",_.bind(e.onPickerComboContextMenu,e),!1),e.menuPicker.el.addEventListener("contextmenu",_.bind(e.onPickerComboContextMenu,e),!1),e.onResize(),e.rendered=!0,e.trigger("render:after",e)}return this},checkSize:function(){if(this.cmpEl&&this.cmpEl.is(":visible")){var t=this,e=this.cmpEl.width(),i=this.cmpEl.height();if(e div:not(.grouped-data):not(.ps-scrollbar-x-rail):not(.ps-scrollbar-y-rail)")[0]);a.length>0&&(n.itemMarginLeft=parseInt(a.css("margin-left")),n.itemMarginRight=parseInt(a.css("margin-right")),n.itemPaddingLeft=parseInt(a.css("padding-left")),n.itemPaddingRight=parseInt(a.css("padding-right")),n.itemBorderLeft=parseInt(a.css("border-left-width")),n.itemBorderRight=parseInt(a.css("border-right-width")))}var l=o.indexOf(t);if(l<0)return;var r=o.length,c=Math.floor(Math.max(s.width(),n.minWidth)/(n.itemWidth+(n.itemMarginLeft||0)+(n.itemMarginRight||0)+(n.itemPaddingLeft||0)+(n.itemPaddingRight||0)+(n.itemBorderLeft||0)+(n.itemBorderRight||0))),h=[];s.height()/n.itemHeight>2&&(c*=Math.floor(s.height()/n.itemHeight)),l=Math.floor(l/c)*c,r-l1?t/2:t)},setItemHeight:function(t){this.itemHeight!=t&&(this.itemHeight=window.devicePixelRatio>1?t/2:t)},removeTips:function(){var t=this.menuPicker;_.each(t.dataViewItems,function(t){var e=t.$el.data("bs.tooltip");e&&e.tip().remove()},t)}})}),void 0===Common)var Common={};if(define("common/main/lib/component/SynchronizeTip",["common/main/lib/component/BaseView"],function(){"use strict";Common.UI.SynchronizeTip=Common.UI.BaseView.extend(_.extend(function(){return{options:{target:$(document.body),text:"",placement:"right",showLink:!0},template:_.template(['
    <%= scope.placement %>">','
    ','
    ',"
    ",'
    <%= scope.text %>
    ','
    ',"
    ","<% if ( scope.showLink ) { %>",'',"<% } %>","
    ","
    "].join("")),initialize:function(t){this.textSynchronize+=Common.Utils.String.platformKey("Ctrl+S"),Common.UI.BaseView.prototype.initialize.call(this,t),this.target=this.options.target,this.text=_.isEmpty(this.options.text)?this.textSynchronize:this.options.text,this.textLink=_.isEmpty(this.options.textLink)?this.textDontShow:this.options.textLink,this.placement=this.options.placement,this.showLink=this.options.showLink},render:function(){return this.cmpEl||(this.cmpEl=$(this.template({scope:this})),$(document.body).append(this.cmpEl),this.cmpEl.find(".close").on("click",_.bind(function(){this.trigger("closeclick")},this)),this.cmpEl.find(".show-link label").on("click",_.bind(function(){this.trigger("dontshowclick")},this))),this.applyPlacement(),this},show:function(){this.cmpEl?(this.applyPlacement(),this.cmpEl.show()):this.render()},hide:function(){this.cmpEl&&this.cmpEl.hide()},close:function(){this.cmpEl&&this.cmpEl.remove()},applyPlacement:function(){var t=this.target.offset(),e=Common.Utils.innerHeight();if("top"==this.placement)this.cmpEl.css({bottom:e-t.top+"px",right:Common.Utils.innerWidth()-t.left-this.target.width()/2+"px"});else{var i=t.top+this.target.height()/2,n=this.cmpEl.height();i+n>e&&(i=e-n),"left"==this.placement?this.cmpEl.css({top:i+"px",right:Common.Utils.innerWidth()-t.left-5+"px"}):this.cmpEl.css({top:i+"px",left:t.left+this.target.width()+"px"})}},isVisible:function(){return this.cmpEl&&this.cmpEl.is(":visible")},textDontShow:"Don't show this message again",textSynchronize:"The document has been changed by another user.
    Please click to save your changes and reload the updates."}}(),Common.UI.SynchronizeTip||{}))}),define("common/main/lib/component/Mixtbar",["backbone","common/main/lib/component/BaseView"],function(t){"use strict";Common.UI.Mixtbar=Common.UI.BaseView.extend(function(){function t(t){this.fireEvent("change:compact",[$(t.target).data("tab")])}function e(t){this.isFolded&&($(t.target).parents(".toolbar, #file-menu-panel").length||this.collapse())}var i,n,o={timeout:2e3},s={},a=function(t,e){var n=i.scrollLeft();(n||"right"==t)&&i.animate({scrollLeft:"left"==t?n-100:n+100},200)};return{$tabs:void 0,$panels:void 0,isFolded:!1,initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t);this.$layout=$(t.template({tabsmarkup:_.template('
      <% for(var i in items) { %>
    • <% if (items[i].extcls) print(\' \' + items[i].extcls) %>"><%= items[i].caption %>
    • <% } %>
    ')({items:t.tabs})})),s.tabs=t.tabs,$(document.body).on("click",e.bind(this)),Common.NotificationCenter.on("tab:visible",_.bind(function(t,e){this.setVisible(t,e)},this))},afterRender:function(){var e=this;i=e.$(".tabs > ul"),e.$tabs=i.find("> li"),e.$panels=e.$(".box-panels > .panel"),o.$bar=e.$(".toolbar");var s=e.$(".tabs .scroll.right");n=e.$(".tabs .scroll.left"),n.on("click",a.bind(this,"left")),s.on("click",a.bind(this,"right")),i.on("dblclick","> .ribtab",t.bind(this)),i.on("click","> .ribtab",e.onTabClick.bind(this))},isTabActive:function(t){var e=this.$tabs.filter(".active").find("> a");return e.length&&e.data("tab")==t},setFolded:function(t){this.isFolded=t;var e=this;if(this.isFolded)o.$box||(o.$box=e.$el.find(".box-controls")),o.$bar.addClass("folded z-clear").toggleClass("expanded",!1),o.$bar.find(".tabs .ribtab").removeClass("active"),o.$bar.on($.support.transition.end,function(t){o.$bar.hasClass("folded")&&!o.$bar.hasClass("expanded")&&o.$bar.toggleClass("z-clear",!0)}),o.$box.on({mouseleave:function(t){},mouseenter:function(t){}});else{o.$bar.removeClass("folded z-clear"),o.$box.off();var i=o.$box.find(".panel.active");if(i.length){var n=i.data("tab");e.$tabs.find("> a[data-tab="+n+"]").parent().toggleClass("active",!0)}else n=e.$tabs.siblings(":not(.x-lone):visible").first().find("> a[data-tab]").data("tab"),e.setTab(n)}},collapse:function(){Common.UI.Menu.Manager.hideAll(),this.isFolded&&o.$bar&&(o.$bar.removeClass("expanded"),o.$bar.find(".tabs .ribtab").removeClass("active"))},expand:function(){o.$bar.removeClass("z-clear"),o.$bar.addClass("expanded")},onResize:function(t){this.hasTabInvisible()?i.parent().hasClass("short")||i.parent().addClass("short"):i.parent().hasClass("short")&&i.parent().removeClass("short"),this.processPanelVisible()},onTabClick:function(t){var e=this,i=$(t.currentTarget),n=i.find("> a[data-tab]").data("tab"),o=i.hasClass("x-lone");e.isFolded?i.hasClass("x-lone")?e.collapse():i.hasClass("active")?e.collapse():(e.setTab(n),e.processPanelVisible(null,!0)):i.hasClass("active")||o||(e.setTab(n),e.processPanelVisible(null,!0))},setTab:function(t){var e=this;if(t||(this.isFolded?this.collapse():t=this.lastPanel),t){e.$tabs.removeClass("active"),e.$panels.removeClass("active");var i=this.$panels.filter("[data-tab="+t+"]");i.length&&(this.lastPanel=t,i.addClass("active")),i.length?e.isFolded&&e.expand():e.isFolded&&e.collapse();var n=this.$tabs.find("> a[data-tab="+t+"]").parent();n.length&&n.addClass("active"),this.fireEvent("tab:active",[t])}},addTab:function(t,e,n){function o(t){return s.tabs[t]?s.tabs[t].action:o(--t)}var a=_.template('');s.tabs[n+1]=t;var l=o(n),r=this.$tabs||this.$layout.find(".tabs"),c=r.find("a[data-tab="+l+"]");c.length&&(c.parent().after(a(t)),e&&(r=this.$panels||this.$layout.find(".box-panels > .panel"),c=r.filter("[data-tab="+l+"]"),c.length?c.after(e):e.appendTo(this.$layout.find(".box-panels"))),this.$tabs&&(this.$tabs=i.find("> li")),this.$panels&&(this.$panels=this.$el.find(".box-panels > .panel")))},isCompact:function(){return this.isFolded},hasTabInvisible:function(){if(i.length<1)return!1;var t=Math.round(i.offset().left),e=Math.round(t+i.width()),n=this.$tabs.filter(":visible:first").get(0);if(!n)return!1;var o=n.getBoundingClientRect();return Math.round(o.left)e)},processPanelVisible:function(t,e){function i(){var e=t||n.$panels.filter(".active");if(e&&e.length){var i=e.parents(".box-controls").width(),o=e.data(),s=o.rightedge;s||(s=e.get(0).getBoundingClientRect().right),s>i?e.hasClass("compactwidth")||(e.addClass("compactwidth"),o.rightedge=s):e.hasClass("compactwidth")&&e.removeClass("compactwidth")}}var n=this;n._timer_id&&clearTimeout(n._timer_id),!0===e?i():n._timer_id=setTimeout(function(){delete n._timer_id,i()},100)},setExtra:function(t,e){e&&(this.$tabs||("right"==t?this.$layout.find(".extra.right").html(e):"left"==t&&this.$layout.find(".extra.left").html(e)))},setVisible:function(t,e){t&&this.$tabs&&this.$tabs.find("> a[data-tab="+t+"]").parent().css("display",e?"":"none")}}}())}),define("spreadsheeteditor/main/app/view/Toolbar",["backbone","text!spreadsheeteditor/main/app/template/Toolbar.template","text!spreadsheeteditor/main/app/template/ToolbarAnother.template","text!spreadsheeteditor/main/app/template/ToolbarView.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","common/main/lib/component/Mixtbar"],function(t,e,i,n){"use strict";SSE.enumLock={editCell:"cell-editing",editFormula:"is-formula",editText:"is-text",editPivot:"is-pivot",selImage:"sel-image",selShape:"sel-shape",selShapeText:"sel-shape-txt",selChart:"sel-chart",selChartText:"sel-chart-txt",selRange:"sel-range",selRangeEdit:"sel-range-edit",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",commentLock:"can-comment",cantModifyFilter:"cant-filter",disableOnStart:"on-start",cantGroup:"cant-group",cantGroupUngroup:"cant-group-ungroup",docPropsLock:"doc-props-lock",printAreaLock:"print-area-lock",namedRangeLock:"named-range-lock",multiselectCols:"is-multiselect-cols",headerLock:"header-lock",sheetLock:"sheet-lock"},SSE.Views.Toolbar=Common.UI.Mixtbar.extend(_.extend({el:"#toolbar",template:_.template(e),events:{},initialize:function(){var t=this;return t.SchemeNames=[t.txtScheme1,t.txtScheme2,t.txtScheme3,t.txtScheme4,t.txtScheme5,t.txtScheme6,t.txtScheme7,t.txtScheme8,t.txtScheme9,t.txtScheme10,t.txtScheme11,t.txtScheme12,t.txtScheme13,t.txtScheme14,t.txtScheme15,t.txtScheme16,t.txtScheme17,t.txtScheme18,t.txtScheme19,t.txtScheme20,t.txtScheme21],t._state={hasCollaborativeChanges:void 0},t.btnSaveCls="btn-save",t.btnSaveTip=this.tipSave+Common.Utils.String.platformKey("Ctrl+S"),t.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:"@"},t.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"}],this},lockToolbar:function(t,e,i){Common.Utils.lockControls(t,e,i,this.lockControls)},applyLayout:function(t){function o(){return{isDummy:!0,on:function(){}}}var s=this,a=SSE.enumLock;if(s.btnCopy=new Common.UI.Button({id:"id-toolbar-btn-copy",cls:"btn-toolbar",iconCls:"btn-copy"}),s.btnPaste=new Common.UI.Button({id:"id-toolbar-btn-paste",cls:"btn-toolbar",iconCls:"btn-paste",lock:[a.coAuth,a.lostConnect]}),s.btnUndo=new Common.UI.Button({id:"id-toolbar-btn-undo",cls:"btn-toolbar",iconCls:"btn-undo",disabled:!0,lock:[a.lostConnect],signals:["disabled"]}),s.btnRedo=new Common.UI.Button({id:"id-toolbar-btn-redo",cls:"btn-toolbar",iconCls:"btn-redo",disabled:!0,lock:[a.lostConnect],signals:["disabled"]}),t.isEditDiagram){s.$layout=$(_.template(i)(t)),s.btnInsertFormula=new Common.UI.Button({id:"id-toolbar-btn-insertformula",cls:"btn-toolbar",iconCls:"btn-formula",split:!0,lock:[a.editText,a.selChart,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.selRangeEdit,a.lostConnect,a.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:s.txtAdditional,value:"more"}]})}),s.btnDecDecimal=new Common.UI.Button({id:"id-toolbar-btn-decdecimal",cls:"btn-toolbar",iconCls:"btn-decdecimal",lock:[a.editCell,a.selChart,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.lostConnect,a.coAuth]}),s.btnIncDecimal=new Common.UI.Button({id:"id-toolbar-btn-incdecimal",cls:"btn-toolbar",iconCls:"btn-incdecimal",lock:[a.editCell,a.selChart,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.lostConnect,a.coAuth]});var l=_.template(["<% _.each(items, function(item) { %>",'
  • ','
    <%= scope.getDisplayValue(item) %>
    ','
    <%= item.exampleval ? item.exampleval : "" %>
    ',"
  • ","<% }); %>",'
  • ','
  • '+s.textMoreFormats+"
  • "].join(""));s.cmbNumberFormat=new Common.UI.ComboBox({cls:"input-group-nr",menuStyle:"min-width: 180px;",hint:s.tipNumFormat,lock:[a.editCell,a.selChart,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.selRangeEdit,a.lostConnect,a.coAuth],itemsTemplate:l,editable:!1,data:s.numFormatData}),s.btnEditChart=new Common.UI.Button({id:"id-toolbar-rtn-edit-chart",cls:"btn-toolbar btn-text-value",caption:s.tipEditChart,lock:[a.lostConnect],style:"width: 120px;"})}else if(t.isEditMailMerge)s.$layout=$(_.template(i)(t)),s.btnSearch=new Common.UI.Button({id:"id-toolbar-btn-search",cls:"btn-toolbar",iconCls:"btn-search",lock:[a.lostConnect]}),s.btnSortDown=new Common.UI.Button({id:"id-toolbar-btn-sort-down",cls:"btn-toolbar",iconCls:"btn-sort-down",lock:[a.editCell,a.selChart,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.lostConnect,a.coAuth,a.ruleFilter,a.editPivot]}),s.btnSortUp=new Common.UI.Button({id:"id-toolbar-btn-sort-up",cls:"btn-toolbar",iconCls:"btn-sort-up",lock:[a.editCell,a.selChart,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.lostConnect,a.coAuth,a.ruleFilter,a.editPivot]}),s.btnSetAutofilter=new Common.UI.Button({id:"id-toolbar-btn-setautofilter",cls:"btn-toolbar",iconCls:"btn-autofilter",lock:[a.editCell,a.selChart,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.lostConnect,a.coAuth,a.ruleFilter,a.editPivot],enableToggle:!0}),s.btnClearAutofilter=new Common.UI.Button({id:"id-toolbar-btn-clearfilter",cls:"btn-toolbar",iconCls:"btn-clear-filter",lock:[a.editCell,a.selChart,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.lostConnect,a.coAuth,a.ruleDelFilter,a.editPivot]});else if(t.isEdit){Common.UI.Mixtbar.prototype.initialize.call(this,{template:_.template(e),tabs:[{caption:s.textTabFile,action:"file",extcls:"canedit",haspanel:!1},{caption:s.textTabHome,action:"home",extcls:"canedit"},{caption:s.textTabInsert,action:"ins",extcls:"canedit"},{caption:s.textTabLayout,action:"layout",extcls:"canedit"},{caption:s.textTabFormula,action:"formula",extcls:"canedit"},{caption:s.textTabData,action:"data",extcls:"canedit"}]}),s.cmbFontSize=new Common.UI.ComboBox({cls:"input-group-nr",menuStyle:"min-width: 55px;",hint:s.tipFontSize,lock:[a.selImage,a.editFormula,a.selRangeEdit,a.coAuth,a.coAuthText,a.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"},{value:96,displayValue:"96"}]}),s.cmbFontName=new Common.UI.ComboBoxFonts({cls:"input-group-nr",menuCls:"scrollable-menu",menuStyle:"min-width: 325px;",hint:s.tipFontName,lock:[a.selImage,a.editFormula,a.selRangeEdit,a.coAuth,a.coAuthText,a.lostConnect],store:new Common.Collections.Fonts}),s.btnPrint=new Common.UI.Button({id:"id-toolbar-btn-print",cls:"btn-toolbar",iconCls:"btn-print no-mask",lock:[a.editCell,a.cantPrint,a.disableOnStart],signals:["disabled"]}),s.btnSave=new Common.UI.Button({id:"id-toolbar-btn-save",cls:"btn-toolbar",iconCls:"no-mask "+s.btnSaveCls,signals:["disabled"]}),s.btnCollabChanges=s.btnSave,s.btnIncFontSize=new Common.UI.Button({id:"id-toolbar-btn-incfont",cls:"btn-toolbar",iconCls:"btn-incfont",lock:[a.selImage,a.editFormula,a.selRangeEdit,a.coAuth,a.coAuthText,a.lostConnect]}),s.btnDecFontSize=new Common.UI.Button({id:"id-toolbar-btn-decfont",cls:"btn-toolbar",iconCls:"btn-decfont",lock:[a.selImage,a.editFormula,a.selRangeEdit,a.coAuth,a.coAuthText,a.lostConnect]}),s.btnBold=new Common.UI.Button({id:"id-toolbar-btn-bold",cls:"btn-toolbar",iconCls:"btn-bold",lock:[a.selImage,a.editFormula,a.selRangeEdit,a.coAuth,a.coAuthText,a.lostConnect],enableToggle:!0}),s.btnItalic=new Common.UI.Button({id:"id-toolbar-btn-italic",cls:"btn-toolbar",iconCls:"btn-italic",lock:[a.selImage,a.editFormula,a.selRangeEdit,a.coAuth,a.coAuthText,a.lostConnect],enableToggle:!0}),s.btnUnderline=new Common.UI.Button({id:"id-toolbar-btn-underline",cls:"btn-toolbar",iconCls:"btn-underline",lock:[a.selImage,a.editFormula,a.selRangeEdit,a.coAuth,a.coAuthText,a.lostConnect],enableToggle:!0}),s.btnStrikeout=new Common.UI.Button({id:"id-toolbar-btn-strikeout",cls:"btn-toolbar",iconCls:"btn-strikeout",lock:[a.selImage,a.editFormula,a.selRangeEdit,a.coAuth,a.coAuthText,a.lostConnect],enableToggle:!0}),s.btnSubscript=new Common.UI.Button({id:"id-toolbar-btn-subscript",cls:"btn-toolbar",iconCls:"btn-subscript",icls:"btn-subscript",split:!0,enableToggle:!0,lock:[a.selImage,a.editFormula,a.selRangeEdit,a.coAuth,a.coAuthText,a.lostConnect],menu:new Common.UI.Menu({items:[{caption:s.textSuperscript,iconCls:"mnu-text-superscript",icls:"btn-superscript",checkable:!0,allowDepress:!0,toggleGroup:"textsubscriptgroup",value:"super"},{caption:s.textSubscript,iconCls:"mnu-text-subscript",icls:"btn-subscript",checkable:!0,allowDepress:!0,toggleGroup:"textsubscriptgroup",value:"sub"}]})}),s.mnuTextColorPicker=o(),s.btnTextColor=new Common.UI.Button({id:"id-toolbar-btn-fontcolor",cls:"btn-toolbar",iconCls:"btn-fontcolor",split:!0,lock:[a.selImage,a.editFormula,a.selRangeEdit,a.coAuth,a.coAuthText,a.lostConnect],menu:new Common.UI.Menu({items:[{template:_.template('
    ')},{template:_.template(''+s.textNewColor+"")}]})}),s.mnuBackColorPicker=o(),s.btnBackColor=new Common.UI.Button({id:"id-toolbar-btn-fillparag",cls:"btn-toolbar",iconCls:"btn-fillparag",split:!0,lock:[a.selImage,a.editCell,a.coAuth,a.coAuthText,a.lostConnect],menu:new Common.UI.Menu({items:[{template:_.template('
    ')},{template:_.template(''+s.textNewColor+"")}]})}),s.btnBorders=new Common.UI.Button({id:"id-toolbar-btn-borders",cls:"btn-toolbar",iconCls:"btn-border-out",icls:"btn-border-out",borderId:"outer",borderswidth:Asc.c_oAscBorderStyles.Thin,lock:[a.editCell,a.selChart,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.lostConnect,a.coAuth],split:!0,menu:!0}),s.btnAlignLeft=new Common.UI.Button({id:"id-toolbar-btn-align-left",cls:"btn-toolbar",iconCls:"btn-align-left",enableToggle:!0,lock:[a.editCell,a.selChart,a.selChartText,a.selImage,a.lostConnect,a.coAuth,a.coAuthText],toggleGroup:"alignGroup"}),s.btnAlignCenter=new Common.UI.Button({id:"id-toolbar-btn-align-center",cls:"btn-toolbar",iconCls:"btn-align-center",enableToggle:!0,lock:[a.editCell,a.selChart,a.selChartText,a.selImage,a.lostConnect,a.coAuth,a.coAuthText],toggleGroup:"alignGroup"}),s.btnAlignRight=new Common.UI.Button({id:"id-toolbar-btn-align-right",cls:"btn-toolbar",iconCls:"btn-align-right",enableToggle:!0,lock:[a.editCell,a.selChart,a.selChartText,a.selImage,a.lostConnect,a.coAuth,a.coAuthText],toggleGroup:"alignGroup"}),s.btnAlignJust=new Common.UI.Button({id:"id-toolbar-btn-align-just",cls:"btn-toolbar",iconCls:"btn-align-just",enableToggle:!0,lock:[a.editCell,a.selChart,a.selChartText,a.selImage,a.lostConnect,a.coAuth,a.coAuthText],toggleGroup:"alignGroup"}),s.btnMerge=new Common.UI.Button({id:"id-toolbar-rtn-merge",cls:"btn-toolbar",iconCls:"btn-merge",enableToggle:!0,allowDepress:!0,split:!0,lock:[a.editCell,a.selShape,a.selShapeText,a.selChart,a.selChartText,a.selImage,a.lostConnect,a.coAuth,a.ruleMerge,a.editPivot],menu:new Common.UI.Menu({items:[{caption:s.txtMergeCenter,value:Asc.c_oAscMergeOptions.MergeCenter},{caption:s.txtMergeAcross,value:Asc.c_oAscMergeOptions.MergeAcross},{caption:s.txtMergeCells,value:Asc.c_oAscMergeOptions.Merge},{caption:s.txtUnmerge,value:Asc.c_oAscMergeOptions.None}]})}),s.btnAlignTop=new Common.UI.Button({id:"id-toolbar-rtn-valign-top",cls:"btn-toolbar",iconCls:"btn-valign-top",lock:[a.editCell,a.selChart,a.selChartText,a.selImage,a.lostConnect,a.coAuth,a.coAuthText],enableToggle:!0,toggleGroup:"vAlignGroup"}),s.btnAlignMiddle=new Common.UI.Button({id:"id-toolbar-rtn-valign-middle",cls:"btn-toolbar",iconCls:"btn-valign-middle",enableToggle:!0,lock:[a.editCell,a.selChart,a.selChartText,a.selImage,a.lostConnect,a.coAuth,a.coAuthText],toggleGroup:"vAlignGroup"}),s.btnAlignBottom=new Common.UI.Button({id:"id-toolbar-rtn-valign-bottom",cls:"btn-toolbar",iconCls:"btn-valign-bottom",lock:[a.editCell,a.selChart,a.selChartText,a.selImage,a.lostConnect,a.coAuth,a.coAuthText],enableToggle:!0,toggleGroup:"vAlignGroup"}),s.btnWrap=new Common.UI.Button({id:"id-toolbar-rtn-wrap",cls:"btn-toolbar",iconCls:"btn-wrap",lock:[a.editCell,a.selChart,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.lostConnect,a.coAuth],enableToggle:!0,allowDepress:!0}),s.btnTextOrient=new Common.UI.Button({id:"id-toolbar-rtn-textorient",cls:"btn-toolbar",iconCls:"btn-text-orient",lock:[a.editCell,a.selChart,a.selChartText,a.selShape,a.selImage,a.lostConnect,a.coAuth,a.coAuthText],menu:new Common.UI.Menu({items:[{caption:s.textHorizontal,iconCls:"mnu-direct-horiz",checkable:!0,toggleGroup:"textorientgroup",value:"horiz"},{caption:s.textCounterCw,iconCls:"mnu-direct-ccw",checkable:!0,toggleGroup:"textorientgroup",value:"countcw"},{caption:s.textClockwise,iconCls:"mnu-direct-cw",checkable:!0,toggleGroup:"textorientgroup",value:"clockwise"},{caption:s.textRotateUp,iconCls:"mnu-direct-rup",checkable:!0,toggleGroup:"textorientgroup",value:"rotateup"},{caption:s.textRotateDown,iconCls:"mnu-direct-rdown",checkable:!0,toggleGroup:"textorientgroup",value:"rotatedown"}]})}),s.btnInsertImage=new Common.UI.Button({id:"tlbtn-insertimage",cls:"btn-toolbar x-huge icon-top",iconCls:"btn-insertimage",caption:s.capInsertImage,lock:[a.editCell,a.selChartText,a.selImage,a.lostConnect,a.coAuth],menu:new Common.UI.Menu({items:[{caption:s.mniImageFromFile,value:"file"},{caption:s.mniImageFromUrl,value:"url"},{caption:s.mniImageFromStorage,value:"storage"}]})}),s.btnInsertHyperlink=new Common.UI.Button({id:"tlbtn-insertlink",cls:"btn-toolbar x-huge icon-top",iconCls:"btn-inserthyperlink",caption:s.capInsertHyperlink,lock:[a.editCell,a.selChart,a.selChartText,a.selImage,a.selShape,a.cantHyperlink,a.multiselect,a.lostConnect,a.coAuth,a.editPivot]}),s.btnInsertChart=new Common.UI.Button({id:"tlbtn-insertchart",cls:"btn-toolbar x-huge icon-top",iconCls:"btn-insertchart",lock:[a.editCell,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.lostConnect,a.coAuth,a.coAuthText],caption:s.capInsertChart,menu:new Common.UI.Menu({style:"width: 435px;",items:[{template:_.template('')}]})}),s.btnInsertShape=new Common.UI.Button({id:"tlbtn-insertshape",cls:"btn-toolbar x-huge icon-top",iconCls:"btn-insertshape",enableToggle:!0,caption:s.capInsertShape,lock:[a.editCell,a.selChartText,a.selImage,a.lostConnect,a.coAuth],menu:new Common.UI.Menu({cls:"menu-shapes"})}),s.btnInsertText=new Common.UI.Button({id:"tlbtn-inserttext",cls:"btn-toolbar x-huge icon-top",iconCls:"btn-text",caption:s.capInsertText,lock:[a.editCell,a.selChartText,a.selImage,a.lostConnect,a.coAuth],enableToggle:!0}),s.btnInsertTextArt=new Common.UI.Button({id:"tlbtn-inserttextart",cls:"btn-toolbar x-huge icon-top",iconCls:"btn-textart",caption:s.capInsertTextart,lock:[a.editCell,a.selChartText,a.selImage,a.lostConnect,a.coAuth],menu:new Common.UI.Menu({cls:"menu-shapes",items:[{template:_.template('
    ')}]})}),s.btnInsertEquation=new Common.UI.Button({id:"tlbtn-insertequation",cls:"btn-toolbar x-huge icon-top",iconCls:"btn-insertequation",caption:s.capInsertEquation,split:!0,lock:[a.editCell,a.selChartText,a.selImage,a.lostConnect,a.coAuth],menu:new Common.UI.Menu({cls:"menu-shapes"})}),s.btnTableTemplate=new Common.UI.Button({id:"id-toolbar-btn-ttempl",cls:"btn-toolbar",iconCls:"btn-ttempl",lock:[a.editCell,a.selChart,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.lostConnect,a.coAuth,a.ruleFilter,a.multiselect,a.cantModifyFilter],menu:new Common.UI.Menu({items:[{template:_.template('
    ')}]})}),s.btnInsertTable=new Common.UI.Button({id:"tlbtn-inserttable",cls:"btn-toolbar x-huge icon-top",iconCls:"btn-inserttable",caption:s.capInsertTable,lock:[a.editCell,a.selChart,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.lostConnect,a.coAuth,a.ruleFilter,a.multiselect,a.cantModifyFilter,a.ruleMerge,a.editPivot]}),s.listStyles=new Common.UI.ComboDataView({cls:"combo-styles",enableKeyEvents:!0,itemWidth:112,itemHeight:38,menuMaxHeight:226,lock:[a.editCell,a.selChart,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.lostConnect,a.coAuth],beforeOpenHandler:function(t){var e=this,i=e.openButton.menu;if(i.cmpEl){var n=$(e.cmpEl.find(".dataview.inner .style").get(0)).parent(),o=n.is(":visible")?parseInt(n.css("width")):e.itemWidth+parseInt(n.css("padding-left"))+parseInt(n.css("padding-right"))+parseInt(n.css("border-left-width"))+parseInt(n.css("border-right-width")),s=e.menuPicker.store.length>=6?6:e.menuPicker.store.length,a=Math.min(e.menuPicker.store.length,Math.round($(".dataview",$(e.fieldPicker.el)).width()/(-1+o)+.5));a=a",'
  • ','
    <%= scope.getDisplayValue(item) %>
    ','
    <%= item.exampleval ? item.exampleval : "" %>
    ',"
  • ","<% }); %>",'
  • ','
  • '+s.textMoreFormats+"
  • "].join(""));s.cmbNumberFormat=new Common.UI.ComboBox({cls:"input-group-nr",menuStyle:"min-width: 180px;",hint:s.tipNumFormat,lock:[a.editCell,a.selChart,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.selRangeEdit,a.lostConnect,a.coAuth],itemsTemplate:l,editable:!1,data:s.numFormatData}),s.btnPercentStyle=new Common.UI.Button({id:"id-toolbar-btn-percent-style",cls:"btn-toolbar",iconCls:"btn-percent-style",lock:[a.editCell,a.selChart,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.lostConnect,a.coAuth],styleName:"Percent"}),s.btnCurrencyStyle=new Common.UI.Button({id:"id-toolbar-btn-accounting-style",cls:"btn-toolbar",iconCls:"btn-currency-style",lock:[a.editCell,a.selChart,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.lostConnect,a.coAuth],styleName:"Currency",split:!0,menu:new Common.UI.Menu({style:"min-width: 120px;",items:[{caption:s.txtDollar,value:1033},{caption:s.txtEuro,value:1031},{caption:s.txtPound,value:2057},{caption:s.txtRouble,value:1049},{caption:s.txtYen,value:1041},{caption:"--"},{caption:s.textMoreFormats,value:-1}]})}),s.btnDecDecimal=new Common.UI.Button({id:"id-toolbar-btn-decdecimal",cls:"btn-toolbar",iconCls:"btn-decdecimal",lock:[a.editCell,a.selChart,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.lostConnect,a.coAuth]}),s.btnIncDecimal=new Common.UI.Button({id:"id-toolbar-btn-incdecimal",cls:"btn-toolbar",iconCls:"btn-incdecimal",lock:[a.editCell,a.selChart,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.lostConnect,a.coAuth]}),s.btnInsertFormula=new Common.UI.Button({id:"id-toolbar-btn-insertformula",cls:"btn-toolbar",iconCls:"btn-formula",split:!0,lock:[a.editText,a.selChart,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.selRangeEdit,a.lostConnect,a.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:s.txtAdditional,value:"more"}]})}),s.btnNamedRange=new Common.UI.Button({id:"id-toolbar-btn-insertrange",cls:"btn-toolbar",iconCls:"btn-named-range",lock:[a.selChart,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.lostConnect,a.coAuth,a.selRangeEdit],menu:new Common.UI.Menu({style:"min-width: 110px",items:[{caption:s.txtManageRange,lock:[a.editCell],value:"manage"},{caption:s.txtNewRange,lock:[a.editCell],value:"new"},{caption:s.txtPasteRange,value:"paste"}]})}),s.btnClearStyle=new Common.UI.Button({id:"id-toolbar-btn-clear",cls:"btn-toolbar",iconCls:"btn-clearstyle",lock:[a.lostConnect,a.coAuth,a.selRangeEdit],menu:new Common.UI.Menu({style:"min-width: 110px",items:[{caption:s.txtClearAll,lock:[a.cantModifyFilter],value:Asc.c_oAscCleanOptions.All},{caption:s.txtClearText,lock:[a.editCell,a.selChart,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.coAuth],value:Asc.c_oAscCleanOptions.Text},{caption:s.txtClearFormat,lock:[a.editCell,a.selChart,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.coAuth,a.cantModifyFilter],value:Asc.c_oAscCleanOptions.Format},{caption:s.txtClearComments,lock:[a.editCell,a.selChart,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.coAuth],value:Asc.c_oAscCleanOptions.Comments},{caption:s.txtClearHyper,lock:[a.editCell,a.selChart,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.coAuth],value:Asc.c_oAscCleanOptions.Hyperlinks}]})}),s.btnCopyStyle=new Common.UI.Button({id:"id-toolbar-btn-copystyle",cls:"btn-toolbar",iconCls:"btn-copystyle",lock:[a.editCell,a.lostConnect,a.coAuth,a.selChart],enableToggle:!0}),s.btnAddCell=new Common.UI.Button({id:"id-toolbar-btn-addcell",cls:"btn-toolbar",iconCls:"btn-addcell",lock:[a.editCell,a.selChart,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.lostConnect,a.coAuth],menu:new Common.UI.Menu({items:[{caption:s.textInsRight,value:Asc.c_oAscInsertOptions.InsertCellsAndShiftRight},{caption:s.textInsDown,value:Asc.c_oAscInsertOptions.InsertCellsAndShiftDown},{caption:s.textEntireRow,value:Asc.c_oAscInsertOptions.InsertRows},{caption:s.textEntireCol,value:Asc.c_oAscInsertOptions.InsertColumns}]})}),s.btnDeleteCell=new Common.UI.Button({id:"id-toolbar-btn-delcell",cls:"btn-toolbar",iconCls:"btn-delcell",lock:[a.editCell,a.selChart,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.lostConnect,a.coAuth],menu:new Common.UI.Menu({items:[{caption:s.textDelLeft,value:Asc.c_oAscDeleteOptions.DeleteCellsAndShiftLeft},{caption:s.textDelUp,value:Asc.c_oAscDeleteOptions.DeleteCellsAndShiftTop},{caption:s.textEntireRow,value:Asc.c_oAscDeleteOptions.DeleteRows},{caption:s.textEntireCol,value:Asc.c_oAscDeleteOptions.DeleteColumns}]})}),s.btnColorSchemas=new Common.UI.Button({id:"id-toolbar-btn-colorschemas",cls:"btn-toolbar",iconCls:"btn-colorschemas",lock:[a.editCell,a.lostConnect,a.coAuth],menu:new Common.UI.Menu({items:[],restoreHeight:!0})}),s.btnHorizontalAlign=new Common.UI.Button({id:"id-toolbar-btn-halign",cls:"btn-toolbar",iconCls:"btn-align-left",icls:"btn-align-left",lock:[a.editCell,a.selChart,a.selChartText,a.lostConnect,a.coAuth,a.coAuthText],menu:new Common.UI.Menu({items:[{caption:s.tipAlignLeft,iconCls:"mnu-align-left",icls:"btn-align-left",checkable:!0,allowDepress:!0,toggleGroup:"halignGroup",checked:!0,value:AscCommon.align_Left},{caption:s.tipAlignCenter,iconCls:"mnu-align-center",icls:"btn-align-center",checkable:!0,allowDepress:!0,toggleGroup:"halignGroup",value:AscCommon.align_Center},{caption:s.tipAlignRight,iconCls:"mnu-align-right",icls:"btn-align-right",checkable:!0,allowDepress:!0,toggleGroup:"halignGroup",value:AscCommon.align_Right},{caption:s.tipAlignJust,iconCls:"mnu-align-just",icls:"btn-align-just",checkable:!0,allowDepress:!0,toggleGroup:"halignGroup",value:AscCommon.align_Justify}]})}),s.btnVerticalAlign=new Common.UI.Button({id:"id-toolbar-btn-valign",cls:"btn-toolbar",iconCls:"btn-valign-bottom",icls:"btn-valign-bottom",lock:[a.editCell,a.selChart,a.selChartText,a.lostConnect,a.coAuth,a.coAuthText],menu:new Common.UI.Menu({items:[{caption:s.tipAlignTop,iconCls:"mnu-valign-top",icls:"btn-valign-top",checkable:!0,allowDepress:!0,toggleGroup:"valignGroup",value:Asc.c_oAscVAlign.Top},{caption:s.tipAlignMiddle,iconCls:"mnu-valign-middle",icls:"btn-valign-middle",checkable:!0,allowDepress:!0,toggleGroup:"valignGroup",value:Asc.c_oAscVAlign.Center},{caption:s.tipAlignBottom,iconCls:"mnu-valign-bottom",icls:"btn-valign-bottom",checkable:!0,allowDepress:!0,checked:!0,toggleGroup:"valignGroup",value:Asc.c_oAscVAlign.Bottom}]})});var r=Common.localStorage.getItem("sse-hide-synch");s.showSynchTip=!(r&&1==parseInt(r)),s.btnPageOrient=new Common.UI.Button({id:"tlbtn-pageorient",cls:"btn-toolbar x-huge icon-top",iconCls:"btn-pageorient",caption:s.capBtnPageOrient,lock:[a.docPropsLock,a.lostConnect,a.coAuth],menu:new Common.UI.Menu({cls:"ppm-toolbar",items:[{caption:s.textPortrait,iconCls:"mnu-orient-portrait",checkable:!0,toggleGroup:"menuOrient",value:Asc.c_oAscPageOrientation.PagePortrait},{caption:s.textLandscape,iconCls:"mnu-orient-landscape",checkable:!0,toggleGroup:"menuOrient",value:Asc.c_oAscPageOrientation.PageLandscape}]})});var c=_.template('
    <%= caption %>
    <% if (options.value !== null) { %>
    <% } %>
    ");s.btnPageMargins=new Common.UI.Button({id:"tlbtn-pagemargins",cls:"btn-toolbar x-huge icon-top",iconCls:"btn-pagemargins",caption:s.capBtnMargins,lock:[a.docPropsLock,a.lostConnect,a.coAuth],menu:new Common.UI.Menu({items:[{caption:s.textMarginsLast,checkable:!0,template:c,toggleGroup:"menuPageMargins"},{caption:s.textMarginsNormal,checkable:!0,template:c,toggleGroup:"menuPageMargins",value:[19.1,17.8,19.1,17.8]},{caption:s.textMarginsNarrow,checkable:!0,template:c,toggleGroup:"menuPageMargins",value:[19.1,6.4,19.1,6.4]},{caption:s.textMarginsWide,checkable:!0,template:c,toggleGroup:"menuPageMargins",value:[25.4,25.4,25.4,25.4]},{caption:"--"},{caption:s.textPageMarginsCustom,value:"advanced"}]})});var h=_.template('
    <%= caption %>
    <%= parseFloat(Common.Utils.Metric.fnRecalcFromMM(options.value[0]).toFixed(2)) %> <%= Common.Utils.Metric.getCurrentMetricName() %> x <%= parseFloat(Common.Utils.Metric.fnRecalcFromMM(options.value[1]).toFixed(2)) %> <%= Common.Utils.Metric.getCurrentMetricName() %>
    ');s.btnPageSize=new Common.UI.Button({id:"tlbtn-pagesize",cls:"btn-toolbar x-huge icon-top",iconCls:"btn-pagesize",caption:s.capBtnPageSize,lock:[a.docPropsLock,a.lostConnect,a.coAuth],menu:new Common.UI.Menu({restoreHeight:!0,items:[{caption:"US Letter",subtitle:"21,59cm x 27,94cm",template:h,checkable:!0,toggleGroup:"menuPageSize",value:[215.9,279.4]},{caption:"US Legal",subtitle:"21,59cm x 35,56cm",template:h,checkable:!0,toggleGroup:"menuPageSize",value:[215.9,355.6]},{caption:"A4",subtitle:"21cm x 29,7cm",template:h,checkable:!0,toggleGroup:"menuPageSize",value:[210,297],checked:!0},{caption:"A5",subtitle:"14,81cm x 20,99cm",template:h,checkable:!0,toggleGroup:"menuPageSize",value:[148,210]},{caption:"B5",subtitle:"17,6cm x 25,01cm",template:h,checkable:!0,toggleGroup:"menuPageSize",value:[176,250]},{caption:"Envelope #10",subtitle:"10,48cm x 24,13cm",template:h,checkable:!0,toggleGroup:"menuPageSize",value:[104.8,241.3]},{caption:"Envelope DL",subtitle:"11,01cm x 22,01cm",template:h,checkable:!0,toggleGroup:"menuPageSize",value:[110,220]},{caption:"Tabloid",subtitle:"27,94cm x 43,17cm",template:h,checkable:!0,toggleGroup:"menuPageSize",value:[279.4,431.8]},{caption:"A3",subtitle:"29,7cm x 42,01cm",template:h,checkable:!0,toggleGroup:"menuPageSize",value:[297,420]},{caption:"Tabloid Oversize",subtitle:"30,48cm x 45,71cm",template:h,checkable:!0,toggleGroup:"menuPageSize",value:[304.8,457.1]},{caption:"ROC 16K",subtitle:"19,68cm x 27,3cm",template:h,checkable:!0,toggleGroup:"menuPageSize",value:[196.8,273]},{caption:"Envelope Choukei 3",subtitle:"11,99cm x 23,49cm",template:h,checkable:!0,toggleGroup:"menuPageSize",value:[119.9,234.9]},{caption:"Super B/A3",subtitle:"33,02cm x 48,25cm",template:h,checkable:!0,toggleGroup:"menuPageSize",value:[330.2,482.5]}]})}),s.mnuPageSize=s.btnPageSize.menu,s.btnPrintArea=new Common.UI.Button({id:"tlbtn-printarea",cls:"btn-toolbar x-huge icon-top",iconCls:"btn-print-area",caption:s.capBtnPrintArea,lock:[a.selChart,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.editCell,a.selRangeEdit,a.printAreaLock,a.lostConnect,a.coAuth],menu:new Common.UI.Menu({cls:"ppm-toolbar",items:[{caption:s.textSetPrintArea,lock:[a.namedRangeLock],value:Asc.c_oAscChangePrintAreaType.set},{caption:s.textClearPrintArea,value:Asc.c_oAscChangePrintAreaType.clear},{caption:s.textAddPrintArea,lock:[a.namedRangeLock],value:Asc.c_oAscChangePrintAreaType.add}]})}),s.btnEditHeader=new Common.UI.Button({id:"tlbtn-editheader",cls:"btn-toolbar x-huge icon-top",iconCls:"btn-editheader",caption:s.capBtnInsHeader,lock:[a.editCell,a.selRangeEdit,a.headerLock,a.lostConnect,a.coAuth]}),s.btnImgAlign=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"btn-img-align",caption:s.capImgAlign,lock:[a.selRange,a.selRangeEdit,a.cantGroup,a.lostConnect,a.coAuth,a.coAuthText],menu:!0}),s.btnImgGroup=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"btn-img-group",caption:s.capImgGroup,lock:[a.selRange,a.selRangeEdit,a.cantGroupUngroup,a.lostConnect,a.coAuth,a.coAuthText],menu:!0}),s.btnImgForward=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"btn-img-frwd",caption:s.capImgForward,split:!0,lock:[a.selRange,a.selRangeEdit,a.lostConnect,a.coAuth,a.coAuthText],menu:!0}),s.btnImgBackward=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"btn-img-bkwd",caption:s.capImgBackward,lock:[a.selRange,a.selRangeEdit,a.lostConnect,a.coAuth,a.coAuthText],split:!0,menu:!0})}else Common.UI.Mixtbar.prototype.initialize.call(this,{template:_.template(n),tabs:[{caption:s.textTabFile,action:"file",haspanel:!1}]});return t.isEdit&&(s.lockControls=[s.cmbFontName,s.cmbFontSize,s.btnIncFontSize,s.btnDecFontSize,s.btnBold,s.btnItalic,s.btnUnderline,s.btnStrikeout,s.btnSubscript,s.btnTextColor,s.btnHorizontalAlign,s.btnAlignLeft,s.btnAlignCenter,s.btnAlignRight,s.btnAlignJust,s.btnVerticalAlign,s.btnAlignTop,s.btnAlignMiddle,s.btnAlignBottom,s.btnWrap,s.btnTextOrient,s.btnBackColor,s.btnInsertTable,s.btnMerge,s.btnInsertFormula,s.btnNamedRange,s.btnIncDecimal,s.btnInsertShape,s.btnInsertEquation,s.btnInsertText,s.btnInsertTextArt,s.btnSortUp,s.btnSortDown,s.btnSetAutofilter,s.btnClearAutofilter,s.btnTableTemplate,s.btnPercentStyle,s.btnCurrencyStyle,s.btnDecDecimal,s.btnAddCell,s.btnDeleteCell,s.cmbNumberFormat,s.btnBorders,s.btnInsertImage,s.btnInsertHyperlink,s.btnInsertChart,s.btnColorSchemas,s.btnCopy,s.btnPaste,s.listStyles,s.btnPrint,s.btnClearStyle,s.btnCopyStyle,s.btnPageMargins,s.btnPageSize,s.btnPageOrient,s.btnPrintArea,s.btnImgAlign,s.btnImgBackward,s.btnImgForward,s.btnImgGroup,s.btnEditHeader],_.each(s.lockControls.concat([s.btnSave]),function(t){t&&_.isFunction(t.setDisabled)&&t.setDisabled(!0)}),this.lockToolbar(SSE.enumLock.disableOnStart,!0,{array:[s.btnPrint]}),this.on("render:after",_.bind(this.onToolbarAfterRender,this))),this},render:function(t){var e=this;if(e.isCompactView=t.isCompactView,this.fireEvent("render:before",[this]),t.isEdit?e.$el.html(e.rendererComponents(e.$layout)):(e.$layout.find(".canedit").hide(),e.$layout.addClass("folded"),e.$el.html(e.$layout)),this.fireEvent("render:after",[this]),Common.UI.Mixtbar.prototype.afterRender.call(this),Common.NotificationCenter.on({"window:resize":function(){Common.UI.Mixtbar.prototype.onResize.apply(e,arguments)}}),t.isEdit){if(!t.isEditDiagram&&!t.isEditMailMerge){var i=Common.localStorage.getItem("sse-pgmargins-top"),n=Common.localStorage.getItem("sse-pgmargins-left"),o=Common.localStorage.getItem("sse-pgmargins-bottom"),s=Common.localStorage.getItem("sse-pgmargins-right");if(null!==i&&null!==n&&null!==o&&null!==s){var a=this.btnPageMargins.menu.items[0];a.options.value=a.value=[parseFloat(i),parseFloat(n),parseFloat(o),parseFloat(s)],a.setVisible(!0),$(a.el).html(a.template({id:Common.UI.getId(),caption:a.caption,options:a.options}))}else this.btnPageMargins.menu.items[0].setVisible(!1);this.btnInsertImage.menu.items[2].setVisible(t.canRequestInsertImage||t.fileChoiceUrl&&t.fileChoiceUrl.indexOf("{documentType}")>-1)}e.setTab("home")}return e.isCompactView&&e.setFolded(!0),this},onTabClick:function(t){var e=this,i=$(t.currentTarget).find("> a[data-tab]").data("tab"),n=e.isTabActive("file");Common.UI.Mixtbar.prototype.onTabClick.apply(e,arguments),n?e.fireEvent("file:close"):"file"==i&&(e.fireEvent("file:open"),e.setTab(i))},rendererComponents:function(t){var e=$(t),i=function(t,i){Common.Utils.injectComponent(e.find(t),i)};return i("#slot-field-fontname",this.cmbFontName),i("#slot-field-fontsize",this.cmbFontSize),i("#slot-btn-print",this.btnPrint),i("#slot-btn-save",this.btnSave),i("#slot-btn-undo",this.btnUndo),i("#slot-btn-redo",this.btnRedo),i("#slot-btn-copy",this.btnCopy),i("#slot-btn-paste",this.btnPaste),i("#slot-btn-incfont",this.btnIncFontSize),i("#slot-btn-decfont",this.btnDecFontSize),i("#slot-btn-bold",this.btnBold),i("#slot-btn-italic",this.btnItalic),i("#slot-btn-underline",this.btnUnderline),i("#slot-btn-strikeout",this.btnStrikeout),i("#slot-btn-subscript",this.btnSubscript),i("#slot-btn-fontcolor",this.btnTextColor), -i("#slot-btn-fillparag",this.btnBackColor),i("#slot-btn-borders",this.btnBorders),i("#slot-btn-align-left",this.btnAlignLeft),i("#slot-btn-align-center",this.btnAlignCenter),i("#slot-btn-align-right",this.btnAlignRight),i("#slot-btn-align-just",this.btnAlignJust),i("#slot-btn-merge",this.btnMerge),i("#slot-btn-top",this.btnAlignTop),i("#slot-btn-middle",this.btnAlignMiddle),i("#slot-btn-bottom",this.btnAlignBottom),i("#slot-btn-wrap",this.btnWrap),i("#slot-btn-text-orient",this.btnTextOrient),i("#slot-btn-insimage",this.btnInsertImage),i("#slot-btn-instable",this.btnInsertTable),i("#slot-btn-inshyperlink",this.btnInsertHyperlink),i("#slot-btn-insshape",this.btnInsertShape),i("#slot-btn-instext",this.btnInsertText),i("#slot-btn-instextart",this.btnInsertTextArt),i("#slot-btn-insequation",this.btnInsertEquation),i("#slot-btn-sortdesc",this.btnSortDown),i("#slot-btn-sortasc",this.btnSortUp),i("#slot-btn-setfilter",this.btnSetAutofilter),i("#slot-btn-clear-filter",this.btnClearAutofilter),i("#slot-btn-table-tpl",this.btnTableTemplate),i("#slot-btn-format",this.cmbNumberFormat),i("#slot-btn-percents",this.btnPercentStyle),i("#slot-btn-currency",this.btnCurrencyStyle),i("#slot-btn-digit-dec",this.btnDecDecimal),i("#slot-btn-digit-inc",this.btnIncDecimal),i("#slot-btn-formula",this.btnInsertFormula),i("#slot-btn-named-range",this.btnNamedRange),i("#slot-btn-clear",this.btnClearStyle),i("#slot-btn-copystyle",this.btnCopyStyle),i("#slot-btn-cell-ins",this.btnAddCell),i("#slot-btn-cell-del",this.btnDeleteCell),i("#slot-btn-colorschemas",this.btnColorSchemas),i("#slot-btn-search",this.btnSearch),i("#slot-btn-inschart",this.btnInsertChart),i("#slot-field-styles",this.listStyles),i("#slot-btn-chart",this.btnEditChart),i("#slot-btn-pageorient",this.btnPageOrient),i("#slot-btn-pagemargins",this.btnPageMargins),i("#slot-btn-pagesize",this.btnPageSize),i("#slot-btn-printarea",this.btnPrintArea),i("#slot-img-align",this.btnImgAlign),i("#slot-img-group",this.btnImgGroup),i("#slot-img-movefrwd",this.btnImgForward),i("#slot-img-movebkwd",this.btnImgBackward),i("#slot-btn-editheader",this.btnEditHeader),e},createDelayedElements:function(){function t(t,e){t&&t.updateHint(e)}var e=this;if(t(this.btnPrint,this.tipPrint+Common.Utils.String.platformKey("Ctrl+P")),t(this.btnSave,this.btnSaveTip),t(this.btnCopy,this.tipCopy+Common.Utils.String.platformKey("Ctrl+C")),t(this.btnPaste,this.tipPaste+Common.Utils.String.platformKey("Ctrl+V")),t(this.btnUndo,this.tipUndo+Common.Utils.String.platformKey("Ctrl+Z")),t(this.btnRedo,this.tipRedo+Common.Utils.String.platformKey("Ctrl+Y")),t(this.btnIncFontSize,this.tipIncFont+Common.Utils.String.platformKey("Ctrl+]")),t(this.btnDecFontSize,this.tipDecFont+Common.Utils.String.platformKey("Ctrl+[")),t(this.btnBold,this.textBold+Common.Utils.String.platformKey("Ctrl+B")),t(this.btnItalic,this.textItalic+Common.Utils.String.platformKey("Ctrl+I")),t(this.btnUnderline,this.textUnderline+Common.Utils.String.platformKey("Ctrl+U")),t(this.btnStrikeout,this.textStrikeout),t(this.btnSubscript,this.textSubSuperscript),t(this.btnTextColor,this.tipFontColor),t(this.btnBackColor,this.tipPrColor),t(this.btnBorders,this.tipBorders),t(this.btnAlignLeft,this.tipAlignLeft),t(this.btnAlignCenter,this.tipAlignCenter),t(this.btnAlignRight,this.tipAlignRight),t(this.btnAlignJust,this.tipAlignJust),t(this.btnMerge,this.tipMerge),t(this.btnAlignTop,this.tipAlignTop),t(this.btnAlignMiddle,this.tipAlignMiddle),t(this.btnAlignBottom,this.tipAlignBottom),t(this.btnWrap,this.tipWrap),t(this.btnTextOrient,this.tipTextOrientation),t(this.btnInsertTable,this.tipInsertTable),t(this.btnInsertImage,this.tipInsertImage),t(this.btnInsertChart,this.tipInsertChartSpark),t(this.btnInsertText,this.tipInsertText),t(this.btnInsertTextArt,this.tipInsertTextart),t(this.btnInsertHyperlink,this.tipInsertHyperlink+Common.Utils.String.platformKey("Ctrl+K")),t(this.btnInsertShape,this.tipInsertShape),t(this.btnInsertEquation,this.tipInsertEquation),t(this.btnSortDown,this.txtSortAZ),t(this.btnSortUp,this.txtSortZA),t(this.btnSetAutofilter,this.txtFilter+" (Ctrl+Shift+L)"),t(this.btnClearAutofilter,this.txtClearFilter),t(this.btnSearch,this.txtSearch),t(this.btnTableTemplate,this.txtTableTemplate),t(this.btnPercentStyle,this.tipDigStylePercent),t(this.btnCurrencyStyle,this.tipDigStyleAccounting),t(this.btnDecDecimal,this.tipDecDecimal),t(this.btnIncDecimal,this.tipIncDecimal),t(this.btnInsertFormula,this.txtFormula),t(this.btnNamedRange,this.txtNamedRange),t(this.btnClearStyle,this.tipClearStyle),t(this.btnCopyStyle,this.tipCopyStyle),t(this.btnAddCell,this.tipInsertOpt),t(this.btnDeleteCell,this.tipDeleteOpt),t(this.btnColorSchemas,this.tipColorSchemas),t(this.btnHorizontalAlign,this.tipHAligh),t(this.btnVerticalAlign,this.tipVAligh),t(this.btnPageOrient,this.tipPageOrient),t(this.btnPageSize,this.tipPageSize),t(this.btnPageMargins,this.tipPageMargins),t(this.btnPrintArea,this.tipPrintArea),t(this.btnEditHeader,this.tipEditHeader),this.btnBorders&&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:_.template('<%= caption %>'),menu:function(){var t=_.template('
    ');return e.mnuBorderWidth=new Common.UI.Menu({style:"min-width: 100px;",menuAlign:"tl-tr",id:"toolbar-menu-borders-width",items:[{template:t,stopPropagation:!0,checkable:!0,toggleGroup:"border-width",value:Asc.c_oAscBorderStyles.Thin,offsety:0,checked:!0},{template:t,stopPropagation:!0,checkable:!0,toggleGroup:"border-width",value:Asc.c_oAscBorderStyles.Hair,offsety:20},{template:t,stopPropagation:!0,checkable:!0,toggleGroup:"border-width",value:Asc.c_oAscBorderStyles.Dotted,offsety:40},{template:t,stopPropagation:!0,checkable:!0,toggleGroup:"border-width",value:Asc.c_oAscBorderStyles.Dashed,offsety:60},{template:t,stopPropagation:!0,checkable:!0,toggleGroup:"border-width",value:Asc.c_oAscBorderStyles.DashDot,offsety:80},{template:t,stopPropagation:!0,checkable:!0,toggleGroup:"border-width",value:Asc.c_oAscBorderStyles.DashDotDot,offsety:100},{template:t,stopPropagation:!0,checkable:!0,toggleGroup:"border-width",value:Asc.c_oAscBorderStyles.Medium,offsety:120},{template:t,stopPropagation:!0,checkable:!0,toggleGroup:"border-width",value:Asc.c_oAscBorderStyles.MediumDashed,offsety:140},{template:t,stopPropagation:!0,checkable:!0,toggleGroup:"border-width",value:Asc.c_oAscBorderStyles.MediumDashDot,offsety:160},{template:t,stopPropagation:!0,checkable:!0,toggleGroup:"border-width",value:Asc.c_oAscBorderStyles.MediumDashDotDot,offsety:180},{template:t,stopPropagation:!0,checkable:!0,toggleGroup:"border-width",value:Asc.c_oAscBorderStyles.Thick,offsety:200}]}),e.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:_.template('<%= caption %>'),menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{template:_.template('
    '),stopPropagation:!0},{template:_.template(''+this.textNewColor+""),stopPropagation:!0}]})})]}));var i=$('
    ');$("button:first-child",this.btnBorders.cmpEl).append(i),i.css("background-color",this.btnBorders.currentColor||"transparent"),this.mnuBorderColorPicker=new Common.UI.ThemeColorPalette({el:$("#id-toolbar-menu-bordercolor")})}this.btnInsertChart&&(this.mnuInsertChartPicker=new Common.UI.DataView({el:$("#id-toolbar-menu-insertchart"),parentMenu:this.btnInsertChart.menu,showLast:!1,restoreHeight:539,groups:new Common.UI.DataViewGroupStore([{id:"menu-chart-group-bar",caption:e.textColumn,headername:e.textCharts},{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,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:_.template('
    ')})),this.mode.isEditMailMerge||this.mode.isEditDiagram||this.updateMetricUnit()},onToolbarAfterRender:function(t){if(this.btnTextColor&&this.btnTextColor.cmpEl){var e=$('
    ');$("button:first-child",this.btnTextColor.cmpEl).append(e),e.css("background-color",this.btnTextColor.currentColor||"transparent"),this.mnuTextColorPicker=new Common.UI.ThemeColorPalette({el:$("#id-toolbar-menu-fontcolor")})}if(this.btnBackColor&&this.btnBackColor.cmpEl){var e=$('
    ');$("button:first-child",this.btnBackColor.cmpEl).append(e),e.css("background-color",this.btnBackColor.currentColor||"transparent"),this.mnuBackColorPicker=new Common.UI.ThemeColorPalette({el:$("#id-toolbar-menu-paracolor"),transparent:!0})}},updateMetricUnit:function(){for(var t=this.btnPageMargins.menu.items,e=0;e0&&_.each(this.mnuColorSchema.items,function(t){t.remove()}),null==this.mnuColorSchema&&(this.mnuColorSchema=new Common.UI.Menu({restoreHeight:!0})),this.mnuColorSchema.items=[];var i=_.template(['','',"<% _.each(options.colors, function(color) { %>",'',"<% }) %>","",'<%= caption %>',""].join(""));_.each(t,function(t,n){for(var o=t.get_colors(),s=[],a=2;a<7;a++){var l="#"+Common.Utils.ThemeColor.getHexColor(o[a].get_r(),o[a].get_g(),o[a].get_b());s.push(l)}21==n&&this.mnuColorSchema.addItem({caption:"--"});var r=t.get_name();this.mnuColorSchema.addItem({template:i,cls:"color-schemas-menu",colors:s,caption:n<21?e.SchemeNames[n]||r:r,value:r,checkable:!0,toggleGroup:"menuSchema"})},this)},onApiCollaborativeChanges:function(){this._state.hasCollaborativeChanges||this.btnCollabChanges.rendered&&(this._state.hasCollaborativeChanges=!0,this.btnCollabChanges.$icon.removeClass(this.btnSaveCls).addClass("btn-synch"),this.showSynchTip?(this.btnCollabChanges.updateHint(""),void 0===this.synchTooltip&&this.createSynchTip(),this.synchTooltip.show()):this.btnCollabChanges.updateHint(this.tipSynchronize+Common.Utils.String.platformKey("Ctrl+S")),this.btnSave.setDisabled(!1),Common.Gateway.collaborativeChanges())},createSynchTip:function(){this.synchTooltip=new Common.UI.SynchronizeTip({extCls:this.mode.customization&&this.mode.customization.compactHeader?void 0:"inc-index",target:this.btnCollabChanges.$el}),this.synchTooltip.on("dontshowclick",function(){this.showSynchTip=!1,this.synchTooltip.hide(),this.btnCollabChanges.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.btnCollabChanges.updateHint(this.tipSynchronize+Common.Utils.String.platformKey("Ctrl+S"))},this)},synchronizeChanges:function(){if(this.btnCollabChanges.rendered){var t=this;t.btnCollabChanges.$icon.hasClass("btn-synch")&&(t.btnCollabChanges.$icon.removeClass("btn-synch").addClass(this.btnSaveCls),this.synchTooltip&&this.synchTooltip.hide(),this.btnCollabChanges.updateHint(this.btnSaveTip),this.btnSave.setDisabled(!t.mode.forcesave),this._state.hasCollaborativeChanges=!1)}},onApiUsersChanged:function(t){var e=[];_.each(t,function(t){t.asc_getView()||e.push(t)});var i=_.size(e),n=i>1?"btn-save-coauth":"btn-save";n!==this.btnSaveCls&&this.btnCollabChanges.rendered&&(this.btnSaveTip=(i>1?this.tipSaveCoauth:this.tipSave)+Common.Utils.String.platformKey("Ctrl+S"),this.btnCollabChanges.$icon.hasClass("btn-synch")||(this.btnCollabChanges.$icon.removeClass(this.btnSaveCls).addClass(n),this.btnCollabChanges.updateHint(this.btnSaveTip)),this.btnSaveCls=n)},onAppReady:function(t){if(this.mode.isEdit&&!this.mode.isEditMailMerge&&!this.mode.isEditDiagram){var e=this,i=SSE.getController("DocumentHolder").getView("DocumentHolder");e.btnImgForward.updateHint(e.tipSendForward),e.btnImgForward.setMenu(new Common.UI.Menu({items:[{caption:i.textArrangeFront,iconCls:"mnu-arrange-front",value:Asc.c_oAscDrawingLayerType.BringToFront},{caption:i.textArrangeForward,iconCls:"mnu-arrange-forward",value:Asc.c_oAscDrawingLayerType.BringForward}]})),e.btnImgBackward.updateHint(e.tipSendBackward),e.btnImgBackward.setMenu(new Common.UI.Menu({items:[{caption:i.textArrangeBack,iconCls:"mnu-arrange-back",value:Asc.c_oAscDrawingLayerType.SendToBack},{caption:i.textArrangeBackward,iconCls:"mnu-arrange-backward",value:Asc.c_oAscDrawingLayerType.SendBackward}]})),e.btnImgAlign.updateHint(e.tipImgAlign),e.btnImgAlign.setMenu(new Common.UI.Menu({items:[{caption:i.textShapeAlignLeft,iconCls:"mnu-img-align-left",value:0},{caption:i.textShapeAlignCenter,iconCls:"mnu-img-align-center",value:4},{caption:i.textShapeAlignRight,iconCls:"mnu-img-align-right",value:1},{caption:i.textShapeAlignTop,iconCls:"mnu-img-align-top",value:3},{caption:i.textShapeAlignMiddle,iconCls:"mnu-img-align-middle",value:5},{caption:i.textShapeAlignBottom,iconCls:"mnu-img-align-bottom",value:2},{caption:"--"},{caption:i.txtDistribHor,iconCls:"mnu-distrib-hor",value:6},{caption:i.txtDistribVert,iconCls:"mnu-distrib-vert",value:7}]})),e.btnImgGroup.updateHint(e.tipImgGroup),e.btnImgGroup.setMenu(new Common.UI.Menu({items:[{caption:i.txtGroup,iconCls:"mnu-group",value:"grouping"},{caption:i.txtUngroup,iconCls:"mnu-ungroup",value:"ungrouping"}]}))}},textBold:"Bold",textItalic:"Italic",textUnderline:"Underline",textStrikeout:"Strikeout",textSuperscript:"Superscript",textSubscript:"Subscript",textSubSuperscript:"Subscript/Superscript",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 Image",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",tipInsertTextart:"Insert Text Art",tipInsertShape:"Insert Autoshape",tipDigStylePercent:"Percent Style",tipDigStyleAccounting:"Accounting Style",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:"Image from file",mniImageFromUrl:"Image from url",textNewColor:"Add New Custom Color",tipInsertChart:"Insert Chart",tipEditChart:"Edit Chart",textPrint:"Print",textPrintOptions:"Print Options",tipColorSchemas:"Change Color Scheme",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",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",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",textMoreFormats:"More formats",capInsertText:"Text",capInsertTextart:"Text Art",capInsertImage:"Image",capInsertShape:"Shape",capInsertChart:"Chart",capInsertHyperlink:"Hyperlink",capInsertEquation:"Equation",capBtnComment:"Comment",textTabFile:"File",textTabHome:"Home",textTabInsert:"Insert",textSurface:"Surface",tipChangeChart:"Change Chart Type",textTabCollaboration:"Collaboration",textTabProtect:"Protection",textTabLayout:"Layout",capBtnPageOrient:"Orientation",capBtnMargins:"Margins",capBtnPageSize:"Size",tipImgAlign:"Align objects",tipImgGroup:"Group objects",tipSendForward:"Bring forward",tipSendBackward:"Send backward",capImgAlign:"Align",capImgGroup:"Group",capImgForward:"Bring Forward",capImgBackward:"Send Backward",tipPageSize:"Page Size",tipPageOrient:"Page Orientation",tipPageMargins:"Page Margins",textMarginsLast:"Last Custom",textMarginsNormal:"Normal",textMarginsNarrow:"Narrow",textMarginsWide:"Wide",textPageMarginsCustom:"Custom margins",textTop:"Top: ",textLeft:"Left: ",textBottom:"Bottom: ",textRight:"Right: ",textPortrait:"Portrait",textLandscape:"Landscape",mniImageFromStorage:"Image from Storage",capBtnPrintArea:"Print Area",textSetPrintArea:"Set Print Area",textClearPrintArea:"Clear Print Area",textAddPrintArea:"Add to Print Area",tipPrintArea:"Print Area",capBtnInsHeader:"Header/Footer",tipEditHeader:"Edit header or footer",textTabData:"Data",capInsertTable:"Table",tipInsertTable:"Insert table",textTabFormula:"Formula"},SSE.Views.Toolbar||{}))}),define("spreadsheeteditor/main/app/model/TableTemplate",["backbone"],function(t){"use strict";SSE.Models=SSE.Models||{},SSE.Models.TableTemplate=t.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(t){"use strict";if(void 0===e)var e={};e.Collections=e.Collections||{},SSE.Collections.TableTemplates=t.Collection.extend({model:SSE.Models.TableTemplate})}),define("spreadsheeteditor/main/app/view/PivotTable",["common/main/lib/util/utils","common/main/lib/component/Button","common/main/lib/component/ComboDataView","common/main/lib/component/Layout"],function(t){"use strict";SSE.Views.PivotTable=Common.UI.BaseView.extend(_.extend(function(){function t(){var t=this;this.btnAddPivot.on("click",function(e){t.fireEvent("pivottable:create")}),this.btnPivotLayout.menu.on("item:click",function(e,i,n){t.fireEvent("pivottable:layout",[i.value])}),this.btnPivotBlankRows.menu.on("item:click",function(e,i,n){t.fireEvent("pivottable:blankrows",[i.value])}),this.btnPivotSubtotals.menu.on("item:click",function(e,i,n){t.fireEvent("pivottable:subtotals",[i.value])}),this.btnPivotGrandTotals.menu.on("item:click",function(e,i,n){t.fireEvent("pivottable:grandtotals",[i.value])}),this.btnRefreshPivot.on("click",function(e){t.fireEvent("pivottable:refresh")}),this.btnSelectPivot.on("click",function(e){t.fireEvent("pivottable:select")}),this.chRowHeader.on("change",function(e,i){t.fireEvent("pivottable:rowscolumns",[0,i])}),this.chColHeader.on("change",function(e,i){t.fireEvent("pivottable:rowscolumns",[1,i])}),this.chRowBanded.on("change",function(e,i){t.fireEvent("pivottable:rowscolumns",[2,i])}),this.chColBanded.on("change",function(e,i){t.fireEvent("pivottable:rowscolumns",[3,i])}),this.pivotStyles.on("click",function(e,i){t.fireEvent("pivottable:style",[i])}),this.pivotStyles.openButton.menu.on("show:after",function(){t.pivotStyles.menuPicker.scroller.update({alwaysVisibleY:!0})})}return{options:{},initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t),this.appConfig=t.mode,this.lockedControls=[],this.chRowHeader=new Common.UI.CheckBox({labelText:this.textRowHeader}),this.lockedControls.push(this.chRowHeader),this.chColHeader=new Common.UI.CheckBox({labelText:this.textColHeader}),this.lockedControls.push(this.chColHeader),this.chRowBanded=new Common.UI.CheckBox({labelText:this.textRowBanded}),this.lockedControls.push(this.chRowBanded),this.chColBanded=new Common.UI.CheckBox({labelText:this.textColBanded}),this.lockedControls.push(this.chColBanded),this.btnAddPivot=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"btn-add-pivot",caption:this.txtCreate,disabled:!0}),this.btnPivotLayout=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"btn-pivot-layout",caption:this.capLayout,disabled:!0,menu:new Common.UI.Menu({items:[{caption:this.mniLayoutCompact,value:0},{caption:this.mniLayoutOutline,value:1},{caption:this.mniLayoutTabular,value:2},{caption:"--"},{caption:this.mniLayoutRepeat,value:3},{caption:this.mniLayoutNoRepeat,value:4}]})}),this.btnPivotBlankRows=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"btn-blank-rows",caption:this.capBlankRows,disabled:!0,menu:new Common.UI.Menu({items:[{caption:this.mniInsertBlankLine,value:"insert"},{caption:this.mniRemoveBlankLine,value:"remove"}]})}),this.btnPivotSubtotals=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"btn-subtotals",caption:this.capSubtotals,disabled:!0,menu:new Common.UI.Menu({items:[{caption:this.mniNoSubtotals,value:0},{caption:this.mniBottomSubtotals,value:1},{caption:this.mniTopSubtotals,value:2}]})}),this.btnPivotGrandTotals=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"btn-grand-totals",caption:this.capGrandTotals,disabled:!0,menu:new Common.UI.Menu({items:[{caption:this.mniOffTotals,value:0},{caption:this.mniOnTotals,value:1},{caption:this.mniOnRowsTotals,value:2},{caption:this.mniOnColumnsTotals,value:3}]})}),this.btnRefreshPivot=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"btn-update-pivot",caption:this.txtRefresh,disabled:!0}),this.btnSelectPivot=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"btn-select-pivot",caption:this.txtSelect}),this.lockedControls.push(this.btnSelectPivot),this.pivotStyles=new Common.UI.ComboDataView({cls:"combo-pivot-template",enableKeyEvents:!0,itemWidth:61,itemHeight:49,menuMaxHeight:300}),this.lockedControls.push(this.pivotStyles),Common.NotificationCenter.on("app:ready",this.onAppReady.bind(this))},render:function(t){return this.boxSdk=$("#editor_sdk"),t&&t.html(this.getPanel()),this},onAppReady:function(e){var i=this;new Promise(function(t,e){t()}).then(function(){i.btnAddPivot.updateHint(i.tipCreatePivot),i.btnRefreshPivot.updateHint(i.tipRefresh),i.btnSelectPivot.updateHint(i.tipSelect),i.btnPivotLayout.updateHint(i.capLayout),i.btnPivotBlankRows.updateHint(i.capBlankRows),i.btnPivotSubtotals.updateHint(i.tipSubtotals),i.btnPivotGrandTotals.updateHint(i.tipGrandTotals),t.call(i)})},getPanel:function(){return this.$el=$(_.template('
    ')({})), -this.chRowHeader.render(this.$el.find("#slot-chk-header-row")),this.chColHeader.render(this.$el.find("#slot-chk-header-column")),this.chRowBanded.render(this.$el.find("#slot-chk-banded-row")),this.chColBanded.render(this.$el.find("#slot-chk-banded-column")),this.btnAddPivot.render(this.$el.find("#slot-btn-add-pivot")),this.btnRefreshPivot.render(this.$el.find("#slot-btn-refresh-pivot")),this.btnSelectPivot.render(this.$el.find("#slot-btn-select-pivot")),this.btnPivotLayout.render(this.$el.find("#slot-btn-pivot-report-layout")),this.btnPivotBlankRows.render(this.$el.find("#slot-btn-pivot-blank-rows")),this.btnPivotSubtotals.render(this.$el.find("#slot-btn-pivot-subtotals")),this.btnPivotGrandTotals.render(this.$el.find("#slot-btn-pivot-grand-totals")),this.pivotStyles.render(this.$el.find("#slot-field-pivot-styles")),this.$el},show:function(){Common.UI.BaseView.prototype.show.call(this),this.fireEvent("show",this)},getButton:function(t,e){},SetDisabled:function(t){this.lockedControls&&this.lockedControls.forEach(function(e){e&&e.setDisabled(t)},this)},txtCreate:"Insert Table",tipCreatePivot:"Insert Pivot Table",textRowHeader:"Row Headers",textColHeader:"Column Headers",textRowBanded:"Banded Rows",textColBanded:"Banded Columns",capBlankRows:"Blank Rows",mniInsertBlankLine:"Insert Blank Line after Each Item",mniRemoveBlankLine:"Remove Blank Line after Each Item",capGrandTotals:"Grand Totals",mniOffTotals:"Off for Rows and Columns",mniOnTotals:"On for Rows and Columns",mniOnRowsTotals:"On for Rows Only",mniOnColumnsTotals:"On for Columns Only",capLayout:"Report Layout",capSubtotals:"Subtotals",mniLayoutCompact:"Show in Compact Form",mniLayoutOutline:"Show in Outline Form",mniLayoutTabular:"Show in Tabular Form",mniLayoutRepeat:"Repeat All Item Labels",mniLayoutNoRepeat:"Don't Repeat All Item Labels",mniNoSubtotals:"Don't Show Subtotals",mniBottomSubtotals:"Show all Subtotals at Bottom of Group",mniTopSubtotals:"Show all Subtotals at Top of Group",txtRefresh:"Refresh",tipRefresh:"Update the information from data source",tipGrandTotals:"Show or hide grand totals",tipSubtotals:"Show or hide subtotals",txtSelect:"Select",tipSelect:"Select entire pivot table"}}(),SSE.Views.PivotTable||{}))}),define("spreadsheeteditor/main/app/controller/PivotTable",["core","spreadsheeteditor/main/app/view/PivotTable"],function(){"use strict";SSE.Controllers.PivotTable=Backbone.Controller.extend(_.extend({models:[],views:["PivotTable"],sdkViewName:"#id_main",initialize:function(){this.addListeners({PivotTable:{"pivottable:rowscolumns":_.bind(this.onCheckTemplateChange,this),"pivottable:create":_.bind(this.onCreateClick,this),"pivottable:refresh":_.bind(this.onRefreshClick,this),"pivottable:select":_.bind(this.onSelectClick,this),"pivottable:style":_.bind(this.onPivotStyleSelect,this),"pivottable:layout":_.bind(this.onPivotLayout,this),"pivottable:blankrows":_.bind(this.onPivotBlankRows,this),"pivottable:subtotals":_.bind(this.onPivotSubtotals,this),"pivottable:grandtotals":_.bind(this.onPivotGrandTotals,this)}})},onLaunch:function(){this._state={TableName:"",TemplateName:"",RowHeader:void 0,RowBanded:void 0,ColHeader:void 0,ColBanded:void 0,DisabledControls:!1},this._originalProps=null,this.view=this.createView("PivotTable"),Common.NotificationCenter.on("app:ready",this.onAppReady.bind(this)),Common.NotificationCenter.on("api:disconnect",_.bind(this.SetDisabled,this))},setConfig:function(t,e){this.setApi(e),t&&(this.sdkViewName=t.sdkviewname||this.sdkViewName)},setApi:function(t){t&&(this.api=t,this.api.asc_registerCallback("asc_onCoAuthoringDisconnect",_.bind(this.SetDisabled,this)),this.api.asc_registerCallback("asc_onSendThemeColors",_.bind(this.onSendThemeColors,this)),this.api.asc_registerCallback("asc_onSelectionChanged",_.bind(this.onSelectionChanged,this)))},setMode:function(t){return this.appConfig=t,this},SetDisabled:function(){this.view&&this.view.SetDisabled(!0)},onCheckTemplateChange:function(t,e){switch(t){case 0:this._originalProps.asc_getStyleInfo().asc_setShowRowHeaders(this.api,this._originalProps,"checked"==e);break;case 1:this._originalProps.asc_getStyleInfo().asc_setShowColHeaders(this.api,this._originalProps,"checked"==e);break;case 2:this._originalProps.asc_getStyleInfo().asc_setShowRowStripes(this.api,this._originalProps,"checked"==e);break;case 3:this._originalProps.asc_getStyleInfo().asc_setShowColStripes(this.api,this._originalProps,"checked"==e)}Common.NotificationCenter.trigger("edit:complete",this)},onCreateClick:function(t,e){Common.NotificationCenter.trigger("edit:complete",this)},onRefreshClick:function(t,e){Common.NotificationCenter.trigger("edit:complete",this)},onSelectClick:function(t,e){this.api&&this._originalProps.asc_select(this.api),Common.NotificationCenter.trigger("edit:complete",this)},onPivotStyleSelect:function(t){this.api&&this._originalProps.asc_getStyleInfo().asc_setName(this.api,this._originalProps,t.get("name")),Common.NotificationCenter.trigger("edit:complete",this)},onPivotBlankRows:function(t){this.api,Common.NotificationCenter.trigger("edit:complete",this)},onPivotLayout:function(t){this.api,Common.NotificationCenter.trigger("edit:complete",this)},onPivotGrandTotals:function(t){if(this.api){var e=new Asc.CT_pivotTableDefinition;e.asc_setColGrandTotals(1==t||2==t),e.asc_setRowGrandTotals(1==t||3==t),this._originalProps.asc_set(this.api,e)}Common.NotificationCenter.trigger("edit:complete",this)},onPivotSubtotals:function(t){this.api,Common.NotificationCenter.trigger("edit:complete",this)},ChangeSettings:function(t){if(t){this._originalProps=t;var e=this.view,i=!1,n=t.asc_getStyleInfo(),o=n.asc_getShowRowHeaders();if(this._state.RowHeader!==o&&(e.chRowHeader.setValue(o,!0),this._state.RowHeader=o,i=!0),o=n.asc_getShowColHeaders(),this._state.ColHeader!==o&&(e.chColHeader.setValue(o,!0),this._state.ColHeader=o,i=!0),o=n.asc_getShowColStripes(),this._state.ColBanded!==o&&(e.chColBanded.setValue(o,!0),this._state.ColBanded=o,i=!0),o=n.asc_getShowRowStripes(),this._state.RowBanded!==o&&(e.chRowBanded.setValue(o,!0),this._state.RowBanded=o,i=!0),o=t.asc_getColGrandTotals(),this._state.ColGrandTotals!==o&&(this._state.ColGrandTotals=o,i=!0),o=t.asc_getRowGrandTotals(),this._state.RowGrandTotals!==o&&(this._state.RowGrandTotals=o,i=!0),i&&this.onApiInitPivotStyles(this.api.asc_getTablePictures(this._originalProps,!0)),o=n.asc_getName(),this._state.TemplateName!==o||this._isTemplatesChanged){e.pivotStyles.suspendEvents();var s=e.pivotStyles.menuPicker.store.findWhere({name:o});e.pivotStyles.menuPicker.selectRecord(s),e.pivotStyles.resumeEvents(),this._isTemplatesChanged&&(s?e.pivotStyles.fillComboView(e.pivotStyles.menuPicker.getSelectedRec(),!0):e.pivotStyles.fillComboView(e.pivotStyles.menuPicker.store.at(0),!0)),this._state.TemplateName=o}this._isTemplatesChanged=!1}},onSendThemeColors:function(){this.view.pivotStyles&&this._originalProps&&(this.onApiInitPivotStyles(this.api.asc_getTablePictures(this._originalProps,!0)),this.view.pivotStyles.menuPicker.scroller.update({alwaysVisibleY:!0}))},onApiInitPivotStyles:function(t){var e=this.view.pivotStyles;this._isTemplatesChanged=!0;var i=e.menuPicker.store.length;if(i>0&&i==t.length){var n=e.menuPicker.store.models;_.each(t,function(t,e){n[e].set("imageUrl",t.asc_getImage())})}else{e.menuPicker.store.reset([]);var o=[];_.each(t,function(t){o.push({id:Common.UI.getId(),name:t.asc_getName(),caption:t.asc_getDisplayName(),type:t.asc_getType(),imageUrl:t.asc_getImage(),allowSelected:!0,selected:!1,tip:t.asc_getDisplayName()})}),e.menuPicker.store.add(o)}},onSelectionChanged:function(t){if(!this.rangeSelectionMode&&this.appConfig.isEdit){var e=(t.asc_getFlags().asc_getSelectionType(),t.asc_getPivotTableInfo());this.view.SetDisabled(!e||t.asc_getLockedPivotTable()),e&&this.ChangeSettings(e)}},createToolbarPanel:function(){return this.view.getPanel()},getView:function(t){return!t&&this.view?this.view:Backbone.Controller.prototype.getView.call(this,t)},onAppReady:function(t){new Promise(function(t){t()}).then(function(){})}},SSE.Controllers.PivotTable||{}))}),void 0===Common)var Common={};if(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(t){_.extend(this.options,{title:this.txtFormat},t),this.template=['
    ','
    ','
    ',"
    ",'"].join(""),this.options.tpl=_.template(this.template)(this.options),this.checkRangeType=Asc.c_oAscSelectionDialogType.FormatTable,this.selectionType=Asc.c_oAscSelectionType.RangeCells,Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this);var t=this.getChild(),e=this;e.inputRange=new Common.UI.InputField({el:$("#id-dlg-tableoptions-range"),name:"range",style:"width: 100%;",allowBlank:!1,blankError:this.txtEmpty,validateOnChange:!0}),e.cbTitle=new Common.UI.CheckBox({el:$("#id-dlg-tableoptions-title"),labelText:this.txtTitle}),t.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this)),this.on("close",_.bind(this.onClose,this))},onPrimary:function(){return this._handleInput("ok"),!1},setSettings:function(t){var e=this;if(t.api){if(e.api=t.api,t.range)e.cbTitle.setVisible(!1),e.setHeight(130),e.checkRangeType=Asc.c_oAscSelectionDialogType.FormatTableChangeRange,e.inputRange.setValue(t.range),e.api.asc_setSelectionDialogMode(Asc.c_oAscSelectionDialogType.FormatTable,t.range);else{var i=e.api.asc_getAddFormatTableOptions();e.inputRange.setValue(i.asc_getRange()),e.cbTitle.setValue(i.asc_getIsTitle()),e.api.asc_setSelectionDialogMode(Asc.c_oAscSelectionDialogType.FormatTable,i.asc_getRange())}t.title&&e.setTitle(t.title),t.selectionType&&(e.selectionType=t.selectionType),e.api.asc_unregisterCallback("asc_onSelectionRangeChanged",_.bind(e.onApiRangeChanged,e)),e.api.asc_registerCallback("asc_onSelectionRangeChanged",_.bind(e.onApiRangeChanged,e)),Common.NotificationCenter.trigger("cells:range",Asc.c_oAscSelectionDialogType.FormatTable)}e.inputRange.validation=function(t){return e.api.asc_checkDataRange(e.checkRangeType,t,!1)!=Asc.c_oAscError.ID.DataRangeError||e.txtInvalidRange}},getSettings:function(){if(this.checkRangeType==Asc.c_oAscSelectionDialogType.FormatTable){var t=this.api.asc_getAddFormatTableOptions(this.inputRange.getValue());return t.asc_setIsTitle(this.cbTitle.checked),{selectionType:this.selectionType,range:t}}return{selectionType:this.selectionType,range:this.inputRange.getValue()}},onApiRangeChanged:function(t){this.inputRange.setValue(t.asc_getName()),this.inputRange.cmpEl.hasClass("error")&&this.inputRange.cmpEl.removeClass("error"),this.selectionType=t.asc_getType()},isRangeValid:function(){var t=this.api.asc_checkDataRange(this.checkRangeType,this.inputRange.getValue(),!0);if(t==Asc.c_oAscError.ID.No)return!0;switch(t){case Asc.c_oAscError.ID.AutoFilterDataRangeError:Common.UI.warning({msg:this.errorAutoFilterDataRange});break;case Asc.c_oAscError.ID.FTChangeTableRangeError:Common.UI.warning({msg:this.errorFTChangeTableRangeError});break;case Asc.c_oAscError.ID.FTRangeIncludedOtherTables:Common.UI.warning({msg:this.errorFTRangeIncludedOtherTables});break;case Asc.c_oAscError.ID.MultiCellsInTablesFormulaArray:Common.UI.warning({msg:this.errorMultiCellFormula})}return!1},onBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value)},onClose:function(t){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)},_handleInput:function(t){if(this.options.handler){if("ok"==t&&!0!==this.isRangeValid())return;this.options.handler.call(this,this,t)}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.
    Select a uniform data range inside or outside the table and try again.",errorFTChangeTableRangeError:"Operation could not be completed for the selected cell range.
    Select a range so that the first table row was on the same row
    and the resulting table overlapped the current one.",errorFTRangeIncludedOtherTables:"Operation could not be completed for the selected cell range.
    Select a range which does not include other tables.",errorMultiCellFormula:"Multi-cell array formulas are not allowed in 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(t){var e=this;_.extend(this.options,{title:this.txtTitleNew,template:['
    ','
    ','
    ','',"",'","","",'","","","","","",'",'","","
    ','",'
    ',"
    ','",'
    ',"
    ",'","
    ','
    ',"
    ','","
    ","
    ","
    ","
    ",'
    ','"].join("")},t),this.api=t.api,this.handler=t.handler,this.isEdit=t.isEdit||!1,this.sheets=t.sheets||[],this.props=t.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 t=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(e){var i=t.api.asc_checkDefinedName(e,-255==t.cmbScope.getValue()?null:t.cmbScope.getValue());if(!0===i.asc_getStatus())return!0;switch(i.asc_getReason()){case Asc.c_oAscDefinedNameReason.IsLocked:return t.textIsLocked;case Asc.c_oAscDefinedNameReason.Existed:return!(!t.isEdit||t.props.asc_getName(!0).toLowerCase()!=e.toLowerCase())||t.textExistName;case Asc.c_oAscDefinedNameReason.NameReserved:return!t.isEdit||t.textReservedName;default:return t.textInvalidName}}}),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(e){return!!_.isEmpty(e)||(!!(t.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.Chart,e,!1)!==Asc.c_oAscError.ID.DataRangeError||t.isEdit&&t.props.asc_getRef().toLowerCase()==e.toLowerCase())||t.textInvalidRange)}}),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 t=this;_.delay(function(){t.inputName.cmpEl.find("input").focus()},200)},_setDefaults:function(t){if(this.cmbScope.setData([{value:-255,displayValue:this.strWorkbook}].concat(this.sheets)),t){var e=t.asc_getScope();this.cmbScope.setValue(null===e?-255:e),e=t.asc_getName(!0),_.isEmpty(e)||this.inputName.setValue(e),e=t.asc_getRef(),this.txtDataRange.setValue(e||""),this.dataRangeValid=e,this.txtDataRange.setDisabled(this.isEdit&&t.asc_getIsTable()),this.btnSelectData.setDisabled(this.isEdit&&t.asc_getIsTable())}else this.cmbScope.setValue(-255);this.cmbScope.setDisabled(this.isEdit)},onSelectData:function(){var t=this;if(t.api){var e=function(e,i){"ok"==i&&(t.dataRangeValid=e.getSettings(),t.txtDataRange.setValue(t.dataRangeValid),t.txtDataRange.checkValidate())},i=new SSE.Views.CellRangeDialog({handler:e}).on("close",function(){t.show()}),n=t.$window.offset();t.hide(),i.show(n.left+65,n.top+77),i.setSettings({api:t.api,range:_.isEmpty(t.txtDataRange.getValue())||1!=t.txtDataRange.checkValidate()?t.dataRangeValid:t.txtDataRange.getValue(),type:Asc.c_oAscSelectionDialogType.Chart})}},getSettings:function(){return new Asc.asc_CDefName(this.inputName.getValue(),this.txtDataRange.getValue(),-255==this.cmbScope.getValue()?null:this.cmbScope.getValue(),this.props.asc_getIsTable(),void 0,void 0,void 0,!0)},onPrimary:function(){return this.onDlgBtnClick("ok"),!1},onDlgBtnClick:function(t){var e=this,i="object"==typeof t?t.currentTarget.attributes.result.value:t;if("ok"==i){if(this.locked)return void Common.UI.alert({msg:this.errorCreateDefName,title:this.notcriticalErrorTitle,iconCls:"warn",buttons:["ok"],callback:function(t){e.close()}});var n=this.inputName.checkValidate(),o=this.txtDataRange.checkValidate();if(!0!==n)return void this.inputName.cmpEl.find("input").focus();if(!0!==o)return void this.txtDataRange.cmpEl.find("input").focus();this.handler&&this.handler.call(this,i,"ok"==i?this.getSettings():void 0)}this.close()},onLockDefNameManager:function(t){this.locked=t==Asc.c_oAscDefinedNameReason.LockDefNameManager},onRefreshDefNameList:function(t){var e=this;this.isEdit&&Common.Utils.InternalSettings.get("sse-settings-coauthmode")&&t&&t.asc_getIsLock()&&t.asc_getName(!0).toLowerCase()==this.props.asc_getName(!0).toLowerCase()&&(null===t.asc_getScope()&&null===this.props.asc_getScope()||t.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(t){e.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
    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(t){var e=this;_.extend(this.options,{title:this.txtTitle,template:['
    ','
    ','
    ','',"",'","","
    ','",'
    ',"
    ","
    ","
    ","
    ",'
    ','"].join("")},t),this.handler=t.handler,this.ranges=t.ranges||[],Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this,this.options)},render:function(){Common.Views.AdvancedSettingsWindow.prototype.render.call(this);this.rangeList=new Common.UI.ListView({el:$("#named-range-paste-list",this.$window),store:new Common.UI.DataViewStore,simpleAddMode:!0,template:_.template(['
    '].join("")),itemTemplate:_.template(['
    ','
    ','
    ','
    <%= name %>
    ',"
    ","
    "].join(""))}),this.rangeList.store.comparator=function(t,e){var i=t.get("name").toLowerCase(),n=e.get("name").toLowerCase();return i==n?0:i0&&this.rangeList.selectByIndex(0),this.rangeList.scroller.update({alwaysVisibleY:!0}),_.delay(function(){t.rangeList.cmpEl.find(".listview").focus()},100,this)}},getSettings:function(){var t=this.rangeList.getSelectedRec();return t?new Asc.asc_CDefName(t.get("name"),t.get("range"),t.get("scope"),t.get("isTable"),void 0,void 0,void 0,!0):null},onPrimary:function(){return this.handler&&this.handler.call(this,"ok",this.getSettings()),this.close(),!1},onDlgBtnClick:function(t){var e=t.currentTarget.attributes.result.value;this.handler&&this.handler.call(this,e,"ok"==e?this.getSettings():void 0),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(t){var e=this;e.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}],e.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"}],e.CurrencySymbolsData=null,e.langId=1033,_.extend(this.options,{title:this.textTitle,template:['
    ','
    ','
    ','',"",'","","",'","","",'","",'','","",'','","",'','","",'','","",'','","",'','","","
    ','",'
    ',"
    ','",'',"
    ',"
    ','",'
    ',"
    ','
    ',"
    ','",'
    ',"
    ','",'
    ',"
    ','",'
    ',"
    ','",'
    ',"
    ","
    ","
    ","
    ",'
    ','"].join("")},t),this.api=t.api,this.handler=t.handler,this.props=t.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);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(t){if(t&&t.formatInfo&&(this.langId&&(this.langId=t.langId),this.cmbFormat.setValue(t.formatInfo.asc_getType(),this.txtCustom),t.formatInfo.asc_getType()==Asc.c_oAscNumFormatType.Custom&&t.format&&(this.CustomFormat=this.Format=t.format),this.onFormatSelect(this.cmbFormat,this.cmbFormat.getSelectedRecord(),null,t.formatInfo),this._state.hasDecimal&&this.spnDecimal.setValue(t.formatInfo.asc_getDecimalPlaces()),this._state.hasSeparator&&this.chSeparator.setValue(t.formatInfo.asc_getSeparator()),this._state.hasSymbols&&this.cmbSymbols.setValue(t.formatInfo.asc_getSymbol()), -t.format)){if(this._state.hasNegative){var e=this.cmbNegative.store.findWhere({value:t.format});e?this.cmbNegative.selectRecord(e):this.cmbNegative.setValue(this.api.asc_getLocaleExample(t.format))}else if(this._state.hasType){var e=this.cmbType.store.findWhere({value:t.format});e?this.cmbType.selectRecord(e):t.formatInfo.asc_getType()==Asc.c_oAscNumFormatType.Fraction?this.cmbType.setValue(this.txtCustom):t.formatInfo.asc_getType()==Asc.c_oAscNumFormatType.Time?this.cmbType.setValue(this.api.asc_getLocaleExample(t.format,1.534)):this.cmbType.setValue(this.api.asc_getLocaleExample(t.format,38822))}this.Format=t.format,this.lblExample.text(this.api.asc_getLocaleExample(this.Format))}},getSettings:function(){return{format:this.Format}},onDlgBtnClick:function(t){var e="object"==typeof t?t.currentTarget.attributes.result.value:t;"ok"==e&&this.handler&&this.handler.call(this,e,"ok"==e?this.getSettings():void 0),this.close()},onPrimary:function(){return this.onDlgBtnClick("ok"),!1},onNegativeSelect:function(t,e){this.Format=e.value,this.lblExample.text(this.api.asc_getLocaleExample(this.Format))},onSymbolsSelect:function(t,e){var i=this,n=new Asc.asc_CFormatCellsInfo;n.asc_setType(this.FormatType),n.asc_setDecimalPlaces(this.spnDecimal.getNumberValue()),n.asc_setSeparator(!1),n.asc_setSymbol(e.value);var o=this.api.asc_getFormatCells(n),s=[];o.forEach(function(t){s.push({value:t,displayValue:i.api.asc_getLocaleExample(t,-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=o[0],this.lblExample.text(this.api.asc_getLocaleExample(this.Format))},onDecimalChange:function(t,e,i,n){var o=this,s=new Asc.asc_CFormatCellsInfo;s.asc_setType(this.FormatType),s.asc_setDecimalPlaces(t.getNumberValue()),s.asc_setSeparator(this.FormatType==Asc.c_oAscNumFormatType.Number&&"checked"==this.chSeparator.getValue()),s.asc_setSymbol((this.FormatType==Asc.c_oAscNumFormatType.Currency||this.FormatType==Asc.c_oAscNumFormatType.Accounting)&&this.cmbSymbols.getValue());var a=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 l=[];a.forEach(function(t){l.push({value:t,displayValue:o.api.asc_getLocaleExample(t,-1234.1234567890124)})}),this.cmbNegative.setData(l),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=a[0]}else this.Format=a[0];this.lblExample.text(this.api.asc_getLocaleExample(this.Format))},onSeparatorChange:function(t,e,i,n){var o=this,s=new Asc.asc_CFormatCellsInfo;s.asc_setType(this.FormatType),s.asc_setDecimalPlaces(this.spnDecimal.getNumberValue()),s.asc_setSeparator("checked"==t.getValue());var a=this.api.asc_getFormatCells(s),l=[];a.forEach(function(t){l.push({value:t,displayValue:o.api.asc_getLocaleExample(t,-1234.1234567890124)})}),this.cmbNegative.setData(l),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=a[0],this.lblExample.text(this.api.asc_getLocaleExample(this.Format))},onTypeSelect:function(t,e){this.Format=e.value,this.lblExample.text(this.api.asc_getLocaleExample(this.Format))},onCodeSelect:function(t,e){this.Format=e.value,this.lblExample.text(this.api.asc_getLocaleExample(this.Format))},onFormatSelect:function(t,e,i,n){if(e){this.FormatType=e.value;var o=e.value==Asc.c_oAscNumFormatType.Number||e.value==Asc.c_oAscNumFormatType.Scientific||e.value==Asc.c_oAscNumFormatType.Accounting||e.value==Asc.c_oAscNumFormatType.Currency||e.value==Asc.c_oAscNumFormatType.Percent,s=e.value==Asc.c_oAscNumFormatType.Number||e.value==Asc.c_oAscNumFormatType.Currency||e.value==Asc.c_oAscNumFormatType.Accounting,a=e.value==Asc.c_oAscNumFormatType.Number,l=e.value==Asc.c_oAscNumFormatType.Date||e.value==Asc.c_oAscNumFormatType.Time||e.value==Asc.c_oAscNumFormatType.Fraction,r=e.value==Asc.c_oAscNumFormatType.Accounting||e.value==Asc.c_oAscNumFormatType.Currency,c=e.value==Asc.c_oAscNumFormatType.Custom,h=this,d=n?n.asc_getDecimalPlaces():this.spnDecimal.getNumberValue(),p=n?n.asc_getSeparator():"checked"==this.chSeparator.getValue(),m=n?n.asc_getSymbol():this.langId;if(e.value!==Asc.c_oAscNumFormatType.Custom){var u=new Asc.asc_CFormatCellsInfo;if(u.asc_setType(e.value),u.asc_setDecimalPlaces(o?d:0),u.asc_setSeparator(!!a&&p),s||e.value==Asc.c_oAscNumFormatType.Date||e.value==Asc.c_oAscNumFormatType.Time){if(r){if(!h.CurrencySymbolsData){h.CurrencySymbolsData=[{value:null,displayValue:h.txtNone}];var g=this.api.asc_getCurrencySymbols();for(var b in g)g.hasOwnProperty(b)&&h.CurrencySymbolsData.push({value:parseInt(b),displayValue:g[b]+" "+Common.util.LanguageInfo.getLocalLanguageName(b)[1]});this.cmbSymbols.setData(this.CurrencySymbolsData),this.cmbSymbols.setValue(m)}u.asc_setSymbol(this.cmbSymbols.getValue())}var f=this.api.asc_getFormatCells(u),C=[],v=e.value==Asc.c_oAscNumFormatType.Date?38822:e.value==Asc.c_oAscNumFormatType.Time?1.534:parseFloat("-1234.12345678901234567890");f.forEach(function(t){C.push({value:t,displayValue:h.api.asc_getLocaleExample(t,v)})}),s?(this.cmbNegative.setData(C),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(C),this.cmbType.selectRecord(this.cmbType.store.at(0))),this.Format=f[0]}else e.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(u)[0]}else{var u=new Asc.asc_CFormatCellsInfo;u.asc_setType(Asc.c_oAscNumFormatType.Custom),u.asc_setSymbol(m);var f=this.api.asc_getFormatCells(u),C=[],_=!!this.CustomFormat;f.forEach(function(t){C.push({value:t,displayValue:t}),h.CustomFormat==t&&(_=!1)}),_&&C.push({value:this.CustomFormat,displayValue:this.CustomFormat}),this.cmbCode.setData(C),this.cmbCode.setValue(this.Format)}this.lblExample.text(this.api.asc_getLocaleExample(this.Format)),this._decimalPanel.toggleClass("hidden",!o),this._negativePanel.css("visibility",s?"":"hidden"),this._separatorPanel.toggleClass("hidden",!a),this._typePanel.toggleClass("hidden",!l),this._symbolsPanel.toggleClass("hidden",!r),this._codePanel.toggleClass("hidden",!c),this._state={hasDecimal:o,hasNegative:s,hasSeparator:a,hasType:l,hasSymbols:r,hasCode:c}}},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:",txtNone:"None"},SSE.Views.FormatSettingsDialog||{}))}),define("spreadsheeteditor/main/app/view/PageMarginsDialog",["common/main/lib/component/Window","common/main/lib/component/MetricSpinner"],function(){"use strict";SSE.Views.PageMarginsDialog=Common.UI.Window.extend(_.extend({options:{width:215,header:!0,style:"min-width: 216px;",cls:"modal-dlg",id:"window-page-margins"},initialize:function(t){_.extend(this.options,{title:this.textTitle},t||{}),this.template=['
    ','',"",'",'","","",'",'","","
    ','",'
    ',"
    ','",'
    ',"
    ','",'
    ',"
    ','",'
    ',"
    ","
    ",'
    ','"].join(""),this.options.tpl=_.template(this.template)(this.options),this.spinners=[],this._noApply=!1,this.maxMarginsW=this.maxMarginsH=0,Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this),this.spnTop=new Common.UI.MetricSpinner({el:$("#page-margins-spin-top"),step:.1,width:86,defaultUnit:"cm",value:"0",maxValue:48.25,minValue:0}),this.spinners.push(this.spnTop),this.spnBottom=new Common.UI.MetricSpinner({el:$("#page-margins-spin-bottom"),step:.1,width:86,defaultUnit:"cm",value:"0",maxValue:48.25,minValue:0}),this.spinners.push(this.spnBottom),this.spnLeft=new Common.UI.MetricSpinner({el:$("#page-margins-spin-left"),step:.1,width:86,defaultUnit:"cm",value:"0.19 cm",maxValue:48.25,minValue:0}),this.spinners.push(this.spnLeft),this.spnRight=new Common.UI.MetricSpinner({el:$("#page-margins-spin-right"),step:.1,width:86,defaultUnit:"cm",value:"0.19 cm",maxValue:48.25,minValue:0}),this.spinners.push(this.spnRight);var t=this.getChild();t.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this)),t.find("input").on("keypress",_.bind(this.onKeyPress,this)),this.updateMetricUnit()},_handleInput:function(t){this.options.handler&&this.options.handler.call(this,this,t),this.close()},onBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value)},onKeyPress:function(t){t.keyCode==Common.UI.Keys.RETURN&&this._handleInput("ok")},setSettings:function(t){if(t){var e=t.asc_getPageMargins();this.spnTop.setValue(Common.Utils.Metric.fnRecalcFromMM(e.asc_getTop()),!0),this.spnBottom.setValue(Common.Utils.Metric.fnRecalcFromMM(e.asc_getBottom()),!0),this.spnLeft.setValue(Common.Utils.Metric.fnRecalcFromMM(e.asc_getLeft()),!0),this.spnRight.setValue(Common.Utils.Metric.fnRecalcFromMM(e.asc_getRight()),!0)}},getSettings:function(){var t=new Asc.asc_CPageMargins;return t.asc_setTop(Common.Utils.Metric.fnRecalcToMM(this.spnTop.getNumberValue())),t.asc_setBottom(Common.Utils.Metric.fnRecalcToMM(this.spnBottom.getNumberValue())),t.asc_setLeft(Common.Utils.Metric.fnRecalcToMM(this.spnLeft.getNumberValue())),t.asc_setRight(Common.Utils.Metric.fnRecalcToMM(this.spnRight.getNumberValue())),t},updateMetricUnit:function(){if(this.spinners)for(var t=0;t','',"",'",'","","","","","","
    ','
    ',"
    ','
    ',"
    ",'
    ',"
    ",'
    ',"
    ",'
    ','",'",'",'","
    ",'",'
    ','
    ','
    ','
    ','
    ','
    ','
    ','
    ','
    ','
    ','
    ','
    ','
    ','
    ','
    ',"
    ","
    ",'
    ','
    ','
    ',"
    ","
    ",'
    ','
    ','
    ',"
    ","
    ","
    ",'",'
    ','
    ','
    ','
    ','
    ','
    ','
    ','
    ','
    ','
    ','
    ','
    ','
    ','
    ','',"
    ","
    ",'
    ','
    ','',"
    ","
    ",'
    ','
    ','',"
    ","
    ","
    ","
    ",'"].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 t=this,e=this.getChild();this.chFirstPage=new Common.UI.CheckBox({el:$("#id-dlg-hf-ch-first"),labelText:this.textDiffFirst}),this.chFirstPage.on("change",_.bind(function(t,e,i,n){var o="checked"==t.getValue(),s=this.HFObject?this.HFObject.setDifferentFirst(o):null;if(s){var a=this;return void this.showError(function(){t.setValue(!o,!0),_.delay(function(){a.onCanvasClick(s)},50)})}this.btnFirst.setVisible(o),!o&&this.btnFirst.isActive()&&(this.btnAll.isVisible()?this.btnAll.toggle(!0):this.btnOdd.toggle(!0))},this)),this.chOddPage=new Common.UI.CheckBox({el:$("#id-dlg-hf-ch-odd"),labelText:this.textDiffOdd}),this.chOddPage.on("change",_.bind(function(t,e,i,n){var o="checked"==t.getValue(),s=this.HFObject?this.HFObject.setDifferentOddEven(o):null;if(s){var a=this;return void this.showError(function(){t.setValue(!o,!0),_.delay(function(){a.onCanvasClick(s)},50)})}this.btnOdd.setVisible(o),this.btnEven.setVisible(o),this.btnAll.setVisible(!o),o||!this.btnOdd.isActive()&&!this.btnEven.isActive()||this.btnAll.toggle(!0),o&&this.btnAll.isActive()&&this.btnOdd.toggle(!0)},this)),this.chScale=new Common.UI.CheckBox({el:$("#id-dlg-hf-ch-scale"),labelText:this.textScale}),this.chScale.on("change",_.bind(function(t,e,i,n){var o="checked"==t.getValue();this.HFObject&&this.HFObject.setScaleWithDoc(o)},this)),this.chAlign=new Common.UI.CheckBox({el:$("#id-dlg-hf-ch-align"),labelText:this.textAlign}),this.chAlign.on("change",_.bind(function(t,e,i,n){var o="checked"==t.getValue();this.HFObject&&this.HFObject.setAlignWithMargins(o)},this)),this.btnAll=new Common.UI.Button({el:$("#id-dlg-hf-btn-all"),enableToggle:!0,toggleGroup:"hf-pages",allowDepress:!1,pressed:!0}),this.btnAll.on("toggle",_.bind(this.onPageTypeToggle,this,Asc.c_oAscHeaderFooterType.odd)),this.btnOdd=new Common.UI.Button({el:$("#id-dlg-hf-btn-odd"),enableToggle:!0,toggleGroup:"hf-pages",allowDepress:!1}),this.btnOdd.on("toggle",_.bind(this.onPageTypeToggle,this,Asc.c_oAscHeaderFooterType.odd)),this.btnEven=new Common.UI.Button({el:$("#id-dlg-hf-btn-even"),enableToggle:!0,toggleGroup:"hf-pages",allowDepress:!1}),this.btnEven.on("toggle",_.bind(this.onPageTypeToggle,this,Asc.c_oAscHeaderFooterType.even)),this.btnFirst=new Common.UI.Button({el:$("#id-dlg-hf-btn-first"),enableToggle:!0,toggleGroup:"hf-pages",allowDepress:!1}),this.btnFirst.on("toggle",_.bind(this.onPageTypeToggle,this,Asc.c_oAscHeaderFooterType.first)),this.cmbPresetsH=new Common.UI.ComboBox({el:$("#id-dlg-h-presets"),cls:"input-group-nr",style:"width: 110px;",menuStyle:"min-width: 100%; max-height: 200px;",editable:!1,scrollAlwaysVisible:!0,data:[]}),this.cmbPresetsH.on("selected",_.bind(this.onPresetSelect,this,!1)),this.cmbPresetsH.setValue(this.textPresets),this.cmbPresetsF=new Common.UI.ComboBox({el:$("#id-dlg-f-presets"),cls:"input-group-nr",style:"width: 110px;",menuStyle:"min-width: 100%; max-height: 200px;",editable:!1,scrollAlwaysVisible:!0,data:[]}),this.cmbPresetsF.on("selected",_.bind(this.onPresetSelect,this,!0)),this.cmbPresetsF.setValue(this.textPresets);var i=[{displayValue:this.textPageNum,value:Asc.c_oAscHeaderFooterField.pageNumber},{displayValue:this.textPageCount,value:Asc.c_oAscHeaderFooterField.pageCount},{displayValue:this.textDate,value:Asc.c_oAscHeaderFooterField.date},{displayValue:this.textTime,value:Asc.c_oAscHeaderFooterField.time},{displayValue:this.textFileName,value:Asc.c_oAscHeaderFooterField.fileName},{displayValue:this.textSheet,value:Asc.c_oAscHeaderFooterField.sheetName}];this.cmbInsertH=new Common.UI.ComboBox({el:$("#id-dlg-h-insert"),cls:"input-group-nr",style:"width: 110px;",menuStyle:"min-width: 100%; max-heigh: 100px;",editable:!1,data:i}),this.cmbInsertH.on("selected",_.bind(this.onObjectSelect,this)),this.cmbInsertH.setValue(this.textInsert),this.headerControls.push(this.cmbInsertH),this.cmbInsertF=new Common.UI.ComboBox({el:$("#id-dlg-f-insert"),cls:"input-group-nr",style:"width: 110px;",menuStyle:"min-width: 100%; max-heigh: 100px;",editable:!1,data:i}),this.cmbInsertF.on("selected",_.bind(this.onObjectSelect,this)),this.cmbInsertF.setValue(this.textInsert),this.footerControls.push(this.cmbInsertF),this.cmbFonts=[],this.cmbFonts.push(new Common.UI.ComboBoxFonts({el:$("#id-dlg-h-fonts"),cls:"input-group-nr",style:"width: 142px;",menuCls:"scrollable-menu",menuStyle:"min-width: 100%;max-height: 270px;",store:new Common.Collections.Fonts,recent:0,hint:this.tipFontName})),this.cmbFonts[0].on("selected",_.bind(this.onFontSelect,this)),this.headerControls.push(this.cmbFonts[0]),this.cmbFonts.push(new Common.UI.ComboBoxFonts({el:$("#id-dlg-f-fonts"),cls:"input-group-nr",style:"width: 142px;",menuCls:"scrollable-menu",menuStyle:"min-width: 100%;max-height: 270px;",store:new Common.Collections.Fonts,recent:0,hint:this.tipFontName})),this.cmbFonts[1].on("selected",_.bind(this.onFontSelect,this)),this.footerControls.push(this.cmbFonts[1]),Common.NotificationCenter.on("fonts:change",_.bind(this.onApiChangeFont,this)),i=[{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"}],this.cmbFontSize=[],this.cmbFontSize.push(new Common.UI.ComboBox({el:$("#id-dlg-h-font-size"),cls:"input-group-nr",style:"width: 55px;",menuCls:"scrollable-menu",menuStyle:"min-width: 55px;max-height: 270px;",hint:this.tipFontSize,data:i})),this.cmbFontSize[0].on("selected",_.bind(this.onFontSizeSelect,this)),this.cmbFontSize[0].on("changed:before",_.bind(this.onFontSizeChanged,this,!0)),this.cmbFontSize[0].on("changed:after",_.bind(this.onFontSizeChanged,this,!1)),this.cmbFontSize[0].setValue(this._state.fontsize),this.headerControls.push(this.cmbFontSize[0]),this.cmbFontSize.push(new Common.UI.ComboBox({el:$("#id-dlg-f-font-size"),cls:"input-group-nr",style:"width: 55px;",menuCls:"scrollable-menu",menuStyle:"min-width: 55px;max-height: 270px;",hint:this.tipFontSize,data:i})),this.cmbFontSize[1].on("selected",_.bind(this.onFontSizeSelect,this)),this.cmbFontSize[1].on("changed:before",_.bind(this.onFontSizeChanged,this,!0)),this.cmbFontSize[1].on("changed:after",_.bind(this.onFontSizeChanged,this,!1)),this.cmbFontSize[1].setValue(this._state.fontsize),this.footerControls.push(this.cmbFontSize[1]),this.btnBold=[],this.btnBold.push(new Common.UI.Button({cls:"btn-toolbar",iconCls:"btn-bold",enableToggle:!0,hint:this.textBold})),this.btnBold[0].render($("#id-dlg-h-bold")),this.btnBold[0].on("click",_.bind(this.onBoldClick,this)),this.headerControls.push(this.btnBold[0]),this.btnBold.push(new Common.UI.Button({cls:"btn-toolbar",iconCls:"btn-bold",enableToggle:!0,hint:this.textBold})),this.btnBold[1].render($("#id-dlg-f-bold")),this.btnBold[1].on("click",_.bind(this.onBoldClick,this)),this.footerControls.push(this.btnBold[1]),this.btnItalic=[],this.btnItalic.push(new Common.UI.Button({cls:"btn-toolbar",iconCls:"btn-italic",enableToggle:!0,hint:this.textItalic})),this.btnItalic[0].render($("#id-dlg-h-italic")),this.btnItalic[0].on("click",_.bind(this.onItalicClick,this)),this.headerControls.push(this.btnItalic[0]),this.btnItalic.push(new Common.UI.Button({cls:"btn-toolbar",iconCls:"btn-italic",enableToggle:!0,hint:this.textItalic})),this.btnItalic[1].render($("#id-dlg-f-italic")),this.btnItalic[1].on("click",_.bind(this.onItalicClick,this)),this.footerControls.push(this.btnItalic[1]),this.btnUnderline=[],this.btnUnderline.push(new Common.UI.Button({cls:"btn-toolbar",iconCls:"btn-underline",enableToggle:!0,hint:this.textUnderline})),this.btnUnderline[0].render($("#id-dlg-h-underline")),this.btnUnderline[0].on("click",_.bind(this.onUnderlineClick,this)),this.headerControls.push(this.btnUnderline[0]),this.btnUnderline.push(new Common.UI.Button({cls:"btn-toolbar",iconCls:"btn-underline",enableToggle:!0,hint:this.textUnderline})),this.btnUnderline[1].render($("#id-dlg-f-underline")),this.btnUnderline[1].on("click",_.bind(this.onUnderlineClick,this)),this.footerControls.push(this.btnUnderline[1]),this.btnStrikeout=[],this.btnStrikeout.push(new Common.UI.Button({cls:"btn-toolbar",iconCls:"btn-strikeout",enableToggle:!0,hint:this.textStrikeout})),this.btnStrikeout[0].render($("#id-dlg-h-strikeout")),this.btnStrikeout[0].on("click",_.bind(this.onStrikeoutClick,this)),this.headerControls.push(this.btnStrikeout[0]),this.btnStrikeout.push(new Common.UI.Button({cls:"btn-toolbar",iconCls:"btn-strikeout",enableToggle:!0,hint:this.textStrikeout})),this.btnStrikeout[1].render($("#id-dlg-f-strikeout")),this.btnStrikeout[1].on("click",_.bind(this.onStrikeoutClick,this)),this.footerControls.push(this.btnStrikeout[1]),this.btnSuperscript=[],this.btnSuperscript.push(new Common.UI.Button({cls:"btn-toolbar",iconCls:"btn-superscript",enableToggle:!0,toggleGroup:"superscriptHFGroup",hint:this.textSuperscript})),this.btnSuperscript[0].render($("#id-dlg-h-superscript")),this.btnSuperscript[0].on("click",_.bind(this.onSuperscriptClick,this)),this.headerControls.push(this.btnSuperscript[0]),this.btnSuperscript.push(new Common.UI.Button({cls:"btn-toolbar",iconCls:"btn-superscript",enableToggle:!0,toggleGroup:"superscriptHFGroup",hint:this.textSuperscript})),this.btnSuperscript[1].render($("#id-dlg-f-superscript")),this.btnSuperscript[1].on("click",_.bind(this.onSuperscriptClick,this)),this.footerControls.push(this.btnSuperscript[1]),this.btnSubscript=[],this.btnSubscript.push(new Common.UI.Button({cls:"btn-toolbar",iconCls:"btn-subscript",enableToggle:!0,toggleGroup:"superscriptHFGroup",hint:this.textSubscript})),this.btnSubscript[0].render($("#id-dlg-h-subscript")),this.btnSubscript[0].on("click",_.bind(this.onSubscriptClick,this)),this.headerControls.push(this.btnSubscript[0]),this.btnSubscript.push(new Common.UI.Button({cls:"btn-toolbar",iconCls:"btn-subscript",enableToggle:!0,toggleGroup:"superscriptHFGroup",hint:this.textSubscript})),this.btnSubscript[1].render($("#id-dlg-f-subscript")),this.btnSubscript[1].on("click",_.bind(this.onSubscriptClick,this)),this.footerControls.push(this.btnSubscript[1]);var n=function(e,i){if(e&&e.cmpEl){e.currentColor="#000000";var n=$('
    ');$("button:first-child",e.cmpEl).append(n),n.css("background-color",e.currentColor);var o=new Common.UI.ThemeColorPalette({el:$(i)});o.currentColor=e.currentColor}return e.menu.cmpEl.on("click",i+"-new",_.bind(function(){o.addNewColor("object"==typeof e.color?e.color.color:e.color)},t)),o.on("select",_.bind(t.onColorSelect,t,e)),o};this.btnTextColor=[],this.btnTextColor.push(new Common.UI.Button({cls:"btn-toolbar",iconCls:"btn-fontcolor",hint:this.textColor,split:!0,menu:new Common.UI.Menu({items:[{template:_.template('
    ')},{template:_.template(''+this.textNewColor+"")}]})})),this.btnTextColor[0].render($("#id-dlg-h-textcolor")),this.btnTextColor[0].on("click",_.bind(this.onTextColor,this)),this.mnuTextColorPicker=[],this.mnuTextColorPicker.push(n(this.btnTextColor[0],"#id-dlg-h-menu-fontcolor")),this.headerControls.push(this.btnTextColor[0]),this.btnTextColor.push(new Common.UI.Button({cls:"btn-toolbar",iconCls:"btn-fontcolor",hint:this.textColor,split:!0,menu:new Common.UI.Menu({items:[{template:_.template('
    ')},{template:_.template(''+this.textNewColor+"")}]})})),this.btnTextColor[1].render($("#id-dlg-f-textcolor")),this.btnTextColor[1].on("click",_.bind(this.onTextColor,this)),this.mnuTextColorPicker.push(n(this.btnTextColor[1],"#id-dlg-f-menu-fontcolor")),this.footerControls.push(this.btnTextColor[1]),this.btnOk=new Common.UI.Button({el:e.find(".primary")}),e.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this)),this.scrollers=[],this.initCanvas("#header-left-img"),this.initCanvas("#header-center-img"),this.initCanvas("#header-right-img"),this.initCanvas("#footer-left-img"),this.initCanvas("#footer-center-img"),this.initCanvas("#footer-right-img"),this.wrapEvents={onApiEditorSelectionChanged:_.bind(this.onApiEditorSelectionChanged,this),onApiResizeEditorHeight:_.bind(this.onApiResizeEditorHeight,this),onUpdateEditorCursorPosition:_.bind(this.onUpdateEditorCursorPosition,this)},this.afterRender()},initCanvas:function(t){var e=this.$window.find(t);e.on("click",_.bind(this.onCanvasClick,this,t)),this.canvasBoxHeight=e.height(),this.scrollers[t]=new Common.UI.Scroller({el:e.parent(),minScrollbarLength:20}),this.scrollers[t].update(),this.scrollers[t].scrollTop(0)},show:function(){Common.UI.Window.prototype.show.apply(this,arguments)},close:function(){this.api.asc_unregisterCallback("asc_onEditorSelectionChanged",this.wrapEvents.onApiEditorSelectionChanged),this.api.asc_unregisterCallback("asc_resizeEditorHeight",this.wrapEvents.onApiResizeEditorHeight),this.api.asc_unregisterCallback("asc_updateEditorCursorPosition",this.wrapEvents.onUpdateEditorCursorPosition),Common.UI.Window.prototype.close.apply(this,arguments),this.HFObject&&this.HFObject.destroy()},afterRender:function(){this.api.asc_registerCallback("asc_onEditorSelectionChanged",this.wrapEvents.onApiEditorSelectionChanged),this.api.asc_registerCallback("asc_resizeEditorHeight",this.wrapEvents.onApiResizeEditorHeight),this.api.asc_registerCallback("asc_updateEditorCursorPosition",this.wrapEvents.onUpdateEditorCursorPosition),this.cmbFonts[0].fillFonts(this.fontStore),this.cmbFonts[0].selectRecord(this.fontStore.findWhere({name:this._state.fontname})||this.fontStore.at(0)),this.cmbFonts[1].fillFonts(this.fontStore),this.cmbFonts[1].selectRecord(this.fontStore.findWhere({name:this._state.fontname})||this.fontStore.at(0)),this.updateThemeColors(),this.HFObject=new AscCommonExcel.CHeaderFooterEditor(["header-left-img","header-center-img","header-right-img","footer-left-img","footer-center-img","footer-right-img"],205),this._setDefaults(this.props), -this.editorCanvas=this.$window.find("#ce-canvas-menu");var t=this;_.delay(function(){t.onCanvasClick("#header-left-img")},500)},_setDefaults:function(t){var e=[];this.HFObject.getTextPresetsArr().forEach(function(t,i){e.push({displayValue:t,value:i})}),this.cmbPresetsH.setData(e),this.cmbPresetsH.setValue(this.textPresets),this.cmbPresetsF.setData(e),this.cmbPresetsF.setValue(this.textPresets),this.chOddPage.setValue(this.HFObject.getDifferentOddEven()),this.chFirstPage.setValue(this.HFObject.getDifferentFirst()),this.chAlign.setValue(this.HFObject.getAlignWithMargins()),this.chScale.setValue(this.HFObject.getScaleWithDoc());var i="checked"==this.chOddPage.getValue();this.btnOdd.setVisible(i),this.btnEven.setVisible(i),this.btnAll.setVisible(!i),i?this.btnOdd.toggle(!0):this.btnAll.toggle(!0),i="checked"==this.chFirstPage.getValue(),this.btnFirst.setVisible(i)},updateThemeColors:function(){this.mnuTextColorPicker[0].updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors()),this.mnuTextColorPicker[1].updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors())},getSettings:function(){return{}},onBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value)},onPrimary:function(t){return this._handleInput("ok"),!1},_handleInput:function(t){if(this.HFObject){var e=this.HFObject.destroy("ok"==t);if(e){var i=this;return void this.showError(function(){_.delay(function(){i.onCanvasClick(e)},50)})}this.HFObject=null}this.options.handler&&this.options.handler.call(this,this,t),this.close()},showError:function(t){Common.UI.warning({title:this.notcriticalErrorTitle,msg:this.textMaxError,callback:t})},scrollerUpdate:function(){for(var t in this.scrollers)this.scrollers[t]&&this.scrollers[t].update()},scrollerScrollTop:function(){for(var t in this.scrollers)this.scrollers[t]&&this.scrollers[t].scrollTop(0)},onCanvasClick:function(t,e){if(this.HFObject){t=t||"#header-left-img";var i=this.currentCanvas!==t;if(i){this.currentCanvas=t,this.isFooter="#footer-left-img"==t||"#footer-center-img"==t||"#footer-right-img"==t;var n=this;this.headerControls.forEach(function(t){t.setDisabled(n.isFooter)}),this.footerControls.forEach(function(t){t.setDisabled(!n.isFooter)})}if(e){var o=$(e.currentTarget).parent(),s=o.offset();this.HFObject.click(t,e.pageX*Common.Utils.zoom()-s.left,e.pageY*Common.Utils.zoom()-s.top+o.scrollTop())}else this.HFObject.click(t);i&&this.scrollerUpdate()}},onApiResizeEditorHeight:function(t){if(this.editorCanvas){var e=this.editorCanvas.height();e!=this.editorCanvasHeight&&(this.editorCanvasHeight=e,this.scrollers[this.currentCanvas]&&this.scrollers[this.currentCanvas].update())}},onUpdateEditorCursorPosition:function(t,e){if(this.editorCanvas){var i=this.currentCanvas;if(this.scrollers[i]){var n=this.scrollers[i].getScrollTop();t+e>n+this.canvasBoxHeight?this.scrollers[i].scrollTop(t+e-this.canvasBoxHeight):t409?409:o<1?1:Math.floor(2*(o+.4))/2,e.setRawValue(o),this.HFObject&&this.HFObject.setFontSize(o)},onBoldClick:function(t,e){this.HFObject&&(this.HFObject.setBold(t.pressed),this.scrollerUpdate())},onItalicClick:function(t,e){this.HFObject&&(this.HFObject.setItalic(t.pressed),this.scrollerUpdate())},onUnderlineClick:function(t,e){this.HFObject&&(this.HFObject.setUnderline(t.pressed),this.scrollerUpdate())},onStrikeoutClick:function(t,e){this.HFObject&&(this.HFObject.setStrikeout(t.pressed),this.scrollerUpdate())},onSuperscriptClick:function(t,e){this.HFObject&&(this.HFObject.setSuperscript(t.pressed),this.scrollerUpdate())},onSubscriptClick:function(t,e){this.HFObject&&(this.HFObject.setSubscript(t.pressed),this.scrollerUpdate())},onTextColor:function(){var t=this.mnuTextColorPicker[this.isFooter?1:0];t.trigger("select",t,t.currentColor,!0)},onColorSelect:function(t,e,i){var n="object"==typeof i?i.color:i;t.currentColor=i,$(".btn-color-value-line",t.cmpEl).css("background-color","#"+n),e.currentColor=i,this.HFObject&&this.HFObject.setTextColor(Common.Utils.ThemeColor.getRgbColor(i)),this.onCanvasClick(this.currentCanvas)},onPageTypeToggle:function(t,e,i){if(!this._pagetype&&i&&this.HFObject){var n=this.HFObject.getPageType(),o=this.HFObject.switchHeaderFooterType(t);if(o){this._pagetype=!0;var s=this;return void this.showError(function(){switch(n){case Asc.c_oAscHeaderFooterType.odd:s.btnOdd.isVisible()?s.btnOdd.toggle(!0):s.btnAll.toggle(!0);break;case Asc.c_oAscHeaderFooterType.even:s.btnEven.toggle(!0);break;case Asc.c_oAscHeaderFooterType.first:s.btnFirst.toggle(!0)}_.delay(function(){s.onCanvasClick(o)},50),s._pagetype=!1})}this.scrollerScrollTop(),this.onCanvasClick(this.currentCanvas,void 0,!0)}},onApiChangeFont:function(t){this.cmbFonts[this.isFooter?1:0].onApiChangeFont(t)},onApiEditorSelectionChanged:function(t){var e,i=this.isFooter?1:0;t.asc_getName()!=this.cmbFonts[i].getValue()&&Common.NotificationCenter.trigger("fonts:change",t),e=t.asc_getBold(),this.btnBold[i].isActive()!==e&&this.btnBold[i].toggle(!0===e,!0),e=t.asc_getItalic(),this.btnItalic[i].isActive()!==e&&this.btnItalic[i].toggle(!0===e,!0),e=t.asc_getUnderline(),this.btnUnderline[i].isActive()!==e&&this.btnUnderline[i].toggle(!0===e,!0),e=t.asc_getStrikeout(),this.btnStrikeout[i].isActive()!==e&&this.btnStrikeout[i].toggle(!0===e,!0),e=t.asc_getSubscript(),this.btnSubscript[i].isActive()!==e&&this.btnSubscript[i].toggle(!0===e,!0),e=t.asc_getSuperscript(),this.btnSuperscript[i].isActive()!==e&&this.btnSuperscript[i].toggle(!0===e,!0);var n=t.asc_getSize();this.cmbFontSize[i].getValue()!==n&&this.cmbFontSize[i].setValue(void 0!==n?n:"");var o,s,a=this.mnuTextColorPicker[i];if(s=t.asc_getColor(),s&&(o=s.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?{color:Common.Utils.ThemeColor.getHexColor(s.get_r(),s.get_g(),s.get_b()),effectValue:s.get_value()}:Common.Utils.ThemeColor.getHexColor(s.get_r(),s.get_g(),s.get_b())),_.isObject(o)){for(var l=!1,r=0;r<10;r++)if(Common.Utils.ThemeColor.ThemeValues[r]==o.effectValue){a.select(o,!0),l=!0;break}l||a.clearSelection()}else a.select(o,!0)},cancelButtonText:"Cancel",okButtonText:"Ok",tipFontName:"Font",tipFontSize:"Font size",textBold:"Bold",textItalic:"Italic",textUnderline:"Underline",textStrikeout:"Strikeout",textSuperscript:"Superscript",textSubscript:"Subscript",textTitle:"Header/Footer Settings",textHeader:"Header",textFooter:"Footer",textLeft:"Left",textCenter:"Center",textRight:"Right",textPageNum:"Page number",textPageCount:"Page count",textDate:"Date",textTime:"Time",textFileName:"File name",textSheet:"Sheet name",textColor:"Text color",textNewColor:"Add New Custom Color",textInsert:"Insert",textPresets:"Presets",textDiffFirst:"Different first page",textDiffOdd:"Different odd and even pages",textScale:"Scale with document",textAlign:"Align with page margins",textFirst:"First page",textOdd:"Odd page",textEven:"Even page",textAll:"All pages",textMaxError:"The text string you entered is too long. Reduce the number of characters used."},SSE.Views.HeaderFooterDialog||{}))}),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/view/SelectFileDlg","common/main/lib/util/define","spreadsheeteditor/main/app/view/Toolbar","spreadsheeteditor/main/app/collection/TableTemplates","spreadsheeteditor/main/app/controller/PivotTable","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","spreadsheeteditor/main/app/view/PageMarginsDialog","spreadsheeteditor/main/app/view/HeaderFooterDialog"],function(){"use strict";SSE.Controllers.Toolbar=Backbone.Controller.extend(_.extend({models:[],collections:[],views:["Toolbar"],initialize:function(){var t=this;this.addListeners({Toolbar:{"change:compact":this.onClickChangeCompact.bind(t)},FileMenu:{"menu:hide":t.onFileMenu.bind(t,"hide"),"menu:show":t.onFileMenu.bind(t,"show")},Statusbar:{"sheet:changed":_.bind(this.onApiSheetChanged,this)},"Common.Views.Header":{"toolbar:setcompact":this.onChangeViewMode.bind(this),print:function(t){this.getApplication().getController("Main").onPrint()},save:function(t){this.api.asc_Save()},undo:this.onUndo,redo:this.onRedo,downloadas:function(t){var e,i=this.getApplication().getController("Main"),n=i.appOptions.spreadsheet.fileType;n&&(e=Asc.c_oAscFileType[n.toUpperCase()]);var o=[Asc.c_oAscFileType.XLSX,Asc.c_oAscFileType.ODS,Asc.c_oAscFileType.CSV,Asc.c_oAscFileType.PDFA,Asc.c_oAscFileType.XLTX,Asc.c_oAscFileType.OTS];(!e||o.indexOf(e)<0)&&(e=Asc.c_oAscFileType.PDF),e==Asc.c_oAscFileType.PDF||e==Asc.c_oAscFileType.PDFA?Common.NotificationCenter.trigger("download:settings",this.toolbar,e):i.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(e))},"go:editor":function(){Common.Gateway.requestEditRights()}},DataTab:{"data:sort":this.onSortType,"data:setfilter":this.onAutoFilter,"data:clearfilter":this.onClearFilter}}),Common.NotificationCenter.on("page:settings",_.bind(this.onApiSheetChanged,this)),Common.NotificationCenter.on("formula:settings",_.bind(this.applyFormulaSettings,this)),this.editMode=!0,this._isAddingShape=!1,this._state={activated:!1,prstyle:void 0,clrtext:void 0,pralign:void 0,clrback:void 0,valign:void 0,can_undo:void 0,can_redo:void 0,bold:void 0,italic:void 0,underline:void 0,strikeout:void 0,subscript:void 0,superscript:void 0,wrap:void 0,merge:void 0,angle:void 0,controlsdisabled:{rows:void 0,cols:void 0,cells_right:void 0,cells_down:void 0,filters:void 0},selection_type:void 0,filter:void 0,filterapplied:!1,tablestylename:void 0,tablename:void 0,namedrange_locked:!1,fontsize:void 0,multiselect:!1,sparklines_disabled:!1,numformatinfo:void 0,numformattype:void 0,numformat:void 0,langId:void 0,pgsize:[0,0],pgmargins:void 0,pgorient:void 0,lock_doc:void 0};var e=function(e,i){var n=$(e.target),o=n.closest("#editor_sdk"),s=n.closest("button").attr("id");void 0===s&&(s=n.closest(".btn-group").attr("id")),t.api&&t.api.asc_isAddAutoshape()&&(o.length<=0||"cancel"==i)&&(t.toolbar.btnInsertText.pressed&&s!=t.toolbar.btnInsertText.id||t.toolbar.btnInsertShape.pressed&&s!=t.toolbar.btnInsertShape.id?(t._isAddingShape=!1,t._addAutoshape(!1),t.toolbar.btnInsertShape.toggle(!1,!0),t.toolbar.btnInsertText.toggle(!1,!0),Common.NotificationCenter.trigger("edit:complete",t.toolbar)):t.toolbar.btnInsertShape.pressed&&s==t.toolbar.btnInsertShape.id&&_.defer(function(){t.api.asc_endAddShape(),Common.NotificationCenter.trigger("edit:complete",t.toolbar)},100))};this.checkInsertAutoshape=function(t){e({},t.action)},this._addAutoshape=function(t,i){this.api&&(t?(this.api.asc_startAddShape(i),$(document.body).on("mouseup",e)):(this.api.asc_endAddShape(),$(document.body).off("mouseup",e)))},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",e)}},onLaunch:function(){this.toolbar=this.createView("Toolbar"),Common.NotificationCenter.on("app:ready",this.onAppReady.bind(this)),Common.NotificationCenter.on("app:face",this.onAppShowed.bind(this))},setMode:function(t){this.mode=t,this.toolbar.applyLayout(t)},attachUIEvents:function(t){var e=this;e.appConfig.isEditDiagram?(t.btnUndo.on("click",_.bind(this.onUndo,this)),t.btnRedo.on("click",_.bind(this.onRedo,this)),t.btnCopy.on("click",_.bind(this.onCopyPaste,this,!0)),t.btnPaste.on("click",_.bind(this.onCopyPaste,this,!1)),t.btnInsertFormula.on("click",_.bind(this.onInsertFormulaMenu,this)),t.btnInsertFormula.menu.on("item:click",_.bind(this.onInsertFormulaMenu,this)),t.btnDecDecimal.on("click",_.bind(this.onDecrement,this)),t.btnIncDecimal.on("click",_.bind(this.onIncrement,this)),t.cmbNumberFormat.on("selected",_.bind(this.onNumberFormatSelect,this)),t.cmbNumberFormat.on("show:before",_.bind(this.onNumberFormatOpenBefore,this,!0)),t.cmbNumberFormat.cmpEl&&t.cmbNumberFormat.cmpEl.on("click","#id-toolbar-mnu-item-more-formats a",_.bind(this.onNumberFormatSelect,this)),t.btnEditChart.on("click",_.bind(this.onEditChart,this))):e.appConfig.isEditMailMerge?(t.btnUndo.on("click",_.bind(this.onUndo,this)),t.btnRedo.on("click",_.bind(this.onRedo,this)),t.btnCopy.on("click",_.bind(this.onCopyPaste,this,!0)),t.btnPaste.on("click",_.bind(this.onCopyPaste,this,!1)),t.btnSearch.on("click",_.bind(this.onSearch,this)),t.btnSortDown.on("click",_.bind(this.onSortType,this,Asc.c_oAscSortOptions.Ascending)),t.btnSortUp.on("click",_.bind(this.onSortType,this,Asc.c_oAscSortOptions.Descending)),t.btnSetAutofilter.on("click",_.bind(this.onAutoFilter,this)),t.btnClearAutofilter.on("click",_.bind(this.onClearFilter,this))):(t.btnPrint.on("click",_.bind(this.onPrint,this)),t.btnPrint.on("disabled",_.bind(this.onBtnChangeState,this,"print:disabled")),t.btnSave.on("click",_.bind(this.onSave,this)),t.btnSave.on("disabled",_.bind(this.onBtnChangeState,this,"save:disabled")),t.btnUndo.on("click",_.bind(this.onUndo,this)),t.btnUndo.on("disabled",_.bind(this.onBtnChangeState,this,"undo:disabled")),t.btnRedo.on("click",_.bind(this.onRedo,this)),t.btnRedo.on("disabled",_.bind(this.onBtnChangeState,this,"redo:disabled")),t.btnCopy.on("click",_.bind(this.onCopyPaste,this,!0)),t.btnPaste.on("click",_.bind(this.onCopyPaste,this,!1)),t.btnIncFontSize.on("click",_.bind(this.onIncreaseFontSize,this)),t.btnDecFontSize.on("click",_.bind(this.onDecreaseFontSize,this)),t.btnBold.on("click",_.bind(this.onBold,this)),t.btnItalic.on("click",_.bind(this.onItalic,this)),t.btnUnderline.on("click",_.bind(this.onUnderline,this)),t.btnStrikeout.on("click",_.bind(this.onStrikeout,this)),t.btnSubscript.on("click",_.bind(this.onSubscript,this)),t.btnSubscript.menu.on("item:click",_.bind(this.onSubscriptMenu,this)),t.btnTextColor.on("click",_.bind(this.onTextColor,this)),t.btnBackColor.on("click",_.bind(this.onBackColor,this)),t.mnuTextColorPicker.on("select",_.bind(this.onTextColorSelect,this)),t.mnuBackColorPicker.on("select",_.bind(this.onBackColorSelect,this)),t.btnBorders.on("click",_.bind(this.onBorders,this)),t.btnBorders.rendered&&(t.btnBorders.menu.on("item:click",_.bind(this.onBordersMenu,this)),t.mnuBorderWidth.on("item:toggle",_.bind(this.onBordersWidth,this)),t.mnuBorderColorPicker.on("select",_.bind(this.onBordersColor,this))),t.btnAlignLeft.on("click",_.bind(this.onHorizontalAlign,this,AscCommon.align_Left)),t.btnAlignCenter.on("click",_.bind(this.onHorizontalAlign,this,AscCommon.align_Center)),t.btnAlignRight.on("click",_.bind(this.onHorizontalAlign,this,AscCommon.align_Right)),t.btnAlignJust.on("click",_.bind(this.onHorizontalAlign,this,AscCommon.align_Justify)),t.btnHorizontalAlign.menu.on("item:click",_.bind(this.onHorizontalAlignMenu,this)),t.btnVerticalAlign.menu.on("item:click",_.bind(this.onVerticalAlignMenu,this)),t.btnMerge.on("click",_.bind(this.onMergeCellsMenu,this,t.btnMerge.menu,t.btnMerge.menu.items[0])),t.btnMerge.menu.on("item:click",_.bind(this.onMergeCellsMenu,this)),t.btnAlignTop.on("click",_.bind(this.onVerticalAlign,this,Asc.c_oAscVAlign.Top)),t.btnAlignMiddle.on("click",_.bind(this.onVerticalAlign,this,Asc.c_oAscVAlign.Center)),t.btnAlignBottom.on("click",_.bind(this.onVerticalAlign,this,Asc.c_oAscVAlign.Bottom)),t.btnWrap.on("click",_.bind(this.onWrap,this)),t.btnTextOrient.menu.on("item:click",_.bind(this.onTextOrientationMenu,this)),t.btnInsertTable.on("click",_.bind(this.onBtnInsertTableClick,this)),t.btnInsertImage.menu.on("item:click",_.bind(this.onInsertImageMenu,this)),t.btnInsertHyperlink.on("click",_.bind(this.onHyperlink,this)),t.mnuInsertChartPicker.on("item:click",_.bind(this.onSelectChart,this)),t.btnInsertText.on("click",_.bind(this.onBtnInsertTextClick,this)),t.btnInsertShape.menu.on("hide:after",_.bind(this.onInsertShapeHide,this)),t.btnInsertEquation.on("click",_.bind(this.onInsertEquationClick,this)),t.btnTableTemplate.menu.on("show:after",_.bind(this.onTableTplMenuOpen,this)),t.btnPercentStyle.on("click",_.bind(this.onNumberFormat,this)),t.btnCurrencyStyle.on("click",_.bind(this.onNumberFormat,this)),t.btnDecDecimal.on("click",_.bind(this.onDecrement,this)),t.btnIncDecimal.on("click",_.bind(this.onIncrement,this)),t.btnInsertFormula.on("click",_.bind(this.onInsertFormulaMenu,this)),t.btnInsertFormula.menu.on("item:click",_.bind(this.onInsertFormulaMenu,this)),t.btnNamedRange.menu.on("item:click",_.bind(this.onNamedRangeMenu,this)),t.btnNamedRange.menu.on("show:after",_.bind(this.onNamedRangeMenuOpen,this)),t.btnClearStyle.menu.on("item:click",_.bind(this.onClearStyleMenu,this)),t.btnAddCell.menu.on("item:click",_.bind(this.onCellInsertMenu,this)),t.btnCopyStyle.on("toggle",_.bind(this.onCopyStyleToggle,this)),t.btnDeleteCell.menu.on("item:click",_.bind(this.onCellDeleteMenu,this)),t.btnColorSchemas.menu.on("item:click",_.bind(this.onColorSchemaClick,this)),t.btnColorSchemas.menu.on("show:after",_.bind(this.onColorSchemaShow,this)),t.cmbFontName.on("selected",_.bind(this.onFontNameSelect,this)),t.cmbFontName.on("show:after",_.bind(this.onComboOpen,this,!0)),t.cmbFontName.on("hide:after",_.bind(this.onHideMenus,this)),t.cmbFontName.on("combo:blur",_.bind(this.onComboBlur,this)),t.cmbFontName.on("combo:focusin",_.bind(this.onComboOpen,this,!1)),t.cmbFontSize.on("selected",_.bind(this.onFontSizeSelect,this)),t.cmbFontSize.on("changed:before",_.bind(this.onFontSizeChanged,this,!0)),t.cmbFontSize.on("changed:after",_.bind(this.onFontSizeChanged,this,!1)),t.cmbFontSize.on("show:after",_.bind(this.onComboOpen,this,!0)),t.cmbFontSize.on("hide:after",_.bind(this.onHideMenus,this)),t.cmbFontSize.on("combo:blur",_.bind(this.onComboBlur,this)),t.cmbFontSize.on("combo:focusin",_.bind(this.onComboOpen,this,!1)),t.listStyles.on("click",_.bind(this.onListStyleSelect,this)),t.cmbNumberFormat.on("selected",_.bind(this.onNumberFormatSelect,this)),t.cmbNumberFormat.on("show:before",_.bind(this.onNumberFormatOpenBefore,this,!0)),t.cmbNumberFormat.cmpEl&&t.cmbNumberFormat.cmpEl.on("click","#id-toolbar-mnu-item-more-formats a",_.bind(this.onNumberFormatSelect,this)),t.btnCurrencyStyle.menu.on("item:click",_.bind(this.onNumberFormatMenu,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)),t.btnPageOrient.menu.on("item:click",_.bind(this.onPageOrientSelect,this)),t.btnPageMargins.menu.on("item:click",_.bind(this.onPageMarginsSelect,this)),t.mnuPageSize.on("item:click",_.bind(this.onPageSizeClick,this)),t.btnPrintArea.menu.on("item:click",_.bind(this.onPrintAreaClick,this)),t.btnPrintArea.menu.on("show:after",_.bind(this.onPrintAreaMenuOpen,this)),t.btnImgGroup.menu.on("item:click",_.bind(this.onImgGroupSelect,this)),t.btnImgBackward.menu.on("item:click",_.bind(this.onImgArrangeSelect,this)),t.btnImgForward.menu.on("item:click",_.bind(this.onImgArrangeSelect,this)),t.btnImgAlign.menu.on("item:click",_.bind(this.onImgAlignSelect,this)),t.btnImgForward.on("click",this.onImgArrangeSelect.bind(this,"forward")),t.btnImgBackward.on("click",this.onImgArrangeSelect.bind(this,"backward")),t.btnEditHeader.on("click",_.bind(this.onEditHeaderClick,this)),Common.Gateway.on("insertimage",_.bind(this.insertImage,this)),this.onSetupCopyStyleButton())},setApi:function(t){this.api=t;var e=SSE.getController("Main").appOptions;e.isEditDiagram||e.isEditMailMerge||(this.api.asc_registerCallback("asc_onSendThemeColors",_.bind(this.onSendThemeColors,this)),this.api.asc_registerCallback("asc_onMathTypes",_.bind(this.onMathTypes,this)),this.api.asc_registerCallback("asc_onContextMenu",_.bind(this.onContextMenu,this))),this.api.asc_registerCallback("asc_onInitEditorStyles",_.bind(this.onApiInitEditorStyles,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_onLockDefNameManager",_.bind(this.onLockDefNameManager,this)),this.api.asc_registerCallback("asc_onZoomChanged",_.bind(this.onApiZoomChange,this)),Common.NotificationCenter.on("fonts:change",_.bind(this.onApiChangeFont,this))},onApiChangeFont:function(t){!this.getApplication().getController("Main").isModalShowed&&this.toolbar.cmbFontName.onApiChangeFont(t)},onContextMenu:function(){this.toolbar.collapse()},onPrint:function(t){Common.NotificationCenter.trigger("print",this.toolbar)},onSave:function(t){if(this.api){var e=this.api.asc_isDocumentCanSave(),i=this.toolbar.btnCollabChanges&&this.toolbar.btnCollabChanges.$icon.hasClass("btn-synch");if(!e&&!i&&!this.toolbar.mode.forcesave)return;this.api.asc_Save()}Common.component.Analytics.trackEvent("Save"),Common.component.Analytics.trackEvent("ToolBar","Save")},onBtnChangeState:function(t){if(/\:disabled$/.test(t)){var e=arguments[2];this.toolbar.fireEvent(t,[e])}},onUndo:function(t,e){this.api&&this.api.asc_Undo(),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Undo")},onRedo:function(t,e){this.api&&this.api.asc_Redo(),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Redo")},onCopyPaste:function(t,e){var i=this;if(i.api){if(t?i.api.asc_Copy():i.api.asc_Paste())Common.component.Analytics.trackEvent("ToolBar","Copy Warning");else{var n=Common.localStorage.getItem("sse-hide-copywarning");n&&1==parseInt(n)||new Common.Views.CopyWarningDialog({handler:function(t){t&&Common.localStorage.setItem("sse-hide-copywarning",1),Common.NotificationCenter.trigger("edit:complete",i.toolbar)}}).show()}}Common.NotificationCenter.trigger("edit:complete",i.toolbar)},onIncreaseFontSize:function(t){this.api&&this.api.asc_increaseFontSize(),Common.NotificationCenter.trigger("edit:complete",this.toolbar,{restorefocus:!0}),Common.component.Analytics.trackEvent("ToolBar","Font Size")},onDecreaseFontSize:function(t){this.api&&this.api.asc_decreaseFontSize(),Common.NotificationCenter.trigger("edit:complete",this.toolbar,{restorefocus:!0}),Common.component.Analytics.trackEvent("ToolBar","Font Size")},onBold:function(t,e){this._state.bold=void 0,this.api&&this.api.asc_setCellBold(t.pressed),Common.NotificationCenter.trigger("edit:complete",this.toolbar,{restorefocus:!0}),Common.component.Analytics.trackEvent("ToolBar","Bold")},onItalic:function(t,e){this._state.italic=void 0,this.api&&this.api.asc_setCellItalic(t.pressed),Common.NotificationCenter.trigger("edit:complete",this.toolbar,{restorefocus:!0}),Common.component.Analytics.trackEvent("ToolBar","Italic")},onUnderline:function(t,e){this._state.underline=void 0,this.api&&this.api.asc_setCellUnderline(t.pressed),Common.NotificationCenter.trigger("edit:complete",this.toolbar,{restorefocus:!0}),Common.component.Analytics.trackEvent("ToolBar","Underline")},onStrikeout:function(t,e){this._state.strikeout=void 0,this.api&&this.api.asc_setCellStrikeout(t.pressed),Common.NotificationCenter.trigger("edit:complete",this.toolbar,{restorefocus:!0}),Common.component.Analytics.trackEvent("ToolBar","Strikeout")},onSubscriptMenu:function(t,e){var i=this.toolbar.btnSubscript;"sub"==e.value?(this._state.subscript=void 0,this.api.asc_setCellSubscript(e.checked)):(this._state.superscript=void 0,this.api.asc_setCellSuperscript(e.checked)),e.checked&&(i.$icon.removeClass(i.options.icls).addClass(e.options.icls),i.options.icls=e.options.icls),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","sub"==e.value?"Subscript":"Superscript")},onSubscript:function(t,e){var i="btn-subscript"==t.options.icls;i?(this._state.subscript=void 0,this.api.asc_setCellSubscript(t.pressed)):(this._state.superscript=void 0,this.api.asc_setCellSuperscript(t.pressed)),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar",i?"Subscript":"Superscript")},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(t,e,i){this._state.clrtext_asccolor=this._state.clrtext=void 0;var n="object"==typeof e?e.color:e;this.toolbar.btnTextColor.currentColor=e,$(".btn-color-value-line",this.toolbar.btnTextColor.cmpEl).css("background-color","#"+n),this.toolbar.mnuTextColorPicker.currentColor=e,this.api&&(this.toolbar.btnTextColor.ischanged=!0!==i,this.api.asc_setCellTextColor(Common.Utils.ThemeColor.getRgbColor(e)),this.toolbar.btnTextColor.ischanged=!1),Common.NotificationCenter.trigger("edit:complete",this.toolbar,{restorefocus:!0}),Common.component.Analytics.trackEvent("ToolBar","Text Color")},onBackColorSelect:function(t,e,i){this._state.clrshd_asccolor=this._state.clrback=void 0;var n="object"==typeof e?e.color:e;this.toolbar.btnBackColor.currentColor=e,$(".btn-color-value-line",this.toolbar.btnBackColor.cmpEl).css("background-color","transparent"==n?"transparent":"#"+n),this.toolbar.mnuBackColorPicker.currentColor=e,this.api&&(this.toolbar.btnBackColor.ischanged=!0!==i,this.api.asc_setCellBackgroundColor("transparent"==e?null:Common.Utils.ThemeColor.getRgbColor(e)),this.toolbar.btnBackColor.ischanged=!1),Common.component.Analytics.trackEvent("ToolBar","Background Color")},onNewTextColor:function(t,e){this.toolbar.mnuTextColorPicker.addNewColor()},onNewBackColor:function(t,e){this.toolbar.mnuBackColorPicker.addNewColor()},onNewBorderColor:function(t,e){this.toolbar.btnBorders.menu.hide(),this.toolbar.btnBorders.toggle(!1,!0),this.toolbar.mnuBorderColorPicker.addNewColor()},onBorders:function(t){var e;_.each(t.menu.items,function(i){if(t.options.borderId==i.options.borderId)return e=i,!1}),e&&this.onBordersMenu(t.menu,e)},onBordersMenu:function(t,e){var i=this;if(i.api&&!_.isUndefined(e.options.borderId)){var n=i.toolbar.btnBorders,o=[],s=n.options.borderswidth,a=n.options.borderscolor;n.rendered&&(n.$icon.removeClass(n.options.icls).addClass(e.options.icls),n.options.icls=e.options.icls),n.options.borderId=e.options.borderId,"inner"==e.options.borderId?(o[Asc.c_oAscBorderOptions.InnerV]=new Asc.asc_CBorder(s,a),o[Asc.c_oAscBorderOptions.InnerH]=new Asc.asc_CBorder(s,a)):"all"==e.options.borderId?(o[Asc.c_oAscBorderOptions.InnerV]=new Asc.asc_CBorder(s,a),o[Asc.c_oAscBorderOptions.InnerH]=new Asc.asc_CBorder(s,a),o[Asc.c_oAscBorderOptions.Left]=new Asc.asc_CBorder(s,a),o[Asc.c_oAscBorderOptions.Top]=new Asc.asc_CBorder(s,a),o[Asc.c_oAscBorderOptions.Right]=new Asc.asc_CBorder(s,a),o[Asc.c_oAscBorderOptions.Bottom]=new Asc.asc_CBorder(s,a)):"outer"==e.options.borderId?(o[Asc.c_oAscBorderOptions.Left]=new Asc.asc_CBorder(s,a),o[Asc.c_oAscBorderOptions.Top]=new Asc.asc_CBorder(s,a),o[Asc.c_oAscBorderOptions.Right]=new Asc.asc_CBorder(s,a),o[Asc.c_oAscBorderOptions.Bottom]=new Asc.asc_CBorder(s,a)):"none"!=e.options.borderId&&(o[e.options.borderId]=new Asc.asc_CBorder(s,a)),i.api.asc_setCellBorders(o),Common.NotificationCenter.trigger("edit:complete",i.toolbar),Common.component.Analytics.trackEvent("ToolBar","Borders")}},onBordersWidth:function(t,e,i){i&&(this.toolbar.btnBorders.options.borderswidth=e.value,Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Border Width"))},onBordersColor:function(t,e){$("#id-toolbar-mnu-item-border-color .menu-item-icon").css("border-color","#"+("object"==typeof e?e.color:e)),this.toolbar.mnuBorderColor.onUnHoverItem(),this.toolbar.btnBorders.options.borderscolor=Common.Utils.ThemeColor.getRgbColor(e),this.toolbar.mnuBorderColorPicker.currentColor=e,Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Border Color")},onHorizontalAlign:function(t,e,i){this._state.pralign=void 0,this.api&&(this.api.asc_setCellAlign(e.pressed?t:null),this.toolbar.btnWrap.allowDepress=!(t==AscCommon.align_Justify)),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Horizontal align")},onHorizontalAlignMenu:function(t,e){var i=this.toolbar.btnHorizontalAlign;i.$icon.removeClass(i.options.icls),i.options.icls=e.checked?e.options.icls:"btn-align-left",i.$icon.addClass(i.options.icls),this._state.pralign=void 0,this.api&&this.api.asc_setCellAlign(e.checked?e.value:null),this.toolbar.btnWrap.allowDepress=!(e.value==AscCommon.align_Justify),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Horizontal Align")},onVerticalAlignMenu:function(t,e){var i=this.toolbar.btnVerticalAlign;i.$icon.removeClass(i.options.icls),i.options.icls=e.checked?e.options.icls:"btn-valign-bottom",i.$icon.addClass(i.options.icls),this._state.valign=void 0,this.api&&this.api.asc_setCellVertAlign(e.checked?e.value:Asc.c_oAscVAlign.Bottom),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Vertical Align")},onVerticalAlign:function(t,e,i){this._state.valign=void 0,this.api&&this.api.asc_setCellVertAlign(e.pressed?t:Asc.c_oAscVAlign.Bottom),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Vertical align")},onMergeCellsMenu:function(t,e){function i(t){n._state.merge=void 0,n.api.asc_mergeCells(t),Common.NotificationCenter.trigger("edit:complete",n.toolbar),Common.component.Analytics.trackEvent("ToolBar","Merge")}var n=this;if(n.api){n.api.asc_getCellInfo().asc_getFlags().asc_getMerge()!==Asc.c_oAscMergeOptions.Merge&&n.api.asc_mergeCellsDataLost(e.value)?Common.UI.warning({msg:n.warnMergeLostData,buttons:["yes","no"],primary:"yes",callback:function(t){"yes"==t?i(e.value):(n.toolbar.btnMerge.toggle(!1,!0),Common.NotificationCenter.trigger("edit:complete",n.toolbar),Common.component.Analytics.trackEvent("ToolBar","Merge"))}}):i(e.value)}Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Merge cells")},onWrap:function(t,e){this._state.wrap=void 0,this.api&&this.api.asc_setCellTextWrap(t.pressed),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Wrap")},onTextOrientationMenu:function(t,e){if(this.api.asc_getCellInfo().asc_getFlags().asc_getSelectionType()==Asc.c_oAscSelectionType.RangeShapeText){var i=Asc.c_oAscVertDrawingText.normal;switch(e.value){case"rotateup":i=Asc.c_oAscVertDrawingText.vert270;break;case"rotatedown":i=Asc.c_oAscVertDrawingText.vert}var n=new Asc.asc_CImgProperty;n.asc_putVert(i),this.api.asc_setGraphicObjectProps(n)}else{var i=0;switch(e.value){case"countcw":i=45;break;case"clockwise":i=-45 -;break;case"rotateup":i=90;break;case"rotatedown":i=-90}this._state.angle=void 0,this.api&&this.api.asc_setCellAngle(i)}Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Text orientation")},onBtnInsertTableClick:function(t,e){this.api&&this._setTableFormat(this.api.asc_getDefaultTableStyle()),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Table")},onInsertImageMenu:function(t,e,i){var n=this;"file"===e.value?(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")):"url"===e.value?new Common.Views.ImageFromUrlDialog({handler:function(t,e){if("ok"==t){if(n.api){var i=e.replace(/\s/g,"");_.isEmpty(i)?Common.UI.warning({msg:this.textEmptyImgUrl}):(n.toolbar.fireEvent("insertimage",n.toolbar),n.api.asc_addImageDrawingObject(i),Common.component.Analytics.trackEvent("ToolBar","Image"))}Common.NotificationCenter.trigger("edit:complete",n.toolbar)}}}).show():"storage"===e.value&&(this.toolbar.mode.canRequestInsertImage?Common.Gateway.requestInsertImage():new Common.Views.SelectFileDlg({fileChoiceUrl:this.toolbar.mode.fileChoiceUrl.replace("{fileExt}","").replace("{documentType}","ImagesOnly")}).on("selectfile",function(t,e){n.insertImage(e)}).show())},insertImage:function(t){t&&t.url&&(this.toolbar.fireEvent("insertimage",this.toolbar),this.api.asc_addImageDrawingObject(t.url,void 0,t.token),Common.component.Analytics.trackEvent("ToolBar","Image"))},onHyperlink:function(t){var e,i,n=this;if(n.api){for(var o=n.api.asc_getWorksheetsCount(),s=-1,a=[];++s0?o[0]:void 0,n)}else{var n=new Asc.asc_CFormatCellsInfo;n.asc_setType(Asc.c_oAscNumFormatType.Accounting),n.asc_setSeparator(!1),n.asc_setSymbol(e.value);var o=this.api.asc_getFormatCells(n);o&&o.length>0&&this.api.asc_setCellFormat(o[0])}Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Number Format")},onNumberFormatSelect:function(t,e){e?this.api&&this.api.asc_setCellFormat(e.format):this.onCustomNumberFormat(),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Number Format")},onCustomNumberFormat:function(t,e){var i=this,n=i.api.asc_getLocale();!n&&(n=i.toolbar.mode.lang?parseInt(Common.util.LanguageInfo.getLocalLanguageCode(i.toolbar.mode.lang)):1033),new SSE.Views.FormatSettingsDialog({api:i.api,handler:function(t,e){e&&i.api.asc_setCellFormat(e.format),Common.NotificationCenter.trigger("edit:complete",i.toolbar)},props:{format:t||i._state.numformat,formatInfo:e||i._state.numformatinfo,langId:n}}).show(),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Number Format")},onNumberFormatOpenBefore:function(t){if(this.api){var e=this,i=e.api.asc_getLocale();if(!i&&(i=e.toolbar.mode.lang?parseInt(Common.util.LanguageInfo.getLocalLanguageCode(e.toolbar.mode.lang)):1033),this._state.langId!==i){this._state.langId=i;var n=new Asc.asc_CFormatCellsInfo;n.asc_setType(Asc.c_oAscNumFormatType.None),n.asc_setSymbol(this._state.langId);var o=this.api.asc_getFormatCells(n);e.toolbar.numFormatData.forEach(function(t,i){e.toolbar.numFormatData[i].format=o[i]})}e.toolbar.numFormatData.forEach(function(t,i){t.exampleval=e.api.asc_getLocaleExample(t.format)}),e.toolbar.cmbNumberFormat.setData(e.toolbar.numFormatData),e.toolbar.cmbNumberFormat.setValue(e._state.numformattype,e.toolbar.txtCustom)}},onDecrement:function(t){this.api&&this.api.asc_decreaseCellDigitNumbers(),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Decrement")},onIncrement:function(t){this.api&&this.api.asc_increaseCellDigitNumbers(),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Increment")},onInsertFormulaMenu:function(t,e,i){if(this.api)if("more"===e.value){var n=this.getApplication().getController("FormulaDialog");n&&n.showDialog()}else e.value=e.value||"SUM",this.toolbar.fireEvent("function:apply",[{name:this.api.asc_getFormulaLocaleName(e.value),origin:e.value},!0]),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Insert formula")},onNamedRangeMenu:function(t,e,i){if(this.api){var n=this;if("paste"===e.value)new SSE.Views.NamedRangePasteDlg({handler:function(t,e){"ok"==t&&e&&(n.api.asc_insertFormula(e.asc_getName(!0),e.asc_getIsTable()?Asc.c_oAscPopUpSelectorType.Table:Asc.c_oAscPopUpSelectorType.Range,!1),Common.component.Analytics.trackEvent("ToolBar","Paste Named Range")),Common.NotificationCenter.trigger("edit:complete",n.toolbar)},ranges:n.api.asc_getDefinedNames(Asc.c_oAscGetDefinedNamesList.WorksheetWorkbook)}).show(),Common.component.Analytics.trackEvent("ToolBar","Paste Named Range");else{var o=n.api.asc_getWorksheetsCount(),s=-1,a=[],l=[];if("new"===e.value){if(this._state.namedrange_locked)return void Common.NotificationCenter.trigger("namedrange:locked");for(;++s409?409:o<1?1:Math.floor(2*(o+.4))/2,e.setRawValue(o),this._state.fontsize=void 0,this.api&&this.api.asc_setCellFontSize(o),Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onListStyleSelect:function(t,e){this._state.prstyle=void 0,this.api&&(this.api.asc_setCellStyle(e.get("name")),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Style"))},createDelayedElements:function(){var t=this;this.toolbar.createDelayedElements(),this.attachUIEvents(this.toolbar),this.appConfig.isEditDiagram||this.appConfig.isEditMailMerge||(this.api.asc_registerCallback("asc_onSheetsChanged",_.bind(this.onApiSheetChanged,this)),this.api.asc_registerCallback("asc_onUpdateSheetViewSettings",_.bind(this.onApiSheetChanged,this)),this.api.asc_registerCallback("asc_onEndAddShape",_.bind(this.onApiEndAddShape,this)),this.api.asc_registerCallback("asc_onEditorSelectionChanged",_.bind(this.onApiEditorSelectionChanged,this)),this.api.asc_registerCallback("asc_onUpdateDocumentProps",_.bind(this.onUpdateDocumentProps,this)),this.api.asc_registerCallback("asc_onLockDocumentProps",_.bind(this.onApiLockDocumentProps,this)),this.api.asc_registerCallback("asc_onUnLockDocumentProps",_.bind(this.onApiUnLockDocumentProps,this))),this.appConfig.isEditMailMerge||this.applyFormulaSettings(),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_onStopFormatPainter",_.bind(this.onApiStyleChange,this)),this.api.asc_registerCallback("asc_onSelectionChanged",_.bind(this.onApiSelectionChanged,this)),Common.util.Shortcuts.delegateShortcuts({shortcuts:{"command+l,ctrl+l":function(e){if(t.editMode&&!t._state.multiselect&&t.appConfig.canModifyFilter){var i=t.api.asc_getCellInfo(),n=i.asc_getAutoFilterInfo(),o=i.asc_getFormatTableInfo();n=n?n.asc_getIsAutoFilter():null,null===n||o||t._setTableFormat(t.api.asc_getDefaultTableStyle())}return!1},"command+shift+l,ctrl+shift+l":function(e){if(t.editMode&&t.api&&!t._state.multiselect&&t.appConfig.canModifyFilter){var i=t._state.filter;t._state.filter=void 0,t._state.tablename||i?t.api.asc_changeAutoFilter(t._state.tablename,Asc.c_oAscChangeFilterOptions.filter,!i):t.api.asc_addAutoFilter()}return!1},"command+s,ctrl+s":function(e){t.onSave(),e.preventDefault(),e.stopPropagation()},"command+k,ctrl+k":function(e){!t.editMode||t.toolbar.mode.isEditMailMerge||t.toolbar.mode.isEditDiagram||t.api.isCellEdited||t._state.multiselect||t._state.inpivot||t.getApplication().getController("LeftMenu").leftMenu.menuFile.isVisible()||t.onHyperlink(),e.preventDefault()},"command+1,ctrl+1":function(e){return!t.editMode||t.toolbar.mode.isEditMailMerge||t.api.isCellEdited||t.toolbar.cmbNumberFormat.isDisabled()||t.onCustomNumberFormat(),!1}}}),this.onApiSelectionChanged(this.api.asc_getCellInfo()),this.attachToControlEvents(),this.onApiSheetChanged(),Common.NotificationCenter.on("cells:range",_.bind(this.onCellsRange,this))},onChangeViewMode:function(t,e){this.toolbar.setFolded(e),this.toolbar.fireEvent("view:compact",[this,e]),Common.localStorage.setBool("sse-compact-toolbar",e),Common.NotificationCenter.trigger("layout:changed","toolbar"),Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onClickChangeCompact:function(t){"file"!=t&&Common.Utils.asyncCall(function(){this.onChangeViewMode(null,!this.toolbar.isCompact())},this)},fillTableTemplates:function(){if(this.toolbar.btnTableTemplate.rendered){var t=this;_.isUndefined(this.toolbar.mnuTableTemplatePicker)&&(this.toolbar.mnuTableTemplatePicker=function(e,i){var n=new Common.UI.DataView({el:e,parentMenu:i,restoreHeight:300,style:"max-height: 300px;",store:t.getCollection("TableTemplates"),itemTemplate:_.template('
    ')});return n.on("item:click",function(e,i,n){t.api&&(t._state.tablestylename=null,t._setTableFormat(n?n.get("name"):t.api.asc_getDefaultTableStyle()),Common.NotificationCenter.trigger("edit:complete",t.toolbar),Common.component.Analytics.trackEvent("ToolBar","Table Templates"))}),n.scroller&&n.scroller.update({alwaysVisibleY:!0}),n}($("#id-toolbar-menu-table-templates"),this.toolbar.btnTableTemplate.menu))}},onTableTplMenuOpen:function(t){this.onApiInitTableTemplates(this.api.asc_getTablePictures(this.api.asc_getCellInfo().asc_getFormatTableInfo()));var e=this.toolbar.mnuTableTemplatePicker.scroller;e&&(e.update({alwaysVisibleY:!0}),e.scrollTop(0));var i=this.toolbar.mnuTableTemplatePicker.store.findWhere({name:this._state.tablestylename});i?this.toolbar.mnuTableTemplatePicker.selectRecord(i):this.toolbar.mnuTableTemplatePicker.deselectAll()},onSendThemeColors:function(){this.toolbar.btnTableTemplate.rendered&&this.toolbar.btnTableTemplate.cmpEl.hasClass("open")&&this.onTableTplMenuOpen()},onApiInitTableTemplates:function(t){var e=this.getCollection("TableTemplates");if(e){var i=[];_.each(t,function(t){i.push({name:t.asc_getName(),caption:t.asc_getDisplayName(),type:t.asc_getType(),imageUrl:t.asc_getImage(),allowSelected:!0,selected:!1,tip:t.asc_getDisplayName()})}),e.reset(),e.add(i)}this.fillTableTemplates()},onApiInitEditorStyles:function(t){window.styles_loaded=!1;var e=this,i=e.toolbar.listStyles;if(!i)return void(e.styles=t);i.menuPicker.store.reset([]);var n=this.getApplication().getController("Main");_.each(t,function(t){i.menuPicker.store.add({imageUrl:t.asc_getImage(),name:t.asc_getName(),tip:n.translationTable[t.get_Name()]||t.get_Name(),uid:Common.UI.getId()})}),i.menuPicker.store.length>0&&i.rendered&&(i.fillComboView(i.menuPicker.store.at(0),!0),i.selectByIndex(0)),window.styles_loaded=!0},onApiCoAuthoringDisconnect:function(t){this.toolbar.setMode({isDisconnected:!0,enableDownload:!!t}),this.editMode=!1},onApiChartDblClick:function(){this.onEditChart(this.btnInsertChart)},onApiCanRevert:function(t,e){"undo"==t?this._state.can_undo!==e&&(this.toolbar.btnUndo.setDisabled(!e),this._state.can_undo=e):this._state.can_redo!==e&&(this.toolbar.btnRedo.setDisabled(!e),this._state.can_redo=e)},setDisabledComponents:function(t,e){_.each([].concat(t),function(t){t.isDisabled()!==e&&t.setDisabled(e)})},onApiEditCell:function(t){if(!($(".asc-window.enable-key-events:visible").length>0)){var e=this.toolbar;if(e.mode.isEditDiagram||e.mode.isEditMailMerge)i=t==Asc.c_oAscCellEditorState.editStart,e.lockToolbar(SSE.enumLock.editCell,t==Asc.c_oAscCellEditorState.editStart,{array:[e.btnDecDecimal,e.btnIncDecimal,e.cmbNumberFormat]});else if(t==Asc.c_oAscCellEditorState.editStart||t==Asc.c_oAscCellEditorState.editEnd){e.lockToolbar(SSE.enumLock.editCell,t==Asc.c_oAscCellEditorState.editStart,{array:[e.btnClearStyle.menu.items[1],e.btnClearStyle.menu.items[2],e.btnClearStyle.menu.items[3],e.btnClearStyle.menu.items[4],e.btnNamedRange.menu.items[0],e.btnNamedRange.menu.items[1]],merge:!0,clear:[SSE.enumLock.editFormula,SSE.enumLock.editText]});var i=t==Asc.c_oAscCellEditorState.editStart;i?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"),i&&(e.listStyles.suspendEvents(),e.listStyles.menuPicker.selectRecord(null),e.listStyles.resumeEvents(),this._state.prstyle=void 0)}else{if(t==Asc.c_oAscCellEditorState.editText)var n=!0,o=!1;else t==Asc.c_oAscCellEditorState.editFormula?n=!(o=!0):t==Asc.c_oAscCellEditorState.editEmptyCell&&(n=o=!1);e.lockToolbar(SSE.enumLock.editFormula,o,{array:[e.cmbFontName,e.cmbFontSize,e.btnIncFontSize,e.btnDecFontSize,e.btnBold,e.btnItalic,e.btnUnderline,e.btnStrikeout,e.btnSubscript,e.btnTextColor]}),e.lockToolbar(SSE.enumLock.editText,n,{array:[e.btnInsertFormula].concat(e.btnsFormula)})}this._state.coauthdisable=void 0,this._state.selection_type=void 0,this.checkInsertAutoshape({action:"cancel"})}},onApiZoomChange:function(t,e){},onApiSheetChanged:function(){if(this.toolbar.mode&&this.toolbar.mode.isEdit&&!this.toolbar.mode.isEditDiagram&&!this.toolbar.mode.isEditMailMerge){var t=this.api.asc_getActiveWorksheetIndex(),e=this.api.asc_getPageOptions(t),i=e.asc_getPageSetup();this.onApiPageOrient(i.asc_getOrientation()),this.onApiPageSize(i.asc_getWidth(),i.asc_getHeight()),this.onApiPageMargins(e.asc_getPageMargins()),this.api.asc_isLayoutLocked(t)?this.onApiLockDocumentProps(t):this.onApiUnLockDocumentProps(t),this.toolbar.lockToolbar(SSE.enumLock.printAreaLock,this.api.asc_isPrintAreaLocked(t),{array:[this.toolbar.btnPrintArea]})}},onUpdateDocumentProps:function(t){t==this.api.asc_getActiveWorksheetIndex()&&this.onApiSheetChanged()},onApiPageSize:function(t,e){void 0!==this._state.pgorient&&(Math.abs(this._state.pgsize[0]-t)>.1||Math.abs(this._state.pgsize[1]-e)>.1)&&(this._state.pgsize=[t,e],this.toolbar.mnuPageSize&&(this.toolbar.mnuPageSize.clearAll(),_.each(this.toolbar.mnuPageSize.items,function(i){if(i.value&&"object"==typeof i.value&&Math.abs(i.value[0]-t)<.1&&Math.abs(i.value[1]-e)<.1)return i.setChecked(!0),!1},this)))},onApiPageMargins:function(t){if(t){var e=t.asc_getLeft(),i=t.asc_getTop(),n=t.asc_getRight(),o=t.asc_getBottom();(!this._state.pgmargins||Math.abs(this._state.pgmargins[0]-i)>.1||Math.abs(this._state.pgmargins[1]-e)>.1||Math.abs(this._state.pgmargins[2]-o)>.1||Math.abs(this._state.pgmargins[3]-n)>.1)&&(this._state.pgmargins=[i,e,o,n],this.toolbar.btnPageMargins.menu&&(this.toolbar.btnPageMargins.menu.clearAll(),_.each(this.toolbar.btnPageMargins.menu.items,function(t){if(t.value&&"object"==typeof t.value&&Math.abs(t.value[0]-i)<.1&&Math.abs(t.value[1]-e)<.1&&Math.abs(t.value[2]-o)<.1&&Math.abs(t.value[3]-n)<.1)return t.setChecked(!0),!1},this)))}},onApiPageOrient:function(t){this._state.pgorient!==t&&(this.toolbar.btnPageOrient.menu.items[t==Asc.c_oAscPageOrientation.PagePortrait?0:1].setChecked(!0),this._state.pgorient=t)},onApiLockDocumentProps:function(t){!0!==this._state.lock_doc&&t==this.api.asc_getActiveWorksheetIndex()&&(this.toolbar.lockToolbar(SSE.enumLock.docPropsLock,!0,{array:[this.toolbar.btnPageSize,this.toolbar.btnPageMargins,this.toolbar.btnPageOrient]}),this._state.lock_doc=!0)},onApiUnLockDocumentProps:function(t){!1!==this._state.lock_doc&&t==this.api.asc_getActiveWorksheetIndex()&&(this.toolbar.lockToolbar(SSE.enumLock.docPropsLock,!1,{array:[this.toolbar.btnPageSize,this.toolbar.btnPageMargins,this.toolbar.btnPageOrient]}),this._state.lock_doc=!1)},onApiEditorSelectionChanged:function(t){if(this.editMode&&!($(".asc-window.enable-key-events:visible").length>0)){var e,i=this.toolbar;if(t.asc_getName()!=i.cmbFontName.getValue()&&Common.NotificationCenter.trigger("fonts:change",t),!i.mode.isEditMailMerge&&!i.mode.isEditDiagram){e=t.asc_getBold(),this._state.bold!==e&&(i.btnBold.toggle(!0===e,!0),this._state.bold=e),e=t.asc_getItalic(),this._state.italic!==e&&(i.btnItalic.toggle(!0===e,!0),this._state.italic=e),e=t.asc_getUnderline(),this._state.underline!==e&&(i.btnUnderline.toggle(!0===e,!0),this._state.underline=e),e=t.asc_getStrikeout(),this._state.strikeout!==e&&(i.btnStrikeout.toggle(!0===e,!0),this._state.strikeout=e);var n=t.asc_getSubscript(),o=t.asc_getSuperscript();if(this._state.subscript!==n||this._state.superscript!==o){var s=o?0:n?1:-1,a=i.btnSubscript;a.toggle(s>-1,!0),s<0?a.menu.clearAll():(a.menu.items[s].setChecked(!0),a.rendered&&a.$icon&&(a.$icon.removeClass(a.options.icls),a.options.icls=a.menu.items[s].options.icls,a.$icon.addClass(a.options.icls))),this._state.subscript=n,this._state.superscript=o}}var l=t.asc_getSize();this._state.fontsize!==l&&(i.cmbFontSize.setValue(void 0!==l?l:""),this._state.fontsize=l);var r,c,h=this.toolbar.mnuTextColorPicker;if(!i.btnTextColor.ischanged&&!h.isDummy){c=t.asc_getColor(),c&&(r=c.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?{color:Common.Utils.ThemeColor.getHexColor(c.get_r(),c.get_g(),c.get_b()),effectValue:c.get_value()}:Common.Utils.ThemeColor.getHexColor(c.get_r(),c.get_g(),c.get_b()));var d=typeof r;if(d!==typeof this._state.clrtext||"object"==d&&(r.effectValue!==this._state.clrtext.effectValue||this._state.clrtext.color.indexOf(r.color)<0)||"object"!=d&&void 0!==this._state.clrtext&&this._state.clrtext.indexOf(r)<0){if(_.isObject(r)){for(var p=!1,m=0;m<10;m++)if(Common.Utils.ThemeColor.ThemeValues[m]==r.effectValue){h.select(r,!0),p=!0;break}p||h.clearSelection()}else h.select(r,!0);this._state.clrtext=r}this._state.clrtext_asccolor=c}}},onApiSelectionChanged:function(t){if(this.editMode&&!($(".asc-window.enable-key-events:visible").length>0)){if(this.toolbar.mode.isEditDiagram)return this.onApiSelectionChanged_DiagramEditor(t);if(this.toolbar.mode.isEditMailMerge)return this.onApiSelectionChanged_MailMergeEditor(t);var e,i=t.asc_getFlags().asc_getSelectionType(),n=!this.toolbar.mode.isEditMailMerge&&!this.toolbar.mode.isEditDiagram&&(!0===t.asc_getLocked()||!0===t.asc_getLockedTable()),o=this._disableEditOptions(i,n),s=this.toolbar,a=t.asc_getFont(),l=!1,r=a.asc_getName();r!=s.cmbFontName.getValue()&&Common.NotificationCenter.trigger("fonts:change",a);var c=a.asc_getSize();this._state.fontsize!==c&&(s.cmbFontSize.setValue(void 0!==c?c:""),this._state.fontsize=c),s.lockToolbar(SSE.enumLock.cantHyperlink,i==Asc.c_oAscSelectionType.RangeShapeText&&!1===this.api.asc_canAddShapeHyperlink(),{array:[s.btnInsertHyperlink]}),l=i==Asc.c_oAscSelectionType.RangeCells||i==Asc.c_oAscSelectionType.RangeCol||i==Asc.c_oAscSelectionType.RangeRow||i==Asc.c_oAscSelectionType.RangeMax,s.lockToolbar(SSE.enumLock.selRange,l,{array:[s.btnImgAlign,s.btnImgBackward,s.btnImgForward,s.btnImgGroup]});var h=this.api.asc_canGroupGraphicsObjects(),d=this.api.asc_canUnGroupGraphicsObjects();s.lockToolbar(SSE.enumLock.cantGroupUngroup,!h&&!d,{array:[s.btnImgGroup]}),s.btnImgGroup.menu.items[0].setDisabled(!h),s.btnImgGroup.menu.items[1].setDisabled(!d),s.lockToolbar(SSE.enumLock.cantGroup,!h,{array:[s.btnImgAlign]});var p=this.api.asc_getSelectedDrawingObjectsCount();if(s.btnImgAlign.menu.items[7].setDisabled(p<3),s.btnImgAlign.menu.items[8].setDisabled(p<3),!o){if(!s.mode.isEditMailMerge&&!s.mode.isEditDiagram){e=a.asc_getBold(),this._state.bold!==e&&(s.btnBold.toggle(!0===e,!0),this._state.bold=e),e=a.asc_getItalic(),this._state.italic!==e&&(s.btnItalic.toggle(!0===e,!0),this._state.italic=e),e=a.asc_getUnderline(),this._state.underline!==e&&(s.btnUnderline.toggle(!0===e,!0),this._state.underline=e),e=a.asc_getStrikeout(),this._state.strikeout!==e&&(s.btnStrikeout.toggle(!0===e,!0),this._state.strikeout=e);var m=a.asc_getSubscript(),u=a.asc_getSuperscript();if(this._state.subscript!==m||this._state.superscript!==u){var g=u?0:m?1:-1,b=s.btnSubscript;b.toggle(g>-1,!0),g<0?b.menu.clearAll():(b.menu.items[g].setChecked(!0),b.rendered&&(b.$icon.removeClass(b.options.icls),b.options.icls=b.menu.items[g].options.icls,b.$icon.addClass(b.options.icls))),this._state.subscript=m,this._state.superscript=u}}var f,C,v=this.toolbar.mnuTextColorPicker,y=this.toolbar.mnuBackColorPicker;if(!s.btnTextColor.ischanged&&!v.isDummy){C=a.asc_getColor(),C&&(f=C.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?{color:Common.Utils.ThemeColor.getHexColor(C.get_r(),C.get_g(),C.get_b()),effectValue:C.get_value()}:Common.Utils.ThemeColor.getHexColor(C.get_r(),C.get_g(),C.get_b()));var x=typeof f,w=typeof this._state.clrtext;if(x!==w||"object"==x&&(f.effectValue!==this._state.clrtext.effectValue||this._state.clrtext.color.indexOf(f.color)<0)||"object"!=x&&void 0!==this._state.clrtext&&this._state.clrtext.indexOf(f)<0){if(_.isObject(f)){for(var S=!1,A=0;A<10;A++)if(Common.Utils.ThemeColor.ThemeValues[A]==f.effectValue){v.select(f,!0),S=!0;break}S||v.clearSelection()}else v.select(f,!0);this._state.clrtext=f}this._state.clrtext_asccolor=C}if(!s.btnBackColor.ischanged&&!y.isDummy){if(C=t.asc_getFill().asc_getColor(),f=C?C.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?{color:Common.Utils.ThemeColor.getHexColor(C.get_r(),C.get_g(),C.get_b()),effectValue:C.get_value()}:Common.Utils.ThemeColor.getHexColor(C.get_r(),C.get_g(),C.get_b()):"transparent",x=typeof f,w=typeof this._state.clrback,x!==w||"object"==x&&(f.effectValue!==this._state.clrback.effectValue||this._state.clrback.color.indexOf(f.color)<0)||"object"!=x&&void 0!==this._state.clrback&&this._state.clrback.indexOf(f)<0){if(_.isObject(f)){var S=!1;for(A=0;A<10;A++)if(Common.Utils.ThemeColor.ThemeValues[A]==f.effectValue){y.select(f,!0),S=!0;break}S||y.clearSelection()}else y.select(f,!0);this._state.clrback=f}this._state.clrshd_asccolor=C}var k=i==Asc.c_oAscSelectionType.RangeChart||i==Asc.c_oAscSelectionType.RangeChartText;if(k!==this._state.in_chart&&(s.btnInsertChart.updateHint(k?s.tipChangeChart:s.tipInsertChart),this._state.in_chart=k),!k){if(!s.mode.isEditDiagram){ -var T=t.asc_getAutoFilterInfo(),I=t.asc_getFormatTableInfo();if(!s.mode.isEditMailMerge){if(r=t.asc_getHorAlign(),this._state.pralign!==r){this._state.pralign=r;var E,g=-1;switch(r){case AscCommon.align_Left:g=0,E="btn-align-left";break;case AscCommon.align_Center:g=1,E="btn-align-center";break;case AscCommon.align_Right:g=2,E="btn-align-right";break;case AscCommon.align_Justify:g=3,E="btn-align-just";break;default:g=-255,E="btn-align-left"}g<0?-255==g&&(s.btnAlignRight.toggle(!1,!0),s.btnAlignLeft.toggle(!1,!0),s.btnAlignCenter.toggle(!1,!0),s.btnAlignJust.toggle(!1,!0),s.btnHorizontalAlign.menu.clearAll()):(s.btnAlignRight.toggle(2===g,!0),s.btnAlignLeft.toggle(0===g,!0),s.btnAlignCenter.toggle(1===g,!0),s.btnAlignJust.toggle(3===g,!0),s.btnHorizontalAlign.menu.items[g].setChecked(!0,!1));var P=this.toolbar.btnHorizontalAlign;P.rendered&&(P.$icon.removeClass(P.options.icls).addClass(E),P.options.icls=E)}if(l=r==AscCommon.align_Justify||i==Asc.c_oAscSelectionType.RangeShapeText,s.btnTextOrient.menu.items[1].setDisabled(l),s.btnTextOrient.menu.items[2].setDisabled(l),r=t.asc_getVertAlign(),this._state.valign!==r){switch(this._state.valign=r,g=-1,E="",r){case Asc.c_oAscVAlign.Top:g=0,E="btn-valign-top";break;case Asc.c_oAscVAlign.Center:g=1,E="btn-valign-middle";break;case Asc.c_oAscVAlign.Bottom:g=2,E="btn-valign-bottom"}if(g>-1){s.btnAlignTop.toggle(0===g,!0),s.btnAlignMiddle.toggle(1===g,!0),s.btnAlignBottom.toggle(2===g,!0),s.btnVerticalAlign.menu.items[g].setChecked(!0,!1);var M=this.toolbar.btnVerticalAlign;M.rendered&&(M.$icon.removeClass(M.options.icls).addClass(E),M.options.icls=E)}}l=this._state.controlsdisabled.filters||null!==I||T&&null===T.asc_getIsAutoFilter(),s.lockToolbar(SSE.enumLock.ruleMerge,l,{array:[s.btnMerge,s.btnInsertTable]}),e=t.asc_getFlags().asc_getMerge(),this._state.merge!==e&&(s.btnMerge.toggle(e===Asc.c_oAscMergeOptions.Merge,!0),this._state.merge=e),s.btnWrap.isDisabled()||(e=t.asc_getFlags().asc_getWrapText(),this._state.wrap!==e&&(s.btnWrap.toggle(!0===e,!0),this._state.wrap=e))}e=T?T.asc_getIsAutoFilter():null,this._state.filter!==e&&(s.btnsSetAutofilter.toggle(!0===e,!0),this._state.filter=e),l=this._state.controlsdisabled.filters||null===e,s.lockToolbar(SSE.enumLock.ruleFilter,l,{array:s.btnsSetAutofilter.concat(s.btnsSortDown,s.btnsSortUp,s.btnTableTemplate,s.btnInsertTable)}),e=I?I.asc_getTableStyleName():null,this._state.tablestylename!==e&&this.toolbar.mnuTableTemplatePicker&&(e=this.toolbar.mnuTableTemplatePicker.store.findWhere({name:e}),e?(this.toolbar.mnuTableTemplatePicker.selectRecord(e),this._state.tablestylename=e.get("name")):(s.mnuTableTemplatePicker.deselectAll(),this._state.tablestylename=null)),l=this._state.controlsdisabled.filters||!T||!0!==T.asc_getIsApplyAutoFilter(),s.lockToolbar(SSE.enumLock.ruleDelFilter,l,{array:s.btnsClearAutofilter});var D=this._state.tablename;this._state.tablename=I?I.asc_getTableName():void 0;var F=this._state.filterapplied;this._state.filterapplied=this._state.filter&&T.asc_getIsApplyAutoFilter(),this._state.tablename===D&&this._state.filterapplied===F||this.getApplication().getController("Statusbar").onApiFilterInfo(!l),this._state.multiselect=t.asc_getFlags().asc_getMultiselect(),s.lockToolbar(SSE.enumLock.multiselect,this._state.multiselect,{array:[s.btnTableTemplate,s.btnInsertHyperlink,s.btnInsertTable]}),this._state.inpivot=!!t.asc_getPivotTableInfo(),s.lockToolbar(SSE.enumLock.editPivot,this._state.inpivot,{array:s.btnsSetAutofilter.concat(s.btnsClearAutofilter,s.btnsSortDown,s.btnsSortUp,s.btnMerge,s.btnInsertHyperlink,s.btnInsertTable)}),l=!this.appConfig.canModifyFilter,s.lockToolbar(SSE.enumLock.cantModifyFilter,l,{array:s.btnsSetAutofilter.concat(s.btnsSortDown,s.btnsSortUp,s.btnTableTemplate,s.btnClearStyle.menu.items[0],s.btnClearStyle.menu.items[2],s.btnInsertTable)})}if(e=t.asc_getNumFormatInfo(),e&&(this._state.numformat=t.asc_getNumFormat(),this._state.numformatinfo=e,e=e.asc_getType(),this._state.numformattype!==e&&(s.cmbNumberFormat.setValue(e,s.txtCustom),this._state.numformattype=e)),i==Asc.c_oAscSelectionType.RangeShapeText)for(var U=this.api.asc_getGraphicObjectProps(),A=0;A0?e:void 0,V.menuPicker.selectRecord(R),V.resumeEvents()}}e=i==Asc.c_oAscSelectionType.RangeRow,this._state.controlsdisabled.rows!==e&&(this._state.controlsdisabled.rows=e,s.btnAddCell.menu.items[3].setDisabled(e),s.btnDeleteCell.menu.items[3].setDisabled(e)),e=i==Asc.c_oAscSelectionType.RangeCol,this._state.controlsdisabled.cols!==e&&(this._state.controlsdisabled.cols=e,s.btnAddCell.menu.items[2].setDisabled(e),s.btnDeleteCell.menu.items[2].setDisabled(e)),e=T&&T.asc_getIsApplyAutoFilter(),this._state.controlsdisabled.cells_right!==(this._state.controlsdisabled.rows||e)&&(this._state.controlsdisabled.cells_right=this._state.controlsdisabled.rows||e,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||e)&&(this._state.controlsdisabled.cells_down=this._state.controlsdisabled.cols||e,s.btnAddCell.menu.items[1].setDisabled(this._state.controlsdisabled.cells_down),s.btnDeleteCell.menu.items[1].setDisabled(this._state.controlsdisabled.cells_down)),s.lockToolbar(SSE.enumLock.commentLock,i==Asc.c_oAscSelectionType.RangeCells&&(t.asc_getComments().length>0||t.asc_getLocked()),{array:this.btnsComment}),s.lockToolbar(SSE.enumLock.headerLock,t.asc_getLockedHeaderFooter(),{array:[this.toolbar.btnEditHeader]})}}}},onApiSelectionChanged_DiagramEditor:function(t){if(this.editMode&&!this.api.isCellEdited&&!this.api.isRangeSelection){var e=this,i=t.asc_getFlags().asc_getSelectionType();if(!function(t,i){var n=t==Asc.c_oAscSelectionType.RangeChartText,o=t==Asc.c_oAscSelectionType.RangeChart,s=t==Asc.c_oAscSelectionType.RangeShapeText,a=t==Asc.c_oAscSelectionType.RangeShape,l=t==Asc.c_oAscSelectionType.RangeImage,r=s||a||n||o,c=!1;if(!r&&!l&&e._state.selection_type===t&&e._state.coauthdisable===i)return t===Asc.c_oAscSelectionType.RangeImage;if(r){c=e.api.asc_getGraphicObjectProps().some(function(t){return t.asc_getObjectType()==Asc.c_oAscTypeSelectElement.Image&&t.asc_getObjectValue().asc_getLocked()})}var h=SSE.enumLock,d=t;switch(t){case Asc.c_oAscSelectionType.RangeImage:d=h.selImage;break;case Asc.c_oAscSelectionType.RangeShape:d=h.selShape;break;case Asc.c_oAscSelectionType.RangeShapeText:d=h.selShapeText;break;case Asc.c_oAscSelectionType.RangeChart:d=h.selChart;break;case Asc.c_oAscSelectionType.RangeChartText:d=h.selChartText}return e.toolbar.lockToolbar(d,d!=t,{clear:[h.selImage,h.selChart,h.selChartText,h.selShape,h.selShapeText,h.coAuth]}),e.toolbar.lockToolbar(SSE.enumLock.coAuthText,c),l}(i,!1)&&i!=Asc.c_oAscSelectionType.RangeChart&&i!=Asc.c_oAscSelectionType.RangeChartText){var n=t.asc_getNumFormatInfo();n&&(this._state.numformat=t.asc_getNumFormat(),this._state.numformatinfo=n,n=n.asc_getType(),this._state.numformattype!==n&&(e.toolbar.cmbNumberFormat.setValue(n,e.toolbar.txtCustom),this._state.numformattype=n))}}},onApiSelectionChanged_MailMergeEditor:function(t){if(this.editMode&&!this.api.isCellEdited&&!this.api.isRangeSelection){var e,i=this,n=t.asc_getFlags().asc_getSelectionType(),o=function(t,e){var n=t==Asc.c_oAscSelectionType.RangeChartText,o=t==Asc.c_oAscSelectionType.RangeChart,s=t==Asc.c_oAscSelectionType.RangeShapeText,a=t==Asc.c_oAscSelectionType.RangeShape,l=t==Asc.c_oAscSelectionType.RangeImage,r=s||a||n||o,c=!1;if(!r&&!l&&i._state.selection_type===t&&i._state.coauthdisable===e)return t===Asc.c_oAscSelectionType.RangeImage;if(r){c=i.api.asc_getGraphicObjectProps().some(function(t){return t.asc_getObjectType()==Asc.c_oAscTypeSelectElement.Image&&t.asc_getObjectValue().asc_getLocked()})}return i.toolbar.lockToolbar(SSE.enumLock.coAuthText,c),l}(n,!1),s=!1;if(!o&&n!=Asc.c_oAscSelectionType.RangeChart&&n!=Asc.c_oAscSelectionType.RangeChartText&&!i.toolbar.mode.isEditDiagram){var a=t.asc_getAutoFilterInfo();e=a?a.asc_getIsAutoFilter():null,this._state.filter!==e&&(i.toolbar.btnSetAutofilter.toggle(!0===e,!0),this._state.filter=e),s=this._state.controlsdisabled.filters||null===e,i.toolbar.lockToolbar(SSE.enumLock.ruleFilter,s,{array:[i.toolbar.btnSetAutofilter,i.toolbar.btnSortDown,i.toolbar.btnSortUp]}),s=this._state.controlsdisabled.filters||!a||!0!==a.asc_getIsApplyAutoFilter(),i.toolbar.lockToolbar(SSE.enumLock.ruleDelFilter,s,{array:[i.toolbar.btnClearAutofilter]})}}},onApiStyleChange:function(){this.toolbar.btnCopyStyle.toggle(!1,!0),this.modeAlwaysSetStyle=!1},updateThemeColors:function(){var t=function(t,e){if(t){for(var i,n=Common.Utils.ThemeColor.getEffectColors(),o=0;o
    ')}]})});t.toolbar.btnInsertShape.menu.addItem(o);new Common.UI.DataView({el:$("#id-toolbar-menu-shapegroup"+i),store:n.get("groupStore"),parentMenu:o.menu,showLast:!1,itemTemplate:_.template('
    ')}).on("item:click",function(e,i,n,o){t.api&&(n&&(t._addAutoshape(!0,n.get("data").shapeType),t._isAddingShape=!0),t.toolbar.btnInsertText.pressed&&t.toolbar.btnInsertText.toggle(!1,!0),"click"!==o.type&&t.toolbar.btnInsertShape.menu.hide(),Common.NotificationCenter.trigger("edit:complete",t.toolbar,t.toolbar.btnInsertShape),Common.component.Analytics.trackEvent("ToolBar","Add Shape"))})}},fillTextArt:function(){if(this.toolbar.btnInsertTextArt.rendered){var t=this;if(this.toolbar.mnuTextArtPicker){var e=this.getApplication().getCollection("Common.Collections.TextArt").models,i=this.toolbar.mnuTextArtPicker.store.length;if(i>0&&i==e.length){var n=this.toolbar.mnuTextArtPicker.store.models;_.each(e,function(t,e){n[e].set("imageUrl",t.get("imageUrl"))})}else this.toolbar.mnuTextArtPicker.store.reset(e)}else this.toolbar.mnuTextArtPicker=new Common.UI.DataView({el:$("#id-toolbar-menu-insart"),store:this.getApplication().getCollection("Common.Collections.TextArt"),parentMenu:this.toolbar.btnInsertTextArt.menu,showLast:!1,itemTemplate:_.template('
    ')}),this.toolbar.mnuTextArtPicker.on("item:click",function(e,i,n,o){n&&(t.toolbar.fireEvent("inserttextart",t.toolbar),t.api.asc_addTextArt(n.get("data"))),t.toolbar.btnInsertShape.pressed&&t.toolbar.btnInsertShape.toggle(!1,!0),"click"!==o.type&&t.toolbar.btnInsertTextArt.menu.hide(),Common.NotificationCenter.trigger("edit:complete",t.toolbar,t.toolbar.btnInsertTextArt),Common.component.Analytics.trackEvent("ToolBar","Add Text Art")})}},fillEquations:function(){if(this.toolbar.btnInsertEquation.rendered&&!(this.toolbar.btnInsertEquation.menu.items.length>0)){var t=this,e=this.getApplication().getCollection("EquationGroups");t.equationPickers=[],t.toolbar.btnInsertEquation.menu.removeAll();for(var i=0;i')}]})});t.toolbar.btnInsertEquation.menu.addItem(o);var s=new Common.UI.DataView({el:$("#id-toolbar-menu-equationgroup"+i),store:n.get("groupStore"),parentMenu:o.menu,showLast:!1,itemTemplate:_.template('
    ')});n.get("groupHeight").length&&(t.equationPickers.push(s),t.toolbar.btnInsertEquation.menu.on("show:after",function(){if(t.equationPickers.length){var e=$(this.el).find(".over").find(".menu-shape");if(e.length)for(var i=0;i0||!t&&0==i.length)){var n=this.toolbar;n.$el.find(".toolbar").toggleClass("masked",t),this.toolbar.lockToolbar(SSE.enumLock.menuFileOpen,t),t?(i=$("
    ").appendTo(n.$el.find(".toolbar")),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")):(i.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(){if(this.toolbar.btnInsertFormula&&this.toolbar.btnInsertFormula.rendered)for(var t=this.toolbar.btnInsertFormula.menu.items,e=0;e-1&&e.value<6?(this.api.asc_setSelectedDrawingObjectAlign(e.value),Common.component.Analytics.trackEvent("ToolBar","Objects Align")):6==e.value?(this.api.asc_DistributeSelectedDrawingObjectHor(),Common.component.Analytics.trackEvent("ToolBar","Distribute")):7==e.value&&(this.api.asc_DistributeSelectedDrawingObjectVer(),Common.component.Analytics.trackEvent("ToolBar","Distribute"))),Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onPrintAreaClick:function(t,e){this.api&&(this.api.asc_ChangePrintArea(e.value),Common.component.Analytics.trackEvent("ToolBar","Print Area")),Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onPrintAreaMenuOpen:function(){this.api&&this.toolbar.btnPrintArea.menu.items[2].setVisible(this.api.asc_CanAddPrintArea())},onEditHeaderClick:function(t){var e=this;if(_.isUndefined(e.fontStore)){e.fontStore=new Common.Collections.Fonts;var i=e.toolbar.cmbFontName.store.toJSON(),n=[];_.each(i,function(t,e){t.cloneid||n.push(_.clone(t))}),e.fontStore.add(n)}new SSE.Views.HeaderFooterDialog({api:e.api,fontStore:e.fontStore,handler:function(t,e){Common.NotificationCenter.trigger("edit:complete")}}).show(),Common.NotificationCenter.trigger("edit:complete",this.toolbar)},textEmptyImgUrl:"You need to specify image URL.",warnMergeLostData:"Operation can destroy data in the selected cells.
    Continue?", -textWarning:"Warning",textFontSizeErr:"The entered value is incorrect.
    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.
    The text style will be displayed using one of the device fonts, the saved font will be used when it is available.
    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",textLongOperation:"Long operation",warnLongOperation:"The operation you are about to perform might take rather much time to complete.
    Are you sure you want to continue?",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:
    opening price, max price, min price, closing price.",textPivot:"Pivot Table"},SSE.Controllers.Toolbar||{}))}),define("text!spreadsheeteditor/main/app/template/StatusBar.template",[],function(){return'\r\n
    \r\n
    \r\n \r\n \r\n \r\n \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n \r\n \r\n \r\n \r\n \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n'}),void 0===Common)var Common={};define("common/main/lib/component/Tab",["common/main/lib/component/BaseView"],function(t){"use strict";var e=function(t){return this.active=!1,this.label="Tab",this.cls="",this.template=_.template(['
  • ',"<%- label %>","
  • "].join("")),this.initialize.call(this,t),this};_.extend(e.prototype,{initialize:function(t){_.extend(this,t)},render:function(){var t=this.template(this);return this.$el=$(t),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(t){this.disabled=t,this.rendered&&(t&&!this.$el.hasClass("disabled")?this.$el.addClass("disabled"):this.$el.removeClass("disabled"))},addClass:function(t){t.length&&!this.$el.hasClass(t)&&this.$el.addClass(t)},removeClass:function(t){t.length&&this.$el.hasClass(t)&&this.$el.removeClass(t)},hasClass:function(t){return this.$el.hasClass(t)},setCaption:function(t){this.$el.find("> a").text(t)}}),Common.UI.Tab=e}),define("common/main/lib/component/TabBar",["common/main/lib/component/BaseView","common/main/lib/component/Tab"],function(){"use strict";var t={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)}},e=function(t){this.initialize.call(this,t)};_.extend(e.prototype,t),e.prototype.initialize=function(t){this.bar=t.bar},e.prototype.attach=function(t){t.changeState=$.proxy(function(){this.trigger("tab:change",t),this.bar.$el.find("ul > li.active").removeClass("active"),t.activate(),this.bar.trigger("tab:changed",this.bar,this.bar.tabs.indexOf(t),t)},this);var e=new function(){return{bounds:[],drag:void 0,calculateBounds:function(){var t=this,e=t.bar.tabs.length,i=t.bar.$bar.get(0).getBoundingClientRect();if(i){t.bounds=[],t.scrollLeft=t.bar.$bar.scrollLeft(),t.bar.scrollX=this.scrollLeft;for(var n=0;n0){for(t=s-1;t>=0;--t)if(e=this.bounds[t],i=.5*(e.right+e.left),a.left=0;--t)if(e=a,i=.5*(e.right+e.left),this.bounds[t].leftthis.drag.index&&t===n+1&&(o+=this.drag.tabWidth),t!==this.drag.index?(this.bar.tabs[t].$el.css("left",o+"px"),o+=this.bounds[t].width):this.drag.index===n&&(o+=this.drag.tabWidth)},setHook:function(t,e,i){function n(){if(!_.isUndefined(a.drag)){a.drag.tab.removeClass("dragged"),a.drag.tab.$el.css("z-index",""),a.bar.dragging=!1;for(var t=null,e=a.bar.tabs.length-1;e>=0;--e)(t=a.bar.tabs[e].$el)&&(t.css("top",""),t.css("position",""),t.css("left",""));_.isUndefined(a.drag.place)?(a.bar.trigger("tab:move",a.drag.index),a.bar.$bar.scrollLeft(a.scrollLeft),a.bar.scrollX=void 0):(a.bar.trigger("tab:move",a.drag.index,a.drag.place),a.bar.$bar.scrollLeft(a.scrollLeft),a.bar.scrollX=void 0),a.drag=void 0}}function o(t){if(!_.isUndefined(a.drag)){a.drag.moveX=t.clientX*Common.Utils.zoom();var e=Math.max(a.drag.moveX-a.drag.anchorX-a.tabBarLeft-a.scrollLeft,0);e=Math.min(e,a.tabBarRight-a.tabBarLeft-a.drag.tabWidth-a.scrollLeft),a.drag.tab.$el.css("left",e+"px"),a.drag.tab.$el.css("z-index","100"),a.updatePositions()}}function s(t){t.preventDefault()}var a=this;if(!_.isUndefined(e)&&!_.isUndefined(i)&&e.tabs.length>1){i.addClass("dragged");var l=e.tabs.indexOf(i),r=t.clientX*Common.Utils.zoom();a.bar=e,a.drag={tab:i,index:l},e.dragging=!0,this.calculateBounds(),this.setAbsTabs(),a.drag.moveX=r,a.drag.mouseX=r,a.drag.anchorX=r-this.bounds[l].left,a.drag.tabWidth=this.bounds[l].width,document.addEventListener("dragstart",s),$(document).on("mousemove.tabbar",o),$(document).on("mouseup.tabbar",function(t){n(),$(document).off("mouseup.tabbar"),$(document).off("mousemove.tabbar"),document.removeEventListener("dragstart",s)})}}}};t.$el.on({click:$.proxy(function(){t.disabled||t.$el.hasClass("active")||("manual"==t.control?this.bar.trigger("tab:manual",this.bar,this.bar.tabs.indexOf(t),t):t.changeState()),!t.disabled&&Common.NotificationCenter.trigger("edit:complete",this.bar)},this),dblclick:$.proxy(function(){this.trigger("tab:dblclick",this,this.tabs.indexOf(t),t)},this.bar),contextmenu:$.proxy(function(){this.trigger("tab:contextmenu",this,this.tabs.indexOf(t),t)},this.bar),mousedown:$.proxy(function(i){this.bar.options.draggable&&!_.isUndefined(e)&&3!==i.which&&(t.isLockTheDrag||e.setHook(i,this.bar,t))},this)})},e.prototype.detach=function(t){t.$el.off()},Common.UI.TabBar=Common.UI.BaseView.extend({config:{placement:"top",items:[],draggable:!1},tabs:[],template:_.template('
    ')},{template:_.template(''+t.textNewColor+"")}]});return t.mnuTabColor=function(){return{isDummy:!0,on:function(){}}}(),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:e},{caption:this.itemTabColor,menu:i}]}).on("render:after",function(e){var i=$('
    ');$("button:first-child",e.cmpEl).append(i),i.css("background-color",e.currentColor||"transparent"),t.mnuTabColor=new Common.UI.ThemeColorPalette({el:$("#id-tab-menu-color"),transparent:!0}),t.mnuTabColor.on("select",function(e,i){t.fireEvent("sheet:setcolor",[i])})}),this.tabbar.$el.append('',n.id)),i.cmpEl.append(o)),n.render(o),n.cmpEl.attr({tabindex:"-1"}));var a=e.api.asc_getActiveCellCoord(),l={left:0,top:0},r=[a.asc_getX()+l.left,(a.asc_getY()<0?0:a.asc_getY())+a.asc_getHeight()+l.top];o.css({left:r[0],top:r[1]}),n.show(),n.alignPosition(),_.delay(function(){n.cmpEl.focus()},10)}else this.documentHolder.entriesMenu.hide(),Common.UI.warning({title:this.notcriticalErrorTitle,maxwidth:600,msg:this.txtNoChoices,callback:_.bind(function(t){Common.NotificationCenter.trigger("edit:complete",this.documentHolder)},this)})},onFormulaCompleteMenu:function(t){if(this.documentHolder.funcMenu)if(t){for(var e=this,i=e.documentHolder,n=i.funcMenu,o=i.cmpEl.find("#menu-formula-selection"),s=e.getApplication().getController("FormulaDialog").getDescription(Common.Utils.InternalSettings.get("sse-settings-func-locale")),a=0;an?1:0}),_.each(t,function(t,i){var o=t.asc_getType(),a=t.asc_getName(!0),l=e.api.asc_getFormulaNameByLocale(a),r=new Common.UI.MenuItem({iconCls:o==Asc.c_oAscPopUpSelectorType.Func?"mnu-popup-func":o==Asc.c_oAscPopUpSelectorType.Table?"mnu-popup-table":"mnu-popup-range",caption:a,hint:s&&s[l]?s[l].d:""}).on("click",function(t,i){setTimeout(function(){e.api.asc_insertFormula(t.caption,o,!1)},10)});n.addItem(r)}),n.rendered||(o.length<1&&(o=$(Common.Utils.String.format('')),i.cmpEl.append(o)),n.onAfterKeydownMenu=function(t){if(t.keyCode!=Common.UI.Keys.RETURN||!t.ctrlKey&&!t.altKey){var e;if(arguments.length>1&&arguments[1]instanceof KeyboardEvent&&(t=arguments[1]),o.hasClass("open"))if(t.keyCode==Common.UI.Keys.TAB||t.keyCode==Common.UI.Keys.RETURN&&!t.ctrlKey&&!t.altKey)e=o.find("a.focus").closest("li");else if(t.keyCode==Common.UI.Keys.UP||t.keyCode==Common.UI.Keys.DOWN){var i=n.cmpEl,s=i.offset().top,a=o.find("a.focus").closest("li"),l=a.offset().top;(ls+i.height())&&(n.scroller?n.scroller.scrollTop(i.scrollTop()+l-s,0):i.scrollTop(i.scrollTop()+l-s))}e&&(e.length>0&&e.click(),Common.UI.Menu.Manager.hideAll())}},n.on("hide:after",function(){for(var t=0;t
    '),this.documentHolder.cmpEl.append(e.parentEl));var i=this.getApplication().getController("FormulaDialog").getDescription(Common.Utils.InternalSettings.get("sse-settings-func-locale")),n=(i&&i[t]?this.api.asc_getFormulaLocaleName(t)+i[t].a:"").replace(/[,;]/g,this.api.asc_getFunctionArgumentSeparator());if(e.ref&&e.ref.isVisible()&&e.text!=n&&(e.ref.hide(),e.ref=void 0,e.text="",e.isHidden=!0),!n)return;e.ref&&e.ref.isVisible()||(e.text=n,e.ref=new Common.UI.Tooltip({owner:e.parentEl,html:!0,title:n,cls:"auto-tooltip"}),e.ref.show([-1e4,-1e4]),e.isHidden=!1);var o=[this.documentHolder.cmpEl.offset().left-$(window).scrollLeft(),this.documentHolder.cmpEl.offset().top-$(window).scrollTop()],s=this.api.asc_getActiveCellCoord(),a=[s.asc_getX()+o[0]-3,s.asc_getY()+o[1]-e.ref.getBSTip().$tip.height()-5],l=e.ref.getBSTip().$tip.width();a[0]+l>this.tooltips.coauth.bodyWidth&&(a[0]=this.tooltips.coauth.bodyWidth-l),e.ref.getBSTip().$tip.css({top:a[1]+"px",left:a[0]+"px"})}else!e.isHidden&&e.ref&&(e.ref.hide(),e.ref=void 0,e.text="",e.isHidden=!0)},onInputMessage:function(t,e){var i=this.tooltips.input_msg;if(e){i.parentEl||(i.parentEl=$('
    '),this.documentHolder.cmpEl.append(i.parentEl));var n=t?""+(t||"")+"
    ":"";n+=e||"",i.ref&&i.ref.isVisible()&&i.text!=n&&(i.ref.hide(),i.ref=void 0,i.text="",i.isHidden=!0),i.ref&&i.ref.isVisible()||(i.text=n,i.ref=new Common.UI.Tooltip({owner:i.parentEl,html:!0,title:n}),i.ref.show([-1e4,-1e4]),i.isHidden=!1);var o=[this.documentHolder.cmpEl.offset().left-$(window).scrollLeft(),this.documentHolder.cmpEl.offset().top-$(window).scrollTop()],s=this.api.asc_getActiveCellCoord(),a=[s.asc_getX()+o[0]-3,s.asc_getY()+o[1]-i.ref.getBSTip().$tip.height()-5],l=i.ref.getBSTip().$tip.width();a[0]+l>this.tooltips.coauth.bodyWidth&&(a[0]=this.tooltips.coauth.bodyWidth-l),i.ref.getBSTip().$tip.css({top:a[1]+"px",left:a[0]+"px"})}else!i.isHidden&&i.ref&&(i.ref.hide(),i.ref=void 0,i.text="",i.isHidden=!0)},onShowSpecialPasteOptions:function(t){var e=this,i=e.documentHolder,n=t.asc_getCellCoord(),o=i.cmpEl.find("#special-paste-container"),s=t.asc_getOptions();if(s){if(o.length<1&&(e._arrSpecialPaste=[],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.paste]=[e.txtPaste,0],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.pasteOnlyFormula]=[e.txtPasteFormulas,0],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.formulaNumberFormat]=[e.txtPasteFormulaNumFormat,0],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.formulaAllFormatting]=[e.txtPasteKeepSourceFormat,0],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.formulaWithoutBorders]=[e.txtPasteBorders,0],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.formulaColumnWidth]=[e.txtPasteColWidths,0],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.mergeConditionalFormating]=[e.txtPasteMerge,0],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.transpose]=[e.txtPasteTranspose,0],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.pasteOnlyValues]=[e.txtPasteValues,1],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.valueNumberFormat]=[e.txtPasteValNumFormat,1],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.valueAllFormating]=[e.txtPasteValFormat,1],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.pasteOnlyFormating]=[e.txtPasteFormat,2],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.link]=[e.txtPasteLink,2],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.picture]=[e.txtPastePicture,2],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.linkedPicture]=[e.txtPasteLinkPicture,2],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.sourceformatting]=[e.txtPasteSourceFormat,2],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.destinationFormatting]=[e.txtPasteDestFormat,2],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.keepTextOnly]=[e.txtKeepTextOnly,2],e._arrSpecialPaste[Asc.c_oSpecialPasteProps.useTextImport]=[e.txtUseTextImport,3],o=$('
    '),i.cmpEl.append(o),e.btnSpecialPaste=new Common.UI.Button({cls:"btn-toolbar",iconCls:"btn-paste",menu:new Common.UI.Menu({items:[]})}),e.btnSpecialPaste.render($("#id-document-holder-btn-special-paste"))),s.length>0){for(var a=e.btnSpecialPaste.menu,l=0;l0&&(a.addItem(new Common.UI.MenuItem({caption:"--"})),h=!1),_.each(r[l],function(t,e){a.addItem(t),h=!0});a.items.length>0&&a.items[0].setChecked(!0,!0),e._state.lastSpecPasteChecked=a.items.length>0?a.items[0]:null,c&&(a.addItem(new Common.UI.MenuItem({caption:"--"})),a.addItem(c))}if(n[0].asc_getX()<0||n[0].asc_getY()<0)return void(o.is(":visible")&&o.hide());var d=n[0],p=n[1],m=e.tooltips.coauth.bodyWidth-e.tooltips.coauth.XY[0]-e.tooltips.coauth.rightMenuWidth-15,u=e.tooltips.coauth.apiHeight-15,g=[],b=[31,20],f=d.asc_getX()+d.asc_getWidth()+3+b[0],C=d.asc_getY()+d.asc_getHeight()+3+b[1];f>m?(g[0]=void 0!==p?p.asc_getX():m-b[0]-3,C>u&&(g[0]-=b[0]+3),g[0]<0&&(g[0]=m-3-b[0])):g[0]=f-b[0],g[1]=C>u?u-3-b[1]:C-b[1],o.css({left:g[0],top:g[1]}),o.show()}},onHideSpecialPasteOptions:function(){var t=this.documentHolder.cmpEl.find("#special-paste-container");t.is(":visible")&&t.hide()},onToggleAutoCorrectOptions:function(t){if(!t){var e=this.documentHolder.cmpEl.find("#autocorrect-paste-container");return void(e.is(":visible")&&e.hide())}var i=this,n=i.documentHolder,o=t.asc_getCellCoord(),e=n.cmpEl.find("#autocorrect-paste-container"),s=t.asc_getOptions();if(e.length<1&&(i._arrAutoCorrectPaste=[],i._arrAutoCorrectPaste[Asc.c_oAscAutoCorrectOptions.UndoTableAutoExpansion]=i.txtUndoExpansion,i._arrAutoCorrectPaste[Asc.c_oAscAutoCorrectOptions.RedoTableAutoExpansion]=i.txtRedoExpansion,e=$('
    '),n.cmpEl.append(e),i.btnAutoCorrectPaste=new Common.UI.Button({cls:"btn-toolbar",iconCls:"btn-paste",menu:new Common.UI.Menu({items:[]})}),i.btnAutoCorrectPaste.render($("#id-document-holder-btn-autocorrect-paste"))),s.length>0){for(var a=i.btnAutoCorrectPaste.menu,l=0;lr||p>c||o.asc_getX()<0||o.asc_getY()<0?e.is(":visible")&&e.hide():(e.css({left:d-h[0],top:p-h[1]}),e.show())},onCellsRange:function(t){this.rangeSelectionMode=t!=Asc.c_oAscSelectionDialogType.None},onApiEditCell:function(t){this.isEditFormula=t==Asc.c_oAscCellEditorState.editFormula,this.isEditCell=t!=Asc.c_oAscCellEditorState.editEnd},onLockDefNameManager:function(t){this.namedrange_locked=t==Asc.c_oAscDefinedNameReason.LockDefNameManager},onChangeCropState:function(t){this.documentHolder.menuImgCrop.menu.items[0].setChecked(t,!0)},initEquationMenu:function(){if(this._currentMathObj){var t,e=this,i=e._currentMathObj.get_Type(),n=e._currentMathObj,o=[];switch(i){case Asc.c_oAscMathInterfaceType.Accent:t=new Common.UI.MenuItem({caption:e.txtRemoveAccentChar,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"remove_AccentCharacter"}}),o.push(t);break;case Asc.c_oAscMathInterfaceType.BorderBox:t=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:i,callback:"put_HideTop",value:!n.get_HideTop()}},{caption:n.get_HideBottom()?e.txtAddBottom:e.txtHideBottom,equationProps:{type:i,callback:"put_HideBottom",value:!n.get_HideBottom()}},{caption:n.get_HideLeft()?e.txtAddLeft:e.txtHideLeft,equationProps:{type:i,callback:"put_HideLeft",value:!n.get_HideLeft()}},{caption:n.get_HideRight()?e.txtAddRight:e.txtHideRight,equationProps:{type:i,callback:"put_HideRight",value:!n.get_HideRight()}},{caption:n.get_HideHor()?e.txtAddHor:e.txtHideHor,equationProps:{type:i,callback:"put_HideHor",value:!n.get_HideHor()}},{caption:n.get_HideVer()?e.txtAddVer:e.txtHideVer,equationProps:{type:i,callback:"put_HideVer",value:!n.get_HideVer()}},{caption:n.get_HideTopLTR()?e.txtAddLT:e.txtHideLT,equationProps:{type:i,callback:"put_HideTopLTR",value:!n.get_HideTopLTR()}},{caption:n.get_HideTopRTL()?e.txtAddLB:e.txtHideLB,equationProps:{type:i,callback:"put_HideTopRTL",value:!n.get_HideTopRTL()}}]})}),o.push(t);break;case Asc.c_oAscMathInterfaceType.Bar:t=new Common.UI.MenuItem({caption:e.txtRemoveBar,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"remove_Bar"}}),o.push(t),t=new Common.UI.MenuItem({caption:n.get_Pos()==Asc.c_oAscMathInterfaceBarPos.Top?e.txtUnderbar:e.txtOverbar,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_Pos",value:n.get_Pos()==Asc.c_oAscMathInterfaceBarPos.Top?Asc.c_oAscMathInterfaceBarPos.Bottom:Asc.c_oAscMathInterfaceBarPos.Top}}),o.push(t);break;case Asc.c_oAscMathInterfaceType.Script:var s=n.get_ScriptType();s==Asc.c_oAscMathInterfaceScript.PreSubSup?(t=new Common.UI.MenuItem({caption:e.txtScriptsAfter,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_ScriptType",value:Asc.c_oAscMathInterfaceScript.SubSup}}),o.push(t),t=new Common.UI.MenuItem({caption:e.txtRemScripts,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_ScriptType",value:Asc.c_oAscMathInterfaceScript.None}}),o.push(t)):(s==Asc.c_oAscMathInterfaceScript.SubSup&&(t=new Common.UI.MenuItem({caption:e.txtScriptsBefore,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_ScriptType",value:Asc.c_oAscMathInterfaceScript.PreSubSup}}),o.push(t)),s!=Asc.c_oAscMathInterfaceScript.SubSup&&s!=Asc.c_oAscMathInterfaceScript.Sub||(t=new Common.UI.MenuItem({caption:e.txtRemSubscript,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_ScriptType",value:s==Asc.c_oAscMathInterfaceScript.SubSup?Asc.c_oAscMathInterfaceScript.Sup:Asc.c_oAscMathInterfaceScript.None}}),o.push(t)),s!=Asc.c_oAscMathInterfaceScript.SubSup&&s!=Asc.c_oAscMathInterfaceScript.Sup||(t=new Common.UI.MenuItem({caption:e.txtRemSuperscript,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_ScriptType",value:s==Asc.c_oAscMathInterfaceScript.SubSup?Asc.c_oAscMathInterfaceScript.Sub:Asc.c_oAscMathInterfaceScript.None}}),o.push(t)));break;case Asc.c_oAscMathInterfaceType.Fraction:var a=n.get_FractionType();a!=Asc.c_oAscMathInterfaceFraction.Skewed&&a!=Asc.c_oAscMathInterfaceFraction.Linear||(t=new Common.UI.MenuItem({caption:e.txtFractionStacked,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_FractionType",value:Asc.c_oAscMathInterfaceFraction.Bar}}),o.push(t)),a!=Asc.c_oAscMathInterfaceFraction.Bar&&a!=Asc.c_oAscMathInterfaceFraction.Linear||(t=new Common.UI.MenuItem({caption:e.txtFractionSkewed,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_FractionType",value:Asc.c_oAscMathInterfaceFraction.Skewed}}),o.push(t)),a!=Asc.c_oAscMathInterfaceFraction.Bar&&a!=Asc.c_oAscMathInterfaceFraction.Skewed||(t=new Common.UI.MenuItem({caption:e.txtFractionLinear,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_FractionType",value:Asc.c_oAscMathInterfaceFraction.Linear}}),o.push(t)),a!=Asc.c_oAscMathInterfaceFraction.Bar&&a!=Asc.c_oAscMathInterfaceFraction.NoBar||(t=new Common.UI.MenuItem({caption:a==Asc.c_oAscMathInterfaceFraction.Bar?e.txtRemFractionBar:e.txtAddFractionBar,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_FractionType",value:a==Asc.c_oAscMathInterfaceFraction.Bar?Asc.c_oAscMathInterfaceFraction.NoBar:Asc.c_oAscMathInterfaceFraction.Bar}}),o.push(t));break;case Asc.c_oAscMathInterfaceType.Limit:t=new Common.UI.MenuItem({caption:n.get_Pos()==Asc.c_oAscMathInterfaceLimitPos.Top?e.txtLimitUnder:e.txtLimitOver,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_Pos",value:n.get_Pos()==Asc.c_oAscMathInterfaceLimitPos.Top?Asc.c_oAscMathInterfaceLimitPos.Bottom:Asc.c_oAscMathInterfaceLimitPos.Top}}),o.push(t),t=new Common.UI.MenuItem({caption:e.txtRemLimit,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_Pos",value:Asc.c_oAscMathInterfaceLimitPos.None}}),o.push(t);break;case Asc.c_oAscMathInterfaceType.Matrix:t=new Common.UI.MenuItem({caption:n.get_HidePlaceholder()?e.txtShowPlaceholder:e.txtHidePlaceholder,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_HidePlaceholder",value:!n.get_HidePlaceholder()}}),o.push(t),t=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:i,callback:"insert_MatrixRow",value:!0}},{caption:e.insertRowBelowText,equationProps:{type:i,callback:"insert_MatrixRow",value:!1}},{caption:e.insertColumnLeftText,equationProps:{type:i,callback:"insert_MatrixColumn",value:!0}},{caption:e.insertColumnRightText,equationProps:{type:i,callback:"insert_MatrixColumn",value:!1}}]})}),o.push(t),t=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:i,callback:"delete_MatrixRow"}},{caption:e.deleteColumnText,equationProps:{type:i,callback:"delete_MatrixColumn"}}]})}),o.push(t),t=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:i,callback:"put_MatrixAlign",value:Asc.c_oAscMathInterfaceMatrixMatrixAlign.Top}},{caption:e.centerText,checkable:!0,checked:n.get_MatrixAlign()==Asc.c_oAscMathInterfaceMatrixMatrixAlign.Center,equationProps:{type:i,callback:"put_MatrixAlign",value:Asc.c_oAscMathInterfaceMatrixMatrixAlign.Center}},{caption:e.txtBottom,checkable:!0,checked:n.get_MatrixAlign()==Asc.c_oAscMathInterfaceMatrixMatrixAlign.Bottom,equationProps:{type:i,callback:"put_MatrixAlign",value:Asc.c_oAscMathInterfaceMatrixMatrixAlign.Bottom}}]})}),o.push(t),t=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:i,callback:"put_ColumnAlign",value:Asc.c_oAscMathInterfaceMatrixColumnAlign.Left}},{caption:e.centerText,checkable:!0,checked:n.get_ColumnAlign()==Asc.c_oAscMathInterfaceMatrixColumnAlign.Center,equationProps:{type:i,callback:"put_ColumnAlign",value:Asc.c_oAscMathInterfaceMatrixColumnAlign.Center}},{caption:e.rightText,checkable:!0,checked:n.get_ColumnAlign()==Asc.c_oAscMathInterfaceMatrixColumnAlign.Right,equationProps:{type:i,callback:"put_ColumnAlign",value:Asc.c_oAscMathInterfaceMatrixColumnAlign.Right}}]})}),o.push(t);break;case Asc.c_oAscMathInterfaceType.EqArray:t=new Common.UI.MenuItem({caption:e.txtInsertEqBefore,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"insert_Equation",value:!0}}),o.push(t),t=new Common.UI.MenuItem({caption:e.txtInsertEqAfter,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"insert_Equation",value:!1}}),o.push(t),t=new Common.UI.MenuItem({caption:e.txtDeleteEq,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"delete_Equation"}}),o.push(t),t=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:i,callback:"put_Align",value:Asc.c_oAscMathInterfaceEqArrayAlign.Top}},{caption:e.centerText,checkable:!0,checked:n.get_Align()==Asc.c_oAscMathInterfaceEqArrayAlign.Center,equationProps:{type:i,callback:"put_Align",value:Asc.c_oAscMathInterfaceEqArrayAlign.Center}},{caption:e.txtBottom,checkable:!0,checked:n.get_Align()==Asc.c_oAscMathInterfaceEqArrayAlign.Bottom,equationProps:{type:i,callback:"put_Align",value:Asc.c_oAscMathInterfaceEqArrayAlign.Bottom}}]})}),o.push(t);break;case Asc.c_oAscMathInterfaceType.LargeOperator:t=new Common.UI.MenuItem({caption:e.txtLimitChange,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_LimitLocation",value:n.get_LimitLocation()==Asc.c_oAscMathInterfaceNaryLimitLocation.UndOvr?Asc.c_oAscMathInterfaceNaryLimitLocation.SubSup:Asc.c_oAscMathInterfaceNaryLimitLocation.UndOvr}}),o.push(t),void 0!==n.get_HideUpper()&&(t=new Common.UI.MenuItem({caption:n.get_HideUpper()?e.txtShowTopLimit:e.txtHideTopLimit,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_HideUpper",value:!n.get_HideUpper()}}),o.push(t)),void 0!==n.get_HideLower()&&(t=new Common.UI.MenuItem({caption:n.get_HideLower()?e.txtShowBottomLimit:e.txtHideBottomLimit,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_HideLower",value:!n.get_HideLower()}}),o.push(t));break;case Asc.c_oAscMathInterfaceType.Delimiter:t=new Common.UI.MenuItem({caption:e.txtInsertArgBefore,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"insert_DelimiterArgument",value:!0}}),o.push(t),t=new Common.UI.MenuItem({caption:e.txtInsertArgAfter,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"insert_DelimiterArgument",value:!1}}),o.push(t),n.can_DeleteArgument()&&(t=new Common.UI.MenuItem({caption:e.txtDeleteArg,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"delete_DelimiterArgument"}}),o.push(t)),t=new Common.UI.MenuItem({caption:n.has_Separators()?e.txtDeleteCharsAndSeparators:e.txtDeleteChars,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"remove_DelimiterCharacters"}}),o.push(t),t=new Common.UI.MenuItem({caption:n.get_HideOpeningBracket()?e.txtShowOpenBracket:e.txtHideOpenBracket,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_HideOpeningBracket",value:!n.get_HideOpeningBracket()}}),o.push(t),t=new Common.UI.MenuItem({caption:n.get_HideClosingBracket()?e.txtShowCloseBracket:e.txtHideCloseBracket,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_HideClosingBracket",value:!n.get_HideClosingBracket()}}),o.push(t),t=new Common.UI.MenuItem({caption:e.txtStretchBrackets,equation:!0,disabled:e._currentParaObjDisabled,checkable:!0,checked:n.get_StretchBrackets(),equationProps:{type:i,callback:"put_StretchBrackets",value:!n.get_StretchBrackets()}}),o.push(t),t=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:i,callback:"put_MatchBrackets",value:!n.get_MatchBrackets()}}),o.push(t);break;case Asc.c_oAscMathInterfaceType.GroupChar:n.can_ChangePos()&&(t=new Common.UI.MenuItem({caption:n.get_Pos()==Asc.c_oAscMathInterfaceGroupCharPos.Top?e.txtGroupCharUnder:e.txtGroupCharOver,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_Pos",value:n.get_Pos()==Asc.c_oAscMathInterfaceGroupCharPos.Top?Asc.c_oAscMathInterfaceGroupCharPos.Bottom:Asc.c_oAscMathInterfaceGroupCharPos.Top}}),o.push(t),t=new Common.UI.MenuItem({caption:e.txtDeleteGroupChar,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_Pos",value:Asc.c_oAscMathInterfaceGroupCharPos.None}}),o.push(t));break;case Asc.c_oAscMathInterfaceType.Radical:void 0!==n.get_HideDegree()&&(t=new Common.UI.MenuItem({caption:n.get_HideDegree()?e.txtShowDegree:e.txtHideDegree,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"put_HideDegree",value:!n.get_HideDegree()}}),o.push(t)),t=new Common.UI.MenuItem({caption:e.txtDeleteRadical,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"remove_Radical"}}),o.push(t)}return n.can_IncreaseArgumentSize()&&(t=new Common.UI.MenuItem({caption:e.txtIncreaseArg,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"increase_ArgumentSize"}}),o.push(t)),n.can_DecreaseArgumentSize()&&(t=new Common.UI.MenuItem({caption:e.txtDecreaseArg,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"decrease_ArgumentSize"}}),o.push(t)),n.can_InsertManualBreak()&&(t=new Common.UI.MenuItem({caption:e.txtInsertBreak,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"insert_ManualBreak"}}),o.push(t)),n.can_DeleteManualBreak()&&(t=new Common.UI.MenuItem({caption:e.txtDeleteBreak,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"delete_ManualBreak"}}),o.push(t)),n.can_AlignToCharacter()&&(t=new Common.UI.MenuItem({caption:e.txtAlignToChar,equation:!0,disabled:e._currentParaObjDisabled,equationProps:{type:i,callback:"align_ToCharacter"}}),o.push(t)),o}},addEquationMenu:function(t){var e=this;e.clearEquationMenu(t);var i=e.documentHolder.textInShapeMenu,n=e.initEquationMenu();return n.length>0&&_.each(n,function(n,o){n.menu?_.each(n.menu.items,function(t){t.on("click",_.bind(e.equationCallback,e,t.options.equationProps))}):n.on("click",_.bind(e.equationCallback,e,n.options.equationProps)),i.insertItem(t,n),t++}),n.length},clearEquationMenu:function(t){for(var e=this,i=e.documentHolder.textInShapeMenu,n=t;n
    ')}),e.paraBulletsPicker.on("item:click",_.bind(this.onSelectBullets,this)),i&&e.paraBulletsPicker.selectRecord(i.rec,!0)},onSignatureClick:function(t){var e=t.cmpEl.attr("data-value");switch(t.value){case 0:Common.NotificationCenter.trigger("protect:sign",e);break;case 1:this.api.asc_ViewCertificate(e);break;case 2:Common.NotificationCenter.trigger("protect:signature","visible",this._isDisabled,e);break;case 3:this.api.asc_RemoveSignature(e)}},onOriginalSizeClick:function(t){if(this.api){var e=this.api.asc_getOriginalImageSize(),i=e.asc_getImageWidth(),n=e.asc_getImageHeight(),o=new Asc.asc_CImgProperty;o.asc_putWidth(i),o.asc_putHeight(n),o.put_ResetCrop(!0),this.api.asc_setGraphicObjectProps(o),Common.NotificationCenter.trigger("edit:complete",this.documentHolder),Common.component.Analytics.trackEvent("DocumentHolder","Set Image Original Size")}},onImgReplace:function(t,e){var i=this;this.api&&("file"==e.value?setTimeout(function(){i.api&&i.api.asc_changeImageFromFile(),Common.NotificationCenter.trigger("edit:complete",i.documentHolder)},10):new Common.Views.ImageFromUrlDialog({handler:function(t,e){if("ok"==t&&i.api){var n=e.replace(/ /g,"");if(!_.isEmpty(n)){var o=new Asc.asc_CImgProperty;o.asc_putImageUrl(n),i.api.asc_setGraphicObjectProps(o)}}Common.NotificationCenter.trigger("edit:complete",i.documentHolder)}}).show())},onNumberFormatSelect:function(t,e){void 0!==e.value&&"advanced"!==e.value&&this.api&&this.api.asc_setCellFormat(e.options.format),Common.NotificationCenter.trigger("edit:complete",this.documentHolder)},onCustomNumberFormat:function(t){var e=this,i=e.api.asc_getLocale();!i&&(i=e.permissions.lang?parseInt(Common.util.LanguageInfo.getLocalLanguageCode(e.permissions.lang)):1033),new SSE.Views.FormatSettingsDialog({api:e.api,handler:function(t,i){i&&e.api.asc_setCellFormat(i.format),Common.NotificationCenter.trigger("edit:complete",e.documentHolder)},props:{format:t.options.numformat,formatInfo:t.options.numformatinfo,langId:i}}).show(),Common.NotificationCenter.trigger("edit:complete",this.documentHolder)},onNumberFormatOpenAfter:function(t){if(this.api){var e=this,i=e.api.asc_getLocale() +;if(!i&&(i=e.permissions.lang?parseInt(Common.util.LanguageInfo.getLocalLanguageCode(e.permissions.lang)):1033),this._state.langId!==i){this._state.langId=i;var n=new Asc.asc_CFormatCellsInfo;n.asc_setType(Asc.c_oAscNumFormatType.None),n.asc_setSymbol(this._state.langId);for(var o=this.api.asc_getFormatCells(n),s=0;sOnly 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",txtKeepTextOnly:"Keep text only",txtUseTextImport:"Use text import wizard",txtUndoExpansion:"Undo table autoexpansion",txtRedoExpansion:"Redo table autoexpansion",txtAnd:"and",txtOr:"or",txtEquals:"Equals",txtNotEquals:"Does not equal",txtGreater:"Greater than",txtGreaterEquals:"Greater than or equal to",txtLess:"Less than",txtLessEquals:"Less than or equal to",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",txtFilterTop:"Top",txtFilterBottom:"Bottom",txtItems:"items",txtPercent:"percent",txtEqualsToCellColor:"Equals to cell color",txtEqualsToFontColor:"Equals to font color",txtAll:"(All)",txtBlanks:"(Blanks)",txtColumn:"Column",txtImportWizard:"Text Import Wizard"},SSE.Controllers.DocumentHolder||{}))}),define("text!spreadsheeteditor/main/app/template/CellEditor.template",[],function(){return'
    \r\n \r\n
    \r\n \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n \r\n
    \r\n'}),define("spreadsheeteditor/main/app/view/CellEditor",["text!spreadsheeteditor/main/app/template/CellEditor.template","common/main/lib/component/BaseView"],function(t){"use strict";SSE.Views.CellEditor=Common.UI.BaseView.extend(_.extend({template:_.template(t),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t)},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:"--"}]})}),this.btnNamedRanges.render($("#ce-cell-name-menu")),this.btnNamedRanges.setVisible(!1),this.btnNamedRanges.menu.setOffset(-81),this.$cellname=$("#ce-cell-name",this.el),this.$btnexpand=$("#ce-btn-expand",this.el),this.$btnfunc=$("#ce-func-label",this.el);var t=this;return this.$cellname.on("focus",function(e){var i=t.$cellname[0];i.selectionStart=0,i.selectionEnd=i.value.length,i.scrollLeft=i.scrollWidth}),this.$btnfunc.addClass("disabled"),this.$btnfunc.tooltip({title:this.tipFormula,placement:"cursor"}),this},updateCellInfo:function(t){t&&this.$cellname.val("string"==typeof t?t:t.asc_getName())},cellNameDisabled:function(t){t?this.$cellname.attr("disabled","disabled"):this.$cellname.removeAttr("disabled"),this.btnNamedRanges.setDisabled(t)},tipFormula:"Insert Function",textManager:"Manager"},SSE.Views.CellEditor||{}))}),define("text!spreadsheeteditor/main/app/template/NameManagerDlg.template",[],function(){return'
    \r\n
    \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n \r\n \r\n \r\n \r\n
    \r\n
    \r\n
    '}),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(t){"use strict";SSE.Views=SSE.Views||{},SSE.Views.NameManagerDlg=Common.Views.AdvancedSettingsWindow.extend(_.extend({options:{alias:"NameManagerDlg",contentWidth:510,height:353},initialize:function(e){_.extend(this.options,{title:this.txtTitle,template:['
    ','
    '+_.template(t)({scope:this})+"
    ","
    ",'
    ','"].join("")},e),this.api=e.api,this.handler=e.handler,this.sheets=e.sheets||[],this.sheetNames=e.sheetNames||[],this.ranges=e.ranges||[],this.props=e.props,this.sort=e.sort||{type:"name",direction:1},this.locked=e.locked||!1,this.userTooltip=!0,this.currentNamedRange=void 0,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 t=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(e,i){t.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(['
    '].join("")),itemTemplate:_.template(['
    ','
    ','
    <%= name %>
    ','
    <%= scopeName %>
    ','
    <%= range %>
    ',"<% if (lock) { %>",'
    <%=lockuser%>
    ',"<% } %>","
    "].join(""))}),this.rangeList.store.comparator=function(e,i){var n=e.get(t.sort.type).toLowerCase(),o=i.get(t.sort.type).toLowerCase();return n==o?0:n0?this.textnoNames:this.textEmpty)}var a=this,l=this.rangeList.store,r=this.rangesStore.models,c=this.cmbFilter.getValue(),h=c<3?2==c:-1,d=c>2?4==c:-1;if(c>0&&(r=this.rangesStore.filter(function(t){return-1!==h?h===t.get("isTable"):-1!==d&&d===(null===t.get("scope"))})),l.reset(r,{silent:!1}),c=l.length,this.btnEditRange.setDisabled(!c),this.btnDeleteRange.setDisabled(!c),c>0){if(void 0!==e&&null!==e||(e=0),_.isNumber(e))e>c-1&&(e=c-1),this.rangeList.selectByIndex(e),setTimeout(function(){a.rangeList.scrollToRecord(l.at(e))},50);else if(e){var p=l.findWhere({name:e.asc_getName(!0),scope:e.asc_getScope()});p&&(this.rangeList.selectRecord(p),setTimeout(function(){a.rangeList.scrollToRecord(p)},50))}!0===this.userTooltip&&this.rangeList.cmpEl.find(".lock-user").length>0&&this.rangeList.cmpEl.on("mouseover",_.bind(a.onMouseOverLock,a)).on("mouseout",_.bind(a.onMouseOutLock,a))}_.delay(function(){a.rangeList.cmpEl.find(".listview").focus(),a.rangeList.scroller.update({alwaysVisibleY:!0})},100,this)},onMouseOverLock:function(t,e,i){if(!0===this.userTooltip&&$(t.target).hasClass("lock-user")){var n=this,o=$(t.target).tooltip({title:this.tipIsLocked,trigger:"manual"}).data("bs.tooltip");this.userTooltip=o.tip(),this.userTooltip.css("z-index",parseInt(this.$window.css("z-index"))+10),o.show(),setTimeout(function(){n.userTipHide()},5e3)}},userTipHide:function(){"object"==typeof this.userTooltip&&(this.userTooltip.remove(),this.userTooltip=void 0,this.rangeList.cmpEl.off("mouseover").off("mouseout"))},onMouseOutLock:function(t,e,i){"object"==typeof this.userTooltip&&this.userTipHide()},onEditRange:function(t){if(this.locked)return void Common.NotificationCenter.trigger("namedrange:locked");var e=this,i=e.$window.offset(),n=this.rangeList.getSelectedRec(),o=(_.indexOf(this.rangeList.store.models,n),t&&n?new Asc.asc_CDefName(n.get("name"),n.get("range"),n.get("scope"),n.get("isTable"),void 0,void 0,void 0,!0):null),s=new SSE.Views.NamedRangeEditDlg({api:e.api,sheets:this.sheets,props:t?o:this.props,isEdit:t,handler:function(i,n){"ok"==i&&n&&(t?(e.currentNamedRange=n,e.api.asc_editDefinedNames(o,n)):(e.cmbFilter.setValue(0),e.currentNamedRange=n,e.api.asc_setDefinedNames(n)))}}).on("close",function(){e.show(),_.delay(function(){e.rangeList.cmpEl.find(".listview").focus()},100,e)});e.hide(),s.show(i.left+65,i.top+77)},onDeleteRange:function(){var t=this.rangeList.getSelectedRec();t&&(this.currentNamedRange=_.indexOf(this.rangeList.store.models,t),this.api.asc_delDefinedNames(new Asc.asc_CDefName(t.get("name"),t.get("range"),t.get("scope"),t.get("isTable"),void 0,void 0,void 0,!0)))},getSettings:function(){return this.sort},onPrimary:function(){return!0},onDlgBtnClick:function(t){this.handler&&this.handler.call(this,t.currentTarget.attributes.result.value),this.close()},onSortNames:function(t){t!==this.sort.type?(this.sort={type:t,direction:1},this.spanSortName.toggleClass("hidden"),this.spanSortScope.toggleClass("hidden")):this.sort.direction=-this.sort.direction;var e="name"==t?this.spanSortName:this.spanSortScope;this.sort.direction>0?e.removeClass("sort-desc"):e.addClass("sort-desc"),this.rangeList.store.sort(),this.rangeList.onResetItems(),this.rangeList.scroller.update({alwaysVisibleY:!0})},getUserName:function(t){var e=SSE.getCollection("Common.Collections.Users");if(e){var i=e.findUser(t);if(i)return i.get("username")}return this.guestText},onSelectRangeItem:function(t,e,i){this.userTipHide();var n={};if(_.isFunction(i.toJSON)){if(!i.get("selected"))return;n=i.toJSON(),this.currentNamedRange=_.indexOf(this.rangeList.store.models,i),this.btnEditRange.setDisabled(n.lock),this.btnDeleteRange.setDisabled(n.lock||n.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(t,e,i){i.keyCode!=Common.UI.Keys.DELETE||this.btnDeleteRange.isDisabled()||this.onDeleteRange()},onDblClickItem:function(t,e,i){this.btnEditRange.isDisabled()||this.onEditRange(!0)},onLockDefNameManager:function(t){this.locked=t==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.
    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(t){"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)},"Common.Views.Header":{"formulabar:hide":function(t){this.editor.setVisible(!t),Common.localStorage.setBool("sse-hidden-formula",t),Common.NotificationCenter.trigger("layout:changed","celleditor",t?"hidden":"showed")}.bind(this)}})},setApi:function(t){return this.api=t,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(t){this.mode=t,this.editor.$btnfunc[this.mode.isEdit?"removeClass":"addClass"]("disabled"),this.editor.btnNamedRanges.setVisible(this.mode.isEdit&&!this.mode.isEditDiagram&&!this.mode.isEditMailMerge),this.mode.isEdit&&this.api.asc_registerCallback("asc_onSelectionChanged",_.bind(this.onApiSelectionChanged,this))},onInputKeyDown:function(t){if(Common.UI.Keys.UP===t.keyCode||Common.UI.Keys.DOWN===t.keyCode||Common.UI.Keys.TAB===t.keyCode||Common.UI.Keys.RETURN===t.keyCode||Common.UI.Keys.ESC===t.keyCode||Common.UI.Keys.LEFT===t.keyCode||Common.UI.Keys.RIGHT===t.keyCode){var e=$("#menu-formula-selection");e.hasClass("open")&&e.find(".dropdown-menu").trigger("keydown",t)}},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(t){t==Asc.c_oAscCellEditorState.editStart?(this.api.isCellEdited=!0,this.editor.cellNameDisabled(!0)):t==Asc.c_oAscCellEditorState.editInCell?this.api.isCEditorFocused="clear":t==Asc.c_oAscCellEditorState.editEnd&&(this.api.isCellEdited=!1,this.api.isCEditorFocused=!1,this.editor.cellNameDisabled(!1)),this.editor.$btnfunc.toggleClass("disabled",t==Asc.c_oAscCellEditorState.editText)},onApiCellSelection:function(t){this.editor.updateCellInfo(t)},onApiSelectionChanged:function(t){var e=t.asc_getFlags().asc_getSelectionType(),i=!this.mode.isEditMailMerge&&!this.mode.isEditDiagram&&(!0===t.asc_getLocked()||!0===t.asc_getLockedTable()),n=e==Asc.c_oAscSelectionType.RangeChartText,o=e==Asc.c_oAscSelectionType.RangeChart,s=e==Asc.c_oAscSelectionType.RangeShapeText,a=e==Asc.c_oAscSelectionType.RangeShape,l=e==Asc.c_oAscSelectionType.RangeImage,r=s||a||n||o;this.editor.$btnfunc.toggleClass("disabled",l||r||i)},onApiDisconnect:function(){this.mode.isEdit=!1;var t=this.getApplication().getController("FormulaDialog");t&&t.hideDialog(),this.mode.isEdit||($("#ce-func-label",this.editor.el).addClass("disabled"),this.editor.btnNamedRanges.setVisible(!1))},onCellsRange:function(t){this.editor.cellNameDisabled(t!=Asc.c_oAscSelectionDialogType.None),this.editor.$btnfunc.toggleClass("disabled",t!=Asc.c_oAscSelectionDialogType.None)},onLayoutResize:function(t,e){"cell:edit"==e&&(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(t){if(t.keyCode==Common.UI.Keys.RETURN){var e=this.editor.$cellname.val();e&&e.length&&this.api.asc_findCell(e),Common.NotificationCenter.trigger("edit:complete",this.editor)}},onBlurCellEditor:function(){"clear"==this.api.isCEditorFocused?this.api.isCEditorFocused=void 0:this.api.isCellEdited&&(this.api.isCEditorFocused=!0)},onKeyupCellEditor:function(t){t.keyCode!=Common.UI.Keys.RETURN||t.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 t=this.getApplication().getController("FormulaDialog");t&&($("#ce-func-label",this.editor.el).blur(),t.showDialog())}},onNamedRangesMenu:function(t,e){var i=this;if("manager"==e.options.value){for(var n=this.api.asc_getWorksheetsCount(),o=-1,s=[],a=[];++o2)},onLockDefNameManager:function(t){this.namedrange_locked=t==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(t){_.extend(this.options,t||{}),this.template=['
    ','
    ',"","
    ",'
    ',"
    ",'"].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 t=this;t.inputUrl=new Common.UI.InputField({el:$("#id-dlg-url"),allowBlank:!1,blankError:t.txtEmpty,style:"width: 100%;",validateOnBlur:!1,validation:function(e){return!!/((^https?)|(^ftp)):\/\/.+/i.test(e)||t.txtNotUrl}}),this.getChild().find(".btn").on("click",_.bind(this.onBtnClick,this))},show:function(){Common.UI.Window.prototype.show.apply(this,arguments);var t=this;_.delay(function(){t.getChild("input").focus()},500)},onPrimary:function(t){return this._handleInput("ok"),!1},onBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value)},_handleInput:function(t){if(this.options.handler){if("ok"==t&&!0!==this.inputUrl.checkValidate())return void this.inputUrl.cmpEl.find("input").focus();this.options.handler.call(this,t,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||{}))}),void 0===Common)var Common={};if(define("common/main/lib/component/LoadMask",["common/main/lib/component/BaseView"],function(){"use strict";Common.UI.LoadMask=Common.UI.BaseView.extend(function(){var t,e,i;return{options:{cls:"",style:"",title:"Loading...",owner:document.body},template:_.template(['"].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t),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(!e&&!i){if(t=this.owner instanceof Common.UI.BaseView?$(this.owner.el):$(this.owner),t.hasClass("masked"))return this;var n=this;return e=$('
    '),i=$(this.template({id:n.id,cls:n.cls,style:n.style,title:n.title})),t.addClass("masked"),t.append(e),t.append(i),i.css({top:Math.round(t.height()/2-(i.height()+parseInt(i.css("padding-top"))+parseInt(i.css("padding-bottom")))/2)+"px",left:Math.round(t.width()/2-(i.width()+parseInt(i.css("padding-left"))+parseInt(i.css("padding-right")))/2)+"px"}),(t.height()<1||t.width()<1)&&i.css({visibility:"hidden"}),Common.util.Shortcuts.suspendEvents(),this}},hide:function(){t&&t.removeClass("masked"),e&&e.remove(),i&&i.remove(),e=null,i=null,Common.util.Shortcuts.resumeEvents()},setTitle:function(e){this.title=e,t&&t.hasClass("masked")&&i&&$(".asc-loadmask-title",i).html(e)},isVisible:function(){return!_.isEmpty(i)},updatePosition:function(){t&&t.hasClass("masked")&&i&&(i.css({top:Math.round(t.height()/2-(i.height()+parseInt(i.css("padding-top"))+parseInt(i.css("padding-bottom")))/2)+"px",left:Math.round(t.width()/2-(i.width()+parseInt(i.css("padding-left"))+parseInt(i.css("padding-right")))/2)+"px"}),i.css({visibility:"visible"}))}}}())}),define("common/main/lib/view/SelectFileDlg",["common/main/lib/component/Window","common/main/lib/component/LoadMask"],function(){"use strict";Common.Views.SelectFileDlg=Common.UI.Window.extend(_.extend({initialize:function(t){var e={};_.extend(e,{title:this.textTitle,width:1024,height:621,header:!0},t),this.template=['
    '].join(""),e.tpl=_.template(this.template)(e),this.fileChoiceUrl=t.fileChoiceUrl||"",Common.UI.Window.prototype.initialize.call(this,e)},render:function(){Common.UI.Window.prototype.render.call(this),this.$window.find("> .body").css({height:"auto",overflow:"hidden"});var t=document.createElement("iframe");t.width="100%",t.height=585,t.align="top",t.frameBorder=0,t.scrolling="no",t.onload=_.bind(this._onLoad,this), +$("#id-select-file-placeholder").append(t),this.loadMask=new Common.UI.LoadMask({owner:$("#id-select-file-placeholder")}),this.loadMask.setTitle(this.textLoading),this.loadMask.show(),t.src=this.fileChoiceUrl;var e=this;this._eventfunc=function(t){e._onWindowMessage(t)},this._bindWindowEvents.call(this),this.on("close",function(t){e._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(t){if(t&&window.JSON)try{this._onMessage.call(this,window.JSON.parse(t.data))}catch(t){}},_onMessage:function(t){if(t&&"onlyoffice"==t.Referer&&void 0!==t.file){Common.NotificationCenter.trigger("window:close",this);var e=this;setTimeout(function(){_.isEmpty(t.file)||e.trigger("selectfile",e,t.file)},50)}},_onLoad:function(){this.loadMask&&this.loadMask.hide()},textTitle:"Select Data Source",textLoading:"Loading"},Common.Views.SelectFileDlg||{}))}),void 0===Common)var Common={};if(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'
    \n
    \n
    \n <%= tabsmarkup %>\n
    \n
    \n
    \n
    \n
    \n
    \n \n
    \n
    \n \n
    \n
    \n
    \n
    \n
    \n \n \n
    \n
    \n \n \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n \n \n \n \n
    \n
    \n \n \n \n \n \n \n \n \n
    \n
    \n
    \n
    \n
    \n \n \n \n \n \n
    \n
    \n \n \n \n \n \n
    \n
    \n
    \n
    \n
    \n \n
    \n
    \n \n
    \n
    \n
    \n
    \n
    \n \n \n
    \n
    \n \n \n
    \n
    \n
    \n
    \n
    \n \n
    \n
    \n \n \n \n \n
    \n
    \n
    \n
    \n
    \n \n
    \n
    \n \n
    \n
    \n
    \n
    \n
    \n \n \n
    \n
    \n \n \n
    \n
    \n
    \n
    \n
    \n
    \n \n
    \n
    \n
    \n \n \n \n \n \n
    \n
    \n
    \n \n \n
    \n
    \n
    \n \n
    \n
    \n
    \n
    \n \n \n \n \n \n
    \n
    \n
    \n \n \n \n \n
    \n
    \n
    \n
    \n \n
    \n
    \n
    \n \n \n \n \n \n \n \n \n \n
    \n
    \n
    \n
    \n
    \n \n \n
    \n
    \n \n \n
    \n
    \n
    \n
    \n \n
    \n
    \n
    \n \n \n
    \n \x3c!--
    --\x3e\n \x3c!--
    --\x3e\n \x3c!----\x3e\n \x3c!--
    --\x3e\n \x3c!--
    --\x3e\n \x3c!----\x3e\n \x3c!--
    --\x3e\n \x3c!--
    --\x3e\n
    \n
    \n
    \n
    '}),define("text!spreadsheeteditor/main/app/template/ToolbarAnother.template",[],function(){return'
    \n <% if ( isEditDiagram ) { %>\n \x3c!-----------------------\x3e\n \x3c!-- Edit diagram mode --\x3e\n \x3c!-----------------------\x3e\n
    \n
    \n
    \n \n \n \n \n
    \n
    \n
    \n
    \n
    \n \n
    \n
    \n
    \n
    \n
    \n \n \n \n
    \n
    \n
    \n
    \n
    \n \n
    \n
    \n
    \n
    \n <% } else if ( isEditMailMerge ) { %>\n \x3c!-----------------------\x3e\n \x3c!-- Edit mail merge mode --\x3e\n \x3c!-----------------------\x3e\n
    \n
    \n
    \n \n \n \n \n
    \n
    \n
    \n
    \n
    \n \n \n
    \n
    \n
    \n
    \n
    \n \n \n
    \n
    \n
    \n
    \n
    \n \n
    \n
    \n
    \n
    \n <% } %>\n
    '}),define("text!spreadsheeteditor/main/app/template/ToolbarView.template",[],function(){return'
    \n
    \n
    \n <%= tabsmarkup %>\n
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    '}),void 0===Common)var Common={};if(Common.Models=Common.Models||{},define("common/main/lib/model/Font",["backbone"],function(t){"use strict";Common.Models.Font=t.Model.extend({defaults:function(){return{id:Common.UI.getId(),name:null,cloneid:null,imgidx:0,type:0}}})}),void 0===Common)var Common={};if(Common.Collections=Common.Collections||{},define("common/main/lib/collection/Fonts",["backbone","common/main/lib/model/Font"],function(t){"use strict";Common.Collections.Fonts=t.Collection.extend({model:Common.Models.Font,comparator:function(t,e){var i=t.get("name").toLowerCase(),n=e.get("name").toLowerCase();return i==n?0:i","<% if (iconImg) { print(''); } else { %>","<% if (iconCls != \"\") { if (/svgicon/.test(iconCls)) {print('');} else print(' '); }} %>","<% } %>","<% if ( !menu ) { %>",'","<% } else if (split == false) {%>",'
    ','","
    ","<% } else { %>",'
    ','",'","
    ","<% } %>"].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t);var e=this;e.id=e.options.id||Common.UI.getId(),e.hint=e.options.hint,e.enableToggle=e.options.enableToggle,e.allowDepress=e.options.allowDepress,e.cls=e.options.cls,e.iconCls=e.options.iconCls,e.menu=e.options.menu,e.split=e.options.split,e.toggleGroup=e.options.toggleGroup,e.disabled=e.options.disabled,e.visible=e.options.visible,e.pressed=e.options.pressed,e.caption=e.options.caption,e.template=e.options.template||e.template,e.style=e.options.style,e.rendered=!1,e.options.el&&e.render()},render:function(t){var e=this;if(e.trigger("render:before",e),e.cmpEl=$(e.el),t&&(e.setElement(t,!1),e.rendered||(/icon-top/.test(e.cls)&&e.caption&&/huge/.test(e.cls)&&(!0===e.split?(!!e.cls&&(e.cls=e.cls.replace(/\s?(?:x-huge|icon-top)/g,"")),this.template=_.template('
    ')):e.menu?this.template=_.template('
    '):this.template=_.template('')),e.cmpEl=$(this.template({id:e.id,cls:e.cls,iconCls:e.iconCls,iconImg:e.options.iconImg,menu:e.menu,split:e.split,disabled:e.disabled,pressed:e.pressed,caption:e.caption,style:e.style})),e.menu&&_.isObject(e.menu)&&_.isFunction(e.menu.render)&&e.menu.render(e.cmpEl),t.html(e.cmpEl),e.$icon=e.$el.find(".icon"))),!e.rendered){var i=e.cmpEl,n=i.hasClass("btn-group"),o=i.hasClass("split");if(e.options.hint){var s=e.cmpEl.closest(".asc-window") +;if("object"==typeof e.options.hint&&e.options.hint.length>1&&$("button",i).length>0){var a=$("button",i);e.btnEl=$(a[0]),e.btnMenuEl=$(a[1])}else e.btnEl=e.cmpEl,e.btnEl.attr("data-toggle","tooltip");e.btnEl.tooltip({title:"string"==typeof e.options.hint?e.options.hint:e.options.hint[0],placement:e.options.hintAnchor||"cursor"}),e.btnMenuEl&&e.btnMenuEl.tooltip({title:e.options.hint[1],placement:e.options.hintAnchor||"cursor"}),s.length>0&&(e.btnEl.data("bs.tooltip").tip().css("z-index",parseInt(s.css("z-index"))+10),e.btnMenuEl&&e.btnMenuEl.data("bs.tooltip").tip().css("z-index",parseInt(s.css("z-index"))+10))}_.isString(e.toggleGroup)&&(e.enableToggle=!0);var l,r=function(t){if(!e.disabled&&1==t.which){if(e.doToggle(),e.options.hint){var i=e.btnEl.data("bs.tooltip");i&&(void 0===i.dontShow&&(i.dontShow=!0),i.hide())}e.trigger("click",e,t)}},c=function(t,n,s){if(!t){var a=!1;$("button",i).each(function(t,e){if($(e).is(":hover"))return a=!0,!1}),a||(i.removeClass("over"),$("button",i).removeClass("over"))}if("button"==n){if(!t&&e.enableToggle&&e.allowDepress&&e.pressed)return;if(t&&!o&&e.enableToggle&&e.allowDepress&&!e.pressed)return void s.preventDefault();$("button:first",i).toggleClass("active",t)}else $("[data-toggle^=dropdown]",i).toggleClass("active",t);i.toggleClass("active",t)},h=function(t){if(!e.disabled&&1==t.which&&o){if(e.options.hint){var n=(e.btnMenuEl?e.btnMenuEl:e.btnEl).data("bs.tooltip");n&&(void 0===n.dontShow&&(n.dontShow=!0),n.hide())}var s=i.hasClass("open");c(!s,"arrow",t)}},d=function(t,e){o?c(e,"button",t):(i.toggleClass("active",e),$("button",i).toggleClass("active",e))},p=function(t){l=t.currentTarget.className.match(/dropdown/)?"arrow":"button",c(!0,l,t),$(document).on("mouseup",m)},m=function(t){c(!1,l,t),$(document).off("mouseup",m)},u=function(t,i){e.cmpEl.find(".dropdown-toggle").blur(),e.cmpEl.hasClass("active")!==e.pressed&&e.cmpEl.trigger("button.internal.active",[e.pressed])};n?(o&&($("[data-toggle^=dropdown]",i).on("mousedown",_.bind(h,this)),$("button",i).on("mousedown",_.bind(p,this)),e.options.width>0&&$("button:first",i).css("width",e.options.width-$("[data-toggle^=dropdown]",i).outerWidth())),i.on("hide.bs.dropdown",_.bind(c,e,!1,"arrow")),i.on("show.bs.dropdown",_.bind(c,e,!0,"arrow")),i.on("hidden.bs.dropdown",_.bind(u,e)),$("button:first",i).on("click",r)):i.on("click",r),i.on("button.internal.active",_.bind(d,e)),i.on("mouseover",function(t){e.disabled||(e.cmpEl.addClass("over"),e.trigger("mouseover",e,t))}),i.on("mouseout",function(t){e.cmpEl.removeClass("over"),e.disabled||e.trigger("mouseout",e,t)}),Common.UI.ToggleManager.register(e)}return e.rendered=!0,e.pressed&&e.toggle(e.pressed,!0),e.disabled&&e.setDisabled(!(e.disabled=!1)),e.visible||e.setVisible(e.visible),e.trigger("render:after",e),this},doToggle:function(){var t=this;!t.enableToggle||!1===t.allowDepress&&t.pressed||t.toggle()},toggle:function(t,e){var i=void 0===t?!this.pressed:!!t;this.pressed=i,this.cmpEl&&this.cmpEl.trigger("button.internal.active",[i]),e||this.trigger("toggle",this,i)},isActive:function(){return this.enableToggle?this.pressed:this.cmpEl.hasClass("active")},setDisabled:function(t){if(this.rendered&&this.disabled!=t){var e=this.cmpEl,i=e.hasClass("btn-group"),n=this;if((t=!0===t)!==e.hasClass("disabled")){var o=function(e){e.toggleClass("disabled",t),n.options.allowMouseEventsOnDisabled||(t?e.attr({disabled:t}):e.removeAttr("disabled"))};o(e),i&&o(e.children("button"))}if((t||!Common.Utils.isGecko)&&this.options.hint){var s=this.btnEl.data("bs.tooltip");s&&(t&&s.hide(),!Common.Utils.isGecko&&(s.enabled=!t)),this.btnMenuEl&&(s=this.btnMenuEl.data("bs.tooltip"))&&(t&&s.hide(),!Common.Utils.isGecko&&(s.enabled=!t))}if(t&&this.menu&&_.isObject(this.menu)&&this.menu.rendered&&this.menu.isVisible()&&setTimeout(function(){n.menu.hide()},1),n.options.signals){n.options.signals.indexOf("disabled")<0||n.trigger("disabled",n,t)}}this.disabled=t},isDisabled:function(){return this.disabled},setIconCls:function(t){var e=$(this.el).find(".icon"),i=this.iconCls;this.iconCls=t,e.removeClass(i),e.addClass(t||"")},setVisible:function(t){this.cmpEl&&this.cmpEl.toggleClass("hidden",!t),this.visible=t},isVisible:function(){return this.cmpEl?this.cmpEl.is(":visible"):$(this.el).is(":visible")},updateHint:function(t){if(this.options.hint=t,this.rendered){var e=this.cmpEl,i=e.closest(".asc-window");if(!this.btnEl)if("object"==typeof this.options.hint&&this.options.hint.length>1&&$("button",e).length>0){var n=$("button",e);this.btnEl=$(n[0]),this.btnMenuEl=$(n[1])}else this.btnEl=e,this.btnEl.attr("data-toggle","tooltip");if(this.btnEl.data("bs.tooltip")&&this.btnEl.removeData("bs.tooltip"),this.btnMenuEl&&this.btnMenuEl.data("bs.tooltip")&&this.btnMenuEl.removeData("bs.tooltip"),this.btnEl.tooltip({title:"string"==typeof t?t:t[0],placement:this.options.hintAnchor||"cursor"}),this.btnMenuEl&&this.btnMenuEl.tooltip({title:t[1],placement:this.options.hintAnchor||"cursor"}),i.length>0&&(this.btnEl.data("bs.tooltip").tip().css("z-index",parseInt(i.css("z-index"))+10),this.btnMenuEl&&this.btnMenuEl.data("bs.tooltip").tip().css("z-index",parseInt(i.css("z-index"))+10)),this.disabled||!Common.Utils.isGecko){var o=this.btnEl.data("bs.tooltip");o&&(this.disabled&&o.hide(),!Common.Utils.isGecko&&(o.enabled=!this.disabled)),this.btnMenuEl&&(o=this.btnMenuEl.data("bs.tooltip"))&&(this.disabled&&o.hide(),!Common.Utils.isGecko&&(o.enabled=!this.disabled))}}},setCaption:function(t){if(this.caption!=t&&(this.caption=t,this.rendered)){var e=this.cmpEl.find("button:first > .caption").addBack().filter("button > .caption");e.length>0?e.text(t):this.cmpEl.find("button:first").addBack().filter("button").text(t)}},setMenu:function(t){t&&_.isObject(t)&&_.isFunction(t.render)&&(this.menu=t,this.rendered&&this.menu.render(this.cmpEl))}})}),void 0===Common)var Common={};if(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(['
    ',"<% _.each(colors, function(color, index) { %>",'',"<% }) %>","
    "].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t);var e=this;this.id=e.options.id,this.cls=e.options.cls,this.style=e.options.style,this.colors=e.options.colors||[],this.value=e.options.value,e.options.el&&e.render()},render:function(t){var e=this;if(e.rendered?this.cmpEl=$(this.el):(this.cmpEl=$(this.template({id:this.id,cls:this.cls,style:this.style,colors:this.colors})),t?(this.setElement(t,!1),t.html(this.cmpEl)):$(this.el).html(this.cmpEl)),!e.rendered){this.cmpEl.on("click","span.color-item",_.bind(this.itemClick,this))}return e.rendered=!0,this},itemClick:function(t){var e=$(t.target);this.select(e.attr("data-color"))},select:function(t,e){if(this.value!=t){var i=this;$("span.color-item",this.cmpEl).removeClass("selected"),this.value=t,t&&/#?[a-fA-F0-9]{6}/.test(t)&&(t=/#?([a-fA-F0-9]{6})/.exec(t)[1].toUpperCase(),$("span[data-color="+t+"]",this.cmpEl).addClass("selected"),e||i.trigger("select",i,this.value))}}})}),define("text!common/main/lib/template/ExtendedColorDialog.template",[],function(){return'
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n \r\n \r\n
    \r\n
    \r\n
    \r\n\r\n'}),void 0===Common)var Common={};if(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('
    <% if (this.showCurrentColor) { %>
    <% } %>
    <% if (this.changeSaturation) { %>
    <% } %>
    <% if (this.allowEmptyColor) { %>
    <%= this.textNoColor %>
    <% } %>
    '),color:"#ff0000",options:{allowEmptyColor:!1,changeSaturation:!0,showCurrentColor:!0},initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t);var e,i,n,o,s,a,l,r,c=this,h=($(this.el),0),d=100,p=100;c.allowEmptyColor=c.options.allowEmptyColor,c.changeSaturation=c.options.changeSaturation,c.showCurrentColor=c.options.showCurrentColor;var m=function(t,e){var i=new Common.Utils.RGBColor("hsb("+t.h+","+t.s+","+t.b+")"),n=i.toHex();c.color=e?"transparent":n,u(),c.trigger("changecolor",c,c.color)},u=function(){s.length>0&&a.length>0&&("transparent"==c.color?a.show():(s.css("background-color",c.color),a.hide())),n.length>0&&n.css("background-color",new Common.Utils.RGBColor("hsb("+h+", 100, 100)").toHex()),l.length>0&&(l[0].innerHTML="transparent"==c.color?c.textNoColor:c.color.toUpperCase()),e.length>0&&i.length>0&&(e.css("left",d+"%"),e.css("top",100-p+"%"),i.css("top",parseInt(100*h/360)+"%"))},g=function(t,i,o){if(e.length>0&&n.length>0){var s=[Math.max(0,Math.min(100,parseInt((t.pageX*Common.Utils.zoom()-n.offset().left)/n.width()*100))),Math.max(0,Math.min(100,parseInt((t.pageY*Common.Utils.zoom()-n.offset().top)/n.height()*100)))];e.css("left",s[0]+"%"),e.css("top",s[1]+"%"),d=s[0],p=100-s[1],m({h:h,s:d,b:p})}},b=function(t,e,n){if(i&&o){var s=Math.max(0,Math.min(100,parseInt((t.pageY*Common.Utils.zoom()-o.offset().top)/o.height()*100)));i.css("top",s+"%"),h=parseInt(360*s/100),m({h:h,s:d,b:p})}},f=function(t,e,i){$(document).on("mouseup",C),$(document).on("mousemove",g)},C=function(t,e,i){$(document).off("mouseup",C),$(document).off("mousemove",g),g(t)},v=function(t,e,i){$(document).on("mouseup",_),$(document).on("mousemove",b),b(t)},_=function(t,e,i){$(document).off("mouseup",_),$(document).off("mousemove",b)},y=function(t){var e=new Common.util.RGBColor(c.color).toHSB();m(e,!0)},x=function(t){var m,g=$(c.el);g&&(e=g.find(".cnt-hb-arrow"),i=g.find(".cnt-sat-arrow"),n=g.find(".cnt-hb"),o=g.find(".cnt-sat"),s=g.find(".color-value"),l=g.find(".color-text"),r=g.find(".empty-color"),s.length>0&&(a=s.find(".transparent-color")),n.length>0&&(n.off("mousedown"),n.on("mousedown",f)),o.length>0&&(o.off("mousedown"),o.on("mousedown",v)),r.length>0&&(r.off("click"),r.on("click",y)),m="transparent"==c.color?{h:0,s:100,b:100}:new Common.Utils.RGBColor(c.color).toHSB(),h=m.h,d=m.s,p=m.b,h==d&&h==p&&0==h&&(d=100),u())};c.setColor=function(t){if(c.color!=t){var e;e="transparent"==t?{h:0,s:100,b:100}:new Common.Utils.RGBColor(t).toHSB(),h=e.h,d=e.s,p=e.b,h==d&&h==p&&0==h&&(d=100),c.color=t,u()}},c.getColor=function(){return c.color},c.on("render:after",x),c.render()},render:function(){return $(this.el).html(this.template()),this.trigger("render:after",this),this},textNoColor:"No Color"})}),void 0===Common)var Common={};if(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(t){Common.UI.BaseView.prototype.initialize.call(this,t);var e=this,i=$(this.el);i.addClass("masked-field user-select"),i.attr("maxlength",e.options.maxLength),i.on("keypress",function(t){var n=String.fromCharCode(t.which);e.options.maskExp.test(n)||t.ctrlKey||(t.keyCode==Common.UI.Keys.RETURN&&e.trigger("changed",e,i.val()),t.preventDefault(),t.stopPropagation())}),i.on("input",function(t){e.trigger("change",e,i.val())}),i.on("blur",function(t){e.trigger("changed",e,i.val())})},render:function(){return this},setValue:function(t){this.options.maskExp.test(t)&&t.length<=this.options.maxLength&&$(this.el).val(t)},getValue:function(){$(this.el).val()}})}),void 0===Common)var Common={};if(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(t){"use strict";Common.UI.ExtendedColorDialog=Common.UI.Window.extend(_.extend({tpl:_.template(t),options:{},rendered:!1,initialize:function(t){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,void 0!==this.color&&this.setColor(this.color),this},onChangeColor:function(t,e){this.colorNew.css({"background-color":e}),this.stopevents=!0;var i=e.match(this.hexRe);this.spinR.setValue(parseInt(i[1],16)),this.spinG.setValue(parseInt(i[2],16)),this.spinB.setValue(parseInt(i[3],16)),this.textColor.setValue((i[1]+i[2]+i[3]).toUpperCase()),this.stopevents=!1},showColor:function(t,e){if(!this.stopevents){var i=this.spinR.getNumberValue(),n=null==i||i<0?0:i>255?255:i;e&&this.spinR.setValue(n,!0),n=n.toString(16),i=this.spinG.getNumberValue();var o=null==i||i<0?0:i>255?255:i;e&&this.spinG.setValue(o,!0),o=o.toString(16),i=this.spinB.getNumberValue();var s=null==i||i<0?0:i>255?255:i;e&&this.spinB.setValue(s,!0),s=s.toString(16);var a=(1==n.length?"0"+n:n)+(1==o.length?"0"+o:o)+(1==s.length?"0"+s:s);this.colorsPicker.setColor("#"+a),"hex"!=t&&this.textColor.setValue(a.toUpperCase()),this.colorNew.css("background-color","#"+a)}},onChangingRGB:function(t,e,i,n){if(!this.stopevents){var o,s,a,l;switch(i=_.isEmpty(i)||isNaN(parseInt(i))?parseInt(e.getValue()):parseInt(i),t){case 1:o=(null==i||isNaN(i)||i<0?0:i>255?255:i).toString(16),l=this.spinG.getNumberValue(),s=(null==l||l<0?0:l>255?255:l).toString(16),l=this.spinB.getNumberValue(),a=(null==l||l<0?0:l>255?255:l).toString(16);break;case 2:l=this.spinR.getNumberValue(),o=(null==l||l<0?0:l>255?255:l).toString(16),s=(null==i||isNaN(i)||i<0?0:i>255?255:i).toString(16),l=this.spinB.getNumberValue(),a=(null==l||l<0?0:l>255?255:l).toString(16);break;case 3:l=this.spinR.getNumberValue(),o=(null==l||l<0?0:l>255?255:l).toString(16),l=this.spinG.getNumberValue(),s=(null==l||l<0?0:l>255?255:l).toString(16),a=(null==i||isNaN(i)||i<0?0:i>255?255:i).toString(16)}var r=(1==o.length?"0"+o:o)+(1==s.length?"0"+s:s)+(1==a.length?"0"+a:a);this.colorsPicker.setColor("#"+r),this.textColor.setValue(r.toUpperCase()),this.colorNew.css("background-color","#"+r)}},onChangeMaskedField:function(t,e){e=/^[a-fA-F0-9]{0,6}$/.test(e)?e:"000000",e="000000"+e;var i=e.match(/([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})$/i);this.stopevents=!0,this.spinR.setValue(parseInt(i[1],16)),this.spinG.setValue(parseInt(i[2],16)),this.spinB.setValue(parseInt(i[3],16)),this.stopevents=!1,this.rendered&&this.showColor("hex")},onChangedMaskedField:function(t,e){/^[a-fA-F0-9]{0,6}$/.test(e)&&!_.isEmpty(e)||t.setValue("000000"),this.rendered&&this.showColor("",!0)},getColor:function(){var t=/#?([a-fA-F0-9]{6})/.exec(this.colorsPicker.getColor());return t?t[1]:null},setColor:function(t){var e=this;if(!0!==this.rendered)return void(this.color=t);var i=/#?([a-fA-F0-9]{6})/.test(t)?t:"ff0000";e.colorsPicker.setColor("#"+i),function(){"transparent"==t?e.colorSaved.addClass("color-transparent"):(e.colorSaved.removeClass("color-transparent"),e.colorSaved.css("background-color","#"+t)),e.colorNew.css("background-color","#"+i)}(),e.stopevents=!0;var n=e.hexRe.exec(i);e.spinR.setValue(parseInt(n[1],16)),e.spinG.setValue(parseInt(n[2],16)),e.spinB.setValue(parseInt(n[3],16)),e.textColor.setValue((n[1]+n[2]+n[3]).toUpperCase()),e.stopevents=!1},show:function(){Common.UI.Window.prototype.show.apply(this,arguments);var t=this;_.delay(function(){t.getChild("#extended-text-color").focus()},50)},onPrimary:function(){return this.trigger("onmodalresult",1),this.close(!0),!1},cancelButtonText:"Cancel",addButtonText:"Add",textNew:"New",textCurrent:"Current",textRGBErr:"The entered value is incorrect.
    Please enter a numeric value between 0 and 255.",textHexErr:"The entered value is incorrect.
    Please enter a value between 000000 and FFFFFF."},Common.UI.ExtendedColorDialog||{}))}),void 0===Common)var Common={};if(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('
    <% var me = this; %><% $(colors).each(function(num, item) { %><% if (me.isBlankSeparator(item)) { %>
    <% } else if (me.isSeparator(item)) { %>
    <% } else if (me.isColor(item)) { %>  <% } else if (me.isTransparent(item)) { %> <% } else if (me.isEffect(item)) { %> <% } else if (me.isCaption(item)) { %>
    <%=item%>
    <% } %><% }); %>
    <% if (me.options.dynamiccolors!==undefined) { %>
    <% for (var i=0; i <% } %><% } %>
    '),colorRe:/(?:^|\s)color-(.{6})(?:\s|$)/,selectedCls:"selected",initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t);var e=this,i=$(this.el);this.colors=e.options.colors||this.generateColorData(e.options.themecolors,e.options.effects,e.options.standardcolors,e.options.transparent),i.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(),i.closest(".btn-group").on("show.bs.dropdown",_.bind(this.updateCustomColors,this)),i.closest(".dropdown-submenu").on("show.bs.dropdown",_.bind(this.updateCustomColors,this)),i.on("click",_.bind(this.handleClick,this))},render:function(){return $(this.el).html(this.template({colors:this.colors})),this},isBlankSeparator:function(t){return"string"==typeof t&&"-"==t},isSeparator:function(t){return"string"==typeof t&&"--"==t},isColor:function(t){return"string"==typeof t&&/[0-9A-F]{6}/.test(t)},isTransparent:function(t){return"string"==typeof t&&"transparent"==t},isCaption:function(t){return"string"==typeof t&&"-"!=t&&"--"!=t&&!/[0-9A-F]{6}|transparent/.test(t)},isEffect:function(t){return"object"==typeof t&&void 0!==t.effectId},getColor:function(){return this.value},updateCustomColors:function(){var t=$(this.el);if(t){var e=t.find("a."+this.selectedCls),i=e.length>0&&/color-dynamic/.test(e[0].className)?e.attr("color"):void 0;i&&(i=i.toUpperCase(),e.removeClass(this.selectedCls));var n=Common.localStorage.getItem("asc."+Common.localStorage.getId()+".colors.custom");n=n?n.split(","):[];for(var o,s=-1,a=n.lengththis.options.dynamiccolors&&i.shift(),Common.localStorage.setItem(e,i.join().toUpperCase())},addNewColor:function(t){var e=this,i=new Common.UI.ExtendedColorDialog({});i.on("onmodalresult",function(t){e._isdlgopen=!1,1==t&&(e.setCustomColor(i.getColor()),e.fireEvent("select",e,i.getColor()))}),e._isdlgopen=!0,i.setColor(void 0!==e.value&&!1!==e.value?e.value:void 0!==t?t:"000000"),i.show()},isDialogOpen:function(){return 1==this._isdlgopen},select:function(t,e){var i=$(this.el);if(i.find("a."+this.selectedCls).removeClass(this.selectedCls),"object"==typeof t){var n;void 0!==t.effectId?(n=i.find('a[effectid="'+t.effectId+'"]').first(),n.length>0?(n.addClass(this.selectedCls),this.value=n[0].className.match(this.colorRe)[1].toUpperCase()):this.value=!1):void 0!==t.effectValue&&(n=i.find('a[effectvalue="'+t.effectValue+'"].color-'+t.color.toUpperCase()).first(),n.length>0?(n.addClass(this.selectedCls),this.value=n[0].className.match(this.colorRe)[1].toUpperCase()):this.value=!1)}else if(/#?[a-fA-F0-9]{6}/.test(t)&&(t=/#?([a-fA-F0-9]{6})/.exec(t)[1].toUpperCase(),this.value=t),/^[a-fA-F0-9]{6}|transparent$/.test(t)&&_.indexOf(this.colors,t)>=0)_.indexOf(this.colors,this.value)<0&&(this.value=!1),(t!=this.value||this.options.allowReselect)&&("transparent"==t?i.find("a.color-transparent").addClass(this.selectedCls):i.find("a.palette-color.color-"+t).first().addClass(this.selectedCls),this.value=t,!0!==e&&this.fireEvent("select",this,t));else{var o=i.find("#"+t).first();0==o.length&&(o=i.find('a[color="'+t+'"]').first()),o.length>0&&(o.addClass(this.selectedCls),this.value=t.toUpperCase())}},selectByRGB:function(t,e){var i=$(this.el);i.find("a."+this.selectedCls).removeClass(this.selectedCls);var n="object"==typeof t?t.color:t;if(/#?[a-fA-F0-9]{6}/.test(n)&&(n=/#?([a-fA-F0-9]{6})/.exec(n)[1].toUpperCase()),/^[a-fA-F0-9]{6}|transparent$/.test(n)&&(n!=this.value||this.options.allowReselect)){var o="transparent"==n?i.find("a.color-transparent"):i.find("a.color-"+n).first();0==o.length&&(o=i.find("#"+n).first()),0==o.length&&(o=i.find('a[color="'+n+'"]').first()),o.length>0&&(o.addClass(this.selectedCls),this.value=n),!0!==e&&this.fireEvent("select",this,n)}},updateColors:function(t,e,i){if(void 0!==t&&void 0!==e){var n=this,o=$(this.el);void 0===n.aColorElements&&(n.aColorElements=o.find("a.palette-color")),void 0===n.aEffectElements&&(n.aEffectElements=o.find("a.palette-color-effect"));for(var s,a=0,l=0,r=0;r=e.length)continue;s=$(n.aColorElements[a]),s.removeClass("color-"+n.colors[r]),n.colors[r]=e[a].toUpperCase(),s.addClass("color-"+n.colors[r]),s.css({background:"#"+n.colors[r]}),s.find("span").first().css({background:"#"+n.colors[r]}),a++}else if("object"==typeof n.colors[r]&&void 0!==n.colors[r].effectId){if(l>=t.length)continue;s=$(n.aEffectElements[l]),t[l].color=t[l].color.toUpperCase(),n.colors[r].color!==t[l].color&&(s.removeClass("color-"+n.colors[r].color),s.addClass("color-"+t[l].color),s.css({background:"#"+t[l].color}),s.find("span").first().css({background:"#"+t[l].color})),n.colors[r].effectId!==t[l].effectId&&s.attr("effectid",""+t[l].effectId),n.colors[r].effectValue!==t[l].effectValue&&s.attr("effectvalue",""+t[l].effectValue),n.colors[r]=t[l],l++}if(i)this.select(i,!0);else{var c=$(this.el).find("a."+this.selectedCls);c.length&&c.hasClass("palette-color-effect")&&(this.value=c[0].className.match(this.colorRe)[1].toUpperCase())}this.options.updateColorsArr=void 0}},clearSelection:function(t){$(this.el).find("a."+this.selectedCls).removeClass(this.selectedCls),this.value=void 0},generateColorData:function(t,e,i,n){var o=[],s=t>0&&e>0?t*e:0;if(t>0){o=[this.textThemeColors,"-"];for(var a=0;a0&&o.push("-");for(var a=0;a','
    0x0
    ','
    ','
    ','
    ','
    ',"
    ","
    "].join("")),initialize:function(d){Common.UI.BaseView.prototype.initialize.call(this,d),t=this,e=$(this.el),t.itemSize=t.options.itemSize,t.minRows=t.options.minRows,t.minColumns=t.options.minColumns,t.maxRows=t.options.maxRows,t.maxColumns=t.options.maxColumns,this.render(),e&&(i=e.find(".dimension-picker-mousecatcher"),n=e.find(".dimension-picker-unhighlighted"),o=e.find(".dimension-picker-highlighted"),s=e.find(".dimension-picker-status"),e.css({width:t.minColumns+"em"}),i.css("z-index",1),i.width(t.maxColumns+"em").height(t.maxRows+"em"),n.width(t.minColumns+"em").height(t.minRows+"em"),s.html(a+" x "+l),s.width(n.width())),i.on("mousemove",r),o.on("mousemove",r),n.on("mousemove",r),i.on("mouseleave",c),o.on("mouseleave",c),n.on("mouseleave",c),i.on("click",h),o.on("click",h),n.on("click",h)},render:function(){return $(this.el).html(this.template()),this},setTableSize:function(i,r,c){i>this.maxColumns&&(i=this.maxColumns),r>this.maxRows&&(r=this.maxRows),a==i&&l==r||(a=i,l=r,o.width(a+"em").height(l+"em"),n.width((at.maxColumns?t.maxColumns:a+1)+"em").height((lt.maxRows?t.maxRows:l+1)+"em"),e.width(n.width()),s.html(a+" x "+l),s.width(n.width()),t.trigger("change",t,a,l,c))},getColumnsCount:function(){return a},getRowsCount:function(){return l}}}())}),void 0===Common)var Common={};var FONT_TYPE_RECENT=4;if(define("common/main/lib/component/ComboBoxFonts",["common/main/lib/component/ComboBox"],function(){"use strict";Common.UI.ComboBoxFonts=Common.UI.ComboBox.extend(function(){ +var t=Asc.FONT_THUMBNAIL_HEIGHT||26,e=window.devicePixelRatio>1,i=document.createElement("canvas"),n=i.getContext("2d"),o="../../../../sdkjs/common/Images/fonts_thumbnail.png?"+window.CP_urlArgs,s="../../../../sdkjs/common/Images/fonts_thumbnail@2x.png?"+window.CP_urlArgs;return"object"==typeof window.AscDesktopEditor&&(o=window.AscDesktopEditor.getFontsSprite(),s=window.AscDesktopEditor.getFontsSprite(!0)),i.height=e?2*t:t,i.width=e?604:302,{template:_.template(['
    ',' ','
    ','','","
    "].join("")),initialize:function(t){Common.UI.ComboBox.prototype.initialize.call(this,_.extend(t,{displayField:"name",scroller:{wheelSpeed:20,alwaysVisibleY:!0,onChange:this.updateVisibleFontsTiles.bind(this)}})),this.recent=_.isNumber(t.recent)?t.recent:5;var e=Common.localStorage.getKeysFilter();this.appPrefix=e&&e.length?e.split(",")[0]:"",Common.NotificationCenter.on("fonts:load",_.bind(this.fillFonts,this))},render:function(t){var e=null;return _.isUndefined(this._input)||(e=this._input.val()),Common.UI.ComboBox.prototype.render.call(this,t),this.setRawValue(e),this._input.on("keyup",_.bind(this.onInputKeyUp,this)),this._input.on("keydown",_.bind(this.onInputKeyDown,this)),this._input.on("focus",_.bind(function(){this.inFormControl=!0},this)),this._input.on("blur",_.bind(function(){this.inFormControl=!1},this)),this},onAfterKeydownMenu:function(t){var e=this;return t.keyCode==Common.UI.Keys.RETURN?($(t.target).closest("input").length?this.lastValue!==this._input.val()&&this._input.trigger("change"):($(t.target).click(),this.rendered&&(Common.Utils.isIE?this._input.trigger("change",{onkeydown:!0}):this._input.blur())),!1):t.keyCode==Common.UI.Keys.ESC&&this.isMenuOpen()?(this._input.val(this.lastValue),setTimeout(function(){e.closeMenu(),e.onAfterHideMenu(t)},10),!1):((t.keyCode==Common.UI.Keys.HOME&&!t.shiftKey||t.keyCode==Common.UI.Keys.END&&!t.shiftKey||t.keyCode==Common.UI.Keys.BACKSPACE&&!e._input.is(":focus"))&&this.isMenuOpen()&&(e._input.focus(),setTimeout(function(){e._input[0].selectionStart=e._input[0].selectionEnd=t.keyCode==Common.UI.Keys.HOME?0:e._input[0].value.length},10)),void this.updateVisibleFontsTiles())},onInputKeyUp:function(t){if(t.keyCode!=Common.UI.Keys.RETURN&&t.keyCode!==Common.UI.Keys.SHIFT&&t.keyCode!==Common.UI.Keys.CTRL&&t.keyCode!==Common.UI.Keys.ALT&&t.keyCode!==Common.UI.Keys.LEFT&&t.keyCode!==Common.UI.Keys.RIGHT&&t.keyCode!==Common.UI.Keys.HOME&&t.keyCode!==Common.UI.Keys.END&&t.keyCode!==Common.UI.Keys.ESC&&t.keyCode!==Common.UI.Keys.INSERT&&t.keyCode!==Common.UI.Keys.TAB&&(t.stopPropagation(),this.selectCandidate(t.keyCode==Common.UI.Keys.DELETE||t.keyCode==Common.UI.Keys.BACKSPACE),this._selectedItem)){var e=this;void 0===e._timerSelection&&(e._timerSelection=setInterval(function(){if(!(new Date-e._inInputKeyDown<100)&&e._selectedItem){clearInterval(e._timerSelection),e._timerSelection=void 0;var t=e._input[0],i=e._selectedItem.get(e.displayField),n=t.value;e.rendered&&(document.selection?document.selection.createRange().text=i:(t.selectionStart||"0"==t.selectionStart)&&(t.value=i,t.selectionStart=n.length,t.selectionEnd=i.length))}},10))}},onInputKeyDown:function(t){this._inInputKeyDown=new Date;var e=this;t.keyCode==Common.UI.Keys.ESC?(this._input.val(this.lastValue),setTimeout(function(){e.closeMenu(),e.onAfterHideMenu(t)},10)):t.keyCode!=Common.UI.Keys.RETURN&&t.keyCode!=Common.UI.Keys.CTRL&&t.keyCode!=Common.UI.Keys.SHIFT&&t.keyCode!=Common.UI.Keys.ALT?(this.isMenuOpen()||t.ctrlKey||this.openMenu(),t.keyCode==Common.UI.Keys.UP||t.keyCode==Common.UI.Keys.DOWN?_.delay(function(){var i=t.keyCode==Common.UI.Keys.DOWN?e.cmpEl.find("ul li.selected").nextAll("li:not(.divider)"):e.cmpEl.find("ul li.selected").prevAll("li:not(.divider)");i=i.length>0?i.eq(0):t.keyCode==Common.UI.Keys.DOWN?e.cmpEl.find("ul li:not(.divider):first"):e.cmpEl.find("ul li:not(.divider):last"),i=i.find("a"),e._skipInputChange=!0,i.focus(),e.updateVisibleFontsTiles()},10):e._skipInputChange=!1):t.keyCode==Common.UI.Keys.RETURN&&this._input.val()===e.lastValue&&this._input.trigger("change",{reapply:!0})},onInputChanged:function(t,e){if(!e||!e.synthetic){if(this._skipInputChange)return void(this._skipInputChange=!1);if(this._isMouseDownMenu)return void(this._isMouseDownMenu=!1);var i=$(t.target).val(),n={};if(!(this.lastValue!==i||e&&e.reapply))return void(e&&e.onkeydown&&this.trigger("combo:blur",this,t));n[this.valueField]=i,n[this.displayField]=i,this.trigger("changed:before",this,n,t),t.isDefaultPrevented()||(this._selectedItem?(n[this.valueField]=this._selectedItem.get(this.displayField),this.setRawValue(n[this.valueField]),this.trigger("selected",this,_.extend({},this._selectedItem.toJSON()),t),this.addItemToRecent(this._selectedItem),this.closeMenu()):(this.setRawValue(n[this.valueField]),n.isNewFont=!0,this.trigger("selected",this,n,t),this.closeMenu()),this.trigger("changed:after",this,n,t))}},getImageUri:function(o){if(o.cloneid){var s=$(this.el).find("ul > li#"+o.cloneid+" img");return null!=s?s[0].src:void 0}return e?(n.clearRect(0,0,604,2*t),n.drawImage(this.spriteThumbs,0,2*-Asc.FONT_THUMBNAIL_HEIGHT*o.imgidx)):(n.clearRect(0,0,302,t),n.drawImage(this.spriteThumbs,0,-Asc.FONT_THUMBNAIL_HEIGHT*o.imgidx)),i.toDataURL()},getImageWidth:function(){return 302},getImageHeight:function(){return t},getListItemHeight:function(){return 26},loadSprite:function(t){t&&(this.spriteThumbs=new Image,this.spriteThumbs.onload=t,this.spriteThumbs.src=window.devicePixelRatio>1?s:o)},fillFonts:function(t,e){var i=this;this.loadSprite(function(){if(i.store.set(t.toJSON()),i.rendered=!1,_.isUndefined(i.scroller)||(i.scroller.destroy(),delete i.scroller),i._scrollerIsInited=!1,i.render($(i.el)),i._fontsArray=i.store.toJSON(),i.recent>0){i.store.on("add",i.onInsertItem,i),i.store.on("remove",i.onRemoveItem,i),Common.Utils.InternalSettings.set(i.appPrefix+"-settings-recent-fonts",Common.localStorage.getItem(i.appPrefix+"-settings-recent-fonts"));var e=Common.Utils.InternalSettings.get(i.appPrefix+"-settings-recent-fonts");e=e?e.split(";"):[],e.reverse().forEach(function(t){t&&i.addItemToRecent(i.store.findWhere({name:t}),!0)})}})},onApiChangeFont:function(t){var e=this;setTimeout(function(){e.onApiChangeFontInternal(t)},100)},onApiChangeFontInternal:function(t){if(!this.inFormControl){var e=_.isFunction(t.get_Name)?t.get_Name():t.asc_getName();if(this.getRawValue()!==e){var i=this.store.findWhere({name:e});if($(".selected",$(this.el)).removeClass("selected"),i){this.setRawValue(i.get(this.displayField));var n=$("#"+i.get("id"),$(this.el)),o=$("ul.dropdown-menu",this.cmpEl);n&&o&&(n.addClass("selected"),this.recent<=0&&o.scrollTop(n.offset().top-o.offset().top))}else this.setRawValue(e)}}},itemClicked:function(t){Common.UI.ComboBox.prototype.itemClicked.apply(this,arguments);var e=$(t.target).closest("li"),i=this.store.findWhere({id:e.attr("id")});this.addItemToRecent(i)},onInsertItem:function(t){$(this.el).find("ul").prepend(_.template(['
  • ','',"
  • "].join(""))({item:t.attributes,scope:this}))},onRemoveItem:function(t,e,i){$(this.el).find("ul > li#"+t.id).remove()},onBeforeShowMenu:function(t){if(this.store.length<1)return void t.preventDefault();if(Common.UI.ComboBox.prototype.onBeforeShowMenu.apply(this,arguments),!this.getSelectedRecord()&&this.getRawValue()){var e=this.store.where({name:this.getRawValue()});e&&e.length&&this.selectRecord(e[e.length-1])}},onAfterShowMenu:function(t){this.recent>0?(this.scroller&&!this._scrollerIsInited&&(this.scroller.update(),this._scrollerIsInited=!0),$(this.el).find("ul").scrollTop(0),this.trigger("show:after",this,t),this.flushVisibleFontsTiles(),this.updateVisibleFontsTiles(null,0)):Common.UI.ComboBox.prototype.onAfterShowMenu.apply(this,arguments)},onAfterHideMenu:function(t){this.lastValue!==this._input.val()&&this._input.val(this.lastValue),Common.UI.ComboBox.prototype.onAfterHideMenu.apply(this,arguments)},addItemToRecent:function(t,e){if(!(this.recent<1)){var i=this.store.findWhere({name:t.get("name"),type:FONT_TYPE_RECENT});i&&this.store.remove(i);var n=this.store.where({type:FONT_TYPE_RECENT});n.length0&&s.length>0){o.addClass("selected");var a=o.position().top,l=s.scrollTop();0!=a&&s.scrollTop(l+a)}}},updateVisibleFontsTiles:function(i,n){var o=this,s=0,a=o.store.length,l=0;if(o.tiles||(o.tiles=[]),a!==o.tiles.length)for(s=o.tiles.length;s=0;--t)this.tiles[t]&&(this.tiles[t].parentNode.removeChild(this.tiles[t]),this.tiles[t]=null)}}}())}),void 0===Common)var Common={};if(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,minWidth:-1},template:_.template(['
    ','
    ','
    ',"
    "].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t),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.minWidth=this.options.minWidth,this.fieldPicker=new Common.UI.DataView({cls:"field-picker",allowScrollbar:!1,itemTemplate:_.template(['
    ','','<% if (typeof title !== "undefined") {%>','<%= title %>',"<% } %>","
    "].join(""))}),this.openButton=new Common.UI.Button({cls:"open-menu",menu:new Common.UI.Menu({menuAlign:"tl-tl",offset:[0,3],items:[{template:_.template('')}]})}),null!=this.options.additionalMenuItems&&(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,store:this.store,itemTemplate:_.template(['
    ','','<% if (typeof title !== "undefined") {%>','<%= title %>',"<% } %>","
    "].join(""))}),setInterval(_.bind(this.checkSize,this),500),this.options.el&&this.render()},render:function(t){if(!this.rendered){var e=this;e.trigger("render:before",e),e.cmpEl=$(e.el);var i=e.template({id:e.id,cls:e.cls,style:e.style});t?(e.setElement(t,!1),e.cmpEl=$(i),t.html(e.cmpEl)):e.cmpEl.html(i),e.rootWidth=e.cmpEl.width(),e.rootHeight=e.cmpEl.height(),e.fieldPicker.render($(".view",e.cmpEl)),e.openButton.render($(".button",e.cmpEl)),e.menuPicker.render($(".menu-picker-container",e.cmpEl)),e.openButton.menu.cmpEl&&e.openButton.menu.cmpEl&&(e.openButton.menu.menuAlignEl=e.cmpEl,e.openButton.menu.cmpEl.css("min-width",e.itemWidth),e.openButton.menu.on("show:before",_.bind(e.onBeforeShowMenu,e)),e.openButton.menu.on("show:after",_.bind(e.onAfterShowMenu,e)),e.openButton.cmpEl.on("hide.bs.dropdown",_.bind(e.onBeforeHideMenu,e)),e.openButton.cmpEl.on("hidden.bs.dropdown",_.bind(e.onAfterHideMenu,e))),e.options.hint&&(e.cmpEl.attr("data-toggle","tooltip"),e.cmpEl.tooltip({title:e.options.hint,placement:e.options.hintAnchor||"cursor"})),e.fieldPicker.on("item:select",_.bind(e.onFieldPickerSelect,e)),e.menuPicker.on("item:select",_.bind(e.onMenuPickerSelect,e)),e.fieldPicker.on("item:click",_.bind(e.onFieldPickerClick,e)),e.menuPicker.on("item:click",_.bind(e.onMenuPickerClick,e)),e.fieldPicker.on("item:contextmenu",_.bind(e.onPickerItemContextMenu,e)),e.menuPicker.on("item:contextmenu",_.bind(e.onPickerItemContextMenu,e)),e.fieldPicker.el.addEventListener("contextmenu",_.bind(e.onPickerComboContextMenu,e),!1),e.menuPicker.el.addEventListener("contextmenu",_.bind(e.onPickerComboContextMenu,e),!1),e.onResize(),e.rendered=!0,e.trigger("render:after",e)}return this},checkSize:function(){if(this.cmpEl&&this.cmpEl.is(":visible")){var t=this,e=this.cmpEl.width(),i=this.cmpEl.height();if(e div:not(.grouped-data):not(.ps-scrollbar-x-rail):not(.ps-scrollbar-y-rail)")[0]);a.length>0&&(n.itemMarginLeft=parseInt(a.css("margin-left")),n.itemMarginRight=parseInt(a.css("margin-right")),n.itemPaddingLeft=parseInt(a.css("padding-left")),n.itemPaddingRight=parseInt(a.css("padding-right")),n.itemBorderLeft=parseInt(a.css("border-left-width")),n.itemBorderRight=parseInt(a.css("border-right-width")))}var l=o.indexOf(t);if(l<0)return;var r=o.length,c=Math.floor(Math.max(s.width(),n.minWidth)/(n.itemWidth+(n.itemMarginLeft||0)+(n.itemMarginRight||0)+(n.itemPaddingLeft||0)+(n.itemPaddingRight||0)+(n.itemBorderLeft||0)+(n.itemBorderRight||0))),h=[];s.height()/n.itemHeight>2&&(c*=Math.floor(s.height()/n.itemHeight)),l=Math.floor(l/c)*c,r-l1?t/2:t)},setItemHeight:function(t){this.itemHeight!=t&&(this.itemHeight=window.devicePixelRatio>1?t/2:t)},removeTips:function(){var t=this.menuPicker;_.each(t.dataViewItems,function(t){var e=t.$el.data("bs.tooltip");e&&e.tip().remove()},t)}})}),void 0===Common)var Common={};if(define("common/main/lib/component/SynchronizeTip",["common/main/lib/component/BaseView"],function(){"use strict";Common.UI.SynchronizeTip=Common.UI.BaseView.extend(_.extend(function(){return{options:{target:$(document.body),text:"",placement:"right",showLink:!0},template:_.template(['
    <%= scope.placement %>">','
    ','
    ',"
    ",'
    <%= scope.text %>
    ','
    ',"
    ","<% if ( scope.showLink ) { %>",'',"<% } %>","
    ","
    "].join("")),initialize:function(t){this.textSynchronize+=Common.Utils.String.platformKey("Ctrl+S"),Common.UI.BaseView.prototype.initialize.call(this,t),this.target=this.options.target,this.text=_.isEmpty(this.options.text)?this.textSynchronize:this.options.text,this.textLink=_.isEmpty(this.options.textLink)?this.textDontShow:this.options.textLink,this.placement=this.options.placement,this.showLink=this.options.showLink},render:function(){return this.cmpEl||(this.cmpEl=$(this.template({scope:this})),$(document.body).append(this.cmpEl),this.cmpEl.find(".close").on("click",_.bind(function(){this.trigger("closeclick")},this)),this.cmpEl.find(".show-link label").on("click",_.bind(function(){this.trigger("dontshowclick")},this))),this.applyPlacement(),this},show:function(){this.cmpEl?(this.applyPlacement(),this.cmpEl.show()):this.render()},hide:function(){this.cmpEl&&this.cmpEl.hide()},close:function(){this.cmpEl&&this.cmpEl.remove()},applyPlacement:function(){var t=this.target.offset(),e=Common.Utils.innerHeight();if("top"==this.placement)this.cmpEl.css({bottom:e-t.top+"px",right:Common.Utils.innerWidth()-t.left-this.target.width()/2+"px"});else{var i=t.top+this.target.height()/2,n=this.cmpEl.height();i+n>e&&(i=e-n),"left"==this.placement?this.cmpEl.css({top:i+"px",right:Common.Utils.innerWidth()-t.left-5+"px"}):this.cmpEl.css({top:i+"px",left:t.left+this.target.width()+"px"})}},isVisible:function(){return this.cmpEl&&this.cmpEl.is(":visible")},textDontShow:"Don't show this message again",textSynchronize:"The document has been changed by another user.
    Please click to save your changes and reload the updates."}}(),Common.UI.SynchronizeTip||{}))}),define("common/main/lib/component/Mixtbar",["backbone","common/main/lib/component/BaseView"],function(t){"use strict";Common.UI.Mixtbar=Common.UI.BaseView.extend(function(){function t(t){this.fireEvent("change:compact",[$(t.target).data("tab")])}function e(t){this.isFolded&&($(t.target).parents(".toolbar, #file-menu-panel").length||this.collapse())}var i,n,o={timeout:2e3},s={},a=function(t,e){var n=i.scrollLeft();(n||"right"==t)&&i.animate({scrollLeft:"left"==t?n-100:n+100},200)};return{$tabs:void 0,$panels:void 0,isFolded:!1,initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t);this.$layout=$(t.template({tabsmarkup:_.template('
      <% for(var i in items) { %>
    • <% if (items[i].extcls) print(\' \' + items[i].extcls) %>"><%= items[i].caption %>
    • <% } %>
    ')({items:t.tabs})})),s.tabs=t.tabs,$(document.body).on("click",e.bind(this)),Common.NotificationCenter.on("tab:visible",_.bind(function(t,e){this.setVisible(t,e)},this))},afterRender:function(){var e=this;i=e.$(".tabs > ul"),e.$tabs=i.find("> li"),e.$panels=e.$(".box-panels > .panel"),o.$bar=e.$(".toolbar");var s=e.$(".tabs .scroll.right");n=e.$(".tabs .scroll.left"),n.on("click",a.bind(this,"left")),s.on("click",a.bind(this,"right")),i.on("dblclick","> .ribtab",t.bind(this)),i.on("click","> .ribtab",e.onTabClick.bind(this))},isTabActive:function(t){var e=this.$tabs.filter(".active").find("> a");return e.length&&e.data("tab")==t},setFolded:function(t){this.isFolded=t;var e=this;if(this.isFolded)o.$box||(o.$box=e.$el.find(".box-controls")),o.$bar.addClass("folded z-clear").toggleClass("expanded",!1),o.$bar.find(".tabs .ribtab").removeClass("active"),o.$bar.on($.support.transition.end,function(t){o.$bar.hasClass("folded")&&!o.$bar.hasClass("expanded")&&o.$bar.toggleClass("z-clear",!0)}),o.$box.on({mouseleave:function(t){},mouseenter:function(t){}});else{o.$bar.removeClass("folded z-clear"),o.$box.off();var i=o.$box.find(".panel.active");if(i.length){var n=i.data("tab");e.$tabs.find("> a[data-tab="+n+"]").parent().toggleClass("active",!0)}else n=e.$tabs.siblings(":not(.x-lone):visible").first().find("> a[data-tab]").data("tab"),e.setTab(n)}},collapse:function(){Common.UI.Menu.Manager.hideAll(),this.isFolded&&o.$bar&&(o.$bar.removeClass("expanded"),o.$bar.find(".tabs .ribtab").removeClass("active"))},expand:function(){o.$bar.removeClass("z-clear"),o.$bar.addClass("expanded")},onResize:function(t){this.hasTabInvisible()?i.parent().hasClass("short")||i.parent().addClass("short"):i.parent().hasClass("short")&&i.parent().removeClass("short"),this.processPanelVisible()},onTabClick:function(t){var e=this,i=$(t.currentTarget),n=i.find("> a[data-tab]").data("tab"),o=i.hasClass("x-lone");e.isFolded?i.hasClass("x-lone")?e.collapse():i.hasClass("active")?e.collapse():(e.setTab(n),e.processPanelVisible(null,!0)):i.hasClass("active")||o||(e.setTab(n),e.processPanelVisible(null,!0))},setTab:function(t){var e=this;if(t||(this.isFolded?this.collapse():t=this.lastPanel),t){e.$tabs.removeClass("active"),e.$panels.removeClass("active");var i=this.$panels.filter("[data-tab="+t+"]");i.length&&(this.lastPanel=t,i.addClass("active")),i.length?e.isFolded&&e.expand():e.isFolded&&e.collapse();var n=this.$tabs.find("> a[data-tab="+t+"]").parent();n.length&&n.addClass("active"),this.fireEvent("tab:active",[t])}},addTab:function(t,e,n){function o(t){return s.tabs[t]?s.tabs[t].action:o(--t)}var a=_.template('');s.tabs[n+1]=t;var l=o(n),r=this.$tabs||this.$layout.find(".tabs"),c=r.find("a[data-tab="+l+"]");c.length&&(c.parent().after(a(t)),e&&(r=this.$panels||this.$layout.find(".box-panels > .panel"),c=r.filter("[data-tab="+l+"]"),c.length?c.after(e):e.appendTo(this.$layout.find(".box-panels"))),this.$tabs&&(this.$tabs=i.find("> li")),this.$panels&&(this.$panels=this.$el.find(".box-panels > .panel")))},isCompact:function(){return this.isFolded},hasTabInvisible:function(){if(i.length<1)return!1;var t=Math.round(i.offset().left),e=Math.round(t+i.width()),n=this.$tabs.filter(":visible:first").get(0);if(!n)return!1;var o=n.getBoundingClientRect();return Math.round(o.left)e)},processPanelVisible:function(t,e){function i(){var e=t||n.$panels.filter(".active");if(e&&e.length){var i=e.parents(".box-controls").width(),o=e.data(),s=o.rightedge;s||(s=e.get(0).getBoundingClientRect().right),s>i?e.hasClass("compactwidth")||(e.addClass("compactwidth"),o.rightedge=s):e.hasClass("compactwidth")&&e.removeClass("compactwidth")}}var n=this;n._timer_id&&clearTimeout(n._timer_id),!0===e?i():n._timer_id=setTimeout(function(){delete n._timer_id,i()},100)},setExtra:function(t,e){e&&(this.$tabs||("right"==t?this.$layout.find(".extra.right").html(e):"left"==t&&this.$layout.find(".extra.left").html(e)))},setVisible:function(t,e){t&&this.$tabs&&this.$tabs.find("> a[data-tab="+t+"]").parent().css("display",e?"":"none")}}}())}),define("spreadsheeteditor/main/app/view/Toolbar",["backbone","text!spreadsheeteditor/main/app/template/Toolbar.template","text!spreadsheeteditor/main/app/template/ToolbarAnother.template","text!spreadsheeteditor/main/app/template/ToolbarView.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","common/main/lib/component/Mixtbar"],function(t,e,i,n){"use strict";SSE.enumLock={editCell:"cell-editing",editFormula:"is-formula",editText:"is-text",editPivot:"is-pivot",selImage:"sel-image",selShape:"sel-shape",selShapeText:"sel-shape-txt",selChart:"sel-chart",selChartText:"sel-chart-txt",selRange:"sel-range",selRangeEdit:"sel-range-edit",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",commentLock:"can-comment",cantModifyFilter:"cant-filter",disableOnStart:"on-start",cantGroup:"cant-group",cantGroupUngroup:"cant-group-ungroup",docPropsLock:"doc-props-lock",printAreaLock:"print-area-lock",namedRangeLock:"named-range-lock",multiselectCols:"is-multiselect-cols",headerLock:"header-lock",sheetLock:"sheet-lock"},SSE.Views.Toolbar=Common.UI.Mixtbar.extend(_.extend({el:"#toolbar",template:_.template(e),events:{},initialize:function(){var t=this;return t.SchemeNames=[t.txtScheme1,t.txtScheme2,t.txtScheme3,t.txtScheme4,t.txtScheme5,t.txtScheme6,t.txtScheme7,t.txtScheme8,t.txtScheme9,t.txtScheme10,t.txtScheme11,t.txtScheme12,t.txtScheme13,t.txtScheme14,t.txtScheme15,t.txtScheme16,t.txtScheme17,t.txtScheme18,t.txtScheme19,t.txtScheme20,t.txtScheme21],t._state={hasCollaborativeChanges:void 0},t.btnSaveCls="btn-save",t.btnSaveTip=this.tipSave+Common.Utils.String.platformKey("Ctrl+S"),t.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:"@"},t.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"}],this},lockToolbar:function(t,e,i){Common.Utils.lockControls(t,e,i,this.lockControls)},applyLayout:function(t){function o(){return{isDummy:!0,on:function(){}}}var s=this,a=SSE.enumLock;if(s.btnCopy=new Common.UI.Button({id:"id-toolbar-btn-copy",cls:"btn-toolbar",iconCls:"btn-copy"}),s.btnPaste=new Common.UI.Button({id:"id-toolbar-btn-paste",cls:"btn-toolbar",iconCls:"btn-paste",lock:[a.coAuth,a.lostConnect]}),s.btnUndo=new Common.UI.Button({id:"id-toolbar-btn-undo",cls:"btn-toolbar",iconCls:"btn-undo",disabled:!0,lock:[a.lostConnect],signals:["disabled"]}),s.btnRedo=new Common.UI.Button({id:"id-toolbar-btn-redo",cls:"btn-toolbar",iconCls:"btn-redo",disabled:!0,lock:[a.lostConnect], +signals:["disabled"]}),t.isEditDiagram){s.$layout=$(_.template(i)(t)),s.btnInsertFormula=new Common.UI.Button({id:"id-toolbar-btn-insertformula",cls:"btn-toolbar",iconCls:"btn-formula",split:!0,lock:[a.editText,a.selChart,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.selRangeEdit,a.lostConnect,a.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:s.txtAdditional,value:"more"}]})}),s.btnDecDecimal=new Common.UI.Button({id:"id-toolbar-btn-decdecimal",cls:"btn-toolbar",iconCls:"btn-decdecimal",lock:[a.editCell,a.selChart,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.lostConnect,a.coAuth]}),s.btnIncDecimal=new Common.UI.Button({id:"id-toolbar-btn-incdecimal",cls:"btn-toolbar",iconCls:"btn-incdecimal",lock:[a.editCell,a.selChart,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.lostConnect,a.coAuth]});var l=_.template(["<% _.each(items, function(item) { %>",'
  • ','
    <%= scope.getDisplayValue(item) %>
    ','
    <%= item.exampleval ? item.exampleval : "" %>
    ',"
  • ","<% }); %>",'
  • ','
  • '+s.textMoreFormats+"
  • "].join(""));s.cmbNumberFormat=new Common.UI.ComboBox({cls:"input-group-nr",menuStyle:"min-width: 180px;",hint:s.tipNumFormat,lock:[a.editCell,a.selChart,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.selRangeEdit,a.lostConnect,a.coAuth],itemsTemplate:l,editable:!1,data:s.numFormatData}),s.btnEditChart=new Common.UI.Button({id:"id-toolbar-rtn-edit-chart",cls:"btn-toolbar btn-text-value",caption:s.tipEditChart,lock:[a.lostConnect],style:"width: 120px;"})}else if(t.isEditMailMerge)s.$layout=$(_.template(i)(t)),s.btnSearch=new Common.UI.Button({id:"id-toolbar-btn-search",cls:"btn-toolbar",iconCls:"btn-search",lock:[a.lostConnect]}),s.btnSortDown=new Common.UI.Button({id:"id-toolbar-btn-sort-down",cls:"btn-toolbar",iconCls:"btn-sort-down",lock:[a.editCell,a.selChart,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.lostConnect,a.coAuth,a.ruleFilter,a.editPivot]}),s.btnSortUp=new Common.UI.Button({id:"id-toolbar-btn-sort-up",cls:"btn-toolbar",iconCls:"btn-sort-up",lock:[a.editCell,a.selChart,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.lostConnect,a.coAuth,a.ruleFilter,a.editPivot]}),s.btnSetAutofilter=new Common.UI.Button({id:"id-toolbar-btn-setautofilter",cls:"btn-toolbar",iconCls:"btn-autofilter",lock:[a.editCell,a.selChart,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.lostConnect,a.coAuth,a.ruleFilter,a.editPivot],enableToggle:!0}),s.btnClearAutofilter=new Common.UI.Button({id:"id-toolbar-btn-clearfilter",cls:"btn-toolbar",iconCls:"btn-clear-filter",lock:[a.editCell,a.selChart,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.lostConnect,a.coAuth,a.ruleDelFilter,a.editPivot]});else if(t.isEdit){Common.UI.Mixtbar.prototype.initialize.call(this,{template:_.template(e),tabs:[{caption:s.textTabFile,action:"file",extcls:"canedit",haspanel:!1},{caption:s.textTabHome,action:"home",extcls:"canedit"},{caption:s.textTabInsert,action:"ins",extcls:"canedit"},{caption:s.textTabLayout,action:"layout",extcls:"canedit"},{caption:s.textTabFormula,action:"formula",extcls:"canedit"},{caption:s.textTabData,action:"data",extcls:"canedit"}]}),s.cmbFontSize=new Common.UI.ComboBox({cls:"input-group-nr",menuStyle:"min-width: 55px;",hint:s.tipFontSize,lock:[a.selImage,a.editFormula,a.selRangeEdit,a.coAuth,a.coAuthText,a.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"},{value:96,displayValue:"96"}]}),s.cmbFontName=new Common.UI.ComboBoxFonts({cls:"input-group-nr",menuCls:"scrollable-menu",menuStyle:"min-width: 325px;",hint:s.tipFontName,lock:[a.selImage,a.editFormula,a.selRangeEdit,a.coAuth,a.coAuthText,a.lostConnect],store:new Common.Collections.Fonts}),s.btnPrint=new Common.UI.Button({id:"id-toolbar-btn-print",cls:"btn-toolbar",iconCls:"btn-print no-mask",lock:[a.editCell,a.cantPrint,a.disableOnStart],signals:["disabled"]}),s.btnSave=new Common.UI.Button({id:"id-toolbar-btn-save",cls:"btn-toolbar",iconCls:"no-mask "+s.btnSaveCls,signals:["disabled"]}),s.btnCollabChanges=s.btnSave,s.btnIncFontSize=new Common.UI.Button({id:"id-toolbar-btn-incfont",cls:"btn-toolbar",iconCls:"btn-incfont",lock:[a.selImage,a.editFormula,a.selRangeEdit,a.coAuth,a.coAuthText,a.lostConnect]}),s.btnDecFontSize=new Common.UI.Button({id:"id-toolbar-btn-decfont",cls:"btn-toolbar",iconCls:"btn-decfont",lock:[a.selImage,a.editFormula,a.selRangeEdit,a.coAuth,a.coAuthText,a.lostConnect]}),s.btnBold=new Common.UI.Button({id:"id-toolbar-btn-bold",cls:"btn-toolbar",iconCls:"btn-bold",lock:[a.selImage,a.editFormula,a.selRangeEdit,a.coAuth,a.coAuthText,a.lostConnect],enableToggle:!0}),s.btnItalic=new Common.UI.Button({id:"id-toolbar-btn-italic",cls:"btn-toolbar",iconCls:"btn-italic",lock:[a.selImage,a.editFormula,a.selRangeEdit,a.coAuth,a.coAuthText,a.lostConnect],enableToggle:!0}),s.btnUnderline=new Common.UI.Button({id:"id-toolbar-btn-underline",cls:"btn-toolbar",iconCls:"btn-underline",lock:[a.selImage,a.editFormula,a.selRangeEdit,a.coAuth,a.coAuthText,a.lostConnect],enableToggle:!0}),s.btnStrikeout=new Common.UI.Button({id:"id-toolbar-btn-strikeout",cls:"btn-toolbar",iconCls:"btn-strikeout",lock:[a.selImage,a.editFormula,a.selRangeEdit,a.coAuth,a.coAuthText,a.lostConnect],enableToggle:!0}),s.btnSubscript=new Common.UI.Button({id:"id-toolbar-btn-subscript",cls:"btn-toolbar",iconCls:"btn-subscript",icls:"btn-subscript",split:!0,enableToggle:!0,lock:[a.selImage,a.editFormula,a.selRangeEdit,a.coAuth,a.coAuthText,a.lostConnect],menu:new Common.UI.Menu({items:[{caption:s.textSuperscript,iconCls:"mnu-text-superscript",icls:"btn-superscript",checkable:!0,allowDepress:!0,toggleGroup:"textsubscriptgroup",value:"super"},{caption:s.textSubscript,iconCls:"mnu-text-subscript",icls:"btn-subscript",checkable:!0,allowDepress:!0,toggleGroup:"textsubscriptgroup",value:"sub"}]})}),s.mnuTextColorPicker=o(),s.btnTextColor=new Common.UI.Button({id:"id-toolbar-btn-fontcolor",cls:"btn-toolbar",iconCls:"btn-fontcolor",split:!0,lock:[a.selImage,a.editFormula,a.selRangeEdit,a.coAuth,a.coAuthText,a.lostConnect],menu:new Common.UI.Menu({items:[{template:_.template('
    ')},{template:_.template(''+s.textNewColor+"")}]})}),s.mnuBackColorPicker=o(),s.btnBackColor=new Common.UI.Button({id:"id-toolbar-btn-fillparag",cls:"btn-toolbar",iconCls:"btn-fillparag",split:!0,lock:[a.selImage,a.editCell,a.coAuth,a.coAuthText,a.lostConnect],menu:new Common.UI.Menu({items:[{template:_.template('
    ')},{template:_.template(''+s.textNewColor+"")}]})}),s.btnBorders=new Common.UI.Button({id:"id-toolbar-btn-borders",cls:"btn-toolbar",iconCls:"btn-border-out",icls:"btn-border-out",borderId:"outer",borderswidth:Asc.c_oAscBorderStyles.Thin,lock:[a.editCell,a.selChart,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.lostConnect,a.coAuth],split:!0,menu:!0}),s.btnAlignLeft=new Common.UI.Button({id:"id-toolbar-btn-align-left",cls:"btn-toolbar",iconCls:"btn-align-left",enableToggle:!0,lock:[a.editCell,a.selChart,a.selChartText,a.selImage,a.lostConnect,a.coAuth,a.coAuthText],toggleGroup:"alignGroup"}),s.btnAlignCenter=new Common.UI.Button({id:"id-toolbar-btn-align-center",cls:"btn-toolbar",iconCls:"btn-align-center",enableToggle:!0,lock:[a.editCell,a.selChart,a.selChartText,a.selImage,a.lostConnect,a.coAuth,a.coAuthText],toggleGroup:"alignGroup"}),s.btnAlignRight=new Common.UI.Button({id:"id-toolbar-btn-align-right",cls:"btn-toolbar",iconCls:"btn-align-right",enableToggle:!0,lock:[a.editCell,a.selChart,a.selChartText,a.selImage,a.lostConnect,a.coAuth,a.coAuthText],toggleGroup:"alignGroup"}),s.btnAlignJust=new Common.UI.Button({id:"id-toolbar-btn-align-just",cls:"btn-toolbar",iconCls:"btn-align-just",enableToggle:!0,lock:[a.editCell,a.selChart,a.selChartText,a.selImage,a.lostConnect,a.coAuth,a.coAuthText],toggleGroup:"alignGroup"}),s.btnMerge=new Common.UI.Button({id:"id-toolbar-rtn-merge",cls:"btn-toolbar",iconCls:"btn-merge",enableToggle:!0,allowDepress:!0,split:!0,lock:[a.editCell,a.selShape,a.selShapeText,a.selChart,a.selChartText,a.selImage,a.lostConnect,a.coAuth,a.ruleMerge,a.editPivot],menu:new Common.UI.Menu({items:[{caption:s.txtMergeCenter,value:Asc.c_oAscMergeOptions.MergeCenter},{caption:s.txtMergeAcross,value:Asc.c_oAscMergeOptions.MergeAcross},{caption:s.txtMergeCells,value:Asc.c_oAscMergeOptions.Merge},{caption:s.txtUnmerge,value:Asc.c_oAscMergeOptions.None}]})}),s.btnAlignTop=new Common.UI.Button({id:"id-toolbar-rtn-valign-top",cls:"btn-toolbar",iconCls:"btn-valign-top",lock:[a.editCell,a.selChart,a.selChartText,a.selImage,a.lostConnect,a.coAuth,a.coAuthText],enableToggle:!0,toggleGroup:"vAlignGroup"}),s.btnAlignMiddle=new Common.UI.Button({id:"id-toolbar-rtn-valign-middle",cls:"btn-toolbar",iconCls:"btn-valign-middle",enableToggle:!0,lock:[a.editCell,a.selChart,a.selChartText,a.selImage,a.lostConnect,a.coAuth,a.coAuthText],toggleGroup:"vAlignGroup"}),s.btnAlignBottom=new Common.UI.Button({id:"id-toolbar-rtn-valign-bottom",cls:"btn-toolbar",iconCls:"btn-valign-bottom",lock:[a.editCell,a.selChart,a.selChartText,a.selImage,a.lostConnect,a.coAuth,a.coAuthText],enableToggle:!0,toggleGroup:"vAlignGroup"}),s.btnWrap=new Common.UI.Button({id:"id-toolbar-rtn-wrap",cls:"btn-toolbar",iconCls:"btn-wrap",lock:[a.editCell,a.selChart,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.lostConnect,a.coAuth],enableToggle:!0,allowDepress:!0}),s.btnTextOrient=new Common.UI.Button({id:"id-toolbar-rtn-textorient",cls:"btn-toolbar",iconCls:"btn-text-orient",lock:[a.editCell,a.selChart,a.selChartText,a.selShape,a.selImage,a.lostConnect,a.coAuth,a.coAuthText],menu:new Common.UI.Menu({items:[{caption:s.textHorizontal,iconCls:"mnu-direct-horiz",checkable:!0,toggleGroup:"textorientgroup",value:"horiz"},{caption:s.textCounterCw,iconCls:"mnu-direct-ccw",checkable:!0,toggleGroup:"textorientgroup",value:"countcw"},{caption:s.textClockwise,iconCls:"mnu-direct-cw",checkable:!0,toggleGroup:"textorientgroup",value:"clockwise"},{caption:s.textRotateUp,iconCls:"mnu-direct-rup",checkable:!0,toggleGroup:"textorientgroup",value:"rotateup"},{caption:s.textRotateDown,iconCls:"mnu-direct-rdown",checkable:!0,toggleGroup:"textorientgroup",value:"rotatedown"}]})}),s.btnInsertImage=new Common.UI.Button({id:"tlbtn-insertimage",cls:"btn-toolbar x-huge icon-top",iconCls:"btn-insertimage",caption:s.capInsertImage,lock:[a.editCell,a.selChartText,a.selImage,a.lostConnect,a.coAuth],menu:new Common.UI.Menu({items:[{caption:s.mniImageFromFile,value:"file"},{caption:s.mniImageFromUrl,value:"url"},{caption:s.mniImageFromStorage,value:"storage"}]})}),s.btnInsertHyperlink=new Common.UI.Button({id:"tlbtn-insertlink",cls:"btn-toolbar x-huge icon-top",iconCls:"btn-inserthyperlink",caption:s.capInsertHyperlink,lock:[a.editCell,a.selChart,a.selChartText,a.selImage,a.selShape,a.cantHyperlink,a.multiselect,a.lostConnect,a.coAuth,a.editPivot]}),s.btnInsertChart=new Common.UI.Button({id:"tlbtn-insertchart",cls:"btn-toolbar x-huge icon-top",iconCls:"btn-insertchart",lock:[a.editCell,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.lostConnect,a.coAuth,a.coAuthText],caption:s.capInsertChart,menu:new Common.UI.Menu({style:"width: 435px;",items:[{template:_.template('')}]})}),s.btnInsertShape=new Common.UI.Button({id:"tlbtn-insertshape",cls:"btn-toolbar x-huge icon-top",iconCls:"btn-insertshape",enableToggle:!0,caption:s.capInsertShape,lock:[a.editCell,a.selChartText,a.selImage,a.lostConnect,a.coAuth],menu:new Common.UI.Menu({cls:"menu-shapes"})}),s.btnInsertText=new Common.UI.Button({id:"tlbtn-inserttext",cls:"btn-toolbar x-huge icon-top",iconCls:"btn-text",caption:s.capInsertText,lock:[a.editCell,a.selChartText,a.selImage,a.lostConnect,a.coAuth],enableToggle:!0}),s.btnInsertTextArt=new Common.UI.Button({id:"tlbtn-inserttextart",cls:"btn-toolbar x-huge icon-top",iconCls:"btn-textart",caption:s.capInsertTextart,lock:[a.editCell,a.selChartText,a.selImage,a.lostConnect,a.coAuth],menu:new Common.UI.Menu({cls:"menu-shapes",items:[{template:_.template('
    ')}]})}),s.btnInsertEquation=new Common.UI.Button({id:"tlbtn-insertequation",cls:"btn-toolbar x-huge icon-top",iconCls:"btn-insertequation",caption:s.capInsertEquation,split:!0,lock:[a.editCell,a.selChartText,a.selImage,a.lostConnect,a.coAuth],menu:new Common.UI.Menu({cls:"menu-shapes"})}),s.btnTableTemplate=new Common.UI.Button({id:"id-toolbar-btn-ttempl",cls:"btn-toolbar",iconCls:"btn-ttempl",lock:[a.editCell,a.selChart,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.lostConnect,a.coAuth,a.ruleFilter,a.multiselect,a.cantModifyFilter],menu:new Common.UI.Menu({items:[{template:_.template('
    ')}]})}),s.btnInsertTable=new Common.UI.Button({id:"tlbtn-inserttable",cls:"btn-toolbar x-huge icon-top",iconCls:"btn-inserttable",caption:s.capInsertTable,lock:[a.editCell,a.selChart,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.lostConnect,a.coAuth,a.ruleFilter,a.multiselect,a.cantModifyFilter,a.ruleMerge,a.editPivot]}),s.listStyles=new Common.UI.ComboDataView({cls:"combo-styles",enableKeyEvents:!0,itemWidth:112,itemHeight:38,menuMaxHeight:226,lock:[a.editCell,a.selChart,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.lostConnect,a.coAuth],beforeOpenHandler:function(t){var e=this,i=e.openButton.menu;if(i.cmpEl){var n=$(e.cmpEl.find(".dataview.inner .style").get(0)).parent(),o=n.is(":visible")?parseInt(n.css("width")):e.itemWidth+parseInt(n.css("padding-left"))+parseInt(n.css("padding-right"))+parseInt(n.css("border-left-width"))+parseInt(n.css("border-right-width")),s=e.menuPicker.store.length>=6?6:e.menuPicker.store.length,a=Math.min(e.menuPicker.store.length,Math.round($(".dataview",$(e.fieldPicker.el)).width()/(-1+o)+.5));a=a",'
  • ','
    <%= scope.getDisplayValue(item) %>
    ','
    <%= item.exampleval ? item.exampleval : "" %>
    ',"
  • ","<% }); %>",'
  • ','
  • '+s.textMoreFormats+"
  • "].join(""));s.cmbNumberFormat=new Common.UI.ComboBox({cls:"input-group-nr",menuStyle:"min-width: 180px;",hint:s.tipNumFormat,lock:[a.editCell,a.selChart,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.selRangeEdit,a.lostConnect,a.coAuth],itemsTemplate:l,editable:!1,data:s.numFormatData}),s.btnPercentStyle=new Common.UI.Button({id:"id-toolbar-btn-percent-style",cls:"btn-toolbar",iconCls:"btn-percent-style",lock:[a.editCell,a.selChart,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.lostConnect,a.coAuth],styleName:"Percent"}),s.btnCurrencyStyle=new Common.UI.Button({id:"id-toolbar-btn-accounting-style",cls:"btn-toolbar",iconCls:"btn-currency-style",lock:[a.editCell,a.selChart,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.lostConnect,a.coAuth],styleName:"Currency",split:!0,menu:new Common.UI.Menu({style:"min-width: 120px;",items:[{caption:s.txtDollar,value:1033},{caption:s.txtEuro,value:1031},{caption:s.txtPound,value:2057},{caption:s.txtRouble,value:1049},{caption:s.txtYen,value:1041},{caption:"--"},{caption:s.textMoreFormats,value:-1}]})}),s.btnDecDecimal=new Common.UI.Button({id:"id-toolbar-btn-decdecimal",cls:"btn-toolbar",iconCls:"btn-decdecimal",lock:[a.editCell,a.selChart,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.lostConnect,a.coAuth]}),s.btnIncDecimal=new Common.UI.Button({id:"id-toolbar-btn-incdecimal",cls:"btn-toolbar",iconCls:"btn-incdecimal",lock:[a.editCell,a.selChart,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.lostConnect,a.coAuth]}),s.btnInsertFormula=new Common.UI.Button({id:"id-toolbar-btn-insertformula",cls:"btn-toolbar",iconCls:"btn-formula",split:!0,lock:[a.editText,a.selChart,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.selRangeEdit,a.lostConnect,a.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:s.txtAdditional,value:"more"}]})}),s.btnNamedRange=new Common.UI.Button({id:"id-toolbar-btn-insertrange",cls:"btn-toolbar",iconCls:"btn-named-range",lock:[a.selChart,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.lostConnect,a.coAuth,a.selRangeEdit],menu:new Common.UI.Menu({style:"min-width: 110px",items:[{caption:s.txtManageRange,lock:[a.editCell],value:"manage"},{caption:s.txtNewRange,lock:[a.editCell],value:"new"},{caption:s.txtPasteRange,value:"paste"}]})}),s.btnClearStyle=new Common.UI.Button({id:"id-toolbar-btn-clear",cls:"btn-toolbar",iconCls:"btn-clearstyle",lock:[a.lostConnect,a.coAuth,a.selRangeEdit],menu:new Common.UI.Menu({style:"min-width: 110px",items:[{caption:s.txtClearAll,lock:[a.cantModifyFilter],value:Asc.c_oAscCleanOptions.All},{caption:s.txtClearText,lock:[a.editCell,a.selChart,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.coAuth],value:Asc.c_oAscCleanOptions.Text},{caption:s.txtClearFormat,lock:[a.editCell,a.selChart,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.coAuth,a.cantModifyFilter],value:Asc.c_oAscCleanOptions.Format},{caption:s.txtClearComments,lock:[a.editCell,a.selChart,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.coAuth],value:Asc.c_oAscCleanOptions.Comments},{caption:s.txtClearHyper,lock:[a.editCell,a.selChart,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.coAuth],value:Asc.c_oAscCleanOptions.Hyperlinks}]})}),s.btnCopyStyle=new Common.UI.Button({id:"id-toolbar-btn-copystyle",cls:"btn-toolbar",iconCls:"btn-copystyle",lock:[a.editCell,a.lostConnect,a.coAuth,a.selChart],enableToggle:!0}),s.btnAddCell=new Common.UI.Button({id:"id-toolbar-btn-addcell",cls:"btn-toolbar",iconCls:"btn-addcell",lock:[a.editCell,a.selChart,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.lostConnect,a.coAuth],menu:new Common.UI.Menu({items:[{caption:s.textInsRight,value:Asc.c_oAscInsertOptions.InsertCellsAndShiftRight},{caption:s.textInsDown,value:Asc.c_oAscInsertOptions.InsertCellsAndShiftDown},{caption:s.textEntireRow,value:Asc.c_oAscInsertOptions.InsertRows},{caption:s.textEntireCol,value:Asc.c_oAscInsertOptions.InsertColumns}]})}),s.btnDeleteCell=new Common.UI.Button({id:"id-toolbar-btn-delcell",cls:"btn-toolbar",iconCls:"btn-delcell",lock:[a.editCell,a.selChart,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.lostConnect,a.coAuth],menu:new Common.UI.Menu({items:[{caption:s.textDelLeft,value:Asc.c_oAscDeleteOptions.DeleteCellsAndShiftLeft},{caption:s.textDelUp,value:Asc.c_oAscDeleteOptions.DeleteCellsAndShiftTop},{caption:s.textEntireRow,value:Asc.c_oAscDeleteOptions.DeleteRows},{caption:s.textEntireCol,value:Asc.c_oAscDeleteOptions.DeleteColumns}]})}),s.btnColorSchemas=new Common.UI.Button({id:"id-toolbar-btn-colorschemas",cls:"btn-toolbar",iconCls:"btn-colorschemas",lock:[a.editCell,a.lostConnect,a.coAuth],menu:new Common.UI.Menu({items:[],restoreHeight:!0})}),s.btnHorizontalAlign=new Common.UI.Button({id:"id-toolbar-btn-halign",cls:"btn-toolbar",iconCls:"btn-align-left",icls:"btn-align-left",lock:[a.editCell,a.selChart,a.selChartText,a.lostConnect,a.coAuth,a.coAuthText],menu:new Common.UI.Menu({items:[{caption:s.tipAlignLeft,iconCls:"mnu-align-left",icls:"btn-align-left",checkable:!0,allowDepress:!0,toggleGroup:"halignGroup",checked:!0,value:AscCommon.align_Left},{caption:s.tipAlignCenter,iconCls:"mnu-align-center",icls:"btn-align-center",checkable:!0,allowDepress:!0,toggleGroup:"halignGroup",value:AscCommon.align_Center},{caption:s.tipAlignRight,iconCls:"mnu-align-right",icls:"btn-align-right",checkable:!0,allowDepress:!0,toggleGroup:"halignGroup",value:AscCommon.align_Right},{caption:s.tipAlignJust,iconCls:"mnu-align-just",icls:"btn-align-just",checkable:!0,allowDepress:!0,toggleGroup:"halignGroup",value:AscCommon.align_Justify}]})}),s.btnVerticalAlign=new Common.UI.Button({id:"id-toolbar-btn-valign",cls:"btn-toolbar",iconCls:"btn-valign-bottom",icls:"btn-valign-bottom",lock:[a.editCell,a.selChart,a.selChartText,a.lostConnect,a.coAuth,a.coAuthText],menu:new Common.UI.Menu({items:[{caption:s.tipAlignTop,iconCls:"mnu-valign-top",icls:"btn-valign-top",checkable:!0,allowDepress:!0,toggleGroup:"valignGroup",value:Asc.c_oAscVAlign.Top},{caption:s.tipAlignMiddle,iconCls:"mnu-valign-middle",icls:"btn-valign-middle",checkable:!0,allowDepress:!0,toggleGroup:"valignGroup",value:Asc.c_oAscVAlign.Center},{caption:s.tipAlignBottom,iconCls:"mnu-valign-bottom",icls:"btn-valign-bottom",checkable:!0,allowDepress:!0,checked:!0,toggleGroup:"valignGroup",value:Asc.c_oAscVAlign.Bottom}]})});var r=Common.localStorage.getItem("sse-hide-synch");s.showSynchTip=!(r&&1==parseInt(r)),s.btnPageOrient=new Common.UI.Button({id:"tlbtn-pageorient",cls:"btn-toolbar x-huge icon-top",iconCls:"btn-pageorient",caption:s.capBtnPageOrient,lock:[a.docPropsLock,a.lostConnect,a.coAuth],menu:new Common.UI.Menu({cls:"ppm-toolbar",items:[{caption:s.textPortrait,iconCls:"mnu-orient-portrait",checkable:!0,toggleGroup:"menuOrient",value:Asc.c_oAscPageOrientation.PagePortrait},{caption:s.textLandscape,iconCls:"mnu-orient-landscape",checkable:!0,toggleGroup:"menuOrient",value:Asc.c_oAscPageOrientation.PageLandscape}]})});var c=_.template('
    <%= caption %>
    <% if (options.value !== null) { %>
    <% } %>
    ");s.btnPageMargins=new Common.UI.Button({id:"tlbtn-pagemargins",cls:"btn-toolbar x-huge icon-top",iconCls:"btn-pagemargins",caption:s.capBtnMargins,lock:[a.docPropsLock,a.lostConnect,a.coAuth],menu:new Common.UI.Menu({items:[{caption:s.textMarginsLast,checkable:!0,template:c,toggleGroup:"menuPageMargins"},{caption:s.textMarginsNormal,checkable:!0,template:c,toggleGroup:"menuPageMargins",value:[19.1,17.8,19.1,17.8]},{caption:s.textMarginsNarrow,checkable:!0,template:c,toggleGroup:"menuPageMargins",value:[19.1,6.4,19.1,6.4]},{caption:s.textMarginsWide,checkable:!0,template:c,toggleGroup:"menuPageMargins",value:[25.4,25.4,25.4,25.4]},{caption:"--"},{caption:s.textPageMarginsCustom,value:"advanced"}]})});var h=_.template('
    <%= caption %>
    <%= parseFloat(Common.Utils.Metric.fnRecalcFromMM(options.value[0]).toFixed(2)) %> <%= Common.Utils.Metric.getCurrentMetricName() %> x <%= parseFloat(Common.Utils.Metric.fnRecalcFromMM(options.value[1]).toFixed(2)) %> <%= Common.Utils.Metric.getCurrentMetricName() %>
    ');s.btnPageSize=new Common.UI.Button({id:"tlbtn-pagesize",cls:"btn-toolbar x-huge icon-top",iconCls:"btn-pagesize",caption:s.capBtnPageSize,lock:[a.docPropsLock,a.lostConnect,a.coAuth],menu:new Common.UI.Menu({restoreHeight:!0,items:[{caption:"US Letter",subtitle:"21,59cm x 27,94cm",template:h,checkable:!0,toggleGroup:"menuPageSize",value:[215.9,279.4]},{caption:"US Legal",subtitle:"21,59cm x 35,56cm",template:h,checkable:!0,toggleGroup:"menuPageSize",value:[215.9,355.6]},{caption:"A4",subtitle:"21cm x 29,7cm",template:h,checkable:!0,toggleGroup:"menuPageSize",value:[210,297],checked:!0},{caption:"A5",subtitle:"14,81cm x 20,99cm",template:h,checkable:!0,toggleGroup:"menuPageSize",value:[148,210]},{caption:"B5",subtitle:"17,6cm x 25,01cm",template:h,checkable:!0,toggleGroup:"menuPageSize",value:[176,250]},{caption:"Envelope #10",subtitle:"10,48cm x 24,13cm",template:h,checkable:!0,toggleGroup:"menuPageSize",value:[104.8,241.3]},{caption:"Envelope DL",subtitle:"11,01cm x 22,01cm",template:h,checkable:!0,toggleGroup:"menuPageSize",value:[110,220]},{caption:"Tabloid",subtitle:"27,94cm x 43,17cm",template:h,checkable:!0,toggleGroup:"menuPageSize",value:[279.4,431.8]},{caption:"A3",subtitle:"29,7cm x 42,01cm",template:h,checkable:!0,toggleGroup:"menuPageSize",value:[297,420]},{caption:"Tabloid Oversize",subtitle:"30,48cm x 45,71cm",template:h,checkable:!0,toggleGroup:"menuPageSize",value:[304.8,457.1]},{caption:"ROC 16K",subtitle:"19,68cm x 27,3cm",template:h,checkable:!0,toggleGroup:"menuPageSize",value:[196.8,273]},{caption:"Envelope Choukei 3",subtitle:"11,99cm x 23,49cm",template:h,checkable:!0,toggleGroup:"menuPageSize",value:[119.9,234.9]},{caption:"Super B/A3",subtitle:"33,02cm x 48,25cm",template:h,checkable:!0,toggleGroup:"menuPageSize",value:[330.2,482.5]}]})}),s.mnuPageSize=s.btnPageSize.menu,s.btnPrintArea=new Common.UI.Button({id:"tlbtn-printarea",cls:"btn-toolbar x-huge icon-top",iconCls:"btn-print-area",caption:s.capBtnPrintArea,lock:[a.selChart,a.selChartText,a.selShape,a.selShapeText,a.selImage,a.editCell,a.selRangeEdit,a.printAreaLock,a.lostConnect,a.coAuth],menu:new Common.UI.Menu({cls:"ppm-toolbar",items:[{caption:s.textSetPrintArea,lock:[a.namedRangeLock],value:Asc.c_oAscChangePrintAreaType.set},{caption:s.textClearPrintArea,value:Asc.c_oAscChangePrintAreaType.clear},{caption:s.textAddPrintArea,lock:[a.namedRangeLock],value:Asc.c_oAscChangePrintAreaType.add}]})}),s.btnEditHeader=new Common.UI.Button({id:"tlbtn-editheader",cls:"btn-toolbar x-huge icon-top",iconCls:"btn-editheader",caption:s.capBtnInsHeader,lock:[a.editCell,a.selRangeEdit,a.headerLock,a.lostConnect,a.coAuth]}),s.btnImgAlign=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"btn-img-align",caption:s.capImgAlign,lock:[a.selRange,a.selRangeEdit,a.cantGroup,a.lostConnect,a.coAuth,a.coAuthText],menu:!0}),s.btnImgGroup=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"btn-img-group",caption:s.capImgGroup,lock:[a.selRange,a.selRangeEdit,a.cantGroupUngroup,a.lostConnect,a.coAuth,a.coAuthText],menu:!0}),s.btnImgForward=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"btn-img-frwd",caption:s.capImgForward,split:!0,lock:[a.selRange,a.selRangeEdit,a.lostConnect,a.coAuth,a.coAuthText],menu:!0}),s.btnImgBackward=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"btn-img-bkwd",caption:s.capImgBackward,lock:[a.selRange,a.selRangeEdit,a.lostConnect,a.coAuth,a.coAuthText],split:!0,menu:!0})}else Common.UI.Mixtbar.prototype.initialize.call(this,{template:_.template(n),tabs:[{caption:s.textTabFile,action:"file",haspanel:!1}]});return t.isEdit&&(s.lockControls=[s.cmbFontName,s.cmbFontSize,s.btnIncFontSize,s.btnDecFontSize,s.btnBold,s.btnItalic,s.btnUnderline,s.btnStrikeout,s.btnSubscript,s.btnTextColor,s.btnHorizontalAlign,s.btnAlignLeft,s.btnAlignCenter,s.btnAlignRight,s.btnAlignJust,s.btnVerticalAlign,s.btnAlignTop,s.btnAlignMiddle,s.btnAlignBottom,s.btnWrap,s.btnTextOrient,s.btnBackColor,s.btnInsertTable,s.btnMerge,s.btnInsertFormula,s.btnNamedRange,s.btnIncDecimal,s.btnInsertShape,s.btnInsertEquation,s.btnInsertText,s.btnInsertTextArt,s.btnSortUp,s.btnSortDown,s.btnSetAutofilter,s.btnClearAutofilter,s.btnTableTemplate,s.btnPercentStyle,s.btnCurrencyStyle,s.btnDecDecimal,s.btnAddCell,s.btnDeleteCell,s.cmbNumberFormat,s.btnBorders,s.btnInsertImage,s.btnInsertHyperlink,s.btnInsertChart,s.btnColorSchemas,s.btnCopy,s.btnPaste,s.listStyles,s.btnPrint,s.btnClearStyle,s.btnCopyStyle,s.btnPageMargins,s.btnPageSize,s.btnPageOrient,s.btnPrintArea,s.btnImgAlign,s.btnImgBackward,s.btnImgForward,s.btnImgGroup,s.btnEditHeader],_.each(s.lockControls.concat([s.btnSave]),function(t){t&&_.isFunction(t.setDisabled)&&t.setDisabled(!0)}),this.lockToolbar(SSE.enumLock.disableOnStart,!0,{array:[s.btnPrint]}),this.on("render:after",_.bind(this.onToolbarAfterRender,this))),this},render:function(t){var e=this;if(e.isCompactView=t.isCompactView,this.fireEvent("render:before",[this]),t.isEdit?e.$el.html(e.rendererComponents(e.$layout)):(e.$layout.find(".canedit").hide(),e.$layout.addClass("folded"),e.$el.html(e.$layout)),this.fireEvent("render:after",[this]),Common.UI.Mixtbar.prototype.afterRender.call(this),Common.NotificationCenter.on({"window:resize":function(){Common.UI.Mixtbar.prototype.onResize.apply(e,arguments)}}),t.isEdit){if(!t.isEditDiagram&&!t.isEditMailMerge){var i=Common.localStorage.getItem("sse-pgmargins-top"),n=Common.localStorage.getItem("sse-pgmargins-left"),o=Common.localStorage.getItem("sse-pgmargins-bottom"),s=Common.localStorage.getItem("sse-pgmargins-right");if(null!==i&&null!==n&&null!==o&&null!==s){var a=this.btnPageMargins.menu.items[0];a.options.value=a.value=[parseFloat(i),parseFloat(n),parseFloat(o),parseFloat(s)],a.setVisible(!0),$(a.el).html(a.template({id:Common.UI.getId(),caption:a.caption,options:a.options}))}else this.btnPageMargins.menu.items[0].setVisible(!1);this.btnInsertImage.menu.items[2].setVisible(t.canRequestInsertImage||t.fileChoiceUrl&&t.fileChoiceUrl.indexOf("{documentType}")>-1)}e.setTab("home")}return e.isCompactView&&e.setFolded(!0),this},onTabClick:function(t){var e=this,i=$(t.currentTarget).find("> a[data-tab]").data("tab"),n=e.isTabActive("file");Common.UI.Mixtbar.prototype.onTabClick.apply(e,arguments),n?e.fireEvent("file:close"):"file"==i&&(e.fireEvent("file:open"),e.setTab(i))},rendererComponents:function(t){var e=$(t),i=function(t,i){Common.Utils.injectComponent(e.find(t),i)};return i("#slot-field-fontname",this.cmbFontName),i("#slot-field-fontsize",this.cmbFontSize),i("#slot-btn-print",this.btnPrint),i("#slot-btn-save",this.btnSave),i("#slot-btn-undo",this.btnUndo),i("#slot-btn-redo",this.btnRedo),i("#slot-btn-copy",this.btnCopy), +i("#slot-btn-paste",this.btnPaste),i("#slot-btn-incfont",this.btnIncFontSize),i("#slot-btn-decfont",this.btnDecFontSize),i("#slot-btn-bold",this.btnBold),i("#slot-btn-italic",this.btnItalic),i("#slot-btn-underline",this.btnUnderline),i("#slot-btn-strikeout",this.btnStrikeout),i("#slot-btn-subscript",this.btnSubscript),i("#slot-btn-fontcolor",this.btnTextColor),i("#slot-btn-fillparag",this.btnBackColor),i("#slot-btn-borders",this.btnBorders),i("#slot-btn-align-left",this.btnAlignLeft),i("#slot-btn-align-center",this.btnAlignCenter),i("#slot-btn-align-right",this.btnAlignRight),i("#slot-btn-align-just",this.btnAlignJust),i("#slot-btn-merge",this.btnMerge),i("#slot-btn-top",this.btnAlignTop),i("#slot-btn-middle",this.btnAlignMiddle),i("#slot-btn-bottom",this.btnAlignBottom),i("#slot-btn-wrap",this.btnWrap),i("#slot-btn-text-orient",this.btnTextOrient),i("#slot-btn-insimage",this.btnInsertImage),i("#slot-btn-instable",this.btnInsertTable),i("#slot-btn-inshyperlink",this.btnInsertHyperlink),i("#slot-btn-insshape",this.btnInsertShape),i("#slot-btn-instext",this.btnInsertText),i("#slot-btn-instextart",this.btnInsertTextArt),i("#slot-btn-insequation",this.btnInsertEquation),i("#slot-btn-sortdesc",this.btnSortDown),i("#slot-btn-sortasc",this.btnSortUp),i("#slot-btn-setfilter",this.btnSetAutofilter),i("#slot-btn-clear-filter",this.btnClearAutofilter),i("#slot-btn-table-tpl",this.btnTableTemplate),i("#slot-btn-format",this.cmbNumberFormat),i("#slot-btn-percents",this.btnPercentStyle),i("#slot-btn-currency",this.btnCurrencyStyle),i("#slot-btn-digit-dec",this.btnDecDecimal),i("#slot-btn-digit-inc",this.btnIncDecimal),i("#slot-btn-formula",this.btnInsertFormula),i("#slot-btn-named-range",this.btnNamedRange),i("#slot-btn-clear",this.btnClearStyle),i("#slot-btn-copystyle",this.btnCopyStyle),i("#slot-btn-cell-ins",this.btnAddCell),i("#slot-btn-cell-del",this.btnDeleteCell),i("#slot-btn-colorschemas",this.btnColorSchemas),i("#slot-btn-search",this.btnSearch),i("#slot-btn-inschart",this.btnInsertChart),i("#slot-field-styles",this.listStyles),i("#slot-btn-chart",this.btnEditChart),i("#slot-btn-pageorient",this.btnPageOrient),i("#slot-btn-pagemargins",this.btnPageMargins),i("#slot-btn-pagesize",this.btnPageSize),i("#slot-btn-printarea",this.btnPrintArea),i("#slot-img-align",this.btnImgAlign),i("#slot-img-group",this.btnImgGroup),i("#slot-img-movefrwd",this.btnImgForward),i("#slot-img-movebkwd",this.btnImgBackward),i("#slot-btn-editheader",this.btnEditHeader),e},createDelayedElements:function(){function t(t,e){t&&t.updateHint(e)}var e=this;if(t(this.btnPrint,this.tipPrint+Common.Utils.String.platformKey("Ctrl+P")),t(this.btnSave,this.btnSaveTip),t(this.btnCopy,this.tipCopy+Common.Utils.String.platformKey("Ctrl+C")),t(this.btnPaste,this.tipPaste+Common.Utils.String.platformKey("Ctrl+V")),t(this.btnUndo,this.tipUndo+Common.Utils.String.platformKey("Ctrl+Z")),t(this.btnRedo,this.tipRedo+Common.Utils.String.platformKey("Ctrl+Y")),t(this.btnIncFontSize,this.tipIncFont+Common.Utils.String.platformKey("Ctrl+]")),t(this.btnDecFontSize,this.tipDecFont+Common.Utils.String.platformKey("Ctrl+[")),t(this.btnBold,this.textBold+Common.Utils.String.platformKey("Ctrl+B")),t(this.btnItalic,this.textItalic+Common.Utils.String.platformKey("Ctrl+I")),t(this.btnUnderline,this.textUnderline+Common.Utils.String.platformKey("Ctrl+U")),t(this.btnStrikeout,this.textStrikeout),t(this.btnSubscript,this.textSubSuperscript),t(this.btnTextColor,this.tipFontColor),t(this.btnBackColor,this.tipPrColor),t(this.btnBorders,this.tipBorders),t(this.btnAlignLeft,this.tipAlignLeft),t(this.btnAlignCenter,this.tipAlignCenter),t(this.btnAlignRight,this.tipAlignRight),t(this.btnAlignJust,this.tipAlignJust),t(this.btnMerge,this.tipMerge),t(this.btnAlignTop,this.tipAlignTop),t(this.btnAlignMiddle,this.tipAlignMiddle),t(this.btnAlignBottom,this.tipAlignBottom),t(this.btnWrap,this.tipWrap),t(this.btnTextOrient,this.tipTextOrientation),t(this.btnInsertTable,this.tipInsertTable),t(this.btnInsertImage,this.tipInsertImage),t(this.btnInsertChart,this.tipInsertChartSpark),t(this.btnInsertText,this.tipInsertText),t(this.btnInsertTextArt,this.tipInsertTextart),t(this.btnInsertHyperlink,this.tipInsertHyperlink+Common.Utils.String.platformKey("Ctrl+K")),t(this.btnInsertShape,this.tipInsertShape),t(this.btnInsertEquation,this.tipInsertEquation),t(this.btnSortDown,this.txtSortAZ),t(this.btnSortUp,this.txtSortZA),t(this.btnSetAutofilter,this.txtFilter+" (Ctrl+Shift+L)"),t(this.btnClearAutofilter,this.txtClearFilter),t(this.btnSearch,this.txtSearch),t(this.btnTableTemplate,this.txtTableTemplate),t(this.btnPercentStyle,this.tipDigStylePercent),t(this.btnCurrencyStyle,this.tipDigStyleAccounting),t(this.btnDecDecimal,this.tipDecDecimal),t(this.btnIncDecimal,this.tipIncDecimal),t(this.btnInsertFormula,this.txtFormula),t(this.btnNamedRange,this.txtNamedRange),t(this.btnClearStyle,this.tipClearStyle),t(this.btnCopyStyle,this.tipCopyStyle),t(this.btnAddCell,this.tipInsertOpt),t(this.btnDeleteCell,this.tipDeleteOpt),t(this.btnColorSchemas,this.tipColorSchemas),t(this.btnHorizontalAlign,this.tipHAligh),t(this.btnVerticalAlign,this.tipVAligh),t(this.btnPageOrient,this.tipPageOrient),t(this.btnPageSize,this.tipPageSize),t(this.btnPageMargins,this.tipPageMargins),t(this.btnPrintArea,this.tipPrintArea),t(this.btnEditHeader,this.tipEditHeader),this.btnBorders&&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:_.template('<%= caption %>'),menu:function(){var t=_.template('
    ');return e.mnuBorderWidth=new Common.UI.Menu({style:"min-width: 100px;",menuAlign:"tl-tr",id:"toolbar-menu-borders-width",items:[{template:t,stopPropagation:!0,checkable:!0,toggleGroup:"border-width",value:Asc.c_oAscBorderStyles.Thin,offsety:0,checked:!0},{template:t,stopPropagation:!0,checkable:!0,toggleGroup:"border-width",value:Asc.c_oAscBorderStyles.Hair,offsety:20},{template:t,stopPropagation:!0,checkable:!0,toggleGroup:"border-width",value:Asc.c_oAscBorderStyles.Dotted,offsety:40},{template:t,stopPropagation:!0,checkable:!0,toggleGroup:"border-width",value:Asc.c_oAscBorderStyles.Dashed,offsety:60},{template:t,stopPropagation:!0,checkable:!0,toggleGroup:"border-width",value:Asc.c_oAscBorderStyles.DashDot,offsety:80},{template:t,stopPropagation:!0,checkable:!0,toggleGroup:"border-width",value:Asc.c_oAscBorderStyles.DashDotDot,offsety:100},{template:t,stopPropagation:!0,checkable:!0,toggleGroup:"border-width",value:Asc.c_oAscBorderStyles.Medium,offsety:120},{template:t,stopPropagation:!0,checkable:!0,toggleGroup:"border-width",value:Asc.c_oAscBorderStyles.MediumDashed,offsety:140},{template:t,stopPropagation:!0,checkable:!0,toggleGroup:"border-width",value:Asc.c_oAscBorderStyles.MediumDashDot,offsety:160},{template:t,stopPropagation:!0,checkable:!0,toggleGroup:"border-width",value:Asc.c_oAscBorderStyles.MediumDashDotDot,offsety:180},{template:t,stopPropagation:!0,checkable:!0,toggleGroup:"border-width",value:Asc.c_oAscBorderStyles.Thick,offsety:200}]}),e.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:_.template('<%= caption %>'),menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{template:_.template('
    '),stopPropagation:!0},{template:_.template(''+this.textNewColor+""),stopPropagation:!0}]})})]}));var i=$('
    ');$("button:first-child",this.btnBorders.cmpEl).append(i),i.css("background-color",this.btnBorders.currentColor||"transparent"),this.mnuBorderColorPicker=new Common.UI.ThemeColorPalette({el:$("#id-toolbar-menu-bordercolor")})}this.btnInsertChart&&(this.mnuInsertChartPicker=new Common.UI.DataView({el:$("#id-toolbar-menu-insertchart"),parentMenu:this.btnInsertChart.menu,showLast:!1,restoreHeight:539,groups:new Common.UI.DataViewGroupStore([{id:"menu-chart-group-bar",caption:e.textColumn,headername:e.textCharts},{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,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:_.template('
    ')})),this.mode.isEditMailMerge||this.mode.isEditDiagram||this.updateMetricUnit()},onToolbarAfterRender:function(t){if(this.btnTextColor&&this.btnTextColor.cmpEl){var e=$('
    ');$("button:first-child",this.btnTextColor.cmpEl).append(e),e.css("background-color",this.btnTextColor.currentColor||"transparent"),this.mnuTextColorPicker=new Common.UI.ThemeColorPalette({el:$("#id-toolbar-menu-fontcolor")})}if(this.btnBackColor&&this.btnBackColor.cmpEl){var e=$('
    ');$("button:first-child",this.btnBackColor.cmpEl).append(e),e.css("background-color",this.btnBackColor.currentColor||"transparent"),this.mnuBackColorPicker=new Common.UI.ThemeColorPalette({el:$("#id-toolbar-menu-paracolor"),transparent:!0})}},updateMetricUnit:function(){for(var t=this.btnPageMargins.menu.items,e=0;e0&&_.each(this.mnuColorSchema.items,function(t){t.remove()}),null==this.mnuColorSchema&&(this.mnuColorSchema=new Common.UI.Menu({restoreHeight:!0})),this.mnuColorSchema.items=[];var i=_.template(['','',"<% _.each(options.colors, function(color) { %>",'',"<% }) %>","",'<%= caption %>',""].join(""));_.each(t,function(t,n){for(var o=t.get_colors(),s=[],a=2;a<7;a++){var l="#"+Common.Utils.ThemeColor.getHexColor(o[a].get_r(),o[a].get_g(),o[a].get_b());s.push(l)}21==n&&this.mnuColorSchema.addItem({caption:"--"});var r=t.get_name();this.mnuColorSchema.addItem({template:i,cls:"color-schemas-menu",colors:s,caption:n<21?e.SchemeNames[n]||r:r,value:r,checkable:!0,toggleGroup:"menuSchema"})},this)},onApiCollaborativeChanges:function(){this._state.hasCollaborativeChanges||this.btnCollabChanges.rendered&&(this._state.hasCollaborativeChanges=!0,this.btnCollabChanges.$icon.removeClass(this.btnSaveCls).addClass("btn-synch"),this.showSynchTip?(this.btnCollabChanges.updateHint(""),void 0===this.synchTooltip&&this.createSynchTip(),this.synchTooltip.show()):this.btnCollabChanges.updateHint(this.tipSynchronize+Common.Utils.String.platformKey("Ctrl+S")),this.btnSave.setDisabled(!1),Common.Gateway.collaborativeChanges())},createSynchTip:function(){this.synchTooltip=new Common.UI.SynchronizeTip({extCls:this.mode.customization&&this.mode.customization.compactHeader?void 0:"inc-index",target:this.btnCollabChanges.$el}),this.synchTooltip.on("dontshowclick",function(){this.showSynchTip=!1,this.synchTooltip.hide(),this.btnCollabChanges.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.btnCollabChanges.updateHint(this.tipSynchronize+Common.Utils.String.platformKey("Ctrl+S"))},this)},synchronizeChanges:function(){if(this.btnCollabChanges.rendered){var t=this;t.btnCollabChanges.$icon.hasClass("btn-synch")&&(t.btnCollabChanges.$icon.removeClass("btn-synch").addClass(this.btnSaveCls),this.synchTooltip&&this.synchTooltip.hide(),this.btnCollabChanges.updateHint(this.btnSaveTip),this.btnSave.setDisabled(!t.mode.forcesave),this._state.hasCollaborativeChanges=!1)}},onApiUsersChanged:function(t){var e=[];_.each(t,function(t){t.asc_getView()||e.push(t)});var i=_.size(e),n=i>1?"btn-save-coauth":"btn-save";n!==this.btnSaveCls&&this.btnCollabChanges.rendered&&(this.btnSaveTip=(i>1?this.tipSaveCoauth:this.tipSave)+Common.Utils.String.platformKey("Ctrl+S"),this.btnCollabChanges.$icon.hasClass("btn-synch")||(this.btnCollabChanges.$icon.removeClass(this.btnSaveCls).addClass(n),this.btnCollabChanges.updateHint(this.btnSaveTip)),this.btnSaveCls=n)},onAppReady:function(t){if(this.mode.isEdit&&!this.mode.isEditMailMerge&&!this.mode.isEditDiagram){var e=this,i=SSE.getController("DocumentHolder").getView("DocumentHolder");e.btnImgForward.updateHint(e.tipSendForward),e.btnImgForward.setMenu(new Common.UI.Menu({items:[{caption:i.textArrangeFront,iconCls:"mnu-arrange-front",value:Asc.c_oAscDrawingLayerType.BringToFront},{caption:i.textArrangeForward,iconCls:"mnu-arrange-forward",value:Asc.c_oAscDrawingLayerType.BringForward}]})),e.btnImgBackward.updateHint(e.tipSendBackward),e.btnImgBackward.setMenu(new Common.UI.Menu({items:[{caption:i.textArrangeBack,iconCls:"mnu-arrange-back",value:Asc.c_oAscDrawingLayerType.SendToBack},{caption:i.textArrangeBackward,iconCls:"mnu-arrange-backward",value:Asc.c_oAscDrawingLayerType.SendBackward}]})),e.btnImgAlign.updateHint(e.tipImgAlign),e.btnImgAlign.setMenu(new Common.UI.Menu({items:[{caption:i.textShapeAlignLeft,iconCls:"mnu-img-align-left",value:0},{caption:i.textShapeAlignCenter,iconCls:"mnu-img-align-center",value:4},{caption:i.textShapeAlignRight,iconCls:"mnu-img-align-right",value:1},{caption:i.textShapeAlignTop,iconCls:"mnu-img-align-top",value:3},{caption:i.textShapeAlignMiddle,iconCls:"mnu-img-align-middle",value:5},{caption:i.textShapeAlignBottom,iconCls:"mnu-img-align-bottom",value:2},{caption:"--"},{caption:i.txtDistribHor,iconCls:"mnu-distrib-hor",value:6},{caption:i.txtDistribVert,iconCls:"mnu-distrib-vert",value:7}]})),e.btnImgGroup.updateHint(e.tipImgGroup),e.btnImgGroup.setMenu(new Common.UI.Menu({items:[{caption:i.txtGroup,iconCls:"mnu-group",value:"grouping"},{caption:i.txtUngroup,iconCls:"mnu-ungroup",value:"ungrouping"}]}))}},textBold:"Bold",textItalic:"Italic",textUnderline:"Underline",textStrikeout:"Strikeout",textSuperscript:"Superscript",textSubscript:"Subscript",textSubSuperscript:"Subscript/Superscript",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 Image",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",tipInsertTextart:"Insert Text Art",tipInsertShape:"Insert Autoshape",tipDigStylePercent:"Percent Style",tipDigStyleAccounting:"Accounting Style",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:"Image from file",mniImageFromUrl:"Image from url",textNewColor:"Add New Custom Color",tipInsertChart:"Insert Chart",tipEditChart:"Edit Chart",textPrint:"Print",textPrintOptions:"Print Options",tipColorSchemas:"Change Color Scheme",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",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",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",textMoreFormats:"More formats",capInsertText:"Text",capInsertTextart:"Text Art",capInsertImage:"Image",capInsertShape:"Shape",capInsertChart:"Chart",capInsertHyperlink:"Hyperlink",capInsertEquation:"Equation",capBtnComment:"Comment",textTabFile:"File",textTabHome:"Home",textTabInsert:"Insert",textSurface:"Surface",tipChangeChart:"Change Chart Type",textTabCollaboration:"Collaboration",textTabProtect:"Protection",textTabLayout:"Layout",capBtnPageOrient:"Orientation",capBtnMargins:"Margins",capBtnPageSize:"Size",tipImgAlign:"Align objects",tipImgGroup:"Group objects",tipSendForward:"Bring forward",tipSendBackward:"Send backward",capImgAlign:"Align",capImgGroup:"Group",capImgForward:"Bring Forward",capImgBackward:"Send Backward",tipPageSize:"Page Size",tipPageOrient:"Page Orientation",tipPageMargins:"Page Margins",textMarginsLast:"Last Custom",textMarginsNormal:"Normal",textMarginsNarrow:"Narrow",textMarginsWide:"Wide",textPageMarginsCustom:"Custom margins",textTop:"Top: ",textLeft:"Left: ",textBottom:"Bottom: ",textRight:"Right: ",textPortrait:"Portrait",textLandscape:"Landscape",mniImageFromStorage:"Image from Storage",capBtnPrintArea:"Print Area",textSetPrintArea:"Set Print Area",textClearPrintArea:"Clear Print Area",textAddPrintArea:"Add to Print Area",tipPrintArea:"Print Area",capBtnInsHeader:"Header/Footer",tipEditHeader:"Edit header or footer",textTabData:"Data",capInsertTable:"Table",tipInsertTable:"Insert table",textTabFormula:"Formula"},SSE.Views.Toolbar||{}))}),define("spreadsheeteditor/main/app/model/TableTemplate",["backbone"],function(t){"use strict";SSE.Models=SSE.Models||{},SSE.Models.TableTemplate=t.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(t){"use strict";if(void 0===e)var e={};e.Collections=e.Collections||{},SSE.Collections.TableTemplates=t.Collection.extend({model:SSE.Models.TableTemplate})}),define("spreadsheeteditor/main/app/view/PivotTable",["common/main/lib/util/utils","common/main/lib/component/Button","common/main/lib/component/ComboDataView","common/main/lib/component/Layout"],function(t){"use strict";SSE.Views.PivotTable=Common.UI.BaseView.extend(_.extend(function(){function t(){var t=this;this.btnAddPivot.on("click",function(e){t.fireEvent("pivottable:create")}),this.btnPivotLayout.menu.on("item:click",function(e,i,n){t.fireEvent("pivottable:layout",[i.value])}),this.btnPivotBlankRows.menu.on("item:click",function(e,i,n){t.fireEvent("pivottable:blankrows",[i.value])}),this.btnPivotSubtotals.menu.on("item:click",function(e,i,n){t.fireEvent("pivottable:subtotals",[i.value])}),this.btnPivotGrandTotals.menu.on("item:click",function(e,i,n){t.fireEvent("pivottable:grandtotals",[i.value])}),this.btnRefreshPivot.on("click",function(e){t.fireEvent("pivottable:refresh")}),this.btnSelectPivot.on("click",function(e){t.fireEvent("pivottable:select")}),this.chRowHeader.on("change",function(e,i){t.fireEvent("pivottable:rowscolumns",[0,i])}),this.chColHeader.on("change",function(e,i){t.fireEvent("pivottable:rowscolumns",[1,i])}),this.chRowBanded.on("change",function(e,i){t.fireEvent("pivottable:rowscolumns",[2,i])}),this.chColBanded.on("change",function(e,i){t.fireEvent("pivottable:rowscolumns",[3,i])}),this.pivotStyles.on("click",function(e,i){t.fireEvent("pivottable:style",[i])}),this.pivotStyles.openButton.menu.on("show:after",function(){t.pivotStyles.menuPicker.scroller.update({alwaysVisibleY:!0})})}return{options:{},initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t),this.appConfig=t.mode,this.lockedControls=[],this.chRowHeader=new Common.UI.CheckBox({labelText:this.textRowHeader}),this.lockedControls.push(this.chRowHeader),this.chColHeader=new Common.UI.CheckBox({labelText:this.textColHeader}),this.lockedControls.push(this.chColHeader),this.chRowBanded=new Common.UI.CheckBox({labelText:this.textRowBanded}),this.lockedControls.push(this.chRowBanded),this.chColBanded=new Common.UI.CheckBox({labelText:this.textColBanded}),this.lockedControls.push(this.chColBanded),this.btnAddPivot=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"btn-add-pivot",caption:this.txtCreate,disabled:!0}),this.btnPivotLayout=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"btn-pivot-layout",caption:this.capLayout,disabled:!0,menu:new Common.UI.Menu({items:[{caption:this.mniLayoutCompact,value:0},{caption:this.mniLayoutOutline,value:1},{caption:this.mniLayoutTabular,value:2},{caption:"--"},{caption:this.mniLayoutRepeat,value:3},{caption:this.mniLayoutNoRepeat,value:4}]})}),this.btnPivotBlankRows=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"btn-blank-rows",caption:this.capBlankRows,disabled:!0,menu:new Common.UI.Menu({items:[{caption:this.mniInsertBlankLine,value:"insert"},{caption:this.mniRemoveBlankLine,value:"remove"}]})}),this.btnPivotSubtotals=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"btn-subtotals",caption:this.capSubtotals,disabled:!0,menu:new Common.UI.Menu({items:[{caption:this.mniNoSubtotals,value:0},{caption:this.mniBottomSubtotals,value:1},{caption:this.mniTopSubtotals,value:2}]})}),this.btnPivotGrandTotals=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"btn-grand-totals",caption:this.capGrandTotals,disabled:!0,menu:new Common.UI.Menu({items:[{caption:this.mniOffTotals,value:0},{caption:this.mniOnTotals,value:1},{caption:this.mniOnRowsTotals,value:2},{caption:this.mniOnColumnsTotals,value:3}]})}),this.btnRefreshPivot=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"btn-update-pivot",caption:this.txtRefresh,disabled:!0}),this.btnSelectPivot=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"btn-select-pivot",caption:this.txtSelect}),this.lockedControls.push(this.btnSelectPivot),this.pivotStyles=new Common.UI.ComboDataView({cls:"combo-pivot-template",enableKeyEvents:!0,itemWidth:61,itemHeight:49,menuMaxHeight:300}),this.lockedControls.push(this.pivotStyles),Common.NotificationCenter.on("app:ready",this.onAppReady.bind(this))},render:function(t){return this.boxSdk=$("#editor_sdk"),t&&t.html(this.getPanel()),this},onAppReady:function(e){var i=this;new Promise(function(t,e){t()}).then(function(){i.btnAddPivot.updateHint(i.tipCreatePivot),i.btnRefreshPivot.updateHint(i.tipRefresh),i.btnSelectPivot.updateHint(i.tipSelect),i.btnPivotLayout.updateHint(i.capLayout),i.btnPivotBlankRows.updateHint(i.capBlankRows),i.btnPivotSubtotals.updateHint(i.tipSubtotals),i.btnPivotGrandTotals.updateHint(i.tipGrandTotals),t.call(i)})},getPanel:function(){ +return this.$el=$(_.template('
    ')({})),this.chRowHeader.render(this.$el.find("#slot-chk-header-row")),this.chColHeader.render(this.$el.find("#slot-chk-header-column")),this.chRowBanded.render(this.$el.find("#slot-chk-banded-row")),this.chColBanded.render(this.$el.find("#slot-chk-banded-column")),this.btnAddPivot.render(this.$el.find("#slot-btn-add-pivot")),this.btnRefreshPivot.render(this.$el.find("#slot-btn-refresh-pivot")),this.btnSelectPivot.render(this.$el.find("#slot-btn-select-pivot")),this.btnPivotLayout.render(this.$el.find("#slot-btn-pivot-report-layout")),this.btnPivotBlankRows.render(this.$el.find("#slot-btn-pivot-blank-rows")),this.btnPivotSubtotals.render(this.$el.find("#slot-btn-pivot-subtotals")),this.btnPivotGrandTotals.render(this.$el.find("#slot-btn-pivot-grand-totals")),this.pivotStyles.render(this.$el.find("#slot-field-pivot-styles")),this.$el},show:function(){Common.UI.BaseView.prototype.show.call(this),this.fireEvent("show",this)},getButton:function(t,e){},SetDisabled:function(t){this.lockedControls&&this.lockedControls.forEach(function(e){e&&e.setDisabled(t)},this)},txtCreate:"Insert Table",tipCreatePivot:"Insert Pivot Table",textRowHeader:"Row Headers",textColHeader:"Column Headers",textRowBanded:"Banded Rows",textColBanded:"Banded Columns",capBlankRows:"Blank Rows",mniInsertBlankLine:"Insert Blank Line after Each Item",mniRemoveBlankLine:"Remove Blank Line after Each Item",capGrandTotals:"Grand Totals",mniOffTotals:"Off for Rows and Columns",mniOnTotals:"On for Rows and Columns",mniOnRowsTotals:"On for Rows Only",mniOnColumnsTotals:"On for Columns Only",capLayout:"Report Layout",capSubtotals:"Subtotals",mniLayoutCompact:"Show in Compact Form",mniLayoutOutline:"Show in Outline Form",mniLayoutTabular:"Show in Tabular Form",mniLayoutRepeat:"Repeat All Item Labels",mniLayoutNoRepeat:"Don't Repeat All Item Labels",mniNoSubtotals:"Don't Show Subtotals",mniBottomSubtotals:"Show all Subtotals at Bottom of Group",mniTopSubtotals:"Show all Subtotals at Top of Group",txtRefresh:"Refresh",tipRefresh:"Update the information from data source",tipGrandTotals:"Show or hide grand totals",tipSubtotals:"Show or hide subtotals",txtSelect:"Select",tipSelect:"Select entire pivot table"}}(),SSE.Views.PivotTable||{}))}),define("spreadsheeteditor/main/app/controller/PivotTable",["core","spreadsheeteditor/main/app/view/PivotTable"],function(){"use strict";SSE.Controllers.PivotTable=Backbone.Controller.extend(_.extend({models:[],views:["PivotTable"],sdkViewName:"#id_main",initialize:function(){this.addListeners({PivotTable:{"pivottable:rowscolumns":_.bind(this.onCheckTemplateChange,this),"pivottable:create":_.bind(this.onCreateClick,this),"pivottable:refresh":_.bind(this.onRefreshClick,this),"pivottable:select":_.bind(this.onSelectClick,this),"pivottable:style":_.bind(this.onPivotStyleSelect,this),"pivottable:layout":_.bind(this.onPivotLayout,this),"pivottable:blankrows":_.bind(this.onPivotBlankRows,this),"pivottable:subtotals":_.bind(this.onPivotSubtotals,this),"pivottable:grandtotals":_.bind(this.onPivotGrandTotals,this)}})},onLaunch:function(){this._state={TableName:"",TemplateName:"",RowHeader:void 0,RowBanded:void 0,ColHeader:void 0,ColBanded:void 0,DisabledControls:!1},this._originalProps=null,this.view=this.createView("PivotTable"),Common.NotificationCenter.on("app:ready",this.onAppReady.bind(this)),Common.NotificationCenter.on("api:disconnect",_.bind(this.SetDisabled,this))},setConfig:function(t,e){this.setApi(e),t&&(this.sdkViewName=t.sdkviewname||this.sdkViewName)},setApi:function(t){t&&(this.api=t,this.api.asc_registerCallback("asc_onCoAuthoringDisconnect",_.bind(this.SetDisabled,this)),this.api.asc_registerCallback("asc_onSendThemeColors",_.bind(this.onSendThemeColors,this)),this.api.asc_registerCallback("asc_onSelectionChanged",_.bind(this.onSelectionChanged,this)))},setMode:function(t){return this.appConfig=t,this},SetDisabled:function(){this.view&&this.view.SetDisabled(!0)},onCheckTemplateChange:function(t,e){switch(t){case 0:this._originalProps.asc_getStyleInfo().asc_setShowRowHeaders(this.api,this._originalProps,"checked"==e);break;case 1:this._originalProps.asc_getStyleInfo().asc_setShowColHeaders(this.api,this._originalProps,"checked"==e);break;case 2:this._originalProps.asc_getStyleInfo().asc_setShowRowStripes(this.api,this._originalProps,"checked"==e);break;case 3:this._originalProps.asc_getStyleInfo().asc_setShowColStripes(this.api,this._originalProps,"checked"==e)}Common.NotificationCenter.trigger("edit:complete",this)},onCreateClick:function(t,e){Common.NotificationCenter.trigger("edit:complete",this)},onRefreshClick:function(t,e){Common.NotificationCenter.trigger("edit:complete",this)},onSelectClick:function(t,e){this.api&&this._originalProps.asc_select(this.api),Common.NotificationCenter.trigger("edit:complete",this)},onPivotStyleSelect:function(t){this.api&&this._originalProps.asc_getStyleInfo().asc_setName(this.api,this._originalProps,t.get("name")),Common.NotificationCenter.trigger("edit:complete",this)},onPivotBlankRows:function(t){this.api,Common.NotificationCenter.trigger("edit:complete",this)},onPivotLayout:function(t){this.api,Common.NotificationCenter.trigger("edit:complete",this)},onPivotGrandTotals:function(t){if(this.api){var e=new Asc.CT_pivotTableDefinition;e.asc_setColGrandTotals(1==t||2==t),e.asc_setRowGrandTotals(1==t||3==t),this._originalProps.asc_set(this.api,e)}Common.NotificationCenter.trigger("edit:complete",this)},onPivotSubtotals:function(t){this.api,Common.NotificationCenter.trigger("edit:complete",this)},ChangeSettings:function(t){if(t){this._originalProps=t;var e=this.view,i=!1,n=t.asc_getStyleInfo(),o=n.asc_getShowRowHeaders();if(this._state.RowHeader!==o&&(e.chRowHeader.setValue(o,!0),this._state.RowHeader=o,i=!0),o=n.asc_getShowColHeaders(),this._state.ColHeader!==o&&(e.chColHeader.setValue(o,!0),this._state.ColHeader=o,i=!0),o=n.asc_getShowColStripes(),this._state.ColBanded!==o&&(e.chColBanded.setValue(o,!0),this._state.ColBanded=o,i=!0),o=n.asc_getShowRowStripes(),this._state.RowBanded!==o&&(e.chRowBanded.setValue(o,!0),this._state.RowBanded=o,i=!0),o=t.asc_getColGrandTotals(),this._state.ColGrandTotals!==o&&(this._state.ColGrandTotals=o,i=!0),o=t.asc_getRowGrandTotals(),this._state.RowGrandTotals!==o&&(this._state.RowGrandTotals=o,i=!0),i&&this.onApiInitPivotStyles(this.api.asc_getTablePictures(this._originalProps,!0)),o=n.asc_getName(),this._state.TemplateName!==o||this._isTemplatesChanged){e.pivotStyles.suspendEvents();var s=e.pivotStyles.menuPicker.store.findWhere({name:o});e.pivotStyles.menuPicker.selectRecord(s),e.pivotStyles.resumeEvents(),this._isTemplatesChanged&&(s?e.pivotStyles.fillComboView(e.pivotStyles.menuPicker.getSelectedRec(),!0):e.pivotStyles.fillComboView(e.pivotStyles.menuPicker.store.at(0),!0)),this._state.TemplateName=o}this._isTemplatesChanged=!1}},onSendThemeColors:function(){this.view.pivotStyles&&this._originalProps&&(this.onApiInitPivotStyles(this.api.asc_getTablePictures(this._originalProps,!0)),this.view.pivotStyles.menuPicker.scroller.update({alwaysVisibleY:!0}))},onApiInitPivotStyles:function(t){var e=this.view.pivotStyles;this._isTemplatesChanged=!0;var i=e.menuPicker.store.length;if(i>0&&i==t.length){var n=e.menuPicker.store.models;_.each(t,function(t,e){n[e].set("imageUrl",t.asc_getImage())})}else{e.menuPicker.store.reset([]);var o=[];_.each(t,function(t){o.push({id:Common.UI.getId(),name:t.asc_getName(),caption:t.asc_getDisplayName(),type:t.asc_getType(),imageUrl:t.asc_getImage(),allowSelected:!0,selected:!1,tip:t.asc_getDisplayName()})}),e.menuPicker.store.add(o)}},onSelectionChanged:function(t){if(!this.rangeSelectionMode&&this.appConfig.isEdit){var e=(t.asc_getFlags().asc_getSelectionType(),t.asc_getPivotTableInfo());this.view.SetDisabled(!e||t.asc_getLockedPivotTable()),e&&this.ChangeSettings(e)}},createToolbarPanel:function(){return this.view.getPanel()},getView:function(t){return!t&&this.view?this.view:Backbone.Controller.prototype.getView.call(this,t)},onAppReady:function(t){new Promise(function(t){t()}).then(function(){})}},SSE.Controllers.PivotTable||{}))}),void 0===Common)var Common={};if(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(t){_.extend(this.options,{title:this.txtFormat},t),this.template=['
    ','
    ','
    ',"
    ",'"].join(""),this.options.tpl=_.template(this.template)(this.options),this.checkRangeType=Asc.c_oAscSelectionDialogType.FormatTable,this.selectionType=Asc.c_oAscSelectionType.RangeCells,Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this);var t=this.getChild(),e=this;e.inputRange=new Common.UI.InputField({el:$("#id-dlg-tableoptions-range"),name:"range",style:"width: 100%;",allowBlank:!1,blankError:this.txtEmpty,validateOnChange:!0}),e.cbTitle=new Common.UI.CheckBox({el:$("#id-dlg-tableoptions-title"),labelText:this.txtTitle}),t.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this)),this.on("close",_.bind(this.onClose,this))},onPrimary:function(){return this._handleInput("ok"),!1},setSettings:function(t){var e=this;if(t.api){if(e.api=t.api,t.range)e.cbTitle.setVisible(!1),e.setHeight(130),e.checkRangeType=Asc.c_oAscSelectionDialogType.FormatTableChangeRange,e.inputRange.setValue(t.range),e.api.asc_setSelectionDialogMode(Asc.c_oAscSelectionDialogType.FormatTable,t.range);else{var i=e.api.asc_getAddFormatTableOptions();e.inputRange.setValue(i.asc_getRange()),e.cbTitle.setValue(i.asc_getIsTitle()),e.api.asc_setSelectionDialogMode(Asc.c_oAscSelectionDialogType.FormatTable,i.asc_getRange())}t.title&&e.setTitle(t.title),t.selectionType&&(e.selectionType=t.selectionType),e.api.asc_unregisterCallback("asc_onSelectionRangeChanged",_.bind(e.onApiRangeChanged,e)),e.api.asc_registerCallback("asc_onSelectionRangeChanged",_.bind(e.onApiRangeChanged,e)),Common.NotificationCenter.trigger("cells:range",Asc.c_oAscSelectionDialogType.FormatTable)}e.inputRange.validation=function(t){return e.api.asc_checkDataRange(e.checkRangeType,t,!1)!=Asc.c_oAscError.ID.DataRangeError||e.txtInvalidRange}},getSettings:function(){if(this.checkRangeType==Asc.c_oAscSelectionDialogType.FormatTable){var t=this.api.asc_getAddFormatTableOptions(this.inputRange.getValue());return t.asc_setIsTitle(this.cbTitle.checked),{selectionType:this.selectionType,range:t}}return{selectionType:this.selectionType,range:this.inputRange.getValue()}},onApiRangeChanged:function(t){this.inputRange.setValue(t.asc_getName()),this.inputRange.cmpEl.hasClass("error")&&this.inputRange.cmpEl.removeClass("error"),this.selectionType=t.asc_getType()},isRangeValid:function(){var t=this.api.asc_checkDataRange(this.checkRangeType,this.inputRange.getValue(),!0);if(t==Asc.c_oAscError.ID.No)return!0;switch(t){case Asc.c_oAscError.ID.AutoFilterDataRangeError:Common.UI.warning({msg:this.errorAutoFilterDataRange});break;case Asc.c_oAscError.ID.FTChangeTableRangeError:Common.UI.warning({msg:this.errorFTChangeTableRangeError});break;case Asc.c_oAscError.ID.FTRangeIncludedOtherTables:Common.UI.warning({msg:this.errorFTRangeIncludedOtherTables});break;case Asc.c_oAscError.ID.MultiCellsInTablesFormulaArray:Common.UI.warning({msg:this.errorMultiCellFormula})}return!1},onBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value)},onClose:function(t){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)},_handleInput:function(t){if(this.options.handler){if("ok"==t&&!0!==this.isRangeValid())return;this.options.handler.call(this,this,t)}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.
    Select a uniform data range inside or outside the table and try again.",errorFTChangeTableRangeError:"Operation could not be completed for the selected cell range.
    Select a range so that the first table row was on the same row
    and the resulting table overlapped the current one.",errorFTRangeIncludedOtherTables:"Operation could not be completed for the selected cell range.
    Select a range which does not include other tables.",errorMultiCellFormula:"Multi-cell array formulas are not allowed in 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(t){var e=this;_.extend(this.options,{title:this.txtTitleNew,template:['
    ','
    ','
    ','',"",'","","",'","","","","","",'",'","","
    ','",'
    ',"
    ','",'
    ',"
    ",'","
    ','
    ',"
    ','","
    ","
    ","
    ","
    ",'
    ','"].join("")},t),this.api=t.api,this.handler=t.handler,this.isEdit=t.isEdit||!1,this.sheets=t.sheets||[],this.props=t.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 t=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(e){var i=t.api.asc_checkDefinedName(e,-255==t.cmbScope.getValue()?null:t.cmbScope.getValue());if(!0===i.asc_getStatus())return!0;switch(i.asc_getReason()){case Asc.c_oAscDefinedNameReason.IsLocked:return t.textIsLocked;case Asc.c_oAscDefinedNameReason.Existed:return!(!t.isEdit||t.props.asc_getName(!0).toLowerCase()!=e.toLowerCase())||t.textExistName;case Asc.c_oAscDefinedNameReason.NameReserved:return!t.isEdit||t.textReservedName;default:return t.textInvalidName}}}),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(e){return!!_.isEmpty(e)||(!!(t.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.Chart,e,!1)!==Asc.c_oAscError.ID.DataRangeError||t.isEdit&&t.props.asc_getRef().toLowerCase()==e.toLowerCase())||t.textInvalidRange)}}),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 t=this;_.delay(function(){t.inputName.cmpEl.find("input").focus()},200)},_setDefaults:function(t){if(this.cmbScope.setData([{value:-255,displayValue:this.strWorkbook}].concat(this.sheets)),t){var e=t.asc_getScope();this.cmbScope.setValue(null===e?-255:e),e=t.asc_getName(!0),_.isEmpty(e)||this.inputName.setValue(e),e=t.asc_getRef(),this.txtDataRange.setValue(e||""),this.dataRangeValid=e,this.txtDataRange.setDisabled(this.isEdit&&t.asc_getIsTable()),this.btnSelectData.setDisabled(this.isEdit&&t.asc_getIsTable())}else this.cmbScope.setValue(-255);this.cmbScope.setDisabled(this.isEdit)},onSelectData:function(){var t=this;if(t.api){var e=function(e,i){"ok"==i&&(t.dataRangeValid=e.getSettings(),t.txtDataRange.setValue(t.dataRangeValid),t.txtDataRange.checkValidate())},i=new SSE.Views.CellRangeDialog({handler:e}).on("close",function(){t.show()}),n=t.$window.offset();t.hide(),i.show(n.left+65,n.top+77),i.setSettings({api:t.api,range:_.isEmpty(t.txtDataRange.getValue())||1!=t.txtDataRange.checkValidate()?t.dataRangeValid:t.txtDataRange.getValue(),type:Asc.c_oAscSelectionDialogType.Chart})}},getSettings:function(){return new Asc.asc_CDefName(this.inputName.getValue(),this.txtDataRange.getValue(),-255==this.cmbScope.getValue()?null:this.cmbScope.getValue(),this.props.asc_getIsTable(),void 0,void 0,void 0,!0)},onPrimary:function(){return this.onDlgBtnClick("ok"),!1},onDlgBtnClick:function(t){var e=this,i="object"==typeof t?t.currentTarget.attributes.result.value:t;if("ok"==i){if(this.locked)return void Common.UI.alert({msg:this.errorCreateDefName,title:this.notcriticalErrorTitle,iconCls:"warn",buttons:["ok"],callback:function(t){e.close()}});var n=this.inputName.checkValidate(),o=this.txtDataRange.checkValidate();if(!0!==n)return void this.inputName.cmpEl.find("input").focus();if(!0!==o)return void this.txtDataRange.cmpEl.find("input").focus();this.handler&&this.handler.call(this,i,"ok"==i?this.getSettings():void 0)}this.close()},onLockDefNameManager:function(t){this.locked=t==Asc.c_oAscDefinedNameReason.LockDefNameManager},onRefreshDefNameList:function(t){var e=this;this.isEdit&&Common.Utils.InternalSettings.get("sse-settings-coauthmode")&&t&&t.asc_getIsLock()&&t.asc_getName(!0).toLowerCase()==this.props.asc_getName(!0).toLowerCase()&&(null===t.asc_getScope()&&null===this.props.asc_getScope()||t.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(t){e.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
    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(t){var e=this;_.extend(this.options,{title:this.txtTitle,template:['
    ','
    ','
    ','',"",'","","
    ','",'
    ',"
    ","
    ","
    ","
    ",'
    ','"].join("")},t),this.handler=t.handler,this.ranges=t.ranges||[],Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this,this.options)},render:function(){Common.Views.AdvancedSettingsWindow.prototype.render.call(this);this.rangeList=new Common.UI.ListView({el:$("#named-range-paste-list",this.$window),store:new Common.UI.DataViewStore,simpleAddMode:!0,template:_.template(['
    '].join("")),itemTemplate:_.template(['
    ','
    ','
    ','
    <%= name %>
    ',"
    ","
    "].join(""))}),this.rangeList.store.comparator=function(t,e){var i=t.get("name").toLowerCase(),n=e.get("name").toLowerCase();return i==n?0:i0&&this.rangeList.selectByIndex(0),this.rangeList.scroller.update({alwaysVisibleY:!0}),_.delay(function(){t.rangeList.cmpEl.find(".listview").focus()},100,this)}},getSettings:function(){var t=this.rangeList.getSelectedRec();return t?new Asc.asc_CDefName(t.get("name"),t.get("range"),t.get("scope"),t.get("isTable"),void 0,void 0,void 0,!0):null},onPrimary:function(){return this.handler&&this.handler.call(this,"ok",this.getSettings()),this.close(),!1},onDlgBtnClick:function(t){var e=t.currentTarget.attributes.result.value;this.handler&&this.handler.call(this,e,"ok"==e?this.getSettings():void 0),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(t){var e=this;e.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}],e.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"}],e.CurrencySymbolsData=null,e.langId=1033,_.extend(this.options,{title:this.textTitle,template:['
    ','
    ','
    ','',"",'","","",'","","",'","",'','","",'','","",'','","",'','","",'','","",'','","","
    ','",'
    ',"
    ','",'',"
    ',"
    ','",'
    ',"
    ','
    ',"
    ','",'
    ',"
    ','",'
    ',"
    ','",'
    ',"
    ','",'
    ',"
    ","
    ","
    ","
    ",'
    ','"].join("")},t),this.api=t.api,this.handler=t.handler,this.props=t.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);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(t){if(t&&t.formatInfo&&(this.langId&&(this.langId=t.langId),this.cmbFormat.setValue(t.formatInfo.asc_getType(),this.txtCustom),t.formatInfo.asc_getType()==Asc.c_oAscNumFormatType.Custom&&t.format&&(this.CustomFormat=this.Format=t.format),this.onFormatSelect(this.cmbFormat,this.cmbFormat.getSelectedRecord(),null,t.formatInfo),this._state.hasDecimal&&this.spnDecimal.setValue(t.formatInfo.asc_getDecimalPlaces()),this._state.hasSeparator&&this.chSeparator.setValue(t.formatInfo.asc_getSeparator()),this._state.hasSymbols&&this.cmbSymbols.setValue(t.formatInfo.asc_getSymbol()),t.format)){if(this._state.hasNegative){var e=this.cmbNegative.store.findWhere({value:t.format});e?this.cmbNegative.selectRecord(e):this.cmbNegative.setValue(this.api.asc_getLocaleExample(t.format))}else if(this._state.hasType){var e=this.cmbType.store.findWhere({value:t.format});e?this.cmbType.selectRecord(e):t.formatInfo.asc_getType()==Asc.c_oAscNumFormatType.Fraction?this.cmbType.setValue(this.txtCustom):t.formatInfo.asc_getType()==Asc.c_oAscNumFormatType.Time?this.cmbType.setValue(this.api.asc_getLocaleExample(t.format,1.534)):this.cmbType.setValue(this.api.asc_getLocaleExample(t.format,38822))}this.Format=t.format,this.lblExample.text(this.api.asc_getLocaleExample(this.Format))}},getSettings:function(){return{format:this.Format}},onDlgBtnClick:function(t){var e="object"==typeof t?t.currentTarget.attributes.result.value:t;"ok"==e&&this.handler&&this.handler.call(this,e,"ok"==e?this.getSettings():void 0),this.close()},onPrimary:function(){return this.onDlgBtnClick("ok"),!1},onNegativeSelect:function(t,e){this.Format=e.value,this.lblExample.text(this.api.asc_getLocaleExample(this.Format))},onSymbolsSelect:function(t,e){var i=this,n=new Asc.asc_CFormatCellsInfo;n.asc_setType(this.FormatType),n.asc_setDecimalPlaces(this.spnDecimal.getNumberValue()),n.asc_setSeparator(!1),n.asc_setSymbol(e.value);var o=this.api.asc_getFormatCells(n),s=[];o.forEach(function(t){s.push({value:t,displayValue:i.api.asc_getLocaleExample(t,-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=o[0],this.lblExample.text(this.api.asc_getLocaleExample(this.Format))},onDecimalChange:function(t,e,i,n){var o=this,s=new Asc.asc_CFormatCellsInfo;s.asc_setType(this.FormatType),s.asc_setDecimalPlaces(t.getNumberValue()),s.asc_setSeparator(this.FormatType==Asc.c_oAscNumFormatType.Number&&"checked"==this.chSeparator.getValue()),s.asc_setSymbol((this.FormatType==Asc.c_oAscNumFormatType.Currency||this.FormatType==Asc.c_oAscNumFormatType.Accounting)&&this.cmbSymbols.getValue());var a=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 l=[];a.forEach(function(t){l.push({value:t,displayValue:o.api.asc_getLocaleExample(t,-1234.1234567890124)})}),this.cmbNegative.setData(l),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=a[0]}else this.Format=a[0];this.lblExample.text(this.api.asc_getLocaleExample(this.Format))},onSeparatorChange:function(t,e,i,n){var o=this,s=new Asc.asc_CFormatCellsInfo;s.asc_setType(this.FormatType),s.asc_setDecimalPlaces(this.spnDecimal.getNumberValue()),s.asc_setSeparator("checked"==t.getValue());var a=this.api.asc_getFormatCells(s),l=[];a.forEach(function(t){l.push({value:t,displayValue:o.api.asc_getLocaleExample(t,-1234.1234567890124)})}),this.cmbNegative.setData(l),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=a[0],this.lblExample.text(this.api.asc_getLocaleExample(this.Format))},onTypeSelect:function(t,e){this.Format=e.value,this.lblExample.text(this.api.asc_getLocaleExample(this.Format))},onCodeSelect:function(t,e){this.Format=e.value,this.lblExample.text(this.api.asc_getLocaleExample(this.Format))},onFormatSelect:function(t,e,i,n){if(e){this.FormatType=e.value;var o=e.value==Asc.c_oAscNumFormatType.Number||e.value==Asc.c_oAscNumFormatType.Scientific||e.value==Asc.c_oAscNumFormatType.Accounting||e.value==Asc.c_oAscNumFormatType.Currency||e.value==Asc.c_oAscNumFormatType.Percent,s=e.value==Asc.c_oAscNumFormatType.Number||e.value==Asc.c_oAscNumFormatType.Currency||e.value==Asc.c_oAscNumFormatType.Accounting,a=e.value==Asc.c_oAscNumFormatType.Number,l=e.value==Asc.c_oAscNumFormatType.Date||e.value==Asc.c_oAscNumFormatType.Time||e.value==Asc.c_oAscNumFormatType.Fraction,r=e.value==Asc.c_oAscNumFormatType.Accounting||e.value==Asc.c_oAscNumFormatType.Currency,c=e.value==Asc.c_oAscNumFormatType.Custom,h=this,d=n?n.asc_getDecimalPlaces():this.spnDecimal.getNumberValue(),p=n?n.asc_getSeparator():"checked"==this.chSeparator.getValue(),m=n?n.asc_getSymbol():this.langId;if(e.value!==Asc.c_oAscNumFormatType.Custom){var u=new Asc.asc_CFormatCellsInfo;if(u.asc_setType(e.value),u.asc_setDecimalPlaces(o?d:0),u.asc_setSeparator(!!a&&p),s||e.value==Asc.c_oAscNumFormatType.Date||e.value==Asc.c_oAscNumFormatType.Time){if(r){if(!h.CurrencySymbolsData){h.CurrencySymbolsData=[{value:null,displayValue:h.txtNone}];var g=this.api.asc_getCurrencySymbols();for(var b in g)g.hasOwnProperty(b)&&h.CurrencySymbolsData.push({value:parseInt(b),displayValue:g[b]+" "+Common.util.LanguageInfo.getLocalLanguageName(b)[1]});this.cmbSymbols.setData(this.CurrencySymbolsData),this.cmbSymbols.setValue(m)}u.asc_setSymbol(this.cmbSymbols.getValue())}var f=this.api.asc_getFormatCells(u),C=[],v=e.value==Asc.c_oAscNumFormatType.Date?38822:e.value==Asc.c_oAscNumFormatType.Time?1.534:parseFloat("-1234.12345678901234567890");f.forEach(function(t){C.push({value:t,displayValue:h.api.asc_getLocaleExample(t,v)})}),s?(this.cmbNegative.setData(C),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(C),this.cmbType.selectRecord(this.cmbType.store.at(0))),this.Format=f[0]}else e.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(u)[0]}else{var u=new Asc.asc_CFormatCellsInfo;u.asc_setType(Asc.c_oAscNumFormatType.Custom),u.asc_setSymbol(m);var f=this.api.asc_getFormatCells(u),C=[],_=!!this.CustomFormat;f.forEach(function(t){C.push({value:t,displayValue:t}),h.CustomFormat==t&&(_=!1)}),_&&C.push({value:this.CustomFormat,displayValue:this.CustomFormat}),this.cmbCode.setData(C),this.cmbCode.setValue(this.Format)}this.lblExample.text(this.api.asc_getLocaleExample(this.Format)),this._decimalPanel.toggleClass("hidden",!o),this._negativePanel.css("visibility",s?"":"hidden"),this._separatorPanel.toggleClass("hidden",!a),this._typePanel.toggleClass("hidden",!l),this._symbolsPanel.toggleClass("hidden",!r),this._codePanel.toggleClass("hidden",!c),this._state={hasDecimal:o,hasNegative:s,hasSeparator:a,hasType:l,hasSymbols:r,hasCode:c}}},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:",txtNone:"None"},SSE.Views.FormatSettingsDialog||{}))}),define("spreadsheeteditor/main/app/view/PageMarginsDialog",["common/main/lib/component/Window","common/main/lib/component/MetricSpinner"],function(){"use strict";SSE.Views.PageMarginsDialog=Common.UI.Window.extend(_.extend({options:{width:215,header:!0,style:"min-width: 216px;",cls:"modal-dlg",id:"window-page-margins"},initialize:function(t){_.extend(this.options,{title:this.textTitle},t||{}),this.template=['
    ','',"",'",'","","",'",'","","
    ','",'
    ',"
    ','",'
    ',"
    ','",'
    ',"
    ','",'
    ',"
    ","
    ",'
    ','"].join(""),this.options.tpl=_.template(this.template)(this.options),this.spinners=[],this._noApply=!1,this.maxMarginsW=this.maxMarginsH=0,Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this),this.spnTop=new Common.UI.MetricSpinner({el:$("#page-margins-spin-top"),step:.1,width:86,defaultUnit:"cm",value:"0",maxValue:48.25,minValue:0}),this.spinners.push(this.spnTop),this.spnBottom=new Common.UI.MetricSpinner({el:$("#page-margins-spin-bottom"),step:.1,width:86,defaultUnit:"cm",value:"0",maxValue:48.25,minValue:0}),this.spinners.push(this.spnBottom),this.spnLeft=new Common.UI.MetricSpinner({el:$("#page-margins-spin-left"),step:.1,width:86,defaultUnit:"cm",value:"0.19 cm",maxValue:48.25,minValue:0}),this.spinners.push(this.spnLeft),this.spnRight=new Common.UI.MetricSpinner({el:$("#page-margins-spin-right"),step:.1,width:86,defaultUnit:"cm",value:"0.19 cm",maxValue:48.25,minValue:0}),this.spinners.push(this.spnRight);var t=this.getChild();t.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this)),t.find("input").on("keypress",_.bind(this.onKeyPress,this)),this.updateMetricUnit()},_handleInput:function(t){this.options.handler&&this.options.handler.call(this,this,t),this.close()},onBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value)},onKeyPress:function(t){t.keyCode==Common.UI.Keys.RETURN&&this._handleInput("ok")},setSettings:function(t){if(t){var e=t.asc_getPageMargins();this.spnTop.setValue(Common.Utils.Metric.fnRecalcFromMM(e.asc_getTop()),!0),this.spnBottom.setValue(Common.Utils.Metric.fnRecalcFromMM(e.asc_getBottom()),!0),this.spnLeft.setValue(Common.Utils.Metric.fnRecalcFromMM(e.asc_getLeft()),!0),this.spnRight.setValue(Common.Utils.Metric.fnRecalcFromMM(e.asc_getRight()),!0)}},getSettings:function(){var t=new Asc.asc_CPageMargins;return t.asc_setTop(Common.Utils.Metric.fnRecalcToMM(this.spnTop.getNumberValue())),t.asc_setBottom(Common.Utils.Metric.fnRecalcToMM(this.spnBottom.getNumberValue())),t.asc_setLeft(Common.Utils.Metric.fnRecalcToMM(this.spnLeft.getNumberValue())),t.asc_setRight(Common.Utils.Metric.fnRecalcToMM(this.spnRight.getNumberValue())),t},updateMetricUnit:function(){if(this.spinners)for(var t=0;t','',"",'",'","","","","","","
    ','
    ',"
    ','
    ',"
    ",'
    ',"
    ",'
    ',"
    ",'
    ','",'",'",'","
    ",'",'
    ','
    ','
    ','
    ','
    ','
    ','
    ','
    ','
    ','
    ','
    ','
    ','
    ','
    ','
    ',"
    ","
    ",'
    ','
    ','
    ',"
    ","
    ",'
    ','
    ','
    ',"
    ","
    ","
    ",'",'
    ','
    ','
    ','
    ','
    ','
    ','
    ','
    ','
    ','
    ','
    ','
    ','
    ','
    ','',"
    ","
    ",'
    ','
    ','',"
    ","
    ",'
    ','
    ','',"
    ","
    ","
    ","
    ",'"].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 t=this,e=this.getChild();this.chFirstPage=new Common.UI.CheckBox({el:$("#id-dlg-hf-ch-first"),labelText:this.textDiffFirst}),this.chFirstPage.on("change",_.bind(function(t,e,i,n){var o="checked"==t.getValue(),s=this.HFObject?this.HFObject.setDifferentFirst(o):null;if(s){var a=this;return void this.showError(function(){t.setValue(!o,!0),_.delay(function(){a.onCanvasClick(s)},50)})}this.btnFirst.setVisible(o),!o&&this.btnFirst.isActive()&&(this.btnAll.isVisible()?this.btnAll.toggle(!0):this.btnOdd.toggle(!0))},this)),this.chOddPage=new Common.UI.CheckBox({el:$("#id-dlg-hf-ch-odd"),labelText:this.textDiffOdd}),this.chOddPage.on("change",_.bind(function(t,e,i,n){var o="checked"==t.getValue(),s=this.HFObject?this.HFObject.setDifferentOddEven(o):null;if(s){var a=this;return void this.showError(function(){t.setValue(!o,!0),_.delay(function(){a.onCanvasClick(s)},50)})}this.btnOdd.setVisible(o),this.btnEven.setVisible(o),this.btnAll.setVisible(!o),o||!this.btnOdd.isActive()&&!this.btnEven.isActive()||this.btnAll.toggle(!0),o&&this.btnAll.isActive()&&this.btnOdd.toggle(!0)},this)),this.chScale=new Common.UI.CheckBox({el:$("#id-dlg-hf-ch-scale"),labelText:this.textScale}),this.chScale.on("change",_.bind(function(t,e,i,n){var o="checked"==t.getValue();this.HFObject&&this.HFObject.setScaleWithDoc(o)},this)),this.chAlign=new Common.UI.CheckBox({el:$("#id-dlg-hf-ch-align"),labelText:this.textAlign}),this.chAlign.on("change",_.bind(function(t,e,i,n){var o="checked"==t.getValue();this.HFObject&&this.HFObject.setAlignWithMargins(o)},this)),this.btnAll=new Common.UI.Button({el:$("#id-dlg-hf-btn-all"),enableToggle:!0,toggleGroup:"hf-pages",allowDepress:!1,pressed:!0}),this.btnAll.on("toggle",_.bind(this.onPageTypeToggle,this,Asc.c_oAscHeaderFooterType.odd)),this.btnOdd=new Common.UI.Button({el:$("#id-dlg-hf-btn-odd"),enableToggle:!0,toggleGroup:"hf-pages",allowDepress:!1}),this.btnOdd.on("toggle",_.bind(this.onPageTypeToggle,this,Asc.c_oAscHeaderFooterType.odd)),this.btnEven=new Common.UI.Button({el:$("#id-dlg-hf-btn-even"),enableToggle:!0,toggleGroup:"hf-pages",allowDepress:!1}),this.btnEven.on("toggle",_.bind(this.onPageTypeToggle,this,Asc.c_oAscHeaderFooterType.even)),this.btnFirst=new Common.UI.Button({el:$("#id-dlg-hf-btn-first"),enableToggle:!0,toggleGroup:"hf-pages",allowDepress:!1}),this.btnFirst.on("toggle",_.bind(this.onPageTypeToggle,this,Asc.c_oAscHeaderFooterType.first)),this.cmbPresetsH=new Common.UI.ComboBox({el:$("#id-dlg-h-presets"),cls:"input-group-nr",style:"width: 110px;",menuStyle:"min-width: 100%; max-height: 200px;",editable:!1,scrollAlwaysVisible:!0,data:[]}),this.cmbPresetsH.on("selected",_.bind(this.onPresetSelect,this,!1)),this.cmbPresetsH.setValue(this.textPresets),this.cmbPresetsF=new Common.UI.ComboBox({el:$("#id-dlg-f-presets"),cls:"input-group-nr",style:"width: 110px;",menuStyle:"min-width: 100%; max-height: 200px;",editable:!1,scrollAlwaysVisible:!0,data:[]}),this.cmbPresetsF.on("selected",_.bind(this.onPresetSelect,this,!0)),this.cmbPresetsF.setValue(this.textPresets);var i=[{displayValue:this.textPageNum,value:Asc.c_oAscHeaderFooterField.pageNumber},{displayValue:this.textPageCount,value:Asc.c_oAscHeaderFooterField.pageCount},{displayValue:this.textDate,value:Asc.c_oAscHeaderFooterField.date},{displayValue:this.textTime,value:Asc.c_oAscHeaderFooterField.time},{displayValue:this.textFileName,value:Asc.c_oAscHeaderFooterField.fileName},{displayValue:this.textSheet,value:Asc.c_oAscHeaderFooterField.sheetName}];this.cmbInsertH=new Common.UI.ComboBox({el:$("#id-dlg-h-insert"),cls:"input-group-nr",style:"width: 110px;",menuStyle:"min-width: 100%; max-heigh: 100px;",editable:!1,data:i}),this.cmbInsertH.on("selected",_.bind(this.onObjectSelect,this)),this.cmbInsertH.setValue(this.textInsert),this.headerControls.push(this.cmbInsertH),this.cmbInsertF=new Common.UI.ComboBox({el:$("#id-dlg-f-insert"),cls:"input-group-nr",style:"width: 110px;",menuStyle:"min-width: 100%; max-heigh: 100px;",editable:!1,data:i}),this.cmbInsertF.on("selected",_.bind(this.onObjectSelect,this)),this.cmbInsertF.setValue(this.textInsert),this.footerControls.push(this.cmbInsertF),this.cmbFonts=[],this.cmbFonts.push(new Common.UI.ComboBoxFonts({el:$("#id-dlg-h-fonts"),cls:"input-group-nr",style:"width: 142px;",menuCls:"scrollable-menu",menuStyle:"min-width: 100%;max-height: 270px;",store:new Common.Collections.Fonts,recent:0,hint:this.tipFontName})),this.cmbFonts[0].on("selected",_.bind(this.onFontSelect,this)),this.headerControls.push(this.cmbFonts[0]),this.cmbFonts.push(new Common.UI.ComboBoxFonts({el:$("#id-dlg-f-fonts"),cls:"input-group-nr",style:"width: 142px;",menuCls:"scrollable-menu",menuStyle:"min-width: 100%;max-height: 270px;",store:new Common.Collections.Fonts,recent:0,hint:this.tipFontName})),this.cmbFonts[1].on("selected",_.bind(this.onFontSelect,this)),this.footerControls.push(this.cmbFonts[1]),Common.NotificationCenter.on("fonts:change",_.bind(this.onApiChangeFont,this)),i=[{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"}],this.cmbFontSize=[],this.cmbFontSize.push(new Common.UI.ComboBox({el:$("#id-dlg-h-font-size"),cls:"input-group-nr",style:"width: 55px;",menuCls:"scrollable-menu",menuStyle:"min-width: 55px;max-height: 270px;",hint:this.tipFontSize,data:i})),this.cmbFontSize[0].on("selected",_.bind(this.onFontSizeSelect,this)),this.cmbFontSize[0].on("changed:before",_.bind(this.onFontSizeChanged,this,!0)),this.cmbFontSize[0].on("changed:after",_.bind(this.onFontSizeChanged,this,!1)),this.cmbFontSize[0].setValue(this._state.fontsize),this.headerControls.push(this.cmbFontSize[0]),this.cmbFontSize.push(new Common.UI.ComboBox({el:$("#id-dlg-f-font-size"),cls:"input-group-nr",style:"width: 55px;",menuCls:"scrollable-menu",menuStyle:"min-width: 55px;max-height: 270px;",hint:this.tipFontSize,data:i})),this.cmbFontSize[1].on("selected",_.bind(this.onFontSizeSelect,this)),this.cmbFontSize[1].on("changed:before",_.bind(this.onFontSizeChanged,this,!0)),this.cmbFontSize[1].on("changed:after",_.bind(this.onFontSizeChanged,this,!1)),this.cmbFontSize[1].setValue(this._state.fontsize),this.footerControls.push(this.cmbFontSize[1]),this.btnBold=[],this.btnBold.push(new Common.UI.Button({cls:"btn-toolbar",iconCls:"btn-bold",enableToggle:!0,hint:this.textBold})),this.btnBold[0].render($("#id-dlg-h-bold")),this.btnBold[0].on("click",_.bind(this.onBoldClick,this)),this.headerControls.push(this.btnBold[0]),this.btnBold.push(new Common.UI.Button({cls:"btn-toolbar",iconCls:"btn-bold",enableToggle:!0,hint:this.textBold})),this.btnBold[1].render($("#id-dlg-f-bold")),this.btnBold[1].on("click",_.bind(this.onBoldClick,this)),this.footerControls.push(this.btnBold[1]),this.btnItalic=[],this.btnItalic.push(new Common.UI.Button({cls:"btn-toolbar",iconCls:"btn-italic",enableToggle:!0,hint:this.textItalic})),this.btnItalic[0].render($("#id-dlg-h-italic")),this.btnItalic[0].on("click",_.bind(this.onItalicClick,this)),this.headerControls.push(this.btnItalic[0]),this.btnItalic.push(new Common.UI.Button({cls:"btn-toolbar",iconCls:"btn-italic",enableToggle:!0,hint:this.textItalic})),this.btnItalic[1].render($("#id-dlg-f-italic")),this.btnItalic[1].on("click",_.bind(this.onItalicClick,this)),this.footerControls.push(this.btnItalic[1]),this.btnUnderline=[],this.btnUnderline.push(new Common.UI.Button({cls:"btn-toolbar",iconCls:"btn-underline",enableToggle:!0,hint:this.textUnderline})),this.btnUnderline[0].render($("#id-dlg-h-underline")),this.btnUnderline[0].on("click",_.bind(this.onUnderlineClick,this)),this.headerControls.push(this.btnUnderline[0]),this.btnUnderline.push(new Common.UI.Button({cls:"btn-toolbar",iconCls:"btn-underline",enableToggle:!0,hint:this.textUnderline})),this.btnUnderline[1].render($("#id-dlg-f-underline")),this.btnUnderline[1].on("click",_.bind(this.onUnderlineClick,this)),this.footerControls.push(this.btnUnderline[1]),this.btnStrikeout=[],this.btnStrikeout.push(new Common.UI.Button({cls:"btn-toolbar",iconCls:"btn-strikeout",enableToggle:!0,hint:this.textStrikeout})),this.btnStrikeout[0].render($("#id-dlg-h-strikeout")),this.btnStrikeout[0].on("click",_.bind(this.onStrikeoutClick,this)),this.headerControls.push(this.btnStrikeout[0]),this.btnStrikeout.push(new Common.UI.Button({cls:"btn-toolbar",iconCls:"btn-strikeout",enableToggle:!0,hint:this.textStrikeout})),this.btnStrikeout[1].render($("#id-dlg-f-strikeout")),this.btnStrikeout[1].on("click",_.bind(this.onStrikeoutClick,this)),this.footerControls.push(this.btnStrikeout[1]),this.btnSuperscript=[],this.btnSuperscript.push(new Common.UI.Button({cls:"btn-toolbar",iconCls:"btn-superscript",enableToggle:!0,toggleGroup:"superscriptHFGroup",hint:this.textSuperscript})),this.btnSuperscript[0].render($("#id-dlg-h-superscript")),this.btnSuperscript[0].on("click",_.bind(this.onSuperscriptClick,this)),this.headerControls.push(this.btnSuperscript[0]),this.btnSuperscript.push(new Common.UI.Button({cls:"btn-toolbar",iconCls:"btn-superscript",enableToggle:!0,toggleGroup:"superscriptHFGroup",hint:this.textSuperscript})),this.btnSuperscript[1].render($("#id-dlg-f-superscript")),this.btnSuperscript[1].on("click",_.bind(this.onSuperscriptClick,this)),this.footerControls.push(this.btnSuperscript[1]),this.btnSubscript=[],this.btnSubscript.push(new Common.UI.Button({cls:"btn-toolbar",iconCls:"btn-subscript",enableToggle:!0,toggleGroup:"superscriptHFGroup",hint:this.textSubscript})),this.btnSubscript[0].render($("#id-dlg-h-subscript")),this.btnSubscript[0].on("click",_.bind(this.onSubscriptClick,this)),this.headerControls.push(this.btnSubscript[0]),this.btnSubscript.push(new Common.UI.Button({cls:"btn-toolbar",iconCls:"btn-subscript",enableToggle:!0,toggleGroup:"superscriptHFGroup",hint:this.textSubscript})),this.btnSubscript[1].render($("#id-dlg-f-subscript")),this.btnSubscript[1].on("click",_.bind(this.onSubscriptClick,this)),this.footerControls.push(this.btnSubscript[1]);var n=function(e,i){if(e&&e.cmpEl){e.currentColor="#000000";var n=$('
    ');$("button:first-child",e.cmpEl).append(n),n.css("background-color",e.currentColor);var o=new Common.UI.ThemeColorPalette({el:$(i)});o.currentColor=e.currentColor}return e.menu.cmpEl.on("click",i+"-new",_.bind(function(){o.addNewColor("object"==typeof e.color?e.color.color:e.color)},t)),o.on("select",_.bind(t.onColorSelect,t,e)),o};this.btnTextColor=[],this.btnTextColor.push(new Common.UI.Button({cls:"btn-toolbar",iconCls:"btn-fontcolor",hint:this.textColor,split:!0,menu:new Common.UI.Menu({items:[{template:_.template('
    ')},{template:_.template(''+this.textNewColor+"")}]})})),this.btnTextColor[0].render($("#id-dlg-h-textcolor")),this.btnTextColor[0].on("click",_.bind(this.onTextColor,this)),this.mnuTextColorPicker=[],this.mnuTextColorPicker.push(n(this.btnTextColor[0],"#id-dlg-h-menu-fontcolor")),this.headerControls.push(this.btnTextColor[0]),this.btnTextColor.push(new Common.UI.Button({cls:"btn-toolbar",iconCls:"btn-fontcolor",hint:this.textColor,split:!0,menu:new Common.UI.Menu({items:[{template:_.template('
    ')},{template:_.template(''+this.textNewColor+"")}]})})),this.btnTextColor[1].render($("#id-dlg-f-textcolor")),this.btnTextColor[1].on("click",_.bind(this.onTextColor,this)),this.mnuTextColorPicker.push(n(this.btnTextColor[1],"#id-dlg-f-menu-fontcolor")),this.footerControls.push(this.btnTextColor[1]),this.btnOk=new Common.UI.Button({el:e.find(".primary")}),e.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this)),this.scrollers=[],this.initCanvas("#header-left-img"),this.initCanvas("#header-center-img"),this.initCanvas("#header-right-img"),this.initCanvas("#footer-left-img"),this.initCanvas("#footer-center-img"),this.initCanvas("#footer-right-img"),this.wrapEvents={onApiEditorSelectionChanged:_.bind(this.onApiEditorSelectionChanged,this),onApiResizeEditorHeight:_.bind(this.onApiResizeEditorHeight,this),onUpdateEditorCursorPosition:_.bind(this.onUpdateEditorCursorPosition,this)},this.afterRender()},initCanvas:function(t){var e=this.$window.find(t);e.on("click",_.bind(this.onCanvasClick,this,t)),this.canvasBoxHeight=e.height(),this.scrollers[t]=new Common.UI.Scroller({el:e.parent(),minScrollbarLength:20}),this.scrollers[t].update(),this.scrollers[t].scrollTop(0)},show:function(){Common.UI.Window.prototype.show.apply(this,arguments)},close:function(){this.api.asc_unregisterCallback("asc_onEditorSelectionChanged",this.wrapEvents.onApiEditorSelectionChanged),this.api.asc_unregisterCallback("asc_resizeEditorHeight",this.wrapEvents.onApiResizeEditorHeight),this.api.asc_unregisterCallback("asc_updateEditorCursorPosition",this.wrapEvents.onUpdateEditorCursorPosition),Common.UI.Window.prototype.close.apply(this,arguments),this.HFObject&&this.HFObject.destroy()},afterRender:function(){this.api.asc_registerCallback("asc_onEditorSelectionChanged",this.wrapEvents.onApiEditorSelectionChanged), +this.api.asc_registerCallback("asc_resizeEditorHeight",this.wrapEvents.onApiResizeEditorHeight),this.api.asc_registerCallback("asc_updateEditorCursorPosition",this.wrapEvents.onUpdateEditorCursorPosition),this.cmbFonts[0].fillFonts(this.fontStore),this.cmbFonts[0].selectRecord(this.fontStore.findWhere({name:this._state.fontname})||this.fontStore.at(0)),this.cmbFonts[1].fillFonts(this.fontStore),this.cmbFonts[1].selectRecord(this.fontStore.findWhere({name:this._state.fontname})||this.fontStore.at(0)),this.updateThemeColors(),this.HFObject=new AscCommonExcel.CHeaderFooterEditor(["header-left-img","header-center-img","header-right-img","footer-left-img","footer-center-img","footer-right-img"],205),this._setDefaults(this.props),this.editorCanvas=this.$window.find("#ce-canvas-menu");var t=this;_.delay(function(){t.onCanvasClick("#header-left-img")},500)},_setDefaults:function(t){var e=[];this.HFObject.getTextPresetsArr().forEach(function(t,i){e.push({displayValue:t,value:i})}),this.cmbPresetsH.setData(e),this.cmbPresetsH.setValue(this.textPresets),this.cmbPresetsF.setData(e),this.cmbPresetsF.setValue(this.textPresets),this.chOddPage.setValue(this.HFObject.getDifferentOddEven()),this.chFirstPage.setValue(this.HFObject.getDifferentFirst()),this.chAlign.setValue(this.HFObject.getAlignWithMargins()),this.chScale.setValue(this.HFObject.getScaleWithDoc());var i="checked"==this.chOddPage.getValue();this.btnOdd.setVisible(i),this.btnEven.setVisible(i),this.btnAll.setVisible(!i),i?this.btnOdd.toggle(!0):this.btnAll.toggle(!0),i="checked"==this.chFirstPage.getValue(),this.btnFirst.setVisible(i)},updateThemeColors:function(){this.mnuTextColorPicker[0].updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors()),this.mnuTextColorPicker[1].updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors())},getSettings:function(){return{}},onBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value)},onPrimary:function(t){return this._handleInput("ok"),!1},_handleInput:function(t){if(this.HFObject){var e=this.HFObject.destroy("ok"==t);if(e){var i=this;return void this.showError(function(){_.delay(function(){i.onCanvasClick(e)},50)})}this.HFObject=null}this.options.handler&&this.options.handler.call(this,this,t),this.close()},showError:function(t){Common.UI.warning({title:this.notcriticalErrorTitle,msg:this.textMaxError,callback:t})},scrollerUpdate:function(){for(var t in this.scrollers)this.scrollers[t]&&this.scrollers[t].update()},scrollerScrollTop:function(){for(var t in this.scrollers)this.scrollers[t]&&this.scrollers[t].scrollTop(0)},onCanvasClick:function(t,e){if(this.HFObject){t=t||"#header-left-img";var i=this.currentCanvas!==t;if(i){this.currentCanvas=t,this.isFooter="#footer-left-img"==t||"#footer-center-img"==t||"#footer-right-img"==t;var n=this;this.headerControls.forEach(function(t){t.setDisabled(n.isFooter)}),this.footerControls.forEach(function(t){t.setDisabled(!n.isFooter)})}if(e){var o=$(e.currentTarget).parent(),s=o.offset();this.HFObject.click(t,e.pageX*Common.Utils.zoom()-s.left,e.pageY*Common.Utils.zoom()-s.top+o.scrollTop())}else this.HFObject.click(t);i&&this.scrollerUpdate()}},onApiResizeEditorHeight:function(t){if(this.editorCanvas){var e=this.editorCanvas.height();e!=this.editorCanvasHeight&&(this.editorCanvasHeight=e,this.scrollers[this.currentCanvas]&&this.scrollers[this.currentCanvas].update())}},onUpdateEditorCursorPosition:function(t,e){if(this.editorCanvas){var i=this.currentCanvas;if(this.scrollers[i]){var n=this.scrollers[i].getScrollTop();t+e>n+this.canvasBoxHeight?this.scrollers[i].scrollTop(t+e-this.canvasBoxHeight):t409?409:o<1?1:Math.floor(2*(o+.4))/2,e.setRawValue(o),this.HFObject&&this.HFObject.setFontSize(o)},onBoldClick:function(t,e){this.HFObject&&(this.HFObject.setBold(t.pressed),this.scrollerUpdate())},onItalicClick:function(t,e){this.HFObject&&(this.HFObject.setItalic(t.pressed),this.scrollerUpdate())},onUnderlineClick:function(t,e){this.HFObject&&(this.HFObject.setUnderline(t.pressed),this.scrollerUpdate())},onStrikeoutClick:function(t,e){this.HFObject&&(this.HFObject.setStrikeout(t.pressed),this.scrollerUpdate())},onSuperscriptClick:function(t,e){this.HFObject&&(this.HFObject.setSuperscript(t.pressed),this.scrollerUpdate())},onSubscriptClick:function(t,e){this.HFObject&&(this.HFObject.setSubscript(t.pressed),this.scrollerUpdate())},onTextColor:function(){var t=this.mnuTextColorPicker[this.isFooter?1:0];t.trigger("select",t,t.currentColor,!0)},onColorSelect:function(t,e,i){var n="object"==typeof i?i.color:i;t.currentColor=i,$(".btn-color-value-line",t.cmpEl).css("background-color","#"+n),e.currentColor=i,this.HFObject&&this.HFObject.setTextColor(Common.Utils.ThemeColor.getRgbColor(i)),this.onCanvasClick(this.currentCanvas)},onPageTypeToggle:function(t,e,i){if(!this._pagetype&&i&&this.HFObject){var n=this.HFObject.getPageType(),o=this.HFObject.switchHeaderFooterType(t);if(o){this._pagetype=!0;var s=this;return void this.showError(function(){switch(n){case Asc.c_oAscHeaderFooterType.odd:s.btnOdd.isVisible()?s.btnOdd.toggle(!0):s.btnAll.toggle(!0);break;case Asc.c_oAscHeaderFooterType.even:s.btnEven.toggle(!0);break;case Asc.c_oAscHeaderFooterType.first:s.btnFirst.toggle(!0)}_.delay(function(){s.onCanvasClick(o)},50),s._pagetype=!1})}this.scrollerScrollTop(),this.onCanvasClick(this.currentCanvas,void 0,!0)}},onApiChangeFont:function(t){this.cmbFonts[this.isFooter?1:0].onApiChangeFont(t)},onApiEditorSelectionChanged:function(t){var e,i=this.isFooter?1:0;t.asc_getName()!=this.cmbFonts[i].getValue()&&Common.NotificationCenter.trigger("fonts:change",t),e=t.asc_getBold(),this.btnBold[i].isActive()!==e&&this.btnBold[i].toggle(!0===e,!0),e=t.asc_getItalic(),this.btnItalic[i].isActive()!==e&&this.btnItalic[i].toggle(!0===e,!0),e=t.asc_getUnderline(),this.btnUnderline[i].isActive()!==e&&this.btnUnderline[i].toggle(!0===e,!0),e=t.asc_getStrikeout(),this.btnStrikeout[i].isActive()!==e&&this.btnStrikeout[i].toggle(!0===e,!0),e=t.asc_getSubscript(),this.btnSubscript[i].isActive()!==e&&this.btnSubscript[i].toggle(!0===e,!0),e=t.asc_getSuperscript(),this.btnSuperscript[i].isActive()!==e&&this.btnSuperscript[i].toggle(!0===e,!0);var n=t.asc_getSize();this.cmbFontSize[i].getValue()!==n&&this.cmbFontSize[i].setValue(void 0!==n?n:"");var o,s,a=this.mnuTextColorPicker[i];if(s=t.asc_getColor(),s&&(o=s.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?{color:Common.Utils.ThemeColor.getHexColor(s.get_r(),s.get_g(),s.get_b()),effectValue:s.get_value()}:Common.Utils.ThemeColor.getHexColor(s.get_r(),s.get_g(),s.get_b())),_.isObject(o)){for(var l=!1,r=0;r<10;r++)if(Common.Utils.ThemeColor.ThemeValues[r]==o.effectValue){a.select(o,!0),l=!0;break}l||a.clearSelection()}else a.select(o,!0)},cancelButtonText:"Cancel",okButtonText:"Ok",tipFontName:"Font",tipFontSize:"Font size",textBold:"Bold",textItalic:"Italic",textUnderline:"Underline",textStrikeout:"Strikeout",textSuperscript:"Superscript",textSubscript:"Subscript",textTitle:"Header/Footer Settings",textHeader:"Header",textFooter:"Footer",textLeft:"Left",textCenter:"Center",textRight:"Right",textPageNum:"Page number",textPageCount:"Page count",textDate:"Date",textTime:"Time",textFileName:"File name",textSheet:"Sheet name",textColor:"Text color",textNewColor:"Add New Custom Color",textInsert:"Insert",textPresets:"Presets",textDiffFirst:"Different first page",textDiffOdd:"Different odd and even pages",textScale:"Scale with document",textAlign:"Align with page margins",textFirst:"First page",textOdd:"Odd page",textEven:"Even page",textAll:"All pages",textMaxError:"The text string you entered is too long. Reduce the number of characters used."},SSE.Views.HeaderFooterDialog||{}))}),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/view/SelectFileDlg","common/main/lib/util/define","spreadsheeteditor/main/app/view/Toolbar","spreadsheeteditor/main/app/collection/TableTemplates","spreadsheeteditor/main/app/controller/PivotTable","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","spreadsheeteditor/main/app/view/PageMarginsDialog","spreadsheeteditor/main/app/view/HeaderFooterDialog"],function(){"use strict";SSE.Controllers.Toolbar=Backbone.Controller.extend(_.extend({models:[],collections:[],views:["Toolbar"],initialize:function(){var t=this;this.addListeners({Toolbar:{"change:compact":this.onClickChangeCompact.bind(t)},FileMenu:{"menu:hide":t.onFileMenu.bind(t,"hide"),"menu:show":t.onFileMenu.bind(t,"show")},Statusbar:{"sheet:changed":_.bind(this.onApiSheetChanged,this)},"Common.Views.Header":{"toolbar:setcompact":this.onChangeViewMode.bind(this),print:function(t){this.getApplication().getController("Main").onPrint()},save:function(t){this.api.asc_Save()},undo:this.onUndo,redo:this.onRedo,downloadas:function(t){var e,i=this.getApplication().getController("Main"),n=i.appOptions.spreadsheet.fileType;n&&(e=Asc.c_oAscFileType[n.toUpperCase()]);var o=[Asc.c_oAscFileType.XLSX,Asc.c_oAscFileType.ODS,Asc.c_oAscFileType.CSV,Asc.c_oAscFileType.PDFA,Asc.c_oAscFileType.XLTX,Asc.c_oAscFileType.OTS];(!e||o.indexOf(e)<0)&&(e=Asc.c_oAscFileType.PDF),e==Asc.c_oAscFileType.PDF||e==Asc.c_oAscFileType.PDFA?Common.NotificationCenter.trigger("download:settings",this.toolbar,e):i.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(e))},"go:editor":function(){Common.Gateway.requestEditRights()}},DataTab:{"data:sort":this.onSortType,"data:setfilter":this.onAutoFilter,"data:clearfilter":this.onClearFilter}}),Common.NotificationCenter.on("page:settings",_.bind(this.onApiSheetChanged,this)),Common.NotificationCenter.on("formula:settings",_.bind(this.applyFormulaSettings,this)),this.editMode=!0,this._isAddingShape=!1,this._state={activated:!1,prstyle:void 0,clrtext:void 0,pralign:void 0,clrback:void 0,valign:void 0,can_undo:void 0,can_redo:void 0,bold:void 0,italic:void 0,underline:void 0,strikeout:void 0,subscript:void 0,superscript:void 0,wrap:void 0,merge:void 0,angle:void 0,controlsdisabled:{rows:void 0,cols:void 0,cells_right:void 0,cells_down:void 0,filters:void 0},selection_type:void 0,filter:void 0,filterapplied:!1,tablestylename:void 0,tablename:void 0,namedrange_locked:!1,fontsize:void 0,multiselect:!1,sparklines_disabled:!1,numformatinfo:void 0,numformattype:void 0,numformat:void 0,langId:void 0,pgsize:[0,0],pgmargins:void 0,pgorient:void 0,lock_doc:void 0};var e=function(e,i){var n=$(e.target),o=n.closest("#editor_sdk"),s=n.closest("button").attr("id");void 0===s&&(s=n.closest(".btn-group").attr("id")),t.api&&t.api.asc_isAddAutoshape()&&(o.length<=0||"cancel"==i)&&(t.toolbar.btnInsertText.pressed&&s!=t.toolbar.btnInsertText.id||t.toolbar.btnInsertShape.pressed&&s!=t.toolbar.btnInsertShape.id?(t._isAddingShape=!1,t._addAutoshape(!1),t.toolbar.btnInsertShape.toggle(!1,!0),t.toolbar.btnInsertText.toggle(!1,!0),Common.NotificationCenter.trigger("edit:complete",t.toolbar)):t.toolbar.btnInsertShape.pressed&&s==t.toolbar.btnInsertShape.id&&_.defer(function(){t.api.asc_endAddShape(),Common.NotificationCenter.trigger("edit:complete",t.toolbar)},100))};this.checkInsertAutoshape=function(t){e({},t.action)},this._addAutoshape=function(t,i){this.api&&(t?(this.api.asc_startAddShape(i),$(document.body).on("mouseup",e)):(this.api.asc_endAddShape(),$(document.body).off("mouseup",e)))},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",e)}},onLaunch:function(){this.toolbar=this.createView("Toolbar"),Common.NotificationCenter.on("app:ready",this.onAppReady.bind(this)),Common.NotificationCenter.on("app:face",this.onAppShowed.bind(this))},setMode:function(t){this.mode=t,this.toolbar.applyLayout(t)},attachUIEvents:function(t){var e=this;e.appConfig.isEditDiagram?(t.btnUndo.on("click",_.bind(this.onUndo,this)),t.btnRedo.on("click",_.bind(this.onRedo,this)),t.btnCopy.on("click",_.bind(this.onCopyPaste,this,!0)),t.btnPaste.on("click",_.bind(this.onCopyPaste,this,!1)),t.btnInsertFormula.on("click",_.bind(this.onInsertFormulaMenu,this)),t.btnInsertFormula.menu.on("item:click",_.bind(this.onInsertFormulaMenu,this)),t.btnDecDecimal.on("click",_.bind(this.onDecrement,this)),t.btnIncDecimal.on("click",_.bind(this.onIncrement,this)),t.cmbNumberFormat.on("selected",_.bind(this.onNumberFormatSelect,this)),t.cmbNumberFormat.on("show:before",_.bind(this.onNumberFormatOpenBefore,this,!0)),t.cmbNumberFormat.cmpEl&&t.cmbNumberFormat.cmpEl.on("click","#id-toolbar-mnu-item-more-formats a",_.bind(this.onNumberFormatSelect,this)),t.btnEditChart.on("click",_.bind(this.onEditChart,this))):e.appConfig.isEditMailMerge?(t.btnUndo.on("click",_.bind(this.onUndo,this)),t.btnRedo.on("click",_.bind(this.onRedo,this)),t.btnCopy.on("click",_.bind(this.onCopyPaste,this,!0)),t.btnPaste.on("click",_.bind(this.onCopyPaste,this,!1)),t.btnSearch.on("click",_.bind(this.onSearch,this)),t.btnSortDown.on("click",_.bind(this.onSortType,this,Asc.c_oAscSortOptions.Ascending)),t.btnSortUp.on("click",_.bind(this.onSortType,this,Asc.c_oAscSortOptions.Descending)),t.btnSetAutofilter.on("click",_.bind(this.onAutoFilter,this)),t.btnClearAutofilter.on("click",_.bind(this.onClearFilter,this))):(t.btnPrint.on("click",_.bind(this.onPrint,this)),t.btnPrint.on("disabled",_.bind(this.onBtnChangeState,this,"print:disabled")),t.btnSave.on("click",_.bind(this.onSave,this)),t.btnSave.on("disabled",_.bind(this.onBtnChangeState,this,"save:disabled")),t.btnUndo.on("click",_.bind(this.onUndo,this)),t.btnUndo.on("disabled",_.bind(this.onBtnChangeState,this,"undo:disabled")),t.btnRedo.on("click",_.bind(this.onRedo,this)),t.btnRedo.on("disabled",_.bind(this.onBtnChangeState,this,"redo:disabled")),t.btnCopy.on("click",_.bind(this.onCopyPaste,this,!0)),t.btnPaste.on("click",_.bind(this.onCopyPaste,this,!1)),t.btnIncFontSize.on("click",_.bind(this.onIncreaseFontSize,this)),t.btnDecFontSize.on("click",_.bind(this.onDecreaseFontSize,this)),t.btnBold.on("click",_.bind(this.onBold,this)),t.btnItalic.on("click",_.bind(this.onItalic,this)),t.btnUnderline.on("click",_.bind(this.onUnderline,this)),t.btnStrikeout.on("click",_.bind(this.onStrikeout,this)),t.btnSubscript.on("click",_.bind(this.onSubscript,this)),t.btnSubscript.menu.on("item:click",_.bind(this.onSubscriptMenu,this)),t.btnTextColor.on("click",_.bind(this.onTextColor,this)),t.btnBackColor.on("click",_.bind(this.onBackColor,this)),t.mnuTextColorPicker.on("select",_.bind(this.onTextColorSelect,this)),t.mnuBackColorPicker.on("select",_.bind(this.onBackColorSelect,this)),t.btnBorders.on("click",_.bind(this.onBorders,this)),t.btnBorders.rendered&&(t.btnBorders.menu.on("item:click",_.bind(this.onBordersMenu,this)),t.mnuBorderWidth.on("item:toggle",_.bind(this.onBordersWidth,this)),t.mnuBorderColorPicker.on("select",_.bind(this.onBordersColor,this))),t.btnAlignLeft.on("click",_.bind(this.onHorizontalAlign,this,AscCommon.align_Left)),t.btnAlignCenter.on("click",_.bind(this.onHorizontalAlign,this,AscCommon.align_Center)),t.btnAlignRight.on("click",_.bind(this.onHorizontalAlign,this,AscCommon.align_Right)),t.btnAlignJust.on("click",_.bind(this.onHorizontalAlign,this,AscCommon.align_Justify)),t.btnHorizontalAlign.menu.on("item:click",_.bind(this.onHorizontalAlignMenu,this)),t.btnVerticalAlign.menu.on("item:click",_.bind(this.onVerticalAlignMenu,this)),t.btnMerge.on("click",_.bind(this.onMergeCellsMenu,this,t.btnMerge.menu,t.btnMerge.menu.items[0])),t.btnMerge.menu.on("item:click",_.bind(this.onMergeCellsMenu,this)),t.btnAlignTop.on("click",_.bind(this.onVerticalAlign,this,Asc.c_oAscVAlign.Top)),t.btnAlignMiddle.on("click",_.bind(this.onVerticalAlign,this,Asc.c_oAscVAlign.Center)),t.btnAlignBottom.on("click",_.bind(this.onVerticalAlign,this,Asc.c_oAscVAlign.Bottom)),t.btnWrap.on("click",_.bind(this.onWrap,this)),t.btnTextOrient.menu.on("item:click",_.bind(this.onTextOrientationMenu,this)),t.btnInsertTable.on("click",_.bind(this.onBtnInsertTableClick,this)),t.btnInsertImage.menu.on("item:click",_.bind(this.onInsertImageMenu,this)),t.btnInsertHyperlink.on("click",_.bind(this.onHyperlink,this)),t.mnuInsertChartPicker.on("item:click",_.bind(this.onSelectChart,this)),t.btnInsertText.on("click",_.bind(this.onBtnInsertTextClick,this)),t.btnInsertShape.menu.on("hide:after",_.bind(this.onInsertShapeHide,this)),t.btnInsertEquation.on("click",_.bind(this.onInsertEquationClick,this)),t.btnTableTemplate.menu.on("show:after",_.bind(this.onTableTplMenuOpen,this)),t.btnPercentStyle.on("click",_.bind(this.onNumberFormat,this)),t.btnCurrencyStyle.on("click",_.bind(this.onNumberFormat,this)),t.btnDecDecimal.on("click",_.bind(this.onDecrement,this)),t.btnIncDecimal.on("click",_.bind(this.onIncrement,this)),t.btnInsertFormula.on("click",_.bind(this.onInsertFormulaMenu,this)),t.btnInsertFormula.menu.on("item:click",_.bind(this.onInsertFormulaMenu,this)),t.btnNamedRange.menu.on("item:click",_.bind(this.onNamedRangeMenu,this)),t.btnNamedRange.menu.on("show:after",_.bind(this.onNamedRangeMenuOpen,this)),t.btnClearStyle.menu.on("item:click",_.bind(this.onClearStyleMenu,this)),t.btnAddCell.menu.on("item:click",_.bind(this.onCellInsertMenu,this)),t.btnCopyStyle.on("toggle",_.bind(this.onCopyStyleToggle,this)),t.btnDeleteCell.menu.on("item:click",_.bind(this.onCellDeleteMenu,this)),t.btnColorSchemas.menu.on("item:click",_.bind(this.onColorSchemaClick,this)),t.btnColorSchemas.menu.on("show:after",_.bind(this.onColorSchemaShow,this)),t.cmbFontName.on("selected",_.bind(this.onFontNameSelect,this)),t.cmbFontName.on("show:after",_.bind(this.onComboOpen,this,!0)),t.cmbFontName.on("hide:after",_.bind(this.onHideMenus,this)),t.cmbFontName.on("combo:blur",_.bind(this.onComboBlur,this)),t.cmbFontName.on("combo:focusin",_.bind(this.onComboOpen,this,!1)),t.cmbFontSize.on("selected",_.bind(this.onFontSizeSelect,this)),t.cmbFontSize.on("changed:before",_.bind(this.onFontSizeChanged,this,!0)),t.cmbFontSize.on("changed:after",_.bind(this.onFontSizeChanged,this,!1)),t.cmbFontSize.on("show:after",_.bind(this.onComboOpen,this,!0)),t.cmbFontSize.on("hide:after",_.bind(this.onHideMenus,this)),t.cmbFontSize.on("combo:blur",_.bind(this.onComboBlur,this)),t.cmbFontSize.on("combo:focusin",_.bind(this.onComboOpen,this,!1)),t.listStyles.on("click",_.bind(this.onListStyleSelect,this)),t.cmbNumberFormat.on("selected",_.bind(this.onNumberFormatSelect,this)),t.cmbNumberFormat.on("show:before",_.bind(this.onNumberFormatOpenBefore,this,!0)),t.cmbNumberFormat.cmpEl&&t.cmbNumberFormat.cmpEl.on("click","#id-toolbar-mnu-item-more-formats a",_.bind(this.onNumberFormatSelect,this)),t.btnCurrencyStyle.menu.on("item:click",_.bind(this.onNumberFormatMenu,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)),t.btnPageOrient.menu.on("item:click",_.bind(this.onPageOrientSelect,this)),t.btnPageMargins.menu.on("item:click",_.bind(this.onPageMarginsSelect,this)),t.mnuPageSize.on("item:click",_.bind(this.onPageSizeClick,this)),t.btnPrintArea.menu.on("item:click",_.bind(this.onPrintAreaClick,this)),t.btnPrintArea.menu.on("show:after",_.bind(this.onPrintAreaMenuOpen,this)),t.btnImgGroup.menu.on("item:click",_.bind(this.onImgGroupSelect,this)),t.btnImgBackward.menu.on("item:click",_.bind(this.onImgArrangeSelect,this)),t.btnImgForward.menu.on("item:click",_.bind(this.onImgArrangeSelect,this)),t.btnImgAlign.menu.on("item:click",_.bind(this.onImgAlignSelect,this)),t.btnImgForward.on("click",this.onImgArrangeSelect.bind(this,"forward")),t.btnImgBackward.on("click",this.onImgArrangeSelect.bind(this,"backward")),t.btnEditHeader.on("click",_.bind(this.onEditHeaderClick,this)),Common.Gateway.on("insertimage",_.bind(this.insertImage,this)),this.onSetupCopyStyleButton())},setApi:function(t){this.api=t;var e=SSE.getController("Main").appOptions;e.isEditDiagram||e.isEditMailMerge||(this.api.asc_registerCallback("asc_onSendThemeColors",_.bind(this.onSendThemeColors,this)),this.api.asc_registerCallback("asc_onMathTypes",_.bind(this.onMathTypes,this)),this.api.asc_registerCallback("asc_onContextMenu",_.bind(this.onContextMenu,this))),this.api.asc_registerCallback("asc_onInitEditorStyles",_.bind(this.onApiInitEditorStyles,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_onLockDefNameManager",_.bind(this.onLockDefNameManager,this)),this.api.asc_registerCallback("asc_onZoomChanged",_.bind(this.onApiZoomChange,this)),Common.NotificationCenter.on("fonts:change",_.bind(this.onApiChangeFont,this))},onApiChangeFont:function(t){!this.getApplication().getController("Main").isModalShowed&&this.toolbar.cmbFontName.onApiChangeFont(t)},onContextMenu:function(){this.toolbar.collapse()},onPrint:function(t){Common.NotificationCenter.trigger("print",this.toolbar)},onSave:function(t){if(this.api){var e=this.api.asc_isDocumentCanSave(),i=this.toolbar.btnCollabChanges&&this.toolbar.btnCollabChanges.$icon.hasClass("btn-synch");if(!e&&!i&&!this.toolbar.mode.forcesave)return;this.api.asc_Save()}Common.component.Analytics.trackEvent("Save"),Common.component.Analytics.trackEvent("ToolBar","Save")},onBtnChangeState:function(t){if(/\:disabled$/.test(t)){var e=arguments[2];this.toolbar.fireEvent(t,[e])}},onUndo:function(t,e){this.api&&this.api.asc_Undo(),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Undo")},onRedo:function(t,e){this.api&&this.api.asc_Redo(),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Redo")},onCopyPaste:function(t,e){var i=this;if(i.api){if(t?i.api.asc_Copy():i.api.asc_Paste())Common.component.Analytics.trackEvent("ToolBar","Copy Warning");else{var n=Common.localStorage.getItem("sse-hide-copywarning");n&&1==parseInt(n)||new Common.Views.CopyWarningDialog({handler:function(t){t&&Common.localStorage.setItem("sse-hide-copywarning",1),Common.NotificationCenter.trigger("edit:complete",i.toolbar)}}).show()}}Common.NotificationCenter.trigger("edit:complete",i.toolbar)},onIncreaseFontSize:function(t){this.api&&this.api.asc_increaseFontSize(),Common.NotificationCenter.trigger("edit:complete",this.toolbar,{restorefocus:!0}),Common.component.Analytics.trackEvent("ToolBar","Font Size")},onDecreaseFontSize:function(t){this.api&&this.api.asc_decreaseFontSize(),Common.NotificationCenter.trigger("edit:complete",this.toolbar,{restorefocus:!0}),Common.component.Analytics.trackEvent("ToolBar","Font Size")},onBold:function(t,e){this._state.bold=void 0,this.api&&this.api.asc_setCellBold(t.pressed),Common.NotificationCenter.trigger("edit:complete",this.toolbar,{restorefocus:!0}),Common.component.Analytics.trackEvent("ToolBar","Bold")},onItalic:function(t,e){this._state.italic=void 0,this.api&&this.api.asc_setCellItalic(t.pressed),Common.NotificationCenter.trigger("edit:complete",this.toolbar,{restorefocus:!0}),Common.component.Analytics.trackEvent("ToolBar","Italic")},onUnderline:function(t,e){this._state.underline=void 0,this.api&&this.api.asc_setCellUnderline(t.pressed),Common.NotificationCenter.trigger("edit:complete",this.toolbar,{restorefocus:!0}),Common.component.Analytics.trackEvent("ToolBar","Underline")},onStrikeout:function(t,e){this._state.strikeout=void 0,this.api&&this.api.asc_setCellStrikeout(t.pressed),Common.NotificationCenter.trigger("edit:complete",this.toolbar,{restorefocus:!0}),Common.component.Analytics.trackEvent("ToolBar","Strikeout")},onSubscriptMenu:function(t,e){var i=this.toolbar.btnSubscript;"sub"==e.value?(this._state.subscript=void 0,this.api.asc_setCellSubscript(e.checked)):(this._state.superscript=void 0,this.api.asc_setCellSuperscript(e.checked)),e.checked&&(i.$icon.removeClass(i.options.icls).addClass(e.options.icls),i.options.icls=e.options.icls),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","sub"==e.value?"Subscript":"Superscript")},onSubscript:function(t,e){var i="btn-subscript"==t.options.icls;i?(this._state.subscript=void 0,this.api.asc_setCellSubscript(t.pressed)):(this._state.superscript=void 0,this.api.asc_setCellSuperscript(t.pressed)),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar",i?"Subscript":"Superscript")},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(t,e,i){this._state.clrtext_asccolor=this._state.clrtext=void 0;var n="object"==typeof e?e.color:e;this.toolbar.btnTextColor.currentColor=e,$(".btn-color-value-line",this.toolbar.btnTextColor.cmpEl).css("background-color","#"+n),this.toolbar.mnuTextColorPicker.currentColor=e,this.api&&(this.toolbar.btnTextColor.ischanged=!0!==i,this.api.asc_setCellTextColor(Common.Utils.ThemeColor.getRgbColor(e)),this.toolbar.btnTextColor.ischanged=!1),Common.NotificationCenter.trigger("edit:complete",this.toolbar,{restorefocus:!0}),Common.component.Analytics.trackEvent("ToolBar","Text Color")},onBackColorSelect:function(t,e,i){this._state.clrshd_asccolor=this._state.clrback=void 0;var n="object"==typeof e?e.color:e;this.toolbar.btnBackColor.currentColor=e,$(".btn-color-value-line",this.toolbar.btnBackColor.cmpEl).css("background-color","transparent"==n?"transparent":"#"+n),this.toolbar.mnuBackColorPicker.currentColor=e,this.api&&(this.toolbar.btnBackColor.ischanged=!0!==i,this.api.asc_setCellBackgroundColor("transparent"==e?null:Common.Utils.ThemeColor.getRgbColor(e)),this.toolbar.btnBackColor.ischanged=!1),Common.component.Analytics.trackEvent("ToolBar","Background Color")},onNewTextColor:function(t,e){this.toolbar.mnuTextColorPicker.addNewColor()},onNewBackColor:function(t,e){this.toolbar.mnuBackColorPicker.addNewColor()},onNewBorderColor:function(t,e){this.toolbar.btnBorders.menu.hide(),this.toolbar.btnBorders.toggle(!1,!0),this.toolbar.mnuBorderColorPicker.addNewColor()},onBorders:function(t){var e;_.each(t.menu.items,function(i){if(t.options.borderId==i.options.borderId)return e=i,!1}),e&&this.onBordersMenu(t.menu,e)},onBordersMenu:function(t,e){var i=this;if(i.api&&!_.isUndefined(e.options.borderId)){var n=i.toolbar.btnBorders,o=[],s=n.options.borderswidth,a=n.options.borderscolor;n.rendered&&(n.$icon.removeClass(n.options.icls).addClass(e.options.icls),n.options.icls=e.options.icls),n.options.borderId=e.options.borderId,"inner"==e.options.borderId?(o[Asc.c_oAscBorderOptions.InnerV]=new Asc.asc_CBorder(s,a),o[Asc.c_oAscBorderOptions.InnerH]=new Asc.asc_CBorder(s,a)):"all"==e.options.borderId?(o[Asc.c_oAscBorderOptions.InnerV]=new Asc.asc_CBorder(s,a),o[Asc.c_oAscBorderOptions.InnerH]=new Asc.asc_CBorder(s,a),o[Asc.c_oAscBorderOptions.Left]=new Asc.asc_CBorder(s,a),o[Asc.c_oAscBorderOptions.Top]=new Asc.asc_CBorder(s,a),o[Asc.c_oAscBorderOptions.Right]=new Asc.asc_CBorder(s,a),o[Asc.c_oAscBorderOptions.Bottom]=new Asc.asc_CBorder(s,a)):"outer"==e.options.borderId?(o[Asc.c_oAscBorderOptions.Left]=new Asc.asc_CBorder(s,a),o[Asc.c_oAscBorderOptions.Top]=new Asc.asc_CBorder(s,a),o[Asc.c_oAscBorderOptions.Right]=new Asc.asc_CBorder(s,a),o[Asc.c_oAscBorderOptions.Bottom]=new Asc.asc_CBorder(s,a)):"none"!=e.options.borderId&&(o[e.options.borderId]=new Asc.asc_CBorder(s,a)),i.api.asc_setCellBorders(o),Common.NotificationCenter.trigger("edit:complete",i.toolbar),Common.component.Analytics.trackEvent("ToolBar","Borders")}},onBordersWidth:function(t,e,i){i&&(this.toolbar.btnBorders.options.borderswidth=e.value,Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Border Width"))},onBordersColor:function(t,e){$("#id-toolbar-mnu-item-border-color .menu-item-icon").css("border-color","#"+("object"==typeof e?e.color:e)),this.toolbar.mnuBorderColor.onUnHoverItem(),this.toolbar.btnBorders.options.borderscolor=Common.Utils.ThemeColor.getRgbColor(e),this.toolbar.mnuBorderColorPicker.currentColor=e,Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Border Color")},onHorizontalAlign:function(t,e,i){this._state.pralign=void 0,this.api&&(this.api.asc_setCellAlign(e.pressed?t:null),this.toolbar.btnWrap.allowDepress=!(t==AscCommon.align_Justify)),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Horizontal align")},onHorizontalAlignMenu:function(t,e){var i=this.toolbar.btnHorizontalAlign;i.$icon.removeClass(i.options.icls),i.options.icls=e.checked?e.options.icls:"btn-align-left",i.$icon.addClass(i.options.icls),this._state.pralign=void 0,this.api&&this.api.asc_setCellAlign(e.checked?e.value:null),this.toolbar.btnWrap.allowDepress=!(e.value==AscCommon.align_Justify),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Horizontal Align")},onVerticalAlignMenu:function(t,e){var i=this.toolbar.btnVerticalAlign;i.$icon.removeClass(i.options.icls),i.options.icls=e.checked?e.options.icls:"btn-valign-bottom",i.$icon.addClass(i.options.icls),this._state.valign=void 0,this.api&&this.api.asc_setCellVertAlign(e.checked?e.value:Asc.c_oAscVAlign.Bottom),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Vertical Align")},onVerticalAlign:function(t,e,i){this._state.valign=void 0,this.api&&this.api.asc_setCellVertAlign(e.pressed?t:Asc.c_oAscVAlign.Bottom),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Vertical align")},onMergeCellsMenu:function(t,e){function i(t){n._state.merge=void 0,n.api.asc_mergeCells(t),Common.NotificationCenter.trigger("edit:complete",n.toolbar),Common.component.Analytics.trackEvent("ToolBar","Merge")}var n=this;if(n.api){n.api.asc_getCellInfo().asc_getFlags().asc_getMerge()!==Asc.c_oAscMergeOptions.Merge&&n.api.asc_mergeCellsDataLost(e.value)?Common.UI.warning({msg:n.warnMergeLostData,buttons:["yes","no"],primary:"yes",callback:function(t){"yes"==t?i(e.value):(n.toolbar.btnMerge.toggle(!1,!0),Common.NotificationCenter.trigger("edit:complete",n.toolbar),Common.component.Analytics.trackEvent("ToolBar","Merge"))}}):i(e.value)}Common.NotificationCenter.trigger("edit:complete",this.toolbar), +Common.component.Analytics.trackEvent("ToolBar","Merge cells")},onWrap:function(t,e){this._state.wrap=void 0,this.api&&this.api.asc_setCellTextWrap(t.pressed),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Wrap")},onTextOrientationMenu:function(t,e){if(this.api.asc_getCellInfo().asc_getFlags().asc_getSelectionType()==Asc.c_oAscSelectionType.RangeShapeText){var i=Asc.c_oAscVertDrawingText.normal;switch(e.value){case"rotateup":i=Asc.c_oAscVertDrawingText.vert270;break;case"rotatedown":i=Asc.c_oAscVertDrawingText.vert}var n=new Asc.asc_CImgProperty;n.asc_putVert(i),this.api.asc_setGraphicObjectProps(n)}else{var i=0;switch(e.value){case"countcw":i=45;break;case"clockwise":i=-45;break;case"rotateup":i=90;break;case"rotatedown":i=-90}this._state.angle=void 0,this.api&&this.api.asc_setCellAngle(i)}Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Text orientation")},onBtnInsertTableClick:function(t,e){this.api&&this._setTableFormat(this.api.asc_getDefaultTableStyle()),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Table")},onInsertImageMenu:function(t,e,i){var n=this;"file"===e.value?(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")):"url"===e.value?new Common.Views.ImageFromUrlDialog({handler:function(t,e){if("ok"==t){if(n.api){var i=e.replace(/\s/g,"");_.isEmpty(i)?Common.UI.warning({msg:this.textEmptyImgUrl}):(n.toolbar.fireEvent("insertimage",n.toolbar),n.api.asc_addImageDrawingObject(i),Common.component.Analytics.trackEvent("ToolBar","Image"))}Common.NotificationCenter.trigger("edit:complete",n.toolbar)}}}).show():"storage"===e.value&&(this.toolbar.mode.canRequestInsertImage?Common.Gateway.requestInsertImage():new Common.Views.SelectFileDlg({fileChoiceUrl:this.toolbar.mode.fileChoiceUrl.replace("{fileExt}","").replace("{documentType}","ImagesOnly")}).on("selectfile",function(t,e){n.insertImage(e)}).show())},insertImage:function(t){t&&t.url&&(this.toolbar.fireEvent("insertimage",this.toolbar),this.api.asc_addImageDrawingObject(t.url,void 0,t.token),Common.component.Analytics.trackEvent("ToolBar","Image"))},onHyperlink:function(t){var e,i,n=this;if(n.api){for(var o=n.api.asc_getWorksheetsCount(),s=-1,a=[];++s0?o[0]:void 0,n)}else{var n=new Asc.asc_CFormatCellsInfo;n.asc_setType(Asc.c_oAscNumFormatType.Accounting),n.asc_setSeparator(!1),n.asc_setSymbol(e.value);var o=this.api.asc_getFormatCells(n);o&&o.length>0&&this.api.asc_setCellFormat(o[0])}Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Number Format")},onNumberFormatSelect:function(t,e){e?this.api&&this.api.asc_setCellFormat(e.format):this.onCustomNumberFormat(),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Number Format")},onCustomNumberFormat:function(t,e){var i=this,n=i.api.asc_getLocale();!n&&(n=i.toolbar.mode.lang?parseInt(Common.util.LanguageInfo.getLocalLanguageCode(i.toolbar.mode.lang)):1033),new SSE.Views.FormatSettingsDialog({api:i.api,handler:function(t,e){e&&i.api.asc_setCellFormat(e.format),Common.NotificationCenter.trigger("edit:complete",i.toolbar)},props:{format:t||i._state.numformat,formatInfo:e||i._state.numformatinfo,langId:n}}).show(),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Number Format")},onNumberFormatOpenBefore:function(t){if(this.api){var e=this,i=e.api.asc_getLocale();if(!i&&(i=e.toolbar.mode.lang?parseInt(Common.util.LanguageInfo.getLocalLanguageCode(e.toolbar.mode.lang)):1033),this._state.langId!==i){this._state.langId=i;var n=new Asc.asc_CFormatCellsInfo;n.asc_setType(Asc.c_oAscNumFormatType.None),n.asc_setSymbol(this._state.langId);var o=this.api.asc_getFormatCells(n);e.toolbar.numFormatData.forEach(function(t,i){e.toolbar.numFormatData[i].format=o[i]})}e.toolbar.numFormatData.forEach(function(t,i){t.exampleval=e.api.asc_getLocaleExample(t.format)}),e.toolbar.cmbNumberFormat.setData(e.toolbar.numFormatData),e.toolbar.cmbNumberFormat.setValue(e._state.numformattype,e.toolbar.txtCustom)}},onDecrement:function(t){this.api&&this.api.asc_decreaseCellDigitNumbers(),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Decrement")},onIncrement:function(t){this.api&&this.api.asc_increaseCellDigitNumbers(),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Increment")},onInsertFormulaMenu:function(t,e,i){if(this.api)if("more"===e.value){var n=this.getApplication().getController("FormulaDialog");n&&n.showDialog()}else e.value=e.value||"SUM",this.toolbar.fireEvent("function:apply",[{name:this.api.asc_getFormulaLocaleName(e.value),origin:e.value},!0]),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Insert formula")},onNamedRangeMenu:function(t,e,i){if(this.api){var n=this;if("paste"===e.value)new SSE.Views.NamedRangePasteDlg({handler:function(t,e){"ok"==t&&e&&(n.api.asc_insertFormula(e.asc_getName(!0),e.asc_getIsTable()?Asc.c_oAscPopUpSelectorType.Table:Asc.c_oAscPopUpSelectorType.Range,!1),Common.component.Analytics.trackEvent("ToolBar","Paste Named Range")),Common.NotificationCenter.trigger("edit:complete",n.toolbar)},ranges:n.api.asc_getDefinedNames(Asc.c_oAscGetDefinedNamesList.WorksheetWorkbook)}).show(),Common.component.Analytics.trackEvent("ToolBar","Paste Named Range");else{var o=n.api.asc_getWorksheetsCount(),s=-1,a=[],l=[];if("new"===e.value){if(this._state.namedrange_locked)return void Common.NotificationCenter.trigger("namedrange:locked");for(;++s409?409:o<1?1:Math.floor(2*(o+.4))/2,e.setRawValue(o),this._state.fontsize=void 0,this.api&&this.api.asc_setCellFontSize(o),Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onListStyleSelect:function(t,e){this._state.prstyle=void 0,this.api&&(this.api.asc_setCellStyle(e.get("name")),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Style"))},createDelayedElements:function(){var t=this;this.toolbar.createDelayedElements(),this.attachUIEvents(this.toolbar),this.appConfig.isEditDiagram||this.appConfig.isEditMailMerge||(this.api.asc_registerCallback("asc_onSheetsChanged",_.bind(this.onApiSheetChanged,this)),this.api.asc_registerCallback("asc_onUpdateSheetViewSettings",_.bind(this.onApiSheetChanged,this)),this.api.asc_registerCallback("asc_onEndAddShape",_.bind(this.onApiEndAddShape,this)),this.api.asc_registerCallback("asc_onEditorSelectionChanged",_.bind(this.onApiEditorSelectionChanged,this)),this.api.asc_registerCallback("asc_onUpdateDocumentProps",_.bind(this.onUpdateDocumentProps,this)),this.api.asc_registerCallback("asc_onLockDocumentProps",_.bind(this.onApiLockDocumentProps,this)),this.api.asc_registerCallback("asc_onUnLockDocumentProps",_.bind(this.onApiUnLockDocumentProps,this))),this.appConfig.isEditMailMerge||this.applyFormulaSettings(),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_onStopFormatPainter",_.bind(this.onApiStyleChange,this)),this.api.asc_registerCallback("asc_onSelectionChanged",_.bind(this.onApiSelectionChanged,this)),Common.util.Shortcuts.delegateShortcuts({shortcuts:{"command+l,ctrl+l":function(e){if(t.editMode&&!t._state.multiselect&&t.appConfig.canModifyFilter){var i=t.api.asc_getCellInfo(),n=i.asc_getAutoFilterInfo(),o=i.asc_getFormatTableInfo();n=n?n.asc_getIsAutoFilter():null,null===n||o||t._setTableFormat(t.api.asc_getDefaultTableStyle())}return!1},"command+shift+l,ctrl+shift+l":function(e){if(t.editMode&&t.api&&!t._state.multiselect&&t.appConfig.canModifyFilter){var i=t._state.filter;t._state.filter=void 0,t._state.tablename||i?t.api.asc_changeAutoFilter(t._state.tablename,Asc.c_oAscChangeFilterOptions.filter,!i):t.api.asc_addAutoFilter()}return!1},"command+s,ctrl+s":function(e){t.onSave(),e.preventDefault(),e.stopPropagation()},"command+k,ctrl+k":function(e){!t.editMode||t.toolbar.mode.isEditMailMerge||t.toolbar.mode.isEditDiagram||t.api.isCellEdited||t._state.multiselect||t._state.inpivot||t.getApplication().getController("LeftMenu").leftMenu.menuFile.isVisible()||t.onHyperlink(),e.preventDefault()},"command+1,ctrl+1":function(e){return!t.editMode||t.toolbar.mode.isEditMailMerge||t.api.isCellEdited||t.toolbar.cmbNumberFormat.isDisabled()||t.onCustomNumberFormat(),!1}}}),this.onApiSelectionChanged(this.api.asc_getCellInfo()),this.attachToControlEvents(),this.onApiSheetChanged(),Common.NotificationCenter.on("cells:range",_.bind(this.onCellsRange,this))},onChangeViewMode:function(t,e){this.toolbar.setFolded(e),this.toolbar.fireEvent("view:compact",[this,e]),Common.localStorage.setBool("sse-compact-toolbar",e),Common.NotificationCenter.trigger("layout:changed","toolbar"),Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onClickChangeCompact:function(t){"file"!=t&&Common.Utils.asyncCall(function(){this.onChangeViewMode(null,!this.toolbar.isCompact())},this)},fillTableTemplates:function(){if(this.toolbar.btnTableTemplate.rendered){var t=this;_.isUndefined(this.toolbar.mnuTableTemplatePicker)&&(this.toolbar.mnuTableTemplatePicker=function(e,i){var n=new Common.UI.DataView({el:e,parentMenu:i,restoreHeight:300,style:"max-height: 300px;",store:t.getCollection("TableTemplates"),itemTemplate:_.template('
    ')});return n.on("item:click",function(e,i,n){t.api&&(t._state.tablestylename=null,t._setTableFormat(n?n.get("name"):t.api.asc_getDefaultTableStyle()),Common.NotificationCenter.trigger("edit:complete",t.toolbar),Common.component.Analytics.trackEvent("ToolBar","Table Templates"))}),n.scroller&&n.scroller.update({alwaysVisibleY:!0}),n}($("#id-toolbar-menu-table-templates"),this.toolbar.btnTableTemplate.menu))}},onTableTplMenuOpen:function(t){this.onApiInitTableTemplates(this.api.asc_getTablePictures(this.api.asc_getCellInfo().asc_getFormatTableInfo()));var e=this.toolbar.mnuTableTemplatePicker.scroller;e&&(e.update({alwaysVisibleY:!0}),e.scrollTop(0));var i=this.toolbar.mnuTableTemplatePicker.store.findWhere({name:this._state.tablestylename});i?this.toolbar.mnuTableTemplatePicker.selectRecord(i):this.toolbar.mnuTableTemplatePicker.deselectAll()},onSendThemeColors:function(){this.toolbar.btnTableTemplate.rendered&&this.toolbar.btnTableTemplate.cmpEl.hasClass("open")&&this.onTableTplMenuOpen()},onApiInitTableTemplates:function(t){var e=this.getCollection("TableTemplates");if(e){var i=[];_.each(t,function(t){i.push({name:t.asc_getName(),caption:t.asc_getDisplayName(),type:t.asc_getType(),imageUrl:t.asc_getImage(),allowSelected:!0,selected:!1,tip:t.asc_getDisplayName()})}),e.reset(),e.add(i)}this.fillTableTemplates()},onApiInitEditorStyles:function(t){window.styles_loaded=!1;var e=this,i=e.toolbar.listStyles;if(!i)return void(e.styles=t);i.menuPicker.store.reset([]);var n=this.getApplication().getController("Main");_.each(t,function(t){i.menuPicker.store.add({imageUrl:t.asc_getImage(),name:t.asc_getName(),tip:n.translationTable[t.get_Name()]||t.get_Name(),uid:Common.UI.getId()})}),i.menuPicker.store.length>0&&i.rendered&&(i.fillComboView(i.menuPicker.store.at(0),!0),i.selectByIndex(0)),window.styles_loaded=!0},onApiCoAuthoringDisconnect:function(t){this.toolbar.setMode({isDisconnected:!0,enableDownload:!!t}),this.editMode=!1},onApiChartDblClick:function(){this.onEditChart(this.btnInsertChart)},onApiCanRevert:function(t,e){"undo"==t?this._state.can_undo!==e&&(this.toolbar.btnUndo.setDisabled(!e),this._state.can_undo=e):this._state.can_redo!==e&&(this.toolbar.btnRedo.setDisabled(!e),this._state.can_redo=e)},setDisabledComponents:function(t,e){_.each([].concat(t),function(t){t.isDisabled()!==e&&t.setDisabled(e)})},onApiEditCell:function(t){if(!($(".asc-window.enable-key-events:visible").length>0)){var e=this.toolbar;if(e.mode.isEditDiagram||e.mode.isEditMailMerge)i=t==Asc.c_oAscCellEditorState.editStart,e.lockToolbar(SSE.enumLock.editCell,t==Asc.c_oAscCellEditorState.editStart,{array:[e.btnDecDecimal,e.btnIncDecimal,e.cmbNumberFormat]});else if(t==Asc.c_oAscCellEditorState.editStart||t==Asc.c_oAscCellEditorState.editEnd){e.lockToolbar(SSE.enumLock.editCell,t==Asc.c_oAscCellEditorState.editStart,{array:[e.btnClearStyle.menu.items[1],e.btnClearStyle.menu.items[2],e.btnClearStyle.menu.items[3],e.btnClearStyle.menu.items[4],e.btnNamedRange.menu.items[0],e.btnNamedRange.menu.items[1]],merge:!0,clear:[SSE.enumLock.editFormula,SSE.enumLock.editText]});var i=t==Asc.c_oAscCellEditorState.editStart;i?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"),i&&(e.listStyles.suspendEvents(),e.listStyles.menuPicker.selectRecord(null),e.listStyles.resumeEvents(),this._state.prstyle=void 0)}else{if(t==Asc.c_oAscCellEditorState.editText)var n=!0,o=!1;else t==Asc.c_oAscCellEditorState.editFormula?n=!(o=!0):t==Asc.c_oAscCellEditorState.editEmptyCell&&(n=o=!1);e.lockToolbar(SSE.enumLock.editFormula,o,{array:[e.cmbFontName,e.cmbFontSize,e.btnIncFontSize,e.btnDecFontSize,e.btnBold,e.btnItalic,e.btnUnderline,e.btnStrikeout,e.btnSubscript,e.btnTextColor]}),e.lockToolbar(SSE.enumLock.editText,n,{array:[e.btnInsertFormula].concat(e.btnsFormula)})}this._state.coauthdisable=void 0,this._state.selection_type=void 0,this.checkInsertAutoshape({action:"cancel"})}},onApiZoomChange:function(t,e){},onApiSheetChanged:function(){if(this.toolbar.mode&&this.toolbar.mode.isEdit&&!this.toolbar.mode.isEditDiagram&&!this.toolbar.mode.isEditMailMerge){var t=this.api.asc_getActiveWorksheetIndex(),e=this.api.asc_getPageOptions(t),i=e.asc_getPageSetup();this.onApiPageOrient(i.asc_getOrientation()),this.onApiPageSize(i.asc_getWidth(),i.asc_getHeight()),this.onApiPageMargins(e.asc_getPageMargins()),this.api.asc_isLayoutLocked(t)?this.onApiLockDocumentProps(t):this.onApiUnLockDocumentProps(t),this.toolbar.lockToolbar(SSE.enumLock.printAreaLock,this.api.asc_isPrintAreaLocked(t),{array:[this.toolbar.btnPrintArea]})}},onUpdateDocumentProps:function(t){t==this.api.asc_getActiveWorksheetIndex()&&this.onApiSheetChanged()},onApiPageSize:function(t,e){void 0!==this._state.pgorient&&(Math.abs(this._state.pgsize[0]-t)>.1||Math.abs(this._state.pgsize[1]-e)>.1)&&(this._state.pgsize=[t,e],this.toolbar.mnuPageSize&&(this.toolbar.mnuPageSize.clearAll(),_.each(this.toolbar.mnuPageSize.items,function(i){if(i.value&&"object"==typeof i.value&&Math.abs(i.value[0]-t)<.1&&Math.abs(i.value[1]-e)<.1)return i.setChecked(!0),!1},this)))},onApiPageMargins:function(t){if(t){var e=t.asc_getLeft(),i=t.asc_getTop(),n=t.asc_getRight(),o=t.asc_getBottom();(!this._state.pgmargins||Math.abs(this._state.pgmargins[0]-i)>.1||Math.abs(this._state.pgmargins[1]-e)>.1||Math.abs(this._state.pgmargins[2]-o)>.1||Math.abs(this._state.pgmargins[3]-n)>.1)&&(this._state.pgmargins=[i,e,o,n],this.toolbar.btnPageMargins.menu&&(this.toolbar.btnPageMargins.menu.clearAll(),_.each(this.toolbar.btnPageMargins.menu.items,function(t){if(t.value&&"object"==typeof t.value&&Math.abs(t.value[0]-i)<.1&&Math.abs(t.value[1]-e)<.1&&Math.abs(t.value[2]-o)<.1&&Math.abs(t.value[3]-n)<.1)return t.setChecked(!0),!1},this)))}},onApiPageOrient:function(t){this._state.pgorient!==t&&(this.toolbar.btnPageOrient.menu.items[t==Asc.c_oAscPageOrientation.PagePortrait?0:1].setChecked(!0),this._state.pgorient=t)},onApiLockDocumentProps:function(t){!0!==this._state.lock_doc&&t==this.api.asc_getActiveWorksheetIndex()&&(this.toolbar.lockToolbar(SSE.enumLock.docPropsLock,!0,{array:[this.toolbar.btnPageSize,this.toolbar.btnPageMargins,this.toolbar.btnPageOrient]}),this._state.lock_doc=!0)},onApiUnLockDocumentProps:function(t){!1!==this._state.lock_doc&&t==this.api.asc_getActiveWorksheetIndex()&&(this.toolbar.lockToolbar(SSE.enumLock.docPropsLock,!1,{array:[this.toolbar.btnPageSize,this.toolbar.btnPageMargins,this.toolbar.btnPageOrient]}),this._state.lock_doc=!1)},onApiEditorSelectionChanged:function(t){if(this.editMode&&!($(".asc-window.enable-key-events:visible").length>0)){var e,i=this.toolbar;if(t.asc_getName()!=i.cmbFontName.getValue()&&Common.NotificationCenter.trigger("fonts:change",t),!i.mode.isEditMailMerge&&!i.mode.isEditDiagram){e=t.asc_getBold(),this._state.bold!==e&&(i.btnBold.toggle(!0===e,!0),this._state.bold=e),e=t.asc_getItalic(),this._state.italic!==e&&(i.btnItalic.toggle(!0===e,!0),this._state.italic=e),e=t.asc_getUnderline(),this._state.underline!==e&&(i.btnUnderline.toggle(!0===e,!0),this._state.underline=e),e=t.asc_getStrikeout(),this._state.strikeout!==e&&(i.btnStrikeout.toggle(!0===e,!0),this._state.strikeout=e);var n=t.asc_getSubscript(),o=t.asc_getSuperscript();if(this._state.subscript!==n||this._state.superscript!==o){var s=o?0:n?1:-1,a=i.btnSubscript;a.toggle(s>-1,!0),s<0?a.menu.clearAll():(a.menu.items[s].setChecked(!0),a.rendered&&a.$icon&&(a.$icon.removeClass(a.options.icls),a.options.icls=a.menu.items[s].options.icls,a.$icon.addClass(a.options.icls))),this._state.subscript=n,this._state.superscript=o}}var l=t.asc_getSize();this._state.fontsize!==l&&(i.cmbFontSize.setValue(void 0!==l?l:""),this._state.fontsize=l);var r,c,h=this.toolbar.mnuTextColorPicker;if(!i.btnTextColor.ischanged&&!h.isDummy){c=t.asc_getColor(),c&&(r=c.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?{color:Common.Utils.ThemeColor.getHexColor(c.get_r(),c.get_g(),c.get_b()),effectValue:c.get_value()}:Common.Utils.ThemeColor.getHexColor(c.get_r(),c.get_g(),c.get_b()));var d=typeof r;if(d!==typeof this._state.clrtext||"object"==d&&(r.effectValue!==this._state.clrtext.effectValue||this._state.clrtext.color.indexOf(r.color)<0)||"object"!=d&&void 0!==this._state.clrtext&&this._state.clrtext.indexOf(r)<0){if(_.isObject(r)){for(var p=!1,m=0;m<10;m++)if(Common.Utils.ThemeColor.ThemeValues[m]==r.effectValue){h.select(r,!0),p=!0;break}p||h.clearSelection()}else h.select(r,!0);this._state.clrtext=r}this._state.clrtext_asccolor=c}}},onApiSelectionChanged:function(t){if(this.editMode&&!($(".asc-window.enable-key-events:visible").length>0)){if(this.toolbar.mode.isEditDiagram)return this.onApiSelectionChanged_DiagramEditor(t);if(this.toolbar.mode.isEditMailMerge)return this.onApiSelectionChanged_MailMergeEditor(t);var e,i=t.asc_getFlags().asc_getSelectionType(),n=!this.toolbar.mode.isEditMailMerge&&!this.toolbar.mode.isEditDiagram&&(!0===t.asc_getLocked()||!0===t.asc_getLockedTable()),o=this._disableEditOptions(i,n),s=this.toolbar,a=t.asc_getFont(),l=!1,r=a.asc_getName();r!=s.cmbFontName.getValue()&&Common.NotificationCenter.trigger("fonts:change",a);var c=a.asc_getSize();this._state.fontsize!==c&&(s.cmbFontSize.setValue(void 0!==c?c:""),this._state.fontsize=c),s.lockToolbar(SSE.enumLock.cantHyperlink,i==Asc.c_oAscSelectionType.RangeShapeText&&!1===this.api.asc_canAddShapeHyperlink(),{array:[s.btnInsertHyperlink]}),l=i==Asc.c_oAscSelectionType.RangeCells||i==Asc.c_oAscSelectionType.RangeCol||i==Asc.c_oAscSelectionType.RangeRow||i==Asc.c_oAscSelectionType.RangeMax,s.lockToolbar(SSE.enumLock.selRange,l,{array:[s.btnImgAlign,s.btnImgBackward,s.btnImgForward,s.btnImgGroup]});var h=this.api.asc_canGroupGraphicsObjects(),d=this.api.asc_canUnGroupGraphicsObjects();s.lockToolbar(SSE.enumLock.cantGroupUngroup,!h&&!d,{array:[s.btnImgGroup]}),s.btnImgGroup.menu.items[0].setDisabled(!h),s.btnImgGroup.menu.items[1].setDisabled(!d),s.lockToolbar(SSE.enumLock.cantGroup,!h,{array:[s.btnImgAlign]});var p=this.api.asc_getSelectedDrawingObjectsCount();if(s.btnImgAlign.menu.items[7].setDisabled(p<3),s.btnImgAlign.menu.items[8].setDisabled(p<3),!o){if(!s.mode.isEditMailMerge&&!s.mode.isEditDiagram){e=a.asc_getBold(),this._state.bold!==e&&(s.btnBold.toggle(!0===e,!0),this._state.bold=e),e=a.asc_getItalic(),this._state.italic!==e&&(s.btnItalic.toggle(!0===e,!0),this._state.italic=e),e=a.asc_getUnderline(),this._state.underline!==e&&(s.btnUnderline.toggle(!0===e,!0),this._state.underline=e),e=a.asc_getStrikeout(),this._state.strikeout!==e&&(s.btnStrikeout.toggle(!0===e,!0),this._state.strikeout=e);var m=a.asc_getSubscript(),u=a.asc_getSuperscript();if(this._state.subscript!==m||this._state.superscript!==u){var g=u?0:m?1:-1,b=s.btnSubscript;b.toggle(g>-1,!0),g<0?b.menu.clearAll():(b.menu.items[g].setChecked(!0),b.rendered&&(b.$icon.removeClass(b.options.icls),b.options.icls=b.menu.items[g].options.icls,b.$icon.addClass(b.options.icls))),this._state.subscript=m,this._state.superscript=u}}var f,C,v=this.toolbar.mnuTextColorPicker,y=this.toolbar.mnuBackColorPicker;if(!s.btnTextColor.ischanged&&!v.isDummy){C=a.asc_getColor(),C&&(f=C.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?{color:Common.Utils.ThemeColor.getHexColor(C.get_r(),C.get_g(),C.get_b()),effectValue:C.get_value()}:Common.Utils.ThemeColor.getHexColor(C.get_r(),C.get_g(),C.get_b()));var x=typeof f,w=typeof this._state.clrtext;if(x!==w||"object"==x&&(f.effectValue!==this._state.clrtext.effectValue||this._state.clrtext.color.indexOf(f.color)<0)||"object"!=x&&void 0!==this._state.clrtext&&this._state.clrtext.indexOf(f)<0){if(_.isObject(f)){for(var S=!1,A=0;A<10;A++)if(Common.Utils.ThemeColor.ThemeValues[A]==f.effectValue){v.select(f,!0),S=!0;break}S||v.clearSelection()}else v.select(f,!0);this._state.clrtext=f}this._state.clrtext_asccolor=C}if(!s.btnBackColor.ischanged&&!y.isDummy){if(C=t.asc_getFill().asc_getColor(),f=C?C.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?{color:Common.Utils.ThemeColor.getHexColor(C.get_r(),C.get_g(),C.get_b()),effectValue:C.get_value() +}:Common.Utils.ThemeColor.getHexColor(C.get_r(),C.get_g(),C.get_b()):"transparent",x=typeof f,w=typeof this._state.clrback,x!==w||"object"==x&&(f.effectValue!==this._state.clrback.effectValue||this._state.clrback.color.indexOf(f.color)<0)||"object"!=x&&void 0!==this._state.clrback&&this._state.clrback.indexOf(f)<0){if(_.isObject(f)){var S=!1;for(A=0;A<10;A++)if(Common.Utils.ThemeColor.ThemeValues[A]==f.effectValue){y.select(f,!0),S=!0;break}S||y.clearSelection()}else y.select(f,!0);this._state.clrback=f}this._state.clrshd_asccolor=C}var k=i==Asc.c_oAscSelectionType.RangeChart||i==Asc.c_oAscSelectionType.RangeChartText;if(k!==this._state.in_chart&&(s.btnInsertChart.updateHint(k?s.tipChangeChart:s.tipInsertChart),this._state.in_chart=k),!k){if(!s.mode.isEditDiagram){var T=t.asc_getAutoFilterInfo(),I=t.asc_getFormatTableInfo();if(!s.mode.isEditMailMerge){if(r=t.asc_getHorAlign(),this._state.pralign!==r){this._state.pralign=r;var E,g=-1;switch(r){case AscCommon.align_Left:g=0,E="btn-align-left";break;case AscCommon.align_Center:g=1,E="btn-align-center";break;case AscCommon.align_Right:g=2,E="btn-align-right";break;case AscCommon.align_Justify:g=3,E="btn-align-just";break;default:g=-255,E="btn-align-left"}g<0?-255==g&&(s.btnAlignRight.toggle(!1,!0),s.btnAlignLeft.toggle(!1,!0),s.btnAlignCenter.toggle(!1,!0),s.btnAlignJust.toggle(!1,!0),s.btnHorizontalAlign.menu.clearAll()):(s.btnAlignRight.toggle(2===g,!0),s.btnAlignLeft.toggle(0===g,!0),s.btnAlignCenter.toggle(1===g,!0),s.btnAlignJust.toggle(3===g,!0),s.btnHorizontalAlign.menu.items[g].setChecked(!0,!1));var P=this.toolbar.btnHorizontalAlign;P.rendered&&(P.$icon.removeClass(P.options.icls).addClass(E),P.options.icls=E)}if(l=r==AscCommon.align_Justify||i==Asc.c_oAscSelectionType.RangeShapeText,s.btnTextOrient.menu.items[1].setDisabled(l),s.btnTextOrient.menu.items[2].setDisabled(l),r=t.asc_getVertAlign(),this._state.valign!==r){switch(this._state.valign=r,g=-1,E="",r){case Asc.c_oAscVAlign.Top:g=0,E="btn-valign-top";break;case Asc.c_oAscVAlign.Center:g=1,E="btn-valign-middle";break;case Asc.c_oAscVAlign.Bottom:g=2,E="btn-valign-bottom"}if(g>-1){s.btnAlignTop.toggle(0===g,!0),s.btnAlignMiddle.toggle(1===g,!0),s.btnAlignBottom.toggle(2===g,!0),s.btnVerticalAlign.menu.items[g].setChecked(!0,!1);var M=this.toolbar.btnVerticalAlign;M.rendered&&(M.$icon.removeClass(M.options.icls).addClass(E),M.options.icls=E)}}l=this._state.controlsdisabled.filters||null!==I||T&&null===T.asc_getIsAutoFilter(),s.lockToolbar(SSE.enumLock.ruleMerge,l,{array:[s.btnMerge,s.btnInsertTable]}),e=t.asc_getFlags().asc_getMerge(),this._state.merge!==e&&(s.btnMerge.toggle(e===Asc.c_oAscMergeOptions.Merge,!0),this._state.merge=e),s.btnWrap.isDisabled()||(e=t.asc_getFlags().asc_getWrapText(),this._state.wrap!==e&&(s.btnWrap.toggle(!0===e,!0),this._state.wrap=e))}e=T?T.asc_getIsAutoFilter():null,this._state.filter!==e&&(s.btnsSetAutofilter.toggle(!0===e,!0),this._state.filter=e),l=this._state.controlsdisabled.filters||null===e,s.lockToolbar(SSE.enumLock.ruleFilter,l,{array:s.btnsSetAutofilter.concat(s.btnsSortDown,s.btnsSortUp,s.btnTableTemplate,s.btnInsertTable)}),e=I?I.asc_getTableStyleName():null,this._state.tablestylename!==e&&this.toolbar.mnuTableTemplatePicker&&(e=this.toolbar.mnuTableTemplatePicker.store.findWhere({name:e}),e?(this.toolbar.mnuTableTemplatePicker.selectRecord(e),this._state.tablestylename=e.get("name")):(s.mnuTableTemplatePicker.deselectAll(),this._state.tablestylename=null)),l=this._state.controlsdisabled.filters||!T||!0!==T.asc_getIsApplyAutoFilter(),s.lockToolbar(SSE.enumLock.ruleDelFilter,l,{array:s.btnsClearAutofilter});var D=this._state.tablename;this._state.tablename=I?I.asc_getTableName():void 0;var F=this._state.filterapplied;this._state.filterapplied=this._state.filter&&T.asc_getIsApplyAutoFilter(),this._state.tablename===D&&this._state.filterapplied===F||this.getApplication().getController("Statusbar").onApiFilterInfo(!l),this._state.multiselect=t.asc_getFlags().asc_getMultiselect(),s.lockToolbar(SSE.enumLock.multiselect,this._state.multiselect,{array:[s.btnTableTemplate,s.btnInsertHyperlink,s.btnInsertTable]}),this._state.inpivot=!!t.asc_getPivotTableInfo(),s.lockToolbar(SSE.enumLock.editPivot,this._state.inpivot,{array:s.btnsSetAutofilter.concat(s.btnsClearAutofilter,s.btnsSortDown,s.btnsSortUp,s.btnMerge,s.btnInsertHyperlink,s.btnInsertTable)}),l=!this.appConfig.canModifyFilter,s.lockToolbar(SSE.enumLock.cantModifyFilter,l,{array:s.btnsSetAutofilter.concat(s.btnsSortDown,s.btnsSortUp,s.btnTableTemplate,s.btnClearStyle.menu.items[0],s.btnClearStyle.menu.items[2],s.btnInsertTable)})}if(e=t.asc_getNumFormatInfo(),e&&(this._state.numformat=t.asc_getNumFormat(),this._state.numformatinfo=e,e=e.asc_getType(),this._state.numformattype!==e&&(s.cmbNumberFormat.setValue(e,s.txtCustom),this._state.numformattype=e)),i==Asc.c_oAscSelectionType.RangeShapeText)for(var U=this.api.asc_getGraphicObjectProps(),A=0;A0?e:void 0,V.menuPicker.selectRecord(R),V.resumeEvents()}}e=i==Asc.c_oAscSelectionType.RangeRow,this._state.controlsdisabled.rows!==e&&(this._state.controlsdisabled.rows=e,s.btnAddCell.menu.items[3].setDisabled(e),s.btnDeleteCell.menu.items[3].setDisabled(e)),e=i==Asc.c_oAscSelectionType.RangeCol,this._state.controlsdisabled.cols!==e&&(this._state.controlsdisabled.cols=e,s.btnAddCell.menu.items[2].setDisabled(e),s.btnDeleteCell.menu.items[2].setDisabled(e)),e=T&&T.asc_getIsApplyAutoFilter(),this._state.controlsdisabled.cells_right!==(this._state.controlsdisabled.rows||e)&&(this._state.controlsdisabled.cells_right=this._state.controlsdisabled.rows||e,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||e)&&(this._state.controlsdisabled.cells_down=this._state.controlsdisabled.cols||e,s.btnAddCell.menu.items[1].setDisabled(this._state.controlsdisabled.cells_down),s.btnDeleteCell.menu.items[1].setDisabled(this._state.controlsdisabled.cells_down)),s.lockToolbar(SSE.enumLock.commentLock,i==Asc.c_oAscSelectionType.RangeCells&&(t.asc_getComments().length>0||t.asc_getLocked()),{array:this.btnsComment}),s.lockToolbar(SSE.enumLock.headerLock,t.asc_getLockedHeaderFooter(),{array:[this.toolbar.btnEditHeader]})}}}},onApiSelectionChanged_DiagramEditor:function(t){if(this.editMode&&!this.api.isCellEdited&&!this.api.isRangeSelection){var e=this,i=t.asc_getFlags().asc_getSelectionType();if(!function(t,i){var n=t==Asc.c_oAscSelectionType.RangeChartText,o=t==Asc.c_oAscSelectionType.RangeChart,s=t==Asc.c_oAscSelectionType.RangeShapeText,a=t==Asc.c_oAscSelectionType.RangeShape,l=t==Asc.c_oAscSelectionType.RangeImage,r=s||a||n||o,c=!1;if(!r&&!l&&e._state.selection_type===t&&e._state.coauthdisable===i)return t===Asc.c_oAscSelectionType.RangeImage;if(r){c=e.api.asc_getGraphicObjectProps().some(function(t){return t.asc_getObjectType()==Asc.c_oAscTypeSelectElement.Image&&t.asc_getObjectValue().asc_getLocked()})}var h=SSE.enumLock,d=t;switch(t){case Asc.c_oAscSelectionType.RangeImage:d=h.selImage;break;case Asc.c_oAscSelectionType.RangeShape:d=h.selShape;break;case Asc.c_oAscSelectionType.RangeShapeText:d=h.selShapeText;break;case Asc.c_oAscSelectionType.RangeChart:d=h.selChart;break;case Asc.c_oAscSelectionType.RangeChartText:d=h.selChartText}return e.toolbar.lockToolbar(d,d!=t,{clear:[h.selImage,h.selChart,h.selChartText,h.selShape,h.selShapeText,h.coAuth]}),e.toolbar.lockToolbar(SSE.enumLock.coAuthText,c),l}(i,!1)&&i!=Asc.c_oAscSelectionType.RangeChart&&i!=Asc.c_oAscSelectionType.RangeChartText){var n=t.asc_getNumFormatInfo();n&&(this._state.numformat=t.asc_getNumFormat(),this._state.numformatinfo=n,n=n.asc_getType(),this._state.numformattype!==n&&(e.toolbar.cmbNumberFormat.setValue(n,e.toolbar.txtCustom),this._state.numformattype=n))}}},onApiSelectionChanged_MailMergeEditor:function(t){if(this.editMode&&!this.api.isCellEdited&&!this.api.isRangeSelection){var e,i=this,n=t.asc_getFlags().asc_getSelectionType(),o=function(t,e){var n=t==Asc.c_oAscSelectionType.RangeChartText,o=t==Asc.c_oAscSelectionType.RangeChart,s=t==Asc.c_oAscSelectionType.RangeShapeText,a=t==Asc.c_oAscSelectionType.RangeShape,l=t==Asc.c_oAscSelectionType.RangeImage,r=s||a||n||o,c=!1;if(!r&&!l&&i._state.selection_type===t&&i._state.coauthdisable===e)return t===Asc.c_oAscSelectionType.RangeImage;if(r){c=i.api.asc_getGraphicObjectProps().some(function(t){return t.asc_getObjectType()==Asc.c_oAscTypeSelectElement.Image&&t.asc_getObjectValue().asc_getLocked()})}return i.toolbar.lockToolbar(SSE.enumLock.coAuthText,c),l}(n,!1),s=!1;if(!o&&n!=Asc.c_oAscSelectionType.RangeChart&&n!=Asc.c_oAscSelectionType.RangeChartText&&!i.toolbar.mode.isEditDiagram){var a=t.asc_getAutoFilterInfo();e=a?a.asc_getIsAutoFilter():null,this._state.filter!==e&&(i.toolbar.btnSetAutofilter.toggle(!0===e,!0),this._state.filter=e),s=this._state.controlsdisabled.filters||null===e,i.toolbar.lockToolbar(SSE.enumLock.ruleFilter,s,{array:[i.toolbar.btnSetAutofilter,i.toolbar.btnSortDown,i.toolbar.btnSortUp]}),s=this._state.controlsdisabled.filters||!a||!0!==a.asc_getIsApplyAutoFilter(),i.toolbar.lockToolbar(SSE.enumLock.ruleDelFilter,s,{array:[i.toolbar.btnClearAutofilter]})}}},onApiStyleChange:function(){this.toolbar.btnCopyStyle.toggle(!1,!0),this.modeAlwaysSetStyle=!1},updateThemeColors:function(){var t=function(t,e){if(t){for(var i,n=Common.Utils.ThemeColor.getEffectColors(),o=0;o
    ')}]})});t.toolbar.btnInsertShape.menu.addItem(o);new Common.UI.DataView({el:$("#id-toolbar-menu-shapegroup"+i),store:n.get("groupStore"),parentMenu:o.menu,showLast:!1,itemTemplate:_.template('
    ')}).on("item:click",function(e,i,n,o){t.api&&(n&&(t._addAutoshape(!0,n.get("data").shapeType),t._isAddingShape=!0),t.toolbar.btnInsertText.pressed&&t.toolbar.btnInsertText.toggle(!1,!0),"click"!==o.type&&t.toolbar.btnInsertShape.menu.hide(),Common.NotificationCenter.trigger("edit:complete",t.toolbar,t.toolbar.btnInsertShape),Common.component.Analytics.trackEvent("ToolBar","Add Shape"))})}},fillTextArt:function(){if(this.toolbar.btnInsertTextArt.rendered){var t=this;if(this.toolbar.mnuTextArtPicker){var e=this.getApplication().getCollection("Common.Collections.TextArt").models,i=this.toolbar.mnuTextArtPicker.store.length;if(i>0&&i==e.length){var n=this.toolbar.mnuTextArtPicker.store.models;_.each(e,function(t,e){n[e].set("imageUrl",t.get("imageUrl"))})}else this.toolbar.mnuTextArtPicker.store.reset(e)}else this.toolbar.mnuTextArtPicker=new Common.UI.DataView({el:$("#id-toolbar-menu-insart"),store:this.getApplication().getCollection("Common.Collections.TextArt"),parentMenu:this.toolbar.btnInsertTextArt.menu,showLast:!1,itemTemplate:_.template('
    ')}),this.toolbar.mnuTextArtPicker.on("item:click",function(e,i,n,o){n&&(t.toolbar.fireEvent("inserttextart",t.toolbar),t.api.asc_addTextArt(n.get("data"))),t.toolbar.btnInsertShape.pressed&&t.toolbar.btnInsertShape.toggle(!1,!0),"click"!==o.type&&t.toolbar.btnInsertTextArt.menu.hide(),Common.NotificationCenter.trigger("edit:complete",t.toolbar,t.toolbar.btnInsertTextArt),Common.component.Analytics.trackEvent("ToolBar","Add Text Art")})}},fillEquations:function(){if(this.toolbar.btnInsertEquation.rendered&&!(this.toolbar.btnInsertEquation.menu.items.length>0)){var t=this,e=this.getApplication().getCollection("EquationGroups");t.equationPickers=[],t.toolbar.btnInsertEquation.menu.removeAll();for(var i=0;i
    ')}]})});t.toolbar.btnInsertEquation.menu.addItem(o);var s=new Common.UI.DataView({el:$("#id-toolbar-menu-equationgroup"+i),store:n.get("groupStore"),parentMenu:o.menu,showLast:!1,itemTemplate:_.template('
    ')});n.get("groupHeight").length&&(t.equationPickers.push(s),t.toolbar.btnInsertEquation.menu.on("show:after",function(){if(t.equationPickers.length){var e=$(this.el).find(".over").find(".menu-shape");if(e.length)for(var i=0;i0||!t&&0==i.length)){var n=this.toolbar;n.$el.find(".toolbar").toggleClass("masked",t),this.toolbar.lockToolbar(SSE.enumLock.menuFileOpen,t),t?(i=$("
    ").appendTo(n.$el.find(".toolbar")),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")):(i.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(){if(this.toolbar.btnInsertFormula&&this.toolbar.btnInsertFormula.rendered)for(var t=this.toolbar.btnInsertFormula.menu.items,e=0;e-1&&e.value<6?(this.api.asc_setSelectedDrawingObjectAlign(e.value),Common.component.Analytics.trackEvent("ToolBar","Objects Align")):6==e.value?(this.api.asc_DistributeSelectedDrawingObjectHor(),Common.component.Analytics.trackEvent("ToolBar","Distribute")):7==e.value&&(this.api.asc_DistributeSelectedDrawingObjectVer(),Common.component.Analytics.trackEvent("ToolBar","Distribute"))),Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onPrintAreaClick:function(t,e){this.api&&(this.api.asc_ChangePrintArea(e.value),Common.component.Analytics.trackEvent("ToolBar","Print Area")), +Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onPrintAreaMenuOpen:function(){this.api&&this.toolbar.btnPrintArea.menu.items[2].setVisible(this.api.asc_CanAddPrintArea())},onEditHeaderClick:function(t){var e=this;if(_.isUndefined(e.fontStore)){e.fontStore=new Common.Collections.Fonts;var i=e.toolbar.cmbFontName.store.toJSON(),n=[];_.each(i,function(t,e){t.cloneid||n.push(_.clone(t))}),e.fontStore.add(n)}new SSE.Views.HeaderFooterDialog({api:e.api,fontStore:e.fontStore,handler:function(t,e){Common.NotificationCenter.trigger("edit:complete")}}).show(),Common.NotificationCenter.trigger("edit:complete",this.toolbar)},textEmptyImgUrl:"You need to specify image URL.",warnMergeLostData:"Operation can destroy data in the selected cells.
    Continue?",textWarning:"Warning",textFontSizeErr:"The entered value is incorrect.
    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.
    The text style will be displayed using one of the device fonts, the saved font will be used when it is available.
    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",textLongOperation:"Long operation",warnLongOperation:"The operation you are about to perform might take rather much time to complete.
    Are you sure you want to continue?",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:
    opening price, max price, min price, closing price.",textPivot:"Pivot Table"},SSE.Controllers.Toolbar||{}))}),define("text!spreadsheeteditor/main/app/template/StatusBar.template",[],function(){return'\r\n
    \r\n
    \r\n \r\n \r\n \r\n \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n \r\n \r\n \r\n \r\n \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n'}),void 0===Common)var Common={};define("common/main/lib/component/Tab",["common/main/lib/component/BaseView"],function(t){"use strict";var e=function(t){return this.active=!1,this.label="Tab",this.cls="",this.template=_.template(['
  • ',"<%- label %>","
  • "].join("")),this.initialize.call(this,t),this};_.extend(e.prototype,{initialize:function(t){_.extend(this,t)},render:function(){var t=this.template(this);return this.$el=$(t),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(t){this.disabled=t,this.rendered&&(t&&!this.$el.hasClass("disabled")?this.$el.addClass("disabled"):this.$el.removeClass("disabled"))},addClass:function(t){t.length&&!this.$el.hasClass(t)&&this.$el.addClass(t)},removeClass:function(t){t.length&&this.$el.hasClass(t)&&this.$el.removeClass(t)},hasClass:function(t){return this.$el.hasClass(t)},setCaption:function(t){this.$el.find("> a").text(t)}}),Common.UI.Tab=e}),define("common/main/lib/component/TabBar",["common/main/lib/component/BaseView","common/main/lib/component/Tab"],function(){"use strict";var t={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)}},e=function(t){this.initialize.call(this,t)};_.extend(e.prototype,t),e.prototype.initialize=function(t){this.bar=t.bar},e.prototype.attach=function(t){t.changeState=$.proxy(function(){this.trigger("tab:change",t),this.bar.$el.find("ul > li.active").removeClass("active"),t.activate(),this.bar.trigger("tab:changed",this.bar,this.bar.tabs.indexOf(t),t)},this);var e=new function(){return{bounds:[],drag:void 0,calculateBounds:function(){var t=this,e=t.bar.tabs.length,i=t.bar.$bar.get(0).getBoundingClientRect();if(i){t.bounds=[],t.scrollLeft=t.bar.$bar.scrollLeft(),t.bar.scrollX=this.scrollLeft;for(var n=0;n0){for(t=s-1;t>=0;--t)if(e=this.bounds[t],i=.5*(e.right+e.left),a.left=0;--t)if(e=a,i=.5*(e.right+e.left),this.bounds[t].leftthis.drag.index&&t===n+1&&(o+=this.drag.tabWidth),t!==this.drag.index?(this.bar.tabs[t].$el.css("left",o+"px"),o+=this.bounds[t].width):this.drag.index===n&&(o+=this.drag.tabWidth)},setHook:function(t,e,i){function n(){if(!_.isUndefined(a.drag)){a.drag.tab.removeClass("dragged"),a.drag.tab.$el.css("z-index",""),a.bar.dragging=!1;for(var t=null,e=a.bar.tabs.length-1;e>=0;--e)(t=a.bar.tabs[e].$el)&&(t.css("top",""),t.css("position",""),t.css("left",""));_.isUndefined(a.drag.place)?(a.bar.trigger("tab:move",a.drag.index),a.bar.$bar.scrollLeft(a.scrollLeft),a.bar.scrollX=void 0):(a.bar.trigger("tab:move",a.drag.index,a.drag.place),a.bar.$bar.scrollLeft(a.scrollLeft),a.bar.scrollX=void 0),a.drag=void 0}}function o(t){if(!_.isUndefined(a.drag)){a.drag.moveX=t.clientX*Common.Utils.zoom();var e=Math.max(a.drag.moveX-a.drag.anchorX-a.tabBarLeft-a.scrollLeft,0);e=Math.min(e,a.tabBarRight-a.tabBarLeft-a.drag.tabWidth-a.scrollLeft),a.drag.tab.$el.css("left",e+"px"),a.drag.tab.$el.css("z-index","100"),a.updatePositions()}}function s(t){t.preventDefault()}var a=this;if(!_.isUndefined(e)&&!_.isUndefined(i)&&e.tabs.length>1){i.addClass("dragged");var l=e.tabs.indexOf(i),r=t.clientX*Common.Utils.zoom();a.bar=e,a.drag={tab:i,index:l},e.dragging=!0,this.calculateBounds(),this.setAbsTabs(),a.drag.moveX=r,a.drag.mouseX=r,a.drag.anchorX=r-this.bounds[l].left,a.drag.tabWidth=this.bounds[l].width,document.addEventListener("dragstart",s),$(document).on("mousemove.tabbar",o),$(document).on("mouseup.tabbar",function(t){n(),$(document).off("mouseup.tabbar"),$(document).off("mousemove.tabbar"),document.removeEventListener("dragstart",s)})}}}};t.$el.on({click:$.proxy(function(){t.disabled||t.$el.hasClass("active")||("manual"==t.control?this.bar.trigger("tab:manual",this.bar,this.bar.tabs.indexOf(t),t):t.changeState()),!t.disabled&&Common.NotificationCenter.trigger("edit:complete",this.bar)},this),dblclick:$.proxy(function(){this.trigger("tab:dblclick",this,this.tabs.indexOf(t),t)},this.bar),contextmenu:$.proxy(function(){this.trigger("tab:contextmenu",this,this.tabs.indexOf(t),t)},this.bar),mousedown:$.proxy(function(i){this.bar.options.draggable&&!_.isUndefined(e)&&3!==i.which&&(t.isLockTheDrag||e.setHook(i,this.bar,t))},this)})},e.prototype.detach=function(t){t.$el.off()},Common.UI.TabBar=Common.UI.BaseView.extend({config:{placement:"top",items:[],draggable:!1},tabs:[],template:_.template('
    ')},{template:_.template(''+t.textNewColor+"")}]});return t.mnuTabColor=function(){return{isDummy:!0,on:function(){}}}(),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:e},{caption:this.itemTabColor,menu:i}]}).on("render:after",function(e){var i=$('
    ');$("button:first-child",e.cmpEl).append(i),i.css("background-color",e.currentColor||"transparent"),t.mnuTabColor=new Common.UI.ThemeColorPalette({el:$("#id-tab-menu-color"),transparent:!0}),t.mnuTabColor.on("select",function(e,i){t.fireEvent("sheet:setcolor",[i])})}),this.tabbar.$el.append('