Merge branch 'soon' into avoid-translating-html

pull/1/head
ansuz 4 years ago
commit 6776e967e8

@ -1,3 +1,15 @@
# 4.3.1
This minor release addresses some bugs discovered after deploying and tagging 4.3.0
* We found that some browser extensions interfered with checks to determine whether a registered user was correctly logged in, which resulted in some disabled functionality. If you are running extensions that actively delete the tokens that keep you logged your session should now stay alive until you close all its active tabs, after which you will have to log back in.
* Our 4.2.0 update introduced a new internal format for spreadsheets which broke support for spreadsheet templates using the older format. This release implements a compatibility layer.
* We fixed some minor bugs in our rich text editor. Section links in the table of contents now navigate correctly. Adding a comment to a link no longer prevents clicking on that link.
* A race condition that caused poll titles to reset occasionally has been fixed.
* We've added a little bit of telemetry to tell our server when a newly registered user opens the new user guide which is automatically added to their drive. We're considering either rewriting or removing this guide, so it's helpful to be able to determine how often people actually read it.
* An error introduced in 4.3.0 was preventing the creation of new teams. It's been fixed.
* 4.3.0 temporarily broke the sheet editor for iPad users. Migrations to a new internal format that were run while the editor was in a bad state produced some invalid data that prevented sheets from loading correctly. This release improves the platforms ability to recover from bad states like this and improves its ability to detect the kind of errors we observed.
# 4.3.0 (D)
## Goals
@ -6,6 +18,15 @@ This release is a continuation of our recent efforts to stabilize the platform,
## Update notes
This release should be fairly simple for admins.
To update from 4.2.1 to 4.3.0:
1. Stop your server
2. Get the latest code with git
3. Install the latest dependencies with `bower update` and `npm i`
4. Restart your server
## Features
* We're introducing a "degraded mode" for most of our editors (all except polls and sheets). This follows reports we received that CryptPad performed poorly in settings where a relatively large number of users with *edit* rights were connected simultaneously. To alleviate this, some non-essential features will be disabled when a number of concurrent editors is reached, in order to save computing power on client devices. The user-list will stop being updated as users join and leave, users cursors will stop being displayed, and the chat will not be disabled. Sessions will enter this mode when 8 or more editors are present. This threshold can be configured via `customize/application_config.js` by setting a `degradedLimit` attribute.

@ -72,7 +72,7 @@ define([
var imprintUrl = AppConfig.imprint && (typeof(AppConfig.imprint) === "boolean" ?
'/imprint.html' : AppConfig.imprint);
Pages.versionString = "v4.3.0";
Pages.versionString = "v4.3.1";
// used for the about menu
Pages.imprintLink = AppConfig.imprint ? footLink(imprintUrl, 'imprint') : undefined;

@ -52,7 +52,7 @@ html, body {
.advisory-text {
display: inline-block;
word-break: break-all;
word-break: break-word;
padding: 5px;
//font-size: 16px;
border: 1px solid red;

@ -685,7 +685,7 @@ const handleGetHistory = function (Env, Server, seq, userId, parsed) {
// If we're asking for a specific version (lastKnownHash) but we receive an
// ENOENT, this is not a pad creation so we need to abort.
if (err && err.code === 'ENOENT' && lastKnownHash) {
if (err && err.code === 'ENOENT' && lastKnownHash) { // XXX && lastKnownHash !== -1
/*
This informs clients that the pad they're trying to load was deleted by its owner.
The user in question might be reconnecting or might have loaded the document from their cache.

2
package-lock.json generated

@ -1,6 +1,6 @@
{
"name": "cryptpad",
"version": "4.3.0",
"version": "4.3.1",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

@ -1,7 +1,7 @@
{
"name": "cryptpad",
"description": "realtime collaborative visual editor with zero knowlege server",
"version": "4.3.0",
"version": "4.3.1",
"license": "AGPL-3.0+",
"repository": {
"type": "git",

@ -496,7 +496,7 @@ define([
}
var size = Array.isArray(obj) && obj[0];
if (typeof(size) !== "number") { return; }
UI.alert(Util.getPrettySize(size, Messages));
UI.alert(getPrettySize(size));
});
});

@ -202,6 +202,24 @@ define([
}, _alert("Login block is not working (write/read/remove)"));
assert(function (cb) {
var url = '/common/onlyoffice/v4/web-apps/apps/spreadsheeteditor/main/index.html';
var expect = {
'cross-origin-resource-policy': 'cross-origin',
'cross-origin-embedder-policy': 'require-corp',
};
$.ajax(url, {
success: function (data, textStatus, xhr) {
cb(!Object.keys(expect).some(function (k) {
var response = xhr.getResponseHeader(k);
console.log(k, response);
return response !== expect[k];
}));
},
});
}, _alert("Missing HTTP headers required for XLSX export"));
var row = function (cells) {
return h('tr', cells.map(function (cell) {
return h('td', cell);

@ -2028,7 +2028,6 @@ define([
});
};
var provideFeedback = function () {
if (typeof(window.Proxy) === 'undefined') {
Feedback.send("NO_PROXIES");
@ -2065,7 +2064,6 @@ define([
if (!common.hasCSSVariables()) {
Feedback.send('NO_CSS_VARIABLES');
}
Feedback.reportScreenDimensions();
Feedback.reportLanguage();
};
@ -2486,6 +2484,9 @@ define([
data = data.returned;
}
if (data.loggedIn) {
window.CP_logged_in = true;
}
if (data.anonHash && !cfg.userHash) { LocalStore.setFSHash(data.anonHash); }
initialized = true;

@ -263,6 +263,9 @@ define([
i = i || 0;
var idx = sortCpIndex(hashes);
var lastIndex = idx[idx.length - 1 - i];
if (typeof(lastIndex) === "undefined" || !hashes[lastIndex]) {
return {};
}
var last = JSON.parse(JSON.stringify(hashes[lastIndex]));
return last;
};
@ -366,7 +369,8 @@ define([
content.hashes[i] = {
file: data.url,
hash: ev.hash,
index: ev.index
index: ev.index,
version: NEW_VERSION
};
oldHashes = JSON.parse(JSON.stringify(content.hashes));
content.locks = {};
@ -593,7 +597,13 @@ define([
if (arrayBuffer) {
var u8 = new Uint8Array(arrayBuffer);
FileCrypto.decrypt(u8, key, function (err, decrypted) {
if (err) { return void console.error(err); }
if (err) {
if (err === "DECRYPTION_ERROR") {
console.warn(err);
return void onCpError(err);
}
return void console.error(err);
}
var blob = new Blob([decrypted.content], {type: 'plain/text'});
if (cb) {
return cb(blob, getFileType());
@ -858,7 +868,7 @@ define([
var handleNewLocks = function (o, n) {
var hasNew = false;
// Check if we have at least one new lock
Object.keys(n).some(function (id) {
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) {
@ -870,7 +880,7 @@ define([
});
});
// Remove old locks
Object.keys(o).forEach(function (id) {
Object.keys(o || {}).forEach(function (id) {
if (typeof(o[id]) !== "object") { return; } // Ignore old format
Object.keys(o[id]).forEach(function (uid) {
// Removed lock
@ -1340,7 +1350,7 @@ define([
// Migration required but read-only: continue...
if (readOnly) {
setEditable(true);
getEditor().setViewModeDisconnect();
try { getEditor().asc_setRestriction(true); } catch (e) {}
} else {
// No changes after the cp: migrate now
onMigrateRdy.fire();
@ -1365,12 +1375,9 @@ define([
return;
}
if (lock) {
getEditor().setViewModeDisconnect();
} else if (readOnly) {
try {
getEditor().asc_setRestriction(true);
} catch (e) {}
if (lock || readOnly) {
try { getEditor().asc_setRestriction(true); } catch (e) {}
//getEditor().setViewModeDisconnect(); // can't be used anymore, display an OO error popup
} else {
setEditable(true);
deleteOfflineLocks();
@ -1390,7 +1397,6 @@ define([
}
}
if (isLockedModal.modal && force) {
isLockedModal.modal.closeModal();
delete isLockedModal.modal;
@ -1400,7 +1406,8 @@ define([
}
if (APP.template) {
getEditor().setViewModeDisconnect();
try { getEditor().asc_setRestriction(true); } catch (e) {}
//getEditor().setViewModeDisconnect();
UI.removeLoadingScreen();
makeCheckpoint(true);
return;
@ -1414,7 +1421,7 @@ define([
} catch (e) {}
}
if (APP.migrate && !readOnly) {
if (lock && !readOnly) {
onMigrateRdy.fire();
}
@ -1969,7 +1976,7 @@ define([
UI.removeModals();
UI.confirm(Messages.oo_uploaded, function (yes) {
try {
getEditor().setViewModeDisconnect();
getEditor().asc_setRestriction(true);
} catch (e) {}
if (!yes) { return; }
common.gotoURL();
@ -2135,7 +2142,9 @@ define([
APP.history = true;
APP.template = true;
var editor = getEditor();
if (editor) { editor.setViewModeDisconnect(); }
if (editor) {
try { getEditor().asc_setRestriction(true); } catch (e) {}
}
var content = parsed.content;
// Get checkpoint
@ -2274,7 +2283,7 @@ define([
var setHistoryMode = function (bool) {
if (bool) {
APP.history = true;
getEditor().setViewModeDisconnect();
try { getEditor().asc_setRestriction(true); } catch (e) {}
return;
}
// Cancel button: redraw from lastCp
@ -2457,6 +2466,7 @@ define([
newDoc = !content.hashes || Object.keys(content.hashes).length === 0;
} else if (!privateData.isNewFile) {
// This is an empty doc but not a new file: error
// XXX clear cache before reloading
UI.errorLoadingScreen(Messages.unableToDisplay, false, function () {
common.gotoURL('');
});
@ -2481,7 +2491,11 @@ define([
APP.onLocal();
} else {
msg = h('div.alert.alert-warning.cp-burn-after-reading', Messages.oo_sheetMigration_anonymousEditor);
if (APP.helpMenu) {
$(APP.helpMenu.menu).after(msg);
} else {
$('#cp-app-oo-editor').prepend(msg);
}
readOnly = true;
}
} else if (content && content.version <= 3) { // V2 or V3
@ -2493,7 +2507,11 @@ define([
APP.onLocal();
} else {
msg = h('div.alert.alert-warning.cp-burn-after-reading', Messages.oo_sheetMigration_anonymousEditor);
if (APP.helpMenu) {
$(APP.helpMenu.menu).after(msg);
} else {
$('#cp-app-oo-editor').prepend(msg);
}
readOnly = true;
}
}

@ -780,94 +780,95 @@ nQuotient){sGroup+=arrChinese[nQuotient]+arrChinese[1E3];isPrevZero=false}else i
true;if(nTTRemainder<=0){sResult=sGroup+sResult;if(nRemValue<=0)break;continue}var nQuotient=nTTRemainder/1E3|0;var nRemainder=nTTRemainder-nQuotient*1E3;if(0!==nQuotient){sGroup+=arrChinese[nQuotient]+arrChinese[1E3];isPrevZero=false}else if(nTTQuotient>0){sGroup+=arrChinese[0];isPrevZero=true}if(nRemainder<=0){sResult=sGroup+sResult;if(nRemValue<=0)break;continue}nQuotient=nRemainder/100|0;nRemainder=nRemainder-nQuotient*100;if(0!==nQuotient){sGroup+=arrChinese[nQuotient]+arrChinese[100];isPrevZero=
false}else if(!isPrevZero){sGroup+=arrChinese[0];isPrevZero=true}if(nRemainder<=0){sResult=sGroup+sResult;if(nRemValue<=0)break;continue}nQuotient=nRemainder/10|0;nRemainder=nRemainder-nQuotient*10;if(0!==nQuotient){sGroup+=arrChinese[nQuotient]+arrChinese[10];isPrevZero=false}else if(!isPrevZero){sGroup+=arrChinese[0];isPrevZero=true}if(0!==nRemainder)sGroup+=arrChinese[nRemainder];sResult=sGroup+sResult;if(nRemValue<=0)break}break}}return sResult}var c_oAscSpaces=[];c_oAscSpaces[10]=1;c_oAscSpaces[32]=
1;c_oAscSpaces[8194]=1;c_oAscSpaces[8195]=1;c_oAscSpaces[8197]=1;c_oAscSpaces[12288]=1;function IsSpace(nUnicode){return!!c_oAscSpaces[nUnicode]}function private_IsAbbreviation(sWord){if(sWord.toUpperCase()===sWord){for(var nPos=0,nLen=sWord.length;nPos<nLen;++nPos){var nCharCode=sWord.charCodeAt(nPos);if(44032<=nCharCode&&nCharCode<=55203||4352<=nCharCode&&nCharCode<=4607||12592<=nCharCode&&nCharCode<=12687||43360<=nCharCode&&nCharCode<=43391||55216<=nCharCode&&nCharCode<=55295||19968<=nCharCode&&
nCharCode<=40959||13312<=nCharCode&&nCharCode<=19903||131072<=nCharCode&&nCharCode<=173791||173824<=nCharCode&&nCharCode<=177983||177984<=nCharCode&&nCharCode<=178207||178208<=nCharCode&&nCharCode<=183983||63744<=nCharCode&&nCharCode<=64255||194560<=nCharCode&&nCharCode<=195103)return false}return true}return false}var g_oUserColorById={},g_oUserNextColorIndex=0;function getUserColorById(userId,userName,isDark,isNumericValue){if((!userId||""===userId)&&(!userName||""===userName))return new CColor(0,
0,0,255);var res;if(g_oUserColorById.hasOwnProperty(userId))res=g_oUserColorById[userId];else if(g_oUserColorById.hasOwnProperty(userName))res=g_oUserColorById[userName];else{var nColor=Asc.c_oAscArrUserColors[g_oUserNextColorIndex%Asc.c_oAscArrUserColors.length];++g_oUserNextColorIndex;res=g_oUserColorById[userId||userName]=new CUserCacheColor(nColor)}if(!res)return new CColor(0,0,0,255);var oColor=true===isDark?res.Dark:res.Light;return true===isNumericValue?oColor.r<<16&16711680|oColor.g<<8&65280|
oColor.b&255:oColor}function isNullOrEmptyString(str){return str==undefined||str==null||str==""}function unleakString(s){return(" "+s).substr(1)}function readValAttr(attr){if(attr()){var val=attr()["val"];return val?val:null}return null}function getNumFromXml(val){return val?val-0:null}function getColorFromXml(attr){if(attr()){var vals=attr();if(null!=vals["theme"])return AscCommonExcel.g_oColorManager.getThemeColor(getNumFromXml(vals["theme"]),getNumFromXml(vals["tint"]));else if(null!=vals["rgb"])return new AscCommonExcel.RgbColor(16777215&
getNumFromXml(vals["rgb"]))}return null}function getBoolFromXml(val){return"0"!==val&&"false"!==val&&"off"!==val}function CUserCacheColor(nColor){this.Light=null;this.Dark=null;this.init(nColor)}CUserCacheColor.prototype.init=function(nColor){var r=nColor>>16&255;var g=nColor>>8&255;var b=nColor&255;var Y=Math.max(0,Math.min(255,.299*r+.587*g+.114*b));var Cb=Math.max(0,Math.min(255,128-.168736*r-.331264*g+.5*b));var Cr=Math.max(0,Math.min(255,128+.5*r-.418688*g-.081312*b));if(Y>63)Y=63;var R=Math.max(0,
Math.min(255,Y+1.402*(Cr-128)))|0;var G=Math.max(0,Math.min(255,Y-.34414*(Cb-128)-.71414*(Cr-128)))|0;var B=Math.max(0,Math.min(255,Y+1.772*(Cb-128)))|0;this.Light=new CColor(r,g,b,255);this.Dark=new CColor(R,G,B,255)};function loadScript(url,onSuccess,onError){if(window["NATIVE_EDITOR_ENJINE"]===true||window["Native"]!==undefined){onSuccess();return}if(window["AscDesktopEditor"]&&window["local_load_add"]){var _context={"completeLoad":function(){return onSuccess()}};window["local_load_add"](_context,
"sdk-all-from-min",url);var _ret_param=window["AscDesktopEditor"]["LoadJS"](url);if(2!=_ret_param)window["local_load_remove"](url);if(_ret_param==1){setTimeout(onSuccess,1);return}else if(_ret_param==2)return}var backoff=new AscCommon.Backoff(AscCommon.g_oBackoffDefaults);loadScriptWithBackoff(backoff,url,onSuccess,onError)}function loadScriptWithBackoff(backoff,url,onSuccess,onError){var script=document.createElement("script");script.type="text/javascript";script.src=url;script.onload=onSuccess;
script.onerror=function(){backoff.attempt(onError,function(){loadScriptWithBackoff(backoff,url,onSuccess,onError)})};document.head.appendChild(script)}function loadSdk(sdkName,onSuccess,onError){if(window["AscNotLoadAllScript"])onSuccess();else{var urlArgs=window.parent&&window.parent.APP&&window.parent.APP.urlArgs||"";loadScript("./../../../../sdkjs/"+sdkName+"/sdk-all.js?"+urlArgs,onSuccess,onError)}}function getAltGr(e){var ctrlKey=e.metaKey||e.ctrlKey;var altKey=e.altKey;return altKey&&(AscBrowser.isMacOs?
!ctrlKey:ctrlKey)}function getColorSchemeByName(sName){for(var i=0;i<AscCommon.g_oUserColorScheme.length;++i){var tmp=AscCommon.g_oUserColorScheme[i];if(tmp&&tmp.name===sName)return getColorSchemeByIdx(i)}return null}function getColorSchemeByIdx(idx){var tmp=AscCommon.g_oUserColorScheme[idx];if(tmp){var scheme=new AscFormat.ClrScheme,_c;scheme.name=tmp.name;_c=tmp.get_dk1();scheme.colors[8]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_lt1();scheme.colors[12]=AscFormat.CreateUniColorRGB(_c.r,
_c.g,_c.b);_c=tmp.get_dk2();scheme.colors[9]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_lt2();scheme.colors[13]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_accent1();scheme.colors[0]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_accent2();scheme.colors[1]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_accent3();scheme.colors[2]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_accent4();scheme.colors[3]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_accent5();
scheme.colors[4]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_accent6();scheme.colors[5]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_hlink();scheme.colors[11]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_folHlink();scheme.colors[10]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);return scheme}return null}function getAscColorScheme(_scheme,theme){var elem,_c;var _rgba={R:0,G:0,B:0,A:255};elem=new AscCommon.CAscColorScheme;elem.scheme=_scheme;elem.name=_scheme.name;_scheme.colors[8].Calculate(theme,
null,null,null,_rgba);_c=_scheme.colors[8].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[12].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[12].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[9].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[9].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[13].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[13].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));
_scheme.colors[0].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[0].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[1].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[1].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[2].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[2].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[3].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[3].RGBA;elem.putColor(new AscCommon.CColor(_c.R,
_c.G,_c.B));_scheme.colors[4].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[4].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[5].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[5].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[11].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[11].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[10].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[10].RGBA;elem.putColor(new AscCommon.CColor(_c.R,
_c.G,_c.B));return elem}function getIndexColorSchemeInArray(result,asc_color_scheme){for(var j=0;j<result.length;++j)if(result[j].isEqual(asc_color_scheme))return j;return-1}function checkAddColorScheme(result,asc_color_scheme,nStartIndex){var nIndex=getIndexColorSchemeInArray(result,asc_color_scheme);if(nIndex>-1)return nIndex;var nStartIndex_=nStartIndex;if(nStartIndex===null)nStartIndex_=result.length;result.splice(nStartIndex_,0,asc_color_scheme);return nStartIndex_}function isEastAsianScript(value){return 12544<=
value&&value<=12591||12704<=value&&value<=12735||19968<=value&&value<=40938||13312<=value&&value<=19893||131072<=value&&value<=173782||173824<=value&&value<=177972||177984<=value&&value<=178205||178208<=value&&value<=183969||183984<=value&&value<=191456||63744<=value&&value<=64255||194560<=value&&value<=195103||12032<=value&&value<=12255||11904<=value&&value<=12031||12736<=value&&value<=12783||12272<=value&&value<=12287||4352<=value&&value<=4607||43360<=value&&value<=43391||55216<=value&&value<=55295||
12592<=value&&value<=12687||65280<=value&&value<=65519||44032<=value&&value<=55215||12352<=value&&value<=12447||110848<=value&&value<=110895||110592<=value&&value<=110847||12688<=value&&value<=12703||12448<=value&&value<=12543||12784<=value&&value<=12799||42192<=value&&value<=42239||93952<=value&&value<=94111||110960<=value&&value<=111359||94208<=value&&value<=100332||100352<=value&&value<=101119||40960<=value&&value<=42127||42128<=value&&value<=42191}var g_oIdCounter=new CIdCounter;window.Asc.g_signature_drawer=
null;function CSignatureDrawer(id,api,w,h){window.Asc.g_signature_drawer=this;this.Api=api;this.CanvasParent=document.getElementById(id);this.Canvas=document.createElement("canvas");this.Canvas.style.position="absolute";this.Canvas.style.left="0px";this.Canvas.style.top="0px";var _width=parseInt(this.CanvasParent.offsetWidth);var _height=parseInt(this.CanvasParent.offsetHeight);if(0==_width)_width=300;if(0==_height)_height=80;this.Canvas.width=_width;this.Canvas.height=_height;this.CanvasParent.appendChild(this.Canvas);
this.Image="";this.ImageHtml=null;this.Text="";this.Font="Arial";this.Size=10;this.Italic=true;this.Bold=false;this.Width=w;this.Height=h;this.CanvasReturn=null;this.IsAsync=false}CSignatureDrawer.prototype.getCanvas=function(){return this.CanvasReturn==null?this.Canvas:this.CanvasReturn};CSignatureDrawer.prototype.getImages=function(){if(!this.isValid())return["",""];this.CanvasReturn=document.createElement("canvas");this.CanvasReturn.width=this.Width*AscCommon.g_dKoef_mm_to_pix;this.CanvasReturn.height=
this.Height*AscCommon.g_dKoef_mm_to_pix;if(this.Text!="")this.drawText();else this.drawImage();var _ret=[];_ret.push(this.CanvasReturn.toDataURL("image/png"));var _ctx=this.CanvasReturn.getContext("2d");_ctx.strokeStyle="#FF0000";_ctx.lineWidth=2;_ctx.moveTo(0,0);_ctx.lineTo(this.CanvasReturn.width,this.CanvasReturn.height);_ctx.moveTo(0,this.CanvasReturn.height);_ctx.lineTo(this.CanvasReturn.width,0);_ctx.stroke();_ret.push(this.CanvasReturn.toDataURL("image/png"));this.CanvasReturn=null;return _ret};
CSignatureDrawer.prototype.setText=function(text,font,size,isItalic,isBold){if(this.IsAsync){this.Text=text;return}this.Image="";this.ImageHtml=null;this.Text=text;this.Font=font;this.Size=size;this.Italic=isItalic;this.Bold=isBold;this.IsAsync=true;AscFonts.FontPickerByCharacter.checkText(this.Text,this,function(){this.IsAsync=false;var loader=AscCommon.g_font_loader;var fontinfo=AscFonts.g_fontApplication.GetFontInfo(font);var isasync=loader.LoadFont(fontinfo,function(){window.Asc.g_signature_drawer.Api.sync_EndAction(Asc.c_oAscAsyncActionType.Information,
Asc.c_oAscAsyncAction.LoadFont);window.Asc.g_signature_drawer.drawText()});if(false===isasync)this.drawText()})};CSignatureDrawer.prototype.drawText=function(){var _oldTurn=this.Api.isViewMode;var _oldMarks=this.Api.ShowParaMarks;this.Api.isViewMode=true;this.Api.ShowParaMarks=false;AscFormat.ExecuteNoHistory(AscCommon.DrawTextByCenter,this,[]);this.Api.isViewMode=_oldTurn;this.Api.ShowParaMarks=_oldMarks};CSignatureDrawer.prototype.drawImage=function(){var _canvas=this.getCanvas();var w=_canvas.width;
var h=_canvas.height;var _ctx=_canvas.getContext("2d");_ctx.clearRect(0,0,w,h);var im_w=this.ImageHtml.width;var im_h=this.ImageHtml.height;var _x=0;var _y=0;var _w=0;var _h=0;var koef1=w/h;var koef2=im_w/im_h;if(koef1>koef2){_h=h;_w=koef2*_h>>0;_y=0;_x=w-_w>>1}else{_w=w;_h=_w/koef2>>0;_x=0;_y=h-_h>>1}_ctx.drawImage(this.ImageHtml,_x,_y,_w,_h)};CSignatureDrawer.prototype.selectImage=CSignatureDrawer.prototype["selectImage"]=function(){this.Text="";window["AscDesktopEditor"]["OpenFilenameDialog"]("images",
false,function(_file){var file=_file;if(Array.isArray(file))file=file[0];if(!file)return;var _drawer=window.Asc.g_signature_drawer;_drawer.Image=window["AscDesktopEditor"]["GetImageBase64"](file);_drawer.ImageHtml=new Image;_drawer.ImageHtml.onload=function(){window.Asc.g_signature_drawer.drawImage()};_drawer.ImageHtml.src=_drawer.Image;_drawer=null})};CSignatureDrawer.prototype.isValid=function(){return this.Image!=""||this.Text!=""};CSignatureDrawer.prototype.destroy=function(){window.Asc.g_signature_drawer.CanvasParent.removeChild(this.Canvas);
delete window.Asc.g_signature_drawer};function CSignatureImage(){this.ImageValidBase64="";this.ImageInvalidBase64="";this.ImageValid=null;this.ImageInvalid=null;this.Valid=false;this.Loading=0;this.Remove=function(){this.ImageValidBase64="";this.ImageInvalidBase64="";this.ImageValid=null;this.ImageInvalid=null;this.Valid=false;this.Loading=0};this.Register=function(_api,_guid){if(_api.ImageLoader.map_image_index[_guid])return;var _obj={Image:this.Valid?this.ImageValid:this.ImageInvalid,Status:AscFonts.ImageLoadStatus.Complete,
src:_guid};_api.ImageLoader.map_image_index[_guid]=_obj};this.Unregister=function(_api,_guid){if(_api.ImageLoader.map_image_index[_guid])delete _api.ImageLoader.map_image_index[_guid]}}function CShortcuts(){this.List={};this.CustomCounter=0;this.CustomActions={}}CShortcuts.prototype.Add=function(nType,nCode,isCtrl,isShift,isAlt){this.List[this.private_GetIndex(nCode,isCtrl,isShift,isAlt)]=nType};CShortcuts.prototype.Get=function(nCode,isCtrl,isShift,isAlt){var nType=this.List[this.private_GetIndex(nCode,
isCtrl,isShift,isAlt)];return undefined!==nType?nType:0};CShortcuts.prototype.private_GetIndex=function(nCode,isCtrl,isShift,isAlt){return nCode<<8|(isCtrl?4:0)|(isShift?2:0)|(isAlt?1:0)};CShortcuts.prototype.CheckType=function(nType){for(var nIndex in this.List)if(this.List[nIndex]===nType)return{KeyCode:nIndex>>>8,CtrlKey:!!(nIndex&4),ShiftKey:!!(nIndex&2),AltKey:!!(nIndex&1)};return null};CShortcuts.prototype.Remove=function(nCode,isCtrl,isShift,isAlt){delete this.List[this.private_GetIndex(nCode,
isCtrl,isShift,isAlt)]};CShortcuts.prototype.RemoveByType=function(nType){for(var nIndex in this.List)if(this.List[nIndex]===nType)delete this.List[nIndex]};CShortcuts.prototype.GetNewCustomType=function(){return 16711680|this.CustomCounter++};CShortcuts.prototype.IsCustomType=function(nType){return nType>=16711680};CShortcuts.prototype.GetCustomAction=function(nType){return this.CustomActions[nType]};CShortcuts.prototype.AddCustomActionSymbol=function(nCharCode,sFont){var nType=this.GetNewCustomType();
this.CustomActions[nType]=new CCustomShortcutActionSymbol(nCharCode,sFont);return nType};function CCustomShortcutActionSymbol(nCharCode,sFont){this.CharCode=nCharCode;this.Font=sFont}CCustomShortcutActionSymbol.prototype.Type=AscCommon.c_oAscCustomShortcutType.Symbol;AscCommon.EncryptionMessageType={Encrypt:0,Decrypt:1};function CEncryptionData(){this._init=false;this.arrData=[];this.arrImages=[];this.handleChangesCallback=null;this.isChangesHandled=false;this.cryptoMode=0;this.isChartEditor=false;
this.isExistDecryptedChanges=false;this.cryptoPrefix=window["AscDesktopEditor"]&&window["AscDesktopEditor"]["GetEncryptedHeader"]?window["AscDesktopEditor"]["GetEncryptedHeader"]():"ENCRYPTED;";this.cryptoPrefixLen=this.cryptoPrefix.length;this.editorId=null;this.nextChangesTimeoutId=-1;this.isPasswordCryptoPresent=false;this.init=function(){this._init=true};this.isInit=function(){return this._init};this.isNeedCrypt=function(){if(window.g_asc_plugins)if(!window.g_asc_plugins.isRunnedEncryption())return false;
if(!window["AscDesktopEditor"])return false;if(this.isChartEditor)return false;if(2==this.cryptoMode)return true;if(0===window["AscDesktopEditor"]["CryptoMode"])return false;return true};this.isCryptoImages=function(){return this.isNeedCrypt()&&this.isPasswordCryptoPresent};this.addCryproImagesFromDialog=function(callback){var _this=this;window["AscDesktopEditor"]["OpenFilenameDialog"]("images",true,function(files){if(!files)return;if(!Array.isArray(files))files=[files];if(0===files.length)return;
var _files=[];var _options={isImageCrypt:true,callback:callback,ext:[]};for(var i=0;i<files.length;i++){_files.push(window["AscDesktopEditor"]["GetImageBase64"](files[i],true));_options.ext.push(AscCommon.GetFileExtension(files[i]))}_this.sendChanges(this,_files,AscCommon.EncryptionMessageType.Encrypt,_options)})};this.addCryproImagesFromUrls=function(urls,callback){var _editor=window["Asc"]["editor"]?window["Asc"]["editor"]:window.editor;_editor.sync_StartAction(Asc.c_oAscAsyncActionType.BlockInteraction,
Asc.c_oAscAsyncAction.LoadImage);var _this=this;window["AscDesktopEditor"]["DownloadFiles"](urls,[],function(files){_editor.sync_EndAction(Asc.c_oAscAsyncActionType.BlockInteraction,Asc.c_oAscAsyncAction.LoadImage);_editor.sync_StartAction(Asc.c_oAscAsyncActionType.BlockInteraction,Asc.c_oAscAsyncAction.UploadImage);var _files=[];var _options={isImageCrypt:true,isUrls:true,callback:callback,ext:[],api:_editor};for(var elem in files){_files.push(window["AscDesktopEditor"]["GetImageBase64"](files[elem],
true));_options.ext.push(window["AscDesktopEditor"]["GetImageFormat"](files[elem]));window["AscDesktopEditor"]["RemoveFile"](files[elem])}_this.sendChanges(this,_files,AscCommon.EncryptionMessageType.Encrypt,_options)})};this.onDecodeError=function(){var _editor=window["Asc"]["editor"]?window["Asc"]["editor"]:window.editor;_editor.sendEvent("asc_onError",Asc.c_oAscError.ID.DataEncrypted,Asc.c_oAscError.Level.Critical)};this.checkEditorId=function(){if(null==this.editorId){var _editor=window["Asc"]["editor"]?
window["Asc"]["editor"]:window.editor;this.editorId=_editor.editorId}};this.decryptImage=function(src,img,data){this.sendChanges(this,[data],AscCommon.EncryptionMessageType.Decrypt,{isImageDecrypt:true,src:src,img:img})};this.nextChanges=function(){this.nextChangesTimeoutId=setTimeout(function(){AscCommon.EncryptionWorker.sendChanges(undefined,undefined);this.nextChangesTimeoutId=-1},10)};this.sendChanges=function(sender,data,type,options){if(!this.isNeedCrypt()){if(AscCommon.EncryptionMessageType.Encrypt==
type)sender._send(data,true);else if(AscCommon.EncryptionMessageType.Decrypt==type){if(this.isExistEncryptedChanges(data["changes"])){this.onDecodeError();return}sender._onSaveChanges(data,true)}return}if(undefined!==type)this.arrData.push({sender:sender,type:type,data:data,options:options});if(this.arrData.length==0)return;if(undefined!==type&&(1!=this.arrData.length||!this.isChangesHandled))return;if(undefined!==type&&-1!=this.nextChangesTimeoutId){clearTimeout(this.nextChangesTimeoutId);this.nextChangesTimeoutId=
-1}if(AscCommon.EncryptionMessageType.Encrypt==this.arrData[0].type)if(this.arrData[0].options&&this.arrData[0].options.isImageCrypt)window.g_asc_plugins.sendToEncryption({"type":"encryptData","data":this.arrData[0].data});else window.g_asc_plugins.sendToEncryption({"type":"encryptData","data":JSON.parse(this.arrData[0].data["changes"])});else if(AscCommon.EncryptionMessageType.Decrypt==this.arrData[0].type)if(this.arrData[0].options&&this.arrData[0].options.isImageDecrypt)window.g_asc_plugins.sendToEncryption({"type":"decryptData",
"data":this.arrData[0].data});else window.g_asc_plugins.sendToEncryption({"type":"decryptData","data":this.arrData[0].data["changes"]})};this.receiveChanges=function(obj){var data=obj["data"];var check=obj["check"];if(!check){this.onDecodeError();return}if(this.handleChangesCallback){this.isExistDecryptedChanges=true;this.checkEditorId();if(this.editorId==AscCommon.c_oEditorId.Spreadsheet)for(var i=data.length-1;i>=0;i--)this.handleChangesCallback.changesBase[i]=data[i];else for(var i=data.length-
1;i>=0;i--)this.handleChangesCallback.changesBase[i].m_pData=data[i];this.isChangesHandled=true;this.handleChangesCallback.callback.call(this.handleChangesCallback.sender);this.handleChangesCallback=null;this.nextChanges();return}var obj=this.arrData[0];this.arrData.splice(0,1);if(AscCommon.EncryptionMessageType.Encrypt==obj.type)if(obj.options&&obj.options.isImageCrypt){for(var i=0;i<data.length;i++)if(this.cryptoPrefix==data[i].substr(0,this.cryptoPrefixLen))data[i]=this.cryptoPrefix+obj.options.ext[i]+
";"+data[i].substr(this.cryptoPrefixLen);if(!obj.options.isUrls)obj.options.callback(Asc.c_oAscError.ID.No,data);else AscCommon.UploadImageUrls(data,obj.options.api.documentId,obj.options.api.documentUserId,obj.options.api.CoAuthoringApi.get_jwt(),function(urls){obj.options.api.sync_EndAction(Asc.c_oAscAsyncActionType.BlockInteraction,Asc.c_oAscAsyncAction.UploadImage);obj.options.callback(urls)})}else{obj.data["changes"]=JSON.stringify(data);obj.sender._send(obj.data,true)}else if(AscCommon.EncryptionMessageType.Decrypt==
obj.type)if(obj.options&&obj.options.isImageDecrypt){window["AscDesktopEditor"]["ResaveFile"](obj.options.src,data[0]);obj.options.img["onload_crypto"](obj.options.src)}else{this.isExistDecryptedChanges=true;obj.data["changes"]=data;obj.sender._onSaveChanges(obj.data,true)}this.nextChanges()};this.isExistEncryptedChanges=function(_array){if(0==_array.length)return false;this.checkEditorId();var isChangesMode=_array[0]["change"]?true:false;var _prefix="";var _checkPrefixLen=this.cryptoPrefixLen+1;
if(isChangesMode){for(var i=_array.length-1;i>=0;i--)if(_array[i]["change"].length>_checkPrefixLen){_prefix=_array[i]["change"].substr(0,_checkPrefixLen);if(-1!=_prefix.indexOf(this.cryptoPrefix)){isCrypted=true;break}}return isCrypted}var isCrypted=false;if(this.editorId==AscCommon.c_oEditorId.Spreadsheet)for(var i=_array.length-1;i>=0;i--){if(_array[i].length>_checkPrefixLen){_prefix=_array[i].substr(0,_checkPrefixLen);if(-1!=_prefix.indexOf(this.cryptoPrefix)){isCrypted=true;break}}}else for(var i=
_array.length-1;i>=0;i--)if(_array[i].m_pData.length>_checkPrefixLen){_prefix=_array[i].m_pData.substr(0,_checkPrefixLen);if(-1!=_prefix.indexOf(this.cryptoPrefix)){isCrypted=true;break}}return isCrypted};this.handleChanges=function(_array,_sender,_callback){if(0==_array.length||!this.isNeedCrypt()){if(this.isExistEncryptedChanges(_array)){this.onDecodeError();return}this.isChangesHandled=true;_callback.call(_sender);return}this.handleChangesCallback={changesBase:_array,changes:[],sender:_sender,
callback:_callback};this.checkEditorId();if(this.editorId==AscCommon.c_oEditorId.Spreadsheet)for(var i=_array.length-1;i>=0;i--)this.handleChangesCallback.changes[i]=_array[i];else for(var i=_array.length-1;i>=0;i--)this.handleChangesCallback.changes[i]=_array[i].m_pData;window.g_asc_plugins.sendToEncryption({"type":"decryptData","data":this.handleChangesCallback.changes})};this.asc_setAdvancedOptions=function(api,idOption,option){if(window.isNativeOpenPassword){window["AscDesktopEditor"]["NativeViewerOpen"](option.asc_getPassword());
return}if(window.isCloudCryptoDownloadAs)return false;if(!this.isNeedCrypt())return false;window.checkPasswordFromPlugin=true;if(window["Asc"].c_oAscAdvancedOptionsID.TXT===idOption){var _param="<m_nCsvTxtEncoding>"+option.asc_getCodePage()+"</m_nCsvTxtEncoding>";window["AscDesktopEditor"]["SetAdvancedOptions"](_param)}else if(window["Asc"].c_oAscAdvancedOptionsID.CSV===idOption){var delimiter=option.asc_getDelimiter();var delimiterChar=option.asc_getDelimiterChar();var _param="";_param+="<m_nCsvTxtEncoding>"+
option.asc_getCodePage()+"</m_nCsvTxtEncoding>";if(null!=delimiter)_param+="<m_nCsvDelimiter>"+delimiter+"</m_nCsvDelimiter>";if(null!=delimiterChar)_param+="<m_nCsvDelimiterChar>"+delimiterChar+"</m_nCsvDelimiterChar>";window["AscDesktopEditor"]["SetAdvancedOptions"](_param)}else if(window["Asc"].c_oAscAdvancedOptionsID.DRM===idOption){var _param="<m_sPassword>"+AscCommon.CopyPasteCorrectString(option.asc_getPassword())+"</m_sPassword>";api.currentPassword=option.asc_getPassword();window["AscDesktopEditor"]["SetAdvancedOptions"](_param)}return true}}
AscCommon.EncryptionWorker=new CEncryptionData;function CMouseSmoothWheelCorrector(t,scrollFunction){this._deltaX=0;this._deltaY=0;this._isBreakX=false;this._isBreakY=false;this._timeoutCorrector=-1;this._api=t;this._scrollFunction=scrollFunction;this._normalDelta=120;this._isNormalDeltaActive=false;this.setNormalDeltaActive=function(value){this._isNormalDeltaActive=true;this._normalDelta=value};this.isBreakX=function(){return this._isBreakX};this.isBreakY=function(){return this._isBreakY};this.get_DeltaX=
function(wheelDeltaX){this._isBreakX=false;if(!AscCommon.AscBrowser.isMacOs)return wheelDeltaX;this._deltaX+=wheelDeltaX;if(Math.abs(this._deltaX)>=this._normalDelta)return this._isNormalDeltaActive?this._deltaX>0?this._normalDelta:-this._normalDelta:this._deltaX;this._isBreakX=true;return 0};this.get_DeltaY=function(wheelDeltaY){this._isBreakY=false;if(!AscCommon.AscBrowser.isMacOs)return wheelDeltaY;this._deltaY+=wheelDeltaY;if(Math.abs(this._deltaY)>=this._normalDelta)return this._isNormalDeltaActive?
this._deltaY>0?this._normalDelta:-this._normalDelta:this._deltaY;this._isBreakY=true;return 0};this.checkBreak=function(){if(-1!=this._timeoutCorrector){clearTimeout(this._timeoutCorrector);this._timeoutCorrector=-1}if((this._isBreakX||this._isBreakY)&&this._scrollFunction){var obj={t:this,x:this._isBreakX?this._deltaX:0,y:this._isBreakY?this._deltaY:0};this._timeoutCorrector=setTimeout(function(){var t=obj.t;t._scrollFunction.call(t._api,obj.x,obj.y);t._timeoutCorrector=-1;t._deltaX=0;t._deltaY=
0},100)}if(!this._isBreakX)this._deltaX=0;if(!this._isBreakY)this._deltaY=0;this._isBreakX=false;this._isBreakY=false}}AscCommon.CMouseSmoothWheelCorrector=CMouseSmoothWheelCorrector;function CTranslateManager(){this.mapTranslate={}}CTranslateManager.prototype.init=function(map){this.mapTranslate=map||{}};CTranslateManager.prototype.getValue=function(key){return this.mapTranslate.hasOwnProperty(key)?this.mapTranslate[key]:key};function CPolygonPoint2(X,Y){this.X=X;this.Y=Y}function CPolygonVectors(){this.Page=
-1;this.VX=[];this.VY=[]}function CPolygonPath(precision){this.Page=-1;this.Direction=1;this.precision=precision;this.Points=[]}CPolygonPath.prototype.PushPoint=function(x,y){this.Points.push(new CPolygonPoint2(x/this.precision,y/this.precision))};CPolygonPath.prototype.CorrectExtremePoints=function(){var Lng=this.Points.length;this.Points[0].X=this.Points[Lng-1].X;this.Points[Lng-1].Y=this.Points[0].Y};function CPolygon(){this.Vectors=[];this.precision=1E3}CPolygon.prototype.fill=function(arrBounds){this.Vectors.length=
0;if(arrBounds.length<=0)return;var nStartLineIndex=0,nStartIndex=0,CountLines=arrBounds.length,CountBounds;while(nStartLineIndex<arrBounds.length){CountBounds=arrBounds[nStartLineIndex].length;while(nStartIndex<CountBounds)if(arrBounds[nStartLineIndex][nStartIndex].W<.001)nStartIndex++;else break;if(nStartIndex<CountBounds)break;nStartLineIndex++;nStartIndex=0}if(nStartLineIndex>=arrBounds.length)return;var CurrentPage=arrBounds[nStartLineIndex][nStartIndex].Page,CurrentVectors=new CPolygonVectors,
VectorsX=CurrentVectors.VX,VectorsY=CurrentVectors.VY;CurrentVectors.Page=CurrentPage;this.Vectors.push(CurrentVectors);for(var LineIndex=nStartLineIndex;LineIndex<CountLines;nStartIndex=0,LineIndex++){if(arrBounds[LineIndex][nStartIndex].Page!==CurrentPage){CurrentPage=arrBounds[LineIndex][nStartIndex].Page;CurrentVectors=new CPolygonVectors;VectorsX=CurrentVectors.VX;VectorsY=CurrentVectors.VY;CurrentVectors.Page=CurrentPage;this.Vectors.push(CurrentVectors)}for(var Index=nStartIndex;Index<arrBounds[LineIndex].length;Index++){var oBound=
arrBounds[LineIndex][Index];if(oBound.W<.001)continue;var x1=Math.round(oBound.X*this.precision),x2=Math.round((oBound.X+oBound.W)*this.precision),y1=Math.round(oBound.Y*this.precision),y2=Math.round((oBound.Y+oBound.H)*this.precision);if(VectorsX[y1]==undefined)VectorsX[y1]={};this.IntersectionX(VectorsX,x2,x1,y1);if(VectorsY[x1]==undefined)VectorsY[x1]={};this.IntersectionY(VectorsY,y1,y2,x1);if(VectorsX[y2]==undefined)VectorsX[y2]={};this.IntersectionX(VectorsX,x1,x2,y2);if(VectorsY[x2]==undefined)VectorsY[x2]=
{};this.IntersectionY(VectorsY,y2,y1,x2)}}};CPolygon.prototype.IntersectionX=function(VectorsX,BeginX,EndX,Y){var CurrentVector={};CurrentVector[BeginX]=EndX;var VX=VectorsX[Y];if(BeginX>EndX)while(true==this.IntersectVectorX(CurrentVector,VX));else while(true==this.IntersectVectorX(VX,CurrentVector));for(var X in CurrentVector){var VBeginX=parseInt(X);var VEndX=CurrentVector[VBeginX];if(VBeginX!==VEndX||VX[VBeginX]===undefined)VX[VBeginX]=VEndX}};CPolygon.prototype.IntersectVectorX=function(VectorOpp,
VectorClW){for(var X in VectorOpp){var VBeginX=parseInt(X);var VEndX=VectorOpp[VBeginX];if(VEndX==VBeginX)continue;for(var ClwX in VectorClW){var ClwBeginX=parseInt(ClwX);var ClwEndX=VectorClW[ClwBeginX];var bIntersection=false;if(ClwBeginX==ClwEndX)continue;if(ClwBeginX<=VEndX&&VBeginX<=ClwEndX){VectorOpp[VBeginX]=VBeginX;VectorClW[ClwBeginX]=VEndX;VectorClW[VBeginX]=ClwEndX;bIntersection=true}else if(VEndX<=ClwBeginX&&ClwEndX<=VBeginX){VectorClW[ClwBeginX]=ClwBeginX;VectorOpp[VBeginX]=ClwEndX;VectorOpp[ClwBeginX]=
VEndX;bIntersection=true}else if(ClwBeginX<VEndX&&VEndX<ClwEndX){VectorClW[ClwBeginX]=VEndX;VectorOpp[VBeginX]=ClwEndX;bIntersection=true}else if(ClwBeginX<VBeginX&&VBeginX<ClwEndX){VectorOpp[ClwBeginX]=VEndX;VectorClW[VBeginX]=ClwEndX;delete VectorOpp[VBeginX];delete VectorClW[ClwBeginX];bIntersection=true}if(bIntersection==true)return true}}return false};CPolygon.prototype.IntersectionY=function(VectorsY,BeginY,EndY,X){var bIntersect=false;for(var y in VectorsY[X]){var CurBeginY=parseInt(y);var CurEndY=
VectorsY[X][CurBeginY];var minY,maxY;if(CurBeginY<CurEndY){minY=CurBeginY;maxY=CurEndY}else{minY=CurEndY;maxY=CurBeginY}var bInterSection=!(maxY<=BeginY&&maxY<=EndY||minY>=BeginY&&minY>=EndY),bDirection=(CurBeginY-CurEndY)*(BeginY-EndY)<0;if(bInterSection&&bDirection){VectorsY[X][CurBeginY]=EndY;VectorsY[X][BeginY]=CurEndY;bIntersect=true}}if(bIntersect==false)VectorsY[X][BeginY]=EndY};CPolygon.prototype.GetPaths=function(shift){var Paths=[];shift*=this.precision;for(var PageIndex=0;PageIndex<this.Vectors.length;PageIndex++){var y,
x1,x2,x,y1,y2;var VectorsX=this.Vectors[PageIndex].VX,VectorsY=this.Vectors[PageIndex].VY,Page=this.Vectors[PageIndex].Page;for(var LineIndex in VectorsX)for(var Index in VectorsX[LineIndex]){var Polygon=new CPolygonPath(this.precision);Polygon.Page=Page;y=parseInt(LineIndex);x1=parseInt(Index);x2=VectorsX[y][x1];VectorsX[y][x1]=-1;var Direction=x1>x2?1:-1;var minY=y;var SignRightLeft,SignDownUp;var X,Y;if(x2!==-1){SignRightLeft=x1>x2?1:-1;Y=y-SignRightLeft*shift;Polygon.PushPoint(x1,Y);while(true){x=
x2;y1=y;y2=VectorsY[x][y1];if(y2==-1)break;else if(y2==undefined)return[];VectorsY[x][y1]=-1;SignDownUp=y1>y2?1:-1;X=x+SignDownUp*shift;Polygon.PushPoint(X,Y);y=y2;x1=x;x2=VectorsX[y][x1];if(x2==-1)break;else if(x2==undefined)return[];VectorsX[y][x1]=-1;SignRightLeft=x1>x2?1:-1;Y=y-SignRightLeft*shift;Polygon.PushPoint(X,Y);if(y<minY){minY=y;Direction=x1>x2?1:-1}}Polygon.PushPoint(X,Y);Polygon.CorrectExtremePoints();Polygon.Direction=Direction;Paths.push(Polygon)}}}return Paths};function CMathTrack(){this.MathRect=
{IsActive:false,Bounds:[],ContentSelection:null};this.MathPolygons=[];this.MathSelectPolygons=[]}CMathTrack.prototype.Update=function(IsActive,IsContentActive,oMath,PixelError){this.MathRect.IsActive=IsActive;if(true===IsActive&&null!==oMath){var selectBounds=true===IsContentActive?oMath.Get_ContentSelection():null;if(selectBounds!=null){var SelectPolygon=new CPolygon;SelectPolygon.fill(selectBounds);this.MathSelectPolygons=SelectPolygon.GetPaths(0)}else this.MathSelectPolygons.length=0;var arrBounds=
oMath.Get_Bounds();if(arrBounds.length<=0)return;var MPolygon=new CPolygon;MPolygon.fill(arrBounds);this.MathPolygons=MPolygon.GetPaths(PixelError)}};CMathTrack.prototype.Draw=function(overlay,oPath,shift,color,dKoefX,dKoefY,left,top){var ctx=overlay.m_oContext;ctx.strokeStyle=color;ctx.lineWidth=1;ctx.beginPath();var Points=oPath.Points;var nCount=Points.length;var PrevX=Points[nCount-2].X,PrevY=Points[nCount-2].Y;var _x=left+dKoefX*Points[nCount-2].X,_y=top+dKoefY*Points[nCount-2].Y;var StartX,
StartY;for(var nIndex=0;nIndex<nCount;nIndex++){if(PrevX>Points[nIndex].X)_y=top+dKoefY*Points[nIndex].Y-shift;else if(PrevX<Points[nIndex].X)_y=top+dKoefY*Points[nIndex].Y+shift;if(PrevY<Points[nIndex].Y)_x=left+dKoefX*Points[nIndex].X-shift;else if(PrevY>Points[nIndex].Y)_x=left+dKoefX*Points[nIndex].X+shift;PrevX=Points[nIndex].X;PrevY=Points[nIndex].Y;if(nIndex>0){overlay.CheckPoint(_x,_y);if(1==nIndex){StartX=_x;StartY=_y;overlay.m_oContext.moveTo((_x>>0)+.5,(_y>>0)+.5)}else overlay.m_oContext.lineTo((_x>>
0)+.5,(_y>>0)+.5)}}overlay.m_oContext.lineTo((StartX>>0)+.5,(StartY>>0)+.5);ctx.closePath();ctx.stroke();ctx.beginPath()};CMathTrack.prototype.DrawWithMatrix=function(overlay,oPath,ShiftX,ShiftY,color,dKoefX,dKoefY,left,top,m){var ctx=overlay.m_oContext;ctx.strokeStyle=color;ctx.lineWidth=1;ctx.beginPath();var Points=oPath.Points;var nCount=Points.length;var x=Points[nCount-2].X,y=Points[nCount-2].Y;var _x,_y;var PrevX=Points[nCount-2].X,PrevY=Points[nCount-2].Y;var StartX,StartY;for(var nIndex=0;nIndex<
nCount;nIndex++){if(PrevX>Points[nIndex].X)y=Points[nIndex].Y-ShiftY;else if(PrevX<Points[nIndex].X)y=Points[nIndex].Y+ShiftY;if(PrevY<Points[nIndex].Y)x=Points[nIndex].X-ShiftX;else if(PrevY>Points[nIndex].Y)x=Points[nIndex].X+ShiftX;PrevX=Points[nIndex].X;PrevY=Points[nIndex].Y;if(nIndex>0){_x=left+dKoefX*m.TransformPointX(x,y);_y=top+dKoefY*m.TransformPointY(x,y);overlay.CheckPoint(_x,_y);if(1==nIndex){StartX=_x;StartY=_y;overlay.m_oContext.moveTo((_x>>0)+.5,(_y>>0)+.5)}else overlay.m_oContext.lineTo((_x>>
0)+.5,(_y>>0)+.5)}}overlay.m_oContext.lineTo((StartX>>0)+.5,(StartY>>0)+.5);ctx.closePath();ctx.stroke();ctx.beginPath()};CMathTrack.prototype.DrawSelectPolygon=function(overlay,oPath,dKoefX,dKoefY,left,top,m){var ctx=overlay.m_oContext;ctx.fillStyle="#375082";ctx.beginPath();var Points=oPath.Points;var nPointIndex;var _x,_y,x,y,p;for(nPointIndex=0;nPointIndex<Points.length-1;nPointIndex++){p=Points[nPointIndex];if(!m){_x=left+dKoefX*p.X;_y=top+dKoefY*p.Y}else{x=p.X;y=p.Y;_x=left+dKoefX*m.TransformPointX(x,
y);_y=top+dKoefY*m.TransformPointY(x,y)}overlay.CheckPoint(_x,_y);if(0==nPointIndex)ctx.moveTo((_x>>0)+.5,(_y>>0)+.5);else ctx.lineTo((_x>>0)+.5,(_y>>0)+.5)}ctx.globalAlpha=.2;ctx.fill();ctx.globalAlpha=1};CMathTrack.prototype.IsActive=function(){return this.MathRect.IsActive};CMathTrack.prototype.GetPolygonsCount=function(){return this.MathPolygons.length};CMathTrack.prototype.GetPolygon=function(nIndex){return this.MathPolygons[nIndex]};CMathTrack.prototype.GetSelectPathsCount=function(){return this.MathSelectPolygons.length};
CMathTrack.prototype.GetSelectPath=function(nIndex){return this.MathSelectPolygons[nIndex]};if(!Array.prototype.findIndex)Object.defineProperty(Array.prototype,"findIndex",{value:function(predicate){if(this==null)throw new TypeError("Array.prototype.findIndex called on null or undefined");if(typeof predicate!=="function")throw new TypeError("predicate must be a function");var list=Object(this);var length=list.length>>>0;var thisArg=arguments[1];var value;for(var i=0;i<length;i++){value=list[i];if(predicate.call(thisArg,
value,i,list))return i}return-1}});if(!Array.prototype.fill)Object.defineProperty(Array.prototype,"fill",{value:function(value){if(this==null)throw new TypeError("this is null or not defined");var O=Object(this);var len=O.length>>>0;var start=arguments[1];var relativeStart=start>>0;var k=relativeStart<0?Math.max(len+relativeStart,0):Math.min(relativeStart,len);var end=arguments[2];var relativeEnd=end===undefined?len:end>>0;var final=relativeEnd<0?Math.max(len+relativeEnd,0):Math.min(relativeEnd,len);
while(k<final){O[k]=value;k++}return O}});if(typeof Int8Array!=="undefined"&&!Int8Array.prototype.fill)Int8Array.prototype.fill=Array.prototype.fill;if(typeof Uint8Array!=="undefined"&&!Uint8Array.prototype.fill)Uint8Array.prototype.fill=Array.prototype.fill;if(typeof Uint8ClampedArray!=="undefined"&&!Uint8ClampedArray.prototype.fill)Uint8ClampedArray.prototype.fill=Array.prototype.fill;if(typeof Int16Array!=="undefined"&&!Int16Array.prototype.fill)Int16Array.prototype.fill=Array.prototype.fill;if(typeof Uint16Array!==
"undefined"&&!Uint16Array.prototype.fill)Uint16Array.prototype.fill=Array.prototype.fill;if(typeof Int32Array!=="undefined"&&!Int32Array.prototype.fill)Int32Array.prototype.fill=Array.prototype.fill;if(typeof Uint32Array!=="undefined"&&!Uint32Array.prototype.fill)Uint32Array.prototype.fill=Array.prototype.fill;if(typeof Float32Array!=="undefined"&&!Float32Array.prototype.fill)Float32Array.prototype.fill=Array.prototype.fill;if(typeof Float64Array!=="undefined"&&!Float64Array.prototype.fill)Float64Array.prototype.fill=
Array.prototype.fill;if(typeof Uint8Array!=="undefined"&&!Uint8Array.prototype.slice)Uint8Array.prototype.slice=Array.prototype.slice;function parseText(text,options,bTrimSpaces){var delimiterChar;if(options.asc_getDelimiterChar())delimiterChar=options.asc_getDelimiterChar();else switch(options.asc_getDelimiter()){case AscCommon.c_oAscCsvDelimiter.None:delimiterChar=undefined;break;case AscCommon.c_oAscCsvDelimiter.Tab:delimiterChar="\t";break;case AscCommon.c_oAscCsvDelimiter.Semicolon:delimiterChar=
";";break;case AscCommon.c_oAscCsvDelimiter.Colon:delimiterChar=":";break;case AscCommon.c_oAscCsvDelimiter.Comma:delimiterChar=",";break;case AscCommon.c_oAscCsvDelimiter.Space:delimiterChar=" ";break}var matrix=[];var rows=text.split(/\r?\n/);for(var i=0;i<rows.length;++i){var row=rows[i];if(" "===delimiterChar&&bTrimSpaces){var addSpace=false;if(row[0]===delimiterChar)addSpace=true;row=addSpace?delimiterChar+row.trim():row.trim()}matrix.push(row.split(delimiterChar))}return matrix}function getTimeISO8601(dateStr){if(dateStr)if(dateStr.endsWith("Z"))return Date.parse(dateStr);
else return Date.parse(dateStr+"Z");return NaN}function valueToMmType(value){var oVal=parseFloat(value);var oType;if(!isNaN(oVal)){if(-1!==value.indexOf("%")){oType="%";oVal/=100}else if(-1!==value.indexOf("px")){oType="px";oVal*=AscCommon.g_dKoef_pix_to_mm}else if(-1!==value.indexOf("in")){oType="in";oVal*=AscCommonWord.g_dKoef_in_to_mm}else if(-1!==value.indexOf("cm")){oType="cm";oVal*=10}else if(-1!==value.indexOf("mm"))oType="mm";else if(-1!==value.indexOf("pt")){oType="pt";oVal*=AscCommonWord.g_dKoef_pt_to_mm}else if(-1!==
value.indexOf("pc")){oType="pc";oVal*=AscCommonWord.g_dKoef_pc_to_mm}else oType="none";return{val:oVal,type:oType}}return null}function valueToMm(value){var obj=valueToMmType(value);if(obj&&"%"!==obj.type&&"none"!==obj.type)return obj.val;return null}function arrayMove(array,from,to){array.splice(to,0,array.splice(from,1)[0])}function getRangeArray(start,stop){var res=new Array(stop-start);for(var i=start;i<stop;++i)res[i-start]=i;return res}var g_oBackoffDefaults={retries:2,factor:2,minTimeout:100,
maxTimeout:2E3,randomize:true};function Backoff(opts){this.attempts=0;this.opts=opts}Backoff.prototype.attempt=function(fError,fRetry){var timeout=this.nextTimeout();if(timeout>0)setTimeout(function(){fRetry()},timeout);else fError()};Backoff.prototype.nextTimeout=function(){var timeout=-1;if(this.attempts<this.opts.retries){timeout=this.createTimeout(this.attempts,this.opts);this.attempts++}return timeout};Backoff.prototype.createTimeout=function(attempt,opts){var random=opts.randomize?Math.random()+
1:1;var timeout=Math.round(random*opts.minTimeout*Math.pow(opts.factor,attempt));timeout=Math.min(timeout,opts.maxTimeout);return timeout};function backoffOnError(obj,onError,onRetry){if(!onRetry)return onError;var backoff=new Backoff(g_oBackoffDefaults);return function(){var timeout=backoff.nextTimeout();if(timeout>0)setTimeout(function(){onRetry.call(obj,obj)},timeout);else if(onError)onError.apply(obj,arguments)}}function backoffOnErrorImg(img,onRetry){if(!onRetry)onRetry=function(img){img.setAttribute("src",
img.getAttribute("src"))};img.onerror=backoffOnError(img,img.onerror,onRetry)}function isEmptyObject(obj){for(var name in obj)return false;return true}window["AscCommon"]=window["AscCommon"]||{};window["AscCommon"].getSockJs=getSockJs;window["AscCommon"].getJSZipUtils=getJSZipUtils;window["AscCommon"].getJSZip=getJSZip;window["AscCommon"].getBaseUrl=getBaseUrl;window["AscCommon"].getEncodingParams=getEncodingParams;window["AscCommon"].getEncodingByBOM=getEncodingByBOM;window["AscCommon"].saveWithParts=
saveWithParts;window["AscCommon"].loadFileContent=loadFileContent;window["AscCommon"].getImageFromChanges=getImageFromChanges;window["AscCommon"].openFileCommand=openFileCommand;window["AscCommon"].sendCommand=sendCommand;window["AscCommon"].sendSaveFile=sendSaveFile;window["AscCommon"].mapAscServerErrorToAscError=mapAscServerErrorToAscError;window["AscCommon"].joinUrls=joinUrls;window["AscCommon"].getFullImageSrc2=getFullImageSrc2;window["AscCommon"].fSortAscending=fSortAscending;window["AscCommon"].fSortDescending=
fSortDescending;window["AscCommon"].isLeadingSurrogateChar=isLeadingSurrogateChar;window["AscCommon"].decodeSurrogateChar=decodeSurrogateChar;window["AscCommon"].encodeSurrogateChar=encodeSurrogateChar;window["AscCommon"].convertUnicodeToUTF16=convertUnicodeToUTF16;window["AscCommon"].convertUTF16toUnicode=convertUTF16toUnicode;window["AscCommon"].build_local_rx=build_local_rx;window["AscCommon"].GetFileName=GetFileName;window["AscCommon"].GetFileExtension=GetFileExtension;window["AscCommon"].changeFileExtention=
changeFileExtention;window["AscCommon"].getExtentionByFormat=getExtentionByFormat;window["AscCommon"].InitOnMessage=InitOnMessage;window["AscCommon"].ShowImageFileDialog=ShowImageFileDialog;window["AscCommon"].ShowDocumentFileDialog=ShowDocumentFileDialog;window["AscCommon"].InitDragAndDrop=InitDragAndDrop;window["AscCommon"].UploadImageFiles=UploadImageFiles;window["AscCommon"].UploadImageUrls=UploadImageUrls;window["AscCommon"].CanDropFiles=CanDropFiles;window["AscCommon"].getUrlType=getUrlType;
window["AscCommon"].prepareUrl=prepareUrl;window["AscCommon"].getUserColorById=getUserColorById;window["AscCommon"].isNullOrEmptyString=isNullOrEmptyString;window["AscCommon"].unleakString=unleakString;window["AscCommon"].readValAttr=readValAttr;window["AscCommon"].getNumFromXml=getNumFromXml;window["AscCommon"].getColorFromXml=getColorFromXml;window["AscCommon"].getBoolFromXml=getBoolFromXml;window["AscCommon"].initStreamFromResponse=initStreamFromResponse;window["AscCommon"].checkStreamSignature=
checkStreamSignature;window["AscCommon"].DocumentUrls=DocumentUrls;window["AscCommon"].OpenFileResult=OpenFileResult;window["AscCommon"].CLock=CLock;window["AscCommon"].CContentChanges=CContentChanges;window["AscCommon"].CContentChangesElement=CContentChangesElement;window["AscCommon"].CorrectMMToTwips=CorrectMMToTwips;window["AscCommon"].TwipsToMM=TwipsToMM;window["AscCommon"].MMToTwips=MMToTwips;window["AscCommon"].RomanToInt=RomanToInt;window["AscCommon"].LatinNumberingToInt=LatinNumberingToInt;
window["AscCommon"].IntToNumberFormat=IntToNumberFormat;window["AscCommon"].IsSpace=IsSpace;window["AscCommon"].loadSdk=loadSdk;window["AscCommon"].loadScript=loadScript;window["AscCommon"].getAltGr=getAltGr;window["AscCommon"].getColorSchemeByName=getColorSchemeByName;window["AscCommon"].getColorSchemeByIdx=getColorSchemeByIdx;window["AscCommon"].getAscColorScheme=getAscColorScheme;window["AscCommon"].checkAddColorScheme=checkAddColorScheme;window["AscCommon"].getIndexColorSchemeInArray=getIndexColorSchemeInArray;
window["AscCommon"].isEastAsianScript=isEastAsianScript;window["AscCommon"].CMathTrack=CMathTrack;window["AscCommon"].CPolygon=CPolygon;window["AscCommon"].JSZipWrapper=JSZipWrapper;window["AscCommon"].g_oDocumentUrls=g_oDocumentUrls;window["AscCommon"].FormulaTablePartInfo=FormulaTablePartInfo;window["AscCommon"].cBoolLocal=cBoolLocal;window["AscCommon"].cErrorOrigin=cErrorOrigin;window["AscCommon"].cErrorLocal=cErrorLocal;window["AscCommon"].FormulaSeparators=FormulaSeparators;window["AscCommon"].rx_space_g=
rx_space_g;window["AscCommon"].rx_space=rx_space;window["AscCommon"].rx_defName=rx_defName;window["AscCommon"].kCurFormatPainterWord=kCurFormatPainterWord;window["AscCommon"].parserHelp=parserHelp;window["AscCommon"].g_oIdCounter=g_oIdCounter;window["AscCommon"].g_oHtmlCursor=g_oHtmlCursor;window["AscCommon"].g_oBackoffDefaults=g_oBackoffDefaults;window["AscCommon"].Backoff=Backoff;window["AscCommon"].backoffOnErrorImg=backoffOnErrorImg;window["AscCommon"].isEmptyObject=isEmptyObject;window["AscCommon"].CSignatureDrawer=
window["AscCommon"]["CSignatureDrawer"]=CSignatureDrawer;var prot=CSignatureDrawer.prototype;prot["getImages"]=prot.getImages;prot["setText"]=prot.setText;prot["selectImage"]=prot.selectImage;prot["isValid"]=prot.isValid;prot["destroy"]=prot.destroy;window["AscCommon"].translateManager=new CTranslateManager;window["AscCommon"].parseText=parseText;window["AscCommon"].getTimeISO8601=getTimeISO8601;window["AscCommon"].valueToMm=valueToMm;window["AscCommon"].valueToMmType=valueToMmType;window["AscCommon"].arrayMove=
arrayMove;window["AscCommon"].getRangeArray=getRangeArray;window["AscCommon"].CUnicodeStringEmulator=CUnicodeStringEmulator;window["AscCommon"].private_IsAbbreviation=private_IsAbbreviation;window["AscCommon"].rx_test_ws_name=rx_test_ws_name;window["AscCommon"].CShortcuts=window["AscCommon"]["CShortcuts"]=CShortcuts;prot=CShortcuts.prototype;prot["Add"]=prot.Add;prot["Get"]=prot.Get;prot["CheckType"]=prot.CheckType;prot["Remove"]=prot.Remove;prot["RemoveByType"]=prot.RemoveByType;prot["GetNewCustomType"]=
prot.GetNewCustomType;prot["IsCustomType"]=prot.IsCustomType;prot["GetCustomAction"]=prot.GetCustomAction;prot["AddCustomActionSymbol"]=prot.AddCustomActionSymbol;window["AscCommon"].CCustomShortcutActionSymbol=window["AscCommon"]["CCustomShortcutActionSymbol"]=CCustomShortcutActionSymbol})(window);
nCharCode<=40959||13312<=nCharCode&&nCharCode<=19903||131072<=nCharCode&&nCharCode<=173791||173824<=nCharCode&&nCharCode<=177983||177984<=nCharCode&&nCharCode<=178207||178208<=nCharCode&&nCharCode<=183983||63744<=nCharCode&&nCharCode<=64255||194560<=nCharCode&&nCharCode<=195103)return false}return true}return false}var g_oUserColorById={},g_oUserNextColorIndex=0;function getUserColorById(userId,userName,isDark,isNumericValue){if(window.parent.APP&&window.parent.APP.getUserColor)try{var CPColor=window.parent.APP.getUserColor(userId);
if(CPColor)return true===isNumericValue?CPColor.r<<16&16711680|CPColor.g<<8&65280|CPColor.b&255:CPColor}catch(e){}if((!userId||""===userId)&&(!userName||""===userName))return new CColor(0,0,0,255);var res;if(g_oUserColorById.hasOwnProperty(userId))res=g_oUserColorById[userId];else if(g_oUserColorById.hasOwnProperty(userName))res=g_oUserColorById[userName];else{var nColor=Asc.c_oAscArrUserColors[g_oUserNextColorIndex%Asc.c_oAscArrUserColors.length];++g_oUserNextColorIndex;res=g_oUserColorById[userId||
userName]=new CUserCacheColor(nColor)}if(!res)return new CColor(0,0,0,255);var oColor=true===isDark?res.Dark:res.Light;return true===isNumericValue?oColor.r<<16&16711680|oColor.g<<8&65280|oColor.b&255:oColor}function isNullOrEmptyString(str){return str==undefined||str==null||str==""}function unleakString(s){return(" "+s).substr(1)}function readValAttr(attr){if(attr()){var val=attr()["val"];return val?val:null}return null}function getNumFromXml(val){return val?val-0:null}function getColorFromXml(attr){if(attr()){var vals=
attr();if(null!=vals["theme"])return AscCommonExcel.g_oColorManager.getThemeColor(getNumFromXml(vals["theme"]),getNumFromXml(vals["tint"]));else if(null!=vals["rgb"])return new AscCommonExcel.RgbColor(16777215&getNumFromXml(vals["rgb"]))}return null}function getBoolFromXml(val){return"0"!==val&&"false"!==val&&"off"!==val}function CUserCacheColor(nColor){this.Light=null;this.Dark=null;this.init(nColor)}CUserCacheColor.prototype.init=function(nColor){var r=nColor>>16&255;var g=nColor>>8&255;var b=nColor&
255;var Y=Math.max(0,Math.min(255,.299*r+.587*g+.114*b));var Cb=Math.max(0,Math.min(255,128-.168736*r-.331264*g+.5*b));var Cr=Math.max(0,Math.min(255,128+.5*r-.418688*g-.081312*b));if(Y>63)Y=63;var R=Math.max(0,Math.min(255,Y+1.402*(Cr-128)))|0;var G=Math.max(0,Math.min(255,Y-.34414*(Cb-128)-.71414*(Cr-128)))|0;var B=Math.max(0,Math.min(255,Y+1.772*(Cb-128)))|0;this.Light=new CColor(r,g,b,255);this.Dark=new CColor(R,G,B,255)};function loadScript(url,onSuccess,onError){if(window["NATIVE_EDITOR_ENJINE"]===
true||window["Native"]!==undefined){onSuccess();return}if(window["AscDesktopEditor"]&&window["local_load_add"]){var _context={"completeLoad":function(){return onSuccess()}};window["local_load_add"](_context,"sdk-all-from-min",url);var _ret_param=window["AscDesktopEditor"]["LoadJS"](url);if(2!=_ret_param)window["local_load_remove"](url);if(_ret_param==1){setTimeout(onSuccess,1);return}else if(_ret_param==2)return}var backoff=new AscCommon.Backoff(AscCommon.g_oBackoffDefaults);loadScriptWithBackoff(backoff,
url,onSuccess,onError)}function loadScriptWithBackoff(backoff,url,onSuccess,onError){var script=document.createElement("script");script.type="text/javascript";script.src=url;script.onload=onSuccess;script.onerror=function(){backoff.attempt(onError,function(){loadScriptWithBackoff(backoff,url,onSuccess,onError)})};document.head.appendChild(script)}function loadSdk(sdkName,onSuccess,onError){if(window["AscNotLoadAllScript"])onSuccess();else{var urlArgs=window.parent&&window.parent.APP&&window.parent.APP.urlArgs||
"";loadScript("./../../../../sdkjs/"+sdkName+"/sdk-all.js?"+urlArgs,onSuccess,onError)}}function getAltGr(e){var ctrlKey=e.metaKey||e.ctrlKey;var altKey=e.altKey;return altKey&&(AscBrowser.isMacOs?!ctrlKey:ctrlKey)}function getColorSchemeByName(sName){for(var i=0;i<AscCommon.g_oUserColorScheme.length;++i){var tmp=AscCommon.g_oUserColorScheme[i];if(tmp&&tmp.name===sName)return getColorSchemeByIdx(i)}return null}function getColorSchemeByIdx(idx){var tmp=AscCommon.g_oUserColorScheme[idx];if(tmp){var scheme=
new AscFormat.ClrScheme,_c;scheme.name=tmp.name;_c=tmp.get_dk1();scheme.colors[8]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_lt1();scheme.colors[12]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_dk2();scheme.colors[9]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_lt2();scheme.colors[13]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_accent1();scheme.colors[0]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_accent2();scheme.colors[1]=AscFormat.CreateUniColorRGB(_c.r,
_c.g,_c.b);_c=tmp.get_accent3();scheme.colors[2]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_accent4();scheme.colors[3]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_accent5();scheme.colors[4]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_accent6();scheme.colors[5]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_hlink();scheme.colors[11]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_folHlink();scheme.colors[10]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);
return scheme}return null}function getAscColorScheme(_scheme,theme){var elem,_c;var _rgba={R:0,G:0,B:0,A:255};elem=new AscCommon.CAscColorScheme;elem.scheme=_scheme;elem.name=_scheme.name;_scheme.colors[8].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[8].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[12].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[12].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[9].Calculate(theme,null,null,
null,_rgba);_c=_scheme.colors[9].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[13].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[13].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[0].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[0].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[1].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[1].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[2].Calculate(theme,
null,null,null,_rgba);_c=_scheme.colors[2].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[3].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[3].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[4].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[4].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[5].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[5].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));
_scheme.colors[11].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[11].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[10].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[10].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));return elem}function getIndexColorSchemeInArray(result,asc_color_scheme){for(var j=0;j<result.length;++j)if(result[j].isEqual(asc_color_scheme))return j;return-1}function checkAddColorScheme(result,asc_color_scheme,nStartIndex){var nIndex=
getIndexColorSchemeInArray(result,asc_color_scheme);if(nIndex>-1)return nIndex;var nStartIndex_=nStartIndex;if(nStartIndex===null)nStartIndex_=result.length;result.splice(nStartIndex_,0,asc_color_scheme);return nStartIndex_}function isEastAsianScript(value){return 12544<=value&&value<=12591||12704<=value&&value<=12735||19968<=value&&value<=40938||13312<=value&&value<=19893||131072<=value&&value<=173782||173824<=value&&value<=177972||177984<=value&&value<=178205||178208<=value&&value<=183969||183984<=
value&&value<=191456||63744<=value&&value<=64255||194560<=value&&value<=195103||12032<=value&&value<=12255||11904<=value&&value<=12031||12736<=value&&value<=12783||12272<=value&&value<=12287||4352<=value&&value<=4607||43360<=value&&value<=43391||55216<=value&&value<=55295||12592<=value&&value<=12687||65280<=value&&value<=65519||44032<=value&&value<=55215||12352<=value&&value<=12447||110848<=value&&value<=110895||110592<=value&&value<=110847||12688<=value&&value<=12703||12448<=value&&value<=12543||
12784<=value&&value<=12799||42192<=value&&value<=42239||93952<=value&&value<=94111||110960<=value&&value<=111359||94208<=value&&value<=100332||100352<=value&&value<=101119||40960<=value&&value<=42127||42128<=value&&value<=42191}var g_oIdCounter=new CIdCounter;window.Asc.g_signature_drawer=null;function CSignatureDrawer(id,api,w,h){window.Asc.g_signature_drawer=this;this.Api=api;this.CanvasParent=document.getElementById(id);this.Canvas=document.createElement("canvas");this.Canvas.style.position="absolute";
this.Canvas.style.left="0px";this.Canvas.style.top="0px";var _width=parseInt(this.CanvasParent.offsetWidth);var _height=parseInt(this.CanvasParent.offsetHeight);if(0==_width)_width=300;if(0==_height)_height=80;this.Canvas.width=_width;this.Canvas.height=_height;this.CanvasParent.appendChild(this.Canvas);this.Image="";this.ImageHtml=null;this.Text="";this.Font="Arial";this.Size=10;this.Italic=true;this.Bold=false;this.Width=w;this.Height=h;this.CanvasReturn=null;this.IsAsync=false}CSignatureDrawer.prototype.getCanvas=
function(){return this.CanvasReturn==null?this.Canvas:this.CanvasReturn};CSignatureDrawer.prototype.getImages=function(){if(!this.isValid())return["",""];this.CanvasReturn=document.createElement("canvas");this.CanvasReturn.width=this.Width*AscCommon.g_dKoef_mm_to_pix;this.CanvasReturn.height=this.Height*AscCommon.g_dKoef_mm_to_pix;if(this.Text!="")this.drawText();else this.drawImage();var _ret=[];_ret.push(this.CanvasReturn.toDataURL("image/png"));var _ctx=this.CanvasReturn.getContext("2d");_ctx.strokeStyle=
"#FF0000";_ctx.lineWidth=2;_ctx.moveTo(0,0);_ctx.lineTo(this.CanvasReturn.width,this.CanvasReturn.height);_ctx.moveTo(0,this.CanvasReturn.height);_ctx.lineTo(this.CanvasReturn.width,0);_ctx.stroke();_ret.push(this.CanvasReturn.toDataURL("image/png"));this.CanvasReturn=null;return _ret};CSignatureDrawer.prototype.setText=function(text,font,size,isItalic,isBold){if(this.IsAsync){this.Text=text;return}this.Image="";this.ImageHtml=null;this.Text=text;this.Font=font;this.Size=size;this.Italic=isItalic;
this.Bold=isBold;this.IsAsync=true;AscFonts.FontPickerByCharacter.checkText(this.Text,this,function(){this.IsAsync=false;var loader=AscCommon.g_font_loader;var fontinfo=AscFonts.g_fontApplication.GetFontInfo(font);var isasync=loader.LoadFont(fontinfo,function(){window.Asc.g_signature_drawer.Api.sync_EndAction(Asc.c_oAscAsyncActionType.Information,Asc.c_oAscAsyncAction.LoadFont);window.Asc.g_signature_drawer.drawText()});if(false===isasync)this.drawText()})};CSignatureDrawer.prototype.drawText=function(){var _oldTurn=
this.Api.isViewMode;var _oldMarks=this.Api.ShowParaMarks;this.Api.isViewMode=true;this.Api.ShowParaMarks=false;AscFormat.ExecuteNoHistory(AscCommon.DrawTextByCenter,this,[]);this.Api.isViewMode=_oldTurn;this.Api.ShowParaMarks=_oldMarks};CSignatureDrawer.prototype.drawImage=function(){var _canvas=this.getCanvas();var w=_canvas.width;var h=_canvas.height;var _ctx=_canvas.getContext("2d");_ctx.clearRect(0,0,w,h);var im_w=this.ImageHtml.width;var im_h=this.ImageHtml.height;var _x=0;var _y=0;var _w=0;
var _h=0;var koef1=w/h;var koef2=im_w/im_h;if(koef1>koef2){_h=h;_w=koef2*_h>>0;_y=0;_x=w-_w>>1}else{_w=w;_h=_w/koef2>>0;_x=0;_y=h-_h>>1}_ctx.drawImage(this.ImageHtml,_x,_y,_w,_h)};CSignatureDrawer.prototype.selectImage=CSignatureDrawer.prototype["selectImage"]=function(){this.Text="";window["AscDesktopEditor"]["OpenFilenameDialog"]("images",false,function(_file){var file=_file;if(Array.isArray(file))file=file[0];if(!file)return;var _drawer=window.Asc.g_signature_drawer;_drawer.Image=window["AscDesktopEditor"]["GetImageBase64"](file);
_drawer.ImageHtml=new Image;_drawer.ImageHtml.onload=function(){window.Asc.g_signature_drawer.drawImage()};_drawer.ImageHtml.src=_drawer.Image;_drawer=null})};CSignatureDrawer.prototype.isValid=function(){return this.Image!=""||this.Text!=""};CSignatureDrawer.prototype.destroy=function(){window.Asc.g_signature_drawer.CanvasParent.removeChild(this.Canvas);delete window.Asc.g_signature_drawer};function CSignatureImage(){this.ImageValidBase64="";this.ImageInvalidBase64="";this.ImageValid=null;this.ImageInvalid=
null;this.Valid=false;this.Loading=0;this.Remove=function(){this.ImageValidBase64="";this.ImageInvalidBase64="";this.ImageValid=null;this.ImageInvalid=null;this.Valid=false;this.Loading=0};this.Register=function(_api,_guid){if(_api.ImageLoader.map_image_index[_guid])return;var _obj={Image:this.Valid?this.ImageValid:this.ImageInvalid,Status:AscFonts.ImageLoadStatus.Complete,src:_guid};_api.ImageLoader.map_image_index[_guid]=_obj};this.Unregister=function(_api,_guid){if(_api.ImageLoader.map_image_index[_guid])delete _api.ImageLoader.map_image_index[_guid]}}
function CShortcuts(){this.List={};this.CustomCounter=0;this.CustomActions={}}CShortcuts.prototype.Add=function(nType,nCode,isCtrl,isShift,isAlt){this.List[this.private_GetIndex(nCode,isCtrl,isShift,isAlt)]=nType};CShortcuts.prototype.Get=function(nCode,isCtrl,isShift,isAlt){var nType=this.List[this.private_GetIndex(nCode,isCtrl,isShift,isAlt)];return undefined!==nType?nType:0};CShortcuts.prototype.private_GetIndex=function(nCode,isCtrl,isShift,isAlt){return nCode<<8|(isCtrl?4:0)|(isShift?2:0)|(isAlt?
1:0)};CShortcuts.prototype.CheckType=function(nType){for(var nIndex in this.List)if(this.List[nIndex]===nType)return{KeyCode:nIndex>>>8,CtrlKey:!!(nIndex&4),ShiftKey:!!(nIndex&2),AltKey:!!(nIndex&1)};return null};CShortcuts.prototype.Remove=function(nCode,isCtrl,isShift,isAlt){delete this.List[this.private_GetIndex(nCode,isCtrl,isShift,isAlt)]};CShortcuts.prototype.RemoveByType=function(nType){for(var nIndex in this.List)if(this.List[nIndex]===nType)delete this.List[nIndex]};CShortcuts.prototype.GetNewCustomType=
function(){return 16711680|this.CustomCounter++};CShortcuts.prototype.IsCustomType=function(nType){return nType>=16711680};CShortcuts.prototype.GetCustomAction=function(nType){return this.CustomActions[nType]};CShortcuts.prototype.AddCustomActionSymbol=function(nCharCode,sFont){var nType=this.GetNewCustomType();this.CustomActions[nType]=new CCustomShortcutActionSymbol(nCharCode,sFont);return nType};function CCustomShortcutActionSymbol(nCharCode,sFont){this.CharCode=nCharCode;this.Font=sFont}CCustomShortcutActionSymbol.prototype.Type=
AscCommon.c_oAscCustomShortcutType.Symbol;AscCommon.EncryptionMessageType={Encrypt:0,Decrypt:1};function CEncryptionData(){this._init=false;this.arrData=[];this.arrImages=[];this.handleChangesCallback=null;this.isChangesHandled=false;this.cryptoMode=0;this.isChartEditor=false;this.isExistDecryptedChanges=false;this.cryptoPrefix=window["AscDesktopEditor"]&&window["AscDesktopEditor"]["GetEncryptedHeader"]?window["AscDesktopEditor"]["GetEncryptedHeader"]():"ENCRYPTED;";this.cryptoPrefixLen=this.cryptoPrefix.length;
this.editorId=null;this.nextChangesTimeoutId=-1;this.isPasswordCryptoPresent=false;this.init=function(){this._init=true};this.isInit=function(){return this._init};this.isNeedCrypt=function(){if(window.g_asc_plugins)if(!window.g_asc_plugins.isRunnedEncryption())return false;if(!window["AscDesktopEditor"])return false;if(this.isChartEditor)return false;if(2==this.cryptoMode)return true;if(0===window["AscDesktopEditor"]["CryptoMode"])return false;return true};this.isCryptoImages=function(){return this.isNeedCrypt()&&
this.isPasswordCryptoPresent};this.addCryproImagesFromDialog=function(callback){var _this=this;window["AscDesktopEditor"]["OpenFilenameDialog"]("images",true,function(files){if(!files)return;if(!Array.isArray(files))files=[files];if(0===files.length)return;var _files=[];var _options={isImageCrypt:true,callback:callback,ext:[]};for(var i=0;i<files.length;i++){_files.push(window["AscDesktopEditor"]["GetImageBase64"](files[i],true));_options.ext.push(AscCommon.GetFileExtension(files[i]))}_this.sendChanges(this,
_files,AscCommon.EncryptionMessageType.Encrypt,_options)})};this.addCryproImagesFromUrls=function(urls,callback){var _editor=window["Asc"]["editor"]?window["Asc"]["editor"]:window.editor;_editor.sync_StartAction(Asc.c_oAscAsyncActionType.BlockInteraction,Asc.c_oAscAsyncAction.LoadImage);var _this=this;window["AscDesktopEditor"]["DownloadFiles"](urls,[],function(files){_editor.sync_EndAction(Asc.c_oAscAsyncActionType.BlockInteraction,Asc.c_oAscAsyncAction.LoadImage);_editor.sync_StartAction(Asc.c_oAscAsyncActionType.BlockInteraction,
Asc.c_oAscAsyncAction.UploadImage);var _files=[];var _options={isImageCrypt:true,isUrls:true,callback:callback,ext:[],api:_editor};for(var elem in files){_files.push(window["AscDesktopEditor"]["GetImageBase64"](files[elem],true));_options.ext.push(window["AscDesktopEditor"]["GetImageFormat"](files[elem]));window["AscDesktopEditor"]["RemoveFile"](files[elem])}_this.sendChanges(this,_files,AscCommon.EncryptionMessageType.Encrypt,_options)})};this.onDecodeError=function(){var _editor=window["Asc"]["editor"]?
window["Asc"]["editor"]:window.editor;_editor.sendEvent("asc_onError",Asc.c_oAscError.ID.DataEncrypted,Asc.c_oAscError.Level.Critical)};this.checkEditorId=function(){if(null==this.editorId){var _editor=window["Asc"]["editor"]?window["Asc"]["editor"]:window.editor;this.editorId=_editor.editorId}};this.decryptImage=function(src,img,data){this.sendChanges(this,[data],AscCommon.EncryptionMessageType.Decrypt,{isImageDecrypt:true,src:src,img:img})};this.nextChanges=function(){this.nextChangesTimeoutId=
setTimeout(function(){AscCommon.EncryptionWorker.sendChanges(undefined,undefined);this.nextChangesTimeoutId=-1},10)};this.sendChanges=function(sender,data,type,options){if(!this.isNeedCrypt()){if(AscCommon.EncryptionMessageType.Encrypt==type)sender._send(data,true);else if(AscCommon.EncryptionMessageType.Decrypt==type){if(this.isExistEncryptedChanges(data["changes"])){this.onDecodeError();return}sender._onSaveChanges(data,true)}return}if(undefined!==type)this.arrData.push({sender:sender,type:type,
data:data,options:options});if(this.arrData.length==0)return;if(undefined!==type&&(1!=this.arrData.length||!this.isChangesHandled))return;if(undefined!==type&&-1!=this.nextChangesTimeoutId){clearTimeout(this.nextChangesTimeoutId);this.nextChangesTimeoutId=-1}if(AscCommon.EncryptionMessageType.Encrypt==this.arrData[0].type)if(this.arrData[0].options&&this.arrData[0].options.isImageCrypt)window.g_asc_plugins.sendToEncryption({"type":"encryptData","data":this.arrData[0].data});else window.g_asc_plugins.sendToEncryption({"type":"encryptData",
"data":JSON.parse(this.arrData[0].data["changes"])});else if(AscCommon.EncryptionMessageType.Decrypt==this.arrData[0].type)if(this.arrData[0].options&&this.arrData[0].options.isImageDecrypt)window.g_asc_plugins.sendToEncryption({"type":"decryptData","data":this.arrData[0].data});else window.g_asc_plugins.sendToEncryption({"type":"decryptData","data":this.arrData[0].data["changes"]})};this.receiveChanges=function(obj){var data=obj["data"];var check=obj["check"];if(!check){this.onDecodeError();return}if(this.handleChangesCallback){this.isExistDecryptedChanges=
true;this.checkEditorId();if(this.editorId==AscCommon.c_oEditorId.Spreadsheet)for(var i=data.length-1;i>=0;i--)this.handleChangesCallback.changesBase[i]=data[i];else for(var i=data.length-1;i>=0;i--)this.handleChangesCallback.changesBase[i].m_pData=data[i];this.isChangesHandled=true;this.handleChangesCallback.callback.call(this.handleChangesCallback.sender);this.handleChangesCallback=null;this.nextChanges();return}var obj=this.arrData[0];this.arrData.splice(0,1);if(AscCommon.EncryptionMessageType.Encrypt==
obj.type)if(obj.options&&obj.options.isImageCrypt){for(var i=0;i<data.length;i++)if(this.cryptoPrefix==data[i].substr(0,this.cryptoPrefixLen))data[i]=this.cryptoPrefix+obj.options.ext[i]+";"+data[i].substr(this.cryptoPrefixLen);if(!obj.options.isUrls)obj.options.callback(Asc.c_oAscError.ID.No,data);else AscCommon.UploadImageUrls(data,obj.options.api.documentId,obj.options.api.documentUserId,obj.options.api.CoAuthoringApi.get_jwt(),function(urls){obj.options.api.sync_EndAction(Asc.c_oAscAsyncActionType.BlockInteraction,
Asc.c_oAscAsyncAction.UploadImage);obj.options.callback(urls)})}else{obj.data["changes"]=JSON.stringify(data);obj.sender._send(obj.data,true)}else if(AscCommon.EncryptionMessageType.Decrypt==obj.type)if(obj.options&&obj.options.isImageDecrypt){window["AscDesktopEditor"]["ResaveFile"](obj.options.src,data[0]);obj.options.img["onload_crypto"](obj.options.src)}else{this.isExistDecryptedChanges=true;obj.data["changes"]=data;obj.sender._onSaveChanges(obj.data,true)}this.nextChanges()};this.isExistEncryptedChanges=
function(_array){if(0==_array.length)return false;this.checkEditorId();var isChangesMode=_array[0]["change"]?true:false;var _prefix="";var _checkPrefixLen=this.cryptoPrefixLen+1;if(isChangesMode){for(var i=_array.length-1;i>=0;i--)if(_array[i]["change"].length>_checkPrefixLen){_prefix=_array[i]["change"].substr(0,_checkPrefixLen);if(-1!=_prefix.indexOf(this.cryptoPrefix)){isCrypted=true;break}}return isCrypted}var isCrypted=false;if(this.editorId==AscCommon.c_oEditorId.Spreadsheet)for(var i=_array.length-
1;i>=0;i--){if(_array[i].length>_checkPrefixLen){_prefix=_array[i].substr(0,_checkPrefixLen);if(-1!=_prefix.indexOf(this.cryptoPrefix)){isCrypted=true;break}}}else for(var i=_array.length-1;i>=0;i--)if(_array[i].m_pData.length>_checkPrefixLen){_prefix=_array[i].m_pData.substr(0,_checkPrefixLen);if(-1!=_prefix.indexOf(this.cryptoPrefix)){isCrypted=true;break}}return isCrypted};this.handleChanges=function(_array,_sender,_callback){if(0==_array.length||!this.isNeedCrypt()){if(this.isExistEncryptedChanges(_array)){this.onDecodeError();
return}this.isChangesHandled=true;_callback.call(_sender);return}this.handleChangesCallback={changesBase:_array,changes:[],sender:_sender,callback:_callback};this.checkEditorId();if(this.editorId==AscCommon.c_oEditorId.Spreadsheet)for(var i=_array.length-1;i>=0;i--)this.handleChangesCallback.changes[i]=_array[i];else for(var i=_array.length-1;i>=0;i--)this.handleChangesCallback.changes[i]=_array[i].m_pData;window.g_asc_plugins.sendToEncryption({"type":"decryptData","data":this.handleChangesCallback.changes})};
this.asc_setAdvancedOptions=function(api,idOption,option){if(window.isNativeOpenPassword){window["AscDesktopEditor"]["NativeViewerOpen"](option.asc_getPassword());return}if(window.isCloudCryptoDownloadAs)return false;if(!this.isNeedCrypt())return false;window.checkPasswordFromPlugin=true;if(window["Asc"].c_oAscAdvancedOptionsID.TXT===idOption){var _param="<m_nCsvTxtEncoding>"+option.asc_getCodePage()+"</m_nCsvTxtEncoding>";window["AscDesktopEditor"]["SetAdvancedOptions"](_param)}else if(window["Asc"].c_oAscAdvancedOptionsID.CSV===
idOption){var delimiter=option.asc_getDelimiter();var delimiterChar=option.asc_getDelimiterChar();var _param="";_param+="<m_nCsvTxtEncoding>"+option.asc_getCodePage()+"</m_nCsvTxtEncoding>";if(null!=delimiter)_param+="<m_nCsvDelimiter>"+delimiter+"</m_nCsvDelimiter>";if(null!=delimiterChar)_param+="<m_nCsvDelimiterChar>"+delimiterChar+"</m_nCsvDelimiterChar>";window["AscDesktopEditor"]["SetAdvancedOptions"](_param)}else if(window["Asc"].c_oAscAdvancedOptionsID.DRM===idOption){var _param="<m_sPassword>"+
AscCommon.CopyPasteCorrectString(option.asc_getPassword())+"</m_sPassword>";api.currentPassword=option.asc_getPassword();window["AscDesktopEditor"]["SetAdvancedOptions"](_param)}return true}}AscCommon.EncryptionWorker=new CEncryptionData;function CMouseSmoothWheelCorrector(t,scrollFunction){this._deltaX=0;this._deltaY=0;this._isBreakX=false;this._isBreakY=false;this._timeoutCorrector=-1;this._api=t;this._scrollFunction=scrollFunction;this._normalDelta=120;this._isNormalDeltaActive=false;this.setNormalDeltaActive=
function(value){this._isNormalDeltaActive=true;this._normalDelta=value};this.isBreakX=function(){return this._isBreakX};this.isBreakY=function(){return this._isBreakY};this.get_DeltaX=function(wheelDeltaX){this._isBreakX=false;if(!AscCommon.AscBrowser.isMacOs)return wheelDeltaX;this._deltaX+=wheelDeltaX;if(Math.abs(this._deltaX)>=this._normalDelta)return this._isNormalDeltaActive?this._deltaX>0?this._normalDelta:-this._normalDelta:this._deltaX;this._isBreakX=true;return 0};this.get_DeltaY=function(wheelDeltaY){this._isBreakY=
false;if(!AscCommon.AscBrowser.isMacOs)return wheelDeltaY;this._deltaY+=wheelDeltaY;if(Math.abs(this._deltaY)>=this._normalDelta)return this._isNormalDeltaActive?this._deltaY>0?this._normalDelta:-this._normalDelta:this._deltaY;this._isBreakY=true;return 0};this.checkBreak=function(){if(-1!=this._timeoutCorrector){clearTimeout(this._timeoutCorrector);this._timeoutCorrector=-1}if((this._isBreakX||this._isBreakY)&&this._scrollFunction){var obj={t:this,x:this._isBreakX?this._deltaX:0,y:this._isBreakY?
this._deltaY:0};this._timeoutCorrector=setTimeout(function(){var t=obj.t;t._scrollFunction.call(t._api,obj.x,obj.y);t._timeoutCorrector=-1;t._deltaX=0;t._deltaY=0},100)}if(!this._isBreakX)this._deltaX=0;if(!this._isBreakY)this._deltaY=0;this._isBreakX=false;this._isBreakY=false}}AscCommon.CMouseSmoothWheelCorrector=CMouseSmoothWheelCorrector;function CTranslateManager(){this.mapTranslate={}}CTranslateManager.prototype.init=function(map){this.mapTranslate=map||{}};CTranslateManager.prototype.getValue=
function(key){return this.mapTranslate.hasOwnProperty(key)?this.mapTranslate[key]:key};function CPolygonPoint2(X,Y){this.X=X;this.Y=Y}function CPolygonVectors(){this.Page=-1;this.VX=[];this.VY=[]}function CPolygonPath(precision){this.Page=-1;this.Direction=1;this.precision=precision;this.Points=[]}CPolygonPath.prototype.PushPoint=function(x,y){this.Points.push(new CPolygonPoint2(x/this.precision,y/this.precision))};CPolygonPath.prototype.CorrectExtremePoints=function(){var Lng=this.Points.length;
this.Points[0].X=this.Points[Lng-1].X;this.Points[Lng-1].Y=this.Points[0].Y};function CPolygon(){this.Vectors=[];this.precision=1E3}CPolygon.prototype.fill=function(arrBounds){this.Vectors.length=0;if(arrBounds.length<=0)return;var nStartLineIndex=0,nStartIndex=0,CountLines=arrBounds.length,CountBounds;while(nStartLineIndex<arrBounds.length){CountBounds=arrBounds[nStartLineIndex].length;while(nStartIndex<CountBounds)if(arrBounds[nStartLineIndex][nStartIndex].W<.001)nStartIndex++;else break;if(nStartIndex<
CountBounds)break;nStartLineIndex++;nStartIndex=0}if(nStartLineIndex>=arrBounds.length)return;var CurrentPage=arrBounds[nStartLineIndex][nStartIndex].Page,CurrentVectors=new CPolygonVectors,VectorsX=CurrentVectors.VX,VectorsY=CurrentVectors.VY;CurrentVectors.Page=CurrentPage;this.Vectors.push(CurrentVectors);for(var LineIndex=nStartLineIndex;LineIndex<CountLines;nStartIndex=0,LineIndex++){if(arrBounds[LineIndex][nStartIndex].Page!==CurrentPage){CurrentPage=arrBounds[LineIndex][nStartIndex].Page;CurrentVectors=
new CPolygonVectors;VectorsX=CurrentVectors.VX;VectorsY=CurrentVectors.VY;CurrentVectors.Page=CurrentPage;this.Vectors.push(CurrentVectors)}for(var Index=nStartIndex;Index<arrBounds[LineIndex].length;Index++){var oBound=arrBounds[LineIndex][Index];if(oBound.W<.001)continue;var x1=Math.round(oBound.X*this.precision),x2=Math.round((oBound.X+oBound.W)*this.precision),y1=Math.round(oBound.Y*this.precision),y2=Math.round((oBound.Y+oBound.H)*this.precision);if(VectorsX[y1]==undefined)VectorsX[y1]={};this.IntersectionX(VectorsX,
x2,x1,y1);if(VectorsY[x1]==undefined)VectorsY[x1]={};this.IntersectionY(VectorsY,y1,y2,x1);if(VectorsX[y2]==undefined)VectorsX[y2]={};this.IntersectionX(VectorsX,x1,x2,y2);if(VectorsY[x2]==undefined)VectorsY[x2]={};this.IntersectionY(VectorsY,y2,y1,x2)}}};CPolygon.prototype.IntersectionX=function(VectorsX,BeginX,EndX,Y){var CurrentVector={};CurrentVector[BeginX]=EndX;var VX=VectorsX[Y];if(BeginX>EndX)while(true==this.IntersectVectorX(CurrentVector,VX));else while(true==this.IntersectVectorX(VX,CurrentVector));
for(var X in CurrentVector){var VBeginX=parseInt(X);var VEndX=CurrentVector[VBeginX];if(VBeginX!==VEndX||VX[VBeginX]===undefined)VX[VBeginX]=VEndX}};CPolygon.prototype.IntersectVectorX=function(VectorOpp,VectorClW){for(var X in VectorOpp){var VBeginX=parseInt(X);var VEndX=VectorOpp[VBeginX];if(VEndX==VBeginX)continue;for(var ClwX in VectorClW){var ClwBeginX=parseInt(ClwX);var ClwEndX=VectorClW[ClwBeginX];var bIntersection=false;if(ClwBeginX==ClwEndX)continue;if(ClwBeginX<=VEndX&&VBeginX<=ClwEndX){VectorOpp[VBeginX]=
VBeginX;VectorClW[ClwBeginX]=VEndX;VectorClW[VBeginX]=ClwEndX;bIntersection=true}else if(VEndX<=ClwBeginX&&ClwEndX<=VBeginX){VectorClW[ClwBeginX]=ClwBeginX;VectorOpp[VBeginX]=ClwEndX;VectorOpp[ClwBeginX]=VEndX;bIntersection=true}else if(ClwBeginX<VEndX&&VEndX<ClwEndX){VectorClW[ClwBeginX]=VEndX;VectorOpp[VBeginX]=ClwEndX;bIntersection=true}else if(ClwBeginX<VBeginX&&VBeginX<ClwEndX){VectorOpp[ClwBeginX]=VEndX;VectorClW[VBeginX]=ClwEndX;delete VectorOpp[VBeginX];delete VectorClW[ClwBeginX];bIntersection=
true}if(bIntersection==true)return true}}return false};CPolygon.prototype.IntersectionY=function(VectorsY,BeginY,EndY,X){var bIntersect=false;for(var y in VectorsY[X]){var CurBeginY=parseInt(y);var CurEndY=VectorsY[X][CurBeginY];var minY,maxY;if(CurBeginY<CurEndY){minY=CurBeginY;maxY=CurEndY}else{minY=CurEndY;maxY=CurBeginY}var bInterSection=!(maxY<=BeginY&&maxY<=EndY||minY>=BeginY&&minY>=EndY),bDirection=(CurBeginY-CurEndY)*(BeginY-EndY)<0;if(bInterSection&&bDirection){VectorsY[X][CurBeginY]=EndY;
VectorsY[X][BeginY]=CurEndY;bIntersect=true}}if(bIntersect==false)VectorsY[X][BeginY]=EndY};CPolygon.prototype.GetPaths=function(shift){var Paths=[];shift*=this.precision;for(var PageIndex=0;PageIndex<this.Vectors.length;PageIndex++){var y,x1,x2,x,y1,y2;var VectorsX=this.Vectors[PageIndex].VX,VectorsY=this.Vectors[PageIndex].VY,Page=this.Vectors[PageIndex].Page;for(var LineIndex in VectorsX)for(var Index in VectorsX[LineIndex]){var Polygon=new CPolygonPath(this.precision);Polygon.Page=Page;y=parseInt(LineIndex);
x1=parseInt(Index);x2=VectorsX[y][x1];VectorsX[y][x1]=-1;var Direction=x1>x2?1:-1;var minY=y;var SignRightLeft,SignDownUp;var X,Y;if(x2!==-1){SignRightLeft=x1>x2?1:-1;Y=y-SignRightLeft*shift;Polygon.PushPoint(x1,Y);while(true){x=x2;y1=y;y2=VectorsY[x][y1];if(y2==-1)break;else if(y2==undefined)return[];VectorsY[x][y1]=-1;SignDownUp=y1>y2?1:-1;X=x+SignDownUp*shift;Polygon.PushPoint(X,Y);y=y2;x1=x;x2=VectorsX[y][x1];if(x2==-1)break;else if(x2==undefined)return[];VectorsX[y][x1]=-1;SignRightLeft=x1>x2?
1:-1;Y=y-SignRightLeft*shift;Polygon.PushPoint(X,Y);if(y<minY){minY=y;Direction=x1>x2?1:-1}}Polygon.PushPoint(X,Y);Polygon.CorrectExtremePoints();Polygon.Direction=Direction;Paths.push(Polygon)}}}return Paths};function CMathTrack(){this.MathRect={IsActive:false,Bounds:[],ContentSelection:null};this.MathPolygons=[];this.MathSelectPolygons=[]}CMathTrack.prototype.Update=function(IsActive,IsContentActive,oMath,PixelError){this.MathRect.IsActive=IsActive;if(true===IsActive&&null!==oMath){var selectBounds=
true===IsContentActive?oMath.Get_ContentSelection():null;if(selectBounds!=null){var SelectPolygon=new CPolygon;SelectPolygon.fill(selectBounds);this.MathSelectPolygons=SelectPolygon.GetPaths(0)}else this.MathSelectPolygons.length=0;var arrBounds=oMath.Get_Bounds();if(arrBounds.length<=0)return;var MPolygon=new CPolygon;MPolygon.fill(arrBounds);this.MathPolygons=MPolygon.GetPaths(PixelError)}};CMathTrack.prototype.Draw=function(overlay,oPath,shift,color,dKoefX,dKoefY,left,top){var ctx=overlay.m_oContext;
ctx.strokeStyle=color;ctx.lineWidth=1;ctx.beginPath();var Points=oPath.Points;var nCount=Points.length;var PrevX=Points[nCount-2].X,PrevY=Points[nCount-2].Y;var _x=left+dKoefX*Points[nCount-2].X,_y=top+dKoefY*Points[nCount-2].Y;var StartX,StartY;for(var nIndex=0;nIndex<nCount;nIndex++){if(PrevX>Points[nIndex].X)_y=top+dKoefY*Points[nIndex].Y-shift;else if(PrevX<Points[nIndex].X)_y=top+dKoefY*Points[nIndex].Y+shift;if(PrevY<Points[nIndex].Y)_x=left+dKoefX*Points[nIndex].X-shift;else if(PrevY>Points[nIndex].Y)_x=
left+dKoefX*Points[nIndex].X+shift;PrevX=Points[nIndex].X;PrevY=Points[nIndex].Y;if(nIndex>0){overlay.CheckPoint(_x,_y);if(1==nIndex){StartX=_x;StartY=_y;overlay.m_oContext.moveTo((_x>>0)+.5,(_y>>0)+.5)}else overlay.m_oContext.lineTo((_x>>0)+.5,(_y>>0)+.5)}}overlay.m_oContext.lineTo((StartX>>0)+.5,(StartY>>0)+.5);ctx.closePath();ctx.stroke();ctx.beginPath()};CMathTrack.prototype.DrawWithMatrix=function(overlay,oPath,ShiftX,ShiftY,color,dKoefX,dKoefY,left,top,m){var ctx=overlay.m_oContext;ctx.strokeStyle=
color;ctx.lineWidth=1;ctx.beginPath();var Points=oPath.Points;var nCount=Points.length;var x=Points[nCount-2].X,y=Points[nCount-2].Y;var _x,_y;var PrevX=Points[nCount-2].X,PrevY=Points[nCount-2].Y;var StartX,StartY;for(var nIndex=0;nIndex<nCount;nIndex++){if(PrevX>Points[nIndex].X)y=Points[nIndex].Y-ShiftY;else if(PrevX<Points[nIndex].X)y=Points[nIndex].Y+ShiftY;if(PrevY<Points[nIndex].Y)x=Points[nIndex].X-ShiftX;else if(PrevY>Points[nIndex].Y)x=Points[nIndex].X+ShiftX;PrevX=Points[nIndex].X;PrevY=
Points[nIndex].Y;if(nIndex>0){_x=left+dKoefX*m.TransformPointX(x,y);_y=top+dKoefY*m.TransformPointY(x,y);overlay.CheckPoint(_x,_y);if(1==nIndex){StartX=_x;StartY=_y;overlay.m_oContext.moveTo((_x>>0)+.5,(_y>>0)+.5)}else overlay.m_oContext.lineTo((_x>>0)+.5,(_y>>0)+.5)}}overlay.m_oContext.lineTo((StartX>>0)+.5,(StartY>>0)+.5);ctx.closePath();ctx.stroke();ctx.beginPath()};CMathTrack.prototype.DrawSelectPolygon=function(overlay,oPath,dKoefX,dKoefY,left,top,m){var ctx=overlay.m_oContext;ctx.fillStyle=
"#375082";ctx.beginPath();var Points=oPath.Points;var nPointIndex;var _x,_y,x,y,p;for(nPointIndex=0;nPointIndex<Points.length-1;nPointIndex++){p=Points[nPointIndex];if(!m){_x=left+dKoefX*p.X;_y=top+dKoefY*p.Y}else{x=p.X;y=p.Y;_x=left+dKoefX*m.TransformPointX(x,y);_y=top+dKoefY*m.TransformPointY(x,y)}overlay.CheckPoint(_x,_y);if(0==nPointIndex)ctx.moveTo((_x>>0)+.5,(_y>>0)+.5);else ctx.lineTo((_x>>0)+.5,(_y>>0)+.5)}ctx.globalAlpha=.2;ctx.fill();ctx.globalAlpha=1};CMathTrack.prototype.IsActive=function(){return this.MathRect.IsActive};
CMathTrack.prototype.GetPolygonsCount=function(){return this.MathPolygons.length};CMathTrack.prototype.GetPolygon=function(nIndex){return this.MathPolygons[nIndex]};CMathTrack.prototype.GetSelectPathsCount=function(){return this.MathSelectPolygons.length};CMathTrack.prototype.GetSelectPath=function(nIndex){return this.MathSelectPolygons[nIndex]};if(!Array.prototype.findIndex)Object.defineProperty(Array.prototype,"findIndex",{value:function(predicate){if(this==null)throw new TypeError("Array.prototype.findIndex called on null or undefined");
if(typeof predicate!=="function")throw new TypeError("predicate must be a function");var list=Object(this);var length=list.length>>>0;var thisArg=arguments[1];var value;for(var i=0;i<length;i++){value=list[i];if(predicate.call(thisArg,value,i,list))return i}return-1}});if(!Array.prototype.fill)Object.defineProperty(Array.prototype,"fill",{value:function(value){if(this==null)throw new TypeError("this is null or not defined");var O=Object(this);var len=O.length>>>0;var start=arguments[1];var relativeStart=
start>>0;var k=relativeStart<0?Math.max(len+relativeStart,0):Math.min(relativeStart,len);var end=arguments[2];var relativeEnd=end===undefined?len:end>>0;var final=relativeEnd<0?Math.max(len+relativeEnd,0):Math.min(relativeEnd,len);while(k<final){O[k]=value;k++}return O}});if(typeof Int8Array!=="undefined"&&!Int8Array.prototype.fill)Int8Array.prototype.fill=Array.prototype.fill;if(typeof Uint8Array!=="undefined"&&!Uint8Array.prototype.fill)Uint8Array.prototype.fill=Array.prototype.fill;if(typeof Uint8ClampedArray!==
"undefined"&&!Uint8ClampedArray.prototype.fill)Uint8ClampedArray.prototype.fill=Array.prototype.fill;if(typeof Int16Array!=="undefined"&&!Int16Array.prototype.fill)Int16Array.prototype.fill=Array.prototype.fill;if(typeof Uint16Array!=="undefined"&&!Uint16Array.prototype.fill)Uint16Array.prototype.fill=Array.prototype.fill;if(typeof Int32Array!=="undefined"&&!Int32Array.prototype.fill)Int32Array.prototype.fill=Array.prototype.fill;if(typeof Uint32Array!=="undefined"&&!Uint32Array.prototype.fill)Uint32Array.prototype.fill=
Array.prototype.fill;if(typeof Float32Array!=="undefined"&&!Float32Array.prototype.fill)Float32Array.prototype.fill=Array.prototype.fill;if(typeof Float64Array!=="undefined"&&!Float64Array.prototype.fill)Float64Array.prototype.fill=Array.prototype.fill;if(typeof Uint8Array!=="undefined"&&!Uint8Array.prototype.slice)Uint8Array.prototype.slice=Array.prototype.slice;function parseText(text,options,bTrimSpaces){var delimiterChar;if(options.asc_getDelimiterChar())delimiterChar=options.asc_getDelimiterChar();
else switch(options.asc_getDelimiter()){case AscCommon.c_oAscCsvDelimiter.None:delimiterChar=undefined;break;case AscCommon.c_oAscCsvDelimiter.Tab:delimiterChar="\t";break;case AscCommon.c_oAscCsvDelimiter.Semicolon:delimiterChar=";";break;case AscCommon.c_oAscCsvDelimiter.Colon:delimiterChar=":";break;case AscCommon.c_oAscCsvDelimiter.Comma:delimiterChar=",";break;case AscCommon.c_oAscCsvDelimiter.Space:delimiterChar=" ";break}var matrix=[];var rows=text.split(/\r?\n/);for(var i=0;i<rows.length;++i){var row=
rows[i];if(" "===delimiterChar&&bTrimSpaces){var addSpace=false;if(row[0]===delimiterChar)addSpace=true;row=addSpace?delimiterChar+row.trim():row.trim()}matrix.push(row.split(delimiterChar))}return matrix}function getTimeISO8601(dateStr){if(dateStr)if(dateStr.endsWith("Z"))return Date.parse(dateStr);else return Date.parse(dateStr+"Z");return NaN}function valueToMmType(value){var oVal=parseFloat(value);var oType;if(!isNaN(oVal)){if(-1!==value.indexOf("%")){oType="%";oVal/=100}else if(-1!==value.indexOf("px")){oType=
"px";oVal*=AscCommon.g_dKoef_pix_to_mm}else if(-1!==value.indexOf("in")){oType="in";oVal*=AscCommonWord.g_dKoef_in_to_mm}else if(-1!==value.indexOf("cm")){oType="cm";oVal*=10}else if(-1!==value.indexOf("mm"))oType="mm";else if(-1!==value.indexOf("pt")){oType="pt";oVal*=AscCommonWord.g_dKoef_pt_to_mm}else if(-1!==value.indexOf("pc")){oType="pc";oVal*=AscCommonWord.g_dKoef_pc_to_mm}else oType="none";return{val:oVal,type:oType}}return null}function valueToMm(value){var obj=valueToMmType(value);if(obj&&
"%"!==obj.type&&"none"!==obj.type)return obj.val;return null}function arrayMove(array,from,to){array.splice(to,0,array.splice(from,1)[0])}function getRangeArray(start,stop){var res=new Array(stop-start);for(var i=start;i<stop;++i)res[i-start]=i;return res}var g_oBackoffDefaults={retries:2,factor:2,minTimeout:100,maxTimeout:2E3,randomize:true};function Backoff(opts){this.attempts=0;this.opts=opts}Backoff.prototype.attempt=function(fError,fRetry){var timeout=this.nextTimeout();if(timeout>0)setTimeout(function(){fRetry()},
timeout);else fError()};Backoff.prototype.nextTimeout=function(){var timeout=-1;if(this.attempts<this.opts.retries){timeout=this.createTimeout(this.attempts,this.opts);this.attempts++}return timeout};Backoff.prototype.createTimeout=function(attempt,opts){var random=opts.randomize?Math.random()+1:1;var timeout=Math.round(random*opts.minTimeout*Math.pow(opts.factor,attempt));timeout=Math.min(timeout,opts.maxTimeout);return timeout};function backoffOnError(obj,onError,onRetry){if(!onRetry)return onError;
var backoff=new Backoff(g_oBackoffDefaults);return function(){var timeout=backoff.nextTimeout();if(timeout>0)setTimeout(function(){onRetry.call(obj,obj)},timeout);else if(onError)onError.apply(obj,arguments)}}function backoffOnErrorImg(img,onRetry){if(!onRetry)onRetry=function(img){img.setAttribute("src",img.getAttribute("src"))};img.onerror=backoffOnError(img,img.onerror,onRetry)}function isEmptyObject(obj){for(var name in obj)return false;return true}window["AscCommon"]=window["AscCommon"]||{};
window["AscCommon"].getSockJs=getSockJs;window["AscCommon"].getJSZipUtils=getJSZipUtils;window["AscCommon"].getJSZip=getJSZip;window["AscCommon"].getBaseUrl=getBaseUrl;window["AscCommon"].getEncodingParams=getEncodingParams;window["AscCommon"].getEncodingByBOM=getEncodingByBOM;window["AscCommon"].saveWithParts=saveWithParts;window["AscCommon"].loadFileContent=loadFileContent;window["AscCommon"].getImageFromChanges=getImageFromChanges;window["AscCommon"].openFileCommand=openFileCommand;window["AscCommon"].sendCommand=
sendCommand;window["AscCommon"].sendSaveFile=sendSaveFile;window["AscCommon"].mapAscServerErrorToAscError=mapAscServerErrorToAscError;window["AscCommon"].joinUrls=joinUrls;window["AscCommon"].getFullImageSrc2=getFullImageSrc2;window["AscCommon"].fSortAscending=fSortAscending;window["AscCommon"].fSortDescending=fSortDescending;window["AscCommon"].isLeadingSurrogateChar=isLeadingSurrogateChar;window["AscCommon"].decodeSurrogateChar=decodeSurrogateChar;window["AscCommon"].encodeSurrogateChar=encodeSurrogateChar;
window["AscCommon"].convertUnicodeToUTF16=convertUnicodeToUTF16;window["AscCommon"].convertUTF16toUnicode=convertUTF16toUnicode;window["AscCommon"].build_local_rx=build_local_rx;window["AscCommon"].GetFileName=GetFileName;window["AscCommon"].GetFileExtension=GetFileExtension;window["AscCommon"].changeFileExtention=changeFileExtention;window["AscCommon"].getExtentionByFormat=getExtentionByFormat;window["AscCommon"].InitOnMessage=InitOnMessage;window["AscCommon"].ShowImageFileDialog=ShowImageFileDialog;
window["AscCommon"].ShowDocumentFileDialog=ShowDocumentFileDialog;window["AscCommon"].InitDragAndDrop=InitDragAndDrop;window["AscCommon"].UploadImageFiles=UploadImageFiles;window["AscCommon"].UploadImageUrls=UploadImageUrls;window["AscCommon"].CanDropFiles=CanDropFiles;window["AscCommon"].getUrlType=getUrlType;window["AscCommon"].prepareUrl=prepareUrl;window["AscCommon"].getUserColorById=getUserColorById;window["AscCommon"].isNullOrEmptyString=isNullOrEmptyString;window["AscCommon"].unleakString=
unleakString;window["AscCommon"].readValAttr=readValAttr;window["AscCommon"].getNumFromXml=getNumFromXml;window["AscCommon"].getColorFromXml=getColorFromXml;window["AscCommon"].getBoolFromXml=getBoolFromXml;window["AscCommon"].initStreamFromResponse=initStreamFromResponse;window["AscCommon"].checkStreamSignature=checkStreamSignature;window["AscCommon"].DocumentUrls=DocumentUrls;window["AscCommon"].OpenFileResult=OpenFileResult;window["AscCommon"].CLock=CLock;window["AscCommon"].CContentChanges=CContentChanges;
window["AscCommon"].CContentChangesElement=CContentChangesElement;window["AscCommon"].CorrectMMToTwips=CorrectMMToTwips;window["AscCommon"].TwipsToMM=TwipsToMM;window["AscCommon"].MMToTwips=MMToTwips;window["AscCommon"].RomanToInt=RomanToInt;window["AscCommon"].LatinNumberingToInt=LatinNumberingToInt;window["AscCommon"].IntToNumberFormat=IntToNumberFormat;window["AscCommon"].IsSpace=IsSpace;window["AscCommon"].loadSdk=loadSdk;window["AscCommon"].loadScript=loadScript;window["AscCommon"].getAltGr=
getAltGr;window["AscCommon"].getColorSchemeByName=getColorSchemeByName;window["AscCommon"].getColorSchemeByIdx=getColorSchemeByIdx;window["AscCommon"].getAscColorScheme=getAscColorScheme;window["AscCommon"].checkAddColorScheme=checkAddColorScheme;window["AscCommon"].getIndexColorSchemeInArray=getIndexColorSchemeInArray;window["AscCommon"].isEastAsianScript=isEastAsianScript;window["AscCommon"].CMathTrack=CMathTrack;window["AscCommon"].CPolygon=CPolygon;window["AscCommon"].JSZipWrapper=JSZipWrapper;
window["AscCommon"].g_oDocumentUrls=g_oDocumentUrls;window["AscCommon"].FormulaTablePartInfo=FormulaTablePartInfo;window["AscCommon"].cBoolLocal=cBoolLocal;window["AscCommon"].cErrorOrigin=cErrorOrigin;window["AscCommon"].cErrorLocal=cErrorLocal;window["AscCommon"].FormulaSeparators=FormulaSeparators;window["AscCommon"].rx_space_g=rx_space_g;window["AscCommon"].rx_space=rx_space;window["AscCommon"].rx_defName=rx_defName;window["AscCommon"].kCurFormatPainterWord=kCurFormatPainterWord;window["AscCommon"].parserHelp=
parserHelp;window["AscCommon"].g_oIdCounter=g_oIdCounter;window["AscCommon"].g_oHtmlCursor=g_oHtmlCursor;window["AscCommon"].g_oBackoffDefaults=g_oBackoffDefaults;window["AscCommon"].Backoff=Backoff;window["AscCommon"].backoffOnErrorImg=backoffOnErrorImg;window["AscCommon"].isEmptyObject=isEmptyObject;window["AscCommon"].CSignatureDrawer=window["AscCommon"]["CSignatureDrawer"]=CSignatureDrawer;var prot=CSignatureDrawer.prototype;prot["getImages"]=prot.getImages;prot["setText"]=prot.setText;prot["selectImage"]=
prot.selectImage;prot["isValid"]=prot.isValid;prot["destroy"]=prot.destroy;window["AscCommon"].translateManager=new CTranslateManager;window["AscCommon"].parseText=parseText;window["AscCommon"].getTimeISO8601=getTimeISO8601;window["AscCommon"].valueToMm=valueToMm;window["AscCommon"].valueToMmType=valueToMmType;window["AscCommon"].arrayMove=arrayMove;window["AscCommon"].getRangeArray=getRangeArray;window["AscCommon"].CUnicodeStringEmulator=CUnicodeStringEmulator;window["AscCommon"].private_IsAbbreviation=
private_IsAbbreviation;window["AscCommon"].rx_test_ws_name=rx_test_ws_name;window["AscCommon"].CShortcuts=window["AscCommon"]["CShortcuts"]=CShortcuts;prot=CShortcuts.prototype;prot["Add"]=prot.Add;prot["Get"]=prot.Get;prot["CheckType"]=prot.CheckType;prot["Remove"]=prot.Remove;prot["RemoveByType"]=prot.RemoveByType;prot["GetNewCustomType"]=prot.GetNewCustomType;prot["IsCustomType"]=prot.IsCustomType;prot["GetCustomAction"]=prot.GetCustomAction;prot["AddCustomActionSymbol"]=prot.AddCustomActionSymbol;
window["AscCommon"].CCustomShortcutActionSymbol=window["AscCommon"]["CCustomShortcutActionSymbol"]=CCustomShortcutActionSymbol})(window);
window["asc_initAdvancedOptions"]=function(_code,_file_hash,_docInfo){if(window.isNativeOpenPassword)return window["NativeFileOpen_error"](window.isNativeOpenPassword,_file_hash,_docInfo);var _editor=window["Asc"]["editor"]?window["Asc"]["editor"]:window.editor;if(_code==90||_code==91){if(window["AscDesktopEditor"]&&0!==window["AscDesktopEditor"]["CryptoMode"]&&!_editor.isLoadFullApi){_editor.asc_initAdvancedOptions_params=[];_editor.asc_initAdvancedOptions_params.push(_code);_editor.asc_initAdvancedOptions_params.push(_file_hash);
_editor.asc_initAdvancedOptions_params.push(_docInfo);return}if(AscCommon.EncryptionWorker.isNeedCrypt()&&!window.checkPasswordFromPlugin){window.checkPasswordFromPlugin=true;window.g_asc_plugins.sendToEncryption({"type":"getPasswordByFile","hash":_file_hash,"docinfo":_docInfo});return}}window.checkPasswordFromPlugin=false;_editor._onNeedParams(undefined,_code==90||_code==91?true:undefined)};
window["asc_IsNeedBuildCryptedFile"]=function(){if(!window["AscDesktopEditor"]||!window["AscDesktopEditor"]["CryptoMode"])return false;var _api=window["Asc"]["editor"]?window["Asc"]["editor"]:window.editor;var _returnValue=false;var _users=null;if(_api.CoAuthoringApi&&_api.CoAuthoringApi._CoAuthoringApi&&_api.CoAuthoringApi._CoAuthoringApi._participants)_users=_api.CoAuthoringApi._CoAuthoringApi._participants;var _usersCount=0;for(var _user in _users)_usersCount++;var isOne=1>=_usersCount?true:false;

@ -8412,18 +8412,18 @@ function(font_index,stream_index){this.embeddedFontFiles[font_index].SetStreamIn
false;var oThis=this;if(window["AscDesktopEditor"]&&window["AscDesktopEditor"]["IsLocalFile"]&&window["AscDesktopEditor"]["isBlockchainSupport"]){this.isBlockchainSupport=window["AscDesktopEditor"]["isBlockchainSupport"]()&&!window["AscDesktopEditor"]["IsLocalFile"]();if(this.isBlockchainSupport){Image.prototype.preload_crypto=function(_url){window["crypto_images_map"]=window["crypto_images_map"]||{};if(!window["crypto_images_map"][_url])window["crypto_images_map"][_url]=[];window["crypto_images_map"][_url].push(this);
window["AscDesktopEditor"]["PreloadCryptoImage"](_url,AscCommon.g_oDocumentUrls.getLocal(_url));oThis.Api.sync_StartAction(Asc.c_oAscAsyncActionType.BlockInteraction,Asc.c_oAscAsyncAction.LoadImage)};Image.prototype["onload_crypto"]=function(_src,_crypto_data){if(_crypto_data&&AscCommon.EncryptionWorker&&AscCommon.EncryptionWorker.isCryptoImages()){AscCommon.EncryptionWorker.decryptImage(_src,this,_crypto_data);return}this.crossOrigin="";this.src=_src;oThis.Api.sync_EndAction(Asc.c_oAscAsyncActionType.BlockInteraction,
Asc.c_oAscAsyncAction.LoadImage)}}}this.put_Api=function(_api){this.Api=_api;if(this.Api.IsAsyncOpenDocumentImages!==undefined){this.bIsAsyncLoadDocumentImages=this.Api.IsAsyncOpenDocumentImages();if(this.bIsAsyncLoadDocumentImages)if(undefined===this.Api.asyncImageEndLoadedBackground)this.bIsAsyncLoadDocumentImages=false}};this.LoadDocumentImagesCallback=function(){if(this.ThemeLoader==null)this.Api.asyncImagesDocumentEndLoaded();else this.ThemeLoader.asyncImagesEndLoaded()};this.LoadDocumentImages=
function(_images){if(this.ThemeLoader==null)this.Api.asyncImagesDocumentStartLoaded();else this.ThemeLoader.asyncImagesStartLoaded();this.images_loading=[];for(var id in _images)this.images_loading[this.images_loading.length]=AscCommon.getFullImageSrc2(_images[id]);if(!this.bIsAsyncLoadDocumentImages){this.nNoByOrderCounter=0;this._LoadImages()}else{var _len=this.images_loading.length;for(var i=0;i<_len;i++)this.LoadImageAsync(i);this.images_loading.splice(0,_len);var that=this;setTimeout(function(){that.LoadDocumentImagesCallback()},
3E3)}};this.loadImageByUrl=function(_image,_url){if(this.isBlockchainSupport)_image.preload_crypto(_url);else _image.src=_url};this._LoadImages=function(){var _count_images=this.images_loading.length;if(0==_count_images){this.nNoByOrderCounter=0;if(this.ThemeLoader==null)this.Api.asyncImagesDocumentEndLoaded();else this.ThemeLoader.asyncImagesEndLoaded();return}for(var i=0;i<_count_images;i++){var _id=this.images_loading[i];var oImage=new CImage(_id);oImage.Status=ImageLoadStatus.Loading;oImage.Image=
new Image;oThis.map_image_index[oImage.src]=oImage;oImage.Image.parentImage=oImage;oImage.Image.onload=function(){this.parentImage.Status=ImageLoadStatus.Complete;oThis.nNoByOrderCounter++;if(oThis.bIsLoadDocumentFirst===true){oThis.Api.OpenDocumentProgress.CurrentImage++;oThis.Api.SendOpenProgress()}if(!oThis.bIsLoadDocumentImagesNoByOrder){oThis.images_loading.shift();oThis._LoadImages()}else if(oThis.nNoByOrderCounter==oThis.images_loading.length){oThis.images_loading=[];oThis._LoadImages()}};
oImage.Image.onerror=function(){this.parentImage.Status=ImageLoadStatus.Complete;this.parentImage.Image=null;oThis.nNoByOrderCounter++;if(oThis.bIsLoadDocumentFirst===true){oThis.Api.OpenDocumentProgress.CurrentImage++;oThis.Api.SendOpenProgress()}if(!oThis.bIsLoadDocumentImagesNoByOrder){oThis.images_loading.shift();oThis._LoadImages()}else if(oThis.nNoByOrderCounter==oThis.images_loading.length){oThis.images_loading=[];oThis._LoadImages()}};AscCommon.backoffOnErrorImg(oImage.Image,function(img){oThis.loadImageByUrl(img,
img.src)});oThis.loadImageByUrl(oImage.Image,oImage.src);if(!oThis.bIsLoadDocumentImagesNoByOrder)return}};this.LoadImage=function(src,Type){var _image=this.map_image_index[src];if(undefined!=_image)return _image;this.Api.asyncImageStartLoaded();var oImage=new CImage(src);oImage.Type=Type;oImage.Image=new Image;oImage.Status=ImageLoadStatus.Loading;oThis.map_image_index[oImage.src]=oImage;oImage.Image.onload=function(){oImage.Status=ImageLoadStatus.Complete;oThis.Api.asyncImageEndLoaded(oImage)};
oImage.Image.onerror=function(){oImage.Image=null;oImage.Status=ImageLoadStatus.Complete;oThis.Api.asyncImageEndLoaded(oImage)};AscCommon.backoffOnErrorImg(oImage.Image,function(img){oThis.loadImageByUrl(img,img.src)});this.loadImageByUrl(oImage.Image,oImage.src);return null};this.LoadImageAsync=function(i){var _id=oThis.images_loading[i];var oImage=new CImage(_id);oImage.Status=ImageLoadStatus.Loading;oImage.Image=new Image;oThis.map_image_index[oImage.src]=oImage;var oThat=oThis;oImage.Image.onload=
function(){oImage.Status=ImageLoadStatus.Complete;oThat.Api.asyncImageEndLoadedBackground(oImage)};oImage.Image.onerror=function(){oImage.Status=ImageLoadStatus.Complete;oImage.Image=null;oThat.Api.asyncImageEndLoadedBackground(oImage)};AscCommon.backoffOnErrorImg(oImage.Image,function(img){oThis.loadImageByUrl(img,img.src)});console.log("Loading image "+i);console.log(oImage);window.parent.APP.getImageURL(oImage.src,function(url){if(url=="")oThis.loadImageByUrl(oImage.Image,oImage.src);else{oThis.loadImageByUrl(oImage.Image,
url);oThis.map_image_index[url]=oImage}})};this.LoadImagesWithCallback=function(arr,loadImageCallBack,loadImageCallBackArgs){var arrAsync=[];var i=0;for(i=0;i<arr.length;i++)if(this.map_image_index[arr[i]]===undefined)arrAsync.push(arr[i]);if(arrAsync.length==0){loadImageCallBack.call(this.Api,loadImageCallBackArgs);return}this.loadImageCallBackCounter=0;this.loadImageCallBackCounterMax=arrAsync.length;this.loadImageCallBack=loadImageCallBack;this.loadImageCallBackArgs=loadImageCallBackArgs;for(i=
0;i<arrAsync.length;i++){var oImage=new CImage(arrAsync[i]);oImage.Image=new Image;oImage.Image.parentImage=oImage;oImage.Status=ImageLoadStatus.Loading;this.map_image_index[oImage.src]=oImage;oImage.Image.onload=function(){this.parentImage.Status=ImageLoadStatus.Complete;oThis.loadImageCallBackCounter++;if(oThis.loadImageCallBackCounter==oThis.loadImageCallBackCounterMax)oThis.LoadImagesWithCallbackEnd()};oImage.Image.onerror=function(){this.parentImage.Image=null;this.parentImage.Status=ImageLoadStatus.Complete;
oThis.loadImageCallBackCounter++;if(oThis.loadImageCallBackCounter==oThis.loadImageCallBackCounterMax)oThis.LoadImagesWithCallbackEnd()};AscCommon.backoffOnErrorImg(oImage.Image,function(img){oThis.loadImageByUrl(img,img.src)});this.loadImageByUrl(oImage.Image,oImage.src)}};this.LoadImagesWithCallbackEnd=function(){this.loadImageCallBack.call(this.Api,this.loadImageCallBackArgs);this.loadImageCallBack=null;this.loadImageCallBackArgs=null;this.loadImageCallBackCounterMax=0;this.loadImageCallBackCounter=
0}}var g_flow_anchor=new Image;g_flow_anchor.asc_complete=false;g_flow_anchor.onload=function(){g_flow_anchor.asc_complete=true};g_flow_anchor.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAAPBAMAAADNDVhEAAAAIVBMVEUAAAANDQ0NDQ0NDQ0NDQ0NDQ0AAAANDQ0NDQ0NDQ0NDQ1jk7YPAAAACnRSTlMAGkD4mb9c5s9TDghpXQAAAFZJREFUCNdjYGBgW8YABlxcIBLBZ1gAEfZa5QWiGRkWMAIpAaA4iHQE0YwODEtANMsChkIwv4BBWQBICyswMC1iWADEDAzKoUuDFUAGNC9uABvIaQkkABpxD6lFb9lRAAAAAElFTkSuQmCC";var g_flow_anchor2=new Image;g_flow_anchor2.asc_complete=
false;g_flow_anchor2.onload=function(){g_flow_anchor2.asc_complete=true};g_flow_anchor2.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABoAAAAeCAMAAAAFBf7qAAAAOVBMVEUAAAAAAAAAAAAAAAAJCQkAAAAJCQkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJCQknI0ZQAAAAEnRSTlMAx9ITlAfyPHxn68yecTAl5qt6y0BvAAAAt0lEQVQoz8WS0QrDIAxFk0ajtlXb+/8fuzAprltg7Gnn4aIcvAgJTSSoBiGPoIAGV60qoquvIIL110IJgPONmKIlMI73MiwGRoZvahbKVSizcDKU8QeVPDXEIr6ShVB9VUEn2FOMkwL8VwjUtuypvDWiHeVTFeyWkZHfVQZHGm4XMhKQyJB9GKMxuHQSBlioF7u2q7kzgO2AcWwW3F8mWRmGKgyu91mK1Tzh4ixVVkBzJI/EnGjyACbfCaO3eIWRAAAAAElFTkSuQmCC";
function(_images){if(this.ThemeLoader==null)this.Api.asyncImagesDocumentStartLoaded();else this.ThemeLoader.asyncImagesStartLoaded();this.images_loading=[];for(var id in _images)this.images_loading[this.images_loading.length]=AscCommon.getFullImageSrc2(_images[id]);if(!this.bIsAsyncLoadDocumentImages){this.nNoByOrderCounter=0;this._LoadImages()}else{var _len=this.images_loading.length;if(_len===0)return void this.LoadDocumentImagesCallback();var todo=_len;var that=this;var done=function(){todo--;
if(todo===0){that.images_loading.splice(0,_len);setTimeout(function(){that.LoadDocumentImagesCallback()},100);done=function(){}}};for(var i=0;i<_len;i++)this.LoadImageAsync(i,done);return;this.images_loading.splice(0,_len);var that=this;setTimeout(function(){that.LoadDocumentImagesCallback()},3E3)}};this.loadImageByUrl=function(_image,_url){if(this.isBlockchainSupport)_image.preload_crypto(_url);else _image.src=_url};this._LoadImages=function(){var _count_images=this.images_loading.length;if(0==_count_images){this.nNoByOrderCounter=
0;if(this.ThemeLoader==null)this.Api.asyncImagesDocumentEndLoaded();else this.ThemeLoader.asyncImagesEndLoaded();return}for(var i=0;i<_count_images;i++){var _id=this.images_loading[i];var oImage=new CImage(_id);oImage.Status=ImageLoadStatus.Loading;oImage.Image=new Image;oThis.map_image_index[oImage.src]=oImage;oImage.Image.parentImage=oImage;oImage.Image.onload=function(){this.parentImage.Status=ImageLoadStatus.Complete;oThis.nNoByOrderCounter++;if(oThis.bIsLoadDocumentFirst===true){oThis.Api.OpenDocumentProgress.CurrentImage++;
oThis.Api.SendOpenProgress()}if(!oThis.bIsLoadDocumentImagesNoByOrder){oThis.images_loading.shift();oThis._LoadImages()}else if(oThis.nNoByOrderCounter==oThis.images_loading.length){oThis.images_loading=[];oThis._LoadImages()}};oImage.Image.onerror=function(){this.parentImage.Status=ImageLoadStatus.Complete;this.parentImage.Image=null;oThis.nNoByOrderCounter++;if(oThis.bIsLoadDocumentFirst===true){oThis.Api.OpenDocumentProgress.CurrentImage++;oThis.Api.SendOpenProgress()}if(!oThis.bIsLoadDocumentImagesNoByOrder){oThis.images_loading.shift();
oThis._LoadImages()}else if(oThis.nNoByOrderCounter==oThis.images_loading.length){oThis.images_loading=[];oThis._LoadImages()}};AscCommon.backoffOnErrorImg(oImage.Image,function(img){oThis.loadImageByUrl(img,img.src)});oThis.loadImageByUrl(oImage.Image,oImage.src);if(!oThis.bIsLoadDocumentImagesNoByOrder)return}};this.LoadImage=function(src,Type){var _image=this.map_image_index[src];if(undefined!=_image)return _image;this.Api.asyncImageStartLoaded();var oImage=new CImage(src);oImage.Type=Type;oImage.Image=
new Image;oImage.Status=ImageLoadStatus.Loading;oThis.map_image_index[oImage.src]=oImage;oImage.Image.onload=function(){oImage.Status=ImageLoadStatus.Complete;oThis.Api.asyncImageEndLoaded(oImage)};oImage.Image.onerror=function(){oImage.Image=null;oImage.Status=ImageLoadStatus.Complete;oThis.Api.asyncImageEndLoaded(oImage)};AscCommon.backoffOnErrorImg(oImage.Image,function(img){oThis.loadImageByUrl(img,img.src)});this.loadImageByUrl(oImage.Image,oImage.src);return null};this.LoadImageAsync=function(i,
cb){var _id=oThis.images_loading[i];var oImage=new CImage(_id);oImage.Status=ImageLoadStatus.Loading;oImage.Image=new Image;oThis.map_image_index[oImage.src]=oImage;var oThat=oThis;oImage.Image.onload=function(){oImage.Status=ImageLoadStatus.Complete;oThat.Api.asyncImageEndLoadedBackground(oImage)};oImage.Image.onerror=function(){oImage.Status=ImageLoadStatus.Complete;oImage.Image=null;oThat.Api.asyncImageEndLoadedBackground(oImage)};AscCommon.backoffOnErrorImg(oImage.Image,function(img){oThis.loadImageByUrl(img,
img.src)});console.log("Loading image "+i);console.log(oImage);window.parent.APP.getImageURL(oImage.src,function(url){if(url=="")oThis.loadImageByUrl(oImage.Image,oImage.src);else{oThis.loadImageByUrl(oImage.Image,url);oThis.map_image_index[url]=oImage}if(typeof cb==="function")cb()})};this.LoadImagesWithCallback=function(arr,loadImageCallBack,loadImageCallBackArgs){var arrAsync=[];var i=0;for(i=0;i<arr.length;i++)if(this.map_image_index[arr[i]]===undefined)arrAsync.push(arr[i]);if(arrAsync.length==
0){loadImageCallBack.call(this.Api,loadImageCallBackArgs);return}this.loadImageCallBackCounter=0;this.loadImageCallBackCounterMax=arrAsync.length;this.loadImageCallBack=loadImageCallBack;this.loadImageCallBackArgs=loadImageCallBackArgs;for(i=0;i<arrAsync.length;i++){var oImage=new CImage(arrAsync[i]);oImage.Image=new Image;oImage.Image.parentImage=oImage;oImage.Status=ImageLoadStatus.Loading;this.map_image_index[oImage.src]=oImage;oImage.Image.onload=function(){this.parentImage.Status=ImageLoadStatus.Complete;
oThis.loadImageCallBackCounter++;if(oThis.loadImageCallBackCounter==oThis.loadImageCallBackCounterMax)oThis.LoadImagesWithCallbackEnd()};oImage.Image.onerror=function(){this.parentImage.Image=null;this.parentImage.Status=ImageLoadStatus.Complete;oThis.loadImageCallBackCounter++;if(oThis.loadImageCallBackCounter==oThis.loadImageCallBackCounterMax)oThis.LoadImagesWithCallbackEnd()};AscCommon.backoffOnErrorImg(oImage.Image,function(img){oThis.loadImageByUrl(img,img.src)});this.loadImageByUrl(oImage.Image,
oImage.src)}};this.LoadImagesWithCallbackEnd=function(){this.loadImageCallBack.call(this.Api,this.loadImageCallBackArgs);this.loadImageCallBack=null;this.loadImageCallBackArgs=null;this.loadImageCallBackCounterMax=0;this.loadImageCallBackCounter=0}}var g_flow_anchor=new Image;g_flow_anchor.asc_complete=false;g_flow_anchor.onload=function(){g_flow_anchor.asc_complete=true};g_flow_anchor.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAAPBAMAAADNDVhEAAAAIVBMVEUAAAANDQ0NDQ0NDQ0NDQ0NDQ0AAAANDQ0NDQ0NDQ0NDQ1jk7YPAAAACnRSTlMAGkD4mb9c5s9TDghpXQAAAFZJREFUCNdjYGBgW8YABlxcIBLBZ1gAEfZa5QWiGRkWMAIpAaA4iHQE0YwODEtANMsChkIwv4BBWQBICyswMC1iWADEDAzKoUuDFUAGNC9uABvIaQkkABpxD6lFb9lRAAAAAElFTkSuQmCC";
var g_flow_anchor2=new Image;g_flow_anchor2.asc_complete=false;g_flow_anchor2.onload=function(){g_flow_anchor2.asc_complete=true};g_flow_anchor2.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABoAAAAeCAMAAAAFBf7qAAAAOVBMVEUAAAAAAAAAAAAAAAAJCQkAAAAJCQkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJCQknI0ZQAAAAEnRSTlMAx9ITlAfyPHxn68yecTAl5qt6y0BvAAAAt0lEQVQoz8WS0QrDIAxFk0ajtlXb+/8fuzAprltg7Gnn4aIcvAgJTSSoBiGPoIAGV60qoquvIIL110IJgPONmKIlMI73MiwGRoZvahbKVSizcDKU8QeVPDXEIr6ShVB9VUEn2FOMkwL8VwjUtuypvDWiHeVTFeyWkZHfVQZHGm4XMhKQyJB9GKMxuHQSBlioF7u2q7kzgO2AcWwW3F8mWRmGKgyu91mK1Tzh4ixVVkBzJI/EnGjyACbfCaO3eIWRAAAAAElFTkSuQmCC";
window["AscCommon"]=window["AscCommon"]||{};window["AscCommon"].g_font_loader=new CGlobalFontLoader;window["AscCommon"].g_image_loader=new CGlobalImageLoader;window["AscCommon"].g_flow_anchor=g_flow_anchor;window["AscCommon"].g_flow_anchor2=g_flow_anchor2})(window,window.document);"use strict";(function(window,undefined){var FOREIGN_CURSOR_LABEL_HIDETIME=1500;function CCollaborativeChanges(){this.m_pData=null;this.m_oColor=null}CCollaborativeChanges.prototype.Set_Data=function(pData){this.m_pData=
pData};CCollaborativeChanges.prototype.Set_Color=function(oColor){this.m_oColor=oColor};CCollaborativeChanges.prototype.Set_FromUndoRedo=function(Class,Data,Binary){if(!Class.Get_Id)return false;this.m_pData=this.private_SaveData(Binary);return true};CCollaborativeChanges.prototype.Apply_Data=function(){var CollaborativeEditing=AscCommon.CollaborativeEditing;var Reader=this.private_LoadData(this.m_pData);var ClassId=Reader.GetString2();var Class=AscCommon.g_oTableId.Get_ById(ClassId);if(!Class)return false;
var nReaderPos=Reader.GetCurPos();var nChangesType=Reader.GetLong();var fChangesClass=AscDFH.changesFactory[nChangesType];if(fChangesClass){var oChange=new fChangesClass(Class);oChange.ReadFromBinary(Reader);if(true===CollaborativeEditing.private_AddOverallChange(oChange))oChange.Load(this.m_oColor);return true}else{CollaborativeEditing.private_AddOverallChange(this.m_pData);Reader.Seek2(nReaderPos);if(!Class.Load_Changes)return false;return Class.Load_Changes(Reader,null,this.m_oColor)}};CCollaborativeChanges.prototype.private_LoadData=
@ -20067,59 +20067,59 @@ this.CheckFootnote(X,Y,CurPage);if(isInText&&null!=oHyperlink&&(Y<=this.Pages[Cu
Asc.c_oAscMouseMoveDataTypes.Common;if(isInText&&(null!=oHyperlink||bPageRefLink)&&true===AscCommon.global_keyboardEvent.CtrlKey)this.DrawingDocument.SetCursorType("pointer",MMData);else this.DrawingDocument.SetCursorType("text",MMData);var Bounds=this.Pages[CurPage].Bounds;if(true===this.Lock.Is_Locked()&&X<Bounds.Right&&X>Bounds.Left&&Y>Bounds.Top&&Y<Bounds.Bottom&&this.LogicDocument&&!this.LogicDocument.IsViewModeInReview()){var _X=this.Pages[CurPage].X;var _Y=this.Pages[CurPage].Y;var MMData=
new AscCommon.CMouseMoveData;var Coords=this.DrawingDocument.ConvertCoordsToCursorWR(_X,_Y,this.Get_AbsolutePage(CurPage),text_transform);MMData.X_abs=Coords.X-5;MMData.Y_abs=Coords.Y;MMData.Type=Asc.c_oAscMouseMoveDataTypes.LockedObject;MMData.UserId=this.Lock.Get_UserId();MMData.HaveChanges=this.Lock.Have_Changes();MMData.LockedObjectType=c_oAscMouseMoveLockedObjectType.Common;editor.sync_MouseMoveCallback(MMData)}};Paragraph.prototype.Document_CreateFontMap=function(FontMap){if(true===this.FontMap.NeedRecalc){this.FontMap.Map=
{};this.private_CompileParaPr();var FontScheme=this.Get_Theme().themeElements.fontScheme;var CurTextPr=this.CompiledPr.Pr.TextPr.Copy();CurTextPr.Document_CreateFontMap(this.FontMap.Map,FontScheme);CurTextPr.Merge(this.TextPr.Value);CurTextPr.Document_CreateFontMap(this.FontMap.Map,FontScheme);var Count=this.Content.length;for(var Index=0;Index<Count;Index++)this.Content[Index].Create_FontMap(this.FontMap.Map);this.FontMap.NeedRecalc=false}for(var Key in this.FontMap.Map)FontMap[Key]=this.FontMap.Map[Key]};
Paragraph.prototype.Document_CreateFontCharMap=function(FontCharMap){};Paragraph.prototype.Document_Get_AllFontNames=function(AllFonts){this.TextPr.Value.Document_Get_AllFontNames(AllFonts);if(this.Pr.Bullet)this.Pr.Bullet.Get_AllFontNames(AllFonts);if(this.Pr.DefaultRunPr)this.Pr.DefaultRunPr.Document_Get_AllFontNames(AllFonts);var Count=this.Content.length;for(var Index=0;Index<Count;Index++)this.Content[Index].Get_AllFontNames(AllFonts)};Paragraph.prototype.Document_UpdateRulersState=function(){if(this.CalculatedFrame){var oFrame=
this.CalculatedFrame;this.Parent.DrawingDocument.Set_RulerState_Paragraph({L:oFrame.L2,T:oFrame.T2,R:oFrame.L2+oFrame.W2,B:oFrame.T2+oFrame.H2,PageIndex:this.GetStartPageAbsolute(),Frame:this},false)}else if(this.Parent instanceof CDocument)if(this.LogicDocument)this.LogicDocument.Document_UpdateRulersStateBySection()};Paragraph.prototype.Document_UpdateInterfaceState=function(){var StartPos,EndPos;if(true===this.Selection.Use){StartPos=this.Get_ParaContentPos(true,true);EndPos=this.Get_ParaContentPos(true,
false)}else{var CurPos=this.Get_ParaContentPos(false,false);StartPos=CurPos;EndPos=CurPos}if(this.LogicDocument&&true===this.LogicDocument.Spelling.Use&&(selectionflag_Numbering!==this.Selection.Flag&&selectionflag_NumberingCur!==this.Selection.Flag))this.SpellChecker.Document_UpdateInterfaceState(StartPos,EndPos);if(true===this.Selection.Use){var StartPos=this.Selection.StartPos;var EndPos=this.Selection.EndPos;if(StartPos>EndPos){StartPos=this.Selection.EndPos;EndPos=this.Selection.StartPos}for(var CurPos=
StartPos;CurPos<=EndPos;CurPos++){var Element=this.Content[CurPos];if(true!==Element.IsSelectionEmpty()&&Element.Document_UpdateInterfaceState)Element.Document_UpdateInterfaceState()}}else{var CurType=this.Content[this.CurPos.ContentPos].Type;if(this.Content[this.CurPos.ContentPos].Document_UpdateInterfaceState)this.Content[this.CurPos.ContentPos].Document_UpdateInterfaceState()}var arrComplexFields=this.GetCurrentComplexFields();for(var nIndex=0,nCount=arrComplexFields.length;nIndex<nCount;++nIndex){var oInstruction=
arrComplexFields[nIndex].GetInstruction();if(oInstruction&&fieldtype_HYPERLINK===oInstruction.GetType()){var oHyperProps=new Asc.CHyperlinkProperty;oHyperProps.put_ToolTip(oInstruction.GetToolTip());oHyperProps.put_Value(oInstruction.GetValue());oHyperProps.put_Text(this.LogicDocument?this.LogicDocument.GetComplexFieldTextValue(arrComplexFields[nIndex]):null);oHyperProps.put_InternalHyperlink(oInstruction);editor.sync_HyperlinkPropCallback(oHyperProps)}}if(editor&&this.bFromDocument){if(!this.LogicDocument)return;
var TrackManager=this.LogicDocument.GetTrackRevisionsManager();if(this.Pages.length<=0&&this.Lines.length<=0)return;var ContentPos=this.Get_ParaContentPos(this.Selection.Use,true);var ParaPos=this.Get_ParaPosByContentPos(ContentPos);if(this.Pages.length<=ParaPos.Page||this.Lines.length<=ParaPos.Line)return;var Page_abs=this.Get_AbsolutePage(ParaPos.Page);var _Y=this.Pages[ParaPos.Page].Y+this.Lines[ParaPos.Line].Top;var TextTransform=this.Get_ParentTextTransform();var _X=this.LogicDocument?this.LogicDocument.Get_PageLimits(Page_abs).XLimit:
0;var Coords=this.DrawingDocument.ConvertCoordsToCursorWR(_X,_Y,Page_abs,TextTransform);if(false===this.Selection.Use){var Changes=TrackManager.GetElementChanges(this.GetId());if(Changes.length>0)for(var ChangeIndex=0,ChangesCount=Changes.length;ChangeIndex<ChangesCount;ChangeIndex++){var Change=Changes[ChangeIndex];var Type=Change.get_Type();if(c_oAscRevisionsChangeType.TextAdd!==Type&&c_oAscRevisionsChangeType.TextRem!==Type&&c_oAscRevisionsChangeType.TextPr!==Type||StartPos.Compare(Change.get_StartPos())>=
0&&StartPos.Compare(Change.get_EndPos())<=0){Change.put_InternalPos(_X,_Y,Page_abs);TrackManager.AddVisibleChange(Change)}}}}};Paragraph.prototype.PreDelete=function(){for(var Index=0;Index<this.Content.length;Index++){var Item=this.Content[Index];if(Item.PreDelete)Item.PreDelete();if(this.LogicDocument)if(para_Comment===Item.Type&&true===this.LogicDocument.RemoveCommentsOnPreDelete)this.LogicDocument.RemoveComment(Item.CommentId,true,false);else if(para_Bookmark===Item.Type)this.LogicDocument.GetBookmarksManager().SetNeedUpdate(true)}this.RemoveSelection();
this.UpdateDocumentOutline();if(undefined!==this.Get_SectionPr()&&this.LogicDocument)this.Set_SectionPr(undefined)};Paragraph.prototype.Document_SetThisElementCurrent=function(bUpdateStates){this.Parent.Update_ContentIndexing();this.Parent.Set_CurrentElement(this.Index,bUpdateStates)};Paragraph.prototype.Is_ThisElementCurrent=function(){var Parent=this.Parent;Parent.Update_ContentIndexing();if(docpostype_Content===Parent.GetDocPosType()&&false===Parent.Selection.Use&&this.Index===Parent.CurPos.ContentPos&&
Parent.Content[this.Index]===this)return this.Parent.Is_ThisElementCurrent();return false};Paragraph.prototype.Is_Inline=function(){if(this.bFromDocument===false)return true;var PrevElement=this.Get_DocumentPrev();if(true===this.Is_Empty()&&undefined!==this.Get_SectionPr()&&null!==PrevElement&&(type_Paragraph!==PrevElement.Get_Type()||undefined===PrevElement.Get_SectionPr()))return true;if(undefined===this.Parent||!(this.Parent instanceof CDocument)&&(undefined===this.Parent.Parent||!(this.Parent.Parent instanceof
CHeaderFooter)))return true;if(undefined!=this.Pr.FramePr&&Asc.c_oAscYAlign.Inline!==this.Pr.FramePr.YAlign)return false;return true};Paragraph.prototype.IsInline=function(){return this.Is_Inline()};Paragraph.prototype.GetFramePr=function(){return this.Get_CompiledPr2(false).ParaPr.FramePr};Paragraph.prototype.Get_FramePr=function(){return this.GetFramePr()};Paragraph.prototype.Set_FramePr=function(FramePr,bDelete){var FramePr_old=this.Pr.FramePr;if(undefined===bDelete)bDelete=false;if(true===bDelete){this.Pr.FramePr=
undefined;this.private_AddPrChange();History.Add(new CChangesParagraphFramePr(this,FramePr_old,undefined));this.CompiledPr.NeedRecalc=true;this.private_UpdateTrackRevisionOnChangeParaPr(true);return}var FrameParas=this.Internal_Get_FrameParagraphs();if(true===FramePr.FromDropCapMenu&&1===FrameParas.length){var NewFramePr=FramePr_old?FramePr_old.Copy():new CFramePr;if(undefined!=FramePr.DropCap){var OldLines=NewFramePr.Lines;NewFramePr.Init_Default_DropCap(FramePr.DropCap===Asc.c_oAscDropCap.Drop?
true:false);NewFramePr.Lines=OldLines}if(undefined!=FramePr.Lines){var AnchorPara=this.Get_FrameAnchorPara();if(null===AnchorPara||AnchorPara.Lines.length<=0)return;var Before=AnchorPara.Get_CompiledPr().ParaPr.Spacing.Before;var LineH=AnchorPara.Lines[0].Bottom-AnchorPara.Lines[0].Top-Before;var LineTA=AnchorPara.Lines[0].Metrics.TextAscent2;var LineTD=AnchorPara.Lines[0].Metrics.TextDescent+AnchorPara.Lines[0].Metrics.LineGap;this.Set_Spacing({LineRule:linerule_Exact,Line:FramePr.Lines*LineH},false);
this.Update_DropCapByLines(this.Internal_CalculateTextPr(this.Internal_GetStartPos()),FramePr.Lines,LineH,LineTA,LineTD,Before);NewFramePr.Lines=FramePr.Lines}if(undefined!=FramePr.FontFamily){var FF=new ParaTextPr({RFonts:{Ascii:{Name:FramePr.FontFamily.Name,Index:-1}}});this.SelectAll();this.Add(FF);this.RemoveSelection()}if(undefined!=FramePr.HSpace)NewFramePr.HSpace=FramePr.HSpace;this.Pr.FramePr=NewFramePr}else{var NewFramePr=FramePr_old?FramePr_old.Copy():new CFramePr;if(undefined!=FramePr.H)NewFramePr.H=
FramePr.H;if(undefined!=FramePr.HAnchor)NewFramePr.HAnchor=FramePr.HAnchor;if(undefined!=FramePr.HRule)NewFramePr.HRule=FramePr.HRule;if(undefined!=FramePr.HSpace)NewFramePr.HSpace=FramePr.HSpace;if(undefined!=FramePr.Lines)NewFramePr.Lines=FramePr.Lines;if(undefined!=FramePr.VAnchor)NewFramePr.VAnchor=FramePr.VAnchor;if(undefined!=FramePr.VSpace)NewFramePr.VSpace=FramePr.VSpace;NewFramePr.W=FramePr.W;if(undefined!=FramePr.X){NewFramePr.X=FramePr.X;NewFramePr.XAlign=undefined}if(undefined!=FramePr.XAlign){NewFramePr.XAlign=
FramePr.XAlign;NewFramePr.X=undefined}if(undefined!=FramePr.Y){NewFramePr.Y=FramePr.Y;NewFramePr.YAlign=undefined}if(undefined!=FramePr.YAlign){NewFramePr.YAlign=FramePr.YAlign;NewFramePr.Y=undefined}if(undefined!==FramePr.Wrap)if(false===FramePr.Wrap)NewFramePr.Wrap=wrap_NotBeside;else if(true===FramePr.Wrap)NewFramePr.Wrap=wrap_Around;else NewFramePr.Wrap=FramePr.Wrap;this.Pr.FramePr=NewFramePr}if(undefined!=FramePr.Brd){var Count=FrameParas.length;for(var Index=0;Index<Count;Index++)FrameParas[Index].Set_Borders(FramePr.Brd)}if(undefined!=
FramePr.Shd){var Count=FrameParas.length;for(var Index=0;Index<Count;Index++)FrameParas[Index].Set_Shd(FramePr.Shd)}this.private_AddPrChange();History.Add(new CChangesParagraphFramePr(this,FramePr_old,this.Pr.FramePr));this.CompiledPr.NeedRecalc=true;this.private_UpdateTrackRevisionOnChangeParaPr(true)};Paragraph.prototype.Set_FramePr2=function(FramePr){this.private_AddPrChange();History.Add(new CChangesParagraphFramePr(this,this.Pr.FramePr,FramePr));this.Pr.FramePr=FramePr;this.CompiledPr.NeedRecalc=
true;this.private_UpdateTrackRevisionOnChangeParaPr(true)};Paragraph.prototype.Set_FrameParaPr=function(Para){Para.CopyPr(this);Para.Set_Ind({FirstLine:0},false);this.Set_Spacing({After:0},false);this.Set_Ind({Right:0},false);this.RemoveNumPr()};Paragraph.prototype.Get_FrameBounds=function(FrameX,FrameY,FrameW,FrameH){var X0=FrameX,Y0=FrameY,X1=FrameX+FrameW,Y1=FrameY+FrameH;var Paras=this.Internal_Get_FrameParagraphs();var Count=Paras.length;var FramePr=this.Get_FramePr();if(0>=Count)return{X:X0,
Y:Y0,W:X1-X0,H:Y1-Y0};for(var Index=0;Index<Count;Index++){var Para=Paras[Index];var ParaPr=Para.Get_CompiledPr2(false).ParaPr;var Brd=ParaPr.Brd;var _X0=FrameX;if(undefined!==Brd.Left&&border_None!==Brd.Left.Value)_X0-=Brd.Left.Size+Brd.Left.Space+1;if(_X0<X0)X0=_X0;var _X1=FrameX+FrameW;if(undefined!==Brd.Right&&border_None!==Brd.Right.Value){_X1=Math.max(_X1,_X1-ParaPr.Ind.Right);_X1+=Brd.Right.Size+Brd.Right.Space+1}if(_X1>X1)X1=_X1}var _Y1=Y1;var BottomBorder=Paras[Count-1].Get_CompiledPr2(false).ParaPr.Brd.Bottom;
if(undefined!==BottomBorder&&border_None!==BottomBorder.Value)_Y1+=BottomBorder.Size+BottomBorder.Space;if(_Y1>Y1&&(Asc.linerule_Auto===FramePr.HRule||Asc.linerule_AtLeast===FramePr.HRule&&FrameH>=FramePr.H))Y1=_Y1;return{X:X0,Y:Y0,W:X1-X0,H:Y1-Y0}};Paragraph.prototype.SetCalculatedFrame=function(oFrame){this.CalculatedFrame=oFrame;oFrame.AddParagraph(this)};Paragraph.prototype.GetCalculatedFrame=function(){return this.CalculatedFrame};Paragraph.prototype.Internal_Get_FrameParagraphs=function(){if(this.CalculatedFrame&&
this.CalculatedFrame.GetParagraphs().length>0)return this.CalculatedFrame.GetParagraphs();var FrameParas=[];var FramePr=this.Get_FramePr();if(undefined===FramePr)return FrameParas;FrameParas.push(this);var Prev=this.Get_DocumentPrev();while(null!=Prev)if(type_Paragraph===Prev.GetType()){var PrevFramePr=Prev.Get_FramePr();if(undefined!=PrevFramePr&&true===FramePr.Compare(PrevFramePr)){FrameParas.push(Prev);Prev=Prev.Get_DocumentPrev()}else break}else break;var Next=this.Get_DocumentNext();while(null!=
Next)if(type_Paragraph===Next.GetType()){var NextFramePr=Next.Get_FramePr();if(undefined!=NextFramePr&&true===FramePr.Compare(NextFramePr)){FrameParas.push(Next);Next=Next.Get_DocumentNext()}else break}else break;return FrameParas};Paragraph.prototype.Is_LineDropCap=function(){var FrameParas=this.Internal_Get_FrameParagraphs();if(1!==FrameParas.length||1!==this.Lines.length)return false;return true};Paragraph.prototype.Get_LineDropCapWidth=function(){var W=this.Lines[0].Ranges[0].W;var ParaPr=this.Get_CompiledPr2(false).ParaPr;
W+=ParaPr.Ind.Left+ParaPr.Ind.FirstLine;return W};Paragraph.prototype.Change_Frame=function(X,Y,W,H,PageIndex){if(!this.LogicDocument||!this.CalculatedFrame||!this.CalculatedFrame.GetFramePr())return;var FramePr=this.CalculatedFrame.GetFramePr();if(Math.abs(Y-this.CalculatedFrame.T2)<.001&&Math.abs(X-this.CalculatedFrame.L2)<.001&&Math.abs(W-this.CalculatedFrame.W2)<.001&&Math.abs(H-this.CalculatedFrame.H2)<.001&&PageIndex===this.CalculatedFrame.PageIndex)return;var FrameParas=this.Internal_Get_FrameParagraphs();
if(false===this.LogicDocument.Document_Is_SelectionLocked(AscCommon.changestype_None,{Type:AscCommon.changestype_2_ElementsArray_and_Type,Elements:FrameParas,CheckType:AscCommon.changestype_Paragraph_Content})){this.LogicDocument.StartAction(AscDFH.historydescription_Document_ParagraphChangeFrame);var NewFramePr=FramePr.Copy();if(Math.abs(X-this.CalculatedFrame.L2)>.001){NewFramePr.X=X+(this.CalculatedFrame.L-this.CalculatedFrame.L2);NewFramePr.XAlign=undefined;NewFramePr.HAnchor=Asc.c_oAscHAnchor.Page}if(Math.abs(Y-
this.CalculatedFrame.T2)>.001){NewFramePr.Y=Y+(this.CalculatedFrame.T-this.CalculatedFrame.T2);NewFramePr.YAlign=undefined;NewFramePr.VAnchor=Asc.c_oAscVAnchor.Page}if(Math.abs(W-this.CalculatedFrame.W2)>.001)NewFramePr.W=W-Math.abs(this.CalculatedFrame.W2-this.CalculatedFrame.W);if(Math.abs(H-this.CalculatedFrame.H2)>.001)if(undefined!=FramePr.DropCap&&Asc.c_oAscDropCap.None!=FramePr.DropCap&&1===FrameParas.length){var PageH=this.LogicDocument.Get_PageLimits(PageIndex).YLimit;var _H=Math.min(H,PageH);
NewFramePr.Lines=this.Update_DropCapByHeight(_H);NewFramePr.HRule=linerule_Exact;NewFramePr.H=H-Math.abs(this.CalculatedFrame.H2-this.CalculatedFrame.H)}else{if(H<=this.CalculatedFrame.H2)NewFramePr.HRule=linerule_Exact;else NewFramePr.HRule=Asc.linerule_AtLeast;NewFramePr.H=H}var Count=FrameParas.length;for(var Index=0;Index<Count;Index++){var Para=FrameParas[Index];Para.Set_FramePr(NewFramePr,false)}this.LogicDocument.Recalculate();this.LogicDocument.UpdateInterface();this.LogicDocument.UpdateRulers();
this.LogicDocument.UpdateTracks();this.LogicDocument.FinalizeAction()}};Paragraph.prototype.Supplement_FramePr=function(FramePr){if(undefined!=FramePr.DropCap&&Asc.c_oAscDropCap.None!=FramePr.DropCap){var _FramePr=this.Get_FramePr();var FirstFramePara=this;var Prev=FirstFramePara.Get_DocumentPrev();while(null!=Prev)if(type_Paragraph===Prev.GetType()){var PrevFramePr=Prev.Get_FramePr();if(undefined!=PrevFramePr&&true===_FramePr.Compare(PrevFramePr)){FirstFramePara=Prev;Prev=Prev.Get_DocumentPrev()}else break}else break;
var TextPr=FirstFramePara.GetFirstRunPr();if(undefined===TextPr.RFonts||undefined===TextPr.RFonts.Ascii)TextPr=this.Get_CompiledPr2(false).TextPr;FramePr.FontFamily={Name:TextPr.RFonts.Ascii.Name,Index:TextPr.RFonts.Ascii.Index}}var FrameParas=this.Internal_Get_FrameParagraphs();var Count=FrameParas.length;var ParaPr=FrameParas[0].Get_CompiledPr2(false).ParaPr.Copy();for(var Index=1;Index<Count;Index++){var TempPr=FrameParas[Index].Get_CompiledPr2(false).ParaPr;ParaPr=ParaPr.Compare(TempPr)}FramePr.Brd=
ParaPr.Brd;FramePr.Shd=ParaPr.Shd};Paragraph.prototype.CanAddDropCap=function(){for(var nPos=0,nCount=this.Content.length;nPos<nCount;++nPos){var bResult=this.Content[nPos].CanAddDropCap();if(null!==bResult)return bResult}return false};Paragraph.prototype.Get_TextForDropCap=function(DropCapText,UseContentPos,ContentPos,Depth){var EndPos=true===UseContentPos?ContentPos.Get(Depth):this.Content.length-1;for(var Pos=0;Pos<=EndPos;Pos++){this.Content[Pos].Get_TextForDropCap(DropCapText,true===UseContentPos&&
Pos===EndPos?true:false,ContentPos,Depth+1);if(true===DropCapText.Mixed&&(true===DropCapText.Check||DropCapText.Runs.length>0))return}};Paragraph.prototype.Split_DropCap=function(NewParagraph){var DropCapText=new CParagraphGetDropCapText;if(true==this.Selection.Use&&this.Parent.IsSelectedSingleElement()){var SelSP=this.Get_ParaContentPos(true,true);var SelEP=this.Get_ParaContentPos(true,false);if(0<=SelSP.Compare(SelEP))SelEP=SelSP;DropCapText.Check=true;this.Get_TextForDropCap(DropCapText,true,SelEP,
0);DropCapText.Check=false;this.Get_TextForDropCap(DropCapText,true,SelEP,0)}else{DropCapText.Mixed=true;DropCapText.Check=false;this.Get_TextForDropCap(DropCapText,false)}var Count=DropCapText.Text.length;var PrevRun=null;var CurrRun=null;for(var Pos=0,ParaPos=0,RunPos=0;Pos<Count;Pos++){if(PrevRun!==DropCapText.Runs[Pos]){PrevRun=DropCapText.Runs[Pos];CurrRun=new ParaRun(NewParagraph);CurrRun.Set_Pr(DropCapText.Runs[Pos].Pr.Copy());NewParagraph.Internal_Content_Add(ParaPos++,CurrRun,false);RunPos=
0}CurrRun.Add_ToContent(RunPos++,DropCapText.Text[Pos],false)}if(Count>0)return DropCapText.Runs[Count-1].Get_CompiledPr(true);return null};Paragraph.prototype.SelectFirstLetter=function(){var oStartPos=new CParagraphContentPos;var oEndPos=new CParagraphContentPos;for(var nPos=0,nCount=this.Content.length;nPos<nCount;++nPos){oStartPos.Update(nPos,0);oEndPos.Update(nPos,0);if(this.Content[nPos].GetFirstRunElementPos(para_Text,oStartPos,oEndPos,1)){this.StartSelectionFromCurPos();this.SetSelectionContentPos(oStartPos,
oEndPos,false);this.Document_SetThisElementCurrent();return true}}return false};Paragraph.prototype.CheckSelectionForDropCap=function(){var oSelectionStart=this.Get_ParaContentPos(true,true);var oSelectionEnd=this.Get_ParaContentPos(true,false);if(0<=oSelectionStart.Compare(oSelectionEnd))oSelectionEnd=oSelectionStart;var nEndPos=oSelectionEnd.Get(0);for(var nPos=0;nPos<=nEndPos;++nPos)if(!this.Content[nPos].CheckSelectionForDropCap(nPos===nEndPos,oSelectionEnd,1))return false;return true};Paragraph.prototype.Update_DropCapByLines=
function(TextPr,Count,LineH,LineTA,LineTD,Before){if(null===TextPr)return;this.Set_Spacing({Before:Before,After:0,LineRule:linerule_Exact,Line:Count*LineH-.001},false);var FontSize=72;TextPr.FontSize=FontSize;g_oTextMeasurer.SetTextPr(TextPr,this.Get_Theme());g_oTextMeasurer.SetFontSlot(fontslot_ASCII,1);var TMetrics={Ascent:null,Descent:null};this.private_RecalculateTextMetrics(TMetrics);var TDescent=TMetrics.Descent;var TAscent=TMetrics.Ascent;var THeight=0;if(null===TAscent||null===TDescent)THeight=
g_oTextMeasurer.GetHeight();else THeight=-TDescent+TAscent;var EmHeight=THeight;var NewEmHeight=(Count-1)*LineH+LineTA;var Koef=NewEmHeight/EmHeight;var NewFontSize=TextPr.FontSize*Koef;TextPr.FontSize=parseInt(NewFontSize*2)/2;g_oTextMeasurer.SetTextPr(TextPr,this.Get_Theme());g_oTextMeasurer.SetFontSlot(fontslot_ASCII,1);var TNewMetrics={Ascent:null,Descent:null};this.private_RecalculateTextMetrics(TNewMetrics);var TNewDescent=TNewMetrics.Descent;var TNewAscent=TNewMetrics.Ascent;var TNewHeight=
0;if(null===TNewAscent||null===TNewDescent)TNewHeight=g_oTextMeasurer.GetHeight();else TNewHeight=-TNewDescent+TNewAscent;var Descent=g_oTextMeasurer.GetDescender();var Ascent=g_oTextMeasurer.GetAscender();var Dy=Descent*(LineH*Count)/(Ascent-Descent)+TNewHeight-TNewAscent+LineTD;var PTextPr=new ParaTextPr({RFonts:{Ascii:{Name:TextPr.RFonts.Ascii.Name,Index:-1}},FontSize:TextPr.FontSize,Position:Dy});this.SelectAll();this.Add(PTextPr);this.RemoveSelection()};Paragraph.prototype.Update_DropCapByHeight=
function(_Height){var AnchorPara=this.Get_FrameAnchorPara();if(null===AnchorPara||AnchorPara.Lines.length<=0)return 1;var Before=AnchorPara.Get_CompiledPr().ParaPr.Spacing.Before;var LineH=AnchorPara.Lines[0].Bottom-AnchorPara.Lines[0].Top-Before;var LineTA=AnchorPara.Lines[0].Metrics.TextAscent2;var LineTD=AnchorPara.Lines[0].Metrics.TextDescent+AnchorPara.Lines[0].Metrics.LineGap;var Height=_Height-Before;this.Set_Spacing({LineRule:linerule_Exact,Line:Height},false);var LinesCount=Math.ceil(Height/
LineH);var TextPr=this.Internal_CalculateTextPr(this.Internal_GetStartPos());g_oTextMeasurer.SetTextPr(TextPr,this.Get_Theme());g_oTextMeasurer.SetFontSlot(fontslot_ASCII,1);var TMetrics={Ascent:null,Descent:null};this.private_RecalculateTextMetrics(TMetrics);var TDescent=TMetrics.Descent;var TAscent=TMetrics.Ascent;var THeight=0;if(null===TAscent||null===TDescent)THeight=g_oTextMeasurer.GetHeight();else THeight=-TDescent+TAscent;var Koef=(Height-LineTD)/THeight;var NewFontSize=TextPr.FontSize*Koef;
TextPr.FontSize=parseInt(NewFontSize*2)/2;g_oTextMeasurer.SetTextPr(TextPr,this.Get_Theme());g_oTextMeasurer.SetFontSlot(fontslot_ASCII,1);var TNewMetrics={Ascent:null,Descent:null};this.private_RecalculateTextMetrics(TNewMetrics);var TNewDescent=TNewMetrics.Descent;var TNewAscent=TNewMetrics.Ascent;var TNewHeight=0;if(null===TNewAscent||null===TNewDescent)TNewHeight=g_oTextMeasurer.GetHeight();else TNewHeight=-TNewDescent+TNewAscent;var Descent=g_oTextMeasurer.GetDescender();var Ascent=g_oTextMeasurer.GetAscender();
var Dy=Descent*Height/(Ascent-Descent)+TNewHeight-TNewAscent+LineTD;var PTextPr=new ParaTextPr({RFonts:{Ascii:{Name:TextPr.RFonts.Ascii.Name,Index:-1}},FontSize:TextPr.FontSize,Position:Dy});this.SelectAll();this.Add(PTextPr);this.RemoveSelection();return LinesCount};Paragraph.prototype.Get_FrameAnchorPara=function(){var FramePr=this.Get_FramePr();if(undefined===FramePr)return null;var Next=this.Get_DocumentNext();while(null!=Next){if(type_Paragraph===Next.GetType()){var NextFramePr=Next.Get_FramePr();
if(undefined===NextFramePr||false===FramePr.Compare(NextFramePr))return Next}Next=Next.Get_DocumentNext()}return Next};Paragraph.prototype.Split=function(NewParagraph){if(!NewParagraph)NewParagraph=new Paragraph(this.DrawingDocument,this.Parent);NewParagraph.DeleteCommentOnRemove=false;this.DeleteCommentOnRemove=false;this.RemoveSelection();NewParagraph.RemoveSelection();var ContentPos=this.Get_ParaContentPos(false,false);var CurPos=ContentPos.Get(0);var TextPr=this.Get_TextPr(ContentPos);var oLogicDocument=
this.GetLogicDocument();var oStyles=oLogicDocument&&oLogicDocument.GetStyles?oLogicDocument.GetStyles():null;if(oStyles&&(TextPr.RStyle===oStyles.GetDefaultEndnoteReference()||TextPr.RStyle===oStyles.GetDefaultFootnoteReference())){TextPr=TextPr.Copy();TextPr.RStyle=undefined}var NewElement=this.Content[CurPos].Split(ContentPos,1);if(null===NewElement){NewElement=new ParaRun(NewParagraph);NewElement.Set_Pr(TextPr.Copy())}var NewContent=this.Content.slice(CurPos+1);this.Internal_Content_Remove2(CurPos+
1,this.Content.length-CurPos-1);var EndRun=new ParaRun(this);EndRun.Add_ToContent(0,new ParaEnd);this.Internal_Content_Add(this.Content.length,EndRun);NewParagraph.Internal_Content_Remove2(0,NewParagraph.Content.length);NewParagraph.Internal_Content_Concat(NewContent);NewParagraph.Internal_Content_Add(0,NewElement);NewParagraph.Correct_Content();this.CopyPr(NewParagraph);this.TextPr.Clear_Style();this.TextPr.Apply_TextPr(TextPr);var SectPr=this.Get_SectionPr();if(undefined!==SectPr){this.Set_SectionPr(undefined);
NewParagraph.Set_SectionPr(SectPr)}this.MoveCursorToEndPos(false,false);NewParagraph.MoveCursorToStartPos(false);NewParagraph.DeleteCommentOnRemove=true;this.DeleteCommentOnRemove=true;return NewParagraph};Paragraph.prototype.Concat=function(Para,isUseConcatedStyle){this.DeleteCommentOnRemove=false;Para.DeleteCommentOnRemove=false;this.Remove_ParaEnd();var NearPosCount=Para.NearPosArray.length;for(var Pos=0;Pos<NearPosCount;Pos++){var ParaNearPos=Para.NearPosArray[Pos];ParaNearPos.Classes[0]=this;
ParaNearPos.NearPos.Paragraph=this;ParaNearPos.NearPos.ContentPos.Data[0]+=this.Content.length;this.NearPosArray.push(ParaNearPos)}this.Internal_Content_Concat(Para.Content);Para.ClearContent();this.Set_SectionPr(undefined);var SectPr=Para.Get_SectionPr();if(undefined!==SectPr){Para.Set_SectionPr(undefined);this.Set_SectionPr(SectPr)}this.DeleteCommentOnRemove=true;Para.DeleteCommentOnRemove=true;if(true===isUseConcatedStyle)Para.CopyPr(this)};Paragraph.prototype.ConcatBefore=function(oPara){this.DeleteCommentOnRemove=
false;oPara.DeleteCommentOnRemove=false;oPara.Remove_ParaEnd();for(var nPos=0,nCount=this.NearPosArray.length;nPos<nCount;++nPos){var oParaNearPos=this.NearPosArray[nPos];oParaNearPos.NearPos.ContentPos.Data[0]+=oPara.Content.length}for(var nPos=0,nCount=oPara.NearPosArray.length;nPos<nCount;++nPos){var oParaNearPos=oPara.NearPosArray[nPos];oParaNearPos.Classes[0]=this;oParaNearPos.NearPos.Paragraph=this;this.NearPosArray.push(oParaNearPos)}for(var nPos=0,nCount=oPara.Content.length;nPos<nCount;++nPos)this.AddToContent(nPos,
oPara.Content[nPos]);oPara.ClearContent();oPara.Set_SectionPr(undefined);this.DeleteCommentOnRemove=true;oPara.DeleteCommentOnRemove=true;oPara.CopyPr(this)};Paragraph.prototype.Continue=function(NewParagraph){var TextPr;if(this.IsEmpty())TextPr=this.TextPr.Value.Copy();else{var EndPos=this.Get_EndPos2(false);var CurPos=this.Get_ParaContentPos(false,false);this.Set_ParaContentPos(EndPos,true,-1,-1);TextPr=this.Get_TextPr(this.Get_ParaContentPos(false,false)).Copy();this.Set_ParaContentPos(CurPos,
false,-1,-1,false);TextPr.HighLight=highlight_None;var oStyles;if(this.bFromDocument&&this.LogicDocument&&(oStyles=this.LogicDocument.GetStyles())&&(TextPr.RStyle===oStyles.GetDefaultFootnoteReference()||TextPr.RStyle===oStyles.GetDefaultEndnoteReference()))TextPr.RStyle=undefined}this.CopyPr(NewParagraph);if(!this.HaveNumbering()&&!this.Lock.Is_Locked()){this.TextPr.Clear_Style();this.TextPr.Apply_TextPr(TextPr)}NewParagraph.Internal_Content_Add(0,new ParaRun(NewParagraph));NewParagraph.Correct_Content();
NewParagraph.MoveCursorToStartPos(false);for(var Pos=0,Count=NewParagraph.Content.length;Pos<Count;Pos++)if(para_Run===NewParagraph.Content[Pos].Type)NewParagraph.Content[Pos].Set_Pr(TextPr.Copy())};Paragraph.prototype.GetSelectionState=function(){var ParaState={};ParaState.CurPos={X:this.CurPos.X,Y:this.CurPos.Y,Line:this.CurPos.Line,ContentPos:this.Get_ParaContentPos(false,false),RealX:this.CurPos.RealX,RealY:this.CurPos.RealY,PagesPos:this.CurPos.PagesPos};ParaState.Selection={Start:this.Selection.Start,
Use:this.Selection.Use,StartPos:0,EndPos:0,Flag:this.Selection.Flag};if(true===this.Selection.Use){ParaState.Selection.StartPos=this.Get_ParaContentPos(true,true);ParaState.Selection.EndPos=this.Get_ParaContentPos(true,false)}return[ParaState]};Paragraph.prototype.SetSelectionState=function(State,StateIndex){if(State.length<=0)return;var ParaState=State[StateIndex];this.CurPos.X=ParaState.CurPos.X;this.CurPos.Y=ParaState.CurPos.Y;this.CurPos.Line=ParaState.CurPos.Line;this.CurPos.RealX=ParaState.CurPos.RealX;
this.CurPos.RealY=ParaState.CurPos.RealY;this.CurPos.PagesPos=ParaState.CurPos.PagesPos;this.Set_ParaContentPos(ParaState.CurPos.ContentPos,true,-1,-1);this.RemoveSelection();this.Selection.Start=ParaState.Selection.Start;this.Selection.Use=ParaState.Selection.Use;this.Selection.Flag=ParaState.Selection.Flag;if(true===this.Selection.Use)this.Set_SelectionContentPos(ParaState.Selection.StartPos,ParaState.Selection.EndPos)};Paragraph.prototype.Get_ParentObject_or_DocumentPos=function(){this.Parent.Update_ContentIndexing();
return this.Parent.Get_ParentObject_or_DocumentPos(this.Index)};Paragraph.prototype.Refresh_RecalcData=function(Data){var Type=Data.Type;var bNeedRecalc=false;var CurPage=0;switch(Type){case AscDFH.historyitem_Paragraph_AddItem:case AscDFH.historyitem_Paragraph_RemoveItem:{for(CurPage=this.Pages.length-1;CurPage>0;CurPage--)if(Data.Pos>this.Lines[this.Pages[CurPage].StartLine].Get_StartPos())break;this.RecalcInfo.Set_Type_0(pararecalc_0_All);bNeedRecalc=true;break}case AscDFH.historyitem_Paragraph_Numbering:case AscDFH.historyitem_Paragraph_PStyle:case AscDFH.historyitem_Paragraph_Pr:case AscDFH.historyitem_Paragraph_PresentationPr_Bullet:case AscDFH.historyitem_Paragraph_PresentationPr_Level:{this.RecalcInfo.Set_Type_0(pararecalc_0_All);
bNeedRecalc=true;this.CompiledPr.NeedRecalc=true;this.Recalc_RunsCompiledPr();break}case AscDFH.historyitem_Paragraph_Align:case AscDFH.historyitem_Paragraph_DefaultTabSize:case AscDFH.historyitem_Paragraph_Ind_First:case AscDFH.historyitem_Paragraph_Ind_Left:case AscDFH.historyitem_Paragraph_Ind_Right:case AscDFH.historyitem_Paragraph_ContextualSpacing:case AscDFH.historyitem_Paragraph_KeepLines:case AscDFH.historyitem_Paragraph_KeepNext:case AscDFH.historyitem_Paragraph_PageBreakBefore:case AscDFH.historyitem_Paragraph_Spacing_Line:case AscDFH.historyitem_Paragraph_Spacing_LineRule:case AscDFH.historyitem_Paragraph_Spacing_Before:case AscDFH.historyitem_Paragraph_Spacing_After:case AscDFH.historyitem_Paragraph_Spacing_AfterAutoSpacing:case AscDFH.historyitem_Paragraph_Spacing_BeforeAutoSpacing:case AscDFH.historyitem_Paragraph_WidowControl:case AscDFH.historyitem_Paragraph_Tabs:case AscDFH.historyitem_Paragraph_Borders_Between:case AscDFH.historyitem_Paragraph_Borders_Bottom:case AscDFH.historyitem_Paragraph_Borders_Left:case AscDFH.historyitem_Paragraph_Borders_Right:case AscDFH.historyitem_Paragraph_Borders_Top:case AscDFH.historyitem_Paragraph_FramePr:{bNeedRecalc=
Paragraph.prototype.Document_CreateFontCharMap=function(FontCharMap){};Paragraph.prototype.Document_Get_AllFontNames=function(AllFonts){this.TextPr.Value.Document_Get_AllFontNames(AllFonts);if(this.Pr.Bullet)this.Pr.Bullet.Get_AllFontNames(AllFonts);if(this.Pr.DefaultRunPr)this.Pr.DefaultRunPr.Document_Get_AllFontNames(AllFonts);var Count=this.Content.length;for(var Index=0;Index<Count;Index++)if(this.Content[Index]&&typeof this.Content[Index].Get_AllFontNames==="function")this.Content[Index].Get_AllFontNames(AllFonts)};
Paragraph.prototype.Document_UpdateRulersState=function(){if(this.CalculatedFrame){var oFrame=this.CalculatedFrame;this.Parent.DrawingDocument.Set_RulerState_Paragraph({L:oFrame.L2,T:oFrame.T2,R:oFrame.L2+oFrame.W2,B:oFrame.T2+oFrame.H2,PageIndex:this.GetStartPageAbsolute(),Frame:this},false)}else if(this.Parent instanceof CDocument)if(this.LogicDocument)this.LogicDocument.Document_UpdateRulersStateBySection()};Paragraph.prototype.Document_UpdateInterfaceState=function(){var StartPos,EndPos;if(true===
this.Selection.Use){StartPos=this.Get_ParaContentPos(true,true);EndPos=this.Get_ParaContentPos(true,false)}else{var CurPos=this.Get_ParaContentPos(false,false);StartPos=CurPos;EndPos=CurPos}if(this.LogicDocument&&true===this.LogicDocument.Spelling.Use&&(selectionflag_Numbering!==this.Selection.Flag&&selectionflag_NumberingCur!==this.Selection.Flag))this.SpellChecker.Document_UpdateInterfaceState(StartPos,EndPos);if(true===this.Selection.Use){var StartPos=this.Selection.StartPos;var EndPos=this.Selection.EndPos;
if(StartPos>EndPos){StartPos=this.Selection.EndPos;EndPos=this.Selection.StartPos}for(var CurPos=StartPos;CurPos<=EndPos;CurPos++){var Element=this.Content[CurPos];if(true!==Element.IsSelectionEmpty()&&Element.Document_UpdateInterfaceState)Element.Document_UpdateInterfaceState()}}else{var CurType=this.Content[this.CurPos.ContentPos].Type;if(this.Content[this.CurPos.ContentPos].Document_UpdateInterfaceState)this.Content[this.CurPos.ContentPos].Document_UpdateInterfaceState()}var arrComplexFields=this.GetCurrentComplexFields();
for(var nIndex=0,nCount=arrComplexFields.length;nIndex<nCount;++nIndex){var oInstruction=arrComplexFields[nIndex].GetInstruction();if(oInstruction&&fieldtype_HYPERLINK===oInstruction.GetType()){var oHyperProps=new Asc.CHyperlinkProperty;oHyperProps.put_ToolTip(oInstruction.GetToolTip());oHyperProps.put_Value(oInstruction.GetValue());oHyperProps.put_Text(this.LogicDocument?this.LogicDocument.GetComplexFieldTextValue(arrComplexFields[nIndex]):null);oHyperProps.put_InternalHyperlink(oInstruction);editor.sync_HyperlinkPropCallback(oHyperProps)}}if(editor&&
this.bFromDocument){if(!this.LogicDocument)return;var TrackManager=this.LogicDocument.GetTrackRevisionsManager();if(this.Pages.length<=0&&this.Lines.length<=0)return;var ContentPos=this.Get_ParaContentPos(this.Selection.Use,true);var ParaPos=this.Get_ParaPosByContentPos(ContentPos);if(this.Pages.length<=ParaPos.Page||this.Lines.length<=ParaPos.Line)return;var Page_abs=this.Get_AbsolutePage(ParaPos.Page);var _Y=this.Pages[ParaPos.Page].Y+this.Lines[ParaPos.Line].Top;var TextTransform=this.Get_ParentTextTransform();
var _X=this.LogicDocument?this.LogicDocument.Get_PageLimits(Page_abs).XLimit:0;var Coords=this.DrawingDocument.ConvertCoordsToCursorWR(_X,_Y,Page_abs,TextTransform);if(false===this.Selection.Use){var Changes=TrackManager.GetElementChanges(this.GetId());if(Changes.length>0)for(var ChangeIndex=0,ChangesCount=Changes.length;ChangeIndex<ChangesCount;ChangeIndex++){var Change=Changes[ChangeIndex];var Type=Change.get_Type();if(c_oAscRevisionsChangeType.TextAdd!==Type&&c_oAscRevisionsChangeType.TextRem!==
Type&&c_oAscRevisionsChangeType.TextPr!==Type||StartPos.Compare(Change.get_StartPos())>=0&&StartPos.Compare(Change.get_EndPos())<=0){Change.put_InternalPos(_X,_Y,Page_abs);TrackManager.AddVisibleChange(Change)}}}}};Paragraph.prototype.PreDelete=function(){for(var Index=0;Index<this.Content.length;Index++){var Item=this.Content[Index];if(Item.PreDelete)Item.PreDelete();if(this.LogicDocument)if(para_Comment===Item.Type&&true===this.LogicDocument.RemoveCommentsOnPreDelete)this.LogicDocument.RemoveComment(Item.CommentId,
true,false);else if(para_Bookmark===Item.Type)this.LogicDocument.GetBookmarksManager().SetNeedUpdate(true)}this.RemoveSelection();this.UpdateDocumentOutline();if(undefined!==this.Get_SectionPr()&&this.LogicDocument)this.Set_SectionPr(undefined)};Paragraph.prototype.Document_SetThisElementCurrent=function(bUpdateStates){this.Parent.Update_ContentIndexing();this.Parent.Set_CurrentElement(this.Index,bUpdateStates)};Paragraph.prototype.Is_ThisElementCurrent=function(){var Parent=this.Parent;Parent.Update_ContentIndexing();
if(docpostype_Content===Parent.GetDocPosType()&&false===Parent.Selection.Use&&this.Index===Parent.CurPos.ContentPos&&Parent.Content[this.Index]===this)return this.Parent.Is_ThisElementCurrent();return false};Paragraph.prototype.Is_Inline=function(){if(this.bFromDocument===false)return true;var PrevElement=this.Get_DocumentPrev();if(true===this.Is_Empty()&&undefined!==this.Get_SectionPr()&&null!==PrevElement&&(type_Paragraph!==PrevElement.Get_Type()||undefined===PrevElement.Get_SectionPr()))return true;
if(undefined===this.Parent||!(this.Parent instanceof CDocument)&&(undefined===this.Parent.Parent||!(this.Parent.Parent instanceof CHeaderFooter)))return true;if(undefined!=this.Pr.FramePr&&Asc.c_oAscYAlign.Inline!==this.Pr.FramePr.YAlign)return false;return true};Paragraph.prototype.IsInline=function(){return this.Is_Inline()};Paragraph.prototype.GetFramePr=function(){return this.Get_CompiledPr2(false).ParaPr.FramePr};Paragraph.prototype.Get_FramePr=function(){return this.GetFramePr()};Paragraph.prototype.Set_FramePr=
function(FramePr,bDelete){var FramePr_old=this.Pr.FramePr;if(undefined===bDelete)bDelete=false;if(true===bDelete){this.Pr.FramePr=undefined;this.private_AddPrChange();History.Add(new CChangesParagraphFramePr(this,FramePr_old,undefined));this.CompiledPr.NeedRecalc=true;this.private_UpdateTrackRevisionOnChangeParaPr(true);return}var FrameParas=this.Internal_Get_FrameParagraphs();if(true===FramePr.FromDropCapMenu&&1===FrameParas.length){var NewFramePr=FramePr_old?FramePr_old.Copy():new CFramePr;if(undefined!=
FramePr.DropCap){var OldLines=NewFramePr.Lines;NewFramePr.Init_Default_DropCap(FramePr.DropCap===Asc.c_oAscDropCap.Drop?true:false);NewFramePr.Lines=OldLines}if(undefined!=FramePr.Lines){var AnchorPara=this.Get_FrameAnchorPara();if(null===AnchorPara||AnchorPara.Lines.length<=0)return;var Before=AnchorPara.Get_CompiledPr().ParaPr.Spacing.Before;var LineH=AnchorPara.Lines[0].Bottom-AnchorPara.Lines[0].Top-Before;var LineTA=AnchorPara.Lines[0].Metrics.TextAscent2;var LineTD=AnchorPara.Lines[0].Metrics.TextDescent+
AnchorPara.Lines[0].Metrics.LineGap;this.Set_Spacing({LineRule:linerule_Exact,Line:FramePr.Lines*LineH},false);this.Update_DropCapByLines(this.Internal_CalculateTextPr(this.Internal_GetStartPos()),FramePr.Lines,LineH,LineTA,LineTD,Before);NewFramePr.Lines=FramePr.Lines}if(undefined!=FramePr.FontFamily){var FF=new ParaTextPr({RFonts:{Ascii:{Name:FramePr.FontFamily.Name,Index:-1}}});this.SelectAll();this.Add(FF);this.RemoveSelection()}if(undefined!=FramePr.HSpace)NewFramePr.HSpace=FramePr.HSpace;this.Pr.FramePr=
NewFramePr}else{var NewFramePr=FramePr_old?FramePr_old.Copy():new CFramePr;if(undefined!=FramePr.H)NewFramePr.H=FramePr.H;if(undefined!=FramePr.HAnchor)NewFramePr.HAnchor=FramePr.HAnchor;if(undefined!=FramePr.HRule)NewFramePr.HRule=FramePr.HRule;if(undefined!=FramePr.HSpace)NewFramePr.HSpace=FramePr.HSpace;if(undefined!=FramePr.Lines)NewFramePr.Lines=FramePr.Lines;if(undefined!=FramePr.VAnchor)NewFramePr.VAnchor=FramePr.VAnchor;if(undefined!=FramePr.VSpace)NewFramePr.VSpace=FramePr.VSpace;NewFramePr.W=
FramePr.W;if(undefined!=FramePr.X){NewFramePr.X=FramePr.X;NewFramePr.XAlign=undefined}if(undefined!=FramePr.XAlign){NewFramePr.XAlign=FramePr.XAlign;NewFramePr.X=undefined}if(undefined!=FramePr.Y){NewFramePr.Y=FramePr.Y;NewFramePr.YAlign=undefined}if(undefined!=FramePr.YAlign){NewFramePr.YAlign=FramePr.YAlign;NewFramePr.Y=undefined}if(undefined!==FramePr.Wrap)if(false===FramePr.Wrap)NewFramePr.Wrap=wrap_NotBeside;else if(true===FramePr.Wrap)NewFramePr.Wrap=wrap_Around;else NewFramePr.Wrap=FramePr.Wrap;
this.Pr.FramePr=NewFramePr}if(undefined!=FramePr.Brd){var Count=FrameParas.length;for(var Index=0;Index<Count;Index++)FrameParas[Index].Set_Borders(FramePr.Brd)}if(undefined!=FramePr.Shd){var Count=FrameParas.length;for(var Index=0;Index<Count;Index++)FrameParas[Index].Set_Shd(FramePr.Shd)}this.private_AddPrChange();History.Add(new CChangesParagraphFramePr(this,FramePr_old,this.Pr.FramePr));this.CompiledPr.NeedRecalc=true;this.private_UpdateTrackRevisionOnChangeParaPr(true)};Paragraph.prototype.Set_FramePr2=
function(FramePr){this.private_AddPrChange();History.Add(new CChangesParagraphFramePr(this,this.Pr.FramePr,FramePr));this.Pr.FramePr=FramePr;this.CompiledPr.NeedRecalc=true;this.private_UpdateTrackRevisionOnChangeParaPr(true)};Paragraph.prototype.Set_FrameParaPr=function(Para){Para.CopyPr(this);Para.Set_Ind({FirstLine:0},false);this.Set_Spacing({After:0},false);this.Set_Ind({Right:0},false);this.RemoveNumPr()};Paragraph.prototype.Get_FrameBounds=function(FrameX,FrameY,FrameW,FrameH){var X0=FrameX,
Y0=FrameY,X1=FrameX+FrameW,Y1=FrameY+FrameH;var Paras=this.Internal_Get_FrameParagraphs();var Count=Paras.length;var FramePr=this.Get_FramePr();if(0>=Count)return{X:X0,Y:Y0,W:X1-X0,H:Y1-Y0};for(var Index=0;Index<Count;Index++){var Para=Paras[Index];var ParaPr=Para.Get_CompiledPr2(false).ParaPr;var Brd=ParaPr.Brd;var _X0=FrameX;if(undefined!==Brd.Left&&border_None!==Brd.Left.Value)_X0-=Brd.Left.Size+Brd.Left.Space+1;if(_X0<X0)X0=_X0;var _X1=FrameX+FrameW;if(undefined!==Brd.Right&&border_None!==Brd.Right.Value){_X1=
Math.max(_X1,_X1-ParaPr.Ind.Right);_X1+=Brd.Right.Size+Brd.Right.Space+1}if(_X1>X1)X1=_X1}var _Y1=Y1;var BottomBorder=Paras[Count-1].Get_CompiledPr2(false).ParaPr.Brd.Bottom;if(undefined!==BottomBorder&&border_None!==BottomBorder.Value)_Y1+=BottomBorder.Size+BottomBorder.Space;if(_Y1>Y1&&(Asc.linerule_Auto===FramePr.HRule||Asc.linerule_AtLeast===FramePr.HRule&&FrameH>=FramePr.H))Y1=_Y1;return{X:X0,Y:Y0,W:X1-X0,H:Y1-Y0}};Paragraph.prototype.SetCalculatedFrame=function(oFrame){this.CalculatedFrame=
oFrame;oFrame.AddParagraph(this)};Paragraph.prototype.GetCalculatedFrame=function(){return this.CalculatedFrame};Paragraph.prototype.Internal_Get_FrameParagraphs=function(){if(this.CalculatedFrame&&this.CalculatedFrame.GetParagraphs().length>0)return this.CalculatedFrame.GetParagraphs();var FrameParas=[];var FramePr=this.Get_FramePr();if(undefined===FramePr)return FrameParas;FrameParas.push(this);var Prev=this.Get_DocumentPrev();while(null!=Prev)if(type_Paragraph===Prev.GetType()){var PrevFramePr=
Prev.Get_FramePr();if(undefined!=PrevFramePr&&true===FramePr.Compare(PrevFramePr)){FrameParas.push(Prev);Prev=Prev.Get_DocumentPrev()}else break}else break;var Next=this.Get_DocumentNext();while(null!=Next)if(type_Paragraph===Next.GetType()){var NextFramePr=Next.Get_FramePr();if(undefined!=NextFramePr&&true===FramePr.Compare(NextFramePr)){FrameParas.push(Next);Next=Next.Get_DocumentNext()}else break}else break;return FrameParas};Paragraph.prototype.Is_LineDropCap=function(){var FrameParas=this.Internal_Get_FrameParagraphs();
if(1!==FrameParas.length||1!==this.Lines.length)return false;return true};Paragraph.prototype.Get_LineDropCapWidth=function(){var W=this.Lines[0].Ranges[0].W;var ParaPr=this.Get_CompiledPr2(false).ParaPr;W+=ParaPr.Ind.Left+ParaPr.Ind.FirstLine;return W};Paragraph.prototype.Change_Frame=function(X,Y,W,H,PageIndex){if(!this.LogicDocument||!this.CalculatedFrame||!this.CalculatedFrame.GetFramePr())return;var FramePr=this.CalculatedFrame.GetFramePr();if(Math.abs(Y-this.CalculatedFrame.T2)<.001&&Math.abs(X-
this.CalculatedFrame.L2)<.001&&Math.abs(W-this.CalculatedFrame.W2)<.001&&Math.abs(H-this.CalculatedFrame.H2)<.001&&PageIndex===this.CalculatedFrame.PageIndex)return;var FrameParas=this.Internal_Get_FrameParagraphs();if(false===this.LogicDocument.Document_Is_SelectionLocked(AscCommon.changestype_None,{Type:AscCommon.changestype_2_ElementsArray_and_Type,Elements:FrameParas,CheckType:AscCommon.changestype_Paragraph_Content})){this.LogicDocument.StartAction(AscDFH.historydescription_Document_ParagraphChangeFrame);
var NewFramePr=FramePr.Copy();if(Math.abs(X-this.CalculatedFrame.L2)>.001){NewFramePr.X=X+(this.CalculatedFrame.L-this.CalculatedFrame.L2);NewFramePr.XAlign=undefined;NewFramePr.HAnchor=Asc.c_oAscHAnchor.Page}if(Math.abs(Y-this.CalculatedFrame.T2)>.001){NewFramePr.Y=Y+(this.CalculatedFrame.T-this.CalculatedFrame.T2);NewFramePr.YAlign=undefined;NewFramePr.VAnchor=Asc.c_oAscVAnchor.Page}if(Math.abs(W-this.CalculatedFrame.W2)>.001)NewFramePr.W=W-Math.abs(this.CalculatedFrame.W2-this.CalculatedFrame.W);
if(Math.abs(H-this.CalculatedFrame.H2)>.001)if(undefined!=FramePr.DropCap&&Asc.c_oAscDropCap.None!=FramePr.DropCap&&1===FrameParas.length){var PageH=this.LogicDocument.Get_PageLimits(PageIndex).YLimit;var _H=Math.min(H,PageH);NewFramePr.Lines=this.Update_DropCapByHeight(_H);NewFramePr.HRule=linerule_Exact;NewFramePr.H=H-Math.abs(this.CalculatedFrame.H2-this.CalculatedFrame.H)}else{if(H<=this.CalculatedFrame.H2)NewFramePr.HRule=linerule_Exact;else NewFramePr.HRule=Asc.linerule_AtLeast;NewFramePr.H=
H}var Count=FrameParas.length;for(var Index=0;Index<Count;Index++){var Para=FrameParas[Index];Para.Set_FramePr(NewFramePr,false)}this.LogicDocument.Recalculate();this.LogicDocument.UpdateInterface();this.LogicDocument.UpdateRulers();this.LogicDocument.UpdateTracks();this.LogicDocument.FinalizeAction()}};Paragraph.prototype.Supplement_FramePr=function(FramePr){if(undefined!=FramePr.DropCap&&Asc.c_oAscDropCap.None!=FramePr.DropCap){var _FramePr=this.Get_FramePr();var FirstFramePara=this;var Prev=FirstFramePara.Get_DocumentPrev();
while(null!=Prev)if(type_Paragraph===Prev.GetType()){var PrevFramePr=Prev.Get_FramePr();if(undefined!=PrevFramePr&&true===_FramePr.Compare(PrevFramePr)){FirstFramePara=Prev;Prev=Prev.Get_DocumentPrev()}else break}else break;var TextPr=FirstFramePara.GetFirstRunPr();if(undefined===TextPr.RFonts||undefined===TextPr.RFonts.Ascii)TextPr=this.Get_CompiledPr2(false).TextPr;FramePr.FontFamily={Name:TextPr.RFonts.Ascii.Name,Index:TextPr.RFonts.Ascii.Index}}var FrameParas=this.Internal_Get_FrameParagraphs();
var Count=FrameParas.length;var ParaPr=FrameParas[0].Get_CompiledPr2(false).ParaPr.Copy();for(var Index=1;Index<Count;Index++){var TempPr=FrameParas[Index].Get_CompiledPr2(false).ParaPr;ParaPr=ParaPr.Compare(TempPr)}FramePr.Brd=ParaPr.Brd;FramePr.Shd=ParaPr.Shd};Paragraph.prototype.CanAddDropCap=function(){for(var nPos=0,nCount=this.Content.length;nPos<nCount;++nPos){var bResult=this.Content[nPos].CanAddDropCap();if(null!==bResult)return bResult}return false};Paragraph.prototype.Get_TextForDropCap=
function(DropCapText,UseContentPos,ContentPos,Depth){var EndPos=true===UseContentPos?ContentPos.Get(Depth):this.Content.length-1;for(var Pos=0;Pos<=EndPos;Pos++){this.Content[Pos].Get_TextForDropCap(DropCapText,true===UseContentPos&&Pos===EndPos?true:false,ContentPos,Depth+1);if(true===DropCapText.Mixed&&(true===DropCapText.Check||DropCapText.Runs.length>0))return}};Paragraph.prototype.Split_DropCap=function(NewParagraph){var DropCapText=new CParagraphGetDropCapText;if(true==this.Selection.Use&&this.Parent.IsSelectedSingleElement()){var SelSP=
this.Get_ParaContentPos(true,true);var SelEP=this.Get_ParaContentPos(true,false);if(0<=SelSP.Compare(SelEP))SelEP=SelSP;DropCapText.Check=true;this.Get_TextForDropCap(DropCapText,true,SelEP,0);DropCapText.Check=false;this.Get_TextForDropCap(DropCapText,true,SelEP,0)}else{DropCapText.Mixed=true;DropCapText.Check=false;this.Get_TextForDropCap(DropCapText,false)}var Count=DropCapText.Text.length;var PrevRun=null;var CurrRun=null;for(var Pos=0,ParaPos=0,RunPos=0;Pos<Count;Pos++){if(PrevRun!==DropCapText.Runs[Pos]){PrevRun=
DropCapText.Runs[Pos];CurrRun=new ParaRun(NewParagraph);CurrRun.Set_Pr(DropCapText.Runs[Pos].Pr.Copy());NewParagraph.Internal_Content_Add(ParaPos++,CurrRun,false);RunPos=0}CurrRun.Add_ToContent(RunPos++,DropCapText.Text[Pos],false)}if(Count>0)return DropCapText.Runs[Count-1].Get_CompiledPr(true);return null};Paragraph.prototype.SelectFirstLetter=function(){var oStartPos=new CParagraphContentPos;var oEndPos=new CParagraphContentPos;for(var nPos=0,nCount=this.Content.length;nPos<nCount;++nPos){oStartPos.Update(nPos,
0);oEndPos.Update(nPos,0);if(this.Content[nPos].GetFirstRunElementPos(para_Text,oStartPos,oEndPos,1)){this.StartSelectionFromCurPos();this.SetSelectionContentPos(oStartPos,oEndPos,false);this.Document_SetThisElementCurrent();return true}}return false};Paragraph.prototype.CheckSelectionForDropCap=function(){var oSelectionStart=this.Get_ParaContentPos(true,true);var oSelectionEnd=this.Get_ParaContentPos(true,false);if(0<=oSelectionStart.Compare(oSelectionEnd))oSelectionEnd=oSelectionStart;var nEndPos=
oSelectionEnd.Get(0);for(var nPos=0;nPos<=nEndPos;++nPos)if(!this.Content[nPos].CheckSelectionForDropCap(nPos===nEndPos,oSelectionEnd,1))return false;return true};Paragraph.prototype.Update_DropCapByLines=function(TextPr,Count,LineH,LineTA,LineTD,Before){if(null===TextPr)return;this.Set_Spacing({Before:Before,After:0,LineRule:linerule_Exact,Line:Count*LineH-.001},false);var FontSize=72;TextPr.FontSize=FontSize;g_oTextMeasurer.SetTextPr(TextPr,this.Get_Theme());g_oTextMeasurer.SetFontSlot(fontslot_ASCII,
1);var TMetrics={Ascent:null,Descent:null};this.private_RecalculateTextMetrics(TMetrics);var TDescent=TMetrics.Descent;var TAscent=TMetrics.Ascent;var THeight=0;if(null===TAscent||null===TDescent)THeight=g_oTextMeasurer.GetHeight();else THeight=-TDescent+TAscent;var EmHeight=THeight;var NewEmHeight=(Count-1)*LineH+LineTA;var Koef=NewEmHeight/EmHeight;var NewFontSize=TextPr.FontSize*Koef;TextPr.FontSize=parseInt(NewFontSize*2)/2;g_oTextMeasurer.SetTextPr(TextPr,this.Get_Theme());g_oTextMeasurer.SetFontSlot(fontslot_ASCII,
1);var TNewMetrics={Ascent:null,Descent:null};this.private_RecalculateTextMetrics(TNewMetrics);var TNewDescent=TNewMetrics.Descent;var TNewAscent=TNewMetrics.Ascent;var TNewHeight=0;if(null===TNewAscent||null===TNewDescent)TNewHeight=g_oTextMeasurer.GetHeight();else TNewHeight=-TNewDescent+TNewAscent;var Descent=g_oTextMeasurer.GetDescender();var Ascent=g_oTextMeasurer.GetAscender();var Dy=Descent*(LineH*Count)/(Ascent-Descent)+TNewHeight-TNewAscent+LineTD;var PTextPr=new ParaTextPr({RFonts:{Ascii:{Name:TextPr.RFonts.Ascii.Name,
Index:-1}},FontSize:TextPr.FontSize,Position:Dy});this.SelectAll();this.Add(PTextPr);this.RemoveSelection()};Paragraph.prototype.Update_DropCapByHeight=function(_Height){var AnchorPara=this.Get_FrameAnchorPara();if(null===AnchorPara||AnchorPara.Lines.length<=0)return 1;var Before=AnchorPara.Get_CompiledPr().ParaPr.Spacing.Before;var LineH=AnchorPara.Lines[0].Bottom-AnchorPara.Lines[0].Top-Before;var LineTA=AnchorPara.Lines[0].Metrics.TextAscent2;var LineTD=AnchorPara.Lines[0].Metrics.TextDescent+
AnchorPara.Lines[0].Metrics.LineGap;var Height=_Height-Before;this.Set_Spacing({LineRule:linerule_Exact,Line:Height},false);var LinesCount=Math.ceil(Height/LineH);var TextPr=this.Internal_CalculateTextPr(this.Internal_GetStartPos());g_oTextMeasurer.SetTextPr(TextPr,this.Get_Theme());g_oTextMeasurer.SetFontSlot(fontslot_ASCII,1);var TMetrics={Ascent:null,Descent:null};this.private_RecalculateTextMetrics(TMetrics);var TDescent=TMetrics.Descent;var TAscent=TMetrics.Ascent;var THeight=0;if(null===TAscent||
null===TDescent)THeight=g_oTextMeasurer.GetHeight();else THeight=-TDescent+TAscent;var Koef=(Height-LineTD)/THeight;var NewFontSize=TextPr.FontSize*Koef;TextPr.FontSize=parseInt(NewFontSize*2)/2;g_oTextMeasurer.SetTextPr(TextPr,this.Get_Theme());g_oTextMeasurer.SetFontSlot(fontslot_ASCII,1);var TNewMetrics={Ascent:null,Descent:null};this.private_RecalculateTextMetrics(TNewMetrics);var TNewDescent=TNewMetrics.Descent;var TNewAscent=TNewMetrics.Ascent;var TNewHeight=0;if(null===TNewAscent||null===TNewDescent)TNewHeight=
g_oTextMeasurer.GetHeight();else TNewHeight=-TNewDescent+TNewAscent;var Descent=g_oTextMeasurer.GetDescender();var Ascent=g_oTextMeasurer.GetAscender();var Dy=Descent*Height/(Ascent-Descent)+TNewHeight-TNewAscent+LineTD;var PTextPr=new ParaTextPr({RFonts:{Ascii:{Name:TextPr.RFonts.Ascii.Name,Index:-1}},FontSize:TextPr.FontSize,Position:Dy});this.SelectAll();this.Add(PTextPr);this.RemoveSelection();return LinesCount};Paragraph.prototype.Get_FrameAnchorPara=function(){var FramePr=this.Get_FramePr();
if(undefined===FramePr)return null;var Next=this.Get_DocumentNext();while(null!=Next){if(type_Paragraph===Next.GetType()){var NextFramePr=Next.Get_FramePr();if(undefined===NextFramePr||false===FramePr.Compare(NextFramePr))return Next}Next=Next.Get_DocumentNext()}return Next};Paragraph.prototype.Split=function(NewParagraph){if(!NewParagraph)NewParagraph=new Paragraph(this.DrawingDocument,this.Parent);NewParagraph.DeleteCommentOnRemove=false;this.DeleteCommentOnRemove=false;this.RemoveSelection();NewParagraph.RemoveSelection();
var ContentPos=this.Get_ParaContentPos(false,false);var CurPos=ContentPos.Get(0);var TextPr=this.Get_TextPr(ContentPos);var oLogicDocument=this.GetLogicDocument();var oStyles=oLogicDocument&&oLogicDocument.GetStyles?oLogicDocument.GetStyles():null;if(oStyles&&(TextPr.RStyle===oStyles.GetDefaultEndnoteReference()||TextPr.RStyle===oStyles.GetDefaultFootnoteReference())){TextPr=TextPr.Copy();TextPr.RStyle=undefined}var NewElement=this.Content[CurPos].Split(ContentPos,1);if(null===NewElement){NewElement=
new ParaRun(NewParagraph);NewElement.Set_Pr(TextPr.Copy())}var NewContent=this.Content.slice(CurPos+1);this.Internal_Content_Remove2(CurPos+1,this.Content.length-CurPos-1);var EndRun=new ParaRun(this);EndRun.Add_ToContent(0,new ParaEnd);this.Internal_Content_Add(this.Content.length,EndRun);NewParagraph.Internal_Content_Remove2(0,NewParagraph.Content.length);NewParagraph.Internal_Content_Concat(NewContent);NewParagraph.Internal_Content_Add(0,NewElement);NewParagraph.Correct_Content();this.CopyPr(NewParagraph);
this.TextPr.Clear_Style();this.TextPr.Apply_TextPr(TextPr);var SectPr=this.Get_SectionPr();if(undefined!==SectPr){this.Set_SectionPr(undefined);NewParagraph.Set_SectionPr(SectPr)}this.MoveCursorToEndPos(false,false);NewParagraph.MoveCursorToStartPos(false);NewParagraph.DeleteCommentOnRemove=true;this.DeleteCommentOnRemove=true;return NewParagraph};Paragraph.prototype.Concat=function(Para,isUseConcatedStyle){this.DeleteCommentOnRemove=false;Para.DeleteCommentOnRemove=false;this.Remove_ParaEnd();var NearPosCount=
Para.NearPosArray.length;for(var Pos=0;Pos<NearPosCount;Pos++){var ParaNearPos=Para.NearPosArray[Pos];ParaNearPos.Classes[0]=this;ParaNearPos.NearPos.Paragraph=this;ParaNearPos.NearPos.ContentPos.Data[0]+=this.Content.length;this.NearPosArray.push(ParaNearPos)}this.Internal_Content_Concat(Para.Content);Para.ClearContent();this.Set_SectionPr(undefined);var SectPr=Para.Get_SectionPr();if(undefined!==SectPr){Para.Set_SectionPr(undefined);this.Set_SectionPr(SectPr)}this.DeleteCommentOnRemove=true;Para.DeleteCommentOnRemove=
true;if(true===isUseConcatedStyle)Para.CopyPr(this)};Paragraph.prototype.ConcatBefore=function(oPara){this.DeleteCommentOnRemove=false;oPara.DeleteCommentOnRemove=false;oPara.Remove_ParaEnd();for(var nPos=0,nCount=this.NearPosArray.length;nPos<nCount;++nPos){var oParaNearPos=this.NearPosArray[nPos];oParaNearPos.NearPos.ContentPos.Data[0]+=oPara.Content.length}for(var nPos=0,nCount=oPara.NearPosArray.length;nPos<nCount;++nPos){var oParaNearPos=oPara.NearPosArray[nPos];oParaNearPos.Classes[0]=this;
oParaNearPos.NearPos.Paragraph=this;this.NearPosArray.push(oParaNearPos)}for(var nPos=0,nCount=oPara.Content.length;nPos<nCount;++nPos)this.AddToContent(nPos,oPara.Content[nPos]);oPara.ClearContent();oPara.Set_SectionPr(undefined);this.DeleteCommentOnRemove=true;oPara.DeleteCommentOnRemove=true;oPara.CopyPr(this)};Paragraph.prototype.Continue=function(NewParagraph){var TextPr;if(this.IsEmpty())TextPr=this.TextPr.Value.Copy();else{var EndPos=this.Get_EndPos2(false);var CurPos=this.Get_ParaContentPos(false,
false);this.Set_ParaContentPos(EndPos,true,-1,-1);TextPr=this.Get_TextPr(this.Get_ParaContentPos(false,false)).Copy();this.Set_ParaContentPos(CurPos,false,-1,-1,false);TextPr.HighLight=highlight_None;var oStyles;if(this.bFromDocument&&this.LogicDocument&&(oStyles=this.LogicDocument.GetStyles())&&(TextPr.RStyle===oStyles.GetDefaultFootnoteReference()||TextPr.RStyle===oStyles.GetDefaultEndnoteReference()))TextPr.RStyle=undefined}this.CopyPr(NewParagraph);if(!this.HaveNumbering()&&!this.Lock.Is_Locked()){this.TextPr.Clear_Style();
this.TextPr.Apply_TextPr(TextPr)}NewParagraph.Internal_Content_Add(0,new ParaRun(NewParagraph));NewParagraph.Correct_Content();NewParagraph.MoveCursorToStartPos(false);for(var Pos=0,Count=NewParagraph.Content.length;Pos<Count;Pos++)if(para_Run===NewParagraph.Content[Pos].Type)NewParagraph.Content[Pos].Set_Pr(TextPr.Copy())};Paragraph.prototype.GetSelectionState=function(){var ParaState={};ParaState.CurPos={X:this.CurPos.X,Y:this.CurPos.Y,Line:this.CurPos.Line,ContentPos:this.Get_ParaContentPos(false,
false),RealX:this.CurPos.RealX,RealY:this.CurPos.RealY,PagesPos:this.CurPos.PagesPos};ParaState.Selection={Start:this.Selection.Start,Use:this.Selection.Use,StartPos:0,EndPos:0,Flag:this.Selection.Flag};if(true===this.Selection.Use){ParaState.Selection.StartPos=this.Get_ParaContentPos(true,true);ParaState.Selection.EndPos=this.Get_ParaContentPos(true,false)}return[ParaState]};Paragraph.prototype.SetSelectionState=function(State,StateIndex){if(State.length<=0)return;var ParaState=State[StateIndex];
this.CurPos.X=ParaState.CurPos.X;this.CurPos.Y=ParaState.CurPos.Y;this.CurPos.Line=ParaState.CurPos.Line;this.CurPos.RealX=ParaState.CurPos.RealX;this.CurPos.RealY=ParaState.CurPos.RealY;this.CurPos.PagesPos=ParaState.CurPos.PagesPos;this.Set_ParaContentPos(ParaState.CurPos.ContentPos,true,-1,-1);this.RemoveSelection();this.Selection.Start=ParaState.Selection.Start;this.Selection.Use=ParaState.Selection.Use;this.Selection.Flag=ParaState.Selection.Flag;if(true===this.Selection.Use)this.Set_SelectionContentPos(ParaState.Selection.StartPos,
ParaState.Selection.EndPos)};Paragraph.prototype.Get_ParentObject_or_DocumentPos=function(){this.Parent.Update_ContentIndexing();return this.Parent.Get_ParentObject_or_DocumentPos(this.Index)};Paragraph.prototype.Refresh_RecalcData=function(Data){var Type=Data.Type;var bNeedRecalc=false;var CurPage=0;switch(Type){case AscDFH.historyitem_Paragraph_AddItem:case AscDFH.historyitem_Paragraph_RemoveItem:{for(CurPage=this.Pages.length-1;CurPage>0;CurPage--)if(Data.Pos>this.Lines[this.Pages[CurPage].StartLine].Get_StartPos())break;
this.RecalcInfo.Set_Type_0(pararecalc_0_All);bNeedRecalc=true;break}case AscDFH.historyitem_Paragraph_Numbering:case AscDFH.historyitem_Paragraph_PStyle:case AscDFH.historyitem_Paragraph_Pr:case AscDFH.historyitem_Paragraph_PresentationPr_Bullet:case AscDFH.historyitem_Paragraph_PresentationPr_Level:{this.RecalcInfo.Set_Type_0(pararecalc_0_All);bNeedRecalc=true;this.CompiledPr.NeedRecalc=true;this.Recalc_RunsCompiledPr();break}case AscDFH.historyitem_Paragraph_Align:case AscDFH.historyitem_Paragraph_DefaultTabSize:case AscDFH.historyitem_Paragraph_Ind_First:case AscDFH.historyitem_Paragraph_Ind_Left:case AscDFH.historyitem_Paragraph_Ind_Right:case AscDFH.historyitem_Paragraph_ContextualSpacing:case AscDFH.historyitem_Paragraph_KeepLines:case AscDFH.historyitem_Paragraph_KeepNext:case AscDFH.historyitem_Paragraph_PageBreakBefore:case AscDFH.historyitem_Paragraph_Spacing_Line:case AscDFH.historyitem_Paragraph_Spacing_LineRule:case AscDFH.historyitem_Paragraph_Spacing_Before:case AscDFH.historyitem_Paragraph_Spacing_After:case AscDFH.historyitem_Paragraph_Spacing_AfterAutoSpacing:case AscDFH.historyitem_Paragraph_Spacing_BeforeAutoSpacing:case AscDFH.historyitem_Paragraph_WidowControl:case AscDFH.historyitem_Paragraph_Tabs:case AscDFH.historyitem_Paragraph_Borders_Between:case AscDFH.historyitem_Paragraph_Borders_Bottom:case AscDFH.historyitem_Paragraph_Borders_Left:case AscDFH.historyitem_Paragraph_Borders_Right:case AscDFH.historyitem_Paragraph_Borders_Top:case AscDFH.historyitem_Paragraph_FramePr:{bNeedRecalc=
true;break}case AscDFH.historyitem_Paragraph_Shd_Value:case AscDFH.historyitem_Paragraph_Shd_Color:case AscDFH.historyitem_Paragraph_Shd_Unifill:case AscDFH.historyitem_Paragraph_Shd:{if(this.Parent){var oDrawingShape=this.Parent.Is_DrawingShape(true);if(oDrawingShape&&oDrawingShape.getObjectType&&oDrawingShape.getObjectType()===AscDFH.historyitem_type_Shape)if(oDrawingShape.chekBodyPrTransform(oDrawingShape.getBodyPr())||oDrawingShape.checkContentWordArt(oDrawingShape.getDocContent()))bNeedRecalc=
true;if(this.Parent.IsTableHeader())bNeedRecalc=true}break}case AscDFH.historyitem_Paragraph_SectionPr:{if(this.Parent instanceof CDocument){this.Parent.UpdateContentIndexing();var nSectionIndex=this.Parent.GetSectionIndexByElementIndex(this.GetIndex());var oFirstElement=this.Parent.GetFirstElementInSection(nSectionIndex);if(oFirstElement)this.Parent.Refresh_RecalcData2(oFirstElement.GetIndex(),oFirstElement.private_GetRelativePageIndex(0))}break}case AscDFH.historyitem_Paragraph_PrChange:{if(Data instanceof
CChangesParagraphPrChange&&Data.IsChangedNumbering())bNeedRecalc=true;break}case AscDFH.historyitem_Paragraph_SuppressLineNumbers:{History.AddLineNumbersToRecalculateData();break}}if(true===bNeedRecalc){var Prev=this.Get_DocumentPrev();if(0===CurPage&&null!=Prev&&type_Paragraph===Prev.GetType()&&true===Prev.Get_CompiledPr2(false).ParaPr.KeepNext)Prev.Refresh_RecalcData2(Prev.Pages.length-1);return this.Refresh_RecalcData2(CurPage)}};Paragraph.prototype.Refresh_RecalcData2=function(CurPage){if(!CurPage)CurPage=

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 KiB

@ -778,94 +778,95 @@ nQuotient){sGroup+=arrChinese[nQuotient]+arrChinese[1E3];isPrevZero=false}else i
true;if(nTTRemainder<=0){sResult=sGroup+sResult;if(nRemValue<=0)break;continue}var nQuotient=nTTRemainder/1E3|0;var nRemainder=nTTRemainder-nQuotient*1E3;if(0!==nQuotient){sGroup+=arrChinese[nQuotient]+arrChinese[1E3];isPrevZero=false}else if(nTTQuotient>0){sGroup+=arrChinese[0];isPrevZero=true}if(nRemainder<=0){sResult=sGroup+sResult;if(nRemValue<=0)break;continue}nQuotient=nRemainder/100|0;nRemainder=nRemainder-nQuotient*100;if(0!==nQuotient){sGroup+=arrChinese[nQuotient]+arrChinese[100];isPrevZero=
false}else if(!isPrevZero){sGroup+=arrChinese[0];isPrevZero=true}if(nRemainder<=0){sResult=sGroup+sResult;if(nRemValue<=0)break;continue}nQuotient=nRemainder/10|0;nRemainder=nRemainder-nQuotient*10;if(0!==nQuotient){sGroup+=arrChinese[nQuotient]+arrChinese[10];isPrevZero=false}else if(!isPrevZero){sGroup+=arrChinese[0];isPrevZero=true}if(0!==nRemainder)sGroup+=arrChinese[nRemainder];sResult=sGroup+sResult;if(nRemValue<=0)break}break}}return sResult}var c_oAscSpaces=[];c_oAscSpaces[10]=1;c_oAscSpaces[32]=
1;c_oAscSpaces[8194]=1;c_oAscSpaces[8195]=1;c_oAscSpaces[8197]=1;c_oAscSpaces[12288]=1;function IsSpace(nUnicode){return!!c_oAscSpaces[nUnicode]}function private_IsAbbreviation(sWord){if(sWord.toUpperCase()===sWord){for(var nPos=0,nLen=sWord.length;nPos<nLen;++nPos){var nCharCode=sWord.charCodeAt(nPos);if(44032<=nCharCode&&nCharCode<=55203||4352<=nCharCode&&nCharCode<=4607||12592<=nCharCode&&nCharCode<=12687||43360<=nCharCode&&nCharCode<=43391||55216<=nCharCode&&nCharCode<=55295||19968<=nCharCode&&
nCharCode<=40959||13312<=nCharCode&&nCharCode<=19903||131072<=nCharCode&&nCharCode<=173791||173824<=nCharCode&&nCharCode<=177983||177984<=nCharCode&&nCharCode<=178207||178208<=nCharCode&&nCharCode<=183983||63744<=nCharCode&&nCharCode<=64255||194560<=nCharCode&&nCharCode<=195103)return false}return true}return false}var g_oUserColorById={},g_oUserNextColorIndex=0;function getUserColorById(userId,userName,isDark,isNumericValue){if((!userId||""===userId)&&(!userName||""===userName))return new CColor(0,
0,0,255);var res;if(g_oUserColorById.hasOwnProperty(userId))res=g_oUserColorById[userId];else if(g_oUserColorById.hasOwnProperty(userName))res=g_oUserColorById[userName];else{var nColor=Asc.c_oAscArrUserColors[g_oUserNextColorIndex%Asc.c_oAscArrUserColors.length];++g_oUserNextColorIndex;res=g_oUserColorById[userId||userName]=new CUserCacheColor(nColor)}if(!res)return new CColor(0,0,0,255);var oColor=true===isDark?res.Dark:res.Light;return true===isNumericValue?oColor.r<<16&16711680|oColor.g<<8&65280|
oColor.b&255:oColor}function isNullOrEmptyString(str){return str==undefined||str==null||str==""}function unleakString(s){return(" "+s).substr(1)}function readValAttr(attr){if(attr()){var val=attr()["val"];return val?val:null}return null}function getNumFromXml(val){return val?val-0:null}function getColorFromXml(attr){if(attr()){var vals=attr();if(null!=vals["theme"])return AscCommonExcel.g_oColorManager.getThemeColor(getNumFromXml(vals["theme"]),getNumFromXml(vals["tint"]));else if(null!=vals["rgb"])return new AscCommonExcel.RgbColor(16777215&
getNumFromXml(vals["rgb"]))}return null}function getBoolFromXml(val){return"0"!==val&&"false"!==val&&"off"!==val}function CUserCacheColor(nColor){this.Light=null;this.Dark=null;this.init(nColor)}CUserCacheColor.prototype.init=function(nColor){var r=nColor>>16&255;var g=nColor>>8&255;var b=nColor&255;var Y=Math.max(0,Math.min(255,.299*r+.587*g+.114*b));var Cb=Math.max(0,Math.min(255,128-.168736*r-.331264*g+.5*b));var Cr=Math.max(0,Math.min(255,128+.5*r-.418688*g-.081312*b));if(Y>63)Y=63;var R=Math.max(0,
Math.min(255,Y+1.402*(Cr-128)))|0;var G=Math.max(0,Math.min(255,Y-.34414*(Cb-128)-.71414*(Cr-128)))|0;var B=Math.max(0,Math.min(255,Y+1.772*(Cb-128)))|0;this.Light=new CColor(r,g,b,255);this.Dark=new CColor(R,G,B,255)};function loadScript(url,onSuccess,onError){if(window["NATIVE_EDITOR_ENJINE"]===true||window["Native"]!==undefined){onSuccess();return}if(window["AscDesktopEditor"]&&window["local_load_add"]){var _context={"completeLoad":function(){return onSuccess()}};window["local_load_add"](_context,
"sdk-all-from-min",url);var _ret_param=window["AscDesktopEditor"]["LoadJS"](url);if(2!=_ret_param)window["local_load_remove"](url);if(_ret_param==1){setTimeout(onSuccess,1);return}else if(_ret_param==2)return}var backoff=new AscCommon.Backoff(AscCommon.g_oBackoffDefaults);loadScriptWithBackoff(backoff,url,onSuccess,onError)}function loadScriptWithBackoff(backoff,url,onSuccess,onError){var script=document.createElement("script");script.type="text/javascript";script.src=url;script.onload=onSuccess;
script.onerror=function(){backoff.attempt(onError,function(){loadScriptWithBackoff(backoff,url,onSuccess,onError)})};document.head.appendChild(script)}function loadSdk(sdkName,onSuccess,onError){if(window["AscNotLoadAllScript"])onSuccess();else{var urlArgs=window.parent&&window.parent.APP&&window.parent.APP.urlArgs||"";loadScript("./../../../../sdkjs/"+sdkName+"/sdk-all.js?"+urlArgs,onSuccess,onError)}}function getAltGr(e){var ctrlKey=e.metaKey||e.ctrlKey;var altKey=e.altKey;return altKey&&(AscBrowser.isMacOs?
!ctrlKey:ctrlKey)}function getColorSchemeByName(sName){for(var i=0;i<AscCommon.g_oUserColorScheme.length;++i){var tmp=AscCommon.g_oUserColorScheme[i];if(tmp&&tmp.name===sName)return getColorSchemeByIdx(i)}return null}function getColorSchemeByIdx(idx){var tmp=AscCommon.g_oUserColorScheme[idx];if(tmp){var scheme=new AscFormat.ClrScheme,_c;scheme.name=tmp.name;_c=tmp.get_dk1();scheme.colors[8]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_lt1();scheme.colors[12]=AscFormat.CreateUniColorRGB(_c.r,
_c.g,_c.b);_c=tmp.get_dk2();scheme.colors[9]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_lt2();scheme.colors[13]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_accent1();scheme.colors[0]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_accent2();scheme.colors[1]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_accent3();scheme.colors[2]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_accent4();scheme.colors[3]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_accent5();
scheme.colors[4]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_accent6();scheme.colors[5]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_hlink();scheme.colors[11]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_folHlink();scheme.colors[10]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);return scheme}return null}function getAscColorScheme(_scheme,theme){var elem,_c;var _rgba={R:0,G:0,B:0,A:255};elem=new AscCommon.CAscColorScheme;elem.scheme=_scheme;elem.name=_scheme.name;_scheme.colors[8].Calculate(theme,
null,null,null,_rgba);_c=_scheme.colors[8].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[12].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[12].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[9].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[9].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[13].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[13].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));
_scheme.colors[0].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[0].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[1].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[1].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[2].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[2].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[3].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[3].RGBA;elem.putColor(new AscCommon.CColor(_c.R,
_c.G,_c.B));_scheme.colors[4].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[4].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[5].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[5].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[11].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[11].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[10].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[10].RGBA;elem.putColor(new AscCommon.CColor(_c.R,
_c.G,_c.B));return elem}function getIndexColorSchemeInArray(result,asc_color_scheme){for(var j=0;j<result.length;++j)if(result[j].isEqual(asc_color_scheme))return j;return-1}function checkAddColorScheme(result,asc_color_scheme,nStartIndex){var nIndex=getIndexColorSchemeInArray(result,asc_color_scheme);if(nIndex>-1)return nIndex;var nStartIndex_=nStartIndex;if(nStartIndex===null)nStartIndex_=result.length;result.splice(nStartIndex_,0,asc_color_scheme);return nStartIndex_}function isEastAsianScript(value){return 12544<=
value&&value<=12591||12704<=value&&value<=12735||19968<=value&&value<=40938||13312<=value&&value<=19893||131072<=value&&value<=173782||173824<=value&&value<=177972||177984<=value&&value<=178205||178208<=value&&value<=183969||183984<=value&&value<=191456||63744<=value&&value<=64255||194560<=value&&value<=195103||12032<=value&&value<=12255||11904<=value&&value<=12031||12736<=value&&value<=12783||12272<=value&&value<=12287||4352<=value&&value<=4607||43360<=value&&value<=43391||55216<=value&&value<=55295||
12592<=value&&value<=12687||65280<=value&&value<=65519||44032<=value&&value<=55215||12352<=value&&value<=12447||110848<=value&&value<=110895||110592<=value&&value<=110847||12688<=value&&value<=12703||12448<=value&&value<=12543||12784<=value&&value<=12799||42192<=value&&value<=42239||93952<=value&&value<=94111||110960<=value&&value<=111359||94208<=value&&value<=100332||100352<=value&&value<=101119||40960<=value&&value<=42127||42128<=value&&value<=42191}var g_oIdCounter=new CIdCounter;window.Asc.g_signature_drawer=
null;function CSignatureDrawer(id,api,w,h){window.Asc.g_signature_drawer=this;this.Api=api;this.CanvasParent=document.getElementById(id);this.Canvas=document.createElement("canvas");this.Canvas.style.position="absolute";this.Canvas.style.left="0px";this.Canvas.style.top="0px";var _width=parseInt(this.CanvasParent.offsetWidth);var _height=parseInt(this.CanvasParent.offsetHeight);if(0==_width)_width=300;if(0==_height)_height=80;this.Canvas.width=_width;this.Canvas.height=_height;this.CanvasParent.appendChild(this.Canvas);
this.Image="";this.ImageHtml=null;this.Text="";this.Font="Arial";this.Size=10;this.Italic=true;this.Bold=false;this.Width=w;this.Height=h;this.CanvasReturn=null;this.IsAsync=false}CSignatureDrawer.prototype.getCanvas=function(){return this.CanvasReturn==null?this.Canvas:this.CanvasReturn};CSignatureDrawer.prototype.getImages=function(){if(!this.isValid())return["",""];this.CanvasReturn=document.createElement("canvas");this.CanvasReturn.width=this.Width*AscCommon.g_dKoef_mm_to_pix;this.CanvasReturn.height=
this.Height*AscCommon.g_dKoef_mm_to_pix;if(this.Text!="")this.drawText();else this.drawImage();var _ret=[];_ret.push(this.CanvasReturn.toDataURL("image/png"));var _ctx=this.CanvasReturn.getContext("2d");_ctx.strokeStyle="#FF0000";_ctx.lineWidth=2;_ctx.moveTo(0,0);_ctx.lineTo(this.CanvasReturn.width,this.CanvasReturn.height);_ctx.moveTo(0,this.CanvasReturn.height);_ctx.lineTo(this.CanvasReturn.width,0);_ctx.stroke();_ret.push(this.CanvasReturn.toDataURL("image/png"));this.CanvasReturn=null;return _ret};
CSignatureDrawer.prototype.setText=function(text,font,size,isItalic,isBold){if(this.IsAsync){this.Text=text;return}this.Image="";this.ImageHtml=null;this.Text=text;this.Font=font;this.Size=size;this.Italic=isItalic;this.Bold=isBold;this.IsAsync=true;AscFonts.FontPickerByCharacter.checkText(this.Text,this,function(){this.IsAsync=false;var loader=AscCommon.g_font_loader;var fontinfo=AscFonts.g_fontApplication.GetFontInfo(font);var isasync=loader.LoadFont(fontinfo,function(){window.Asc.g_signature_drawer.Api.sync_EndAction(Asc.c_oAscAsyncActionType.Information,
Asc.c_oAscAsyncAction.LoadFont);window.Asc.g_signature_drawer.drawText()});if(false===isasync)this.drawText()})};CSignatureDrawer.prototype.drawText=function(){var _oldTurn=this.Api.isViewMode;var _oldMarks=this.Api.ShowParaMarks;this.Api.isViewMode=true;this.Api.ShowParaMarks=false;AscFormat.ExecuteNoHistory(AscCommon.DrawTextByCenter,this,[]);this.Api.isViewMode=_oldTurn;this.Api.ShowParaMarks=_oldMarks};CSignatureDrawer.prototype.drawImage=function(){var _canvas=this.getCanvas();var w=_canvas.width;
var h=_canvas.height;var _ctx=_canvas.getContext("2d");_ctx.clearRect(0,0,w,h);var im_w=this.ImageHtml.width;var im_h=this.ImageHtml.height;var _x=0;var _y=0;var _w=0;var _h=0;var koef1=w/h;var koef2=im_w/im_h;if(koef1>koef2){_h=h;_w=koef2*_h>>0;_y=0;_x=w-_w>>1}else{_w=w;_h=_w/koef2>>0;_x=0;_y=h-_h>>1}_ctx.drawImage(this.ImageHtml,_x,_y,_w,_h)};CSignatureDrawer.prototype.selectImage=CSignatureDrawer.prototype["selectImage"]=function(){this.Text="";window["AscDesktopEditor"]["OpenFilenameDialog"]("images",
false,function(_file){var file=_file;if(Array.isArray(file))file=file[0];if(!file)return;var _drawer=window.Asc.g_signature_drawer;_drawer.Image=window["AscDesktopEditor"]["GetImageBase64"](file);_drawer.ImageHtml=new Image;_drawer.ImageHtml.onload=function(){window.Asc.g_signature_drawer.drawImage()};_drawer.ImageHtml.src=_drawer.Image;_drawer=null})};CSignatureDrawer.prototype.isValid=function(){return this.Image!=""||this.Text!=""};CSignatureDrawer.prototype.destroy=function(){window.Asc.g_signature_drawer.CanvasParent.removeChild(this.Canvas);
delete window.Asc.g_signature_drawer};function CSignatureImage(){this.ImageValidBase64="";this.ImageInvalidBase64="";this.ImageValid=null;this.ImageInvalid=null;this.Valid=false;this.Loading=0;this.Remove=function(){this.ImageValidBase64="";this.ImageInvalidBase64="";this.ImageValid=null;this.ImageInvalid=null;this.Valid=false;this.Loading=0};this.Register=function(_api,_guid){if(_api.ImageLoader.map_image_index[_guid])return;var _obj={Image:this.Valid?this.ImageValid:this.ImageInvalid,Status:AscFonts.ImageLoadStatus.Complete,
src:_guid};_api.ImageLoader.map_image_index[_guid]=_obj};this.Unregister=function(_api,_guid){if(_api.ImageLoader.map_image_index[_guid])delete _api.ImageLoader.map_image_index[_guid]}}function CShortcuts(){this.List={};this.CustomCounter=0;this.CustomActions={}}CShortcuts.prototype.Add=function(nType,nCode,isCtrl,isShift,isAlt){this.List[this.private_GetIndex(nCode,isCtrl,isShift,isAlt)]=nType};CShortcuts.prototype.Get=function(nCode,isCtrl,isShift,isAlt){var nType=this.List[this.private_GetIndex(nCode,
isCtrl,isShift,isAlt)];return undefined!==nType?nType:0};CShortcuts.prototype.private_GetIndex=function(nCode,isCtrl,isShift,isAlt){return nCode<<8|(isCtrl?4:0)|(isShift?2:0)|(isAlt?1:0)};CShortcuts.prototype.CheckType=function(nType){for(var nIndex in this.List)if(this.List[nIndex]===nType)return{KeyCode:nIndex>>>8,CtrlKey:!!(nIndex&4),ShiftKey:!!(nIndex&2),AltKey:!!(nIndex&1)};return null};CShortcuts.prototype.Remove=function(nCode,isCtrl,isShift,isAlt){delete this.List[this.private_GetIndex(nCode,
isCtrl,isShift,isAlt)]};CShortcuts.prototype.RemoveByType=function(nType){for(var nIndex in this.List)if(this.List[nIndex]===nType)delete this.List[nIndex]};CShortcuts.prototype.GetNewCustomType=function(){return 16711680|this.CustomCounter++};CShortcuts.prototype.IsCustomType=function(nType){return nType>=16711680};CShortcuts.prototype.GetCustomAction=function(nType){return this.CustomActions[nType]};CShortcuts.prototype.AddCustomActionSymbol=function(nCharCode,sFont){var nType=this.GetNewCustomType();
this.CustomActions[nType]=new CCustomShortcutActionSymbol(nCharCode,sFont);return nType};function CCustomShortcutActionSymbol(nCharCode,sFont){this.CharCode=nCharCode;this.Font=sFont}CCustomShortcutActionSymbol.prototype.Type=AscCommon.c_oAscCustomShortcutType.Symbol;AscCommon.EncryptionMessageType={Encrypt:0,Decrypt:1};function CEncryptionData(){this._init=false;this.arrData=[];this.arrImages=[];this.handleChangesCallback=null;this.isChangesHandled=false;this.cryptoMode=0;this.isChartEditor=false;
this.isExistDecryptedChanges=false;this.cryptoPrefix=window["AscDesktopEditor"]&&window["AscDesktopEditor"]["GetEncryptedHeader"]?window["AscDesktopEditor"]["GetEncryptedHeader"]():"ENCRYPTED;";this.cryptoPrefixLen=this.cryptoPrefix.length;this.editorId=null;this.nextChangesTimeoutId=-1;this.isPasswordCryptoPresent=false;this.init=function(){this._init=true};this.isInit=function(){return this._init};this.isNeedCrypt=function(){if(window.g_asc_plugins)if(!window.g_asc_plugins.isRunnedEncryption())return false;
if(!window["AscDesktopEditor"])return false;if(this.isChartEditor)return false;if(2==this.cryptoMode)return true;if(0===window["AscDesktopEditor"]["CryptoMode"])return false;return true};this.isCryptoImages=function(){return this.isNeedCrypt()&&this.isPasswordCryptoPresent};this.addCryproImagesFromDialog=function(callback){var _this=this;window["AscDesktopEditor"]["OpenFilenameDialog"]("images",true,function(files){if(!files)return;if(!Array.isArray(files))files=[files];if(0===files.length)return;
var _files=[];var _options={isImageCrypt:true,callback:callback,ext:[]};for(var i=0;i<files.length;i++){_files.push(window["AscDesktopEditor"]["GetImageBase64"](files[i],true));_options.ext.push(AscCommon.GetFileExtension(files[i]))}_this.sendChanges(this,_files,AscCommon.EncryptionMessageType.Encrypt,_options)})};this.addCryproImagesFromUrls=function(urls,callback){var _editor=window["Asc"]["editor"]?window["Asc"]["editor"]:window.editor;_editor.sync_StartAction(Asc.c_oAscAsyncActionType.BlockInteraction,
Asc.c_oAscAsyncAction.LoadImage);var _this=this;window["AscDesktopEditor"]["DownloadFiles"](urls,[],function(files){_editor.sync_EndAction(Asc.c_oAscAsyncActionType.BlockInteraction,Asc.c_oAscAsyncAction.LoadImage);_editor.sync_StartAction(Asc.c_oAscAsyncActionType.BlockInteraction,Asc.c_oAscAsyncAction.UploadImage);var _files=[];var _options={isImageCrypt:true,isUrls:true,callback:callback,ext:[],api:_editor};for(var elem in files){_files.push(window["AscDesktopEditor"]["GetImageBase64"](files[elem],
true));_options.ext.push(window["AscDesktopEditor"]["GetImageFormat"](files[elem]));window["AscDesktopEditor"]["RemoveFile"](files[elem])}_this.sendChanges(this,_files,AscCommon.EncryptionMessageType.Encrypt,_options)})};this.onDecodeError=function(){var _editor=window["Asc"]["editor"]?window["Asc"]["editor"]:window.editor;_editor.sendEvent("asc_onError",Asc.c_oAscError.ID.DataEncrypted,Asc.c_oAscError.Level.Critical)};this.checkEditorId=function(){if(null==this.editorId){var _editor=window["Asc"]["editor"]?
window["Asc"]["editor"]:window.editor;this.editorId=_editor.editorId}};this.decryptImage=function(src,img,data){this.sendChanges(this,[data],AscCommon.EncryptionMessageType.Decrypt,{isImageDecrypt:true,src:src,img:img})};this.nextChanges=function(){this.nextChangesTimeoutId=setTimeout(function(){AscCommon.EncryptionWorker.sendChanges(undefined,undefined);this.nextChangesTimeoutId=-1},10)};this.sendChanges=function(sender,data,type,options){if(!this.isNeedCrypt()){if(AscCommon.EncryptionMessageType.Encrypt==
type)sender._send(data,true);else if(AscCommon.EncryptionMessageType.Decrypt==type){if(this.isExistEncryptedChanges(data["changes"])){this.onDecodeError();return}sender._onSaveChanges(data,true)}return}if(undefined!==type)this.arrData.push({sender:sender,type:type,data:data,options:options});if(this.arrData.length==0)return;if(undefined!==type&&(1!=this.arrData.length||!this.isChangesHandled))return;if(undefined!==type&&-1!=this.nextChangesTimeoutId){clearTimeout(this.nextChangesTimeoutId);this.nextChangesTimeoutId=
-1}if(AscCommon.EncryptionMessageType.Encrypt==this.arrData[0].type)if(this.arrData[0].options&&this.arrData[0].options.isImageCrypt)window.g_asc_plugins.sendToEncryption({"type":"encryptData","data":this.arrData[0].data});else window.g_asc_plugins.sendToEncryption({"type":"encryptData","data":JSON.parse(this.arrData[0].data["changes"])});else if(AscCommon.EncryptionMessageType.Decrypt==this.arrData[0].type)if(this.arrData[0].options&&this.arrData[0].options.isImageDecrypt)window.g_asc_plugins.sendToEncryption({"type":"decryptData",
"data":this.arrData[0].data});else window.g_asc_plugins.sendToEncryption({"type":"decryptData","data":this.arrData[0].data["changes"]})};this.receiveChanges=function(obj){var data=obj["data"];var check=obj["check"];if(!check){this.onDecodeError();return}if(this.handleChangesCallback){this.isExistDecryptedChanges=true;this.checkEditorId();if(this.editorId==AscCommon.c_oEditorId.Spreadsheet)for(var i=data.length-1;i>=0;i--)this.handleChangesCallback.changesBase[i]=data[i];else for(var i=data.length-
1;i>=0;i--)this.handleChangesCallback.changesBase[i].m_pData=data[i];this.isChangesHandled=true;this.handleChangesCallback.callback.call(this.handleChangesCallback.sender);this.handleChangesCallback=null;this.nextChanges();return}var obj=this.arrData[0];this.arrData.splice(0,1);if(AscCommon.EncryptionMessageType.Encrypt==obj.type)if(obj.options&&obj.options.isImageCrypt){for(var i=0;i<data.length;i++)if(this.cryptoPrefix==data[i].substr(0,this.cryptoPrefixLen))data[i]=this.cryptoPrefix+obj.options.ext[i]+
";"+data[i].substr(this.cryptoPrefixLen);if(!obj.options.isUrls)obj.options.callback(Asc.c_oAscError.ID.No,data);else AscCommon.UploadImageUrls(data,obj.options.api.documentId,obj.options.api.documentUserId,obj.options.api.CoAuthoringApi.get_jwt(),function(urls){obj.options.api.sync_EndAction(Asc.c_oAscAsyncActionType.BlockInteraction,Asc.c_oAscAsyncAction.UploadImage);obj.options.callback(urls)})}else{obj.data["changes"]=JSON.stringify(data);obj.sender._send(obj.data,true)}else if(AscCommon.EncryptionMessageType.Decrypt==
obj.type)if(obj.options&&obj.options.isImageDecrypt){window["AscDesktopEditor"]["ResaveFile"](obj.options.src,data[0]);obj.options.img["onload_crypto"](obj.options.src)}else{this.isExistDecryptedChanges=true;obj.data["changes"]=data;obj.sender._onSaveChanges(obj.data,true)}this.nextChanges()};this.isExistEncryptedChanges=function(_array){if(0==_array.length)return false;this.checkEditorId();var isChangesMode=_array[0]["change"]?true:false;var _prefix="";var _checkPrefixLen=this.cryptoPrefixLen+1;
if(isChangesMode){for(var i=_array.length-1;i>=0;i--)if(_array[i]["change"].length>_checkPrefixLen){_prefix=_array[i]["change"].substr(0,_checkPrefixLen);if(-1!=_prefix.indexOf(this.cryptoPrefix)){isCrypted=true;break}}return isCrypted}var isCrypted=false;if(this.editorId==AscCommon.c_oEditorId.Spreadsheet)for(var i=_array.length-1;i>=0;i--){if(_array[i].length>_checkPrefixLen){_prefix=_array[i].substr(0,_checkPrefixLen);if(-1!=_prefix.indexOf(this.cryptoPrefix)){isCrypted=true;break}}}else for(var i=
_array.length-1;i>=0;i--)if(_array[i].m_pData.length>_checkPrefixLen){_prefix=_array[i].m_pData.substr(0,_checkPrefixLen);if(-1!=_prefix.indexOf(this.cryptoPrefix)){isCrypted=true;break}}return isCrypted};this.handleChanges=function(_array,_sender,_callback){if(0==_array.length||!this.isNeedCrypt()){if(this.isExistEncryptedChanges(_array)){this.onDecodeError();return}this.isChangesHandled=true;_callback.call(_sender);return}this.handleChangesCallback={changesBase:_array,changes:[],sender:_sender,
callback:_callback};this.checkEditorId();if(this.editorId==AscCommon.c_oEditorId.Spreadsheet)for(var i=_array.length-1;i>=0;i--)this.handleChangesCallback.changes[i]=_array[i];else for(var i=_array.length-1;i>=0;i--)this.handleChangesCallback.changes[i]=_array[i].m_pData;window.g_asc_plugins.sendToEncryption({"type":"decryptData","data":this.handleChangesCallback.changes})};this.asc_setAdvancedOptions=function(api,idOption,option){if(window.isNativeOpenPassword){window["AscDesktopEditor"]["NativeViewerOpen"](option.asc_getPassword());
return}if(window.isCloudCryptoDownloadAs)return false;if(!this.isNeedCrypt())return false;window.checkPasswordFromPlugin=true;if(window["Asc"].c_oAscAdvancedOptionsID.TXT===idOption){var _param="<m_nCsvTxtEncoding>"+option.asc_getCodePage()+"</m_nCsvTxtEncoding>";window["AscDesktopEditor"]["SetAdvancedOptions"](_param)}else if(window["Asc"].c_oAscAdvancedOptionsID.CSV===idOption){var delimiter=option.asc_getDelimiter();var delimiterChar=option.asc_getDelimiterChar();var _param="";_param+="<m_nCsvTxtEncoding>"+
option.asc_getCodePage()+"</m_nCsvTxtEncoding>";if(null!=delimiter)_param+="<m_nCsvDelimiter>"+delimiter+"</m_nCsvDelimiter>";if(null!=delimiterChar)_param+="<m_nCsvDelimiterChar>"+delimiterChar+"</m_nCsvDelimiterChar>";window["AscDesktopEditor"]["SetAdvancedOptions"](_param)}else if(window["Asc"].c_oAscAdvancedOptionsID.DRM===idOption){var _param="<m_sPassword>"+AscCommon.CopyPasteCorrectString(option.asc_getPassword())+"</m_sPassword>";api.currentPassword=option.asc_getPassword();window["AscDesktopEditor"]["SetAdvancedOptions"](_param)}return true}}
AscCommon.EncryptionWorker=new CEncryptionData;function CMouseSmoothWheelCorrector(t,scrollFunction){this._deltaX=0;this._deltaY=0;this._isBreakX=false;this._isBreakY=false;this._timeoutCorrector=-1;this._api=t;this._scrollFunction=scrollFunction;this._normalDelta=120;this._isNormalDeltaActive=false;this.setNormalDeltaActive=function(value){this._isNormalDeltaActive=true;this._normalDelta=value};this.isBreakX=function(){return this._isBreakX};this.isBreakY=function(){return this._isBreakY};this.get_DeltaX=
function(wheelDeltaX){this._isBreakX=false;if(!AscCommon.AscBrowser.isMacOs)return wheelDeltaX;this._deltaX+=wheelDeltaX;if(Math.abs(this._deltaX)>=this._normalDelta)return this._isNormalDeltaActive?this._deltaX>0?this._normalDelta:-this._normalDelta:this._deltaX;this._isBreakX=true;return 0};this.get_DeltaY=function(wheelDeltaY){this._isBreakY=false;if(!AscCommon.AscBrowser.isMacOs)return wheelDeltaY;this._deltaY+=wheelDeltaY;if(Math.abs(this._deltaY)>=this._normalDelta)return this._isNormalDeltaActive?
this._deltaY>0?this._normalDelta:-this._normalDelta:this._deltaY;this._isBreakY=true;return 0};this.checkBreak=function(){if(-1!=this._timeoutCorrector){clearTimeout(this._timeoutCorrector);this._timeoutCorrector=-1}if((this._isBreakX||this._isBreakY)&&this._scrollFunction){var obj={t:this,x:this._isBreakX?this._deltaX:0,y:this._isBreakY?this._deltaY:0};this._timeoutCorrector=setTimeout(function(){var t=obj.t;t._scrollFunction.call(t._api,obj.x,obj.y);t._timeoutCorrector=-1;t._deltaX=0;t._deltaY=
0},100)}if(!this._isBreakX)this._deltaX=0;if(!this._isBreakY)this._deltaY=0;this._isBreakX=false;this._isBreakY=false}}AscCommon.CMouseSmoothWheelCorrector=CMouseSmoothWheelCorrector;function CTranslateManager(){this.mapTranslate={}}CTranslateManager.prototype.init=function(map){this.mapTranslate=map||{}};CTranslateManager.prototype.getValue=function(key){return this.mapTranslate.hasOwnProperty(key)?this.mapTranslate[key]:key};function CPolygonPoint2(X,Y){this.X=X;this.Y=Y}function CPolygonVectors(){this.Page=
-1;this.VX=[];this.VY=[]}function CPolygonPath(precision){this.Page=-1;this.Direction=1;this.precision=precision;this.Points=[]}CPolygonPath.prototype.PushPoint=function(x,y){this.Points.push(new CPolygonPoint2(x/this.precision,y/this.precision))};CPolygonPath.prototype.CorrectExtremePoints=function(){var Lng=this.Points.length;this.Points[0].X=this.Points[Lng-1].X;this.Points[Lng-1].Y=this.Points[0].Y};function CPolygon(){this.Vectors=[];this.precision=1E3}CPolygon.prototype.fill=function(arrBounds){this.Vectors.length=
0;if(arrBounds.length<=0)return;var nStartLineIndex=0,nStartIndex=0,CountLines=arrBounds.length,CountBounds;while(nStartLineIndex<arrBounds.length){CountBounds=arrBounds[nStartLineIndex].length;while(nStartIndex<CountBounds)if(arrBounds[nStartLineIndex][nStartIndex].W<.001)nStartIndex++;else break;if(nStartIndex<CountBounds)break;nStartLineIndex++;nStartIndex=0}if(nStartLineIndex>=arrBounds.length)return;var CurrentPage=arrBounds[nStartLineIndex][nStartIndex].Page,CurrentVectors=new CPolygonVectors,
VectorsX=CurrentVectors.VX,VectorsY=CurrentVectors.VY;CurrentVectors.Page=CurrentPage;this.Vectors.push(CurrentVectors);for(var LineIndex=nStartLineIndex;LineIndex<CountLines;nStartIndex=0,LineIndex++){if(arrBounds[LineIndex][nStartIndex].Page!==CurrentPage){CurrentPage=arrBounds[LineIndex][nStartIndex].Page;CurrentVectors=new CPolygonVectors;VectorsX=CurrentVectors.VX;VectorsY=CurrentVectors.VY;CurrentVectors.Page=CurrentPage;this.Vectors.push(CurrentVectors)}for(var Index=nStartIndex;Index<arrBounds[LineIndex].length;Index++){var oBound=
arrBounds[LineIndex][Index];if(oBound.W<.001)continue;var x1=Math.round(oBound.X*this.precision),x2=Math.round((oBound.X+oBound.W)*this.precision),y1=Math.round(oBound.Y*this.precision),y2=Math.round((oBound.Y+oBound.H)*this.precision);if(VectorsX[y1]==undefined)VectorsX[y1]={};this.IntersectionX(VectorsX,x2,x1,y1);if(VectorsY[x1]==undefined)VectorsY[x1]={};this.IntersectionY(VectorsY,y1,y2,x1);if(VectorsX[y2]==undefined)VectorsX[y2]={};this.IntersectionX(VectorsX,x1,x2,y2);if(VectorsY[x2]==undefined)VectorsY[x2]=
{};this.IntersectionY(VectorsY,y2,y1,x2)}}};CPolygon.prototype.IntersectionX=function(VectorsX,BeginX,EndX,Y){var CurrentVector={};CurrentVector[BeginX]=EndX;var VX=VectorsX[Y];if(BeginX>EndX)while(true==this.IntersectVectorX(CurrentVector,VX));else while(true==this.IntersectVectorX(VX,CurrentVector));for(var X in CurrentVector){var VBeginX=parseInt(X);var VEndX=CurrentVector[VBeginX];if(VBeginX!==VEndX||VX[VBeginX]===undefined)VX[VBeginX]=VEndX}};CPolygon.prototype.IntersectVectorX=function(VectorOpp,
VectorClW){for(var X in VectorOpp){var VBeginX=parseInt(X);var VEndX=VectorOpp[VBeginX];if(VEndX==VBeginX)continue;for(var ClwX in VectorClW){var ClwBeginX=parseInt(ClwX);var ClwEndX=VectorClW[ClwBeginX];var bIntersection=false;if(ClwBeginX==ClwEndX)continue;if(ClwBeginX<=VEndX&&VBeginX<=ClwEndX){VectorOpp[VBeginX]=VBeginX;VectorClW[ClwBeginX]=VEndX;VectorClW[VBeginX]=ClwEndX;bIntersection=true}else if(VEndX<=ClwBeginX&&ClwEndX<=VBeginX){VectorClW[ClwBeginX]=ClwBeginX;VectorOpp[VBeginX]=ClwEndX;VectorOpp[ClwBeginX]=
VEndX;bIntersection=true}else if(ClwBeginX<VEndX&&VEndX<ClwEndX){VectorClW[ClwBeginX]=VEndX;VectorOpp[VBeginX]=ClwEndX;bIntersection=true}else if(ClwBeginX<VBeginX&&VBeginX<ClwEndX){VectorOpp[ClwBeginX]=VEndX;VectorClW[VBeginX]=ClwEndX;delete VectorOpp[VBeginX];delete VectorClW[ClwBeginX];bIntersection=true}if(bIntersection==true)return true}}return false};CPolygon.prototype.IntersectionY=function(VectorsY,BeginY,EndY,X){var bIntersect=false;for(var y in VectorsY[X]){var CurBeginY=parseInt(y);var CurEndY=
VectorsY[X][CurBeginY];var minY,maxY;if(CurBeginY<CurEndY){minY=CurBeginY;maxY=CurEndY}else{minY=CurEndY;maxY=CurBeginY}var bInterSection=!(maxY<=BeginY&&maxY<=EndY||minY>=BeginY&&minY>=EndY),bDirection=(CurBeginY-CurEndY)*(BeginY-EndY)<0;if(bInterSection&&bDirection){VectorsY[X][CurBeginY]=EndY;VectorsY[X][BeginY]=CurEndY;bIntersect=true}}if(bIntersect==false)VectorsY[X][BeginY]=EndY};CPolygon.prototype.GetPaths=function(shift){var Paths=[];shift*=this.precision;for(var PageIndex=0;PageIndex<this.Vectors.length;PageIndex++){var y,
x1,x2,x,y1,y2;var VectorsX=this.Vectors[PageIndex].VX,VectorsY=this.Vectors[PageIndex].VY,Page=this.Vectors[PageIndex].Page;for(var LineIndex in VectorsX)for(var Index in VectorsX[LineIndex]){var Polygon=new CPolygonPath(this.precision);Polygon.Page=Page;y=parseInt(LineIndex);x1=parseInt(Index);x2=VectorsX[y][x1];VectorsX[y][x1]=-1;var Direction=x1>x2?1:-1;var minY=y;var SignRightLeft,SignDownUp;var X,Y;if(x2!==-1){SignRightLeft=x1>x2?1:-1;Y=y-SignRightLeft*shift;Polygon.PushPoint(x1,Y);while(true){x=
x2;y1=y;y2=VectorsY[x][y1];if(y2==-1)break;else if(y2==undefined)return[];VectorsY[x][y1]=-1;SignDownUp=y1>y2?1:-1;X=x+SignDownUp*shift;Polygon.PushPoint(X,Y);y=y2;x1=x;x2=VectorsX[y][x1];if(x2==-1)break;else if(x2==undefined)return[];VectorsX[y][x1]=-1;SignRightLeft=x1>x2?1:-1;Y=y-SignRightLeft*shift;Polygon.PushPoint(X,Y);if(y<minY){minY=y;Direction=x1>x2?1:-1}}Polygon.PushPoint(X,Y);Polygon.CorrectExtremePoints();Polygon.Direction=Direction;Paths.push(Polygon)}}}return Paths};function CMathTrack(){this.MathRect=
{IsActive:false,Bounds:[],ContentSelection:null};this.MathPolygons=[];this.MathSelectPolygons=[]}CMathTrack.prototype.Update=function(IsActive,IsContentActive,oMath,PixelError){this.MathRect.IsActive=IsActive;if(true===IsActive&&null!==oMath){var selectBounds=true===IsContentActive?oMath.Get_ContentSelection():null;if(selectBounds!=null){var SelectPolygon=new CPolygon;SelectPolygon.fill(selectBounds);this.MathSelectPolygons=SelectPolygon.GetPaths(0)}else this.MathSelectPolygons.length=0;var arrBounds=
oMath.Get_Bounds();if(arrBounds.length<=0)return;var MPolygon=new CPolygon;MPolygon.fill(arrBounds);this.MathPolygons=MPolygon.GetPaths(PixelError)}};CMathTrack.prototype.Draw=function(overlay,oPath,shift,color,dKoefX,dKoefY,left,top){var ctx=overlay.m_oContext;ctx.strokeStyle=color;ctx.lineWidth=1;ctx.beginPath();var Points=oPath.Points;var nCount=Points.length;var PrevX=Points[nCount-2].X,PrevY=Points[nCount-2].Y;var _x=left+dKoefX*Points[nCount-2].X,_y=top+dKoefY*Points[nCount-2].Y;var StartX,
StartY;for(var nIndex=0;nIndex<nCount;nIndex++){if(PrevX>Points[nIndex].X)_y=top+dKoefY*Points[nIndex].Y-shift;else if(PrevX<Points[nIndex].X)_y=top+dKoefY*Points[nIndex].Y+shift;if(PrevY<Points[nIndex].Y)_x=left+dKoefX*Points[nIndex].X-shift;else if(PrevY>Points[nIndex].Y)_x=left+dKoefX*Points[nIndex].X+shift;PrevX=Points[nIndex].X;PrevY=Points[nIndex].Y;if(nIndex>0){overlay.CheckPoint(_x,_y);if(1==nIndex){StartX=_x;StartY=_y;overlay.m_oContext.moveTo((_x>>0)+.5,(_y>>0)+.5)}else overlay.m_oContext.lineTo((_x>>
0)+.5,(_y>>0)+.5)}}overlay.m_oContext.lineTo((StartX>>0)+.5,(StartY>>0)+.5);ctx.closePath();ctx.stroke();ctx.beginPath()};CMathTrack.prototype.DrawWithMatrix=function(overlay,oPath,ShiftX,ShiftY,color,dKoefX,dKoefY,left,top,m){var ctx=overlay.m_oContext;ctx.strokeStyle=color;ctx.lineWidth=1;ctx.beginPath();var Points=oPath.Points;var nCount=Points.length;var x=Points[nCount-2].X,y=Points[nCount-2].Y;var _x,_y;var PrevX=Points[nCount-2].X,PrevY=Points[nCount-2].Y;var StartX,StartY;for(var nIndex=0;nIndex<
nCount;nIndex++){if(PrevX>Points[nIndex].X)y=Points[nIndex].Y-ShiftY;else if(PrevX<Points[nIndex].X)y=Points[nIndex].Y+ShiftY;if(PrevY<Points[nIndex].Y)x=Points[nIndex].X-ShiftX;else if(PrevY>Points[nIndex].Y)x=Points[nIndex].X+ShiftX;PrevX=Points[nIndex].X;PrevY=Points[nIndex].Y;if(nIndex>0){_x=left+dKoefX*m.TransformPointX(x,y);_y=top+dKoefY*m.TransformPointY(x,y);overlay.CheckPoint(_x,_y);if(1==nIndex){StartX=_x;StartY=_y;overlay.m_oContext.moveTo((_x>>0)+.5,(_y>>0)+.5)}else overlay.m_oContext.lineTo((_x>>
0)+.5,(_y>>0)+.5)}}overlay.m_oContext.lineTo((StartX>>0)+.5,(StartY>>0)+.5);ctx.closePath();ctx.stroke();ctx.beginPath()};CMathTrack.prototype.DrawSelectPolygon=function(overlay,oPath,dKoefX,dKoefY,left,top,m){var ctx=overlay.m_oContext;ctx.fillStyle="#375082";ctx.beginPath();var Points=oPath.Points;var nPointIndex;var _x,_y,x,y,p;for(nPointIndex=0;nPointIndex<Points.length-1;nPointIndex++){p=Points[nPointIndex];if(!m){_x=left+dKoefX*p.X;_y=top+dKoefY*p.Y}else{x=p.X;y=p.Y;_x=left+dKoefX*m.TransformPointX(x,
y);_y=top+dKoefY*m.TransformPointY(x,y)}overlay.CheckPoint(_x,_y);if(0==nPointIndex)ctx.moveTo((_x>>0)+.5,(_y>>0)+.5);else ctx.lineTo((_x>>0)+.5,(_y>>0)+.5)}ctx.globalAlpha=.2;ctx.fill();ctx.globalAlpha=1};CMathTrack.prototype.IsActive=function(){return this.MathRect.IsActive};CMathTrack.prototype.GetPolygonsCount=function(){return this.MathPolygons.length};CMathTrack.prototype.GetPolygon=function(nIndex){return this.MathPolygons[nIndex]};CMathTrack.prototype.GetSelectPathsCount=function(){return this.MathSelectPolygons.length};
CMathTrack.prototype.GetSelectPath=function(nIndex){return this.MathSelectPolygons[nIndex]};if(!Array.prototype.findIndex)Object.defineProperty(Array.prototype,"findIndex",{value:function(predicate){if(this==null)throw new TypeError("Array.prototype.findIndex called on null or undefined");if(typeof predicate!=="function")throw new TypeError("predicate must be a function");var list=Object(this);var length=list.length>>>0;var thisArg=arguments[1];var value;for(var i=0;i<length;i++){value=list[i];if(predicate.call(thisArg,
value,i,list))return i}return-1}});if(!Array.prototype.fill)Object.defineProperty(Array.prototype,"fill",{value:function(value){if(this==null)throw new TypeError("this is null or not defined");var O=Object(this);var len=O.length>>>0;var start=arguments[1];var relativeStart=start>>0;var k=relativeStart<0?Math.max(len+relativeStart,0):Math.min(relativeStart,len);var end=arguments[2];var relativeEnd=end===undefined?len:end>>0;var final=relativeEnd<0?Math.max(len+relativeEnd,0):Math.min(relativeEnd,len);
while(k<final){O[k]=value;k++}return O}});if(typeof Int8Array!=="undefined"&&!Int8Array.prototype.fill)Int8Array.prototype.fill=Array.prototype.fill;if(typeof Uint8Array!=="undefined"&&!Uint8Array.prototype.fill)Uint8Array.prototype.fill=Array.prototype.fill;if(typeof Uint8ClampedArray!=="undefined"&&!Uint8ClampedArray.prototype.fill)Uint8ClampedArray.prototype.fill=Array.prototype.fill;if(typeof Int16Array!=="undefined"&&!Int16Array.prototype.fill)Int16Array.prototype.fill=Array.prototype.fill;if(typeof Uint16Array!==
"undefined"&&!Uint16Array.prototype.fill)Uint16Array.prototype.fill=Array.prototype.fill;if(typeof Int32Array!=="undefined"&&!Int32Array.prototype.fill)Int32Array.prototype.fill=Array.prototype.fill;if(typeof Uint32Array!=="undefined"&&!Uint32Array.prototype.fill)Uint32Array.prototype.fill=Array.prototype.fill;if(typeof Float32Array!=="undefined"&&!Float32Array.prototype.fill)Float32Array.prototype.fill=Array.prototype.fill;if(typeof Float64Array!=="undefined"&&!Float64Array.prototype.fill)Float64Array.prototype.fill=
Array.prototype.fill;if(typeof Uint8Array!=="undefined"&&!Uint8Array.prototype.slice)Uint8Array.prototype.slice=Array.prototype.slice;function parseText(text,options,bTrimSpaces){var delimiterChar;if(options.asc_getDelimiterChar())delimiterChar=options.asc_getDelimiterChar();else switch(options.asc_getDelimiter()){case AscCommon.c_oAscCsvDelimiter.None:delimiterChar=undefined;break;case AscCommon.c_oAscCsvDelimiter.Tab:delimiterChar="\t";break;case AscCommon.c_oAscCsvDelimiter.Semicolon:delimiterChar=
";";break;case AscCommon.c_oAscCsvDelimiter.Colon:delimiterChar=":";break;case AscCommon.c_oAscCsvDelimiter.Comma:delimiterChar=",";break;case AscCommon.c_oAscCsvDelimiter.Space:delimiterChar=" ";break}var matrix=[];var rows=text.split(/\r?\n/);for(var i=0;i<rows.length;++i){var row=rows[i];if(" "===delimiterChar&&bTrimSpaces){var addSpace=false;if(row[0]===delimiterChar)addSpace=true;row=addSpace?delimiterChar+row.trim():row.trim()}matrix.push(row.split(delimiterChar))}return matrix}function getTimeISO8601(dateStr){if(dateStr)if(dateStr.endsWith("Z"))return Date.parse(dateStr);
else return Date.parse(dateStr+"Z");return NaN}function valueToMmType(value){var oVal=parseFloat(value);var oType;if(!isNaN(oVal)){if(-1!==value.indexOf("%")){oType="%";oVal/=100}else if(-1!==value.indexOf("px")){oType="px";oVal*=AscCommon.g_dKoef_pix_to_mm}else if(-1!==value.indexOf("in")){oType="in";oVal*=AscCommonWord.g_dKoef_in_to_mm}else if(-1!==value.indexOf("cm")){oType="cm";oVal*=10}else if(-1!==value.indexOf("mm"))oType="mm";else if(-1!==value.indexOf("pt")){oType="pt";oVal*=AscCommonWord.g_dKoef_pt_to_mm}else if(-1!==
value.indexOf("pc")){oType="pc";oVal*=AscCommonWord.g_dKoef_pc_to_mm}else oType="none";return{val:oVal,type:oType}}return null}function valueToMm(value){var obj=valueToMmType(value);if(obj&&"%"!==obj.type&&"none"!==obj.type)return obj.val;return null}function arrayMove(array,from,to){array.splice(to,0,array.splice(from,1)[0])}function getRangeArray(start,stop){var res=new Array(stop-start);for(var i=start;i<stop;++i)res[i-start]=i;return res}var g_oBackoffDefaults={retries:2,factor:2,minTimeout:100,
maxTimeout:2E3,randomize:true};function Backoff(opts){this.attempts=0;this.opts=opts}Backoff.prototype.attempt=function(fError,fRetry){var timeout=this.nextTimeout();if(timeout>0)setTimeout(function(){fRetry()},timeout);else fError()};Backoff.prototype.nextTimeout=function(){var timeout=-1;if(this.attempts<this.opts.retries){timeout=this.createTimeout(this.attempts,this.opts);this.attempts++}return timeout};Backoff.prototype.createTimeout=function(attempt,opts){var random=opts.randomize?Math.random()+
1:1;var timeout=Math.round(random*opts.minTimeout*Math.pow(opts.factor,attempt));timeout=Math.min(timeout,opts.maxTimeout);return timeout};function backoffOnError(obj,onError,onRetry){if(!onRetry)return onError;var backoff=new Backoff(g_oBackoffDefaults);return function(){var timeout=backoff.nextTimeout();if(timeout>0)setTimeout(function(){onRetry.call(obj,obj)},timeout);else if(onError)onError.apply(obj,arguments)}}function backoffOnErrorImg(img,onRetry){if(!onRetry)onRetry=function(img){img.setAttribute("src",
img.getAttribute("src"))};img.onerror=backoffOnError(img,img.onerror,onRetry)}function isEmptyObject(obj){for(var name in obj)return false;return true}window["AscCommon"]=window["AscCommon"]||{};window["AscCommon"].getSockJs=getSockJs;window["AscCommon"].getJSZipUtils=getJSZipUtils;window["AscCommon"].getJSZip=getJSZip;window["AscCommon"].getBaseUrl=getBaseUrl;window["AscCommon"].getEncodingParams=getEncodingParams;window["AscCommon"].getEncodingByBOM=getEncodingByBOM;window["AscCommon"].saveWithParts=
saveWithParts;window["AscCommon"].loadFileContent=loadFileContent;window["AscCommon"].getImageFromChanges=getImageFromChanges;window["AscCommon"].openFileCommand=openFileCommand;window["AscCommon"].sendCommand=sendCommand;window["AscCommon"].sendSaveFile=sendSaveFile;window["AscCommon"].mapAscServerErrorToAscError=mapAscServerErrorToAscError;window["AscCommon"].joinUrls=joinUrls;window["AscCommon"].getFullImageSrc2=getFullImageSrc2;window["AscCommon"].fSortAscending=fSortAscending;window["AscCommon"].fSortDescending=
fSortDescending;window["AscCommon"].isLeadingSurrogateChar=isLeadingSurrogateChar;window["AscCommon"].decodeSurrogateChar=decodeSurrogateChar;window["AscCommon"].encodeSurrogateChar=encodeSurrogateChar;window["AscCommon"].convertUnicodeToUTF16=convertUnicodeToUTF16;window["AscCommon"].convertUTF16toUnicode=convertUTF16toUnicode;window["AscCommon"].build_local_rx=build_local_rx;window["AscCommon"].GetFileName=GetFileName;window["AscCommon"].GetFileExtension=GetFileExtension;window["AscCommon"].changeFileExtention=
changeFileExtention;window["AscCommon"].getExtentionByFormat=getExtentionByFormat;window["AscCommon"].InitOnMessage=InitOnMessage;window["AscCommon"].ShowImageFileDialog=ShowImageFileDialog;window["AscCommon"].ShowDocumentFileDialog=ShowDocumentFileDialog;window["AscCommon"].InitDragAndDrop=InitDragAndDrop;window["AscCommon"].UploadImageFiles=UploadImageFiles;window["AscCommon"].UploadImageUrls=UploadImageUrls;window["AscCommon"].CanDropFiles=CanDropFiles;window["AscCommon"].getUrlType=getUrlType;
window["AscCommon"].prepareUrl=prepareUrl;window["AscCommon"].getUserColorById=getUserColorById;window["AscCommon"].isNullOrEmptyString=isNullOrEmptyString;window["AscCommon"].unleakString=unleakString;window["AscCommon"].readValAttr=readValAttr;window["AscCommon"].getNumFromXml=getNumFromXml;window["AscCommon"].getColorFromXml=getColorFromXml;window["AscCommon"].getBoolFromXml=getBoolFromXml;window["AscCommon"].initStreamFromResponse=initStreamFromResponse;window["AscCommon"].checkStreamSignature=
checkStreamSignature;window["AscCommon"].DocumentUrls=DocumentUrls;window["AscCommon"].OpenFileResult=OpenFileResult;window["AscCommon"].CLock=CLock;window["AscCommon"].CContentChanges=CContentChanges;window["AscCommon"].CContentChangesElement=CContentChangesElement;window["AscCommon"].CorrectMMToTwips=CorrectMMToTwips;window["AscCommon"].TwipsToMM=TwipsToMM;window["AscCommon"].MMToTwips=MMToTwips;window["AscCommon"].RomanToInt=RomanToInt;window["AscCommon"].LatinNumberingToInt=LatinNumberingToInt;
window["AscCommon"].IntToNumberFormat=IntToNumberFormat;window["AscCommon"].IsSpace=IsSpace;window["AscCommon"].loadSdk=loadSdk;window["AscCommon"].loadScript=loadScript;window["AscCommon"].getAltGr=getAltGr;window["AscCommon"].getColorSchemeByName=getColorSchemeByName;window["AscCommon"].getColorSchemeByIdx=getColorSchemeByIdx;window["AscCommon"].getAscColorScheme=getAscColorScheme;window["AscCommon"].checkAddColorScheme=checkAddColorScheme;window["AscCommon"].getIndexColorSchemeInArray=getIndexColorSchemeInArray;
window["AscCommon"].isEastAsianScript=isEastAsianScript;window["AscCommon"].CMathTrack=CMathTrack;window["AscCommon"].CPolygon=CPolygon;window["AscCommon"].JSZipWrapper=JSZipWrapper;window["AscCommon"].g_oDocumentUrls=g_oDocumentUrls;window["AscCommon"].FormulaTablePartInfo=FormulaTablePartInfo;window["AscCommon"].cBoolLocal=cBoolLocal;window["AscCommon"].cErrorOrigin=cErrorOrigin;window["AscCommon"].cErrorLocal=cErrorLocal;window["AscCommon"].FormulaSeparators=FormulaSeparators;window["AscCommon"].rx_space_g=
rx_space_g;window["AscCommon"].rx_space=rx_space;window["AscCommon"].rx_defName=rx_defName;window["AscCommon"].kCurFormatPainterWord=kCurFormatPainterWord;window["AscCommon"].parserHelp=parserHelp;window["AscCommon"].g_oIdCounter=g_oIdCounter;window["AscCommon"].g_oHtmlCursor=g_oHtmlCursor;window["AscCommon"].g_oBackoffDefaults=g_oBackoffDefaults;window["AscCommon"].Backoff=Backoff;window["AscCommon"].backoffOnErrorImg=backoffOnErrorImg;window["AscCommon"].isEmptyObject=isEmptyObject;window["AscCommon"].CSignatureDrawer=
window["AscCommon"]["CSignatureDrawer"]=CSignatureDrawer;var prot=CSignatureDrawer.prototype;prot["getImages"]=prot.getImages;prot["setText"]=prot.setText;prot["selectImage"]=prot.selectImage;prot["isValid"]=prot.isValid;prot["destroy"]=prot.destroy;window["AscCommon"].translateManager=new CTranslateManager;window["AscCommon"].parseText=parseText;window["AscCommon"].getTimeISO8601=getTimeISO8601;window["AscCommon"].valueToMm=valueToMm;window["AscCommon"].valueToMmType=valueToMmType;window["AscCommon"].arrayMove=
arrayMove;window["AscCommon"].getRangeArray=getRangeArray;window["AscCommon"].CUnicodeStringEmulator=CUnicodeStringEmulator;window["AscCommon"].private_IsAbbreviation=private_IsAbbreviation;window["AscCommon"].rx_test_ws_name=rx_test_ws_name;window["AscCommon"].CShortcuts=window["AscCommon"]["CShortcuts"]=CShortcuts;prot=CShortcuts.prototype;prot["Add"]=prot.Add;prot["Get"]=prot.Get;prot["CheckType"]=prot.CheckType;prot["Remove"]=prot.Remove;prot["RemoveByType"]=prot.RemoveByType;prot["GetNewCustomType"]=
prot.GetNewCustomType;prot["IsCustomType"]=prot.IsCustomType;prot["GetCustomAction"]=prot.GetCustomAction;prot["AddCustomActionSymbol"]=prot.AddCustomActionSymbol;window["AscCommon"].CCustomShortcutActionSymbol=window["AscCommon"]["CCustomShortcutActionSymbol"]=CCustomShortcutActionSymbol})(window);
nCharCode<=40959||13312<=nCharCode&&nCharCode<=19903||131072<=nCharCode&&nCharCode<=173791||173824<=nCharCode&&nCharCode<=177983||177984<=nCharCode&&nCharCode<=178207||178208<=nCharCode&&nCharCode<=183983||63744<=nCharCode&&nCharCode<=64255||194560<=nCharCode&&nCharCode<=195103)return false}return true}return false}var g_oUserColorById={},g_oUserNextColorIndex=0;function getUserColorById(userId,userName,isDark,isNumericValue){if(window.parent.APP&&window.parent.APP.getUserColor)try{var CPColor=window.parent.APP.getUserColor(userId);
if(CPColor)return true===isNumericValue?CPColor.r<<16&16711680|CPColor.g<<8&65280|CPColor.b&255:CPColor}catch(e){}if((!userId||""===userId)&&(!userName||""===userName))return new CColor(0,0,0,255);var res;if(g_oUserColorById.hasOwnProperty(userId))res=g_oUserColorById[userId];else if(g_oUserColorById.hasOwnProperty(userName))res=g_oUserColorById[userName];else{var nColor=Asc.c_oAscArrUserColors[g_oUserNextColorIndex%Asc.c_oAscArrUserColors.length];++g_oUserNextColorIndex;res=g_oUserColorById[userId||
userName]=new CUserCacheColor(nColor)}if(!res)return new CColor(0,0,0,255);var oColor=true===isDark?res.Dark:res.Light;return true===isNumericValue?oColor.r<<16&16711680|oColor.g<<8&65280|oColor.b&255:oColor}function isNullOrEmptyString(str){return str==undefined||str==null||str==""}function unleakString(s){return(" "+s).substr(1)}function readValAttr(attr){if(attr()){var val=attr()["val"];return val?val:null}return null}function getNumFromXml(val){return val?val-0:null}function getColorFromXml(attr){if(attr()){var vals=
attr();if(null!=vals["theme"])return AscCommonExcel.g_oColorManager.getThemeColor(getNumFromXml(vals["theme"]),getNumFromXml(vals["tint"]));else if(null!=vals["rgb"])return new AscCommonExcel.RgbColor(16777215&getNumFromXml(vals["rgb"]))}return null}function getBoolFromXml(val){return"0"!==val&&"false"!==val&&"off"!==val}function CUserCacheColor(nColor){this.Light=null;this.Dark=null;this.init(nColor)}CUserCacheColor.prototype.init=function(nColor){var r=nColor>>16&255;var g=nColor>>8&255;var b=nColor&
255;var Y=Math.max(0,Math.min(255,.299*r+.587*g+.114*b));var Cb=Math.max(0,Math.min(255,128-.168736*r-.331264*g+.5*b));var Cr=Math.max(0,Math.min(255,128+.5*r-.418688*g-.081312*b));if(Y>63)Y=63;var R=Math.max(0,Math.min(255,Y+1.402*(Cr-128)))|0;var G=Math.max(0,Math.min(255,Y-.34414*(Cb-128)-.71414*(Cr-128)))|0;var B=Math.max(0,Math.min(255,Y+1.772*(Cb-128)))|0;this.Light=new CColor(r,g,b,255);this.Dark=new CColor(R,G,B,255)};function loadScript(url,onSuccess,onError){if(window["NATIVE_EDITOR_ENJINE"]===
true||window["Native"]!==undefined){onSuccess();return}if(window["AscDesktopEditor"]&&window["local_load_add"]){var _context={"completeLoad":function(){return onSuccess()}};window["local_load_add"](_context,"sdk-all-from-min",url);var _ret_param=window["AscDesktopEditor"]["LoadJS"](url);if(2!=_ret_param)window["local_load_remove"](url);if(_ret_param==1){setTimeout(onSuccess,1);return}else if(_ret_param==2)return}var backoff=new AscCommon.Backoff(AscCommon.g_oBackoffDefaults);loadScriptWithBackoff(backoff,
url,onSuccess,onError)}function loadScriptWithBackoff(backoff,url,onSuccess,onError){var script=document.createElement("script");script.type="text/javascript";script.src=url;script.onload=onSuccess;script.onerror=function(){backoff.attempt(onError,function(){loadScriptWithBackoff(backoff,url,onSuccess,onError)})};document.head.appendChild(script)}function loadSdk(sdkName,onSuccess,onError){if(window["AscNotLoadAllScript"])onSuccess();else{var urlArgs=window.parent&&window.parent.APP&&window.parent.APP.urlArgs||
"";loadScript("./../../../../sdkjs/"+sdkName+"/sdk-all.js?"+urlArgs,onSuccess,onError)}}function getAltGr(e){var ctrlKey=e.metaKey||e.ctrlKey;var altKey=e.altKey;return altKey&&(AscBrowser.isMacOs?!ctrlKey:ctrlKey)}function getColorSchemeByName(sName){for(var i=0;i<AscCommon.g_oUserColorScheme.length;++i){var tmp=AscCommon.g_oUserColorScheme[i];if(tmp&&tmp.name===sName)return getColorSchemeByIdx(i)}return null}function getColorSchemeByIdx(idx){var tmp=AscCommon.g_oUserColorScheme[idx];if(tmp){var scheme=
new AscFormat.ClrScheme,_c;scheme.name=tmp.name;_c=tmp.get_dk1();scheme.colors[8]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_lt1();scheme.colors[12]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_dk2();scheme.colors[9]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_lt2();scheme.colors[13]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_accent1();scheme.colors[0]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_accent2();scheme.colors[1]=AscFormat.CreateUniColorRGB(_c.r,
_c.g,_c.b);_c=tmp.get_accent3();scheme.colors[2]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_accent4();scheme.colors[3]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_accent5();scheme.colors[4]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_accent6();scheme.colors[5]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_hlink();scheme.colors[11]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_folHlink();scheme.colors[10]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);
return scheme}return null}function getAscColorScheme(_scheme,theme){var elem,_c;var _rgba={R:0,G:0,B:0,A:255};elem=new AscCommon.CAscColorScheme;elem.scheme=_scheme;elem.name=_scheme.name;_scheme.colors[8].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[8].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[12].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[12].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[9].Calculate(theme,null,null,
null,_rgba);_c=_scheme.colors[9].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[13].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[13].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[0].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[0].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[1].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[1].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[2].Calculate(theme,
null,null,null,_rgba);_c=_scheme.colors[2].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[3].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[3].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[4].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[4].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[5].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[5].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));
_scheme.colors[11].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[11].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[10].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[10].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));return elem}function getIndexColorSchemeInArray(result,asc_color_scheme){for(var j=0;j<result.length;++j)if(result[j].isEqual(asc_color_scheme))return j;return-1}function checkAddColorScheme(result,asc_color_scheme,nStartIndex){var nIndex=
getIndexColorSchemeInArray(result,asc_color_scheme);if(nIndex>-1)return nIndex;var nStartIndex_=nStartIndex;if(nStartIndex===null)nStartIndex_=result.length;result.splice(nStartIndex_,0,asc_color_scheme);return nStartIndex_}function isEastAsianScript(value){return 12544<=value&&value<=12591||12704<=value&&value<=12735||19968<=value&&value<=40938||13312<=value&&value<=19893||131072<=value&&value<=173782||173824<=value&&value<=177972||177984<=value&&value<=178205||178208<=value&&value<=183969||183984<=
value&&value<=191456||63744<=value&&value<=64255||194560<=value&&value<=195103||12032<=value&&value<=12255||11904<=value&&value<=12031||12736<=value&&value<=12783||12272<=value&&value<=12287||4352<=value&&value<=4607||43360<=value&&value<=43391||55216<=value&&value<=55295||12592<=value&&value<=12687||65280<=value&&value<=65519||44032<=value&&value<=55215||12352<=value&&value<=12447||110848<=value&&value<=110895||110592<=value&&value<=110847||12688<=value&&value<=12703||12448<=value&&value<=12543||
12784<=value&&value<=12799||42192<=value&&value<=42239||93952<=value&&value<=94111||110960<=value&&value<=111359||94208<=value&&value<=100332||100352<=value&&value<=101119||40960<=value&&value<=42127||42128<=value&&value<=42191}var g_oIdCounter=new CIdCounter;window.Asc.g_signature_drawer=null;function CSignatureDrawer(id,api,w,h){window.Asc.g_signature_drawer=this;this.Api=api;this.CanvasParent=document.getElementById(id);this.Canvas=document.createElement("canvas");this.Canvas.style.position="absolute";
this.Canvas.style.left="0px";this.Canvas.style.top="0px";var _width=parseInt(this.CanvasParent.offsetWidth);var _height=parseInt(this.CanvasParent.offsetHeight);if(0==_width)_width=300;if(0==_height)_height=80;this.Canvas.width=_width;this.Canvas.height=_height;this.CanvasParent.appendChild(this.Canvas);this.Image="";this.ImageHtml=null;this.Text="";this.Font="Arial";this.Size=10;this.Italic=true;this.Bold=false;this.Width=w;this.Height=h;this.CanvasReturn=null;this.IsAsync=false}CSignatureDrawer.prototype.getCanvas=
function(){return this.CanvasReturn==null?this.Canvas:this.CanvasReturn};CSignatureDrawer.prototype.getImages=function(){if(!this.isValid())return["",""];this.CanvasReturn=document.createElement("canvas");this.CanvasReturn.width=this.Width*AscCommon.g_dKoef_mm_to_pix;this.CanvasReturn.height=this.Height*AscCommon.g_dKoef_mm_to_pix;if(this.Text!="")this.drawText();else this.drawImage();var _ret=[];_ret.push(this.CanvasReturn.toDataURL("image/png"));var _ctx=this.CanvasReturn.getContext("2d");_ctx.strokeStyle=
"#FF0000";_ctx.lineWidth=2;_ctx.moveTo(0,0);_ctx.lineTo(this.CanvasReturn.width,this.CanvasReturn.height);_ctx.moveTo(0,this.CanvasReturn.height);_ctx.lineTo(this.CanvasReturn.width,0);_ctx.stroke();_ret.push(this.CanvasReturn.toDataURL("image/png"));this.CanvasReturn=null;return _ret};CSignatureDrawer.prototype.setText=function(text,font,size,isItalic,isBold){if(this.IsAsync){this.Text=text;return}this.Image="";this.ImageHtml=null;this.Text=text;this.Font=font;this.Size=size;this.Italic=isItalic;
this.Bold=isBold;this.IsAsync=true;AscFonts.FontPickerByCharacter.checkText(this.Text,this,function(){this.IsAsync=false;var loader=AscCommon.g_font_loader;var fontinfo=AscFonts.g_fontApplication.GetFontInfo(font);var isasync=loader.LoadFont(fontinfo,function(){window.Asc.g_signature_drawer.Api.sync_EndAction(Asc.c_oAscAsyncActionType.Information,Asc.c_oAscAsyncAction.LoadFont);window.Asc.g_signature_drawer.drawText()});if(false===isasync)this.drawText()})};CSignatureDrawer.prototype.drawText=function(){var _oldTurn=
this.Api.isViewMode;var _oldMarks=this.Api.ShowParaMarks;this.Api.isViewMode=true;this.Api.ShowParaMarks=false;AscFormat.ExecuteNoHistory(AscCommon.DrawTextByCenter,this,[]);this.Api.isViewMode=_oldTurn;this.Api.ShowParaMarks=_oldMarks};CSignatureDrawer.prototype.drawImage=function(){var _canvas=this.getCanvas();var w=_canvas.width;var h=_canvas.height;var _ctx=_canvas.getContext("2d");_ctx.clearRect(0,0,w,h);var im_w=this.ImageHtml.width;var im_h=this.ImageHtml.height;var _x=0;var _y=0;var _w=0;
var _h=0;var koef1=w/h;var koef2=im_w/im_h;if(koef1>koef2){_h=h;_w=koef2*_h>>0;_y=0;_x=w-_w>>1}else{_w=w;_h=_w/koef2>>0;_x=0;_y=h-_h>>1}_ctx.drawImage(this.ImageHtml,_x,_y,_w,_h)};CSignatureDrawer.prototype.selectImage=CSignatureDrawer.prototype["selectImage"]=function(){this.Text="";window["AscDesktopEditor"]["OpenFilenameDialog"]("images",false,function(_file){var file=_file;if(Array.isArray(file))file=file[0];if(!file)return;var _drawer=window.Asc.g_signature_drawer;_drawer.Image=window["AscDesktopEditor"]["GetImageBase64"](file);
_drawer.ImageHtml=new Image;_drawer.ImageHtml.onload=function(){window.Asc.g_signature_drawer.drawImage()};_drawer.ImageHtml.src=_drawer.Image;_drawer=null})};CSignatureDrawer.prototype.isValid=function(){return this.Image!=""||this.Text!=""};CSignatureDrawer.prototype.destroy=function(){window.Asc.g_signature_drawer.CanvasParent.removeChild(this.Canvas);delete window.Asc.g_signature_drawer};function CSignatureImage(){this.ImageValidBase64="";this.ImageInvalidBase64="";this.ImageValid=null;this.ImageInvalid=
null;this.Valid=false;this.Loading=0;this.Remove=function(){this.ImageValidBase64="";this.ImageInvalidBase64="";this.ImageValid=null;this.ImageInvalid=null;this.Valid=false;this.Loading=0};this.Register=function(_api,_guid){if(_api.ImageLoader.map_image_index[_guid])return;var _obj={Image:this.Valid?this.ImageValid:this.ImageInvalid,Status:AscFonts.ImageLoadStatus.Complete,src:_guid};_api.ImageLoader.map_image_index[_guid]=_obj};this.Unregister=function(_api,_guid){if(_api.ImageLoader.map_image_index[_guid])delete _api.ImageLoader.map_image_index[_guid]}}
function CShortcuts(){this.List={};this.CustomCounter=0;this.CustomActions={}}CShortcuts.prototype.Add=function(nType,nCode,isCtrl,isShift,isAlt){this.List[this.private_GetIndex(nCode,isCtrl,isShift,isAlt)]=nType};CShortcuts.prototype.Get=function(nCode,isCtrl,isShift,isAlt){var nType=this.List[this.private_GetIndex(nCode,isCtrl,isShift,isAlt)];return undefined!==nType?nType:0};CShortcuts.prototype.private_GetIndex=function(nCode,isCtrl,isShift,isAlt){return nCode<<8|(isCtrl?4:0)|(isShift?2:0)|(isAlt?
1:0)};CShortcuts.prototype.CheckType=function(nType){for(var nIndex in this.List)if(this.List[nIndex]===nType)return{KeyCode:nIndex>>>8,CtrlKey:!!(nIndex&4),ShiftKey:!!(nIndex&2),AltKey:!!(nIndex&1)};return null};CShortcuts.prototype.Remove=function(nCode,isCtrl,isShift,isAlt){delete this.List[this.private_GetIndex(nCode,isCtrl,isShift,isAlt)]};CShortcuts.prototype.RemoveByType=function(nType){for(var nIndex in this.List)if(this.List[nIndex]===nType)delete this.List[nIndex]};CShortcuts.prototype.GetNewCustomType=
function(){return 16711680|this.CustomCounter++};CShortcuts.prototype.IsCustomType=function(nType){return nType>=16711680};CShortcuts.prototype.GetCustomAction=function(nType){return this.CustomActions[nType]};CShortcuts.prototype.AddCustomActionSymbol=function(nCharCode,sFont){var nType=this.GetNewCustomType();this.CustomActions[nType]=new CCustomShortcutActionSymbol(nCharCode,sFont);return nType};function CCustomShortcutActionSymbol(nCharCode,sFont){this.CharCode=nCharCode;this.Font=sFont}CCustomShortcutActionSymbol.prototype.Type=
AscCommon.c_oAscCustomShortcutType.Symbol;AscCommon.EncryptionMessageType={Encrypt:0,Decrypt:1};function CEncryptionData(){this._init=false;this.arrData=[];this.arrImages=[];this.handleChangesCallback=null;this.isChangesHandled=false;this.cryptoMode=0;this.isChartEditor=false;this.isExistDecryptedChanges=false;this.cryptoPrefix=window["AscDesktopEditor"]&&window["AscDesktopEditor"]["GetEncryptedHeader"]?window["AscDesktopEditor"]["GetEncryptedHeader"]():"ENCRYPTED;";this.cryptoPrefixLen=this.cryptoPrefix.length;
this.editorId=null;this.nextChangesTimeoutId=-1;this.isPasswordCryptoPresent=false;this.init=function(){this._init=true};this.isInit=function(){return this._init};this.isNeedCrypt=function(){if(window.g_asc_plugins)if(!window.g_asc_plugins.isRunnedEncryption())return false;if(!window["AscDesktopEditor"])return false;if(this.isChartEditor)return false;if(2==this.cryptoMode)return true;if(0===window["AscDesktopEditor"]["CryptoMode"])return false;return true};this.isCryptoImages=function(){return this.isNeedCrypt()&&
this.isPasswordCryptoPresent};this.addCryproImagesFromDialog=function(callback){var _this=this;window["AscDesktopEditor"]["OpenFilenameDialog"]("images",true,function(files){if(!files)return;if(!Array.isArray(files))files=[files];if(0===files.length)return;var _files=[];var _options={isImageCrypt:true,callback:callback,ext:[]};for(var i=0;i<files.length;i++){_files.push(window["AscDesktopEditor"]["GetImageBase64"](files[i],true));_options.ext.push(AscCommon.GetFileExtension(files[i]))}_this.sendChanges(this,
_files,AscCommon.EncryptionMessageType.Encrypt,_options)})};this.addCryproImagesFromUrls=function(urls,callback){var _editor=window["Asc"]["editor"]?window["Asc"]["editor"]:window.editor;_editor.sync_StartAction(Asc.c_oAscAsyncActionType.BlockInteraction,Asc.c_oAscAsyncAction.LoadImage);var _this=this;window["AscDesktopEditor"]["DownloadFiles"](urls,[],function(files){_editor.sync_EndAction(Asc.c_oAscAsyncActionType.BlockInteraction,Asc.c_oAscAsyncAction.LoadImage);_editor.sync_StartAction(Asc.c_oAscAsyncActionType.BlockInteraction,
Asc.c_oAscAsyncAction.UploadImage);var _files=[];var _options={isImageCrypt:true,isUrls:true,callback:callback,ext:[],api:_editor};for(var elem in files){_files.push(window["AscDesktopEditor"]["GetImageBase64"](files[elem],true));_options.ext.push(window["AscDesktopEditor"]["GetImageFormat"](files[elem]));window["AscDesktopEditor"]["RemoveFile"](files[elem])}_this.sendChanges(this,_files,AscCommon.EncryptionMessageType.Encrypt,_options)})};this.onDecodeError=function(){var _editor=window["Asc"]["editor"]?
window["Asc"]["editor"]:window.editor;_editor.sendEvent("asc_onError",Asc.c_oAscError.ID.DataEncrypted,Asc.c_oAscError.Level.Critical)};this.checkEditorId=function(){if(null==this.editorId){var _editor=window["Asc"]["editor"]?window["Asc"]["editor"]:window.editor;this.editorId=_editor.editorId}};this.decryptImage=function(src,img,data){this.sendChanges(this,[data],AscCommon.EncryptionMessageType.Decrypt,{isImageDecrypt:true,src:src,img:img})};this.nextChanges=function(){this.nextChangesTimeoutId=
setTimeout(function(){AscCommon.EncryptionWorker.sendChanges(undefined,undefined);this.nextChangesTimeoutId=-1},10)};this.sendChanges=function(sender,data,type,options){if(!this.isNeedCrypt()){if(AscCommon.EncryptionMessageType.Encrypt==type)sender._send(data,true);else if(AscCommon.EncryptionMessageType.Decrypt==type){if(this.isExistEncryptedChanges(data["changes"])){this.onDecodeError();return}sender._onSaveChanges(data,true)}return}if(undefined!==type)this.arrData.push({sender:sender,type:type,
data:data,options:options});if(this.arrData.length==0)return;if(undefined!==type&&(1!=this.arrData.length||!this.isChangesHandled))return;if(undefined!==type&&-1!=this.nextChangesTimeoutId){clearTimeout(this.nextChangesTimeoutId);this.nextChangesTimeoutId=-1}if(AscCommon.EncryptionMessageType.Encrypt==this.arrData[0].type)if(this.arrData[0].options&&this.arrData[0].options.isImageCrypt)window.g_asc_plugins.sendToEncryption({"type":"encryptData","data":this.arrData[0].data});else window.g_asc_plugins.sendToEncryption({"type":"encryptData",
"data":JSON.parse(this.arrData[0].data["changes"])});else if(AscCommon.EncryptionMessageType.Decrypt==this.arrData[0].type)if(this.arrData[0].options&&this.arrData[0].options.isImageDecrypt)window.g_asc_plugins.sendToEncryption({"type":"decryptData","data":this.arrData[0].data});else window.g_asc_plugins.sendToEncryption({"type":"decryptData","data":this.arrData[0].data["changes"]})};this.receiveChanges=function(obj){var data=obj["data"];var check=obj["check"];if(!check){this.onDecodeError();return}if(this.handleChangesCallback){this.isExistDecryptedChanges=
true;this.checkEditorId();if(this.editorId==AscCommon.c_oEditorId.Spreadsheet)for(var i=data.length-1;i>=0;i--)this.handleChangesCallback.changesBase[i]=data[i];else for(var i=data.length-1;i>=0;i--)this.handleChangesCallback.changesBase[i].m_pData=data[i];this.isChangesHandled=true;this.handleChangesCallback.callback.call(this.handleChangesCallback.sender);this.handleChangesCallback=null;this.nextChanges();return}var obj=this.arrData[0];this.arrData.splice(0,1);if(AscCommon.EncryptionMessageType.Encrypt==
obj.type)if(obj.options&&obj.options.isImageCrypt){for(var i=0;i<data.length;i++)if(this.cryptoPrefix==data[i].substr(0,this.cryptoPrefixLen))data[i]=this.cryptoPrefix+obj.options.ext[i]+";"+data[i].substr(this.cryptoPrefixLen);if(!obj.options.isUrls)obj.options.callback(Asc.c_oAscError.ID.No,data);else AscCommon.UploadImageUrls(data,obj.options.api.documentId,obj.options.api.documentUserId,obj.options.api.CoAuthoringApi.get_jwt(),function(urls){obj.options.api.sync_EndAction(Asc.c_oAscAsyncActionType.BlockInteraction,
Asc.c_oAscAsyncAction.UploadImage);obj.options.callback(urls)})}else{obj.data["changes"]=JSON.stringify(data);obj.sender._send(obj.data,true)}else if(AscCommon.EncryptionMessageType.Decrypt==obj.type)if(obj.options&&obj.options.isImageDecrypt){window["AscDesktopEditor"]["ResaveFile"](obj.options.src,data[0]);obj.options.img["onload_crypto"](obj.options.src)}else{this.isExistDecryptedChanges=true;obj.data["changes"]=data;obj.sender._onSaveChanges(obj.data,true)}this.nextChanges()};this.isExistEncryptedChanges=
function(_array){if(0==_array.length)return false;this.checkEditorId();var isChangesMode=_array[0]["change"]?true:false;var _prefix="";var _checkPrefixLen=this.cryptoPrefixLen+1;if(isChangesMode){for(var i=_array.length-1;i>=0;i--)if(_array[i]["change"].length>_checkPrefixLen){_prefix=_array[i]["change"].substr(0,_checkPrefixLen);if(-1!=_prefix.indexOf(this.cryptoPrefix)){isCrypted=true;break}}return isCrypted}var isCrypted=false;if(this.editorId==AscCommon.c_oEditorId.Spreadsheet)for(var i=_array.length-
1;i>=0;i--){if(_array[i].length>_checkPrefixLen){_prefix=_array[i].substr(0,_checkPrefixLen);if(-1!=_prefix.indexOf(this.cryptoPrefix)){isCrypted=true;break}}}else for(var i=_array.length-1;i>=0;i--)if(_array[i].m_pData.length>_checkPrefixLen){_prefix=_array[i].m_pData.substr(0,_checkPrefixLen);if(-1!=_prefix.indexOf(this.cryptoPrefix)){isCrypted=true;break}}return isCrypted};this.handleChanges=function(_array,_sender,_callback){if(0==_array.length||!this.isNeedCrypt()){if(this.isExistEncryptedChanges(_array)){this.onDecodeError();
return}this.isChangesHandled=true;_callback.call(_sender);return}this.handleChangesCallback={changesBase:_array,changes:[],sender:_sender,callback:_callback};this.checkEditorId();if(this.editorId==AscCommon.c_oEditorId.Spreadsheet)for(var i=_array.length-1;i>=0;i--)this.handleChangesCallback.changes[i]=_array[i];else for(var i=_array.length-1;i>=0;i--)this.handleChangesCallback.changes[i]=_array[i].m_pData;window.g_asc_plugins.sendToEncryption({"type":"decryptData","data":this.handleChangesCallback.changes})};
this.asc_setAdvancedOptions=function(api,idOption,option){if(window.isNativeOpenPassword){window["AscDesktopEditor"]["NativeViewerOpen"](option.asc_getPassword());return}if(window.isCloudCryptoDownloadAs)return false;if(!this.isNeedCrypt())return false;window.checkPasswordFromPlugin=true;if(window["Asc"].c_oAscAdvancedOptionsID.TXT===idOption){var _param="<m_nCsvTxtEncoding>"+option.asc_getCodePage()+"</m_nCsvTxtEncoding>";window["AscDesktopEditor"]["SetAdvancedOptions"](_param)}else if(window["Asc"].c_oAscAdvancedOptionsID.CSV===
idOption){var delimiter=option.asc_getDelimiter();var delimiterChar=option.asc_getDelimiterChar();var _param="";_param+="<m_nCsvTxtEncoding>"+option.asc_getCodePage()+"</m_nCsvTxtEncoding>";if(null!=delimiter)_param+="<m_nCsvDelimiter>"+delimiter+"</m_nCsvDelimiter>";if(null!=delimiterChar)_param+="<m_nCsvDelimiterChar>"+delimiterChar+"</m_nCsvDelimiterChar>";window["AscDesktopEditor"]["SetAdvancedOptions"](_param)}else if(window["Asc"].c_oAscAdvancedOptionsID.DRM===idOption){var _param="<m_sPassword>"+
AscCommon.CopyPasteCorrectString(option.asc_getPassword())+"</m_sPassword>";api.currentPassword=option.asc_getPassword();window["AscDesktopEditor"]["SetAdvancedOptions"](_param)}return true}}AscCommon.EncryptionWorker=new CEncryptionData;function CMouseSmoothWheelCorrector(t,scrollFunction){this._deltaX=0;this._deltaY=0;this._isBreakX=false;this._isBreakY=false;this._timeoutCorrector=-1;this._api=t;this._scrollFunction=scrollFunction;this._normalDelta=120;this._isNormalDeltaActive=false;this.setNormalDeltaActive=
function(value){this._isNormalDeltaActive=true;this._normalDelta=value};this.isBreakX=function(){return this._isBreakX};this.isBreakY=function(){return this._isBreakY};this.get_DeltaX=function(wheelDeltaX){this._isBreakX=false;if(!AscCommon.AscBrowser.isMacOs)return wheelDeltaX;this._deltaX+=wheelDeltaX;if(Math.abs(this._deltaX)>=this._normalDelta)return this._isNormalDeltaActive?this._deltaX>0?this._normalDelta:-this._normalDelta:this._deltaX;this._isBreakX=true;return 0};this.get_DeltaY=function(wheelDeltaY){this._isBreakY=
false;if(!AscCommon.AscBrowser.isMacOs)return wheelDeltaY;this._deltaY+=wheelDeltaY;if(Math.abs(this._deltaY)>=this._normalDelta)return this._isNormalDeltaActive?this._deltaY>0?this._normalDelta:-this._normalDelta:this._deltaY;this._isBreakY=true;return 0};this.checkBreak=function(){if(-1!=this._timeoutCorrector){clearTimeout(this._timeoutCorrector);this._timeoutCorrector=-1}if((this._isBreakX||this._isBreakY)&&this._scrollFunction){var obj={t:this,x:this._isBreakX?this._deltaX:0,y:this._isBreakY?
this._deltaY:0};this._timeoutCorrector=setTimeout(function(){var t=obj.t;t._scrollFunction.call(t._api,obj.x,obj.y);t._timeoutCorrector=-1;t._deltaX=0;t._deltaY=0},100)}if(!this._isBreakX)this._deltaX=0;if(!this._isBreakY)this._deltaY=0;this._isBreakX=false;this._isBreakY=false}}AscCommon.CMouseSmoothWheelCorrector=CMouseSmoothWheelCorrector;function CTranslateManager(){this.mapTranslate={}}CTranslateManager.prototype.init=function(map){this.mapTranslate=map||{}};CTranslateManager.prototype.getValue=
function(key){return this.mapTranslate.hasOwnProperty(key)?this.mapTranslate[key]:key};function CPolygonPoint2(X,Y){this.X=X;this.Y=Y}function CPolygonVectors(){this.Page=-1;this.VX=[];this.VY=[]}function CPolygonPath(precision){this.Page=-1;this.Direction=1;this.precision=precision;this.Points=[]}CPolygonPath.prototype.PushPoint=function(x,y){this.Points.push(new CPolygonPoint2(x/this.precision,y/this.precision))};CPolygonPath.prototype.CorrectExtremePoints=function(){var Lng=this.Points.length;
this.Points[0].X=this.Points[Lng-1].X;this.Points[Lng-1].Y=this.Points[0].Y};function CPolygon(){this.Vectors=[];this.precision=1E3}CPolygon.prototype.fill=function(arrBounds){this.Vectors.length=0;if(arrBounds.length<=0)return;var nStartLineIndex=0,nStartIndex=0,CountLines=arrBounds.length,CountBounds;while(nStartLineIndex<arrBounds.length){CountBounds=arrBounds[nStartLineIndex].length;while(nStartIndex<CountBounds)if(arrBounds[nStartLineIndex][nStartIndex].W<.001)nStartIndex++;else break;if(nStartIndex<
CountBounds)break;nStartLineIndex++;nStartIndex=0}if(nStartLineIndex>=arrBounds.length)return;var CurrentPage=arrBounds[nStartLineIndex][nStartIndex].Page,CurrentVectors=new CPolygonVectors,VectorsX=CurrentVectors.VX,VectorsY=CurrentVectors.VY;CurrentVectors.Page=CurrentPage;this.Vectors.push(CurrentVectors);for(var LineIndex=nStartLineIndex;LineIndex<CountLines;nStartIndex=0,LineIndex++){if(arrBounds[LineIndex][nStartIndex].Page!==CurrentPage){CurrentPage=arrBounds[LineIndex][nStartIndex].Page;CurrentVectors=
new CPolygonVectors;VectorsX=CurrentVectors.VX;VectorsY=CurrentVectors.VY;CurrentVectors.Page=CurrentPage;this.Vectors.push(CurrentVectors)}for(var Index=nStartIndex;Index<arrBounds[LineIndex].length;Index++){var oBound=arrBounds[LineIndex][Index];if(oBound.W<.001)continue;var x1=Math.round(oBound.X*this.precision),x2=Math.round((oBound.X+oBound.W)*this.precision),y1=Math.round(oBound.Y*this.precision),y2=Math.round((oBound.Y+oBound.H)*this.precision);if(VectorsX[y1]==undefined)VectorsX[y1]={};this.IntersectionX(VectorsX,
x2,x1,y1);if(VectorsY[x1]==undefined)VectorsY[x1]={};this.IntersectionY(VectorsY,y1,y2,x1);if(VectorsX[y2]==undefined)VectorsX[y2]={};this.IntersectionX(VectorsX,x1,x2,y2);if(VectorsY[x2]==undefined)VectorsY[x2]={};this.IntersectionY(VectorsY,y2,y1,x2)}}};CPolygon.prototype.IntersectionX=function(VectorsX,BeginX,EndX,Y){var CurrentVector={};CurrentVector[BeginX]=EndX;var VX=VectorsX[Y];if(BeginX>EndX)while(true==this.IntersectVectorX(CurrentVector,VX));else while(true==this.IntersectVectorX(VX,CurrentVector));
for(var X in CurrentVector){var VBeginX=parseInt(X);var VEndX=CurrentVector[VBeginX];if(VBeginX!==VEndX||VX[VBeginX]===undefined)VX[VBeginX]=VEndX}};CPolygon.prototype.IntersectVectorX=function(VectorOpp,VectorClW){for(var X in VectorOpp){var VBeginX=parseInt(X);var VEndX=VectorOpp[VBeginX];if(VEndX==VBeginX)continue;for(var ClwX in VectorClW){var ClwBeginX=parseInt(ClwX);var ClwEndX=VectorClW[ClwBeginX];var bIntersection=false;if(ClwBeginX==ClwEndX)continue;if(ClwBeginX<=VEndX&&VBeginX<=ClwEndX){VectorOpp[VBeginX]=
VBeginX;VectorClW[ClwBeginX]=VEndX;VectorClW[VBeginX]=ClwEndX;bIntersection=true}else if(VEndX<=ClwBeginX&&ClwEndX<=VBeginX){VectorClW[ClwBeginX]=ClwBeginX;VectorOpp[VBeginX]=ClwEndX;VectorOpp[ClwBeginX]=VEndX;bIntersection=true}else if(ClwBeginX<VEndX&&VEndX<ClwEndX){VectorClW[ClwBeginX]=VEndX;VectorOpp[VBeginX]=ClwEndX;bIntersection=true}else if(ClwBeginX<VBeginX&&VBeginX<ClwEndX){VectorOpp[ClwBeginX]=VEndX;VectorClW[VBeginX]=ClwEndX;delete VectorOpp[VBeginX];delete VectorClW[ClwBeginX];bIntersection=
true}if(bIntersection==true)return true}}return false};CPolygon.prototype.IntersectionY=function(VectorsY,BeginY,EndY,X){var bIntersect=false;for(var y in VectorsY[X]){var CurBeginY=parseInt(y);var CurEndY=VectorsY[X][CurBeginY];var minY,maxY;if(CurBeginY<CurEndY){minY=CurBeginY;maxY=CurEndY}else{minY=CurEndY;maxY=CurBeginY}var bInterSection=!(maxY<=BeginY&&maxY<=EndY||minY>=BeginY&&minY>=EndY),bDirection=(CurBeginY-CurEndY)*(BeginY-EndY)<0;if(bInterSection&&bDirection){VectorsY[X][CurBeginY]=EndY;
VectorsY[X][BeginY]=CurEndY;bIntersect=true}}if(bIntersect==false)VectorsY[X][BeginY]=EndY};CPolygon.prototype.GetPaths=function(shift){var Paths=[];shift*=this.precision;for(var PageIndex=0;PageIndex<this.Vectors.length;PageIndex++){var y,x1,x2,x,y1,y2;var VectorsX=this.Vectors[PageIndex].VX,VectorsY=this.Vectors[PageIndex].VY,Page=this.Vectors[PageIndex].Page;for(var LineIndex in VectorsX)for(var Index in VectorsX[LineIndex]){var Polygon=new CPolygonPath(this.precision);Polygon.Page=Page;y=parseInt(LineIndex);
x1=parseInt(Index);x2=VectorsX[y][x1];VectorsX[y][x1]=-1;var Direction=x1>x2?1:-1;var minY=y;var SignRightLeft,SignDownUp;var X,Y;if(x2!==-1){SignRightLeft=x1>x2?1:-1;Y=y-SignRightLeft*shift;Polygon.PushPoint(x1,Y);while(true){x=x2;y1=y;y2=VectorsY[x][y1];if(y2==-1)break;else if(y2==undefined)return[];VectorsY[x][y1]=-1;SignDownUp=y1>y2?1:-1;X=x+SignDownUp*shift;Polygon.PushPoint(X,Y);y=y2;x1=x;x2=VectorsX[y][x1];if(x2==-1)break;else if(x2==undefined)return[];VectorsX[y][x1]=-1;SignRightLeft=x1>x2?
1:-1;Y=y-SignRightLeft*shift;Polygon.PushPoint(X,Y);if(y<minY){minY=y;Direction=x1>x2?1:-1}}Polygon.PushPoint(X,Y);Polygon.CorrectExtremePoints();Polygon.Direction=Direction;Paths.push(Polygon)}}}return Paths};function CMathTrack(){this.MathRect={IsActive:false,Bounds:[],ContentSelection:null};this.MathPolygons=[];this.MathSelectPolygons=[]}CMathTrack.prototype.Update=function(IsActive,IsContentActive,oMath,PixelError){this.MathRect.IsActive=IsActive;if(true===IsActive&&null!==oMath){var selectBounds=
true===IsContentActive?oMath.Get_ContentSelection():null;if(selectBounds!=null){var SelectPolygon=new CPolygon;SelectPolygon.fill(selectBounds);this.MathSelectPolygons=SelectPolygon.GetPaths(0)}else this.MathSelectPolygons.length=0;var arrBounds=oMath.Get_Bounds();if(arrBounds.length<=0)return;var MPolygon=new CPolygon;MPolygon.fill(arrBounds);this.MathPolygons=MPolygon.GetPaths(PixelError)}};CMathTrack.prototype.Draw=function(overlay,oPath,shift,color,dKoefX,dKoefY,left,top){var ctx=overlay.m_oContext;
ctx.strokeStyle=color;ctx.lineWidth=1;ctx.beginPath();var Points=oPath.Points;var nCount=Points.length;var PrevX=Points[nCount-2].X,PrevY=Points[nCount-2].Y;var _x=left+dKoefX*Points[nCount-2].X,_y=top+dKoefY*Points[nCount-2].Y;var StartX,StartY;for(var nIndex=0;nIndex<nCount;nIndex++){if(PrevX>Points[nIndex].X)_y=top+dKoefY*Points[nIndex].Y-shift;else if(PrevX<Points[nIndex].X)_y=top+dKoefY*Points[nIndex].Y+shift;if(PrevY<Points[nIndex].Y)_x=left+dKoefX*Points[nIndex].X-shift;else if(PrevY>Points[nIndex].Y)_x=
left+dKoefX*Points[nIndex].X+shift;PrevX=Points[nIndex].X;PrevY=Points[nIndex].Y;if(nIndex>0){overlay.CheckPoint(_x,_y);if(1==nIndex){StartX=_x;StartY=_y;overlay.m_oContext.moveTo((_x>>0)+.5,(_y>>0)+.5)}else overlay.m_oContext.lineTo((_x>>0)+.5,(_y>>0)+.5)}}overlay.m_oContext.lineTo((StartX>>0)+.5,(StartY>>0)+.5);ctx.closePath();ctx.stroke();ctx.beginPath()};CMathTrack.prototype.DrawWithMatrix=function(overlay,oPath,ShiftX,ShiftY,color,dKoefX,dKoefY,left,top,m){var ctx=overlay.m_oContext;ctx.strokeStyle=
color;ctx.lineWidth=1;ctx.beginPath();var Points=oPath.Points;var nCount=Points.length;var x=Points[nCount-2].X,y=Points[nCount-2].Y;var _x,_y;var PrevX=Points[nCount-2].X,PrevY=Points[nCount-2].Y;var StartX,StartY;for(var nIndex=0;nIndex<nCount;nIndex++){if(PrevX>Points[nIndex].X)y=Points[nIndex].Y-ShiftY;else if(PrevX<Points[nIndex].X)y=Points[nIndex].Y+ShiftY;if(PrevY<Points[nIndex].Y)x=Points[nIndex].X-ShiftX;else if(PrevY>Points[nIndex].Y)x=Points[nIndex].X+ShiftX;PrevX=Points[nIndex].X;PrevY=
Points[nIndex].Y;if(nIndex>0){_x=left+dKoefX*m.TransformPointX(x,y);_y=top+dKoefY*m.TransformPointY(x,y);overlay.CheckPoint(_x,_y);if(1==nIndex){StartX=_x;StartY=_y;overlay.m_oContext.moveTo((_x>>0)+.5,(_y>>0)+.5)}else overlay.m_oContext.lineTo((_x>>0)+.5,(_y>>0)+.5)}}overlay.m_oContext.lineTo((StartX>>0)+.5,(StartY>>0)+.5);ctx.closePath();ctx.stroke();ctx.beginPath()};CMathTrack.prototype.DrawSelectPolygon=function(overlay,oPath,dKoefX,dKoefY,left,top,m){var ctx=overlay.m_oContext;ctx.fillStyle=
"#375082";ctx.beginPath();var Points=oPath.Points;var nPointIndex;var _x,_y,x,y,p;for(nPointIndex=0;nPointIndex<Points.length-1;nPointIndex++){p=Points[nPointIndex];if(!m){_x=left+dKoefX*p.X;_y=top+dKoefY*p.Y}else{x=p.X;y=p.Y;_x=left+dKoefX*m.TransformPointX(x,y);_y=top+dKoefY*m.TransformPointY(x,y)}overlay.CheckPoint(_x,_y);if(0==nPointIndex)ctx.moveTo((_x>>0)+.5,(_y>>0)+.5);else ctx.lineTo((_x>>0)+.5,(_y>>0)+.5)}ctx.globalAlpha=.2;ctx.fill();ctx.globalAlpha=1};CMathTrack.prototype.IsActive=function(){return this.MathRect.IsActive};
CMathTrack.prototype.GetPolygonsCount=function(){return this.MathPolygons.length};CMathTrack.prototype.GetPolygon=function(nIndex){return this.MathPolygons[nIndex]};CMathTrack.prototype.GetSelectPathsCount=function(){return this.MathSelectPolygons.length};CMathTrack.prototype.GetSelectPath=function(nIndex){return this.MathSelectPolygons[nIndex]};if(!Array.prototype.findIndex)Object.defineProperty(Array.prototype,"findIndex",{value:function(predicate){if(this==null)throw new TypeError("Array.prototype.findIndex called on null or undefined");
if(typeof predicate!=="function")throw new TypeError("predicate must be a function");var list=Object(this);var length=list.length>>>0;var thisArg=arguments[1];var value;for(var i=0;i<length;i++){value=list[i];if(predicate.call(thisArg,value,i,list))return i}return-1}});if(!Array.prototype.fill)Object.defineProperty(Array.prototype,"fill",{value:function(value){if(this==null)throw new TypeError("this is null or not defined");var O=Object(this);var len=O.length>>>0;var start=arguments[1];var relativeStart=
start>>0;var k=relativeStart<0?Math.max(len+relativeStart,0):Math.min(relativeStart,len);var end=arguments[2];var relativeEnd=end===undefined?len:end>>0;var final=relativeEnd<0?Math.max(len+relativeEnd,0):Math.min(relativeEnd,len);while(k<final){O[k]=value;k++}return O}});if(typeof Int8Array!=="undefined"&&!Int8Array.prototype.fill)Int8Array.prototype.fill=Array.prototype.fill;if(typeof Uint8Array!=="undefined"&&!Uint8Array.prototype.fill)Uint8Array.prototype.fill=Array.prototype.fill;if(typeof Uint8ClampedArray!==
"undefined"&&!Uint8ClampedArray.prototype.fill)Uint8ClampedArray.prototype.fill=Array.prototype.fill;if(typeof Int16Array!=="undefined"&&!Int16Array.prototype.fill)Int16Array.prototype.fill=Array.prototype.fill;if(typeof Uint16Array!=="undefined"&&!Uint16Array.prototype.fill)Uint16Array.prototype.fill=Array.prototype.fill;if(typeof Int32Array!=="undefined"&&!Int32Array.prototype.fill)Int32Array.prototype.fill=Array.prototype.fill;if(typeof Uint32Array!=="undefined"&&!Uint32Array.prototype.fill)Uint32Array.prototype.fill=
Array.prototype.fill;if(typeof Float32Array!=="undefined"&&!Float32Array.prototype.fill)Float32Array.prototype.fill=Array.prototype.fill;if(typeof Float64Array!=="undefined"&&!Float64Array.prototype.fill)Float64Array.prototype.fill=Array.prototype.fill;if(typeof Uint8Array!=="undefined"&&!Uint8Array.prototype.slice)Uint8Array.prototype.slice=Array.prototype.slice;function parseText(text,options,bTrimSpaces){var delimiterChar;if(options.asc_getDelimiterChar())delimiterChar=options.asc_getDelimiterChar();
else switch(options.asc_getDelimiter()){case AscCommon.c_oAscCsvDelimiter.None:delimiterChar=undefined;break;case AscCommon.c_oAscCsvDelimiter.Tab:delimiterChar="\t";break;case AscCommon.c_oAscCsvDelimiter.Semicolon:delimiterChar=";";break;case AscCommon.c_oAscCsvDelimiter.Colon:delimiterChar=":";break;case AscCommon.c_oAscCsvDelimiter.Comma:delimiterChar=",";break;case AscCommon.c_oAscCsvDelimiter.Space:delimiterChar=" ";break}var matrix=[];var rows=text.split(/\r?\n/);for(var i=0;i<rows.length;++i){var row=
rows[i];if(" "===delimiterChar&&bTrimSpaces){var addSpace=false;if(row[0]===delimiterChar)addSpace=true;row=addSpace?delimiterChar+row.trim():row.trim()}matrix.push(row.split(delimiterChar))}return matrix}function getTimeISO8601(dateStr){if(dateStr)if(dateStr.endsWith("Z"))return Date.parse(dateStr);else return Date.parse(dateStr+"Z");return NaN}function valueToMmType(value){var oVal=parseFloat(value);var oType;if(!isNaN(oVal)){if(-1!==value.indexOf("%")){oType="%";oVal/=100}else if(-1!==value.indexOf("px")){oType=
"px";oVal*=AscCommon.g_dKoef_pix_to_mm}else if(-1!==value.indexOf("in")){oType="in";oVal*=AscCommonWord.g_dKoef_in_to_mm}else if(-1!==value.indexOf("cm")){oType="cm";oVal*=10}else if(-1!==value.indexOf("mm"))oType="mm";else if(-1!==value.indexOf("pt")){oType="pt";oVal*=AscCommonWord.g_dKoef_pt_to_mm}else if(-1!==value.indexOf("pc")){oType="pc";oVal*=AscCommonWord.g_dKoef_pc_to_mm}else oType="none";return{val:oVal,type:oType}}return null}function valueToMm(value){var obj=valueToMmType(value);if(obj&&
"%"!==obj.type&&"none"!==obj.type)return obj.val;return null}function arrayMove(array,from,to){array.splice(to,0,array.splice(from,1)[0])}function getRangeArray(start,stop){var res=new Array(stop-start);for(var i=start;i<stop;++i)res[i-start]=i;return res}var g_oBackoffDefaults={retries:2,factor:2,minTimeout:100,maxTimeout:2E3,randomize:true};function Backoff(opts){this.attempts=0;this.opts=opts}Backoff.prototype.attempt=function(fError,fRetry){var timeout=this.nextTimeout();if(timeout>0)setTimeout(function(){fRetry()},
timeout);else fError()};Backoff.prototype.nextTimeout=function(){var timeout=-1;if(this.attempts<this.opts.retries){timeout=this.createTimeout(this.attempts,this.opts);this.attempts++}return timeout};Backoff.prototype.createTimeout=function(attempt,opts){var random=opts.randomize?Math.random()+1:1;var timeout=Math.round(random*opts.minTimeout*Math.pow(opts.factor,attempt));timeout=Math.min(timeout,opts.maxTimeout);return timeout};function backoffOnError(obj,onError,onRetry){if(!onRetry)return onError;
var backoff=new Backoff(g_oBackoffDefaults);return function(){var timeout=backoff.nextTimeout();if(timeout>0)setTimeout(function(){onRetry.call(obj,obj)},timeout);else if(onError)onError.apply(obj,arguments)}}function backoffOnErrorImg(img,onRetry){if(!onRetry)onRetry=function(img){img.setAttribute("src",img.getAttribute("src"))};img.onerror=backoffOnError(img,img.onerror,onRetry)}function isEmptyObject(obj){for(var name in obj)return false;return true}window["AscCommon"]=window["AscCommon"]||{};
window["AscCommon"].getSockJs=getSockJs;window["AscCommon"].getJSZipUtils=getJSZipUtils;window["AscCommon"].getJSZip=getJSZip;window["AscCommon"].getBaseUrl=getBaseUrl;window["AscCommon"].getEncodingParams=getEncodingParams;window["AscCommon"].getEncodingByBOM=getEncodingByBOM;window["AscCommon"].saveWithParts=saveWithParts;window["AscCommon"].loadFileContent=loadFileContent;window["AscCommon"].getImageFromChanges=getImageFromChanges;window["AscCommon"].openFileCommand=openFileCommand;window["AscCommon"].sendCommand=
sendCommand;window["AscCommon"].sendSaveFile=sendSaveFile;window["AscCommon"].mapAscServerErrorToAscError=mapAscServerErrorToAscError;window["AscCommon"].joinUrls=joinUrls;window["AscCommon"].getFullImageSrc2=getFullImageSrc2;window["AscCommon"].fSortAscending=fSortAscending;window["AscCommon"].fSortDescending=fSortDescending;window["AscCommon"].isLeadingSurrogateChar=isLeadingSurrogateChar;window["AscCommon"].decodeSurrogateChar=decodeSurrogateChar;window["AscCommon"].encodeSurrogateChar=encodeSurrogateChar;
window["AscCommon"].convertUnicodeToUTF16=convertUnicodeToUTF16;window["AscCommon"].convertUTF16toUnicode=convertUTF16toUnicode;window["AscCommon"].build_local_rx=build_local_rx;window["AscCommon"].GetFileName=GetFileName;window["AscCommon"].GetFileExtension=GetFileExtension;window["AscCommon"].changeFileExtention=changeFileExtention;window["AscCommon"].getExtentionByFormat=getExtentionByFormat;window["AscCommon"].InitOnMessage=InitOnMessage;window["AscCommon"].ShowImageFileDialog=ShowImageFileDialog;
window["AscCommon"].ShowDocumentFileDialog=ShowDocumentFileDialog;window["AscCommon"].InitDragAndDrop=InitDragAndDrop;window["AscCommon"].UploadImageFiles=UploadImageFiles;window["AscCommon"].UploadImageUrls=UploadImageUrls;window["AscCommon"].CanDropFiles=CanDropFiles;window["AscCommon"].getUrlType=getUrlType;window["AscCommon"].prepareUrl=prepareUrl;window["AscCommon"].getUserColorById=getUserColorById;window["AscCommon"].isNullOrEmptyString=isNullOrEmptyString;window["AscCommon"].unleakString=
unleakString;window["AscCommon"].readValAttr=readValAttr;window["AscCommon"].getNumFromXml=getNumFromXml;window["AscCommon"].getColorFromXml=getColorFromXml;window["AscCommon"].getBoolFromXml=getBoolFromXml;window["AscCommon"].initStreamFromResponse=initStreamFromResponse;window["AscCommon"].checkStreamSignature=checkStreamSignature;window["AscCommon"].DocumentUrls=DocumentUrls;window["AscCommon"].OpenFileResult=OpenFileResult;window["AscCommon"].CLock=CLock;window["AscCommon"].CContentChanges=CContentChanges;
window["AscCommon"].CContentChangesElement=CContentChangesElement;window["AscCommon"].CorrectMMToTwips=CorrectMMToTwips;window["AscCommon"].TwipsToMM=TwipsToMM;window["AscCommon"].MMToTwips=MMToTwips;window["AscCommon"].RomanToInt=RomanToInt;window["AscCommon"].LatinNumberingToInt=LatinNumberingToInt;window["AscCommon"].IntToNumberFormat=IntToNumberFormat;window["AscCommon"].IsSpace=IsSpace;window["AscCommon"].loadSdk=loadSdk;window["AscCommon"].loadScript=loadScript;window["AscCommon"].getAltGr=
getAltGr;window["AscCommon"].getColorSchemeByName=getColorSchemeByName;window["AscCommon"].getColorSchemeByIdx=getColorSchemeByIdx;window["AscCommon"].getAscColorScheme=getAscColorScheme;window["AscCommon"].checkAddColorScheme=checkAddColorScheme;window["AscCommon"].getIndexColorSchemeInArray=getIndexColorSchemeInArray;window["AscCommon"].isEastAsianScript=isEastAsianScript;window["AscCommon"].CMathTrack=CMathTrack;window["AscCommon"].CPolygon=CPolygon;window["AscCommon"].JSZipWrapper=JSZipWrapper;
window["AscCommon"].g_oDocumentUrls=g_oDocumentUrls;window["AscCommon"].FormulaTablePartInfo=FormulaTablePartInfo;window["AscCommon"].cBoolLocal=cBoolLocal;window["AscCommon"].cErrorOrigin=cErrorOrigin;window["AscCommon"].cErrorLocal=cErrorLocal;window["AscCommon"].FormulaSeparators=FormulaSeparators;window["AscCommon"].rx_space_g=rx_space_g;window["AscCommon"].rx_space=rx_space;window["AscCommon"].rx_defName=rx_defName;window["AscCommon"].kCurFormatPainterWord=kCurFormatPainterWord;window["AscCommon"].parserHelp=
parserHelp;window["AscCommon"].g_oIdCounter=g_oIdCounter;window["AscCommon"].g_oHtmlCursor=g_oHtmlCursor;window["AscCommon"].g_oBackoffDefaults=g_oBackoffDefaults;window["AscCommon"].Backoff=Backoff;window["AscCommon"].backoffOnErrorImg=backoffOnErrorImg;window["AscCommon"].isEmptyObject=isEmptyObject;window["AscCommon"].CSignatureDrawer=window["AscCommon"]["CSignatureDrawer"]=CSignatureDrawer;var prot=CSignatureDrawer.prototype;prot["getImages"]=prot.getImages;prot["setText"]=prot.setText;prot["selectImage"]=
prot.selectImage;prot["isValid"]=prot.isValid;prot["destroy"]=prot.destroy;window["AscCommon"].translateManager=new CTranslateManager;window["AscCommon"].parseText=parseText;window["AscCommon"].getTimeISO8601=getTimeISO8601;window["AscCommon"].valueToMm=valueToMm;window["AscCommon"].valueToMmType=valueToMmType;window["AscCommon"].arrayMove=arrayMove;window["AscCommon"].getRangeArray=getRangeArray;window["AscCommon"].CUnicodeStringEmulator=CUnicodeStringEmulator;window["AscCommon"].private_IsAbbreviation=
private_IsAbbreviation;window["AscCommon"].rx_test_ws_name=rx_test_ws_name;window["AscCommon"].CShortcuts=window["AscCommon"]["CShortcuts"]=CShortcuts;prot=CShortcuts.prototype;prot["Add"]=prot.Add;prot["Get"]=prot.Get;prot["CheckType"]=prot.CheckType;prot["Remove"]=prot.Remove;prot["RemoveByType"]=prot.RemoveByType;prot["GetNewCustomType"]=prot.GetNewCustomType;prot["IsCustomType"]=prot.IsCustomType;prot["GetCustomAction"]=prot.GetCustomAction;prot["AddCustomActionSymbol"]=prot.AddCustomActionSymbol;
window["AscCommon"].CCustomShortcutActionSymbol=window["AscCommon"]["CCustomShortcutActionSymbol"]=CCustomShortcutActionSymbol})(window);
window["asc_initAdvancedOptions"]=function(_code,_file_hash,_docInfo){if(window.isNativeOpenPassword)return window["NativeFileOpen_error"](window.isNativeOpenPassword,_file_hash,_docInfo);var _editor=window["Asc"]["editor"]?window["Asc"]["editor"]:window.editor;if(_code==90||_code==91){if(window["AscDesktopEditor"]&&0!==window["AscDesktopEditor"]["CryptoMode"]&&!_editor.isLoadFullApi){_editor.asc_initAdvancedOptions_params=[];_editor.asc_initAdvancedOptions_params.push(_code);_editor.asc_initAdvancedOptions_params.push(_file_hash);
_editor.asc_initAdvancedOptions_params.push(_docInfo);return}if(AscCommon.EncryptionWorker.isNeedCrypt()&&!window.checkPasswordFromPlugin){window.checkPasswordFromPlugin=true;window.g_asc_plugins.sendToEncryption({"type":"getPasswordByFile","hash":_file_hash,"docinfo":_docInfo});return}}window.checkPasswordFromPlugin=false;_editor._onNeedParams(undefined,_code==90||_code==91?true:undefined)};
window["asc_IsNeedBuildCryptedFile"]=function(){if(!window["AscDesktopEditor"]||!window["AscDesktopEditor"]["CryptoMode"])return false;var _api=window["Asc"]["editor"]?window["Asc"]["editor"]:window.editor;var _returnValue=false;var _users=null;if(_api.CoAuthoringApi&&_api.CoAuthoringApi._CoAuthoringApi&&_api.CoAuthoringApi._CoAuthoringApi._participants)_users=_api.CoAuthoringApi._CoAuthoringApi._participants;var _usersCount=0;for(var _user in _users)_usersCount++;var isOne=1>=_usersCount?true:false;

@ -8402,18 +8402,18 @@ function(font_index,stream_index){this.embeddedFontFiles[font_index].SetStreamIn
false;var oThis=this;if(window["AscDesktopEditor"]&&window["AscDesktopEditor"]["IsLocalFile"]&&window["AscDesktopEditor"]["isBlockchainSupport"]){this.isBlockchainSupport=window["AscDesktopEditor"]["isBlockchainSupport"]()&&!window["AscDesktopEditor"]["IsLocalFile"]();if(this.isBlockchainSupport){Image.prototype.preload_crypto=function(_url){window["crypto_images_map"]=window["crypto_images_map"]||{};if(!window["crypto_images_map"][_url])window["crypto_images_map"][_url]=[];window["crypto_images_map"][_url].push(this);
window["AscDesktopEditor"]["PreloadCryptoImage"](_url,AscCommon.g_oDocumentUrls.getLocal(_url));oThis.Api.sync_StartAction(Asc.c_oAscAsyncActionType.BlockInteraction,Asc.c_oAscAsyncAction.LoadImage)};Image.prototype["onload_crypto"]=function(_src,_crypto_data){if(_crypto_data&&AscCommon.EncryptionWorker&&AscCommon.EncryptionWorker.isCryptoImages()){AscCommon.EncryptionWorker.decryptImage(_src,this,_crypto_data);return}this.crossOrigin="";this.src=_src;oThis.Api.sync_EndAction(Asc.c_oAscAsyncActionType.BlockInteraction,
Asc.c_oAscAsyncAction.LoadImage)}}}this.put_Api=function(_api){this.Api=_api;if(this.Api.IsAsyncOpenDocumentImages!==undefined){this.bIsAsyncLoadDocumentImages=this.Api.IsAsyncOpenDocumentImages();if(this.bIsAsyncLoadDocumentImages)if(undefined===this.Api.asyncImageEndLoadedBackground)this.bIsAsyncLoadDocumentImages=false}};this.LoadDocumentImagesCallback=function(){if(this.ThemeLoader==null)this.Api.asyncImagesDocumentEndLoaded();else this.ThemeLoader.asyncImagesEndLoaded()};this.LoadDocumentImages=
function(_images){if(this.ThemeLoader==null)this.Api.asyncImagesDocumentStartLoaded();else this.ThemeLoader.asyncImagesStartLoaded();this.images_loading=[];for(var id in _images)this.images_loading[this.images_loading.length]=AscCommon.getFullImageSrc2(_images[id]);if(!this.bIsAsyncLoadDocumentImages){this.nNoByOrderCounter=0;this._LoadImages()}else{var _len=this.images_loading.length;for(var i=0;i<_len;i++)this.LoadImageAsync(i);this.images_loading.splice(0,_len);var that=this;setTimeout(function(){that.LoadDocumentImagesCallback()},
3E3)}};this.loadImageByUrl=function(_image,_url){if(this.isBlockchainSupport)_image.preload_crypto(_url);else _image.src=_url};this._LoadImages=function(){var _count_images=this.images_loading.length;if(0==_count_images){this.nNoByOrderCounter=0;if(this.ThemeLoader==null)this.Api.asyncImagesDocumentEndLoaded();else this.ThemeLoader.asyncImagesEndLoaded();return}for(var i=0;i<_count_images;i++){var _id=this.images_loading[i];var oImage=new CImage(_id);oImage.Status=ImageLoadStatus.Loading;oImage.Image=
new Image;oThis.map_image_index[oImage.src]=oImage;oImage.Image.parentImage=oImage;oImage.Image.onload=function(){this.parentImage.Status=ImageLoadStatus.Complete;oThis.nNoByOrderCounter++;if(oThis.bIsLoadDocumentFirst===true){oThis.Api.OpenDocumentProgress.CurrentImage++;oThis.Api.SendOpenProgress()}if(!oThis.bIsLoadDocumentImagesNoByOrder){oThis.images_loading.shift();oThis._LoadImages()}else if(oThis.nNoByOrderCounter==oThis.images_loading.length){oThis.images_loading=[];oThis._LoadImages()}};
oImage.Image.onerror=function(){this.parentImage.Status=ImageLoadStatus.Complete;this.parentImage.Image=null;oThis.nNoByOrderCounter++;if(oThis.bIsLoadDocumentFirst===true){oThis.Api.OpenDocumentProgress.CurrentImage++;oThis.Api.SendOpenProgress()}if(!oThis.bIsLoadDocumentImagesNoByOrder){oThis.images_loading.shift();oThis._LoadImages()}else if(oThis.nNoByOrderCounter==oThis.images_loading.length){oThis.images_loading=[];oThis._LoadImages()}};AscCommon.backoffOnErrorImg(oImage.Image,function(img){oThis.loadImageByUrl(img,
img.src)});oThis.loadImageByUrl(oImage.Image,oImage.src);if(!oThis.bIsLoadDocumentImagesNoByOrder)return}};this.LoadImage=function(src,Type){var _image=this.map_image_index[src];if(undefined!=_image)return _image;this.Api.asyncImageStartLoaded();var oImage=new CImage(src);oImage.Type=Type;oImage.Image=new Image;oImage.Status=ImageLoadStatus.Loading;oThis.map_image_index[oImage.src]=oImage;oImage.Image.onload=function(){oImage.Status=ImageLoadStatus.Complete;oThis.Api.asyncImageEndLoaded(oImage)};
oImage.Image.onerror=function(){oImage.Image=null;oImage.Status=ImageLoadStatus.Complete;oThis.Api.asyncImageEndLoaded(oImage)};AscCommon.backoffOnErrorImg(oImage.Image,function(img){oThis.loadImageByUrl(img,img.src)});this.loadImageByUrl(oImage.Image,oImage.src);return null};this.LoadImageAsync=function(i){var _id=oThis.images_loading[i];var oImage=new CImage(_id);oImage.Status=ImageLoadStatus.Loading;oImage.Image=new Image;oThis.map_image_index[oImage.src]=oImage;var oThat=oThis;oImage.Image.onload=
function(){oImage.Status=ImageLoadStatus.Complete;oThat.Api.asyncImageEndLoadedBackground(oImage)};oImage.Image.onerror=function(){oImage.Status=ImageLoadStatus.Complete;oImage.Image=null;oThat.Api.asyncImageEndLoadedBackground(oImage)};AscCommon.backoffOnErrorImg(oImage.Image,function(img){oThis.loadImageByUrl(img,img.src)});console.log("Loading image "+i);console.log(oImage);window.parent.APP.getImageURL(oImage.src,function(url){if(url=="")oThis.loadImageByUrl(oImage.Image,oImage.src);else{oThis.loadImageByUrl(oImage.Image,
url);oThis.map_image_index[url]=oImage}})};this.LoadImagesWithCallback=function(arr,loadImageCallBack,loadImageCallBackArgs){var arrAsync=[];var i=0;for(i=0;i<arr.length;i++)if(this.map_image_index[arr[i]]===undefined)arrAsync.push(arr[i]);if(arrAsync.length==0){loadImageCallBack.call(this.Api,loadImageCallBackArgs);return}this.loadImageCallBackCounter=0;this.loadImageCallBackCounterMax=arrAsync.length;this.loadImageCallBack=loadImageCallBack;this.loadImageCallBackArgs=loadImageCallBackArgs;for(i=
0;i<arrAsync.length;i++){var oImage=new CImage(arrAsync[i]);oImage.Image=new Image;oImage.Image.parentImage=oImage;oImage.Status=ImageLoadStatus.Loading;this.map_image_index[oImage.src]=oImage;oImage.Image.onload=function(){this.parentImage.Status=ImageLoadStatus.Complete;oThis.loadImageCallBackCounter++;if(oThis.loadImageCallBackCounter==oThis.loadImageCallBackCounterMax)oThis.LoadImagesWithCallbackEnd()};oImage.Image.onerror=function(){this.parentImage.Image=null;this.parentImage.Status=ImageLoadStatus.Complete;
oThis.loadImageCallBackCounter++;if(oThis.loadImageCallBackCounter==oThis.loadImageCallBackCounterMax)oThis.LoadImagesWithCallbackEnd()};AscCommon.backoffOnErrorImg(oImage.Image,function(img){oThis.loadImageByUrl(img,img.src)});this.loadImageByUrl(oImage.Image,oImage.src)}};this.LoadImagesWithCallbackEnd=function(){this.loadImageCallBack.call(this.Api,this.loadImageCallBackArgs);this.loadImageCallBack=null;this.loadImageCallBackArgs=null;this.loadImageCallBackCounterMax=0;this.loadImageCallBackCounter=
0}}var g_flow_anchor=new Image;g_flow_anchor.asc_complete=false;g_flow_anchor.onload=function(){g_flow_anchor.asc_complete=true};g_flow_anchor.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAAPBAMAAADNDVhEAAAAIVBMVEUAAAANDQ0NDQ0NDQ0NDQ0NDQ0AAAANDQ0NDQ0NDQ0NDQ1jk7YPAAAACnRSTlMAGkD4mb9c5s9TDghpXQAAAFZJREFUCNdjYGBgW8YABlxcIBLBZ1gAEfZa5QWiGRkWMAIpAaA4iHQE0YwODEtANMsChkIwv4BBWQBICyswMC1iWADEDAzKoUuDFUAGNC9uABvIaQkkABpxD6lFb9lRAAAAAElFTkSuQmCC";var g_flow_anchor2=new Image;g_flow_anchor2.asc_complete=
false;g_flow_anchor2.onload=function(){g_flow_anchor2.asc_complete=true};g_flow_anchor2.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABoAAAAeCAMAAAAFBf7qAAAAOVBMVEUAAAAAAAAAAAAAAAAJCQkAAAAJCQkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJCQknI0ZQAAAAEnRSTlMAx9ITlAfyPHxn68yecTAl5qt6y0BvAAAAt0lEQVQoz8WS0QrDIAxFk0ajtlXb+/8fuzAprltg7Gnn4aIcvAgJTSSoBiGPoIAGV60qoquvIIL110IJgPONmKIlMI73MiwGRoZvahbKVSizcDKU8QeVPDXEIr6ShVB9VUEn2FOMkwL8VwjUtuypvDWiHeVTFeyWkZHfVQZHGm4XMhKQyJB9GKMxuHQSBlioF7u2q7kzgO2AcWwW3F8mWRmGKgyu91mK1Tzh4ixVVkBzJI/EnGjyACbfCaO3eIWRAAAAAElFTkSuQmCC";
function(_images){if(this.ThemeLoader==null)this.Api.asyncImagesDocumentStartLoaded();else this.ThemeLoader.asyncImagesStartLoaded();this.images_loading=[];for(var id in _images)this.images_loading[this.images_loading.length]=AscCommon.getFullImageSrc2(_images[id]);if(!this.bIsAsyncLoadDocumentImages){this.nNoByOrderCounter=0;this._LoadImages()}else{var _len=this.images_loading.length;if(_len===0)return void this.LoadDocumentImagesCallback();var todo=_len;var that=this;var done=function(){todo--;
if(todo===0){that.images_loading.splice(0,_len);setTimeout(function(){that.LoadDocumentImagesCallback()},100);done=function(){}}};for(var i=0;i<_len;i++)this.LoadImageAsync(i,done);return;this.images_loading.splice(0,_len);var that=this;setTimeout(function(){that.LoadDocumentImagesCallback()},3E3)}};this.loadImageByUrl=function(_image,_url){if(this.isBlockchainSupport)_image.preload_crypto(_url);else _image.src=_url};this._LoadImages=function(){var _count_images=this.images_loading.length;if(0==_count_images){this.nNoByOrderCounter=
0;if(this.ThemeLoader==null)this.Api.asyncImagesDocumentEndLoaded();else this.ThemeLoader.asyncImagesEndLoaded();return}for(var i=0;i<_count_images;i++){var _id=this.images_loading[i];var oImage=new CImage(_id);oImage.Status=ImageLoadStatus.Loading;oImage.Image=new Image;oThis.map_image_index[oImage.src]=oImage;oImage.Image.parentImage=oImage;oImage.Image.onload=function(){this.parentImage.Status=ImageLoadStatus.Complete;oThis.nNoByOrderCounter++;if(oThis.bIsLoadDocumentFirst===true){oThis.Api.OpenDocumentProgress.CurrentImage++;
oThis.Api.SendOpenProgress()}if(!oThis.bIsLoadDocumentImagesNoByOrder){oThis.images_loading.shift();oThis._LoadImages()}else if(oThis.nNoByOrderCounter==oThis.images_loading.length){oThis.images_loading=[];oThis._LoadImages()}};oImage.Image.onerror=function(){this.parentImage.Status=ImageLoadStatus.Complete;this.parentImage.Image=null;oThis.nNoByOrderCounter++;if(oThis.bIsLoadDocumentFirst===true){oThis.Api.OpenDocumentProgress.CurrentImage++;oThis.Api.SendOpenProgress()}if(!oThis.bIsLoadDocumentImagesNoByOrder){oThis.images_loading.shift();
oThis._LoadImages()}else if(oThis.nNoByOrderCounter==oThis.images_loading.length){oThis.images_loading=[];oThis._LoadImages()}};AscCommon.backoffOnErrorImg(oImage.Image,function(img){oThis.loadImageByUrl(img,img.src)});oThis.loadImageByUrl(oImage.Image,oImage.src);if(!oThis.bIsLoadDocumentImagesNoByOrder)return}};this.LoadImage=function(src,Type){var _image=this.map_image_index[src];if(undefined!=_image)return _image;this.Api.asyncImageStartLoaded();var oImage=new CImage(src);oImage.Type=Type;oImage.Image=
new Image;oImage.Status=ImageLoadStatus.Loading;oThis.map_image_index[oImage.src]=oImage;oImage.Image.onload=function(){oImage.Status=ImageLoadStatus.Complete;oThis.Api.asyncImageEndLoaded(oImage)};oImage.Image.onerror=function(){oImage.Image=null;oImage.Status=ImageLoadStatus.Complete;oThis.Api.asyncImageEndLoaded(oImage)};AscCommon.backoffOnErrorImg(oImage.Image,function(img){oThis.loadImageByUrl(img,img.src)});this.loadImageByUrl(oImage.Image,oImage.src);return null};this.LoadImageAsync=function(i,
cb){var _id=oThis.images_loading[i];var oImage=new CImage(_id);oImage.Status=ImageLoadStatus.Loading;oImage.Image=new Image;oThis.map_image_index[oImage.src]=oImage;var oThat=oThis;oImage.Image.onload=function(){oImage.Status=ImageLoadStatus.Complete;oThat.Api.asyncImageEndLoadedBackground(oImage)};oImage.Image.onerror=function(){oImage.Status=ImageLoadStatus.Complete;oImage.Image=null;oThat.Api.asyncImageEndLoadedBackground(oImage)};AscCommon.backoffOnErrorImg(oImage.Image,function(img){oThis.loadImageByUrl(img,
img.src)});console.log("Loading image "+i);console.log(oImage);window.parent.APP.getImageURL(oImage.src,function(url){if(url=="")oThis.loadImageByUrl(oImage.Image,oImage.src);else{oThis.loadImageByUrl(oImage.Image,url);oThis.map_image_index[url]=oImage}if(typeof cb==="function")cb()})};this.LoadImagesWithCallback=function(arr,loadImageCallBack,loadImageCallBackArgs){var arrAsync=[];var i=0;for(i=0;i<arr.length;i++)if(this.map_image_index[arr[i]]===undefined)arrAsync.push(arr[i]);if(arrAsync.length==
0){loadImageCallBack.call(this.Api,loadImageCallBackArgs);return}this.loadImageCallBackCounter=0;this.loadImageCallBackCounterMax=arrAsync.length;this.loadImageCallBack=loadImageCallBack;this.loadImageCallBackArgs=loadImageCallBackArgs;for(i=0;i<arrAsync.length;i++){var oImage=new CImage(arrAsync[i]);oImage.Image=new Image;oImage.Image.parentImage=oImage;oImage.Status=ImageLoadStatus.Loading;this.map_image_index[oImage.src]=oImage;oImage.Image.onload=function(){this.parentImage.Status=ImageLoadStatus.Complete;
oThis.loadImageCallBackCounter++;if(oThis.loadImageCallBackCounter==oThis.loadImageCallBackCounterMax)oThis.LoadImagesWithCallbackEnd()};oImage.Image.onerror=function(){this.parentImage.Image=null;this.parentImage.Status=ImageLoadStatus.Complete;oThis.loadImageCallBackCounter++;if(oThis.loadImageCallBackCounter==oThis.loadImageCallBackCounterMax)oThis.LoadImagesWithCallbackEnd()};AscCommon.backoffOnErrorImg(oImage.Image,function(img){oThis.loadImageByUrl(img,img.src)});this.loadImageByUrl(oImage.Image,
oImage.src)}};this.LoadImagesWithCallbackEnd=function(){this.loadImageCallBack.call(this.Api,this.loadImageCallBackArgs);this.loadImageCallBack=null;this.loadImageCallBackArgs=null;this.loadImageCallBackCounterMax=0;this.loadImageCallBackCounter=0}}var g_flow_anchor=new Image;g_flow_anchor.asc_complete=false;g_flow_anchor.onload=function(){g_flow_anchor.asc_complete=true};g_flow_anchor.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAAPBAMAAADNDVhEAAAAIVBMVEUAAAANDQ0NDQ0NDQ0NDQ0NDQ0AAAANDQ0NDQ0NDQ0NDQ1jk7YPAAAACnRSTlMAGkD4mb9c5s9TDghpXQAAAFZJREFUCNdjYGBgW8YABlxcIBLBZ1gAEfZa5QWiGRkWMAIpAaA4iHQE0YwODEtANMsChkIwv4BBWQBICyswMC1iWADEDAzKoUuDFUAGNC9uABvIaQkkABpxD6lFb9lRAAAAAElFTkSuQmCC";
var g_flow_anchor2=new Image;g_flow_anchor2.asc_complete=false;g_flow_anchor2.onload=function(){g_flow_anchor2.asc_complete=true};g_flow_anchor2.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABoAAAAeCAMAAAAFBf7qAAAAOVBMVEUAAAAAAAAAAAAAAAAJCQkAAAAJCQkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJCQknI0ZQAAAAEnRSTlMAx9ITlAfyPHxn68yecTAl5qt6y0BvAAAAt0lEQVQoz8WS0QrDIAxFk0ajtlXb+/8fuzAprltg7Gnn4aIcvAgJTSSoBiGPoIAGV60qoquvIIL110IJgPONmKIlMI73MiwGRoZvahbKVSizcDKU8QeVPDXEIr6ShVB9VUEn2FOMkwL8VwjUtuypvDWiHeVTFeyWkZHfVQZHGm4XMhKQyJB9GKMxuHQSBlioF7u2q7kzgO2AcWwW3F8mWRmGKgyu91mK1Tzh4ixVVkBzJI/EnGjyACbfCaO3eIWRAAAAAElFTkSuQmCC";
window["AscCommon"]=window["AscCommon"]||{};window["AscCommon"].g_font_loader=new CGlobalFontLoader;window["AscCommon"].g_image_loader=new CGlobalImageLoader;window["AscCommon"].g_flow_anchor=g_flow_anchor;window["AscCommon"].g_flow_anchor2=g_flow_anchor2})(window,window.document);"use strict";(function(window,undefined){var g_dKoef_mm_to_pix=AscCommon.g_dKoef_mm_to_pix;function CBounds(){this.L=0;this.T=0;this.R=0;this.B=0;this.isAbsL=false;this.isAbsT=false;this.isAbsR=false;this.isAbsB=false;this.AbsW=
-1;this.AbsH=-1;this.SetParams=function(_l,_t,_r,_b,abs_l,abs_t,abs_r,abs_b,absW,absH){this.L=_l;this.T=_t;this.R=_r;this.B=_b;this.isAbsL=abs_l;this.isAbsT=abs_t;this.isAbsR=abs_r;this.isAbsB=abs_b;this.AbsW=absW;this.AbsH=absH}}function CAbsolutePosition(){this.L=0;this.T=0;this.R=0;this.B=0}var g_anchor_left=1;var g_anchor_top=2;var g_anchor_right=4;var g_anchor_bottom=8;function CControl(){this.Bounds=new CBounds;this.Anchor=g_anchor_left|g_anchor_top;this.Name=null;this.Parent=null;this.TabIndex=
null;this.HtmlElement=null;this.AbsolutePosition=new CBounds;this.Resize=function(_width,_height,api){if(null==this.Parent||null==this.HtmlElement)return;var _x=0;var _y=0;var _r=0;var _b=0;var hor_anchor=this.Anchor&5;var ver_anchor=this.Anchor&10;if(g_anchor_left==hor_anchor){if(this.Bounds.isAbsL)_x=this.Bounds.L;else _x=this.Bounds.L*_width/1E3;if(-1!=this.Bounds.AbsW)_r=_x+this.Bounds.AbsW;else if(this.Bounds.isAbsR)_r=_width-this.Bounds.R;else _r=this.Bounds.R*_width/1E3}else if(g_anchor_right==
@ -19395,59 +19395,59 @@ this.CheckFootnote(X,Y,CurPage);if(isInText&&null!=oHyperlink&&(Y<=this.Pages[Cu
Asc.c_oAscMouseMoveDataTypes.Common;if(isInText&&(null!=oHyperlink||bPageRefLink)&&true===AscCommon.global_keyboardEvent.CtrlKey)this.DrawingDocument.SetCursorType("pointer",MMData);else this.DrawingDocument.SetCursorType("text",MMData);var Bounds=this.Pages[CurPage].Bounds;if(true===this.Lock.Is_Locked()&&X<Bounds.Right&&X>Bounds.Left&&Y>Bounds.Top&&Y<Bounds.Bottom&&this.LogicDocument&&!this.LogicDocument.IsViewModeInReview()){var _X=this.Pages[CurPage].X;var _Y=this.Pages[CurPage].Y;var MMData=
new AscCommon.CMouseMoveData;var Coords=this.DrawingDocument.ConvertCoordsToCursorWR(_X,_Y,this.Get_AbsolutePage(CurPage),text_transform);MMData.X_abs=Coords.X-5;MMData.Y_abs=Coords.Y;MMData.Type=Asc.c_oAscMouseMoveDataTypes.LockedObject;MMData.UserId=this.Lock.Get_UserId();MMData.HaveChanges=this.Lock.Have_Changes();MMData.LockedObjectType=c_oAscMouseMoveLockedObjectType.Common;editor.sync_MouseMoveCallback(MMData)}};Paragraph.prototype.Document_CreateFontMap=function(FontMap){if(true===this.FontMap.NeedRecalc){this.FontMap.Map=
{};this.private_CompileParaPr();var FontScheme=this.Get_Theme().themeElements.fontScheme;var CurTextPr=this.CompiledPr.Pr.TextPr.Copy();CurTextPr.Document_CreateFontMap(this.FontMap.Map,FontScheme);CurTextPr.Merge(this.TextPr.Value);CurTextPr.Document_CreateFontMap(this.FontMap.Map,FontScheme);var Count=this.Content.length;for(var Index=0;Index<Count;Index++)this.Content[Index].Create_FontMap(this.FontMap.Map);this.FontMap.NeedRecalc=false}for(var Key in this.FontMap.Map)FontMap[Key]=this.FontMap.Map[Key]};
Paragraph.prototype.Document_CreateFontCharMap=function(FontCharMap){};Paragraph.prototype.Document_Get_AllFontNames=function(AllFonts){this.TextPr.Value.Document_Get_AllFontNames(AllFonts);if(this.Pr.Bullet)this.Pr.Bullet.Get_AllFontNames(AllFonts);if(this.Pr.DefaultRunPr)this.Pr.DefaultRunPr.Document_Get_AllFontNames(AllFonts);var Count=this.Content.length;for(var Index=0;Index<Count;Index++)this.Content[Index].Get_AllFontNames(AllFonts)};Paragraph.prototype.Document_UpdateRulersState=function(){if(this.CalculatedFrame){var oFrame=
this.CalculatedFrame;this.Parent.DrawingDocument.Set_RulerState_Paragraph({L:oFrame.L2,T:oFrame.T2,R:oFrame.L2+oFrame.W2,B:oFrame.T2+oFrame.H2,PageIndex:this.GetStartPageAbsolute(),Frame:this},false)}else if(this.Parent instanceof CDocument)if(this.LogicDocument)this.LogicDocument.Document_UpdateRulersStateBySection()};Paragraph.prototype.Document_UpdateInterfaceState=function(){var StartPos,EndPos;if(true===this.Selection.Use){StartPos=this.Get_ParaContentPos(true,true);EndPos=this.Get_ParaContentPos(true,
false)}else{var CurPos=this.Get_ParaContentPos(false,false);StartPos=CurPos;EndPos=CurPos}if(this.LogicDocument&&true===this.LogicDocument.Spelling.Use&&(selectionflag_Numbering!==this.Selection.Flag&&selectionflag_NumberingCur!==this.Selection.Flag))this.SpellChecker.Document_UpdateInterfaceState(StartPos,EndPos);if(true===this.Selection.Use){var StartPos=this.Selection.StartPos;var EndPos=this.Selection.EndPos;if(StartPos>EndPos){StartPos=this.Selection.EndPos;EndPos=this.Selection.StartPos}for(var CurPos=
StartPos;CurPos<=EndPos;CurPos++){var Element=this.Content[CurPos];if(true!==Element.IsSelectionEmpty()&&Element.Document_UpdateInterfaceState)Element.Document_UpdateInterfaceState()}}else{var CurType=this.Content[this.CurPos.ContentPos].Type;if(this.Content[this.CurPos.ContentPos].Document_UpdateInterfaceState)this.Content[this.CurPos.ContentPos].Document_UpdateInterfaceState()}var arrComplexFields=this.GetCurrentComplexFields();for(var nIndex=0,nCount=arrComplexFields.length;nIndex<nCount;++nIndex){var oInstruction=
arrComplexFields[nIndex].GetInstruction();if(oInstruction&&fieldtype_HYPERLINK===oInstruction.GetType()){var oHyperProps=new Asc.CHyperlinkProperty;oHyperProps.put_ToolTip(oInstruction.GetToolTip());oHyperProps.put_Value(oInstruction.GetValue());oHyperProps.put_Text(this.LogicDocument?this.LogicDocument.GetComplexFieldTextValue(arrComplexFields[nIndex]):null);oHyperProps.put_InternalHyperlink(oInstruction);editor.sync_HyperlinkPropCallback(oHyperProps)}}if(editor&&this.bFromDocument){if(!this.LogicDocument)return;
var TrackManager=this.LogicDocument.GetTrackRevisionsManager();if(this.Pages.length<=0&&this.Lines.length<=0)return;var ContentPos=this.Get_ParaContentPos(this.Selection.Use,true);var ParaPos=this.Get_ParaPosByContentPos(ContentPos);if(this.Pages.length<=ParaPos.Page||this.Lines.length<=ParaPos.Line)return;var Page_abs=this.Get_AbsolutePage(ParaPos.Page);var _Y=this.Pages[ParaPos.Page].Y+this.Lines[ParaPos.Line].Top;var TextTransform=this.Get_ParentTextTransform();var _X=this.LogicDocument?this.LogicDocument.Get_PageLimits(Page_abs).XLimit:
0;var Coords=this.DrawingDocument.ConvertCoordsToCursorWR(_X,_Y,Page_abs,TextTransform);if(false===this.Selection.Use){var Changes=TrackManager.GetElementChanges(this.GetId());if(Changes.length>0)for(var ChangeIndex=0,ChangesCount=Changes.length;ChangeIndex<ChangesCount;ChangeIndex++){var Change=Changes[ChangeIndex];var Type=Change.get_Type();if(c_oAscRevisionsChangeType.TextAdd!==Type&&c_oAscRevisionsChangeType.TextRem!==Type&&c_oAscRevisionsChangeType.TextPr!==Type||StartPos.Compare(Change.get_StartPos())>=
0&&StartPos.Compare(Change.get_EndPos())<=0){Change.put_InternalPos(_X,_Y,Page_abs);TrackManager.AddVisibleChange(Change)}}}}};Paragraph.prototype.PreDelete=function(){for(var Index=0;Index<this.Content.length;Index++){var Item=this.Content[Index];if(Item.PreDelete)Item.PreDelete();if(this.LogicDocument)if(para_Comment===Item.Type&&true===this.LogicDocument.RemoveCommentsOnPreDelete)this.LogicDocument.RemoveComment(Item.CommentId,true,false);else if(para_Bookmark===Item.Type)this.LogicDocument.GetBookmarksManager().SetNeedUpdate(true)}this.RemoveSelection();
this.UpdateDocumentOutline();if(undefined!==this.Get_SectionPr()&&this.LogicDocument)this.Set_SectionPr(undefined)};Paragraph.prototype.Document_SetThisElementCurrent=function(bUpdateStates){this.Parent.Update_ContentIndexing();this.Parent.Set_CurrentElement(this.Index,bUpdateStates)};Paragraph.prototype.Is_ThisElementCurrent=function(){var Parent=this.Parent;Parent.Update_ContentIndexing();if(docpostype_Content===Parent.GetDocPosType()&&false===Parent.Selection.Use&&this.Index===Parent.CurPos.ContentPos&&
Parent.Content[this.Index]===this)return this.Parent.Is_ThisElementCurrent();return false};Paragraph.prototype.Is_Inline=function(){if(this.bFromDocument===false)return true;var PrevElement=this.Get_DocumentPrev();if(true===this.Is_Empty()&&undefined!==this.Get_SectionPr()&&null!==PrevElement&&(type_Paragraph!==PrevElement.Get_Type()||undefined===PrevElement.Get_SectionPr()))return true;if(undefined===this.Parent||!(this.Parent instanceof CDocument)&&(undefined===this.Parent.Parent||!(this.Parent.Parent instanceof
CHeaderFooter)))return true;if(undefined!=this.Pr.FramePr&&Asc.c_oAscYAlign.Inline!==this.Pr.FramePr.YAlign)return false;return true};Paragraph.prototype.IsInline=function(){return this.Is_Inline()};Paragraph.prototype.GetFramePr=function(){return this.Get_CompiledPr2(false).ParaPr.FramePr};Paragraph.prototype.Get_FramePr=function(){return this.GetFramePr()};Paragraph.prototype.Set_FramePr=function(FramePr,bDelete){var FramePr_old=this.Pr.FramePr;if(undefined===bDelete)bDelete=false;if(true===bDelete){this.Pr.FramePr=
undefined;this.private_AddPrChange();History.Add(new CChangesParagraphFramePr(this,FramePr_old,undefined));this.CompiledPr.NeedRecalc=true;this.private_UpdateTrackRevisionOnChangeParaPr(true);return}var FrameParas=this.Internal_Get_FrameParagraphs();if(true===FramePr.FromDropCapMenu&&1===FrameParas.length){var NewFramePr=FramePr_old?FramePr_old.Copy():new CFramePr;if(undefined!=FramePr.DropCap){var OldLines=NewFramePr.Lines;NewFramePr.Init_Default_DropCap(FramePr.DropCap===Asc.c_oAscDropCap.Drop?
true:false);NewFramePr.Lines=OldLines}if(undefined!=FramePr.Lines){var AnchorPara=this.Get_FrameAnchorPara();if(null===AnchorPara||AnchorPara.Lines.length<=0)return;var Before=AnchorPara.Get_CompiledPr().ParaPr.Spacing.Before;var LineH=AnchorPara.Lines[0].Bottom-AnchorPara.Lines[0].Top-Before;var LineTA=AnchorPara.Lines[0].Metrics.TextAscent2;var LineTD=AnchorPara.Lines[0].Metrics.TextDescent+AnchorPara.Lines[0].Metrics.LineGap;this.Set_Spacing({LineRule:linerule_Exact,Line:FramePr.Lines*LineH},false);
this.Update_DropCapByLines(this.Internal_CalculateTextPr(this.Internal_GetStartPos()),FramePr.Lines,LineH,LineTA,LineTD,Before);NewFramePr.Lines=FramePr.Lines}if(undefined!=FramePr.FontFamily){var FF=new ParaTextPr({RFonts:{Ascii:{Name:FramePr.FontFamily.Name,Index:-1}}});this.SelectAll();this.Add(FF);this.RemoveSelection()}if(undefined!=FramePr.HSpace)NewFramePr.HSpace=FramePr.HSpace;this.Pr.FramePr=NewFramePr}else{var NewFramePr=FramePr_old?FramePr_old.Copy():new CFramePr;if(undefined!=FramePr.H)NewFramePr.H=
FramePr.H;if(undefined!=FramePr.HAnchor)NewFramePr.HAnchor=FramePr.HAnchor;if(undefined!=FramePr.HRule)NewFramePr.HRule=FramePr.HRule;if(undefined!=FramePr.HSpace)NewFramePr.HSpace=FramePr.HSpace;if(undefined!=FramePr.Lines)NewFramePr.Lines=FramePr.Lines;if(undefined!=FramePr.VAnchor)NewFramePr.VAnchor=FramePr.VAnchor;if(undefined!=FramePr.VSpace)NewFramePr.VSpace=FramePr.VSpace;NewFramePr.W=FramePr.W;if(undefined!=FramePr.X){NewFramePr.X=FramePr.X;NewFramePr.XAlign=undefined}if(undefined!=FramePr.XAlign){NewFramePr.XAlign=
FramePr.XAlign;NewFramePr.X=undefined}if(undefined!=FramePr.Y){NewFramePr.Y=FramePr.Y;NewFramePr.YAlign=undefined}if(undefined!=FramePr.YAlign){NewFramePr.YAlign=FramePr.YAlign;NewFramePr.Y=undefined}if(undefined!==FramePr.Wrap)if(false===FramePr.Wrap)NewFramePr.Wrap=wrap_NotBeside;else if(true===FramePr.Wrap)NewFramePr.Wrap=wrap_Around;else NewFramePr.Wrap=FramePr.Wrap;this.Pr.FramePr=NewFramePr}if(undefined!=FramePr.Brd){var Count=FrameParas.length;for(var Index=0;Index<Count;Index++)FrameParas[Index].Set_Borders(FramePr.Brd)}if(undefined!=
FramePr.Shd){var Count=FrameParas.length;for(var Index=0;Index<Count;Index++)FrameParas[Index].Set_Shd(FramePr.Shd)}this.private_AddPrChange();History.Add(new CChangesParagraphFramePr(this,FramePr_old,this.Pr.FramePr));this.CompiledPr.NeedRecalc=true;this.private_UpdateTrackRevisionOnChangeParaPr(true)};Paragraph.prototype.Set_FramePr2=function(FramePr){this.private_AddPrChange();History.Add(new CChangesParagraphFramePr(this,this.Pr.FramePr,FramePr));this.Pr.FramePr=FramePr;this.CompiledPr.NeedRecalc=
true;this.private_UpdateTrackRevisionOnChangeParaPr(true)};Paragraph.prototype.Set_FrameParaPr=function(Para){Para.CopyPr(this);Para.Set_Ind({FirstLine:0},false);this.Set_Spacing({After:0},false);this.Set_Ind({Right:0},false);this.RemoveNumPr()};Paragraph.prototype.Get_FrameBounds=function(FrameX,FrameY,FrameW,FrameH){var X0=FrameX,Y0=FrameY,X1=FrameX+FrameW,Y1=FrameY+FrameH;var Paras=this.Internal_Get_FrameParagraphs();var Count=Paras.length;var FramePr=this.Get_FramePr();if(0>=Count)return{X:X0,
Y:Y0,W:X1-X0,H:Y1-Y0};for(var Index=0;Index<Count;Index++){var Para=Paras[Index];var ParaPr=Para.Get_CompiledPr2(false).ParaPr;var Brd=ParaPr.Brd;var _X0=FrameX;if(undefined!==Brd.Left&&border_None!==Brd.Left.Value)_X0-=Brd.Left.Size+Brd.Left.Space+1;if(_X0<X0)X0=_X0;var _X1=FrameX+FrameW;if(undefined!==Brd.Right&&border_None!==Brd.Right.Value){_X1=Math.max(_X1,_X1-ParaPr.Ind.Right);_X1+=Brd.Right.Size+Brd.Right.Space+1}if(_X1>X1)X1=_X1}var _Y1=Y1;var BottomBorder=Paras[Count-1].Get_CompiledPr2(false).ParaPr.Brd.Bottom;
if(undefined!==BottomBorder&&border_None!==BottomBorder.Value)_Y1+=BottomBorder.Size+BottomBorder.Space;if(_Y1>Y1&&(Asc.linerule_Auto===FramePr.HRule||Asc.linerule_AtLeast===FramePr.HRule&&FrameH>=FramePr.H))Y1=_Y1;return{X:X0,Y:Y0,W:X1-X0,H:Y1-Y0}};Paragraph.prototype.SetCalculatedFrame=function(oFrame){this.CalculatedFrame=oFrame;oFrame.AddParagraph(this)};Paragraph.prototype.GetCalculatedFrame=function(){return this.CalculatedFrame};Paragraph.prototype.Internal_Get_FrameParagraphs=function(){if(this.CalculatedFrame&&
this.CalculatedFrame.GetParagraphs().length>0)return this.CalculatedFrame.GetParagraphs();var FrameParas=[];var FramePr=this.Get_FramePr();if(undefined===FramePr)return FrameParas;FrameParas.push(this);var Prev=this.Get_DocumentPrev();while(null!=Prev)if(type_Paragraph===Prev.GetType()){var PrevFramePr=Prev.Get_FramePr();if(undefined!=PrevFramePr&&true===FramePr.Compare(PrevFramePr)){FrameParas.push(Prev);Prev=Prev.Get_DocumentPrev()}else break}else break;var Next=this.Get_DocumentNext();while(null!=
Next)if(type_Paragraph===Next.GetType()){var NextFramePr=Next.Get_FramePr();if(undefined!=NextFramePr&&true===FramePr.Compare(NextFramePr)){FrameParas.push(Next);Next=Next.Get_DocumentNext()}else break}else break;return FrameParas};Paragraph.prototype.Is_LineDropCap=function(){var FrameParas=this.Internal_Get_FrameParagraphs();if(1!==FrameParas.length||1!==this.Lines.length)return false;return true};Paragraph.prototype.Get_LineDropCapWidth=function(){var W=this.Lines[0].Ranges[0].W;var ParaPr=this.Get_CompiledPr2(false).ParaPr;
W+=ParaPr.Ind.Left+ParaPr.Ind.FirstLine;return W};Paragraph.prototype.Change_Frame=function(X,Y,W,H,PageIndex){if(!this.LogicDocument||!this.CalculatedFrame||!this.CalculatedFrame.GetFramePr())return;var FramePr=this.CalculatedFrame.GetFramePr();if(Math.abs(Y-this.CalculatedFrame.T2)<.001&&Math.abs(X-this.CalculatedFrame.L2)<.001&&Math.abs(W-this.CalculatedFrame.W2)<.001&&Math.abs(H-this.CalculatedFrame.H2)<.001&&PageIndex===this.CalculatedFrame.PageIndex)return;var FrameParas=this.Internal_Get_FrameParagraphs();
if(false===this.LogicDocument.Document_Is_SelectionLocked(AscCommon.changestype_None,{Type:AscCommon.changestype_2_ElementsArray_and_Type,Elements:FrameParas,CheckType:AscCommon.changestype_Paragraph_Content})){this.LogicDocument.StartAction(AscDFH.historydescription_Document_ParagraphChangeFrame);var NewFramePr=FramePr.Copy();if(Math.abs(X-this.CalculatedFrame.L2)>.001){NewFramePr.X=X+(this.CalculatedFrame.L-this.CalculatedFrame.L2);NewFramePr.XAlign=undefined;NewFramePr.HAnchor=Asc.c_oAscHAnchor.Page}if(Math.abs(Y-
this.CalculatedFrame.T2)>.001){NewFramePr.Y=Y+(this.CalculatedFrame.T-this.CalculatedFrame.T2);NewFramePr.YAlign=undefined;NewFramePr.VAnchor=Asc.c_oAscVAnchor.Page}if(Math.abs(W-this.CalculatedFrame.W2)>.001)NewFramePr.W=W-Math.abs(this.CalculatedFrame.W2-this.CalculatedFrame.W);if(Math.abs(H-this.CalculatedFrame.H2)>.001)if(undefined!=FramePr.DropCap&&Asc.c_oAscDropCap.None!=FramePr.DropCap&&1===FrameParas.length){var PageH=this.LogicDocument.Get_PageLimits(PageIndex).YLimit;var _H=Math.min(H,PageH);
NewFramePr.Lines=this.Update_DropCapByHeight(_H);NewFramePr.HRule=linerule_Exact;NewFramePr.H=H-Math.abs(this.CalculatedFrame.H2-this.CalculatedFrame.H)}else{if(H<=this.CalculatedFrame.H2)NewFramePr.HRule=linerule_Exact;else NewFramePr.HRule=Asc.linerule_AtLeast;NewFramePr.H=H}var Count=FrameParas.length;for(var Index=0;Index<Count;Index++){var Para=FrameParas[Index];Para.Set_FramePr(NewFramePr,false)}this.LogicDocument.Recalculate();this.LogicDocument.UpdateInterface();this.LogicDocument.UpdateRulers();
this.LogicDocument.UpdateTracks();this.LogicDocument.FinalizeAction()}};Paragraph.prototype.Supplement_FramePr=function(FramePr){if(undefined!=FramePr.DropCap&&Asc.c_oAscDropCap.None!=FramePr.DropCap){var _FramePr=this.Get_FramePr();var FirstFramePara=this;var Prev=FirstFramePara.Get_DocumentPrev();while(null!=Prev)if(type_Paragraph===Prev.GetType()){var PrevFramePr=Prev.Get_FramePr();if(undefined!=PrevFramePr&&true===_FramePr.Compare(PrevFramePr)){FirstFramePara=Prev;Prev=Prev.Get_DocumentPrev()}else break}else break;
var TextPr=FirstFramePara.GetFirstRunPr();if(undefined===TextPr.RFonts||undefined===TextPr.RFonts.Ascii)TextPr=this.Get_CompiledPr2(false).TextPr;FramePr.FontFamily={Name:TextPr.RFonts.Ascii.Name,Index:TextPr.RFonts.Ascii.Index}}var FrameParas=this.Internal_Get_FrameParagraphs();var Count=FrameParas.length;var ParaPr=FrameParas[0].Get_CompiledPr2(false).ParaPr.Copy();for(var Index=1;Index<Count;Index++){var TempPr=FrameParas[Index].Get_CompiledPr2(false).ParaPr;ParaPr=ParaPr.Compare(TempPr)}FramePr.Brd=
ParaPr.Brd;FramePr.Shd=ParaPr.Shd};Paragraph.prototype.CanAddDropCap=function(){for(var nPos=0,nCount=this.Content.length;nPos<nCount;++nPos){var bResult=this.Content[nPos].CanAddDropCap();if(null!==bResult)return bResult}return false};Paragraph.prototype.Get_TextForDropCap=function(DropCapText,UseContentPos,ContentPos,Depth){var EndPos=true===UseContentPos?ContentPos.Get(Depth):this.Content.length-1;for(var Pos=0;Pos<=EndPos;Pos++){this.Content[Pos].Get_TextForDropCap(DropCapText,true===UseContentPos&&
Pos===EndPos?true:false,ContentPos,Depth+1);if(true===DropCapText.Mixed&&(true===DropCapText.Check||DropCapText.Runs.length>0))return}};Paragraph.prototype.Split_DropCap=function(NewParagraph){var DropCapText=new CParagraphGetDropCapText;if(true==this.Selection.Use&&this.Parent.IsSelectedSingleElement()){var SelSP=this.Get_ParaContentPos(true,true);var SelEP=this.Get_ParaContentPos(true,false);if(0<=SelSP.Compare(SelEP))SelEP=SelSP;DropCapText.Check=true;this.Get_TextForDropCap(DropCapText,true,SelEP,
0);DropCapText.Check=false;this.Get_TextForDropCap(DropCapText,true,SelEP,0)}else{DropCapText.Mixed=true;DropCapText.Check=false;this.Get_TextForDropCap(DropCapText,false)}var Count=DropCapText.Text.length;var PrevRun=null;var CurrRun=null;for(var Pos=0,ParaPos=0,RunPos=0;Pos<Count;Pos++){if(PrevRun!==DropCapText.Runs[Pos]){PrevRun=DropCapText.Runs[Pos];CurrRun=new ParaRun(NewParagraph);CurrRun.Set_Pr(DropCapText.Runs[Pos].Pr.Copy());NewParagraph.Internal_Content_Add(ParaPos++,CurrRun,false);RunPos=
0}CurrRun.Add_ToContent(RunPos++,DropCapText.Text[Pos],false)}if(Count>0)return DropCapText.Runs[Count-1].Get_CompiledPr(true);return null};Paragraph.prototype.SelectFirstLetter=function(){var oStartPos=new CParagraphContentPos;var oEndPos=new CParagraphContentPos;for(var nPos=0,nCount=this.Content.length;nPos<nCount;++nPos){oStartPos.Update(nPos,0);oEndPos.Update(nPos,0);if(this.Content[nPos].GetFirstRunElementPos(para_Text,oStartPos,oEndPos,1)){this.StartSelectionFromCurPos();this.SetSelectionContentPos(oStartPos,
oEndPos,false);this.Document_SetThisElementCurrent();return true}}return false};Paragraph.prototype.CheckSelectionForDropCap=function(){var oSelectionStart=this.Get_ParaContentPos(true,true);var oSelectionEnd=this.Get_ParaContentPos(true,false);if(0<=oSelectionStart.Compare(oSelectionEnd))oSelectionEnd=oSelectionStart;var nEndPos=oSelectionEnd.Get(0);for(var nPos=0;nPos<=nEndPos;++nPos)if(!this.Content[nPos].CheckSelectionForDropCap(nPos===nEndPos,oSelectionEnd,1))return false;return true};Paragraph.prototype.Update_DropCapByLines=
function(TextPr,Count,LineH,LineTA,LineTD,Before){if(null===TextPr)return;this.Set_Spacing({Before:Before,After:0,LineRule:linerule_Exact,Line:Count*LineH-.001},false);var FontSize=72;TextPr.FontSize=FontSize;g_oTextMeasurer.SetTextPr(TextPr,this.Get_Theme());g_oTextMeasurer.SetFontSlot(fontslot_ASCII,1);var TMetrics={Ascent:null,Descent:null};this.private_RecalculateTextMetrics(TMetrics);var TDescent=TMetrics.Descent;var TAscent=TMetrics.Ascent;var THeight=0;if(null===TAscent||null===TDescent)THeight=
g_oTextMeasurer.GetHeight();else THeight=-TDescent+TAscent;var EmHeight=THeight;var NewEmHeight=(Count-1)*LineH+LineTA;var Koef=NewEmHeight/EmHeight;var NewFontSize=TextPr.FontSize*Koef;TextPr.FontSize=parseInt(NewFontSize*2)/2;g_oTextMeasurer.SetTextPr(TextPr,this.Get_Theme());g_oTextMeasurer.SetFontSlot(fontslot_ASCII,1);var TNewMetrics={Ascent:null,Descent:null};this.private_RecalculateTextMetrics(TNewMetrics);var TNewDescent=TNewMetrics.Descent;var TNewAscent=TNewMetrics.Ascent;var TNewHeight=
0;if(null===TNewAscent||null===TNewDescent)TNewHeight=g_oTextMeasurer.GetHeight();else TNewHeight=-TNewDescent+TNewAscent;var Descent=g_oTextMeasurer.GetDescender();var Ascent=g_oTextMeasurer.GetAscender();var Dy=Descent*(LineH*Count)/(Ascent-Descent)+TNewHeight-TNewAscent+LineTD;var PTextPr=new ParaTextPr({RFonts:{Ascii:{Name:TextPr.RFonts.Ascii.Name,Index:-1}},FontSize:TextPr.FontSize,Position:Dy});this.SelectAll();this.Add(PTextPr);this.RemoveSelection()};Paragraph.prototype.Update_DropCapByHeight=
function(_Height){var AnchorPara=this.Get_FrameAnchorPara();if(null===AnchorPara||AnchorPara.Lines.length<=0)return 1;var Before=AnchorPara.Get_CompiledPr().ParaPr.Spacing.Before;var LineH=AnchorPara.Lines[0].Bottom-AnchorPara.Lines[0].Top-Before;var LineTA=AnchorPara.Lines[0].Metrics.TextAscent2;var LineTD=AnchorPara.Lines[0].Metrics.TextDescent+AnchorPara.Lines[0].Metrics.LineGap;var Height=_Height-Before;this.Set_Spacing({LineRule:linerule_Exact,Line:Height},false);var LinesCount=Math.ceil(Height/
LineH);var TextPr=this.Internal_CalculateTextPr(this.Internal_GetStartPos());g_oTextMeasurer.SetTextPr(TextPr,this.Get_Theme());g_oTextMeasurer.SetFontSlot(fontslot_ASCII,1);var TMetrics={Ascent:null,Descent:null};this.private_RecalculateTextMetrics(TMetrics);var TDescent=TMetrics.Descent;var TAscent=TMetrics.Ascent;var THeight=0;if(null===TAscent||null===TDescent)THeight=g_oTextMeasurer.GetHeight();else THeight=-TDescent+TAscent;var Koef=(Height-LineTD)/THeight;var NewFontSize=TextPr.FontSize*Koef;
TextPr.FontSize=parseInt(NewFontSize*2)/2;g_oTextMeasurer.SetTextPr(TextPr,this.Get_Theme());g_oTextMeasurer.SetFontSlot(fontslot_ASCII,1);var TNewMetrics={Ascent:null,Descent:null};this.private_RecalculateTextMetrics(TNewMetrics);var TNewDescent=TNewMetrics.Descent;var TNewAscent=TNewMetrics.Ascent;var TNewHeight=0;if(null===TNewAscent||null===TNewDescent)TNewHeight=g_oTextMeasurer.GetHeight();else TNewHeight=-TNewDescent+TNewAscent;var Descent=g_oTextMeasurer.GetDescender();var Ascent=g_oTextMeasurer.GetAscender();
var Dy=Descent*Height/(Ascent-Descent)+TNewHeight-TNewAscent+LineTD;var PTextPr=new ParaTextPr({RFonts:{Ascii:{Name:TextPr.RFonts.Ascii.Name,Index:-1}},FontSize:TextPr.FontSize,Position:Dy});this.SelectAll();this.Add(PTextPr);this.RemoveSelection();return LinesCount};Paragraph.prototype.Get_FrameAnchorPara=function(){var FramePr=this.Get_FramePr();if(undefined===FramePr)return null;var Next=this.Get_DocumentNext();while(null!=Next){if(type_Paragraph===Next.GetType()){var NextFramePr=Next.Get_FramePr();
if(undefined===NextFramePr||false===FramePr.Compare(NextFramePr))return Next}Next=Next.Get_DocumentNext()}return Next};Paragraph.prototype.Split=function(NewParagraph){if(!NewParagraph)NewParagraph=new Paragraph(this.DrawingDocument,this.Parent);NewParagraph.DeleteCommentOnRemove=false;this.DeleteCommentOnRemove=false;this.RemoveSelection();NewParagraph.RemoveSelection();var ContentPos=this.Get_ParaContentPos(false,false);var CurPos=ContentPos.Get(0);var TextPr=this.Get_TextPr(ContentPos);var oLogicDocument=
this.GetLogicDocument();var oStyles=oLogicDocument&&oLogicDocument.GetStyles?oLogicDocument.GetStyles():null;if(oStyles&&(TextPr.RStyle===oStyles.GetDefaultEndnoteReference()||TextPr.RStyle===oStyles.GetDefaultFootnoteReference())){TextPr=TextPr.Copy();TextPr.RStyle=undefined}var NewElement=this.Content[CurPos].Split(ContentPos,1);if(null===NewElement){NewElement=new ParaRun(NewParagraph);NewElement.Set_Pr(TextPr.Copy())}var NewContent=this.Content.slice(CurPos+1);this.Internal_Content_Remove2(CurPos+
1,this.Content.length-CurPos-1);var EndRun=new ParaRun(this);EndRun.Add_ToContent(0,new ParaEnd);this.Internal_Content_Add(this.Content.length,EndRun);NewParagraph.Internal_Content_Remove2(0,NewParagraph.Content.length);NewParagraph.Internal_Content_Concat(NewContent);NewParagraph.Internal_Content_Add(0,NewElement);NewParagraph.Correct_Content();this.CopyPr(NewParagraph);this.TextPr.Clear_Style();this.TextPr.Apply_TextPr(TextPr);var SectPr=this.Get_SectionPr();if(undefined!==SectPr){this.Set_SectionPr(undefined);
NewParagraph.Set_SectionPr(SectPr)}this.MoveCursorToEndPos(false,false);NewParagraph.MoveCursorToStartPos(false);NewParagraph.DeleteCommentOnRemove=true;this.DeleteCommentOnRemove=true;return NewParagraph};Paragraph.prototype.Concat=function(Para,isUseConcatedStyle){this.DeleteCommentOnRemove=false;Para.DeleteCommentOnRemove=false;this.Remove_ParaEnd();var NearPosCount=Para.NearPosArray.length;for(var Pos=0;Pos<NearPosCount;Pos++){var ParaNearPos=Para.NearPosArray[Pos];ParaNearPos.Classes[0]=this;
ParaNearPos.NearPos.Paragraph=this;ParaNearPos.NearPos.ContentPos.Data[0]+=this.Content.length;this.NearPosArray.push(ParaNearPos)}this.Internal_Content_Concat(Para.Content);Para.ClearContent();this.Set_SectionPr(undefined);var SectPr=Para.Get_SectionPr();if(undefined!==SectPr){Para.Set_SectionPr(undefined);this.Set_SectionPr(SectPr)}this.DeleteCommentOnRemove=true;Para.DeleteCommentOnRemove=true;if(true===isUseConcatedStyle)Para.CopyPr(this)};Paragraph.prototype.ConcatBefore=function(oPara){this.DeleteCommentOnRemove=
false;oPara.DeleteCommentOnRemove=false;oPara.Remove_ParaEnd();for(var nPos=0,nCount=this.NearPosArray.length;nPos<nCount;++nPos){var oParaNearPos=this.NearPosArray[nPos];oParaNearPos.NearPos.ContentPos.Data[0]+=oPara.Content.length}for(var nPos=0,nCount=oPara.NearPosArray.length;nPos<nCount;++nPos){var oParaNearPos=oPara.NearPosArray[nPos];oParaNearPos.Classes[0]=this;oParaNearPos.NearPos.Paragraph=this;this.NearPosArray.push(oParaNearPos)}for(var nPos=0,nCount=oPara.Content.length;nPos<nCount;++nPos)this.AddToContent(nPos,
oPara.Content[nPos]);oPara.ClearContent();oPara.Set_SectionPr(undefined);this.DeleteCommentOnRemove=true;oPara.DeleteCommentOnRemove=true;oPara.CopyPr(this)};Paragraph.prototype.Continue=function(NewParagraph){var TextPr;if(this.IsEmpty())TextPr=this.TextPr.Value.Copy();else{var EndPos=this.Get_EndPos2(false);var CurPos=this.Get_ParaContentPos(false,false);this.Set_ParaContentPos(EndPos,true,-1,-1);TextPr=this.Get_TextPr(this.Get_ParaContentPos(false,false)).Copy();this.Set_ParaContentPos(CurPos,
false,-1,-1,false);TextPr.HighLight=highlight_None;var oStyles;if(this.bFromDocument&&this.LogicDocument&&(oStyles=this.LogicDocument.GetStyles())&&(TextPr.RStyle===oStyles.GetDefaultFootnoteReference()||TextPr.RStyle===oStyles.GetDefaultEndnoteReference()))TextPr.RStyle=undefined}this.CopyPr(NewParagraph);if(!this.HaveNumbering()&&!this.Lock.Is_Locked()){this.TextPr.Clear_Style();this.TextPr.Apply_TextPr(TextPr)}NewParagraph.Internal_Content_Add(0,new ParaRun(NewParagraph));NewParagraph.Correct_Content();
NewParagraph.MoveCursorToStartPos(false);for(var Pos=0,Count=NewParagraph.Content.length;Pos<Count;Pos++)if(para_Run===NewParagraph.Content[Pos].Type)NewParagraph.Content[Pos].Set_Pr(TextPr.Copy())};Paragraph.prototype.GetSelectionState=function(){var ParaState={};ParaState.CurPos={X:this.CurPos.X,Y:this.CurPos.Y,Line:this.CurPos.Line,ContentPos:this.Get_ParaContentPos(false,false),RealX:this.CurPos.RealX,RealY:this.CurPos.RealY,PagesPos:this.CurPos.PagesPos};ParaState.Selection={Start:this.Selection.Start,
Use:this.Selection.Use,StartPos:0,EndPos:0,Flag:this.Selection.Flag};if(true===this.Selection.Use){ParaState.Selection.StartPos=this.Get_ParaContentPos(true,true);ParaState.Selection.EndPos=this.Get_ParaContentPos(true,false)}return[ParaState]};Paragraph.prototype.SetSelectionState=function(State,StateIndex){if(State.length<=0)return;var ParaState=State[StateIndex];this.CurPos.X=ParaState.CurPos.X;this.CurPos.Y=ParaState.CurPos.Y;this.CurPos.Line=ParaState.CurPos.Line;this.CurPos.RealX=ParaState.CurPos.RealX;
this.CurPos.RealY=ParaState.CurPos.RealY;this.CurPos.PagesPos=ParaState.CurPos.PagesPos;this.Set_ParaContentPos(ParaState.CurPos.ContentPos,true,-1,-1);this.RemoveSelection();this.Selection.Start=ParaState.Selection.Start;this.Selection.Use=ParaState.Selection.Use;this.Selection.Flag=ParaState.Selection.Flag;if(true===this.Selection.Use)this.Set_SelectionContentPos(ParaState.Selection.StartPos,ParaState.Selection.EndPos)};Paragraph.prototype.Get_ParentObject_or_DocumentPos=function(){this.Parent.Update_ContentIndexing();
return this.Parent.Get_ParentObject_or_DocumentPos(this.Index)};Paragraph.prototype.Refresh_RecalcData=function(Data){var Type=Data.Type;var bNeedRecalc=false;var CurPage=0;switch(Type){case AscDFH.historyitem_Paragraph_AddItem:case AscDFH.historyitem_Paragraph_RemoveItem:{for(CurPage=this.Pages.length-1;CurPage>0;CurPage--)if(Data.Pos>this.Lines[this.Pages[CurPage].StartLine].Get_StartPos())break;this.RecalcInfo.Set_Type_0(pararecalc_0_All);bNeedRecalc=true;break}case AscDFH.historyitem_Paragraph_Numbering:case AscDFH.historyitem_Paragraph_PStyle:case AscDFH.historyitem_Paragraph_Pr:case AscDFH.historyitem_Paragraph_PresentationPr_Bullet:case AscDFH.historyitem_Paragraph_PresentationPr_Level:{this.RecalcInfo.Set_Type_0(pararecalc_0_All);
bNeedRecalc=true;this.CompiledPr.NeedRecalc=true;this.Recalc_RunsCompiledPr();break}case AscDFH.historyitem_Paragraph_Align:case AscDFH.historyitem_Paragraph_DefaultTabSize:case AscDFH.historyitem_Paragraph_Ind_First:case AscDFH.historyitem_Paragraph_Ind_Left:case AscDFH.historyitem_Paragraph_Ind_Right:case AscDFH.historyitem_Paragraph_ContextualSpacing:case AscDFH.historyitem_Paragraph_KeepLines:case AscDFH.historyitem_Paragraph_KeepNext:case AscDFH.historyitem_Paragraph_PageBreakBefore:case AscDFH.historyitem_Paragraph_Spacing_Line:case AscDFH.historyitem_Paragraph_Spacing_LineRule:case AscDFH.historyitem_Paragraph_Spacing_Before:case AscDFH.historyitem_Paragraph_Spacing_After:case AscDFH.historyitem_Paragraph_Spacing_AfterAutoSpacing:case AscDFH.historyitem_Paragraph_Spacing_BeforeAutoSpacing:case AscDFH.historyitem_Paragraph_WidowControl:case AscDFH.historyitem_Paragraph_Tabs:case AscDFH.historyitem_Paragraph_Borders_Between:case AscDFH.historyitem_Paragraph_Borders_Bottom:case AscDFH.historyitem_Paragraph_Borders_Left:case AscDFH.historyitem_Paragraph_Borders_Right:case AscDFH.historyitem_Paragraph_Borders_Top:case AscDFH.historyitem_Paragraph_FramePr:{bNeedRecalc=
Paragraph.prototype.Document_CreateFontCharMap=function(FontCharMap){};Paragraph.prototype.Document_Get_AllFontNames=function(AllFonts){this.TextPr.Value.Document_Get_AllFontNames(AllFonts);if(this.Pr.Bullet)this.Pr.Bullet.Get_AllFontNames(AllFonts);if(this.Pr.DefaultRunPr)this.Pr.DefaultRunPr.Document_Get_AllFontNames(AllFonts);var Count=this.Content.length;for(var Index=0;Index<Count;Index++)if(this.Content[Index]&&typeof this.Content[Index].Get_AllFontNames==="function")this.Content[Index].Get_AllFontNames(AllFonts)};
Paragraph.prototype.Document_UpdateRulersState=function(){if(this.CalculatedFrame){var oFrame=this.CalculatedFrame;this.Parent.DrawingDocument.Set_RulerState_Paragraph({L:oFrame.L2,T:oFrame.T2,R:oFrame.L2+oFrame.W2,B:oFrame.T2+oFrame.H2,PageIndex:this.GetStartPageAbsolute(),Frame:this},false)}else if(this.Parent instanceof CDocument)if(this.LogicDocument)this.LogicDocument.Document_UpdateRulersStateBySection()};Paragraph.prototype.Document_UpdateInterfaceState=function(){var StartPos,EndPos;if(true===
this.Selection.Use){StartPos=this.Get_ParaContentPos(true,true);EndPos=this.Get_ParaContentPos(true,false)}else{var CurPos=this.Get_ParaContentPos(false,false);StartPos=CurPos;EndPos=CurPos}if(this.LogicDocument&&true===this.LogicDocument.Spelling.Use&&(selectionflag_Numbering!==this.Selection.Flag&&selectionflag_NumberingCur!==this.Selection.Flag))this.SpellChecker.Document_UpdateInterfaceState(StartPos,EndPos);if(true===this.Selection.Use){var StartPos=this.Selection.StartPos;var EndPos=this.Selection.EndPos;
if(StartPos>EndPos){StartPos=this.Selection.EndPos;EndPos=this.Selection.StartPos}for(var CurPos=StartPos;CurPos<=EndPos;CurPos++){var Element=this.Content[CurPos];if(true!==Element.IsSelectionEmpty()&&Element.Document_UpdateInterfaceState)Element.Document_UpdateInterfaceState()}}else{var CurType=this.Content[this.CurPos.ContentPos].Type;if(this.Content[this.CurPos.ContentPos].Document_UpdateInterfaceState)this.Content[this.CurPos.ContentPos].Document_UpdateInterfaceState()}var arrComplexFields=this.GetCurrentComplexFields();
for(var nIndex=0,nCount=arrComplexFields.length;nIndex<nCount;++nIndex){var oInstruction=arrComplexFields[nIndex].GetInstruction();if(oInstruction&&fieldtype_HYPERLINK===oInstruction.GetType()){var oHyperProps=new Asc.CHyperlinkProperty;oHyperProps.put_ToolTip(oInstruction.GetToolTip());oHyperProps.put_Value(oInstruction.GetValue());oHyperProps.put_Text(this.LogicDocument?this.LogicDocument.GetComplexFieldTextValue(arrComplexFields[nIndex]):null);oHyperProps.put_InternalHyperlink(oInstruction);editor.sync_HyperlinkPropCallback(oHyperProps)}}if(editor&&
this.bFromDocument){if(!this.LogicDocument)return;var TrackManager=this.LogicDocument.GetTrackRevisionsManager();if(this.Pages.length<=0&&this.Lines.length<=0)return;var ContentPos=this.Get_ParaContentPos(this.Selection.Use,true);var ParaPos=this.Get_ParaPosByContentPos(ContentPos);if(this.Pages.length<=ParaPos.Page||this.Lines.length<=ParaPos.Line)return;var Page_abs=this.Get_AbsolutePage(ParaPos.Page);var _Y=this.Pages[ParaPos.Page].Y+this.Lines[ParaPos.Line].Top;var TextTransform=this.Get_ParentTextTransform();
var _X=this.LogicDocument?this.LogicDocument.Get_PageLimits(Page_abs).XLimit:0;var Coords=this.DrawingDocument.ConvertCoordsToCursorWR(_X,_Y,Page_abs,TextTransform);if(false===this.Selection.Use){var Changes=TrackManager.GetElementChanges(this.GetId());if(Changes.length>0)for(var ChangeIndex=0,ChangesCount=Changes.length;ChangeIndex<ChangesCount;ChangeIndex++){var Change=Changes[ChangeIndex];var Type=Change.get_Type();if(c_oAscRevisionsChangeType.TextAdd!==Type&&c_oAscRevisionsChangeType.TextRem!==
Type&&c_oAscRevisionsChangeType.TextPr!==Type||StartPos.Compare(Change.get_StartPos())>=0&&StartPos.Compare(Change.get_EndPos())<=0){Change.put_InternalPos(_X,_Y,Page_abs);TrackManager.AddVisibleChange(Change)}}}}};Paragraph.prototype.PreDelete=function(){for(var Index=0;Index<this.Content.length;Index++){var Item=this.Content[Index];if(Item.PreDelete)Item.PreDelete();if(this.LogicDocument)if(para_Comment===Item.Type&&true===this.LogicDocument.RemoveCommentsOnPreDelete)this.LogicDocument.RemoveComment(Item.CommentId,
true,false);else if(para_Bookmark===Item.Type)this.LogicDocument.GetBookmarksManager().SetNeedUpdate(true)}this.RemoveSelection();this.UpdateDocumentOutline();if(undefined!==this.Get_SectionPr()&&this.LogicDocument)this.Set_SectionPr(undefined)};Paragraph.prototype.Document_SetThisElementCurrent=function(bUpdateStates){this.Parent.Update_ContentIndexing();this.Parent.Set_CurrentElement(this.Index,bUpdateStates)};Paragraph.prototype.Is_ThisElementCurrent=function(){var Parent=this.Parent;Parent.Update_ContentIndexing();
if(docpostype_Content===Parent.GetDocPosType()&&false===Parent.Selection.Use&&this.Index===Parent.CurPos.ContentPos&&Parent.Content[this.Index]===this)return this.Parent.Is_ThisElementCurrent();return false};Paragraph.prototype.Is_Inline=function(){if(this.bFromDocument===false)return true;var PrevElement=this.Get_DocumentPrev();if(true===this.Is_Empty()&&undefined!==this.Get_SectionPr()&&null!==PrevElement&&(type_Paragraph!==PrevElement.Get_Type()||undefined===PrevElement.Get_SectionPr()))return true;
if(undefined===this.Parent||!(this.Parent instanceof CDocument)&&(undefined===this.Parent.Parent||!(this.Parent.Parent instanceof CHeaderFooter)))return true;if(undefined!=this.Pr.FramePr&&Asc.c_oAscYAlign.Inline!==this.Pr.FramePr.YAlign)return false;return true};Paragraph.prototype.IsInline=function(){return this.Is_Inline()};Paragraph.prototype.GetFramePr=function(){return this.Get_CompiledPr2(false).ParaPr.FramePr};Paragraph.prototype.Get_FramePr=function(){return this.GetFramePr()};Paragraph.prototype.Set_FramePr=
function(FramePr,bDelete){var FramePr_old=this.Pr.FramePr;if(undefined===bDelete)bDelete=false;if(true===bDelete){this.Pr.FramePr=undefined;this.private_AddPrChange();History.Add(new CChangesParagraphFramePr(this,FramePr_old,undefined));this.CompiledPr.NeedRecalc=true;this.private_UpdateTrackRevisionOnChangeParaPr(true);return}var FrameParas=this.Internal_Get_FrameParagraphs();if(true===FramePr.FromDropCapMenu&&1===FrameParas.length){var NewFramePr=FramePr_old?FramePr_old.Copy():new CFramePr;if(undefined!=
FramePr.DropCap){var OldLines=NewFramePr.Lines;NewFramePr.Init_Default_DropCap(FramePr.DropCap===Asc.c_oAscDropCap.Drop?true:false);NewFramePr.Lines=OldLines}if(undefined!=FramePr.Lines){var AnchorPara=this.Get_FrameAnchorPara();if(null===AnchorPara||AnchorPara.Lines.length<=0)return;var Before=AnchorPara.Get_CompiledPr().ParaPr.Spacing.Before;var LineH=AnchorPara.Lines[0].Bottom-AnchorPara.Lines[0].Top-Before;var LineTA=AnchorPara.Lines[0].Metrics.TextAscent2;var LineTD=AnchorPara.Lines[0].Metrics.TextDescent+
AnchorPara.Lines[0].Metrics.LineGap;this.Set_Spacing({LineRule:linerule_Exact,Line:FramePr.Lines*LineH},false);this.Update_DropCapByLines(this.Internal_CalculateTextPr(this.Internal_GetStartPos()),FramePr.Lines,LineH,LineTA,LineTD,Before);NewFramePr.Lines=FramePr.Lines}if(undefined!=FramePr.FontFamily){var FF=new ParaTextPr({RFonts:{Ascii:{Name:FramePr.FontFamily.Name,Index:-1}}});this.SelectAll();this.Add(FF);this.RemoveSelection()}if(undefined!=FramePr.HSpace)NewFramePr.HSpace=FramePr.HSpace;this.Pr.FramePr=
NewFramePr}else{var NewFramePr=FramePr_old?FramePr_old.Copy():new CFramePr;if(undefined!=FramePr.H)NewFramePr.H=FramePr.H;if(undefined!=FramePr.HAnchor)NewFramePr.HAnchor=FramePr.HAnchor;if(undefined!=FramePr.HRule)NewFramePr.HRule=FramePr.HRule;if(undefined!=FramePr.HSpace)NewFramePr.HSpace=FramePr.HSpace;if(undefined!=FramePr.Lines)NewFramePr.Lines=FramePr.Lines;if(undefined!=FramePr.VAnchor)NewFramePr.VAnchor=FramePr.VAnchor;if(undefined!=FramePr.VSpace)NewFramePr.VSpace=FramePr.VSpace;NewFramePr.W=
FramePr.W;if(undefined!=FramePr.X){NewFramePr.X=FramePr.X;NewFramePr.XAlign=undefined}if(undefined!=FramePr.XAlign){NewFramePr.XAlign=FramePr.XAlign;NewFramePr.X=undefined}if(undefined!=FramePr.Y){NewFramePr.Y=FramePr.Y;NewFramePr.YAlign=undefined}if(undefined!=FramePr.YAlign){NewFramePr.YAlign=FramePr.YAlign;NewFramePr.Y=undefined}if(undefined!==FramePr.Wrap)if(false===FramePr.Wrap)NewFramePr.Wrap=wrap_NotBeside;else if(true===FramePr.Wrap)NewFramePr.Wrap=wrap_Around;else NewFramePr.Wrap=FramePr.Wrap;
this.Pr.FramePr=NewFramePr}if(undefined!=FramePr.Brd){var Count=FrameParas.length;for(var Index=0;Index<Count;Index++)FrameParas[Index].Set_Borders(FramePr.Brd)}if(undefined!=FramePr.Shd){var Count=FrameParas.length;for(var Index=0;Index<Count;Index++)FrameParas[Index].Set_Shd(FramePr.Shd)}this.private_AddPrChange();History.Add(new CChangesParagraphFramePr(this,FramePr_old,this.Pr.FramePr));this.CompiledPr.NeedRecalc=true;this.private_UpdateTrackRevisionOnChangeParaPr(true)};Paragraph.prototype.Set_FramePr2=
function(FramePr){this.private_AddPrChange();History.Add(new CChangesParagraphFramePr(this,this.Pr.FramePr,FramePr));this.Pr.FramePr=FramePr;this.CompiledPr.NeedRecalc=true;this.private_UpdateTrackRevisionOnChangeParaPr(true)};Paragraph.prototype.Set_FrameParaPr=function(Para){Para.CopyPr(this);Para.Set_Ind({FirstLine:0},false);this.Set_Spacing({After:0},false);this.Set_Ind({Right:0},false);this.RemoveNumPr()};Paragraph.prototype.Get_FrameBounds=function(FrameX,FrameY,FrameW,FrameH){var X0=FrameX,
Y0=FrameY,X1=FrameX+FrameW,Y1=FrameY+FrameH;var Paras=this.Internal_Get_FrameParagraphs();var Count=Paras.length;var FramePr=this.Get_FramePr();if(0>=Count)return{X:X0,Y:Y0,W:X1-X0,H:Y1-Y0};for(var Index=0;Index<Count;Index++){var Para=Paras[Index];var ParaPr=Para.Get_CompiledPr2(false).ParaPr;var Brd=ParaPr.Brd;var _X0=FrameX;if(undefined!==Brd.Left&&border_None!==Brd.Left.Value)_X0-=Brd.Left.Size+Brd.Left.Space+1;if(_X0<X0)X0=_X0;var _X1=FrameX+FrameW;if(undefined!==Brd.Right&&border_None!==Brd.Right.Value){_X1=
Math.max(_X1,_X1-ParaPr.Ind.Right);_X1+=Brd.Right.Size+Brd.Right.Space+1}if(_X1>X1)X1=_X1}var _Y1=Y1;var BottomBorder=Paras[Count-1].Get_CompiledPr2(false).ParaPr.Brd.Bottom;if(undefined!==BottomBorder&&border_None!==BottomBorder.Value)_Y1+=BottomBorder.Size+BottomBorder.Space;if(_Y1>Y1&&(Asc.linerule_Auto===FramePr.HRule||Asc.linerule_AtLeast===FramePr.HRule&&FrameH>=FramePr.H))Y1=_Y1;return{X:X0,Y:Y0,W:X1-X0,H:Y1-Y0}};Paragraph.prototype.SetCalculatedFrame=function(oFrame){this.CalculatedFrame=
oFrame;oFrame.AddParagraph(this)};Paragraph.prototype.GetCalculatedFrame=function(){return this.CalculatedFrame};Paragraph.prototype.Internal_Get_FrameParagraphs=function(){if(this.CalculatedFrame&&this.CalculatedFrame.GetParagraphs().length>0)return this.CalculatedFrame.GetParagraphs();var FrameParas=[];var FramePr=this.Get_FramePr();if(undefined===FramePr)return FrameParas;FrameParas.push(this);var Prev=this.Get_DocumentPrev();while(null!=Prev)if(type_Paragraph===Prev.GetType()){var PrevFramePr=
Prev.Get_FramePr();if(undefined!=PrevFramePr&&true===FramePr.Compare(PrevFramePr)){FrameParas.push(Prev);Prev=Prev.Get_DocumentPrev()}else break}else break;var Next=this.Get_DocumentNext();while(null!=Next)if(type_Paragraph===Next.GetType()){var NextFramePr=Next.Get_FramePr();if(undefined!=NextFramePr&&true===FramePr.Compare(NextFramePr)){FrameParas.push(Next);Next=Next.Get_DocumentNext()}else break}else break;return FrameParas};Paragraph.prototype.Is_LineDropCap=function(){var FrameParas=this.Internal_Get_FrameParagraphs();
if(1!==FrameParas.length||1!==this.Lines.length)return false;return true};Paragraph.prototype.Get_LineDropCapWidth=function(){var W=this.Lines[0].Ranges[0].W;var ParaPr=this.Get_CompiledPr2(false).ParaPr;W+=ParaPr.Ind.Left+ParaPr.Ind.FirstLine;return W};Paragraph.prototype.Change_Frame=function(X,Y,W,H,PageIndex){if(!this.LogicDocument||!this.CalculatedFrame||!this.CalculatedFrame.GetFramePr())return;var FramePr=this.CalculatedFrame.GetFramePr();if(Math.abs(Y-this.CalculatedFrame.T2)<.001&&Math.abs(X-
this.CalculatedFrame.L2)<.001&&Math.abs(W-this.CalculatedFrame.W2)<.001&&Math.abs(H-this.CalculatedFrame.H2)<.001&&PageIndex===this.CalculatedFrame.PageIndex)return;var FrameParas=this.Internal_Get_FrameParagraphs();if(false===this.LogicDocument.Document_Is_SelectionLocked(AscCommon.changestype_None,{Type:AscCommon.changestype_2_ElementsArray_and_Type,Elements:FrameParas,CheckType:AscCommon.changestype_Paragraph_Content})){this.LogicDocument.StartAction(AscDFH.historydescription_Document_ParagraphChangeFrame);
var NewFramePr=FramePr.Copy();if(Math.abs(X-this.CalculatedFrame.L2)>.001){NewFramePr.X=X+(this.CalculatedFrame.L-this.CalculatedFrame.L2);NewFramePr.XAlign=undefined;NewFramePr.HAnchor=Asc.c_oAscHAnchor.Page}if(Math.abs(Y-this.CalculatedFrame.T2)>.001){NewFramePr.Y=Y+(this.CalculatedFrame.T-this.CalculatedFrame.T2);NewFramePr.YAlign=undefined;NewFramePr.VAnchor=Asc.c_oAscVAnchor.Page}if(Math.abs(W-this.CalculatedFrame.W2)>.001)NewFramePr.W=W-Math.abs(this.CalculatedFrame.W2-this.CalculatedFrame.W);
if(Math.abs(H-this.CalculatedFrame.H2)>.001)if(undefined!=FramePr.DropCap&&Asc.c_oAscDropCap.None!=FramePr.DropCap&&1===FrameParas.length){var PageH=this.LogicDocument.Get_PageLimits(PageIndex).YLimit;var _H=Math.min(H,PageH);NewFramePr.Lines=this.Update_DropCapByHeight(_H);NewFramePr.HRule=linerule_Exact;NewFramePr.H=H-Math.abs(this.CalculatedFrame.H2-this.CalculatedFrame.H)}else{if(H<=this.CalculatedFrame.H2)NewFramePr.HRule=linerule_Exact;else NewFramePr.HRule=Asc.linerule_AtLeast;NewFramePr.H=
H}var Count=FrameParas.length;for(var Index=0;Index<Count;Index++){var Para=FrameParas[Index];Para.Set_FramePr(NewFramePr,false)}this.LogicDocument.Recalculate();this.LogicDocument.UpdateInterface();this.LogicDocument.UpdateRulers();this.LogicDocument.UpdateTracks();this.LogicDocument.FinalizeAction()}};Paragraph.prototype.Supplement_FramePr=function(FramePr){if(undefined!=FramePr.DropCap&&Asc.c_oAscDropCap.None!=FramePr.DropCap){var _FramePr=this.Get_FramePr();var FirstFramePara=this;var Prev=FirstFramePara.Get_DocumentPrev();
while(null!=Prev)if(type_Paragraph===Prev.GetType()){var PrevFramePr=Prev.Get_FramePr();if(undefined!=PrevFramePr&&true===_FramePr.Compare(PrevFramePr)){FirstFramePara=Prev;Prev=Prev.Get_DocumentPrev()}else break}else break;var TextPr=FirstFramePara.GetFirstRunPr();if(undefined===TextPr.RFonts||undefined===TextPr.RFonts.Ascii)TextPr=this.Get_CompiledPr2(false).TextPr;FramePr.FontFamily={Name:TextPr.RFonts.Ascii.Name,Index:TextPr.RFonts.Ascii.Index}}var FrameParas=this.Internal_Get_FrameParagraphs();
var Count=FrameParas.length;var ParaPr=FrameParas[0].Get_CompiledPr2(false).ParaPr.Copy();for(var Index=1;Index<Count;Index++){var TempPr=FrameParas[Index].Get_CompiledPr2(false).ParaPr;ParaPr=ParaPr.Compare(TempPr)}FramePr.Brd=ParaPr.Brd;FramePr.Shd=ParaPr.Shd};Paragraph.prototype.CanAddDropCap=function(){for(var nPos=0,nCount=this.Content.length;nPos<nCount;++nPos){var bResult=this.Content[nPos].CanAddDropCap();if(null!==bResult)return bResult}return false};Paragraph.prototype.Get_TextForDropCap=
function(DropCapText,UseContentPos,ContentPos,Depth){var EndPos=true===UseContentPos?ContentPos.Get(Depth):this.Content.length-1;for(var Pos=0;Pos<=EndPos;Pos++){this.Content[Pos].Get_TextForDropCap(DropCapText,true===UseContentPos&&Pos===EndPos?true:false,ContentPos,Depth+1);if(true===DropCapText.Mixed&&(true===DropCapText.Check||DropCapText.Runs.length>0))return}};Paragraph.prototype.Split_DropCap=function(NewParagraph){var DropCapText=new CParagraphGetDropCapText;if(true==this.Selection.Use&&this.Parent.IsSelectedSingleElement()){var SelSP=
this.Get_ParaContentPos(true,true);var SelEP=this.Get_ParaContentPos(true,false);if(0<=SelSP.Compare(SelEP))SelEP=SelSP;DropCapText.Check=true;this.Get_TextForDropCap(DropCapText,true,SelEP,0);DropCapText.Check=false;this.Get_TextForDropCap(DropCapText,true,SelEP,0)}else{DropCapText.Mixed=true;DropCapText.Check=false;this.Get_TextForDropCap(DropCapText,false)}var Count=DropCapText.Text.length;var PrevRun=null;var CurrRun=null;for(var Pos=0,ParaPos=0,RunPos=0;Pos<Count;Pos++){if(PrevRun!==DropCapText.Runs[Pos]){PrevRun=
DropCapText.Runs[Pos];CurrRun=new ParaRun(NewParagraph);CurrRun.Set_Pr(DropCapText.Runs[Pos].Pr.Copy());NewParagraph.Internal_Content_Add(ParaPos++,CurrRun,false);RunPos=0}CurrRun.Add_ToContent(RunPos++,DropCapText.Text[Pos],false)}if(Count>0)return DropCapText.Runs[Count-1].Get_CompiledPr(true);return null};Paragraph.prototype.SelectFirstLetter=function(){var oStartPos=new CParagraphContentPos;var oEndPos=new CParagraphContentPos;for(var nPos=0,nCount=this.Content.length;nPos<nCount;++nPos){oStartPos.Update(nPos,
0);oEndPos.Update(nPos,0);if(this.Content[nPos].GetFirstRunElementPos(para_Text,oStartPos,oEndPos,1)){this.StartSelectionFromCurPos();this.SetSelectionContentPos(oStartPos,oEndPos,false);this.Document_SetThisElementCurrent();return true}}return false};Paragraph.prototype.CheckSelectionForDropCap=function(){var oSelectionStart=this.Get_ParaContentPos(true,true);var oSelectionEnd=this.Get_ParaContentPos(true,false);if(0<=oSelectionStart.Compare(oSelectionEnd))oSelectionEnd=oSelectionStart;var nEndPos=
oSelectionEnd.Get(0);for(var nPos=0;nPos<=nEndPos;++nPos)if(!this.Content[nPos].CheckSelectionForDropCap(nPos===nEndPos,oSelectionEnd,1))return false;return true};Paragraph.prototype.Update_DropCapByLines=function(TextPr,Count,LineH,LineTA,LineTD,Before){if(null===TextPr)return;this.Set_Spacing({Before:Before,After:0,LineRule:linerule_Exact,Line:Count*LineH-.001},false);var FontSize=72;TextPr.FontSize=FontSize;g_oTextMeasurer.SetTextPr(TextPr,this.Get_Theme());g_oTextMeasurer.SetFontSlot(fontslot_ASCII,
1);var TMetrics={Ascent:null,Descent:null};this.private_RecalculateTextMetrics(TMetrics);var TDescent=TMetrics.Descent;var TAscent=TMetrics.Ascent;var THeight=0;if(null===TAscent||null===TDescent)THeight=g_oTextMeasurer.GetHeight();else THeight=-TDescent+TAscent;var EmHeight=THeight;var NewEmHeight=(Count-1)*LineH+LineTA;var Koef=NewEmHeight/EmHeight;var NewFontSize=TextPr.FontSize*Koef;TextPr.FontSize=parseInt(NewFontSize*2)/2;g_oTextMeasurer.SetTextPr(TextPr,this.Get_Theme());g_oTextMeasurer.SetFontSlot(fontslot_ASCII,
1);var TNewMetrics={Ascent:null,Descent:null};this.private_RecalculateTextMetrics(TNewMetrics);var TNewDescent=TNewMetrics.Descent;var TNewAscent=TNewMetrics.Ascent;var TNewHeight=0;if(null===TNewAscent||null===TNewDescent)TNewHeight=g_oTextMeasurer.GetHeight();else TNewHeight=-TNewDescent+TNewAscent;var Descent=g_oTextMeasurer.GetDescender();var Ascent=g_oTextMeasurer.GetAscender();var Dy=Descent*(LineH*Count)/(Ascent-Descent)+TNewHeight-TNewAscent+LineTD;var PTextPr=new ParaTextPr({RFonts:{Ascii:{Name:TextPr.RFonts.Ascii.Name,
Index:-1}},FontSize:TextPr.FontSize,Position:Dy});this.SelectAll();this.Add(PTextPr);this.RemoveSelection()};Paragraph.prototype.Update_DropCapByHeight=function(_Height){var AnchorPara=this.Get_FrameAnchorPara();if(null===AnchorPara||AnchorPara.Lines.length<=0)return 1;var Before=AnchorPara.Get_CompiledPr().ParaPr.Spacing.Before;var LineH=AnchorPara.Lines[0].Bottom-AnchorPara.Lines[0].Top-Before;var LineTA=AnchorPara.Lines[0].Metrics.TextAscent2;var LineTD=AnchorPara.Lines[0].Metrics.TextDescent+
AnchorPara.Lines[0].Metrics.LineGap;var Height=_Height-Before;this.Set_Spacing({LineRule:linerule_Exact,Line:Height},false);var LinesCount=Math.ceil(Height/LineH);var TextPr=this.Internal_CalculateTextPr(this.Internal_GetStartPos());g_oTextMeasurer.SetTextPr(TextPr,this.Get_Theme());g_oTextMeasurer.SetFontSlot(fontslot_ASCII,1);var TMetrics={Ascent:null,Descent:null};this.private_RecalculateTextMetrics(TMetrics);var TDescent=TMetrics.Descent;var TAscent=TMetrics.Ascent;var THeight=0;if(null===TAscent||
null===TDescent)THeight=g_oTextMeasurer.GetHeight();else THeight=-TDescent+TAscent;var Koef=(Height-LineTD)/THeight;var NewFontSize=TextPr.FontSize*Koef;TextPr.FontSize=parseInt(NewFontSize*2)/2;g_oTextMeasurer.SetTextPr(TextPr,this.Get_Theme());g_oTextMeasurer.SetFontSlot(fontslot_ASCII,1);var TNewMetrics={Ascent:null,Descent:null};this.private_RecalculateTextMetrics(TNewMetrics);var TNewDescent=TNewMetrics.Descent;var TNewAscent=TNewMetrics.Ascent;var TNewHeight=0;if(null===TNewAscent||null===TNewDescent)TNewHeight=
g_oTextMeasurer.GetHeight();else TNewHeight=-TNewDescent+TNewAscent;var Descent=g_oTextMeasurer.GetDescender();var Ascent=g_oTextMeasurer.GetAscender();var Dy=Descent*Height/(Ascent-Descent)+TNewHeight-TNewAscent+LineTD;var PTextPr=new ParaTextPr({RFonts:{Ascii:{Name:TextPr.RFonts.Ascii.Name,Index:-1}},FontSize:TextPr.FontSize,Position:Dy});this.SelectAll();this.Add(PTextPr);this.RemoveSelection();return LinesCount};Paragraph.prototype.Get_FrameAnchorPara=function(){var FramePr=this.Get_FramePr();
if(undefined===FramePr)return null;var Next=this.Get_DocumentNext();while(null!=Next){if(type_Paragraph===Next.GetType()){var NextFramePr=Next.Get_FramePr();if(undefined===NextFramePr||false===FramePr.Compare(NextFramePr))return Next}Next=Next.Get_DocumentNext()}return Next};Paragraph.prototype.Split=function(NewParagraph){if(!NewParagraph)NewParagraph=new Paragraph(this.DrawingDocument,this.Parent);NewParagraph.DeleteCommentOnRemove=false;this.DeleteCommentOnRemove=false;this.RemoveSelection();NewParagraph.RemoveSelection();
var ContentPos=this.Get_ParaContentPos(false,false);var CurPos=ContentPos.Get(0);var TextPr=this.Get_TextPr(ContentPos);var oLogicDocument=this.GetLogicDocument();var oStyles=oLogicDocument&&oLogicDocument.GetStyles?oLogicDocument.GetStyles():null;if(oStyles&&(TextPr.RStyle===oStyles.GetDefaultEndnoteReference()||TextPr.RStyle===oStyles.GetDefaultFootnoteReference())){TextPr=TextPr.Copy();TextPr.RStyle=undefined}var NewElement=this.Content[CurPos].Split(ContentPos,1);if(null===NewElement){NewElement=
new ParaRun(NewParagraph);NewElement.Set_Pr(TextPr.Copy())}var NewContent=this.Content.slice(CurPos+1);this.Internal_Content_Remove2(CurPos+1,this.Content.length-CurPos-1);var EndRun=new ParaRun(this);EndRun.Add_ToContent(0,new ParaEnd);this.Internal_Content_Add(this.Content.length,EndRun);NewParagraph.Internal_Content_Remove2(0,NewParagraph.Content.length);NewParagraph.Internal_Content_Concat(NewContent);NewParagraph.Internal_Content_Add(0,NewElement);NewParagraph.Correct_Content();this.CopyPr(NewParagraph);
this.TextPr.Clear_Style();this.TextPr.Apply_TextPr(TextPr);var SectPr=this.Get_SectionPr();if(undefined!==SectPr){this.Set_SectionPr(undefined);NewParagraph.Set_SectionPr(SectPr)}this.MoveCursorToEndPos(false,false);NewParagraph.MoveCursorToStartPos(false);NewParagraph.DeleteCommentOnRemove=true;this.DeleteCommentOnRemove=true;return NewParagraph};Paragraph.prototype.Concat=function(Para,isUseConcatedStyle){this.DeleteCommentOnRemove=false;Para.DeleteCommentOnRemove=false;this.Remove_ParaEnd();var NearPosCount=
Para.NearPosArray.length;for(var Pos=0;Pos<NearPosCount;Pos++){var ParaNearPos=Para.NearPosArray[Pos];ParaNearPos.Classes[0]=this;ParaNearPos.NearPos.Paragraph=this;ParaNearPos.NearPos.ContentPos.Data[0]+=this.Content.length;this.NearPosArray.push(ParaNearPos)}this.Internal_Content_Concat(Para.Content);Para.ClearContent();this.Set_SectionPr(undefined);var SectPr=Para.Get_SectionPr();if(undefined!==SectPr){Para.Set_SectionPr(undefined);this.Set_SectionPr(SectPr)}this.DeleteCommentOnRemove=true;Para.DeleteCommentOnRemove=
true;if(true===isUseConcatedStyle)Para.CopyPr(this)};Paragraph.prototype.ConcatBefore=function(oPara){this.DeleteCommentOnRemove=false;oPara.DeleteCommentOnRemove=false;oPara.Remove_ParaEnd();for(var nPos=0,nCount=this.NearPosArray.length;nPos<nCount;++nPos){var oParaNearPos=this.NearPosArray[nPos];oParaNearPos.NearPos.ContentPos.Data[0]+=oPara.Content.length}for(var nPos=0,nCount=oPara.NearPosArray.length;nPos<nCount;++nPos){var oParaNearPos=oPara.NearPosArray[nPos];oParaNearPos.Classes[0]=this;
oParaNearPos.NearPos.Paragraph=this;this.NearPosArray.push(oParaNearPos)}for(var nPos=0,nCount=oPara.Content.length;nPos<nCount;++nPos)this.AddToContent(nPos,oPara.Content[nPos]);oPara.ClearContent();oPara.Set_SectionPr(undefined);this.DeleteCommentOnRemove=true;oPara.DeleteCommentOnRemove=true;oPara.CopyPr(this)};Paragraph.prototype.Continue=function(NewParagraph){var TextPr;if(this.IsEmpty())TextPr=this.TextPr.Value.Copy();else{var EndPos=this.Get_EndPos2(false);var CurPos=this.Get_ParaContentPos(false,
false);this.Set_ParaContentPos(EndPos,true,-1,-1);TextPr=this.Get_TextPr(this.Get_ParaContentPos(false,false)).Copy();this.Set_ParaContentPos(CurPos,false,-1,-1,false);TextPr.HighLight=highlight_None;var oStyles;if(this.bFromDocument&&this.LogicDocument&&(oStyles=this.LogicDocument.GetStyles())&&(TextPr.RStyle===oStyles.GetDefaultFootnoteReference()||TextPr.RStyle===oStyles.GetDefaultEndnoteReference()))TextPr.RStyle=undefined}this.CopyPr(NewParagraph);if(!this.HaveNumbering()&&!this.Lock.Is_Locked()){this.TextPr.Clear_Style();
this.TextPr.Apply_TextPr(TextPr)}NewParagraph.Internal_Content_Add(0,new ParaRun(NewParagraph));NewParagraph.Correct_Content();NewParagraph.MoveCursorToStartPos(false);for(var Pos=0,Count=NewParagraph.Content.length;Pos<Count;Pos++)if(para_Run===NewParagraph.Content[Pos].Type)NewParagraph.Content[Pos].Set_Pr(TextPr.Copy())};Paragraph.prototype.GetSelectionState=function(){var ParaState={};ParaState.CurPos={X:this.CurPos.X,Y:this.CurPos.Y,Line:this.CurPos.Line,ContentPos:this.Get_ParaContentPos(false,
false),RealX:this.CurPos.RealX,RealY:this.CurPos.RealY,PagesPos:this.CurPos.PagesPos};ParaState.Selection={Start:this.Selection.Start,Use:this.Selection.Use,StartPos:0,EndPos:0,Flag:this.Selection.Flag};if(true===this.Selection.Use){ParaState.Selection.StartPos=this.Get_ParaContentPos(true,true);ParaState.Selection.EndPos=this.Get_ParaContentPos(true,false)}return[ParaState]};Paragraph.prototype.SetSelectionState=function(State,StateIndex){if(State.length<=0)return;var ParaState=State[StateIndex];
this.CurPos.X=ParaState.CurPos.X;this.CurPos.Y=ParaState.CurPos.Y;this.CurPos.Line=ParaState.CurPos.Line;this.CurPos.RealX=ParaState.CurPos.RealX;this.CurPos.RealY=ParaState.CurPos.RealY;this.CurPos.PagesPos=ParaState.CurPos.PagesPos;this.Set_ParaContentPos(ParaState.CurPos.ContentPos,true,-1,-1);this.RemoveSelection();this.Selection.Start=ParaState.Selection.Start;this.Selection.Use=ParaState.Selection.Use;this.Selection.Flag=ParaState.Selection.Flag;if(true===this.Selection.Use)this.Set_SelectionContentPos(ParaState.Selection.StartPos,
ParaState.Selection.EndPos)};Paragraph.prototype.Get_ParentObject_or_DocumentPos=function(){this.Parent.Update_ContentIndexing();return this.Parent.Get_ParentObject_or_DocumentPos(this.Index)};Paragraph.prototype.Refresh_RecalcData=function(Data){var Type=Data.Type;var bNeedRecalc=false;var CurPage=0;switch(Type){case AscDFH.historyitem_Paragraph_AddItem:case AscDFH.historyitem_Paragraph_RemoveItem:{for(CurPage=this.Pages.length-1;CurPage>0;CurPage--)if(Data.Pos>this.Lines[this.Pages[CurPage].StartLine].Get_StartPos())break;
this.RecalcInfo.Set_Type_0(pararecalc_0_All);bNeedRecalc=true;break}case AscDFH.historyitem_Paragraph_Numbering:case AscDFH.historyitem_Paragraph_PStyle:case AscDFH.historyitem_Paragraph_Pr:case AscDFH.historyitem_Paragraph_PresentationPr_Bullet:case AscDFH.historyitem_Paragraph_PresentationPr_Level:{this.RecalcInfo.Set_Type_0(pararecalc_0_All);bNeedRecalc=true;this.CompiledPr.NeedRecalc=true;this.Recalc_RunsCompiledPr();break}case AscDFH.historyitem_Paragraph_Align:case AscDFH.historyitem_Paragraph_DefaultTabSize:case AscDFH.historyitem_Paragraph_Ind_First:case AscDFH.historyitem_Paragraph_Ind_Left:case AscDFH.historyitem_Paragraph_Ind_Right:case AscDFH.historyitem_Paragraph_ContextualSpacing:case AscDFH.historyitem_Paragraph_KeepLines:case AscDFH.historyitem_Paragraph_KeepNext:case AscDFH.historyitem_Paragraph_PageBreakBefore:case AscDFH.historyitem_Paragraph_Spacing_Line:case AscDFH.historyitem_Paragraph_Spacing_LineRule:case AscDFH.historyitem_Paragraph_Spacing_Before:case AscDFH.historyitem_Paragraph_Spacing_After:case AscDFH.historyitem_Paragraph_Spacing_AfterAutoSpacing:case AscDFH.historyitem_Paragraph_Spacing_BeforeAutoSpacing:case AscDFH.historyitem_Paragraph_WidowControl:case AscDFH.historyitem_Paragraph_Tabs:case AscDFH.historyitem_Paragraph_Borders_Between:case AscDFH.historyitem_Paragraph_Borders_Bottom:case AscDFH.historyitem_Paragraph_Borders_Left:case AscDFH.historyitem_Paragraph_Borders_Right:case AscDFH.historyitem_Paragraph_Borders_Top:case AscDFH.historyitem_Paragraph_FramePr:{bNeedRecalc=
true;break}case AscDFH.historyitem_Paragraph_Shd_Value:case AscDFH.historyitem_Paragraph_Shd_Color:case AscDFH.historyitem_Paragraph_Shd_Unifill:case AscDFH.historyitem_Paragraph_Shd:{if(this.Parent){var oDrawingShape=this.Parent.Is_DrawingShape(true);if(oDrawingShape&&oDrawingShape.getObjectType&&oDrawingShape.getObjectType()===AscDFH.historyitem_type_Shape)if(oDrawingShape.chekBodyPrTransform(oDrawingShape.getBodyPr())||oDrawingShape.checkContentWordArt(oDrawingShape.getDocContent()))bNeedRecalc=
true;if(this.Parent.IsTableHeader())bNeedRecalc=true}break}case AscDFH.historyitem_Paragraph_SectionPr:{if(this.Parent instanceof CDocument){this.Parent.UpdateContentIndexing();var nSectionIndex=this.Parent.GetSectionIndexByElementIndex(this.GetIndex());var oFirstElement=this.Parent.GetFirstElementInSection(nSectionIndex);if(oFirstElement)this.Parent.Refresh_RecalcData2(oFirstElement.GetIndex(),oFirstElement.private_GetRelativePageIndex(0))}break}case AscDFH.historyitem_Paragraph_PrChange:{if(Data instanceof
CChangesParagraphPrChange&&Data.IsChangedNumbering())bNeedRecalc=true;break}case AscDFH.historyitem_Paragraph_SuppressLineNumbers:{History.AddLineNumbersToRecalculateData();break}}if(true===bNeedRecalc){var Prev=this.Get_DocumentPrev();if(0===CurPage&&null!=Prev&&type_Paragraph===Prev.GetType()&&true===Prev.Get_CompiledPr2(false).ParaPr.KeepNext)Prev.Refresh_RecalcData2(Prev.Pages.length-1);return this.Refresh_RecalcData2(CurPage)}};Paragraph.prototype.Refresh_RecalcData2=function(CurPage){if(!CurPage)CurPage=

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 91 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 504 KiB

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 378 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 357 KiB

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -0,0 +1 @@
AscCommon.g_defaultThemes = ["Blank","Basic","Classic","Official","Green leaf","Lines","Office","Safari","Dotted","Corner","Turtle"];

@ -778,94 +778,95 @@ nQuotient){sGroup+=arrChinese[nQuotient]+arrChinese[1E3];isPrevZero=false}else i
true;if(nTTRemainder<=0){sResult=sGroup+sResult;if(nRemValue<=0)break;continue}var nQuotient=nTTRemainder/1E3|0;var nRemainder=nTTRemainder-nQuotient*1E3;if(0!==nQuotient){sGroup+=arrChinese[nQuotient]+arrChinese[1E3];isPrevZero=false}else if(nTTQuotient>0){sGroup+=arrChinese[0];isPrevZero=true}if(nRemainder<=0){sResult=sGroup+sResult;if(nRemValue<=0)break;continue}nQuotient=nRemainder/100|0;nRemainder=nRemainder-nQuotient*100;if(0!==nQuotient){sGroup+=arrChinese[nQuotient]+arrChinese[100];isPrevZero=
false}else if(!isPrevZero){sGroup+=arrChinese[0];isPrevZero=true}if(nRemainder<=0){sResult=sGroup+sResult;if(nRemValue<=0)break;continue}nQuotient=nRemainder/10|0;nRemainder=nRemainder-nQuotient*10;if(0!==nQuotient){sGroup+=arrChinese[nQuotient]+arrChinese[10];isPrevZero=false}else if(!isPrevZero){sGroup+=arrChinese[0];isPrevZero=true}if(0!==nRemainder)sGroup+=arrChinese[nRemainder];sResult=sGroup+sResult;if(nRemValue<=0)break}break}}return sResult}var c_oAscSpaces=[];c_oAscSpaces[10]=1;c_oAscSpaces[32]=
1;c_oAscSpaces[8194]=1;c_oAscSpaces[8195]=1;c_oAscSpaces[8197]=1;c_oAscSpaces[12288]=1;function IsSpace(nUnicode){return!!c_oAscSpaces[nUnicode]}function private_IsAbbreviation(sWord){if(sWord.toUpperCase()===sWord){for(var nPos=0,nLen=sWord.length;nPos<nLen;++nPos){var nCharCode=sWord.charCodeAt(nPos);if(44032<=nCharCode&&nCharCode<=55203||4352<=nCharCode&&nCharCode<=4607||12592<=nCharCode&&nCharCode<=12687||43360<=nCharCode&&nCharCode<=43391||55216<=nCharCode&&nCharCode<=55295||19968<=nCharCode&&
nCharCode<=40959||13312<=nCharCode&&nCharCode<=19903||131072<=nCharCode&&nCharCode<=173791||173824<=nCharCode&&nCharCode<=177983||177984<=nCharCode&&nCharCode<=178207||178208<=nCharCode&&nCharCode<=183983||63744<=nCharCode&&nCharCode<=64255||194560<=nCharCode&&nCharCode<=195103)return false}return true}return false}var g_oUserColorById={},g_oUserNextColorIndex=0;function getUserColorById(userId,userName,isDark,isNumericValue){if((!userId||""===userId)&&(!userName||""===userName))return new CColor(0,
0,0,255);var res;if(g_oUserColorById.hasOwnProperty(userId))res=g_oUserColorById[userId];else if(g_oUserColorById.hasOwnProperty(userName))res=g_oUserColorById[userName];else{var nColor=Asc.c_oAscArrUserColors[g_oUserNextColorIndex%Asc.c_oAscArrUserColors.length];++g_oUserNextColorIndex;res=g_oUserColorById[userId||userName]=new CUserCacheColor(nColor)}if(!res)return new CColor(0,0,0,255);var oColor=true===isDark?res.Dark:res.Light;return true===isNumericValue?oColor.r<<16&16711680|oColor.g<<8&65280|
oColor.b&255:oColor}function isNullOrEmptyString(str){return str==undefined||str==null||str==""}function unleakString(s){return(" "+s).substr(1)}function readValAttr(attr){if(attr()){var val=attr()["val"];return val?val:null}return null}function getNumFromXml(val){return val?val-0:null}function getColorFromXml(attr){if(attr()){var vals=attr();if(null!=vals["theme"])return AscCommonExcel.g_oColorManager.getThemeColor(getNumFromXml(vals["theme"]),getNumFromXml(vals["tint"]));else if(null!=vals["rgb"])return new AscCommonExcel.RgbColor(16777215&
getNumFromXml(vals["rgb"]))}return null}function getBoolFromXml(val){return"0"!==val&&"false"!==val&&"off"!==val}function CUserCacheColor(nColor){this.Light=null;this.Dark=null;this.init(nColor)}CUserCacheColor.prototype.init=function(nColor){var r=nColor>>16&255;var g=nColor>>8&255;var b=nColor&255;var Y=Math.max(0,Math.min(255,.299*r+.587*g+.114*b));var Cb=Math.max(0,Math.min(255,128-.168736*r-.331264*g+.5*b));var Cr=Math.max(0,Math.min(255,128+.5*r-.418688*g-.081312*b));if(Y>63)Y=63;var R=Math.max(0,
Math.min(255,Y+1.402*(Cr-128)))|0;var G=Math.max(0,Math.min(255,Y-.34414*(Cb-128)-.71414*(Cr-128)))|0;var B=Math.max(0,Math.min(255,Y+1.772*(Cb-128)))|0;this.Light=new CColor(r,g,b,255);this.Dark=new CColor(R,G,B,255)};function loadScript(url,onSuccess,onError){if(window["NATIVE_EDITOR_ENJINE"]===true||window["Native"]!==undefined){onSuccess();return}if(window["AscDesktopEditor"]&&window["local_load_add"]){var _context={"completeLoad":function(){return onSuccess()}};window["local_load_add"](_context,
"sdk-all-from-min",url);var _ret_param=window["AscDesktopEditor"]["LoadJS"](url);if(2!=_ret_param)window["local_load_remove"](url);if(_ret_param==1){setTimeout(onSuccess,1);return}else if(_ret_param==2)return}var backoff=new AscCommon.Backoff(AscCommon.g_oBackoffDefaults);loadScriptWithBackoff(backoff,url,onSuccess,onError)}function loadScriptWithBackoff(backoff,url,onSuccess,onError){var script=document.createElement("script");script.type="text/javascript";script.src=url;script.onload=onSuccess;
script.onerror=function(){backoff.attempt(onError,function(){loadScriptWithBackoff(backoff,url,onSuccess,onError)})};document.head.appendChild(script)}function loadSdk(sdkName,onSuccess,onError){if(window["AscNotLoadAllScript"])onSuccess();else{var urlArgs=window.parent&&window.parent.APP&&window.parent.APP.urlArgs||"";loadScript("./../../../../sdkjs/"+sdkName+"/sdk-all.js?"+urlArgs,onSuccess,onError)}}function getAltGr(e){var ctrlKey=e.metaKey||e.ctrlKey;var altKey=e.altKey;return altKey&&(AscBrowser.isMacOs?
!ctrlKey:ctrlKey)}function getColorSchemeByName(sName){for(var i=0;i<AscCommon.g_oUserColorScheme.length;++i){var tmp=AscCommon.g_oUserColorScheme[i];if(tmp&&tmp.name===sName)return getColorSchemeByIdx(i)}return null}function getColorSchemeByIdx(idx){var tmp=AscCommon.g_oUserColorScheme[idx];if(tmp){var scheme=new AscFormat.ClrScheme,_c;scheme.name=tmp.name;_c=tmp.get_dk1();scheme.colors[8]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_lt1();scheme.colors[12]=AscFormat.CreateUniColorRGB(_c.r,
_c.g,_c.b);_c=tmp.get_dk2();scheme.colors[9]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_lt2();scheme.colors[13]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_accent1();scheme.colors[0]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_accent2();scheme.colors[1]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_accent3();scheme.colors[2]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_accent4();scheme.colors[3]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_accent5();
scheme.colors[4]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_accent6();scheme.colors[5]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_hlink();scheme.colors[11]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_folHlink();scheme.colors[10]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);return scheme}return null}function getAscColorScheme(_scheme,theme){var elem,_c;var _rgba={R:0,G:0,B:0,A:255};elem=new AscCommon.CAscColorScheme;elem.scheme=_scheme;elem.name=_scheme.name;_scheme.colors[8].Calculate(theme,
null,null,null,_rgba);_c=_scheme.colors[8].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[12].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[12].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[9].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[9].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[13].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[13].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));
_scheme.colors[0].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[0].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[1].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[1].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[2].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[2].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[3].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[3].RGBA;elem.putColor(new AscCommon.CColor(_c.R,
_c.G,_c.B));_scheme.colors[4].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[4].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[5].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[5].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[11].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[11].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[10].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[10].RGBA;elem.putColor(new AscCommon.CColor(_c.R,
_c.G,_c.B));return elem}function getIndexColorSchemeInArray(result,asc_color_scheme){for(var j=0;j<result.length;++j)if(result[j].isEqual(asc_color_scheme))return j;return-1}function checkAddColorScheme(result,asc_color_scheme,nStartIndex){var nIndex=getIndexColorSchemeInArray(result,asc_color_scheme);if(nIndex>-1)return nIndex;var nStartIndex_=nStartIndex;if(nStartIndex===null)nStartIndex_=result.length;result.splice(nStartIndex_,0,asc_color_scheme);return nStartIndex_}function isEastAsianScript(value){return 12544<=
value&&value<=12591||12704<=value&&value<=12735||19968<=value&&value<=40938||13312<=value&&value<=19893||131072<=value&&value<=173782||173824<=value&&value<=177972||177984<=value&&value<=178205||178208<=value&&value<=183969||183984<=value&&value<=191456||63744<=value&&value<=64255||194560<=value&&value<=195103||12032<=value&&value<=12255||11904<=value&&value<=12031||12736<=value&&value<=12783||12272<=value&&value<=12287||4352<=value&&value<=4607||43360<=value&&value<=43391||55216<=value&&value<=55295||
12592<=value&&value<=12687||65280<=value&&value<=65519||44032<=value&&value<=55215||12352<=value&&value<=12447||110848<=value&&value<=110895||110592<=value&&value<=110847||12688<=value&&value<=12703||12448<=value&&value<=12543||12784<=value&&value<=12799||42192<=value&&value<=42239||93952<=value&&value<=94111||110960<=value&&value<=111359||94208<=value&&value<=100332||100352<=value&&value<=101119||40960<=value&&value<=42127||42128<=value&&value<=42191}var g_oIdCounter=new CIdCounter;window.Asc.g_signature_drawer=
null;function CSignatureDrawer(id,api,w,h){window.Asc.g_signature_drawer=this;this.Api=api;this.CanvasParent=document.getElementById(id);this.Canvas=document.createElement("canvas");this.Canvas.style.position="absolute";this.Canvas.style.left="0px";this.Canvas.style.top="0px";var _width=parseInt(this.CanvasParent.offsetWidth);var _height=parseInt(this.CanvasParent.offsetHeight);if(0==_width)_width=300;if(0==_height)_height=80;this.Canvas.width=_width;this.Canvas.height=_height;this.CanvasParent.appendChild(this.Canvas);
this.Image="";this.ImageHtml=null;this.Text="";this.Font="Arial";this.Size=10;this.Italic=true;this.Bold=false;this.Width=w;this.Height=h;this.CanvasReturn=null;this.IsAsync=false}CSignatureDrawer.prototype.getCanvas=function(){return this.CanvasReturn==null?this.Canvas:this.CanvasReturn};CSignatureDrawer.prototype.getImages=function(){if(!this.isValid())return["",""];this.CanvasReturn=document.createElement("canvas");this.CanvasReturn.width=this.Width*AscCommon.g_dKoef_mm_to_pix;this.CanvasReturn.height=
this.Height*AscCommon.g_dKoef_mm_to_pix;if(this.Text!="")this.drawText();else this.drawImage();var _ret=[];_ret.push(this.CanvasReturn.toDataURL("image/png"));var _ctx=this.CanvasReturn.getContext("2d");_ctx.strokeStyle="#FF0000";_ctx.lineWidth=2;_ctx.moveTo(0,0);_ctx.lineTo(this.CanvasReturn.width,this.CanvasReturn.height);_ctx.moveTo(0,this.CanvasReturn.height);_ctx.lineTo(this.CanvasReturn.width,0);_ctx.stroke();_ret.push(this.CanvasReturn.toDataURL("image/png"));this.CanvasReturn=null;return _ret};
CSignatureDrawer.prototype.setText=function(text,font,size,isItalic,isBold){if(this.IsAsync){this.Text=text;return}this.Image="";this.ImageHtml=null;this.Text=text;this.Font=font;this.Size=size;this.Italic=isItalic;this.Bold=isBold;this.IsAsync=true;AscFonts.FontPickerByCharacter.checkText(this.Text,this,function(){this.IsAsync=false;var loader=AscCommon.g_font_loader;var fontinfo=AscFonts.g_fontApplication.GetFontInfo(font);var isasync=loader.LoadFont(fontinfo,function(){window.Asc.g_signature_drawer.Api.sync_EndAction(Asc.c_oAscAsyncActionType.Information,
Asc.c_oAscAsyncAction.LoadFont);window.Asc.g_signature_drawer.drawText()});if(false===isasync)this.drawText()})};CSignatureDrawer.prototype.drawText=function(){var _oldTurn=this.Api.isViewMode;var _oldMarks=this.Api.ShowParaMarks;this.Api.isViewMode=true;this.Api.ShowParaMarks=false;AscFormat.ExecuteNoHistory(AscCommon.DrawTextByCenter,this,[]);this.Api.isViewMode=_oldTurn;this.Api.ShowParaMarks=_oldMarks};CSignatureDrawer.prototype.drawImage=function(){var _canvas=this.getCanvas();var w=_canvas.width;
var h=_canvas.height;var _ctx=_canvas.getContext("2d");_ctx.clearRect(0,0,w,h);var im_w=this.ImageHtml.width;var im_h=this.ImageHtml.height;var _x=0;var _y=0;var _w=0;var _h=0;var koef1=w/h;var koef2=im_w/im_h;if(koef1>koef2){_h=h;_w=koef2*_h>>0;_y=0;_x=w-_w>>1}else{_w=w;_h=_w/koef2>>0;_x=0;_y=h-_h>>1}_ctx.drawImage(this.ImageHtml,_x,_y,_w,_h)};CSignatureDrawer.prototype.selectImage=CSignatureDrawer.prototype["selectImage"]=function(){this.Text="";window["AscDesktopEditor"]["OpenFilenameDialog"]("images",
false,function(_file){var file=_file;if(Array.isArray(file))file=file[0];if(!file)return;var _drawer=window.Asc.g_signature_drawer;_drawer.Image=window["AscDesktopEditor"]["GetImageBase64"](file);_drawer.ImageHtml=new Image;_drawer.ImageHtml.onload=function(){window.Asc.g_signature_drawer.drawImage()};_drawer.ImageHtml.src=_drawer.Image;_drawer=null})};CSignatureDrawer.prototype.isValid=function(){return this.Image!=""||this.Text!=""};CSignatureDrawer.prototype.destroy=function(){window.Asc.g_signature_drawer.CanvasParent.removeChild(this.Canvas);
delete window.Asc.g_signature_drawer};function CSignatureImage(){this.ImageValidBase64="";this.ImageInvalidBase64="";this.ImageValid=null;this.ImageInvalid=null;this.Valid=false;this.Loading=0;this.Remove=function(){this.ImageValidBase64="";this.ImageInvalidBase64="";this.ImageValid=null;this.ImageInvalid=null;this.Valid=false;this.Loading=0};this.Register=function(_api,_guid){if(_api.ImageLoader.map_image_index[_guid])return;var _obj={Image:this.Valid?this.ImageValid:this.ImageInvalid,Status:AscFonts.ImageLoadStatus.Complete,
src:_guid};_api.ImageLoader.map_image_index[_guid]=_obj};this.Unregister=function(_api,_guid){if(_api.ImageLoader.map_image_index[_guid])delete _api.ImageLoader.map_image_index[_guid]}}function CShortcuts(){this.List={};this.CustomCounter=0;this.CustomActions={}}CShortcuts.prototype.Add=function(nType,nCode,isCtrl,isShift,isAlt){this.List[this.private_GetIndex(nCode,isCtrl,isShift,isAlt)]=nType};CShortcuts.prototype.Get=function(nCode,isCtrl,isShift,isAlt){var nType=this.List[this.private_GetIndex(nCode,
isCtrl,isShift,isAlt)];return undefined!==nType?nType:0};CShortcuts.prototype.private_GetIndex=function(nCode,isCtrl,isShift,isAlt){return nCode<<8|(isCtrl?4:0)|(isShift?2:0)|(isAlt?1:0)};CShortcuts.prototype.CheckType=function(nType){for(var nIndex in this.List)if(this.List[nIndex]===nType)return{KeyCode:nIndex>>>8,CtrlKey:!!(nIndex&4),ShiftKey:!!(nIndex&2),AltKey:!!(nIndex&1)};return null};CShortcuts.prototype.Remove=function(nCode,isCtrl,isShift,isAlt){delete this.List[this.private_GetIndex(nCode,
isCtrl,isShift,isAlt)]};CShortcuts.prototype.RemoveByType=function(nType){for(var nIndex in this.List)if(this.List[nIndex]===nType)delete this.List[nIndex]};CShortcuts.prototype.GetNewCustomType=function(){return 16711680|this.CustomCounter++};CShortcuts.prototype.IsCustomType=function(nType){return nType>=16711680};CShortcuts.prototype.GetCustomAction=function(nType){return this.CustomActions[nType]};CShortcuts.prototype.AddCustomActionSymbol=function(nCharCode,sFont){var nType=this.GetNewCustomType();
this.CustomActions[nType]=new CCustomShortcutActionSymbol(nCharCode,sFont);return nType};function CCustomShortcutActionSymbol(nCharCode,sFont){this.CharCode=nCharCode;this.Font=sFont}CCustomShortcutActionSymbol.prototype.Type=AscCommon.c_oAscCustomShortcutType.Symbol;AscCommon.EncryptionMessageType={Encrypt:0,Decrypt:1};function CEncryptionData(){this._init=false;this.arrData=[];this.arrImages=[];this.handleChangesCallback=null;this.isChangesHandled=false;this.cryptoMode=0;this.isChartEditor=false;
this.isExistDecryptedChanges=false;this.cryptoPrefix=window["AscDesktopEditor"]&&window["AscDesktopEditor"]["GetEncryptedHeader"]?window["AscDesktopEditor"]["GetEncryptedHeader"]():"ENCRYPTED;";this.cryptoPrefixLen=this.cryptoPrefix.length;this.editorId=null;this.nextChangesTimeoutId=-1;this.isPasswordCryptoPresent=false;this.init=function(){this._init=true};this.isInit=function(){return this._init};this.isNeedCrypt=function(){if(window.g_asc_plugins)if(!window.g_asc_plugins.isRunnedEncryption())return false;
if(!window["AscDesktopEditor"])return false;if(this.isChartEditor)return false;if(2==this.cryptoMode)return true;if(0===window["AscDesktopEditor"]["CryptoMode"])return false;return true};this.isCryptoImages=function(){return this.isNeedCrypt()&&this.isPasswordCryptoPresent};this.addCryproImagesFromDialog=function(callback){var _this=this;window["AscDesktopEditor"]["OpenFilenameDialog"]("images",true,function(files){if(!files)return;if(!Array.isArray(files))files=[files];if(0===files.length)return;
var _files=[];var _options={isImageCrypt:true,callback:callback,ext:[]};for(var i=0;i<files.length;i++){_files.push(window["AscDesktopEditor"]["GetImageBase64"](files[i],true));_options.ext.push(AscCommon.GetFileExtension(files[i]))}_this.sendChanges(this,_files,AscCommon.EncryptionMessageType.Encrypt,_options)})};this.addCryproImagesFromUrls=function(urls,callback){var _editor=window["Asc"]["editor"]?window["Asc"]["editor"]:window.editor;_editor.sync_StartAction(Asc.c_oAscAsyncActionType.BlockInteraction,
Asc.c_oAscAsyncAction.LoadImage);var _this=this;window["AscDesktopEditor"]["DownloadFiles"](urls,[],function(files){_editor.sync_EndAction(Asc.c_oAscAsyncActionType.BlockInteraction,Asc.c_oAscAsyncAction.LoadImage);_editor.sync_StartAction(Asc.c_oAscAsyncActionType.BlockInteraction,Asc.c_oAscAsyncAction.UploadImage);var _files=[];var _options={isImageCrypt:true,isUrls:true,callback:callback,ext:[],api:_editor};for(var elem in files){_files.push(window["AscDesktopEditor"]["GetImageBase64"](files[elem],
true));_options.ext.push(window["AscDesktopEditor"]["GetImageFormat"](files[elem]));window["AscDesktopEditor"]["RemoveFile"](files[elem])}_this.sendChanges(this,_files,AscCommon.EncryptionMessageType.Encrypt,_options)})};this.onDecodeError=function(){var _editor=window["Asc"]["editor"]?window["Asc"]["editor"]:window.editor;_editor.sendEvent("asc_onError",Asc.c_oAscError.ID.DataEncrypted,Asc.c_oAscError.Level.Critical)};this.checkEditorId=function(){if(null==this.editorId){var _editor=window["Asc"]["editor"]?
window["Asc"]["editor"]:window.editor;this.editorId=_editor.editorId}};this.decryptImage=function(src,img,data){this.sendChanges(this,[data],AscCommon.EncryptionMessageType.Decrypt,{isImageDecrypt:true,src:src,img:img})};this.nextChanges=function(){this.nextChangesTimeoutId=setTimeout(function(){AscCommon.EncryptionWorker.sendChanges(undefined,undefined);this.nextChangesTimeoutId=-1},10)};this.sendChanges=function(sender,data,type,options){if(!this.isNeedCrypt()){if(AscCommon.EncryptionMessageType.Encrypt==
type)sender._send(data,true);else if(AscCommon.EncryptionMessageType.Decrypt==type){if(this.isExistEncryptedChanges(data["changes"])){this.onDecodeError();return}sender._onSaveChanges(data,true)}return}if(undefined!==type)this.arrData.push({sender:sender,type:type,data:data,options:options});if(this.arrData.length==0)return;if(undefined!==type&&(1!=this.arrData.length||!this.isChangesHandled))return;if(undefined!==type&&-1!=this.nextChangesTimeoutId){clearTimeout(this.nextChangesTimeoutId);this.nextChangesTimeoutId=
-1}if(AscCommon.EncryptionMessageType.Encrypt==this.arrData[0].type)if(this.arrData[0].options&&this.arrData[0].options.isImageCrypt)window.g_asc_plugins.sendToEncryption({"type":"encryptData","data":this.arrData[0].data});else window.g_asc_plugins.sendToEncryption({"type":"encryptData","data":JSON.parse(this.arrData[0].data["changes"])});else if(AscCommon.EncryptionMessageType.Decrypt==this.arrData[0].type)if(this.arrData[0].options&&this.arrData[0].options.isImageDecrypt)window.g_asc_plugins.sendToEncryption({"type":"decryptData",
"data":this.arrData[0].data});else window.g_asc_plugins.sendToEncryption({"type":"decryptData","data":this.arrData[0].data["changes"]})};this.receiveChanges=function(obj){var data=obj["data"];var check=obj["check"];if(!check){this.onDecodeError();return}if(this.handleChangesCallback){this.isExistDecryptedChanges=true;this.checkEditorId();if(this.editorId==AscCommon.c_oEditorId.Spreadsheet)for(var i=data.length-1;i>=0;i--)this.handleChangesCallback.changesBase[i]=data[i];else for(var i=data.length-
1;i>=0;i--)this.handleChangesCallback.changesBase[i].m_pData=data[i];this.isChangesHandled=true;this.handleChangesCallback.callback.call(this.handleChangesCallback.sender);this.handleChangesCallback=null;this.nextChanges();return}var obj=this.arrData[0];this.arrData.splice(0,1);if(AscCommon.EncryptionMessageType.Encrypt==obj.type)if(obj.options&&obj.options.isImageCrypt){for(var i=0;i<data.length;i++)if(this.cryptoPrefix==data[i].substr(0,this.cryptoPrefixLen))data[i]=this.cryptoPrefix+obj.options.ext[i]+
";"+data[i].substr(this.cryptoPrefixLen);if(!obj.options.isUrls)obj.options.callback(Asc.c_oAscError.ID.No,data);else AscCommon.UploadImageUrls(data,obj.options.api.documentId,obj.options.api.documentUserId,obj.options.api.CoAuthoringApi.get_jwt(),function(urls){obj.options.api.sync_EndAction(Asc.c_oAscAsyncActionType.BlockInteraction,Asc.c_oAscAsyncAction.UploadImage);obj.options.callback(urls)})}else{obj.data["changes"]=JSON.stringify(data);obj.sender._send(obj.data,true)}else if(AscCommon.EncryptionMessageType.Decrypt==
obj.type)if(obj.options&&obj.options.isImageDecrypt){window["AscDesktopEditor"]["ResaveFile"](obj.options.src,data[0]);obj.options.img["onload_crypto"](obj.options.src)}else{this.isExistDecryptedChanges=true;obj.data["changes"]=data;obj.sender._onSaveChanges(obj.data,true)}this.nextChanges()};this.isExistEncryptedChanges=function(_array){if(0==_array.length)return false;this.checkEditorId();var isChangesMode=_array[0]["change"]?true:false;var _prefix="";var _checkPrefixLen=this.cryptoPrefixLen+1;
if(isChangesMode){for(var i=_array.length-1;i>=0;i--)if(_array[i]["change"].length>_checkPrefixLen){_prefix=_array[i]["change"].substr(0,_checkPrefixLen);if(-1!=_prefix.indexOf(this.cryptoPrefix)){isCrypted=true;break}}return isCrypted}var isCrypted=false;if(this.editorId==AscCommon.c_oEditorId.Spreadsheet)for(var i=_array.length-1;i>=0;i--){if(_array[i].length>_checkPrefixLen){_prefix=_array[i].substr(0,_checkPrefixLen);if(-1!=_prefix.indexOf(this.cryptoPrefix)){isCrypted=true;break}}}else for(var i=
_array.length-1;i>=0;i--)if(_array[i].m_pData.length>_checkPrefixLen){_prefix=_array[i].m_pData.substr(0,_checkPrefixLen);if(-1!=_prefix.indexOf(this.cryptoPrefix)){isCrypted=true;break}}return isCrypted};this.handleChanges=function(_array,_sender,_callback){if(0==_array.length||!this.isNeedCrypt()){if(this.isExistEncryptedChanges(_array)){this.onDecodeError();return}this.isChangesHandled=true;_callback.call(_sender);return}this.handleChangesCallback={changesBase:_array,changes:[],sender:_sender,
callback:_callback};this.checkEditorId();if(this.editorId==AscCommon.c_oEditorId.Spreadsheet)for(var i=_array.length-1;i>=0;i--)this.handleChangesCallback.changes[i]=_array[i];else for(var i=_array.length-1;i>=0;i--)this.handleChangesCallback.changes[i]=_array[i].m_pData;window.g_asc_plugins.sendToEncryption({"type":"decryptData","data":this.handleChangesCallback.changes})};this.asc_setAdvancedOptions=function(api,idOption,option){if(window.isNativeOpenPassword){window["AscDesktopEditor"]["NativeViewerOpen"](option.asc_getPassword());
return}if(window.isCloudCryptoDownloadAs)return false;if(!this.isNeedCrypt())return false;window.checkPasswordFromPlugin=true;if(window["Asc"].c_oAscAdvancedOptionsID.TXT===idOption){var _param="<m_nCsvTxtEncoding>"+option.asc_getCodePage()+"</m_nCsvTxtEncoding>";window["AscDesktopEditor"]["SetAdvancedOptions"](_param)}else if(window["Asc"].c_oAscAdvancedOptionsID.CSV===idOption){var delimiter=option.asc_getDelimiter();var delimiterChar=option.asc_getDelimiterChar();var _param="";_param+="<m_nCsvTxtEncoding>"+
option.asc_getCodePage()+"</m_nCsvTxtEncoding>";if(null!=delimiter)_param+="<m_nCsvDelimiter>"+delimiter+"</m_nCsvDelimiter>";if(null!=delimiterChar)_param+="<m_nCsvDelimiterChar>"+delimiterChar+"</m_nCsvDelimiterChar>";window["AscDesktopEditor"]["SetAdvancedOptions"](_param)}else if(window["Asc"].c_oAscAdvancedOptionsID.DRM===idOption){var _param="<m_sPassword>"+AscCommon.CopyPasteCorrectString(option.asc_getPassword())+"</m_sPassword>";api.currentPassword=option.asc_getPassword();window["AscDesktopEditor"]["SetAdvancedOptions"](_param)}return true}}
AscCommon.EncryptionWorker=new CEncryptionData;function CMouseSmoothWheelCorrector(t,scrollFunction){this._deltaX=0;this._deltaY=0;this._isBreakX=false;this._isBreakY=false;this._timeoutCorrector=-1;this._api=t;this._scrollFunction=scrollFunction;this._normalDelta=120;this._isNormalDeltaActive=false;this.setNormalDeltaActive=function(value){this._isNormalDeltaActive=true;this._normalDelta=value};this.isBreakX=function(){return this._isBreakX};this.isBreakY=function(){return this._isBreakY};this.get_DeltaX=
function(wheelDeltaX){this._isBreakX=false;if(!AscCommon.AscBrowser.isMacOs)return wheelDeltaX;this._deltaX+=wheelDeltaX;if(Math.abs(this._deltaX)>=this._normalDelta)return this._isNormalDeltaActive?this._deltaX>0?this._normalDelta:-this._normalDelta:this._deltaX;this._isBreakX=true;return 0};this.get_DeltaY=function(wheelDeltaY){this._isBreakY=false;if(!AscCommon.AscBrowser.isMacOs)return wheelDeltaY;this._deltaY+=wheelDeltaY;if(Math.abs(this._deltaY)>=this._normalDelta)return this._isNormalDeltaActive?
this._deltaY>0?this._normalDelta:-this._normalDelta:this._deltaY;this._isBreakY=true;return 0};this.checkBreak=function(){if(-1!=this._timeoutCorrector){clearTimeout(this._timeoutCorrector);this._timeoutCorrector=-1}if((this._isBreakX||this._isBreakY)&&this._scrollFunction){var obj={t:this,x:this._isBreakX?this._deltaX:0,y:this._isBreakY?this._deltaY:0};this._timeoutCorrector=setTimeout(function(){var t=obj.t;t._scrollFunction.call(t._api,obj.x,obj.y);t._timeoutCorrector=-1;t._deltaX=0;t._deltaY=
0},100)}if(!this._isBreakX)this._deltaX=0;if(!this._isBreakY)this._deltaY=0;this._isBreakX=false;this._isBreakY=false}}AscCommon.CMouseSmoothWheelCorrector=CMouseSmoothWheelCorrector;function CTranslateManager(){this.mapTranslate={}}CTranslateManager.prototype.init=function(map){this.mapTranslate=map||{}};CTranslateManager.prototype.getValue=function(key){return this.mapTranslate.hasOwnProperty(key)?this.mapTranslate[key]:key};function CPolygonPoint2(X,Y){this.X=X;this.Y=Y}function CPolygonVectors(){this.Page=
-1;this.VX=[];this.VY=[]}function CPolygonPath(precision){this.Page=-1;this.Direction=1;this.precision=precision;this.Points=[]}CPolygonPath.prototype.PushPoint=function(x,y){this.Points.push(new CPolygonPoint2(x/this.precision,y/this.precision))};CPolygonPath.prototype.CorrectExtremePoints=function(){var Lng=this.Points.length;this.Points[0].X=this.Points[Lng-1].X;this.Points[Lng-1].Y=this.Points[0].Y};function CPolygon(){this.Vectors=[];this.precision=1E3}CPolygon.prototype.fill=function(arrBounds){this.Vectors.length=
0;if(arrBounds.length<=0)return;var nStartLineIndex=0,nStartIndex=0,CountLines=arrBounds.length,CountBounds;while(nStartLineIndex<arrBounds.length){CountBounds=arrBounds[nStartLineIndex].length;while(nStartIndex<CountBounds)if(arrBounds[nStartLineIndex][nStartIndex].W<.001)nStartIndex++;else break;if(nStartIndex<CountBounds)break;nStartLineIndex++;nStartIndex=0}if(nStartLineIndex>=arrBounds.length)return;var CurrentPage=arrBounds[nStartLineIndex][nStartIndex].Page,CurrentVectors=new CPolygonVectors,
VectorsX=CurrentVectors.VX,VectorsY=CurrentVectors.VY;CurrentVectors.Page=CurrentPage;this.Vectors.push(CurrentVectors);for(var LineIndex=nStartLineIndex;LineIndex<CountLines;nStartIndex=0,LineIndex++){if(arrBounds[LineIndex][nStartIndex].Page!==CurrentPage){CurrentPage=arrBounds[LineIndex][nStartIndex].Page;CurrentVectors=new CPolygonVectors;VectorsX=CurrentVectors.VX;VectorsY=CurrentVectors.VY;CurrentVectors.Page=CurrentPage;this.Vectors.push(CurrentVectors)}for(var Index=nStartIndex;Index<arrBounds[LineIndex].length;Index++){var oBound=
arrBounds[LineIndex][Index];if(oBound.W<.001)continue;var x1=Math.round(oBound.X*this.precision),x2=Math.round((oBound.X+oBound.W)*this.precision),y1=Math.round(oBound.Y*this.precision),y2=Math.round((oBound.Y+oBound.H)*this.precision);if(VectorsX[y1]==undefined)VectorsX[y1]={};this.IntersectionX(VectorsX,x2,x1,y1);if(VectorsY[x1]==undefined)VectorsY[x1]={};this.IntersectionY(VectorsY,y1,y2,x1);if(VectorsX[y2]==undefined)VectorsX[y2]={};this.IntersectionX(VectorsX,x1,x2,y2);if(VectorsY[x2]==undefined)VectorsY[x2]=
{};this.IntersectionY(VectorsY,y2,y1,x2)}}};CPolygon.prototype.IntersectionX=function(VectorsX,BeginX,EndX,Y){var CurrentVector={};CurrentVector[BeginX]=EndX;var VX=VectorsX[Y];if(BeginX>EndX)while(true==this.IntersectVectorX(CurrentVector,VX));else while(true==this.IntersectVectorX(VX,CurrentVector));for(var X in CurrentVector){var VBeginX=parseInt(X);var VEndX=CurrentVector[VBeginX];if(VBeginX!==VEndX||VX[VBeginX]===undefined)VX[VBeginX]=VEndX}};CPolygon.prototype.IntersectVectorX=function(VectorOpp,
VectorClW){for(var X in VectorOpp){var VBeginX=parseInt(X);var VEndX=VectorOpp[VBeginX];if(VEndX==VBeginX)continue;for(var ClwX in VectorClW){var ClwBeginX=parseInt(ClwX);var ClwEndX=VectorClW[ClwBeginX];var bIntersection=false;if(ClwBeginX==ClwEndX)continue;if(ClwBeginX<=VEndX&&VBeginX<=ClwEndX){VectorOpp[VBeginX]=VBeginX;VectorClW[ClwBeginX]=VEndX;VectorClW[VBeginX]=ClwEndX;bIntersection=true}else if(VEndX<=ClwBeginX&&ClwEndX<=VBeginX){VectorClW[ClwBeginX]=ClwBeginX;VectorOpp[VBeginX]=ClwEndX;VectorOpp[ClwBeginX]=
VEndX;bIntersection=true}else if(ClwBeginX<VEndX&&VEndX<ClwEndX){VectorClW[ClwBeginX]=VEndX;VectorOpp[VBeginX]=ClwEndX;bIntersection=true}else if(ClwBeginX<VBeginX&&VBeginX<ClwEndX){VectorOpp[ClwBeginX]=VEndX;VectorClW[VBeginX]=ClwEndX;delete VectorOpp[VBeginX];delete VectorClW[ClwBeginX];bIntersection=true}if(bIntersection==true)return true}}return false};CPolygon.prototype.IntersectionY=function(VectorsY,BeginY,EndY,X){var bIntersect=false;for(var y in VectorsY[X]){var CurBeginY=parseInt(y);var CurEndY=
VectorsY[X][CurBeginY];var minY,maxY;if(CurBeginY<CurEndY){minY=CurBeginY;maxY=CurEndY}else{minY=CurEndY;maxY=CurBeginY}var bInterSection=!(maxY<=BeginY&&maxY<=EndY||minY>=BeginY&&minY>=EndY),bDirection=(CurBeginY-CurEndY)*(BeginY-EndY)<0;if(bInterSection&&bDirection){VectorsY[X][CurBeginY]=EndY;VectorsY[X][BeginY]=CurEndY;bIntersect=true}}if(bIntersect==false)VectorsY[X][BeginY]=EndY};CPolygon.prototype.GetPaths=function(shift){var Paths=[];shift*=this.precision;for(var PageIndex=0;PageIndex<this.Vectors.length;PageIndex++){var y,
x1,x2,x,y1,y2;var VectorsX=this.Vectors[PageIndex].VX,VectorsY=this.Vectors[PageIndex].VY,Page=this.Vectors[PageIndex].Page;for(var LineIndex in VectorsX)for(var Index in VectorsX[LineIndex]){var Polygon=new CPolygonPath(this.precision);Polygon.Page=Page;y=parseInt(LineIndex);x1=parseInt(Index);x2=VectorsX[y][x1];VectorsX[y][x1]=-1;var Direction=x1>x2?1:-1;var minY=y;var SignRightLeft,SignDownUp;var X,Y;if(x2!==-1){SignRightLeft=x1>x2?1:-1;Y=y-SignRightLeft*shift;Polygon.PushPoint(x1,Y);while(true){x=
x2;y1=y;y2=VectorsY[x][y1];if(y2==-1)break;else if(y2==undefined)return[];VectorsY[x][y1]=-1;SignDownUp=y1>y2?1:-1;X=x+SignDownUp*shift;Polygon.PushPoint(X,Y);y=y2;x1=x;x2=VectorsX[y][x1];if(x2==-1)break;else if(x2==undefined)return[];VectorsX[y][x1]=-1;SignRightLeft=x1>x2?1:-1;Y=y-SignRightLeft*shift;Polygon.PushPoint(X,Y);if(y<minY){minY=y;Direction=x1>x2?1:-1}}Polygon.PushPoint(X,Y);Polygon.CorrectExtremePoints();Polygon.Direction=Direction;Paths.push(Polygon)}}}return Paths};function CMathTrack(){this.MathRect=
{IsActive:false,Bounds:[],ContentSelection:null};this.MathPolygons=[];this.MathSelectPolygons=[]}CMathTrack.prototype.Update=function(IsActive,IsContentActive,oMath,PixelError){this.MathRect.IsActive=IsActive;if(true===IsActive&&null!==oMath){var selectBounds=true===IsContentActive?oMath.Get_ContentSelection():null;if(selectBounds!=null){var SelectPolygon=new CPolygon;SelectPolygon.fill(selectBounds);this.MathSelectPolygons=SelectPolygon.GetPaths(0)}else this.MathSelectPolygons.length=0;var arrBounds=
oMath.Get_Bounds();if(arrBounds.length<=0)return;var MPolygon=new CPolygon;MPolygon.fill(arrBounds);this.MathPolygons=MPolygon.GetPaths(PixelError)}};CMathTrack.prototype.Draw=function(overlay,oPath,shift,color,dKoefX,dKoefY,left,top){var ctx=overlay.m_oContext;ctx.strokeStyle=color;ctx.lineWidth=1;ctx.beginPath();var Points=oPath.Points;var nCount=Points.length;var PrevX=Points[nCount-2].X,PrevY=Points[nCount-2].Y;var _x=left+dKoefX*Points[nCount-2].X,_y=top+dKoefY*Points[nCount-2].Y;var StartX,
StartY;for(var nIndex=0;nIndex<nCount;nIndex++){if(PrevX>Points[nIndex].X)_y=top+dKoefY*Points[nIndex].Y-shift;else if(PrevX<Points[nIndex].X)_y=top+dKoefY*Points[nIndex].Y+shift;if(PrevY<Points[nIndex].Y)_x=left+dKoefX*Points[nIndex].X-shift;else if(PrevY>Points[nIndex].Y)_x=left+dKoefX*Points[nIndex].X+shift;PrevX=Points[nIndex].X;PrevY=Points[nIndex].Y;if(nIndex>0){overlay.CheckPoint(_x,_y);if(1==nIndex){StartX=_x;StartY=_y;overlay.m_oContext.moveTo((_x>>0)+.5,(_y>>0)+.5)}else overlay.m_oContext.lineTo((_x>>
0)+.5,(_y>>0)+.5)}}overlay.m_oContext.lineTo((StartX>>0)+.5,(StartY>>0)+.5);ctx.closePath();ctx.stroke();ctx.beginPath()};CMathTrack.prototype.DrawWithMatrix=function(overlay,oPath,ShiftX,ShiftY,color,dKoefX,dKoefY,left,top,m){var ctx=overlay.m_oContext;ctx.strokeStyle=color;ctx.lineWidth=1;ctx.beginPath();var Points=oPath.Points;var nCount=Points.length;var x=Points[nCount-2].X,y=Points[nCount-2].Y;var _x,_y;var PrevX=Points[nCount-2].X,PrevY=Points[nCount-2].Y;var StartX,StartY;for(var nIndex=0;nIndex<
nCount;nIndex++){if(PrevX>Points[nIndex].X)y=Points[nIndex].Y-ShiftY;else if(PrevX<Points[nIndex].X)y=Points[nIndex].Y+ShiftY;if(PrevY<Points[nIndex].Y)x=Points[nIndex].X-ShiftX;else if(PrevY>Points[nIndex].Y)x=Points[nIndex].X+ShiftX;PrevX=Points[nIndex].X;PrevY=Points[nIndex].Y;if(nIndex>0){_x=left+dKoefX*m.TransformPointX(x,y);_y=top+dKoefY*m.TransformPointY(x,y);overlay.CheckPoint(_x,_y);if(1==nIndex){StartX=_x;StartY=_y;overlay.m_oContext.moveTo((_x>>0)+.5,(_y>>0)+.5)}else overlay.m_oContext.lineTo((_x>>
0)+.5,(_y>>0)+.5)}}overlay.m_oContext.lineTo((StartX>>0)+.5,(StartY>>0)+.5);ctx.closePath();ctx.stroke();ctx.beginPath()};CMathTrack.prototype.DrawSelectPolygon=function(overlay,oPath,dKoefX,dKoefY,left,top,m){var ctx=overlay.m_oContext;ctx.fillStyle="#375082";ctx.beginPath();var Points=oPath.Points;var nPointIndex;var _x,_y,x,y,p;for(nPointIndex=0;nPointIndex<Points.length-1;nPointIndex++){p=Points[nPointIndex];if(!m){_x=left+dKoefX*p.X;_y=top+dKoefY*p.Y}else{x=p.X;y=p.Y;_x=left+dKoefX*m.TransformPointX(x,
y);_y=top+dKoefY*m.TransformPointY(x,y)}overlay.CheckPoint(_x,_y);if(0==nPointIndex)ctx.moveTo((_x>>0)+.5,(_y>>0)+.5);else ctx.lineTo((_x>>0)+.5,(_y>>0)+.5)}ctx.globalAlpha=.2;ctx.fill();ctx.globalAlpha=1};CMathTrack.prototype.IsActive=function(){return this.MathRect.IsActive};CMathTrack.prototype.GetPolygonsCount=function(){return this.MathPolygons.length};CMathTrack.prototype.GetPolygon=function(nIndex){return this.MathPolygons[nIndex]};CMathTrack.prototype.GetSelectPathsCount=function(){return this.MathSelectPolygons.length};
CMathTrack.prototype.GetSelectPath=function(nIndex){return this.MathSelectPolygons[nIndex]};if(!Array.prototype.findIndex)Object.defineProperty(Array.prototype,"findIndex",{value:function(predicate){if(this==null)throw new TypeError("Array.prototype.findIndex called on null or undefined");if(typeof predicate!=="function")throw new TypeError("predicate must be a function");var list=Object(this);var length=list.length>>>0;var thisArg=arguments[1];var value;for(var i=0;i<length;i++){value=list[i];if(predicate.call(thisArg,
value,i,list))return i}return-1}});if(!Array.prototype.fill)Object.defineProperty(Array.prototype,"fill",{value:function(value){if(this==null)throw new TypeError("this is null or not defined");var O=Object(this);var len=O.length>>>0;var start=arguments[1];var relativeStart=start>>0;var k=relativeStart<0?Math.max(len+relativeStart,0):Math.min(relativeStart,len);var end=arguments[2];var relativeEnd=end===undefined?len:end>>0;var final=relativeEnd<0?Math.max(len+relativeEnd,0):Math.min(relativeEnd,len);
while(k<final){O[k]=value;k++}return O}});if(typeof Int8Array!=="undefined"&&!Int8Array.prototype.fill)Int8Array.prototype.fill=Array.prototype.fill;if(typeof Uint8Array!=="undefined"&&!Uint8Array.prototype.fill)Uint8Array.prototype.fill=Array.prototype.fill;if(typeof Uint8ClampedArray!=="undefined"&&!Uint8ClampedArray.prototype.fill)Uint8ClampedArray.prototype.fill=Array.prototype.fill;if(typeof Int16Array!=="undefined"&&!Int16Array.prototype.fill)Int16Array.prototype.fill=Array.prototype.fill;if(typeof Uint16Array!==
"undefined"&&!Uint16Array.prototype.fill)Uint16Array.prototype.fill=Array.prototype.fill;if(typeof Int32Array!=="undefined"&&!Int32Array.prototype.fill)Int32Array.prototype.fill=Array.prototype.fill;if(typeof Uint32Array!=="undefined"&&!Uint32Array.prototype.fill)Uint32Array.prototype.fill=Array.prototype.fill;if(typeof Float32Array!=="undefined"&&!Float32Array.prototype.fill)Float32Array.prototype.fill=Array.prototype.fill;if(typeof Float64Array!=="undefined"&&!Float64Array.prototype.fill)Float64Array.prototype.fill=
Array.prototype.fill;if(typeof Uint8Array!=="undefined"&&!Uint8Array.prototype.slice)Uint8Array.prototype.slice=Array.prototype.slice;function parseText(text,options,bTrimSpaces){var delimiterChar;if(options.asc_getDelimiterChar())delimiterChar=options.asc_getDelimiterChar();else switch(options.asc_getDelimiter()){case AscCommon.c_oAscCsvDelimiter.None:delimiterChar=undefined;break;case AscCommon.c_oAscCsvDelimiter.Tab:delimiterChar="\t";break;case AscCommon.c_oAscCsvDelimiter.Semicolon:delimiterChar=
";";break;case AscCommon.c_oAscCsvDelimiter.Colon:delimiterChar=":";break;case AscCommon.c_oAscCsvDelimiter.Comma:delimiterChar=",";break;case AscCommon.c_oAscCsvDelimiter.Space:delimiterChar=" ";break}var matrix=[];var rows=text.split(/\r?\n/);for(var i=0;i<rows.length;++i){var row=rows[i];if(" "===delimiterChar&&bTrimSpaces){var addSpace=false;if(row[0]===delimiterChar)addSpace=true;row=addSpace?delimiterChar+row.trim():row.trim()}matrix.push(row.split(delimiterChar))}return matrix}function getTimeISO8601(dateStr){if(dateStr)if(dateStr.endsWith("Z"))return Date.parse(dateStr);
else return Date.parse(dateStr+"Z");return NaN}function valueToMmType(value){var oVal=parseFloat(value);var oType;if(!isNaN(oVal)){if(-1!==value.indexOf("%")){oType="%";oVal/=100}else if(-1!==value.indexOf("px")){oType="px";oVal*=AscCommon.g_dKoef_pix_to_mm}else if(-1!==value.indexOf("in")){oType="in";oVal*=AscCommonWord.g_dKoef_in_to_mm}else if(-1!==value.indexOf("cm")){oType="cm";oVal*=10}else if(-1!==value.indexOf("mm"))oType="mm";else if(-1!==value.indexOf("pt")){oType="pt";oVal*=AscCommonWord.g_dKoef_pt_to_mm}else if(-1!==
value.indexOf("pc")){oType="pc";oVal*=AscCommonWord.g_dKoef_pc_to_mm}else oType="none";return{val:oVal,type:oType}}return null}function valueToMm(value){var obj=valueToMmType(value);if(obj&&"%"!==obj.type&&"none"!==obj.type)return obj.val;return null}function arrayMove(array,from,to){array.splice(to,0,array.splice(from,1)[0])}function getRangeArray(start,stop){var res=new Array(stop-start);for(var i=start;i<stop;++i)res[i-start]=i;return res}var g_oBackoffDefaults={retries:2,factor:2,minTimeout:100,
maxTimeout:2E3,randomize:true};function Backoff(opts){this.attempts=0;this.opts=opts}Backoff.prototype.attempt=function(fError,fRetry){var timeout=this.nextTimeout();if(timeout>0)setTimeout(function(){fRetry()},timeout);else fError()};Backoff.prototype.nextTimeout=function(){var timeout=-1;if(this.attempts<this.opts.retries){timeout=this.createTimeout(this.attempts,this.opts);this.attempts++}return timeout};Backoff.prototype.createTimeout=function(attempt,opts){var random=opts.randomize?Math.random()+
1:1;var timeout=Math.round(random*opts.minTimeout*Math.pow(opts.factor,attempt));timeout=Math.min(timeout,opts.maxTimeout);return timeout};function backoffOnError(obj,onError,onRetry){if(!onRetry)return onError;var backoff=new Backoff(g_oBackoffDefaults);return function(){var timeout=backoff.nextTimeout();if(timeout>0)setTimeout(function(){onRetry.call(obj,obj)},timeout);else if(onError)onError.apply(obj,arguments)}}function backoffOnErrorImg(img,onRetry){if(!onRetry)onRetry=function(img){img.setAttribute("src",
img.getAttribute("src"))};img.onerror=backoffOnError(img,img.onerror,onRetry)}function isEmptyObject(obj){for(var name in obj)return false;return true}window["AscCommon"]=window["AscCommon"]||{};window["AscCommon"].getSockJs=getSockJs;window["AscCommon"].getJSZipUtils=getJSZipUtils;window["AscCommon"].getJSZip=getJSZip;window["AscCommon"].getBaseUrl=getBaseUrl;window["AscCommon"].getEncodingParams=getEncodingParams;window["AscCommon"].getEncodingByBOM=getEncodingByBOM;window["AscCommon"].saveWithParts=
saveWithParts;window["AscCommon"].loadFileContent=loadFileContent;window["AscCommon"].getImageFromChanges=getImageFromChanges;window["AscCommon"].openFileCommand=openFileCommand;window["AscCommon"].sendCommand=sendCommand;window["AscCommon"].sendSaveFile=sendSaveFile;window["AscCommon"].mapAscServerErrorToAscError=mapAscServerErrorToAscError;window["AscCommon"].joinUrls=joinUrls;window["AscCommon"].getFullImageSrc2=getFullImageSrc2;window["AscCommon"].fSortAscending=fSortAscending;window["AscCommon"].fSortDescending=
fSortDescending;window["AscCommon"].isLeadingSurrogateChar=isLeadingSurrogateChar;window["AscCommon"].decodeSurrogateChar=decodeSurrogateChar;window["AscCommon"].encodeSurrogateChar=encodeSurrogateChar;window["AscCommon"].convertUnicodeToUTF16=convertUnicodeToUTF16;window["AscCommon"].convertUTF16toUnicode=convertUTF16toUnicode;window["AscCommon"].build_local_rx=build_local_rx;window["AscCommon"].GetFileName=GetFileName;window["AscCommon"].GetFileExtension=GetFileExtension;window["AscCommon"].changeFileExtention=
changeFileExtention;window["AscCommon"].getExtentionByFormat=getExtentionByFormat;window["AscCommon"].InitOnMessage=InitOnMessage;window["AscCommon"].ShowImageFileDialog=ShowImageFileDialog;window["AscCommon"].ShowDocumentFileDialog=ShowDocumentFileDialog;window["AscCommon"].InitDragAndDrop=InitDragAndDrop;window["AscCommon"].UploadImageFiles=UploadImageFiles;window["AscCommon"].UploadImageUrls=UploadImageUrls;window["AscCommon"].CanDropFiles=CanDropFiles;window["AscCommon"].getUrlType=getUrlType;
window["AscCommon"].prepareUrl=prepareUrl;window["AscCommon"].getUserColorById=getUserColorById;window["AscCommon"].isNullOrEmptyString=isNullOrEmptyString;window["AscCommon"].unleakString=unleakString;window["AscCommon"].readValAttr=readValAttr;window["AscCommon"].getNumFromXml=getNumFromXml;window["AscCommon"].getColorFromXml=getColorFromXml;window["AscCommon"].getBoolFromXml=getBoolFromXml;window["AscCommon"].initStreamFromResponse=initStreamFromResponse;window["AscCommon"].checkStreamSignature=
checkStreamSignature;window["AscCommon"].DocumentUrls=DocumentUrls;window["AscCommon"].OpenFileResult=OpenFileResult;window["AscCommon"].CLock=CLock;window["AscCommon"].CContentChanges=CContentChanges;window["AscCommon"].CContentChangesElement=CContentChangesElement;window["AscCommon"].CorrectMMToTwips=CorrectMMToTwips;window["AscCommon"].TwipsToMM=TwipsToMM;window["AscCommon"].MMToTwips=MMToTwips;window["AscCommon"].RomanToInt=RomanToInt;window["AscCommon"].LatinNumberingToInt=LatinNumberingToInt;
window["AscCommon"].IntToNumberFormat=IntToNumberFormat;window["AscCommon"].IsSpace=IsSpace;window["AscCommon"].loadSdk=loadSdk;window["AscCommon"].loadScript=loadScript;window["AscCommon"].getAltGr=getAltGr;window["AscCommon"].getColorSchemeByName=getColorSchemeByName;window["AscCommon"].getColorSchemeByIdx=getColorSchemeByIdx;window["AscCommon"].getAscColorScheme=getAscColorScheme;window["AscCommon"].checkAddColorScheme=checkAddColorScheme;window["AscCommon"].getIndexColorSchemeInArray=getIndexColorSchemeInArray;
window["AscCommon"].isEastAsianScript=isEastAsianScript;window["AscCommon"].CMathTrack=CMathTrack;window["AscCommon"].CPolygon=CPolygon;window["AscCommon"].JSZipWrapper=JSZipWrapper;window["AscCommon"].g_oDocumentUrls=g_oDocumentUrls;window["AscCommon"].FormulaTablePartInfo=FormulaTablePartInfo;window["AscCommon"].cBoolLocal=cBoolLocal;window["AscCommon"].cErrorOrigin=cErrorOrigin;window["AscCommon"].cErrorLocal=cErrorLocal;window["AscCommon"].FormulaSeparators=FormulaSeparators;window["AscCommon"].rx_space_g=
rx_space_g;window["AscCommon"].rx_space=rx_space;window["AscCommon"].rx_defName=rx_defName;window["AscCommon"].kCurFormatPainterWord=kCurFormatPainterWord;window["AscCommon"].parserHelp=parserHelp;window["AscCommon"].g_oIdCounter=g_oIdCounter;window["AscCommon"].g_oHtmlCursor=g_oHtmlCursor;window["AscCommon"].g_oBackoffDefaults=g_oBackoffDefaults;window["AscCommon"].Backoff=Backoff;window["AscCommon"].backoffOnErrorImg=backoffOnErrorImg;window["AscCommon"].isEmptyObject=isEmptyObject;window["AscCommon"].CSignatureDrawer=
window["AscCommon"]["CSignatureDrawer"]=CSignatureDrawer;var prot=CSignatureDrawer.prototype;prot["getImages"]=prot.getImages;prot["setText"]=prot.setText;prot["selectImage"]=prot.selectImage;prot["isValid"]=prot.isValid;prot["destroy"]=prot.destroy;window["AscCommon"].translateManager=new CTranslateManager;window["AscCommon"].parseText=parseText;window["AscCommon"].getTimeISO8601=getTimeISO8601;window["AscCommon"].valueToMm=valueToMm;window["AscCommon"].valueToMmType=valueToMmType;window["AscCommon"].arrayMove=
arrayMove;window["AscCommon"].getRangeArray=getRangeArray;window["AscCommon"].CUnicodeStringEmulator=CUnicodeStringEmulator;window["AscCommon"].private_IsAbbreviation=private_IsAbbreviation;window["AscCommon"].rx_test_ws_name=rx_test_ws_name;window["AscCommon"].CShortcuts=window["AscCommon"]["CShortcuts"]=CShortcuts;prot=CShortcuts.prototype;prot["Add"]=prot.Add;prot["Get"]=prot.Get;prot["CheckType"]=prot.CheckType;prot["Remove"]=prot.Remove;prot["RemoveByType"]=prot.RemoveByType;prot["GetNewCustomType"]=
prot.GetNewCustomType;prot["IsCustomType"]=prot.IsCustomType;prot["GetCustomAction"]=prot.GetCustomAction;prot["AddCustomActionSymbol"]=prot.AddCustomActionSymbol;window["AscCommon"].CCustomShortcutActionSymbol=window["AscCommon"]["CCustomShortcutActionSymbol"]=CCustomShortcutActionSymbol})(window);
nCharCode<=40959||13312<=nCharCode&&nCharCode<=19903||131072<=nCharCode&&nCharCode<=173791||173824<=nCharCode&&nCharCode<=177983||177984<=nCharCode&&nCharCode<=178207||178208<=nCharCode&&nCharCode<=183983||63744<=nCharCode&&nCharCode<=64255||194560<=nCharCode&&nCharCode<=195103)return false}return true}return false}var g_oUserColorById={},g_oUserNextColorIndex=0;function getUserColorById(userId,userName,isDark,isNumericValue){if(window.parent.APP&&window.parent.APP.getUserColor)try{var CPColor=window.parent.APP.getUserColor(userId);
if(CPColor)return true===isNumericValue?CPColor.r<<16&16711680|CPColor.g<<8&65280|CPColor.b&255:CPColor}catch(e){}if((!userId||""===userId)&&(!userName||""===userName))return new CColor(0,0,0,255);var res;if(g_oUserColorById.hasOwnProperty(userId))res=g_oUserColorById[userId];else if(g_oUserColorById.hasOwnProperty(userName))res=g_oUserColorById[userName];else{var nColor=Asc.c_oAscArrUserColors[g_oUserNextColorIndex%Asc.c_oAscArrUserColors.length];++g_oUserNextColorIndex;res=g_oUserColorById[userId||
userName]=new CUserCacheColor(nColor)}if(!res)return new CColor(0,0,0,255);var oColor=true===isDark?res.Dark:res.Light;return true===isNumericValue?oColor.r<<16&16711680|oColor.g<<8&65280|oColor.b&255:oColor}function isNullOrEmptyString(str){return str==undefined||str==null||str==""}function unleakString(s){return(" "+s).substr(1)}function readValAttr(attr){if(attr()){var val=attr()["val"];return val?val:null}return null}function getNumFromXml(val){return val?val-0:null}function getColorFromXml(attr){if(attr()){var vals=
attr();if(null!=vals["theme"])return AscCommonExcel.g_oColorManager.getThemeColor(getNumFromXml(vals["theme"]),getNumFromXml(vals["tint"]));else if(null!=vals["rgb"])return new AscCommonExcel.RgbColor(16777215&getNumFromXml(vals["rgb"]))}return null}function getBoolFromXml(val){return"0"!==val&&"false"!==val&&"off"!==val}function CUserCacheColor(nColor){this.Light=null;this.Dark=null;this.init(nColor)}CUserCacheColor.prototype.init=function(nColor){var r=nColor>>16&255;var g=nColor>>8&255;var b=nColor&
255;var Y=Math.max(0,Math.min(255,.299*r+.587*g+.114*b));var Cb=Math.max(0,Math.min(255,128-.168736*r-.331264*g+.5*b));var Cr=Math.max(0,Math.min(255,128+.5*r-.418688*g-.081312*b));if(Y>63)Y=63;var R=Math.max(0,Math.min(255,Y+1.402*(Cr-128)))|0;var G=Math.max(0,Math.min(255,Y-.34414*(Cb-128)-.71414*(Cr-128)))|0;var B=Math.max(0,Math.min(255,Y+1.772*(Cb-128)))|0;this.Light=new CColor(r,g,b,255);this.Dark=new CColor(R,G,B,255)};function loadScript(url,onSuccess,onError){if(window["NATIVE_EDITOR_ENJINE"]===
true||window["Native"]!==undefined){onSuccess();return}if(window["AscDesktopEditor"]&&window["local_load_add"]){var _context={"completeLoad":function(){return onSuccess()}};window["local_load_add"](_context,"sdk-all-from-min",url);var _ret_param=window["AscDesktopEditor"]["LoadJS"](url);if(2!=_ret_param)window["local_load_remove"](url);if(_ret_param==1){setTimeout(onSuccess,1);return}else if(_ret_param==2)return}var backoff=new AscCommon.Backoff(AscCommon.g_oBackoffDefaults);loadScriptWithBackoff(backoff,
url,onSuccess,onError)}function loadScriptWithBackoff(backoff,url,onSuccess,onError){var script=document.createElement("script");script.type="text/javascript";script.src=url;script.onload=onSuccess;script.onerror=function(){backoff.attempt(onError,function(){loadScriptWithBackoff(backoff,url,onSuccess,onError)})};document.head.appendChild(script)}function loadSdk(sdkName,onSuccess,onError){if(window["AscNotLoadAllScript"])onSuccess();else{var urlArgs=window.parent&&window.parent.APP&&window.parent.APP.urlArgs||
"";loadScript("./../../../../sdkjs/"+sdkName+"/sdk-all.js?"+urlArgs,onSuccess,onError)}}function getAltGr(e){var ctrlKey=e.metaKey||e.ctrlKey;var altKey=e.altKey;return altKey&&(AscBrowser.isMacOs?!ctrlKey:ctrlKey)}function getColorSchemeByName(sName){for(var i=0;i<AscCommon.g_oUserColorScheme.length;++i){var tmp=AscCommon.g_oUserColorScheme[i];if(tmp&&tmp.name===sName)return getColorSchemeByIdx(i)}return null}function getColorSchemeByIdx(idx){var tmp=AscCommon.g_oUserColorScheme[idx];if(tmp){var scheme=
new AscFormat.ClrScheme,_c;scheme.name=tmp.name;_c=tmp.get_dk1();scheme.colors[8]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_lt1();scheme.colors[12]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_dk2();scheme.colors[9]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_lt2();scheme.colors[13]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_accent1();scheme.colors[0]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_accent2();scheme.colors[1]=AscFormat.CreateUniColorRGB(_c.r,
_c.g,_c.b);_c=tmp.get_accent3();scheme.colors[2]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_accent4();scheme.colors[3]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_accent5();scheme.colors[4]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_accent6();scheme.colors[5]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_hlink();scheme.colors[11]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);_c=tmp.get_folHlink();scheme.colors[10]=AscFormat.CreateUniColorRGB(_c.r,_c.g,_c.b);
return scheme}return null}function getAscColorScheme(_scheme,theme){var elem,_c;var _rgba={R:0,G:0,B:0,A:255};elem=new AscCommon.CAscColorScheme;elem.scheme=_scheme;elem.name=_scheme.name;_scheme.colors[8].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[8].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[12].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[12].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[9].Calculate(theme,null,null,
null,_rgba);_c=_scheme.colors[9].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[13].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[13].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[0].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[0].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[1].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[1].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[2].Calculate(theme,
null,null,null,_rgba);_c=_scheme.colors[2].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[3].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[3].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[4].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[4].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[5].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[5].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));
_scheme.colors[11].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[11].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));_scheme.colors[10].Calculate(theme,null,null,null,_rgba);_c=_scheme.colors[10].RGBA;elem.putColor(new AscCommon.CColor(_c.R,_c.G,_c.B));return elem}function getIndexColorSchemeInArray(result,asc_color_scheme){for(var j=0;j<result.length;++j)if(result[j].isEqual(asc_color_scheme))return j;return-1}function checkAddColorScheme(result,asc_color_scheme,nStartIndex){var nIndex=
getIndexColorSchemeInArray(result,asc_color_scheme);if(nIndex>-1)return nIndex;var nStartIndex_=nStartIndex;if(nStartIndex===null)nStartIndex_=result.length;result.splice(nStartIndex_,0,asc_color_scheme);return nStartIndex_}function isEastAsianScript(value){return 12544<=value&&value<=12591||12704<=value&&value<=12735||19968<=value&&value<=40938||13312<=value&&value<=19893||131072<=value&&value<=173782||173824<=value&&value<=177972||177984<=value&&value<=178205||178208<=value&&value<=183969||183984<=
value&&value<=191456||63744<=value&&value<=64255||194560<=value&&value<=195103||12032<=value&&value<=12255||11904<=value&&value<=12031||12736<=value&&value<=12783||12272<=value&&value<=12287||4352<=value&&value<=4607||43360<=value&&value<=43391||55216<=value&&value<=55295||12592<=value&&value<=12687||65280<=value&&value<=65519||44032<=value&&value<=55215||12352<=value&&value<=12447||110848<=value&&value<=110895||110592<=value&&value<=110847||12688<=value&&value<=12703||12448<=value&&value<=12543||
12784<=value&&value<=12799||42192<=value&&value<=42239||93952<=value&&value<=94111||110960<=value&&value<=111359||94208<=value&&value<=100332||100352<=value&&value<=101119||40960<=value&&value<=42127||42128<=value&&value<=42191}var g_oIdCounter=new CIdCounter;window.Asc.g_signature_drawer=null;function CSignatureDrawer(id,api,w,h){window.Asc.g_signature_drawer=this;this.Api=api;this.CanvasParent=document.getElementById(id);this.Canvas=document.createElement("canvas");this.Canvas.style.position="absolute";
this.Canvas.style.left="0px";this.Canvas.style.top="0px";var _width=parseInt(this.CanvasParent.offsetWidth);var _height=parseInt(this.CanvasParent.offsetHeight);if(0==_width)_width=300;if(0==_height)_height=80;this.Canvas.width=_width;this.Canvas.height=_height;this.CanvasParent.appendChild(this.Canvas);this.Image="";this.ImageHtml=null;this.Text="";this.Font="Arial";this.Size=10;this.Italic=true;this.Bold=false;this.Width=w;this.Height=h;this.CanvasReturn=null;this.IsAsync=false}CSignatureDrawer.prototype.getCanvas=
function(){return this.CanvasReturn==null?this.Canvas:this.CanvasReturn};CSignatureDrawer.prototype.getImages=function(){if(!this.isValid())return["",""];this.CanvasReturn=document.createElement("canvas");this.CanvasReturn.width=this.Width*AscCommon.g_dKoef_mm_to_pix;this.CanvasReturn.height=this.Height*AscCommon.g_dKoef_mm_to_pix;if(this.Text!="")this.drawText();else this.drawImage();var _ret=[];_ret.push(this.CanvasReturn.toDataURL("image/png"));var _ctx=this.CanvasReturn.getContext("2d");_ctx.strokeStyle=
"#FF0000";_ctx.lineWidth=2;_ctx.moveTo(0,0);_ctx.lineTo(this.CanvasReturn.width,this.CanvasReturn.height);_ctx.moveTo(0,this.CanvasReturn.height);_ctx.lineTo(this.CanvasReturn.width,0);_ctx.stroke();_ret.push(this.CanvasReturn.toDataURL("image/png"));this.CanvasReturn=null;return _ret};CSignatureDrawer.prototype.setText=function(text,font,size,isItalic,isBold){if(this.IsAsync){this.Text=text;return}this.Image="";this.ImageHtml=null;this.Text=text;this.Font=font;this.Size=size;this.Italic=isItalic;
this.Bold=isBold;this.IsAsync=true;AscFonts.FontPickerByCharacter.checkText(this.Text,this,function(){this.IsAsync=false;var loader=AscCommon.g_font_loader;var fontinfo=AscFonts.g_fontApplication.GetFontInfo(font);var isasync=loader.LoadFont(fontinfo,function(){window.Asc.g_signature_drawer.Api.sync_EndAction(Asc.c_oAscAsyncActionType.Information,Asc.c_oAscAsyncAction.LoadFont);window.Asc.g_signature_drawer.drawText()});if(false===isasync)this.drawText()})};CSignatureDrawer.prototype.drawText=function(){var _oldTurn=
this.Api.isViewMode;var _oldMarks=this.Api.ShowParaMarks;this.Api.isViewMode=true;this.Api.ShowParaMarks=false;AscFormat.ExecuteNoHistory(AscCommon.DrawTextByCenter,this,[]);this.Api.isViewMode=_oldTurn;this.Api.ShowParaMarks=_oldMarks};CSignatureDrawer.prototype.drawImage=function(){var _canvas=this.getCanvas();var w=_canvas.width;var h=_canvas.height;var _ctx=_canvas.getContext("2d");_ctx.clearRect(0,0,w,h);var im_w=this.ImageHtml.width;var im_h=this.ImageHtml.height;var _x=0;var _y=0;var _w=0;
var _h=0;var koef1=w/h;var koef2=im_w/im_h;if(koef1>koef2){_h=h;_w=koef2*_h>>0;_y=0;_x=w-_w>>1}else{_w=w;_h=_w/koef2>>0;_x=0;_y=h-_h>>1}_ctx.drawImage(this.ImageHtml,_x,_y,_w,_h)};CSignatureDrawer.prototype.selectImage=CSignatureDrawer.prototype["selectImage"]=function(){this.Text="";window["AscDesktopEditor"]["OpenFilenameDialog"]("images",false,function(_file){var file=_file;if(Array.isArray(file))file=file[0];if(!file)return;var _drawer=window.Asc.g_signature_drawer;_drawer.Image=window["AscDesktopEditor"]["GetImageBase64"](file);
_drawer.ImageHtml=new Image;_drawer.ImageHtml.onload=function(){window.Asc.g_signature_drawer.drawImage()};_drawer.ImageHtml.src=_drawer.Image;_drawer=null})};CSignatureDrawer.prototype.isValid=function(){return this.Image!=""||this.Text!=""};CSignatureDrawer.prototype.destroy=function(){window.Asc.g_signature_drawer.CanvasParent.removeChild(this.Canvas);delete window.Asc.g_signature_drawer};function CSignatureImage(){this.ImageValidBase64="";this.ImageInvalidBase64="";this.ImageValid=null;this.ImageInvalid=
null;this.Valid=false;this.Loading=0;this.Remove=function(){this.ImageValidBase64="";this.ImageInvalidBase64="";this.ImageValid=null;this.ImageInvalid=null;this.Valid=false;this.Loading=0};this.Register=function(_api,_guid){if(_api.ImageLoader.map_image_index[_guid])return;var _obj={Image:this.Valid?this.ImageValid:this.ImageInvalid,Status:AscFonts.ImageLoadStatus.Complete,src:_guid};_api.ImageLoader.map_image_index[_guid]=_obj};this.Unregister=function(_api,_guid){if(_api.ImageLoader.map_image_index[_guid])delete _api.ImageLoader.map_image_index[_guid]}}
function CShortcuts(){this.List={};this.CustomCounter=0;this.CustomActions={}}CShortcuts.prototype.Add=function(nType,nCode,isCtrl,isShift,isAlt){this.List[this.private_GetIndex(nCode,isCtrl,isShift,isAlt)]=nType};CShortcuts.prototype.Get=function(nCode,isCtrl,isShift,isAlt){var nType=this.List[this.private_GetIndex(nCode,isCtrl,isShift,isAlt)];return undefined!==nType?nType:0};CShortcuts.prototype.private_GetIndex=function(nCode,isCtrl,isShift,isAlt){return nCode<<8|(isCtrl?4:0)|(isShift?2:0)|(isAlt?
1:0)};CShortcuts.prototype.CheckType=function(nType){for(var nIndex in this.List)if(this.List[nIndex]===nType)return{KeyCode:nIndex>>>8,CtrlKey:!!(nIndex&4),ShiftKey:!!(nIndex&2),AltKey:!!(nIndex&1)};return null};CShortcuts.prototype.Remove=function(nCode,isCtrl,isShift,isAlt){delete this.List[this.private_GetIndex(nCode,isCtrl,isShift,isAlt)]};CShortcuts.prototype.RemoveByType=function(nType){for(var nIndex in this.List)if(this.List[nIndex]===nType)delete this.List[nIndex]};CShortcuts.prototype.GetNewCustomType=
function(){return 16711680|this.CustomCounter++};CShortcuts.prototype.IsCustomType=function(nType){return nType>=16711680};CShortcuts.prototype.GetCustomAction=function(nType){return this.CustomActions[nType]};CShortcuts.prototype.AddCustomActionSymbol=function(nCharCode,sFont){var nType=this.GetNewCustomType();this.CustomActions[nType]=new CCustomShortcutActionSymbol(nCharCode,sFont);return nType};function CCustomShortcutActionSymbol(nCharCode,sFont){this.CharCode=nCharCode;this.Font=sFont}CCustomShortcutActionSymbol.prototype.Type=
AscCommon.c_oAscCustomShortcutType.Symbol;AscCommon.EncryptionMessageType={Encrypt:0,Decrypt:1};function CEncryptionData(){this._init=false;this.arrData=[];this.arrImages=[];this.handleChangesCallback=null;this.isChangesHandled=false;this.cryptoMode=0;this.isChartEditor=false;this.isExistDecryptedChanges=false;this.cryptoPrefix=window["AscDesktopEditor"]&&window["AscDesktopEditor"]["GetEncryptedHeader"]?window["AscDesktopEditor"]["GetEncryptedHeader"]():"ENCRYPTED;";this.cryptoPrefixLen=this.cryptoPrefix.length;
this.editorId=null;this.nextChangesTimeoutId=-1;this.isPasswordCryptoPresent=false;this.init=function(){this._init=true};this.isInit=function(){return this._init};this.isNeedCrypt=function(){if(window.g_asc_plugins)if(!window.g_asc_plugins.isRunnedEncryption())return false;if(!window["AscDesktopEditor"])return false;if(this.isChartEditor)return false;if(2==this.cryptoMode)return true;if(0===window["AscDesktopEditor"]["CryptoMode"])return false;return true};this.isCryptoImages=function(){return this.isNeedCrypt()&&
this.isPasswordCryptoPresent};this.addCryproImagesFromDialog=function(callback){var _this=this;window["AscDesktopEditor"]["OpenFilenameDialog"]("images",true,function(files){if(!files)return;if(!Array.isArray(files))files=[files];if(0===files.length)return;var _files=[];var _options={isImageCrypt:true,callback:callback,ext:[]};for(var i=0;i<files.length;i++){_files.push(window["AscDesktopEditor"]["GetImageBase64"](files[i],true));_options.ext.push(AscCommon.GetFileExtension(files[i]))}_this.sendChanges(this,
_files,AscCommon.EncryptionMessageType.Encrypt,_options)})};this.addCryproImagesFromUrls=function(urls,callback){var _editor=window["Asc"]["editor"]?window["Asc"]["editor"]:window.editor;_editor.sync_StartAction(Asc.c_oAscAsyncActionType.BlockInteraction,Asc.c_oAscAsyncAction.LoadImage);var _this=this;window["AscDesktopEditor"]["DownloadFiles"](urls,[],function(files){_editor.sync_EndAction(Asc.c_oAscAsyncActionType.BlockInteraction,Asc.c_oAscAsyncAction.LoadImage);_editor.sync_StartAction(Asc.c_oAscAsyncActionType.BlockInteraction,
Asc.c_oAscAsyncAction.UploadImage);var _files=[];var _options={isImageCrypt:true,isUrls:true,callback:callback,ext:[],api:_editor};for(var elem in files){_files.push(window["AscDesktopEditor"]["GetImageBase64"](files[elem],true));_options.ext.push(window["AscDesktopEditor"]["GetImageFormat"](files[elem]));window["AscDesktopEditor"]["RemoveFile"](files[elem])}_this.sendChanges(this,_files,AscCommon.EncryptionMessageType.Encrypt,_options)})};this.onDecodeError=function(){var _editor=window["Asc"]["editor"]?
window["Asc"]["editor"]:window.editor;_editor.sendEvent("asc_onError",Asc.c_oAscError.ID.DataEncrypted,Asc.c_oAscError.Level.Critical)};this.checkEditorId=function(){if(null==this.editorId){var _editor=window["Asc"]["editor"]?window["Asc"]["editor"]:window.editor;this.editorId=_editor.editorId}};this.decryptImage=function(src,img,data){this.sendChanges(this,[data],AscCommon.EncryptionMessageType.Decrypt,{isImageDecrypt:true,src:src,img:img})};this.nextChanges=function(){this.nextChangesTimeoutId=
setTimeout(function(){AscCommon.EncryptionWorker.sendChanges(undefined,undefined);this.nextChangesTimeoutId=-1},10)};this.sendChanges=function(sender,data,type,options){if(!this.isNeedCrypt()){if(AscCommon.EncryptionMessageType.Encrypt==type)sender._send(data,true);else if(AscCommon.EncryptionMessageType.Decrypt==type){if(this.isExistEncryptedChanges(data["changes"])){this.onDecodeError();return}sender._onSaveChanges(data,true)}return}if(undefined!==type)this.arrData.push({sender:sender,type:type,
data:data,options:options});if(this.arrData.length==0)return;if(undefined!==type&&(1!=this.arrData.length||!this.isChangesHandled))return;if(undefined!==type&&-1!=this.nextChangesTimeoutId){clearTimeout(this.nextChangesTimeoutId);this.nextChangesTimeoutId=-1}if(AscCommon.EncryptionMessageType.Encrypt==this.arrData[0].type)if(this.arrData[0].options&&this.arrData[0].options.isImageCrypt)window.g_asc_plugins.sendToEncryption({"type":"encryptData","data":this.arrData[0].data});else window.g_asc_plugins.sendToEncryption({"type":"encryptData",
"data":JSON.parse(this.arrData[0].data["changes"])});else if(AscCommon.EncryptionMessageType.Decrypt==this.arrData[0].type)if(this.arrData[0].options&&this.arrData[0].options.isImageDecrypt)window.g_asc_plugins.sendToEncryption({"type":"decryptData","data":this.arrData[0].data});else window.g_asc_plugins.sendToEncryption({"type":"decryptData","data":this.arrData[0].data["changes"]})};this.receiveChanges=function(obj){var data=obj["data"];var check=obj["check"];if(!check){this.onDecodeError();return}if(this.handleChangesCallback){this.isExistDecryptedChanges=
true;this.checkEditorId();if(this.editorId==AscCommon.c_oEditorId.Spreadsheet)for(var i=data.length-1;i>=0;i--)this.handleChangesCallback.changesBase[i]=data[i];else for(var i=data.length-1;i>=0;i--)this.handleChangesCallback.changesBase[i].m_pData=data[i];this.isChangesHandled=true;this.handleChangesCallback.callback.call(this.handleChangesCallback.sender);this.handleChangesCallback=null;this.nextChanges();return}var obj=this.arrData[0];this.arrData.splice(0,1);if(AscCommon.EncryptionMessageType.Encrypt==
obj.type)if(obj.options&&obj.options.isImageCrypt){for(var i=0;i<data.length;i++)if(this.cryptoPrefix==data[i].substr(0,this.cryptoPrefixLen))data[i]=this.cryptoPrefix+obj.options.ext[i]+";"+data[i].substr(this.cryptoPrefixLen);if(!obj.options.isUrls)obj.options.callback(Asc.c_oAscError.ID.No,data);else AscCommon.UploadImageUrls(data,obj.options.api.documentId,obj.options.api.documentUserId,obj.options.api.CoAuthoringApi.get_jwt(),function(urls){obj.options.api.sync_EndAction(Asc.c_oAscAsyncActionType.BlockInteraction,
Asc.c_oAscAsyncAction.UploadImage);obj.options.callback(urls)})}else{obj.data["changes"]=JSON.stringify(data);obj.sender._send(obj.data,true)}else if(AscCommon.EncryptionMessageType.Decrypt==obj.type)if(obj.options&&obj.options.isImageDecrypt){window["AscDesktopEditor"]["ResaveFile"](obj.options.src,data[0]);obj.options.img["onload_crypto"](obj.options.src)}else{this.isExistDecryptedChanges=true;obj.data["changes"]=data;obj.sender._onSaveChanges(obj.data,true)}this.nextChanges()};this.isExistEncryptedChanges=
function(_array){if(0==_array.length)return false;this.checkEditorId();var isChangesMode=_array[0]["change"]?true:false;var _prefix="";var _checkPrefixLen=this.cryptoPrefixLen+1;if(isChangesMode){for(var i=_array.length-1;i>=0;i--)if(_array[i]["change"].length>_checkPrefixLen){_prefix=_array[i]["change"].substr(0,_checkPrefixLen);if(-1!=_prefix.indexOf(this.cryptoPrefix)){isCrypted=true;break}}return isCrypted}var isCrypted=false;if(this.editorId==AscCommon.c_oEditorId.Spreadsheet)for(var i=_array.length-
1;i>=0;i--){if(_array[i].length>_checkPrefixLen){_prefix=_array[i].substr(0,_checkPrefixLen);if(-1!=_prefix.indexOf(this.cryptoPrefix)){isCrypted=true;break}}}else for(var i=_array.length-1;i>=0;i--)if(_array[i].m_pData.length>_checkPrefixLen){_prefix=_array[i].m_pData.substr(0,_checkPrefixLen);if(-1!=_prefix.indexOf(this.cryptoPrefix)){isCrypted=true;break}}return isCrypted};this.handleChanges=function(_array,_sender,_callback){if(0==_array.length||!this.isNeedCrypt()){if(this.isExistEncryptedChanges(_array)){this.onDecodeError();
return}this.isChangesHandled=true;_callback.call(_sender);return}this.handleChangesCallback={changesBase:_array,changes:[],sender:_sender,callback:_callback};this.checkEditorId();if(this.editorId==AscCommon.c_oEditorId.Spreadsheet)for(var i=_array.length-1;i>=0;i--)this.handleChangesCallback.changes[i]=_array[i];else for(var i=_array.length-1;i>=0;i--)this.handleChangesCallback.changes[i]=_array[i].m_pData;window.g_asc_plugins.sendToEncryption({"type":"decryptData","data":this.handleChangesCallback.changes})};
this.asc_setAdvancedOptions=function(api,idOption,option){if(window.isNativeOpenPassword){window["AscDesktopEditor"]["NativeViewerOpen"](option.asc_getPassword());return}if(window.isCloudCryptoDownloadAs)return false;if(!this.isNeedCrypt())return false;window.checkPasswordFromPlugin=true;if(window["Asc"].c_oAscAdvancedOptionsID.TXT===idOption){var _param="<m_nCsvTxtEncoding>"+option.asc_getCodePage()+"</m_nCsvTxtEncoding>";window["AscDesktopEditor"]["SetAdvancedOptions"](_param)}else if(window["Asc"].c_oAscAdvancedOptionsID.CSV===
idOption){var delimiter=option.asc_getDelimiter();var delimiterChar=option.asc_getDelimiterChar();var _param="";_param+="<m_nCsvTxtEncoding>"+option.asc_getCodePage()+"</m_nCsvTxtEncoding>";if(null!=delimiter)_param+="<m_nCsvDelimiter>"+delimiter+"</m_nCsvDelimiter>";if(null!=delimiterChar)_param+="<m_nCsvDelimiterChar>"+delimiterChar+"</m_nCsvDelimiterChar>";window["AscDesktopEditor"]["SetAdvancedOptions"](_param)}else if(window["Asc"].c_oAscAdvancedOptionsID.DRM===idOption){var _param="<m_sPassword>"+
AscCommon.CopyPasteCorrectString(option.asc_getPassword())+"</m_sPassword>";api.currentPassword=option.asc_getPassword();window["AscDesktopEditor"]["SetAdvancedOptions"](_param)}return true}}AscCommon.EncryptionWorker=new CEncryptionData;function CMouseSmoothWheelCorrector(t,scrollFunction){this._deltaX=0;this._deltaY=0;this._isBreakX=false;this._isBreakY=false;this._timeoutCorrector=-1;this._api=t;this._scrollFunction=scrollFunction;this._normalDelta=120;this._isNormalDeltaActive=false;this.setNormalDeltaActive=
function(value){this._isNormalDeltaActive=true;this._normalDelta=value};this.isBreakX=function(){return this._isBreakX};this.isBreakY=function(){return this._isBreakY};this.get_DeltaX=function(wheelDeltaX){this._isBreakX=false;if(!AscCommon.AscBrowser.isMacOs)return wheelDeltaX;this._deltaX+=wheelDeltaX;if(Math.abs(this._deltaX)>=this._normalDelta)return this._isNormalDeltaActive?this._deltaX>0?this._normalDelta:-this._normalDelta:this._deltaX;this._isBreakX=true;return 0};this.get_DeltaY=function(wheelDeltaY){this._isBreakY=
false;if(!AscCommon.AscBrowser.isMacOs)return wheelDeltaY;this._deltaY+=wheelDeltaY;if(Math.abs(this._deltaY)>=this._normalDelta)return this._isNormalDeltaActive?this._deltaY>0?this._normalDelta:-this._normalDelta:this._deltaY;this._isBreakY=true;return 0};this.checkBreak=function(){if(-1!=this._timeoutCorrector){clearTimeout(this._timeoutCorrector);this._timeoutCorrector=-1}if((this._isBreakX||this._isBreakY)&&this._scrollFunction){var obj={t:this,x:this._isBreakX?this._deltaX:0,y:this._isBreakY?
this._deltaY:0};this._timeoutCorrector=setTimeout(function(){var t=obj.t;t._scrollFunction.call(t._api,obj.x,obj.y);t._timeoutCorrector=-1;t._deltaX=0;t._deltaY=0},100)}if(!this._isBreakX)this._deltaX=0;if(!this._isBreakY)this._deltaY=0;this._isBreakX=false;this._isBreakY=false}}AscCommon.CMouseSmoothWheelCorrector=CMouseSmoothWheelCorrector;function CTranslateManager(){this.mapTranslate={}}CTranslateManager.prototype.init=function(map){this.mapTranslate=map||{}};CTranslateManager.prototype.getValue=
function(key){return this.mapTranslate.hasOwnProperty(key)?this.mapTranslate[key]:key};function CPolygonPoint2(X,Y){this.X=X;this.Y=Y}function CPolygonVectors(){this.Page=-1;this.VX=[];this.VY=[]}function CPolygonPath(precision){this.Page=-1;this.Direction=1;this.precision=precision;this.Points=[]}CPolygonPath.prototype.PushPoint=function(x,y){this.Points.push(new CPolygonPoint2(x/this.precision,y/this.precision))};CPolygonPath.prototype.CorrectExtremePoints=function(){var Lng=this.Points.length;
this.Points[0].X=this.Points[Lng-1].X;this.Points[Lng-1].Y=this.Points[0].Y};function CPolygon(){this.Vectors=[];this.precision=1E3}CPolygon.prototype.fill=function(arrBounds){this.Vectors.length=0;if(arrBounds.length<=0)return;var nStartLineIndex=0,nStartIndex=0,CountLines=arrBounds.length,CountBounds;while(nStartLineIndex<arrBounds.length){CountBounds=arrBounds[nStartLineIndex].length;while(nStartIndex<CountBounds)if(arrBounds[nStartLineIndex][nStartIndex].W<.001)nStartIndex++;else break;if(nStartIndex<
CountBounds)break;nStartLineIndex++;nStartIndex=0}if(nStartLineIndex>=arrBounds.length)return;var CurrentPage=arrBounds[nStartLineIndex][nStartIndex].Page,CurrentVectors=new CPolygonVectors,VectorsX=CurrentVectors.VX,VectorsY=CurrentVectors.VY;CurrentVectors.Page=CurrentPage;this.Vectors.push(CurrentVectors);for(var LineIndex=nStartLineIndex;LineIndex<CountLines;nStartIndex=0,LineIndex++){if(arrBounds[LineIndex][nStartIndex].Page!==CurrentPage){CurrentPage=arrBounds[LineIndex][nStartIndex].Page;CurrentVectors=
new CPolygonVectors;VectorsX=CurrentVectors.VX;VectorsY=CurrentVectors.VY;CurrentVectors.Page=CurrentPage;this.Vectors.push(CurrentVectors)}for(var Index=nStartIndex;Index<arrBounds[LineIndex].length;Index++){var oBound=arrBounds[LineIndex][Index];if(oBound.W<.001)continue;var x1=Math.round(oBound.X*this.precision),x2=Math.round((oBound.X+oBound.W)*this.precision),y1=Math.round(oBound.Y*this.precision),y2=Math.round((oBound.Y+oBound.H)*this.precision);if(VectorsX[y1]==undefined)VectorsX[y1]={};this.IntersectionX(VectorsX,
x2,x1,y1);if(VectorsY[x1]==undefined)VectorsY[x1]={};this.IntersectionY(VectorsY,y1,y2,x1);if(VectorsX[y2]==undefined)VectorsX[y2]={};this.IntersectionX(VectorsX,x1,x2,y2);if(VectorsY[x2]==undefined)VectorsY[x2]={};this.IntersectionY(VectorsY,y2,y1,x2)}}};CPolygon.prototype.IntersectionX=function(VectorsX,BeginX,EndX,Y){var CurrentVector={};CurrentVector[BeginX]=EndX;var VX=VectorsX[Y];if(BeginX>EndX)while(true==this.IntersectVectorX(CurrentVector,VX));else while(true==this.IntersectVectorX(VX,CurrentVector));
for(var X in CurrentVector){var VBeginX=parseInt(X);var VEndX=CurrentVector[VBeginX];if(VBeginX!==VEndX||VX[VBeginX]===undefined)VX[VBeginX]=VEndX}};CPolygon.prototype.IntersectVectorX=function(VectorOpp,VectorClW){for(var X in VectorOpp){var VBeginX=parseInt(X);var VEndX=VectorOpp[VBeginX];if(VEndX==VBeginX)continue;for(var ClwX in VectorClW){var ClwBeginX=parseInt(ClwX);var ClwEndX=VectorClW[ClwBeginX];var bIntersection=false;if(ClwBeginX==ClwEndX)continue;if(ClwBeginX<=VEndX&&VBeginX<=ClwEndX){VectorOpp[VBeginX]=
VBeginX;VectorClW[ClwBeginX]=VEndX;VectorClW[VBeginX]=ClwEndX;bIntersection=true}else if(VEndX<=ClwBeginX&&ClwEndX<=VBeginX){VectorClW[ClwBeginX]=ClwBeginX;VectorOpp[VBeginX]=ClwEndX;VectorOpp[ClwBeginX]=VEndX;bIntersection=true}else if(ClwBeginX<VEndX&&VEndX<ClwEndX){VectorClW[ClwBeginX]=VEndX;VectorOpp[VBeginX]=ClwEndX;bIntersection=true}else if(ClwBeginX<VBeginX&&VBeginX<ClwEndX){VectorOpp[ClwBeginX]=VEndX;VectorClW[VBeginX]=ClwEndX;delete VectorOpp[VBeginX];delete VectorClW[ClwBeginX];bIntersection=
true}if(bIntersection==true)return true}}return false};CPolygon.prototype.IntersectionY=function(VectorsY,BeginY,EndY,X){var bIntersect=false;for(var y in VectorsY[X]){var CurBeginY=parseInt(y);var CurEndY=VectorsY[X][CurBeginY];var minY,maxY;if(CurBeginY<CurEndY){minY=CurBeginY;maxY=CurEndY}else{minY=CurEndY;maxY=CurBeginY}var bInterSection=!(maxY<=BeginY&&maxY<=EndY||minY>=BeginY&&minY>=EndY),bDirection=(CurBeginY-CurEndY)*(BeginY-EndY)<0;if(bInterSection&&bDirection){VectorsY[X][CurBeginY]=EndY;
VectorsY[X][BeginY]=CurEndY;bIntersect=true}}if(bIntersect==false)VectorsY[X][BeginY]=EndY};CPolygon.prototype.GetPaths=function(shift){var Paths=[];shift*=this.precision;for(var PageIndex=0;PageIndex<this.Vectors.length;PageIndex++){var y,x1,x2,x,y1,y2;var VectorsX=this.Vectors[PageIndex].VX,VectorsY=this.Vectors[PageIndex].VY,Page=this.Vectors[PageIndex].Page;for(var LineIndex in VectorsX)for(var Index in VectorsX[LineIndex]){var Polygon=new CPolygonPath(this.precision);Polygon.Page=Page;y=parseInt(LineIndex);
x1=parseInt(Index);x2=VectorsX[y][x1];VectorsX[y][x1]=-1;var Direction=x1>x2?1:-1;var minY=y;var SignRightLeft,SignDownUp;var X,Y;if(x2!==-1){SignRightLeft=x1>x2?1:-1;Y=y-SignRightLeft*shift;Polygon.PushPoint(x1,Y);while(true){x=x2;y1=y;y2=VectorsY[x][y1];if(y2==-1)break;else if(y2==undefined)return[];VectorsY[x][y1]=-1;SignDownUp=y1>y2?1:-1;X=x+SignDownUp*shift;Polygon.PushPoint(X,Y);y=y2;x1=x;x2=VectorsX[y][x1];if(x2==-1)break;else if(x2==undefined)return[];VectorsX[y][x1]=-1;SignRightLeft=x1>x2?
1:-1;Y=y-SignRightLeft*shift;Polygon.PushPoint(X,Y);if(y<minY){minY=y;Direction=x1>x2?1:-1}}Polygon.PushPoint(X,Y);Polygon.CorrectExtremePoints();Polygon.Direction=Direction;Paths.push(Polygon)}}}return Paths};function CMathTrack(){this.MathRect={IsActive:false,Bounds:[],ContentSelection:null};this.MathPolygons=[];this.MathSelectPolygons=[]}CMathTrack.prototype.Update=function(IsActive,IsContentActive,oMath,PixelError){this.MathRect.IsActive=IsActive;if(true===IsActive&&null!==oMath){var selectBounds=
true===IsContentActive?oMath.Get_ContentSelection():null;if(selectBounds!=null){var SelectPolygon=new CPolygon;SelectPolygon.fill(selectBounds);this.MathSelectPolygons=SelectPolygon.GetPaths(0)}else this.MathSelectPolygons.length=0;var arrBounds=oMath.Get_Bounds();if(arrBounds.length<=0)return;var MPolygon=new CPolygon;MPolygon.fill(arrBounds);this.MathPolygons=MPolygon.GetPaths(PixelError)}};CMathTrack.prototype.Draw=function(overlay,oPath,shift,color,dKoefX,dKoefY,left,top){var ctx=overlay.m_oContext;
ctx.strokeStyle=color;ctx.lineWidth=1;ctx.beginPath();var Points=oPath.Points;var nCount=Points.length;var PrevX=Points[nCount-2].X,PrevY=Points[nCount-2].Y;var _x=left+dKoefX*Points[nCount-2].X,_y=top+dKoefY*Points[nCount-2].Y;var StartX,StartY;for(var nIndex=0;nIndex<nCount;nIndex++){if(PrevX>Points[nIndex].X)_y=top+dKoefY*Points[nIndex].Y-shift;else if(PrevX<Points[nIndex].X)_y=top+dKoefY*Points[nIndex].Y+shift;if(PrevY<Points[nIndex].Y)_x=left+dKoefX*Points[nIndex].X-shift;else if(PrevY>Points[nIndex].Y)_x=
left+dKoefX*Points[nIndex].X+shift;PrevX=Points[nIndex].X;PrevY=Points[nIndex].Y;if(nIndex>0){overlay.CheckPoint(_x,_y);if(1==nIndex){StartX=_x;StartY=_y;overlay.m_oContext.moveTo((_x>>0)+.5,(_y>>0)+.5)}else overlay.m_oContext.lineTo((_x>>0)+.5,(_y>>0)+.5)}}overlay.m_oContext.lineTo((StartX>>0)+.5,(StartY>>0)+.5);ctx.closePath();ctx.stroke();ctx.beginPath()};CMathTrack.prototype.DrawWithMatrix=function(overlay,oPath,ShiftX,ShiftY,color,dKoefX,dKoefY,left,top,m){var ctx=overlay.m_oContext;ctx.strokeStyle=
color;ctx.lineWidth=1;ctx.beginPath();var Points=oPath.Points;var nCount=Points.length;var x=Points[nCount-2].X,y=Points[nCount-2].Y;var _x,_y;var PrevX=Points[nCount-2].X,PrevY=Points[nCount-2].Y;var StartX,StartY;for(var nIndex=0;nIndex<nCount;nIndex++){if(PrevX>Points[nIndex].X)y=Points[nIndex].Y-ShiftY;else if(PrevX<Points[nIndex].X)y=Points[nIndex].Y+ShiftY;if(PrevY<Points[nIndex].Y)x=Points[nIndex].X-ShiftX;else if(PrevY>Points[nIndex].Y)x=Points[nIndex].X+ShiftX;PrevX=Points[nIndex].X;PrevY=
Points[nIndex].Y;if(nIndex>0){_x=left+dKoefX*m.TransformPointX(x,y);_y=top+dKoefY*m.TransformPointY(x,y);overlay.CheckPoint(_x,_y);if(1==nIndex){StartX=_x;StartY=_y;overlay.m_oContext.moveTo((_x>>0)+.5,(_y>>0)+.5)}else overlay.m_oContext.lineTo((_x>>0)+.5,(_y>>0)+.5)}}overlay.m_oContext.lineTo((StartX>>0)+.5,(StartY>>0)+.5);ctx.closePath();ctx.stroke();ctx.beginPath()};CMathTrack.prototype.DrawSelectPolygon=function(overlay,oPath,dKoefX,dKoefY,left,top,m){var ctx=overlay.m_oContext;ctx.fillStyle=
"#375082";ctx.beginPath();var Points=oPath.Points;var nPointIndex;var _x,_y,x,y,p;for(nPointIndex=0;nPointIndex<Points.length-1;nPointIndex++){p=Points[nPointIndex];if(!m){_x=left+dKoefX*p.X;_y=top+dKoefY*p.Y}else{x=p.X;y=p.Y;_x=left+dKoefX*m.TransformPointX(x,y);_y=top+dKoefY*m.TransformPointY(x,y)}overlay.CheckPoint(_x,_y);if(0==nPointIndex)ctx.moveTo((_x>>0)+.5,(_y>>0)+.5);else ctx.lineTo((_x>>0)+.5,(_y>>0)+.5)}ctx.globalAlpha=.2;ctx.fill();ctx.globalAlpha=1};CMathTrack.prototype.IsActive=function(){return this.MathRect.IsActive};
CMathTrack.prototype.GetPolygonsCount=function(){return this.MathPolygons.length};CMathTrack.prototype.GetPolygon=function(nIndex){return this.MathPolygons[nIndex]};CMathTrack.prototype.GetSelectPathsCount=function(){return this.MathSelectPolygons.length};CMathTrack.prototype.GetSelectPath=function(nIndex){return this.MathSelectPolygons[nIndex]};if(!Array.prototype.findIndex)Object.defineProperty(Array.prototype,"findIndex",{value:function(predicate){if(this==null)throw new TypeError("Array.prototype.findIndex called on null or undefined");
if(typeof predicate!=="function")throw new TypeError("predicate must be a function");var list=Object(this);var length=list.length>>>0;var thisArg=arguments[1];var value;for(var i=0;i<length;i++){value=list[i];if(predicate.call(thisArg,value,i,list))return i}return-1}});if(!Array.prototype.fill)Object.defineProperty(Array.prototype,"fill",{value:function(value){if(this==null)throw new TypeError("this is null or not defined");var O=Object(this);var len=O.length>>>0;var start=arguments[1];var relativeStart=
start>>0;var k=relativeStart<0?Math.max(len+relativeStart,0):Math.min(relativeStart,len);var end=arguments[2];var relativeEnd=end===undefined?len:end>>0;var final=relativeEnd<0?Math.max(len+relativeEnd,0):Math.min(relativeEnd,len);while(k<final){O[k]=value;k++}return O}});if(typeof Int8Array!=="undefined"&&!Int8Array.prototype.fill)Int8Array.prototype.fill=Array.prototype.fill;if(typeof Uint8Array!=="undefined"&&!Uint8Array.prototype.fill)Uint8Array.prototype.fill=Array.prototype.fill;if(typeof Uint8ClampedArray!==
"undefined"&&!Uint8ClampedArray.prototype.fill)Uint8ClampedArray.prototype.fill=Array.prototype.fill;if(typeof Int16Array!=="undefined"&&!Int16Array.prototype.fill)Int16Array.prototype.fill=Array.prototype.fill;if(typeof Uint16Array!=="undefined"&&!Uint16Array.prototype.fill)Uint16Array.prototype.fill=Array.prototype.fill;if(typeof Int32Array!=="undefined"&&!Int32Array.prototype.fill)Int32Array.prototype.fill=Array.prototype.fill;if(typeof Uint32Array!=="undefined"&&!Uint32Array.prototype.fill)Uint32Array.prototype.fill=
Array.prototype.fill;if(typeof Float32Array!=="undefined"&&!Float32Array.prototype.fill)Float32Array.prototype.fill=Array.prototype.fill;if(typeof Float64Array!=="undefined"&&!Float64Array.prototype.fill)Float64Array.prototype.fill=Array.prototype.fill;if(typeof Uint8Array!=="undefined"&&!Uint8Array.prototype.slice)Uint8Array.prototype.slice=Array.prototype.slice;function parseText(text,options,bTrimSpaces){var delimiterChar;if(options.asc_getDelimiterChar())delimiterChar=options.asc_getDelimiterChar();
else switch(options.asc_getDelimiter()){case AscCommon.c_oAscCsvDelimiter.None:delimiterChar=undefined;break;case AscCommon.c_oAscCsvDelimiter.Tab:delimiterChar="\t";break;case AscCommon.c_oAscCsvDelimiter.Semicolon:delimiterChar=";";break;case AscCommon.c_oAscCsvDelimiter.Colon:delimiterChar=":";break;case AscCommon.c_oAscCsvDelimiter.Comma:delimiterChar=",";break;case AscCommon.c_oAscCsvDelimiter.Space:delimiterChar=" ";break}var matrix=[];var rows=text.split(/\r?\n/);for(var i=0;i<rows.length;++i){var row=
rows[i];if(" "===delimiterChar&&bTrimSpaces){var addSpace=false;if(row[0]===delimiterChar)addSpace=true;row=addSpace?delimiterChar+row.trim():row.trim()}matrix.push(row.split(delimiterChar))}return matrix}function getTimeISO8601(dateStr){if(dateStr)if(dateStr.endsWith("Z"))return Date.parse(dateStr);else return Date.parse(dateStr+"Z");return NaN}function valueToMmType(value){var oVal=parseFloat(value);var oType;if(!isNaN(oVal)){if(-1!==value.indexOf("%")){oType="%";oVal/=100}else if(-1!==value.indexOf("px")){oType=
"px";oVal*=AscCommon.g_dKoef_pix_to_mm}else if(-1!==value.indexOf("in")){oType="in";oVal*=AscCommonWord.g_dKoef_in_to_mm}else if(-1!==value.indexOf("cm")){oType="cm";oVal*=10}else if(-1!==value.indexOf("mm"))oType="mm";else if(-1!==value.indexOf("pt")){oType="pt";oVal*=AscCommonWord.g_dKoef_pt_to_mm}else if(-1!==value.indexOf("pc")){oType="pc";oVal*=AscCommonWord.g_dKoef_pc_to_mm}else oType="none";return{val:oVal,type:oType}}return null}function valueToMm(value){var obj=valueToMmType(value);if(obj&&
"%"!==obj.type&&"none"!==obj.type)return obj.val;return null}function arrayMove(array,from,to){array.splice(to,0,array.splice(from,1)[0])}function getRangeArray(start,stop){var res=new Array(stop-start);for(var i=start;i<stop;++i)res[i-start]=i;return res}var g_oBackoffDefaults={retries:2,factor:2,minTimeout:100,maxTimeout:2E3,randomize:true};function Backoff(opts){this.attempts=0;this.opts=opts}Backoff.prototype.attempt=function(fError,fRetry){var timeout=this.nextTimeout();if(timeout>0)setTimeout(function(){fRetry()},
timeout);else fError()};Backoff.prototype.nextTimeout=function(){var timeout=-1;if(this.attempts<this.opts.retries){timeout=this.createTimeout(this.attempts,this.opts);this.attempts++}return timeout};Backoff.prototype.createTimeout=function(attempt,opts){var random=opts.randomize?Math.random()+1:1;var timeout=Math.round(random*opts.minTimeout*Math.pow(opts.factor,attempt));timeout=Math.min(timeout,opts.maxTimeout);return timeout};function backoffOnError(obj,onError,onRetry){if(!onRetry)return onError;
var backoff=new Backoff(g_oBackoffDefaults);return function(){var timeout=backoff.nextTimeout();if(timeout>0)setTimeout(function(){onRetry.call(obj,obj)},timeout);else if(onError)onError.apply(obj,arguments)}}function backoffOnErrorImg(img,onRetry){if(!onRetry)onRetry=function(img){img.setAttribute("src",img.getAttribute("src"))};img.onerror=backoffOnError(img,img.onerror,onRetry)}function isEmptyObject(obj){for(var name in obj)return false;return true}window["AscCommon"]=window["AscCommon"]||{};
window["AscCommon"].getSockJs=getSockJs;window["AscCommon"].getJSZipUtils=getJSZipUtils;window["AscCommon"].getJSZip=getJSZip;window["AscCommon"].getBaseUrl=getBaseUrl;window["AscCommon"].getEncodingParams=getEncodingParams;window["AscCommon"].getEncodingByBOM=getEncodingByBOM;window["AscCommon"].saveWithParts=saveWithParts;window["AscCommon"].loadFileContent=loadFileContent;window["AscCommon"].getImageFromChanges=getImageFromChanges;window["AscCommon"].openFileCommand=openFileCommand;window["AscCommon"].sendCommand=
sendCommand;window["AscCommon"].sendSaveFile=sendSaveFile;window["AscCommon"].mapAscServerErrorToAscError=mapAscServerErrorToAscError;window["AscCommon"].joinUrls=joinUrls;window["AscCommon"].getFullImageSrc2=getFullImageSrc2;window["AscCommon"].fSortAscending=fSortAscending;window["AscCommon"].fSortDescending=fSortDescending;window["AscCommon"].isLeadingSurrogateChar=isLeadingSurrogateChar;window["AscCommon"].decodeSurrogateChar=decodeSurrogateChar;window["AscCommon"].encodeSurrogateChar=encodeSurrogateChar;
window["AscCommon"].convertUnicodeToUTF16=convertUnicodeToUTF16;window["AscCommon"].convertUTF16toUnicode=convertUTF16toUnicode;window["AscCommon"].build_local_rx=build_local_rx;window["AscCommon"].GetFileName=GetFileName;window["AscCommon"].GetFileExtension=GetFileExtension;window["AscCommon"].changeFileExtention=changeFileExtention;window["AscCommon"].getExtentionByFormat=getExtentionByFormat;window["AscCommon"].InitOnMessage=InitOnMessage;window["AscCommon"].ShowImageFileDialog=ShowImageFileDialog;
window["AscCommon"].ShowDocumentFileDialog=ShowDocumentFileDialog;window["AscCommon"].InitDragAndDrop=InitDragAndDrop;window["AscCommon"].UploadImageFiles=UploadImageFiles;window["AscCommon"].UploadImageUrls=UploadImageUrls;window["AscCommon"].CanDropFiles=CanDropFiles;window["AscCommon"].getUrlType=getUrlType;window["AscCommon"].prepareUrl=prepareUrl;window["AscCommon"].getUserColorById=getUserColorById;window["AscCommon"].isNullOrEmptyString=isNullOrEmptyString;window["AscCommon"].unleakString=
unleakString;window["AscCommon"].readValAttr=readValAttr;window["AscCommon"].getNumFromXml=getNumFromXml;window["AscCommon"].getColorFromXml=getColorFromXml;window["AscCommon"].getBoolFromXml=getBoolFromXml;window["AscCommon"].initStreamFromResponse=initStreamFromResponse;window["AscCommon"].checkStreamSignature=checkStreamSignature;window["AscCommon"].DocumentUrls=DocumentUrls;window["AscCommon"].OpenFileResult=OpenFileResult;window["AscCommon"].CLock=CLock;window["AscCommon"].CContentChanges=CContentChanges;
window["AscCommon"].CContentChangesElement=CContentChangesElement;window["AscCommon"].CorrectMMToTwips=CorrectMMToTwips;window["AscCommon"].TwipsToMM=TwipsToMM;window["AscCommon"].MMToTwips=MMToTwips;window["AscCommon"].RomanToInt=RomanToInt;window["AscCommon"].LatinNumberingToInt=LatinNumberingToInt;window["AscCommon"].IntToNumberFormat=IntToNumberFormat;window["AscCommon"].IsSpace=IsSpace;window["AscCommon"].loadSdk=loadSdk;window["AscCommon"].loadScript=loadScript;window["AscCommon"].getAltGr=
getAltGr;window["AscCommon"].getColorSchemeByName=getColorSchemeByName;window["AscCommon"].getColorSchemeByIdx=getColorSchemeByIdx;window["AscCommon"].getAscColorScheme=getAscColorScheme;window["AscCommon"].checkAddColorScheme=checkAddColorScheme;window["AscCommon"].getIndexColorSchemeInArray=getIndexColorSchemeInArray;window["AscCommon"].isEastAsianScript=isEastAsianScript;window["AscCommon"].CMathTrack=CMathTrack;window["AscCommon"].CPolygon=CPolygon;window["AscCommon"].JSZipWrapper=JSZipWrapper;
window["AscCommon"].g_oDocumentUrls=g_oDocumentUrls;window["AscCommon"].FormulaTablePartInfo=FormulaTablePartInfo;window["AscCommon"].cBoolLocal=cBoolLocal;window["AscCommon"].cErrorOrigin=cErrorOrigin;window["AscCommon"].cErrorLocal=cErrorLocal;window["AscCommon"].FormulaSeparators=FormulaSeparators;window["AscCommon"].rx_space_g=rx_space_g;window["AscCommon"].rx_space=rx_space;window["AscCommon"].rx_defName=rx_defName;window["AscCommon"].kCurFormatPainterWord=kCurFormatPainterWord;window["AscCommon"].parserHelp=
parserHelp;window["AscCommon"].g_oIdCounter=g_oIdCounter;window["AscCommon"].g_oHtmlCursor=g_oHtmlCursor;window["AscCommon"].g_oBackoffDefaults=g_oBackoffDefaults;window["AscCommon"].Backoff=Backoff;window["AscCommon"].backoffOnErrorImg=backoffOnErrorImg;window["AscCommon"].isEmptyObject=isEmptyObject;window["AscCommon"].CSignatureDrawer=window["AscCommon"]["CSignatureDrawer"]=CSignatureDrawer;var prot=CSignatureDrawer.prototype;prot["getImages"]=prot.getImages;prot["setText"]=prot.setText;prot["selectImage"]=
prot.selectImage;prot["isValid"]=prot.isValid;prot["destroy"]=prot.destroy;window["AscCommon"].translateManager=new CTranslateManager;window["AscCommon"].parseText=parseText;window["AscCommon"].getTimeISO8601=getTimeISO8601;window["AscCommon"].valueToMm=valueToMm;window["AscCommon"].valueToMmType=valueToMmType;window["AscCommon"].arrayMove=arrayMove;window["AscCommon"].getRangeArray=getRangeArray;window["AscCommon"].CUnicodeStringEmulator=CUnicodeStringEmulator;window["AscCommon"].private_IsAbbreviation=
private_IsAbbreviation;window["AscCommon"].rx_test_ws_name=rx_test_ws_name;window["AscCommon"].CShortcuts=window["AscCommon"]["CShortcuts"]=CShortcuts;prot=CShortcuts.prototype;prot["Add"]=prot.Add;prot["Get"]=prot.Get;prot["CheckType"]=prot.CheckType;prot["Remove"]=prot.Remove;prot["RemoveByType"]=prot.RemoveByType;prot["GetNewCustomType"]=prot.GetNewCustomType;prot["IsCustomType"]=prot.IsCustomType;prot["GetCustomAction"]=prot.GetCustomAction;prot["AddCustomActionSymbol"]=prot.AddCustomActionSymbol;
window["AscCommon"].CCustomShortcutActionSymbol=window["AscCommon"]["CCustomShortcutActionSymbol"]=CCustomShortcutActionSymbol})(window);
window["asc_initAdvancedOptions"]=function(_code,_file_hash,_docInfo){if(window.isNativeOpenPassword)return window["NativeFileOpen_error"](window.isNativeOpenPassword,_file_hash,_docInfo);var _editor=window["Asc"]["editor"]?window["Asc"]["editor"]:window.editor;if(_code==90||_code==91){if(window["AscDesktopEditor"]&&0!==window["AscDesktopEditor"]["CryptoMode"]&&!_editor.isLoadFullApi){_editor.asc_initAdvancedOptions_params=[];_editor.asc_initAdvancedOptions_params.push(_code);_editor.asc_initAdvancedOptions_params.push(_file_hash);
_editor.asc_initAdvancedOptions_params.push(_docInfo);return}if(AscCommon.EncryptionWorker.isNeedCrypt()&&!window.checkPasswordFromPlugin){window.checkPasswordFromPlugin=true;window.g_asc_plugins.sendToEncryption({"type":"getPasswordByFile","hash":_file_hash,"docinfo":_docInfo});return}}window.checkPasswordFromPlugin=false;_editor._onNeedParams(undefined,_code==90||_code==91?true:undefined)};
window["asc_IsNeedBuildCryptedFile"]=function(){if(!window["AscDesktopEditor"]||!window["AscDesktopEditor"]["CryptoMode"])return false;var _api=window["Asc"]["editor"]?window["Asc"]["editor"]:window.editor;var _returnValue=false;var _users=null;if(_api.CoAuthoringApi&&_api.CoAuthoringApi._CoAuthoringApi&&_api.CoAuthoringApi._CoAuthoringApi._participants)_users=_api.CoAuthoringApi._CoAuthoringApi._participants;var _usersCount=0;for(var _user in _users)_usersCount++;var isOne=1>=_usersCount?true:false;

@ -8371,18 +8371,18 @@ function(font_index,stream_index){this.embeddedFontFiles[font_index].SetStreamIn
false;var oThis=this;if(window["AscDesktopEditor"]&&window["AscDesktopEditor"]["IsLocalFile"]&&window["AscDesktopEditor"]["isBlockchainSupport"]){this.isBlockchainSupport=window["AscDesktopEditor"]["isBlockchainSupport"]()&&!window["AscDesktopEditor"]["IsLocalFile"]();if(this.isBlockchainSupport){Image.prototype.preload_crypto=function(_url){window["crypto_images_map"]=window["crypto_images_map"]||{};if(!window["crypto_images_map"][_url])window["crypto_images_map"][_url]=[];window["crypto_images_map"][_url].push(this);
window["AscDesktopEditor"]["PreloadCryptoImage"](_url,AscCommon.g_oDocumentUrls.getLocal(_url));oThis.Api.sync_StartAction(Asc.c_oAscAsyncActionType.BlockInteraction,Asc.c_oAscAsyncAction.LoadImage)};Image.prototype["onload_crypto"]=function(_src,_crypto_data){if(_crypto_data&&AscCommon.EncryptionWorker&&AscCommon.EncryptionWorker.isCryptoImages()){AscCommon.EncryptionWorker.decryptImage(_src,this,_crypto_data);return}this.crossOrigin="";this.src=_src;oThis.Api.sync_EndAction(Asc.c_oAscAsyncActionType.BlockInteraction,
Asc.c_oAscAsyncAction.LoadImage)}}}this.put_Api=function(_api){this.Api=_api;if(this.Api.IsAsyncOpenDocumentImages!==undefined){this.bIsAsyncLoadDocumentImages=this.Api.IsAsyncOpenDocumentImages();if(this.bIsAsyncLoadDocumentImages)if(undefined===this.Api.asyncImageEndLoadedBackground)this.bIsAsyncLoadDocumentImages=false}};this.LoadDocumentImagesCallback=function(){if(this.ThemeLoader==null)this.Api.asyncImagesDocumentEndLoaded();else this.ThemeLoader.asyncImagesEndLoaded()};this.LoadDocumentImages=
function(_images){if(this.ThemeLoader==null)this.Api.asyncImagesDocumentStartLoaded();else this.ThemeLoader.asyncImagesStartLoaded();this.images_loading=[];for(var id in _images)this.images_loading[this.images_loading.length]=AscCommon.getFullImageSrc2(_images[id]);if(!this.bIsAsyncLoadDocumentImages){this.nNoByOrderCounter=0;this._LoadImages()}else{var _len=this.images_loading.length;for(var i=0;i<_len;i++)this.LoadImageAsync(i);this.images_loading.splice(0,_len);var that=this;setTimeout(function(){that.LoadDocumentImagesCallback()},
3E3)}};this.loadImageByUrl=function(_image,_url){if(this.isBlockchainSupport)_image.preload_crypto(_url);else _image.src=_url};this._LoadImages=function(){var _count_images=this.images_loading.length;if(0==_count_images){this.nNoByOrderCounter=0;if(this.ThemeLoader==null)this.Api.asyncImagesDocumentEndLoaded();else this.ThemeLoader.asyncImagesEndLoaded();return}for(var i=0;i<_count_images;i++){var _id=this.images_loading[i];var oImage=new CImage(_id);oImage.Status=ImageLoadStatus.Loading;oImage.Image=
new Image;oThis.map_image_index[oImage.src]=oImage;oImage.Image.parentImage=oImage;oImage.Image.onload=function(){this.parentImage.Status=ImageLoadStatus.Complete;oThis.nNoByOrderCounter++;if(oThis.bIsLoadDocumentFirst===true){oThis.Api.OpenDocumentProgress.CurrentImage++;oThis.Api.SendOpenProgress()}if(!oThis.bIsLoadDocumentImagesNoByOrder){oThis.images_loading.shift();oThis._LoadImages()}else if(oThis.nNoByOrderCounter==oThis.images_loading.length){oThis.images_loading=[];oThis._LoadImages()}};
oImage.Image.onerror=function(){this.parentImage.Status=ImageLoadStatus.Complete;this.parentImage.Image=null;oThis.nNoByOrderCounter++;if(oThis.bIsLoadDocumentFirst===true){oThis.Api.OpenDocumentProgress.CurrentImage++;oThis.Api.SendOpenProgress()}if(!oThis.bIsLoadDocumentImagesNoByOrder){oThis.images_loading.shift();oThis._LoadImages()}else if(oThis.nNoByOrderCounter==oThis.images_loading.length){oThis.images_loading=[];oThis._LoadImages()}};AscCommon.backoffOnErrorImg(oImage.Image,function(img){oThis.loadImageByUrl(img,
img.src)});oThis.loadImageByUrl(oImage.Image,oImage.src);if(!oThis.bIsLoadDocumentImagesNoByOrder)return}};this.LoadImage=function(src,Type){var _image=this.map_image_index[src];if(undefined!=_image)return _image;this.Api.asyncImageStartLoaded();var oImage=new CImage(src);oImage.Type=Type;oImage.Image=new Image;oImage.Status=ImageLoadStatus.Loading;oThis.map_image_index[oImage.src]=oImage;oImage.Image.onload=function(){oImage.Status=ImageLoadStatus.Complete;oThis.Api.asyncImageEndLoaded(oImage)};
oImage.Image.onerror=function(){oImage.Image=null;oImage.Status=ImageLoadStatus.Complete;oThis.Api.asyncImageEndLoaded(oImage)};AscCommon.backoffOnErrorImg(oImage.Image,function(img){oThis.loadImageByUrl(img,img.src)});this.loadImageByUrl(oImage.Image,oImage.src);return null};this.LoadImageAsync=function(i){var _id=oThis.images_loading[i];var oImage=new CImage(_id);oImage.Status=ImageLoadStatus.Loading;oImage.Image=new Image;oThis.map_image_index[oImage.src]=oImage;var oThat=oThis;oImage.Image.onload=
function(){oImage.Status=ImageLoadStatus.Complete;oThat.Api.asyncImageEndLoadedBackground(oImage)};oImage.Image.onerror=function(){oImage.Status=ImageLoadStatus.Complete;oImage.Image=null;oThat.Api.asyncImageEndLoadedBackground(oImage)};AscCommon.backoffOnErrorImg(oImage.Image,function(img){oThis.loadImageByUrl(img,img.src)});console.log("Loading image "+i);console.log(oImage);window.parent.APP.getImageURL(oImage.src,function(url){if(url=="")oThis.loadImageByUrl(oImage.Image,oImage.src);else{oThis.loadImageByUrl(oImage.Image,
url);oThis.map_image_index[url]=oImage}})};this.LoadImagesWithCallback=function(arr,loadImageCallBack,loadImageCallBackArgs){var arrAsync=[];var i=0;for(i=0;i<arr.length;i++)if(this.map_image_index[arr[i]]===undefined)arrAsync.push(arr[i]);if(arrAsync.length==0){loadImageCallBack.call(this.Api,loadImageCallBackArgs);return}this.loadImageCallBackCounter=0;this.loadImageCallBackCounterMax=arrAsync.length;this.loadImageCallBack=loadImageCallBack;this.loadImageCallBackArgs=loadImageCallBackArgs;for(i=
0;i<arrAsync.length;i++){var oImage=new CImage(arrAsync[i]);oImage.Image=new Image;oImage.Image.parentImage=oImage;oImage.Status=ImageLoadStatus.Loading;this.map_image_index[oImage.src]=oImage;oImage.Image.onload=function(){this.parentImage.Status=ImageLoadStatus.Complete;oThis.loadImageCallBackCounter++;if(oThis.loadImageCallBackCounter==oThis.loadImageCallBackCounterMax)oThis.LoadImagesWithCallbackEnd()};oImage.Image.onerror=function(){this.parentImage.Image=null;this.parentImage.Status=ImageLoadStatus.Complete;
oThis.loadImageCallBackCounter++;if(oThis.loadImageCallBackCounter==oThis.loadImageCallBackCounterMax)oThis.LoadImagesWithCallbackEnd()};AscCommon.backoffOnErrorImg(oImage.Image,function(img){oThis.loadImageByUrl(img,img.src)});this.loadImageByUrl(oImage.Image,oImage.src)}};this.LoadImagesWithCallbackEnd=function(){this.loadImageCallBack.call(this.Api,this.loadImageCallBackArgs);this.loadImageCallBack=null;this.loadImageCallBackArgs=null;this.loadImageCallBackCounterMax=0;this.loadImageCallBackCounter=
0}}var g_flow_anchor=new Image;g_flow_anchor.asc_complete=false;g_flow_anchor.onload=function(){g_flow_anchor.asc_complete=true};g_flow_anchor.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAAPBAMAAADNDVhEAAAAIVBMVEUAAAANDQ0NDQ0NDQ0NDQ0NDQ0AAAANDQ0NDQ0NDQ0NDQ1jk7YPAAAACnRSTlMAGkD4mb9c5s9TDghpXQAAAFZJREFUCNdjYGBgW8YABlxcIBLBZ1gAEfZa5QWiGRkWMAIpAaA4iHQE0YwODEtANMsChkIwv4BBWQBICyswMC1iWADEDAzKoUuDFUAGNC9uABvIaQkkABpxD6lFb9lRAAAAAElFTkSuQmCC";var g_flow_anchor2=new Image;g_flow_anchor2.asc_complete=
false;g_flow_anchor2.onload=function(){g_flow_anchor2.asc_complete=true};g_flow_anchor2.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABoAAAAeCAMAAAAFBf7qAAAAOVBMVEUAAAAAAAAAAAAAAAAJCQkAAAAJCQkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJCQknI0ZQAAAAEnRSTlMAx9ITlAfyPHxn68yecTAl5qt6y0BvAAAAt0lEQVQoz8WS0QrDIAxFk0ajtlXb+/8fuzAprltg7Gnn4aIcvAgJTSSoBiGPoIAGV60qoquvIIL110IJgPONmKIlMI73MiwGRoZvahbKVSizcDKU8QeVPDXEIr6ShVB9VUEn2FOMkwL8VwjUtuypvDWiHeVTFeyWkZHfVQZHGm4XMhKQyJB9GKMxuHQSBlioF7u2q7kzgO2AcWwW3F8mWRmGKgyu91mK1Tzh4ixVVkBzJI/EnGjyACbfCaO3eIWRAAAAAElFTkSuQmCC";
function(_images){if(this.ThemeLoader==null)this.Api.asyncImagesDocumentStartLoaded();else this.ThemeLoader.asyncImagesStartLoaded();this.images_loading=[];for(var id in _images)this.images_loading[this.images_loading.length]=AscCommon.getFullImageSrc2(_images[id]);if(!this.bIsAsyncLoadDocumentImages){this.nNoByOrderCounter=0;this._LoadImages()}else{var _len=this.images_loading.length;if(_len===0)return void this.LoadDocumentImagesCallback();var todo=_len;var that=this;var done=function(){todo--;
if(todo===0){that.images_loading.splice(0,_len);setTimeout(function(){that.LoadDocumentImagesCallback()},100);done=function(){}}};for(var i=0;i<_len;i++)this.LoadImageAsync(i,done);return;this.images_loading.splice(0,_len);var that=this;setTimeout(function(){that.LoadDocumentImagesCallback()},3E3)}};this.loadImageByUrl=function(_image,_url){if(this.isBlockchainSupport)_image.preload_crypto(_url);else _image.src=_url};this._LoadImages=function(){var _count_images=this.images_loading.length;if(0==_count_images){this.nNoByOrderCounter=
0;if(this.ThemeLoader==null)this.Api.asyncImagesDocumentEndLoaded();else this.ThemeLoader.asyncImagesEndLoaded();return}for(var i=0;i<_count_images;i++){var _id=this.images_loading[i];var oImage=new CImage(_id);oImage.Status=ImageLoadStatus.Loading;oImage.Image=new Image;oThis.map_image_index[oImage.src]=oImage;oImage.Image.parentImage=oImage;oImage.Image.onload=function(){this.parentImage.Status=ImageLoadStatus.Complete;oThis.nNoByOrderCounter++;if(oThis.bIsLoadDocumentFirst===true){oThis.Api.OpenDocumentProgress.CurrentImage++;
oThis.Api.SendOpenProgress()}if(!oThis.bIsLoadDocumentImagesNoByOrder){oThis.images_loading.shift();oThis._LoadImages()}else if(oThis.nNoByOrderCounter==oThis.images_loading.length){oThis.images_loading=[];oThis._LoadImages()}};oImage.Image.onerror=function(){this.parentImage.Status=ImageLoadStatus.Complete;this.parentImage.Image=null;oThis.nNoByOrderCounter++;if(oThis.bIsLoadDocumentFirst===true){oThis.Api.OpenDocumentProgress.CurrentImage++;oThis.Api.SendOpenProgress()}if(!oThis.bIsLoadDocumentImagesNoByOrder){oThis.images_loading.shift();
oThis._LoadImages()}else if(oThis.nNoByOrderCounter==oThis.images_loading.length){oThis.images_loading=[];oThis._LoadImages()}};AscCommon.backoffOnErrorImg(oImage.Image,function(img){oThis.loadImageByUrl(img,img.src)});oThis.loadImageByUrl(oImage.Image,oImage.src);if(!oThis.bIsLoadDocumentImagesNoByOrder)return}};this.LoadImage=function(src,Type){var _image=this.map_image_index[src];if(undefined!=_image)return _image;this.Api.asyncImageStartLoaded();var oImage=new CImage(src);oImage.Type=Type;oImage.Image=
new Image;oImage.Status=ImageLoadStatus.Loading;oThis.map_image_index[oImage.src]=oImage;oImage.Image.onload=function(){oImage.Status=ImageLoadStatus.Complete;oThis.Api.asyncImageEndLoaded(oImage)};oImage.Image.onerror=function(){oImage.Image=null;oImage.Status=ImageLoadStatus.Complete;oThis.Api.asyncImageEndLoaded(oImage)};AscCommon.backoffOnErrorImg(oImage.Image,function(img){oThis.loadImageByUrl(img,img.src)});this.loadImageByUrl(oImage.Image,oImage.src);return null};this.LoadImageAsync=function(i,
cb){var _id=oThis.images_loading[i];var oImage=new CImage(_id);oImage.Status=ImageLoadStatus.Loading;oImage.Image=new Image;oThis.map_image_index[oImage.src]=oImage;var oThat=oThis;oImage.Image.onload=function(){oImage.Status=ImageLoadStatus.Complete;oThat.Api.asyncImageEndLoadedBackground(oImage)};oImage.Image.onerror=function(){oImage.Status=ImageLoadStatus.Complete;oImage.Image=null;oThat.Api.asyncImageEndLoadedBackground(oImage)};AscCommon.backoffOnErrorImg(oImage.Image,function(img){oThis.loadImageByUrl(img,
img.src)});console.log("Loading image "+i);console.log(oImage);window.parent.APP.getImageURL(oImage.src,function(url){if(url=="")oThis.loadImageByUrl(oImage.Image,oImage.src);else{oThis.loadImageByUrl(oImage.Image,url);oThis.map_image_index[url]=oImage}if(typeof cb==="function")cb()})};this.LoadImagesWithCallback=function(arr,loadImageCallBack,loadImageCallBackArgs){var arrAsync=[];var i=0;for(i=0;i<arr.length;i++)if(this.map_image_index[arr[i]]===undefined)arrAsync.push(arr[i]);if(arrAsync.length==
0){loadImageCallBack.call(this.Api,loadImageCallBackArgs);return}this.loadImageCallBackCounter=0;this.loadImageCallBackCounterMax=arrAsync.length;this.loadImageCallBack=loadImageCallBack;this.loadImageCallBackArgs=loadImageCallBackArgs;for(i=0;i<arrAsync.length;i++){var oImage=new CImage(arrAsync[i]);oImage.Image=new Image;oImage.Image.parentImage=oImage;oImage.Status=ImageLoadStatus.Loading;this.map_image_index[oImage.src]=oImage;oImage.Image.onload=function(){this.parentImage.Status=ImageLoadStatus.Complete;
oThis.loadImageCallBackCounter++;if(oThis.loadImageCallBackCounter==oThis.loadImageCallBackCounterMax)oThis.LoadImagesWithCallbackEnd()};oImage.Image.onerror=function(){this.parentImage.Image=null;this.parentImage.Status=ImageLoadStatus.Complete;oThis.loadImageCallBackCounter++;if(oThis.loadImageCallBackCounter==oThis.loadImageCallBackCounterMax)oThis.LoadImagesWithCallbackEnd()};AscCommon.backoffOnErrorImg(oImage.Image,function(img){oThis.loadImageByUrl(img,img.src)});this.loadImageByUrl(oImage.Image,
oImage.src)}};this.LoadImagesWithCallbackEnd=function(){this.loadImageCallBack.call(this.Api,this.loadImageCallBackArgs);this.loadImageCallBack=null;this.loadImageCallBackArgs=null;this.loadImageCallBackCounterMax=0;this.loadImageCallBackCounter=0}}var g_flow_anchor=new Image;g_flow_anchor.asc_complete=false;g_flow_anchor.onload=function(){g_flow_anchor.asc_complete=true};g_flow_anchor.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAAPBAMAAADNDVhEAAAAIVBMVEUAAAANDQ0NDQ0NDQ0NDQ0NDQ0AAAANDQ0NDQ0NDQ0NDQ1jk7YPAAAACnRSTlMAGkD4mb9c5s9TDghpXQAAAFZJREFUCNdjYGBgW8YABlxcIBLBZ1gAEfZa5QWiGRkWMAIpAaA4iHQE0YwODEtANMsChkIwv4BBWQBICyswMC1iWADEDAzKoUuDFUAGNC9uABvIaQkkABpxD6lFb9lRAAAAAElFTkSuQmCC";
var g_flow_anchor2=new Image;g_flow_anchor2.asc_complete=false;g_flow_anchor2.onload=function(){g_flow_anchor2.asc_complete=true};g_flow_anchor2.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABoAAAAeCAMAAAAFBf7qAAAAOVBMVEUAAAAAAAAAAAAAAAAJCQkAAAAJCQkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJCQknI0ZQAAAAEnRSTlMAx9ITlAfyPHxn68yecTAl5qt6y0BvAAAAt0lEQVQoz8WS0QrDIAxFk0ajtlXb+/8fuzAprltg7Gnn4aIcvAgJTSSoBiGPoIAGV60qoquvIIL110IJgPONmKIlMI73MiwGRoZvahbKVSizcDKU8QeVPDXEIr6ShVB9VUEn2FOMkwL8VwjUtuypvDWiHeVTFeyWkZHfVQZHGm4XMhKQyJB9GKMxuHQSBlioF7u2q7kzgO2AcWwW3F8mWRmGKgyu91mK1Tzh4ixVVkBzJI/EnGjyACbfCaO3eIWRAAAAAElFTkSuQmCC";
window["AscCommon"]=window["AscCommon"]||{};window["AscCommon"].g_font_loader=new CGlobalFontLoader;window["AscCommon"].g_image_loader=new CGlobalImageLoader;window["AscCommon"].g_flow_anchor=g_flow_anchor;window["AscCommon"].g_flow_anchor2=g_flow_anchor2})(window,window.document);"use strict";(function(window,undefined){var g_dKoef_mm_to_pix=AscCommon.g_dKoef_mm_to_pix;function CBounds(){this.L=0;this.T=0;this.R=0;this.B=0;this.isAbsL=false;this.isAbsT=false;this.isAbsR=false;this.isAbsB=false;this.AbsW=
-1;this.AbsH=-1;this.SetParams=function(_l,_t,_r,_b,abs_l,abs_t,abs_r,abs_b,absW,absH){this.L=_l;this.T=_t;this.R=_r;this.B=_b;this.isAbsL=abs_l;this.isAbsT=abs_t;this.isAbsR=abs_r;this.isAbsB=abs_b;this.AbsW=absW;this.AbsH=absH}}function CAbsolutePosition(){this.L=0;this.T=0;this.R=0;this.B=0}var g_anchor_left=1;var g_anchor_top=2;var g_anchor_right=4;var g_anchor_bottom=8;function CControl(){this.Bounds=new CBounds;this.Anchor=g_anchor_left|g_anchor_top;this.Name=null;this.Parent=null;this.TabIndex=
null;this.HtmlElement=null;this.AbsolutePosition=new CBounds;this.Resize=function(_width,_height,api){if(null==this.Parent||null==this.HtmlElement)return;var _x=0;var _y=0;var _r=0;var _b=0;var hor_anchor=this.Anchor&5;var ver_anchor=this.Anchor&10;if(g_anchor_left==hor_anchor){if(this.Bounds.isAbsL)_x=this.Bounds.L;else _x=this.Bounds.L*_width/1E3;if(-1!=this.Bounds.AbsW)_r=_x+this.Bounds.AbsW;else if(this.Bounds.isAbsR)_r=_width-this.Bounds.R;else _r=this.Bounds.R*_width/1E3}else if(g_anchor_right==
@ -14733,59 +14733,59 @@ this.CheckFootnote(X,Y,CurPage);if(isInText&&null!=oHyperlink&&(Y<=this.Pages[Cu
Asc.c_oAscMouseMoveDataTypes.Common;if(isInText&&(null!=oHyperlink||bPageRefLink)&&true===AscCommon.global_keyboardEvent.CtrlKey)this.DrawingDocument.SetCursorType("pointer",MMData);else this.DrawingDocument.SetCursorType("text",MMData);var Bounds=this.Pages[CurPage].Bounds;if(true===this.Lock.Is_Locked()&&X<Bounds.Right&&X>Bounds.Left&&Y>Bounds.Top&&Y<Bounds.Bottom&&this.LogicDocument&&!this.LogicDocument.IsViewModeInReview()){var _X=this.Pages[CurPage].X;var _Y=this.Pages[CurPage].Y;var MMData=
new AscCommon.CMouseMoveData;var Coords=this.DrawingDocument.ConvertCoordsToCursorWR(_X,_Y,this.Get_AbsolutePage(CurPage),text_transform);MMData.X_abs=Coords.X-5;MMData.Y_abs=Coords.Y;MMData.Type=Asc.c_oAscMouseMoveDataTypes.LockedObject;MMData.UserId=this.Lock.Get_UserId();MMData.HaveChanges=this.Lock.Have_Changes();MMData.LockedObjectType=c_oAscMouseMoveLockedObjectType.Common;editor.sync_MouseMoveCallback(MMData)}};Paragraph.prototype.Document_CreateFontMap=function(FontMap){if(true===this.FontMap.NeedRecalc){this.FontMap.Map=
{};this.private_CompileParaPr();var FontScheme=this.Get_Theme().themeElements.fontScheme;var CurTextPr=this.CompiledPr.Pr.TextPr.Copy();CurTextPr.Document_CreateFontMap(this.FontMap.Map,FontScheme);CurTextPr.Merge(this.TextPr.Value);CurTextPr.Document_CreateFontMap(this.FontMap.Map,FontScheme);var Count=this.Content.length;for(var Index=0;Index<Count;Index++)this.Content[Index].Create_FontMap(this.FontMap.Map);this.FontMap.NeedRecalc=false}for(var Key in this.FontMap.Map)FontMap[Key]=this.FontMap.Map[Key]};
Paragraph.prototype.Document_CreateFontCharMap=function(FontCharMap){};Paragraph.prototype.Document_Get_AllFontNames=function(AllFonts){this.TextPr.Value.Document_Get_AllFontNames(AllFonts);if(this.Pr.Bullet)this.Pr.Bullet.Get_AllFontNames(AllFonts);if(this.Pr.DefaultRunPr)this.Pr.DefaultRunPr.Document_Get_AllFontNames(AllFonts);var Count=this.Content.length;for(var Index=0;Index<Count;Index++)this.Content[Index].Get_AllFontNames(AllFonts)};Paragraph.prototype.Document_UpdateRulersState=function(){if(this.CalculatedFrame){var oFrame=
this.CalculatedFrame;this.Parent.DrawingDocument.Set_RulerState_Paragraph({L:oFrame.L2,T:oFrame.T2,R:oFrame.L2+oFrame.W2,B:oFrame.T2+oFrame.H2,PageIndex:this.GetStartPageAbsolute(),Frame:this},false)}else if(this.Parent instanceof CDocument)if(this.LogicDocument)this.LogicDocument.Document_UpdateRulersStateBySection()};Paragraph.prototype.Document_UpdateInterfaceState=function(){var StartPos,EndPos;if(true===this.Selection.Use){StartPos=this.Get_ParaContentPos(true,true);EndPos=this.Get_ParaContentPos(true,
false)}else{var CurPos=this.Get_ParaContentPos(false,false);StartPos=CurPos;EndPos=CurPos}if(this.LogicDocument&&true===this.LogicDocument.Spelling.Use&&(selectionflag_Numbering!==this.Selection.Flag&&selectionflag_NumberingCur!==this.Selection.Flag))this.SpellChecker.Document_UpdateInterfaceState(StartPos,EndPos);if(true===this.Selection.Use){var StartPos=this.Selection.StartPos;var EndPos=this.Selection.EndPos;if(StartPos>EndPos){StartPos=this.Selection.EndPos;EndPos=this.Selection.StartPos}for(var CurPos=
StartPos;CurPos<=EndPos;CurPos++){var Element=this.Content[CurPos];if(true!==Element.IsSelectionEmpty()&&Element.Document_UpdateInterfaceState)Element.Document_UpdateInterfaceState()}}else{var CurType=this.Content[this.CurPos.ContentPos].Type;if(this.Content[this.CurPos.ContentPos].Document_UpdateInterfaceState)this.Content[this.CurPos.ContentPos].Document_UpdateInterfaceState()}var arrComplexFields=this.GetCurrentComplexFields();for(var nIndex=0,nCount=arrComplexFields.length;nIndex<nCount;++nIndex){var oInstruction=
arrComplexFields[nIndex].GetInstruction();if(oInstruction&&fieldtype_HYPERLINK===oInstruction.GetType()){var oHyperProps=new Asc.CHyperlinkProperty;oHyperProps.put_ToolTip(oInstruction.GetToolTip());oHyperProps.put_Value(oInstruction.GetValue());oHyperProps.put_Text(this.LogicDocument?this.LogicDocument.GetComplexFieldTextValue(arrComplexFields[nIndex]):null);oHyperProps.put_InternalHyperlink(oInstruction);editor.sync_HyperlinkPropCallback(oHyperProps)}}if(editor&&this.bFromDocument){if(!this.LogicDocument)return;
var TrackManager=this.LogicDocument.GetTrackRevisionsManager();if(this.Pages.length<=0&&this.Lines.length<=0)return;var ContentPos=this.Get_ParaContentPos(this.Selection.Use,true);var ParaPos=this.Get_ParaPosByContentPos(ContentPos);if(this.Pages.length<=ParaPos.Page||this.Lines.length<=ParaPos.Line)return;var Page_abs=this.Get_AbsolutePage(ParaPos.Page);var _Y=this.Pages[ParaPos.Page].Y+this.Lines[ParaPos.Line].Top;var TextTransform=this.Get_ParentTextTransform();var _X=this.LogicDocument?this.LogicDocument.Get_PageLimits(Page_abs).XLimit:
0;var Coords=this.DrawingDocument.ConvertCoordsToCursorWR(_X,_Y,Page_abs,TextTransform);if(false===this.Selection.Use){var Changes=TrackManager.GetElementChanges(this.GetId());if(Changes.length>0)for(var ChangeIndex=0,ChangesCount=Changes.length;ChangeIndex<ChangesCount;ChangeIndex++){var Change=Changes[ChangeIndex];var Type=Change.get_Type();if(c_oAscRevisionsChangeType.TextAdd!==Type&&c_oAscRevisionsChangeType.TextRem!==Type&&c_oAscRevisionsChangeType.TextPr!==Type||StartPos.Compare(Change.get_StartPos())>=
0&&StartPos.Compare(Change.get_EndPos())<=0){Change.put_InternalPos(_X,_Y,Page_abs);TrackManager.AddVisibleChange(Change)}}}}};Paragraph.prototype.PreDelete=function(){for(var Index=0;Index<this.Content.length;Index++){var Item=this.Content[Index];if(Item.PreDelete)Item.PreDelete();if(this.LogicDocument)if(para_Comment===Item.Type&&true===this.LogicDocument.RemoveCommentsOnPreDelete)this.LogicDocument.RemoveComment(Item.CommentId,true,false);else if(para_Bookmark===Item.Type)this.LogicDocument.GetBookmarksManager().SetNeedUpdate(true)}this.RemoveSelection();
this.UpdateDocumentOutline();if(undefined!==this.Get_SectionPr()&&this.LogicDocument)this.Set_SectionPr(undefined)};Paragraph.prototype.Document_SetThisElementCurrent=function(bUpdateStates){this.Parent.Update_ContentIndexing();this.Parent.Set_CurrentElement(this.Index,bUpdateStates)};Paragraph.prototype.Is_ThisElementCurrent=function(){var Parent=this.Parent;Parent.Update_ContentIndexing();if(docpostype_Content===Parent.GetDocPosType()&&false===Parent.Selection.Use&&this.Index===Parent.CurPos.ContentPos&&
Parent.Content[this.Index]===this)return this.Parent.Is_ThisElementCurrent();return false};Paragraph.prototype.Is_Inline=function(){if(this.bFromDocument===false)return true;var PrevElement=this.Get_DocumentPrev();if(true===this.Is_Empty()&&undefined!==this.Get_SectionPr()&&null!==PrevElement&&(type_Paragraph!==PrevElement.Get_Type()||undefined===PrevElement.Get_SectionPr()))return true;if(undefined===this.Parent||!(this.Parent instanceof CDocument)&&(undefined===this.Parent.Parent||!(this.Parent.Parent instanceof
CHeaderFooter)))return true;if(undefined!=this.Pr.FramePr&&Asc.c_oAscYAlign.Inline!==this.Pr.FramePr.YAlign)return false;return true};Paragraph.prototype.IsInline=function(){return this.Is_Inline()};Paragraph.prototype.GetFramePr=function(){return this.Get_CompiledPr2(false).ParaPr.FramePr};Paragraph.prototype.Get_FramePr=function(){return this.GetFramePr()};Paragraph.prototype.Set_FramePr=function(FramePr,bDelete){var FramePr_old=this.Pr.FramePr;if(undefined===bDelete)bDelete=false;if(true===bDelete){this.Pr.FramePr=
undefined;this.private_AddPrChange();History.Add(new CChangesParagraphFramePr(this,FramePr_old,undefined));this.CompiledPr.NeedRecalc=true;this.private_UpdateTrackRevisionOnChangeParaPr(true);return}var FrameParas=this.Internal_Get_FrameParagraphs();if(true===FramePr.FromDropCapMenu&&1===FrameParas.length){var NewFramePr=FramePr_old?FramePr_old.Copy():new CFramePr;if(undefined!=FramePr.DropCap){var OldLines=NewFramePr.Lines;NewFramePr.Init_Default_DropCap(FramePr.DropCap===Asc.c_oAscDropCap.Drop?
true:false);NewFramePr.Lines=OldLines}if(undefined!=FramePr.Lines){var AnchorPara=this.Get_FrameAnchorPara();if(null===AnchorPara||AnchorPara.Lines.length<=0)return;var Before=AnchorPara.Get_CompiledPr().ParaPr.Spacing.Before;var LineH=AnchorPara.Lines[0].Bottom-AnchorPara.Lines[0].Top-Before;var LineTA=AnchorPara.Lines[0].Metrics.TextAscent2;var LineTD=AnchorPara.Lines[0].Metrics.TextDescent+AnchorPara.Lines[0].Metrics.LineGap;this.Set_Spacing({LineRule:linerule_Exact,Line:FramePr.Lines*LineH},false);
this.Update_DropCapByLines(this.Internal_CalculateTextPr(this.Internal_GetStartPos()),FramePr.Lines,LineH,LineTA,LineTD,Before);NewFramePr.Lines=FramePr.Lines}if(undefined!=FramePr.FontFamily){var FF=new ParaTextPr({RFonts:{Ascii:{Name:FramePr.FontFamily.Name,Index:-1}}});this.SelectAll();this.Add(FF);this.RemoveSelection()}if(undefined!=FramePr.HSpace)NewFramePr.HSpace=FramePr.HSpace;this.Pr.FramePr=NewFramePr}else{var NewFramePr=FramePr_old?FramePr_old.Copy():new CFramePr;if(undefined!=FramePr.H)NewFramePr.H=
FramePr.H;if(undefined!=FramePr.HAnchor)NewFramePr.HAnchor=FramePr.HAnchor;if(undefined!=FramePr.HRule)NewFramePr.HRule=FramePr.HRule;if(undefined!=FramePr.HSpace)NewFramePr.HSpace=FramePr.HSpace;if(undefined!=FramePr.Lines)NewFramePr.Lines=FramePr.Lines;if(undefined!=FramePr.VAnchor)NewFramePr.VAnchor=FramePr.VAnchor;if(undefined!=FramePr.VSpace)NewFramePr.VSpace=FramePr.VSpace;NewFramePr.W=FramePr.W;if(undefined!=FramePr.X){NewFramePr.X=FramePr.X;NewFramePr.XAlign=undefined}if(undefined!=FramePr.XAlign){NewFramePr.XAlign=
FramePr.XAlign;NewFramePr.X=undefined}if(undefined!=FramePr.Y){NewFramePr.Y=FramePr.Y;NewFramePr.YAlign=undefined}if(undefined!=FramePr.YAlign){NewFramePr.YAlign=FramePr.YAlign;NewFramePr.Y=undefined}if(undefined!==FramePr.Wrap)if(false===FramePr.Wrap)NewFramePr.Wrap=wrap_NotBeside;else if(true===FramePr.Wrap)NewFramePr.Wrap=wrap_Around;else NewFramePr.Wrap=FramePr.Wrap;this.Pr.FramePr=NewFramePr}if(undefined!=FramePr.Brd){var Count=FrameParas.length;for(var Index=0;Index<Count;Index++)FrameParas[Index].Set_Borders(FramePr.Brd)}if(undefined!=
FramePr.Shd){var Count=FrameParas.length;for(var Index=0;Index<Count;Index++)FrameParas[Index].Set_Shd(FramePr.Shd)}this.private_AddPrChange();History.Add(new CChangesParagraphFramePr(this,FramePr_old,this.Pr.FramePr));this.CompiledPr.NeedRecalc=true;this.private_UpdateTrackRevisionOnChangeParaPr(true)};Paragraph.prototype.Set_FramePr2=function(FramePr){this.private_AddPrChange();History.Add(new CChangesParagraphFramePr(this,this.Pr.FramePr,FramePr));this.Pr.FramePr=FramePr;this.CompiledPr.NeedRecalc=
true;this.private_UpdateTrackRevisionOnChangeParaPr(true)};Paragraph.prototype.Set_FrameParaPr=function(Para){Para.CopyPr(this);Para.Set_Ind({FirstLine:0},false);this.Set_Spacing({After:0},false);this.Set_Ind({Right:0},false);this.RemoveNumPr()};Paragraph.prototype.Get_FrameBounds=function(FrameX,FrameY,FrameW,FrameH){var X0=FrameX,Y0=FrameY,X1=FrameX+FrameW,Y1=FrameY+FrameH;var Paras=this.Internal_Get_FrameParagraphs();var Count=Paras.length;var FramePr=this.Get_FramePr();if(0>=Count)return{X:X0,
Y:Y0,W:X1-X0,H:Y1-Y0};for(var Index=0;Index<Count;Index++){var Para=Paras[Index];var ParaPr=Para.Get_CompiledPr2(false).ParaPr;var Brd=ParaPr.Brd;var _X0=FrameX;if(undefined!==Brd.Left&&border_None!==Brd.Left.Value)_X0-=Brd.Left.Size+Brd.Left.Space+1;if(_X0<X0)X0=_X0;var _X1=FrameX+FrameW;if(undefined!==Brd.Right&&border_None!==Brd.Right.Value){_X1=Math.max(_X1,_X1-ParaPr.Ind.Right);_X1+=Brd.Right.Size+Brd.Right.Space+1}if(_X1>X1)X1=_X1}var _Y1=Y1;var BottomBorder=Paras[Count-1].Get_CompiledPr2(false).ParaPr.Brd.Bottom;
if(undefined!==BottomBorder&&border_None!==BottomBorder.Value)_Y1+=BottomBorder.Size+BottomBorder.Space;if(_Y1>Y1&&(Asc.linerule_Auto===FramePr.HRule||Asc.linerule_AtLeast===FramePr.HRule&&FrameH>=FramePr.H))Y1=_Y1;return{X:X0,Y:Y0,W:X1-X0,H:Y1-Y0}};Paragraph.prototype.SetCalculatedFrame=function(oFrame){this.CalculatedFrame=oFrame;oFrame.AddParagraph(this)};Paragraph.prototype.GetCalculatedFrame=function(){return this.CalculatedFrame};Paragraph.prototype.Internal_Get_FrameParagraphs=function(){if(this.CalculatedFrame&&
this.CalculatedFrame.GetParagraphs().length>0)return this.CalculatedFrame.GetParagraphs();var FrameParas=[];var FramePr=this.Get_FramePr();if(undefined===FramePr)return FrameParas;FrameParas.push(this);var Prev=this.Get_DocumentPrev();while(null!=Prev)if(type_Paragraph===Prev.GetType()){var PrevFramePr=Prev.Get_FramePr();if(undefined!=PrevFramePr&&true===FramePr.Compare(PrevFramePr)){FrameParas.push(Prev);Prev=Prev.Get_DocumentPrev()}else break}else break;var Next=this.Get_DocumentNext();while(null!=
Next)if(type_Paragraph===Next.GetType()){var NextFramePr=Next.Get_FramePr();if(undefined!=NextFramePr&&true===FramePr.Compare(NextFramePr)){FrameParas.push(Next);Next=Next.Get_DocumentNext()}else break}else break;return FrameParas};Paragraph.prototype.Is_LineDropCap=function(){var FrameParas=this.Internal_Get_FrameParagraphs();if(1!==FrameParas.length||1!==this.Lines.length)return false;return true};Paragraph.prototype.Get_LineDropCapWidth=function(){var W=this.Lines[0].Ranges[0].W;var ParaPr=this.Get_CompiledPr2(false).ParaPr;
W+=ParaPr.Ind.Left+ParaPr.Ind.FirstLine;return W};Paragraph.prototype.Change_Frame=function(X,Y,W,H,PageIndex){if(!this.LogicDocument||!this.CalculatedFrame||!this.CalculatedFrame.GetFramePr())return;var FramePr=this.CalculatedFrame.GetFramePr();if(Math.abs(Y-this.CalculatedFrame.T2)<.001&&Math.abs(X-this.CalculatedFrame.L2)<.001&&Math.abs(W-this.CalculatedFrame.W2)<.001&&Math.abs(H-this.CalculatedFrame.H2)<.001&&PageIndex===this.CalculatedFrame.PageIndex)return;var FrameParas=this.Internal_Get_FrameParagraphs();
if(false===this.LogicDocument.Document_Is_SelectionLocked(AscCommon.changestype_None,{Type:AscCommon.changestype_2_ElementsArray_and_Type,Elements:FrameParas,CheckType:AscCommon.changestype_Paragraph_Content})){this.LogicDocument.StartAction(AscDFH.historydescription_Document_ParagraphChangeFrame);var NewFramePr=FramePr.Copy();if(Math.abs(X-this.CalculatedFrame.L2)>.001){NewFramePr.X=X+(this.CalculatedFrame.L-this.CalculatedFrame.L2);NewFramePr.XAlign=undefined;NewFramePr.HAnchor=Asc.c_oAscHAnchor.Page}if(Math.abs(Y-
this.CalculatedFrame.T2)>.001){NewFramePr.Y=Y+(this.CalculatedFrame.T-this.CalculatedFrame.T2);NewFramePr.YAlign=undefined;NewFramePr.VAnchor=Asc.c_oAscVAnchor.Page}if(Math.abs(W-this.CalculatedFrame.W2)>.001)NewFramePr.W=W-Math.abs(this.CalculatedFrame.W2-this.CalculatedFrame.W);if(Math.abs(H-this.CalculatedFrame.H2)>.001)if(undefined!=FramePr.DropCap&&Asc.c_oAscDropCap.None!=FramePr.DropCap&&1===FrameParas.length){var PageH=this.LogicDocument.Get_PageLimits(PageIndex).YLimit;var _H=Math.min(H,PageH);
NewFramePr.Lines=this.Update_DropCapByHeight(_H);NewFramePr.HRule=linerule_Exact;NewFramePr.H=H-Math.abs(this.CalculatedFrame.H2-this.CalculatedFrame.H)}else{if(H<=this.CalculatedFrame.H2)NewFramePr.HRule=linerule_Exact;else NewFramePr.HRule=Asc.linerule_AtLeast;NewFramePr.H=H}var Count=FrameParas.length;for(var Index=0;Index<Count;Index++){var Para=FrameParas[Index];Para.Set_FramePr(NewFramePr,false)}this.LogicDocument.Recalculate();this.LogicDocument.UpdateInterface();this.LogicDocument.UpdateRulers();
this.LogicDocument.UpdateTracks();this.LogicDocument.FinalizeAction()}};Paragraph.prototype.Supplement_FramePr=function(FramePr){if(undefined!=FramePr.DropCap&&Asc.c_oAscDropCap.None!=FramePr.DropCap){var _FramePr=this.Get_FramePr();var FirstFramePara=this;var Prev=FirstFramePara.Get_DocumentPrev();while(null!=Prev)if(type_Paragraph===Prev.GetType()){var PrevFramePr=Prev.Get_FramePr();if(undefined!=PrevFramePr&&true===_FramePr.Compare(PrevFramePr)){FirstFramePara=Prev;Prev=Prev.Get_DocumentPrev()}else break}else break;
var TextPr=FirstFramePara.GetFirstRunPr();if(undefined===TextPr.RFonts||undefined===TextPr.RFonts.Ascii)TextPr=this.Get_CompiledPr2(false).TextPr;FramePr.FontFamily={Name:TextPr.RFonts.Ascii.Name,Index:TextPr.RFonts.Ascii.Index}}var FrameParas=this.Internal_Get_FrameParagraphs();var Count=FrameParas.length;var ParaPr=FrameParas[0].Get_CompiledPr2(false).ParaPr.Copy();for(var Index=1;Index<Count;Index++){var TempPr=FrameParas[Index].Get_CompiledPr2(false).ParaPr;ParaPr=ParaPr.Compare(TempPr)}FramePr.Brd=
ParaPr.Brd;FramePr.Shd=ParaPr.Shd};Paragraph.prototype.CanAddDropCap=function(){for(var nPos=0,nCount=this.Content.length;nPos<nCount;++nPos){var bResult=this.Content[nPos].CanAddDropCap();if(null!==bResult)return bResult}return false};Paragraph.prototype.Get_TextForDropCap=function(DropCapText,UseContentPos,ContentPos,Depth){var EndPos=true===UseContentPos?ContentPos.Get(Depth):this.Content.length-1;for(var Pos=0;Pos<=EndPos;Pos++){this.Content[Pos].Get_TextForDropCap(DropCapText,true===UseContentPos&&
Pos===EndPos?true:false,ContentPos,Depth+1);if(true===DropCapText.Mixed&&(true===DropCapText.Check||DropCapText.Runs.length>0))return}};Paragraph.prototype.Split_DropCap=function(NewParagraph){var DropCapText=new CParagraphGetDropCapText;if(true==this.Selection.Use&&this.Parent.IsSelectedSingleElement()){var SelSP=this.Get_ParaContentPos(true,true);var SelEP=this.Get_ParaContentPos(true,false);if(0<=SelSP.Compare(SelEP))SelEP=SelSP;DropCapText.Check=true;this.Get_TextForDropCap(DropCapText,true,SelEP,
0);DropCapText.Check=false;this.Get_TextForDropCap(DropCapText,true,SelEP,0)}else{DropCapText.Mixed=true;DropCapText.Check=false;this.Get_TextForDropCap(DropCapText,false)}var Count=DropCapText.Text.length;var PrevRun=null;var CurrRun=null;for(var Pos=0,ParaPos=0,RunPos=0;Pos<Count;Pos++){if(PrevRun!==DropCapText.Runs[Pos]){PrevRun=DropCapText.Runs[Pos];CurrRun=new ParaRun(NewParagraph);CurrRun.Set_Pr(DropCapText.Runs[Pos].Pr.Copy());NewParagraph.Internal_Content_Add(ParaPos++,CurrRun,false);RunPos=
0}CurrRun.Add_ToContent(RunPos++,DropCapText.Text[Pos],false)}if(Count>0)return DropCapText.Runs[Count-1].Get_CompiledPr(true);return null};Paragraph.prototype.SelectFirstLetter=function(){var oStartPos=new CParagraphContentPos;var oEndPos=new CParagraphContentPos;for(var nPos=0,nCount=this.Content.length;nPos<nCount;++nPos){oStartPos.Update(nPos,0);oEndPos.Update(nPos,0);if(this.Content[nPos].GetFirstRunElementPos(para_Text,oStartPos,oEndPos,1)){this.StartSelectionFromCurPos();this.SetSelectionContentPos(oStartPos,
oEndPos,false);this.Document_SetThisElementCurrent();return true}}return false};Paragraph.prototype.CheckSelectionForDropCap=function(){var oSelectionStart=this.Get_ParaContentPos(true,true);var oSelectionEnd=this.Get_ParaContentPos(true,false);if(0<=oSelectionStart.Compare(oSelectionEnd))oSelectionEnd=oSelectionStart;var nEndPos=oSelectionEnd.Get(0);for(var nPos=0;nPos<=nEndPos;++nPos)if(!this.Content[nPos].CheckSelectionForDropCap(nPos===nEndPos,oSelectionEnd,1))return false;return true};Paragraph.prototype.Update_DropCapByLines=
function(TextPr,Count,LineH,LineTA,LineTD,Before){if(null===TextPr)return;this.Set_Spacing({Before:Before,After:0,LineRule:linerule_Exact,Line:Count*LineH-.001},false);var FontSize=72;TextPr.FontSize=FontSize;g_oTextMeasurer.SetTextPr(TextPr,this.Get_Theme());g_oTextMeasurer.SetFontSlot(fontslot_ASCII,1);var TMetrics={Ascent:null,Descent:null};this.private_RecalculateTextMetrics(TMetrics);var TDescent=TMetrics.Descent;var TAscent=TMetrics.Ascent;var THeight=0;if(null===TAscent||null===TDescent)THeight=
g_oTextMeasurer.GetHeight();else THeight=-TDescent+TAscent;var EmHeight=THeight;var NewEmHeight=(Count-1)*LineH+LineTA;var Koef=NewEmHeight/EmHeight;var NewFontSize=TextPr.FontSize*Koef;TextPr.FontSize=parseInt(NewFontSize*2)/2;g_oTextMeasurer.SetTextPr(TextPr,this.Get_Theme());g_oTextMeasurer.SetFontSlot(fontslot_ASCII,1);var TNewMetrics={Ascent:null,Descent:null};this.private_RecalculateTextMetrics(TNewMetrics);var TNewDescent=TNewMetrics.Descent;var TNewAscent=TNewMetrics.Ascent;var TNewHeight=
0;if(null===TNewAscent||null===TNewDescent)TNewHeight=g_oTextMeasurer.GetHeight();else TNewHeight=-TNewDescent+TNewAscent;var Descent=g_oTextMeasurer.GetDescender();var Ascent=g_oTextMeasurer.GetAscender();var Dy=Descent*(LineH*Count)/(Ascent-Descent)+TNewHeight-TNewAscent+LineTD;var PTextPr=new ParaTextPr({RFonts:{Ascii:{Name:TextPr.RFonts.Ascii.Name,Index:-1}},FontSize:TextPr.FontSize,Position:Dy});this.SelectAll();this.Add(PTextPr);this.RemoveSelection()};Paragraph.prototype.Update_DropCapByHeight=
function(_Height){var AnchorPara=this.Get_FrameAnchorPara();if(null===AnchorPara||AnchorPara.Lines.length<=0)return 1;var Before=AnchorPara.Get_CompiledPr().ParaPr.Spacing.Before;var LineH=AnchorPara.Lines[0].Bottom-AnchorPara.Lines[0].Top-Before;var LineTA=AnchorPara.Lines[0].Metrics.TextAscent2;var LineTD=AnchorPara.Lines[0].Metrics.TextDescent+AnchorPara.Lines[0].Metrics.LineGap;var Height=_Height-Before;this.Set_Spacing({LineRule:linerule_Exact,Line:Height},false);var LinesCount=Math.ceil(Height/
LineH);var TextPr=this.Internal_CalculateTextPr(this.Internal_GetStartPos());g_oTextMeasurer.SetTextPr(TextPr,this.Get_Theme());g_oTextMeasurer.SetFontSlot(fontslot_ASCII,1);var TMetrics={Ascent:null,Descent:null};this.private_RecalculateTextMetrics(TMetrics);var TDescent=TMetrics.Descent;var TAscent=TMetrics.Ascent;var THeight=0;if(null===TAscent||null===TDescent)THeight=g_oTextMeasurer.GetHeight();else THeight=-TDescent+TAscent;var Koef=(Height-LineTD)/THeight;var NewFontSize=TextPr.FontSize*Koef;
TextPr.FontSize=parseInt(NewFontSize*2)/2;g_oTextMeasurer.SetTextPr(TextPr,this.Get_Theme());g_oTextMeasurer.SetFontSlot(fontslot_ASCII,1);var TNewMetrics={Ascent:null,Descent:null};this.private_RecalculateTextMetrics(TNewMetrics);var TNewDescent=TNewMetrics.Descent;var TNewAscent=TNewMetrics.Ascent;var TNewHeight=0;if(null===TNewAscent||null===TNewDescent)TNewHeight=g_oTextMeasurer.GetHeight();else TNewHeight=-TNewDescent+TNewAscent;var Descent=g_oTextMeasurer.GetDescender();var Ascent=g_oTextMeasurer.GetAscender();
var Dy=Descent*Height/(Ascent-Descent)+TNewHeight-TNewAscent+LineTD;var PTextPr=new ParaTextPr({RFonts:{Ascii:{Name:TextPr.RFonts.Ascii.Name,Index:-1}},FontSize:TextPr.FontSize,Position:Dy});this.SelectAll();this.Add(PTextPr);this.RemoveSelection();return LinesCount};Paragraph.prototype.Get_FrameAnchorPara=function(){var FramePr=this.Get_FramePr();if(undefined===FramePr)return null;var Next=this.Get_DocumentNext();while(null!=Next){if(type_Paragraph===Next.GetType()){var NextFramePr=Next.Get_FramePr();
if(undefined===NextFramePr||false===FramePr.Compare(NextFramePr))return Next}Next=Next.Get_DocumentNext()}return Next};Paragraph.prototype.Split=function(NewParagraph){if(!NewParagraph)NewParagraph=new Paragraph(this.DrawingDocument,this.Parent);NewParagraph.DeleteCommentOnRemove=false;this.DeleteCommentOnRemove=false;this.RemoveSelection();NewParagraph.RemoveSelection();var ContentPos=this.Get_ParaContentPos(false,false);var CurPos=ContentPos.Get(0);var TextPr=this.Get_TextPr(ContentPos);var oLogicDocument=
this.GetLogicDocument();var oStyles=oLogicDocument&&oLogicDocument.GetStyles?oLogicDocument.GetStyles():null;if(oStyles&&(TextPr.RStyle===oStyles.GetDefaultEndnoteReference()||TextPr.RStyle===oStyles.GetDefaultFootnoteReference())){TextPr=TextPr.Copy();TextPr.RStyle=undefined}var NewElement=this.Content[CurPos].Split(ContentPos,1);if(null===NewElement){NewElement=new ParaRun(NewParagraph);NewElement.Set_Pr(TextPr.Copy())}var NewContent=this.Content.slice(CurPos+1);this.Internal_Content_Remove2(CurPos+
1,this.Content.length-CurPos-1);var EndRun=new ParaRun(this);EndRun.Add_ToContent(0,new ParaEnd);this.Internal_Content_Add(this.Content.length,EndRun);NewParagraph.Internal_Content_Remove2(0,NewParagraph.Content.length);NewParagraph.Internal_Content_Concat(NewContent);NewParagraph.Internal_Content_Add(0,NewElement);NewParagraph.Correct_Content();this.CopyPr(NewParagraph);this.TextPr.Clear_Style();this.TextPr.Apply_TextPr(TextPr);var SectPr=this.Get_SectionPr();if(undefined!==SectPr){this.Set_SectionPr(undefined);
NewParagraph.Set_SectionPr(SectPr)}this.MoveCursorToEndPos(false,false);NewParagraph.MoveCursorToStartPos(false);NewParagraph.DeleteCommentOnRemove=true;this.DeleteCommentOnRemove=true;return NewParagraph};Paragraph.prototype.Concat=function(Para,isUseConcatedStyle){this.DeleteCommentOnRemove=false;Para.DeleteCommentOnRemove=false;this.Remove_ParaEnd();var NearPosCount=Para.NearPosArray.length;for(var Pos=0;Pos<NearPosCount;Pos++){var ParaNearPos=Para.NearPosArray[Pos];ParaNearPos.Classes[0]=this;
ParaNearPos.NearPos.Paragraph=this;ParaNearPos.NearPos.ContentPos.Data[0]+=this.Content.length;this.NearPosArray.push(ParaNearPos)}this.Internal_Content_Concat(Para.Content);Para.ClearContent();this.Set_SectionPr(undefined);var SectPr=Para.Get_SectionPr();if(undefined!==SectPr){Para.Set_SectionPr(undefined);this.Set_SectionPr(SectPr)}this.DeleteCommentOnRemove=true;Para.DeleteCommentOnRemove=true;if(true===isUseConcatedStyle)Para.CopyPr(this)};Paragraph.prototype.ConcatBefore=function(oPara){this.DeleteCommentOnRemove=
false;oPara.DeleteCommentOnRemove=false;oPara.Remove_ParaEnd();for(var nPos=0,nCount=this.NearPosArray.length;nPos<nCount;++nPos){var oParaNearPos=this.NearPosArray[nPos];oParaNearPos.NearPos.ContentPos.Data[0]+=oPara.Content.length}for(var nPos=0,nCount=oPara.NearPosArray.length;nPos<nCount;++nPos){var oParaNearPos=oPara.NearPosArray[nPos];oParaNearPos.Classes[0]=this;oParaNearPos.NearPos.Paragraph=this;this.NearPosArray.push(oParaNearPos)}for(var nPos=0,nCount=oPara.Content.length;nPos<nCount;++nPos)this.AddToContent(nPos,
oPara.Content[nPos]);oPara.ClearContent();oPara.Set_SectionPr(undefined);this.DeleteCommentOnRemove=true;oPara.DeleteCommentOnRemove=true;oPara.CopyPr(this)};Paragraph.prototype.Continue=function(NewParagraph){var TextPr;if(this.IsEmpty())TextPr=this.TextPr.Value.Copy();else{var EndPos=this.Get_EndPos2(false);var CurPos=this.Get_ParaContentPos(false,false);this.Set_ParaContentPos(EndPos,true,-1,-1);TextPr=this.Get_TextPr(this.Get_ParaContentPos(false,false)).Copy();this.Set_ParaContentPos(CurPos,
false,-1,-1,false);TextPr.HighLight=highlight_None;var oStyles;if(this.bFromDocument&&this.LogicDocument&&(oStyles=this.LogicDocument.GetStyles())&&(TextPr.RStyle===oStyles.GetDefaultFootnoteReference()||TextPr.RStyle===oStyles.GetDefaultEndnoteReference()))TextPr.RStyle=undefined}this.CopyPr(NewParagraph);if(!this.HaveNumbering()&&!this.Lock.Is_Locked()){this.TextPr.Clear_Style();this.TextPr.Apply_TextPr(TextPr)}NewParagraph.Internal_Content_Add(0,new ParaRun(NewParagraph));NewParagraph.Correct_Content();
NewParagraph.MoveCursorToStartPos(false);for(var Pos=0,Count=NewParagraph.Content.length;Pos<Count;Pos++)if(para_Run===NewParagraph.Content[Pos].Type)NewParagraph.Content[Pos].Set_Pr(TextPr.Copy())};Paragraph.prototype.GetSelectionState=function(){var ParaState={};ParaState.CurPos={X:this.CurPos.X,Y:this.CurPos.Y,Line:this.CurPos.Line,ContentPos:this.Get_ParaContentPos(false,false),RealX:this.CurPos.RealX,RealY:this.CurPos.RealY,PagesPos:this.CurPos.PagesPos};ParaState.Selection={Start:this.Selection.Start,
Use:this.Selection.Use,StartPos:0,EndPos:0,Flag:this.Selection.Flag};if(true===this.Selection.Use){ParaState.Selection.StartPos=this.Get_ParaContentPos(true,true);ParaState.Selection.EndPos=this.Get_ParaContentPos(true,false)}return[ParaState]};Paragraph.prototype.SetSelectionState=function(State,StateIndex){if(State.length<=0)return;var ParaState=State[StateIndex];this.CurPos.X=ParaState.CurPos.X;this.CurPos.Y=ParaState.CurPos.Y;this.CurPos.Line=ParaState.CurPos.Line;this.CurPos.RealX=ParaState.CurPos.RealX;
this.CurPos.RealY=ParaState.CurPos.RealY;this.CurPos.PagesPos=ParaState.CurPos.PagesPos;this.Set_ParaContentPos(ParaState.CurPos.ContentPos,true,-1,-1);this.RemoveSelection();this.Selection.Start=ParaState.Selection.Start;this.Selection.Use=ParaState.Selection.Use;this.Selection.Flag=ParaState.Selection.Flag;if(true===this.Selection.Use)this.Set_SelectionContentPos(ParaState.Selection.StartPos,ParaState.Selection.EndPos)};Paragraph.prototype.Get_ParentObject_or_DocumentPos=function(){this.Parent.Update_ContentIndexing();
return this.Parent.Get_ParentObject_or_DocumentPos(this.Index)};Paragraph.prototype.Refresh_RecalcData=function(Data){var Type=Data.Type;var bNeedRecalc=false;var CurPage=0;switch(Type){case AscDFH.historyitem_Paragraph_AddItem:case AscDFH.historyitem_Paragraph_RemoveItem:{for(CurPage=this.Pages.length-1;CurPage>0;CurPage--)if(Data.Pos>this.Lines[this.Pages[CurPage].StartLine].Get_StartPos())break;this.RecalcInfo.Set_Type_0(pararecalc_0_All);bNeedRecalc=true;break}case AscDFH.historyitem_Paragraph_Numbering:case AscDFH.historyitem_Paragraph_PStyle:case AscDFH.historyitem_Paragraph_Pr:case AscDFH.historyitem_Paragraph_PresentationPr_Bullet:case AscDFH.historyitem_Paragraph_PresentationPr_Level:{this.RecalcInfo.Set_Type_0(pararecalc_0_All);
bNeedRecalc=true;this.CompiledPr.NeedRecalc=true;this.Recalc_RunsCompiledPr();break}case AscDFH.historyitem_Paragraph_Align:case AscDFH.historyitem_Paragraph_DefaultTabSize:case AscDFH.historyitem_Paragraph_Ind_First:case AscDFH.historyitem_Paragraph_Ind_Left:case AscDFH.historyitem_Paragraph_Ind_Right:case AscDFH.historyitem_Paragraph_ContextualSpacing:case AscDFH.historyitem_Paragraph_KeepLines:case AscDFH.historyitem_Paragraph_KeepNext:case AscDFH.historyitem_Paragraph_PageBreakBefore:case AscDFH.historyitem_Paragraph_Spacing_Line:case AscDFH.historyitem_Paragraph_Spacing_LineRule:case AscDFH.historyitem_Paragraph_Spacing_Before:case AscDFH.historyitem_Paragraph_Spacing_After:case AscDFH.historyitem_Paragraph_Spacing_AfterAutoSpacing:case AscDFH.historyitem_Paragraph_Spacing_BeforeAutoSpacing:case AscDFH.historyitem_Paragraph_WidowControl:case AscDFH.historyitem_Paragraph_Tabs:case AscDFH.historyitem_Paragraph_Borders_Between:case AscDFH.historyitem_Paragraph_Borders_Bottom:case AscDFH.historyitem_Paragraph_Borders_Left:case AscDFH.historyitem_Paragraph_Borders_Right:case AscDFH.historyitem_Paragraph_Borders_Top:case AscDFH.historyitem_Paragraph_FramePr:{bNeedRecalc=
Paragraph.prototype.Document_CreateFontCharMap=function(FontCharMap){};Paragraph.prototype.Document_Get_AllFontNames=function(AllFonts){this.TextPr.Value.Document_Get_AllFontNames(AllFonts);if(this.Pr.Bullet)this.Pr.Bullet.Get_AllFontNames(AllFonts);if(this.Pr.DefaultRunPr)this.Pr.DefaultRunPr.Document_Get_AllFontNames(AllFonts);var Count=this.Content.length;for(var Index=0;Index<Count;Index++)if(this.Content[Index]&&typeof this.Content[Index].Get_AllFontNames==="function")this.Content[Index].Get_AllFontNames(AllFonts)};
Paragraph.prototype.Document_UpdateRulersState=function(){if(this.CalculatedFrame){var oFrame=this.CalculatedFrame;this.Parent.DrawingDocument.Set_RulerState_Paragraph({L:oFrame.L2,T:oFrame.T2,R:oFrame.L2+oFrame.W2,B:oFrame.T2+oFrame.H2,PageIndex:this.GetStartPageAbsolute(),Frame:this},false)}else if(this.Parent instanceof CDocument)if(this.LogicDocument)this.LogicDocument.Document_UpdateRulersStateBySection()};Paragraph.prototype.Document_UpdateInterfaceState=function(){var StartPos,EndPos;if(true===
this.Selection.Use){StartPos=this.Get_ParaContentPos(true,true);EndPos=this.Get_ParaContentPos(true,false)}else{var CurPos=this.Get_ParaContentPos(false,false);StartPos=CurPos;EndPos=CurPos}if(this.LogicDocument&&true===this.LogicDocument.Spelling.Use&&(selectionflag_Numbering!==this.Selection.Flag&&selectionflag_NumberingCur!==this.Selection.Flag))this.SpellChecker.Document_UpdateInterfaceState(StartPos,EndPos);if(true===this.Selection.Use){var StartPos=this.Selection.StartPos;var EndPos=this.Selection.EndPos;
if(StartPos>EndPos){StartPos=this.Selection.EndPos;EndPos=this.Selection.StartPos}for(var CurPos=StartPos;CurPos<=EndPos;CurPos++){var Element=this.Content[CurPos];if(true!==Element.IsSelectionEmpty()&&Element.Document_UpdateInterfaceState)Element.Document_UpdateInterfaceState()}}else{var CurType=this.Content[this.CurPos.ContentPos].Type;if(this.Content[this.CurPos.ContentPos].Document_UpdateInterfaceState)this.Content[this.CurPos.ContentPos].Document_UpdateInterfaceState()}var arrComplexFields=this.GetCurrentComplexFields();
for(var nIndex=0,nCount=arrComplexFields.length;nIndex<nCount;++nIndex){var oInstruction=arrComplexFields[nIndex].GetInstruction();if(oInstruction&&fieldtype_HYPERLINK===oInstruction.GetType()){var oHyperProps=new Asc.CHyperlinkProperty;oHyperProps.put_ToolTip(oInstruction.GetToolTip());oHyperProps.put_Value(oInstruction.GetValue());oHyperProps.put_Text(this.LogicDocument?this.LogicDocument.GetComplexFieldTextValue(arrComplexFields[nIndex]):null);oHyperProps.put_InternalHyperlink(oInstruction);editor.sync_HyperlinkPropCallback(oHyperProps)}}if(editor&&
this.bFromDocument){if(!this.LogicDocument)return;var TrackManager=this.LogicDocument.GetTrackRevisionsManager();if(this.Pages.length<=0&&this.Lines.length<=0)return;var ContentPos=this.Get_ParaContentPos(this.Selection.Use,true);var ParaPos=this.Get_ParaPosByContentPos(ContentPos);if(this.Pages.length<=ParaPos.Page||this.Lines.length<=ParaPos.Line)return;var Page_abs=this.Get_AbsolutePage(ParaPos.Page);var _Y=this.Pages[ParaPos.Page].Y+this.Lines[ParaPos.Line].Top;var TextTransform=this.Get_ParentTextTransform();
var _X=this.LogicDocument?this.LogicDocument.Get_PageLimits(Page_abs).XLimit:0;var Coords=this.DrawingDocument.ConvertCoordsToCursorWR(_X,_Y,Page_abs,TextTransform);if(false===this.Selection.Use){var Changes=TrackManager.GetElementChanges(this.GetId());if(Changes.length>0)for(var ChangeIndex=0,ChangesCount=Changes.length;ChangeIndex<ChangesCount;ChangeIndex++){var Change=Changes[ChangeIndex];var Type=Change.get_Type();if(c_oAscRevisionsChangeType.TextAdd!==Type&&c_oAscRevisionsChangeType.TextRem!==
Type&&c_oAscRevisionsChangeType.TextPr!==Type||StartPos.Compare(Change.get_StartPos())>=0&&StartPos.Compare(Change.get_EndPos())<=0){Change.put_InternalPos(_X,_Y,Page_abs);TrackManager.AddVisibleChange(Change)}}}}};Paragraph.prototype.PreDelete=function(){for(var Index=0;Index<this.Content.length;Index++){var Item=this.Content[Index];if(Item.PreDelete)Item.PreDelete();if(this.LogicDocument)if(para_Comment===Item.Type&&true===this.LogicDocument.RemoveCommentsOnPreDelete)this.LogicDocument.RemoveComment(Item.CommentId,
true,false);else if(para_Bookmark===Item.Type)this.LogicDocument.GetBookmarksManager().SetNeedUpdate(true)}this.RemoveSelection();this.UpdateDocumentOutline();if(undefined!==this.Get_SectionPr()&&this.LogicDocument)this.Set_SectionPr(undefined)};Paragraph.prototype.Document_SetThisElementCurrent=function(bUpdateStates){this.Parent.Update_ContentIndexing();this.Parent.Set_CurrentElement(this.Index,bUpdateStates)};Paragraph.prototype.Is_ThisElementCurrent=function(){var Parent=this.Parent;Parent.Update_ContentIndexing();
if(docpostype_Content===Parent.GetDocPosType()&&false===Parent.Selection.Use&&this.Index===Parent.CurPos.ContentPos&&Parent.Content[this.Index]===this)return this.Parent.Is_ThisElementCurrent();return false};Paragraph.prototype.Is_Inline=function(){if(this.bFromDocument===false)return true;var PrevElement=this.Get_DocumentPrev();if(true===this.Is_Empty()&&undefined!==this.Get_SectionPr()&&null!==PrevElement&&(type_Paragraph!==PrevElement.Get_Type()||undefined===PrevElement.Get_SectionPr()))return true;
if(undefined===this.Parent||!(this.Parent instanceof CDocument)&&(undefined===this.Parent.Parent||!(this.Parent.Parent instanceof CHeaderFooter)))return true;if(undefined!=this.Pr.FramePr&&Asc.c_oAscYAlign.Inline!==this.Pr.FramePr.YAlign)return false;return true};Paragraph.prototype.IsInline=function(){return this.Is_Inline()};Paragraph.prototype.GetFramePr=function(){return this.Get_CompiledPr2(false).ParaPr.FramePr};Paragraph.prototype.Get_FramePr=function(){return this.GetFramePr()};Paragraph.prototype.Set_FramePr=
function(FramePr,bDelete){var FramePr_old=this.Pr.FramePr;if(undefined===bDelete)bDelete=false;if(true===bDelete){this.Pr.FramePr=undefined;this.private_AddPrChange();History.Add(new CChangesParagraphFramePr(this,FramePr_old,undefined));this.CompiledPr.NeedRecalc=true;this.private_UpdateTrackRevisionOnChangeParaPr(true);return}var FrameParas=this.Internal_Get_FrameParagraphs();if(true===FramePr.FromDropCapMenu&&1===FrameParas.length){var NewFramePr=FramePr_old?FramePr_old.Copy():new CFramePr;if(undefined!=
FramePr.DropCap){var OldLines=NewFramePr.Lines;NewFramePr.Init_Default_DropCap(FramePr.DropCap===Asc.c_oAscDropCap.Drop?true:false);NewFramePr.Lines=OldLines}if(undefined!=FramePr.Lines){var AnchorPara=this.Get_FrameAnchorPara();if(null===AnchorPara||AnchorPara.Lines.length<=0)return;var Before=AnchorPara.Get_CompiledPr().ParaPr.Spacing.Before;var LineH=AnchorPara.Lines[0].Bottom-AnchorPara.Lines[0].Top-Before;var LineTA=AnchorPara.Lines[0].Metrics.TextAscent2;var LineTD=AnchorPara.Lines[0].Metrics.TextDescent+
AnchorPara.Lines[0].Metrics.LineGap;this.Set_Spacing({LineRule:linerule_Exact,Line:FramePr.Lines*LineH},false);this.Update_DropCapByLines(this.Internal_CalculateTextPr(this.Internal_GetStartPos()),FramePr.Lines,LineH,LineTA,LineTD,Before);NewFramePr.Lines=FramePr.Lines}if(undefined!=FramePr.FontFamily){var FF=new ParaTextPr({RFonts:{Ascii:{Name:FramePr.FontFamily.Name,Index:-1}}});this.SelectAll();this.Add(FF);this.RemoveSelection()}if(undefined!=FramePr.HSpace)NewFramePr.HSpace=FramePr.HSpace;this.Pr.FramePr=
NewFramePr}else{var NewFramePr=FramePr_old?FramePr_old.Copy():new CFramePr;if(undefined!=FramePr.H)NewFramePr.H=FramePr.H;if(undefined!=FramePr.HAnchor)NewFramePr.HAnchor=FramePr.HAnchor;if(undefined!=FramePr.HRule)NewFramePr.HRule=FramePr.HRule;if(undefined!=FramePr.HSpace)NewFramePr.HSpace=FramePr.HSpace;if(undefined!=FramePr.Lines)NewFramePr.Lines=FramePr.Lines;if(undefined!=FramePr.VAnchor)NewFramePr.VAnchor=FramePr.VAnchor;if(undefined!=FramePr.VSpace)NewFramePr.VSpace=FramePr.VSpace;NewFramePr.W=
FramePr.W;if(undefined!=FramePr.X){NewFramePr.X=FramePr.X;NewFramePr.XAlign=undefined}if(undefined!=FramePr.XAlign){NewFramePr.XAlign=FramePr.XAlign;NewFramePr.X=undefined}if(undefined!=FramePr.Y){NewFramePr.Y=FramePr.Y;NewFramePr.YAlign=undefined}if(undefined!=FramePr.YAlign){NewFramePr.YAlign=FramePr.YAlign;NewFramePr.Y=undefined}if(undefined!==FramePr.Wrap)if(false===FramePr.Wrap)NewFramePr.Wrap=wrap_NotBeside;else if(true===FramePr.Wrap)NewFramePr.Wrap=wrap_Around;else NewFramePr.Wrap=FramePr.Wrap;
this.Pr.FramePr=NewFramePr}if(undefined!=FramePr.Brd){var Count=FrameParas.length;for(var Index=0;Index<Count;Index++)FrameParas[Index].Set_Borders(FramePr.Brd)}if(undefined!=FramePr.Shd){var Count=FrameParas.length;for(var Index=0;Index<Count;Index++)FrameParas[Index].Set_Shd(FramePr.Shd)}this.private_AddPrChange();History.Add(new CChangesParagraphFramePr(this,FramePr_old,this.Pr.FramePr));this.CompiledPr.NeedRecalc=true;this.private_UpdateTrackRevisionOnChangeParaPr(true)};Paragraph.prototype.Set_FramePr2=
function(FramePr){this.private_AddPrChange();History.Add(new CChangesParagraphFramePr(this,this.Pr.FramePr,FramePr));this.Pr.FramePr=FramePr;this.CompiledPr.NeedRecalc=true;this.private_UpdateTrackRevisionOnChangeParaPr(true)};Paragraph.prototype.Set_FrameParaPr=function(Para){Para.CopyPr(this);Para.Set_Ind({FirstLine:0},false);this.Set_Spacing({After:0},false);this.Set_Ind({Right:0},false);this.RemoveNumPr()};Paragraph.prototype.Get_FrameBounds=function(FrameX,FrameY,FrameW,FrameH){var X0=FrameX,
Y0=FrameY,X1=FrameX+FrameW,Y1=FrameY+FrameH;var Paras=this.Internal_Get_FrameParagraphs();var Count=Paras.length;var FramePr=this.Get_FramePr();if(0>=Count)return{X:X0,Y:Y0,W:X1-X0,H:Y1-Y0};for(var Index=0;Index<Count;Index++){var Para=Paras[Index];var ParaPr=Para.Get_CompiledPr2(false).ParaPr;var Brd=ParaPr.Brd;var _X0=FrameX;if(undefined!==Brd.Left&&border_None!==Brd.Left.Value)_X0-=Brd.Left.Size+Brd.Left.Space+1;if(_X0<X0)X0=_X0;var _X1=FrameX+FrameW;if(undefined!==Brd.Right&&border_None!==Brd.Right.Value){_X1=
Math.max(_X1,_X1-ParaPr.Ind.Right);_X1+=Brd.Right.Size+Brd.Right.Space+1}if(_X1>X1)X1=_X1}var _Y1=Y1;var BottomBorder=Paras[Count-1].Get_CompiledPr2(false).ParaPr.Brd.Bottom;if(undefined!==BottomBorder&&border_None!==BottomBorder.Value)_Y1+=BottomBorder.Size+BottomBorder.Space;if(_Y1>Y1&&(Asc.linerule_Auto===FramePr.HRule||Asc.linerule_AtLeast===FramePr.HRule&&FrameH>=FramePr.H))Y1=_Y1;return{X:X0,Y:Y0,W:X1-X0,H:Y1-Y0}};Paragraph.prototype.SetCalculatedFrame=function(oFrame){this.CalculatedFrame=
oFrame;oFrame.AddParagraph(this)};Paragraph.prototype.GetCalculatedFrame=function(){return this.CalculatedFrame};Paragraph.prototype.Internal_Get_FrameParagraphs=function(){if(this.CalculatedFrame&&this.CalculatedFrame.GetParagraphs().length>0)return this.CalculatedFrame.GetParagraphs();var FrameParas=[];var FramePr=this.Get_FramePr();if(undefined===FramePr)return FrameParas;FrameParas.push(this);var Prev=this.Get_DocumentPrev();while(null!=Prev)if(type_Paragraph===Prev.GetType()){var PrevFramePr=
Prev.Get_FramePr();if(undefined!=PrevFramePr&&true===FramePr.Compare(PrevFramePr)){FrameParas.push(Prev);Prev=Prev.Get_DocumentPrev()}else break}else break;var Next=this.Get_DocumentNext();while(null!=Next)if(type_Paragraph===Next.GetType()){var NextFramePr=Next.Get_FramePr();if(undefined!=NextFramePr&&true===FramePr.Compare(NextFramePr)){FrameParas.push(Next);Next=Next.Get_DocumentNext()}else break}else break;return FrameParas};Paragraph.prototype.Is_LineDropCap=function(){var FrameParas=this.Internal_Get_FrameParagraphs();
if(1!==FrameParas.length||1!==this.Lines.length)return false;return true};Paragraph.prototype.Get_LineDropCapWidth=function(){var W=this.Lines[0].Ranges[0].W;var ParaPr=this.Get_CompiledPr2(false).ParaPr;W+=ParaPr.Ind.Left+ParaPr.Ind.FirstLine;return W};Paragraph.prototype.Change_Frame=function(X,Y,W,H,PageIndex){if(!this.LogicDocument||!this.CalculatedFrame||!this.CalculatedFrame.GetFramePr())return;var FramePr=this.CalculatedFrame.GetFramePr();if(Math.abs(Y-this.CalculatedFrame.T2)<.001&&Math.abs(X-
this.CalculatedFrame.L2)<.001&&Math.abs(W-this.CalculatedFrame.W2)<.001&&Math.abs(H-this.CalculatedFrame.H2)<.001&&PageIndex===this.CalculatedFrame.PageIndex)return;var FrameParas=this.Internal_Get_FrameParagraphs();if(false===this.LogicDocument.Document_Is_SelectionLocked(AscCommon.changestype_None,{Type:AscCommon.changestype_2_ElementsArray_and_Type,Elements:FrameParas,CheckType:AscCommon.changestype_Paragraph_Content})){this.LogicDocument.StartAction(AscDFH.historydescription_Document_ParagraphChangeFrame);
var NewFramePr=FramePr.Copy();if(Math.abs(X-this.CalculatedFrame.L2)>.001){NewFramePr.X=X+(this.CalculatedFrame.L-this.CalculatedFrame.L2);NewFramePr.XAlign=undefined;NewFramePr.HAnchor=Asc.c_oAscHAnchor.Page}if(Math.abs(Y-this.CalculatedFrame.T2)>.001){NewFramePr.Y=Y+(this.CalculatedFrame.T-this.CalculatedFrame.T2);NewFramePr.YAlign=undefined;NewFramePr.VAnchor=Asc.c_oAscVAnchor.Page}if(Math.abs(W-this.CalculatedFrame.W2)>.001)NewFramePr.W=W-Math.abs(this.CalculatedFrame.W2-this.CalculatedFrame.W);
if(Math.abs(H-this.CalculatedFrame.H2)>.001)if(undefined!=FramePr.DropCap&&Asc.c_oAscDropCap.None!=FramePr.DropCap&&1===FrameParas.length){var PageH=this.LogicDocument.Get_PageLimits(PageIndex).YLimit;var _H=Math.min(H,PageH);NewFramePr.Lines=this.Update_DropCapByHeight(_H);NewFramePr.HRule=linerule_Exact;NewFramePr.H=H-Math.abs(this.CalculatedFrame.H2-this.CalculatedFrame.H)}else{if(H<=this.CalculatedFrame.H2)NewFramePr.HRule=linerule_Exact;else NewFramePr.HRule=Asc.linerule_AtLeast;NewFramePr.H=
H}var Count=FrameParas.length;for(var Index=0;Index<Count;Index++){var Para=FrameParas[Index];Para.Set_FramePr(NewFramePr,false)}this.LogicDocument.Recalculate();this.LogicDocument.UpdateInterface();this.LogicDocument.UpdateRulers();this.LogicDocument.UpdateTracks();this.LogicDocument.FinalizeAction()}};Paragraph.prototype.Supplement_FramePr=function(FramePr){if(undefined!=FramePr.DropCap&&Asc.c_oAscDropCap.None!=FramePr.DropCap){var _FramePr=this.Get_FramePr();var FirstFramePara=this;var Prev=FirstFramePara.Get_DocumentPrev();
while(null!=Prev)if(type_Paragraph===Prev.GetType()){var PrevFramePr=Prev.Get_FramePr();if(undefined!=PrevFramePr&&true===_FramePr.Compare(PrevFramePr)){FirstFramePara=Prev;Prev=Prev.Get_DocumentPrev()}else break}else break;var TextPr=FirstFramePara.GetFirstRunPr();if(undefined===TextPr.RFonts||undefined===TextPr.RFonts.Ascii)TextPr=this.Get_CompiledPr2(false).TextPr;FramePr.FontFamily={Name:TextPr.RFonts.Ascii.Name,Index:TextPr.RFonts.Ascii.Index}}var FrameParas=this.Internal_Get_FrameParagraphs();
var Count=FrameParas.length;var ParaPr=FrameParas[0].Get_CompiledPr2(false).ParaPr.Copy();for(var Index=1;Index<Count;Index++){var TempPr=FrameParas[Index].Get_CompiledPr2(false).ParaPr;ParaPr=ParaPr.Compare(TempPr)}FramePr.Brd=ParaPr.Brd;FramePr.Shd=ParaPr.Shd};Paragraph.prototype.CanAddDropCap=function(){for(var nPos=0,nCount=this.Content.length;nPos<nCount;++nPos){var bResult=this.Content[nPos].CanAddDropCap();if(null!==bResult)return bResult}return false};Paragraph.prototype.Get_TextForDropCap=
function(DropCapText,UseContentPos,ContentPos,Depth){var EndPos=true===UseContentPos?ContentPos.Get(Depth):this.Content.length-1;for(var Pos=0;Pos<=EndPos;Pos++){this.Content[Pos].Get_TextForDropCap(DropCapText,true===UseContentPos&&Pos===EndPos?true:false,ContentPos,Depth+1);if(true===DropCapText.Mixed&&(true===DropCapText.Check||DropCapText.Runs.length>0))return}};Paragraph.prototype.Split_DropCap=function(NewParagraph){var DropCapText=new CParagraphGetDropCapText;if(true==this.Selection.Use&&this.Parent.IsSelectedSingleElement()){var SelSP=
this.Get_ParaContentPos(true,true);var SelEP=this.Get_ParaContentPos(true,false);if(0<=SelSP.Compare(SelEP))SelEP=SelSP;DropCapText.Check=true;this.Get_TextForDropCap(DropCapText,true,SelEP,0);DropCapText.Check=false;this.Get_TextForDropCap(DropCapText,true,SelEP,0)}else{DropCapText.Mixed=true;DropCapText.Check=false;this.Get_TextForDropCap(DropCapText,false)}var Count=DropCapText.Text.length;var PrevRun=null;var CurrRun=null;for(var Pos=0,ParaPos=0,RunPos=0;Pos<Count;Pos++){if(PrevRun!==DropCapText.Runs[Pos]){PrevRun=
DropCapText.Runs[Pos];CurrRun=new ParaRun(NewParagraph);CurrRun.Set_Pr(DropCapText.Runs[Pos].Pr.Copy());NewParagraph.Internal_Content_Add(ParaPos++,CurrRun,false);RunPos=0}CurrRun.Add_ToContent(RunPos++,DropCapText.Text[Pos],false)}if(Count>0)return DropCapText.Runs[Count-1].Get_CompiledPr(true);return null};Paragraph.prototype.SelectFirstLetter=function(){var oStartPos=new CParagraphContentPos;var oEndPos=new CParagraphContentPos;for(var nPos=0,nCount=this.Content.length;nPos<nCount;++nPos){oStartPos.Update(nPos,
0);oEndPos.Update(nPos,0);if(this.Content[nPos].GetFirstRunElementPos(para_Text,oStartPos,oEndPos,1)){this.StartSelectionFromCurPos();this.SetSelectionContentPos(oStartPos,oEndPos,false);this.Document_SetThisElementCurrent();return true}}return false};Paragraph.prototype.CheckSelectionForDropCap=function(){var oSelectionStart=this.Get_ParaContentPos(true,true);var oSelectionEnd=this.Get_ParaContentPos(true,false);if(0<=oSelectionStart.Compare(oSelectionEnd))oSelectionEnd=oSelectionStart;var nEndPos=
oSelectionEnd.Get(0);for(var nPos=0;nPos<=nEndPos;++nPos)if(!this.Content[nPos].CheckSelectionForDropCap(nPos===nEndPos,oSelectionEnd,1))return false;return true};Paragraph.prototype.Update_DropCapByLines=function(TextPr,Count,LineH,LineTA,LineTD,Before){if(null===TextPr)return;this.Set_Spacing({Before:Before,After:0,LineRule:linerule_Exact,Line:Count*LineH-.001},false);var FontSize=72;TextPr.FontSize=FontSize;g_oTextMeasurer.SetTextPr(TextPr,this.Get_Theme());g_oTextMeasurer.SetFontSlot(fontslot_ASCII,
1);var TMetrics={Ascent:null,Descent:null};this.private_RecalculateTextMetrics(TMetrics);var TDescent=TMetrics.Descent;var TAscent=TMetrics.Ascent;var THeight=0;if(null===TAscent||null===TDescent)THeight=g_oTextMeasurer.GetHeight();else THeight=-TDescent+TAscent;var EmHeight=THeight;var NewEmHeight=(Count-1)*LineH+LineTA;var Koef=NewEmHeight/EmHeight;var NewFontSize=TextPr.FontSize*Koef;TextPr.FontSize=parseInt(NewFontSize*2)/2;g_oTextMeasurer.SetTextPr(TextPr,this.Get_Theme());g_oTextMeasurer.SetFontSlot(fontslot_ASCII,
1);var TNewMetrics={Ascent:null,Descent:null};this.private_RecalculateTextMetrics(TNewMetrics);var TNewDescent=TNewMetrics.Descent;var TNewAscent=TNewMetrics.Ascent;var TNewHeight=0;if(null===TNewAscent||null===TNewDescent)TNewHeight=g_oTextMeasurer.GetHeight();else TNewHeight=-TNewDescent+TNewAscent;var Descent=g_oTextMeasurer.GetDescender();var Ascent=g_oTextMeasurer.GetAscender();var Dy=Descent*(LineH*Count)/(Ascent-Descent)+TNewHeight-TNewAscent+LineTD;var PTextPr=new ParaTextPr({RFonts:{Ascii:{Name:TextPr.RFonts.Ascii.Name,
Index:-1}},FontSize:TextPr.FontSize,Position:Dy});this.SelectAll();this.Add(PTextPr);this.RemoveSelection()};Paragraph.prototype.Update_DropCapByHeight=function(_Height){var AnchorPara=this.Get_FrameAnchorPara();if(null===AnchorPara||AnchorPara.Lines.length<=0)return 1;var Before=AnchorPara.Get_CompiledPr().ParaPr.Spacing.Before;var LineH=AnchorPara.Lines[0].Bottom-AnchorPara.Lines[0].Top-Before;var LineTA=AnchorPara.Lines[0].Metrics.TextAscent2;var LineTD=AnchorPara.Lines[0].Metrics.TextDescent+
AnchorPara.Lines[0].Metrics.LineGap;var Height=_Height-Before;this.Set_Spacing({LineRule:linerule_Exact,Line:Height},false);var LinesCount=Math.ceil(Height/LineH);var TextPr=this.Internal_CalculateTextPr(this.Internal_GetStartPos());g_oTextMeasurer.SetTextPr(TextPr,this.Get_Theme());g_oTextMeasurer.SetFontSlot(fontslot_ASCII,1);var TMetrics={Ascent:null,Descent:null};this.private_RecalculateTextMetrics(TMetrics);var TDescent=TMetrics.Descent;var TAscent=TMetrics.Ascent;var THeight=0;if(null===TAscent||
null===TDescent)THeight=g_oTextMeasurer.GetHeight();else THeight=-TDescent+TAscent;var Koef=(Height-LineTD)/THeight;var NewFontSize=TextPr.FontSize*Koef;TextPr.FontSize=parseInt(NewFontSize*2)/2;g_oTextMeasurer.SetTextPr(TextPr,this.Get_Theme());g_oTextMeasurer.SetFontSlot(fontslot_ASCII,1);var TNewMetrics={Ascent:null,Descent:null};this.private_RecalculateTextMetrics(TNewMetrics);var TNewDescent=TNewMetrics.Descent;var TNewAscent=TNewMetrics.Ascent;var TNewHeight=0;if(null===TNewAscent||null===TNewDescent)TNewHeight=
g_oTextMeasurer.GetHeight();else TNewHeight=-TNewDescent+TNewAscent;var Descent=g_oTextMeasurer.GetDescender();var Ascent=g_oTextMeasurer.GetAscender();var Dy=Descent*Height/(Ascent-Descent)+TNewHeight-TNewAscent+LineTD;var PTextPr=new ParaTextPr({RFonts:{Ascii:{Name:TextPr.RFonts.Ascii.Name,Index:-1}},FontSize:TextPr.FontSize,Position:Dy});this.SelectAll();this.Add(PTextPr);this.RemoveSelection();return LinesCount};Paragraph.prototype.Get_FrameAnchorPara=function(){var FramePr=this.Get_FramePr();
if(undefined===FramePr)return null;var Next=this.Get_DocumentNext();while(null!=Next){if(type_Paragraph===Next.GetType()){var NextFramePr=Next.Get_FramePr();if(undefined===NextFramePr||false===FramePr.Compare(NextFramePr))return Next}Next=Next.Get_DocumentNext()}return Next};Paragraph.prototype.Split=function(NewParagraph){if(!NewParagraph)NewParagraph=new Paragraph(this.DrawingDocument,this.Parent);NewParagraph.DeleteCommentOnRemove=false;this.DeleteCommentOnRemove=false;this.RemoveSelection();NewParagraph.RemoveSelection();
var ContentPos=this.Get_ParaContentPos(false,false);var CurPos=ContentPos.Get(0);var TextPr=this.Get_TextPr(ContentPos);var oLogicDocument=this.GetLogicDocument();var oStyles=oLogicDocument&&oLogicDocument.GetStyles?oLogicDocument.GetStyles():null;if(oStyles&&(TextPr.RStyle===oStyles.GetDefaultEndnoteReference()||TextPr.RStyle===oStyles.GetDefaultFootnoteReference())){TextPr=TextPr.Copy();TextPr.RStyle=undefined}var NewElement=this.Content[CurPos].Split(ContentPos,1);if(null===NewElement){NewElement=
new ParaRun(NewParagraph);NewElement.Set_Pr(TextPr.Copy())}var NewContent=this.Content.slice(CurPos+1);this.Internal_Content_Remove2(CurPos+1,this.Content.length-CurPos-1);var EndRun=new ParaRun(this);EndRun.Add_ToContent(0,new ParaEnd);this.Internal_Content_Add(this.Content.length,EndRun);NewParagraph.Internal_Content_Remove2(0,NewParagraph.Content.length);NewParagraph.Internal_Content_Concat(NewContent);NewParagraph.Internal_Content_Add(0,NewElement);NewParagraph.Correct_Content();this.CopyPr(NewParagraph);
this.TextPr.Clear_Style();this.TextPr.Apply_TextPr(TextPr);var SectPr=this.Get_SectionPr();if(undefined!==SectPr){this.Set_SectionPr(undefined);NewParagraph.Set_SectionPr(SectPr)}this.MoveCursorToEndPos(false,false);NewParagraph.MoveCursorToStartPos(false);NewParagraph.DeleteCommentOnRemove=true;this.DeleteCommentOnRemove=true;return NewParagraph};Paragraph.prototype.Concat=function(Para,isUseConcatedStyle){this.DeleteCommentOnRemove=false;Para.DeleteCommentOnRemove=false;this.Remove_ParaEnd();var NearPosCount=
Para.NearPosArray.length;for(var Pos=0;Pos<NearPosCount;Pos++){var ParaNearPos=Para.NearPosArray[Pos];ParaNearPos.Classes[0]=this;ParaNearPos.NearPos.Paragraph=this;ParaNearPos.NearPos.ContentPos.Data[0]+=this.Content.length;this.NearPosArray.push(ParaNearPos)}this.Internal_Content_Concat(Para.Content);Para.ClearContent();this.Set_SectionPr(undefined);var SectPr=Para.Get_SectionPr();if(undefined!==SectPr){Para.Set_SectionPr(undefined);this.Set_SectionPr(SectPr)}this.DeleteCommentOnRemove=true;Para.DeleteCommentOnRemove=
true;if(true===isUseConcatedStyle)Para.CopyPr(this)};Paragraph.prototype.ConcatBefore=function(oPara){this.DeleteCommentOnRemove=false;oPara.DeleteCommentOnRemove=false;oPara.Remove_ParaEnd();for(var nPos=0,nCount=this.NearPosArray.length;nPos<nCount;++nPos){var oParaNearPos=this.NearPosArray[nPos];oParaNearPos.NearPos.ContentPos.Data[0]+=oPara.Content.length}for(var nPos=0,nCount=oPara.NearPosArray.length;nPos<nCount;++nPos){var oParaNearPos=oPara.NearPosArray[nPos];oParaNearPos.Classes[0]=this;
oParaNearPos.NearPos.Paragraph=this;this.NearPosArray.push(oParaNearPos)}for(var nPos=0,nCount=oPara.Content.length;nPos<nCount;++nPos)this.AddToContent(nPos,oPara.Content[nPos]);oPara.ClearContent();oPara.Set_SectionPr(undefined);this.DeleteCommentOnRemove=true;oPara.DeleteCommentOnRemove=true;oPara.CopyPr(this)};Paragraph.prototype.Continue=function(NewParagraph){var TextPr;if(this.IsEmpty())TextPr=this.TextPr.Value.Copy();else{var EndPos=this.Get_EndPos2(false);var CurPos=this.Get_ParaContentPos(false,
false);this.Set_ParaContentPos(EndPos,true,-1,-1);TextPr=this.Get_TextPr(this.Get_ParaContentPos(false,false)).Copy();this.Set_ParaContentPos(CurPos,false,-1,-1,false);TextPr.HighLight=highlight_None;var oStyles;if(this.bFromDocument&&this.LogicDocument&&(oStyles=this.LogicDocument.GetStyles())&&(TextPr.RStyle===oStyles.GetDefaultFootnoteReference()||TextPr.RStyle===oStyles.GetDefaultEndnoteReference()))TextPr.RStyle=undefined}this.CopyPr(NewParagraph);if(!this.HaveNumbering()&&!this.Lock.Is_Locked()){this.TextPr.Clear_Style();
this.TextPr.Apply_TextPr(TextPr)}NewParagraph.Internal_Content_Add(0,new ParaRun(NewParagraph));NewParagraph.Correct_Content();NewParagraph.MoveCursorToStartPos(false);for(var Pos=0,Count=NewParagraph.Content.length;Pos<Count;Pos++)if(para_Run===NewParagraph.Content[Pos].Type)NewParagraph.Content[Pos].Set_Pr(TextPr.Copy())};Paragraph.prototype.GetSelectionState=function(){var ParaState={};ParaState.CurPos={X:this.CurPos.X,Y:this.CurPos.Y,Line:this.CurPos.Line,ContentPos:this.Get_ParaContentPos(false,
false),RealX:this.CurPos.RealX,RealY:this.CurPos.RealY,PagesPos:this.CurPos.PagesPos};ParaState.Selection={Start:this.Selection.Start,Use:this.Selection.Use,StartPos:0,EndPos:0,Flag:this.Selection.Flag};if(true===this.Selection.Use){ParaState.Selection.StartPos=this.Get_ParaContentPos(true,true);ParaState.Selection.EndPos=this.Get_ParaContentPos(true,false)}return[ParaState]};Paragraph.prototype.SetSelectionState=function(State,StateIndex){if(State.length<=0)return;var ParaState=State[StateIndex];
this.CurPos.X=ParaState.CurPos.X;this.CurPos.Y=ParaState.CurPos.Y;this.CurPos.Line=ParaState.CurPos.Line;this.CurPos.RealX=ParaState.CurPos.RealX;this.CurPos.RealY=ParaState.CurPos.RealY;this.CurPos.PagesPos=ParaState.CurPos.PagesPos;this.Set_ParaContentPos(ParaState.CurPos.ContentPos,true,-1,-1);this.RemoveSelection();this.Selection.Start=ParaState.Selection.Start;this.Selection.Use=ParaState.Selection.Use;this.Selection.Flag=ParaState.Selection.Flag;if(true===this.Selection.Use)this.Set_SelectionContentPos(ParaState.Selection.StartPos,
ParaState.Selection.EndPos)};Paragraph.prototype.Get_ParentObject_or_DocumentPos=function(){this.Parent.Update_ContentIndexing();return this.Parent.Get_ParentObject_or_DocumentPos(this.Index)};Paragraph.prototype.Refresh_RecalcData=function(Data){var Type=Data.Type;var bNeedRecalc=false;var CurPage=0;switch(Type){case AscDFH.historyitem_Paragraph_AddItem:case AscDFH.historyitem_Paragraph_RemoveItem:{for(CurPage=this.Pages.length-1;CurPage>0;CurPage--)if(Data.Pos>this.Lines[this.Pages[CurPage].StartLine].Get_StartPos())break;
this.RecalcInfo.Set_Type_0(pararecalc_0_All);bNeedRecalc=true;break}case AscDFH.historyitem_Paragraph_Numbering:case AscDFH.historyitem_Paragraph_PStyle:case AscDFH.historyitem_Paragraph_Pr:case AscDFH.historyitem_Paragraph_PresentationPr_Bullet:case AscDFH.historyitem_Paragraph_PresentationPr_Level:{this.RecalcInfo.Set_Type_0(pararecalc_0_All);bNeedRecalc=true;this.CompiledPr.NeedRecalc=true;this.Recalc_RunsCompiledPr();break}case AscDFH.historyitem_Paragraph_Align:case AscDFH.historyitem_Paragraph_DefaultTabSize:case AscDFH.historyitem_Paragraph_Ind_First:case AscDFH.historyitem_Paragraph_Ind_Left:case AscDFH.historyitem_Paragraph_Ind_Right:case AscDFH.historyitem_Paragraph_ContextualSpacing:case AscDFH.historyitem_Paragraph_KeepLines:case AscDFH.historyitem_Paragraph_KeepNext:case AscDFH.historyitem_Paragraph_PageBreakBefore:case AscDFH.historyitem_Paragraph_Spacing_Line:case AscDFH.historyitem_Paragraph_Spacing_LineRule:case AscDFH.historyitem_Paragraph_Spacing_Before:case AscDFH.historyitem_Paragraph_Spacing_After:case AscDFH.historyitem_Paragraph_Spacing_AfterAutoSpacing:case AscDFH.historyitem_Paragraph_Spacing_BeforeAutoSpacing:case AscDFH.historyitem_Paragraph_WidowControl:case AscDFH.historyitem_Paragraph_Tabs:case AscDFH.historyitem_Paragraph_Borders_Between:case AscDFH.historyitem_Paragraph_Borders_Bottom:case AscDFH.historyitem_Paragraph_Borders_Left:case AscDFH.historyitem_Paragraph_Borders_Right:case AscDFH.historyitem_Paragraph_Borders_Top:case AscDFH.historyitem_Paragraph_FramePr:{bNeedRecalc=
true;break}case AscDFH.historyitem_Paragraph_Shd_Value:case AscDFH.historyitem_Paragraph_Shd_Color:case AscDFH.historyitem_Paragraph_Shd_Unifill:case AscDFH.historyitem_Paragraph_Shd:{if(this.Parent){var oDrawingShape=this.Parent.Is_DrawingShape(true);if(oDrawingShape&&oDrawingShape.getObjectType&&oDrawingShape.getObjectType()===AscDFH.historyitem_type_Shape)if(oDrawingShape.chekBodyPrTransform(oDrawingShape.getBodyPr())||oDrawingShape.checkContentWordArt(oDrawingShape.getDocContent()))bNeedRecalc=
true;if(this.Parent.IsTableHeader())bNeedRecalc=true}break}case AscDFH.historyitem_Paragraph_SectionPr:{if(this.Parent instanceof CDocument){this.Parent.UpdateContentIndexing();var nSectionIndex=this.Parent.GetSectionIndexByElementIndex(this.GetIndex());var oFirstElement=this.Parent.GetFirstElementInSection(nSectionIndex);if(oFirstElement)this.Parent.Refresh_RecalcData2(oFirstElement.GetIndex(),oFirstElement.private_GetRelativePageIndex(0))}break}case AscDFH.historyitem_Paragraph_PrChange:{if(Data instanceof
CChangesParagraphPrChange&&Data.IsChangedNumbering())bNeedRecalc=true;break}case AscDFH.historyitem_Paragraph_SuppressLineNumbers:{History.AddLineNumbersToRecalculateData();break}}if(true===bNeedRecalc){var Prev=this.Get_DocumentPrev();if(0===CurPage&&null!=Prev&&type_Paragraph===Prev.GetType()&&true===Prev.Get_CompiledPr2(false).ParaPr.KeepNext)Prev.Refresh_RecalcData2(Prev.Pages.length-1);return this.Refresh_RecalcData2(CurPage)}};Paragraph.prototype.Refresh_RecalcData2=function(CurPage){if(!CurPage)CurPage=

@ -807,11 +807,11 @@
isSafari_mobile = !isIE && !isChrome && check(/safari/) && (navigator.maxTouchPoints>0);
path += app + "/";
path += (config.type === "mobile" || isSafari_mobile)
path += "main"; /* (config.type === "mobile" || isSafari_mobile)
? "mobile"
: config.type === "embedded"
? "embed"
: "main";
: "main"; */
var index = "/index.html";
if (config.editorConfig) {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -652,6 +652,7 @@ define([
if (data.expire) { pad.expire = data.expire; }
if (data.password) { pad.password = data.password; }
if (data.channel || secret) { pad.channel = data.channel || secret.channel; }
if (data.readme) { pad.readme = 1; }
var s = getStore(data.teamId);
if (!s || !s.manager) { return void cb({ error: 'ENOTFOUND' }); }
@ -839,6 +840,7 @@ define([
channel: channel,
title: data.driveReadmeTitle,
owners: [ store.proxy.edPublic ],
readme: true
};
Store.addPad(clientId, fileData, cb);
}, {
@ -1155,6 +1157,12 @@ define([
pad.owners = owners;
}
pad.expire = expire;
if (pad.readme) {
delete pad.readme;
Feedback.send('OPEN_README');
}
if (h.mode === 'view') { return; }
// If we only have rohref, it means we have a stronger href
@ -1732,13 +1740,11 @@ define([
postMessage(clientId, "PAD_CACHE");
},
onCacheReady: function () {
channel.hasCache = true;
postMessage(clientId, "PAD_CACHE_READY");
},
onReady: function (pad) {
var padData = pad.metadata || {};
channel.data = padData;
channel.ready = true;
if (padData && padData.validateKey && store.messenger) {
store.messenger.storeValidateKey(data.channel, padData.validateKey);
}
@ -2624,22 +2630,28 @@ define([
// "cb" is wrapped in Util.once() and may have already been called
// if we have a local cache
var onReady = function (clientId, returned, cb) {
console.error('READY');
store.ready = true;
var proxy = store.proxy;
var manager = store.manager;
var userObject = store.userObject;
nThen(function (waitFor) {
if (manager) { return; }
if (!proxy.settings) { proxy.settings = NEW_USER_SETTINGS; }
if (!proxy.friends_pending) { proxy.friends_pending = {}; }
// Call onCacheReady if the manager is not yet defined
if (!manager) {
onCacheReady(clientId, waitFor());
manager = store.manager;
userObject = store.userObject;
}).nThen(function (waitFor) {
}
// Initialize RPC in parallel of onCacheReady in case a shared folder
// is RESTRICTED and requires RPC authentication
initAnonRpc(null, null, waitFor());
initRpc(null, null, waitFor());
// Update loading progress
postMessage(clientId, 'LOADING_DRIVE', {
type: 'migrate',
progress: 0
@ -2811,7 +2823,9 @@ define([
store.onRpcReadyEvt = Util.mkEvent(true);
store.loggedIn = typeof(data.userHash) !== "undefined";
var returned = {};
var returned = {
loggedIn: Boolean(data.userHash)
};
rt.proxy.on('create', function (info) {
store.realtime = info.realtime;
store.network = info.network;
@ -3064,14 +3078,19 @@ define([
if (obj.error === 'GET_HK') {
data.noDrive = false;
Store.init(clientId, data, _callback);
Feedback.send("NO_DRIVE_ERROR", true);
return;
}
}
Feedback.send("NO_DRIVE", true);
callback(obj);
});
}
initialized = true;
if (store.noDriveUid) {
Feedback.send('NO_DRIVE_CONVERSION', true);
}
store.data = data;
connect(clientId, data, function (ret) {

@ -73,7 +73,7 @@ define([
};
LocalStore.isLoggedIn = function () {
return typeof getUserHash() === "string";
return window.CP_logged_in || typeof getUserHash() === "string";
};
LocalStore.login = function (hash, name, cb) {

@ -503,6 +503,10 @@ var factory = function (Util, Hash, CPNetflux, Sortify, nThen, Crypto, Feedback)
var channel = config.channel;
var lastKnownHash = config.lastKnownHash || -1;
if (config.newTeam) { // XXX
lastKnownHash = undefined;
}
var ref = {
state: {
members: { },

@ -187,7 +187,7 @@ define([
team.rpc = call;
team.onRpcReadyEvt.fire();
cb();
});
}, Cache);
});
};
@ -351,10 +351,9 @@ define([
var team;
if (!ctx.store.proxy.teams[id]) { return; }
nThen(function (waitFor) {
if (ctx.cache[id]) { return; }
onCacheReady(ctx, id, lm, roster, keys, cId, waitFor());
}).nThen(function (waitFor) {
team = ctx.teams[id];
team = ctx.teams[id] || ctx.cache[id];
// Init Team RPC
if (!keys.drive.edPrivate) { return; }
initRpc(ctx, team, keys.drive, waitFor(function () {}));
@ -548,8 +547,8 @@ define([
lastKnownHash: rosterData.lastKnownHash,
onCacheReady: function (_roster) {
if (!cache) { return; }
console.error('Corrupted roster cache, cant load this team offline', teamData);
if (_roster && _roster.error === "CORRUPTED") {
console.error('Corrupted roster cache, cant load this team offline', teamData);
if (lm && typeof(lm.stop) === "function") { lm.stop(); }
waitFor.abort();
cb({error: 'CACHE_CORRUPTED_ROSTER'});
@ -692,10 +691,12 @@ define([
keys: rosterKeys,
store: ctx.store,
lastKnownHash: void 0,
newTeam: true,
Cache: Cache
}, waitFor(function (err, _roster) {
if (err) {
waitFor.abort();
console.error(err);
return void cb({error: 'ROSTER_ERROR'});
}
roster = _roster;

@ -213,10 +213,6 @@ define([
evStart.reg(function () { toolbar.forgotten(); });
break;
}
case STATE.FORBIDDEN: {
evStart.reg(function () { toolbar.deleted(); });
break;
}
case STATE.DELETED: {
evStart.reg(function () { toolbar.deleted(); });
break;

@ -812,7 +812,7 @@ define([
$err.find('a').click(function () {
funcs.gotoURL();
});
UI.findOKButton().click();
UI.findOKButton().click(); // FIXME this might be randomly clicking something dangerous...
UI.errorLoadingScreen($err, true, true);
});

@ -547,6 +547,9 @@ MessengerUI, Messages, Pages) {
hidden: true
});
$shareBlock.click(function () {
if (toolbar.isDeleted) {
return void UI.warn(Messages.deletedFromServer);
}
var title = (config.title && config.title.getTitle && config.title.getTitle())
|| (config.title && config.title.defaultName)
|| "";
@ -570,6 +573,9 @@ MessengerUI, Messages, Pages) {
h('span.cp-button-name', Messages.accessButton)
]));
$accessBlock.click(function () {
if (toolbar.isDeleted) {
return void UI.warn(Messages.deletedFromServer);
}
var title = (config.title && config.title.getTitle && config.title.getTitle())
|| (config.title && config.title.defaultName)
|| "";

@ -88,8 +88,8 @@
"cancel": "Cancelar",
"cancelButton": "Cancelar (ESC)",
"historyButton": "Exibir histórico do documento",
"history_next": "Ir para próxima versão",
"history_prev": "Ir para versão anterior",
"history_next": "Próxima versão",
"history_prev": "Versão anterior",
"history_closeTitle": "Fechar o histórico",
"history_restoreTitle": "Restaurar a versão selecionada do documento",
"history_restorePrompt": "Você tem certeza que deseja substituir a versão atual do documento pela que está sendo exibida agora?",
@ -115,7 +115,7 @@
"fm_searchName": "Busca",
"fm_searchPlaceholder": "Buscar...",
"fm_newButton": "Novo",
"fm_newButtonTitle": "Criar um novo bloco ou diretório",
"fm_newButtonTitle": "Criar um novo documento ou pasta, importe um arquivo na pasta atual.",
"fm_newFolder": "Novo diretório",
"fm_newFile": "Novo bloco",
"fm_folder": "Diretório",
@ -131,8 +131,8 @@
"fm_openParent": "Exibir no diretório",
"fm_noname": "Documento sem título",
"fm_emptyTrashDialog": "Você tem certeza que deseja limpar a lixeira??",
"fm_removeSeveralPermanentlyDialog": "Você tem certeza que deseja deletar estes {0} elementos da lixeira permanentemente?",
"fm_removePermanentlyDialog": "Você tem certeza que deseja deletar este elemento da lixeira permanentemente?",
"fm_removeSeveralPermanentlyDialog": "Você tem certeza que deseja deletar estes {0} itens do seu disco? Eles ainda estarão no disco dos usuários que os tenham guardado.",
"fm_removePermanentlyDialog": "Você tem certeza que deseja remover este item do seu disco? Este item permanecerá nos discos dos outros usuários que o tenham armazenado.",
"fm_restoreDialog": "Você tem certeza que deseja restaurar {0} de volta para seu diretório original?",
"fm_unknownFolderError": "O diretório selecionado ou visitado por último não existe mais. Abrindo diretório superior...",
"fm_contextMenuError": "Incapaz de abrir o menu de contextualização para este elementos. Se o problema persistir, tente recarregar a página.",
@ -140,7 +140,7 @@
"fm_categoryError": "Incapaz de abrir a categoria selecionada, Exibindo diretório raiz",
"fm_info_root": "Crie quantos diretórios aninhados aqui desejar para organizar seus arquivos..",
"fm_info_trash": "Empty your trash to free space in your CryptDrive.",
"fm_info_anonymous": "Você não está logado, então estes blocos podem ser deletados! (<a href=\"https://blog.cryptpad.fr/2017/05/17/You-gotta-log-in/\" target=\"_blank\">Descubra o porque</a>). <a href=\"/register/\">Cadastre-se</a> or <a href=\"/login/\">Entre</a> Para deixá-los salvos.",
"fm_info_anonymous": "Você não está logado, então estes documentos vão expirar em {0} dias. Limpar o histórico do seu navegador pode fazê-los desaparecer. <br><a href=\"/register/\">Registre-se</a> (nenhuma informação pessoal será requerida) ou <a href=\"/login/\">Faça login</a> para guarda-lo no seu disco. <a href=\"https://docs.cryptpad.fr/en/user_guide/user_account.html#account-types\" target=\"_blank\">Leia mais sobre contas registradas</a>.",
"fm_alert_anonymous": "Ola! Você está utilizando o CryptPad anonimamente, isto é ok, mas seus blocos podem ser apagados se ficarem muito tempo inativo. Nós desativamos as funções avançadas nas contas anônimas para que isto fique claro para você Este não é um bom lugar apra salvar senhas! Entenda: <a href=\"https://blog.cryptpad.fr/2017/05/17/You-gotta-log-in/\" target=\"_blank\">Clicando aqui!</a> Porque estamos fazendo isso e porque você deveria criar uma onta? <a href=\"/register/\">Sign up</a> and <a href=\"/login/\">Clique e entenda!</a>.",
"fm_error_cantPin": "Erro interno do servidor. Por favor recarregue a página e tente novamente.",
"fc_newfolder": "Nova pasta",
@ -149,7 +149,7 @@
"fc_open_ro": "Abrir (somente leitura)",
"fc_delete": "Deletar",
"fc_restore": "Restaurar",
"fc_remove": "Deletar permanentemente",
"fc_remove": "Remover",
"fc_empty": "Esvaziar lixeira",
"fc_prop": "Propriedades",
"fo_moveUnsortedError": "Você não pode mover uma pasta na lista de notas não organizadas",
@ -168,14 +168,14 @@
"login_invalUser": "É necessário um usuário",
"login_invalPass": "É necessário uma senha",
"login_unhandledError": "Um erro não esperado ocorreu :(",
"register_importRecent": "Importar histórico de blocos (Recomendado)",
"register_importRecent": "Importar documentos da sua sessão não registrada",
"register_acceptTerms": "Eu aceito <a href='/terms.html'>os termos de serviço</a>",
"register_passwordsDontMatch": "Senhas não coincidem!",
"register_mustAcceptTerms": "Você precisa aceitar os termos de serviço.",
"register_header": "Bem vindo ao CryptPad",
"register_header": "Registre-se",
"register_writtenPassword": "I have written down my username and password, proceed",
"register_cancel": "Go back",
"register_warning": "Zero Knowledge means that we can't recover your data if you lose your password.",
"register_cancel": "Cancelar",
"register_warning": "<i class='fa fa-warning'></i> Atenção",
"register_alreadyRegistered": "This user already exists, do you want to log in?",
"settings_title": "Settings",
"settings_save": "Save",
@ -197,21 +197,21 @@
"settings_userFeedback": "Enable user feedback",
"settings_anonymous": "You are not logged in. Settings here are specific to this browser.",
"settings_publicSigningKey": "Public Signing Key",
"settings_logoutEverywhereTitle": "Log out everywhere",
"settings_logoutEverywhereTitle": "Fechar as sessões remotas",
"settings_logoutEverywhere": "Log out of all other web sessions",
"settings_logoutEverywhereConfirm": "Are you sure? You will need to log in with all your devices.",
"upload_serverError": "Server Error: unable to upload your file at this time.",
"upload_uploadPending": "You already have an upload in progress. Cancel it and upload your new file?",
"upload_success": "Your file ({0}) has been successfully uploaded and added to your drive.",
"upload_notEnoughSpace": "There is not enough space for this file in your CryptDrive.",
"upload_tooLarge": "This file exceeds the maximum upload size.",
"upload_tooLarge": "Este arquivo excede o tamanho máximo permitido de envio para sua conta.",
"upload_choose": "Choose a file",
"upload_pending": "Pending",
"upload_cancelled": "Cancelled",
"upload_size": "Size",
"footer_aboutUs": "About us",
"about": "About",
"privacy": "Privacy",
"privacy": "Política de privacidade",
"contact": "Contact",
"terms": "ToS",
"blog": "Blog",
@ -239,7 +239,7 @@
"header_logoTitle": "Go to the main page",
"driveReadmeTitle": "What is CryptPad?",
"readme_welcome": "Welcome to CryptPad !",
"readme_p1": "Welcome to CryptPad, this is where you can take note of things alone and with friends.",
"readme_p1": "Bem vindo ao CryptPad, onde você pode fazer anotações sozinho e com contatos.",
"readme_p2": "This pad will give you a quick walk through of how you can use CryptPad to take notes, keep them organized and work together on them.",
"readme_cat1": "Get to know your CryptDrive",
"readme_cat1_l1": "Make a pad: In your CryptDrive, click {0} then {1} and you can make a pad.",
@ -286,79 +286,708 @@
"exportButton": "Exportar",
"saveTitle": "Salve o título (enter)",
"forgetButton": "Deletar",
"userListButton": "",
"chatButton": "",
"userAccountButton": "",
"uploadButton": "",
"uploadFolderButton": "",
"uploadButtonTitle": "",
"useTemplate": "",
"useTemplateOK": "",
"useTemplateCancel": "",
"template_import": "",
"template_empty": "",
"propertiesButton": "",
"propertiesButtonTitle": "",
"printText": "",
"printButtonTitle2": "",
"printBackground": "",
"printBackgroundButton": "",
"printBackgroundValue": "",
"printBackgroundNoValue": "",
"printBackgroundRemove": "",
"filePickerButton": "",
"filePicker_close": "",
"filePicker_description": "",
"filePicker_filter": "",
"tags_title": "",
"tags_add": "",
"tags_notShared": "",
"tags_duplicate": "",
"tags_noentry": "",
"slideOptionsText": "",
"slide_invalidLess": "",
"languageButton": "",
"themeButton": "",
"themeButtonTitle": "",
"viewEmbedTag": "",
"fileEmbedScript": "",
"fileEmbedTag": "",
"ok": "",
"show_help_button": "",
"help_button": "",
"historyText": "",
"openLinkInNewTab": "",
"pad_mediatagTitle": "",
"pad_mediatagWidth": "",
"pad_mediatagHeight": "",
"pad_mediatagRatio": "",
"pad_mediatagBorder": "",
"pad_mediatagPreview": "",
"pad_mediatagImport": "",
"pad_mediatagOptions": "",
"kanban_newBoard": "",
"kanban_item": "",
"kanban_todo": "",
"kanban_done": "",
"kanban_working": "",
"kanban_addBoard": "",
"poll_remove": "",
"poll_edit": "",
"poll_locked": "",
"poll_unlocked": "",
"poll_total": "",
"poll_comment_list": "",
"poll_comment_add": "",
"poll_comment_submit": "",
"poll_comment_remove": "",
"poll_comment_placeholder": "",
"poll_comment_disabled": "",
"oo_reconnect": "",
"oo_cantUpload": "",
"oo_uploaded": "",
"canvas_opacityLabel": "",
"canvas_widthLabel": "",
"userListButton": "Lista de usuário",
"chatButton": "Bate papo",
"userAccountButton": "Sua conta",
"uploadButton": "Enviar arquivos",
"uploadFolderButton": "Enviar pasta",
"uploadButtonTitle": "Enviar um arquivo novo para seu CryptDrive",
"useTemplate": "Iniciar com um modelo?",
"useTemplateOK": "Selecione um modelo (Enter)",
"useTemplateCancel": "Iniciar novo (Esc)",
"template_import": "Importar um modelo",
"template_empty": "Nenhum modelo disponível",
"propertiesButton": "Propriedades",
"propertiesButtonTitle": "Pegar propriedade do bloco",
"printText": "Imprimir",
"printButtonTitle2": "Imprima seu documento ou exporte para um arquivo PDF",
"printBackground": "Use uma imagem de fundo",
"printBackgroundButton": "Selecione uma imagem",
"printBackgroundValue": "<b>Fundo atual:</b> <em>{0}</em>",
"printBackgroundNoValue": "<em>Nenhuma imagem de fundo mostrada</em>",
"printBackgroundRemove": "Remova esta imagem de fundo",
"filePickerButton": "Incorpore um arquivo guardado no CryptDrive",
"filePicker_close": "Fechar",
"filePicker_description": "Escolha um arquivo do seu CryptDrive para incorporar ou envie um novo.",
"filePicker_filter": "Filtrar arquivos por nome",
"tags_title": "Etiquetas (somente para você)",
"tags_add": "Atualize as etiquetas para os blocos selecionados",
"tags_notShared": "Suas etiquetas não estão compartilhadas com outros usuários",
"tags_duplicate": "Etiqueta duplicada: {0}",
"tags_noentry": "Você não pode aplicar uma etiqueta em um bloco deletado!",
"slideOptionsText": "Opções",
"slide_invalidLess": "Estilo customizado inválido",
"languageButton": "Língua",
"themeButton": "Tema",
"themeButtonTitle": "Selecione o tema de cor para usar nos editores de código e slide",
"viewEmbedTag": "Para incorporar este bloco, inclua este iframe na sua página onde você quiser. Você pode alterar o estilo usando atributos de CSS ou HTML.",
"fileEmbedScript": "Para incorporar este arquivo, inclua este script na sua página para carregar o Media Tag:",
"fileEmbedTag": "Então coloque esta Media Tag onde quiser em sua página:",
"ok": "Ok",
"show_help_button": "Mostrar a ajuda",
"help_button": "Ajuda",
"historyText": "Histórico",
"openLinkInNewTab": "Abrir link em nova página",
"pad_mediatagTitle": "Configurações de Media-Tag",
"pad_mediatagWidth": "Largura (px)",
"pad_mediatagHeight": "Altura (px)",
"pad_mediatagRatio": "Manter a proporção",
"pad_mediatagBorder": "Largura da borda (px)",
"pad_mediatagPreview": "Visualização",
"pad_mediatagImport": "Salvar no seu CryptDrive",
"pad_mediatagOptions": "Propriedades da imagem",
"kanban_newBoard": "Nova board",
"kanban_item": "Item {0}",
"kanban_todo": "A fazer",
"kanban_done": "Feito",
"kanban_working": "Em progresso",
"kanban_addBoard": "Adicionar uma board",
"poll_remove": "Remover",
"poll_edit": "Editar",
"poll_locked": "Bloqueado",
"poll_unlocked": "Desbloqueado",
"poll_total": "TOTAL",
"poll_comment_list": "Comentários",
"poll_comment_add": "Adicione um comentário",
"poll_comment_submit": "Enviar",
"poll_comment_remove": "Delete este comentário",
"poll_comment_placeholder": "Seu comentário",
"poll_comment_disabled": "Publique esta enquete usando o botão ✓ para habilitar os comentários.",
"oo_reconnect": "A conexão com o servidor voltou. Clique OK para recarregar e continuar a edição.",
"oo_cantUpload": "Envio não permitido enquanto outros usuários estão presentes.",
"oo_uploaded": "Seu envio foi completado. Clique OK para recarregar a página ou cancele para continuar no modo somente leitura.",
"canvas_opacityLabel": "Opacidade: {0}",
"canvas_widthLabel": "Largura: {0}",
"storageStatus": "Armazenamento:<br /><b>{0}</b> usados do total <b>{1}</b>",
"upgradeAccount": "Atualizar conta",
"padNotPinnedVariable": "Este pad vai expirar em {4} dias de inatividade, {0} faça login{1} ou {2}registre-se{3} para preserva-lo."
"padNotPinnedVariable": "Este pad vai expirar em {4} dias de inatividade, {0} faça login{1} ou {2}registre-se{3} para preserva-lo.",
"settings_cursorColorTitle": "Cor do cursor",
"settings_changePasswordNewPasswordSameAsOld": "Sua nova senha precisa ser diferente da sua senha atual.",
"settings_changePasswordPending": "Sua senha está sendo atualizada. Por favor, não feche ou recarregue esta página enquanto o processo não termina.",
"settings_changePasswordError": "Um erro inesperado ocorreu. Se você não conseguir logar ou trocar sua senha, contate o administrador do CryptPad.",
"settings_changePasswordConfirm": "Você tem certeza de que quer trocar sua senha? Você terá que logar novamente em todos os seus dispositivos.",
"settings_changePasswordNewConfirm": "Confirme a nova senha",
"settings_changePasswordNew": "Nova senha",
"settings_changePasswordCurrent": "Senha atual",
"settings_changePasswordButton": "Trocar senha",
"settings_changePasswordHint": "Altere a senha da sua conta. Digite sua senha atual e confirme a nova senha teclando duas vezes.<br><b>Nós não podemos restaurar sua senha se você esquece-la. Tenha cuidado!</b>",
"settings_changePasswordTitle": "Altere sua senha",
"settings_ownDrivePending": "Sua conta está sendo atualizada. Por favor, não feche ou recarregue esta página enquanto o processo não termina.",
"settings_ownDriveConfirm": "Atualizar sua conta poderá levar algum tempo. Você precisará logar novamente em todos os seus dispositivos. Tem certeza?",
"settings_ownDriveButton": "Atualizar sua conta",
"settings_ownDriveHint": "Contas antigas não têm acesso aos novos recursos, por conta de razões técnicas. Uma atualização livre habilitará os recursos atuais e preparará seu CryptDrive para recursos futuros.",
"settings_ownDriveTitle": "Atualizar conta",
"settings_padSpellcheckLabel": "Habilitar verificação ortográfica nos blocos de texto",
"settings_padSpellcheckHint": "Esta opção lhe permite habilitar a verificação ortográfica nos blocos de texto. Erros de ortografia serão sublinhados em vermelho e você terá que apertar Ctrl ou Meta enquanto clica com o botão direito do mouse para ver as opções corretas.",
"settings_padSpellcheckTitle": "Verificação ortográfica",
"settings_padWidthLabel": "Reduza a largura do editor",
"settings_padWidthHint": "Alterne entre modos de página (predefinido) que limita a largura do editor de texto, e use a largura máxima da tela.",
"settings_padWidth": "Largura máxima do editor",
"settings_codeFontSize": "Tamanho da fonte no editor de código",
"settings_codeUseTabs": "Recue usando guias (no lugar de espaços)",
"settings_codeIndentation": "Recuo do editor de código (espaços)",
"settings_driveDuplicateLabel": "Esconder duplicados",
"settings_driveDuplicateHint": "Quando você move um bloco de sua propriedade para uma pasta compartilhada, uma cópia é mantida no seu CryptDrive para garantir que você mantenha o controle sobre ele. Você pode esconder os arquivos duplicados. Somente a versão compartilhada estará visível, enquanto não deletado, em todo caso o original será mostrado em sua localização anterior.",
"settings_driveDuplicateTitle": "Donos de blocos duplicados",
"settings_logoutEverywhereButton": "Sair",
"settings_deleted": "Sua conta foi deletada. Tecle OK para ir para a página inicial.",
"settings_deleteModal": "Compartilhe a seguinte informação com o administrador do seu CryptPad para que os dados sejam removidos do servidor deles.",
"settings_deleteButton": "Deletar sua conta",
"settings_deleteHint": "Deletar conta é uma ação permanente. Seu CryptDrive e sua lista de blocos serão deletados do servidor. O restante de seus blocos serão deletados em 90 dias se ninguém mais os tiver armazenado nos CryptDrive deles.",
"settings_deleteTitle": "Deletar conta",
"settings_userFeedbackTitle": "Comentário",
"settings_autostoreNo": "Manual (nunca perguntar)",
"settings_autostoreMaybe": "Manual (sempre perguntar)",
"settings_autostoreYes": "Automático",
"settings_autostoreHint": "<b>Automatico</b> Todos os blocos que visitou estão armazenados no seu CryptDrive.<br><b>Manual (sempre pergunta)<b> Se você não armazenou um bloco ainda, você será questionado se quer armazenar no seu CryptDrive.<br><b>Manual (nunca pergunta)</b> Blocos não são armazenados automaticamente no seu CryptPad. A opção para armazena-los estará escondida.",
"settings_autostoreTitle": "Bloco armazenado no CryptDrive",
"settings_resetThumbnailsDone": "Todas as miniaturas foram apagadas.",
"settings_resetThumbnailsDescription": "Limpar todos as miniaturas de blocos armazenadas no seu navegador.",
"settings_resetThumbnailsAction": "Limpar",
"settings_disableThumbnailsDescription": "Miniaturas são automaticamente criadas e armazenadas no seu navegador quando visita um novo bloco. Você pode desabilitar este recurso aqui.",
"settings_disableThumbnailsAction": "Desabilite a criação de miniaturas no seu CryptDrive",
"settings_thumbnails": "Miniaturas",
"settings_resetTipsAction": "Redefinir",
"settings_resetButton": "Remover",
"settings_resetNewTitle": "Limpar o CryptDrive",
"settings_exportErrorOther": "Ocorreu um erro enquanto tentava exportar este documento: {0}",
"settings_exportErrorMissing": "Este documento não foi encontrado em nossos servidores (expirou ou foi deletado pelo dono)",
"settings_exportErrorEmpty": "Este documento não pode ser exportado (vazio ou conteúdo inválido).",
"settings_exportErrorDescription": "Nós não conseguimos adicionar os seguintes documentos para exportar:",
"settings_exportError": "Visualizar erros",
"settings_export_done": "Pronto para baixar!",
"settings_export_compressing": "Compactando dados...",
"settings_export_download": "Baixando e desencriptando seus documentos...",
"settings_export_reading": "Lendo seu CryptDrive...",
"settings_exportCancel": "Você tem certeza de que quer cancelar a exportação? Você terá que recomeçar do início na próxima vez.",
"settings_exportWarning": "Nota: esta ferramenta está em uma versão beta e pode ter problemas de escalabilidade. Para uma melhor performance, recomendamos deixar esta aba em foco.",
"settings_exportFailed": "Se um bloco levar mais que 1 minuto para ser baixado, não será incluso na exportação. Será mostrado um link para qualquer bloco não exportado.",
"settings_exportDescription": "Por favor, aguarde enquanto baixamos e desencriptamos seus documentos. Isto pode levar alguns minutos. Ao fechar a aba o processo será interrompido.",
"settings_exportTitle": "Exportar seu CryptDrive",
"settings_backup2Confirm": "Isto baixará todos os seus blocos e arquivos do seu CryptDrive. Se quiser continuar, escolha um nome e clique em OK",
"settings_backup2": "Baixar meu CryptDrive",
"settings_backupHint2": "Baixe todos os documentos no seu disco. Os documentos serão baixados em formatos legíveis por outras aplicações quando o formato estiver disponível. Quando um formato não estiver disponível, os documentos serão baixados em um formato legível pelo CryptPad.",
"settings_backupHint": "Faça cópia de segurança ou restaure o conteúdo do seu CryptDrive. Não estará incluso o conteúdo de seus blocos, somente as chaves para acessa-los.",
"settings_backupCategory": "Cópia de segurança",
"settings_cat_subscription": "Subscrição",
"settings_cat_pad": "Rich text",
"settings_cat_code": "Código",
"settings_cat_cursor": "Cursor",
"settings_cat_drive": "CryptDrive",
"settings_cat_account": "Conta",
"register_emailWarning3": "Se você entendeu e quer usar seu email como nome de usuário assim mesmo, clique em Ok.",
"register_emailWarning2": "Você não pode resetar sua senha usando seu email como faz com outros serviços.",
"register_emailWarning1": "Você pode fazer isto se quiser, mas não será enviado para nosso servidor.",
"register_emailWarning0": "Parece que você enviou seu e-mail como nome de usuário.",
"register_whyRegister": "Por que registrar-se?",
"register_passwordTooShort": "Senhas precisam ter pelo menos {0} caracteres.",
"fc_hashtag": "Tags",
"fc_remove_sharedfolder": "Remover",
"fc_delete_owned": "Destruir",
"fc_collapseAll": "Colapsar todos",
"fc_expandAll": "Expandir todos",
"fc_openInCode": "Abri no editor de código",
"fc_color": "Alterar cor",
"fc_newsharedfolder": "Nova pasta compartilhada",
"fm_passwordProtected": "Senha protegida",
"fm_moveNestedSF": "Você não pode colocar uma pasta compartilhada com outra. A pasta {0} não foi movida.",
"fm_restoreDrive": "Restaurando seu disco para um estado anterior. Para melhores resultados, não faça alterações no seu disco enquanto este processo está em andamento.",
"fm_tags_used": "Número de usuários",
"fm_tags_name": "Nome da etiqueta",
"fm_deletedPads": "Estes blocos não existem mais no servidor, eles foram removidos do seu CryptDrive: {0}",
"fm_burnThisDrive": "Você tem certeza que deseja remover tudo que foi armazenado CryptPad pelo no seu navegador?<br>Isto removerá seu CryptDrive e o histórico do seu navegador, mas seus blocos continuarão existindo (encriptado) no seu servidor.",
"fm_padIsOwnedOther": "Este bloco pertence a outro usuário",
"fm_padIsOwned": "Você é o dono deste bloco",
"fm_burnThisDriveButton": "Apaga todas as informações guardadas CryptPad pelo no seu navegador",
"fm_prop_tagsList": "Etiquetas",
"fm_canBeShared": "Esta pasta pode ser compartilhada",
"fm_renamedPad": "Você deu um nome customizado para este bloco. O título compartilhado é:<br><b>{0}</b>",
"fm_viewGridButton": "Visualização em grade",
"fm_viewListButton": "Visualização em lista",
"fm_info_owned": "Você é o dono dos blocos mostrados aqui. Isto quer dizer que você pode remove-los permanentemente do servidor quando quiser. Se você o fizer, outros usuários não conseguirão acessa-los.",
"fm_info_sharedFolder": "Esta é uma pasta compartilhada. Você não está logado, então só pode acessar no modo somente leitura.<br><a href=\"/register/\">Registre-se</a> ou <a href=\"/login/\">Faça login</a> para habilitar a importação para seu CryptDrive ou poder modifica-la.",
"fm_info_recent": "Estes blocos foram recentemente abertos ou modificados por você ou pessoas que colaboraram.",
"fm_info_template": "Contêm todos os blocos guardados como modelo e você pode reusar quando criar um novo bloco.",
"fm_deleteOwnedPads": "Você tem certeza de que quer remover permanentemente estes blocos do servidor?",
"fm_deleteOwnedPad": "Você tem certeza de que quer remover permanentemente este bloco do servidor?",
"fm_sharedFolder": "Pasta compartilhada",
"fm_morePads": "Mais",
"fm_sharedFolderName": "Pasta compartilhada",
"fm_tagsName": "Etiquetas",
"fm_ownedPadsName": "Adquirido",
"fm_recentPadsName": "Blocos recentes",
"contacts_online": "Outro usuário desta sala está online",
"contacts_leaveRoom": "Sair desta sala",
"contacts_rooms": "Salas",
"contacts_fetchHistory": "Recuperar histórico antigo",
"contacts_removeHistoryServerError": "Ocorreu um erro ao remover seu histórico de bate-papo. Tente novamente mais tarde",
"contacts_confirmRemoveHistory": "Tem certeza de que quer remover permanentemente o histórico do seu bate-papo? Os dados não poderão ser restaurados",
"contacts_removeHistoryTitle": "Limpar o histórico do bate-papo",
"contacts_info4": "Qualquer participante pode limpar permanentemente o histórico do bate-papo",
"contacts_info3": "Dê um duplo clique no ícone para ver o perfil",
"contacts_info2": "Clique no ícone dos seus contatos para bater-papo com eles",
"contacts_info1": "Estes são seus contatos. Daqui você pode:",
"contacts_padTitle": "Bate-papo",
"contacts_warning": "Tudo que for digitado aqui é persistente e disponível para todos os atuais e futuros usuários deste bloco. Tenha cuidado com as informações sensíveis!",
"contacts_typeHere": "Digite a mensagem aqui...",
"contacts_confirmRemove": "Tem certeza de que quer remover <em>{0}</em> dos seus contatos?",
"contacts_remove": "Remover este contato",
"contacts_send": "Enviar",
"contacts_request": "<em>{0}</em> quer te adicionar como contato. <b>Aceitar<b>?",
"contacts_rejected": "Convite de contato rejeitado",
"contacts_added": "Convite de contato aceito.",
"contacts_title": "Contatos",
"userlist_addAsFriendTitle": "Enviar \"{0}\" uma requisição de contato",
"profile_viewMyProfile": "Ver meu perfil",
"profile_register": "Você precisa se inscrever para criar um perfil!",
"profile_error": "Erro ao criar seu perfil: {0}",
"profile_uploadTypeError": "Erro: seu avatar tem um tipo não permitido. Tipos permitidos são: {0}",
"profile_uploadSizeError": "Erro: seu avatar precisa ser menor que {0}",
"profile_upload": " Envie um novo avatar",
"profile_avatar": "Avatar",
"profileButton": "Perfil",
"canvas_imageEmbed": "Incorpore uma imagem do seu computador",
"canvas_currentBrush": "Pincel atual",
"canvas_saveToDrive": "Salve esta imagem como arquivo no seu CryptDrive",
"history_loadMore": "Carregar mais histórico",
"languageButtonTitle": "Escolha a língua para usar no realce de sintaxe",
"admin_updateLimitButton": "Atualizar cotas",
"admin_updateLimitHint": "Forçar uma atualização dos limites de armazenamento do usuário pode ser feito a qualquer momento, mas só é necessário em caso de erro",
"admin_updateLimitTitle": "Atualizar cotas de usuários",
"admin_registeredHint": "Número de usuários registrados na sua instância",
"admin_registeredTitle": "Usuários registrados",
"admin_activePadsHint": "Número de documentos exclusivos atualmente sendo visualizados ou editados",
"admin_activePadsTitle": "Blocos ativos",
"admin_activeSessionsHint": "Número de conexões websocket ativas (e único endereço de IP conectado)",
"admin_activeSessionsTitle": "Conexões ativas",
"adminPage": "Administração",
"admin_cat_stats": "Estatísticas",
"admin_cat_general": "Geral",
"admin_authError": "Somente administradores podem acessar esta página",
"fm_expirablePad": "Expira em: {0}",
"markdown_toc": "Conteúdo",
"survey": "CryptPad enquete",
"crowdfunding_popup_no": "Não agora",
"crowdfunding_popup_text": "<h3>Nós precisamos de sua ajuda!</h3> Para garantir que o CryptPad seja ativamente desenvolvido, considere dar suporte ao projeto pela página <a href=\"https://opencollective.com/cryptpad\">OpenCollective</a>, onde você poderá ver nosso <b>Roteiro</b> e <b>Metas de financiamento</b>.",
"crowdfunding_button2": "Ajuda CryptPad",
"crowdfunding_button": "CryptPad suporte",
"autostore_notAvailable": "Você precisa armazenar este bloco no seu CryptDrive antes de poder usar este recurso.",
"autostore_forceSave": "Armazene o arquivo no seu CryptDrive",
"autostore_saved": "O bloco foi armazenado no seu CryptDrive com sucesso!",
"autostore_error": "Erro inesperado: nós não conseguimos armazenar este bloco, por favor, tente novamente.",
"autostore_hide": "Não armazene",
"autostore_store": "Armazenamento",
"autostore_settings": "Você pode habilitar o armazenamento automático de bloco na página de <a href=\"/settings/\">Configurações</a>!",
"autostore_notstored": "Isto {0} não está no seu CryptDrive. Quer armazena-lo agora?",
"autostore_pad": "bloco",
"autostore_sf": "Pasta",
"autostore_file": "Arquivo",
"chrome68": "Parece que você está usando o navegador Chrome ou Chromium versão 68. Ele contém um bug que faz com que a página fique completamente branca após alguns segundos ou que a página não responda a cliques. Para corrigir esse problema, você pode alternar para outra guia e voltar ou tentar rolar na página. Este bug deve ser corrigido na próxima versão do seu navegador.",
"convertFolderToSF_confirm": "Esta pasta precisa ser convertida para pasta compartilhada para que outros possam vê-la. Continuar?",
"convertFolderToSF_SFChildren": "Esta pasta não pode ser convertida para uma pasta compartilhada porque ela já contém pastas compartilhadas. Mova essas pastas compartilhadas para outro lugar para continuar.",
"convertFolderToSF_SFParent": "Esta pasta não pode ser convertida para uma pasta compartilhada no local atual. Mova-o para fora da pasta compartilhada que o contém para continuar.",
"sharedFolders_share": "Compartilhe este link com outro usuário registrado para dar acesso a pasta compartilhada. Uma vez que ele acesse este link, a pasta compartilhada será adicionada ao CryptDrive dele.",
"sharedFolders_create_owned": "Pasta proprietária",
"sharedFolders_create_name": "Nome da pasta",
"sharedFolders_create": "Criar uma pasta compartilhada",
"sharedFolders_duplicate": "Alguns blocos que você está tentando mover já foi compartilhado na pasta de destino.",
"sharedFolders_forget": "Este bloco está armazenado somente em uma pasta compartilhada, você não pode movê-lo para a lixeira. Você pode usar seu CryptDrive se quiser deletá-lo.",
"share_mediatagCopy": "Copiar mediatag para a prancheta",
"share_embedCategory": "Embutido",
"share_linkEmbed": "Modo embutido (barra de ferramentas e lista de usuários escondidos)",
"share_contactCategory": "Contatos",
"share_linkCopy": "Cópia",
"share_linkOpen": "Visualização",
"share_linkPresent": "Atual",
"share_linkView": "Ver",
"share_linkEdit": "Editar",
"share_linkAccess": "Direitos de acesso",
"share_linkCategory": "Link",
"properties_changePasswordButton": "Enviar",
"properties_passwordSuccess": "A senha foi trocada com sucesso.<br>Pressione OK para recarregar e atualizar seu direito de acesso.",
"properties_passwordWarning": "A senha foi alterada com sucesso mas não conseguimos atualizar seu CryptDrive com o novo dado. Talvez você tenha que remover a versão anterior do novo bloco manualmente.<br>Pressione OK para recarregar e atualizar seu direito de acesso.",
"properties_passwordError": "Ocorreu um erro enquanto tentava trocar a senha. Por favor, tente novamente.",
"properties_passwordSame": "Senhas novas precisam ser diferentes das atuais.",
"properties_confirmChange": "Você tem certeza? Tocando a senha removerá o histórico. Usuários sem a nova senha perderão o acesso a este bloco",
"properties_confirmNew": "Você tem certeza? Adicionar uma senha vai trocar a URL deste bloco e removerá o histórico. Usuários sem senha perderão o acesso a este bloco",
"properties_changePassword": "Alterar a senha",
"properties_addPassword": "Adicione uma senha",
"password_submit": "Enviar",
"password_placeholder": "Digite a senha aqui...",
"password_error": "Documento não encontrado<br>Este erro pode ser causado por dois fatores: ou a senha é inválida, ou o documento foi destruído.",
"password_info": "O documento que você está tentando abrir não existe ou está protegido com uma nova senha. Digite a senha correta para acessar o conteúdo.",
"creation_newPadModalDescription": "Clique em um tipo de documento para cria-lo. Você também pode teclar <b>Tab</b> para selecionar o tipo e teclar <b>Enter</b> para confirmar.",
"creation_passwordValue": "Senha",
"creation_expiration": "Data de expiração",
"creation_noOwner": "Sem proprietário",
"creation_owners": "Proprietários",
"creation_create": "Criar",
"creation_newTemplate": "Novo modelo",
"creation_noTemplate": "Sem modelo",
"creation_password": "Senha\n",
"creation_expireMonths": "Mês(es)",
"creation_expireDays": "Dia(s)",
"creation_expireHours": "Hora(s)",
"creation_expireFalse": "Ilimitado",
"creation_expire": "Bloco expirando",
"creation_owned1": "Um item <b>proprietário</b> pode ser destruído quando o dono quiser. Destruindo um item proprietário o faz indisponível para outros usuários de CryptDrives.",
"creation_owned": "Bloco proprietário",
"creation_404": "Este bloco não existe. Use o seguinte formulário para criar um novo bloco.",
"help_genericMore": "Aprenda mais sobre como CryptPad pode trabalhar para você lendo nossa <a>Documentação</a>.",
"header_homeTitle": "Vá para a página do CryptPad",
"four04_pageNotFound": "Nós não encontramos a página que você procura.",
"features_f_subscribe_note": "Conta registrada precisa de assinatura",
"features_f_subscribe": "Assine",
"features_f_supporter_note": "Ajude o CryptPad ser financeiramente sustentável e mostre que e mostre que o software que aumenta a privacidade financiado voluntariamente pelos usuários deve ser a norma",
"features_f_supporter": "Privacidade de suporte",
"features_f_support_note": "Prioridade de resposta do time administrador por email e sistema de bilhete embutido",
"features_f_support": "Suporte rápido",
"features_f_storage2_note": "De 5GB até 50GB dependendo do plano, limite incrementado de {0}MB por arquivos enviados",
"features_f_storage2": "Espaço de armazenamento extra",
"features_f_reg_note": "Com benefícios adicionais",
"features_f_reg": "Todos os recursos de usuários registrado",
"features_f_register": "Registre-se gratuitamente",
"features_f_storage1_note": "Documentos armazenados no seu CryptDrive não são deletados por inatividade",
"features_f_storage1": "Armazenamento pessoal ({0})",
"features_f_file1_note": "Armazene arquivos no seu CryptDrive: imagens, PDFs, vídeos e mais. Compartilhe com seus contatos ou incorpore nos seus documentos. (máximo de {0}MB)",
"features_f_file1": "Envie e compartilhe arquivos",
"features_f_social_note": "Adicione contatos para colaboração segura, crie um perfil e acesso a controle refinados",
"features_f_social": "Características sociais",
"features_f_devices_note": "Acesse seu CryptDrive em qualquer lugar com sua conta de usuário",
"features_f_devices": "Seus blocos em todos os seus dispositivos",
"features_f_cryptdrive1_note": "Pastas, pastas compartilhadas, modelos, tags",
"features_f_cryptdrive1": "Funcionalidade do CryptDrive completa",
"features_f_anon_note": "Com funcionalidade adicional",
"features_f_anon": "Todas as características de usuários anônimos",
"features_f_storage0_note": "Documentos são deletados depois de {0} dias de inatividade",
"features_f_storage0": "Tempo de armazenamento limitado",
"features_f_cryptdrive0_note": "Habilitar o armazenamento dos blocos visitados no seu navegador a serem abertos mais tarde",
"features_f_cryptdrive0": "Limitar acesso ao CryptDrive",
"features_f_file0_note": "Ver e baixar documentos compartilhados por outros usuários",
"features_f_file0": "Documentos abertos",
"features_f_core_note": "Editar, Importar & Exportar, Histórico, Lista de usuário, Bate-papo",
"features_f_core": "Características comuns",
"features_f_apps": "Acesso a todas as aplicações",
"features_premium": "Premium",
"features_registered": "Registrado",
"features_anon": "Não registrado",
"features_title": "Características",
"features": "Características",
"whatis_drive": "Organização com CryptDrive",
"whatis_collaboration": "Colaboração privada",
"whatis_title": "O que é CryptPad?",
"topbar_whatIsCryptpad": "O que é CryptPad",
"main_catch_phrase": "Suíte de colaboração<br>fim-para-fim encriptada de código aberto",
"home_host": "Esta é uma instância independente do CryptPad.",
"mdToolbar_toc": "Índice",
"mdToolbar_code": "Código",
"mdToolbar_check": "Lista de tarefas",
"mdToolbar_list": "Lista com marcador",
"mdToolbar_nlist": "Lista ordenada",
"mdToolbar_quote": "Citação",
"mdToolbar_link": "Link",
"mdToolbar_heading": "Cabeçalho",
"mdToolbar_strikethrough": "Tachado",
"mdToolbar_italic": "Itálico",
"mdToolbar_bold": "Negrito",
"mdToolbar_tutorial": "https://www.markdowntutorial.com/",
"mdToolbar_help": "Ajuda",
"mdToolbar_defaultText": "Seu texto aqui",
"mdToolbar_button": "Mostrar ou esconder a barra de marcações",
"pad_base64": "Este bloco contem imagens armazenadas de maneira ineficiente. Estas imagens aumentarão significantemente o tamanho do bloco no seu CryptDrive, e fará com que seja carregado lentamente. Você pode migrar estes arquivos para um novo formato que será armazenado separadamente no seu CryptDrive. Você quer migrar estas imagens agora?",
"todo_removeTaskTitle": "Remove esta tarefa de sua lista",
"todo_markAsIncompleteTitle": "Marque esta tarefa como incompleta",
"todo_markAsCompleteTitle": "Marque esta tarefa como completada",
"todo_title": "CryptTodo",
"download_step2": "Desencriptando",
"download_step1": "Baixando",
"download_dl": "Baixar",
"download_mt_button": "Baixar",
"upload_up": "Enviar",
"upload_mustLogin": "Você precisa estar logado para enviar arquivos",
"upload_tooLargeBrief": "O arquivo excede o limite de {0}MB",
"upload_notEnoughSpaceBrief": "Não há espaço suficiente",
"uploadFolder_modal_forceSave": "Armazene arquivos no seu CryptDrive",
"uploadFolder_modal_owner": "Arquivos adquiridos",
"uploadFolder_modal_filesPassword": "Senha de arquivos",
"uploadFolder_modal_title": "Opções de envio de pastas",
"upload_modal_owner": "Arquivo adquirido",
"upload_modal_filename": "Nome do arquivo (extensão <em>{0}</em> adicionada automaticamente)",
"upload_modal_title": "Opções de envido de arquivo",
"upload_title": "Envio de arquivo",
"settings_cursorShowLabel": "Mostrar cursores",
"settings_cursorShowHint": "Você decide se quer ver a posição do cursor dos outros usuários nos documentos colaborativos.",
"settings_cursorShowTitle": "Mostrar a posição do cursor de outros usuários",
"settings_cursorShareLabel": "Compartilhe a posição",
"settings_cursorShareHint": "Você pode decidir se os outros usuários poderão ver a posição do seu cursor nos documentos colaborativos.",
"settings_cursorShareTitle": "Compartilhe a posição do meu cursor",
"settings_cursorColorHint": "Troque a cor associada ao seu usuário nos documentos colaborativos.",
"admin_updateLimitDone": "Atualização completada com sucesso",
"share_noContactsLoggedIn": "Você ainda não está conectado com ninguém no CryptPad. Compartilhe o link do seu perfil para que as pessoas lhe enviem solicitações de contato.",
"passwordFaqLink": "Leia mais sobre senhas",
"share_embedPasswordAlert": "Este item é protegido por senha. Quando você incorpora este bloco, os visualizadores serão solicitados a fornecer a senha.",
"share_contactPasswordAlert": "Este item é protegido por senha. Como você o está compartilhando com um contato do CryptPad, o destinatário não precisará inserir a senha.",
"share_linkPasswordAlert": "Este item é protegido por senha. Ao enviar o link, o destinatário deverá inserir a senha.",
"share_linkWarning": "Este link contém as chaves do seu documento. Os destinatários terão acesso irrevogável ao seu conteúdo.",
"pad_wordCount": "Palavras: {0}",
"teams_table_role": "Função",
"teams_table_owners": "Gerenciar equipe",
"teams_table_admins": "Gerenciar membros",
"teams_table_specificHint": "Essas são pastas compartilhadas mais antigas onde os visualizadores ainda têm permissão para editar os blocos existentes. Os blocos criados ou copiados para essas pastas terão permissões padrão.",
"teams_table_specific": "Exceções",
"teams_table_generic_own": "Gerenciar equipe: alterar o nome e avatar da equipe, adicionar ou remover proprietários, alterar a assinatura da equipe, excluir equipe.",
"teams_table_generic_admin": "Gerenciar membros: convide e revogue membros, mude as funções dos membros até administradores.",
"teams_table_generic_edit": "Editar: crie, modifique e exclua pastas e blocos.",
"teams_table_generic_view": "Visualizar: acesso a pastas e blocos (somente leitura).",
"teams_table_generic": "Funções e permissões",
"teams_table": "Funções",
"driveOfflineError": "Sua conexão com o CryptPad foi perdida. As alterações neste bloco não serão salvas em seu CryptDrive. Feche todas as guias do CryptPad e tente novamente em uma nova janela. ",
"properties_passwordSuccessFile": "A senha foi alterada com sucesso.",
"properties_passwordWarningFile": "A senha foi alterada com sucesso, mas não foi possível atualizar seu CryptDrive com os novos dados. Pode ser necessário remover a versão antiga do arquivo manualmente.",
"properties_confirmNewFile": "Tem certeza? Adicionar uma senha mudará o URL deste arquivo. Os usuários sem a senha perderão o acesso a este arquivo.",
"properties_confirmChangeFile": "Tem certeza? Os usuários sem a nova senha perderão o acesso a este arquivo.",
"password_error_seed": "Bloco não encontrado! <br> Este erro pode ser causado por dois fatores: uma senha foi adicionada / alterada ou o bloco foi excluído do servidor.",
"drive_sfPasswordError": "Senha errada",
"drive_sfPassword": "Sua pasta compartilhada {0} não está mais disponível. Ele foi excluído por seu proprietário ou agora está protegido com uma nova senha. Você pode remover esta pasta de seu CryptDrive ou recuperar o acesso usando a nova senha.",
"team_viewers": "Visualizadores",
"settings_codeBrackets": "Fechamento automático de parênteses",
"team_quota": "Limite de armazenamento de sua equipe",
"team_title": "Equipe: {0}",
"team_demoteMeConfirm": "Você está prestes a desistir de seus direitos. Você não poderá desfazer esta ação. Tem certeza?",
"team_pendingOwnerTitle": "Este administrador ainda não aceitou a oferta de propriedade.",
"team_pendingOwner": "(pendente)",
"team_deleteConfirm": "Você está prestes a excluir todos os dados de uma equipe inteira. Isso pode afetar o acesso de outros membros da equipe aos seus dados. Isto não pode ser desfeito. Tem certeza de que deseja continuar?",
"team_deleteButton": "Deletar",
"team_deleteHint": "Exclua a equipe e todos os documentos de propriedade exclusiva da equipe.",
"poll_bookmarked_col": "Esta é a sua coluna marcada. Ele sempre estará desbloqueado e exibido no início para você.",
"poll_bookmark_col": "Marque esta coluna para que esteja sempre desbloqueada e exibida no início para você",
"team_deleteTitle": "Exclusão de equipe",
"team_pending": "Convidado",
"sent": "Mensagem enviada",
"team_kickConfirm": "{0} saberá que você os removeu da equipe. Tem certeza?",
"team_ownerConfirm": "Os coproprietários podem modificar ou excluir a equipe e removê-lo como proprietário. Tem certeza?",
"team_rosterPromoteOwner": "Oferecer propriedade",
"owner_team_add": "{0} quer que você seja o proprietário da equipe <b> {1} </b>. Você aceita?",
"team_listSlot": "Vaga de equipe disponível",
"team_listTitle": "Suas equipes",
"team_maxTeams": "Cada conta de usuário só pode ser membro de {0} equipes.",
"team_infoContent": "Cada equipe tem seu próprio CryptDrive, cota de armazenamento, bate-papo e lista de membros. Os proprietários da equipe podem excluir toda a equipe, os administradores podem convidar ou expulsar membros, os membros podem deixar a equipe.",
"team_avatarHint": "500KB tamanho máximo (png, jpg, jpeg, gif)",
"team_avatarTitle": "Avatar da equipe",
"team_nameHint": "Defina o nome da equipe",
"team_nameTitle": "Nome do time",
"team_members": "Membros",
"team_admins": "Administradores",
"team_owner": "Proprietários",
"team_leaveConfirm": "Se você sair desta equipe, perderá o acesso ao CryptDrive, ao histórico de bate-papo e a outros conteúdos. Tem certeza?",
"team_leaveButton": "Deixar este time",
"team_inviteButton": "Convidar membros",
"team_rosterKick": "Tirar do time",
"team_rosterDemote": "Rebaixar",
"team_rosterPromote": "Promover",
"team_createName": "Nome do time",
"team_createLabel": "Criar um novo time",
"team_infoLabel": "Sobre times",
"team_cat_admin": "Administração",
"team_cat_drive": "Disco",
"team_cat_chat": "Bate-papo",
"team_cat_members": "Membros",
"team_cat_back": "De volta às equipes",
"team_cat_create": "Novo",
"team_cat_list": "Times",
"team_cat_general": "Sobre",
"team_declineInvitation": "{0} recusou sua oferta para se juntar à equipe: <b> {1} </b>",
"team_acceptInvitation": "{0} aceitou sua oferta para se juntar à equipe: <b> {1} </b>",
"team_kickedFromTeam": "{0} expulsou você do time: <b> {1} </b>",
"team_invitedToTeam": "{0} convidou você para se juntar a sua equipe: <b> {1} </b>",
"team_pcsSelectHelp": "A criação de um bloco próprio no disco de sua equipe dará a propriedade para a equipe.",
"team_pcsSelectLabel": "Armazenar em",
"team_inviteModalButton": "Convite",
"team_pickFriends": "Escolha quais contatos convidar para esta equipe",
"share_linkTeam": "Adicionar ao disco de equipe",
"owner_removedPending": "{0} cancelou sua oferta de propriedade para <b> {1} </b>",
"owner_removed": "{0} removeu sua propriedade de <b> {1} </b>",
"owner_request_declined": "{0} recusou sua oferta de ser proprietário de <b> {1} </b>",
"owner_request_accepted": "{0} aceitou sua oferta para ser proprietário de <b> {1} </b>",
"owner_request": "{0} quer que você seja o proprietário de <b> {1} </b>",
"owner_add": "{0} deseja que você seja o proprietário do bloco <b> {1} </b>. Você aceita?",
"owner_addConfirm": "Os coproprietários poderão alterar o conteúdo e removê-lo como proprietário. Tem certeza?",
"owner_removeMeConfirm": "Você está prestes a desistir de seus direitos de propriedade. Você não poderá desfazer esta ação. Tem certeza?",
"owner_removeConfirm": "Tem certeza de que deseja remover a propriedade dos usuários selecionados? Eles serão notificados desta ação.",
"owner_unknownUser": "desconhecido",
"owner_removePendingText": "Pendente",
"owner_removeText": "Proprietários",
"features_emailRequired": "Email requerido",
"features_pricing": "{0} a {2}€ por mês",
"features_noData": "Nenhuma informação pessoal necessária",
"homePage": "Página inicial",
"pricing": "Preços",
"properties_unknownUser": "{0} usuário (s) desconhecido (s)",
"requestEdit_sent": "Pedido enviado",
"requestEdit_accepted": "{1} concedeu a você direitos de edição para o bloco <b>{0}</b>",
"requestEdit_request": "{1} quer editar o bloco <b>{0}</b>",
"later": "Decidir depois",
"requestEdit_viewPad": "Abra o bloco em uma nova guia",
"requestEdit_confirm": "{1} solicitou a capacidade de editar o bloco <b> {0} </b>. Você gostaria de conceder acesso a eles?",
"requestEdit_button": "Solicitar direitos de edição",
"support_notification": "Um administrador respondeu ao seu tíquete de suporte",
"notifications_dismissAll": "Recusar tudo",
"notifications_cat_archived": "Histórico",
"notifications_cat_pads": "Compartilhados comigo",
"notifications_cat_friends": "Pedidos de contato",
"notifications_cat_all": "Todos",
"openNotificationsApp": "Abra o painel de notificações",
"notificationsPage": "Notificações",
"fc_noAction": "Nenhuma ação disponível",
"support_closed": "Este tíquete foi fechado",
"support_from": "<b>De:</b> {0}",
"support_showData": "Mostrar/ocultar dados do usuário",
"support_remove": "Remover o tíquete",
"support_close": "Fechar o tíquete",
"support_answer": "Responder",
"support_listHint": "Aqui está a lista de tíquetes enviados aos administradores e suas respostas. Um tíquete fechado não pode ser reaberto, mas você pode fazer um novo. Você pode ocultar tíquetes que foram fechados.",
"support_listTitle": "Tíquetes de suporte",
"support_cat_tickets": "Tíquetes existentes",
"support_formMessage": "Digite sua mensagem...",
"support_formContentError": "Erro: conteúdo está vazio",
"support_formTitleError": "Erro: Título está vazio",
"support_formButton": "Enviar",
"support_formHint": "Use este formulário para entrar em contato com os administradores com segurança sobre questões e dúvidas. <br> Observe que algumas dúvidas/questões já podem ter sido abordadas no <a href = \"https://docs.cryptpad.fr/en/user_guide/index. html \"rel =\" noopener noreferrer \"target =\" _ blank \"> Guia do usuário do CryptPad </a>. Por favor, não crie um novo tíquete se você já tem um tíquete aberto sobre o mesmo problema. Em vez disso, responda à sua mensagem original com informações adicionais.",
"support_formTitle": "Novo Tíquete",
"support_cat_new": "Novo tíquete",
"support_disabledHint": "Esta instância do CryptPad ainda não está configurada para usar um formulário de suporte.",
"support_disabledTitle": "Suporte não habilitado",
"admin_supportListHint": "Aqui está a lista de tíquetes enviados pelos usuários para a caixa de correio de suporte. Todos os administradores podem ver as mensagens e suas respostas. Um tíquete fechado não pode ser reaberto. Você só pode remover (ocultar) tíquetes fechados, e os tíquetes removidos ainda podem ser vistos por outros administradores.",
"admin_supportListTitle": "Caixa de correio de Suporte",
"admin_supportInitHint": "Você pode configurar uma caixa de correio de suporte para fornecer aos usuários de sua instância do CryptPad uma maneira de contatá-lo com segurança se tiverem um problema com sua conta.",
"admin_supportInitTitle": "Suporte para inicialização de caixa de correio",
"admin_supportAddError": "Chave privada inválida",
"admin_supportAddKey": "Adicionar chave privada",
"admin_supportInitPrivate": "Sua instância do CryptPad está configurada para usar uma caixa de correio de suporte, mas sua conta não tem a chave privada correta para acessá-la. Use o seguinte formulário para adicionar ou atualizar a chave privada da sua conta.",
"admin_supportInitHelp": "Seu servidor ainda não está configurado para ter uma caixa de correio de suporte. Se você deseja que uma caixa de correio de suporte receba mensagens de seus usuários, peça ao administrador do servidor para executar o script localizado em \"./scripts/generate-admin-keys.js\" e, em seguida, armazene a chave pública em \"config.js \"arquivo e enviar a chave privada.",
"admin_cat_support": "Suporte",
"supportPage": "Suporte",
"fm_info_sharedFolderHistory": "Este é apenas o histórico da sua pasta compartilhada: <b> {0} </b> <br/> Seu CryptDrive permanecerá no modo somente leitura enquanto você navega.",
"notifications_dismiss": "Recusar",
"share_withFriends": "Compartilhar",
"share_linkFriends": "Compartilhar com contatos",
"share_filterFriend": "Busca por nome",
"notification_folderShared": "{0} compartilhou uma pasta com você: <b>{1}</b>",
"notification_fileShared": "{0} compartilhou um arquivo com você: <b>{1}</b>",
"notification_padShared": "{0} compartilhou um bloco com você: <b>{1}</b>",
"isNotContact": "{0} <b>não</b> é um de seus contatos",
"isContact": "{0} é um de seus contatos",
"profile_friendRequestSent": "Requisição de contato pendente...",
"profile_info": "Outros usuários podem encontrar seu perfil por meio de seu avatar em listas de usuários de documentos.",
"profile_addLink": "Adicione um link para o seu website",
"profile_editDescription": "Edite sua descrição",
"profile_addDescription": "Adicione uma descrição",
"notifications_empty": "Nenhuma notificação disponível",
"friendRequest_notification": "<b>{0}</b> enviou a você uma solicitação de contato",
"friendRequest_received": "<b>{0}</b> quer ser seu contato",
"friendRequest_accepted": "<b>{0}</b> aceitou sua requisição de contato",
"friendRequest_declined": "<b>{0}</b> recusou sua solicitação de contato",
"friendRequest_decline": "Declinar",
"friendRequest_accept": "Aceitar (Enter)",
"friendRequest_later": "Decidir depois",
"drive_activeOld": "Blocos menos recentes",
"drive_active28Days": "Últimas 4 semanas",
"drive_active7Days": "Últimos 7 dias",
"drive_active1Day": "Últimas 24 horas",
"settings_codeSpellcheckLabel": "Habilite a verificação ortográfica no editor de código",
"settings_codeSpellcheckTitle": "Verificação ortográfica",
"admin_diskUsageButton": "Gerar relatório",
"admin_diskUsageHint": "Quantidade de espaço de armazenamento consumido por vários recursos do CryptPad",
"admin_diskUsageTitle": "Uso de disco",
"timeoutError": "Um erro interrompeu sua conexão com o servidor. <br> Pressione <em> Esc </em> para recarregar a página.",
"contact_email": "Email",
"contact_chat": "Bate-papo",
"contact_bug": "Reportar Bug",
"contact_devHint": "Para solicitações de recursos, melhorias de usabilidade ou para dizer obrigado.",
"contact_dev": "Contate os desenvolvedores",
"contact_adminHint": "Para quaisquer problemas relacionados à sua conta, limite de armazenamento ou disponibilidade do serviço.\n",
"contact_admin": "Contate os administradores",
"footer_tos": "Temos de Serviço",
"footer_legal": "Válido",
"footer_donate": "Doe",
"footer_team": "Contribuidores",
"footer_product": "Produto",
"admin_flushCacheDone": "Cache limpo com sucesso",
"admin_flushCacheButton": "Limpar cache",
"admin_flushCacheHint": "Força os usuários a baixar os ativos do cliente mais recentes (apenas se o seu servidor estiver no modo novo)",
"admin_flushCacheTitle": "Limpar cache HTTP",
"settings_padNotifTitle": "Notificações de comentários",
"comments_comment": "Comentário",
"comments_resolve": "Resolve",
"comments_reply": "Responder",
"comments_submit": "Enviar",
"comments_edited": "Editado",
"comments_deleted": "Comentário excluído pelo autor",
"mentions_notification": "{0} mencionou você em <b> {1} </b>",
"unknownPad": "Bloco desconhecido",
"comments_notification": "Respostas ao seu comentário \"{0}\" em <b> {1} </b>",
"cba_title": "Cores do autor",
"oo_login": "Faça login ou registre-se para melhorar o desempenho das planilhas.",
"cba_hide": "Esconder as cores do autor",
"cba_show": "Mostrar cores do autor",
"cba_disable": "Limpar e desativar",
"cba_enable": "Ativar",
"cba_hint": "Esta configuração será lembrada quando você criar seu próximo bloco.",
"cba_properties": "Cores do autor (experimental)",
"cba_writtenBy": "Escrito por: {0}",
"canvas_select": "Selecionar",
"canvas_brush": "Pincel",
"admin_openFilesHint": "Número de descritores de arquivo atualmente abertos no servidor.",
"admin_openFilesTitle": "Abrir arquivos",
"profile_copyKey": "Copiar chave pública",
"oo_isLocked": "sincronizando mudanças, por favor aguarde",
"kanban_editBoard": "Edite este quadro",
"kanban_editCard": "Edite este cartão",
"kanban_clearFilter": "Filtro limpo",
"kanban_conflicts": "Atualmente editando:",
"kanban_noTags": "Nenhuma tag",
"kanban_tags": "Filtrar por tag",
"kanban_delete": "Apagar",
"kanban_color": "Cor",
"kanban_body": "Conteúdo",
"kanban_title": "Título",
"teams": "Times",
"allow_text": "Usar uma lista de acesso significa que apenas usuários e proprietários selecionados poderão acessar este documento.",
"logoutEverywhere": "Sair de todos os lugares",
"owner_text": "O (s) proprietário (s) de um bloco são os únicos usuários autorizados a: adicionar / remover proprietários, restringir o acesso ao bloco com uma lista de acesso ou excluir o painel.",
"access_muteRequests": "Silenciar solicitações de acesso para este teclado",
"allow_label": "Lista de acesso: {0}",
"allow_disabled": "Desativado",
"allow_enabled": "Ativado",
"allow_checkbox": "Habilitar lista de acesso",
"access_noContact": "Nenhum outro contato para adicionar",
"contacts": "Contatos",
"restrictedError": "Você não está autorizado a acessar este documento",
"accessButton": "Acesso",
"access_allow": "Lista",
"access_main": "Acesso",
"copy_title": "{0} (cópia)",
"makeACopy": "Faça uma cópia",
"settings_trimHistoryHint": "Economize espaço de armazenamento excluindo o histórico de sua unidade e notificações. Isso não afetará o histórico de seus eletrodos. Você pode excluir o histórico dos pads em sua caixa de diálogo de propriedades.",
"settings_trimHistoryTitle": "Apagar histórico",
"trimHistory_noHistory": "Nenhum histórico pode ser excluído",
"trimHistory_currentSize": "Tamanho atual do histórico: <b> {0} </b>",
"trimHistory_needMigration": "<a> Atualize seu CryptDrive </a> para ativar este recurso.",
"trimHistory_success": "O histórico foi excluído",
"trimHistory_error": "Erro ao excluir histórico",
"trimHistory_getSizeError": "Erro ao calcular o tamanho do histórico de sua unidade",
"trimHistory_button": "Apagar histórico",
"historyTrim_contentsSize": "Conteúdo? {0}",
"historyTrim_historySize": "Histórico: {0}",
"areYouSure": "Você tem certeza?",
"settings_safeLinksHint": "O CryptPad inclui as chaves para descriptografar seus blocos em seus links. Qualquer pessoa com acesso ao seu histórico de navegação pode potencialmente ler seus dados. Isso inclui extensões de navegador intrusivas e navegadores que sincronizam seu histórico entre dispositivos. Ativar \"links seguros\" evita que as chaves entrem no seu histórico de navegação ou sejam exibidas na barra de endereço, sempre que possível. É altamente recomendável ativar esse recurso e usar o menu {0} Compartilhar.",
"profile_login": "Você precisa fazer login para adicionar este usuário aos seus contatos",
"dontShowAgain": "Não mostra de novo",
"safeLinks_error": "Este link foi copiado da barra de endereço do navegador e não fornece acesso ao documento. Use o menu <i class = \"fa fa-shhare-alt\"> </i> <b> Compartilhar </b> para compartilhar diretamente com os contatos ou copie o link. <a href=\"https://docs.cryptpad.fr/en/user_guide/user_account.html#confidentiality\"> Leia mais sobre o recurso Links Seguros </a>.\n",
"settings_safeLinksCheckbox": "Habilitar links seguros",
"settings_safeLinksTitle": "Links Seguros",
"settings_cat_security": "Confidencialidade",
"imprint": "Aviso Legal",
"oo_sheetMigration_anonymousEditor": "A edição desta planilha está desabilitada para usuários não registrados até que ela seja atualizada para a versão mais recente por um usuário registrado.",
"oo_sheetMigration_complete": "Versão atualizada disponível, pressione OK para recarregar.",
"oo_sheetMigration_loading": "Atualizando sua planilha para a versão mais recente. Aguarde aproximadamente 1 minuto.",
"oo_exportInProgress": "Exportação em andamento",
"oo_importInProgress": "Importação em andamento",
"oo_invalidFormat": "Este arquivo não pode ser importado",
"oo_exportChrome": "A exportação para formatos do Microsoft Office está atualmente disponível apenas no Google Chrome.",
"burnAfterReading_warningDeleted": "Este bloco foi excluído permanentemente, uma vez que você feche esta janela, você não poderá acessá-lo novamente.",
"burnAfterReading_proceed": "ver e deletar",
"burnAfterReading_warningAccess": "Este documento se autodestruirá. Ao clicar no botão abaixo, você verá o conteúdo uma vez antes de ser excluído permanentemente. Ao fechar esta janela, você não poderá acessá-la novamente. Se você não estiver pronto para prosseguir, pode fechar esta janela e voltar mais tarde.",
"burnAfterReading_generateLink": "Clique no botão abaixo para gerar um link.",
"burnAfterReading_warningLink": "Você configurou este bloco para se autodestruir. Assim que o destinatário visitar este link, ele poderá ver o pad uma vez antes de ser excluído permanentemente.",
"burnAfterReading_linkBurnAfterReading": "Ver uma vez e se autodestruir",
"team_inviteLinkError": "Ocorreu um erro ao criar o link.",
"team_inviteInvalidLinkError": "Este link de convite não é válido.",
"team_links": "Links de convite",
"team_cat_link": "Link de convite",
"team_inviteGetData": "Obtendo dados da equipe",
"team_inviteTitle": "Convite da equipe",
"team_inviteJoin": "Junte-se ao time",
"team_invitePasswordLoading": "Descriptografando o convite",
"team_inviteEnterPassword": "Por favor, digite a senha do convite para continuar.",
"team_invitePleaseLogin": "Por favor, faça o login ou registre-se para aceitar este convite.",
"team_inviteFromMsg": "{0} convidou você para se juntar à equipe <b> {1} </b>",
"team_inviteFrom": "De:",
"team_inviteLinkCopy": "Link de cópia",
"team_inviteLinkCreate": "Criar link",
"team_inviteLinkErrorName": "Adicione um nome para a pessoa que você está convidando. Eles podem mudar isso mais tarde. ",
"team_inviteLinkWarning": "A primeira pessoa a acessar este link poderá ingressar nesta equipe e visualizar seu conteúdo. Compartilhe com cuidado.",
"team_inviteLinkLoading": "Gerando seu link",
"team_inviteLinkNoteMsg": "Esta mensagem será exibida antes que o destinatário decida se deseja entrar para esta equipe.",
"team_inviteLinkNote": "Adicione uma mensagem pessoal",
"team_inviteLinkSetPassword": "Proteja o link com uma senha (recomendado)",
"team_inviteLinkTempName": "Nome temporário (visível na lista de convites pendentes)",
"team_inviteLinkTitle": "Crie um convite personalizado para esta equipe",
"contacts_muteInfo": "Você não receberá notificações ou mensagens de usuários ignorados. <br> Eles não saberão que você os ignorou. ",
"contacts_mutedUsers": "Contas silenciadas",
"contacts_manageMuted": "Gerenciar sem som",
"contacts_unmute": "Com som",
"contacts_mute": "Mudo",
"share_noContactsNotLoggedIn": "Faça login ou registre-se para ver seus contatos existentes e adicionar novos.",
"share_copyProfileLink": "Copiar link do perfil"
}

@ -578,7 +578,7 @@ define([
// Scroll into view
if (!$last.length) { return; }
var visible = UIElements.isVisible($last[0], Env.$inner);
var visible = UIElements.isVisible($last[0], Env.$contentContainer);
if (!visible) { $last[0].scrollIntoView(); }
};

@ -908,7 +908,7 @@ define([
$(a).click(function (e) {
e.preventDefault();
e.stopPropagation();
if (!obj.el || UIElements.isVisible(obj.el, $inner)) { return; }
if (!obj.el || UIElements.isVisible(obj.el, $contentContainer)) { return; }
obj.el.scrollIntoView();
});
a.innerHTML = title;

@ -7,7 +7,10 @@ define([
var onLinkClicked = function (e, inner) {
var $target = $(e.target);
if (!$target.is('a')) { return; }
if (!$target.is('a')) {
$target = $target.closest('a');
if (!$target.length) { return; }
}
var href = $target.attr('href');
if (!href) { return; }
var $inner = $(inner);
@ -66,7 +69,7 @@ define([
// Bubble to open the link in a new tab
$inner.click(function (e) {
removeClickedLink($inner);
if (e.target.nodeName.toUpperCase() === 'A') {
if (e.target.nodeName.toUpperCase() === 'A' || $(e.target).closest('a').length) {
return void onLinkClicked(e, inner);
}
});

@ -1166,6 +1166,7 @@ define([
var $drawer = APP.toolbar.$drawer;
metadataMgr.onChange(function () {
if (!APP.proxy) { return; }
var md = copyObject(metadataMgr.getMetadata());
APP.proxy.metadata = md;
});
@ -1365,6 +1366,8 @@ define([
$('#cp-app-poll-comments-add-title').remove();
}
common.getPadAttribute('userid', function (e, userid) {
if (e) { console.error(e); }
var rt = APP.rt = Listmap.create(listmapConfig);
APP.proxy = rt.proxy;
@ -1373,16 +1376,14 @@ define([
.on('ready', function (info) {
if (!firstConnection) { return; } // TODO fix this issue in listmap
firstConnection = false;
common.getPadAttribute('userid', function (e, userid) {
if (e) { console.error(e); }
APP.userid = userid;
onReady(info, userid);
});
})
.on('disconnect', onDisconnect)
.on('reconnect', onReconnect)
.on('error', onError);
});
});
};
main();
});

@ -208,6 +208,7 @@ define([
};
var showCategories = function (cat) {
hideCategories();
if (!Array.isArray(cat)) { return void console.error("invalid category"); }
cat.forEach(function (c) {
APP.$rightside.find('.'+c).show();
});
@ -219,6 +220,7 @@ define([
var metadataMgr = common.getMetadataMgr();
var privateData = metadataMgr.getPrivateData();
var active = privateData.category || 'tickets';
if (!categories[active]) { active = 'tickets'; }
common.setHash(active);
Object.keys(categories).forEach(function (key) {
var $category = $('<div>', {

Loading…
Cancel
Save