diff --git a/www/common/application_config_internal.js b/www/common/application_config_internal.js index 0f91ea447..c58856d09 100644 --- a/www/common/application_config_internal.js +++ b/www/common/application_config_internal.js @@ -20,7 +20,7 @@ define(function() { * users and these users will be redirected to the login page if they still try to access * the app */ - config.registeredOnlyTypes = ['file', 'contacts', 'oodoc', 'ooslide', 'notifications', 'support']; + config.registeredOnlyTypes = ['file', 'contacts', 'notifications', 'support']; /* CryptPad is available is multiple languages, but only English and French are maintained * by the developers. The other languages may be outdated, and any missing string for a langauge diff --git a/www/common/onlyoffice/inner.js b/www/common/onlyoffice/inner.js index 3ddb96b29..b71774b12 100644 --- a/www/common/onlyoffice/inner.js +++ b/www/common/onlyoffice/inner.js @@ -1449,6 +1449,29 @@ define([ }; */ + APP.getUserColor = function (userId) { + var hex; + Object.keys(content.ids || {}).some(function (k) { + var u = content.ids[k]; + if (Number(u.ooid) === Number(userId)) { + var md = common.getMetadataMgr().getMetadataLazy(); + if (md && md.users && md.users[u.netflux]) { + hex = md.users[u.netflux].color; + } + return true; + } + }); + if (hex) { + var rgb = Util.hexToRGB(hex); + return { + r: rgb[0], + g: rgb[1], + b: rgb[2], + a: 255 + }; + } + }; + APP.UploadImageFiles = function (files, type, id, jwt, cb) { return void cb(); }; @@ -2260,6 +2283,7 @@ define([ $contentContainer: $('#cp-app-oo-container') }; toolbar = APP.toolbar = Toolbar.create(configTb); + toolbar.showColors(); Title.setToolbar(toolbar); if (window.CP_DEV_MODE) { diff --git a/www/common/onlyoffice/v4/sdkjs/cell/sdk-all-min.js b/www/common/onlyoffice/v4/sdkjs/cell/sdk-all-min.js index 7c7cc71c5..41705be0e 100644 --- a/www/common/onlyoffice/v4/sdkjs/cell/sdk-all-min.js +++ b/www/common/onlyoffice/v4/sdkjs/cell/sdk-all-min.js @@ -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>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-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=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=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=""+option.asc_getCodePage()+"";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+=""+ -option.asc_getCodePage()+"";if(null!=delimiter)_param+=""+delimiter+"";if(null!=delimiterChar)_param+=""+delimiterChar+"";window["AscDesktopEditor"]["SetAdvancedOptions"](_param)}else if(window["Asc"].c_oAscAdvancedOptionsID.DRM===idOption){var _param=""+AscCommon.CopyPasteCorrectString(option.asc_getPassword())+"";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)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;LineIndexEndX)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=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;PageIndexx2?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(yx2?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;nIndexPoints[nIndex].X)_y=top+dKoefY*Points[nIndex].Y-shift;else if(PrevXPoints[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(PrevXPoints[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>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>>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(k0)setTimeout(function(){fRetry()},timeout);else fError()};Backoff.prototype.nextTimeout=function(){var timeout=-1;if(this.attempts0)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-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=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=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=""+option.asc_getCodePage()+"";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+=""+option.asc_getCodePage()+"";if(null!=delimiter)_param+=""+delimiter+"";if(null!=delimiterChar)_param+=""+delimiterChar+"";window["AscDesktopEditor"]["SetAdvancedOptions"](_param)}else if(window["Asc"].c_oAscAdvancedOptionsID.DRM===idOption){var _param=""+ +AscCommon.CopyPasteCorrectString(option.asc_getPassword())+"";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)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;LineIndexEndX)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=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;PageIndexx2?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(yx2?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;nIndexPoints[nIndex].X)_y=top+dKoefY*Points[nIndex].Y-shift;else if(PrevXPoints[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;nIndexPoints[nIndex].X)y=Points[nIndex].Y-ShiftY;else if(PrevXPoints[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>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>>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(k0)setTimeout(function(){fRetry()}, +timeout);else fError()};Backoff.prototype.nextTimeout=function(){var timeout=-1;if(this.attempts0)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; diff --git a/www/common/onlyoffice/v4/sdkjs/slide/sdk-all-min.js b/www/common/onlyoffice/v4/sdkjs/slide/sdk-all-min.js index 1d29c99f1..b02eeb9de 100644 --- a/www/common/onlyoffice/v4/sdkjs/slide/sdk-all-min.js +++ b/www/common/onlyoffice/v4/sdkjs/slide/sdk-all-min.js @@ -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>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-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=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=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=""+option.asc_getCodePage()+"";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+=""+ -option.asc_getCodePage()+"";if(null!=delimiter)_param+=""+delimiter+"";if(null!=delimiterChar)_param+=""+delimiterChar+"";window["AscDesktopEditor"]["SetAdvancedOptions"](_param)}else if(window["Asc"].c_oAscAdvancedOptionsID.DRM===idOption){var _param=""+AscCommon.CopyPasteCorrectString(option.asc_getPassword())+"";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)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;LineIndexEndX)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=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;PageIndexx2?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(yx2?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;nIndexPoints[nIndex].X)_y=top+dKoefY*Points[nIndex].Y-shift;else if(PrevXPoints[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(PrevXPoints[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>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>>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(k0)setTimeout(function(){fRetry()},timeout);else fError()};Backoff.prototype.nextTimeout=function(){var timeout=-1;if(this.attempts0)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-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=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=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=""+option.asc_getCodePage()+"";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+=""+option.asc_getCodePage()+"";if(null!=delimiter)_param+=""+delimiter+"";if(null!=delimiterChar)_param+=""+delimiterChar+"";window["AscDesktopEditor"]["SetAdvancedOptions"](_param)}else if(window["Asc"].c_oAscAdvancedOptionsID.DRM===idOption){var _param=""+ +AscCommon.CopyPasteCorrectString(option.asc_getPassword())+"";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)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;LineIndexEndX)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=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;PageIndexx2?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(yx2?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;nIndexPoints[nIndex].X)_y=top+dKoefY*Points[nIndex].Y-shift;else if(PrevXPoints[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;nIndexPoints[nIndex].X)y=Points[nIndex].Y-ShiftY;else if(PrevXPoints[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>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>>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(k0)setTimeout(function(){fRetry()}, +timeout);else fError()};Backoff.prototype.nextTimeout=function(){var timeout=-1;if(this.attempts0)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; diff --git a/www/common/onlyoffice/v4/sdkjs/word/sdk-all-min.js b/www/common/onlyoffice/v4/sdkjs/word/sdk-all-min.js index 454114c84..584b09a48 100644 --- a/www/common/onlyoffice/v4/sdkjs/word/sdk-all-min.js +++ b/www/common/onlyoffice/v4/sdkjs/word/sdk-all-min.js @@ -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>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-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=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=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=""+option.asc_getCodePage()+"";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+=""+ -option.asc_getCodePage()+"";if(null!=delimiter)_param+=""+delimiter+"";if(null!=delimiterChar)_param+=""+delimiterChar+"";window["AscDesktopEditor"]["SetAdvancedOptions"](_param)}else if(window["Asc"].c_oAscAdvancedOptionsID.DRM===idOption){var _param=""+AscCommon.CopyPasteCorrectString(option.asc_getPassword())+"";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)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;LineIndexEndX)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=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;PageIndexx2?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(yx2?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;nIndexPoints[nIndex].X)_y=top+dKoefY*Points[nIndex].Y-shift;else if(PrevXPoints[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(PrevXPoints[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>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>>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(k0)setTimeout(function(){fRetry()},timeout);else fError()};Backoff.prototype.nextTimeout=function(){var timeout=-1;if(this.attempts0)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-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=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=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=""+option.asc_getCodePage()+"";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+=""+option.asc_getCodePage()+"";if(null!=delimiter)_param+=""+delimiter+"";if(null!=delimiterChar)_param+=""+delimiterChar+"";window["AscDesktopEditor"]["SetAdvancedOptions"](_param)}else if(window["Asc"].c_oAscAdvancedOptionsID.DRM===idOption){var _param=""+ +AscCommon.CopyPasteCorrectString(option.asc_getPassword())+"";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)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;LineIndexEndX)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=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;PageIndexx2?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(yx2?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;nIndexPoints[nIndex].X)_y=top+dKoefY*Points[nIndex].Y-shift;else if(PrevXPoints[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;nIndexPoints[nIndex].X)y=Points[nIndex].Y-ShiftY;else if(PrevXPoints[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>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>>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(k0)setTimeout(function(){fRetry()}, +timeout);else fError()};Backoff.prototype.nextTimeout=function(){var timeout=-1;if(this.attempts0)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; diff --git a/www/common/onlyoffice/v4/web-apps/apps/documenteditor/main/app.js b/www/common/onlyoffice/v4/web-apps/apps/documenteditor/main/app.js index f50ca27a3..fda54fc98 100644 --- a/www/common/onlyoffice/v4/web-apps/apps/documenteditor/main/app.js +++ b/www/common/onlyoffice/v4/web-apps/apps/documenteditor/main/app.js @@ -31,14 +31,14 @@ Color:Common.Utils.ThemeColor.getHexColor(b.get_r(),b.get_g(),b.get_b())}:this.T return'
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n \n
\n
\n \n
\n
\n \n
\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n \n
\n \n \n
\n
\n \n \n
\n
\n \n
\n
\n
\n
\n
\n \n \n \n \n \n \n \n
\n
\n
\n
\n
\n
\n
\n
\n
\n \n \n \n \n \n \n \n \n \n
\n \n \n
\n
\n
\n \n \n \n \n \n
\n
\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n \n
\n
\n
\n
\n
\n \n
\n
\n
\n
\n
\n
\n
\n \n \n \n \n \n \n \n \n \n
\n \n \n \n
\n \n \n \n
\n
\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n \n
\n
\n \n
\n
\n \n
\n
\n \n \n
\n
\n
\n
\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n
\n
\n
\n
\n
\n \n \n \n
\n \n
\n
\n
\n
\n'}),function(t,e){function i(t,e,i,n,o){this.Start=t,this.End=e,this.Name=i,this.Lid=n,this.Param=o}function n(t,e){var i=0,n=e.length-1,o=0,s=null;if(i>=n)return null;for(;i>1,s=e[o];if(s.Start>t)n=o-1;else{if(!(s.Endn?null:(s=e[i],s.Start>t||s.End','
','",'","
",'
','',"",'",'","","
','",'
',"
','",'
',"
",'',"",'","","",'","","
','
','
','
',"
",'
',"
","
","
","
","
','",'
',"
",'',"",'",'","","",'",'","","
','","',"
','
',"
','
',"
","
",'
','',"","","","","","","
","",'","
",'
',"
","
",""].join(""),this.options.tpl=_.template(this.template)(this.options);var h=e.length<1;h&&this.initFonts(),this.fillRecentSymbols();var p;if(t.font?p=t.font:n.length>0&&(p=n[0].font),p)for(var m=0;m0&&(s=n[0].symbol),h&&this.options.lang&&"en"!=this.options.lang){var u=this;f(this.options.lang,function(){u.updateRangeSelector()})}Common.UI.Window.prototype.initialize.call(this,this.options),this.on("resizing",_.bind(this.onWindowResizing,this)),this.on("resize",_.bind(this.onWindowResize,this)),a=!0},initFonts:function(){var t=this.api.pluginMethod_GetFontList();t.sort(function(t,e){return t.m_wsFontNamee.m_wsFontName?1:0});for(var i,n,s,a=[],r={},l=0;le.displayValue.toLowerCase()?1:-1}),l=0;l31&&t.getRangeBySymbol(i,l)){var c=0===n.find("#c"+l).length;s=l,a=!0,t.updateView(c,void 0,!1)}}).on("change:after",function(e,i,n){t.updateInput()}),this.symbolTablePanel=n.find("#symbol-table-scrollable-div"),this.previewPanel=n.find("#id-preview-data"),this.previewParent=this.previewPanel.parent(),this.previewScrolled=n.find("#id-preview"),this.previewInner=this.previewScrolled.find("div:first-child"),this.recentPanel=n.find("#symbol-table-recent"),this.fontLabel=n.find("#symbol-table-label-font"),this.boxPanel=n.find(".box"),this.updateView(void 0,void 0,void 0,!0);var r=[{symbol:"—",description:this.textEmDash,shortcutKey:"Alt+Ctrl+Num -",code:"2014"},{symbol:"–",description:this.textEnDash,shortcutKey:"",code:"2013"},{symbol:"‑",description:this.textNBHyphen,shortcutKey:"Ctrl+Shift+_",code:"002D",special:{NonBreakingHyphen:!0}},{symbol:"",description:this.textEmSpace,shortcutKey:"",code:"2003"},{symbol:"",description:this.textEnSpace,shortcutKey:"",code:"2002"},{symbol:"",description:this.textQEmSpace,shortcutKey:"",code:"2005"},{symbol:"°",description:this.textNBSpace,shortcutKey:"Ctrl+Shift+Space",code:"00A0"},{symbol:"©",description:this.textCopyright,shortcutKey:"",code:"00A9"},{symbol:"®",description:this.textRegistered,shortcutKey:"",code:"00AE"},{symbol:"™",description:this.textTradeMark,shortcutKey:"",code:"2122"},{symbol:"§",description:this.textSection,shortcutKey:"",code:"00A7"},{symbol:"¶",description:this.textPilcrow,shortcutKey:"",code:"00B6"},{symbol:"…",description:this.textEllipsis,shortcutKey:"",code:"2026"},{symbol:"‛",description:this.textSOQuote,shortcutKey:"",code:"2018"},{symbol:"’",description:this.textSCQuote,shortcutKey:"",code:"2019"},{symbol:"‟",description:this.textDOQuote,shortcutKey:"",code:"201C"},{symbol:"”",description:this.textDCQuote,shortcutKey:"",code:"201D"}];this.specialList=new Common.UI.ListView({el:n.find("#symbol-table-special-list"),store:new Common.UI.DataViewStore(r),simpleAddMode:!0,template:_.template(['
'].join("")),itemTemplate:_.template(['
','
<%= symbol %>
','
<%= description %>
',"<% if ("+this.showShortcutKey+") { %>",'
<%= shortcutKey %>
',"<% } %>","
"].join(""))}),this.specialList.on("item:dblclick",_.bind(this.onDblClickSpecialItem,this)).on("entervalue",_.bind(this.onDblClickSpecialItem,this)),this.specialList.selectByIndex(0),this.lblShortCut=n.find("#symbol-table-lbl-shortcut"),this.lblShortCut.toggleClass("hidden",!this.showShortcutKey),n.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this)),this.symbolsPanel=n.find("#symbol-table-pnl-symbols"),this.specialPanel=n.find("#symbol-table-pnl-special")},show:function(){Common.UI.Window.prototype.show.apply(this,arguments),this.binding||(this.binding={}),this.binding.keydownSymbols=_.bind(this.onKeyDown,this),this.binding.keypressSymbols=_.bind(this.onKeyPress,this),$(document).on("keydown."+this.cid,"#symbol-table-scrollable-div #id-preview-data, #symbol-table-recent",this.binding.keydownSymbols),$(document).on("keypress."+this.cid,"#symbol-table-scrollable-div #id-preview-data, #symbol-table-recent",this.binding.keypressSymbols);var t=this.special&&!!Common.Utils.InternalSettings.get(this.appPrefix+"symbol-table-special");t?this.btnSpecial.toggle(!0):this.btnSymbols.toggle(!0),this.ShowHideElem(t)},close:function(t){$(document).off("keydown."+this.cid,this.binding.keydownSymbols),$(document).off("keypress."+this.cid,this.binding.keypressSymbols),this.special&&Common.Utils.InternalSettings.set(this.appPrefix+"symbol-table-special",this.btnSpecial.isActive()),Common.UI.Window.prototype.close.apply(this,arguments)},getPasteSymbol:function(t){var i,n=!1;if(t&&t.length>0)if(n="c"===t[0])i=e[o].displayValue;else{var a=parseInt(t.split("_")[2]);i=e[a].displayValue}return{font:i,symbol:this.encodeSurrogateChar(s),code:s,updateRecents:n}},getSpecialSymbol:function(){var t=this.specialList.getSelectedRec();return{font:void 0,symbol:this.encodeSurrogateChar(t.get("code")),code:parseInt(t.get("code"),16),special:t.get("special")}},onBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value,!0)},onPrimary:function(t){return this._handleInput("ok"),!1},_handleInput:function(t,e){if(e||!document.activeElement||"textarea"!=document.activeElement.localName||!/area_id/.test(document.activeElement.id)){var i=this.btnSpecial.isActive(),n="ok"==t?i?this.getSpecialSymbol():this.getPasteSymbol(this.$window.find(".cell-selected").attr("id")):{};this.options.handler&&this.options.handler.call(this,this,t,n),"ok"==t&&(!i&&this.checkRecent(s,n.font),!i&&n.updateRecents&&this.updateRecents(),this.type)||this.close()}},encodeSurrogateChar:function(t){if(t<65536)return String.fromCharCode(t);t-=65536;var e=55296|t>>10,i=56320|1023&t;return String.fromCharCode(e)+String.fromCharCode(i)},fixedCharCodeAt:function(t,e){e=e||0;var i,n,o=t.charCodeAt(e);if(55296<=o&&o<=56319){if(i=o,n=t.charCodeAt(e+1),isNaN(n))throw"Старшая часть суррогатной пары без следующей младшей в fixedCharCodeAt()";return 1024*(i-55296)+(n-56320)+65536}return!(56320<=o&&o<=57343)&&o},getArrRangesByFont:function(t){var i=getSupportedRangesByFont(e[t]);return 0===i.length&&i.push({Start:32,End:255}),i[0].Start<32&&(i[0].Start=32),i},getRangeBySymbol:function(t,e){for(var i=0;i=e)return t[i];return null},getRangeByName:function(t,e){for(var i=0;ie)return-1;if(i.Start<=e&&i.End>=e)return n+(e-i.Start);n+=i.End-i.Start+1}return-1},getCodeByLinearIndex:function(t,e){if(e<0)return-1;for(var i,n=0,o=t[0],s=0;se)return o.Start+e-n;n+=i}return-1},createTable:function(t,e,i){for(var n,o,s=e*i,a=0,r="",l=0;l>0==e-1?"style='border-bottom: none'":"",l&#'+t[l].toString(10)+""):r+='
",++a>=i&&(r+='
',a=0);this.previewPanel.html(r)},fillRecentSymbols:function(){var t,e=Common.localStorage.getItem(this.appPrefix+"recentSymbols");""!=e&&(t=JSON.parse(e)),_.isArray(t)&&(n=t)},saveRecent:function(){var t=JSON.stringify(n);Common.localStorage.setItem(this.appPrefix+"recentSymbols",t)},checkRecent:function(t,e){if(0===n.length)return void n.push({symbol:t,font:e});for(var i=0;i36&&n.splice(36,n.length-36),this.saveRecent()},createCell:function(t,i){var n="",o="";if(i){for(var s=0,a=0;a'+o+"");return r.addClass("cell"),r.addClass("noselect"),r.mousedown(_.bind(this.cellClickHandler,this)),i&&r.css("font-family","'"+i+"'"),r},cellClickHandler:function(t){var e=$(t.target).attr("id");if(e){var i=(new Date).getTime();if(e===h&&i-p<300)this.cellDblClickHandler(t);else{if("c"===e[0])s=parseInt(e.slice(1,e.length)),a=!0;else{var n=e.split("_");s=parseInt(n[1]),r=parseInt(n[2]),a=!1}this.updateView(!1)}h=t.target.id,p=i}},cellDblClickHandler:function(t){if(this.type){var e=this.getPasteSymbol($(t.target).attr("id"));this.checkRecent(s,e.font),e.updateRecents&&this.updateView(!1,void 0,void 0,!0),this.fireEvent("symbol:dblclick",this,"ok",e)}else this._handleInput("ok")},onDblClickSpecialItem:function(t){if(this.type){var e=this.getSpecialSymbol();this.fireEvent("symbol:dblclick",this,"ok",e)}else this._handleInput("ok")},updateRecents:function(){var t=this.recentPanel;t.empty();var e=this.getColsCount(),i=n.length;t.width(31*e);for(var o=0;o>0},getMaxHeight:function(){return this.symbolTablePanel.innerHeight()},getRowsCount:function(){return Math.max(1,this.getMaxHeight()/33>>0)},getAllSymbolsCount:function(t){for(var e,i=0,n=0;n>0)),h=d*s,p=a*s,m=[],u=0;u>0),b=Math.min(33*Math.floor(this.previewPanel.height()/33)/10,20),this.scrollerY=new Common.UI.Scroller({el:this.previewScrolled,minScrollbarLength:g,alwaysVisibleY:!0,wheelSpeed:b,useKeyboard:!1,onChange:_.bind(function(){this.scrollerY&&(this._preventUpdateScroll=!0,this.onScrollEnd(),this._preventUpdateScroll=!1,this.previewParent.height(m),this.previewParent.css({top:this.scrollerY.getScrollTop()}))},this)})),this._preventUpdateScroll||(this.scrollerY.update({minScrollbarLength:g,wheelSpeed:b}),this.scrollerY.scrollTop(33*f));var w=this.previewPanel.find(".cell");w.off("mousedown"),w.mousedown(_.bind(this.cellClickHandler,this))}d&&this.updateRecents(),this.$window.find(".cell").removeClass("cell-selected"),a?this.$window.find("#c"+s).addClass("cell-selected"):this.$window.find("#r_"+s+"_"+r).addClass("cell-selected"),!1!==c&&this.updateInput()},onScrollEnd:function(){if(this.scrollerY.getScrollTop()!==d){var t=this.getAllSymbolsCount(i),e=this.getColsCount(),n=this.getRowsCount(),o=Math.ceil(t/e),r=33*o,l=Math.max(0,Math.min(o-n,o*this.scrollerY.getScrollTop()/r+.5>>0));if(d=this.scrollerY.getScrollTop(),a){var c=this.previewPanel.children()[0];if(c){var h=c.id;if(h){var p=parseInt(h.slice(1,h.length)),m=this.getLinearIndexByCode(i,p),u=this.getLinearIndexByCode(i,s),g=u-m,b=l*e+g;s=this.getCodeByLinearIndex(i,b);var f=l*e;for(b-=e;-1===s&&b>=f;)s=this.getCodeByLinearIndex(i,b),b-=e;-1===s&&(s=this.getCodeByLinearIndex(i,f))}else s=this.getCodeByLinearIndex(i,l*e)}}else s=this.getCodeByLinearIndex(i,l*e),a=!0;this.updateView(!0,this.getCodeByLinearIndex(i,l*e))}},updateInput:function(){for(var t=s.toString(16).toUpperCase(),e=t.length,i=e;i<5;++i)t="0"+t;this.inputCode.setValue(t)},updateRangeSelector:function(){var e=this.getRangeBySymbol(i,s);if(e&&e.Name){this.cmbRange.setDisabled(!1);var n,o=[];for(n=0;n0&&(o=i[0].Start):e===Common.UI.Keys.END?i.length>0&&(o=i[i.length-1].End):n=!1,o>-1){s=o;var l=0===this.$window.find("#c"+s).length;this.updateView(l)}}else{var c,d;if(e===Common.UI.Keys.LEFT){if((c=this.$window.find(".cell-selected")[0])&&"r"===c.id[0]){var h=this.$window.find(c).prev();h.length>0&&(d=this.$window.find(h).attr("id").split("_"),s=parseInt(d[1]),r=parseInt(d[2]),this.updateView(!1))}}else if(e===Common.UI.Keys.RIGHT){if((c=this.$window.find(".cell-selected")[0])&&"r"===c.id[0]){var p=this.$window.find(c).next();p.length>0&&(d=this.$window.find(p).attr("id").split("_"),s=parseInt(d[1]),r=parseInt(d[2]),this.updateView(!1))}}else if(e===Common.UI.Keys.HOME){var g=this.$window.find("#recent-table").children()[0];g&&(d=g.id.split("_"),s=parseInt(d[1]),r=parseInt(d[2]),this.updateView(!1))}else if(e===Common.UI.Keys.END){var b=this.recentPanel.children(),f=b[b.length-1];f&&(d=f.id.split("_"),s=parseInt(d[1]),r=parseInt(d[2]),this.updateView(!1))}else n=!1}n&&(u=e,m=(new Date).getTime())}},onKeyPress:function(t){if(!document.activeElement||!document.activeElement.nodeName||"span"!==document.activeElement.nodeName.toLowerCase()){var e=t.which||t.charCode||t.keyCode||0;if(!(u===e&&Math.abs(m-(new Date).getTime())<1e3)){if(!isNaN(e)&&e>31){if(this.getRangeBySymbol(i,e)){var n=0===this.$window.find("#c"+e).length;s=e,a=!0,this.updateView(n,void 0,!0)}}t.preventDefault&&t.preventDefault()}}},onWindowResize:function(t){var e=this.getSize();if(t&&"start"==t[1])this._preventUpdateScroll=!0,this.curSize={resize:!1,width:e[0],height:e[1]};else if(this.curSize.resize){this._preventUpdateScroll=!1,this.curSize.height=e[1]-302+38*(this.special?0:1);var i=Math.max(1,this.curSize.height/33>>0),n=33*i;this.symbolTablePanel.css({height:this.curSize.height+"px"}),this.previewPanel.css({height:n+"px"}),this.previewScrolled.css({height:n+"px"}),this.scrollerY=null,this.updateView(void 0,void 0,void 0,!0),this.specialList.cmpEl.height(e[1]-156+38*(this.special?0:1)),!this.special&&(e[1]+=38);var o=JSON.stringify(e);Common.localStorage.setItem(this.appPrefix+"settings-size-symbol-table",o),Common.Utils.InternalSettings.set(this.appPrefix+"settings-size-symbol-table",o)}},onWindowResizing:function(){if(this.curSize){var t=this.getSize();if(t[0]!==this.curSize.width||t[1]!==this.curSize.height){this.curSize.resize||(this.curSize.resize=!0),this.curSize.width=t[0],this.curSize.height=t[1]-302+38*(this.special?0:1);var e=Math.max(1,this.curSize.height/33>>0),i=33*e;this.symbolTablePanel.css({height:this.curSize.height+"px"}),this.previewPanel.css({height:i+"px"}),this.previewScrolled.css({height:i+"px"}),this.specialList.cmpEl.height(t[1]-156+38*(this.special?0:1)),this.updateView(void 0,void 0,void 0,!0)}}},onModeClick:function(t,e,i){this.ShowHideElem(t)},ShowHideElem:function(t){this.symbolsPanel.toggleClass("hidden",t),this.specialPanel.toggleClass("hidden",!t);var e=this;_.delay(function(){t?e.specialList.focus():e.previewPanel.focus()},50)},textTitle:"Symbol",textFont:"Font",textRange:"Range",textRecent:"Recently used symbols",textCode:"Unicode HEX value",textSymbols:"Symbols",textSpecial:"Special characters",textCharacter:"Character",textShortcut:"Shortcut key",textEmDash:"Em Dash",textEnDash:"En Dash",textNBHyphen:"Non-breaking Hyphen",textSHyphen:"Soft Hyphen",textEmSpace:"Em Space",textEnSpace:"En Space",textQEmSpace:"1/4 Em Space",textNBSpace:"No-break Space",textCopyright:"Copyright Sign",textRegistered:"Registered Sign",textTradeMark:"Trade Mark Sign",textSection:"Section Sign",textPilcrow:"Pilcrow Sign",textEllipsis:"Horizontal Ellipsis",textSOQuote:"Single Opening Quote",textSCQuote:"Single Closing Quote",textDOQuote:"Double Opening Quote",textDCQuote:"Double Closing Quote"},Common.Views.SymbolTableDialog||{}))}),define("documenteditor/main/app/view/EditListItemDialog",["common/main/lib/component/Window","common/main/lib/component/InputField"],function(){"use strict";DE.Views.EditListItemDialog=Common.UI.Window.extend(_.extend({options:{width:330,header:!1,cls:"modal-dlg",buttons:["ok","cancel"]},initialize:function(t){_.extend(this.options,t||{}),this.template=['
','
',"","
",'
','
',"","
",'
',"
"].join(""),this.options.tpl=_.template(this.template)(this.options),Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this);var t=this;t.inputName=new Common.UI.InputField({el:$("#id-dlg-label-name"),allowBlank:!1,blankError:t.textNameError,style:"width: 100%;",maxLength:256,validateOnBlur:!1,validation:function(t){return!!t||""}}),t.inputName._input.on("input",function(e){void 0==t.copyvalue&&t.inputValue.getValue()==t.inputName.getValue()&&(t.copyvalue=1),1==t.copyvalue?t.inputValue.setValue($(e.target).val()):2==t.copyvalue&&(t.copyvalue=0)}),t.inputValue=new Common.UI.InputField({el:$("#id-dlg-label-value"),style:"width: 100%;",maxLength:256,validateOnBlur:!1,validation:function(e){if(""!==e&&t.options.store){if(t.options.store.findWhere({value:e}))return t.textValueError}return!0}}),t.inputValue._input.on("input",function(e){void 0==t.copyvalue&&t.inputValue.getValue()==t.inputName.getValue()&&(t.copyvalue=2),2==t.copyvalue?t.inputName.setValue($(e.target).val()):1==t.copyvalue&&(t.copyvalue=0)}),this.getChild().find(".btn").on("click",_.bind(this.onBtnClick,this))},getFocusedComponents:function(){return[this.inputName,this.inputValue]},getDefaultFocusableComponent:function(){return this.inputName},onPrimary:function(t){return this._handleInput("ok"),!1},onBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value)},_handleInput:function(t){if(this.options.handler){if("ok"==t){if(!0!==this.inputName.checkValidate())return void this.inputName.focus();if(!0!==this.inputValue.checkValidate())return void this.inputValue.focus()}this.options.handler.call(this,t,this.inputName.getValue(),this.inputValue.getValue())}this.close()},setSettings:function(t){t&&(this.inputName.setValue(t.name||""),this.inputValue.setValue(t.value||""))},textDisplayName:"Display name",textValue:"Value",textNameError:"Display name must not be empty.",textValueError:"An item with the same value already exists."},DE.Views.EditListItemDialog||{}))}),define("documenteditor/main/app/view/ControlSettingsDialog",["text!documenteditor/main/app/template/ControlSettingsDialog.template","common/main/lib/util/utils","common/main/lib/component/CheckBox","common/main/lib/component/InputField","common/main/lib/view/AdvancedSettingsWindow","common/main/lib/view/SymbolTableDialog","documenteditor/main/app/view/EditListItemDialog"],function(t){"use strict";DE.Views.ControlSettingsDialog=Common.Views.AdvancedSettingsWindow.extend(_.extend({options:{contentWidth:310,height:392,toggleGroup:"control-adv-settings-group",storageName:"de-control-settings-adv-category"},initialize:function(e){_.extend(this.options,{title:this.textTitle,items:[{panelId:"id-adv-control-settings-general",panelCaption:this.strGeneral},{panelId:"id-adv-control-settings-lock",panelCaption:this.textLock},{panelId:"id-adv-control-settings-list",panelCaption:this.textCombobox},{panelId:"id-adv-control-settings-date",panelCaption:this.textDate},{panelId:"id-adv-control-settings-checkbox",panelCaption:this.textCheckbox},{panelId:"id-adv-control-settings-field",panelCaption:this.textField},{panelId:"id-adv-control-settings-additional",panelCaption:this.textAdditional}],contentTemplate:_.template(t)({scope:this})},e),this.handler=e.handler,this.props=e.props,this.api=e.api,Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this,this.options)},render:function(){Common.Views.AdvancedSettingsWindow.prototype.render.call(this);var t=this;this.txtName=new Common.UI.InputField({el:$("#control-settings-txt-name"),allowBlank:!0,validateOnChange:!1,validateOnBlur:!1,style:"width: 100%;",maxLength:64,value:""}),this.txtTag=new Common.UI.InputField({el:$("#control-settings-txt-tag"),allowBlank:!0,validateOnChange:!1,validateOnBlur:!1,style:"width: 100%;",maxLength:64,value:""}),this.txtPlaceholder=new Common.UI.InputField({el:$("#control-settings-txt-pholder"),allowBlank:!0,validateOnChange:!1,validateOnBlur:!1,style:"width: 100%;",value:""}),this.cmbShow=new Common.UI.ComboBox({el:$("#control-settings-combo-show"),cls:"input-group-nr",menuStyle:"min-width: 120px;",editable:!1,takeFocusOnClose:!0,data:[{displayValue:this.textBox,value:Asc.c_oAscSdtAppearance.Frame},{displayValue:this.textNone,value:Asc.c_oAscSdtAppearance.Hidden}]}),this.cmbShow.setValue(Asc.c_oAscSdtAppearance.Frame),this.btnColor=new Common.UI.ColorButton({parentEl:$("#control-settings-color-btn"),additionalItems:[{id:"control-settings-system-color",caption:this.textSystemColor,template:_.template('<%= caption %>')},{caption:"--"}],additionalAlign:this.menuAddAlign,color:"000000",colors:["000000","993300","333300","003300","003366","000080","333399","333333","800000","FF6600","808000","00FF00","008080","0000FF","666699","808080","FF0000","FF9900","99CC00","339966","33CCCC","3366FF","800080","999999","FF00FF","FFCC00","FFFF00","00FF00","00FFFF","00CCFF","993366","C0C0C0","FF99CC","FFCC99","FFFF99","CCFFCC","CCFFFF","C9C8FF","CC99FF","FFFFFF"],paletteHeight:94}),this.btnColor.on("color:select",_.bind(this.onColorsSelect,this)),this.colors=this.btnColor.getPicker(),$("#control-settings-system-color").on("click",_.bind(this.onSystemColor,this)),this.btnApplyAll=new Common.UI.Button({el:$("#control-settings-btn-all")}),this.btnApplyAll.on("click",_.bind(this.applyAllClick,this)),this.chLockDelete=new Common.UI.CheckBox({el:$("#control-settings-chb-lock-delete"),labelText:this.txtLockDelete}),this.chLockEdit=new Common.UI.CheckBox({el:$("#control-settings-chb-lock-edit"),labelText:this.txtLockEdit}),this.list=new Common.UI.ListView({el:$("#control-settings-list",this.$window),store:new Common.UI.DataViewStore,emptyText:"",template:_.template(['
'].join("")),itemTemplate:_.template(['
','
<%= name %>
','
<%= value %>
',"
"].join("")),tabindex:1}),this.list.on("item:select",_.bind(this.onSelectItem,this)),this.btnAdd=new Common.UI.Button({el:$("#control-settings-btn-add")}),this.btnAdd.on("click",_.bind(this.onAddItem,this)),this.btnChange=new Common.UI.Button({el:$("#control-settings-btn-change")}),this.btnChange.on("click",_.bind(this.onChangeItem,this)),this.btnDelete=new Common.UI.Button({el:$("#control-settings-btn-delete")}),this.btnDelete.on("click",_.bind(this.onDeleteItem,this)),this.btnUp=new Common.UI.Button({el:$("#control-settings-btn-up")}),this.btnUp.on("click",_.bind(this.onMoveItem,this,!0)),this.btnDown=new Common.UI.Button({el:$("#control-settings-btn-down")}),this.btnDown.on("click",_.bind(this.onMoveItem,this,!1));var e=[{value:1068},{value:1026},{value:1029},{value:1031},{value:2055},{value:1032},{value:3081},{value:2057},{value:1033},{value:3082},{value:2058},{value:1035},{value:1036},{value:1040},{value:1041},{value:1042},{value:1062},{value:1043},{value:1045},{value:1046},{value:2070},{value:1049},{value:1051},{value:1060},{value:2077},{value:1053},{value:1055},{value:1058},{value:1066},{value:2052}];e.forEach(function(t){var e=Common.util.LanguageInfo.getLocalLanguageName(t.value);t.displayValue=e[1],t.langName=e[0]}),this.cmbLang=new Common.UI.ComboBox({el:$("#control-settings-lang"),menuStyle:"min-width: 100%; max-height: 185px;",cls:"input-group-nr",editable:!1,takeFocusOnClose:!0,data:e,search:!0,scrollAlwaysVisible:!0}),this.cmbLang.setValue(1033),this.cmbLang.on("selected",function(e,i){t.updateFormats(i.value)}),this.listFormats=new Common.UI.ListView({el:$("#control-settings-format"),store:new Common.UI.DataViewStore,scrollAlwaysVisible:!0,tabindex:1}),this.listFormats.on("item:select",_.bind(this.onSelectFormat,this)),this.txtDate=new Common.UI.InputField({el:$("#control-settings-txt-format"),allowBlank:!0,validateOnChange:!1,validateOnBlur:!1,style:"width: 100%;",value:""}),this.btnEditChecked=new Common.UI.Button({el:$("#control-settings-btn-checked-edit"),hint:this.tipChange}),this.btnEditChecked.cmpEl.css({"font-size":"16px","line-height":"16px"}),this.btnEditChecked.on("click",_.bind(this.onEditCheckbox,this,!0)),this.btnEditUnchecked=new Common.UI.Button({el:$("#control-settings-btn-unchecked-edit"),hint:this.tipChange}),this.btnEditUnchecked.cmpEl.css({"font-size":"16px","line-height":"16px"}),this.btnEditUnchecked.on("click",_.bind(this.onEditCheckbox,this,!1)),this.txtGroupKey=new Common.UI.InputField({el:$("#control-settings-txt-groupkey"),allowBlank:!0,validateOnChange:!1,validateOnBlur:!1,style:"width: 100%;",value:""}),this.txtKey=new Common.UI.InputField({el:$("#control-settings-txt-key"),allowBlank:!0,validateOnChange:!1,validateOnBlur:!1,style:"width: 100%;",value:""}),this.txtLabel=new Common.UI.InputField({el:$("#control-settings-txt-label"),allowBlank:!0,validateOnChange:!1,validateOnBlur:!1,style:"width: 100%;",value:""}),this.textareaHelp=this.$window.find("#control-settings-txt-help"),this.textareaHelp.keydown(function(e){e.keyCode==Common.UI.Keys.RETURN&&e.stopPropagation(),t.isHelpChanged=!0}),this.chRequired=new Common.UI.CheckBox({el:$("#control-settings-chb-required"),labelText:this.textRequired}),this.btnEditPlaceholder=new Common.UI.Button({el:$("#control-settings-btn-placeholder-edit"),hint:this.tipChange}),this.btnEditPlaceholder.cmpEl.css({"font-size":"16px","line-height":"16px"}),this.btnEditPlaceholder.on("click",_.bind(this.onEditPlaceholder,this)),this.spnWidth=new Common.UI.MetricSpinner({el:$("#control-settings-spin-width"),step:.1,width:80,defaultUnit:"cm",value:"Auto",allowAuto:!0,maxValue:55.88,minValue:.1}),this.spnMaxChars=new Common.UI.MetricSpinner({el:$("#control-settings-spin-max-chars"),step:1,width:53,defaultUnit:"",value:"10",maxValue:1e6,minValue:1}),this.chMaxChars=new Common.UI.CheckBox({el:$("#control-settings-chb-max-chars"),labelText:this.textMaxChars}),this.chMaxChars.on("change",_.bind(function(t,e,i,n){this.spnMaxChars.setDisabled("checked"!=t.getValue())},this)),this.chComb=new Common.UI.CheckBox({el:$("#control-settings-chb-comb"),labelText:this.textComb}),this.chComb.on("change",_.bind(function(t,e,i,n){var o="checked"==t.getValue();o&&this.chMaxChars.setValue(!0),this.btnEditPlaceholder.setDisabled(!o),this.spnWidth.setDisabled(!o)},this)),this.afterRender()},getFocusedComponents:function(){return[this.txtName,this.txtTag,this.txtPlaceholder,this.cmbShow,{cmp:this.list,selector:".listview"},this.txtDate,{cmp:this.listFormats,selector:".listview"},this.cmbLang]},onCategoryClick:function(t,e){Common.Views.AdvancedSettingsWindow.prototype.onCategoryClick.call(this,t,e);var i=this;setTimeout(function(){0==e?i.txtName.focus():2==e?i.list.focus():3==e&&i.txtDate.focus()},100)},onColorsSelect:function(t,e){var i=this.btnColor.menu.$el.find("#control-settings-system-color > a");i.hasClass("selected")&&i.removeClass("selected"),this.isSystemColor=!1},onSystemColor:function(t){var e=Common.Utils.ThemeColor.getHexColor(220,220,220);this.btnColor.setColor(e),this.colors.clearSelection();var i=this.btnColor.menu.$el.find("#control-settings-system-color > a");!i.hasClass("selected")&&i.addClass("selected"),this.isSystemColor=!0},afterRender:function(){if(this.updateMetricUnit(),this._setDefaults(this.props),this.storageName){var t=Common.localStorage.getItem(this.storageName);this.setActiveCategory(null!==t?parseInt(t):0)}},show:function(){Common.Views.AdvancedSettingsWindow.prototype.show.apply(this,arguments)},_setDefaults:function(t){if(t){var e=t.get_Alias();if(this.txtName.setValue(e||""),e=t.get_Tag(),this.txtTag.setValue(e||""),e=t.get_PlaceholderText(),this.txtPlaceholder.setValue(e||""),e=t.get_Appearance(),null!==e&&void 0!==e&&this.cmbShow.setValue(e),e=t.get_Color(),this.isSystemColor=null===e,e)e=Common.Utils.ThemeColor.getHexColor(e.get_r(),e.get_g(),e.get_b()),this.colors.selectByRGB(e,!0);else{this.colors.clearSelection();var i=this.btnColor.menu.$el.find("#control-settings-system-color > a");!i.hasClass("selected")&&i.addClass("selected"),e=Common.Utils.ThemeColor.getHexColor(220,220,220)}this.btnColor.setColor(e),e=t.get_Lock(),void 0===e&&(e=Asc.c_oAscSdtLockType.Unlocked),this.chLockDelete.setValue(e==Asc.c_oAscSdtLockType.SdtContentLocked||e==Asc.c_oAscSdtLockType.SdtLocked),this.chLockEdit.setValue(e==Asc.c_oAscSdtLockType.SdtContentLocked||e==Asc.c_oAscSdtLockType.ContentLocked);var n,o=t.get_SpecificType();if(this.btnsCategory[2].setVisible(o==Asc.c_oAscContentControlSpecificType.ComboBox||o==Asc.c_oAscContentControlSpecificType.DropDownList),o==Asc.c_oAscContentControlSpecificType.ComboBox||o==Asc.c_oAscContentControlSpecificType.DropDownList){if(this.btnsCategory[2].setCaption(o==Asc.c_oAscContentControlSpecificType.ComboBox?this.textCombobox:this.textDropDown),n=o==Asc.c_oAscContentControlSpecificType.ComboBox?t.get_ComboBoxPr():t.get_DropDownListPr()){for(var s=n.get_ItemsCount(),a=[],r=0;r=0,!0),this.spnMaxChars.setDisabled(!e||e<0),this.spnMaxChars.setValue(e&&e>=0?e:10),e=b.get_Width(),this.spnWidth.setValue(0!==e&&void 0!==e?Common.Utils.Metric.fnRecalcFromMM(25.4*e/20/72):-1,!0)}o!=Asc.c_oAscContentControlSpecificType.CheckBox&&o!=Asc.c_oAscContentControlSpecificType.Picture||u||this.txtPlaceholder.cmpEl&&this.txtPlaceholder.cmpEl.closest("tr").hide()}},getSettings:function(){var t=new AscCommon.CContentControlPr;if(t.put_Alias(this.txtName.getValue()),t.put_Tag(this.txtTag.getValue()),t.put_PlaceholderText(this.txtPlaceholder.getValue()||" "),t.put_Appearance(this.cmbShow.getValue()),this.isSystemColor)t.put_Color(null);else{var e=Common.Utils.ThemeColor.getRgbColor(this.colors.getColor());t.put_Color(e.get_r(),e.get_g(),e.get_b())}var i=Asc.c_oAscSdtLockType.Unlocked;"checked"==this.chLockDelete.getValue()&&"checked"==this.chLockEdit.getValue()?i=Asc.c_oAscSdtLockType.SdtContentLocked:"checked"==this.chLockDelete.getValue()?i=Asc.c_oAscSdtLockType.SdtLocked:"checked"==this.chLockEdit.getValue()&&(i=Asc.c_oAscSdtLockType.ContentLocked),t.put_Lock(i);var n;if(this.type!=Asc.c_oAscContentControlSpecificType.ComboBox&&this.type!=Asc.c_oAscContentControlSpecificType.DropDownList||(n=this.type==Asc.c_oAscContentControlSpecificType.ComboBox?this.props.get_ComboBoxPr():this.props.get_DropDownListPr(),n.clear(),this.list.store.each(function(t,e){n.add_Item(t.get("name"),t.get("value"))}),this.type==Asc.c_oAscContentControlSpecificType.ComboBox?t.put_ComboBoxPr(n):t.put_DropDownListPr(n)),this.type==Asc.c_oAscContentControlSpecificType.DateTime&&(n=this.props.get_DateTimePr(),n.put_DateFormat(this.txtDate.getValue()),n.put_LangId(this.cmbLang.getValue()),t.put_DateTimePr(n)),this.type==Asc.c_oAscContentControlSpecificType.CheckBox&&(this.checkedBox&&this.checkedBox.changed||this.uncheckedBox&&this.uncheckedBox.changed)&&(n=this.props.get_CheckBoxPr(),this.checkedBox&&(n.put_CheckedSymbol(this.checkedBox.code),n.put_CheckedFont(this.checkedBox.font)),this.uncheckedBox&&(n.put_UncheckedSymbol(this.uncheckedBox.code),n.put_UncheckedFont(this.uncheckedBox.font)),t.put_CheckBoxPr(n)),this.btnsCategory[6].isVisible()){var o=new AscCommon.CSdtFormPr;o.put_Key(this.txtKey.getValue()),o.put_Label(this.txtLabel.getValue()),o.put_Required("checked"==this.chRequired.getValue()),this.isHelpChanged&&o.put_HelpText(this.textareaHelp.val()),this.type!=Asc.c_oAscContentControlSpecificType.CheckBox||this.$window.find(".group-key").hasClass("hidden")||(n=this.props.get_CheckBoxPr())&&(n.put_GroupKey(this.txtGroupKey.getValue()),t.put_CheckBoxPr(n)),t.put_FormPr(o)}if(this.btnsCategory[5].isVisible()){var s=new AscCommon.CSdtTextFormPr;if(this.spnWidth.getValue()){var a=this.spnWidth.getNumberValue();s.put_Width(a<=0?0:parseInt(72*Common.Utils.Metric.fnRecalcToMM(a)*20/25.4))}else s.put_Width(0);this.placeholder&&this.placeholder.changed&&(s.put_PlaceHolderSymbol(this.placeholder.code),s.put_PlaceHolderFont(this.placeholder.font)),s.put_Comb("checked"==this.chComb.getValue());var r="checked"==this.chMaxChars.getValue()||"checked"==this.chComb.getValue();s.put_MaxCharacters(r),r&&s.put_MaxCharacters(this.spnMaxChars.getNumberValue()||10),t.put_TextFormPr(s)}return t},onDlgBtnClick:function(t){var e="object"==typeof t?t.currentTarget.attributes.result.value:t;"ok"==e&&this.handler&&this.handler.call(this,e,this.getSettings()),this.close()},applyAllClick:function(t,e){if(this.api){var i=new AscCommon.CContentControlPr;if(i.put_Appearance(this.cmbShow.getValue()),this.isSystemColor)i.put_Color(null);else{var n=Common.Utils.ThemeColor.getRgbColor(this.colors.getColor());i.put_Color(n.get_r(),n.get_g(),n.get_b())}this.api.asc_SetContentControlProperties(i,null,!0)}},onSelectItem:function(t,e,i){this.disableListButtons(!1)},disableListButtons:function(t){void 0===t&&(t=!this.list.getSelectedRec()),this.btnChange.setDisabled(t),this.btnDelete.setDisabled(t),this.btnUp.setDisabled(t),this.btnDown.setDisabled(t)},onAddItem:function(){var t=this;new DE.Views.EditListItemDialog({store:t.list.store,handler:function(e,i,n){if("ok"==e){var o=t.list.store.add({value:n,name:i});o&&(t.list.selectRecord(o),t.list.scrollToRecord(o),t.disableListButtons())}t.list.focus()}}).show()},onChangeItem:function(){var t=this,e=this.list.getSelectedRec(),i=new DE.Views.EditListItemDialog({store:t.list.store,handler:function(i,n,o){"ok"==i&&e&&e.set({value:o,name:n}),t.list.focus()}});e&&i.show(),e&&i.setSettings({name:e.get("name"),value:e.get("value")})},onDeleteItem:function(t,e){var i=this.list.getSelectedRec();if(i){var n=this.list.store,o=_.indexOf(n.models,i);n.remove(i),o>n.length-1&&(o=n.length-1),n.length>0&&(this.list.selectByIndex(o),this.list.scrollToRecord(n.at(o)))}this.disableListButtons(),this.list.focus()},onMoveItem:function(t){var e=this.list.store,i=e.length,n=this.list.getSelectedRec();if(n){var o=e.indexOf(n);e.add(e.remove(n),{at:t?Math.max(0,o-1):Math.min(i-1,o+1)}),this.list.selectRecord(n),this.list.scrollToRecord(n)}this.list.focus()},updateFormats:function(t){if(this.datetime){for(var e=this.datetime,i=e.get_FormatsExamples(),n=[],o=0,s=i.length;o','
','
',"
",""].join(""),this.options.tpl=_.template(this.template)(this.options),this.props=this.options.props,Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this),this.spnStart=new Common.UI.CustomSpinner({el:$("#id-spin-set-value"),step:1,width:182,defaultUnit:"",value:1,maxValue:16383,minValue:0,allowDecimal:!1,maskExp:/[0-9]/}),this.getChild().find(".dlg-btn").on("click",_.bind(this.onBtnClick,this)),this.spnStart.on("entervalue",_.bind(this.onPrimary,this)),this.spnStart.$el.find("input").focus(),this.afterRender()},afterRender:function(){this._setDefaults(this.props)},_setDefaults:function(t){t&&(this.spnStart.setValue(t.start),this.onFormatSelect(t.format))},_handleInput:function(t){this.options.handler&&this.options.handler.call(this,t,this.getSettings()),this.close()},onBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value)},getSettings:function(){return this.spnStart.getNumberValue()},onPrimary:function(){return this._handleInput("ok"),!1},onFormatSelect:function(t){var e=/[0-9]/,i=this;switch(t){case Asc.c_oAscNumberingFormat.UpperRoman:this.spnStart.options.toCustomFormat=this._10toRome,this.spnStart.options.fromCustomFormat=this._Rometo10,e=/[IVXLCDM]/;break;case Asc.c_oAscNumberingFormat.LowerRoman:this.spnStart.options.toCustomFormat=function(t){return i._10toRome(t).toLocaleLowerCase()},this.spnStart.options.fromCustomFormat=function(t){return i._Rometo10(t.toLocaleUpperCase())},e=/[ivxlcdm]/;break;case Asc.c_oAscNumberingFormat.UpperLetter:this.spnStart.options.toCustomFormat=this._10toS,this.spnStart.options.fromCustomFormat=this._Sto10,e=/[A-Z]/;break;case Asc.c_oAscNumberingFormat.LowerLetter:this.spnStart.options.toCustomFormat=function(t){return i._10toS(t).toLocaleLowerCase()},this.spnStart.options.fromCustomFormat=function(t){return i._Sto10(t.toLocaleUpperCase())},e=/[a-z]/;break;default:this.spnStart.options.toCustomFormat=function(t){return t},this.spnStart.options.fromCustomFormat=function(t){return t}}this.spnStart.setMask(e),this.spnStart.setValue(this.spnStart.getValue())},_10toS:function(t){t=parseInt(t);for(var e=Math.ceil(t/26),i=String.fromCharCode((t-1)%26+"A".charCodeAt(0)),n="",o=0;o0;)n=i[s][1],o=t-n,o>=0?(e+=i[s][0],t=o):s++;return e},_Rometo10:function(t){if(!/[IVXLCDM]/.test(t)||t.length<1)return 1;for(var e={I:1,V:5,X:10,L:50,C:100,D:500,M:1e3},i=t.length-1,n=e[t.charAt(i)],o=n,s=i-1;s>=0;s--){var a=e[t.charAt(s)];if(a10)return 1;a*=-1}n+=a,o=Math.abs(a)}return n}},DE.Views.NumberingValueDialog||{}))}),define("documenteditor/main/app/view/CellsAddDialog",["common/main/lib/component/Window","common/main/lib/component/ComboBox","common/main/lib/component/MetricSpinner","common/main/lib/component/RadioBox"],function(){"use strict";DE.Views.CellsAddDialog=Common.UI.Window.extend(_.extend({options:{width:214,header:!0,style:"min-width: 214px;",cls:"modal-dlg",buttons:["ok","cancel"]},initialize:function(t){_.extend(this.options,{title:this.textTitle},t||{}),this.template=['
','
','
','
',"
",'
','
',"
"].join(""),this.options.tpl=_.template(this.template)(this.options),Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this),this.cmbRowCol=new Common.UI.ComboBox({el:$("#table-combo-row-col"),cls:"input-group-nr",style:"width: 110px;",menuStyle:"min-width: 110px;",editable:!1,takeFocusOnClose:!0,scrollAlwaysVisible:!0,data:[{value:0,displayValue:this.textRow},{value:1,displayValue:this.textCol}]}),this.cmbRowCol.setValue(0),this.cmbRowCol.on("selected",_.bind(function(t,e){var i=0==e.value;this.spnCount.setMaxValue(i?100:64),this.spnCount.setValue(this.spnCount.getNumberValue()),this.radioBefore.setCaption(i?this.textUp:this.textLeft),this.radioAfter.setCaption(i?this.textDown:this.textRight)},this)),this.spnCount=new Common.UI.MetricSpinner({el:$("#table-spin-row-col"),step:1,width:65,value:1,defaultUnit:"",maxValue:100,minValue:1,allowDecimal:!1}),this.radioBefore=new Common.UI.RadioBox({el:$("#table-radio-before"),labelText:this.textUp,name:"asc-radio-table-cells-add",checked:!0}),this.radioAfter=new Common.UI.RadioBox({el:$("#table-radio-after"),labelText:this.textDown,name:"asc-radio-table-cells-add"}),this.getChild().find(".dlg-btn").on("click",_.bind(this.onBtnClick,this))},getFocusedComponents:function(){return[this.cmbRowCol,this.spnCount]},getDefaultFocusableComponent:function(){return this.spnCount},_handleInput:function(t){this.options.handler&&this.options.handler.call(this,t,this.getSettings()),this.close()},onBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value)},getSettings:function(){return{row:0==this.cmbRowCol.getValue(),before:this.radioBefore.getValue(),count:this.spnCount.getNumberValue()}},onPrimary:function(){return this._handleInput("ok"),!1},textTitle:"Insert Several",textLeft:"To the left",textRight:"To the right",textUp:"Above the cursor",textDown:"Below the cursor",textRow:"Rows",textCol:"Columns"},DE.Views.CellsAddDialog||{}))}),define("documenteditor/main/app/view/DocumentHolder",["jquery","underscore","backbone","gateway","common/main/lib/util/utils","common/main/lib/component/Menu","common/main/lib/component/Calendar","common/main/lib/view/InsertTableDialog","common/main/lib/view/CopyWarningDialog","common/main/lib/view/OptionsDialog","documenteditor/main/app/view/DropcapSettingsAdvanced","documenteditor/main/app/view/HyperlinkSettingsDialog","documenteditor/main/app/view/ParagraphSettingsAdvanced","documenteditor/main/app/view/TableSettingsAdvanced","documenteditor/main/app/view/ControlSettingsDialog","documenteditor/main/app/view/NumberingValueDialog","documenteditor/main/app/view/CellsAddDialog"],function(t,e,i,n){"use strict";DE.Views.DocumentHolder=i.View.extend(e.extend({el:"#editor_sdk",template:null,events:{},initialize:function(){var i=this,n=DE.getCollection("Common.Collections.Users");i._TtHeight=20,i._currentSpellObj=void 0,i._currLang={},i.usertips=[],i.fastcoauthtips=[],i._currentMathObj=void 0,i._currentParaObjDisabled=!1,i._isDisabled=!1,i._state={};var o=function(n,o,s,a,r){if(!e.isUndefined(n)&&null!==n){Common.UI.Menu.Manager.hideAll();var l=[s.get_X(),s.get_Y()],c=t(i.el).find(Common.Utils.String.format("#menu-container-{0}",n.id));n.rendered||(c.length<1&&(c=t(Common.Utils.String.format('',n.id)),t(i.el).append(c)),n.render(c),n.cmpEl.attr({tabindex:"-1"})),c.css({left:l[0],top:l[1]}),n.show(),e.isFunction(n.options.initMenu)&&(n.options.initMenu(o),n.alignPosition()),e.delay(function(){n.cmpEl.focus()},10),i.currentMenu=n}},s=function(t){if(t&&e.isArray(t)){for(var n={},o=i.textMenu,s=!0,a=0;a0&&i.api.zoomIn(),t.preventDefault(),t.stopPropagation())}},h=function(e){if(i.api){var n=e.keyCode;if((e.ctrlKey||e.metaKey)&&!e.shiftKey&&!e.altKey){if(n===Common.UI.Keys.NUM_PLUS||n===Common.UI.Keys.EQUALITY||Common.Utils.isGecko&&n===Common.UI.Keys.EQUALITY_FF||Common.Utils.isOpera&&43==n)return i.api.zoomIn(),e.preventDefault(),e.stopPropagation(),!1;if(n===Common.UI.Keys.NUM_MINUS||n===Common.UI.Keys.MINUS||Common.Utils.isGecko&&n===Common.UI.Keys.MINUS_FF||Common.Utils.isOpera&&45==n)return i.api.zoomOut(),e.preventDefault(),e.stopPropagation(),!1;if(48===n||96===n)return i.api.zoom(100),e.preventDefault(),e.stopPropagation(),!1}i.currentMenu&&i.currentMenu.isVisible()&&(n!=Common.UI.Keys.UP&&n!=Common.UI.Keys.DOWN||t("ul.dropdown-menu",i.currentMenu.el).focus()),n==Common.UI.Keys.ESC&&(Common.UI.Menu.Manager.hideAll(),Common.NotificationCenter.trigger("leftmenu:change","hide"))}},p=function(e){i._XY=[i.cmpEl.offset().left-t(window).scrollLeft(),i.cmpEl.offset().top-t(window).scrollTop()],i._Height=i.cmpEl.height(),i._BodyWidth=t("body").width()},m=function(e){var n=i.cmpEl;if(n){n.on("contextmenu",function(t){return t.preventDefault(),t.stopPropagation(),!1}),n.on("click",function(t){"canvas"==t.target.localName&&(i._preventClick?i._preventClick=!1:n.focus())}),n.on("mousedown",function(t){"canvas"==t.target.localName&&Common.UI.Menu.Manager.hideAll()});var o=/Firefox/i.test(navigator.userAgent)?"DOMMouseScroll":"mousewheel";!function(t,e,i){t.addEventListener?t.addEventListener(e,i,!1):t.attachEvent("on"+e,i)}(i.el,o,d)}t(document).on("mousewheel",d),t(document).on("keydown",h),t(window).on("resize",p),DE.getController("Viewport").getView("Viewport").hlayout.on("layout:resizedrag",p)},u=function(t){if(n){var e=n.findUser(t);if(e)return Common.Utils.UserInfoParser.getParsedName(e.get("username"))}return i.guestText},g={toolTip:new Common.UI.Tooltip({owner:this,html:!0,title:"
Press Ctrl and click link",cls:"link-tooltip"}),strTip:"",isHidden:!0,isVisible:!1},b=!0,f=function(t,e,n){!0===b&&(b=new Common.UI.Tooltip({owner:t.currentTarget,title:i.tipIsLocked}),b.show())},C=function(){if("object"==typeof b){b.hide(),b=void 0;for(var t=0;t0&&("object"==typeof b&&(b.hide(),b=!0),e.each(i.usertips,function(t){t.remove()})),i.usertips=[],i.usertipcount=0},w=null,x=!1,S=function(){g.isHidden&&g.isVisible&&(g.isVisible=!1,x=!0,g.toolTip.hide(function(){x=!1,w&&A(w),w=null}))},A=function(n){if(void 0===i._XY&&(i._XY=[i.cmpEl.offset().left-t(window).scrollLeft(),i.cmpEl.offset().top-t(window).scrollTop()],i._Height=i.cmpEl.height(),i._BodyWidth=t("body").width()),n){var o,s,a=n.get_Type();if(a==Asc.c_oAscMouseMoveDataTypes.Hyperlink||a==Asc.c_oAscMouseMoveDataTypes.Footnote||a==Asc.c_oAscMouseMoveDataTypes.Form){if(x)return void(w=n);if(a==Asc.c_oAscMouseMoveDataTypes.Hyperlink){var r=n.get_Hyperlink();if(!r)return;s=e.isEmpty(r.get_ToolTip())?r.get_Value():r.get_ToolTip()}else a==Asc.c_oAscMouseMoveDataTypes.Footnote?(s=n.get_FootnoteText(),s.length>1e3&&(s=s.substr(0,1e3)+"...")):a==Asc.c_oAscMouseMoveDataTypes.Form&&(s=n.get_FormHelpText(),s.length>1e3&&(s=s.substr(0,1e3)+"..."));var l=!1;g.isHidden=!1,s=Common.Utils.String.htmlEncode(s),(g.tipType!==a||g.tipLength!==s.length||g.strTip.indexOf(s)<0)&&(g.toolTip.setTitle(a==Asc.c_oAscMouseMoveDataTypes.Hyperlink?s+"
"+i.txtPressLink+"":s),g.tipLength=s.length,g.strTip=s,g.tipType=a,l=!0),o=[n.get_X(),n.get_Y()],o[1]+=i._XY[1]-15,o[0]+=i._XY[0]+5,g.isVisible&&!l||(g.isVisible=!0,g.toolTip.show([-1e4,-1e4])),l&&(g.tipHeight=g.toolTip.getBSTip().$tip.height(),g.tipWidth=g.toolTip.getBSTip().$tip.width()),l=!1,o[0]+g.tipWidth>i._BodyWidth&&(o[0]=i._BodyWidth-g.tipWidth,l=!0),o[1]-g.tipHeight<0?o[1]=l?o[1]+30:0:o[1]-=g.tipHeight,g.toolTip.getBSTip().$tip.css({top:o[1]+"px",left:o[0]+"px"})}else if(n.get_Type()==Asc.c_oAscMouseMoveDataTypes.LockedObject&&i.mode.isEdit){var c;i.usertipcount>=i.usertips.length&&(c=t(document.createElement("div")),c.addClass("username-tip"),c.css({height:i._TtHeight+"px",position:"absolute",zIndex:"900",visibility:"visible"}),t(document.body).append(c),b&&(c.on("mouseover",f),c.on("mouseout",v)),i.usertips.push(c)),c=i.usertips[i.usertipcount],i.usertipcount++,s=u(n.get_UserId()),o=[n.get_X()+i._XY[0],n.get_Y()+i._XY[1]];var d=o[0];o[0]=i._BodyWidth-o[0],o[1]-=2==n.get_LockedObjectType()?i._TtHeight:0,o[1]>i._XY[1]&&o[1]+i._TtHeight
'),i.cmpEl.append(s),i.btnSpecialPaste=new Common.UI.Button({parentEl:t("#id-document-holder-btn-special-paste"),cls:"btn-toolbar",iconCls:"toolbar__icon btn-paste",menu:new Common.UI.Menu({items:[]})})),a.length>0){for(var r=i.btnSpecialPaste.menu,l=0;l0&&r.items[0].setChecked(!0,!0)}if(o.asc_getX()<0||o.asc_getY()<0)s.is(":visible")&&s.hide();else{var c=[o.asc_getX()+o.asc_getWidth()+3,o.asc_getY()+o.asc_getHeight()+3];s.css({left:c[0],top:c[1]}),s.show()}}},P=function(){var t=i.cmpEl.find("#special-paste-container");t.is(":visible")&&t.hide()},M=function(){var t,n,o;if(i.api&&i.mode.isEdit&&!i._isDisabled&&!DE.getController("LeftMenu").leftMenu.menuFile.isVisible()){var s=function(t,e){"ok"==e&&(n=t.getSettings(),!1!==o?i.api.add_Hyperlink(n):i.api.change_Hyperlink(n)),i.fireEvent("editcomplete",i)};if(!1!==(o=i.api.can_AddHyperlink()))t=new DE.Views.HyperlinkSettingsDialog({api:i.api,handler:s}),n=new Asc.CHyperlinkProperty,n.put_Text(o),t.show(),t.setSettings(n);else{var a=i.api.getSelectedElements();a&&e.isArray(a)&&e.each(a,function(t,e){a[e].get_ObjectType()==Asc.c_oAscTypeSelectElement.Hyperlink&&(n=a[e].get_ObjectValue())}),n&&(t=new DE.Views.HyperlinkSettingsDialog({api:i.api,handler:s}),t.show(),t.setSettings(n))}Common.component.Analytics.trackEvent("DocumentHolder","Add Hyperlink")}},E=function(t){if(i.mode.isEdit&&!i._isDisabled){var e=DE.getController("Common.Controllers.ExternalDiagramEditor").getView("Common.Views.ExternalDiagramEditor");e&&t&&(e.setEditMode(!0),e.show(),e.setChartData(new Asc.asc_CChartBinary(t)))}},U=function(){i.mode.isEdit=!1},V=function(t){i._currLang.id=t};this.changeLanguageMenu=function(t){if(null===i._currLang.id||void 0===i._currLang.id)t.clearAll();else{var n=e.findIndex(t.items,{langid:i._currLang.id});n>-1&&!t.items[n].checked&&t.setChecked(n,!0)}};var B=function(){var t,n=i.api.getSelectedElements(!0);if(n&&e.isArray(n))for(var o=0;o0?(n.setVisible(r.length>3),n.setDisabled(i._currentParaObjDisabled),e.each(r,function(t,e){var n=new Common.UI.MenuItem({caption:t,spellword:!0,disabled:i._currentParaObjDisabled}).on("click",function(t,e){i.api&&(i.api.asc_replaceMisspelledWord(t.caption,i._currentSpellObj),i.fireEvent("editcomplete",i))});e<3?s.push(n):a.push(n)}),s.length>0&&(t?e.each(s,function(t,e){i.textMenu.insertItem(e,t)}):e.each(s,function(t,e){i.menuSpellCheckTable.menu.insertItem(e,t)})),a.length>0&&e.each(a,function(t,e){n.menu.addItem(t)}),o.setVisible(!1)):(n.setVisible(!1),o.setVisible(!0),o.setCaption(i.noSpellVariantsText,!0))}},this.clearWordVariants=function(t){for(var e=t?i.textMenu:i.menuSpellCheckTable.menu,n=0;n0&&e.each(s,function(t,s){t.menu?e.each(t.menu.items,function(t){t.on("click",e.bind(i.equationCallback,i,t.options.equationProps))}):t.on("click",e.bind(i.equationCallback,i,t.options.equationProps)),o.insertItem(n,t),n++}),s.length},this.clearEquationMenu=function(t,n){for(var o=t?i.textMenu:i.tableMenu,s=n;s=0;r--){var l,c;if(l=a[r].get_ObjectType(),c=a[r].get_ObjectValue(),Asc.c_oAscTypeSelectElement.Paragraph==l){o=new DE.Views.ParagraphSettingsAdvanced({tableStylerRows:2,tableStylerColumns:1,paragraphProps:c,borderProps:s.borderAdvancedProps,isChart:!0===t.isChart,api:s.api,handler:function(t,e){"ok"==t&&s.api&&(s.borderAdvancedProps=e.borderProps,s.api.paraApply(e.paragraphProps)),s.fireEvent("editcomplete",s)}});break}}}if(o)return o.show(),o},advancedFrameClick:function(t,e,i,n){Common.NotificationCenter.trigger("dropcap:settings",t)},advancedTableClick:function(t,i,n){var o,s=this;if(s.api){var a=s.api.getSelectedElements();if(a&&e.isArray(a))for(var r=a.length-1;r>=0;r--){var l,c;if(l=a[r].get_ObjectType(),c=a[r].get_ObjectValue(),Asc.c_oAscTypeSelectElement.Table==l){o=new DE.Views.TableSettingsAdvanced({tableStylerRows:null===c.get_CellBorders().get_InsideH()&&1==c.get_CellSelect()?1:2,tableStylerColumns:null===c.get_CellBorders().get_InsideV()&&1==c.get_CellSelect()?1:2,tableProps:c,borderProps:s.borderAdvancedProps,sectionProps:s.api.asc_GetSectionProps(),handler:function(t,e){"ok"==t&&s.api&&(s.borderAdvancedProps=e.borderProps,s.api.tblApply(e.tableProps)),s.fireEvent("editcomplete",s)}});break}}}if(o)return o.show(),o},onRulerDblClick:function(e){Common.UI.Menu.Manager.hideAll();var i,n=this;if("tables"==e)(i=this.advancedTableClick())&&i.setActiveCategory(4);else if("indents"==e||"tabs"==e)(i=this.advancedParagraphClick({isChart:!1}))&&i.setActiveCategory("indents"==e?0:3);else if("margins"==e){if(n._state.lock_doc)return;i=new DE.Views.PageMarginsDialog({api:n.api,handler:function(e,i){if("ok"==i){var o=e.getSettings(),s=DE.getController("Toolbar").toolbar.btnPageMargins.menu.items[0];s.setVisible(!0),s.setChecked(!0),s.options.value=s.value=[o.get_TopMargin(),o.get_LeftMargin(),o.get_BottomMargin(),o.get_RightMargin()],t(s.el).html(s.template({id:Common.UI.getId(),caption:s.caption,options:s.options})),Common.localStorage.setItem("de-pgmargins-top",o.get_TopMargin()),Common.localStorage.setItem("de-pgmargins-left",o.get_LeftMargin()),Common.localStorage.setItem("de-pgmargins-bottom",o.get_BottomMargin()),Common.localStorage.setItem("de-pgmargins-right",o.get_RightMargin()),n.api.asc_SetSectionProps(o),n.fireEvent("editcomplete",n)}}}),i.show(),i.setSettings(n.api.asc_GetSectionProps())}else"columns"==e&&(i=new DE.Views.CustomColumnsDialog({handler:function(t,e){"ok"==e&&(n.api.asc_SetColumnsProps(t.getSettings()),n.fireEvent("editcomplete",n))}}),i.show(),i.setSettings(n.api.asc_GetColumnsProps()))},editHyperlink:function(t,e,i){var n,o=this;o.api&&(n=new DE.Views.HyperlinkSettingsDialog({api:o.api,handler:function(t,e){"ok"==e&&o.api.change_Hyperlink(n.getSettings()),o.fireEvent("editcomplete",o)}}),n.show(),n.setSettings(t.hyperProps.value))},onMenuSaveStyle:function(t,e,i){var n=this;n.api&&Common.NotificationCenter.trigger("style:commitsave",n.api.asc_GetStyleFromFormatting())},onMenuUpdateStyle:function(t,e,i){var n=this;n.api&&Common.NotificationCenter.trigger("style:commitchange",n.api.asc_GetStyleFromFormatting())},addComment:function(t,e,i){if(this.api&&this.mode.canCoAuthoring&&this.mode.canComments){this.suppressEditComplete=!0;var n=DE.getController("Common.Controllers.Comments");n&&n.addDummyComment()}},addHyperlink:function(t,e,i){var n,o=this;o.api&&(n=new DE.Views.HyperlinkSettingsDialog({api:o.api,handler:function(t,e){"ok"==e&&o.api.add_Hyperlink(t.getSettings()),o.fireEvent("editcomplete",o)}}),n.show(),n.setSettings(t.hyperProps.value),Common.component.Analytics.trackEvent("DocumentHolder","Add Hyperlink"))},editChartClick:function(){var t=DE.getController("Common.Controllers.ExternalDiagramEditor").getView("Common.Views.ExternalDiagramEditor");if(t){t.setEditMode(!0),t.show();var e=this.api.asc_getChartObject();e&&t.setChartData(new Asc.asc_CChartBinary(e))}},onCutCopyPaste:function(t,e){var i=this;if(i.api){("cut"==t.value?i.api.Cut():"copy"==t.value?i.api.Copy():i.api.Paste())||Common.localStorage.getBool("de-hide-copywarning")||new Common.Views.CopyWarningDialog({handler:function(t){t&&Common.localStorage.setItem("de-hide-copywarning",1),i.fireEvent("editcomplete",i)}}).show()}i.fireEvent("editcomplete",i)},onPrintSelection:function(t){if(this.api){var e=new Asc.asc_CAdjustPrint;e.asc_setPrintType(Asc.c_oAscPrintType.Selection);var i=new Asc.asc_CDownloadOptions(null,Common.Utils.isChrome||Common.Utils.isSafari||Common.Utils.isOpera);i.asc_setAdvancedOptions(e),this.api.asc_Print(i),this.fireEvent("editcomplete",this),Common.component.Analytics.trackEvent("DocumentHolder","Print Selection")}},onControlsSelect:function(t,e){var i=this,n=this.api.asc_GetContentControlProperties();n&&("settings"==t.value?new DE.Views.ControlSettingsDialog({props:n,api:i.api,handler:function(t,e){"ok"==t&&i.api.asc_SetContentControlProperties(e,n.get_InternalId()),i.fireEvent("editcomplete",i)}}).show():"remove"==t.value&&(n.get_FormPr()?this.api.asc_RemoveContentControl(n.get_InternalId()):this.api.asc_RemoveContentControlWrapper(n.get_InternalId()))),i.fireEvent("editcomplete",i)},onInsertCaption:function(){var t=this;new DE.Views.CaptionDialog({isObject:!0,handler:function(e,i){"ok"==e&&t.api.asc_AddObjectCaption(i),t.fireEvent("editcomplete",t)}}).show()},onContinueNumbering:function(t,e){this.api.asc_ContinueNumbering(),this.fireEvent("editcomplete",this)},onStartNumbering:function(t,e,i){if(1==t)this.api.asc_RestartNumbering(e.value.start);else{var n=this;new DE.Views.NumberingValueDialog({title:n.textNumberingValue,props:e.value,handler:function(t,e){"ok"==t&&n.api.asc_RestartNumbering(e),n.fireEvent("editcomplete",n)}}).show()}this.fireEvent("editcomplete",this)},onCellsRemove:function(){var t=this;new Common.Views.OptionsDialog({title:t.textTitleCellsRemove,items:[{caption:this.textLeft,value:"left"},{caption:this.textRow,value:"row"},{caption:this.textCol,value:"col"}],handler:function(e,i){if("ok"==i){var n=e.getSettings();"row"==n?t.api.remRow():"col"==n?t.api.remColumn():t.api.asc_RemoveTableCells()}t.fireEvent("editcomplete",t)}}).show(),this.fireEvent("editcomplete",this)},onCellsAdd:function(){var t=this;new DE.Views.CellsAddDialog({handler:function(e,i){"ok"==e&&(i.row?i.before?t.api.addRowAbove(i.count):t.api.addRowBelow(i.count):i.before?t.api.addColumnLeft(i.count):t.api.addColumnRight(i.count)),t.fireEvent("editcomplete",t)}}).show(),this.fireEvent("editcomplete",this)},createDelayedElementsViewer:function(){var t=this,i=new Common.UI.MenuItem({iconCls:"menu__icon btn-copy",caption:t.textCopy,value:"copy"}).on("click",e.bind(t.onCutCopyPaste,t)),n=new Common.UI.MenuItem({iconCls:"menu__icon btn-undo",caption:t.textUndo}).on("click",function(){t.api.Undo()}),o=new Common.UI.MenuItem({caption:"--"}),s=new Common.UI.MenuItem({iconCls:"menu__icon btn-menu-comments",caption:t.addCommentText}).on("click",e.bind(t.addComment,t)),a=new Common.UI.MenuItem({caption:this.strSign,value:0}).on("click",e.bind(t.onSignatureClick,t)),r=new Common.UI.MenuItem({caption:this.strDetails,value:1}).on("click",e.bind(t.onSignatureClick,t)),l=new Common.UI.MenuItem({caption:this.strSetup,value:2}).on("click",e.bind(t.onSignatureClick,t)),c=new Common.UI.MenuItem({caption:this.strDelete,value:3}).on("click",e.bind(t.onSignatureClick,t)),d=new Common.UI.MenuItem({caption:"--"}),h=new Common.UI.MenuItem({iconCls:"menu__icon btn-print",caption:t.txtPrintSelection}).on("click",e.bind(t.onPrintSelection,t));this.viewModeMenu=new Common.UI.Menu({cls:"shifted-right",initMenu:function(p){var m=p.imgProps&&p.imgProps.value&&!e.isNull(p.imgProps.value.get_ChartProperties()),u=p.imgProps&&p.imgProps.value&&!e.isNull(p.imgProps.value.get_ShapeProperties()),g=p.imgProps&&p.imgProps.value&&t.mode.isSignatureSupport?p.imgProps.value.asc_getSignatureId():void 0,b=g?t.api.asc_getSignatureSetup(g):null,f=!!b&&t._canProtect,C=!!p.paraProps&&!(p.paraProps.value.can_DeleteBlockContentControl()&&p.paraProps.value.can_EditBlockContentControl()&&p.paraProps.value.can_DeleteInlineContentControl()&&p.paraProps.value.can_EditInlineContentControl()),v=!m&&!1!==t.api.can_AddQuotedComment()&&t.mode.canCoAuthoring&&t.mode.canComments&&!t._isDisabled&&!C;if(t.mode.compatibleFeatures&&(v=v&&!u),t.api.asc_IsContentControl()){var _=t.api.asc_GetContentControlProperties(),y=_?_.get_SpecificType():Asc.c_oAscContentControlSpecificType.None;v=v&&!(y==Asc.c_oAscContentControlSpecificType.CheckBox||y==Asc.c_oAscContentControlSpecificType.Picture||y==Asc.c_oAscContentControlSpecificType.ComboBox||y==Asc.c_oAscContentControlSpecificType.DropDownList||y==Asc.c_oAscContentControlSpecificType.DateTime)}n.setVisible(t.mode.canCoAuthoring&&t.mode.canComments&&!t._isDisabled),n.setDisabled(!t.api.asc_getCanUndo()&&!t._isDisabled),o.setVisible(f);var w=!!b&&b.asc_getRequested();a.setVisible(f&&w),r.setVisible(f&&!w),l.setVisible(f),c.setVisible(f&&!w),d.setVisible(v),f&&(a.cmpEl.attr("data-value",g),r.cmpEl.attr("data-value",b.asc_getId()),l.cmpEl.attr("data-value",g),c.cmpEl.attr("data-value",g)),s.setVisible(v),s.setDisabled(p.paraProps&&!0===p.paraProps.locked);var x=t.api&&t.api.can_CopyCut();i.setDisabled(!x),h.setVisible(t.mode.canPrint),h.setDisabled(!x)},items:[i,n,h,o,a,r,l,c,d,s]}).on("hide:after",function(e,i,n){if(t.suppressEditComplete)return void(t.suppressEditComplete=!1);n||t.fireEvent("editcomplete",t),t.currentMenu=null})},createDelayedElements:function(){var i=this,n=new Common.UI.MenuItem({caption:i.txtInsertCaption}).on("click",e.bind(i.onInsertCaption,i)),o=new Common.UI.MenuItem({caption:"--"}),s=new Common.UI.MenuItem({caption:i.txtInsertCaption}).on("click",e.bind(i.onInsertCaption,i)),a=new Common.UI.MenuItem({caption:"--"}),r=new Common.UI.MenuItem({caption:i.textAlign,menu:function(){function t(t,e){if(i.api){var n=Common.Utils.InternalSettings.get("de-img-align-to"),o=1==n?Asc.c_oAscObjectsAlignType.Page:i.api.asc_getSelectedDrawingObjectsCount()<2&&!n||2==n?Asc.c_oAscObjectsAlignType.Margin:Asc.c_oAscObjectsAlignType.Selected;t.value<6?(i.api.put_ShapesAlign(t.value,o),Common.component.Analytics.trackEvent("DocumentHolder","Shape Align")):6==t.value?(i.api.DistributeHorizontally(o),Common.component.Analytics.trackEvent("DocumentHolder","Distribute Horizontally")):7==t.value&&(i.api.DistributeVertically(o),Common.component.Analytics.trackEvent("DocumentHolder","Distribute Vertically"))}i.fireEvent("editcomplete",i)}return new Common.UI.Menu({cls:"ppm-toolbar shifted-right",menuAlign:"tl-tr",items:[new Common.UI.MenuItem({caption:i.textShapeAlignLeft,iconCls:"menu__icon shape-align-left",value:Asc.c_oAscAlignShapeType.ALIGN_LEFT}).on("click",t),new Common.UI.MenuItem({caption:i.textShapeAlignCenter,iconCls:"menu__icon shape-align-center",value:Asc.c_oAscAlignShapeType.ALIGN_CENTER}).on("click",t),new Common.UI.MenuItem({caption:i.textShapeAlignRight,iconCls:"menu__icon shape-align-right",value:Asc.c_oAscAlignShapeType.ALIGN_RIGHT}).on("click",t),new Common.UI.MenuItem({caption:i.textShapeAlignTop,iconCls:"menu__icon shape-align-top",value:Asc.c_oAscAlignShapeType.ALIGN_TOP}).on("click",t),new Common.UI.MenuItem({caption:i.textShapeAlignMiddle,iconCls:"menu__icon shape-align-middle",value:Asc.c_oAscAlignShapeType.ALIGN_MIDDLE}).on("click",t),new Common.UI.MenuItem({caption:i.textShapeAlignBottom,iconCls:"menu__icon shape-align-bottom",value:Asc.c_oAscAlignShapeType.ALIGN_BOTTOM}).on("click",t),{caption:"--"},new Common.UI.MenuItem({caption:i.txtDistribHor,iconCls:"menu__icon shape-distribute-hor",value:6}).on("click",t),new Common.UI.MenuItem({caption:i.txtDistribVert,iconCls:"menu__icon shape-distribute-vert",value:7}).on("click",t)]})}()}),l=new Common.UI.MenuItem({caption:this.txtGroup,iconCls:"menu__icon shape-group"}).on("click",function(t,e){if(i.api){var n=new Asc.asc_CImgProperty;n.put_Group(1),i.api.ImgApply(n)}i.fireEvent("editcomplete",this)}),c=new Common.UI.MenuItem({iconCls:"menu__icon shape-ungroup",caption:this.txtUngroup}).on("click",function(t,e){if(i.api){var n=new Asc.asc_CImgProperty;n.put_Group(-1),i.api.ImgApply(n)}i.fireEvent("editcomplete",this)}),d=new Common.UI.MenuItem({caption:i.textArrange,menu:function(){function t(t,e){if(i.api){var n=new Asc.asc_CImgProperty;n.put_ChangeLevel(t.options.valign),i.api.ImgApply(n)}i.fireEvent("editcomplete",i)}return new Common.UI.Menu({cls:"ppm-toolbar shifted-right",menuAlign:"tl-tr",items:[new Common.UI.MenuItem({caption:i.textArrangeFront,iconCls:"menu__icon arrange-front",valign:Asc.c_oAscChangeLevel.BringToFront}).on("click",t),new Common.UI.MenuItem({caption:i.textArrangeBack,iconCls:"menu__icon arrange-back",valign:Asc.c_oAscChangeLevel.SendToBack}).on("click",t),new Common.UI.MenuItem({caption:i.textArrangeForward,iconCls:"menu__icon arrange-forward",valign:Asc.c_oAscChangeLevel.BringForward}).on("click",t),new Common.UI.MenuItem({caption:i.textArrangeBackward,iconCls:"menu__icon arrange-backward",valign:Asc.c_oAscChangeLevel.BringBackward}).on("click",t),{caption:"--"},l,c]})}()}),h=new Common.UI.MenuItem({caption:i.textEditWrapBoundary,cls:"no-icon-wrap-item"}).on("click",function(t,e){i.api&&i.api.StartChangeWrapPolygon(),i.fireEvent("editcomplete",i)});this.menuImageWrap=new Common.UI.MenuItem({iconCls:"menu__icon wrap-inline",caption:i.textWrap,menu:function(){function t(t,e){if(i.api){var n=new Asc.asc_CImgProperty;if(n.put_WrappingStyle(t.options.wrapType),i.menuImageWrap._originalProps.get_WrappingStyle()===Asc.c_oAscWrapStyle2.Inline&&t.wrapType!==Asc.c_oAscWrapStyle2.Inline){n.put_PositionH(new Asc.CImagePositionH),n.get_PositionH().put_UseAlign(!1), -n.get_PositionH().put_RelativeFrom(Asc.c_oAscRelativeFromH.Column);var o=i.menuImageWrap._originalProps.get_Value_X(Asc.c_oAscRelativeFromH.Column);n.get_PositionH().put_Value(o),n.put_PositionV(new Asc.CImagePositionV),n.get_PositionV().put_UseAlign(!1),n.get_PositionV().put_RelativeFrom(Asc.c_oAscRelativeFromV.Paragraph),o=i.menuImageWrap._originalProps.get_Value_Y(Asc.c_oAscRelativeFromV.Paragraph),n.get_PositionV().put_Value(o)}i.api.ImgApply(n)}i.fireEvent("editcomplete",i)}return new Common.UI.Menu({cls:"ppm-toolbar shifted-right",menuAlign:"tl-tr",items:[new Common.UI.MenuItem({caption:i.txtInline,iconCls:"menu__icon wrap-inline",toggleGroup:"popuppicturewrapping",wrapType:Asc.c_oAscWrapStyle2.Inline,checkmark:!1,checkable:!0}).on("click",t),new Common.UI.MenuItem({caption:i.txtSquare,iconCls:"menu__icon wrap-square",toggleGroup:"popuppicturewrapping",wrapType:Asc.c_oAscWrapStyle2.Square,checkmark:!1,checkable:!0}).on("click",t),new Common.UI.MenuItem({caption:i.txtTight,iconCls:"menu__icon wrap-tight",toggleGroup:"popuppicturewrapping",wrapType:Asc.c_oAscWrapStyle2.Tight,checkmark:!1,checkable:!0}).on("click",t),new Common.UI.MenuItem({caption:i.txtThrough,iconCls:"menu__icon wrap-through",toggleGroup:"popuppicturewrapping",wrapType:Asc.c_oAscWrapStyle2.Through,checkmark:!1,checkable:!0}).on("click",t),new Common.UI.MenuItem({caption:i.txtTopAndBottom,iconCls:"menu__icon wrap-topandbottom",toggleGroup:"popuppicturewrapping",wrapType:Asc.c_oAscWrapStyle2.TopAndBottom,checkmark:!1,checkable:!0}).on("click",t),new Common.UI.MenuItem({caption:i.txtInFront,iconCls:"menu__icon wrap-infront",toggleGroup:"popuppicturewrapping",wrapType:Asc.c_oAscWrapStyle2.InFront,checkmark:!1,checkable:!0}).on("click",t),new Common.UI.MenuItem({caption:i.txtBehind,iconCls:"menu__icon wrap-behind",toggleGroup:"popuppicturewrapping",wrapType:Asc.c_oAscWrapStyle2.Behind,checkmark:!1,checkable:!0}).on("click",t),{caption:"--"},h]})}()});var p=new Common.UI.MenuItem({iconCls:"menu__icon btn-menu-image",caption:i.advancedText}).on("click",function(t,n){var o,s;if(i.api){var a=i.api.getSelectedElements();if(a&&e.isArray(a))for(var r=a.length-1;r>=0;r--)if(o=a[r].get_ObjectType(),s=a[r].get_ObjectValue(),Asc.c_oAscTypeSelectElement.Image==o){var l;s.get_ChartProperties()||s.get_ShapeProperties()||i.menuOriginalSize.isDisabled()||!i.menuOriginalSize.isVisible()||(l=i.api.get_OriginalSizeImage())&&(l={width:l.get_ImageWidth(),height:l.get_ImageHeight()});var c=new DE.Views.ImageSettingsAdvanced({imageProps:s,sizeOriginal:l,api:i.api,sectionProps:i.api.asc_GetSectionProps(),handler:function(t,e){"ok"==t&&i.api&&i.api.ImgApply(e.imageProps),i.fireEvent("editcomplete",i)}});c.show(),c.btnOriginalSize.setVisible(i.menuOriginalSize.isVisible());break}}}),m=new Common.UI.MenuItem({caption:i.editChartText}).on("click",e.bind(i.editChartClick,i));this.menuOriginalSize=new Common.UI.MenuItem({caption:i.originalSizeText}).on("click",function(t,e){if(i.api){var n=i.api.get_OriginalSizeImage(),o=new Asc.asc_CImgProperty;o.put_Width(n.get_ImageWidth()),o.put_Height(n.get_ImageHeight()),o.put_ResetCrop(!0),i.api.ImgApply(o),i.fireEvent("editcomplete",this)}});var u=new Common.UI.MenuItem({caption:i.textReplace,menu:new Common.UI.Menu({cls:"shifted-right",menuAlign:"tl-tr",items:[new Common.UI.MenuItem({caption:this.textFromFile}).on("click",function(t){setTimeout(function(){i.api&&i.api.ChangeImageFromFile(),i.fireEvent("editcomplete",i)},10)}),new Common.UI.MenuItem({caption:this.textFromUrl}).on("click",function(t){new Common.Views.ImageFromUrlDialog({handler:function(t,n){if("ok"==t&&i.api){var o=n.replace(/ /g,"");if(!e.isEmpty(o)){var s=new Asc.asc_CImgProperty;s.put_ImageUrl(o),i.api.ImgApply(s)}}i.fireEvent("editcomplete",i)}}).show()}),new Common.UI.MenuItem({caption:this.textFromStorage}).on("click",function(t){Common.NotificationCenter.trigger("storage:image-load","change")})]})}),g=new Common.UI.MenuItem({iconCls:"menu__icon btn-copy",caption:i.textCopy,value:"copy"}).on("click",e.bind(i.onCutCopyPaste,i)),b=new Common.UI.MenuItem({iconCls:"menu__icon btn-paste",caption:i.textPaste,value:"paste"}).on("click",e.bind(i.onCutCopyPaste,i)),f=new Common.UI.MenuItem({iconCls:"menu__icon btn-cut",caption:i.textCut,value:"cut"}).on("click",e.bind(i.onCutCopyPaste,i)),C=new Common.UI.MenuItem({iconCls:"menu__icon btn-print",caption:i.txtPrintSelection}).on("click",e.bind(i.onPrintSelection,i)),v=new Common.UI.MenuItem({caption:this.strSign,value:0}).on("click",e.bind(i.onSignatureClick,i)),_=new Common.UI.MenuItem({caption:this.strSetup,value:2}).on("click",e.bind(i.onSignatureClick,i)),y=new Common.UI.MenuItem({caption:"--"}),w=new Common.UI.MenuItem({caption:i.textRotate,menu:new Common.UI.Menu({cls:"shifted-right",menuAlign:"tl-tr",items:[new Common.UI.MenuItem({iconCls:"menu__icon btn-rotate-90",caption:this.textRotate90,value:1}).on("click",e.bind(i.onImgRotate,i)),new Common.UI.MenuItem({iconCls:"menu__icon btn-rotate-270",caption:this.textRotate270,value:0}).on("click",e.bind(i.onImgRotate,i)),{caption:"--"},new Common.UI.MenuItem({iconCls:"menu__icon btn-flip-hor",caption:this.textFlipH,value:1}).on("click",e.bind(i.onImgFlip,i)),new Common.UI.MenuItem({iconCls:"menu__icon btn-flip-vert",caption:this.textFlipV,value:0}).on("click",e.bind(i.onImgFlip,i))]})});i.menuImgCrop=new Common.UI.MenuItem({caption:i.textCrop,menu:new Common.UI.Menu({cls:"shifted-right",menuAlign:"tl-tr",items:[new Common.UI.MenuItem({caption:i.textCrop,checkable:!0,allowDepress:!0,value:0}).on("click",e.bind(i.onImgCrop,i)),new Common.UI.MenuItem({caption:i.textCropFill,value:1}).on("click",e.bind(i.onImgCrop,i)),new Common.UI.MenuItem({caption:i.textCropFit,value:2}).on("click",e.bind(i.onImgCrop,i))]})}),this.pictureMenu=new Common.UI.Menu({cls:"shifted-right",initMenu:function(t){if(!e.isUndefined(t.imgProps)){var n=!t.imgProps.value.get_CanBeFlow(),o=t.imgProps.value.get_WrappingStyle();i.menuImageWrap._originalProps=t.imgProps.value;var s="menu__icon ";if(n){for(var a=0;a<6;a++)i.menuImageWrap.menu.items[a].setChecked(!1);s+="wrap-inline"}else switch(o){case Asc.c_oAscWrapStyle2.Inline:i.menuImageWrap.menu.items[0].setChecked(!0),s+="wrap-inline";break;case Asc.c_oAscWrapStyle2.Square:i.menuImageWrap.menu.items[1].setChecked(!0),s+="wrap-square";break;case Asc.c_oAscWrapStyle2.Tight:i.menuImageWrap.menu.items[2].setChecked(!0),s+="wrap-tight";break;case Asc.c_oAscWrapStyle2.Through:i.menuImageWrap.menu.items[3].setChecked(!0),s+="wrap-through";break;case Asc.c_oAscWrapStyle2.TopAndBottom:i.menuImageWrap.menu.items[4].setChecked(!0),s+="wrap-topandbottom";break;case Asc.c_oAscWrapStyle2.Behind:i.menuImageWrap.menu.items[6].setChecked(!0),s+="wrap-behind";break;case Asc.c_oAscWrapStyle2.InFront:i.menuImageWrap.menu.items[5].setChecked(!0),s+="wrap-infront";break;default:for(var a=0;a<6;a++)i.menuImageWrap.menu.items[a].setChecked(!1);s+="wrap-infront"}i.menuImageWrap.setIconCls(s),e.each(i.menuImageWrap.menu.items,function(t){t.setDisabled(n)});var x=t.imgProps.isImg&&t.imgProps.isChart||t.imgProps.isImg&&t.imgProps.isShape||t.imgProps.isShape&&t.imgProps.isChart;x?(p.setCaption(i.advancedText,!0),p.setIconCls("menu__icon btn-menu-image")):(p.setCaption(t.imgProps.isImg?i.imageText:t.imgProps.isChart?i.chartText:i.shapeText,!0),p.setIconCls("menu__icon "+(t.imgProps.isImg?"btn-menu-image":t.imgProps.isChart?"btn-menu-chart":"btn-menu-shape"))),m.setVisible(!e.isNull(t.imgProps.value.get_ChartProperties())&&!x),i.menuOriginalSize.setVisible(t.imgProps.isOnlyImg||!t.imgProps.isChart&&!t.imgProps.isShape);var S=i.api.asc_IsContentControl()?i.api.asc_GetContentControlProperties():null,A=S?S.get_Lock():Asc.c_oAscSdtLockType.Unlocked,k=A==Asc.c_oAscSdtLockType.SdtContentLocked||A==Asc.c_oAscSdtLockType.ContentLocked,T=t.imgProps.locked||void 0!==t.headerProps&&t.headerProps.locked||k,I=t.imgProps.value.asc_getPluginGuid();if(u.setVisible(t.imgProps.isOnlyImg&&(null===I||void 0===I)),u.isVisible()&&u.setDisabled(T||null===I),u.menu.items[2].setVisible(i.mode.canRequestInsertImage||i.mode.fileChoiceUrl&&i.mode.fileChoiceUrl.indexOf("{documentType}")>-1),w.setVisible(!t.imgProps.isChart&&(null===I||void 0===I)),w.isVisible()&&w.setDisabled(T),i.menuImgCrop.setVisible(i.api.asc_canEditCrop()),i.menuImgCrop.isVisible()&&i.menuImgCrop.setDisabled(T),m.isVisible()&&m.setDisabled(T||t.imgProps.value.get_SeveralCharts()),i.pictureMenu.items[19].setVisible(m.isVisible()),i.menuOriginalSize.setDisabled(T||null===t.imgProps.value.get_ImageUrl()||void 0===t.imgProps.value.get_ImageUrl()),p.setDisabled(T),r.setDisabled(T||o==Asc.c_oAscWrapStyle2.Inline),!T&&o!=Asc.c_oAscWrapStyle2.Inline){var P=i.api.asc_getSelectedDrawingObjectsCount(),M=Common.Utils.InternalSettings.get("de-img-align-to");r.menu.items[7].setDisabled(2==P&&(!M||3==M)),r.menu.items[8].setDisabled(2==P&&(!M||3==M))}d.setDisabled(o==Asc.c_oAscWrapStyle2.Inline||k),i.api&&(c.setDisabled(T||!i.api.CanUnGroup()),l.setDisabled(T||!i.api.CanGroup()),h.setDisabled(T||!i.api.CanChangeWrapPolygon())),i.menuImageWrap.setDisabled(T||t.imgProps.value.get_FromGroup()||n&&h.isDisabled()||!!S&&S.get_SpecificType()==Asc.c_oAscContentControlSpecificType.Picture);var E=i.api&&i.api.can_CopyCut();g.setDisabled(!E),f.setDisabled(T||!E),b.setDisabled(T),C.setVisible(i.mode.canPrint),C.setDisabled(!E);var U=t.imgProps&&t.imgProps.value&&i.mode.isSignatureSupport?t.imgProps.value.asc_getSignatureId():void 0,V=!!U;v.setVisible(V),_.setVisible(V),y.setVisible(V),V&&(v.cmpEl.attr("data-value",U),_.cmpEl.attr("data-value",U))}},items:[f,g,b,C,{caption:"--"},v,_,y,d,r,i.menuImageWrap,w,{caption:"--"},n,o,i.menuImgCrop,i.menuOriginalSize,u,m,{caption:"--"},p]}).on("hide:after",function(t,e,n){n||i.fireEvent("editcomplete",i),i.currentMenu=null});var x=new Common.UI.MenuItem({caption:i.txtInsertCaption}).on("click",e.bind(i.onInsertCaption,i)),S=new Common.UI.MenuItem({iconCls:"menu__icon btn-merge",caption:i.mergeCellsText}).on("click",function(t){i.api&&i.api.MergeCells()}),A=new Common.UI.MenuItem({caption:i.splitCellsText}).on("click",function(t){i.api&&new Common.Views.InsertTableDialog({split:!0,handler:function(t,e){"ok"==t&&(i.api&&i.api.SplitCell(e.columns,e.rows),Common.component.Analytics.trackEvent("DocumentHolder","Table")),i.fireEvent("editcomplete",i)}}).show()}),k=function(t,e){if(i.api){var n=new Asc.CTableProp;n.put_CellsVAlign(t.options.valign),i.api.tblApply(n)}},T=new Common.UI.MenuItem({iconCls:"menu__icon btn-align-top",caption:i.cellAlignText,menu:new Common.UI.Menu({cls:"shifted-right",menuAlign:"tl-tr",items:[i.menuTableCellTop=new Common.UI.MenuItem({iconCls:"menu__icon btn-align-top",caption:i.textShapeAlignTop,toggleGroup:"popuptablecellalign",checkmark:!1,checkable:!0,checked:!1,valign:Asc.c_oAscVertAlignJc.Top}).on("click",e.bind(k,i)),i.menuTableCellCenter=new Common.UI.MenuItem({iconCls:"menu__icon btn-align-middle",caption:i.textShapeAlignMiddle,toggleGroup:"popuptablecellalign",checkmark:!1,checkable:!0,checked:!1,valign:Asc.c_oAscVertAlignJc.Center}).on("click",e.bind(k,i)),i.menuTableCellBottom=new Common.UI.MenuItem({iconCls:"menu__icon btn-align-bottom",caption:i.textShapeAlignBottom,toggleGroup:"popuptablecellalign",checkmark:!1,checkable:!0,checked:!1,valign:Asc.c_oAscVertAlignJc.Bottom}).on("click",e.bind(k,i))]})}),I=new Common.UI.MenuItem({iconCls:"menu__icon btn-menu-table",caption:i.advancedTableText}).on("click",e.bind(i.advancedTableClick,i)),P=new Common.UI.MenuItem({iconCls:"menu__icon btn-paragraph",caption:i.advancedParagraphText}).on("click",e.bind(i.advancedParagraphClick,i)),M=new Common.UI.MenuItem({caption:"--"}),E=new Common.UI.MenuItem({caption:i.editHyperlinkText}).on("click",e.bind(i.editHyperlink,i)),U=new Common.UI.MenuItem({caption:i.removeHyperlinkText}).on("click",function(t,e){i.api&&i.api.remove_Hyperlink(t.hyperProps.value),i.fireEvent("editcomplete",i)}),V=new Common.UI.MenuItem({iconCls:"menu__icon btn-inserthyperlink",caption:i.hyperlinkText,menu:new Common.UI.Menu({cls:"shifted-right",menuAlign:"tl-tr",items:[E,U]})}),B=new Common.UI.MenuItem({iconCls:"menu__icon cc-remove",caption:i.textRemove,value:"remove"}).on("click",e.bind(i.onControlsSelect,i)),D=new Common.UI.MenuItem({caption:i.textSettings,value:"settings"}).on("click",e.bind(i.onControlsSelect,i)),F=new Common.UI.MenuItem({caption:i.textContentControls,menu:new Common.UI.Menu({cls:"shifted-right",menuAlign:"tl-tr",items:[B,D]})}),R=new Common.UI.MenuItem({caption:i.textTOC,menu:new Common.UI.Menu({cls:"shifted-right",menuAlign:"tl-tr",items:[{caption:i.textSettings,value:"settings"},{caption:i.textUpdateAll,value:"all"},{caption:i.textUpdatePages,value:"pages"}]})});R.menu.on("item:click",function(t,e,n){i.fireEvent("settings"==e.value?"links:contents":"links:update",[e.value,!0])});var L=new Common.UI.MenuItem({iconCls:"menu__icon btn-menu-comments",caption:i.addCommentText}).on("click",e.bind(i.addComment,i)),N=new Common.UI.MenuItem({iconCls:"menu__icon btn-inserthyperlink",caption:i.hyperlinkText}).on("click",e.bind(i.addHyperlink,i)),H=new Common.UI.MenuItem({caption:i.textFollow}).on("click",e.bind(i.onFollowMove,i));i.menuSpellTable=new Common.UI.MenuItem({caption:i.loadSpellText,disabled:!0}),i.menuSpellMoreTable=new Common.UI.MenuItem({caption:i.moreText,menu:new Common.UI.Menu({cls:"shifted-right",menuAlign:"tl-tr",restoreHeight:!0,items:[]})});var O=e.template(['','',"<%= caption %>",""].join(""));i.langTableMenu=new Common.UI.MenuItem({iconCls:"menu__icon btn-ic-doclang",caption:i.langText,menu:new Common.UI.MenuSimple({cls:"lang-menu",menuAlign:"tl-tr",restoreHeight:285,items:[],itemTemplate:O,search:!0})});var z=new Common.UI.MenuItem({caption:i.ignoreSpellText}).on("click",function(t){i.api&&(i.api.asc_ignoreMisspelledWord(i._currentSpellObj,!1),i.fireEvent("editcomplete",i))}),$=new Common.UI.MenuItem({caption:i.ignoreAllSpellText}).on("click",function(t){i.api&&(i.api.asc_ignoreMisspelledWord(i._currentSpellObj,!0),i.fireEvent("editcomplete",i))}),G=new Common.UI.MenuItem({caption:i.toDictionaryText}).on("click",function(t,e){i.api.asc_spellCheckAddToDictionary(i._currentSpellObj),i.fireEvent("editcomplete",i)}),W=new Common.UI.MenuItem({caption:"--"}),j=new Common.UI.MenuItem({caption:"--"});i.menuSpellCheckTable=new Common.UI.MenuItem({iconCls:"menu__icon btn-ic-docspell",caption:i.spellcheckText,menu:new Common.UI.Menu({cls:"shifted-right",menuAlign:"tl-tr",items:[i.menuSpellTable,i.menuSpellMoreTable,W,z,$,G,{caption:"--"},i.langTableMenu]})});var K=new Common.UI.MenuItem({iconCls:"menu__icon btn-copy",caption:i.textCopy,value:"copy"}).on("click",e.bind(i.onCutCopyPaste,i)),q=new Common.UI.MenuItem({iconCls:"menu__icon btn-paste",caption:i.textPaste,value:"paste"}).on("click",e.bind(i.onCutCopyPaste,i)),Y=new Common.UI.MenuItem({iconCls:"menu__icon btn-cut",caption:i.textCut,value:"cut"}).on("click",e.bind(i.onCutCopyPaste,i)),X=new Common.UI.MenuItem({iconCls:"menu__icon btn-print",caption:i.txtPrintSelection}).on("click",e.bind(i.onPrintSelection,i)),J=new Common.UI.MenuItem({caption:"--"}),Z=new Common.UI.MenuItem({caption:i.textDistributeRows}).on("click",e.bind(function(){i.api&&i.api.asc_DistributeTableCells(!1),i.fireEvent("editcomplete",i)},i)),Q=new Common.UI.MenuItem({caption:i.textDistributeCols}).on("click",e.bind(function(){i.api&&i.api.asc_DistributeTableCells(!0),i.fireEvent("editcomplete",i)},i)),tt=function(t,e){if(i.api){var n=new Asc.CTableProp;n.put_CellsTextDirection(t.options.direction),i.api.tblApply(n)}},et=new Common.UI.MenuItem({iconCls:"menu__icon text-orient-hor",caption:i.directionText,menu:new Common.UI.Menu({cls:"ppm-toolbar shifted-right",menuAlign:"tl-tr",items:[i.menuTableDirectH=new Common.UI.MenuItem({caption:i.directHText,iconCls:"menu__icon text-orient-hor",checkable:!0,checkmark:!1,checked:!1,toggleGroup:"popuptabledirect",direction:Asc.c_oAscCellTextDirection.LRTB}).on("click",e.bind(tt,i)),i.menuTableDirect90=new Common.UI.MenuItem({caption:i.direct90Text,iconCls:"menu__icon text-orient-rdown",checkable:!0,checkmark:!1,checked:!1,toggleGroup:"popuptabledirect",direction:Asc.c_oAscCellTextDirection.TBRL}).on("click",e.bind(tt,i)),i.menuTableDirect270=new Common.UI.MenuItem({caption:i.direct270Text,iconCls:"menu__icon text-orient-rup",checkable:!0,checkmark:!1,checked:!1,toggleGroup:"popuptabledirect",direction:Asc.c_oAscCellTextDirection.BTLR}).on("click",e.bind(tt,i))]})}),it=new Common.UI.MenuItem({caption:i.textStartNewList}).on("click",e.bind(i.onStartNumbering,i,1)),nt=new Common.UI.MenuItem({caption:i.textStartNumberingFrom}).on("click",e.bind(i.onStartNumbering,i,"advanced")),ot=new Common.UI.MenuItem({caption:i.textContinueNumbering}).on("click",e.bind(i.onContinueNumbering,i)),st=new Common.UI.MenuItem({caption:i.bulletsText,menu:new Common.UI.Menu({cls:"shifted-right",menuAlign:"tl-tr",items:[it,nt,ot]})}),at=new Common.UI.MenuItem({caption:i.textRefreshField}).on("click",function(t,e){i.api.asc_UpdateComplexField(t.options.fieldProps),i.fireEvent("editcomplete",i)}),rt=new Common.UI.MenuItem({caption:"--"});this.tableMenu=new Common.UI.Menu({cls:"shifted-right",initMenu:function(t){if(!e.isUndefined(t.tableProps)){for(var n=t.mathProps&&t.mathProps.value,o=8;o<27;o++)i.tableMenu.items[o].setVisible(!n);var s=t.tableProps.value.get_CellsVAlign(),a="";switch(s){case Asc.c_oAscVertAlignJc.Top:a="menu__icon btn-align-top";break;case Asc.c_oAscVertAlignJc.Center:a="menu__icon btn-align-middle";break;case Asc.c_oAscVertAlignJc.Bottom:a="menu__icon btn-align-bottom"}T.setIconCls(a),i.menuTableCellTop.setChecked(s==Asc.c_oAscVertAlignJc.Top),i.menuTableCellCenter.setChecked(s==Asc.c_oAscVertAlignJc.Center),i.menuTableCellBottom.setChecked(s==Asc.c_oAscVertAlignJc.Bottom);var r=t.tableProps.value.get_CellsTextDirection();switch(a="",r){case Asc.c_oAscCellTextDirection.LRTB:a="menu__icon text-orient-hor";break;case Asc.c_oAscCellTextDirection.TBRL:a="menu__icon text-orient-rdown";break;case Asc.c_oAscCellTextDirection.BTLR:a="menu__icon text-orient-rup"}et.setIconCls(a),i.menuTableDirectH.setChecked(r==Asc.c_oAscCellTextDirection.LRTB),i.menuTableDirect90.setChecked(r==Asc.c_oAscCellTextDirection.TBRL),i.menuTableDirect270.setChecked(r==Asc.c_oAscCellTextDirection.BTLR);var l=t.tableProps.locked||void 0!==t.headerProps&&t.headerProps.locked;i.tableMenu.items[11].setDisabled(l),i.tableMenu.items[12].setDisabled(l),i.api&&(S.setDisabled(l||!i.api.CheckBeforeMergeCells()),A.setDisabled(l||!i.api.CheckBeforeSplitCells())),Z.setDisabled(l),Q.setDisabled(l),T.setDisabled(l),et.setDisabled(l),I.setDisabled(l);var c=i.api&&i.api.can_CopyCut();K.setDisabled(!c),Y.setDisabled(l||!c),q.setDisabled(l),X.setVisible(i.mode.canPrint),X.setDisabled(!c);var d=i.api.asc_GetCurrentNumberingId(),h=null!==d;if(st.setVisible(h),h){var p=i.api.asc_GetNumberingPr(d).get_Lvl(i.api.asc_GetCurrentNumberingLvl()),m=p.get_Format(),u=i.api.asc_GetCalculatedNumberingValue();it.setVisible(p.get_Start()!=u),it.value={start:p.get_Start()},nt.setVisible(m!=Asc.c_oAscNumberingFormat.Bullet),nt.value={format:m,start:u},it.setCaption(m==Asc.c_oAscNumberingFormat.Bullet?i.textSeparateList:i.textStartNewList),ot.setCaption(m==Asc.c_oAscNumberingFormat.Bullet?i.textJoinList:i.textContinueNumbering)}var g=null;i.api&&(g=i.api.can_AddHyperlink()),N.setVisible(void 0===t.hyperProps&&!1!==g),V.setVisible(void 0!==t.hyperProps),E.hyperProps=t.hyperProps,U.hyperProps=t.hyperProps,!1!==g&&(N.hyperProps={},N.hyperProps.value=new Asc.CHyperlinkProperty,N.hyperProps.value.put_Text(g));var b=i.api.asc_GetRevisionsChangesStack(),f=!1;H.value=null,e.each(b,function(t){t.get_Type()!=Asc.c_oAscRevisionsChangeType.TextAdd&&t.get_Type()!=Asc.c_oAscRevisionsChangeType.TextRem||t.get_MoveType()==Asc.c_oAscRevisionsMove.NoMove||(H.value=t,f=!0)}),H.setVisible(f),M.setVisible(N.isVisible()||V.isVisible()||st.isVisible()||H.isVisible()),P.setVisible(void 0!==t.paraProps),i._currentParaObjDisabled=l=t.paraProps.locked||void 0!==t.headerProps&&t.headerProps.locked,N.setDisabled(l),V.setDisabled(l||void 0!==t.hyperProps&&!0===t.hyperProps.isSeveralLinks),P.setDisabled(l),i.menuSpellCheckTable.setVisible(void 0!==t.spellProps&&!1===t.spellProps.value.get_Checked()),G.setVisible(i.mode.isDesktopApp),j.setVisible(void 0!==t.spellProps&&!1===t.spellProps.value.get_Checked()),i.langTableMenu.setDisabled(l),void 0!==t.spellProps&&!1===t.spellProps.value.get_Checked()&&null!==t.spellProps.value.get_Variants()&&void 0!==t.spellProps.value.get_Variants()?i.addWordVariants(!1):(i.menuSpellTable.setCaption(i.loadSpellText,!0),i.clearWordVariants(!1),i.menuSpellMoreTable.setVisible(!1)),i.menuSpellCheckTable.isVisible()&&i._currLang.id!==i._currLang.tableid&&(i.changeLanguageMenu(i.langTableMenu.menu),i._currLang.tableid=i._currLang.id);var C=0;n?C=i.addEquationMenu(!1,7):i.clearEquationMenu(!1,7),J.setVisible(n&&C>0);var v=!!t.paraProps&&!(t.paraProps.value.can_DeleteBlockContentControl()&&t.paraProps.value.can_EditBlockContentControl()&&t.paraProps.value.can_DeleteInlineContentControl()&&t.paraProps.value.can_EditInlineContentControl()),_=i.api.asc_GetTableOfContentsPr(!0),y=!_&&i.api.asc_IsContentControl();if(F.setVisible(y),y){var w=i.api.asc_GetContentControlProperties(),x=w?w.get_Lock():Asc.c_oAscSdtLockType.Unlocked,k=w&&w.get_FormPr();B.setDisabled(x==Asc.c_oAscSdtLockType.SdtContentLocked||x==Asc.c_oAscSdtLockType.SdtLocked),B.setCaption(k?i.getControlLabel(w):i.textRemoveControl),D.setVisible(i.mode.canEditContentControl&&!k);var O=w?w.get_SpecificType():Asc.c_oAscContentControlSpecificType.None;v=v||O==Asc.c_oAscContentControlSpecificType.CheckBox||O==Asc.c_oAscContentControlSpecificType.Picture||O==Asc.c_oAscContentControlSpecificType.ComboBox||O==Asc.c_oAscContentControlSpecificType.DropDownList||O==Asc.c_oAscContentControlSpecificType.DateTime}R.setVisible(_),L.setVisible(!1!==i.api.can_AddQuotedComment()&&i.mode.canCoAuthoring&&i.mode.canComments&&!v),L.setDisabled(void 0!==t.paraProps&&!0===t.paraProps.locked);var z=i.api.asc_GetCurrentComplexField();at.setVisible(!!z),at.setDisabled(l),rt.setVisible(!!z),z&&(at.options.fieldProps=z)}},items:[i.menuSpellCheckTable,j,Y,K,q,X,{caption:"--"},J,at,rt,{caption:i.selectText,menu:new Common.UI.Menu({cls:"shifted-right",menuAlign:"tl-tr",style:"width: 100px",items:[new Common.UI.MenuItem({caption:i.rowText}).on("click",function(t){i.api&&i.api.selectRow()}),new Common.UI.MenuItem({caption:i.columnText}).on("click",function(t){i.api&&i.api.selectColumn()}),new Common.UI.MenuItem({caption:i.cellText}).on("click",function(t){i.api&&i.api.selectCell()}),new Common.UI.MenuItem({caption:i.tableText}).on("click",function(t){i.api&&i.api.selectTable()})]})},{iconCls:"menu__icon btn-addcell",caption:i.insertText,menu:new Common.UI.Menu({cls:"shifted-right",menuAlign:"tl-tr",items:[new Common.UI.MenuItem({caption:i.insertColumnLeftText}).on("click",function(t){i.api&&i.api.addColumnLeft()}),new Common.UI.MenuItem({caption:i.insertColumnRightText}).on("click",function(t){i.api&&i.api.addColumnRight()}),new Common.UI.MenuItem({caption:i.insertRowAboveText}).on("click",function(t){i.api&&i.api.addRowAbove()}),new Common.UI.MenuItem({caption:i.insertRowBelowText}).on("click",function(t){i.api&&i.api.addRowBelow()}),new Common.UI.MenuItem({caption:i.textSeveral}).on("click",function(t){i.onCellsAdd()})]})},{iconCls:"menu__icon btn-delcell",caption:i.deleteText,menu:new Common.UI.Menu({cls:"shifted-right",menuAlign:"tl-tr",style:"width: 100px",items:[new Common.UI.MenuItem({caption:i.rowText}).on("click",function(t){i.api&&i.api.remRow()}),new Common.UI.MenuItem({caption:i.columnText}).on("click",function(t){i.api&&i.api.remColumn()}),new Common.UI.MenuItem({caption:i.tableText}).on("click",function(t){i.api&&i.api.remTable()}),new Common.UI.MenuItem({caption:i.textCells}).on("click",function(t){i.onCellsRemove()})]})},{caption:"--"},S,A,{caption:"--"},Z,Q,{caption:"--"},T,et,{caption:"--"},x,{caption:"--"},I,{caption:"--"},L,st,N,V,H,M,F,R,P]}).on("hide:after",function(t,e,n){if(i.suppressEditComplete)return void(i.suppressEditComplete=!1);n||i.fireEvent("editcomplete",i),i.currentMenu=null});var lt=new Common.UI.MenuItem({caption:i.breakBeforeText,checkable:!0}).on("click",function(t,e){i.api.put_PageBreak(t.checked)}),ct=new Common.UI.MenuItem({caption:i.keepLinesText,checkable:!0}).on("click",function(t,e){i.api.put_KeepLines(t.checked)}),dt=function(t,e){if(i.api){var n=new Asc.asc_CImgProperty;n.put_VerticalTextAlign(t.options.valign),i.api.ImgApply(n)}},ht=new Common.UI.MenuItem({iconCls:"menu__icon btn-align-top",caption:i.vertAlignText,menu:new Common.UI.Menu({cls:"shifted-right",menuAlign:"tl-tr",items:[i.menuParagraphTop=new Common.UI.MenuItem({iconCls:"menu__icon btn-align-top",caption:i.textShapeAlignTop,checkmark:!1,checkable:!0,checked:!1,toggleGroup:"popupparagraphvalign",valign:Asc.c_oAscVAlign.Top}).on("click",e.bind(dt,i)),i.menuParagraphCenter=new Common.UI.MenuItem({iconCls:"menu__icon btn-align-middle",caption:i.textShapeAlignMiddle,checkmark:!1,checkable:!0,checked:!1,toggleGroup:"popupparagraphvalign",valign:Asc.c_oAscVAlign.Center}).on("click",e.bind(dt,i)),i.menuParagraphBottom=new Common.UI.MenuItem({iconCls:"menu__icon btn-align-bottom",caption:i.textShapeAlignBottom,checkmark:!1,checkable:!0,checked:!1,toggleGroup:"popupparagraphvalign",valign:Asc.c_oAscVAlign.Bottom}).on("click",e.bind(dt,i))]})}),pt=function(t,e){if(i.api){var n=new Asc.asc_CImgProperty;n.put_Vert(t.options.direction),i.api.ImgApply(n)}},mt=new Common.UI.MenuItem({iconCls:"menu__icon text-orient-hor",caption:i.directionText,menu:new Common.UI.Menu({cls:"ppm-toolbar shifted-right",menuAlign:"tl-tr",items:[i.menuParagraphDirectH=new Common.UI.MenuItem({caption:i.directHText,iconCls:"menu__icon text-orient-hor",checkable:!0,checkmark:!1,checked:!1,toggleGroup:"popupparagraphdirect",direction:Asc.c_oAscVertDrawingText.normal}).on("click",e.bind(pt,i)),i.menuParagraphDirect90=new Common.UI.MenuItem({caption:i.direct90Text,iconCls:"menu__icon text-orient-rdown",checkable:!0,checkmark:!1,checked:!1,toggleGroup:"popupparagraphdirect",direction:Asc.c_oAscVertDrawingText.vert}).on("click",e.bind(pt,i)),i.menuParagraphDirect270=new Common.UI.MenuItem({caption:i.direct270Text,iconCls:"menu__icon text-orient-rup",checkable:!0,checkmark:!1,checked:!1,toggleGroup:"popupparagraphdirect",direction:Asc.c_oAscVertDrawingText.vert270}).on("click",e.bind(pt,i))]})}),ut=new Common.UI.MenuItem({iconCls:"menu__icon btn-paragraph",caption:i.advancedParagraphText}).on("click",e.bind(i.advancedParagraphClick,i)),gt=new Common.UI.MenuItem({caption:i.advancedFrameText}).on("click",e.bind(i.advancedFrameClick,i,!0)),bt=new Common.UI.MenuItem({iconCls:"menu__icon dropcap-intext",caption:i.advancedDropCapText}).on("click",e.bind(i.advancedFrameClick,i,!1)),ft=new Common.UI.MenuItem({caption:"--"}),Ct=new Common.UI.MenuItem({iconCls:"menu__icon btn-menu-comments",caption:i.addCommentText}).on("click",e.bind(i.addComment,i)),vt=new Common.UI.MenuItem({caption:"--"}),_t=new Common.UI.MenuItem({iconCls:"menu__icon btn-inserthyperlink",caption:i.hyperlinkText}).on("click",e.bind(i.addHyperlink,i)),yt=new Common.UI.MenuItem({caption:i.editHyperlinkText}).on("click",e.bind(i.editHyperlink,i)),wt=new Common.UI.MenuItem({caption:i.removeHyperlinkText}).on("click",function(t,e){i.api.remove_Hyperlink(t.hyperProps.value),i.fireEvent("editcomplete",i)}),xt=new Common.UI.MenuItem({iconCls:"menu__icon btn-inserthyperlink",caption:i.hyperlinkText,menu:new Common.UI.Menu({cls:"shifted-right",menuAlign:"tl-tr",items:[yt,wt]})}),St=new Common.UI.MenuItemSeparator,At=new Common.UI.MenuItem({caption:i.styleText,menu:new Common.UI.Menu({cls:"shifted-right",menuAlign:"tl-tr",items:[i.menuStyleSave=new Common.UI.MenuItem({caption:i.saveStyleText}).on("click",e.bind(i.onMenuSaveStyle,i)),i.menuStyleUpdate=new Common.UI.MenuItem({caption:i.updateStyleText.replace("%1",window.currentStyleName)}).on("click",e.bind(i.onMenuUpdateStyle,i))]})});i.menuSpellPara=new Common.UI.MenuItem({caption:i.loadSpellText,disabled:!0}),i.menuSpellMorePara=new Common.UI.MenuItem({caption:i.moreText,menu:new Common.UI.Menu({cls:"shifted-right",menuAlign:"tl-tr",restoreHeight:!0,items:[]})}),i.langParaMenu=new Common.UI.MenuItem({iconCls:"menu__icon btn-ic-doclang",caption:i.langText,menu:new Common.UI.MenuSimple({cls:"lang-menu",menuAlign:"tl-tr",restoreHeight:285,items:[],itemTemplate:O,search:!0})});var kt=new Common.UI.MenuItem({caption:i.ignoreSpellText}).on("click",function(t,e){i.api.asc_ignoreMisspelledWord(i._currentSpellObj,!1),i.fireEvent("editcomplete",i)}),Tt=new Common.UI.MenuItem({caption:i.ignoreAllSpellText}).on("click",function(t,e){i.api.asc_ignoreMisspelledWord(i._currentSpellObj,!0),i.fireEvent("editcomplete",i)}),It=new Common.UI.MenuItem({caption:i.toDictionaryText}).on("click",function(t,e){i.api.asc_spellCheckAddToDictionary(i._currentSpellObj),i.fireEvent("editcomplete",i)}),Pt=new Common.UI.MenuItem({caption:"--"}),Mt=new Common.UI.MenuItem({caption:"--"}),Et=new Common.UI.MenuItem({iconCls:"menu__icon btn-copy",caption:i.textCopy,value:"copy"}).on("click",e.bind(i.onCutCopyPaste,i)),Ut=new Common.UI.MenuItem({iconCls:"menu__icon btn-paste",caption:i.textPaste,value:"paste"}).on("click",e.bind(i.onCutCopyPaste,i)),Vt=new Common.UI.MenuItem({iconCls:"menu__icon btn-cut",caption:i.textCut,value:"cut"}).on("click",e.bind(i.onCutCopyPaste,i)),Bt=new Common.UI.MenuItem({iconCls:"menu__icon btn-print",caption:i.txtPrintSelection}).on("click",e.bind(i.onPrintSelection,i)),Dt=new Common.UI.MenuItem({caption:"--"}),Ft=new Common.UI.MenuItem({iconCls:"menu__icon cc-remove",caption:i.textRemoveControl,value:"remove"}).on("click",e.bind(i.onControlsSelect,i)),Rt=new Common.UI.MenuItem({caption:i.textEditControls,value:"settings"}).on("click",e.bind(i.onControlsSelect,i)),Lt=new Common.UI.MenuItem({caption:"--"}),Nt=new Common.UI.MenuItem({caption:i.textTOCSettings,value:"settings"}).on("click",function(t,e){i.fireEvent("links:contents",[t.value,!0])}),Ht=new Common.UI.MenuItem({caption:i.textUpdateTOC,menu:new Common.UI.Menu({cls:"shifted-right",menuAlign:"tl-tr",items:[{caption:i.textUpdateAll,value:"all"},{caption:i.textUpdatePages,value:"pages"}]})});Ht.menu.on("item:click",function(t,e,n){i.fireEvent("links:update",[e.value,!0])});var Ot=new Common.UI.MenuItem({caption:"--"}),zt=new Common.UI.MenuItem({caption:i.textRefreshField}).on("click",function(t,e){i.api.asc_UpdateComplexField(t.options.fieldProps),i.fireEvent("editcomplete",i)}),$t=new Common.UI.MenuItem({caption:"--"}),Gt=new Common.UI.MenuItem({caption:i.textStartNewList}).on("click",e.bind(i.onStartNumbering,i,1)),Wt=new Common.UI.MenuItem({caption:i.textStartNumberingFrom}).on("click",e.bind(i.onStartNumbering,i,"advanced")),jt=new Common.UI.MenuItem({caption:i.textContinueNumbering}).on("click",e.bind(i.onContinueNumbering,i)),Kt=new Common.UI.MenuItem({caption:"--"}),qt=new Common.UI.MenuItem({caption:i.textFollow}).on("click",e.bind(i.onFollowMove,i)),Yt=new Common.UI.MenuItem({caption:"--"});this.textMenu=new Common.UI.Menu({cls:"shifted-right",initMenu:function(t){var n=t.imgProps&&t.imgProps.value&&!e.isNull(t.imgProps.value.get_ShapeProperties()),o=t.imgProps&&t.imgProps.value&&!e.isNull(t.imgProps.value.get_ChartProperties()),r=t.mathProps&&t.mathProps.value;if(ht.setVisible(n&&!o&&!r),mt.setVisible(n&&!o&&!r),n||o){var l=t.imgProps.value.get_VerticalTextAlign(),c="";switch(l){case Asc.c_oAscVAlign.Top:c="menu__icon btn-align-top";break;case Asc.c_oAscVAlign.Center:c="menu__icon btn-align-middle";break;case Asc.c_oAscVAlign.Bottom:c="menu__icon btn-align-bottom"}ht.setIconCls(c), -i.menuParagraphTop.setChecked(l==Asc.c_oAscVAlign.Top),i.menuParagraphCenter.setChecked(l==Asc.c_oAscVAlign.Center),i.menuParagraphBottom.setChecked(l==Asc.c_oAscVAlign.Bottom);var d=t.imgProps.value.get_Vert();switch(c="",d){case Asc.c_oAscVertDrawingText.normal:c="menu__icon text-orient-hor";break;case Asc.c_oAscVertDrawingText.vert:c="menu__icon text-orient-rdown";break;case Asc.c_oAscVertDrawingText.vert270:c="menu__icon text-orient-rup"}mt.setIconCls(c),i.menuParagraphDirectH.setChecked(d==Asc.c_oAscVertDrawingText.normal),i.menuParagraphDirect90.setChecked(d==Asc.c_oAscVertDrawingText.vert),i.menuParagraphDirect270.setChecked(d==Asc.c_oAscVertDrawingText.vert270)}ut.isChart=t.imgProps&&t.imgProps.isChart,lt.setVisible(!n&&!o&&!r),ct.setVisible(!n&&!o&&!r),t.paraProps&&(lt.setChecked(t.paraProps.value.get_PageBreakBefore()),ct.setChecked(t.paraProps.value.get_KeepLines()));var h=null;i.api&&(h=i.api.can_AddHyperlink()),_t.setVisible(void 0===t.hyperProps&&!1!==h),xt.setVisible(void 0!==t.hyperProps),vt.setVisible(_t.isVisible()||xt.isVisible()),yt.hyperProps=t.hyperProps,wt.hyperProps=t.hyperProps,!1!==h&&(_t.hyperProps={},_t.hyperProps.value=new Asc.CHyperlinkProperty,_t.hyperProps.value.put_Text(h));var p=t.paraProps.locked||void 0!==t.headerProps&&t.headerProps.locked;i._currentParaObjDisabled=p,_t.setDisabled(p),xt.setDisabled(p||void 0!==t.hyperProps&&!0===t.hyperProps.isSeveralLinks);var m=i.api.asc_GetRevisionsChangesStack(),u=!1;qt.value=null,e.each(m,function(t){t.get_Type()!=Asc.c_oAscRevisionsChangeType.TextAdd&&t.get_Type()!=Asc.c_oAscRevisionsChangeType.TextRem||t.get_MoveType()==Asc.c_oAscRevisionsMove.NoMove||(qt.value=t,u=!0)}),qt.setVisible(u),Yt.setVisible(u),lt.setDisabled(p||!e.isUndefined(t.headerProps)||!e.isUndefined(t.imgProps)),ct.setDisabled(p),ut.setDisabled(p),gt.setDisabled(p),bt.setDisabled(p),ht.setDisabled(p),mt.setDisabled(p);var g=i.api&&i.api.can_CopyCut();Et.setDisabled(!g),Vt.setDisabled(p||!g),Ut.setDisabled(p),Bt.setVisible(i.mode.canPrint),Bt.setDisabled(!g);var b=void 0!==t.spellProps&&!1===t.spellProps.value.get_Checked();i.menuSpellPara.setVisible(b),Mt.setVisible(b),kt.setVisible(b),Tt.setVisible(b),It.setVisible(b&&i.mode.isDesktopApp),i.langParaMenu.setVisible(b),i.langParaMenu.setDisabled(p),Pt.setVisible(b),b&&null!==t.spellProps.value.get_Variants()&&void 0!==t.spellProps.value.get_Variants()?i.addWordVariants(!0):(i.menuSpellPara.setCaption(i.loadSpellText,!0),i.clearWordVariants(!0),i.menuSpellMorePara.setVisible(!1)),i.langParaMenu.isVisible()&&i._currLang.id!==i._currLang.paraid&&(i.changeLanguageMenu(i.langParaMenu.menu),i._currLang.paraid=i._currLang.id);var f=0;r?f=i.addEquationMenu(!0,15):i.clearEquationMenu(!0,15),Dt.setVisible(r&&f>0),s.setVisible(r),a.setVisible(r);var C=t.paraProps.value.get_FramePr();gt.setVisible(void 0!==C),bt.setVisible(void 0!==C),C&&bt.setIconCls(C.get_DropCap()===Asc.c_oAscDropCap.Drop?"menu__icon dropcap-intext":"menu__icon dropcap-inmargin"),St.setVisible(i.mode.canEditStyles&&!o),At.setVisible(i.mode.canEditStyles&&!o),i.mode.canEditStyles&&!o&&i.menuStyleUpdate.setCaption(i.updateStyleText.replace("%1",DE.getController("Main").translationTable[window.currentStyleName]||window.currentStyleName));var v=!!t.paraProps&&!(t.paraProps.value.can_DeleteBlockContentControl()&&t.paraProps.value.can_EditBlockContentControl()&&t.paraProps.value.can_DeleteInlineContentControl()&&t.paraProps.value.can_EditInlineContentControl()),_=i.api.asc_GetTableOfContentsPr(!0),y=!_&&i.api.asc_IsContentControl(),w=y?i.api.asc_GetContentControlProperties():null,x=w&&w.get_FormPr();if(Ft.setVisible(y),Rt.setVisible(y&&i.mode.canEditContentControl&&!x),Lt.setVisible(y),y){var S=w?w.get_Lock():Asc.c_oAscSdtLockType.Unlocked;Ft.setDisabled(S==Asc.c_oAscSdtLockType.SdtContentLocked||S==Asc.c_oAscSdtLockType.SdtLocked),Ft.setCaption(x?i.getControlLabel(w):i.textRemoveControl);var A=w?w.get_SpecificType():Asc.c_oAscContentControlSpecificType.None;v=v||A==Asc.c_oAscContentControlSpecificType.CheckBox||A==Asc.c_oAscContentControlSpecificType.Picture||A==Asc.c_oAscContentControlSpecificType.ComboBox||A==Asc.c_oAscContentControlSpecificType.DropDownList||A==Asc.c_oAscContentControlSpecificType.DateTime}Nt.setVisible(_),Ht.setVisible(_),Ot.setVisible(_);var k=!o&&!1!==i.api.can_AddQuotedComment()&&i.mode.canCoAuthoring&&i.mode.canComments&&!v;i.mode.compatibleFeatures&&(k=k&&!n),ft.setVisible(k),Ct.setVisible(k),Ct.setDisabled(t.paraProps&&!0===t.paraProps.locked);var T=i.api.asc_GetCurrentComplexField();zt.setVisible(!!T),zt.setDisabled(p),$t.setVisible(!!T),T&&(zt.options.fieldProps=T);var I=i.api.asc_GetCurrentNumberingId(),P=null!==I;if(Kt.setVisible(P),Gt.setVisible(P),Wt.setVisible(P),jt.setVisible(P),P){var M=i.api.asc_GetNumberingPr(I).get_Lvl(i.api.asc_GetCurrentNumberingLvl()),E=M.get_Format(),U=i.api.asc_GetCalculatedNumberingValue();Gt.setVisible(M.get_Start()!=U),Gt.value={start:M.get_Start()},Wt.setVisible(E!=Asc.c_oAscNumberingFormat.Bullet),Wt.value={format:E,start:U},Gt.setCaption(E==Asc.c_oAscNumberingFormat.Bullet?i.textSeparateList:i.textStartNewList),jt.setCaption(E==Asc.c_oAscNumberingFormat.Bullet?i.textJoinList:i.textContinueNumbering)}},items:[i.menuSpellPara,i.menuSpellMorePara,Mt,kt,Tt,It,i.langParaMenu,Pt,Vt,Et,Ut,Bt,a,s,{caption:"--"},Dt,Ft,Rt,Lt,zt,$t,Nt,Ht,Ot,lt,ct,ht,mt,ut,gt,bt,ft,Ct,vt,_t,xt,Yt,qt,Kt,Gt,Wt,jt,St,At]}).on("hide:after",function(t,e,n){if(i.suppressEditComplete)return void(i.suppressEditComplete=!1);n||i.fireEvent("editcomplete",i),i.currentMenu=null});var Xt=new Common.UI.MenuItem({caption:i.editHeaderText});this.hdrMenu=new Common.UI.Menu({cls:"shifted-right",initMenu:function(t){Xt.setCaption(t.Header?i.editHeaderText:i.editFooterText,!0),Xt.off("click").on("click",function(e){i.api&&(t.Header?i.api.GoToHeader(t.PageNum):i.api.GoToFooter(t.PageNum),i.fireEvent("editcomplete",i))})},items:[Xt]}).on("hide:after",function(t,e,n){n||i.fireEvent("editcomplete",i),i.currentMenu=null});var Jt=t("#id_buttonNextPage");Jt.attr("data-toggle","tooltip"),Jt.tooltip({title:i.textNextPage+Common.Utils.String.platformKey("Alt+PgDn"),placement:"top-right"});var Zt=t("#id_buttonPrevPage");Zt.attr("data-toggle","tooltip"),Zt.tooltip({title:i.textPrevPage+Common.Utils.String.platformKey("Alt+PgUp"),placement:"top-right"})},setLanguages:function(t){var i=this;if(t&&t.length>0&&i.langParaMenu&&i.langTableMenu){var n=[],o=[];e.each(t,function(t){var i={caption:t.displayValue,value:t.value,checkable:!0,langid:t.code,spellcheck:t.spellcheck};n.push(i),o.push(e.clone(i))}),i.langParaMenu.menu.resetItems(n),i.langTableMenu.menu.resetItems(o),i.langParaMenu.menu.on("item:click",function(t,n){i.api&&(e.isUndefined(n.langid)||i.api.put_TextPrLang(n.langid),i._currLang.paraid=n.langid,i.fireEvent("editcomplete",i))}),i.langTableMenu.menu.on("item:click",function(t,n,o){i.api&&(e.isUndefined(n.langid)||i.api.put_TextPrLang(n.langid),i._currLang.tableid=n.langid,i.fireEvent("editcomplete",i))})}},onSignatureClick:function(t){var e=t.cmpEl.attr("data-value");switch(t.value){case 0:Common.NotificationCenter.trigger("protect:sign",e);break;case 1:this.api.asc_ViewCertificate(e);break;case 2:Common.NotificationCenter.trigger("protect:signature","visible",this._isDisabled,e);break;case 3:this.api.asc_RemoveSignature(e)}},onImgRotate:function(t){var e=new Asc.asc_CImgProperty;e.asc_putRotAdd(3.14159265358979*(1==t.value?90:270)/180),this.api.ImgApply(e),this.fireEvent("editcomplete",this)},onImgFlip:function(t){var e=new Asc.asc_CImgProperty;1==t.value?e.asc_putFlipHInvert(!0):e.asc_putFlipVInvert(!0),this.api.ImgApply(e),this.fireEvent("editcomplete",this)},onImgCrop:function(t){1==t.value?this.api.asc_cropFill():2==t.value?this.api.asc_cropFit():t.checked?this.api.asc_startEditCrop():this.api.asc_endEditCrop(),this.fireEvent("editcomplete",this)},onFollowMove:function(t){this.api&&this.api.asc_FollowRevisionMove(t.value),this.fireEvent("editcomplete",this)},onHideContentControlsActions:function(){this.listControlMenu&&this.listControlMenu.isVisible()&&this.listControlMenu.hide();var t=this.cmpEl.find("#calendar-control-container");t.is(":visible")&&t.hide()},onShowDateActions:function(e,i,n){var o=e.pr,s=o.get_DateTimePr(),a=this.cmpEl.find("#calendar-control-container"),r=this;this._dateObj=o,a.length<1&&(a=t('
'),this.cmpEl.append(a)),Common.UI.Menu.Manager.hideAll(),a.css({left:i,top:n}),a.show(),this.cmpCalendar||(this.cmpCalendar=new Common.UI.Calendar({el:this.cmpEl.find("#id-document-calendar-control"),enableKeyEvents:!0,firstday:1}),this.cmpCalendar.on("date:click",function(t,e){var i=r._dateObj.get_DateTimePr();i.put_FullDate(new Date(e)),r.api.asc_SetContentControlDatePickerDate(i),a.hide(),r.api.asc_UncheckContentControlButtons(),r.fireEvent("editcomplete",r)}),this.cmpCalendar.on("calendar:keydown",function(t,e){e.keyCode==Common.UI.Keys.ESC&&(a.hide(),r.api.asc_UncheckContentControlButtons())}),t(document).on("mousedown",function(t){"canvas"!==t.target.localName&&a.is(":visible")&&0==a.find(t.target).length&&(a.hide(),r.api.asc_UncheckContentControlButtons())})),this.cmpCalendar.setDate(new Date(s?s.get_FullDate():void 0));var l=a.offset(),c=Common.Utils.innerWidth(),d=Common.Utils.innerHeight()-10,h=this.cmpCalendar.cmpEl.outerWidth(),p=this.cmpCalendar.cmpEl.outerHeight(),m=l.left-h,u=l.top;u+p>d&&(u=d-p,m-=22),u<0&&(u=0),m+h>c&&(m=c-h),this.cmpCalendar.cmpEl.css({left:m,top:u}),this._preventClick=!0},onShowListActions:function(i,n,o){var s=i.type,a=i.pr,r=s==Asc.c_oAscContentControlSpecificType.ComboBox?a.get_ComboBoxPr():a.get_DropDownListPr(),l=!!a.get_FormPr(),c=this.listControlMenu,d=c?this.cmpEl.find(Common.Utils.String.format("#menu-container-{0}",c.id)):null,h=this;if(this._listObj=a,this._fromShowContentControls=!0,Common.UI.Menu.Manager.hideAll(),c||(this.listControlMenu=c=new Common.UI.Menu({maxHeight:207,menuAlign:"tr-bl",items:[]}),c.on("item:click",function(t,e){setTimeout(function(){-1!==e.value&&h.api.asc_SelectContentControlListItem(e.value,h._listObj.get_InternalId())},1)}),(!d||d.length<1)&&(d=t(Common.Utils.String.format('',c.id)),this.cmpEl.append(d)),c.render(d),c.cmpEl.attr({tabindex:"-1"}),c.on("hide:after",function(){h.listControlMenu.removeAll(),h._fromShowContentControls||h.api.asc_UncheckContentControlButtons()})),r){if(l){var p=a.get_PlaceholderText();c.addItem(new Common.UI.MenuItem({caption:""!==p.trim()?p:this.txtEmpty,value:"",template:e.template([' opacity: 0.6 <% } %>">',"<%= caption %>",""].join(""))}))}for(var m=r.get_ItemsCount(),u=0;u','
',"","
",'
',""].join(""),this.options.tpl=_.template(this.template)(this.options),Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this);var t=this;t.inputUrl=new Common.UI.InputField({el:$("#id-dlg-url"),allowBlank:!1,blankError:t.txtEmpty,style:"width: 100%;",validateOnBlur:!1,validation:function(e){return!!/((^https?)|(^ftp)):\/\/.+/i.test(e)||t.txtNotUrl}}),this.getChild().find(".btn").on("click",_.bind(this.onBtnClick,this))},show:function(){Common.UI.Window.prototype.show.apply(this,arguments);var t=this;_.delay(function(){t.getChild("input").focus()},100)},onPrimary:function(t){return this._handleInput("ok"),!1},onBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value)},_handleInput:function(t){if(this.options.handler){if("ok"==t&&!0!==this.inputUrl.checkValidate())return void this.inputUrl.cmpEl.find("input").focus();this.options.handler.call(this,t,this.inputUrl.getValue())}this.close()},textUrl:"Paste an image URL:",txtEmpty:"This field is required",txtNotUrl:'This field should be a URL in the format "http://www.example.com"'},Common.Views.ImageFromUrlDialog||{}))}),void 0===Common)var Common={};if(define("common/main/lib/component/LoadMask",["common/main/lib/component/BaseView"],function(){"use strict";Common.UI.LoadMask=Common.UI.BaseView.extend(function(){return{options:{cls:"",style:"",title:"Loading...",owner:document.body},template:_.template(['"].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t),this.template=this.options.template||this.template,this.title=this.options.title,this.ownerEl=this.options.owner instanceof Common.UI.BaseView?$(this.options.owner.el):$(this.options.owner),this.loaderEl=$(this.template({id:this.id,cls:this.options.cls,style:this.options.style,title:this.title})),this.maskeEl=$('
'),this.timerId=0},render:function(){return this},show:function(){var t=this.ownerEl,e=this.loaderEl,i=this.maskeEl;if(t.ismasked)return this;t.ismasked=!0;var n=this;return n.title!=n.options.title&&(n.options.title=n.title,$(".asc-loadmask-title",e).html(n.title)),n.timerId=setTimeout(function(){t.append(i),t.append(e),t&&0==t.closest(".asc-window.modal").length&&Common.util.Shortcuts.suspendEvents()},500),this},hide:function(){var t=this.ownerEl;this.timerId&&(clearTimeout(this.timerId),this.timerId=0),t&&t.ismasked&&(0!=t.closest(".asc-window.modal").length||Common.Utils.ModalWindow.isVisible()||Common.util.Shortcuts.resumeEvents(),this.maskeEl&&this.maskeEl.remove(),this.loaderEl&&this.loaderEl.remove()),delete t.ismasked},setTitle:function(t){this.title=t,this.ownerEl&&this.ownerEl.ismasked&&this.loaderEl&&$(".asc-loadmask-title",this.loaderEl).html(t)},isVisible:function(){return!!this.ownerEl.ismasked},updatePosition:function(){var t=this.ownerEl,e=this.loaderEl;t&&t.ismasked&&e&&(e.css({top:Math.round(t.height()/2-(e.height()+parseInt(e.css("padding-top"))+parseInt(e.css("padding-bottom")))/2)+"px",left:Math.round(t.width()/2-(e.width()+parseInt(e.css("padding-left"))+parseInt(e.css("padding-right")))/2)+"px"}),e.css({visibility:"visible"}))}}}())}),define("common/main/lib/view/SelectFileDlg",["common/main/lib/component/Window","common/main/lib/component/LoadMask"],function(){"use strict";Common.Views.SelectFileDlg=Common.UI.Window.extend(_.extend({initialize:function(t){var e={};_.extend(e,{title:this.textTitle,width:1024,height:621,header:!0},t),this.template=['
'].join(""),e.tpl=_.template(this.template)(e),this.fileChoiceUrl=t.fileChoiceUrl||"",Common.UI.Window.prototype.initialize.call(this,e)},render:function(){Common.UI.Window.prototype.render.call(this),this.$window.find("> .body").css({height:"auto",overflow:"hidden"});var t=document.createElement("iframe");t.width="100%",t.height=585,t.align="top",t.frameBorder=0,t.scrolling="no",t.onload=_.bind(this._onLoad,this),$("#id-select-file-placeholder").append(t),this.loadMask=new Common.UI.LoadMask({owner:$("#id-select-file-placeholder")}),this.loadMask.setTitle(this.textLoading),this.loadMask.show(),t.src=this.fileChoiceUrl;var e=this;this._eventfunc=function(t){e._onWindowMessage(t)},this._bindWindowEvents.call(this),this.on("close",function(t){e._unbindWindowEvents()})},_bindWindowEvents:function(){window.addEventListener?window.addEventListener("message",this._eventfunc,!1):window.attachEvent&&window.attachEvent("onmessage",this._eventfunc)},_unbindWindowEvents:function(){window.removeEventListener?window.removeEventListener("message",this._eventfunc):window.detachEvent&&window.detachEvent("onmessage",this._eventfunc)},_onWindowMessage:function(t){if(t&&window.JSON)try{this._onMessage.call(this,window.JSON.parse(t.data))}catch(t){}},_onMessage:function(t){if(t&&"onlyoffice"==t.Referer&&void 0!==t.file){Common.NotificationCenter.trigger("window:close",this);var e=this;setTimeout(function(){_.isEmpty(t.file)||e.trigger("selectfile",e,t.file)},50)}},_onLoad:function(){this.loadMask&&this.loadMask.hide()},textTitle:"Select Data Source",textLoading:"Loading"},Common.Views.SelectFileDlg||{}))}),void 0===Common)var Common={};if(void 0===Common.define&&(Common.define={}),define("common/main/lib/util/define",[],function(){"use strict";Common.define.c_oAscMathMainType={Symbol:0,Fraction:1,Script:2,Radical:3,Integral:4,LargeOperator:5,Bracket:6,Function:7,Accent:8,LimitLog:9,Operator:10,Matrix:11},Common.define.c_oAscMathType={Symbol_pm:0,Symbol_infinity:1,Symbol_equals:2,Symbol_neq:3,Symbol_about:4,Symbol_times:5,Symbol_div:6,Symbol_factorial:7,Symbol_propto:8,Symbol_less:9,Symbol_ll:10,Symbol_greater:11,Symbol_gg:12,Symbol_leq:13,Symbol_geq:14,Symbol_mp:15,Symbol_cong:16,Symbol_approx:17,Symbol_equiv:18,Symbol_forall:19,Symbol_additional:20,Symbol_partial:21,Symbol_sqrt:22,Symbol_cbrt:23,Symbol_qdrt:24,Symbol_cup:25,Symbol_cap:26,Symbol_emptyset:27,Symbol_percent:28,Symbol_degree:29,Symbol_fahrenheit:30,Symbol_celsius:31,Symbol_inc:32,Symbol_nabla:33,Symbol_exists:34,Symbol_notexists:35,Symbol_in:36,Symbol_ni:37,Symbol_leftarrow:38,Symbol_uparrow:39,Symbol_rightarrow:40,Symbol_downarrow:41,Symbol_leftrightarrow:42,Symbol_therefore:43,Symbol_plus:44,Symbol_minus:45,Symbol_not:46,Symbol_ast:47,Symbol_bullet:48,Symbol_vdots:49,Symbol_cdots:50,Symbol_rddots:51,Symbol_ddots:52,Symbol_aleph:53,Symbol_beth:54,Symbol_QED:55,Symbol_alpha:65536,Symbol_beta:65537,Symbol_gamma:65538,Symbol_delta:65539,Symbol_varepsilon:65540,Symbol_epsilon:65541,Symbol_zeta:65542,Symbol_eta:65543,Symbol_theta:65544,Symbol_vartheta:65545,Symbol_iota:65546,Symbol_kappa:65547,Symbol_lambda:65548,Symbol_mu:65549,Symbol_nu:65550,Symbol_xsi:65551,Symbol_o:65552,Symbol_pi:65553,Symbol_varpi:65554,Symbol_rho:65555,Symbol_varrho:65556,Symbol_sigma:65557,Symbol_varsigma:65558,Symbol_tau:65559,Symbol_upsilon:65560,Symbol_varphi:65561,Symbol_phi:65562,Symbol_chi:65563,Symbol_psi:65564,Symbol_omega:65565,Symbol_Alpha:131072,Symbol_Beta:131073,Symbol_Gamma:131074,Symbol_Delta:131075,Symbol_Epsilon:131076,Symbol_Zeta:131077,Symbol_Eta:131078,Symbol_Theta:131079,Symbol_Iota:131080,Symbol_Kappa:131081,Symbol_Lambda:131082,Symbol_Mu:131083,Symbol_Nu:131084,Symbol_Xsi:131085,Symbol_O:131086,Symbol_Pi:131087,Symbol_Rho:131088,Symbol_Sigma:131089,Symbol_Tau:131090,Symbol_Upsilon:131091,Symbol_Phi:131092,Symbol_Chi:131093,Symbol_Psi:131094,Symbol_Omega:131095,FractionVertical:16777216,FractionDiagonal:16777217,FractionHorizontal:16777218,FractionSmall:16777219,FractionDifferential_1:16842752,FractionDifferential_2:16842753,FractionDifferential_3:16842754,FractionDifferential_4:16842755,FractionPi_2:16842756,ScriptSup:33554432,ScriptSub:33554433,ScriptSubSup:33554434,ScriptSubSupLeft:33554435,ScriptCustom_1:33619968,ScriptCustom_2:33619969,ScriptCustom_3:33619970,ScriptCustom_4:33619971,RadicalSqrt:50331648,RadicalRoot_n:50331649,RadicalRoot_2:50331650,RadicalRoot_3:50331651,RadicalCustom_1:50397184,RadicalCustom_2:50397185,Integral:67108864,IntegralSubSup:67108865,IntegralCenterSubSup:67108866,IntegralDouble:67108867,IntegralDoubleSubSup:67108868,IntegralDoubleCenterSubSup:67108869,IntegralTriple:67108870,IntegralTripleSubSup:67108871,IntegralTripleCenterSubSup:67108872,IntegralOriented:67174400,IntegralOrientedSubSup:67174401,IntegralOrientedCenterSubSup:67174402,IntegralOrientedDouble:67174403,IntegralOrientedDoubleSubSup:67174404,IntegralOrientedDoubleCenterSubSup:67174405,IntegralOrientedTriple:67174406,IntegralOrientedTripleSubSup:67174407,IntegralOrientedTripleCenterSubSup:67174408,Integral_dx:67239936,Integral_dy:67239937,Integral_dtheta:67239938,LargeOperator_Sum:83886080,LargeOperator_Sum_CenterSubSup:83886081,LargeOperator_Sum_SubSup:83886082,LargeOperator_Sum_CenterSub:83886083,LargeOperator_Sum_Sub:83886084,LargeOperator_Prod:83951616,LargeOperator_Prod_CenterSubSup:83951617,LargeOperator_Prod_SubSup:83951618,LargeOperator_Prod_CenterSub:83951619,LargeOperator_Prod_Sub:83951620,LargeOperator_CoProd:83951621, -LargeOperator_CoProd_CenterSubSup:83951622,LargeOperator_CoProd_SubSup:83951623,LargeOperator_CoProd_CenterSub:83951624,LargeOperator_CoProd_Sub:83951625,LargeOperator_Union:84017152,LargeOperator_Union_CenterSubSup:84017153,LargeOperator_Union_SubSup:84017154,LargeOperator_Union_CenterSub:84017155,LargeOperator_Union_Sub:84017156,LargeOperator_Intersection:84017157,LargeOperator_Intersection_CenterSubSup:84017158,LargeOperator_Intersection_SubSup:84017159,LargeOperator_Intersection_CenterSub:84017160,LargeOperator_Intersection_Sub:84017161,LargeOperator_Disjunction:84082688,LargeOperator_Disjunction_CenterSubSup:84082689,LargeOperator_Disjunction_SubSup:84082690,LargeOperator_Disjunction_CenterSub:84082691,LargeOperator_Disjunction_Sub:84082692,LargeOperator_Conjunction:84082693,LargeOperator_Conjunction_CenterSubSup:84082694,LargeOperator_Conjunction_SubSup:84082695,LargeOperator_Conjunction_CenterSub:84082696,LargeOperator_Conjunction_Sub:84082697,LargeOperator_Custom_1:84148224,LargeOperator_Custom_2:84148225,LargeOperator_Custom_3:84148226,LargeOperator_Custom_4:84148227,LargeOperator_Custom_5:84148228,Bracket_Round:100663296,Bracket_Square:100663297,Bracket_Curve:100663298,Bracket_Angle:100663299,Bracket_LowLim:100663300,Bracket_UppLim:100663301,Bracket_Line:100663302,Bracket_LineDouble:100663303,Bracket_Square_OpenOpen:100663304,Bracket_Square_CloseClose:100663305,Bracket_Square_CloseOpen:100663306,Bracket_SquareDouble:100663307,Bracket_Round_Delimiter_2:100728832,Bracket_Curve_Delimiter_2:100728833,Bracket_Angle_Delimiter_2:100728834,Bracket_Angle_Delimiter_3:100728835,Bracket_Round_OpenNone:100794368,Bracket_Round_NoneOpen:100794369,Bracket_Square_OpenNone:100794370,Bracket_Square_NoneOpen:100794371,Bracket_Curve_OpenNone:100794372,Bracket_Curve_NoneOpen:100794373,Bracket_Angle_OpenNone:100794374,Bracket_Angle_NoneOpen:100794375,Bracket_LowLim_OpenNone:100794376,Bracket_LowLim_NoneNone:100794377,Bracket_UppLim_OpenNone:100794378,Bracket_UppLim_NoneOpen:100794379,Bracket_Line_OpenNone:100794380,Bracket_Line_NoneOpen:100794381,Bracket_LineDouble_OpenNone:100794382,Bracket_LineDouble_NoneOpen:100794383,Bracket_SquareDouble_OpenNone:100794384,Bracket_SquareDouble_NoneOpen:100794385,Bracket_Custom_1:100859904,Bracket_Custom_2:100859905,Bracket_Custom_3:100859906,Bracket_Custom_4:100859907,Bracket_Custom_5:100925440,Bracket_Custom_6:100925441,Bracket_Custom_7:100925442,Function_Sin:117440512,Function_Cos:117440513,Function_Tan:117440514,Function_Csc:117440515,Function_Sec:117440516,Function_Cot:117440517,Function_1_Sin:117506048,Function_1_Cos:117506049,Function_1_Tan:117506050,Function_1_Csc:117506051,Function_1_Sec:117506052,Function_1_Cot:117506053,Function_Sinh:117571584,Function_Cosh:117571585,Function_Tanh:117571586,Function_Csch:117571587,Function_Sech:117571588,Function_Coth:117571589,Function_1_Sinh:117637120,Function_1_Cosh:117637121,Function_1_Tanh:117637122,Function_1_Csch:117637123,Function_1_Sech:117637124,Function_1_Coth:117637125,Function_Custom_1:117702656,Function_Custom_2:117702657,Function_Custom_3:117702658,Accent_Dot:134217728,Accent_DDot:134217729,Accent_DDDot:134217730,Accent_Hat:134217731,Accent_Check:134217732,Accent_Accent:134217733,Accent_Grave:134217734,Accent_Smile:134217735,Accent_Tilde:134217736,Accent_Bar:134217737,Accent_DoubleBar:134217738,Accent_CurveBracketTop:134217739,Accent_CurveBracketBot:134217740,Accent_GroupTop:134217741,Accent_GroupBot:134217742,Accent_ArrowL:134217743,Accent_ArrowR:134217744,Accent_ArrowD:134217745,Accent_HarpoonL:134217746,Accent_HarpoonR:134217747,Accent_BorderBox:134283264,Accent_BorderBoxCustom:134283265,Accent_BarTop:134348800,Accent_BarBot:134348801,Accent_Custom_1:134414336,Accent_Custom_2:134414337,Accent_Custom_3:134414338,LimitLog_LogBase:150994944,LimitLog_Log:150994945,LimitLog_Lim:150994946,LimitLog_Min:150994947,LimitLog_Max:150994948,LimitLog_Ln:150994949,LimitLog_Custom_1:151060480,LimitLog_Custom_2:151060481,Operator_ColonEquals:167772160,Operator_EqualsEquals:167772161,Operator_PlusEquals:167772162,Operator_MinusEquals:167772163,Operator_Definition:167772164,Operator_UnitOfMeasure:167772165,Operator_DeltaEquals:167772166,Operator_ArrowL_Top:167837696,Operator_ArrowR_Top:167837697,Operator_ArrowL_Bot:167837698,Operator_ArrowR_Bot:167837699,Operator_DoubleArrowL_Top:167837700,Operator_DoubleArrowR_Top:167837701,Operator_DoubleArrowL_Bot:167837702,Operator_DoubleArrowR_Bot:167837703,Operator_ArrowD_Top:167837704,Operator_ArrowD_Bot:167837705,Operator_DoubleArrowD_Top:167837706,Operator_DoubleArrowD_Bot:167837707,Operator_Custom_1:167903232,Operator_Custom_2:167903233,Matrix_1_2:184549376,Matrix_2_1:184549377,Matrix_1_3:184549378,Matrix_3_1:184549379,Matrix_2_2:184549380,Matrix_2_3:184549381,Matrix_3_2:184549382,Matrix_3_3:184549383,Matrix_Dots_Center:184614912,Matrix_Dots_Baseline:184614913,Matrix_Dots_Vertical:184614914,Matrix_Dots_Diagonal:184614915,Matrix_Identity_2:184680448,Matrix_Identity_2_NoZeros:184680449,Matrix_Identity_3:184680450,Matrix_Identity_3_NoZeros:184680451,Matrix_2_2_RoundBracket:184745984,Matrix_2_2_SquareBracket:184745985,Matrix_2_2_LineBracket:184745986,Matrix_2_2_DLineBracket:184745987,Matrix_Flat_Round:184811520,Matrix_Flat_Square:184811521},Common.define.chartData=_.extend(new function(){return{textLine:"Line",textColumn:"Column",textBar:"Bar",textArea:"Area",textPie:"Pie",textPoint:"XY (Scatter)",textStock:"Stock",textSurface:"Surface",textCharts:"Charts",textSparks:"Sparklines",textLineSpark:"Line",textColumnSpark:"Column",textWinLossSpark:"Win/Loss",getChartGroupData:function(t){return[{id:"menu-chart-group-bar",caption:this.textColumn,headername:t?this.textCharts:void 0},{id:"menu-chart-group-line",caption:this.textLine},{id:"menu-chart-group-pie",caption:this.textPie},{id:"menu-chart-group-hbar",caption:this.textBar},{id:"menu-chart-group-area",caption:this.textArea,inline:!0},{id:"menu-chart-group-scatter",caption:this.textPoint,inline:!0},{id:"menu-chart-group-stock",caption:this.textStock,inline:!0}]},getChartData:function(){return[{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barNormal,iconCls:"column-normal"},{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barStacked,iconCls:"column-stack"},{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barStackedPer,iconCls:"column-pstack"},{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barNormal3d,iconCls:"column-3d-normal"},{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barStacked3d,iconCls:"column-3d-stack"},{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barStackedPer3d,iconCls:"column-3d-pstack"},{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barNormal3dPerspective,iconCls:"column-3d-normal-per"},{group:"menu-chart-group-line",type:Asc.c_oAscChartTypeSettings.lineNormal,iconCls:"line-normal"},{group:"menu-chart-group-line",type:Asc.c_oAscChartTypeSettings.lineStacked,iconCls:"line-stack"},{group:"menu-chart-group-line",type:Asc.c_oAscChartTypeSettings.lineStackedPer,iconCls:"line-pstack"},{group:"menu-chart-group-line",type:Asc.c_oAscChartTypeSettings.line3d,iconCls:"line-3d"},{group:"menu-chart-group-pie",type:Asc.c_oAscChartTypeSettings.pie,iconCls:"pie-normal"},{group:"menu-chart-group-pie",type:Asc.c_oAscChartTypeSettings.doughnut,iconCls:"pie-doughnut"},{group:"menu-chart-group-pie",type:Asc.c_oAscChartTypeSettings.pie3d,iconCls:"pie-3d-normal"},{group:"menu-chart-group-hbar",type:Asc.c_oAscChartTypeSettings.hBarNormal,iconCls:"bar-normal"},{group:"menu-chart-group-hbar",type:Asc.c_oAscChartTypeSettings.hBarStacked,iconCls:"bar-stack"},{group:"menu-chart-group-hbar",type:Asc.c_oAscChartTypeSettings.hBarStackedPer,iconCls:"bar-pstack"},{group:"menu-chart-group-hbar",type:Asc.c_oAscChartTypeSettings.hBarNormal3d,iconCls:"bar-3d-normal"},{group:"menu-chart-group-hbar",type:Asc.c_oAscChartTypeSettings.hBarStacked3d,iconCls:"bar-3d-stack"},{group:"menu-chart-group-hbar",type:Asc.c_oAscChartTypeSettings.hBarStackedPer3d,iconCls:"bar-3d-pstack"},{group:"menu-chart-group-area",type:Asc.c_oAscChartTypeSettings.areaNormal,iconCls:"area-normal"},{group:"menu-chart-group-area",type:Asc.c_oAscChartTypeSettings.areaStacked,iconCls:"area-stack"},{group:"menu-chart-group-area",type:Asc.c_oAscChartTypeSettings.areaStackedPer,iconCls:"area-pstack"},{group:"menu-chart-group-scatter",type:Asc.c_oAscChartTypeSettings.scatter,iconCls:"point-normal"},{group:"menu-chart-group-stock",type:Asc.c_oAscChartTypeSettings.stock,iconCls:"stock-normal"}]},getSparkGroupData:function(t){return[{id:"menu-chart-group-sparkcolumn",inline:!0,headername:t?this.textSparks:void 0},{id:"menu-chart-group-sparkline",inline:!0},{id:"menu-chart-group-sparkwin",inline:!0}]},getSparkData:function(){return[{group:"menu-chart-group-sparkcolumn",type:Asc.c_oAscSparklineType.Column,allowSelected:!0,iconCls:"spark-column",tip:this.textColumnSpark},{group:"menu-chart-group-sparkline",type:Asc.c_oAscSparklineType.Line,allowSelected:!0,iconCls:"spark-line",tip:this.textLineSpark},{group:"menu-chart-group-sparkwin",type:Asc.c_oAscSparklineType.Stacked,allowSelected:!0,iconCls:"spark-win",tip:this.textWinLossSpark}]}}},Common.define.chartData||{})}),define("text!documenteditor/main/app/template/Toolbar.template",[],function(){return'
\n
\n
\n <%= tabsmarkup %>\n
\n
\n
\n
\n
\n
\n \n
\n
\n \n
\n
\n
\n
\n
\n \n \n
\n
\n \n \n
\n
\n
\n
\n
\n
\n
\n
\n \n \n \n \n
\n
\n \n \n \n \n \n \n \n \n \n
\n
\n
\n
\n
\n \n \n \n \n \n \n
\n
\n \n \n \n \n \n
\n
\n
\n
\n
\n \n \n
\n
\n \n \n
\n
\n
\n
\n
\n
\n \n \n
\n
\n
\n \n
\n
\n
\n \n \n \n
\n
\n
\n \n \n
\n
\n
\n \n \n
\n
\n
\n \n \n
\n
\n
\n \n \n
\n
\n
\n \n
\n
\n
\n \n
\n
\n
\n
\n \n \n \n \n \n \n
\n
\n
\n \n \n \n \n \n
\n
\n
\n \n
\n
\n
\n
\n \n \n
\n
\n
\n \n
\n
\n
\n \n \n
\n
\n
\n \n \n
\n
\n
\n \n
\n
\n \n
\n
\n
\n
\n
\n \n \n \n \n \n \n
\n
\n
\n
\n \n
\n
\n \n
\n
\n
\n
\n \n
\n
\n
\n
\n
'}),define("text!documenteditor/main/app/template/ToolbarView.template",[],function(){return'
\n
\n
\n <%= tabsmarkup %>\n
\n
\n
\n
\n
\n
\n
\n
'}),void 0===Common)var Common={};if(Common.Models=Common.Models||{},define("common/main/lib/model/Font",["backbone"],function(t){"use strict";Common.Models.Font=t.Model.extend({defaults:function(){return{id:Common.UI.getId(),name:null,cloneid:null,imgidx:0,type:0}}})}),void 0===Common)var Common={};if(Common.Collections=Common.Collections||{},define("common/main/lib/collection/Fonts",["backbone","common/main/lib/model/Font"],function(t){"use strict";Common.Collections.Fonts=t.Collection.extend({model:Common.Models.Font,comparator:function(t,e){var i=t.get("name").toLowerCase(),n=e.get("name").toLowerCase();return i==n?0:i',"<% _.each(colors, function(color, index) { %>",'',"<% }) %>",""].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t);var e=this;this.id=e.options.id,this.cls=e.options.cls,this.style=e.options.style,this.colors=e.options.colors||[],this.value=e.options.value,e.options.el&&e.render()},render:function(t){var e=this;return e.rendered?this.cmpEl=e.$el||$(this.el):(this.cmpEl=$(this.template({id:this.id,cls:this.cls,style:this.style,colors:this.colors})),t?(this.setElement(t,!1),t.html(this.cmpEl)):e.$el.html(this.cmpEl)),e.rendered||e.cmpEl.on("click","span.color-item",e.itemClick.bind(e)),e.rendered=!0,this},itemClick:function(t){var e=$(t.target);this.select(e.attr("data-color"))},select:function(t,e){if(this.value!=t){var i=this;$("span.color-item",this.cmpEl).removeClass("selected"),this.value=t,t&&/#?[a-fA-F0-9]{6}/.test(t)&&(t=/#?([a-fA-F0-9]{6})/.exec(t)[1].toUpperCase(),$("span[data-color="+t+"]",this.cmpEl).addClass("selected"),e||i.trigger("select",i,this.value))}}})}),void 0===Common)var Common={};if(define("common/main/lib/component/DimensionPicker",["common/main/lib/component/BaseView"],function(){"use strict";Common.UI.DimensionPicker=Common.UI.BaseView.extend(function(){return{options:{itemSize:18,minRows:5,minColumns:5,maxRows:20,maxColumns:20},template:_.template(['
','
0x0
','
','
','
','
',"
","
"].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t);var e=this;this.render(),this.cmpEl=e.$el||$(this.el);var i=this.cmpEl;e.itemSize=e.options.itemSize,e.minRows=e.options.minRows,e.minColumns=e.options.minColumns,e.maxRows=e.options.maxRows,e.maxColumns=e.options.maxColumns,e.curColumns=0,e.curRows=0;var n=function(t){e.setTableSize(Math.ceil((void 0===t.offsetX?t.originalEvent.layerX:t.offsetX*Common.Utils.zoom())/e.itemSize),Math.ceil((void 0===t.offsetY?t.originalEvent.layerY:t.offsetY*Common.Utils.zoom())/e.itemSize),t)},o=function(t){e.setTableSize(0,0,t)},s=function(t){e.trigger("select",e,e.curColumns,e.curRows,t)};if(i){var a=i.find(".dimension-picker-mousecatcher");e.areaUnHighLighted=i.find(".dimension-picker-unhighlighted"),e.areaHighLighted=i.find(".dimension-picker-highlighted"),e.areaStatus=i.find(".dimension-picker-status"),i.css({width:e.minColumns+"em"}),a.css("z-index",1),a.width(e.maxColumns+"em").height(e.maxRows+"em"),e.areaUnHighLighted.width(e.minColumns+"em").height(e.minRows+"em"),e.areaStatus.html(e.curColumns+" x "+e.curRows),e.areaStatus.width(e.areaUnHighLighted.width()),a.on("mousemove",n),e.areaHighLighted.on("mousemove",n),e.areaUnHighLighted.on("mousemove",n),a.on("mouseleave",o),e.areaHighLighted.on("mouseleave",o),e.areaUnHighLighted.on("mouseleave",o),a.on("click",s),e.areaHighLighted.on("click",s),e.areaUnHighLighted.on("click",s)}},render:function(){return(this.$el||$(this.el)).html(this.template()),this},setTableSize:function(t,e,i){t>this.maxColumns&&(t=this.maxColumns),e>this.maxRows&&(e=this.maxRows),this.curColumns==t&&this.curRows==e||(this.curColumns=t,this.curRows=e,this.areaHighLighted.width(this.curColumns+"em").height(this.curRows+"em"),this.areaUnHighLighted.width((this.curColumnsthis.maxColumns?this.maxColumns:this.curColumns+1)+"em").height((this.curRowsthis.maxRows?this.maxRows:this.curRows+1)+"em"),this.cmpEl.width(this.areaUnHighLighted.width()),this.areaStatus.html(this.curColumns+" x "+this.curRows),this.areaStatus.width(this.areaUnHighLighted.width()),this.trigger("change",this,this.curColumns,this.curRows,i))},getColumnsCount:function(){return this.curColumns},getRowsCount:function(){return this.curRows}}}())}),void 0===Common)var Common={};if(define("common/main/lib/component/ComboDataView",["common/main/lib/component/BaseView","common/main/lib/component/DataView"],function(){"use strict";Common.UI.ComboDataView=Common.UI.BaseView.extend({options:{id:null,cls:"",style:"",hint:!1,itemWidth:80,itemHeight:40,menuMaxHeight:300,enableKeyEvents:!1,beforeOpenHandler:null,additionalMenuItems:null,showLast:!0,minWidth:-1},template:_.template(['
','
','
',"
"].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t),this.id=this.options.id||Common.UI.getId(),this.cls=this.options.cls,this.style=this.options.style,this.hint=this.options.hint,this.store=this.options.store||new Common.UI.DataViewStore,this.itemWidth=this.options.itemWidth,this.itemHeight=this.options.itemHeight,this.menuMaxHeight=this.options.menuMaxHeight,this.beforeOpenHandler=this.options.beforeOpenHandler,this.showLast=this.options.showLast,this.rootWidth=0,this.rootHeight=0,this.rendered=!1,this.needFillComboView=!1,this.minWidth=this.options.minWidth,this.fieldPicker=new Common.UI.DataView({cls:"field-picker",allowScrollbar:!1,itemTemplate:_.template(['
','','<% if (typeof title !== "undefined") {%>','<%= title %>',"<% } %>","
"].join(""))}),this.openButton=new Common.UI.Button({cls:"open-menu",menu:new Common.UI.Menu({menuAlign:"tl-tl",offset:[0,3],items:[{template:_.template('')}]})}),null!=this.options.additionalMenuItems&&(this.openButton.menu.items=this.openButton.menu.items.concat(this.options.additionalMenuItems)),this.menuPicker=new Common.UI.DataView({cls:"menu-picker",parentMenu:this.openButton.menu,restoreHeight:this.menuMaxHeight,style:"max-height: "+this.menuMaxHeight+"px;",enableKeyEvents:this.options.enableKeyEvents,store:this.store,itemTemplate:_.template(['
','','<% if (typeof title !== "undefined") {%>','<%= title %>',"<% } %>","
"].join(""))}),setInterval(_.bind(this.checkSize,this),500),this.options.el&&this.render()},render:function(t){if(!this.rendered){var e=this;e.trigger("render:before",e),e.cmpEl=e.$el||$(e.el);var i=e.template({id:e.id,cls:e.cls,style:e.style});t?(e.setElement(t,!1),e.cmpEl=$(i),t.html(e.cmpEl)):e.cmpEl.html(i),e.rootWidth=e.cmpEl.width(),e.rootHeight=e.cmpEl.height(),e.fieldPicker.render($(".view",e.cmpEl)),e.openButton.render($(".button",e.cmpEl)),e.menuPicker.render($(".menu-picker-container",e.cmpEl)),e.openButton.menu.cmpEl&&e.openButton.menu.cmpEl&&(e.openButton.menu.menuAlignEl=e.cmpEl,e.openButton.menu.cmpEl.css("min-width",e.itemWidth),e.openButton.menu.on("show:before",_.bind(e.onBeforeShowMenu,e)),e.openButton.menu.on("show:after",_.bind(e.onAfterShowMenu,e)),e.openButton.cmpEl.on("hide.bs.dropdown",_.bind(e.onBeforeHideMenu,e)),e.openButton.cmpEl.on("hidden.bs.dropdown",_.bind(e.onAfterHideMenu,e))),e.options.hint&&(e.cmpEl.attr("data-toggle","tooltip"),e.cmpEl.tooltip({title:e.options.hint,placement:e.options.hintAnchor||"cursor"})),e.fieldPicker.on("item:select",_.bind(e.onFieldPickerSelect,e)),e.menuPicker.on("item:select",_.bind(e.onMenuPickerSelect,e)),e.fieldPicker.on("item:click",_.bind(e.onFieldPickerClick,e)),e.menuPicker.on("item:click",_.bind(e.onMenuPickerClick,e)),e.fieldPicker.on("item:contextmenu",_.bind(e.onPickerItemContextMenu,e)),e.menuPicker.on("item:contextmenu",_.bind(e.onPickerItemContextMenu,e)),e.fieldPicker.el.addEventListener("contextmenu",_.bind(e.onPickerComboContextMenu,e),!1),e.menuPicker.el.addEventListener("contextmenu",_.bind(e.onPickerComboContextMenu,e),!1),e.onResize(),e.rendered=!0,e.trigger("render:after",e)}return this},checkSize:function(){if(this.cmpEl&&this.cmpEl.is(":visible")){var t=this,e=this.cmpEl.width(),i=this.cmpEl.height();if(e div:not(.grouped-data):not(.ps-scrollbar-x-rail):not(.ps-scrollbar-y-rail)")[0]);a.length>0&&(n.itemMarginLeft=parseInt(a.css("margin-left")),n.itemMarginRight=parseInt(a.css("margin-right")),n.itemPaddingLeft=parseInt(a.css("padding-left")),n.itemPaddingRight=parseInt(a.css("padding-right")),n.itemBorderLeft=parseInt(a.css("border-left-width")),n.itemBorderRight=parseInt(a.css("border-right-width")))}var r=o.indexOf(t);if(r<0)return;var l=o.length,c=Math.floor(Math.max(s.width(),n.minWidth)/(n.itemWidth+(n.itemMarginLeft||0)+(n.itemMarginRight||0)+(n.itemPaddingLeft||0)+(n.itemPaddingRight||0)+(n.itemBorderLeft||0)+(n.itemBorderRight||0))),d=[];s.height()/n.itemHeight>2&&(c*=Math.floor(s.height()/n.itemHeight)),r=Math.floor(r/c)*c,l-r1?t/2:t)},setItemHeight:function(t){this.itemHeight!=t&&(this.itemHeight=window.devicePixelRatio>1?t/2:t)},removeTips:function(){var t=this.menuPicker;_.each(t.dataViewItems,function(t){var e=t.$el.data("bs.tooltip");e&&e.tip().remove()},t)}})}),void 0===Common)var Common={};if(define("common/main/lib/component/SynchronizeTip",["common/main/lib/component/BaseView"],function(){"use strict";Common.UI.SynchronizeTip=Common.UI.BaseView.extend(_.extend(function(){return{options:{target:$(document.body),text:"",placement:"right",showLink:!0},template:_.template(['
<%= scope.placement %>">','
','
',"
",'
<%= scope.text %>
','
',"
","<% if ( scope.showLink ) { %>",'',"<% } %>","
","
"].join("")),initialize:function(t){this.textSynchronize+=Common.Utils.String.platformKey("Ctrl+S"),Common.UI.BaseView.prototype.initialize.call(this,t),this.target=this.options.target,this.text=_.isEmpty(this.options.text)?this.textSynchronize:this.options.text,this.textLink=_.isEmpty(this.options.textLink)?this.textDontShow:this.options.textLink,this.placement=this.options.placement,this.showLink=this.options.showLink},render:function(){return this.cmpEl||(this.cmpEl=$(this.template({scope:this})),$(document.body).append(this.cmpEl),this.cmpEl.find(".close").on("click",_.bind(function(){this.trigger("closeclick")},this)),this.cmpEl.find(".show-link label").on("click",_.bind(function(){this.trigger("dontshowclick")},this))),this.applyPlacement(),this},show:function(){this.cmpEl?(this.applyPlacement(),this.cmpEl.show()):this.render()},hide:function(){this.cmpEl&&this.cmpEl.hide()},close:function(){this.cmpEl&&this.cmpEl.remove()},applyPlacement:function(){var t=this.target.offset(),e=Common.Utils.innerHeight();if("document"==this.placement);else if("top"==this.placement)this.cmpEl.css({bottom:e-t.top+"px",right:Common.Utils.innerWidth()-t.left-this.target.width()/2+"px"});else if("target"==this.placement)this.cmpEl.css({top:t.top+5+"px",left:t.left+5+"px"});else{var i=t.top+this.target.height()/2,n=this.cmpEl.height();i+n>e&&(i=e-n),"left"==this.placement?this.cmpEl.css({top:i+"px",right:Common.Utils.innerWidth()-t.left-5+"px"}):this.cmpEl.css({top:i+"px",left:t.left+this.target.width()+"px"})}},isVisible:function(){return this.cmpEl&&this.cmpEl.is(":visible")},textDontShow:"Don't show this message again",textSynchronize:"The document has been changed by another user.
Please click to save your changes and reload the updates."}}(),Common.UI.SynchronizeTip||{}))}),define("common/main/lib/component/Mixtbar",["backbone","common/main/lib/component/BaseView"],function(t){"use strict";Common.UI.Mixtbar=Common.UI.BaseView.extend(function(){function t(t){var e=$(t.currentTarget).find("> a[data-tab]").data("tab");this.dblclick_el==e&&(this.fireEvent("change:compact",[e]),this.dblclick_el=void 0)}function e(t){this.isFolded&&($(t.target).parents(".toolbar, #file-menu-panel").length||o.$bar&&o.$bar.hasClass("expanded")&&this.collapse())}var i,n,o={timeout:2e3},s={},a=function(t,e){var n=i.scrollLeft();(n||"right"==t)&&i.animate({scrollLeft:"left"==t?n-100:n+100},200)};return{$tabs:void 0,$panels:void 0,isFolded:!1,initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t);this.$layout=$(t.template({tabsmarkup:_.template('
    <% for(var i in items) { %><% if (typeof items[i] == "object") { %>
  • <% if (items[i].extcls) print(\' \' + items[i].extcls) %>"><%= items[i].caption %>
  • <% } %><% } %>
')({items:t.tabs})})),s.tabs=t.tabs,$(document.body).on("click",e.bind(this)),Common.NotificationCenter.on("tab:visible",_.bind(function(t,e){this.setVisible(t,e)},this))},afterRender:function(){var e=this;i=e.$(".tabs > ul"),e.$tabs=i.find("> li"),e.$panels=e.$(".box-panels > .panel"),o.$bar=e.$(".toolbar");var s=e.$(".tabs .scroll.right");n=e.$(".tabs .scroll.left"),n.on("click",a.bind(this,"left")),s.on("click",a.bind(this,"right")),i.on("dblclick","> .ribtab",t.bind(this)),i.on("click","> .ribtab",e.onTabClick.bind(this))},isTabActive:function(t){var e=this.$tabs.filter(".active").find("> a");return e.length&&e.data("tab")==t},setFolded:function(t){this.isFolded=t;var e=this;if(this.isFolded)o.$box||(o.$box=e.$el.find(".box-controls")),o.$bar.addClass("folded z-clear").toggleClass("expanded",!1),o.$bar.find(".tabs .ribtab").removeClass("active"),o.$bar.on($.support.transition.end,function(t){o.$bar.hasClass("folded")&&!o.$bar.hasClass("expanded")&&o.$bar.toggleClass("z-clear",!0)}),o.$box.on({mouseleave:function(t){},mouseenter:function(t){}});else{o.$bar.removeClass("folded z-clear"),o.$box.off();var i=o.$box.find(".panel.active");if(i.length){var n=i.data("tab");e.$tabs.find("> a[data-tab="+n+"]").parent().toggleClass("active",!0)}else n=e.$tabs.siblings(":not(.x-lone):visible").first().find("> a[data-tab]").data("tab"),e.setTab(n)}},collapse:function(){Common.UI.Menu.Manager.hideAll(),this.isFolded&&o.$bar&&(o.$bar.removeClass("expanded"),o.$bar.find(".tabs .ribtab").removeClass("active"))},expand:function(){o.$bar.removeClass("z-clear"),o.$bar.addClass("expanded")},onResize:function(t){this.hasTabInvisible()?i.parent().hasClass("short")||i.parent().addClass("short"):i.parent().hasClass("short")&&i.parent().removeClass("short"),this.processPanelVisible()},onTabClick:function(t){var e=this,i=$(t.currentTarget),n=i.find("> a[data-tab]").data("tab");i.hasClass("x-lone")?e.isFolded&&e.collapse():i.hasClass("active")?e._timerSetTab||(e.dblclick_el=n,e.isFolded&&(e.collapse(),setTimeout(function(){e.dblclick_el=void 0},500))):(e._timerSetTab=!0,setTimeout(function(){e._timerSetTab=!1},500),e.setTab(n),e.processPanelVisible(null,!0),e.isFolded?e.dblclick_el=n:(e.dblclick_timer&&clearTimeout(e.dblclick_timer),e.dblclick_timer=setTimeout(function(){e.dblclick_el=n,delete e.dblclick_timer},500)))},setTab:function(t){var e=this;if(t||(this.isFolded?this.collapse():t=this.lastPanel),t){e.$tabs.removeClass("active"),e.$panels.removeClass("active");var i=this.$panels.filter("[data-tab="+t+"]");i.length&&(this.lastPanel=t,i.addClass("active")),i.length?e.isFolded&&e.expand():e.isFolded&&e.collapse();var n=this.$tabs.find("> a[data-tab="+t+"]").parent();n.length&&n.addClass("active"),this.fireEvent("tab:active",[t])}},addTab:function(t,e,n){function o(t){return s.tabs[t]?s.tabs[t].action:o(--t)}var a=_.template('');s.tabs[n+1]=t;var r=o(n),l=this.$tabs||this.$layout.find(".tabs"),c=l.find("a[data-tab="+r+"]");c.length&&(c.parent().after(a(t)),e&&(l=this.$panels||this.$layout.find(".box-panels > .panel"),c=l.filter("[data-tab="+r+"]"),c.length?c.after(e):e.appendTo(this.$layout.find(".box-panels"))),this.$tabs&&(this.$tabs=i.find("> li")),this.$panels&&(this.$panels=this.$el.find(".box-panels > .panel")))},isCompact:function(){return this.isFolded},hasTabInvisible:function(){if(i.length<1)return!1;var t=Math.round(i.offset().left),e=Math.round(t+i.width()),n=this.$tabs.filter(":visible:first").get(0);if(!n)return!1;var o=n.getBoundingClientRect();return Math.round(o.left)e)},processPanelVisible:function(t,e){function i(){var e=t||n.$panels.filter(".active");if(e&&e.length){var i=e.parents(".box-controls").width(),o=e.data(),s=o.rightedge,a=o.buttons,r=o.flex;if(s||(s=e.get(0).getBoundingClientRect().right),a||(a=[],_.each(e.find(".btn-slot .x-huge"),function(t){a.push($(t).closest(".btn-slot"))}),o.buttons=a),r||(r=[],_.each(e.find(".group.flex"),function(t){var e=$(t);r.push({el:e,width:e.attr("data-group-width")||e.attr("max-width")})}),o.flex=r),s>i){if(r.length>0)for(var l=0;lparseInt(c.css("min-width")))return;c.css("width",c.css("min-width"))}for(var l=a.length-1;l>=0;l--){var d=a[l];if(!d.hasClass("compactwidth")&&(d.addClass("compactwidth"),(s=e.get(0).getBoundingClientRect().right)<=i))break}o.rightedge=s}else{for(var l=0;li)){d.addClass("compactwidth"),s=e.get(0).getBoundingClientRect().right;break}}if(o.rightedge=s,r.length>0&&e.find(".btn-slot.compactwidth").length<1)for(var l=0;l a[data-tab="+t+"]").parent().css("display",e?"":"none"),this.onResize())}}}())}),define("documenteditor/main/app/view/Toolbar",["jquery","underscore","backbone","text!documenteditor/main/app/template/Toolbar.template","text!documenteditor/main/app/template/ToolbarView.template","common/main/lib/collection/Fonts","common/main/lib/component/Button","common/main/lib/component/ComboBox","common/main/lib/component/DataView","common/main/lib/component/ColorPalette","common/main/lib/component/ThemeColorPalette","common/main/lib/component/Menu","common/main/lib/component/DimensionPicker","common/main/lib/component/Window","common/main/lib/component/ComboBoxFonts","common/main/lib/component/ComboDataView","common/main/lib/component/SynchronizeTip","common/main/lib/component/Mixtbar"],function(t,e,i,n,o){"use strict";DE.Views.Toolbar=Common.UI.Mixtbar.extend(e.extend(function(){return{el:"#toolbar",events:{},initialize:function(){var t=this;return this.SchemeNames=[this.txtScheme1,this.txtScheme2,this.txtScheme3,this.txtScheme4,this.txtScheme5,this.txtScheme6,this.txtScheme7,this.txtScheme8,this.txtScheme9,this.txtScheme10,this.txtScheme11,this.txtScheme12,this.txtScheme13,this.txtScheme14,this.txtScheme15,this.txtScheme16,this.txtScheme17,this.txtScheme18,this.txtScheme19,this.txtScheme20,this.txtScheme21],this.paragraphControls=[],this.toolbarControls=[],this.textOnlyControls=[],this._state={hasCollaborativeChanges:void 0,previewmode:!1},Common.NotificationCenter.on("app:ready",t.onAppReady.bind(this)),this},applyLayout:function(i){var s=this;if(i.isEdit){Common.UI.Mixtbar.prototype.initialize.call(this,{template:e.template(n),tabs:[{caption:s.textTabFile,action:"file",extcls:"canedit",haspanel:!1},{caption:s.textTabHome,action:"home",extcls:"canedit"},{caption:s.textTabInsert,action:"ins",extcls:"canedit"},{caption:s.textTabLayout,action:"layout",extcls:"canedit"},{caption:s.textTabLinks,action:"links",extcls:"canedit"}]}),this.btnSaveCls="btn-save",this.btnSaveTip=this.tipSave+Common.Utils.String.platformKey("Ctrl+S"),this.btnPrint=new Common.UI.Button({id:"id-toolbar-btn-print",cls:"btn-toolbar",iconCls:"toolbar__icon btn-print no-mask",signals:["disabled"]}),this.toolbarControls.push(this.btnPrint),this.btnSave=new Common.UI.Button({id:"id-toolbar-btn-save",cls:"btn-toolbar",iconCls:"toolbar__icon no-mask "+this.btnSaveCls,signals:["disabled"]}),this.toolbarControls.push(this.btnSave),this.btnCollabChanges=this.btnSave,this.btnUndo=new Common.UI.Button({id:"id-toolbar-btn-undo",cls:"btn-toolbar",iconCls:"toolbar__icon btn-undo",signals:["disabled"]}),this.toolbarControls.push(this.btnUndo),this.btnRedo=new Common.UI.Button({id:"id-toolbar-btn-redo",cls:"btn-toolbar",iconCls:"toolbar__icon btn-redo",signals:["disabled"]}),this.toolbarControls.push(this.btnRedo),this.btnCopy=new Common.UI.Button({id:"id-toolbar-btn-copy",cls:"btn-toolbar",iconCls:"toolbar__icon btn-copy"}),this.toolbarControls.push(this.btnCopy),this.btnPaste=new Common.UI.Button({id:"id-toolbar-btn-paste",cls:"btn-toolbar",iconCls:"toolbar__icon btn-paste"}),this.paragraphControls.push(this.btnPaste),this.btnIncFontSize=new Common.UI.Button({id:"id-toolbar-btn-incfont",cls:"btn-toolbar",iconCls:"toolbar__icon btn-incfont"}),this.paragraphControls.push(this.btnIncFontSize),this.btnDecFontSize=new Common.UI.Button({id:"id-toolbar-btn-decfont",cls:"btn-toolbar",iconCls:"toolbar__icon btn-decfont"}),this.paragraphControls.push(this.btnDecFontSize),this.btnBold=new Common.UI.Button({id:"id-toolbar-btn-bold",cls:"btn-toolbar",iconCls:"toolbar__icon btn-bold",enableToggle:!0}),this.paragraphControls.push(this.btnBold),this.btnItalic=new Common.UI.Button({id:"id-toolbar-btn-italic",cls:"btn-toolbar",iconCls:"toolbar__icon btn-italic",enableToggle:!0}),this.paragraphControls.push(this.btnItalic),this.btnUnderline=new Common.UI.Button({id:"id-toolbar-btn-underline",cls:"btn-toolbar",iconCls:"toolbar__icon btn-underline",enableToggle:!0}),this.paragraphControls.push(this.btnUnderline),this.btnStrikeout=new Common.UI.Button({id:"id-toolbar-btn-strikeout",cls:"btn-toolbar",iconCls:"toolbar__icon btn-strikeout",enableToggle:!0}),this.paragraphControls.push(this.btnStrikeout),this.btnSuperscript=new Common.UI.Button({id:"id-toolbar-btn-superscript",cls:"btn-toolbar",iconCls:"toolbar__icon btn-superscript",enableToggle:!0,toggleGroup:"superscriptGroup"}),this.paragraphControls.push(this.btnSuperscript),this.btnSubscript=new Common.UI.Button({id:"id-toolbar-btn-subscript",cls:"btn-toolbar",iconCls:"toolbar__icon btn-subscript",enableToggle:!0,toggleGroup:"superscriptGroup"}),this.paragraphControls.push(this.btnSubscript),this.btnHighlightColor=new Common.UI.Button({id:"id-toolbar-btn-highlight",cls:"btn-toolbar",iconCls:"toolbar__icon btn-highlight",enableToggle:!0,allowDepress:!0,split:!0,menu:new Common.UI.Menu({style:"min-width: 100px;",items:[{template:e.template('
')},{caption:"--"},this.mnuHighlightTransparent=new Common.UI.MenuItem({caption:this.strMenuNoFill,checkable:!0})]})}),this.paragraphControls.push(this.btnHighlightColor),this.textOnlyControls.push(this.btnHighlightColor),this.btnFontColor=new Common.UI.Button({id:"id-toolbar-btn-fontcolor",cls:"btn-toolbar",iconCls:"toolbar__icon btn-fontcolor",split:!0,menu:new Common.UI.Menu({cls:"shifted-left",items:[{id:"id-toolbar-menu-auto-fontcolor",caption:this.textAutoColor,template:e.template('<%= caption %>')},{caption:"--"},{template:e.template('
')},{template:e.template(''+this.textNewColor+"")}]})}),this.paragraphControls.push(this.btnFontColor),this.btnParagraphColor=new Common.UI.Button({id:"id-toolbar-btn-paracolor",cls:"btn-toolbar",iconCls:"toolbar__icon btn-paracolor",split:!0,menu:new Common.UI.Menu({items:[{template:e.template('
')},{template:e.template(''+this.textNewColor+"")}]})}),this.paragraphControls.push(this.btnParagraphColor),this.textOnlyControls.push(this.btnParagraphColor),this.btnAlignLeft=new Common.UI.Button({id:"id-toolbar-btn-align-left",cls:"btn-toolbar",iconCls:"toolbar__icon btn-align-left",enableToggle:!0,allowDepress:!1,toggleGroup:"alignGroup"}),this.paragraphControls.push(this.btnAlignLeft),this.btnAlignCenter=new Common.UI.Button({id:"id-toolbar-btn-align-center",cls:"btn-toolbar",iconCls:"toolbar__icon btn-align-center",enableToggle:!0,allowDepress:!1,toggleGroup:"alignGroup"}),this.paragraphControls.push(this.btnAlignCenter),this.btnAlignRight=new Common.UI.Button({id:"id-toolbar-btn-align-right",cls:"btn-toolbar",iconCls:"toolbar__icon btn-align-right",enableToggle:!0,allowDepress:!1,toggleGroup:"alignGroup"}),this.paragraphControls.push(this.btnAlignRight),this.btnAlignJust=new Common.UI.Button({id:"id-toolbar-btn-align-just",cls:"btn-toolbar",iconCls:"toolbar__icon btn-align-just",enableToggle:!0,allowDepress:!1,toggleGroup:"alignGroup"}),this.paragraphControls.push(this.btnAlignJust),this.btnDecLeftOffset=new Common.UI.Button({id:"id-toolbar-btn-decoffset",cls:"btn-toolbar",iconCls:"toolbar__icon btn-decoffset"}),this.paragraphControls.push(this.btnDecLeftOffset),this.btnIncLeftOffset=new Common.UI.Button({id:"id-toolbar-btn-incoffset",cls:"btn-toolbar",iconCls:"toolbar__icon btn-incoffset"}),this.paragraphControls.push(this.btnIncLeftOffset),this.btnLineSpace=new Common.UI.Button({id:"id-toolbar-btn-linespace",cls:"btn-toolbar",iconCls:"toolbar__icon btn-linespace",menu:new Common.UI.Menu({style:"min-width: 60px;",items:[{caption:"1.0",value:1,checkable:!0,toggleGroup:"linesize"},{caption:"1.15",value:1.15,checkable:!0,toggleGroup:"linesize"},{caption:"1.5",value:1.5,checkable:!0,toggleGroup:"linesize"},{caption:"2.0",value:2,checkable:!0,toggleGroup:"linesize"},{caption:"2.5",value:2.5,checkable:!0,toggleGroup:"linesize"},{caption:"3.0",value:3,checkable:!0,toggleGroup:"linesize"}]})}),this.paragraphControls.push(this.btnLineSpace),this.btnShowHidenChars=new Common.UI.Button({id:"id-toolbar-btn-hidenchars",cls:"btn-toolbar",iconCls:"toolbar__icon btn-paragraph",enableToggle:!0,split:!0,menu:new Common.UI.Menu({style:"min-width: 60px;",items:[{caption:this.mniHiddenChars,value:"characters",checkable:!0},{caption:this.mniHiddenBorders,value:"table",checkable:!0}]})}),this.toolbarControls.push(this.btnShowHidenChars),this.btnMarkers=new Common.UI.Button({id:"id-toolbar-btn-markers",cls:"btn-toolbar",iconCls:"toolbar__icon btn-setmarkers",enableToggle:!0,toggleGroup:"markersGroup",split:!0,menu:!0}),this.paragraphControls.push(this.btnMarkers),this.textOnlyControls.push(this.btnMarkers),this.btnNumbers=new Common.UI.Button({id:"id-toolbar-btn-numbering",cls:"btn-toolbar",iconCls:"toolbar__icon btn-numbering",enableToggle:!0,toggleGroup:"markersGroup",split:!0,menu:!0}),this.paragraphControls.push(this.btnNumbers),this.textOnlyControls.push(this.btnNumbers),this.btnMultilevels=new Common.UI.Button({id:"id-toolbar-btn-multilevels",cls:"btn-toolbar",iconCls:"toolbar__icon btn-multilevels",menu:!0}),this.paragraphControls.push(this.btnMultilevels),this.textOnlyControls.push(this.btnMultilevels);var a=function(t){var e={};for(var i in t)e[i]="object"==typeof t[i]?a(t[i]):t[i];return e};this.mnuMarkersPicker={conf:{index:0},selectByIndex:function(t){this.conf.index=t},deselectAll:function(){this.conf.index=-1}},this.mnuNumbersPicker=a(this.mnuMarkersPicker),this.mnuMultilevelPicker=a(this.mnuMarkersPicker),this.btnInsertTable=new Common.UI.Button({id:"tlbtn-inserttable",cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-inserttable",caption:s.capBtnInsTable,menu:new Common.UI.Menu({items:[{template:e.template('
')},{caption:this.mniCustomTable,value:"custom"},{caption:this.mniDrawTable,value:"draw",checkable:!0},{caption:this.mniEraseTable,value:"erase",checkable:!0}]})}),this.paragraphControls.push(this.btnInsertTable),this.btnInsertImage=new Common.UI.Button({id:"tlbtn-insertimage",cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-insertimage",caption:s.capBtnInsImage,menu:new Common.UI.Menu({items:[{caption:this.mniImageFromFile,value:"file"},{caption:this.mniImageFromUrl,value:"url"},{caption:this.mniImageFromStorage,value:"storage"}]})}),this.paragraphControls.push(this.btnInsertImage),this.btnInsertChart=new Common.UI.Button({id:"tlbtn-insertchart",cls:"btn-toolbar x-huge icon-top",caption:s.capBtnInsChart,iconCls:"toolbar__icon btn-insertchart",menu:!0}),this.paragraphControls.push(this.btnInsertChart),this.btnInsertText=new Common.UI.Button({id:"tlbtn-inserttext",cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-text",caption:s.capBtnInsTextbox,enableToggle:!0}),this.paragraphControls.push(this.btnInsertText),this.btnInsertTextArt=new Common.UI.Button({id:"tlbtn-inserttextart",cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-textart",caption:s.capBtnInsTextart,menu:new Common.UI.Menu({cls:"menu-shapes",items:[{template:e.template('
')}]})}),this.paragraphControls.push(this.btnInsertTextArt),this.btnEditHeader=new Common.UI.Button({id:"id-toolbar-btn-editheader",cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-editheader",caption:s.capBtnInsHeader,menu:!0}),this.mnuPageNumberPosPicker={conf:{disabled:!1},isDisabled:function(){return this.conf.disabled},setDisabled:function(t){this.conf.disabled=t}},this.mnuPageNumCurrentPos=a(this.mnuPageNumberPosPicker),this.mnuInsertPageNum=a(this.mnuPageNumberPosPicker),this.mnuInsertPageCount=a(this.mnuPageNumberPosPicker),this.paragraphControls.push(this.mnuPageNumCurrentPos),this.paragraphControls.push(this.mnuInsertPageCount),this.toolbarControls.push(this.btnEditHeader),this.btnInsDateTime=new Common.UI.Button({id:"id-toolbar-btn-datetime",cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-datetime",caption:s.capBtnDateTime}),this.paragraphControls.push(this.btnInsDateTime),this.btnBlankPage=new Common.UI.Button({id:"id-toolbar-btn-blankpage",cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-blankpage",caption:s.capBtnBlankPage}),this.paragraphControls.push(this.btnBlankPage),this.btnInsertShape=new Common.UI.Button({id:"tlbtn-insertshape",cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-insertshape",caption:s.capBtnInsShape,enableToggle:!0,menu:new Common.UI.Menu({cls:"menu-shapes"})}),this.paragraphControls.push(this.btnInsertShape),this.btnInsertEquation=new Common.UI.Button({id:"tlbtn-insertequation",cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-insertequation",caption:s.capBtnInsEquation,split:!0,menu:new Common.UI.Menu({cls:"menu-shapes"})}),this.paragraphControls.push(this.btnInsertEquation),this.btnInsertSymbol=new Common.UI.Button({id:"tlbtn-insertsymbol",cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-symbol",caption:s.capBtnInsSymbol}),this.paragraphControls.push(this.btnInsertSymbol),this.btnDropCap=new Common.UI.Button({id:"tlbtn-dropcap",cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-dropcap",caption:s.capBtnInsDropcap,menu:new Common.UI.Menu({cls:"ppm-toolbar shifted-right",items:[{caption:this.textNone,iconCls:"menu__icon columns-one",checkable:!0,checkmark:!1,toggleGroup:"menuDropCap",value:Asc.c_oAscDropCap.None,checked:!0},{caption:this.textInText,iconCls:"menu__icon dropcap-intext",checkable:!0,checkmark:!1,toggleGroup:"menuDropCap",value:Asc.c_oAscDropCap.Drop},{caption:this.textInMargin,iconCls:"menu__icon dropcap-inmargin",checkable:!0,checkmark:!1,toggleGroup:"menuDropCap",value:Asc.c_oAscDropCap.Margin},{caption:"--"},this.mnuDropCapAdvanced=new Common.UI.MenuItem({caption:this.mniEditDropCap})]})}),this.paragraphControls.push(this.btnDropCap),this.btnContentControls=new Common.UI.Button({id:"tlbtn-controls",cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-controls",caption:s.capBtnInsControls,menu:new Common.UI.Menu({cls:"ppm-toolbar shifted-right",items:[{caption:this.textPlainControl,iconCls:"menu__icon cc-plaintext",value:"plain"},{caption:this.textRichControl,iconCls:"menu__icon cc-richtext",value:"rich"},{caption:this.textPictureControl,value:"picture"},{caption:this.textComboboxControl,value:"combobox"},{caption:this.textDropdownControl,value:"dropdown"},{caption:this.textDateControl,value:"date"},{caption:this.textCheckboxControl,value:"checkbox"},{caption:"--"},{caption:this.textRemoveControl,iconCls:"menu__icon cc-remove",value:"remove"},{caption:"--"},{caption:this.mniEditControls,value:"settings"},{caption:this.mniHighlightControls,value:"highlight",menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[this.mnuNoControlsColor=new Common.UI.MenuItem({id:"id-toolbar-menu-no-highlight-controls",caption:this.textNoHighlight,checkable:!0}),{caption:"--"},{template:e.template('
')},{template:e.template(''+this.textNewColor+"")}]})}]})}),this.btnColumns=new Common.UI.Button({id:"tlbtn-columns",cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-columns",caption:s.capBtnColumns,menu:new Common.UI.Menu({cls:"ppm-toolbar shifted-right",items:[{caption:this.textColumnsOne,iconCls:"menu__icon columns-one",checkable:!0,checkmark:!1,toggleGroup:"menuColumns",value:0},{caption:this.textColumnsTwo,iconCls:"menu__icon columns-two",checkable:!0,checkmark:!1,toggleGroup:"menuColumns",value:1},{caption:this.textColumnsThree,iconCls:"menu__icon columns-three",checkable:!0,checkmark:!1,toggleGroup:"menuColumns",value:2},{caption:this.textColumnsLeft,iconCls:"menu__icon columns-left",checkmark:!1,checkable:!0,toggleGroup:"menuColumns",value:3},{caption:this.textColumnsRight,iconCls:"menu__icon columns-right",checkmark:!1,checkable:!0,toggleGroup:"menuColumns",value:4},{caption:"--"},{caption:this.textColumnsCustom,value:"advanced"}]})}),this.paragraphControls.push(this.btnColumns),this.btnPageOrient=new Common.UI.Button({id:"tlbtn-pageorient",cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-pageorient",caption:s.capBtnPageOrient,menu:new Common.UI.Menu({cls:"ppm-toolbar",items:[{caption:this.textPortrait,iconCls:"menu__icon page-portrait",checkable:!0,checkmark:!1,toggleGroup:"menuOrient",value:!0},{caption:this.textLandscape,iconCls:"menu__icon page-landscape",checkable:!0,checkmark:!1,toggleGroup:"menuOrient",value:!1}]})}),this.toolbarControls.push(this.btnPageOrient);var r=e.template('
<%= caption %>
<% if (options.value !== null) { %>
<% } %>
");this.btnPageMargins=new Common.UI.Button({id:"tlbtn-pagemargins",cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-pagemargins",caption:s.capBtnMargins,menu:new Common.UI.Menu({items:[{caption:this.textMarginsLast,checkable:!0,template:r,toggleGroup:"menuPageMargins"},{caption:this.textMarginsNormal,checkable:!0,template:r,toggleGroup:"menuPageMargins",value:[20,30,20,15]},{caption:this.textMarginsUsNormal,checkable:!0,template:r,toggleGroup:"menuPageMargins",value:[25.4,25.4,25.4,25.4]},{caption:this.textMarginsNarrow,checkable:!0,template:r,toggleGroup:"menuPageMargins",value:[12.7,12.7,12.7,12.7]},{caption:this.textMarginsModerate,checkable:!0,template:r,toggleGroup:"menuPageMargins",value:[25.4,19.1,25.4,19.1]},{caption:this.textMarginsWide,checkable:!0,template:r,toggleGroup:"menuPageMargins",value:[25.4,50.8,25.4,50.8]},{caption:"--"},{caption:this.textPageMarginsCustom,value:"advanced"}]})}),this.toolbarControls.push(this.btnPageMargins);var l=e.template('
<%= caption %>
<%= parseFloat(Common.Utils.Metric.fnRecalcFromMM(options.value[0]).toFixed(2)) %> <%= Common.Utils.Metric.getCurrentMetricName() %> x <%= parseFloat(Common.Utils.Metric.fnRecalcFromMM(options.value[1]).toFixed(2)) %> <%= Common.Utils.Metric.getCurrentMetricName() %>
');this.btnPageSize=new Common.UI.Button({id:"tlbtn-pagesize",cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-pagesize",caption:s.capBtnPageSize,menu:new Common.UI.Menu({restoreHeight:!0,items:[{caption:"US Letter",subtitle:"21,59cm x 27,94cm",template:l,checkable:!0,toggleGroup:"menuPageSize",value:[215.9,279.4]},{caption:"US Legal",subtitle:"21,59cm x 35,56cm",template:l,checkable:!0,toggleGroup:"menuPageSize",value:[215.9,355.6]},{caption:"A4",subtitle:"21cm x 29,7cm",template:l,checkable:!0,toggleGroup:"menuPageSize",value:[210,297],checked:!0},{caption:"A5",subtitle:"14,81cm x 20,99cm",template:l,checkable:!0,toggleGroup:"menuPageSize",value:[148,210]},{ -caption:"B5",subtitle:"17,6cm x 25,01cm",template:l,checkable:!0,toggleGroup:"menuPageSize",value:[176,250]},{caption:"Envelope #10",subtitle:"10,48cm x 24,13cm",template:l,checkable:!0,toggleGroup:"menuPageSize",value:[104.8,241.3]},{caption:"Envelope DL",subtitle:"11,01cm x 22,01cm",template:l,checkable:!0,toggleGroup:"menuPageSize",value:[110,220]},{caption:"Tabloid",subtitle:"27,94cm x 43,17cm",template:l,checkable:!0,toggleGroup:"menuPageSize",value:[279.4,431.8]},{caption:"A3",subtitle:"29,7cm x 42,01cm",template:l,checkable:!0,toggleGroup:"menuPageSize",value:[297,420]},{caption:"Tabloid Oversize",subtitle:"30,48cm x 45,71cm",template:l,checkable:!0,toggleGroup:"menuPageSize",value:[304.8,457.1]},{caption:"ROC 16K",subtitle:"19,68cm x 27,3cm",template:l,checkable:!0,toggleGroup:"menuPageSize",value:[196.8,273]},{caption:"Envelope Choukei 3",subtitle:"11,99cm x 23,49cm",template:l,checkable:!0,toggleGroup:"menuPageSize",value:[119.9,234.9]},{caption:"Super B/A3",subtitle:"33,02cm x 48,25cm",template:l,checkable:!0,toggleGroup:"menuPageSize",value:[330.2,482.5]},{caption:"--"},{caption:this.textPageSizeCustom,value:"advanced"}]})}),this.toolbarControls.push(this.btnPageSize),this.btnLineNumbers=new Common.UI.Button({id:"tlbtn-line-numbers",cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-line-numbering",caption:s.capBtnLineNumbers,menu:new Common.UI.Menu({cls:"ppm-toolbar",items:[{caption:this.textNone,checkable:!0,toggleGroup:"menuLineNumbers",value:0},{caption:this.textContinuous,checkable:!0,toggleGroup:"menuLineNumbers",value:1},{caption:this.textRestartEachPage,checkable:!0,toggleGroup:"menuLineNumbers",value:2},{caption:this.textRestartEachSection,checkable:!0,toggleGroup:"menuLineNumbers",value:3},{caption:this.textSuppressForCurrentParagraph,checkable:!0,allowDepress:!0,value:4},{caption:"--"},{caption:this.textCustomLineNumbers,value:5}]})}),this.btnClearStyle=new Common.UI.Button({id:"id-toolbar-btn-clearstyle",cls:"btn-toolbar",iconCls:"toolbar__icon btn-clearstyle"}),this.toolbarControls.push(this.btnClearStyle),this.btnCopyStyle=new Common.UI.Button({id:"id-toolbar-btn-copystyle",cls:"btn-toolbar",iconCls:"toolbar__icon btn-copystyle",enableToggle:!0}),this.toolbarControls.push(this.btnCopyStyle),this.btnColorSchemas=new Common.UI.Button({id:"id-toolbar-btn-colorschemas",cls:"btn-toolbar",iconCls:"toolbar__icon btn-colorschemas",menu:new Common.UI.Menu({cls:"shifted-left",items:[],restoreHeight:!0})}),this.toolbarControls.push(this.btnColorSchemas),this.btnMailRecepients=new Common.UI.Button({id:"id-toolbar-btn-mailrecepients",cls:"btn-toolbar",iconCls:"toolbar__icon btn-mailmerge"}),s.btnImgAlign=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-img-align",caption:s.capImgAlign,menu:!0}),s.btnImgGroup=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-img-group",caption:s.capImgGroup,menu:!0}),s.btnImgForward=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-img-frwd",caption:s.capImgForward,split:!0,menu:!0}),s.btnImgBackward=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-img-bkwd",caption:s.capImgBackward,split:!0,menu:!0}),s.btnImgWrapping=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-img-wrap",caption:s.capImgWrapping,menu:!0}),s.btnWatermark=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-watermark",caption:s.capBtnWatermark,menu:new Common.UI.Menu({cls:"ppm-toolbar",items:[{caption:this.textEditWatermark,value:"edit"},{caption:this.textRemWatermark,value:"remove"}]})}),s.toolbarControls.push(s.btnImgAlign,s.btnImgGroup,s.btnImgForward,s.btnImgBackward,s.btnImgWrapping,s.btnWatermark),this.mnuLineSpace=this.btnLineSpace.menu,this.mnuNonPrinting=this.btnShowHidenChars.menu,this.mnuInsertTable=this.btnInsertTable.menu,this.mnuInsertImage=this.btnInsertImage.menu,this.mnuPageSize=this.btnPageSize.menu,this.mnuColorSchema=this.btnColorSchemas.menu,this.cmbFontSize=new Common.UI.ComboBox({cls:"input-group-nr",menuStyle:"min-width: 55px;",hint:this.tipFontSize,data:[{value:8,displayValue:"8"},{value:9,displayValue:"9"},{value:10,displayValue:"10"},{value:11,displayValue:"11"},{value:12,displayValue:"12"},{value:14,displayValue:"14"},{value:16,displayValue:"16"},{value:18,displayValue:"18"},{value:20,displayValue:"20"},{value:22,displayValue:"22"},{value:24,displayValue:"24"},{value:26,displayValue:"26"},{value:28,displayValue:"28"},{value:36,displayValue:"36"},{value:48,displayValue:"48"},{value:72,displayValue:"72"},{value:96,displayValue:"96"}]}),this.paragraphControls.push(this.cmbFontSize),this.cmbFontName=new Common.UI.ComboBoxFonts({cls:"input-group-nr",menuCls:"scrollable-menu",menuStyle:"min-width: 325px;",hint:this.tipFontName,store:new Common.Collections.Fonts}),this.paragraphControls.push(this.cmbFontName),this.listStylesAdditionalMenuItem=new Common.UI.MenuItem({template:e.template('
")}),this.listStyles=new Common.UI.ComboDataView({cls:"combo-styles",itemWidth:104,itemHeight:38,enableKeyEvents:!0,additionalMenuItems:[this.listStylesAdditionalMenuItem],beforeOpenHandler:function(e){var i=this,n=i.openButton.menu;if(n.cmpEl){var o=t(i.cmpEl.find(".dataview.inner .style").get(0)).parent(),s=o.is(":visible")?parseInt(o.css("width")):i.itemWidth+parseInt(o.css("padding-left"))+parseInt(o.css("padding-right"))+parseInt(o.css("border-left-width"))+parseInt(o.css("border-right-width")),a=i.menuPicker.store.length>=6?6:i.menuPicker.store.length,r=Math.min(i.menuPicker.store.length,Math.round(t(".dataview",t(i.fieldPicker.el)).width()/(-1+s)+.5));r=r','
',""].join("")),this.listStyles.menuPicker.itemTemplate=e.template(['
','
',"
"].join("")),this.paragraphControls.push(this.listStyles),this.textOnlyControls.push(this.listStyles),e.each(this.toolbarControls.concat(this.paragraphControls),function(t){e.isFunction(t.setDisabled)&&t.setDisabled(!0)}),this.btnMailRecepients.setDisabled(!0);var c=new Common.UI.MenuItem({caption:s.textStyleMenuUpdate}).on("click",e.bind(s.onStyleMenuUpdate,s)),d=new Common.UI.MenuItem({caption:s.textStyleMenuDelete}).on("click",e.bind(s.onStyleMenuDelete,s)),h=new Common.UI.MenuItem({caption:s.textStyleMenuRestore}).on("click",e.bind(s.onStyleMenuDelete,s)),p=new Common.UI.MenuItem({caption:s.textStyleMenuRestoreAll}).on("click",e.bind(s.onStyleMenuRestoreAll,s)),m=new Common.UI.MenuItem({caption:s.textStyleMenuDeleteAll}).on("click",e.bind(s.onStyleMenuDeleteAll,s));null==this.styleMenu&&(this.styleMenu=new Common.UI.Menu({items:[c,d,h,p,m]})),this.on("render:after",e.bind(this.onToolbarAfterRender,this))}else Common.UI.Mixtbar.prototype.initialize.call(this,{template:e.template(o),tabs:[{caption:s.textTabFile,action:"file",haspanel:!1}]});return this},render:function(e){var i=this;if(this.fireEvent("render:before",[this]),i.isCompactView=e.isCompactView,e.isEdit?i.$el.html(i.rendererComponents(i.$layout)):(i.$layout.find(".canedit").hide(),i.$layout.addClass("folded"),i.$el.html(i.$layout)),this.fireEvent("render:after",[this]),Common.UI.Mixtbar.prototype.afterRender.call(this),Common.NotificationCenter.on({"window:resize":function(){Common.UI.Mixtbar.prototype.onResize.apply(i,arguments)}}),e.isEdit){this.showSynchTip=!Common.localStorage.getBool("de-hide-synch"),this.needShowSynchTip=!1,i.setTab("home");var n=Common.localStorage.getItem("de-pgmargins-top"),o=Common.localStorage.getItem("de-pgmargins-left"),s=Common.localStorage.getItem("de-pgmargins-bottom"),a=Common.localStorage.getItem("de-pgmargins-right");if(null!==n&&null!==o&&null!==s&&null!==a){var r=this.btnPageMargins.menu.items[0];r.options.value=r.value=[parseFloat(n),parseFloat(o),parseFloat(s),parseFloat(a)],r.setVisible(!0),t(r.el).html(r.template({id:Common.UI.getId(),caption:r.caption,options:r.options}))}else this.btnPageMargins.menu.items[0].setVisible(!1)}return i.isCompactView&&i.setFolded(!0),this},onTabClick:function(e){var i=this,n=t(e.currentTarget).find("> a[data-tab]").data("tab"),o=i.isTabActive("file");Common.UI.Mixtbar.prototype.onTabClick.apply(i,arguments),o?i.fireEvent("file:close"):"file"==n&&(i.fireEvent("file:open"),i.setTab(n)),i.isTabActive("home")&&i.fireEvent("home:open")},rendererComponents:function(e){var i=t(e),n=function(t,e){Common.Utils.injectComponent(i.findById(t),e)};return n("#slot-field-fontname",this.cmbFontName),n("#slot-field-fontsize",this.cmbFontSize),n("#slot-btn-print",this.btnPrint),n("#slot-btn-save",this.btnSave),n("#slot-btn-undo",this.btnUndo),n("#slot-btn-redo",this.btnRedo),n("#slot-btn-copy",this.btnCopy),n("#slot-btn-paste",this.btnPaste),n("#slot-btn-incfont",this.btnIncFontSize),n("#slot-btn-decfont",this.btnDecFontSize),n("#slot-btn-bold",this.btnBold),n("#slot-btn-italic",this.btnItalic),n("#slot-btn-underline",this.btnUnderline),n("#slot-btn-strikeout",this.btnStrikeout),n("#slot-btn-superscript",this.btnSuperscript),n("#slot-btn-subscript",this.btnSubscript),n("#slot-btn-highlight",this.btnHighlightColor),n("#slot-btn-fontcolor",this.btnFontColor),n("#slot-btn-align-left",this.btnAlignLeft),n("#slot-btn-align-center",this.btnAlignCenter),n("#slot-btn-align-right",this.btnAlignRight),n("#slot-btn-align-just",this.btnAlignJust),n("#slot-btn-incoffset",this.btnIncLeftOffset),n("#slot-btn-decoffset",this.btnDecLeftOffset),n("#slot-btn-linespace",this.btnLineSpace),n("#slot-btn-hidenchars",this.btnShowHidenChars),n("#slot-btn-markers",this.btnMarkers),n("#slot-btn-numbering",this.btnNumbers),n("#slot-btn-multilevels",this.btnMultilevels),n("#slot-btn-instable",this.btnInsertTable),n("#slot-btn-insimage",this.btnInsertImage),n("#slot-btn-inschart",this.btnInsertChart),n("#slot-btn-instext",this.btnInsertText),n("#slot-btn-instextart",this.btnInsertTextArt),n("#slot-btn-dropcap",this.btnDropCap),n("#slot-btn-controls",this.btnContentControls),n("#slot-btn-columns",this.btnColumns),n("#slot-btn-line-numbers",this.btnLineNumbers),n("#slot-btn-editheader",this.btnEditHeader),n("#slot-btn-datetime",this.btnInsDateTime),n("#slot-btn-blankpage",this.btnBlankPage),n("#slot-btn-insshape",this.btnInsertShape),n("#slot-btn-insequation",this.btnInsertEquation),n("#slot-btn-inssymbol",this.btnInsertSymbol),n("#slot-btn-pageorient",this.btnPageOrient),n("#slot-btn-pagemargins",this.btnPageMargins),n("#slot-btn-pagesize",this.btnPageSize),n("#slot-btn-clearstyle",this.btnClearStyle),n("#slot-btn-copystyle",this.btnCopyStyle),n("#slot-btn-colorschemas",this.btnColorSchemas),n("#slot-btn-paracolor",this.btnParagraphColor),n("#slot-field-styles",this.listStyles),n("#slot-btn-mailrecepients",this.btnMailRecepients),n("#slot-img-align",this.btnImgAlign),n("#slot-img-group",this.btnImgGroup),n("#slot-img-movefrwd",this.btnImgForward),n("#slot-img-movebkwd",this.btnImgBackward),n("#slot-img-wrapping",this.btnImgWrapping),n("#slot-btn-watermark",this.btnWatermark),this.btnsPageBreak=Common.Utils.injectButtons(i.find(".btn-slot.btn-pagebreak"),"","toolbar__icon btn-pagebreak",this.capBtnInsPagebreak,void 0,!0,!0),Array.prototype.push.apply(this.paragraphControls,this.btnsPageBreak),i},onAppReady:function(t){var e=this;new Promise(function(t,e){t()}).then(function(){if(t.isEdit){e.btnsPageBreak.forEach(function(t){t.updateHint([e.textInsPageBreak,e.tipPageBreak]);var i=new Common.UI.Menu({menuAlign:"tl-tr",items:[{caption:e.textNextPage,value:Asc.c_oAscSectionBreakType.NextPage},{caption:e.textContPage,value:Asc.c_oAscSectionBreakType.Continuous},{caption:e.textEvenPage,value:Asc.c_oAscSectionBreakType.EvenPage},{caption:e.textOddPage,value:Asc.c_oAscSectionBreakType.OddPage}]}),n=new Common.UI.Menu({items:[{caption:e.textInsPageBreak,value:"page"},{caption:e.textInsColumnBreak,value:"column"},{caption:e.textInsSectionBreak,value:"section",menu:i}]});t.setMenu(n)});var i=DE.getController("DocumentHolder").getView();e.btnImgForward.updateHint(e.tipSendForward),e.btnImgForward.setMenu(new Common.UI.Menu({items:[{caption:i.textArrangeFront,iconCls:"menu__icon arrange-front",valign:Asc.c_oAscChangeLevel.BringToFront},{caption:i.textArrangeForward,iconCls:"menu__icon arrange-forward",valign:Asc.c_oAscChangeLevel.BringForward}]})),e.btnImgBackward.updateHint(e.tipSendBackward),e.btnImgBackward.setMenu(new Common.UI.Menu({items:[{caption:i.textArrangeBack,iconCls:"menu__icon arrange-back",valign:Asc.c_oAscChangeLevel.SendToBack},{caption:i.textArrangeBackward,iconCls:"menu__icon arrange-backward",valign:Asc.c_oAscChangeLevel.BringBackward}]})),e.btnImgAlign.updateHint(e.tipImgAlign),e.mniAlignToPage=new Common.UI.MenuItem({caption:e.txtPageAlign,checkable:!0,toggleGroup:"imgalign",value:-1}).on("click",function(t){Common.Utils.InternalSettings.set("de-img-align-to",1)}),e.mniAlignToMargin=new Common.UI.MenuItem({caption:e.txtMarginAlign,checkable:!0,toggleGroup:"imgalign",value:-1}).on("click",function(t){Common.Utils.InternalSettings.set("de-img-align-to",2)}),e.mniAlignObjects=new Common.UI.MenuItem({caption:e.txtObjectsAlign,checkable:!0,toggleGroup:"imgalign",value:-1}).on("click",function(t){Common.Utils.InternalSettings.set("de-img-align-to",3)}),e.mniDistribHor=new Common.UI.MenuItem({caption:e.txtDistribHor,iconCls:"menu__icon shape-distribute-hor",value:6}),e.mniDistribVert=new Common.UI.MenuItem({caption:e.txtDistribVert,iconCls:"menu__icon shape-distribute-vert",value:7}),e.btnImgAlign.setMenu(new Common.UI.Menu({cls:"shifted-right",items:[{caption:i.textShapeAlignLeft,iconCls:"menu__icon shape-align-left",value:Asc.c_oAscAlignShapeType.ALIGN_LEFT},{caption:i.textShapeAlignCenter,iconCls:"menu__icon shape-align-center",value:Asc.c_oAscAlignShapeType.ALIGN_CENTER},{caption:i.textShapeAlignRight,iconCls:"menu__icon shape-align-right",value:Asc.c_oAscAlignShapeType.ALIGN_RIGHT},{caption:i.textShapeAlignTop,iconCls:"menu__icon shape-align-top",value:Asc.c_oAscAlignShapeType.ALIGN_TOP},{caption:i.textShapeAlignMiddle,iconCls:"menu__icon shape-align-middle",value:Asc.c_oAscAlignShapeType.ALIGN_MIDDLE},{caption:i.textShapeAlignBottom,iconCls:"menu__icon shape-align-bottom",value:Asc.c_oAscAlignShapeType.ALIGN_BOTTOM},{caption:"--"},e.mniDistribHor,e.mniDistribVert,{caption:"--"},e.mniAlignToPage,e.mniAlignToMargin,e.mniAlignObjects]})),e.btnImgGroup.updateHint(e.tipImgGroup),e.btnImgGroup.setMenu(new Common.UI.Menu({items:[{caption:i.txtGroup,iconCls:"menu__icon shape-group",groupval:1},{caption:i.txtUngroup,iconCls:"menu__icon shape-ungroup",groupval:-1}]})),e.btnImgWrapping.updateHint(e.tipImgWrapping),e.btnImgWrapping.setMenu(new Common.UI.Menu({cls:"ppm-toolbar",items:[{caption:i.txtInline,iconCls:"menu__icon wrap-inline",toggleGroup:"imgwrapping",wrapType:Asc.c_oAscWrapStyle2.Inline,checkmark:!1,checkable:!0},{caption:i.txtSquare,iconCls:"menu__icon wrap-square",toggleGroup:"imgwrapping",wrapType:Asc.c_oAscWrapStyle2.Square,checkmark:!1,checkable:!0},{caption:i.txtTight,iconCls:"menu__icon wrap-tight",toggleGroup:"imgwrapping",wrapType:Asc.c_oAscWrapStyle2.Tight,checkmark:!1,checkable:!0},{caption:i.txtThrough,iconCls:"menu__icon wrap-through",toggleGroup:"imgwrapping",wrapType:Asc.c_oAscWrapStyle2.Through,checkmark:!1,checkable:!0},{caption:i.txtTopAndBottom,iconCls:"menu__icon wrap-topandbottom",toggleGroup:"imgwrapping",wrapType:Asc.c_oAscWrapStyle2.TopAndBottom,checkmark:!1,checkable:!0},{caption:i.txtInFront,iconCls:"menu__icon wrap-infront",toggleGroup:"imgwrapping",wrapType:Asc.c_oAscWrapStyle2.InFront,checkmark:!1,checkable:!0},{caption:i.txtBehind,iconCls:"menu__icon wrap-behind",toggleGroup:"imgwrapping",wrapType:Asc.c_oAscWrapStyle2.Behind,checkmark:!1,checkable:!0}]})),e.btnWatermark.updateHint(e.tipWatermark),!t.canFeatureContentControl&&e.btnContentControls.cmpEl&&e.btnContentControls.cmpEl.parents(".group").hide().prev(".separator").hide()}})},createDelayedElements:function(){this.api&&(this.mnuNonPrinting.items[0].setChecked(this.api.get_ShowParaMarks(),!0),this.mnuNonPrinting.items[1].setChecked(this.api.get_ShowTableEmptyLine(),!0),this.btnShowHidenChars.toggle(this.mnuNonPrinting.items[0].checked,!0),this.updateMetricUnit()),this.btnPrint.updateHint(this.tipPrint+Common.Utils.String.platformKey("Ctrl+P")),this.btnSave.updateHint(this.btnSaveTip),this.btnUndo.updateHint(this.tipUndo+Common.Utils.String.platformKey("Ctrl+Z")),this.btnRedo.updateHint(this.tipRedo+Common.Utils.String.platformKey("Ctrl+Y")),this.btnCopy.updateHint(this.tipCopy+Common.Utils.String.platformKey("Ctrl+C")),this.btnPaste.updateHint(this.tipPaste+Common.Utils.String.platformKey("Ctrl+V")),this.btnIncFontSize.updateHint(this.tipIncFont+Common.Utils.String.platformKey("Ctrl+]")),this.btnDecFontSize.updateHint(this.tipDecFont+Common.Utils.String.platformKey("Ctrl+[")),this.btnBold.updateHint(this.textBold+Common.Utils.String.platformKey("Ctrl+B")),this.btnItalic.updateHint(this.textItalic+Common.Utils.String.platformKey("Ctrl+I")),this.btnUnderline.updateHint(this.textUnderline+Common.Utils.String.platformKey("Ctrl+U")),this.btnStrikeout.updateHint(this.textStrikeout),this.btnSuperscript.updateHint(this.textSuperscript),this.btnSubscript.updateHint(this.textSubscript),this.btnHighlightColor.updateHint(this.tipHighlightColor),this.btnFontColor.updateHint(this.tipFontColor),this.btnParagraphColor.updateHint(this.tipPrColor),this.btnAlignLeft.updateHint(this.tipAlignLeft+Common.Utils.String.platformKey("Ctrl+L")),this.btnAlignCenter.updateHint(this.tipAlignCenter+Common.Utils.String.platformKey("Ctrl+E")),this.btnAlignRight.updateHint(this.tipAlignRight+Common.Utils.String.platformKey("Ctrl+R")),this.btnAlignJust.updateHint(this.tipAlignJust+Common.Utils.String.platformKey("Ctrl+J")),this.btnDecLeftOffset.updateHint(this.tipDecPrLeft+Common.Utils.String.platformKey("Ctrl+Shift+M")),this.btnIncLeftOffset.updateHint(this.tipIncPrLeft+Common.Utils.String.platformKey("Ctrl+M")),this.btnLineSpace.updateHint(this.tipLineSpace),this.btnShowHidenChars.updateHint(this.tipShowHiddenChars+Common.Utils.String.platformKey("Ctrl+*")),this.btnMarkers.updateHint(this.tipMarkers),this.btnNumbers.updateHint(this.tipNumbers),this.btnMultilevels.updateHint(this.tipMultilevels),this.btnInsertTable.updateHint(this.tipInsertTable),this.btnInsertImage.updateHint(this.tipInsertImage),this.btnInsertChart.updateHint(this.tipInsertChart),this.btnInsertText.updateHint(this.tipInsertText),this.btnInsertTextArt.updateHint(this.tipInsertTextArt),this.btnEditHeader.updateHint(this.tipEditHeader),this.btnInsDateTime.updateHint(this.tipDateTime),this.btnBlankPage.updateHint(this.tipBlankPage),this.btnInsertShape.updateHint(this.tipInsertShape),this.btnInsertEquation.updateHint(this.tipInsertEquation),this.btnInsertSymbol.updateHint(this.tipInsertSymbol),this.btnDropCap.updateHint(this.tipDropCap),this.btnContentControls.updateHint(this.tipControls),this.btnColumns.updateHint(this.tipColumns),this.btnPageOrient.updateHint(this.tipPageOrient),this.btnPageSize.updateHint(this.tipPageSize),this.btnPageMargins.updateHint(this.tipPageMargins),this.btnLineNumbers.updateHint(this.tipLineNumbers),this.btnClearStyle.updateHint(this.tipClearStyle),this.btnCopyStyle.updateHint(this.tipCopyStyle+Common.Utils.String.platformKey("Ctrl+Shift+C")),this.btnColorSchemas.updateHint(this.tipColorSchemas),this.btnMailRecepients.updateHint(this.tipMailRecepients);var i=this;this.btnMarkers.setMenu(new Common.UI.Menu({cls:"shifted-left",style:"min-width: 139px",items:[{template:e.template('')},this.mnuMarkerSettings=new Common.UI.MenuItem({caption:this.textListSettings,disabled:0==(this.mnuMarkersPicker.conf.index||0),value:"settings"})]})),this.btnNumbers.setMenu(new Common.UI.Menu({cls:"shifted-left",items:[{template:e.template('')},this.mnuNumberSettings=new Common.UI.MenuItem({caption:this.textListSettings,disabled:0==(this.mnuNumbersPicker.conf.index||0),value:"settings"})]})),this.btnMultilevels.setMenu(new Common.UI.Menu({cls:"shifted-left",style:"min-width: 90px",items:[{template:e.template('')},this.mnuMultilevelSettings=new Common.UI.MenuItem({caption:this.textListSettings,disabled:0==(this.mnuMultilevelPicker.conf.index||0),value:"settings"})]})),this.btnEditHeader.setMenu(new Common.UI.Menu({items:[{caption:this.mniEditHeader,value:"header"},{caption:this.mniEditFooter,value:"footer"},{caption:"--"},this.mnuInsertPageNum=new Common.UI.MenuItem({caption:this.textInsertPageNumber,disabled:this.mnuInsertPageNum.isDisabled(),menu:new Common.UI.Menu({cls:"shifted-left",menuAlign:"tl-tr",style:"min-width: 90px;",items:[{template:e.template('')},this.mnuPageNumCurrentPos=new Common.UI.MenuItem({caption:this.textToCurrent,disabled:this.mnuPageNumCurrentPos.isDisabled(),value:"current"})]})}),this.mnuInsertPageCount=new Common.UI.MenuItem({caption:this.textInsertPageCount,disabled:this.mnuInsertPageCount.isDisabled()})]})),this.paragraphControls.push(this.mnuPageNumCurrentPos),this.paragraphControls.push(this.mnuInsertPageCount),this.btnInsertChart.setMenu(new Common.UI.Menu({style:"width: 364px;padding-top: 12px;",items:[{template:e.template('')}]}));var n=function(o){new Common.UI.DataView({el:t("#id-toolbar-menu-insertchart"),parentMenu:o,showLast:!1,restoreHeight:421,groups:new Common.UI.DataViewGroupStore(Common.define.chartData.getChartGroupData()),store:new Common.UI.DataViewStore(Common.define.chartData.getChartData()),itemTemplate:e.template('
')}).on("item:click",function(t,e,n,o){n&&i.fireEvent("add:chart",[n.get("type")])}),o.off("show:before",n)};this.btnInsertChart.menu.on("show:before",n);var o=function(n){var s=DE.getCollection("Common.Collections.TextArt");s.length<1&&DE.getController("Main").fillTextArt(i.api.asc_getTextArtPreviews()),new Common.UI.DataView({el:t("#id-toolbar-menu-insart"),store:s,parentMenu:n,showLast:!1,itemTemplate:e.template('
')}).on("item:click",function(t,e,o,s){o&&i.fireEvent("insert:textart",[o.get("data")]),"click"!==s.type&&n.hide()}),n.off("show:before",o)};this.btnInsertTextArt.menu.on("show:before",o);var s=this.mnuMarkersPicker.conf;this.mnuMarkersPicker=new Common.UI.DataView({el:t("#id-toolbar-menu-markers"),parentMenu:this.btnMarkers.menu,restoreHeight:138,allowScrollbar:!1,store:new Common.UI.DataViewStore([{offsety:0,data:{type:0,subtype:-1}},{offsety:38,data:{type:0,subtype:1}},{offsety:76,data:{type:0,subtype:2}},{offsety:114,data:{type:0,subtype:3}},{offsety:152,data:{type:0,subtype:4}},{offsety:190,data:{type:0,subtype:5}},{offsety:228,data:{type:0,subtype:6}},{offsety:266,data:{type:0,subtype:7}},{offsety:684,data:{type:0,subtype:8}}]),itemTemplate:e.template('
')}),s&&this.mnuMarkersPicker.selectByIndex(s.index,!0),s=this.mnuNumbersPicker.conf,this.mnuNumbersPicker=new Common.UI.DataView({el:t("#id-toolbar-menu-numbering"),parentMenu:this.btnNumbers.menu,restoreHeight:92,allowScrollbar:!1,store:new Common.UI.DataViewStore([{offsety:0,data:{type:1,subtype:-1}},{offsety:570,data:{type:1,subtype:4}},{offsety:532,data:{type:1,subtype:5}},{offsety:608,data:{type:1,subtype:6}},{offsety:418,data:{type:1,subtype:1}},{offsety:456,data:{type:1,subtype:2}},{offsety:494,data:{type:1,subtype:3}},{offsety:646,data:{type:1,subtype:7}}]),itemTemplate:e.template('
')}),s&&this.mnuNumbersPicker.selectByIndex(s.index,!0),s=this.mnuMultilevelPicker.conf,this.mnuMultilevelPicker=new Common.UI.DataView({el:t("#id-toolbar-menu-multilevels"),parentMenu:this.btnMultilevels.menu,restoreHeight:92,allowScrollbar:!1,store:new Common.UI.DataViewStore([{offsety:0,data:{type:2,subtype:-1}},{offsety:304,data:{type:2,subtype:1}},{offsety:342,data:{type:2,subtype:2}},{offsety:380,data:{type:2,subtype:3}}]),itemTemplate:e.template('
')}),s&&this.mnuMultilevelPicker.selectByIndex(s.index,!0),s=this.mnuPageNumberPosPicker?this.mnuPageNumberPosPicker.conf:void 0,this.mnuPageNumberPosPicker=new Common.UI.DataView({el:t("#id-toolbar-menu-pageposition"),allowScrollbar:!1,store:new Common.UI.DataViewStore([{offsety:132,allowSelected:!1,data:{type:c_pageNumPosition.PAGE_NUM_POSITION_TOP,subtype:c_pageNumPosition.PAGE_NUM_POSITION_LEFT}},{offsety:99,allowSelected:!1,data:{type:c_pageNumPosition.PAGE_NUM_POSITION_TOP,subtype:c_pageNumPosition.PAGE_NUM_POSITION_CENTER}},{offsety:66,allowSelected:!1,data:{type:c_pageNumPosition.PAGE_NUM_POSITION_TOP,subtype:c_pageNumPosition.PAGE_NUM_POSITION_RIGHT}},{offsety:33,allowSelected:!1,data:{type:c_pageNumPosition.PAGE_NUM_POSITION_BOTTOM,subtype:c_pageNumPosition.PAGE_NUM_POSITION_LEFT}},{offsety:0,allowSelected:!1,data:{type:c_pageNumPosition.PAGE_NUM_POSITION_BOTTOM,subtype:c_pageNumPosition.PAGE_NUM_POSITION_CENTER}},{offsety:165,allowSelected:!1,data:{type:c_pageNumPosition.PAGE_NUM_POSITION_BOTTOM,subtype:c_pageNumPosition.PAGE_NUM_POSITION_RIGHT}}]),itemTemplate:e.template('
')}),s&&this.mnuPageNumberPosPicker.setDisabled(s.disabled),this.mnuTablePicker=new Common.UI.DimensionPicker({el:t("#id-toolbar-menu-tablepicker"),minRows:8,minColumns:10,maxRows:8,maxColumns:10})},onToolbarAfterRender:function(e){var i;this.btnHighlightColor.cmpEl&&(i=t('
'),t("button:first-child",this.btnHighlightColor.cmpEl).append(i),this.btnHighlightColor.currentColor="FFFF00",i.css("background-color","#"+this.btnHighlightColor.currentColor),this.mnuHighlightColorPicker=new Common.UI.ColorPalette({el:t("#id-toolbar-menu-highlight"),colors:["FFFF00","00FF00","00FFFF","FF00FF","0000FF","FF0000","00008B","008B8B","006400","800080","8B0000","808000","FFFFFF","D3D3D3","A9A9A9","000000"]}),this.mnuHighlightColorPicker.select("FFFF00")),this.btnFontColor.cmpEl&&(i=t('
'),t("button:first-child",this.btnFontColor.cmpEl).append(i),i.css("background-color",this.btnFontColor.currentColor||"transparent"),this.mnuFontColorPicker=new Common.UI.ThemeColorPalette({el:t("#id-toolbar-menu-fontcolor")})),this.btnParagraphColor.cmpEl&&(i=t('
'),t("button:first-child",this.btnParagraphColor.cmpEl).append(i),i.css("background-color",this.btnParagraphColor.currentColor||"transparent"),this.mnuParagraphColorPicker=new Common.UI.ThemeColorPalette({el:t("#id-toolbar-menu-paracolor"),transparent:!0})),this.btnContentControls.cmpEl&&(this.mnuControlsColorPicker=new Common.UI.ThemeColorPalette({el:t("#id-toolbar-menu-controls-color"),colors:["000000","993300","333300","003300","003366","000080","333399","333333","800000","FF6600","808000","00FF00","008080","0000FF","666699","808080","FF0000","FF9900","99CC00","339966","33CCCC","3366FF","800080","999999","FF00FF","FFCC00","FFFF00","00FF00","00FFFF","00CCFF","993366","C0C0C0","FF99CC","FFCC99","FFFF99","CCFFCC","CCFFFF","C9C8FF","CC99FF","FFFFFF"]}))},updateMetricUnit:function(){for(var e=this.btnPageMargins.menu.items,i=0;i-1)},onSendThemeColorSchemes:function(t){var i=this;this.mnuColorSchema&&this.mnuColorSchema.items.length>0&&e.each(this.mnuColorSchema.items,function(t){t.remove()}),null==this.mnuColorSchema&&(this.mnuColorSchema=new Common.UI.Menu({cls:"shifted-left",restoreHeight:!0})),this.mnuColorSchema.items=[];var n=e.template(['','',"<% _.each(options.colors, function(color) { %>",'',"<% }) %>","",'<%= caption %>',""].join(""));e.each(t,function(t,e){for(var o=t.get_colors(),s=[],a=2;a<7;a++){var r="#"+Common.Utils.ThemeColor.getHexColor(o[a].get_r(),o[a].get_g(),o[a].get_b());s.push(r)}21==e&&this.mnuColorSchema.addItem({caption:"--"});var l=t.get_name();this.mnuColorSchema.addItem({template:n,cls:"color-schemas-menu",colors:s,caption:e<21?i.SchemeNames[e]||l:l,value:e,checkable:!0,toggleGroup:"menuSchema"})},this)},onCollaborativeChanges:function(){if(!this._state.hasCollaborativeChanges){if(!this.btnCollabChanges.rendered||this._state.previewmode)return void(this.needShowSynchTip=!0);this._state.hasCollaborativeChanges=!0,this.btnCollabChanges.cmpEl.addClass("notify"),this.showSynchTip?(this.btnCollabChanges.updateHint(""),void 0===this.synchTooltip&&this.createSynchTip(),this.synchTooltip.show()):this.btnCollabChanges.updateHint(this.tipSynchronize+Common.Utils.String.platformKey("Ctrl+S")),this.btnSave.setDisabled(!1),Common.Gateway.collaborativeChanges()}},createSynchTip:function(){this.synchTooltip=new Common.UI.SynchronizeTip({extCls:this.mode.customization&&this.mode.customization.compactHeader?void 0:"inc-index",target:this.btnCollabChanges.$el}),this.synchTooltip.on("dontshowclick",function(){this.showSynchTip=!1,this.synchTooltip.hide(), -this.btnCollabChanges.updateHint(this.tipSynchronize+Common.Utils.String.platformKey("Ctrl+S")),Common.localStorage.setItem("de-hide-synch",1)},this),this.synchTooltip.on("closeclick",function(){this.synchTooltip.hide(),this.btnCollabChanges.updateHint(this.tipSynchronize+Common.Utils.String.platformKey("Ctrl+S"))},this)},synchronizeChanges:function(){if(!this._state.previewmode&&this.btnCollabChanges.rendered){var t=this;t.btnCollabChanges.cmpEl.hasClass("notify")&&(t.btnCollabChanges.cmpEl.removeClass("notify"),this.synchTooltip&&this.synchTooltip.hide(),this.btnCollabChanges.updateHint(this.btnSaveTip),this.btnSave.setDisabled(!t.mode.forcesave),this._state.hasCollaborativeChanges=!1)}},onApiUsersChanged:function(t){var i=[];e.each(t,function(t){t.asc_getView()||i.push(t)});var n=this,o=e.size(i),s=o>1?"btn-save-coauth":"btn-save";s!==n.btnSaveCls&&n.btnCollabChanges.rendered&&(n.btnSaveTip=(o>1?n.tipSaveCoauth:n.tipSave)+Common.Utils.String.platformKey("Ctrl+S"),n.btnCollabChanges.updateHint(n.btnSaveTip),n.btnCollabChanges.$icon.removeClass(n.btnSaveCls).addClass(s),n.btnSaveCls=s)},onStyleMenuUpdate:function(t,e,i){var n=this;if(n.api){var o=n.api.asc_GetStyleFromFormatting(),s=t.styleTitle,a=o.get_Link();o.put_Name(s),a.put_Name(s+"_character"),n.api.asc_AddNewStyle(o),setTimeout(function(){n.listStyles.openButton.menu.hide()},100)}},onStyleMenuDelete:function(t,e,i){this.api&&this.api.asc_RemoveStyle(t.styleTitle)},onStyleMenuRestoreAll:function(t,i,n){var o=this;o.api&&e.each(window.styles.get_MergedStyles(),function(t){o.api.asc_IsStyleDefault(t.get_Name())&&o.api.asc_RemoveStyle(t.get_Name())})},onStyleMenuDeleteAll:function(t,e,i){this.api&&this.api.asc_RemoveAllCustomStyles()},textBold:"Bold",textItalic:"Italic",textUnderline:"Underline",textStrikeout:"Strikeout",textSuperscript:"Superscript",textSubscript:"Subscript",strMenuNoFill:"No Fill",tipFontName:"Font Name",tipFontSize:"Font Size",tipParagraphStyle:"Paragraph Style",tipCopy:"Copy",tipPaste:"Paste",tipUndo:"Undo",tipRedo:"Redo",tipPrint:"Print",tipSave:"Save",tipIncFont:"Increment font size",tipDecFont:"Decrement font size",tipHighlightColor:"Highlight color",tipFontColor:"Font color",tipMarkers:"Bullets",tipNumbers:"Numbering",tipMultilevels:"Outline",tipAlignLeft:"Align Left",tipAlignRight:"Align Right",tipAlignCenter:"Align Center",tipAlignJust:"Justified",tipDecPrLeft:"Decrease Indent",tipIncPrLeft:"Increase Indent",tipShowHiddenChars:"Nonprinting Characters",tipLineSpace:"Paragraph Line Spacing",tipPrColor:"Background color",tipInsertTable:"Insert Table",tipInsertImage:"Insert Image",tipPageBreak:"Insert Page or Section break",tipInsertNum:"Insert Page Number",tipClearStyle:"Clear Style",tipCopyStyle:"Copy Style",tipPageSize:"Page Size",tipPageOrient:"Page Orientation",tipBack:"Back",tipInsertShape:"Insert Autoshape",tipInsertEquation:"Insert Equation",mniImageFromFile:"Image from File",mniImageFromUrl:"Image from URL",mniCustomTable:"Insert Custom Table",textTitleError:"Error",textInsertPageNumber:"Insert page number",textToCurrent:"To Current Position",tipEditHeader:"Edit header or footer",mniEditHeader:"Edit Document Header",mniEditFooter:"Edit Document Footer",mniHiddenChars:"Nonprinting Characters",mniHiddenBorders:"Hidden Table Borders",tipSynchronize:"The document has been changed by another user. Please click to save your changes and reload the updates.",textNewColor:"Add New Custom Color",textAutoColor:"Automatic",tipInsertChart:"Insert Chart",tipColorSchemas:"Change Color Scheme",tipInsertText:"Insert Text",tipInsertTextArt:"Insert Text Art",mniEditDropCap:"Drop Cap Settings",textNone:"None",textInText:"In Text",textInMargin:"In Margin",tipDropCap:"Insert drop cap",txtScheme1:"Office",txtScheme2:"Grayscale",txtScheme3:"Apex",txtScheme4:"Aspect",txtScheme5:"Civic",txtScheme6:"Concourse",txtScheme7:"Equity",txtScheme8:"Flow",txtScheme9:"Foundry",txtScheme10:"Median",txtScheme11:"Metro",txtScheme12:"Module",txtScheme13:"Opulent",txtScheme14:"Oriel",txtScheme15:"Origin",txtScheme16:"Paper",txtScheme17:"Solstice",txtScheme18:"Technic",txtScheme19:"Trek",txtScheme20:"Urban",txtScheme21:"Verve",textInsPageBreak:"Insert Page Break",textInsColumnBreak:"Insert Column Break",textInsSectionBreak:"Insert Section Break",textNextPage:"Next Page",textContPage:"Continuous Page",textEvenPage:"Even Page",textOddPage:"Odd Page",tipSaveCoauth:"Save your changes for the other users to see them.",tipMailRecepients:"Mail Merge",textStyleMenuUpdate:"Update from select",textStyleMenuRestore:"Restore to default",textStyleMenuDelete:"Delete style",textStyleMenuRestoreAll:"Restore all to default styles",textStyleMenuDeleteAll:"Delete all custom styles",textStyleMenuNew:"New style from selection",tipColumns:"Insert columns",textColumnsOne:"One",textColumnsTwo:"Two",textColumnsThree:"Three",textColumnsLeft:"Left",textColumnsRight:"Right",tipPageMargins:"Page Margins",textMarginsLast:"Last Custom",textMarginsNormal:"Normal",textMarginsUsNormal:"US Normal",textMarginsNarrow:"Narrow",textMarginsModerate:"Moderate",textMarginsWide:"Wide",textPageMarginsCustom:"Custom margins",textTop:"Top: ",textLeft:"Left: ",textBottom:"Bottom: ",textRight:"Right: ",textPageSizeCustom:"Custom Page Size",textPortrait:"Portrait",textLandscape:"Landscape",textInsertPageCount:"Insert number of pages",tipChangeChart:"Change Chart Type",capBtnInsPagebreak:"Page Break",capBtnInsImage:"Image",capBtnInsTable:"Table",capBtnInsChart:"Chart",textTabFile:"File",textTabHome:"Home",textTabInsert:"Insert",textTabLayout:"Layout",textTabReview:"Review",capBtnInsShape:"Shape",capBtnInsTextbox:"Text Box",capBtnInsTextart:"Text Art",capBtnInsDropcap:"Drop Cap",capBtnInsEquation:"Equation",capBtnInsHeader:"Header/Footer",capBtnColumns:"Columns",capBtnPageOrient:"Orientation",capBtnMargins:"Margins",capBtnPageSize:"Size",tipImgAlign:"Align objects",tipImgGroup:"Group objects",tipImgWrapping:"Wrap text",tipSendForward:"Bring forward",tipSendBackward:"Send backward",capImgAlign:"Align",capImgGroup:"Group",capImgForward:"Bring Forward",capImgBackward:"Send Backward",capImgWrapping:"Wrapping",capBtnComment:"Comment",textColumnsCustom:"Custom Columns",textTabCollaboration:"Collaboration",textTabProtect:"Protection",textTabLinks:"References",capBtnInsControls:"Content Control",textRichControl:"Rich text",textPlainControl:"Plain text",textRemoveControl:"Remove",mniEditControls:"Settings",tipControls:"Insert content control",mniHighlightControls:"Highlight settings",textNoHighlight:"No highlighting",mniImageFromStorage:"Image from Storage",capBtnBlankPage:"Blank Page",tipBlankPage:"Insert blank page",txtDistribHor:"Distribute Horizontally",txtDistribVert:"Distribute Vertically",txtPageAlign:"Align to Page",txtMarginAlign:"Align to Margin",txtObjectsAlign:"Align Selected Objects",capBtnWatermark:"Watermark",textEditWatermark:"Custom Watermark",textRemWatermark:"Remove Watermark",tipWatermark:"Edit watermark",textPictureControl:"Picture",textComboboxControl:"Combo box",textCheckboxControl:"Check box",textDropdownControl:"Drop-down list",textDateControl:"Date",capBtnAddComment:"Add Comment",capBtnInsSymbol:"Symbol",tipInsertSymbol:"Insert symbol",mniDrawTable:"Draw Table",mniEraseTable:"Erase Table",textListSettings:"List Settings",capBtnDateTime:"Date & Time",tipDateTime:"Insert current date and time",capBtnLineNumbers:"Line Numbers",textContinuous:"Continuous",textRestartEachPage:"Restart Each Page",textRestartEachSection:"Restart Each Section",textSuppressForCurrentParagraph:"Suppress for Current Paragraph",textCustomLineNumbers:"Line Numbering Options",tipLineNumbers:"Show line numbers"}}(),DE.Views.Toolbar||{}))}),void 0===Common)var Common={};if(define("documenteditor/main/app/view/StyleTitleDialog",["common/main/lib/util/utils","common/main/lib/component/InputField","common/main/lib/component/Window"],function(){"use strict";DE.Views.StyleTitleDialog=Common.UI.Window.extend(_.extend({options:{width:350,height:196,style:"min-width: 230px;",cls:"modal-dlg",buttons:["ok","cancel"]},initialize:function(t){_.extend(this.options,{title:this.textHeader},t||{}),this.template=['
','",'
','",'
',"
"].join(""),this.options.tpl=_.template(this.template)(this.options),this.options.formats=this.options.formats||[],Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this);var t=this,e=this.getChild();t.inputTitle=new Common.UI.InputField({el:$("#id-dlg-style-title"),allowBlank:!1,blankError:t.txtEmpty,style:"width: 100%;",validateOnBlur:!1,validation:function(e){return!(""==e)||t.txtNotEmpty}}),e.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this)),this.options.formats.unshift({value:-1,displayValue:this.txtSameAs}),this.cmbNextStyle=new Common.UI.ComboBox({el:$("#id-dlg-style-next-par"),style:"width: 100%;",menuStyle:"width: 100%; max-height: 210px;",editable:!1,takeFocusOnClose:!0,cls:"input-group-nr",data:this.options.formats,disabled:0==this.options.formats.length}),this.cmbNextStyle.setValue(-1)},getFocusedComponents:function(){return[this.inputTitle,this.cmbNextStyle]},getDefaultFocusableComponent:function(){return this.inputTitle},getTitle:function(){return this.inputTitle.getValue()},getNextStyle:function(){var t=this.cmbNextStyle.getValue();return-1!=t?t:null},onBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value)},onPrimary:function(t){return this._handleInput("ok"),!1},_handleInput:function(t){if(this.options.handler){if("ok"==t){if(!0!==this.inputTitle.checkValidate())return void this.inputTitle.focus()}this.options.handler.call(this,this,t)}this.close()},textTitle:"Title",textHeader:"Create New Style",txtEmpty:"This field is required",txtNotEmpty:"Field must not be empty",textNextStyle:"Next paragraph style",txtSameAs:"Same as created new style"},DE.Views.StyleTitleDialog||{}))}),define("documenteditor/main/app/view/PageMarginsDialog",["common/main/lib/component/Window","common/main/lib/component/MetricSpinner"],function(){"use strict";DE.Views.PageMarginsDialog=Common.UI.Window.extend(_.extend({options:{width:404,header:!0,style:"min-width: 404px;",cls:"modal-dlg",id:"window-page-margins",buttons:["ok","cancel"]},initialize:function(t){_.extend(this.options,{title:this.textTitle},t||{}),this.template=['
','
','",'
','
','",'
',"
",'
','",'
',"
","
",'
','
','",'
',"
",'
','",'
',"
","
",'
','","
",'
','
',"
","
",'
','",'
',"
",'
','",'
',"
","
",'
','",'
',"
","
"].join(""),this.options.tpl=_.template(this.template)(this.options),this.spinners=[],this._noApply=!1,this.maxMarginsW=this.maxMarginsH=0,this.api=this.options.api,Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this),this.spnTop=new Common.UI.MetricSpinner({el:$("#page-margins-spin-top"),step:.1,width:86,defaultUnit:"cm",value:"1 cm",maxValue:55.88,minValue:-55.87}),this.spnTop.on("change",_.bind(function(t,e,i){this.api&&(this.properties=this.properties?this.properties:new Asc.CDocumentSectionProps,this.properties.put_TopMargin(Common.Utils.Metric.fnRecalcToMM(t.getNumberValue())),this.api.SetDrawImagePreviewMargins("page-margins-preview",this.properties))},this)),this.spinners.push(this.spnTop),this.spnBottom=new Common.UI.MetricSpinner({el:$("#page-margins-spin-bottom"),step:.1,width:86,defaultUnit:"cm",value:"1 cm",maxValue:55.88,minValue:-55.87}),this.spnBottom.on("change",_.bind(function(t,e,i){this.api&&(this.properties=this.properties?this.properties:new Asc.CDocumentSectionProps,this.properties.put_BottomMargin(Common.Utils.Metric.fnRecalcToMM(t.getNumberValue())),this.api.SetDrawImagePreviewMargins("page-margins-preview",this.properties))},this)),this.spinners.push(this.spnBottom),this.spnLeft=new Common.UI.MetricSpinner({el:$("#page-margins-spin-left"),step:.1,width:86,defaultUnit:"cm",value:"1 cm",maxValue:55.88,minValue:0}),this.spnLeft.on("change",_.bind(function(t,e,i){this.api&&(this.properties=this.properties?this.properties:new Asc.CDocumentSectionProps,this.properties.put_LeftMargin(Common.Utils.Metric.fnRecalcToMM(t.getNumberValue())),this.api.SetDrawImagePreviewMargins("page-margins-preview",this.properties))},this)),this.spinners.push(this.spnLeft),this.spnRight=new Common.UI.MetricSpinner({el:$("#page-margins-spin-right"),step:.1,width:86,defaultUnit:"cm",value:"1 cm",maxValue:55.88,minValue:0}),this.spnRight.on("change",_.bind(function(t,e,i){this.api&&(this.properties=this.properties?this.properties:new Asc.CDocumentSectionProps,this.properties.put_RightMargin(Common.Utils.Metric.fnRecalcToMM(t.getNumberValue())),this.api.SetDrawImagePreviewMargins("page-margins-preview",this.properties))},this)),this.spinners.push(this.spnRight),this.spnGutter=new Common.UI.MetricSpinner({el:$("#page-margins-spin-gutter"),step:.1,width:86,defaultUnit:"cm",value:"1 cm",maxValue:55.88,minValue:0}),this.spnGutter.on("change",_.bind(function(t,e,i){this.api&&(this.properties=this.properties?this.properties:new Asc.CDocumentSectionProps,this.properties.put_Gutter(Common.Utils.Metric.fnRecalcToMM(t.getNumberValue())),this.api.SetDrawImagePreviewMargins("page-margins-preview",this.properties))},this)),this.spinners.push(this.spnGutter),this.cmbGutterPosition=new Common.UI.ComboBox({el:$("#page-margins-spin-gutter-position"),menuStyle:"min-width: 86px;",style:"width: 86px;",editable:!1,takeFocusOnClose:!0,cls:"input-group-nr",data:[{value:0,displayValue:this.textLeft},{value:1,displayValue:this.textTop}]}),this.cmbGutterPosition.on("selected",_.bind(function(t,e){this.api&&(this.properties=this.properties?this.properties:new Asc.CDocumentSectionProps,this.properties.put_GutterAtTop(e.value),this.api.SetDrawImagePreviewMargins("page-margins-preview",this.properties))},this)),this.cmbOrientation=new Common.UI.ComboBox({el:$("#page-margins-cmb-orientation"),menuStyle:"min-width: 180px;",style:"width: 180px;",editable:!1,takeFocusOnClose:!0,cls:"input-group-nr",data:[{value:0,displayValue:this.textPortrait},{value:1,displayValue:this.textLandscape}]}),this.cmbOrientation.on("selected",_.bind(function(t,e){if(this.api&&(this.properties=this.properties?this.properties:new Asc.CDocumentSectionProps,this.properties.get_Orientation()!==e.value)){this.properties.put_TopMargin(Common.Utils.Metric.fnRecalcToMM(e.value?this.spnLeft.getNumberValue():this.spnRight.getNumberValue())),this.properties.put_BottomMargin(Common.Utils.Metric.fnRecalcToMM(e.value?this.spnRight.getNumberValue():this.spnLeft.getNumberValue())),this.properties.put_LeftMargin(Common.Utils.Metric.fnRecalcToMM(e.value?this.spnBottom.getNumberValue():this.spnTop.getNumberValue())),this.properties.put_RightMargin(Common.Utils.Metric.fnRecalcToMM(e.value?this.spnTop.getNumberValue():this.spnBottom.getNumberValue()));var i=this.properties.get_H();this.properties.put_H(this.properties.get_W()),this.properties.put_W(i),this.properties.put_Orientation(e.value),this.maxMarginsH=Common.Utils.Metric.fnRecalcFromMM(this.properties.get_H()-2.6),this.maxMarginsW=Common.Utils.Metric.fnRecalcFromMM(this.properties.get_W()-12.7),this.spnTop.setMaxValue(this.maxMarginsH),this.spnBottom.setMaxValue(this.maxMarginsH),this.spnLeft.setMaxValue(this.maxMarginsW),this.spnRight.setMaxValue(this.maxMarginsW),this.spnTop.setValue(Common.Utils.Metric.fnRecalcFromMM(this.properties.get_TopMargin()),!0),this.spnBottom.setValue(Common.Utils.Metric.fnRecalcFromMM(this.properties.get_BottomMargin()),!0),this.spnLeft.setValue(Common.Utils.Metric.fnRecalcFromMM(this.properties.get_LeftMargin()),!0),this.spnRight.setValue(Common.Utils.Metric.fnRecalcFromMM(this.properties.get_RightMargin()),!0),this.api.SetDrawImagePreviewMargins("page-margins-preview",this.properties)}},this)),this.cmbMultiplePages=new Common.UI.ComboBox({el:$("#page-margins-cmb-multiple-pages"),menuStyle:"min-width: 180px;",style:"width: 180px;",editable:!1,takeFocusOnClose:!0,cls:"input-group-nr",data:[{value:0,displayValue:this.textNormal},{value:1,displayValue:this.textMirrorMargins}]}),this.cmbMultiplePages.on("selected",_.bind(function(t,e){0===e.value?(this.window.find("#margin-left-label").html(this.textLeft),this.window.find("#margin-right-label").html(this.textRight),this.cmbGutterPosition.setDisabled(!1)):(this.window.find("#margin-left-label").html(this.textInside),this.window.find("#margin-right-label").html(this.textOutside),this.cmbGutterPosition.setValue(0),this.cmbGutterPosition.setDisabled(!0)),this.api&&(this.properties=this.properties?this.properties:new Asc.CDocumentSectionProps,this.properties.put_MirrorMargins(e.value),this.api.SetDrawImagePreviewMargins("page-margins-preview",this.properties))},this)),this.window=this.getChild(),this.window.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this)),this.updateMetricUnit()},getFocusedComponents:function(){return[this.spnTop,this.spnBottom,this.spnLeft,this.spnRight,this.spnGutter,this.cmbGutterPosition,this.cmbOrientation,this.cmbMultiplePages]},getDefaultFocusableComponent:function(){return this.spnTop},_handleInput:function(t){if(this.options.handler){if("ok"==t){var e=null;if(this.spnLeft.getNumberValue()+this.spnRight.getNumberValue()+(this.cmbGutterPosition.getValue()?0:this.spnGutter.getNumberValue())>this.maxMarginsW?e=this.txtMarginsW:Math.abs(this.spnTop.getNumberValue()+this.spnBottom.getNumberValue()+(this.cmbGutterPosition.getValue()?this.spnGutter.getNumberValue():0))>this.maxMarginsH&&(e=this.txtMarginsH),e)return void Common.UI.warning({title:this.notcriticalErrorTitle,msg:e})}this.options.handler.call(this,this,t)}this.close()},onBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value)},onPrimary:function(t){return this._handleInput("ok"),!1},setSettings:function(t){if(t){this.properties=t,this.maxMarginsH=Common.Utils.Metric.fnRecalcFromMM(t.get_H()-2.6),this.maxMarginsW=Common.Utils.Metric.fnRecalcFromMM(t.get_W()-12.7),this.spnTop.setMaxValue(this.maxMarginsH),this.spnBottom.setMaxValue(this.maxMarginsH),this.spnLeft.setMaxValue(this.maxMarginsW),this.spnRight.setMaxValue(this.maxMarginsW),this.spnTop.setValue(Common.Utils.Metric.fnRecalcFromMM(t.get_TopMargin()),!0),this.spnBottom.setValue(Common.Utils.Metric.fnRecalcFromMM(t.get_BottomMargin()),!0),this.spnLeft.setValue(Common.Utils.Metric.fnRecalcFromMM(t.get_LeftMargin()),!0),this.spnRight.setValue(Common.Utils.Metric.fnRecalcFromMM(t.get_RightMargin()),!0),this.cmbOrientation.setValue(t.get_Orientation()),this.spnGutter.setValue(Common.Utils.Metric.fnRecalcFromMM(t.get_Gutter()),!0),this.cmbGutterPosition.setValue(t.get_GutterAtTop()?1:0);var e=t.get_MirrorMargins();this.cmbMultiplePages.setValue(e?1:0),e&&(this.window.find("#margin-left-label").html(this.textInside),this.window.find("#margin-right-label").html(this.textOutside),this.cmbGutterPosition.setValue(0)),this.cmbGutterPosition.setDisabled(e),this.api&&this.api.SetDrawImagePreviewMargins("page-margins-preview",this.properties)}},getSettings:function(){var t=new Asc.CDocumentSectionProps;return t.put_TopMargin(Common.Utils.Metric.fnRecalcToMM(this.spnTop.getNumberValue())),t.put_BottomMargin(Common.Utils.Metric.fnRecalcToMM(this.spnBottom.getNumberValue())),t.put_LeftMargin(Common.Utils.Metric.fnRecalcToMM(this.spnLeft.getNumberValue())),t.put_RightMargin(Common.Utils.Metric.fnRecalcToMM(this.spnRight.getNumberValue())),t.put_Orientation(this.cmbOrientation.getValue()),t.put_Gutter(Common.Utils.Metric.fnRecalcToMM(this.spnGutter.getNumberValue())),t.put_GutterAtTop(!!this.cmbGutterPosition.getValue()),t.put_MirrorMargins(!!this.cmbMultiplePages.getValue()),t.put_H(this.properties.get_H()),t.put_W(this.properties.get_W()),t},updateMetricUnit:function(){if(this.spinners)for(var t=0;t','',"",'","","",'","","","
','",'
',"
','",'
',"
",'",'
',"
","",'
'].join(""),this.options.tpl=_.template(this.template)(this.options),this.spinners=[],this._noApply=!1,this.isOrientPortrait=!0,Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this),this.spnWidth=new Common.UI.MetricSpinner({el:$("#page-size-spin-width"),step:.1,width:86,defaultUnit:"cm",value:"10 cm",maxValue:118.9,minValue:0}),this.spinners.push(this.spnWidth),this.spnWidth.on("change",_.bind(function(t,e,i,n){!this._noApply&&this.cmbPreset.getValue()>-1&&this.cmbPreset.setValue(-1)},this)),this.spnHeight=new Common.UI.MetricSpinner({el:$("#page-size-spin-height"),step:.1,width:86,defaultUnit:"cm",value:"20 cm",maxValue:118.9,minValue:0}),this.spinners.push(this.spnHeight),this.spnHeight.on("change",_.bind(function(t,e,i,n){!this._noApply&&this.cmbPreset.getValue()>-1&&this.cmbPreset.setValue(-1)},this)),this.cmbPreset=new Common.UI.ComboBox({el:$("#page-size-combo-preset"),cls:"input-group-nr",menuStyle:"min-width: 183px;max-height: 208px;",editable:!1,takeFocusOnClose:!0,scrollAlwaysVisible:!0,data:[{value:0,displayValue:"US Letter",size:[215.9,279.4]},{value:1,displayValue:"US Legal",size:[215.9,355.6]},{value:2,displayValue:"A4",size:[210,297]},{value:3,displayValue:"A5",size:[148,210]},{value:4,displayValue:"B5",size:[176,250]},{value:5,displayValue:"Envelope #10",size:[104.8,241.3]},{value:6,displayValue:"Envelope DL",size:[110,220]},{value:7,displayValue:"Tabloid",size:[279.4,431.8]},{value:8,displayValue:"A3",size:[297,420]},{value:9,displayValue:"Tabloid Oversize",size:[304.8,457.1]},{value:10,displayValue:"ROC 16K",size:[196.8,273]},{value:11,displayValue:"Envelope Choukei 3",size:[119.9,234.9]},{value:12,displayValue:"Super B/A3",size:[330.2,482.5]},{value:13,displayValue:"A0",size:[841,1189]},{value:14,displayValue:"A1",size:[594,841]},{value:16,displayValue:"A2",size:[420,594]},{value:17,displayValue:"A6",size:[105,148]},{value:-1,displayValue:this.txtCustom,size:[]}]}),this.cmbPreset.setValue(-1),this.cmbPreset.on("selected",_.bind(function(t,e){this._noApply=!0,e.value<0||(this.spnWidth.setValue(Common.Utils.Metric.fnRecalcFromMM(this.isOrientPortrait?e.size[0]:e.size[1]),!0),this.spnHeight.setValue(Common.Utils.Metric.fnRecalcFromMM(this.isOrientPortrait?e.size[1]:e.size[0]),!0)),this._noApply=!1},this)),this.getChild().find(".dlg-btn").on("click",_.bind(this.onBtnClick,this)),this.updateMetricUnit()},getFocusedComponents:function(){return[this.cmbPreset,this.spnWidth,this.spnHeight]},getDefaultFocusableComponent:function(){return this.cmbPreset},_handleInput:function(t){this.options.handler&&this.options.handler.call(this,this,t),this.close()},onBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value)},onPrimary:function(t){return this._handleInput("ok"),!1},setSettings:function(t){if(t){this.isOrientPortrait=t.get_W()1&&(!e||3==e),!0),this.toolbar.mniAlignToMargin.setChecked(t<2&&!e||2==e,!0),this.toolbar.mniAlignToPage.setChecked(1==e,!0),this.toolbar.mniDistribHor.setDisabled(t<3&&this.toolbar.mniAlignObjects.isChecked()),this.toolbar.mniDistribVert.setDisabled(t<3&&this.toolbar.mniAlignObjects.isChecked())},onClickMenuAlign:function(t,e,i){ +if(this.btnsCategory[4].setVisible(o==Asc.c_oAscContentControlSpecificType.CheckBox),o==Asc.c_oAscContentControlSpecificType.CheckBox&&(n=t.get_CheckBoxPr())){var p=n.get_CheckedSymbol(),m=n.get_CheckedFont();m&&this.btnEditChecked.cmpEl.css("font-family",m),p&&this.btnEditChecked.setCaption(String.fromCharCode(p)),this.checkedBox={code:p,font:m},p=n.get_UncheckedSymbol(),m=n.get_UncheckedFont(),m&&this.btnEditUnchecked.cmpEl.css("font-family",m),p&&this.btnEditUnchecked.setCaption(String.fromCharCode(p)),this.uncheckedBox={code:p,font:m}}this.type=o;var u=t.get_FormPr();if(this.btnsCategory[6].setVisible(!!u),u){e=u.get_Key(),this.txtKey.setValue(e||""),e=u.get_Label(),this.txtLabel.setValue(e||""),e=u.get_HelpText(),this.textareaHelp.val(e||""),e=u.get_Required(),this.chRequired.setValue(!!e);var g=!0;o==Asc.c_oAscContentControlSpecificType.CheckBox&&n&&(e=n.get_GroupKey(),this.txtGroupKey.setValue(e||""),!(g="string"!=typeof e)&&this.btnsCategory[4].setCaption(this.textRadiobox)),this.$window.find(".group-key").toggleClass("hidden",g)}var b=t.get_TextFormPr();if(this.btnsCategory[5].setVisible(!!b),b){var p=b.get_PlaceHolderSymbol(),m=b.get_PlaceHolderFont();m&&this.btnEditPlaceholder.cmpEl.css("font-family",m),p&&this.btnEditPlaceholder.setCaption(String.fromCharCode(p)),this.placeholder={code:p,font:m},e=b.get_Comb(),this.chComb.setValue(!!e,!0),this.btnEditPlaceholder.setDisabled(!e),this.spnWidth.setDisabled(!e),e=b.get_MaxCharacters(),this.chMaxChars.setValue(e&&e>=0,!0),this.spnMaxChars.setDisabled(!e||e<0),this.spnMaxChars.setValue(e&&e>=0?e:10),e=b.get_Width(),this.spnWidth.setValue(0!==e&&void 0!==e?Common.Utils.Metric.fnRecalcFromMM(25.4*e/20/72):-1,!0)}o!=Asc.c_oAscContentControlSpecificType.CheckBox&&o!=Asc.c_oAscContentControlSpecificType.Picture||u||this.txtPlaceholder.cmpEl&&this.txtPlaceholder.cmpEl.closest("tr").hide()}},getSettings:function(){var t=new AscCommon.CContentControlPr;if(t.put_Alias(this.txtName.getValue()),t.put_Tag(this.txtTag.getValue()),t.put_PlaceholderText(this.txtPlaceholder.getValue()||" "),t.put_Appearance(this.cmbShow.getValue()),this.isSystemColor)t.put_Color(null);else{var e=Common.Utils.ThemeColor.getRgbColor(this.colors.getColor());t.put_Color(e.get_r(),e.get_g(),e.get_b())}var i=Asc.c_oAscSdtLockType.Unlocked;"checked"==this.chLockDelete.getValue()&&"checked"==this.chLockEdit.getValue()?i=Asc.c_oAscSdtLockType.SdtContentLocked:"checked"==this.chLockDelete.getValue()?i=Asc.c_oAscSdtLockType.SdtLocked:"checked"==this.chLockEdit.getValue()&&(i=Asc.c_oAscSdtLockType.ContentLocked),t.put_Lock(i);var n;if(this.type!=Asc.c_oAscContentControlSpecificType.ComboBox&&this.type!=Asc.c_oAscContentControlSpecificType.DropDownList||(n=this.type==Asc.c_oAscContentControlSpecificType.ComboBox?this.props.get_ComboBoxPr():this.props.get_DropDownListPr(),n.clear(),this.list.store.each(function(t,e){n.add_Item(t.get("name"),t.get("value"))}),this.type==Asc.c_oAscContentControlSpecificType.ComboBox?t.put_ComboBoxPr(n):t.put_DropDownListPr(n)),this.type==Asc.c_oAscContentControlSpecificType.DateTime&&(n=this.props.get_DateTimePr(),n.put_DateFormat(this.txtDate.getValue()),n.put_LangId(this.cmbLang.getValue()),t.put_DateTimePr(n)),this.type==Asc.c_oAscContentControlSpecificType.CheckBox&&(this.checkedBox&&this.checkedBox.changed||this.uncheckedBox&&this.uncheckedBox.changed)&&(n=this.props.get_CheckBoxPr(),this.checkedBox&&(n.put_CheckedSymbol(this.checkedBox.code),n.put_CheckedFont(this.checkedBox.font)),this.uncheckedBox&&(n.put_UncheckedSymbol(this.uncheckedBox.code),n.put_UncheckedFont(this.uncheckedBox.font)),t.put_CheckBoxPr(n)),this.btnsCategory[6].isVisible()){var o=new AscCommon.CSdtFormPr;o.put_Key(this.txtKey.getValue()),o.put_Label(this.txtLabel.getValue()),o.put_Required("checked"==this.chRequired.getValue()),this.isHelpChanged&&o.put_HelpText(this.textareaHelp.val()),this.type!=Asc.c_oAscContentControlSpecificType.CheckBox||this.$window.find(".group-key").hasClass("hidden")||(n=this.props.get_CheckBoxPr())&&(n.put_GroupKey(this.txtGroupKey.getValue()),t.put_CheckBoxPr(n)),t.put_FormPr(o)}if(this.btnsCategory[5].isVisible()){var s=new AscCommon.CSdtTextFormPr;if(this.spnWidth.getValue()){var a=this.spnWidth.getNumberValue();s.put_Width(a<=0?0:parseInt(72*Common.Utils.Metric.fnRecalcToMM(a)*20/25.4))}else s.put_Width(0);this.placeholder&&this.placeholder.changed&&(s.put_PlaceHolderSymbol(this.placeholder.code),s.put_PlaceHolderFont(this.placeholder.font)),s.put_Comb("checked"==this.chComb.getValue());var r="checked"==this.chMaxChars.getValue()||"checked"==this.chComb.getValue();s.put_MaxCharacters(r),r&&s.put_MaxCharacters(this.spnMaxChars.getNumberValue()||10),t.put_TextFormPr(s)}return t},onDlgBtnClick:function(t){var e="object"==typeof t?t.currentTarget.attributes.result.value:t;"ok"==e&&this.handler&&this.handler.call(this,e,this.getSettings()),this.close()},applyAllClick:function(t,e){if(this.api){var i=new AscCommon.CContentControlPr;if(i.put_Appearance(this.cmbShow.getValue()),this.isSystemColor)i.put_Color(null);else{var n=Common.Utils.ThemeColor.getRgbColor(this.colors.getColor());i.put_Color(n.get_r(),n.get_g(),n.get_b())}this.api.asc_SetContentControlProperties(i,null,!0)}},onSelectItem:function(t,e,i){this.disableListButtons(!1)},disableListButtons:function(t){void 0===t&&(t=!this.list.getSelectedRec()),this.btnChange.setDisabled(t),this.btnDelete.setDisabled(t),this.btnUp.setDisabled(t),this.btnDown.setDisabled(t)},onAddItem:function(){var t=this;new DE.Views.EditListItemDialog({store:t.list.store,handler:function(e,i,n){if("ok"==e){var o=t.list.store.add({value:n,name:i});o&&(t.list.selectRecord(o),t.list.scrollToRecord(o),t.disableListButtons())}t.list.focus()}}).show()},onChangeItem:function(){var t=this,e=this.list.getSelectedRec(),i=new DE.Views.EditListItemDialog({store:t.list.store,handler:function(i,n,o){"ok"==i&&e&&e.set({value:o,name:n}),t.list.focus()}});e&&i.show(),e&&i.setSettings({name:e.get("name"),value:e.get("value")})},onDeleteItem:function(t,e){var i=this.list.getSelectedRec();if(i){var n=this.list.store,o=_.indexOf(n.models,i);n.remove(i),o>n.length-1&&(o=n.length-1),n.length>0&&(this.list.selectByIndex(o),this.list.scrollToRecord(n.at(o)))}this.disableListButtons(),this.list.focus()},onMoveItem:function(t){var e=this.list.store,i=e.length,n=this.list.getSelectedRec();if(n){var o=e.indexOf(n);e.add(e.remove(n),{at:t?Math.max(0,o-1):Math.min(i-1,o+1)}),this.list.selectRecord(n),this.list.scrollToRecord(n)}this.list.focus()},updateFormats:function(t){if(this.datetime){for(var e=this.datetime,i=e.get_FormatsExamples(),n=[],o=0,s=i.length;o','
','
',"
",""].join(""),this.options.tpl=_.template(this.template)(this.options),this.props=this.options.props,Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this),this.spnStart=new Common.UI.CustomSpinner({el:$("#id-spin-set-value"),step:1,width:182,defaultUnit:"",value:1,maxValue:16383,minValue:0,allowDecimal:!1,maskExp:/[0-9]/}),this.getChild().find(".dlg-btn").on("click",_.bind(this.onBtnClick,this)),this.spnStart.on("entervalue",_.bind(this.onPrimary,this)),this.spnStart.$el.find("input").focus(),this.afterRender()},afterRender:function(){this._setDefaults(this.props)},_setDefaults:function(t){t&&(this.spnStart.setValue(t.start),this.onFormatSelect(t.format))},_handleInput:function(t){this.options.handler&&this.options.handler.call(this,t,this.getSettings()),this.close()},onBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value)},getSettings:function(){return this.spnStart.getNumberValue()},onPrimary:function(){return this._handleInput("ok"),!1},onFormatSelect:function(t){var e=/[0-9]/,i=this;switch(t){case Asc.c_oAscNumberingFormat.UpperRoman:this.spnStart.options.toCustomFormat=this._10toRome,this.spnStart.options.fromCustomFormat=this._Rometo10,e=/[IVXLCDM]/;break;case Asc.c_oAscNumberingFormat.LowerRoman:this.spnStart.options.toCustomFormat=function(t){return i._10toRome(t).toLocaleLowerCase()},this.spnStart.options.fromCustomFormat=function(t){return i._Rometo10(t.toLocaleUpperCase())},e=/[ivxlcdm]/;break;case Asc.c_oAscNumberingFormat.UpperLetter:this.spnStart.options.toCustomFormat=this._10toS,this.spnStart.options.fromCustomFormat=this._Sto10,e=/[A-Z]/;break;case Asc.c_oAscNumberingFormat.LowerLetter:this.spnStart.options.toCustomFormat=function(t){return i._10toS(t).toLocaleLowerCase()},this.spnStart.options.fromCustomFormat=function(t){return i._Sto10(t.toLocaleUpperCase())},e=/[a-z]/;break;default:this.spnStart.options.toCustomFormat=function(t){return t},this.spnStart.options.fromCustomFormat=function(t){return t}}this.spnStart.setMask(e),this.spnStart.setValue(this.spnStart.getValue())},_10toS:function(t){t=parseInt(t);for(var e=Math.ceil(t/26),i=String.fromCharCode((t-1)%26+"A".charCodeAt(0)),n="",o=0;o0;)n=i[s][1],o=t-n,o>=0?(e+=i[s][0],t=o):s++;return e},_Rometo10:function(t){if(!/[IVXLCDM]/.test(t)||t.length<1)return 1;for(var e={I:1,V:5,X:10,L:50,C:100,D:500,M:1e3},i=t.length-1,n=e[t.charAt(i)],o=n,s=i-1;s>=0;s--){var a=e[t.charAt(s)];if(a10)return 1;a*=-1}n+=a,o=Math.abs(a)}return n}},DE.Views.NumberingValueDialog||{}))}),define("documenteditor/main/app/view/CellsAddDialog",["common/main/lib/component/Window","common/main/lib/component/ComboBox","common/main/lib/component/MetricSpinner","common/main/lib/component/RadioBox"],function(){"use strict";DE.Views.CellsAddDialog=Common.UI.Window.extend(_.extend({options:{width:214,header:!0,style:"min-width: 214px;",cls:"modal-dlg",buttons:["ok","cancel"]},initialize:function(t){_.extend(this.options,{title:this.textTitle},t||{}),this.template=['
','
','
','
',"
",'
','
',"
"].join(""),this.options.tpl=_.template(this.template)(this.options),Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this),this.cmbRowCol=new Common.UI.ComboBox({el:$("#table-combo-row-col"),cls:"input-group-nr",style:"width: 110px;",menuStyle:"min-width: 110px;",editable:!1,takeFocusOnClose:!0,scrollAlwaysVisible:!0,data:[{value:0,displayValue:this.textRow},{value:1,displayValue:this.textCol}]}),this.cmbRowCol.setValue(0),this.cmbRowCol.on("selected",_.bind(function(t,e){var i=0==e.value;this.spnCount.setMaxValue(i?100:64),this.spnCount.setValue(this.spnCount.getNumberValue()),this.radioBefore.setCaption(i?this.textUp:this.textLeft),this.radioAfter.setCaption(i?this.textDown:this.textRight)},this)),this.spnCount=new Common.UI.MetricSpinner({el:$("#table-spin-row-col"),step:1,width:65,value:1,defaultUnit:"",maxValue:100,minValue:1,allowDecimal:!1}),this.radioBefore=new Common.UI.RadioBox({el:$("#table-radio-before"),labelText:this.textUp,name:"asc-radio-table-cells-add",checked:!0}),this.radioAfter=new Common.UI.RadioBox({el:$("#table-radio-after"),labelText:this.textDown,name:"asc-radio-table-cells-add"}),this.getChild().find(".dlg-btn").on("click",_.bind(this.onBtnClick,this))},getFocusedComponents:function(){return[this.cmbRowCol,this.spnCount]},getDefaultFocusableComponent:function(){return this.spnCount},_handleInput:function(t){this.options.handler&&this.options.handler.call(this,t,this.getSettings()),this.close()},onBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value)},getSettings:function(){return{row:0==this.cmbRowCol.getValue(),before:this.radioBefore.getValue(),count:this.spnCount.getNumberValue()}},onPrimary:function(){return this._handleInput("ok"),!1},textTitle:"Insert Several",textLeft:"To the left",textRight:"To the right",textUp:"Above the cursor",textDown:"Below the cursor",textRow:"Rows",textCol:"Columns"},DE.Views.CellsAddDialog||{}))}),define("documenteditor/main/app/view/DocumentHolder",["jquery","underscore","backbone","gateway","common/main/lib/util/utils","common/main/lib/component/Menu","common/main/lib/component/Calendar","common/main/lib/view/InsertTableDialog","common/main/lib/view/CopyWarningDialog","common/main/lib/view/OptionsDialog","documenteditor/main/app/view/DropcapSettingsAdvanced","documenteditor/main/app/view/HyperlinkSettingsDialog","documenteditor/main/app/view/ParagraphSettingsAdvanced","documenteditor/main/app/view/TableSettingsAdvanced","documenteditor/main/app/view/ControlSettingsDialog","documenteditor/main/app/view/NumberingValueDialog","documenteditor/main/app/view/CellsAddDialog"],function(t,e,i,n){"use strict";DE.Views.DocumentHolder=i.View.extend(e.extend({el:"#editor_sdk",template:null,events:{},initialize:function(){var i=this,n=DE.getCollection("Common.Collections.Users");i._TtHeight=20,i._currentSpellObj=void 0,i._currLang={},i.usertips=[],i.fastcoauthtips=[],i._currentMathObj=void 0,i._currentParaObjDisabled=!1,i._isDisabled=!1,i._state={};var o=function(n,o,s,a,r){if(!e.isUndefined(n)&&null!==n){Common.UI.Menu.Manager.hideAll();var l=[s.get_X(),s.get_Y()],c=t(i.el).find(Common.Utils.String.format("#menu-container-{0}",n.id));n.rendered||(c.length<1&&(c=t(Common.Utils.String.format('',n.id)),t(i.el).append(c)),n.render(c),n.cmpEl.attr({tabindex:"-1"})),c.css({left:l[0],top:l[1]}),n.show(),e.isFunction(n.options.initMenu)&&(n.options.initMenu(o),n.alignPosition()),e.delay(function(){n.cmpEl.focus()},10),i.currentMenu=n}},s=function(t){if(t&&e.isArray(t)){for(var n={},o=i.textMenu,s=!0,a=0;a0&&i.api.zoomIn(),t.preventDefault(),t.stopPropagation())}},h=function(e){if(i.api){var n=e.keyCode;if((e.ctrlKey||e.metaKey)&&!e.shiftKey&&!e.altKey){if(n===Common.UI.Keys.NUM_PLUS||n===Common.UI.Keys.EQUALITY||Common.Utils.isGecko&&n===Common.UI.Keys.EQUALITY_FF||Common.Utils.isOpera&&43==n)return i.api.zoomIn(),e.preventDefault(),e.stopPropagation(),!1;if(n===Common.UI.Keys.NUM_MINUS||n===Common.UI.Keys.MINUS||Common.Utils.isGecko&&n===Common.UI.Keys.MINUS_FF||Common.Utils.isOpera&&45==n)return i.api.zoomOut(),e.preventDefault(),e.stopPropagation(),!1;if(48===n||96===n)return i.api.zoom(100),e.preventDefault(),e.stopPropagation(),!1}i.currentMenu&&i.currentMenu.isVisible()&&(n!=Common.UI.Keys.UP&&n!=Common.UI.Keys.DOWN||t("ul.dropdown-menu",i.currentMenu.el).focus()),n==Common.UI.Keys.ESC&&(Common.UI.Menu.Manager.hideAll(),Common.NotificationCenter.trigger("leftmenu:change","hide"))}},p=function(e){i._XY=[i.cmpEl.offset().left-t(window).scrollLeft(),i.cmpEl.offset().top-t(window).scrollTop()],i._Height=i.cmpEl.height(),i._BodyWidth=t("body").width()},m=function(e){var n=i.cmpEl;if(n){n.on("contextmenu",function(t){return t.preventDefault(),t.stopPropagation(),!1}),n.on("click",function(t){"canvas"==t.target.localName&&(i._preventClick?i._preventClick=!1:n.focus())}),n.on("mousedown",function(t){"canvas"==t.target.localName&&Common.UI.Menu.Manager.hideAll()});var o=/Firefox/i.test(navigator.userAgent)?"DOMMouseScroll":"mousewheel";!function(t,e,i){t.addEventListener?t.addEventListener(e,i,!1):t.attachEvent("on"+e,i)}(i.el,o,d)}t(document).on("mousewheel",d),t(document).on("keydown",h),t(window).on("resize",p),DE.getController("Viewport").getView("Viewport").hlayout.on("layout:resizedrag",p)},u=function(t){if(n){var e=n.findUser(t);if(e)return Common.Utils.UserInfoParser.getParsedName(e.get("username"));if("string"==typeof t){var o,s=t.slice(0,-1);if(n.models.some(function(t){if(t.attributes&&t.attributes.idOriginal===s)return o=t,!0}),o&&o.attributes.username)return o.attributes.username}}return i.guestText},g={toolTip:new Common.UI.Tooltip({owner:this,html:!0,title:"
Press Ctrl and click link",cls:"link-tooltip"}),strTip:"",isHidden:!0,isVisible:!1},b=!0,f=function(t,e,n){!0===b&&(b=new Common.UI.Tooltip({owner:t.currentTarget,title:i.tipIsLocked}),b.show())},C=function(){if("object"==typeof b){b.hide(),b=void 0;for(var t=0;t0&&("object"==typeof b&&(b.hide(),b=!0),e.each(i.usertips,function(t){t.remove()})),i.usertips=[],i.usertipcount=0},w=null,x=!1,S=function(){g.isHidden&&g.isVisible&&(g.isVisible=!1,x=!0,g.toolTip.hide(function(){x=!1,w&&A(w),w=null}))},A=function(n){if(void 0===i._XY&&(i._XY=[i.cmpEl.offset().left-t(window).scrollLeft(),i.cmpEl.offset().top-t(window).scrollTop()],i._Height=i.cmpEl.height(),i._BodyWidth=t("body").width()),n){var o,s,a=n.get_Type();if(a==Asc.c_oAscMouseMoveDataTypes.Hyperlink||a==Asc.c_oAscMouseMoveDataTypes.Footnote||a==Asc.c_oAscMouseMoveDataTypes.Form){if(x)return void(w=n);if(a==Asc.c_oAscMouseMoveDataTypes.Hyperlink){var r=n.get_Hyperlink();if(!r)return;s=e.isEmpty(r.get_ToolTip())?r.get_Value():r.get_ToolTip()}else a==Asc.c_oAscMouseMoveDataTypes.Footnote?(s=n.get_FootnoteText(),s.length>1e3&&(s=s.substr(0,1e3)+"...")):a==Asc.c_oAscMouseMoveDataTypes.Form&&(s=n.get_FormHelpText(),s.length>1e3&&(s=s.substr(0,1e3)+"..."));var l=!1;g.isHidden=!1,s=Common.Utils.String.htmlEncode(s),(g.tipType!==a||g.tipLength!==s.length||g.strTip.indexOf(s)<0)&&(g.toolTip.setTitle(a==Asc.c_oAscMouseMoveDataTypes.Hyperlink?s+"
"+i.txtPressLink+"":s),g.tipLength=s.length,g.strTip=s,g.tipType=a,l=!0),o=[n.get_X(),n.get_Y()],o[1]+=i._XY[1]-15,o[0]+=i._XY[0]+5,g.isVisible&&!l||(g.isVisible=!0,g.toolTip.show([-1e4,-1e4])),l&&(g.tipHeight=g.toolTip.getBSTip().$tip.height(),g.tipWidth=g.toolTip.getBSTip().$tip.width()),l=!1,o[0]+g.tipWidth>i._BodyWidth&&(o[0]=i._BodyWidth-g.tipWidth,l=!0),o[1]-g.tipHeight<0?o[1]=l?o[1]+30:0:o[1]-=g.tipHeight,g.toolTip.getBSTip().$tip.css({top:o[1]+"px",left:o[0]+"px"})}else if(n.get_Type()==Asc.c_oAscMouseMoveDataTypes.LockedObject&&i.mode.isEdit){var c;i.usertipcount>=i.usertips.length&&(c=t(document.createElement("div")),c.addClass("username-tip"),c.css({height:i._TtHeight+"px",position:"absolute",zIndex:"900",visibility:"visible"}),t(document.body).append(c),b&&(c.on("mouseover",f),c.on("mouseout",v)),i.usertips.push(c)),c=i.usertips[i.usertipcount],i.usertipcount++,s=u(n.get_UserId()),o=[n.get_X()+i._XY[0],n.get_Y()+i._XY[1]];var d=o[0];o[0]=i._BodyWidth-o[0],o[1]-=2==n.get_LockedObjectType()?i._TtHeight:0,o[1]>i._XY[1]&&o[1]+i._TtHeight
'),i.cmpEl.append(s),i.btnSpecialPaste=new Common.UI.Button({parentEl:t("#id-document-holder-btn-special-paste"),cls:"btn-toolbar",iconCls:"toolbar__icon btn-paste",menu:new Common.UI.Menu({items:[]})})),a.length>0){for(var r=i.btnSpecialPaste.menu,l=0;l0&&r.items[0].setChecked(!0,!0)}if(o.asc_getX()<0||o.asc_getY()<0)s.is(":visible")&&s.hide();else{var c=[o.asc_getX()+o.asc_getWidth()+3,o.asc_getY()+o.asc_getHeight()+3];s.css({left:c[0],top:c[1]}),s.show()}}},P=function(){var t=i.cmpEl.find("#special-paste-container");t.is(":visible")&&t.hide()},M=function(){var t,n,o;if(i.api&&i.mode.isEdit&&!i._isDisabled&&!DE.getController("LeftMenu").leftMenu.menuFile.isVisible()){var s=function(t,e){"ok"==e&&(n=t.getSettings(),!1!==o?i.api.add_Hyperlink(n):i.api.change_Hyperlink(n)),i.fireEvent("editcomplete",i)};if(!1!==(o=i.api.can_AddHyperlink()))t=new DE.Views.HyperlinkSettingsDialog({api:i.api,handler:s}),n=new Asc.CHyperlinkProperty,n.put_Text(o),t.show(),t.setSettings(n);else{var a=i.api.getSelectedElements();a&&e.isArray(a)&&e.each(a,function(t,e){a[e].get_ObjectType()==Asc.c_oAscTypeSelectElement.Hyperlink&&(n=a[e].get_ObjectValue())}),n&&(t=new DE.Views.HyperlinkSettingsDialog({api:i.api,handler:s}),t.show(),t.setSettings(n))}Common.component.Analytics.trackEvent("DocumentHolder","Add Hyperlink")}},E=function(t){if(i.mode.isEdit&&!i._isDisabled){var e=DE.getController("Common.Controllers.ExternalDiagramEditor").getView("Common.Views.ExternalDiagramEditor");e&&t&&(e.setEditMode(!0),e.show(),e.setChartData(new Asc.asc_CChartBinary(t)))}},U=function(){i.mode.isEdit=!1},V=function(t){i._currLang.id=t};this.changeLanguageMenu=function(t){if(null===i._currLang.id||void 0===i._currLang.id)t.clearAll();else{var n=e.findIndex(t.items,{langid:i._currLang.id});n>-1&&!t.items[n].checked&&t.setChecked(n,!0)}};var B=function(){var t,n=i.api.getSelectedElements(!0);if(n&&e.isArray(n))for(var o=0;o0?(n.setVisible(r.length>3),n.setDisabled(i._currentParaObjDisabled),e.each(r,function(t,e){var n=new Common.UI.MenuItem({caption:t,spellword:!0,disabled:i._currentParaObjDisabled}).on("click",function(t,e){i.api&&(i.api.asc_replaceMisspelledWord(t.caption,i._currentSpellObj),i.fireEvent("editcomplete",i))});e<3?s.push(n):a.push(n)}),s.length>0&&(t?e.each(s,function(t,e){i.textMenu.insertItem(e,t)}):e.each(s,function(t,e){i.menuSpellCheckTable.menu.insertItem(e,t)})),a.length>0&&e.each(a,function(t,e){n.menu.addItem(t)}),o.setVisible(!1)):(n.setVisible(!1),o.setVisible(!0),o.setCaption(i.noSpellVariantsText,!0))}},this.clearWordVariants=function(t){for(var e=t?i.textMenu:i.menuSpellCheckTable.menu,n=0;n0&&e.each(s,function(t,s){t.menu?e.each(t.menu.items,function(t){t.on("click",e.bind(i.equationCallback,i,t.options.equationProps))}):t.on("click",e.bind(i.equationCallback,i,t.options.equationProps)),o.insertItem(n,t),n++}),s.length},this.clearEquationMenu=function(t,n){for(var o=t?i.textMenu:i.tableMenu,s=n;s=0;r--){var l,c;if(l=a[r].get_ObjectType(),c=a[r].get_ObjectValue(),Asc.c_oAscTypeSelectElement.Paragraph==l){o=new DE.Views.ParagraphSettingsAdvanced({tableStylerRows:2,tableStylerColumns:1,paragraphProps:c,borderProps:s.borderAdvancedProps,isChart:!0===t.isChart,api:s.api,handler:function(t,e){"ok"==t&&s.api&&(s.borderAdvancedProps=e.borderProps,s.api.paraApply(e.paragraphProps)),s.fireEvent("editcomplete",s)}});break}}}if(o)return o.show(),o},advancedFrameClick:function(t,e,i,n){Common.NotificationCenter.trigger("dropcap:settings",t)},advancedTableClick:function(t,i,n){var o,s=this;if(s.api){var a=s.api.getSelectedElements();if(a&&e.isArray(a))for(var r=a.length-1;r>=0;r--){var l,c;if(l=a[r].get_ObjectType(),c=a[r].get_ObjectValue(),Asc.c_oAscTypeSelectElement.Table==l){o=new DE.Views.TableSettingsAdvanced({tableStylerRows:null===c.get_CellBorders().get_InsideH()&&1==c.get_CellSelect()?1:2,tableStylerColumns:null===c.get_CellBorders().get_InsideV()&&1==c.get_CellSelect()?1:2,tableProps:c,borderProps:s.borderAdvancedProps,sectionProps:s.api.asc_GetSectionProps(),handler:function(t,e){"ok"==t&&s.api&&(s.borderAdvancedProps=e.borderProps,s.api.tblApply(e.tableProps)),s.fireEvent("editcomplete",s)}});break}}}if(o)return o.show(),o},onRulerDblClick:function(e){Common.UI.Menu.Manager.hideAll();var i,n=this;if("tables"==e)(i=this.advancedTableClick())&&i.setActiveCategory(4);else if("indents"==e||"tabs"==e)(i=this.advancedParagraphClick({isChart:!1}))&&i.setActiveCategory("indents"==e?0:3);else if("margins"==e){if(n._state.lock_doc)return;i=new DE.Views.PageMarginsDialog({api:n.api,handler:function(e,i){if("ok"==i){var o=e.getSettings(),s=DE.getController("Toolbar").toolbar.btnPageMargins.menu.items[0];s.setVisible(!0),s.setChecked(!0),s.options.value=s.value=[o.get_TopMargin(),o.get_LeftMargin(),o.get_BottomMargin(),o.get_RightMargin()],t(s.el).html(s.template({id:Common.UI.getId(),caption:s.caption,options:s.options})),Common.localStorage.setItem("de-pgmargins-top",o.get_TopMargin()),Common.localStorage.setItem("de-pgmargins-left",o.get_LeftMargin()),Common.localStorage.setItem("de-pgmargins-bottom",o.get_BottomMargin()),Common.localStorage.setItem("de-pgmargins-right",o.get_RightMargin()),n.api.asc_SetSectionProps(o),n.fireEvent("editcomplete",n)}}}),i.show(),i.setSettings(n.api.asc_GetSectionProps())}else"columns"==e&&(i=new DE.Views.CustomColumnsDialog({handler:function(t,e){"ok"==e&&(n.api.asc_SetColumnsProps(t.getSettings()),n.fireEvent("editcomplete",n))}}),i.show(),i.setSettings(n.api.asc_GetColumnsProps()))},editHyperlink:function(t,e,i){var n,o=this;o.api&&(n=new DE.Views.HyperlinkSettingsDialog({api:o.api,handler:function(t,e){"ok"==e&&o.api.change_Hyperlink(n.getSettings()),o.fireEvent("editcomplete",o)}}),n.show(),n.setSettings(t.hyperProps.value))},onMenuSaveStyle:function(t,e,i){var n=this;n.api&&Common.NotificationCenter.trigger("style:commitsave",n.api.asc_GetStyleFromFormatting())},onMenuUpdateStyle:function(t,e,i){var n=this;n.api&&Common.NotificationCenter.trigger("style:commitchange",n.api.asc_GetStyleFromFormatting())},addComment:function(t,e,i){if(this.api&&this.mode.canCoAuthoring&&this.mode.canComments){this.suppressEditComplete=!0;var n=DE.getController("Common.Controllers.Comments");n&&n.addDummyComment()}},addHyperlink:function(t,e,i){var n,o=this;o.api&&(n=new DE.Views.HyperlinkSettingsDialog({api:o.api,handler:function(t,e){"ok"==e&&o.api.add_Hyperlink(t.getSettings()),o.fireEvent("editcomplete",o)}}),n.show(),n.setSettings(t.hyperProps.value),Common.component.Analytics.trackEvent("DocumentHolder","Add Hyperlink"))},editChartClick:function(){var t=DE.getController("Common.Controllers.ExternalDiagramEditor").getView("Common.Views.ExternalDiagramEditor");if(t){t.setEditMode(!0),t.show();var e=this.api.asc_getChartObject();e&&t.setChartData(new Asc.asc_CChartBinary(e))}},onCutCopyPaste:function(t,e){var i=this;if(i.api){("cut"==t.value?i.api.Cut():"copy"==t.value?i.api.Copy():i.api.Paste())||Common.localStorage.getBool("de-hide-copywarning")||new Common.Views.CopyWarningDialog({handler:function(t){t&&Common.localStorage.setItem("de-hide-copywarning",1),i.fireEvent("editcomplete",i)}}).show()}i.fireEvent("editcomplete",i)},onPrintSelection:function(t){if(this.api){var e=new Asc.asc_CAdjustPrint;e.asc_setPrintType(Asc.c_oAscPrintType.Selection);var i=new Asc.asc_CDownloadOptions(null,Common.Utils.isChrome||Common.Utils.isSafari||Common.Utils.isOpera);i.asc_setAdvancedOptions(e),this.api.asc_Print(i),this.fireEvent("editcomplete",this),Common.component.Analytics.trackEvent("DocumentHolder","Print Selection")}},onControlsSelect:function(t,e){var i=this,n=this.api.asc_GetContentControlProperties();n&&("settings"==t.value?new DE.Views.ControlSettingsDialog({props:n,api:i.api,handler:function(t,e){"ok"==t&&i.api.asc_SetContentControlProperties(e,n.get_InternalId()),i.fireEvent("editcomplete",i)}}).show():"remove"==t.value&&(n.get_FormPr()?this.api.asc_RemoveContentControl(n.get_InternalId()):this.api.asc_RemoveContentControlWrapper(n.get_InternalId()))),i.fireEvent("editcomplete",i)},onInsertCaption:function(){var t=this;new DE.Views.CaptionDialog({isObject:!0,handler:function(e,i){"ok"==e&&t.api.asc_AddObjectCaption(i),t.fireEvent("editcomplete",t)}}).show()},onContinueNumbering:function(t,e){this.api.asc_ContinueNumbering(),this.fireEvent("editcomplete",this)},onStartNumbering:function(t,e,i){if(1==t)this.api.asc_RestartNumbering(e.value.start);else{var n=this;new DE.Views.NumberingValueDialog({title:n.textNumberingValue,props:e.value,handler:function(t,e){"ok"==t&&n.api.asc_RestartNumbering(e),n.fireEvent("editcomplete",n)}}).show()}this.fireEvent("editcomplete",this)},onCellsRemove:function(){var t=this;new Common.Views.OptionsDialog({title:t.textTitleCellsRemove,items:[{caption:this.textLeft,value:"left"},{caption:this.textRow,value:"row"},{caption:this.textCol,value:"col"}],handler:function(e,i){if("ok"==i){var n=e.getSettings();"row"==n?t.api.remRow():"col"==n?t.api.remColumn():t.api.asc_RemoveTableCells()}t.fireEvent("editcomplete",t)}}).show(),this.fireEvent("editcomplete",this)},onCellsAdd:function(){var t=this;new DE.Views.CellsAddDialog({handler:function(e,i){"ok"==e&&(i.row?i.before?t.api.addRowAbove(i.count):t.api.addRowBelow(i.count):i.before?t.api.addColumnLeft(i.count):t.api.addColumnRight(i.count)),t.fireEvent("editcomplete",t)}}).show(),this.fireEvent("editcomplete",this)},createDelayedElementsViewer:function(){var t=this,i=new Common.UI.MenuItem({iconCls:"menu__icon btn-copy",caption:t.textCopy,value:"copy"}).on("click",e.bind(t.onCutCopyPaste,t)),n=new Common.UI.MenuItem({iconCls:"menu__icon btn-undo",caption:t.textUndo}).on("click",function(){t.api.Undo()}),o=new Common.UI.MenuItem({caption:"--"}),s=new Common.UI.MenuItem({iconCls:"menu__icon btn-menu-comments",caption:t.addCommentText}).on("click",e.bind(t.addComment,t)),a=new Common.UI.MenuItem({caption:this.strSign,value:0}).on("click",e.bind(t.onSignatureClick,t)),r=new Common.UI.MenuItem({caption:this.strDetails,value:1}).on("click",e.bind(t.onSignatureClick,t)),l=new Common.UI.MenuItem({caption:this.strSetup,value:2}).on("click",e.bind(t.onSignatureClick,t)),c=new Common.UI.MenuItem({caption:this.strDelete,value:3}).on("click",e.bind(t.onSignatureClick,t)),d=new Common.UI.MenuItem({caption:"--"}),h=new Common.UI.MenuItem({iconCls:"menu__icon btn-print",caption:t.txtPrintSelection}).on("click",e.bind(t.onPrintSelection,t));this.viewModeMenu=new Common.UI.Menu({cls:"shifted-right",initMenu:function(p){var m=p.imgProps&&p.imgProps.value&&!e.isNull(p.imgProps.value.get_ChartProperties()),u=p.imgProps&&p.imgProps.value&&!e.isNull(p.imgProps.value.get_ShapeProperties()),g=p.imgProps&&p.imgProps.value&&t.mode.isSignatureSupport?p.imgProps.value.asc_getSignatureId():void 0,b=g?t.api.asc_getSignatureSetup(g):null,f=!!b&&t._canProtect,C=!!p.paraProps&&!(p.paraProps.value.can_DeleteBlockContentControl()&&p.paraProps.value.can_EditBlockContentControl()&&p.paraProps.value.can_DeleteInlineContentControl()&&p.paraProps.value.can_EditInlineContentControl()),v=!m&&!1!==t.api.can_AddQuotedComment()&&t.mode.canCoAuthoring&&t.mode.canComments&&!t._isDisabled&&!C;if(t.mode.compatibleFeatures&&(v=v&&!u),t.api.asc_IsContentControl()){var _=t.api.asc_GetContentControlProperties(),y=_?_.get_SpecificType():Asc.c_oAscContentControlSpecificType.None;v=v&&!(y==Asc.c_oAscContentControlSpecificType.CheckBox||y==Asc.c_oAscContentControlSpecificType.Picture||y==Asc.c_oAscContentControlSpecificType.ComboBox||y==Asc.c_oAscContentControlSpecificType.DropDownList||y==Asc.c_oAscContentControlSpecificType.DateTime)}n.setVisible(t.mode.canCoAuthoring&&t.mode.canComments&&!t._isDisabled),n.setDisabled(!t.api.asc_getCanUndo()&&!t._isDisabled),o.setVisible(f);var w=!!b&&b.asc_getRequested();a.setVisible(f&&w),r.setVisible(f&&!w),l.setVisible(f),c.setVisible(f&&!w),d.setVisible(v),f&&(a.cmpEl.attr("data-value",g),r.cmpEl.attr("data-value",b.asc_getId()),l.cmpEl.attr("data-value",g),c.cmpEl.attr("data-value",g)),s.setVisible(v),s.setDisabled(p.paraProps&&!0===p.paraProps.locked);var x=t.api&&t.api.can_CopyCut();i.setDisabled(!x),h.setVisible(t.mode.canPrint),h.setDisabled(!x)},items:[i,n,h,o,a,r,l,c,d,s]}).on("hide:after",function(e,i,n){if(t.suppressEditComplete)return void(t.suppressEditComplete=!1);n||t.fireEvent("editcomplete",t),t.currentMenu=null})},createDelayedElements:function(){var i=this,n=new Common.UI.MenuItem({caption:i.txtInsertCaption}).on("click",e.bind(i.onInsertCaption,i)),o=new Common.UI.MenuItem({caption:"--"}),s=new Common.UI.MenuItem({caption:i.txtInsertCaption}).on("click",e.bind(i.onInsertCaption,i)),a=new Common.UI.MenuItem({caption:"--"}),r=new Common.UI.MenuItem({caption:i.textAlign,menu:function(){function t(t,e){if(i.api){var n=Common.Utils.InternalSettings.get("de-img-align-to"),o=1==n?Asc.c_oAscObjectsAlignType.Page:i.api.asc_getSelectedDrawingObjectsCount()<2&&!n||2==n?Asc.c_oAscObjectsAlignType.Margin:Asc.c_oAscObjectsAlignType.Selected;t.value<6?(i.api.put_ShapesAlign(t.value,o),Common.component.Analytics.trackEvent("DocumentHolder","Shape Align")):6==t.value?(i.api.DistributeHorizontally(o),Common.component.Analytics.trackEvent("DocumentHolder","Distribute Horizontally")):7==t.value&&(i.api.DistributeVertically(o),Common.component.Analytics.trackEvent("DocumentHolder","Distribute Vertically"))}i.fireEvent("editcomplete",i)}return new Common.UI.Menu({cls:"ppm-toolbar shifted-right",menuAlign:"tl-tr",items:[new Common.UI.MenuItem({caption:i.textShapeAlignLeft,iconCls:"menu__icon shape-align-left",value:Asc.c_oAscAlignShapeType.ALIGN_LEFT}).on("click",t),new Common.UI.MenuItem({caption:i.textShapeAlignCenter,iconCls:"menu__icon shape-align-center",value:Asc.c_oAscAlignShapeType.ALIGN_CENTER}).on("click",t),new Common.UI.MenuItem({caption:i.textShapeAlignRight,iconCls:"menu__icon shape-align-right",value:Asc.c_oAscAlignShapeType.ALIGN_RIGHT}).on("click",t),new Common.UI.MenuItem({caption:i.textShapeAlignTop,iconCls:"menu__icon shape-align-top",value:Asc.c_oAscAlignShapeType.ALIGN_TOP}).on("click",t),new Common.UI.MenuItem({caption:i.textShapeAlignMiddle,iconCls:"menu__icon shape-align-middle",value:Asc.c_oAscAlignShapeType.ALIGN_MIDDLE}).on("click",t),new Common.UI.MenuItem({caption:i.textShapeAlignBottom,iconCls:"menu__icon shape-align-bottom",value:Asc.c_oAscAlignShapeType.ALIGN_BOTTOM}).on("click",t),{caption:"--"},new Common.UI.MenuItem({caption:i.txtDistribHor,iconCls:"menu__icon shape-distribute-hor",value:6}).on("click",t),new Common.UI.MenuItem({caption:i.txtDistribVert,iconCls:"menu__icon shape-distribute-vert",value:7}).on("click",t)]})}()}),l=new Common.UI.MenuItem({caption:this.txtGroup,iconCls:"menu__icon shape-group"}).on("click",function(t,e){if(i.api){var n=new Asc.asc_CImgProperty;n.put_Group(1),i.api.ImgApply(n)}i.fireEvent("editcomplete",this)}),c=new Common.UI.MenuItem({iconCls:"menu__icon shape-ungroup",caption:this.txtUngroup}).on("click",function(t,e){if(i.api){var n=new Asc.asc_CImgProperty;n.put_Group(-1),i.api.ImgApply(n)}i.fireEvent("editcomplete",this)}),d=new Common.UI.MenuItem({caption:i.textArrange,menu:function(){function t(t,e){if(i.api){var n=new Asc.asc_CImgProperty;n.put_ChangeLevel(t.options.valign),i.api.ImgApply(n)}i.fireEvent("editcomplete",i)}return new Common.UI.Menu({cls:"ppm-toolbar shifted-right",menuAlign:"tl-tr",items:[new Common.UI.MenuItem({caption:i.textArrangeFront,iconCls:"menu__icon arrange-front",valign:Asc.c_oAscChangeLevel.BringToFront}).on("click",t),new Common.UI.MenuItem({caption:i.textArrangeBack,iconCls:"menu__icon arrange-back",valign:Asc.c_oAscChangeLevel.SendToBack}).on("click",t),new Common.UI.MenuItem({caption:i.textArrangeForward,iconCls:"menu__icon arrange-forward",valign:Asc.c_oAscChangeLevel.BringForward}).on("click",t),new Common.UI.MenuItem({caption:i.textArrangeBackward,iconCls:"menu__icon arrange-backward",valign:Asc.c_oAscChangeLevel.BringBackward}).on("click",t),{caption:"--"},l,c]})}()}),h=new Common.UI.MenuItem({caption:i.textEditWrapBoundary,cls:"no-icon-wrap-item"}).on("click",function(t,e){i.api&&i.api.StartChangeWrapPolygon(),i.fireEvent("editcomplete",i)});this.menuImageWrap=new Common.UI.MenuItem({iconCls:"menu__icon wrap-inline",caption:i.textWrap,menu:function(){function t(t,e){if(i.api){var n=new Asc.asc_CImgProperty;if(n.put_WrappingStyle(t.options.wrapType), +i.menuImageWrap._originalProps.get_WrappingStyle()===Asc.c_oAscWrapStyle2.Inline&&t.wrapType!==Asc.c_oAscWrapStyle2.Inline){n.put_PositionH(new Asc.CImagePositionH),n.get_PositionH().put_UseAlign(!1),n.get_PositionH().put_RelativeFrom(Asc.c_oAscRelativeFromH.Column);var o=i.menuImageWrap._originalProps.get_Value_X(Asc.c_oAscRelativeFromH.Column);n.get_PositionH().put_Value(o),n.put_PositionV(new Asc.CImagePositionV),n.get_PositionV().put_UseAlign(!1),n.get_PositionV().put_RelativeFrom(Asc.c_oAscRelativeFromV.Paragraph),o=i.menuImageWrap._originalProps.get_Value_Y(Asc.c_oAscRelativeFromV.Paragraph),n.get_PositionV().put_Value(o)}i.api.ImgApply(n)}i.fireEvent("editcomplete",i)}return new Common.UI.Menu({cls:"ppm-toolbar shifted-right",menuAlign:"tl-tr",items:[new Common.UI.MenuItem({caption:i.txtInline,iconCls:"menu__icon wrap-inline",toggleGroup:"popuppicturewrapping",wrapType:Asc.c_oAscWrapStyle2.Inline,checkmark:!1,checkable:!0}).on("click",t),new Common.UI.MenuItem({caption:i.txtSquare,iconCls:"menu__icon wrap-square",toggleGroup:"popuppicturewrapping",wrapType:Asc.c_oAscWrapStyle2.Square,checkmark:!1,checkable:!0}).on("click",t),new Common.UI.MenuItem({caption:i.txtTight,iconCls:"menu__icon wrap-tight",toggleGroup:"popuppicturewrapping",wrapType:Asc.c_oAscWrapStyle2.Tight,checkmark:!1,checkable:!0}).on("click",t),new Common.UI.MenuItem({caption:i.txtThrough,iconCls:"menu__icon wrap-through",toggleGroup:"popuppicturewrapping",wrapType:Asc.c_oAscWrapStyle2.Through,checkmark:!1,checkable:!0}).on("click",t),new Common.UI.MenuItem({caption:i.txtTopAndBottom,iconCls:"menu__icon wrap-topandbottom",toggleGroup:"popuppicturewrapping",wrapType:Asc.c_oAscWrapStyle2.TopAndBottom,checkmark:!1,checkable:!0}).on("click",t),new Common.UI.MenuItem({caption:i.txtInFront,iconCls:"menu__icon wrap-infront",toggleGroup:"popuppicturewrapping",wrapType:Asc.c_oAscWrapStyle2.InFront,checkmark:!1,checkable:!0}).on("click",t),new Common.UI.MenuItem({caption:i.txtBehind,iconCls:"menu__icon wrap-behind",toggleGroup:"popuppicturewrapping",wrapType:Asc.c_oAscWrapStyle2.Behind,checkmark:!1,checkable:!0}).on("click",t),{caption:"--"},h]})}()});var p=new Common.UI.MenuItem({iconCls:"menu__icon btn-menu-image",caption:i.advancedText}).on("click",function(t,n){var o,s;if(i.api){var a=i.api.getSelectedElements();if(a&&e.isArray(a))for(var r=a.length-1;r>=0;r--)if(o=a[r].get_ObjectType(),s=a[r].get_ObjectValue(),Asc.c_oAscTypeSelectElement.Image==o){var l;s.get_ChartProperties()||s.get_ShapeProperties()||i.menuOriginalSize.isDisabled()||!i.menuOriginalSize.isVisible()||(l=i.api.get_OriginalSizeImage())&&(l={width:l.get_ImageWidth(),height:l.get_ImageHeight()});var c=new DE.Views.ImageSettingsAdvanced({imageProps:s,sizeOriginal:l,api:i.api,sectionProps:i.api.asc_GetSectionProps(),handler:function(t,e){"ok"==t&&i.api&&i.api.ImgApply(e.imageProps),i.fireEvent("editcomplete",i)}});c.show(),c.btnOriginalSize.setVisible(i.menuOriginalSize.isVisible());break}}}),m=new Common.UI.MenuItem({caption:i.editChartText}).on("click",e.bind(i.editChartClick,i));this.menuOriginalSize=new Common.UI.MenuItem({caption:i.originalSizeText}).on("click",function(t,e){if(i.api){var n=i.api.get_OriginalSizeImage(),o=new Asc.asc_CImgProperty;o.put_Width(n.get_ImageWidth()),o.put_Height(n.get_ImageHeight()),o.put_ResetCrop(!0),i.api.ImgApply(o),i.fireEvent("editcomplete",this)}});var u=new Common.UI.MenuItem({caption:i.textReplace,menu:new Common.UI.Menu({cls:"shifted-right",menuAlign:"tl-tr",items:[new Common.UI.MenuItem({caption:this.textFromFile}).on("click",function(t){setTimeout(function(){i.api&&i.api.ChangeImageFromFile(),i.fireEvent("editcomplete",i)},10)}),new Common.UI.MenuItem({caption:this.textFromUrl}).on("click",function(t){new Common.Views.ImageFromUrlDialog({handler:function(t,n){if("ok"==t&&i.api){var o=n.replace(/ /g,"");if(!e.isEmpty(o)){var s=new Asc.asc_CImgProperty;s.put_ImageUrl(o),i.api.ImgApply(s)}}i.fireEvent("editcomplete",i)}}).show()}),new Common.UI.MenuItem({caption:this.textFromStorage}).on("click",function(t){Common.NotificationCenter.trigger("storage:image-load","change")})]})}),g=new Common.UI.MenuItem({iconCls:"menu__icon btn-copy",caption:i.textCopy,value:"copy"}).on("click",e.bind(i.onCutCopyPaste,i)),b=new Common.UI.MenuItem({iconCls:"menu__icon btn-paste",caption:i.textPaste,value:"paste"}).on("click",e.bind(i.onCutCopyPaste,i)),f=new Common.UI.MenuItem({iconCls:"menu__icon btn-cut",caption:i.textCut,value:"cut"}).on("click",e.bind(i.onCutCopyPaste,i)),C=new Common.UI.MenuItem({iconCls:"menu__icon btn-print",caption:i.txtPrintSelection}).on("click",e.bind(i.onPrintSelection,i)),v=new Common.UI.MenuItem({caption:this.strSign,value:0}).on("click",e.bind(i.onSignatureClick,i)),_=new Common.UI.MenuItem({caption:this.strSetup,value:2}).on("click",e.bind(i.onSignatureClick,i)),y=new Common.UI.MenuItem({caption:"--"}),w=new Common.UI.MenuItem({caption:i.textRotate,menu:new Common.UI.Menu({cls:"shifted-right",menuAlign:"tl-tr",items:[new Common.UI.MenuItem({iconCls:"menu__icon btn-rotate-90",caption:this.textRotate90,value:1}).on("click",e.bind(i.onImgRotate,i)),new Common.UI.MenuItem({iconCls:"menu__icon btn-rotate-270",caption:this.textRotate270,value:0}).on("click",e.bind(i.onImgRotate,i)),{caption:"--"},new Common.UI.MenuItem({iconCls:"menu__icon btn-flip-hor",caption:this.textFlipH,value:1}).on("click",e.bind(i.onImgFlip,i)),new Common.UI.MenuItem({iconCls:"menu__icon btn-flip-vert",caption:this.textFlipV,value:0}).on("click",e.bind(i.onImgFlip,i))]})});i.menuImgCrop=new Common.UI.MenuItem({caption:i.textCrop,menu:new Common.UI.Menu({cls:"shifted-right",menuAlign:"tl-tr",items:[new Common.UI.MenuItem({caption:i.textCrop,checkable:!0,allowDepress:!0,value:0}).on("click",e.bind(i.onImgCrop,i)),new Common.UI.MenuItem({caption:i.textCropFill,value:1}).on("click",e.bind(i.onImgCrop,i)),new Common.UI.MenuItem({caption:i.textCropFit,value:2}).on("click",e.bind(i.onImgCrop,i))]})}),this.pictureMenu=new Common.UI.Menu({cls:"shifted-right",initMenu:function(t){if(!e.isUndefined(t.imgProps)){var n=!t.imgProps.value.get_CanBeFlow(),o=t.imgProps.value.get_WrappingStyle();i.menuImageWrap._originalProps=t.imgProps.value;var s="menu__icon ";if(n){for(var a=0;a<6;a++)i.menuImageWrap.menu.items[a].setChecked(!1);s+="wrap-inline"}else switch(o){case Asc.c_oAscWrapStyle2.Inline:i.menuImageWrap.menu.items[0].setChecked(!0),s+="wrap-inline";break;case Asc.c_oAscWrapStyle2.Square:i.menuImageWrap.menu.items[1].setChecked(!0),s+="wrap-square";break;case Asc.c_oAscWrapStyle2.Tight:i.menuImageWrap.menu.items[2].setChecked(!0),s+="wrap-tight";break;case Asc.c_oAscWrapStyle2.Through:i.menuImageWrap.menu.items[3].setChecked(!0),s+="wrap-through";break;case Asc.c_oAscWrapStyle2.TopAndBottom:i.menuImageWrap.menu.items[4].setChecked(!0),s+="wrap-topandbottom";break;case Asc.c_oAscWrapStyle2.Behind:i.menuImageWrap.menu.items[6].setChecked(!0),s+="wrap-behind";break;case Asc.c_oAscWrapStyle2.InFront:i.menuImageWrap.menu.items[5].setChecked(!0),s+="wrap-infront";break;default:for(var a=0;a<6;a++)i.menuImageWrap.menu.items[a].setChecked(!1);s+="wrap-infront"}i.menuImageWrap.setIconCls(s),e.each(i.menuImageWrap.menu.items,function(t){t.setDisabled(n)});var x=t.imgProps.isImg&&t.imgProps.isChart||t.imgProps.isImg&&t.imgProps.isShape||t.imgProps.isShape&&t.imgProps.isChart;x?(p.setCaption(i.advancedText,!0),p.setIconCls("menu__icon btn-menu-image")):(p.setCaption(t.imgProps.isImg?i.imageText:t.imgProps.isChart?i.chartText:i.shapeText,!0),p.setIconCls("menu__icon "+(t.imgProps.isImg?"btn-menu-image":t.imgProps.isChart?"btn-menu-chart":"btn-menu-shape"))),m.setVisible(!e.isNull(t.imgProps.value.get_ChartProperties())&&!x),i.menuOriginalSize.setVisible(t.imgProps.isOnlyImg||!t.imgProps.isChart&&!t.imgProps.isShape);var S=i.api.asc_IsContentControl()?i.api.asc_GetContentControlProperties():null,A=S?S.get_Lock():Asc.c_oAscSdtLockType.Unlocked,k=A==Asc.c_oAscSdtLockType.SdtContentLocked||A==Asc.c_oAscSdtLockType.ContentLocked,T=t.imgProps.locked||void 0!==t.headerProps&&t.headerProps.locked||k,I=t.imgProps.value.asc_getPluginGuid();if(u.setVisible(t.imgProps.isOnlyImg&&(null===I||void 0===I)),u.isVisible()&&u.setDisabled(T||null===I),u.menu.items[2].setVisible(i.mode.canRequestInsertImage||i.mode.fileChoiceUrl&&i.mode.fileChoiceUrl.indexOf("{documentType}")>-1),w.setVisible(!t.imgProps.isChart&&(null===I||void 0===I)),w.isVisible()&&w.setDisabled(T),i.menuImgCrop.setVisible(i.api.asc_canEditCrop()),i.menuImgCrop.isVisible()&&i.menuImgCrop.setDisabled(T),m.isVisible()&&m.setDisabled(T||t.imgProps.value.get_SeveralCharts()),i.pictureMenu.items[19].setVisible(m.isVisible()),i.menuOriginalSize.setDisabled(T||null===t.imgProps.value.get_ImageUrl()||void 0===t.imgProps.value.get_ImageUrl()),p.setDisabled(T),r.setDisabled(T||o==Asc.c_oAscWrapStyle2.Inline),!T&&o!=Asc.c_oAscWrapStyle2.Inline){var P=i.api.asc_getSelectedDrawingObjectsCount(),M=Common.Utils.InternalSettings.get("de-img-align-to");r.menu.items[7].setDisabled(2==P&&(!M||3==M)),r.menu.items[8].setDisabled(2==P&&(!M||3==M))}d.setDisabled(o==Asc.c_oAscWrapStyle2.Inline||k),i.api&&(c.setDisabled(T||!i.api.CanUnGroup()),l.setDisabled(T||!i.api.CanGroup()),h.setDisabled(T||!i.api.CanChangeWrapPolygon())),i.menuImageWrap.setDisabled(T||t.imgProps.value.get_FromGroup()||n&&h.isDisabled()||!!S&&S.get_SpecificType()==Asc.c_oAscContentControlSpecificType.Picture);var E=i.api&&i.api.can_CopyCut();g.setDisabled(!E),f.setDisabled(T||!E),b.setDisabled(T),C.setVisible(i.mode.canPrint),C.setDisabled(!E);var U=t.imgProps&&t.imgProps.value&&i.mode.isSignatureSupport?t.imgProps.value.asc_getSignatureId():void 0,V=!!U;v.setVisible(V),_.setVisible(V),y.setVisible(V),V&&(v.cmpEl.attr("data-value",U),_.cmpEl.attr("data-value",U))}},items:[f,g,b,C,{caption:"--"},v,_,y,d,r,i.menuImageWrap,w,{caption:"--"},n,o,i.menuImgCrop,i.menuOriginalSize,u,m,{caption:"--"},p]}).on("hide:after",function(t,e,n){n||i.fireEvent("editcomplete",i),i.currentMenu=null});var x=new Common.UI.MenuItem({caption:i.txtInsertCaption}).on("click",e.bind(i.onInsertCaption,i)),S=new Common.UI.MenuItem({iconCls:"menu__icon btn-merge",caption:i.mergeCellsText}).on("click",function(t){i.api&&i.api.MergeCells()}),A=new Common.UI.MenuItem({caption:i.splitCellsText}).on("click",function(t){i.api&&new Common.Views.InsertTableDialog({split:!0,handler:function(t,e){"ok"==t&&(i.api&&i.api.SplitCell(e.columns,e.rows),Common.component.Analytics.trackEvent("DocumentHolder","Table")),i.fireEvent("editcomplete",i)}}).show()}),k=function(t,e){if(i.api){var n=new Asc.CTableProp;n.put_CellsVAlign(t.options.valign),i.api.tblApply(n)}},T=new Common.UI.MenuItem({iconCls:"menu__icon btn-align-top",caption:i.cellAlignText,menu:new Common.UI.Menu({cls:"shifted-right",menuAlign:"tl-tr",items:[i.menuTableCellTop=new Common.UI.MenuItem({iconCls:"menu__icon btn-align-top",caption:i.textShapeAlignTop,toggleGroup:"popuptablecellalign",checkmark:!1,checkable:!0,checked:!1,valign:Asc.c_oAscVertAlignJc.Top}).on("click",e.bind(k,i)),i.menuTableCellCenter=new Common.UI.MenuItem({iconCls:"menu__icon btn-align-middle",caption:i.textShapeAlignMiddle,toggleGroup:"popuptablecellalign",checkmark:!1,checkable:!0,checked:!1,valign:Asc.c_oAscVertAlignJc.Center}).on("click",e.bind(k,i)),i.menuTableCellBottom=new Common.UI.MenuItem({iconCls:"menu__icon btn-align-bottom",caption:i.textShapeAlignBottom,toggleGroup:"popuptablecellalign",checkmark:!1,checkable:!0,checked:!1,valign:Asc.c_oAscVertAlignJc.Bottom}).on("click",e.bind(k,i))]})}),I=new Common.UI.MenuItem({iconCls:"menu__icon btn-menu-table",caption:i.advancedTableText}).on("click",e.bind(i.advancedTableClick,i)),P=new Common.UI.MenuItem({iconCls:"menu__icon btn-paragraph",caption:i.advancedParagraphText}).on("click",e.bind(i.advancedParagraphClick,i)),M=new Common.UI.MenuItem({caption:"--"}),E=new Common.UI.MenuItem({caption:i.editHyperlinkText}).on("click",e.bind(i.editHyperlink,i)),U=new Common.UI.MenuItem({caption:i.removeHyperlinkText}).on("click",function(t,e){i.api&&i.api.remove_Hyperlink(t.hyperProps.value),i.fireEvent("editcomplete",i)}),V=new Common.UI.MenuItem({iconCls:"menu__icon btn-inserthyperlink",caption:i.hyperlinkText,menu:new Common.UI.Menu({cls:"shifted-right",menuAlign:"tl-tr",items:[E,U]})}),B=new Common.UI.MenuItem({iconCls:"menu__icon cc-remove",caption:i.textRemove,value:"remove"}).on("click",e.bind(i.onControlsSelect,i)),D=new Common.UI.MenuItem({caption:i.textSettings,value:"settings"}).on("click",e.bind(i.onControlsSelect,i)),F=new Common.UI.MenuItem({caption:i.textContentControls,menu:new Common.UI.Menu({cls:"shifted-right",menuAlign:"tl-tr",items:[B,D]})}),R=new Common.UI.MenuItem({caption:i.textTOC,menu:new Common.UI.Menu({cls:"shifted-right",menuAlign:"tl-tr",items:[{caption:i.textSettings,value:"settings"},{caption:i.textUpdateAll,value:"all"},{caption:i.textUpdatePages,value:"pages"}]})});R.menu.on("item:click",function(t,e,n){i.fireEvent("settings"==e.value?"links:contents":"links:update",[e.value,!0])});var L=new Common.UI.MenuItem({iconCls:"menu__icon btn-menu-comments",caption:i.addCommentText}).on("click",e.bind(i.addComment,i)),N=new Common.UI.MenuItem({iconCls:"menu__icon btn-inserthyperlink",caption:i.hyperlinkText}).on("click",e.bind(i.addHyperlink,i)),H=new Common.UI.MenuItem({caption:i.textFollow}).on("click",e.bind(i.onFollowMove,i));i.menuSpellTable=new Common.UI.MenuItem({caption:i.loadSpellText,disabled:!0}),i.menuSpellMoreTable=new Common.UI.MenuItem({caption:i.moreText,menu:new Common.UI.Menu({cls:"shifted-right",menuAlign:"tl-tr",restoreHeight:!0,items:[]})});var O=e.template(['','',"<%= caption %>",""].join(""));i.langTableMenu=new Common.UI.MenuItem({iconCls:"menu__icon btn-ic-doclang",caption:i.langText,menu:new Common.UI.MenuSimple({cls:"lang-menu",menuAlign:"tl-tr",restoreHeight:285,items:[],itemTemplate:O,search:!0})});var z=new Common.UI.MenuItem({caption:i.ignoreSpellText}).on("click",function(t){i.api&&(i.api.asc_ignoreMisspelledWord(i._currentSpellObj,!1),i.fireEvent("editcomplete",i))}),$=new Common.UI.MenuItem({caption:i.ignoreAllSpellText}).on("click",function(t){i.api&&(i.api.asc_ignoreMisspelledWord(i._currentSpellObj,!0),i.fireEvent("editcomplete",i))}),G=new Common.UI.MenuItem({caption:i.toDictionaryText}).on("click",function(t,e){i.api.asc_spellCheckAddToDictionary(i._currentSpellObj),i.fireEvent("editcomplete",i)}),W=new Common.UI.MenuItem({caption:"--"}),j=new Common.UI.MenuItem({caption:"--"});i.menuSpellCheckTable=new Common.UI.MenuItem({iconCls:"menu__icon btn-ic-docspell",caption:i.spellcheckText,menu:new Common.UI.Menu({cls:"shifted-right",menuAlign:"tl-tr",items:[i.menuSpellTable,i.menuSpellMoreTable,W,z,$,G,{caption:"--"},i.langTableMenu]})});var K=new Common.UI.MenuItem({iconCls:"menu__icon btn-copy",caption:i.textCopy,value:"copy"}).on("click",e.bind(i.onCutCopyPaste,i)),q=new Common.UI.MenuItem({iconCls:"menu__icon btn-paste",caption:i.textPaste,value:"paste"}).on("click",e.bind(i.onCutCopyPaste,i)),Y=new Common.UI.MenuItem({iconCls:"menu__icon btn-cut",caption:i.textCut,value:"cut"}).on("click",e.bind(i.onCutCopyPaste,i)),X=new Common.UI.MenuItem({iconCls:"menu__icon btn-print",caption:i.txtPrintSelection}).on("click",e.bind(i.onPrintSelection,i)),J=new Common.UI.MenuItem({caption:"--"}),Z=new Common.UI.MenuItem({caption:i.textDistributeRows}).on("click",e.bind(function(){i.api&&i.api.asc_DistributeTableCells(!1),i.fireEvent("editcomplete",i)},i)),Q=new Common.UI.MenuItem({caption:i.textDistributeCols}).on("click",e.bind(function(){i.api&&i.api.asc_DistributeTableCells(!0),i.fireEvent("editcomplete",i)},i)),tt=function(t,e){if(i.api){var n=new Asc.CTableProp;n.put_CellsTextDirection(t.options.direction),i.api.tblApply(n)}},et=new Common.UI.MenuItem({iconCls:"menu__icon text-orient-hor",caption:i.directionText,menu:new Common.UI.Menu({cls:"ppm-toolbar shifted-right",menuAlign:"tl-tr",items:[i.menuTableDirectH=new Common.UI.MenuItem({caption:i.directHText,iconCls:"menu__icon text-orient-hor",checkable:!0,checkmark:!1,checked:!1,toggleGroup:"popuptabledirect",direction:Asc.c_oAscCellTextDirection.LRTB}).on("click",e.bind(tt,i)),i.menuTableDirect90=new Common.UI.MenuItem({caption:i.direct90Text,iconCls:"menu__icon text-orient-rdown",checkable:!0,checkmark:!1,checked:!1,toggleGroup:"popuptabledirect",direction:Asc.c_oAscCellTextDirection.TBRL}).on("click",e.bind(tt,i)),i.menuTableDirect270=new Common.UI.MenuItem({caption:i.direct270Text,iconCls:"menu__icon text-orient-rup",checkable:!0,checkmark:!1,checked:!1,toggleGroup:"popuptabledirect",direction:Asc.c_oAscCellTextDirection.BTLR}).on("click",e.bind(tt,i))]})}),it=new Common.UI.MenuItem({caption:i.textStartNewList}).on("click",e.bind(i.onStartNumbering,i,1)),nt=new Common.UI.MenuItem({caption:i.textStartNumberingFrom}).on("click",e.bind(i.onStartNumbering,i,"advanced")),ot=new Common.UI.MenuItem({caption:i.textContinueNumbering}).on("click",e.bind(i.onContinueNumbering,i)),st=new Common.UI.MenuItem({caption:i.bulletsText,menu:new Common.UI.Menu({cls:"shifted-right",menuAlign:"tl-tr",items:[it,nt,ot]})}),at=new Common.UI.MenuItem({caption:i.textRefreshField}).on("click",function(t,e){i.api.asc_UpdateComplexField(t.options.fieldProps),i.fireEvent("editcomplete",i)}),rt=new Common.UI.MenuItem({caption:"--"});this.tableMenu=new Common.UI.Menu({cls:"shifted-right",initMenu:function(t){if(!e.isUndefined(t.tableProps)){for(var n=t.mathProps&&t.mathProps.value,o=8;o<27;o++)i.tableMenu.items[o].setVisible(!n);var s=t.tableProps.value.get_CellsVAlign(),a="";switch(s){case Asc.c_oAscVertAlignJc.Top:a="menu__icon btn-align-top";break;case Asc.c_oAscVertAlignJc.Center:a="menu__icon btn-align-middle";break;case Asc.c_oAscVertAlignJc.Bottom:a="menu__icon btn-align-bottom"}T.setIconCls(a),i.menuTableCellTop.setChecked(s==Asc.c_oAscVertAlignJc.Top),i.menuTableCellCenter.setChecked(s==Asc.c_oAscVertAlignJc.Center),i.menuTableCellBottom.setChecked(s==Asc.c_oAscVertAlignJc.Bottom);var r=t.tableProps.value.get_CellsTextDirection();switch(a="",r){case Asc.c_oAscCellTextDirection.LRTB:a="menu__icon text-orient-hor";break;case Asc.c_oAscCellTextDirection.TBRL:a="menu__icon text-orient-rdown";break;case Asc.c_oAscCellTextDirection.BTLR:a="menu__icon text-orient-rup"}et.setIconCls(a),i.menuTableDirectH.setChecked(r==Asc.c_oAscCellTextDirection.LRTB),i.menuTableDirect90.setChecked(r==Asc.c_oAscCellTextDirection.TBRL),i.menuTableDirect270.setChecked(r==Asc.c_oAscCellTextDirection.BTLR);var l=t.tableProps.locked||void 0!==t.headerProps&&t.headerProps.locked;i.tableMenu.items[11].setDisabled(l),i.tableMenu.items[12].setDisabled(l),i.api&&(S.setDisabled(l||!i.api.CheckBeforeMergeCells()),A.setDisabled(l||!i.api.CheckBeforeSplitCells())),Z.setDisabled(l),Q.setDisabled(l),T.setDisabled(l),et.setDisabled(l),I.setDisabled(l);var c=i.api&&i.api.can_CopyCut();K.setDisabled(!c),Y.setDisabled(l||!c),q.setDisabled(l),X.setVisible(i.mode.canPrint),X.setDisabled(!c);var d=i.api.asc_GetCurrentNumberingId(),h=null!==d;if(st.setVisible(h),h){var p=i.api.asc_GetNumberingPr(d).get_Lvl(i.api.asc_GetCurrentNumberingLvl()),m=p.get_Format(),u=i.api.asc_GetCalculatedNumberingValue();it.setVisible(p.get_Start()!=u),it.value={start:p.get_Start()},nt.setVisible(m!=Asc.c_oAscNumberingFormat.Bullet),nt.value={format:m,start:u},it.setCaption(m==Asc.c_oAscNumberingFormat.Bullet?i.textSeparateList:i.textStartNewList),ot.setCaption(m==Asc.c_oAscNumberingFormat.Bullet?i.textJoinList:i.textContinueNumbering)}var g=null;i.api&&(g=i.api.can_AddHyperlink()),N.setVisible(void 0===t.hyperProps&&!1!==g),V.setVisible(void 0!==t.hyperProps),E.hyperProps=t.hyperProps,U.hyperProps=t.hyperProps,!1!==g&&(N.hyperProps={},N.hyperProps.value=new Asc.CHyperlinkProperty,N.hyperProps.value.put_Text(g));var b=i.api.asc_GetRevisionsChangesStack(),f=!1;H.value=null,e.each(b,function(t){t.get_Type()!=Asc.c_oAscRevisionsChangeType.TextAdd&&t.get_Type()!=Asc.c_oAscRevisionsChangeType.TextRem||t.get_MoveType()==Asc.c_oAscRevisionsMove.NoMove||(H.value=t,f=!0)}),H.setVisible(f),M.setVisible(N.isVisible()||V.isVisible()||st.isVisible()||H.isVisible()),P.setVisible(void 0!==t.paraProps),i._currentParaObjDisabled=l=t.paraProps.locked||void 0!==t.headerProps&&t.headerProps.locked,N.setDisabled(l),V.setDisabled(l||void 0!==t.hyperProps&&!0===t.hyperProps.isSeveralLinks),P.setDisabled(l),i.menuSpellCheckTable.setVisible(void 0!==t.spellProps&&!1===t.spellProps.value.get_Checked()),G.setVisible(i.mode.isDesktopApp),j.setVisible(void 0!==t.spellProps&&!1===t.spellProps.value.get_Checked()),i.langTableMenu.setDisabled(l),void 0!==t.spellProps&&!1===t.spellProps.value.get_Checked()&&null!==t.spellProps.value.get_Variants()&&void 0!==t.spellProps.value.get_Variants()?i.addWordVariants(!1):(i.menuSpellTable.setCaption(i.loadSpellText,!0),i.clearWordVariants(!1),i.menuSpellMoreTable.setVisible(!1)),i.menuSpellCheckTable.isVisible()&&i._currLang.id!==i._currLang.tableid&&(i.changeLanguageMenu(i.langTableMenu.menu),i._currLang.tableid=i._currLang.id);var C=0;n?C=i.addEquationMenu(!1,7):i.clearEquationMenu(!1,7),J.setVisible(n&&C>0);var v=!!t.paraProps&&!(t.paraProps.value.can_DeleteBlockContentControl()&&t.paraProps.value.can_EditBlockContentControl()&&t.paraProps.value.can_DeleteInlineContentControl()&&t.paraProps.value.can_EditInlineContentControl()),_=i.api.asc_GetTableOfContentsPr(!0),y=!_&&i.api.asc_IsContentControl();if(F.setVisible(y),y){var w=i.api.asc_GetContentControlProperties(),x=w?w.get_Lock():Asc.c_oAscSdtLockType.Unlocked,k=w&&w.get_FormPr();B.setDisabled(x==Asc.c_oAscSdtLockType.SdtContentLocked||x==Asc.c_oAscSdtLockType.SdtLocked),B.setCaption(k?i.getControlLabel(w):i.textRemoveControl),D.setVisible(i.mode.canEditContentControl&&!k);var O=w?w.get_SpecificType():Asc.c_oAscContentControlSpecificType.None;v=v||O==Asc.c_oAscContentControlSpecificType.CheckBox||O==Asc.c_oAscContentControlSpecificType.Picture||O==Asc.c_oAscContentControlSpecificType.ComboBox||O==Asc.c_oAscContentControlSpecificType.DropDownList||O==Asc.c_oAscContentControlSpecificType.DateTime}R.setVisible(_),L.setVisible(!1!==i.api.can_AddQuotedComment()&&i.mode.canCoAuthoring&&i.mode.canComments&&!v),L.setDisabled(void 0!==t.paraProps&&!0===t.paraProps.locked);var z=i.api.asc_GetCurrentComplexField();at.setVisible(!!z),at.setDisabled(l),rt.setVisible(!!z),z&&(at.options.fieldProps=z)}},items:[i.menuSpellCheckTable,j,Y,K,q,X,{caption:"--"},J,at,rt,{caption:i.selectText,menu:new Common.UI.Menu({cls:"shifted-right",menuAlign:"tl-tr",style:"width: 100px",items:[new Common.UI.MenuItem({caption:i.rowText}).on("click",function(t){i.api&&i.api.selectRow()}),new Common.UI.MenuItem({caption:i.columnText}).on("click",function(t){i.api&&i.api.selectColumn()}),new Common.UI.MenuItem({caption:i.cellText}).on("click",function(t){i.api&&i.api.selectCell()}),new Common.UI.MenuItem({caption:i.tableText}).on("click",function(t){i.api&&i.api.selectTable()})]})},{iconCls:"menu__icon btn-addcell",caption:i.insertText,menu:new Common.UI.Menu({cls:"shifted-right",menuAlign:"tl-tr",items:[new Common.UI.MenuItem({caption:i.insertColumnLeftText}).on("click",function(t){i.api&&i.api.addColumnLeft()}),new Common.UI.MenuItem({caption:i.insertColumnRightText}).on("click",function(t){i.api&&i.api.addColumnRight()}),new Common.UI.MenuItem({caption:i.insertRowAboveText}).on("click",function(t){i.api&&i.api.addRowAbove()}),new Common.UI.MenuItem({caption:i.insertRowBelowText}).on("click",function(t){i.api&&i.api.addRowBelow()}),new Common.UI.MenuItem({caption:i.textSeveral}).on("click",function(t){i.onCellsAdd()})]})},{iconCls:"menu__icon btn-delcell",caption:i.deleteText,menu:new Common.UI.Menu({cls:"shifted-right",menuAlign:"tl-tr",style:"width: 100px",items:[new Common.UI.MenuItem({caption:i.rowText}).on("click",function(t){i.api&&i.api.remRow()}),new Common.UI.MenuItem({caption:i.columnText}).on("click",function(t){i.api&&i.api.remColumn()}),new Common.UI.MenuItem({caption:i.tableText}).on("click",function(t){i.api&&i.api.remTable()}),new Common.UI.MenuItem({caption:i.textCells}).on("click",function(t){i.onCellsRemove()})]})},{caption:"--"},S,A,{caption:"--"},Z,Q,{caption:"--"},T,et,{caption:"--"},x,{caption:"--"},I,{caption:"--"},L,st,N,V,H,M,F,R,P]}).on("hide:after",function(t,e,n){if(i.suppressEditComplete)return void(i.suppressEditComplete=!1);n||i.fireEvent("editcomplete",i),i.currentMenu=null});var lt=new Common.UI.MenuItem({caption:i.breakBeforeText,checkable:!0}).on("click",function(t,e){i.api.put_PageBreak(t.checked)}),ct=new Common.UI.MenuItem({caption:i.keepLinesText,checkable:!0}).on("click",function(t,e){i.api.put_KeepLines(t.checked)}),dt=function(t,e){if(i.api){var n=new Asc.asc_CImgProperty;n.put_VerticalTextAlign(t.options.valign),i.api.ImgApply(n)}},ht=new Common.UI.MenuItem({iconCls:"menu__icon btn-align-top",caption:i.vertAlignText,menu:new Common.UI.Menu({cls:"shifted-right",menuAlign:"tl-tr",items:[i.menuParagraphTop=new Common.UI.MenuItem({iconCls:"menu__icon btn-align-top",caption:i.textShapeAlignTop,checkmark:!1,checkable:!0,checked:!1,toggleGroup:"popupparagraphvalign",valign:Asc.c_oAscVAlign.Top}).on("click",e.bind(dt,i)),i.menuParagraphCenter=new Common.UI.MenuItem({iconCls:"menu__icon btn-align-middle",caption:i.textShapeAlignMiddle,checkmark:!1,checkable:!0,checked:!1,toggleGroup:"popupparagraphvalign",valign:Asc.c_oAscVAlign.Center}).on("click",e.bind(dt,i)),i.menuParagraphBottom=new Common.UI.MenuItem({iconCls:"menu__icon btn-align-bottom",caption:i.textShapeAlignBottom,checkmark:!1,checkable:!0,checked:!1,toggleGroup:"popupparagraphvalign",valign:Asc.c_oAscVAlign.Bottom}).on("click",e.bind(dt,i))]})}),pt=function(t,e){if(i.api){var n=new Asc.asc_CImgProperty;n.put_Vert(t.options.direction),i.api.ImgApply(n)}},mt=new Common.UI.MenuItem({iconCls:"menu__icon text-orient-hor",caption:i.directionText,menu:new Common.UI.Menu({cls:"ppm-toolbar shifted-right",menuAlign:"tl-tr",items:[i.menuParagraphDirectH=new Common.UI.MenuItem({caption:i.directHText,iconCls:"menu__icon text-orient-hor",checkable:!0,checkmark:!1,checked:!1,toggleGroup:"popupparagraphdirect",direction:Asc.c_oAscVertDrawingText.normal}).on("click",e.bind(pt,i)),i.menuParagraphDirect90=new Common.UI.MenuItem({caption:i.direct90Text,iconCls:"menu__icon text-orient-rdown",checkable:!0,checkmark:!1,checked:!1,toggleGroup:"popupparagraphdirect",direction:Asc.c_oAscVertDrawingText.vert}).on("click",e.bind(pt,i)),i.menuParagraphDirect270=new Common.UI.MenuItem({caption:i.direct270Text,iconCls:"menu__icon text-orient-rup",checkable:!0,checkmark:!1,checked:!1,toggleGroup:"popupparagraphdirect",direction:Asc.c_oAscVertDrawingText.vert270}).on("click",e.bind(pt,i))]})}),ut=new Common.UI.MenuItem({iconCls:"menu__icon btn-paragraph",caption:i.advancedParagraphText}).on("click",e.bind(i.advancedParagraphClick,i)),gt=new Common.UI.MenuItem({caption:i.advancedFrameText}).on("click",e.bind(i.advancedFrameClick,i,!0)),bt=new Common.UI.MenuItem({iconCls:"menu__icon dropcap-intext",caption:i.advancedDropCapText}).on("click",e.bind(i.advancedFrameClick,i,!1)),ft=new Common.UI.MenuItem({caption:"--"}),Ct=new Common.UI.MenuItem({iconCls:"menu__icon btn-menu-comments",caption:i.addCommentText}).on("click",e.bind(i.addComment,i)),vt=new Common.UI.MenuItem({caption:"--"}),_t=new Common.UI.MenuItem({iconCls:"menu__icon btn-inserthyperlink",caption:i.hyperlinkText}).on("click",e.bind(i.addHyperlink,i)),yt=new Common.UI.MenuItem({caption:i.editHyperlinkText}).on("click",e.bind(i.editHyperlink,i)),wt=new Common.UI.MenuItem({caption:i.removeHyperlinkText}).on("click",function(t,e){i.api.remove_Hyperlink(t.hyperProps.value),i.fireEvent("editcomplete",i)}),xt=new Common.UI.MenuItem({iconCls:"menu__icon btn-inserthyperlink",caption:i.hyperlinkText,menu:new Common.UI.Menu({cls:"shifted-right",menuAlign:"tl-tr",items:[yt,wt]})}),St=new Common.UI.MenuItemSeparator,At=new Common.UI.MenuItem({caption:i.styleText,menu:new Common.UI.Menu({cls:"shifted-right",menuAlign:"tl-tr",items:[i.menuStyleSave=new Common.UI.MenuItem({caption:i.saveStyleText}).on("click",e.bind(i.onMenuSaveStyle,i)),i.menuStyleUpdate=new Common.UI.MenuItem({caption:i.updateStyleText.replace("%1",window.currentStyleName)}).on("click",e.bind(i.onMenuUpdateStyle,i))]})});i.menuSpellPara=new Common.UI.MenuItem({caption:i.loadSpellText,disabled:!0}),i.menuSpellMorePara=new Common.UI.MenuItem({caption:i.moreText,menu:new Common.UI.Menu({cls:"shifted-right",menuAlign:"tl-tr",restoreHeight:!0,items:[]})}),i.langParaMenu=new Common.UI.MenuItem({iconCls:"menu__icon btn-ic-doclang",caption:i.langText,menu:new Common.UI.MenuSimple({cls:"lang-menu",menuAlign:"tl-tr",restoreHeight:285,items:[],itemTemplate:O,search:!0})});var kt=new Common.UI.MenuItem({caption:i.ignoreSpellText}).on("click",function(t,e){i.api.asc_ignoreMisspelledWord(i._currentSpellObj,!1),i.fireEvent("editcomplete",i)}),Tt=new Common.UI.MenuItem({caption:i.ignoreAllSpellText}).on("click",function(t,e){i.api.asc_ignoreMisspelledWord(i._currentSpellObj,!0),i.fireEvent("editcomplete",i)}),It=new Common.UI.MenuItem({caption:i.toDictionaryText}).on("click",function(t,e){i.api.asc_spellCheckAddToDictionary(i._currentSpellObj),i.fireEvent("editcomplete",i)}),Pt=new Common.UI.MenuItem({caption:"--"}),Mt=new Common.UI.MenuItem({caption:"--"}),Et=new Common.UI.MenuItem({iconCls:"menu__icon btn-copy",caption:i.textCopy,value:"copy"}).on("click",e.bind(i.onCutCopyPaste,i)),Ut=new Common.UI.MenuItem({iconCls:"menu__icon btn-paste",caption:i.textPaste,value:"paste"}).on("click",e.bind(i.onCutCopyPaste,i)),Vt=new Common.UI.MenuItem({iconCls:"menu__icon btn-cut",caption:i.textCut,value:"cut"}).on("click",e.bind(i.onCutCopyPaste,i)),Bt=new Common.UI.MenuItem({iconCls:"menu__icon btn-print",caption:i.txtPrintSelection}).on("click",e.bind(i.onPrintSelection,i)),Dt=new Common.UI.MenuItem({caption:"--"}),Ft=new Common.UI.MenuItem({iconCls:"menu__icon cc-remove",caption:i.textRemoveControl,value:"remove"}).on("click",e.bind(i.onControlsSelect,i)),Rt=new Common.UI.MenuItem({caption:i.textEditControls,value:"settings"}).on("click",e.bind(i.onControlsSelect,i)),Lt=new Common.UI.MenuItem({caption:"--"}),Nt=new Common.UI.MenuItem({caption:i.textTOCSettings,value:"settings"}).on("click",function(t,e){i.fireEvent("links:contents",[t.value,!0])}),Ht=new Common.UI.MenuItem({caption:i.textUpdateTOC,menu:new Common.UI.Menu({cls:"shifted-right",menuAlign:"tl-tr",items:[{caption:i.textUpdateAll,value:"all"},{caption:i.textUpdatePages,value:"pages"}]})});Ht.menu.on("item:click",function(t,e,n){i.fireEvent("links:update",[e.value,!0])});var Ot=new Common.UI.MenuItem({caption:"--"}),zt=new Common.UI.MenuItem({caption:i.textRefreshField}).on("click",function(t,e){i.api.asc_UpdateComplexField(t.options.fieldProps),i.fireEvent("editcomplete",i)}),$t=new Common.UI.MenuItem({caption:"--"}),Gt=new Common.UI.MenuItem({caption:i.textStartNewList}).on("click",e.bind(i.onStartNumbering,i,1)),Wt=new Common.UI.MenuItem({caption:i.textStartNumberingFrom}).on("click",e.bind(i.onStartNumbering,i,"advanced")),jt=new Common.UI.MenuItem({caption:i.textContinueNumbering}).on("click",e.bind(i.onContinueNumbering,i)),Kt=new Common.UI.MenuItem({caption:"--"}),qt=new Common.UI.MenuItem({caption:i.textFollow}).on("click",e.bind(i.onFollowMove,i)),Yt=new Common.UI.MenuItem({caption:"--"});this.textMenu=new Common.UI.Menu({cls:"shifted-right",initMenu:function(t){var n=t.imgProps&&t.imgProps.value&&!e.isNull(t.imgProps.value.get_ShapeProperties()),o=t.imgProps&&t.imgProps.value&&!e.isNull(t.imgProps.value.get_ChartProperties()),r=t.mathProps&&t.mathProps.value;if(ht.setVisible(n&&!o&&!r),mt.setVisible(n&&!o&&!r),n||o){var l=t.imgProps.value.get_VerticalTextAlign(),c="";switch(l){ +case Asc.c_oAscVAlign.Top:c="menu__icon btn-align-top";break;case Asc.c_oAscVAlign.Center:c="menu__icon btn-align-middle";break;case Asc.c_oAscVAlign.Bottom:c="menu__icon btn-align-bottom"}ht.setIconCls(c),i.menuParagraphTop.setChecked(l==Asc.c_oAscVAlign.Top),i.menuParagraphCenter.setChecked(l==Asc.c_oAscVAlign.Center),i.menuParagraphBottom.setChecked(l==Asc.c_oAscVAlign.Bottom);var d=t.imgProps.value.get_Vert();switch(c="",d){case Asc.c_oAscVertDrawingText.normal:c="menu__icon text-orient-hor";break;case Asc.c_oAscVertDrawingText.vert:c="menu__icon text-orient-rdown";break;case Asc.c_oAscVertDrawingText.vert270:c="menu__icon text-orient-rup"}mt.setIconCls(c),i.menuParagraphDirectH.setChecked(d==Asc.c_oAscVertDrawingText.normal),i.menuParagraphDirect90.setChecked(d==Asc.c_oAscVertDrawingText.vert),i.menuParagraphDirect270.setChecked(d==Asc.c_oAscVertDrawingText.vert270)}ut.isChart=t.imgProps&&t.imgProps.isChart,lt.setVisible(!n&&!o&&!r),ct.setVisible(!n&&!o&&!r),t.paraProps&&(lt.setChecked(t.paraProps.value.get_PageBreakBefore()),ct.setChecked(t.paraProps.value.get_KeepLines()));var h=null;i.api&&(h=i.api.can_AddHyperlink()),_t.setVisible(void 0===t.hyperProps&&!1!==h),xt.setVisible(void 0!==t.hyperProps),vt.setVisible(_t.isVisible()||xt.isVisible()),yt.hyperProps=t.hyperProps,wt.hyperProps=t.hyperProps,!1!==h&&(_t.hyperProps={},_t.hyperProps.value=new Asc.CHyperlinkProperty,_t.hyperProps.value.put_Text(h));var p=t.paraProps.locked||void 0!==t.headerProps&&t.headerProps.locked;i._currentParaObjDisabled=p,_t.setDisabled(p),xt.setDisabled(p||void 0!==t.hyperProps&&!0===t.hyperProps.isSeveralLinks);var m=i.api.asc_GetRevisionsChangesStack(),u=!1;qt.value=null,e.each(m,function(t){t.get_Type()!=Asc.c_oAscRevisionsChangeType.TextAdd&&t.get_Type()!=Asc.c_oAscRevisionsChangeType.TextRem||t.get_MoveType()==Asc.c_oAscRevisionsMove.NoMove||(qt.value=t,u=!0)}),qt.setVisible(u),Yt.setVisible(u),lt.setDisabled(p||!e.isUndefined(t.headerProps)||!e.isUndefined(t.imgProps)),ct.setDisabled(p),ut.setDisabled(p),gt.setDisabled(p),bt.setDisabled(p),ht.setDisabled(p),mt.setDisabled(p);var g=i.api&&i.api.can_CopyCut();Et.setDisabled(!g),Vt.setDisabled(p||!g),Ut.setDisabled(p),Bt.setVisible(i.mode.canPrint),Bt.setDisabled(!g);var b=void 0!==t.spellProps&&!1===t.spellProps.value.get_Checked();i.menuSpellPara.setVisible(b),Mt.setVisible(b),kt.setVisible(b),Tt.setVisible(b),It.setVisible(b&&i.mode.isDesktopApp),i.langParaMenu.setVisible(b),i.langParaMenu.setDisabled(p),Pt.setVisible(b),b&&null!==t.spellProps.value.get_Variants()&&void 0!==t.spellProps.value.get_Variants()?i.addWordVariants(!0):(i.menuSpellPara.setCaption(i.loadSpellText,!0),i.clearWordVariants(!0),i.menuSpellMorePara.setVisible(!1)),i.langParaMenu.isVisible()&&i._currLang.id!==i._currLang.paraid&&(i.changeLanguageMenu(i.langParaMenu.menu),i._currLang.paraid=i._currLang.id);var f=0;r?f=i.addEquationMenu(!0,15):i.clearEquationMenu(!0,15),Dt.setVisible(r&&f>0),s.setVisible(r),a.setVisible(r);var C=t.paraProps.value.get_FramePr();gt.setVisible(void 0!==C),bt.setVisible(void 0!==C),C&&bt.setIconCls(C.get_DropCap()===Asc.c_oAscDropCap.Drop?"menu__icon dropcap-intext":"menu__icon dropcap-inmargin"),St.setVisible(i.mode.canEditStyles&&!o),At.setVisible(i.mode.canEditStyles&&!o),i.mode.canEditStyles&&!o&&i.menuStyleUpdate.setCaption(i.updateStyleText.replace("%1",DE.getController("Main").translationTable[window.currentStyleName]||window.currentStyleName));var v=!!t.paraProps&&!(t.paraProps.value.can_DeleteBlockContentControl()&&t.paraProps.value.can_EditBlockContentControl()&&t.paraProps.value.can_DeleteInlineContentControl()&&t.paraProps.value.can_EditInlineContentControl()),_=i.api.asc_GetTableOfContentsPr(!0),y=!_&&i.api.asc_IsContentControl(),w=y?i.api.asc_GetContentControlProperties():null,x=w&&w.get_FormPr();if(Ft.setVisible(y),Rt.setVisible(y&&i.mode.canEditContentControl&&!x),Lt.setVisible(y),y){var S=w?w.get_Lock():Asc.c_oAscSdtLockType.Unlocked;Ft.setDisabled(S==Asc.c_oAscSdtLockType.SdtContentLocked||S==Asc.c_oAscSdtLockType.SdtLocked),Ft.setCaption(x?i.getControlLabel(w):i.textRemoveControl);var A=w?w.get_SpecificType():Asc.c_oAscContentControlSpecificType.None;v=v||A==Asc.c_oAscContentControlSpecificType.CheckBox||A==Asc.c_oAscContentControlSpecificType.Picture||A==Asc.c_oAscContentControlSpecificType.ComboBox||A==Asc.c_oAscContentControlSpecificType.DropDownList||A==Asc.c_oAscContentControlSpecificType.DateTime}Nt.setVisible(_),Ht.setVisible(_),Ot.setVisible(_);var k=!o&&!1!==i.api.can_AddQuotedComment()&&i.mode.canCoAuthoring&&i.mode.canComments&&!v;i.mode.compatibleFeatures&&(k=k&&!n),ft.setVisible(k),Ct.setVisible(k),Ct.setDisabled(t.paraProps&&!0===t.paraProps.locked);var T=i.api.asc_GetCurrentComplexField();zt.setVisible(!!T),zt.setDisabled(p),$t.setVisible(!!T),T&&(zt.options.fieldProps=T);var I=i.api.asc_GetCurrentNumberingId(),P=null!==I;if(Kt.setVisible(P),Gt.setVisible(P),Wt.setVisible(P),jt.setVisible(P),P){var M=i.api.asc_GetNumberingPr(I).get_Lvl(i.api.asc_GetCurrentNumberingLvl()),E=M.get_Format(),U=i.api.asc_GetCalculatedNumberingValue();Gt.setVisible(M.get_Start()!=U),Gt.value={start:M.get_Start()},Wt.setVisible(E!=Asc.c_oAscNumberingFormat.Bullet),Wt.value={format:E,start:U},Gt.setCaption(E==Asc.c_oAscNumberingFormat.Bullet?i.textSeparateList:i.textStartNewList),jt.setCaption(E==Asc.c_oAscNumberingFormat.Bullet?i.textJoinList:i.textContinueNumbering)}},items:[i.menuSpellPara,i.menuSpellMorePara,Mt,kt,Tt,It,i.langParaMenu,Pt,Vt,Et,Ut,Bt,a,s,{caption:"--"},Dt,Ft,Rt,Lt,zt,$t,Nt,Ht,Ot,lt,ct,ht,mt,ut,gt,bt,ft,Ct,vt,_t,xt,Yt,qt,Kt,Gt,Wt,jt,St,At]}).on("hide:after",function(t,e,n){if(i.suppressEditComplete)return void(i.suppressEditComplete=!1);n||i.fireEvent("editcomplete",i),i.currentMenu=null});var Xt=new Common.UI.MenuItem({caption:i.editHeaderText});this.hdrMenu=new Common.UI.Menu({cls:"shifted-right",initMenu:function(t){Xt.setCaption(t.Header?i.editHeaderText:i.editFooterText,!0),Xt.off("click").on("click",function(e){i.api&&(t.Header?i.api.GoToHeader(t.PageNum):i.api.GoToFooter(t.PageNum),i.fireEvent("editcomplete",i))})},items:[Xt]}).on("hide:after",function(t,e,n){n||i.fireEvent("editcomplete",i),i.currentMenu=null});var Jt=t("#id_buttonNextPage");Jt.attr("data-toggle","tooltip"),Jt.tooltip({title:i.textNextPage+Common.Utils.String.platformKey("Alt+PgDn"),placement:"top-right"});var Zt=t("#id_buttonPrevPage");Zt.attr("data-toggle","tooltip"),Zt.tooltip({title:i.textPrevPage+Common.Utils.String.platformKey("Alt+PgUp"),placement:"top-right"})},setLanguages:function(t){var i=this;if(t&&t.length>0&&i.langParaMenu&&i.langTableMenu){var n=[],o=[];e.each(t,function(t){var i={caption:t.displayValue,value:t.value,checkable:!0,langid:t.code,spellcheck:t.spellcheck};n.push(i),o.push(e.clone(i))}),i.langParaMenu.menu.resetItems(n),i.langTableMenu.menu.resetItems(o),i.langParaMenu.menu.on("item:click",function(t,n){i.api&&(e.isUndefined(n.langid)||i.api.put_TextPrLang(n.langid),i._currLang.paraid=n.langid,i.fireEvent("editcomplete",i))}),i.langTableMenu.menu.on("item:click",function(t,n,o){i.api&&(e.isUndefined(n.langid)||i.api.put_TextPrLang(n.langid),i._currLang.tableid=n.langid,i.fireEvent("editcomplete",i))})}},onSignatureClick:function(t){var e=t.cmpEl.attr("data-value");switch(t.value){case 0:Common.NotificationCenter.trigger("protect:sign",e);break;case 1:this.api.asc_ViewCertificate(e);break;case 2:Common.NotificationCenter.trigger("protect:signature","visible",this._isDisabled,e);break;case 3:this.api.asc_RemoveSignature(e)}},onImgRotate:function(t){var e=new Asc.asc_CImgProperty;e.asc_putRotAdd(3.14159265358979*(1==t.value?90:270)/180),this.api.ImgApply(e),this.fireEvent("editcomplete",this)},onImgFlip:function(t){var e=new Asc.asc_CImgProperty;1==t.value?e.asc_putFlipHInvert(!0):e.asc_putFlipVInvert(!0),this.api.ImgApply(e),this.fireEvent("editcomplete",this)},onImgCrop:function(t){1==t.value?this.api.asc_cropFill():2==t.value?this.api.asc_cropFit():t.checked?this.api.asc_startEditCrop():this.api.asc_endEditCrop(),this.fireEvent("editcomplete",this)},onFollowMove:function(t){this.api&&this.api.asc_FollowRevisionMove(t.value),this.fireEvent("editcomplete",this)},onHideContentControlsActions:function(){this.listControlMenu&&this.listControlMenu.isVisible()&&this.listControlMenu.hide();var t=this.cmpEl.find("#calendar-control-container");t.is(":visible")&&t.hide()},onShowDateActions:function(e,i,n){var o=e.pr,s=o.get_DateTimePr(),a=this.cmpEl.find("#calendar-control-container"),r=this;this._dateObj=o,a.length<1&&(a=t('
'),this.cmpEl.append(a)),Common.UI.Menu.Manager.hideAll(),a.css({left:i,top:n}),a.show(),this.cmpCalendar||(this.cmpCalendar=new Common.UI.Calendar({el:this.cmpEl.find("#id-document-calendar-control"),enableKeyEvents:!0,firstday:1}),this.cmpCalendar.on("date:click",function(t,e){var i=r._dateObj.get_DateTimePr();i.put_FullDate(new Date(e)),r.api.asc_SetContentControlDatePickerDate(i),a.hide(),r.api.asc_UncheckContentControlButtons(),r.fireEvent("editcomplete",r)}),this.cmpCalendar.on("calendar:keydown",function(t,e){e.keyCode==Common.UI.Keys.ESC&&(a.hide(),r.api.asc_UncheckContentControlButtons())}),t(document).on("mousedown",function(t){"canvas"!==t.target.localName&&a.is(":visible")&&0==a.find(t.target).length&&(a.hide(),r.api.asc_UncheckContentControlButtons())})),this.cmpCalendar.setDate(new Date(s?s.get_FullDate():void 0));var l=a.offset(),c=Common.Utils.innerWidth(),d=Common.Utils.innerHeight()-10,h=this.cmpCalendar.cmpEl.outerWidth(),p=this.cmpCalendar.cmpEl.outerHeight(),m=l.left-h,u=l.top;u+p>d&&(u=d-p,m-=22),u<0&&(u=0),m+h>c&&(m=c-h),this.cmpCalendar.cmpEl.css({left:m,top:u}),this._preventClick=!0},onShowListActions:function(i,n,o){var s=i.type,a=i.pr,r=s==Asc.c_oAscContentControlSpecificType.ComboBox?a.get_ComboBoxPr():a.get_DropDownListPr(),l=!!a.get_FormPr(),c=this.listControlMenu,d=c?this.cmpEl.find(Common.Utils.String.format("#menu-container-{0}",c.id)):null,h=this;if(this._listObj=a,this._fromShowContentControls=!0,Common.UI.Menu.Manager.hideAll(),c||(this.listControlMenu=c=new Common.UI.Menu({maxHeight:207,menuAlign:"tr-bl",items:[]}),c.on("item:click",function(t,e){setTimeout(function(){-1!==e.value&&h.api.asc_SelectContentControlListItem(e.value,h._listObj.get_InternalId())},1)}),(!d||d.length<1)&&(d=t(Common.Utils.String.format('',c.id)),this.cmpEl.append(d)),c.render(d),c.cmpEl.attr({tabindex:"-1"}),c.on("hide:after",function(){h.listControlMenu.removeAll(),h._fromShowContentControls||h.api.asc_UncheckContentControlButtons()})),r){if(l){var p=a.get_PlaceholderText();c.addItem(new Common.UI.MenuItem({caption:""!==p.trim()?p:this.txtEmpty,value:"",template:e.template([' opacity: 0.6 <% } %>">',"<%= caption %>",""].join(""))}))}for(var m=r.get_ItemsCount(),u=0;u','
',"","
",'
',""].join(""),this.options.tpl=_.template(this.template)(this.options),Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this);var t=this;t.inputUrl=new Common.UI.InputField({el:$("#id-dlg-url"),allowBlank:!1,blankError:t.txtEmpty,style:"width: 100%;",validateOnBlur:!1,validation:function(e){return!!/((^https?)|(^ftp)):\/\/.+/i.test(e)||t.txtNotUrl}}),this.getChild().find(".btn").on("click",_.bind(this.onBtnClick,this))},show:function(){Common.UI.Window.prototype.show.apply(this,arguments);var t=this;_.delay(function(){t.getChild("input").focus()},100)},onPrimary:function(t){return this._handleInput("ok"),!1},onBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value)},_handleInput:function(t){if(this.options.handler){if("ok"==t&&!0!==this.inputUrl.checkValidate())return void this.inputUrl.cmpEl.find("input").focus();this.options.handler.call(this,t,this.inputUrl.getValue())}this.close()},textUrl:"Paste an image URL:",txtEmpty:"This field is required",txtNotUrl:'This field should be a URL in the format "http://www.example.com"'},Common.Views.ImageFromUrlDialog||{}))}),void 0===Common)var Common={};if(define("common/main/lib/component/LoadMask",["common/main/lib/component/BaseView"],function(){"use strict";Common.UI.LoadMask=Common.UI.BaseView.extend(function(){return{options:{cls:"",style:"",title:"Loading...",owner:document.body},template:_.template(['"].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t),this.template=this.options.template||this.template,this.title=this.options.title,this.ownerEl=this.options.owner instanceof Common.UI.BaseView?$(this.options.owner.el):$(this.options.owner),this.loaderEl=$(this.template({id:this.id,cls:this.options.cls,style:this.options.style,title:this.title})),this.maskeEl=$('
'),this.timerId=0},render:function(){return this},show:function(){var t=this.ownerEl,e=this.loaderEl,i=this.maskeEl;if(t.ismasked)return this;t.ismasked=!0;var n=this;return n.title!=n.options.title&&(n.options.title=n.title,$(".asc-loadmask-title",e).html(n.title)),n.timerId=setTimeout(function(){t.append(i),t.append(e),t&&0==t.closest(".asc-window.modal").length&&Common.util.Shortcuts.suspendEvents()},500),this},hide:function(){var t=this.ownerEl;this.timerId&&(clearTimeout(this.timerId),this.timerId=0),t&&t.ismasked&&(0!=t.closest(".asc-window.modal").length||Common.Utils.ModalWindow.isVisible()||Common.util.Shortcuts.resumeEvents(),this.maskeEl&&this.maskeEl.remove(),this.loaderEl&&this.loaderEl.remove()),delete t.ismasked},setTitle:function(t){this.title=t,this.ownerEl&&this.ownerEl.ismasked&&this.loaderEl&&$(".asc-loadmask-title",this.loaderEl).html(t)},isVisible:function(){return!!this.ownerEl.ismasked},updatePosition:function(){var t=this.ownerEl,e=this.loaderEl;t&&t.ismasked&&e&&(e.css({top:Math.round(t.height()/2-(e.height()+parseInt(e.css("padding-top"))+parseInt(e.css("padding-bottom")))/2)+"px",left:Math.round(t.width()/2-(e.width()+parseInt(e.css("padding-left"))+parseInt(e.css("padding-right")))/2)+"px"}),e.css({visibility:"visible"}))}}}())}),define("common/main/lib/view/SelectFileDlg",["common/main/lib/component/Window","common/main/lib/component/LoadMask"],function(){"use strict";Common.Views.SelectFileDlg=Common.UI.Window.extend(_.extend({initialize:function(t){var e={};_.extend(e,{title:this.textTitle,width:1024,height:621,header:!0},t),this.template=['
'].join(""),e.tpl=_.template(this.template)(e),this.fileChoiceUrl=t.fileChoiceUrl||"",Common.UI.Window.prototype.initialize.call(this,e)},render:function(){Common.UI.Window.prototype.render.call(this),this.$window.find("> .body").css({height:"auto",overflow:"hidden"});var t=document.createElement("iframe");t.width="100%",t.height=585,t.align="top",t.frameBorder=0,t.scrolling="no",t.onload=_.bind(this._onLoad,this),$("#id-select-file-placeholder").append(t),this.loadMask=new Common.UI.LoadMask({owner:$("#id-select-file-placeholder")}),this.loadMask.setTitle(this.textLoading),this.loadMask.show(),t.src=this.fileChoiceUrl;var e=this;this._eventfunc=function(t){e._onWindowMessage(t)},this._bindWindowEvents.call(this),this.on("close",function(t){e._unbindWindowEvents()})},_bindWindowEvents:function(){window.addEventListener?window.addEventListener("message",this._eventfunc,!1):window.attachEvent&&window.attachEvent("onmessage",this._eventfunc)},_unbindWindowEvents:function(){window.removeEventListener?window.removeEventListener("message",this._eventfunc):window.detachEvent&&window.detachEvent("onmessage",this._eventfunc)},_onWindowMessage:function(t){if(t&&window.JSON)try{this._onMessage.call(this,window.JSON.parse(t.data))}catch(t){}},_onMessage:function(t){if(t&&"onlyoffice"==t.Referer&&void 0!==t.file){Common.NotificationCenter.trigger("window:close",this);var e=this;setTimeout(function(){_.isEmpty(t.file)||e.trigger("selectfile",e,t.file)},50)}},_onLoad:function(){this.loadMask&&this.loadMask.hide()},textTitle:"Select Data Source",textLoading:"Loading"},Common.Views.SelectFileDlg||{}))}),void 0===Common)var Common={};if(void 0===Common.define&&(Common.define={}),define("common/main/lib/util/define",[],function(){"use strict";Common.define.c_oAscMathMainType={Symbol:0,Fraction:1,Script:2,Radical:3,Integral:4,LargeOperator:5,Bracket:6,Function:7,Accent:8,LimitLog:9,Operator:10,Matrix:11},Common.define.c_oAscMathType={Symbol_pm:0,Symbol_infinity:1,Symbol_equals:2,Symbol_neq:3,Symbol_about:4,Symbol_times:5,Symbol_div:6,Symbol_factorial:7,Symbol_propto:8,Symbol_less:9,Symbol_ll:10,Symbol_greater:11,Symbol_gg:12,Symbol_leq:13,Symbol_geq:14,Symbol_mp:15,Symbol_cong:16,Symbol_approx:17,Symbol_equiv:18,Symbol_forall:19,Symbol_additional:20,Symbol_partial:21,Symbol_sqrt:22,Symbol_cbrt:23,Symbol_qdrt:24,Symbol_cup:25,Symbol_cap:26,Symbol_emptyset:27,Symbol_percent:28,Symbol_degree:29,Symbol_fahrenheit:30,Symbol_celsius:31,Symbol_inc:32,Symbol_nabla:33,Symbol_exists:34,Symbol_notexists:35,Symbol_in:36,Symbol_ni:37,Symbol_leftarrow:38,Symbol_uparrow:39,Symbol_rightarrow:40,Symbol_downarrow:41,Symbol_leftrightarrow:42,Symbol_therefore:43,Symbol_plus:44,Symbol_minus:45,Symbol_not:46,Symbol_ast:47,Symbol_bullet:48,Symbol_vdots:49,Symbol_cdots:50,Symbol_rddots:51,Symbol_ddots:52,Symbol_aleph:53,Symbol_beth:54,Symbol_QED:55,Symbol_alpha:65536,Symbol_beta:65537,Symbol_gamma:65538,Symbol_delta:65539,Symbol_varepsilon:65540,Symbol_epsilon:65541,Symbol_zeta:65542,Symbol_eta:65543,Symbol_theta:65544,Symbol_vartheta:65545,Symbol_iota:65546,Symbol_kappa:65547,Symbol_lambda:65548,Symbol_mu:65549,Symbol_nu:65550,Symbol_xsi:65551,Symbol_o:65552,Symbol_pi:65553,Symbol_varpi:65554,Symbol_rho:65555,Symbol_varrho:65556,Symbol_sigma:65557,Symbol_varsigma:65558,Symbol_tau:65559,Symbol_upsilon:65560,Symbol_varphi:65561,Symbol_phi:65562,Symbol_chi:65563,Symbol_psi:65564,Symbol_omega:65565,Symbol_Alpha:131072,Symbol_Beta:131073,Symbol_Gamma:131074,Symbol_Delta:131075,Symbol_Epsilon:131076,Symbol_Zeta:131077,Symbol_Eta:131078,Symbol_Theta:131079,Symbol_Iota:131080,Symbol_Kappa:131081,Symbol_Lambda:131082,Symbol_Mu:131083,Symbol_Nu:131084,Symbol_Xsi:131085,Symbol_O:131086,Symbol_Pi:131087,Symbol_Rho:131088,Symbol_Sigma:131089,Symbol_Tau:131090,Symbol_Upsilon:131091,Symbol_Phi:131092,Symbol_Chi:131093,Symbol_Psi:131094,Symbol_Omega:131095,FractionVertical:16777216,FractionDiagonal:16777217,FractionHorizontal:16777218,FractionSmall:16777219,FractionDifferential_1:16842752,FractionDifferential_2:16842753,FractionDifferential_3:16842754,FractionDifferential_4:16842755,FractionPi_2:16842756,ScriptSup:33554432,ScriptSub:33554433,ScriptSubSup:33554434,ScriptSubSupLeft:33554435,ScriptCustom_1:33619968,ScriptCustom_2:33619969,ScriptCustom_3:33619970,ScriptCustom_4:33619971,RadicalSqrt:50331648,RadicalRoot_n:50331649,RadicalRoot_2:50331650,RadicalRoot_3:50331651,RadicalCustom_1:50397184,RadicalCustom_2:50397185,Integral:67108864,IntegralSubSup:67108865,IntegralCenterSubSup:67108866,IntegralDouble:67108867,IntegralDoubleSubSup:67108868,IntegralDoubleCenterSubSup:67108869,IntegralTriple:67108870,IntegralTripleSubSup:67108871,IntegralTripleCenterSubSup:67108872,IntegralOriented:67174400,IntegralOrientedSubSup:67174401,IntegralOrientedCenterSubSup:67174402,IntegralOrientedDouble:67174403,IntegralOrientedDoubleSubSup:67174404,IntegralOrientedDoubleCenterSubSup:67174405,IntegralOrientedTriple:67174406,IntegralOrientedTripleSubSup:67174407,IntegralOrientedTripleCenterSubSup:67174408,Integral_dx:67239936,Integral_dy:67239937,Integral_dtheta:67239938,LargeOperator_Sum:83886080,LargeOperator_Sum_CenterSubSup:83886081,LargeOperator_Sum_SubSup:83886082,LargeOperator_Sum_CenterSub:83886083,LargeOperator_Sum_Sub:83886084, +LargeOperator_Prod:83951616,LargeOperator_Prod_CenterSubSup:83951617,LargeOperator_Prod_SubSup:83951618,LargeOperator_Prod_CenterSub:83951619,LargeOperator_Prod_Sub:83951620,LargeOperator_CoProd:83951621,LargeOperator_CoProd_CenterSubSup:83951622,LargeOperator_CoProd_SubSup:83951623,LargeOperator_CoProd_CenterSub:83951624,LargeOperator_CoProd_Sub:83951625,LargeOperator_Union:84017152,LargeOperator_Union_CenterSubSup:84017153,LargeOperator_Union_SubSup:84017154,LargeOperator_Union_CenterSub:84017155,LargeOperator_Union_Sub:84017156,LargeOperator_Intersection:84017157,LargeOperator_Intersection_CenterSubSup:84017158,LargeOperator_Intersection_SubSup:84017159,LargeOperator_Intersection_CenterSub:84017160,LargeOperator_Intersection_Sub:84017161,LargeOperator_Disjunction:84082688,LargeOperator_Disjunction_CenterSubSup:84082689,LargeOperator_Disjunction_SubSup:84082690,LargeOperator_Disjunction_CenterSub:84082691,LargeOperator_Disjunction_Sub:84082692,LargeOperator_Conjunction:84082693,LargeOperator_Conjunction_CenterSubSup:84082694,LargeOperator_Conjunction_SubSup:84082695,LargeOperator_Conjunction_CenterSub:84082696,LargeOperator_Conjunction_Sub:84082697,LargeOperator_Custom_1:84148224,LargeOperator_Custom_2:84148225,LargeOperator_Custom_3:84148226,LargeOperator_Custom_4:84148227,LargeOperator_Custom_5:84148228,Bracket_Round:100663296,Bracket_Square:100663297,Bracket_Curve:100663298,Bracket_Angle:100663299,Bracket_LowLim:100663300,Bracket_UppLim:100663301,Bracket_Line:100663302,Bracket_LineDouble:100663303,Bracket_Square_OpenOpen:100663304,Bracket_Square_CloseClose:100663305,Bracket_Square_CloseOpen:100663306,Bracket_SquareDouble:100663307,Bracket_Round_Delimiter_2:100728832,Bracket_Curve_Delimiter_2:100728833,Bracket_Angle_Delimiter_2:100728834,Bracket_Angle_Delimiter_3:100728835,Bracket_Round_OpenNone:100794368,Bracket_Round_NoneOpen:100794369,Bracket_Square_OpenNone:100794370,Bracket_Square_NoneOpen:100794371,Bracket_Curve_OpenNone:100794372,Bracket_Curve_NoneOpen:100794373,Bracket_Angle_OpenNone:100794374,Bracket_Angle_NoneOpen:100794375,Bracket_LowLim_OpenNone:100794376,Bracket_LowLim_NoneNone:100794377,Bracket_UppLim_OpenNone:100794378,Bracket_UppLim_NoneOpen:100794379,Bracket_Line_OpenNone:100794380,Bracket_Line_NoneOpen:100794381,Bracket_LineDouble_OpenNone:100794382,Bracket_LineDouble_NoneOpen:100794383,Bracket_SquareDouble_OpenNone:100794384,Bracket_SquareDouble_NoneOpen:100794385,Bracket_Custom_1:100859904,Bracket_Custom_2:100859905,Bracket_Custom_3:100859906,Bracket_Custom_4:100859907,Bracket_Custom_5:100925440,Bracket_Custom_6:100925441,Bracket_Custom_7:100925442,Function_Sin:117440512,Function_Cos:117440513,Function_Tan:117440514,Function_Csc:117440515,Function_Sec:117440516,Function_Cot:117440517,Function_1_Sin:117506048,Function_1_Cos:117506049,Function_1_Tan:117506050,Function_1_Csc:117506051,Function_1_Sec:117506052,Function_1_Cot:117506053,Function_Sinh:117571584,Function_Cosh:117571585,Function_Tanh:117571586,Function_Csch:117571587,Function_Sech:117571588,Function_Coth:117571589,Function_1_Sinh:117637120,Function_1_Cosh:117637121,Function_1_Tanh:117637122,Function_1_Csch:117637123,Function_1_Sech:117637124,Function_1_Coth:117637125,Function_Custom_1:117702656,Function_Custom_2:117702657,Function_Custom_3:117702658,Accent_Dot:134217728,Accent_DDot:134217729,Accent_DDDot:134217730,Accent_Hat:134217731,Accent_Check:134217732,Accent_Accent:134217733,Accent_Grave:134217734,Accent_Smile:134217735,Accent_Tilde:134217736,Accent_Bar:134217737,Accent_DoubleBar:134217738,Accent_CurveBracketTop:134217739,Accent_CurveBracketBot:134217740,Accent_GroupTop:134217741,Accent_GroupBot:134217742,Accent_ArrowL:134217743,Accent_ArrowR:134217744,Accent_ArrowD:134217745,Accent_HarpoonL:134217746,Accent_HarpoonR:134217747,Accent_BorderBox:134283264,Accent_BorderBoxCustom:134283265,Accent_BarTop:134348800,Accent_BarBot:134348801,Accent_Custom_1:134414336,Accent_Custom_2:134414337,Accent_Custom_3:134414338,LimitLog_LogBase:150994944,LimitLog_Log:150994945,LimitLog_Lim:150994946,LimitLog_Min:150994947,LimitLog_Max:150994948,LimitLog_Ln:150994949,LimitLog_Custom_1:151060480,LimitLog_Custom_2:151060481,Operator_ColonEquals:167772160,Operator_EqualsEquals:167772161,Operator_PlusEquals:167772162,Operator_MinusEquals:167772163,Operator_Definition:167772164,Operator_UnitOfMeasure:167772165,Operator_DeltaEquals:167772166,Operator_ArrowL_Top:167837696,Operator_ArrowR_Top:167837697,Operator_ArrowL_Bot:167837698,Operator_ArrowR_Bot:167837699,Operator_DoubleArrowL_Top:167837700,Operator_DoubleArrowR_Top:167837701,Operator_DoubleArrowL_Bot:167837702,Operator_DoubleArrowR_Bot:167837703,Operator_ArrowD_Top:167837704,Operator_ArrowD_Bot:167837705,Operator_DoubleArrowD_Top:167837706,Operator_DoubleArrowD_Bot:167837707,Operator_Custom_1:167903232,Operator_Custom_2:167903233,Matrix_1_2:184549376,Matrix_2_1:184549377,Matrix_1_3:184549378,Matrix_3_1:184549379,Matrix_2_2:184549380,Matrix_2_3:184549381,Matrix_3_2:184549382,Matrix_3_3:184549383,Matrix_Dots_Center:184614912,Matrix_Dots_Baseline:184614913,Matrix_Dots_Vertical:184614914,Matrix_Dots_Diagonal:184614915,Matrix_Identity_2:184680448,Matrix_Identity_2_NoZeros:184680449,Matrix_Identity_3:184680450,Matrix_Identity_3_NoZeros:184680451,Matrix_2_2_RoundBracket:184745984,Matrix_2_2_SquareBracket:184745985,Matrix_2_2_LineBracket:184745986,Matrix_2_2_DLineBracket:184745987,Matrix_Flat_Round:184811520,Matrix_Flat_Square:184811521},Common.define.chartData=_.extend(new function(){return{textLine:"Line",textColumn:"Column",textBar:"Bar",textArea:"Area",textPie:"Pie",textPoint:"XY (Scatter)",textStock:"Stock",textSurface:"Surface",textCharts:"Charts",textSparks:"Sparklines",textLineSpark:"Line",textColumnSpark:"Column",textWinLossSpark:"Win/Loss",getChartGroupData:function(t){return[{id:"menu-chart-group-bar",caption:this.textColumn,headername:t?this.textCharts:void 0},{id:"menu-chart-group-line",caption:this.textLine},{id:"menu-chart-group-pie",caption:this.textPie},{id:"menu-chart-group-hbar",caption:this.textBar},{id:"menu-chart-group-area",caption:this.textArea,inline:!0},{id:"menu-chart-group-scatter",caption:this.textPoint,inline:!0},{id:"menu-chart-group-stock",caption:this.textStock,inline:!0}]},getChartData:function(){return[{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barNormal,iconCls:"column-normal"},{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barStacked,iconCls:"column-stack"},{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barStackedPer,iconCls:"column-pstack"},{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barNormal3d,iconCls:"column-3d-normal"},{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barStacked3d,iconCls:"column-3d-stack"},{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barStackedPer3d,iconCls:"column-3d-pstack"},{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barNormal3dPerspective,iconCls:"column-3d-normal-per"},{group:"menu-chart-group-line",type:Asc.c_oAscChartTypeSettings.lineNormal,iconCls:"line-normal"},{group:"menu-chart-group-line",type:Asc.c_oAscChartTypeSettings.lineStacked,iconCls:"line-stack"},{group:"menu-chart-group-line",type:Asc.c_oAscChartTypeSettings.lineStackedPer,iconCls:"line-pstack"},{group:"menu-chart-group-line",type:Asc.c_oAscChartTypeSettings.line3d,iconCls:"line-3d"},{group:"menu-chart-group-pie",type:Asc.c_oAscChartTypeSettings.pie,iconCls:"pie-normal"},{group:"menu-chart-group-pie",type:Asc.c_oAscChartTypeSettings.doughnut,iconCls:"pie-doughnut"},{group:"menu-chart-group-pie",type:Asc.c_oAscChartTypeSettings.pie3d,iconCls:"pie-3d-normal"},{group:"menu-chart-group-hbar",type:Asc.c_oAscChartTypeSettings.hBarNormal,iconCls:"bar-normal"},{group:"menu-chart-group-hbar",type:Asc.c_oAscChartTypeSettings.hBarStacked,iconCls:"bar-stack"},{group:"menu-chart-group-hbar",type:Asc.c_oAscChartTypeSettings.hBarStackedPer,iconCls:"bar-pstack"},{group:"menu-chart-group-hbar",type:Asc.c_oAscChartTypeSettings.hBarNormal3d,iconCls:"bar-3d-normal"},{group:"menu-chart-group-hbar",type:Asc.c_oAscChartTypeSettings.hBarStacked3d,iconCls:"bar-3d-stack"},{group:"menu-chart-group-hbar",type:Asc.c_oAscChartTypeSettings.hBarStackedPer3d,iconCls:"bar-3d-pstack"},{group:"menu-chart-group-area",type:Asc.c_oAscChartTypeSettings.areaNormal,iconCls:"area-normal"},{group:"menu-chart-group-area",type:Asc.c_oAscChartTypeSettings.areaStacked,iconCls:"area-stack"},{group:"menu-chart-group-area",type:Asc.c_oAscChartTypeSettings.areaStackedPer,iconCls:"area-pstack"},{group:"menu-chart-group-scatter",type:Asc.c_oAscChartTypeSettings.scatter,iconCls:"point-normal"},{group:"menu-chart-group-stock",type:Asc.c_oAscChartTypeSettings.stock,iconCls:"stock-normal"}]},getSparkGroupData:function(t){return[{id:"menu-chart-group-sparkcolumn",inline:!0,headername:t?this.textSparks:void 0},{id:"menu-chart-group-sparkline",inline:!0},{id:"menu-chart-group-sparkwin",inline:!0}]},getSparkData:function(){return[{group:"menu-chart-group-sparkcolumn",type:Asc.c_oAscSparklineType.Column,allowSelected:!0,iconCls:"spark-column",tip:this.textColumnSpark},{group:"menu-chart-group-sparkline",type:Asc.c_oAscSparklineType.Line,allowSelected:!0,iconCls:"spark-line",tip:this.textLineSpark},{group:"menu-chart-group-sparkwin",type:Asc.c_oAscSparklineType.Stacked,allowSelected:!0,iconCls:"spark-win",tip:this.textWinLossSpark}]}}},Common.define.chartData||{})}),define("text!documenteditor/main/app/template/Toolbar.template",[],function(){return'
\n
\n
\n <%= tabsmarkup %>\n
\n
\n
\n
\n
\n
\n \n
\n
\n \n
\n
\n
\n
\n
\n \n \n
\n
\n \n \n
\n
\n
\n
\n
\n
\n
\n
\n \n \n \n \n
\n
\n \n \n \n \n \n \n \n \n \n
\n
\n
\n
\n
\n \n \n \n \n \n \n
\n
\n \n \n \n \n \n
\n
\n
\n
\n
\n \n \n
\n
\n \n \n
\n
\n
\n
\n
\n
\n \n \n
\n
\n
\n \n
\n
\n
\n \n \n \n
\n
\n
\n \n \n
\n
\n
\n \n \n
\n
\n
\n \n \n
\n
\n
\n \n \n
\n
\n
\n \n
\n
\n
\n \n
\n
\n
\n
\n \n \n \n \n \n \n
\n
\n
\n \n \n \n \n \n
\n
\n
\n \n
\n
\n
\n
\n \n \n
\n
\n
\n \n
\n
\n
\n \n \n
\n
\n
\n \n \n
\n
\n
\n \n
\n
\n \n
\n
\n
\n
\n
\n \n \n \n \n \n \n
\n
\n
\n
\n \n
\n
\n \n
\n
\n
\n
\n \n
\n
\n
\n
\n
'}),define("text!documenteditor/main/app/template/ToolbarView.template",[],function(){return'
\n
\n
\n <%= tabsmarkup %>\n
\n
\n
\n
\n
\n
\n
\n
'}),void 0===Common)var Common={};if(Common.Models=Common.Models||{},define("common/main/lib/model/Font",["backbone"],function(t){"use strict";Common.Models.Font=t.Model.extend({defaults:function(){return{id:Common.UI.getId(),name:null,cloneid:null,imgidx:0,type:0}}})}),void 0===Common)var Common={};if(Common.Collections=Common.Collections||{},define("common/main/lib/collection/Fonts",["backbone","common/main/lib/model/Font"],function(t){"use strict";Common.Collections.Fonts=t.Collection.extend({model:Common.Models.Font,comparator:function(t,e){var i=t.get("name").toLowerCase(),n=e.get("name").toLowerCase();return i==n?0:i',"<% _.each(colors, function(color, index) { %>",'',"<% }) %>",""].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t);var e=this;this.id=e.options.id,this.cls=e.options.cls,this.style=e.options.style,this.colors=e.options.colors||[],this.value=e.options.value,e.options.el&&e.render()},render:function(t){var e=this;return e.rendered?this.cmpEl=e.$el||$(this.el):(this.cmpEl=$(this.template({id:this.id,cls:this.cls,style:this.style,colors:this.colors})),t?(this.setElement(t,!1),t.html(this.cmpEl)):e.$el.html(this.cmpEl)),e.rendered||e.cmpEl.on("click","span.color-item",e.itemClick.bind(e)),e.rendered=!0,this},itemClick:function(t){var e=$(t.target);this.select(e.attr("data-color"))},select:function(t,e){if(this.value!=t){var i=this;$("span.color-item",this.cmpEl).removeClass("selected"),this.value=t,t&&/#?[a-fA-F0-9]{6}/.test(t)&&(t=/#?([a-fA-F0-9]{6})/.exec(t)[1].toUpperCase(),$("span[data-color="+t+"]",this.cmpEl).addClass("selected"),e||i.trigger("select",i,this.value))}}})}),void 0===Common)var Common={};if(define("common/main/lib/component/DimensionPicker",["common/main/lib/component/BaseView"],function(){"use strict";Common.UI.DimensionPicker=Common.UI.BaseView.extend(function(){return{options:{itemSize:18,minRows:5,minColumns:5,maxRows:20,maxColumns:20},template:_.template(['
','
0x0
','
','
','
','
',"
","
"].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t);var e=this;this.render(),this.cmpEl=e.$el||$(this.el);var i=this.cmpEl;e.itemSize=e.options.itemSize,e.minRows=e.options.minRows,e.minColumns=e.options.minColumns,e.maxRows=e.options.maxRows,e.maxColumns=e.options.maxColumns,e.curColumns=0,e.curRows=0;var n=function(t){e.setTableSize(Math.ceil((void 0===t.offsetX?t.originalEvent.layerX:t.offsetX*Common.Utils.zoom())/e.itemSize),Math.ceil((void 0===t.offsetY?t.originalEvent.layerY:t.offsetY*Common.Utils.zoom())/e.itemSize),t)},o=function(t){e.setTableSize(0,0,t)},s=function(t){e.trigger("select",e,e.curColumns,e.curRows,t)};if(i){var a=i.find(".dimension-picker-mousecatcher");e.areaUnHighLighted=i.find(".dimension-picker-unhighlighted"),e.areaHighLighted=i.find(".dimension-picker-highlighted"),e.areaStatus=i.find(".dimension-picker-status"),i.css({width:e.minColumns+"em"}),a.css("z-index",1),a.width(e.maxColumns+"em").height(e.maxRows+"em"),e.areaUnHighLighted.width(e.minColumns+"em").height(e.minRows+"em"),e.areaStatus.html(e.curColumns+" x "+e.curRows),e.areaStatus.width(e.areaUnHighLighted.width()),a.on("mousemove",n),e.areaHighLighted.on("mousemove",n),e.areaUnHighLighted.on("mousemove",n),a.on("mouseleave",o),e.areaHighLighted.on("mouseleave",o),e.areaUnHighLighted.on("mouseleave",o),a.on("click",s),e.areaHighLighted.on("click",s),e.areaUnHighLighted.on("click",s)}},render:function(){return(this.$el||$(this.el)).html(this.template()),this},setTableSize:function(t,e,i){t>this.maxColumns&&(t=this.maxColumns),e>this.maxRows&&(e=this.maxRows),this.curColumns==t&&this.curRows==e||(this.curColumns=t,this.curRows=e,this.areaHighLighted.width(this.curColumns+"em").height(this.curRows+"em"),this.areaUnHighLighted.width((this.curColumnsthis.maxColumns?this.maxColumns:this.curColumns+1)+"em").height((this.curRowsthis.maxRows?this.maxRows:this.curRows+1)+"em"),this.cmpEl.width(this.areaUnHighLighted.width()),this.areaStatus.html(this.curColumns+" x "+this.curRows),this.areaStatus.width(this.areaUnHighLighted.width()),this.trigger("change",this,this.curColumns,this.curRows,i))},getColumnsCount:function(){return this.curColumns},getRowsCount:function(){return this.curRows}}}())}),void 0===Common)var Common={};if(define("common/main/lib/component/ComboDataView",["common/main/lib/component/BaseView","common/main/lib/component/DataView"],function(){"use strict";Common.UI.ComboDataView=Common.UI.BaseView.extend({options:{id:null,cls:"",style:"",hint:!1,itemWidth:80,itemHeight:40,menuMaxHeight:300,enableKeyEvents:!1,beforeOpenHandler:null,additionalMenuItems:null,showLast:!0,minWidth:-1},template:_.template(['
','
','
',"
"].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t),this.id=this.options.id||Common.UI.getId(),this.cls=this.options.cls,this.style=this.options.style,this.hint=this.options.hint,this.store=this.options.store||new Common.UI.DataViewStore,this.itemWidth=this.options.itemWidth,this.itemHeight=this.options.itemHeight,this.menuMaxHeight=this.options.menuMaxHeight,this.beforeOpenHandler=this.options.beforeOpenHandler,this.showLast=this.options.showLast,this.rootWidth=0,this.rootHeight=0,this.rendered=!1,this.needFillComboView=!1,this.minWidth=this.options.minWidth,this.fieldPicker=new Common.UI.DataView({cls:"field-picker",allowScrollbar:!1,itemTemplate:_.template(['
','','<% if (typeof title !== "undefined") {%>','<%= title %>',"<% } %>","
"].join(""))}),this.openButton=new Common.UI.Button({cls:"open-menu",menu:new Common.UI.Menu({menuAlign:"tl-tl",offset:[0,3],items:[{template:_.template('')}]})}),null!=this.options.additionalMenuItems&&(this.openButton.menu.items=this.openButton.menu.items.concat(this.options.additionalMenuItems)),this.menuPicker=new Common.UI.DataView({cls:"menu-picker",parentMenu:this.openButton.menu,restoreHeight:this.menuMaxHeight,style:"max-height: "+this.menuMaxHeight+"px;",enableKeyEvents:this.options.enableKeyEvents,store:this.store,itemTemplate:_.template(['
','','<% if (typeof title !== "undefined") {%>','<%= title %>',"<% } %>","
"].join(""))}),setInterval(_.bind(this.checkSize,this),500),this.options.el&&this.render()},render:function(t){if(!this.rendered){var e=this;e.trigger("render:before",e),e.cmpEl=e.$el||$(e.el);var i=e.template({id:e.id,cls:e.cls,style:e.style});t?(e.setElement(t,!1),e.cmpEl=$(i),t.html(e.cmpEl)):e.cmpEl.html(i),e.rootWidth=e.cmpEl.width(),e.rootHeight=e.cmpEl.height(),e.fieldPicker.render($(".view",e.cmpEl)),e.openButton.render($(".button",e.cmpEl)),e.menuPicker.render($(".menu-picker-container",e.cmpEl)),e.openButton.menu.cmpEl&&e.openButton.menu.cmpEl&&(e.openButton.menu.menuAlignEl=e.cmpEl,e.openButton.menu.cmpEl.css("min-width",e.itemWidth),e.openButton.menu.on("show:before",_.bind(e.onBeforeShowMenu,e)),e.openButton.menu.on("show:after",_.bind(e.onAfterShowMenu,e)),e.openButton.cmpEl.on("hide.bs.dropdown",_.bind(e.onBeforeHideMenu,e)),e.openButton.cmpEl.on("hidden.bs.dropdown",_.bind(e.onAfterHideMenu,e))),e.options.hint&&(e.cmpEl.attr("data-toggle","tooltip"),e.cmpEl.tooltip({title:e.options.hint,placement:e.options.hintAnchor||"cursor"})),e.fieldPicker.on("item:select",_.bind(e.onFieldPickerSelect,e)),e.menuPicker.on("item:select",_.bind(e.onMenuPickerSelect,e)),e.fieldPicker.on("item:click",_.bind(e.onFieldPickerClick,e)),e.menuPicker.on("item:click",_.bind(e.onMenuPickerClick,e)),e.fieldPicker.on("item:contextmenu",_.bind(e.onPickerItemContextMenu,e)),e.menuPicker.on("item:contextmenu",_.bind(e.onPickerItemContextMenu,e)),e.fieldPicker.el.addEventListener("contextmenu",_.bind(e.onPickerComboContextMenu,e),!1),e.menuPicker.el.addEventListener("contextmenu",_.bind(e.onPickerComboContextMenu,e),!1),e.onResize(),e.rendered=!0,e.trigger("render:after",e)}return this},checkSize:function(){if(this.cmpEl&&this.cmpEl.is(":visible")){var t=this,e=this.cmpEl.width(),i=this.cmpEl.height();if(e div:not(.grouped-data):not(.ps-scrollbar-x-rail):not(.ps-scrollbar-y-rail)")[0]);a.length>0&&(n.itemMarginLeft=parseInt(a.css("margin-left")),n.itemMarginRight=parseInt(a.css("margin-right")),n.itemPaddingLeft=parseInt(a.css("padding-left")),n.itemPaddingRight=parseInt(a.css("padding-right")),n.itemBorderLeft=parseInt(a.css("border-left-width")),n.itemBorderRight=parseInt(a.css("border-right-width")))}var r=o.indexOf(t);if(r<0)return;var l=o.length,c=Math.floor(Math.max(s.width(),n.minWidth)/(n.itemWidth+(n.itemMarginLeft||0)+(n.itemMarginRight||0)+(n.itemPaddingLeft||0)+(n.itemPaddingRight||0)+(n.itemBorderLeft||0)+(n.itemBorderRight||0))),d=[];s.height()/n.itemHeight>2&&(c*=Math.floor(s.height()/n.itemHeight)),r=Math.floor(r/c)*c,l-r1?t/2:t)},setItemHeight:function(t){this.itemHeight!=t&&(this.itemHeight=window.devicePixelRatio>1?t/2:t)},removeTips:function(){var t=this.menuPicker;_.each(t.dataViewItems,function(t){var e=t.$el.data("bs.tooltip");e&&e.tip().remove()},t)}})}),void 0===Common)var Common={};if(define("common/main/lib/component/SynchronizeTip",["common/main/lib/component/BaseView"],function(){"use strict";Common.UI.SynchronizeTip=Common.UI.BaseView.extend(_.extend(function(){return{options:{target:$(document.body),text:"",placement:"right",showLink:!0},template:_.template(['
<%= scope.placement %>">','
','
',"
",'
<%= scope.text %>
','
',"
","<% if ( scope.showLink ) { %>",'',"<% } %>","
","
"].join("")),initialize:function(t){this.textSynchronize+=Common.Utils.String.platformKey("Ctrl+S"),Common.UI.BaseView.prototype.initialize.call(this,t),this.target=this.options.target,this.text=_.isEmpty(this.options.text)?this.textSynchronize:this.options.text,this.textLink=_.isEmpty(this.options.textLink)?this.textDontShow:this.options.textLink,this.placement=this.options.placement,this.showLink=this.options.showLink},render:function(){return this.cmpEl||(this.cmpEl=$(this.template({scope:this})),$(document.body).append(this.cmpEl),this.cmpEl.find(".close").on("click",_.bind(function(){this.trigger("closeclick")},this)),this.cmpEl.find(".show-link label").on("click",_.bind(function(){this.trigger("dontshowclick")},this))),this.applyPlacement(),this},show:function(){this.cmpEl?(this.applyPlacement(),this.cmpEl.show()):this.render()},hide:function(){this.cmpEl&&this.cmpEl.hide()},close:function(){this.cmpEl&&this.cmpEl.remove()},applyPlacement:function(){var t=this.target.offset(),e=Common.Utils.innerHeight();if("document"==this.placement);else if("top"==this.placement)this.cmpEl.css({bottom:e-t.top+"px",right:Common.Utils.innerWidth()-t.left-this.target.width()/2+"px"});else if("target"==this.placement)this.cmpEl.css({top:t.top+5+"px",left:t.left+5+"px"});else{var i=t.top+this.target.height()/2,n=this.cmpEl.height();i+n>e&&(i=e-n),"left"==this.placement?this.cmpEl.css({top:i+"px",right:Common.Utils.innerWidth()-t.left-5+"px"}):this.cmpEl.css({top:i+"px",left:t.left+this.target.width()+"px"})}},isVisible:function(){return this.cmpEl&&this.cmpEl.is(":visible")},textDontShow:"Don't show this message again",textSynchronize:"The document has been changed by another user.
Please click to save your changes and reload the updates."}}(),Common.UI.SynchronizeTip||{}))}),define("common/main/lib/component/Mixtbar",["backbone","common/main/lib/component/BaseView"],function(t){"use strict";Common.UI.Mixtbar=Common.UI.BaseView.extend(function(){function t(t){var e=$(t.currentTarget).find("> a[data-tab]").data("tab");this.dblclick_el==e&&(this.fireEvent("change:compact",[e]),this.dblclick_el=void 0)}function e(t){this.isFolded&&($(t.target).parents(".toolbar, #file-menu-panel").length||o.$bar&&o.$bar.hasClass("expanded")&&this.collapse())}var i,n,o={timeout:2e3},s={},a=function(t,e){var n=i.scrollLeft();(n||"right"==t)&&i.animate({scrollLeft:"left"==t?n-100:n+100},200)};return{$tabs:void 0,$panels:void 0,isFolded:!1,initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t);this.$layout=$(t.template({tabsmarkup:_.template('
    <% for(var i in items) { %><% if (typeof items[i] == "object") { %>
  • <% if (items[i].extcls) print(\' \' + items[i].extcls) %>"><%= items[i].caption %>
  • <% } %><% } %>
')({items:t.tabs})})),s.tabs=t.tabs,$(document.body).on("click",e.bind(this)),Common.NotificationCenter.on("tab:visible",_.bind(function(t,e){this.setVisible(t,e)},this))},afterRender:function(){var e=this;i=e.$(".tabs > ul"),e.$tabs=i.find("> li"),e.$panels=e.$(".box-panels > .panel"),o.$bar=e.$(".toolbar");var s=e.$(".tabs .scroll.right");n=e.$(".tabs .scroll.left"),n.on("click",a.bind(this,"left")),s.on("click",a.bind(this,"right")),i.on("dblclick","> .ribtab",t.bind(this)),i.on("click","> .ribtab",e.onTabClick.bind(this))},isTabActive:function(t){var e=this.$tabs.filter(".active").find("> a");return e.length&&e.data("tab")==t},setFolded:function(t){this.isFolded=t;var e=this;if(this.isFolded)o.$box||(o.$box=e.$el.find(".box-controls")),o.$bar.addClass("folded z-clear").toggleClass("expanded",!1),o.$bar.find(".tabs .ribtab").removeClass("active"),o.$bar.on($.support.transition.end,function(t){o.$bar.hasClass("folded")&&!o.$bar.hasClass("expanded")&&o.$bar.toggleClass("z-clear",!0)}),o.$box.on({mouseleave:function(t){},mouseenter:function(t){}});else{o.$bar.removeClass("folded z-clear"),o.$box.off();var i=o.$box.find(".panel.active");if(i.length){var n=i.data("tab");e.$tabs.find("> a[data-tab="+n+"]").parent().toggleClass("active",!0)}else n=e.$tabs.siblings(":not(.x-lone):visible").first().find("> a[data-tab]").data("tab"),e.setTab(n)}},collapse:function(){Common.UI.Menu.Manager.hideAll(),this.isFolded&&o.$bar&&(o.$bar.removeClass("expanded"),o.$bar.find(".tabs .ribtab").removeClass("active"))},expand:function(){o.$bar.removeClass("z-clear"),o.$bar.addClass("expanded")},onResize:function(t){this.hasTabInvisible()?i.parent().hasClass("short")||i.parent().addClass("short"):i.parent().hasClass("short")&&i.parent().removeClass("short"),this.processPanelVisible()},onTabClick:function(t){var e=this,i=$(t.currentTarget),n=i.find("> a[data-tab]").data("tab");i.hasClass("x-lone")?e.isFolded&&e.collapse():i.hasClass("active")?e._timerSetTab||(e.dblclick_el=n,e.isFolded&&(e.collapse(),setTimeout(function(){e.dblclick_el=void 0},500))):(e._timerSetTab=!0,setTimeout(function(){e._timerSetTab=!1},500),e.setTab(n),e.processPanelVisible(null,!0),e.isFolded?e.dblclick_el=n:(e.dblclick_timer&&clearTimeout(e.dblclick_timer),e.dblclick_timer=setTimeout(function(){e.dblclick_el=n,delete e.dblclick_timer},500)))},setTab:function(t){var e=this;if(t||(this.isFolded?this.collapse():t=this.lastPanel),t){e.$tabs.removeClass("active"),e.$panels.removeClass("active");var i=this.$panels.filter("[data-tab="+t+"]");i.length&&(this.lastPanel=t,i.addClass("active")),i.length?e.isFolded&&e.expand():e.isFolded&&e.collapse();var n=this.$tabs.find("> a[data-tab="+t+"]").parent();n.length&&n.addClass("active"),this.fireEvent("tab:active",[t])}},addTab:function(t,e,n){function o(t){return s.tabs[t]?s.tabs[t].action:o(--t)}var a=_.template('');s.tabs[n+1]=t;var r=o(n),l=this.$tabs||this.$layout.find(".tabs"),c=l.find("a[data-tab="+r+"]");c.length&&(c.parent().after(a(t)),e&&(l=this.$panels||this.$layout.find(".box-panels > .panel"),c=l.filter("[data-tab="+r+"]"),c.length?c.after(e):e.appendTo(this.$layout.find(".box-panels"))),this.$tabs&&(this.$tabs=i.find("> li")),this.$panels&&(this.$panels=this.$el.find(".box-panels > .panel")))},isCompact:function(){return this.isFolded},hasTabInvisible:function(){if(i.length<1)return!1;var t=Math.round(i.offset().left),e=Math.round(t+i.width()),n=this.$tabs.filter(":visible:first").get(0);if(!n)return!1;var o=n.getBoundingClientRect();return Math.round(o.left)e)},processPanelVisible:function(t,e){function i(){var e=t||n.$panels.filter(".active");if(e&&e.length){var i=e.parents(".box-controls").width(),o=e.data(),s=o.rightedge,a=o.buttons,r=o.flex;if(s||(s=e.get(0).getBoundingClientRect().right),a||(a=[],_.each(e.find(".btn-slot .x-huge"),function(t){a.push($(t).closest(".btn-slot"))}),o.buttons=a),r||(r=[],_.each(e.find(".group.flex"),function(t){var e=$(t);r.push({el:e,width:e.attr("data-group-width")||e.attr("max-width")})}),o.flex=r),s>i){if(r.length>0)for(var l=0;lparseInt(c.css("min-width")))return;c.css("width",c.css("min-width"))}for(var l=a.length-1;l>=0;l--){var d=a[l];if(!d.hasClass("compactwidth")&&(d.addClass("compactwidth"),(s=e.get(0).getBoundingClientRect().right)<=i))break}o.rightedge=s}else{for(var l=0;li)){d.addClass("compactwidth"),s=e.get(0).getBoundingClientRect().right;break}}if(o.rightedge=s,r.length>0&&e.find(".btn-slot.compactwidth").length<1)for(var l=0;l a[data-tab="+t+"]").parent().css("display",e?"":"none"),this.onResize())}}}())}),define("documenteditor/main/app/view/Toolbar",["jquery","underscore","backbone","text!documenteditor/main/app/template/Toolbar.template","text!documenteditor/main/app/template/ToolbarView.template","common/main/lib/collection/Fonts","common/main/lib/component/Button","common/main/lib/component/ComboBox","common/main/lib/component/DataView","common/main/lib/component/ColorPalette","common/main/lib/component/ThemeColorPalette","common/main/lib/component/Menu","common/main/lib/component/DimensionPicker","common/main/lib/component/Window","common/main/lib/component/ComboBoxFonts","common/main/lib/component/ComboDataView","common/main/lib/component/SynchronizeTip","common/main/lib/component/Mixtbar"],function(t,e,i,n,o){"use strict";DE.Views.Toolbar=Common.UI.Mixtbar.extend(e.extend(function(){return{el:"#toolbar",events:{},initialize:function(){var t=this;return this.SchemeNames=[this.txtScheme1,this.txtScheme2,this.txtScheme3,this.txtScheme4,this.txtScheme5,this.txtScheme6,this.txtScheme7,this.txtScheme8,this.txtScheme9,this.txtScheme10,this.txtScheme11,this.txtScheme12,this.txtScheme13,this.txtScheme14,this.txtScheme15,this.txtScheme16,this.txtScheme17,this.txtScheme18,this.txtScheme19,this.txtScheme20,this.txtScheme21],this.paragraphControls=[],this.toolbarControls=[],this.textOnlyControls=[],this._state={hasCollaborativeChanges:void 0,previewmode:!1},Common.NotificationCenter.on("app:ready",t.onAppReady.bind(this)),this},applyLayout:function(i){var s=this;if(i.isEdit){Common.UI.Mixtbar.prototype.initialize.call(this,{template:e.template(n),tabs:[{caption:s.textTabFile,action:"file",extcls:"canedit",haspanel:!1},{caption:s.textTabHome,action:"home",extcls:"canedit"},{caption:s.textTabInsert,action:"ins",extcls:"canedit"},{caption:s.textTabLayout,action:"layout",extcls:"canedit"},{caption:s.textTabLinks,action:"links",extcls:"canedit"}]}),this.btnSaveCls="btn-save",this.btnSaveTip=this.tipSave+Common.Utils.String.platformKey("Ctrl+S"),this.btnPrint=new Common.UI.Button({id:"id-toolbar-btn-print",cls:"btn-toolbar",iconCls:"toolbar__icon btn-print no-mask",signals:["disabled"]}),this.toolbarControls.push(this.btnPrint),this.btnSave=new Common.UI.Button({id:"id-toolbar-btn-save",cls:"btn-toolbar",iconCls:"toolbar__icon no-mask "+this.btnSaveCls,signals:["disabled"]}),this.toolbarControls.push(this.btnSave),this.btnCollabChanges=this.btnSave,this.btnUndo=new Common.UI.Button({id:"id-toolbar-btn-undo",cls:"btn-toolbar",iconCls:"toolbar__icon btn-undo",signals:["disabled"]}),this.toolbarControls.push(this.btnUndo),this.btnRedo=new Common.UI.Button({id:"id-toolbar-btn-redo",cls:"btn-toolbar",iconCls:"toolbar__icon btn-redo",signals:["disabled"]}),this.toolbarControls.push(this.btnRedo),this.btnCopy=new Common.UI.Button({id:"id-toolbar-btn-copy",cls:"btn-toolbar",iconCls:"toolbar__icon btn-copy"}),this.toolbarControls.push(this.btnCopy),this.btnPaste=new Common.UI.Button({id:"id-toolbar-btn-paste",cls:"btn-toolbar",iconCls:"toolbar__icon btn-paste"}),this.paragraphControls.push(this.btnPaste),this.btnIncFontSize=new Common.UI.Button({id:"id-toolbar-btn-incfont",cls:"btn-toolbar",iconCls:"toolbar__icon btn-incfont"}),this.paragraphControls.push(this.btnIncFontSize),this.btnDecFontSize=new Common.UI.Button({id:"id-toolbar-btn-decfont",cls:"btn-toolbar",iconCls:"toolbar__icon btn-decfont"}),this.paragraphControls.push(this.btnDecFontSize),this.btnBold=new Common.UI.Button({id:"id-toolbar-btn-bold",cls:"btn-toolbar",iconCls:"toolbar__icon btn-bold",enableToggle:!0}),this.paragraphControls.push(this.btnBold),this.btnItalic=new Common.UI.Button({id:"id-toolbar-btn-italic",cls:"btn-toolbar",iconCls:"toolbar__icon btn-italic",enableToggle:!0}),this.paragraphControls.push(this.btnItalic),this.btnUnderline=new Common.UI.Button({id:"id-toolbar-btn-underline",cls:"btn-toolbar",iconCls:"toolbar__icon btn-underline",enableToggle:!0}),this.paragraphControls.push(this.btnUnderline),this.btnStrikeout=new Common.UI.Button({id:"id-toolbar-btn-strikeout",cls:"btn-toolbar",iconCls:"toolbar__icon btn-strikeout",enableToggle:!0}),this.paragraphControls.push(this.btnStrikeout),this.btnSuperscript=new Common.UI.Button({id:"id-toolbar-btn-superscript",cls:"btn-toolbar",iconCls:"toolbar__icon btn-superscript",enableToggle:!0,toggleGroup:"superscriptGroup"}),this.paragraphControls.push(this.btnSuperscript),this.btnSubscript=new Common.UI.Button({id:"id-toolbar-btn-subscript",cls:"btn-toolbar",iconCls:"toolbar__icon btn-subscript",enableToggle:!0,toggleGroup:"superscriptGroup"}),this.paragraphControls.push(this.btnSubscript),this.btnHighlightColor=new Common.UI.Button({id:"id-toolbar-btn-highlight",cls:"btn-toolbar",iconCls:"toolbar__icon btn-highlight",enableToggle:!0,allowDepress:!0,split:!0,menu:new Common.UI.Menu({style:"min-width: 100px;",items:[{template:e.template('
')},{caption:"--"},this.mnuHighlightTransparent=new Common.UI.MenuItem({caption:this.strMenuNoFill,checkable:!0})]})}),this.paragraphControls.push(this.btnHighlightColor),this.textOnlyControls.push(this.btnHighlightColor),this.btnFontColor=new Common.UI.Button({id:"id-toolbar-btn-fontcolor",cls:"btn-toolbar",iconCls:"toolbar__icon btn-fontcolor",split:!0,menu:new Common.UI.Menu({cls:"shifted-left",items:[{id:"id-toolbar-menu-auto-fontcolor",caption:this.textAutoColor,template:e.template('<%= caption %>')},{caption:"--"},{template:e.template('
')},{template:e.template(''+this.textNewColor+"")}]})}),this.paragraphControls.push(this.btnFontColor),this.btnParagraphColor=new Common.UI.Button({id:"id-toolbar-btn-paracolor",cls:"btn-toolbar",iconCls:"toolbar__icon btn-paracolor",split:!0,menu:new Common.UI.Menu({items:[{template:e.template('
')},{template:e.template(''+this.textNewColor+"")}]})}),this.paragraphControls.push(this.btnParagraphColor),this.textOnlyControls.push(this.btnParagraphColor),this.btnAlignLeft=new Common.UI.Button({id:"id-toolbar-btn-align-left",cls:"btn-toolbar",iconCls:"toolbar__icon btn-align-left",enableToggle:!0,allowDepress:!1,toggleGroup:"alignGroup"}),this.paragraphControls.push(this.btnAlignLeft),this.btnAlignCenter=new Common.UI.Button({id:"id-toolbar-btn-align-center",cls:"btn-toolbar",iconCls:"toolbar__icon btn-align-center",enableToggle:!0,allowDepress:!1,toggleGroup:"alignGroup"}),this.paragraphControls.push(this.btnAlignCenter),this.btnAlignRight=new Common.UI.Button({id:"id-toolbar-btn-align-right",cls:"btn-toolbar",iconCls:"toolbar__icon btn-align-right",enableToggle:!0,allowDepress:!1,toggleGroup:"alignGroup"}),this.paragraphControls.push(this.btnAlignRight),this.btnAlignJust=new Common.UI.Button({id:"id-toolbar-btn-align-just",cls:"btn-toolbar",iconCls:"toolbar__icon btn-align-just",enableToggle:!0,allowDepress:!1,toggleGroup:"alignGroup"}),this.paragraphControls.push(this.btnAlignJust),this.btnDecLeftOffset=new Common.UI.Button({id:"id-toolbar-btn-decoffset",cls:"btn-toolbar",iconCls:"toolbar__icon btn-decoffset"}),this.paragraphControls.push(this.btnDecLeftOffset),this.btnIncLeftOffset=new Common.UI.Button({id:"id-toolbar-btn-incoffset",cls:"btn-toolbar",iconCls:"toolbar__icon btn-incoffset"}),this.paragraphControls.push(this.btnIncLeftOffset),this.btnLineSpace=new Common.UI.Button({id:"id-toolbar-btn-linespace",cls:"btn-toolbar",iconCls:"toolbar__icon btn-linespace",menu:new Common.UI.Menu({style:"min-width: 60px;",items:[{caption:"1.0",value:1,checkable:!0,toggleGroup:"linesize"},{caption:"1.15",value:1.15,checkable:!0,toggleGroup:"linesize"},{caption:"1.5",value:1.5,checkable:!0,toggleGroup:"linesize"},{caption:"2.0",value:2,checkable:!0,toggleGroup:"linesize"},{caption:"2.5",value:2.5,checkable:!0,toggleGroup:"linesize"},{caption:"3.0",value:3,checkable:!0,toggleGroup:"linesize"}]})}),this.paragraphControls.push(this.btnLineSpace),this.btnShowHidenChars=new Common.UI.Button({id:"id-toolbar-btn-hidenchars",cls:"btn-toolbar",iconCls:"toolbar__icon btn-paragraph",enableToggle:!0,split:!0,menu:new Common.UI.Menu({style:"min-width: 60px;",items:[{caption:this.mniHiddenChars,value:"characters",checkable:!0},{caption:this.mniHiddenBorders,value:"table",checkable:!0}]})}),this.toolbarControls.push(this.btnShowHidenChars),this.btnMarkers=new Common.UI.Button({id:"id-toolbar-btn-markers",cls:"btn-toolbar",iconCls:"toolbar__icon btn-setmarkers",enableToggle:!0,toggleGroup:"markersGroup",split:!0,menu:!0}),this.paragraphControls.push(this.btnMarkers),this.textOnlyControls.push(this.btnMarkers),this.btnNumbers=new Common.UI.Button({id:"id-toolbar-btn-numbering",cls:"btn-toolbar",iconCls:"toolbar__icon btn-numbering",enableToggle:!0,toggleGroup:"markersGroup",split:!0,menu:!0}),this.paragraphControls.push(this.btnNumbers),this.textOnlyControls.push(this.btnNumbers),this.btnMultilevels=new Common.UI.Button({id:"id-toolbar-btn-multilevels",cls:"btn-toolbar",iconCls:"toolbar__icon btn-multilevels",menu:!0}),this.paragraphControls.push(this.btnMultilevels),this.textOnlyControls.push(this.btnMultilevels);var a=function(t){var e={};for(var i in t)e[i]="object"==typeof t[i]?a(t[i]):t[i];return e};this.mnuMarkersPicker={conf:{index:0},selectByIndex:function(t){this.conf.index=t},deselectAll:function(){this.conf.index=-1}},this.mnuNumbersPicker=a(this.mnuMarkersPicker),this.mnuMultilevelPicker=a(this.mnuMarkersPicker),this.btnInsertTable=new Common.UI.Button({id:"tlbtn-inserttable",cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-inserttable",caption:s.capBtnInsTable,menu:new Common.UI.Menu({items:[{template:e.template('
')},{caption:this.mniCustomTable,value:"custom"},{caption:this.mniDrawTable,value:"draw",checkable:!0},{caption:this.mniEraseTable,value:"erase",checkable:!0}]})}),this.paragraphControls.push(this.btnInsertTable),this.btnInsertImage=new Common.UI.Button({id:"tlbtn-insertimage",cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-insertimage",caption:s.capBtnInsImage,menu:new Common.UI.Menu({items:[{caption:this.mniImageFromFile,value:"file"},{caption:this.mniImageFromUrl,value:"url"},{caption:this.mniImageFromStorage,value:"storage"}]})}),this.paragraphControls.push(this.btnInsertImage),this.btnInsertChart=new Common.UI.Button({id:"tlbtn-insertchart",cls:"btn-toolbar x-huge icon-top",caption:s.capBtnInsChart,iconCls:"toolbar__icon btn-insertchart",menu:!0}),this.paragraphControls.push(this.btnInsertChart),this.btnInsertText=new Common.UI.Button({id:"tlbtn-inserttext",cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-text",caption:s.capBtnInsTextbox,enableToggle:!0}),this.paragraphControls.push(this.btnInsertText),this.btnInsertTextArt=new Common.UI.Button({id:"tlbtn-inserttextart",cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-textart",caption:s.capBtnInsTextart,menu:new Common.UI.Menu({cls:"menu-shapes",items:[{template:e.template('
')}]})}),this.paragraphControls.push(this.btnInsertTextArt),this.btnEditHeader=new Common.UI.Button({id:"id-toolbar-btn-editheader",cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-editheader",caption:s.capBtnInsHeader,menu:!0}),this.mnuPageNumberPosPicker={conf:{disabled:!1},isDisabled:function(){return this.conf.disabled},setDisabled:function(t){this.conf.disabled=t}},this.mnuPageNumCurrentPos=a(this.mnuPageNumberPosPicker),this.mnuInsertPageNum=a(this.mnuPageNumberPosPicker),this.mnuInsertPageCount=a(this.mnuPageNumberPosPicker),this.paragraphControls.push(this.mnuPageNumCurrentPos),this.paragraphControls.push(this.mnuInsertPageCount),this.toolbarControls.push(this.btnEditHeader),this.btnInsDateTime=new Common.UI.Button({id:"id-toolbar-btn-datetime",cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-datetime",caption:s.capBtnDateTime}),this.paragraphControls.push(this.btnInsDateTime),this.btnBlankPage=new Common.UI.Button({id:"id-toolbar-btn-blankpage",cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-blankpage",caption:s.capBtnBlankPage}),this.paragraphControls.push(this.btnBlankPage),this.btnInsertShape=new Common.UI.Button({id:"tlbtn-insertshape",cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-insertshape",caption:s.capBtnInsShape,enableToggle:!0,menu:new Common.UI.Menu({cls:"menu-shapes"})}),this.paragraphControls.push(this.btnInsertShape),this.btnInsertEquation=new Common.UI.Button({id:"tlbtn-insertequation",cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-insertequation",caption:s.capBtnInsEquation,split:!0,menu:new Common.UI.Menu({cls:"menu-shapes"})}),this.paragraphControls.push(this.btnInsertEquation),this.btnInsertSymbol=new Common.UI.Button({id:"tlbtn-insertsymbol",cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-symbol",caption:s.capBtnInsSymbol}),this.paragraphControls.push(this.btnInsertSymbol),this.btnDropCap=new Common.UI.Button({id:"tlbtn-dropcap",cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-dropcap",caption:s.capBtnInsDropcap,menu:new Common.UI.Menu({cls:"ppm-toolbar shifted-right",items:[{caption:this.textNone,iconCls:"menu__icon columns-one",checkable:!0,checkmark:!1,toggleGroup:"menuDropCap",value:Asc.c_oAscDropCap.None,checked:!0},{caption:this.textInText,iconCls:"menu__icon dropcap-intext",checkable:!0,checkmark:!1,toggleGroup:"menuDropCap",value:Asc.c_oAscDropCap.Drop},{caption:this.textInMargin,iconCls:"menu__icon dropcap-inmargin",checkable:!0,checkmark:!1,toggleGroup:"menuDropCap",value:Asc.c_oAscDropCap.Margin},{caption:"--"},this.mnuDropCapAdvanced=new Common.UI.MenuItem({caption:this.mniEditDropCap})]})}),this.paragraphControls.push(this.btnDropCap),this.btnContentControls=new Common.UI.Button({id:"tlbtn-controls",cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-controls",caption:s.capBtnInsControls,menu:new Common.UI.Menu({cls:"ppm-toolbar shifted-right",items:[{caption:this.textPlainControl,iconCls:"menu__icon cc-plaintext",value:"plain"},{caption:this.textRichControl,iconCls:"menu__icon cc-richtext",value:"rich"},{caption:this.textPictureControl,value:"picture"},{caption:this.textComboboxControl,value:"combobox"},{caption:this.textDropdownControl,value:"dropdown"},{caption:this.textDateControl,value:"date"},{caption:this.textCheckboxControl,value:"checkbox"},{caption:"--"},{caption:this.textRemoveControl,iconCls:"menu__icon cc-remove",value:"remove"},{caption:"--"},{caption:this.mniEditControls,value:"settings"},{caption:this.mniHighlightControls,value:"highlight",menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[this.mnuNoControlsColor=new Common.UI.MenuItem({id:"id-toolbar-menu-no-highlight-controls",caption:this.textNoHighlight,checkable:!0}),{caption:"--"},{template:e.template('
')},{template:e.template(''+this.textNewColor+"")}]})}]})}),this.btnColumns=new Common.UI.Button({id:"tlbtn-columns",cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-columns",caption:s.capBtnColumns,menu:new Common.UI.Menu({cls:"ppm-toolbar shifted-right",items:[{caption:this.textColumnsOne,iconCls:"menu__icon columns-one",checkable:!0,checkmark:!1,toggleGroup:"menuColumns",value:0},{caption:this.textColumnsTwo,iconCls:"menu__icon columns-two",checkable:!0,checkmark:!1,toggleGroup:"menuColumns",value:1},{caption:this.textColumnsThree,iconCls:"menu__icon columns-three",checkable:!0,checkmark:!1,toggleGroup:"menuColumns",value:2},{caption:this.textColumnsLeft,iconCls:"menu__icon columns-left",checkmark:!1,checkable:!0,toggleGroup:"menuColumns",value:3},{caption:this.textColumnsRight,iconCls:"menu__icon columns-right",checkmark:!1,checkable:!0,toggleGroup:"menuColumns",value:4},{caption:"--"},{caption:this.textColumnsCustom,value:"advanced"}]})}),this.paragraphControls.push(this.btnColumns),this.btnPageOrient=new Common.UI.Button({id:"tlbtn-pageorient",cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-pageorient",caption:s.capBtnPageOrient,menu:new Common.UI.Menu({cls:"ppm-toolbar",items:[{caption:this.textPortrait,iconCls:"menu__icon page-portrait",checkable:!0,checkmark:!1,toggleGroup:"menuOrient",value:!0},{caption:this.textLandscape,iconCls:"menu__icon page-landscape",checkable:!0,checkmark:!1,toggleGroup:"menuOrient",value:!1}]})}),this.toolbarControls.push(this.btnPageOrient);var r=e.template('
<%= caption %>
<% if (options.value !== null) { %>
<% } %>
");this.btnPageMargins=new Common.UI.Button({id:"tlbtn-pagemargins",cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-pagemargins",caption:s.capBtnMargins,menu:new Common.UI.Menu({items:[{caption:this.textMarginsLast,checkable:!0,template:r,toggleGroup:"menuPageMargins"},{caption:this.textMarginsNormal,checkable:!0,template:r,toggleGroup:"menuPageMargins",value:[20,30,20,15]},{caption:this.textMarginsUsNormal,checkable:!0,template:r,toggleGroup:"menuPageMargins",value:[25.4,25.4,25.4,25.4]},{caption:this.textMarginsNarrow,checkable:!0,template:r,toggleGroup:"menuPageMargins",value:[12.7,12.7,12.7,12.7]},{caption:this.textMarginsModerate,checkable:!0,template:r,toggleGroup:"menuPageMargins",value:[25.4,19.1,25.4,19.1]},{caption:this.textMarginsWide,checkable:!0,template:r,toggleGroup:"menuPageMargins",value:[25.4,50.8,25.4,50.8]},{caption:"--"},{caption:this.textPageMarginsCustom,value:"advanced"}]})}),this.toolbarControls.push(this.btnPageMargins);var l=e.template('
<%= caption %>
<%= parseFloat(Common.Utils.Metric.fnRecalcFromMM(options.value[0]).toFixed(2)) %> <%= Common.Utils.Metric.getCurrentMetricName() %> x <%= parseFloat(Common.Utils.Metric.fnRecalcFromMM(options.value[1]).toFixed(2)) %> <%= Common.Utils.Metric.getCurrentMetricName() %>
');this.btnPageSize=new Common.UI.Button({id:"tlbtn-pagesize",cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-pagesize",caption:s.capBtnPageSize,menu:new Common.UI.Menu({restoreHeight:!0,items:[{caption:"US Letter",subtitle:"21,59cm x 27,94cm",template:l,checkable:!0,toggleGroup:"menuPageSize",value:[215.9,279.4]},{caption:"US Legal",subtitle:"21,59cm x 35,56cm",template:l,checkable:!0,toggleGroup:"menuPageSize",value:[215.9,355.6]},{caption:"A4",subtitle:"21cm x 29,7cm",template:l, +checkable:!0,toggleGroup:"menuPageSize",value:[210,297],checked:!0},{caption:"A5",subtitle:"14,81cm x 20,99cm",template:l,checkable:!0,toggleGroup:"menuPageSize",value:[148,210]},{caption:"B5",subtitle:"17,6cm x 25,01cm",template:l,checkable:!0,toggleGroup:"menuPageSize",value:[176,250]},{caption:"Envelope #10",subtitle:"10,48cm x 24,13cm",template:l,checkable:!0,toggleGroup:"menuPageSize",value:[104.8,241.3]},{caption:"Envelope DL",subtitle:"11,01cm x 22,01cm",template:l,checkable:!0,toggleGroup:"menuPageSize",value:[110,220]},{caption:"Tabloid",subtitle:"27,94cm x 43,17cm",template:l,checkable:!0,toggleGroup:"menuPageSize",value:[279.4,431.8]},{caption:"A3",subtitle:"29,7cm x 42,01cm",template:l,checkable:!0,toggleGroup:"menuPageSize",value:[297,420]},{caption:"Tabloid Oversize",subtitle:"30,48cm x 45,71cm",template:l,checkable:!0,toggleGroup:"menuPageSize",value:[304.8,457.1]},{caption:"ROC 16K",subtitle:"19,68cm x 27,3cm",template:l,checkable:!0,toggleGroup:"menuPageSize",value:[196.8,273]},{caption:"Envelope Choukei 3",subtitle:"11,99cm x 23,49cm",template:l,checkable:!0,toggleGroup:"menuPageSize",value:[119.9,234.9]},{caption:"Super B/A3",subtitle:"33,02cm x 48,25cm",template:l,checkable:!0,toggleGroup:"menuPageSize",value:[330.2,482.5]},{caption:"--"},{caption:this.textPageSizeCustom,value:"advanced"}]})}),this.toolbarControls.push(this.btnPageSize),this.btnLineNumbers=new Common.UI.Button({id:"tlbtn-line-numbers",cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-line-numbering",caption:s.capBtnLineNumbers,menu:new Common.UI.Menu({cls:"ppm-toolbar",items:[{caption:this.textNone,checkable:!0,toggleGroup:"menuLineNumbers",value:0},{caption:this.textContinuous,checkable:!0,toggleGroup:"menuLineNumbers",value:1},{caption:this.textRestartEachPage,checkable:!0,toggleGroup:"menuLineNumbers",value:2},{caption:this.textRestartEachSection,checkable:!0,toggleGroup:"menuLineNumbers",value:3},{caption:this.textSuppressForCurrentParagraph,checkable:!0,allowDepress:!0,value:4},{caption:"--"},{caption:this.textCustomLineNumbers,value:5}]})}),this.btnClearStyle=new Common.UI.Button({id:"id-toolbar-btn-clearstyle",cls:"btn-toolbar",iconCls:"toolbar__icon btn-clearstyle"}),this.toolbarControls.push(this.btnClearStyle),this.btnCopyStyle=new Common.UI.Button({id:"id-toolbar-btn-copystyle",cls:"btn-toolbar",iconCls:"toolbar__icon btn-copystyle",enableToggle:!0}),this.toolbarControls.push(this.btnCopyStyle),this.btnColorSchemas=new Common.UI.Button({id:"id-toolbar-btn-colorschemas",cls:"btn-toolbar",iconCls:"toolbar__icon btn-colorschemas",menu:new Common.UI.Menu({cls:"shifted-left",items:[],restoreHeight:!0})}),this.toolbarControls.push(this.btnColorSchemas),this.btnMailRecepients=new Common.UI.Button({id:"id-toolbar-btn-mailrecepients",cls:"btn-toolbar",iconCls:"toolbar__icon btn-mailmerge"}),s.btnImgAlign=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-img-align",caption:s.capImgAlign,menu:!0}),s.btnImgGroup=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-img-group",caption:s.capImgGroup,menu:!0}),s.btnImgForward=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-img-frwd",caption:s.capImgForward,split:!0,menu:!0}),s.btnImgBackward=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-img-bkwd",caption:s.capImgBackward,split:!0,menu:!0}),s.btnImgWrapping=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-img-wrap",caption:s.capImgWrapping,menu:!0}),s.btnWatermark=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-watermark",caption:s.capBtnWatermark,menu:new Common.UI.Menu({cls:"ppm-toolbar",items:[{caption:this.textEditWatermark,value:"edit"},{caption:this.textRemWatermark,value:"remove"}]})}),s.toolbarControls.push(s.btnImgAlign,s.btnImgGroup,s.btnImgForward,s.btnImgBackward,s.btnImgWrapping,s.btnWatermark),this.mnuLineSpace=this.btnLineSpace.menu,this.mnuNonPrinting=this.btnShowHidenChars.menu,this.mnuInsertTable=this.btnInsertTable.menu,this.mnuInsertImage=this.btnInsertImage.menu,this.mnuPageSize=this.btnPageSize.menu,this.mnuColorSchema=this.btnColorSchemas.menu,this.cmbFontSize=new Common.UI.ComboBox({cls:"input-group-nr",menuStyle:"min-width: 55px;",hint:this.tipFontSize,data:[{value:8,displayValue:"8"},{value:9,displayValue:"9"},{value:10,displayValue:"10"},{value:11,displayValue:"11"},{value:12,displayValue:"12"},{value:14,displayValue:"14"},{value:16,displayValue:"16"},{value:18,displayValue:"18"},{value:20,displayValue:"20"},{value:22,displayValue:"22"},{value:24,displayValue:"24"},{value:26,displayValue:"26"},{value:28,displayValue:"28"},{value:36,displayValue:"36"},{value:48,displayValue:"48"},{value:72,displayValue:"72"},{value:96,displayValue:"96"}]}),this.paragraphControls.push(this.cmbFontSize),this.cmbFontName=new Common.UI.ComboBoxFonts({cls:"input-group-nr",menuCls:"scrollable-menu",menuStyle:"min-width: 325px;",hint:this.tipFontName,store:new Common.Collections.Fonts}),this.paragraphControls.push(this.cmbFontName),this.listStylesAdditionalMenuItem=new Common.UI.MenuItem({template:e.template('
")}),this.listStyles=new Common.UI.ComboDataView({cls:"combo-styles",itemWidth:104,itemHeight:38,enableKeyEvents:!0,additionalMenuItems:[this.listStylesAdditionalMenuItem],beforeOpenHandler:function(e){var i=this,n=i.openButton.menu;if(n.cmpEl){var o=t(i.cmpEl.find(".dataview.inner .style").get(0)).parent(),s=o.is(":visible")?parseInt(o.css("width")):i.itemWidth+parseInt(o.css("padding-left"))+parseInt(o.css("padding-right"))+parseInt(o.css("border-left-width"))+parseInt(o.css("border-right-width")),a=i.menuPicker.store.length>=6?6:i.menuPicker.store.length,r=Math.min(i.menuPicker.store.length,Math.round(t(".dataview",t(i.fieldPicker.el)).width()/(-1+s)+.5));r=r','
',""].join("")),this.listStyles.menuPicker.itemTemplate=e.template(['
','
',"
"].join("")),this.paragraphControls.push(this.listStyles),this.textOnlyControls.push(this.listStyles),e.each(this.toolbarControls.concat(this.paragraphControls),function(t){e.isFunction(t.setDisabled)&&t.setDisabled(!0)}),this.btnMailRecepients.setDisabled(!0);var c=new Common.UI.MenuItem({caption:s.textStyleMenuUpdate}).on("click",e.bind(s.onStyleMenuUpdate,s)),d=new Common.UI.MenuItem({caption:s.textStyleMenuDelete}).on("click",e.bind(s.onStyleMenuDelete,s)),h=new Common.UI.MenuItem({caption:s.textStyleMenuRestore}).on("click",e.bind(s.onStyleMenuDelete,s)),p=new Common.UI.MenuItem({caption:s.textStyleMenuRestoreAll}).on("click",e.bind(s.onStyleMenuRestoreAll,s)),m=new Common.UI.MenuItem({caption:s.textStyleMenuDeleteAll}).on("click",e.bind(s.onStyleMenuDeleteAll,s));null==this.styleMenu&&(this.styleMenu=new Common.UI.Menu({items:[c,d,h,p,m]})),this.on("render:after",e.bind(this.onToolbarAfterRender,this))}else Common.UI.Mixtbar.prototype.initialize.call(this,{template:e.template(o),tabs:[{caption:s.textTabFile,action:"file",haspanel:!1}]});return this},render:function(e){var i=this;if(this.fireEvent("render:before",[this]),i.isCompactView=e.isCompactView,e.isEdit?i.$el.html(i.rendererComponents(i.$layout)):(i.$layout.find(".canedit").hide(),i.$layout.addClass("folded"),i.$el.html(i.$layout)),this.fireEvent("render:after",[this]),Common.UI.Mixtbar.prototype.afterRender.call(this),Common.NotificationCenter.on({"window:resize":function(){Common.UI.Mixtbar.prototype.onResize.apply(i,arguments)}}),e.isEdit){this.showSynchTip=!Common.localStorage.getBool("de-hide-synch"),this.needShowSynchTip=!1,i.setTab("home");var n=Common.localStorage.getItem("de-pgmargins-top"),o=Common.localStorage.getItem("de-pgmargins-left"),s=Common.localStorage.getItem("de-pgmargins-bottom"),a=Common.localStorage.getItem("de-pgmargins-right");if(null!==n&&null!==o&&null!==s&&null!==a){var r=this.btnPageMargins.menu.items[0];r.options.value=r.value=[parseFloat(n),parseFloat(o),parseFloat(s),parseFloat(a)],r.setVisible(!0),t(r.el).html(r.template({id:Common.UI.getId(),caption:r.caption,options:r.options}))}else this.btnPageMargins.menu.items[0].setVisible(!1)}return i.isCompactView&&i.setFolded(!0),this},onTabClick:function(e){var i=this,n=t(e.currentTarget).find("> a[data-tab]").data("tab"),o=i.isTabActive("file");Common.UI.Mixtbar.prototype.onTabClick.apply(i,arguments),o?i.fireEvent("file:close"):"file"==n&&(i.fireEvent("file:open"),i.setTab(n)),i.isTabActive("home")&&i.fireEvent("home:open")},rendererComponents:function(e){var i=t(e),n=function(t,e){Common.Utils.injectComponent(i.findById(t),e)};return n("#slot-field-fontname",this.cmbFontName),n("#slot-field-fontsize",this.cmbFontSize),n("#slot-btn-print",this.btnPrint),n("#slot-btn-save",this.btnSave),n("#slot-btn-undo",this.btnUndo),n("#slot-btn-redo",this.btnRedo),n("#slot-btn-copy",this.btnCopy),n("#slot-btn-paste",this.btnPaste),n("#slot-btn-incfont",this.btnIncFontSize),n("#slot-btn-decfont",this.btnDecFontSize),n("#slot-btn-bold",this.btnBold),n("#slot-btn-italic",this.btnItalic),n("#slot-btn-underline",this.btnUnderline),n("#slot-btn-strikeout",this.btnStrikeout),n("#slot-btn-superscript",this.btnSuperscript),n("#slot-btn-subscript",this.btnSubscript),n("#slot-btn-highlight",this.btnHighlightColor),n("#slot-btn-fontcolor",this.btnFontColor),n("#slot-btn-align-left",this.btnAlignLeft),n("#slot-btn-align-center",this.btnAlignCenter),n("#slot-btn-align-right",this.btnAlignRight),n("#slot-btn-align-just",this.btnAlignJust),n("#slot-btn-incoffset",this.btnIncLeftOffset),n("#slot-btn-decoffset",this.btnDecLeftOffset),n("#slot-btn-linespace",this.btnLineSpace),n("#slot-btn-hidenchars",this.btnShowHidenChars),n("#slot-btn-markers",this.btnMarkers),n("#slot-btn-numbering",this.btnNumbers),n("#slot-btn-multilevels",this.btnMultilevels),n("#slot-btn-instable",this.btnInsertTable),n("#slot-btn-insimage",this.btnInsertImage),n("#slot-btn-inschart",this.btnInsertChart),n("#slot-btn-instext",this.btnInsertText),n("#slot-btn-instextart",this.btnInsertTextArt),n("#slot-btn-dropcap",this.btnDropCap),n("#slot-btn-controls",this.btnContentControls),n("#slot-btn-columns",this.btnColumns),n("#slot-btn-line-numbers",this.btnLineNumbers),n("#slot-btn-editheader",this.btnEditHeader),n("#slot-btn-datetime",this.btnInsDateTime),n("#slot-btn-blankpage",this.btnBlankPage),n("#slot-btn-insshape",this.btnInsertShape),n("#slot-btn-insequation",this.btnInsertEquation),n("#slot-btn-inssymbol",this.btnInsertSymbol),n("#slot-btn-pageorient",this.btnPageOrient),n("#slot-btn-pagemargins",this.btnPageMargins),n("#slot-btn-pagesize",this.btnPageSize),n("#slot-btn-clearstyle",this.btnClearStyle),n("#slot-btn-copystyle",this.btnCopyStyle),n("#slot-btn-colorschemas",this.btnColorSchemas),n("#slot-btn-paracolor",this.btnParagraphColor),n("#slot-field-styles",this.listStyles),n("#slot-btn-mailrecepients",this.btnMailRecepients),n("#slot-img-align",this.btnImgAlign),n("#slot-img-group",this.btnImgGroup),n("#slot-img-movefrwd",this.btnImgForward),n("#slot-img-movebkwd",this.btnImgBackward),n("#slot-img-wrapping",this.btnImgWrapping),n("#slot-btn-watermark",this.btnWatermark),this.btnsPageBreak=Common.Utils.injectButtons(i.find(".btn-slot.btn-pagebreak"),"","toolbar__icon btn-pagebreak",this.capBtnInsPagebreak,void 0,!0,!0),Array.prototype.push.apply(this.paragraphControls,this.btnsPageBreak),i},onAppReady:function(t){var e=this;new Promise(function(t,e){t()}).then(function(){if(t.isEdit){e.btnsPageBreak.forEach(function(t){t.updateHint([e.textInsPageBreak,e.tipPageBreak]);var i=new Common.UI.Menu({menuAlign:"tl-tr",items:[{caption:e.textNextPage,value:Asc.c_oAscSectionBreakType.NextPage},{caption:e.textContPage,value:Asc.c_oAscSectionBreakType.Continuous},{caption:e.textEvenPage,value:Asc.c_oAscSectionBreakType.EvenPage},{caption:e.textOddPage,value:Asc.c_oAscSectionBreakType.OddPage}]}),n=new Common.UI.Menu({items:[{caption:e.textInsPageBreak,value:"page"},{caption:e.textInsColumnBreak,value:"column"},{caption:e.textInsSectionBreak,value:"section",menu:i}]});t.setMenu(n)});var i=DE.getController("DocumentHolder").getView();e.btnImgForward.updateHint(e.tipSendForward),e.btnImgForward.setMenu(new Common.UI.Menu({items:[{caption:i.textArrangeFront,iconCls:"menu__icon arrange-front",valign:Asc.c_oAscChangeLevel.BringToFront},{caption:i.textArrangeForward,iconCls:"menu__icon arrange-forward",valign:Asc.c_oAscChangeLevel.BringForward}]})),e.btnImgBackward.updateHint(e.tipSendBackward),e.btnImgBackward.setMenu(new Common.UI.Menu({items:[{caption:i.textArrangeBack,iconCls:"menu__icon arrange-back",valign:Asc.c_oAscChangeLevel.SendToBack},{caption:i.textArrangeBackward,iconCls:"menu__icon arrange-backward",valign:Asc.c_oAscChangeLevel.BringBackward}]})),e.btnImgAlign.updateHint(e.tipImgAlign),e.mniAlignToPage=new Common.UI.MenuItem({caption:e.txtPageAlign,checkable:!0,toggleGroup:"imgalign",value:-1}).on("click",function(t){Common.Utils.InternalSettings.set("de-img-align-to",1)}),e.mniAlignToMargin=new Common.UI.MenuItem({caption:e.txtMarginAlign,checkable:!0,toggleGroup:"imgalign",value:-1}).on("click",function(t){Common.Utils.InternalSettings.set("de-img-align-to",2)}),e.mniAlignObjects=new Common.UI.MenuItem({caption:e.txtObjectsAlign,checkable:!0,toggleGroup:"imgalign",value:-1}).on("click",function(t){Common.Utils.InternalSettings.set("de-img-align-to",3)}),e.mniDistribHor=new Common.UI.MenuItem({caption:e.txtDistribHor,iconCls:"menu__icon shape-distribute-hor",value:6}),e.mniDistribVert=new Common.UI.MenuItem({caption:e.txtDistribVert,iconCls:"menu__icon shape-distribute-vert",value:7}),e.btnImgAlign.setMenu(new Common.UI.Menu({cls:"shifted-right",items:[{caption:i.textShapeAlignLeft,iconCls:"menu__icon shape-align-left",value:Asc.c_oAscAlignShapeType.ALIGN_LEFT},{caption:i.textShapeAlignCenter,iconCls:"menu__icon shape-align-center",value:Asc.c_oAscAlignShapeType.ALIGN_CENTER},{caption:i.textShapeAlignRight,iconCls:"menu__icon shape-align-right",value:Asc.c_oAscAlignShapeType.ALIGN_RIGHT},{caption:i.textShapeAlignTop,iconCls:"menu__icon shape-align-top",value:Asc.c_oAscAlignShapeType.ALIGN_TOP},{caption:i.textShapeAlignMiddle,iconCls:"menu__icon shape-align-middle",value:Asc.c_oAscAlignShapeType.ALIGN_MIDDLE},{caption:i.textShapeAlignBottom,iconCls:"menu__icon shape-align-bottom",value:Asc.c_oAscAlignShapeType.ALIGN_BOTTOM},{caption:"--"},e.mniDistribHor,e.mniDistribVert,{caption:"--"},e.mniAlignToPage,e.mniAlignToMargin,e.mniAlignObjects]})),e.btnImgGroup.updateHint(e.tipImgGroup),e.btnImgGroup.setMenu(new Common.UI.Menu({items:[{caption:i.txtGroup,iconCls:"menu__icon shape-group",groupval:1},{caption:i.txtUngroup,iconCls:"menu__icon shape-ungroup",groupval:-1}]})),e.btnImgWrapping.updateHint(e.tipImgWrapping),e.btnImgWrapping.setMenu(new Common.UI.Menu({cls:"ppm-toolbar",items:[{caption:i.txtInline,iconCls:"menu__icon wrap-inline",toggleGroup:"imgwrapping",wrapType:Asc.c_oAscWrapStyle2.Inline,checkmark:!1,checkable:!0},{caption:i.txtSquare,iconCls:"menu__icon wrap-square",toggleGroup:"imgwrapping",wrapType:Asc.c_oAscWrapStyle2.Square,checkmark:!1,checkable:!0},{caption:i.txtTight,iconCls:"menu__icon wrap-tight",toggleGroup:"imgwrapping",wrapType:Asc.c_oAscWrapStyle2.Tight,checkmark:!1,checkable:!0},{caption:i.txtThrough,iconCls:"menu__icon wrap-through",toggleGroup:"imgwrapping",wrapType:Asc.c_oAscWrapStyle2.Through,checkmark:!1,checkable:!0},{caption:i.txtTopAndBottom,iconCls:"menu__icon wrap-topandbottom",toggleGroup:"imgwrapping",wrapType:Asc.c_oAscWrapStyle2.TopAndBottom,checkmark:!1,checkable:!0},{caption:i.txtInFront,iconCls:"menu__icon wrap-infront",toggleGroup:"imgwrapping",wrapType:Asc.c_oAscWrapStyle2.InFront,checkmark:!1,checkable:!0},{caption:i.txtBehind,iconCls:"menu__icon wrap-behind",toggleGroup:"imgwrapping",wrapType:Asc.c_oAscWrapStyle2.Behind,checkmark:!1,checkable:!0}]})),e.btnWatermark.updateHint(e.tipWatermark),!t.canFeatureContentControl&&e.btnContentControls.cmpEl&&e.btnContentControls.cmpEl.parents(".group").hide().prev(".separator").hide()}})},createDelayedElements:function(){this.api&&(this.mnuNonPrinting.items[0].setChecked(this.api.get_ShowParaMarks(),!0),this.mnuNonPrinting.items[1].setChecked(this.api.get_ShowTableEmptyLine(),!0),this.btnShowHidenChars.toggle(this.mnuNonPrinting.items[0].checked,!0),this.updateMetricUnit()),this.btnPrint.updateHint(this.tipPrint+Common.Utils.String.platformKey("Ctrl+P")),this.btnSave.updateHint(this.btnSaveTip),this.btnUndo.updateHint(this.tipUndo+Common.Utils.String.platformKey("Ctrl+Z")),this.btnRedo.updateHint(this.tipRedo+Common.Utils.String.platformKey("Ctrl+Y")),this.btnCopy.updateHint(this.tipCopy+Common.Utils.String.platformKey("Ctrl+C")),this.btnPaste.updateHint(this.tipPaste+Common.Utils.String.platformKey("Ctrl+V")),this.btnIncFontSize.updateHint(this.tipIncFont+Common.Utils.String.platformKey("Ctrl+]")),this.btnDecFontSize.updateHint(this.tipDecFont+Common.Utils.String.platformKey("Ctrl+[")),this.btnBold.updateHint(this.textBold+Common.Utils.String.platformKey("Ctrl+B")),this.btnItalic.updateHint(this.textItalic+Common.Utils.String.platformKey("Ctrl+I")),this.btnUnderline.updateHint(this.textUnderline+Common.Utils.String.platformKey("Ctrl+U")),this.btnStrikeout.updateHint(this.textStrikeout),this.btnSuperscript.updateHint(this.textSuperscript),this.btnSubscript.updateHint(this.textSubscript),this.btnHighlightColor.updateHint(this.tipHighlightColor),this.btnFontColor.updateHint(this.tipFontColor),this.btnParagraphColor.updateHint(this.tipPrColor),this.btnAlignLeft.updateHint(this.tipAlignLeft+Common.Utils.String.platformKey("Ctrl+L")),this.btnAlignCenter.updateHint(this.tipAlignCenter+Common.Utils.String.platformKey("Ctrl+E")),this.btnAlignRight.updateHint(this.tipAlignRight+Common.Utils.String.platformKey("Ctrl+R")),this.btnAlignJust.updateHint(this.tipAlignJust+Common.Utils.String.platformKey("Ctrl+J")),this.btnDecLeftOffset.updateHint(this.tipDecPrLeft+Common.Utils.String.platformKey("Ctrl+Shift+M")),this.btnIncLeftOffset.updateHint(this.tipIncPrLeft+Common.Utils.String.platformKey("Ctrl+M")),this.btnLineSpace.updateHint(this.tipLineSpace),this.btnShowHidenChars.updateHint(this.tipShowHiddenChars+Common.Utils.String.platformKey("Ctrl+*")),this.btnMarkers.updateHint(this.tipMarkers),this.btnNumbers.updateHint(this.tipNumbers),this.btnMultilevels.updateHint(this.tipMultilevels),this.btnInsertTable.updateHint(this.tipInsertTable),this.btnInsertImage.updateHint(this.tipInsertImage),this.btnInsertChart.updateHint(this.tipInsertChart),this.btnInsertText.updateHint(this.tipInsertText),this.btnInsertTextArt.updateHint(this.tipInsertTextArt),this.btnEditHeader.updateHint(this.tipEditHeader),this.btnInsDateTime.updateHint(this.tipDateTime),this.btnBlankPage.updateHint(this.tipBlankPage),this.btnInsertShape.updateHint(this.tipInsertShape),this.btnInsertEquation.updateHint(this.tipInsertEquation),this.btnInsertSymbol.updateHint(this.tipInsertSymbol),this.btnDropCap.updateHint(this.tipDropCap),this.btnContentControls.updateHint(this.tipControls),this.btnColumns.updateHint(this.tipColumns),this.btnPageOrient.updateHint(this.tipPageOrient),this.btnPageSize.updateHint(this.tipPageSize),this.btnPageMargins.updateHint(this.tipPageMargins),this.btnLineNumbers.updateHint(this.tipLineNumbers),this.btnClearStyle.updateHint(this.tipClearStyle),this.btnCopyStyle.updateHint(this.tipCopyStyle+Common.Utils.String.platformKey("Ctrl+Shift+C")),this.btnColorSchemas.updateHint(this.tipColorSchemas),this.btnMailRecepients.updateHint(this.tipMailRecepients);var i=this;this.btnMarkers.setMenu(new Common.UI.Menu({cls:"shifted-left",style:"min-width: 139px",items:[{template:e.template('')},this.mnuMarkerSettings=new Common.UI.MenuItem({caption:this.textListSettings,disabled:0==(this.mnuMarkersPicker.conf.index||0),value:"settings"})]})),this.btnNumbers.setMenu(new Common.UI.Menu({cls:"shifted-left",items:[{template:e.template('')},this.mnuNumberSettings=new Common.UI.MenuItem({caption:this.textListSettings,disabled:0==(this.mnuNumbersPicker.conf.index||0),value:"settings"})]})),this.btnMultilevels.setMenu(new Common.UI.Menu({cls:"shifted-left",style:"min-width: 90px",items:[{template:e.template('')},this.mnuMultilevelSettings=new Common.UI.MenuItem({caption:this.textListSettings,disabled:0==(this.mnuMultilevelPicker.conf.index||0),value:"settings"})]})),this.btnEditHeader.setMenu(new Common.UI.Menu({items:[{caption:this.mniEditHeader,value:"header"},{caption:this.mniEditFooter,value:"footer"},{caption:"--"},this.mnuInsertPageNum=new Common.UI.MenuItem({caption:this.textInsertPageNumber,disabled:this.mnuInsertPageNum.isDisabled(),menu:new Common.UI.Menu({cls:"shifted-left",menuAlign:"tl-tr",style:"min-width: 90px;",items:[{template:e.template('')},this.mnuPageNumCurrentPos=new Common.UI.MenuItem({caption:this.textToCurrent,disabled:this.mnuPageNumCurrentPos.isDisabled(),value:"current"})]})}),this.mnuInsertPageCount=new Common.UI.MenuItem({caption:this.textInsertPageCount,disabled:this.mnuInsertPageCount.isDisabled()})]})),this.paragraphControls.push(this.mnuPageNumCurrentPos),this.paragraphControls.push(this.mnuInsertPageCount),this.btnInsertChart.setMenu(new Common.UI.Menu({style:"width: 364px;padding-top: 12px;",items:[{template:e.template('')}]}));var n=function(o){new Common.UI.DataView({el:t("#id-toolbar-menu-insertchart"),parentMenu:o,showLast:!1,restoreHeight:421,groups:new Common.UI.DataViewGroupStore(Common.define.chartData.getChartGroupData()),store:new Common.UI.DataViewStore(Common.define.chartData.getChartData()),itemTemplate:e.template('
')}).on("item:click",function(t,e,n,o){n&&i.fireEvent("add:chart",[n.get("type")])}),o.off("show:before",n)};this.btnInsertChart.menu.on("show:before",n);var o=function(n){var s=DE.getCollection("Common.Collections.TextArt");s.length<1&&DE.getController("Main").fillTextArt(i.api.asc_getTextArtPreviews()),new Common.UI.DataView({el:t("#id-toolbar-menu-insart"),store:s,parentMenu:n,showLast:!1,itemTemplate:e.template('
')}).on("item:click",function(t,e,o,s){o&&i.fireEvent("insert:textart",[o.get("data")]),"click"!==s.type&&n.hide()}),n.off("show:before",o)};this.btnInsertTextArt.menu.on("show:before",o);var s=this.mnuMarkersPicker.conf;this.mnuMarkersPicker=new Common.UI.DataView({el:t("#id-toolbar-menu-markers"),parentMenu:this.btnMarkers.menu,restoreHeight:138,allowScrollbar:!1,store:new Common.UI.DataViewStore([{offsety:0,data:{type:0,subtype:-1}},{offsety:38,data:{type:0,subtype:1}},{offsety:76,data:{type:0,subtype:2}},{offsety:114,data:{type:0,subtype:3}},{offsety:152,data:{type:0,subtype:4}},{offsety:190,data:{type:0,subtype:5}},{offsety:228,data:{type:0,subtype:6}},{offsety:266,data:{type:0,subtype:7}},{offsety:684,data:{type:0,subtype:8}}]),itemTemplate:e.template('
')}),s&&this.mnuMarkersPicker.selectByIndex(s.index,!0),s=this.mnuNumbersPicker.conf,this.mnuNumbersPicker=new Common.UI.DataView({el:t("#id-toolbar-menu-numbering"),parentMenu:this.btnNumbers.menu,restoreHeight:92,allowScrollbar:!1,store:new Common.UI.DataViewStore([{offsety:0,data:{type:1,subtype:-1}},{offsety:570,data:{type:1,subtype:4}},{offsety:532,data:{type:1,subtype:5}},{offsety:608,data:{type:1,subtype:6}},{offsety:418,data:{type:1,subtype:1}},{offsety:456,data:{type:1,subtype:2}},{offsety:494,data:{type:1,subtype:3}},{offsety:646,data:{type:1,subtype:7}}]),itemTemplate:e.template('
')}),s&&this.mnuNumbersPicker.selectByIndex(s.index,!0),s=this.mnuMultilevelPicker.conf,this.mnuMultilevelPicker=new Common.UI.DataView({el:t("#id-toolbar-menu-multilevels"),parentMenu:this.btnMultilevels.menu,restoreHeight:92,allowScrollbar:!1,store:new Common.UI.DataViewStore([{offsety:0,data:{type:2,subtype:-1}},{offsety:304,data:{type:2,subtype:1}},{offsety:342,data:{type:2,subtype:2}},{offsety:380,data:{type:2,subtype:3}}]),itemTemplate:e.template('
')}),s&&this.mnuMultilevelPicker.selectByIndex(s.index,!0),s=this.mnuPageNumberPosPicker?this.mnuPageNumberPosPicker.conf:void 0,this.mnuPageNumberPosPicker=new Common.UI.DataView({el:t("#id-toolbar-menu-pageposition"),allowScrollbar:!1,store:new Common.UI.DataViewStore([{offsety:132,allowSelected:!1,data:{type:c_pageNumPosition.PAGE_NUM_POSITION_TOP,subtype:c_pageNumPosition.PAGE_NUM_POSITION_LEFT}},{offsety:99,allowSelected:!1,data:{type:c_pageNumPosition.PAGE_NUM_POSITION_TOP,subtype:c_pageNumPosition.PAGE_NUM_POSITION_CENTER}},{offsety:66,allowSelected:!1,data:{type:c_pageNumPosition.PAGE_NUM_POSITION_TOP,subtype:c_pageNumPosition.PAGE_NUM_POSITION_RIGHT}},{offsety:33,allowSelected:!1,data:{type:c_pageNumPosition.PAGE_NUM_POSITION_BOTTOM,subtype:c_pageNumPosition.PAGE_NUM_POSITION_LEFT}},{offsety:0,allowSelected:!1,data:{type:c_pageNumPosition.PAGE_NUM_POSITION_BOTTOM,subtype:c_pageNumPosition.PAGE_NUM_POSITION_CENTER}},{offsety:165,allowSelected:!1,data:{type:c_pageNumPosition.PAGE_NUM_POSITION_BOTTOM,subtype:c_pageNumPosition.PAGE_NUM_POSITION_RIGHT}}]),itemTemplate:e.template('
')}),s&&this.mnuPageNumberPosPicker.setDisabled(s.disabled),this.mnuTablePicker=new Common.UI.DimensionPicker({el:t("#id-toolbar-menu-tablepicker"),minRows:8,minColumns:10,maxRows:8,maxColumns:10})},onToolbarAfterRender:function(e){var i;this.btnHighlightColor.cmpEl&&(i=t('
'),t("button:first-child",this.btnHighlightColor.cmpEl).append(i),this.btnHighlightColor.currentColor="FFFF00",i.css("background-color","#"+this.btnHighlightColor.currentColor),this.mnuHighlightColorPicker=new Common.UI.ColorPalette({el:t("#id-toolbar-menu-highlight"),colors:["FFFF00","00FF00","00FFFF","FF00FF","0000FF","FF0000","00008B","008B8B","006400","800080","8B0000","808000","FFFFFF","D3D3D3","A9A9A9","000000"]}),this.mnuHighlightColorPicker.select("FFFF00")),this.btnFontColor.cmpEl&&(i=t('
'),t("button:first-child",this.btnFontColor.cmpEl).append(i),i.css("background-color",this.btnFontColor.currentColor||"transparent"),this.mnuFontColorPicker=new Common.UI.ThemeColorPalette({el:t("#id-toolbar-menu-fontcolor")})),this.btnParagraphColor.cmpEl&&(i=t('
'),t("button:first-child",this.btnParagraphColor.cmpEl).append(i),i.css("background-color",this.btnParagraphColor.currentColor||"transparent"),this.mnuParagraphColorPicker=new Common.UI.ThemeColorPalette({el:t("#id-toolbar-menu-paracolor"),transparent:!0})),this.btnContentControls.cmpEl&&(this.mnuControlsColorPicker=new Common.UI.ThemeColorPalette({el:t("#id-toolbar-menu-controls-color"),colors:["000000","993300","333300","003300","003366","000080","333399","333333","800000","FF6600","808000","00FF00","008080","0000FF","666699","808080","FF0000","FF9900","99CC00","339966","33CCCC","3366FF","800080","999999","FF00FF","FFCC00","FFFF00","00FF00","00FFFF","00CCFF","993366","C0C0C0","FF99CC","FFCC99","FFFF99","CCFFCC","CCFFFF","C9C8FF","CC99FF","FFFFFF"]}))},updateMetricUnit:function(){for(var e=this.btnPageMargins.menu.items,i=0;i-1)},onSendThemeColorSchemes:function(t){var i=this;this.mnuColorSchema&&this.mnuColorSchema.items.length>0&&e.each(this.mnuColorSchema.items,function(t){t.remove()}),null==this.mnuColorSchema&&(this.mnuColorSchema=new Common.UI.Menu({cls:"shifted-left",restoreHeight:!0})),this.mnuColorSchema.items=[];var n=e.template(['','',"<% _.each(options.colors, function(color) { %>",'',"<% }) %>","",'<%= caption %>',""].join(""));e.each(t,function(t,e){for(var o=t.get_colors(),s=[],a=2;a<7;a++){var r="#"+Common.Utils.ThemeColor.getHexColor(o[a].get_r(),o[a].get_g(),o[a].get_b());s.push(r)}21==e&&this.mnuColorSchema.addItem({caption:"--"});var l=t.get_name();this.mnuColorSchema.addItem({template:n,cls:"color-schemas-menu",colors:s,caption:e<21?i.SchemeNames[e]||l:l,value:e,checkable:!0,toggleGroup:"menuSchema"})},this)},onCollaborativeChanges:function(){if(!this._state.hasCollaborativeChanges){if(!this.btnCollabChanges.rendered||this._state.previewmode)return void(this.needShowSynchTip=!0);this._state.hasCollaborativeChanges=!0,this.btnCollabChanges.cmpEl.addClass("notify"),this.showSynchTip?(this.btnCollabChanges.updateHint(""),void 0===this.synchTooltip&&this.createSynchTip(),this.synchTooltip.show()):this.btnCollabChanges.updateHint(this.tipSynchronize+Common.Utils.String.platformKey("Ctrl+S")),this.btnSave.setDisabled(!1),Common.Gateway.collaborativeChanges()}},createSynchTip:function(){this.synchTooltip=new Common.UI.SynchronizeTip({extCls:this.mode.customization&&this.mode.customization.compactHeader?void 0:"inc-index",target:this.btnCollabChanges.$el +}),this.synchTooltip.on("dontshowclick",function(){this.showSynchTip=!1,this.synchTooltip.hide(),this.btnCollabChanges.updateHint(this.tipSynchronize+Common.Utils.String.platformKey("Ctrl+S")),Common.localStorage.setItem("de-hide-synch",1)},this),this.synchTooltip.on("closeclick",function(){this.synchTooltip.hide(),this.btnCollabChanges.updateHint(this.tipSynchronize+Common.Utils.String.platformKey("Ctrl+S"))},this)},synchronizeChanges:function(){if(!this._state.previewmode&&this.btnCollabChanges.rendered){var t=this;t.btnCollabChanges.cmpEl.hasClass("notify")&&(t.btnCollabChanges.cmpEl.removeClass("notify"),this.synchTooltip&&this.synchTooltip.hide(),this.btnCollabChanges.updateHint(this.btnSaveTip),this.btnSave.setDisabled(!t.mode.forcesave),this._state.hasCollaborativeChanges=!1)}},onApiUsersChanged:function(t){var i=[];e.each(t,function(t){t.asc_getView()||i.push(t)});var n=this,o=e.size(i),s=o>1?"btn-save-coauth":"btn-save";s!==n.btnSaveCls&&n.btnCollabChanges.rendered&&(n.btnSaveTip=(o>1?n.tipSaveCoauth:n.tipSave)+Common.Utils.String.platformKey("Ctrl+S"),n.btnCollabChanges.updateHint(n.btnSaveTip),n.btnCollabChanges.$icon.removeClass(n.btnSaveCls).addClass(s),n.btnSaveCls=s)},onStyleMenuUpdate:function(t,e,i){var n=this;if(n.api){var o=n.api.asc_GetStyleFromFormatting(),s=t.styleTitle,a=o.get_Link();o.put_Name(s),a.put_Name(s+"_character"),n.api.asc_AddNewStyle(o),setTimeout(function(){n.listStyles.openButton.menu.hide()},100)}},onStyleMenuDelete:function(t,e,i){this.api&&this.api.asc_RemoveStyle(t.styleTitle)},onStyleMenuRestoreAll:function(t,i,n){var o=this;o.api&&e.each(window.styles.get_MergedStyles(),function(t){o.api.asc_IsStyleDefault(t.get_Name())&&o.api.asc_RemoveStyle(t.get_Name())})},onStyleMenuDeleteAll:function(t,e,i){this.api&&this.api.asc_RemoveAllCustomStyles()},textBold:"Bold",textItalic:"Italic",textUnderline:"Underline",textStrikeout:"Strikeout",textSuperscript:"Superscript",textSubscript:"Subscript",strMenuNoFill:"No Fill",tipFontName:"Font Name",tipFontSize:"Font Size",tipParagraphStyle:"Paragraph Style",tipCopy:"Copy",tipPaste:"Paste",tipUndo:"Undo",tipRedo:"Redo",tipPrint:"Print",tipSave:"Save",tipIncFont:"Increment font size",tipDecFont:"Decrement font size",tipHighlightColor:"Highlight color",tipFontColor:"Font color",tipMarkers:"Bullets",tipNumbers:"Numbering",tipMultilevels:"Outline",tipAlignLeft:"Align Left",tipAlignRight:"Align Right",tipAlignCenter:"Align Center",tipAlignJust:"Justified",tipDecPrLeft:"Decrease Indent",tipIncPrLeft:"Increase Indent",tipShowHiddenChars:"Nonprinting Characters",tipLineSpace:"Paragraph Line Spacing",tipPrColor:"Background color",tipInsertTable:"Insert Table",tipInsertImage:"Insert Image",tipPageBreak:"Insert Page or Section break",tipInsertNum:"Insert Page Number",tipClearStyle:"Clear Style",tipCopyStyle:"Copy Style",tipPageSize:"Page Size",tipPageOrient:"Page Orientation",tipBack:"Back",tipInsertShape:"Insert Autoshape",tipInsertEquation:"Insert Equation",mniImageFromFile:"Image from File",mniImageFromUrl:"Image from URL",mniCustomTable:"Insert Custom Table",textTitleError:"Error",textInsertPageNumber:"Insert page number",textToCurrent:"To Current Position",tipEditHeader:"Edit header or footer",mniEditHeader:"Edit Document Header",mniEditFooter:"Edit Document Footer",mniHiddenChars:"Nonprinting Characters",mniHiddenBorders:"Hidden Table Borders",tipSynchronize:"The document has been changed by another user. Please click to save your changes and reload the updates.",textNewColor:"Add New Custom Color",textAutoColor:"Automatic",tipInsertChart:"Insert Chart",tipColorSchemas:"Change Color Scheme",tipInsertText:"Insert Text",tipInsertTextArt:"Insert Text Art",mniEditDropCap:"Drop Cap Settings",textNone:"None",textInText:"In Text",textInMargin:"In Margin",tipDropCap:"Insert drop cap",txtScheme1:"Office",txtScheme2:"Grayscale",txtScheme3:"Apex",txtScheme4:"Aspect",txtScheme5:"Civic",txtScheme6:"Concourse",txtScheme7:"Equity",txtScheme8:"Flow",txtScheme9:"Foundry",txtScheme10:"Median",txtScheme11:"Metro",txtScheme12:"Module",txtScheme13:"Opulent",txtScheme14:"Oriel",txtScheme15:"Origin",txtScheme16:"Paper",txtScheme17:"Solstice",txtScheme18:"Technic",txtScheme19:"Trek",txtScheme20:"Urban",txtScheme21:"Verve",textInsPageBreak:"Insert Page Break",textInsColumnBreak:"Insert Column Break",textInsSectionBreak:"Insert Section Break",textNextPage:"Next Page",textContPage:"Continuous Page",textEvenPage:"Even Page",textOddPage:"Odd Page",tipSaveCoauth:"Save your changes for the other users to see them.",tipMailRecepients:"Mail Merge",textStyleMenuUpdate:"Update from select",textStyleMenuRestore:"Restore to default",textStyleMenuDelete:"Delete style",textStyleMenuRestoreAll:"Restore all to default styles",textStyleMenuDeleteAll:"Delete all custom styles",textStyleMenuNew:"New style from selection",tipColumns:"Insert columns",textColumnsOne:"One",textColumnsTwo:"Two",textColumnsThree:"Three",textColumnsLeft:"Left",textColumnsRight:"Right",tipPageMargins:"Page Margins",textMarginsLast:"Last Custom",textMarginsNormal:"Normal",textMarginsUsNormal:"US Normal",textMarginsNarrow:"Narrow",textMarginsModerate:"Moderate",textMarginsWide:"Wide",textPageMarginsCustom:"Custom margins",textTop:"Top: ",textLeft:"Left: ",textBottom:"Bottom: ",textRight:"Right: ",textPageSizeCustom:"Custom Page Size",textPortrait:"Portrait",textLandscape:"Landscape",textInsertPageCount:"Insert number of pages",tipChangeChart:"Change Chart Type",capBtnInsPagebreak:"Page Break",capBtnInsImage:"Image",capBtnInsTable:"Table",capBtnInsChart:"Chart",textTabFile:"File",textTabHome:"Home",textTabInsert:"Insert",textTabLayout:"Layout",textTabReview:"Review",capBtnInsShape:"Shape",capBtnInsTextbox:"Text Box",capBtnInsTextart:"Text Art",capBtnInsDropcap:"Drop Cap",capBtnInsEquation:"Equation",capBtnInsHeader:"Header/Footer",capBtnColumns:"Columns",capBtnPageOrient:"Orientation",capBtnMargins:"Margins",capBtnPageSize:"Size",tipImgAlign:"Align objects",tipImgGroup:"Group objects",tipImgWrapping:"Wrap text",tipSendForward:"Bring forward",tipSendBackward:"Send backward",capImgAlign:"Align",capImgGroup:"Group",capImgForward:"Bring Forward",capImgBackward:"Send Backward",capImgWrapping:"Wrapping",capBtnComment:"Comment",textColumnsCustom:"Custom Columns",textTabCollaboration:"Collaboration",textTabProtect:"Protection",textTabLinks:"References",capBtnInsControls:"Content Control",textRichControl:"Rich text",textPlainControl:"Plain text",textRemoveControl:"Remove",mniEditControls:"Settings",tipControls:"Insert content control",mniHighlightControls:"Highlight settings",textNoHighlight:"No highlighting",mniImageFromStorage:"Image from Storage",capBtnBlankPage:"Blank Page",tipBlankPage:"Insert blank page",txtDistribHor:"Distribute Horizontally",txtDistribVert:"Distribute Vertically",txtPageAlign:"Align to Page",txtMarginAlign:"Align to Margin",txtObjectsAlign:"Align Selected Objects",capBtnWatermark:"Watermark",textEditWatermark:"Custom Watermark",textRemWatermark:"Remove Watermark",tipWatermark:"Edit watermark",textPictureControl:"Picture",textComboboxControl:"Combo box",textCheckboxControl:"Check box",textDropdownControl:"Drop-down list",textDateControl:"Date",capBtnAddComment:"Add Comment",capBtnInsSymbol:"Symbol",tipInsertSymbol:"Insert symbol",mniDrawTable:"Draw Table",mniEraseTable:"Erase Table",textListSettings:"List Settings",capBtnDateTime:"Date & Time",tipDateTime:"Insert current date and time",capBtnLineNumbers:"Line Numbers",textContinuous:"Continuous",textRestartEachPage:"Restart Each Page",textRestartEachSection:"Restart Each Section",textSuppressForCurrentParagraph:"Suppress for Current Paragraph",textCustomLineNumbers:"Line Numbering Options",tipLineNumbers:"Show line numbers"}}(),DE.Views.Toolbar||{}))}),void 0===Common)var Common={};if(define("documenteditor/main/app/view/StyleTitleDialog",["common/main/lib/util/utils","common/main/lib/component/InputField","common/main/lib/component/Window"],function(){"use strict";DE.Views.StyleTitleDialog=Common.UI.Window.extend(_.extend({options:{width:350,height:196,style:"min-width: 230px;",cls:"modal-dlg",buttons:["ok","cancel"]},initialize:function(t){_.extend(this.options,{title:this.textHeader},t||{}),this.template=['
','",'
','",'
',"
"].join(""),this.options.tpl=_.template(this.template)(this.options),this.options.formats=this.options.formats||[],Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this);var t=this,e=this.getChild();t.inputTitle=new Common.UI.InputField({el:$("#id-dlg-style-title"),allowBlank:!1,blankError:t.txtEmpty,style:"width: 100%;",validateOnBlur:!1,validation:function(e){return!(""==e)||t.txtNotEmpty}}),e.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this)),this.options.formats.unshift({value:-1,displayValue:this.txtSameAs}),this.cmbNextStyle=new Common.UI.ComboBox({el:$("#id-dlg-style-next-par"),style:"width: 100%;",menuStyle:"width: 100%; max-height: 210px;",editable:!1,takeFocusOnClose:!0,cls:"input-group-nr",data:this.options.formats,disabled:0==this.options.formats.length}),this.cmbNextStyle.setValue(-1)},getFocusedComponents:function(){return[this.inputTitle,this.cmbNextStyle]},getDefaultFocusableComponent:function(){return this.inputTitle},getTitle:function(){return this.inputTitle.getValue()},getNextStyle:function(){var t=this.cmbNextStyle.getValue();return-1!=t?t:null},onBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value)},onPrimary:function(t){return this._handleInput("ok"),!1},_handleInput:function(t){if(this.options.handler){if("ok"==t){if(!0!==this.inputTitle.checkValidate())return void this.inputTitle.focus()}this.options.handler.call(this,this,t)}this.close()},textTitle:"Title",textHeader:"Create New Style",txtEmpty:"This field is required",txtNotEmpty:"Field must not be empty",textNextStyle:"Next paragraph style",txtSameAs:"Same as created new style"},DE.Views.StyleTitleDialog||{}))}),define("documenteditor/main/app/view/PageMarginsDialog",["common/main/lib/component/Window","common/main/lib/component/MetricSpinner"],function(){"use strict";DE.Views.PageMarginsDialog=Common.UI.Window.extend(_.extend({options:{width:404,header:!0,style:"min-width: 404px;",cls:"modal-dlg",id:"window-page-margins",buttons:["ok","cancel"]},initialize:function(t){_.extend(this.options,{title:this.textTitle},t||{}),this.template=['
','
','",'
','
','",'
',"
",'
','",'
',"
","
",'
','
','",'
',"
",'
','",'
',"
","
",'
','","
",'
','
',"
","
",'
','",'
',"
",'
','",'
',"
","
",'
','",'
',"
","
"].join(""),this.options.tpl=_.template(this.template)(this.options),this.spinners=[],this._noApply=!1,this.maxMarginsW=this.maxMarginsH=0,this.api=this.options.api,Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this),this.spnTop=new Common.UI.MetricSpinner({el:$("#page-margins-spin-top"),step:.1,width:86,defaultUnit:"cm",value:"1 cm",maxValue:55.88,minValue:-55.87}),this.spnTop.on("change",_.bind(function(t,e,i){this.api&&(this.properties=this.properties?this.properties:new Asc.CDocumentSectionProps,this.properties.put_TopMargin(Common.Utils.Metric.fnRecalcToMM(t.getNumberValue())),this.api.SetDrawImagePreviewMargins("page-margins-preview",this.properties))},this)),this.spinners.push(this.spnTop),this.spnBottom=new Common.UI.MetricSpinner({el:$("#page-margins-spin-bottom"),step:.1,width:86,defaultUnit:"cm",value:"1 cm",maxValue:55.88,minValue:-55.87}),this.spnBottom.on("change",_.bind(function(t,e,i){this.api&&(this.properties=this.properties?this.properties:new Asc.CDocumentSectionProps,this.properties.put_BottomMargin(Common.Utils.Metric.fnRecalcToMM(t.getNumberValue())),this.api.SetDrawImagePreviewMargins("page-margins-preview",this.properties))},this)),this.spinners.push(this.spnBottom),this.spnLeft=new Common.UI.MetricSpinner({el:$("#page-margins-spin-left"),step:.1,width:86,defaultUnit:"cm",value:"1 cm",maxValue:55.88,minValue:0}),this.spnLeft.on("change",_.bind(function(t,e,i){this.api&&(this.properties=this.properties?this.properties:new Asc.CDocumentSectionProps,this.properties.put_LeftMargin(Common.Utils.Metric.fnRecalcToMM(t.getNumberValue())),this.api.SetDrawImagePreviewMargins("page-margins-preview",this.properties))},this)),this.spinners.push(this.spnLeft),this.spnRight=new Common.UI.MetricSpinner({el:$("#page-margins-spin-right"),step:.1,width:86,defaultUnit:"cm",value:"1 cm",maxValue:55.88,minValue:0}),this.spnRight.on("change",_.bind(function(t,e,i){this.api&&(this.properties=this.properties?this.properties:new Asc.CDocumentSectionProps,this.properties.put_RightMargin(Common.Utils.Metric.fnRecalcToMM(t.getNumberValue())),this.api.SetDrawImagePreviewMargins("page-margins-preview",this.properties))},this)),this.spinners.push(this.spnRight),this.spnGutter=new Common.UI.MetricSpinner({el:$("#page-margins-spin-gutter"),step:.1,width:86,defaultUnit:"cm",value:"1 cm",maxValue:55.88,minValue:0}),this.spnGutter.on("change",_.bind(function(t,e,i){this.api&&(this.properties=this.properties?this.properties:new Asc.CDocumentSectionProps,this.properties.put_Gutter(Common.Utils.Metric.fnRecalcToMM(t.getNumberValue())),this.api.SetDrawImagePreviewMargins("page-margins-preview",this.properties))},this)),this.spinners.push(this.spnGutter),this.cmbGutterPosition=new Common.UI.ComboBox({el:$("#page-margins-spin-gutter-position"),menuStyle:"min-width: 86px;",style:"width: 86px;",editable:!1,takeFocusOnClose:!0,cls:"input-group-nr",data:[{value:0,displayValue:this.textLeft},{value:1,displayValue:this.textTop}]}),this.cmbGutterPosition.on("selected",_.bind(function(t,e){this.api&&(this.properties=this.properties?this.properties:new Asc.CDocumentSectionProps,this.properties.put_GutterAtTop(e.value),this.api.SetDrawImagePreviewMargins("page-margins-preview",this.properties))},this)),this.cmbOrientation=new Common.UI.ComboBox({el:$("#page-margins-cmb-orientation"),menuStyle:"min-width: 180px;",style:"width: 180px;",editable:!1,takeFocusOnClose:!0,cls:"input-group-nr",data:[{value:0,displayValue:this.textPortrait},{value:1,displayValue:this.textLandscape}]}),this.cmbOrientation.on("selected",_.bind(function(t,e){if(this.api&&(this.properties=this.properties?this.properties:new Asc.CDocumentSectionProps,this.properties.get_Orientation()!==e.value)){this.properties.put_TopMargin(Common.Utils.Metric.fnRecalcToMM(e.value?this.spnLeft.getNumberValue():this.spnRight.getNumberValue())),this.properties.put_BottomMargin(Common.Utils.Metric.fnRecalcToMM(e.value?this.spnRight.getNumberValue():this.spnLeft.getNumberValue())),this.properties.put_LeftMargin(Common.Utils.Metric.fnRecalcToMM(e.value?this.spnBottom.getNumberValue():this.spnTop.getNumberValue())),this.properties.put_RightMargin(Common.Utils.Metric.fnRecalcToMM(e.value?this.spnTop.getNumberValue():this.spnBottom.getNumberValue()));var i=this.properties.get_H();this.properties.put_H(this.properties.get_W()),this.properties.put_W(i),this.properties.put_Orientation(e.value),this.maxMarginsH=Common.Utils.Metric.fnRecalcFromMM(this.properties.get_H()-2.6),this.maxMarginsW=Common.Utils.Metric.fnRecalcFromMM(this.properties.get_W()-12.7),this.spnTop.setMaxValue(this.maxMarginsH),this.spnBottom.setMaxValue(this.maxMarginsH),this.spnLeft.setMaxValue(this.maxMarginsW),this.spnRight.setMaxValue(this.maxMarginsW),this.spnTop.setValue(Common.Utils.Metric.fnRecalcFromMM(this.properties.get_TopMargin()),!0),this.spnBottom.setValue(Common.Utils.Metric.fnRecalcFromMM(this.properties.get_BottomMargin()),!0),this.spnLeft.setValue(Common.Utils.Metric.fnRecalcFromMM(this.properties.get_LeftMargin()),!0),this.spnRight.setValue(Common.Utils.Metric.fnRecalcFromMM(this.properties.get_RightMargin()),!0),this.api.SetDrawImagePreviewMargins("page-margins-preview",this.properties)}},this)),this.cmbMultiplePages=new Common.UI.ComboBox({el:$("#page-margins-cmb-multiple-pages"),menuStyle:"min-width: 180px;",style:"width: 180px;",editable:!1,takeFocusOnClose:!0,cls:"input-group-nr",data:[{value:0,displayValue:this.textNormal},{value:1,displayValue:this.textMirrorMargins}]}),this.cmbMultiplePages.on("selected",_.bind(function(t,e){0===e.value?(this.window.find("#margin-left-label").html(this.textLeft),this.window.find("#margin-right-label").html(this.textRight),this.cmbGutterPosition.setDisabled(!1)):(this.window.find("#margin-left-label").html(this.textInside),this.window.find("#margin-right-label").html(this.textOutside),this.cmbGutterPosition.setValue(0),this.cmbGutterPosition.setDisabled(!0)),this.api&&(this.properties=this.properties?this.properties:new Asc.CDocumentSectionProps,this.properties.put_MirrorMargins(e.value),this.api.SetDrawImagePreviewMargins("page-margins-preview",this.properties))},this)),this.window=this.getChild(),this.window.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this)),this.updateMetricUnit()},getFocusedComponents:function(){return[this.spnTop,this.spnBottom,this.spnLeft,this.spnRight,this.spnGutter,this.cmbGutterPosition,this.cmbOrientation,this.cmbMultiplePages]},getDefaultFocusableComponent:function(){return this.spnTop},_handleInput:function(t){if(this.options.handler){if("ok"==t){var e=null;if(this.spnLeft.getNumberValue()+this.spnRight.getNumberValue()+(this.cmbGutterPosition.getValue()?0:this.spnGutter.getNumberValue())>this.maxMarginsW?e=this.txtMarginsW:Math.abs(this.spnTop.getNumberValue()+this.spnBottom.getNumberValue()+(this.cmbGutterPosition.getValue()?this.spnGutter.getNumberValue():0))>this.maxMarginsH&&(e=this.txtMarginsH),e)return void Common.UI.warning({title:this.notcriticalErrorTitle,msg:e})}this.options.handler.call(this,this,t)}this.close()},onBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value)},onPrimary:function(t){return this._handleInput("ok"),!1},setSettings:function(t){if(t){this.properties=t,this.maxMarginsH=Common.Utils.Metric.fnRecalcFromMM(t.get_H()-2.6),this.maxMarginsW=Common.Utils.Metric.fnRecalcFromMM(t.get_W()-12.7),this.spnTop.setMaxValue(this.maxMarginsH),this.spnBottom.setMaxValue(this.maxMarginsH),this.spnLeft.setMaxValue(this.maxMarginsW),this.spnRight.setMaxValue(this.maxMarginsW),this.spnTop.setValue(Common.Utils.Metric.fnRecalcFromMM(t.get_TopMargin()),!0),this.spnBottom.setValue(Common.Utils.Metric.fnRecalcFromMM(t.get_BottomMargin()),!0),this.spnLeft.setValue(Common.Utils.Metric.fnRecalcFromMM(t.get_LeftMargin()),!0),this.spnRight.setValue(Common.Utils.Metric.fnRecalcFromMM(t.get_RightMargin()),!0),this.cmbOrientation.setValue(t.get_Orientation()),this.spnGutter.setValue(Common.Utils.Metric.fnRecalcFromMM(t.get_Gutter()),!0),this.cmbGutterPosition.setValue(t.get_GutterAtTop()?1:0);var e=t.get_MirrorMargins();this.cmbMultiplePages.setValue(e?1:0),e&&(this.window.find("#margin-left-label").html(this.textInside),this.window.find("#margin-right-label").html(this.textOutside),this.cmbGutterPosition.setValue(0)),this.cmbGutterPosition.setDisabled(e),this.api&&this.api.SetDrawImagePreviewMargins("page-margins-preview",this.properties)}},getSettings:function(){var t=new Asc.CDocumentSectionProps;return t.put_TopMargin(Common.Utils.Metric.fnRecalcToMM(this.spnTop.getNumberValue())),t.put_BottomMargin(Common.Utils.Metric.fnRecalcToMM(this.spnBottom.getNumberValue())),t.put_LeftMargin(Common.Utils.Metric.fnRecalcToMM(this.spnLeft.getNumberValue())),t.put_RightMargin(Common.Utils.Metric.fnRecalcToMM(this.spnRight.getNumberValue())),t.put_Orientation(this.cmbOrientation.getValue()),t.put_Gutter(Common.Utils.Metric.fnRecalcToMM(this.spnGutter.getNumberValue())),t.put_GutterAtTop(!!this.cmbGutterPosition.getValue()),t.put_MirrorMargins(!!this.cmbMultiplePages.getValue()),t.put_H(this.properties.get_H()),t.put_W(this.properties.get_W()),t},updateMetricUnit:function(){if(this.spinners)for(var t=0;t','',"",'","","",'","","","
','",'
',"
','",'
',"
",'",'
',"
","",'
'].join(""),this.options.tpl=_.template(this.template)(this.options),this.spinners=[],this._noApply=!1,this.isOrientPortrait=!0,Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this),this.spnWidth=new Common.UI.MetricSpinner({el:$("#page-size-spin-width"),step:.1,width:86,defaultUnit:"cm",value:"10 cm",maxValue:118.9,minValue:0}),this.spinners.push(this.spnWidth),this.spnWidth.on("change",_.bind(function(t,e,i,n){!this._noApply&&this.cmbPreset.getValue()>-1&&this.cmbPreset.setValue(-1)},this)),this.spnHeight=new Common.UI.MetricSpinner({el:$("#page-size-spin-height"),step:.1,width:86,defaultUnit:"cm",value:"20 cm",maxValue:118.9,minValue:0}),this.spinners.push(this.spnHeight),this.spnHeight.on("change",_.bind(function(t,e,i,n){!this._noApply&&this.cmbPreset.getValue()>-1&&this.cmbPreset.setValue(-1)},this)),this.cmbPreset=new Common.UI.ComboBox({el:$("#page-size-combo-preset"),cls:"input-group-nr",menuStyle:"min-width: 183px;max-height: 208px;",editable:!1,takeFocusOnClose:!0,scrollAlwaysVisible:!0,data:[{value:0,displayValue:"US Letter",size:[215.9,279.4]},{value:1,displayValue:"US Legal",size:[215.9,355.6]},{value:2,displayValue:"A4",size:[210,297]},{value:3,displayValue:"A5",size:[148,210]},{value:4,displayValue:"B5",size:[176,250]},{value:5,displayValue:"Envelope #10",size:[104.8,241.3]},{value:6,displayValue:"Envelope DL",size:[110,220]},{value:7,displayValue:"Tabloid",size:[279.4,431.8]},{value:8,displayValue:"A3",size:[297,420]},{value:9,displayValue:"Tabloid Oversize",size:[304.8,457.1]},{value:10,displayValue:"ROC 16K",size:[196.8,273]},{value:11,displayValue:"Envelope Choukei 3",size:[119.9,234.9]},{value:12,displayValue:"Super B/A3",size:[330.2,482.5]},{value:13,displayValue:"A0",size:[841,1189]},{value:14,displayValue:"A1",size:[594,841]},{value:16,displayValue:"A2",size:[420,594]},{value:17,displayValue:"A6",size:[105,148]},{value:-1,displayValue:this.txtCustom,size:[]}]}),this.cmbPreset.setValue(-1),this.cmbPreset.on("selected",_.bind(function(t,e){this._noApply=!0,e.value<0||(this.spnWidth.setValue(Common.Utils.Metric.fnRecalcFromMM(this.isOrientPortrait?e.size[0]:e.size[1]),!0),this.spnHeight.setValue(Common.Utils.Metric.fnRecalcFromMM(this.isOrientPortrait?e.size[1]:e.size[0]),!0)),this._noApply=!1},this)),this.getChild().find(".dlg-btn").on("click",_.bind(this.onBtnClick,this)),this.updateMetricUnit()},getFocusedComponents:function(){return[this.cmbPreset,this.spnWidth,this.spnHeight]},getDefaultFocusableComponent:function(){return this.cmbPreset},_handleInput:function(t){this.options.handler&&this.options.handler.call(this,this,t),this.close()},onBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value)},onPrimary:function(t){return this._handleInput("ok"),!1},setSettings:function(t){if(t){this.isOrientPortrait=t.get_W()1&&(!e||3==e),!0),this.toolbar.mniAlignToMargin.setChecked(t<2&&!e||2==e,!0),this.toolbar.mniAlignToPage.setChecked(1==e,!0),this.toolbar.mniDistribHor.setDisabled(t<3&&this.toolbar.mniAlignObjects.isChecked()),this.toolbar.mniDistribVert.setDisabled(t<3&&this.toolbar.mniAlignObjects.isChecked())},onClickMenuAlign:function(t,e,i){ var n=this.toolbar.mniAlignToPage.isChecked()?Asc.c_oAscObjectsAlignType.Page:this.toolbar.mniAlignToMargin.isChecked()?Asc.c_oAscObjectsAlignType.Margin:Asc.c_oAscObjectsAlignType.Selected;e.value>-1&&e.value<6?(this.api.put_ShapesAlign(e.value,n),Common.component.Analytics.trackEvent("ToolBar","Shape Align")):6==e.value?(this.api.DistributeHorizontally(n),Common.component.Analytics.trackEvent("ToolBar","Distribute")):7==e.value&&(this.api.DistributeVertically(n),Common.component.Analytics.trackEvent("ToolBar","Distribute")),this.toolbar.fireEvent("editcomplete",this.toolbar)},onClickMenuWrapping:function(e,i,n){var o=new Asc.asc_CImgProperty;if(o.put_WrappingStyle(i.options.wrapType),t.get_WrappingStyle()===Asc.c_oAscWrapStyle2.Inline&&i.options.wrapType!==Asc.c_oAscWrapStyle2.Inline){o.put_PositionH(new Asc.CImagePositionH),o.get_PositionH().put_UseAlign(!1),o.get_PositionH().put_RelativeFrom(Asc.c_oAscRelativeFromH.Column);var s=t.get_Value_X(Asc.c_oAscRelativeFromH.Column);o.get_PositionH().put_Value(s),o.put_PositionV(new Asc.CImagePositionV),o.get_PositionV().put_UseAlign(!1),o.get_PositionV().put_RelativeFrom(Asc.c_oAscRelativeFromV.Paragraph),s=t.get_Value_Y(Asc.c_oAscRelativeFromV.Paragraph),o.get_PositionV().put_Value(s)}this.api.ImgApply(o),this.toolbar.fireEvent("editcomplete",this.toolbar)},onClickMenuGroup:function(t,e,i){var n=new Asc.asc_CImgProperty;n.put_Group(e.options.groupval),this.api.ImgApply(n),this.toolbar.fireEvent("editcomplete",this.toolbar)},onClickMenuForward:function(t,e,i){var n=new Asc.asc_CImgProperty;"forward"==t?n.put_ChangeLevel(Asc.c_oAscChangeLevel.BringForward):"backward"==t?n.put_ChangeLevel(Asc.c_oAscChangeLevel.BringBackward):n.put_ChangeLevel(e.options.valign),this.api.ImgApply(n),this.toolbar.fireEvent("editcomplete",this.toolbar)}}}())}),define("documenteditor/main/app/view/CustomColumnsDialog",["common/main/lib/component/Window","common/main/lib/component/MetricSpinner","common/main/lib/component/CheckBox"],function(){"use strict";DE.Views.CustomColumnsDialog=Common.UI.Window.extend(_.extend({options:{width:300,header:!0,style:"min-width: 216px;",cls:"modal-dlg",buttons:["ok","cancel"]},initialize:function(t){_.extend(this.options,{title:this.textTitle},t||{}),this.template=['
','
','
',"
",'
','
',"
",'
','
',"
","
",'
'].join(""),this.options.tpl=_.template(this.template)(this.options),this.spinners=[],this.totalWidth=558.7,this._noApply=!1,Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this);var t=this;this.spnColumns=new Common.UI.MetricSpinner({el:$("#custom-columns-spin-num"),step:1,allowDecimal:!1,width:100,defaultUnit:"",value:"1",maxValue:12,minValue:1}),this.spnColumns.on("change",function(e,i,n,o){var s=Common.Utils.Metric.fnRecalcToMM(t.spnSpacing.getNumberValue()),a=t.spnColumns.getNumberValue();t.chSeparator.setDisabled(a<2),t.spnSpacing.setDisabled(a<2),a<2&&(a=2);var r=parseFloat(((t.totalWidth-12.7*a)/(a-1)).toFixed(1));t.spnSpacing.setMaxValue(Common.Utils.Metric.fnRecalcFromMM(r)),s>r&&t.spnSpacing.setValue(Common.Utils.Metric.fnRecalcFromMM(r),!0)}),this.spnSpacing=new Common.UI.MetricSpinner({el:$("#custom-columns-spin-spacing"),step:.1,width:100,defaultUnit:"cm",value:"0 cm",maxValue:40.64,minValue:0}),this.spinners.push(this.spnSpacing),this.chSeparator=new Common.UI.CheckBox({el:$("#custom-columns-separator"),labelText:this.textSeparator}),this.getChild().find(".dlg-btn").on("click",_.bind(this.onBtnClick,this)),this.updateMetricUnit()},getFocusedComponents:function(){return[this.spnColumns,this.spnSpacing]},getDefaultFocusableComponent:function(){return this.spnColumns},_handleInput:function(t){this.options.handler&&this.options.handler.call(this,this,t),this.close()},onBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value)},onPrimary:function(){return this._handleInput("ok"),!1},setSettings:function(t){if(t){var e=t.get_EqualWidth(),i=e?t.get_Num():t.get_ColsCount(),n=e?t.get_Space():i>1?t.get_Col(0).get_Space():12.5;this.chSeparator.setValue(t.get_Sep());var o=t.get_TotalWidth(),s=parseInt((o+.1)/(12.7+.1));this.spnColumns.setMaxValue(s),this.spnColumns.setValue(i,!0),this.chSeparator.setDisabled(i<2),this.spnSpacing.setDisabled(i<2),i<2&&(i=2),i>s&&(i=s);var a=parseFloat(((o-12.7*i)/(i-1)).toFixed(1));this.spnSpacing.setMaxValue(Common.Utils.Metric.fnRecalcFromMM(a)),this.spnSpacing.setValue(Common.Utils.Metric.fnRecalcFromMM(n),!0),this.totalWidth=o}},getSettings:function(){var t=new Asc.CDocumentColumnsProps;return t.put_EqualWidth(!0),t.put_Num(this.spnColumns.getNumberValue()),t.put_Space(Common.Utils.Metric.fnRecalcToMM(this.spnSpacing.getNumberValue())),t.put_Sep("checked"==this.chSeparator.getValue()),t},updateMetricUnit:function(){if(this.spinners)for(var t=0;t\n \n
\n \n \n
\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n \n
\n
\n \n
\n
\n \n
\n
\n
\n
\n
\n
\n
\n
\n \n
\n
\n
\n \n \n
\n \n \n \n \n \n \n \n \n \n \n
\n
\n
\n
\n
\n
\n
\n \n
\n
\n \n\n'}),define("documenteditor/main/app/view/WatermarkSettingsDialog",["text!documenteditor/main/app/template/WatermarkSettings.template","common/main/lib/util/utils","common/main/lib/component/RadioBox","common/main/lib/component/InputField","common/main/lib/view/AdvancedSettingsWindow"],function(t){"use strict";DE.Views.WatermarkText=new function(){var t;return{get:function(){return t},load:function(e){t=[],Common.Utils.loadConfig("resources/watermark/wm-text.json",function(i){for(var n in i){var o=Common.util.LanguageInfo.getLocalLanguageCode(n);o&&t.push({code:o,name:Common.util.LanguageInfo.getLocalLanguageName(o)[1],shortname:Common.util.LanguageInfo.getLocalLanguageName(o)[0],text:i[n]})}t.sort(function(t,e){return t.shortnamee.shortname?1:0}),e&&e(t)})}}},DE.Views.WatermarkSettingsDialog=Common.Views.AdvancedSettingsWindow.extend(_.extend({options:{contentWidth:400,height:442},initialize:function(e){var i=this;_.extend(this.options,{title:this.textTitle,template:_.template(['
','
','
',t,"
","
","
"].join(""))({scope:this})},e),this.handler=e.handler,this.props=e.props,this.fontStore=e.fontStore,this.api=e.api,this.storage=!!e.storage,this.textControls=[],this.imageControls=[],this.fontName="Arial",this.text="",this.isAutoColor=!1,this.isImageLoaded=!1;var n=e.lang||"en",o=Common.util.LanguageInfo.getLocalLanguageCode(n);this.lang=o?{value:n,displayValue:Common.util.LanguageInfo.getLocalLanguageName(o)[1],default:!0}:{value:"en",displayValue:"English",default:!0},Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this,this.options)},render:function(){Common.Views.AdvancedSettingsWindow.prototype.render.call(this);var t=this;this.radioNone=new Common.UI.RadioBox({el:$("#watermark-radio-none"),name:"asc-radio-watermark-type",labelText:this.textNone,checked:!1}),this.radioNone.on("change",_.bind(function(t,e,i){e&&(this.props.put_Type(Asc.c_oAscWatermarkType.None),this.disableControls(Asc.c_oAscWatermarkType.None))},this)),this.radioImage=new Common.UI.RadioBox({el:$("#watermark-radio-image"),name:"asc-radio-watermark-type",labelText:this.textImageW,checked:!1}),this.radioImage.on("change",_.bind(function(t,e,i){e&&(this.props.put_Type(Asc.c_oAscWatermarkType.Image),this.disableControls(Asc.c_oAscWatermarkType.Image),this.focusControls())},this)),this.radioText=new Common.UI.RadioBox({el:$("#watermark-radio-text"),name:"asc-radio-watermark-type",labelText:this.textTextW,checked:!0}),this.radioText.on("change",_.bind(function(t,e,i){e&&(this.props.put_Type(Asc.c_oAscWatermarkType.Text),this.disableControls(Asc.c_oAscWatermarkType.Text),this.focusControls())},this)),this.btnSelectImage=new Common.UI.Button({parentEl:$("#watermark-select-image"),cls:"btn-text-menu-default",caption:this.textSelect,style:"width: 142px;",menu:new Common.UI.Menu({style:"min-width: 142px;",maxHeight:200,additionalAlign:this.menuAddAlign,items:[{caption:this.textFromFile,value:0},{caption:this.textFromUrl,value:1},{caption:this.textFromStorage,value:2}]})}),this.imageControls.push(this.btnSelectImage),this.btnSelectImage.menu.on("item:click",_.bind(this.onImageSelect,this)),this.btnSelectImage.menu.items[2].setVisible(this.storage),this._arrScale=[{displayValue:this.textAuto,value:-1},{displayValue:"500%",value:500},{displayValue:"200%",value:200},{displayValue:"150%",value:150},{displayValue:"100%",value:100},{displayValue:"50%",value:50}],this.cmbScale=new Common.UI.ComboBox({el:$("#watermark-combo-scale"),cls:"input-group-nr",menuStyle:"min-width: 142px;",data:this._arrScale,takeFocusOnClose:!0}).on("selected",_.bind(function(t,e){},this)),this.cmbScale.setValue(this._arrScale[0].value),this.imageControls.push(this.cmbScale),this.cmbLang=new Common.UI.ComboBox({el:$("#watermark-combo-lang"),cls:"input-group-nr",editable:!1,menuStyle:"min-width: 100%;max-height: 210px;",scrollAlwaysVisible:!0,data:[],takeFocusOnClose:!0}).on("selected",_.bind(this.onSelectLang,this)),this.cmbLang.setValue(Common.util.LanguageInfo.getLocalLanguageName(9)[1]),this.textControls.push(this.cmbLang),this.cmbText=new Common.UI.ComboBox({el:$("#watermark-combo-text"),cls:"input-group-nr",menuStyle:"min-width: 100%;max-height: 210px;",scrollAlwaysVisible:!0,displayField:"value",data:[{value:"ASAP"},{value:"CONFIDENTIAL"},{value:"COPY"},{value:"DO NOT COPY"},{value:"DRAFT"},{value:"ORIGINAL"},{value:"PERSONAL"},{value:"SAMPLE"},{value:"TOP SECRET"},{value:"URGENT"}],takeFocusOnClose:!0}).on("selected",_.bind(function(t,e){},this)),this.cmbText.setValue(this.cmbText.options.data[0].value),this.textControls.push(this.cmbText),this.cmbFonts=new Common.UI.ComboBoxFonts({el:$("#watermark-fonts"),cls:"input-group-nr",style:"width: 142px;",menuCls:"scrollable-menu",menuStyle:"min-width: 100%;max-height: 270px;",store:new Common.Collections.Fonts,recent:0,hint:this.tipFontName,takeFocusOnClose:!0}).on("selected",_.bind(function(t,e){this.fontName=e.name},this)),this.textControls.push(this.cmbFonts);var e=[{value:-1,displayValue:this.textAuto},{value:36,displayValue:"36"},{value:40,displayValue:"40"},{value:44,displayValue:"44"},{value:48,displayValue:"48"},{value:54,displayValue:"54"},{value:60,displayValue:"60"},{value:66,displayValue:"66"},{value:72,displayValue:"72"},{value:80,displayValue:"80"},{value:90,displayValue:"90"},{value:96,displayValue:"96"},{value:105,displayValue:"105"},{value:120,displayValue:"120"},{value:144,displayValue:"144"}];this.cmbFontSize=new Common.UI.ComboBox({el:$("#watermark-font-size"),cls:"input-group-nr",style:"width: 55px;",menuCls:"scrollable-menu",menuStyle:"min-width: 55px;max-height: 270px;",hint:this.tipFontSize,data:e,takeFocusOnClose:!0}),this.cmbFontSize.setValue(-1),this.textControls.push(this.cmbFontSize),this.btnBold=new Common.UI.Button({parentEl:$("#watermark-bold"),cls:"btn-toolbar",iconCls:"toolbar__icon btn-bold",enableToggle:!0,hint:this.textBold}),this.textControls.push(this.btnBold),this.btnItalic=new Common.UI.Button({parentEl:$("#watermark-italic"),cls:"btn-toolbar",iconCls:"toolbar__icon btn-italic",enableToggle:!0,hint:this.textItalic}),this.textControls.push(this.btnItalic),this.btnUnderline=new Common.UI.Button({parentEl:$("#watermark-underline"),cls:"btn-toolbar",iconCls:"toolbar__icon btn-underline",enableToggle:!0,hint:this.textUnderline}),this.textControls.push(this.btnUnderline),this.btnStrikeout=new Common.UI.Button({parentEl:$("#watermark-strikeout"),cls:"btn-toolbar",iconCls:"toolbar__icon btn-strikeout",enableToggle:!0,hint:this.textStrikeout}),this.textControls.push(this.btnStrikeout);this.btnTextColor=new Common.UI.Button({parentEl:$("#watermark-textcolor"),cls:"btn-toolbar",iconCls:"toolbar__icon btn-fontcolor",hint:this.textColor,menu:new Common.UI.Menu({cls:"shifted-left",items:[{id:"watermark-auto-color",caption:this.textAuto,template:_.template('<%= caption %>')},{caption:"--"},{template:_.template('
')},{template:_.template(''+this.textNewColor+"")}]})}),this.mnuTextColorPicker=function(e,i){if(e&&e.cmpEl){e.currentColor="#c0c0c0";var n=$('
');$("button:first-child",e.cmpEl).append(n),n.css("background-color",e.currentColor);var o=new Common.UI.ThemeColorPalette({el:$(i)})}return e.menu.cmpEl.on("click",i+"-new",_.bind(function(){o.addNewColor("object"==typeof e.color?e.color.color:e.color)},t)),o.on("select",_.bind(t.onColorSelect,t)),o}(this.btnTextColor,"#watermark-menu-textcolor"),$("#watermark-auto-color").on("click",_.bind(this.onAutoColor,this)),this.textControls.push(this.btnTextColor),this.chTransparency=new Common.UI.CheckBox({el:$("#watermark-chb-transparency"),labelText:this.textTransparency,value:!0}),this.textControls.push(this.chTransparency),this.radioDiag=new Common.UI.RadioBox({el:$("#watermark-radio-diag"),name:"asc-radio-watermark-layout",labelText:this.textDiagonal,checked:!0}),this.textControls.push(this.radioDiag),this.radioHor=new Common.UI.RadioBox({el:$("#watermark-radio-hor"),name:"asc-radio-watermark-layout",labelText:this.textHor}),this.textControls.push(this.radioHor),this.btnOk=new Common.UI.Button({el:this.$window.find(".primary"),disabled:!0}),this.afterRender()},getFocusedComponents:function(){return[this.cmbLang,this.cmbText,this.cmbFonts,this.cmbFontSize,this.cmbScale]},getDefaultFocusableComponent:function(){return this.cmbLang.isDisabled()?this.cmbScale.isDisabled()?void 0:this.cmbScale:this.cmbLang},focusControls:function(){var t=this.getDefaultFocusableComponent();t&&setTimeout(function(){t.focus()},10)},onColorSelect:function(t,e){var i=this.btnTextColor.menu.$el.find("#watermark-auto-color > a");i.hasClass("selected")&&i.removeClass("selected"),this.isAutoColor=!1;var n="object"==typeof e?e.color:e;this.btnTextColor.currentColor=e,$(".btn-color-value-line",this.btnTextColor.cmpEl).css("background-color","#"+n)},updateThemeColors:function(){this.mnuTextColorPicker.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors())},addNewColor:function(t,e){t.addNewColor("object"==typeof e.color?e.color.color:e.color)},onAutoColor:function(t){var e=this.btnTextColor.menu.$el.find("#watermark-auto-color > a");!e.hasClass("selected")&&e.addClass("selected"),this.isAutoColor=!0;this.btnTextColor.currentColor="000",$(".btn-color-value-line",this.btnTextColor.cmpEl).css("background-color","#000"),this.mnuTextColorPicker.clearSelection()},afterRender:function(){this.cmbFonts.fillFonts(this.fontStore),this.cmbFonts.selectRecord(this.fontStore.findWhere({name:this.fontName})),this.updateThemeColors(),this._setDefaults(this.props);var t=this,e=function(){t.isImageLoaded=!0,t.btnOk.setDisabled(!1)};this.api.asc_registerCallback("asc_onWatermarkImageLoaded",e);var i=function(e){e&&e.url&&"watermark"==e.c&&t.props.put_ImageUrl(e.url,e.token)};Common.NotificationCenter.on("storage:image-insert",i),this.on("close",function(n){t.api.asc_unregisterCallback("asc_onWatermarkImageLoaded",e),Common.NotificationCenter.off("storage:image-insert",i)})},loadLanguages:function(){var t=this,e=!1,i=function(i){var n=[];if(t.languages=i,t.languages&&t.languages.forEach(function(t){n.push({displayValue:t.name,value:t.shortname,wmtext:t.text})}),n.length){t.cmbLang.setData(n);var o=t.loadWMText(t.lang.value);o&&t.lang.default?t.cmbLang.setValue(o):t.cmbLang.setValue(t.lang.displayValue),t.cmbLang.setDisabled(!t.radioText.getValue()),t.text&&t.cmbText.setValue(t.text)}else t.cmbLang.setDisabled(!0);e&&t.focusControls()},n=DE.Views.WatermarkText.get();e=!n,n?i(n):DE.Views.WatermarkText.load(i)},onSelectLang:function(t,e){if(e){var i=[];e.wmtext.forEach(function(t){i.push({value:t})}),this.lang=e,i.length>0&&(this.cmbText.setData(i),this.cmbText.setValue(i[0].value))}},loadWMText:function(t){if(t){var e=[],i=this.cmbLang.store.findWhere({value:t});return i||(i=this.cmbLang.store.findWhere({value:t.split(/[\-\_]/)[0]})),i||(i=this.cmbLang.store.findWhere({value:"en"})),i||(i=this.cmbLang.store.at(0)),i&&i.get("wmtext").forEach(function(t){e.push({value:t})}),e.length>0&&(this.cmbText.setData(e),this.cmbText.setValue(e[0].value)),i?i.get("displayValue"):null}},onImageSelect:function(t,e){if(1==e.value){var i=this;new Common.Views.ImageFromUrlDialog({handler:function(t,e){if("ok"==t){var n=e.replace(/ /g,"");_.isEmpty(n)||i.props.put_ImageUrl(n)}}}).show()}else 2==e.value?Common.NotificationCenter.trigger("storage:image-load","watermark"):this.props.showFileDialog()},_setDefaults:function(t){if(this.loadLanguages(),t){t.put_DivId("watermark-texture-img"),t.put_Api(this.api);var e,i=t.get_Type();if(i==Asc.c_oAscWatermarkType.None)this.radioNone.setValue(!0,!0);else if(i==Asc.c_oAscWatermarkType.Image)this.radioImage.setValue(!0,!0),this.isImageLoaded=!!t.get_ImageUrl(),e=t.get_Scale()||-1,this.cmbScale.setValue(e<0?-1:Math.round(100*e),Math.round(100*e)+" %");else{if(this.radioText.setValue(!0,!0),!t.get_IsDiagonal()&&this.radioHor.setValue(!0),this.chTransparency.setValue(t.get_Opacity()<255),e=t.get_TextPr()){var n=Common.util.LanguageInfo.getLocalLanguageName(e.get_Lang());this.lang={value:n[0],displayValue:n[1]},this.cmbLang.setValue(n[1]),this.loadWMText(n[0]);var o=e.get_FontFamily().get_Name();if(o){var s=this.cmbFonts.store.findWhere({name:o});this.fontName=s?s.get("name"):o,this.cmbFonts.setValue(this.fontName)}this.cmbFontSize.setValue(e.get_FontSize()),this.btnBold.toggle(e.get_Bold()),this.btnItalic.toggle(e.get_Italic()),this.btnUnderline.toggle(e.get_Underline()),this.btnStrikeout.toggle(e.get_Strikeout());var a=e.get_Color(),r=this.btnTextColor.menu.$el.find("#watermark-auto-color > a"),l="c0c0c0";if(a.get_auto())l="000",this.isAutoColor=!0,this.mnuTextColorPicker.clearSelection(),!r.hasClass("selected")&&r.addClass("selected");else if(r.hasClass("selected")&&r.removeClass("selected"),a&&(l=a.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?{color:Common.Utils.ThemeColor.getHexColor(a.get_r(),a.get_g(),a.get_b()),effectValue:a.get_value()}:Common.Utils.ThemeColor.getHexColor(a.get_r(),a.get_g(),a.get_b())),"object"==typeof l){for(var c=!1,d=0;d<10;d++)if(Common.Utils.ThemeColor.ThemeValues[d]==l.effectValue){this.mnuTextColorPicker.select(l,!0),c=!0;break}c||this.mnuTextColorPicker.clearSelection()}else this.mnuTextColorPicker.select(l,!0);this.btnTextColor.currentColor=l,$(".btn-color-value-line",this.btnTextColor.cmpEl).css("background-color","#"+("object"==typeof l?l.color:l))}e=t.get_Text(),e&&this.cmbText.setValue(e),this.text=e||""}this.disableControls(i)}},getSettings:function(){var t=this.props,e=this.props.get_Type();if(e==Asc.c_oAscWatermarkType.Image)e=parseInt(this.cmbScale.getValue()),isNaN(e)&&(e=-1),t.put_Scale(e<0?e:e/100);else if(t.put_Text(this.cmbText.getValue()),t.put_IsDiagonal(this.radioDiag.getValue()),t.put_Opacity("checked"==this.chTransparency.getValue()?128:255),e=t.get_TextPr()||new Asc.CTextProp){e.put_FontSize(Math.min(this.cmbFontSize.getValue(),1638));var i=new AscCommon.asc_CTextFontFamily;i.put_Name(this.fontName),i.put_Index(-1),e.put_FontFamily(i),e.put_Bold(this.btnBold.pressed),e.put_Italic(this.btnItalic.pressed),e.put_Underline(this.btnUnderline.pressed),e.put_Strikeout(this.btnStrikeout.pressed),e.put_Lang(parseInt(Common.util.LanguageInfo.getLocalLanguageCode(this.lang.value)));var n=new Asc.asc_CColor;this.isAutoColor?n.put_auto(!0):n=Common.Utils.ThemeColor.getRgbColor(this.btnTextColor.currentColor),e.put_Color(n),t.put_TextPr(e)}return this.props},disableControls:function(t){var e=t!=Asc.c_oAscWatermarkType.Image;_.each(this.imageControls,function(t){t.setDisabled(e)}),e=t!=Asc.c_oAscWatermarkType.Text,_.each(this.textControls,function(t){t.setDisabled(e)}),this.cmbLang.setDisabled(e||!this.languages||this.languages.length<1),this.btnOk.setDisabled(t==Asc.c_oAscWatermarkType.Image&&!this.isImageLoaded)},onDlgBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value)},onPrimary:function(){return this._handleInput("ok"),!1},_handleInput:function(t){if(this.handler){if("ok"==t&&this.btnOk.isDisabled())return;this.handler.call(this,t,this.getSettings())}this.close()},textTitle:"Watermark Settings",textNone:"None",textImageW:"Image watermark",textTextW:"Text watermark",textFromUrl:"From URL",textFromFile:"From File",textScale:"Scale",textAuto:"Auto",textText:"Text",textFont:"Font",tipFontName:"Font Name",tipFontSize:"Font Size",textBold:"Bold",textItalic:"Italic",textUnderline:"Underline",textStrikeout:"Strikeout",textTransparency:"Semitransparent",textLayout:"Layout",textDiagonal:"Diagonal",textHor:"Horizontal",textColor:"Text color",textNewColor:"Add New Custom Color",textLanguage:"Language",textFromStorage:"From Storage",textSelect:"Select Image"},DE.Views.WatermarkSettingsDialog||{}))}),void 0===Common)var Common={};if(define("documenteditor/main/app/view/ListSettingsDialog",["common/main/lib/component/Window","common/main/lib/component/MetricSpinner","common/main/lib/component/ThemeColorPalette","common/main/lib/component/ColorButton","common/main/lib/component/ComboBox","common/main/lib/view/SymbolTableDialog"],function(){"use strict";DE.Views.ListSettingsDialog=Common.UI.Window.extend(_.extend({options:{type:0,width:300,height:422,style:"min-width: 240px;",cls:"modal-dlg",split:!1,buttons:["ok","cancel"]},initialize:function(t){this.type=t.type||0,_.extend(this.options,{title:this.txtTitle,height:2==this.type?376:422,width:2==this.type?430:300},t||{}),this.template=['
',"<% if (type == 2) { %>",'',"",'",'",'",'","","
','",'
',"
','",'
',"
','",'
',"
','",'
',"
","<% } else {%>",'',"",'",'","","",'",'","","
',"<% if (type == 0) { %>",'",'","<% } else { %>",'",'
',"<% } %>","
','",'
',"
','",'
',"
','",'
',"
","<% } %>",'',"",'","","","
","",'
',"
","
"].join(""),this.props=t.props,this.level=t.level||0,this.api=t.api,this.options.tpl=_.template(this.template)(this.options),this.levels=[],Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this);var t=this,e=this.getChild();e.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this)),this.btnColor=new Common.UI.ColorButton({parentEl:e.find("#id-dlg-bullet-color"),additionalItems:[{id:"id-dlg-bullet-text-color",caption:this.txtLikeText,checkable:!0,toggleGroup:"list-settings-color",style:"padding-left: 20px;"},{id:"id-dlg-bullet-auto-color",caption:this.textAuto,checkable:!0,toggleGroup:"list-settings-color",style:"padding-left: 20px;"},{caption:"--"}],additionalAlign:this.menuAddAlign}),this.btnColor.on("color:select",_.bind(this.onColorsSelect,this)),this.btnColor.menu.items[0].on("toggle",_.bind(this.onLikeTextColor,this)),this.btnColor.menu.items[1].on("toggle",_.bind(this.onAutoColor,this)),this.colors=this.btnColor.getPicker(),this.btnEdit=new Common.UI.Button({el:e.find("#id-dlg-bullet-font")}),this.btnEdit.on("click",_.bind(this.onEditBullet,this));var i=["<% _.each(items, function(item) { %>",'
  • ','<%= item.displayValue %><% if (item.value === Asc.c_oAscNumberingFormat.Bullet) { %><%=item.symbol%><% } %>',"
  • ","<% }); %>"],n=['
    ','
    ','
    ','','","
    "]);this.cmbFormat=new Common.UI.ComboBoxCustom({el:e.find("#id-dlg-numbering-format"),menuStyle:"min-width: 100%;max-height: 183px;",style:2==this.type?"width: 107px;":"width: 129px;",editable:!1,template:_.template(n.join("")),itemsTemplate:_.template(i.join("")),takeFocusOnClose:!0,data:[{displayValue:this.txtNone,value:Asc.c_oAscNumberingFormat.None},{displayValue:"1, 2, 3,...",value:Asc.c_oAscNumberingFormat.Decimal},{displayValue:"a, b, c,...",value:Asc.c_oAscNumberingFormat.LowerLetter},{displayValue:"A, B, C,...",value:Asc.c_oAscNumberingFormat.UpperLetter},{displayValue:"i, ii, iii,...",value:Asc.c_oAscNumberingFormat.LowerRoman},{displayValue:"I, II, III,...",value:Asc.c_oAscNumberingFormat.UpperRoman}],updateFormControl:function(t){var e=$(this.el).find(".form-control");t?t.get("value")==Asc.c_oAscNumberingFormat.Bullet?e[0].innerHTML=t.get("displayValue")+''+t.get("symbol")+"":e[0].innerHTML=t.get("displayValue"):e[0].innerHTML=""}}),this.cmbFormat.on("selected",_.bind(function(e,i){if(this._changedProps)if(-1==i.value){var n=function(i){var n=t._changedProps.get_Format();if(n==Asc.c_oAscNumberingFormat.Bullet){var o=e.store ;o.findWhere({value:Asc.c_oAscNumberingFormat.Bullet,symbol:t.bulletProps.symbol,font:t.bulletProps.font})||o.add({displayValue:t.txtSymbol+": ",value:Asc.c_oAscNumberingFormat.Bullet,symbol:t.bulletProps.symbol,font:t.bulletProps.font},{at:o.length-1}),e.setData(o.models),e.selectRecord(e.store.findWhere({value:Asc.c_oAscNumberingFormat.Bullet,symbol:t.bulletProps.symbol,font:t.bulletProps.font}))}else e.setValue(n||"")};this.addNewBullet(n)}else{var o=this._changedProps.get_Format();this._changedProps.put_Format(i.value),i.value==Asc.c_oAscNumberingFormat.Bullet?(this.bulletProps.font=i.font,this.bulletProps.symbol=i.symbol,this._changedProps.get_TextPr()||this._changedProps.put_TextPr(new AscCommonWord.CTextPr),this._changedProps.get_TextPr().put_FontFamily(this.bulletProps.font),this._changedProps.put_Text([new Asc.CAscNumberingLvlText]),this._changedProps.get_Text()[0].put_Value(this.bulletProps.symbol)):i.value!=Asc.c_oAscNumberingFormat.None&&o!=Asc.c_oAscNumberingFormat.Bullet||(this._changedProps.get_TextPr()||this._changedProps.put_TextPr(new AscCommonWord.CTextPr),this._changedProps.get_TextPr().put_FontFamily(void 0),this._changedProps.put_Text([new Asc.CAscNumberingLvlText]),this._changedProps.get_Text()[0].put_Type(Asc.c_oAscNumberingLvlTextType.Num),this._changedProps.get_Text()[0].put_Value(this.level))}this.api&&this.api.SetDrawImagePreviewBullet("bulleted-list-preview",this.props,this.level,2==this.type)},this)),this.cmbAlign=new Common.UI.ComboBox({el:e.find("#id-dlg-bullet-align"),menuStyle:"min-width: 100%;",editable:!1,cls:"input-group-nr",data:[{value:AscCommon.align_Left,displayValue:this.textLeft},{value:AscCommon.align_Center,displayValue:this.textCenter},{value:AscCommon.align_Right,displayValue:this.textRight}],takeFocusOnClose:!0}),this.cmbAlign.on("selected",_.bind(function(t,e){this._changedProps&&this._changedProps.put_Align(e.value),this.api&&this.api.SetDrawImagePreviewBullet("bulleted-list-preview",this.props,this.level,2==this.type)},this)),this.cmbSize=new Common.UI.ComboBox({el:e.find("#id-dlg-bullet-size"),menuStyle:"min-width: 100%;max-height: 183px;",editable:!1,cls:"input-group-nr",data:[{value:-1,displayValue:this.txtLikeText},{value:8,displayValue:"8"},{value:9,displayValue:"9"},{value:10,displayValue:"10"},{value:11,displayValue:"11"},{value:12,displayValue:"12"},{value:14,displayValue:"14"},{value:16,displayValue:"16"},{value:18,displayValue:"18"},{value:20,displayValue:"20"},{value:22,displayValue:"22"},{value:24,displayValue:"24"},{value:26,displayValue:"26"},{value:28,displayValue:"28"},{value:36,displayValue:"36"},{value:48,displayValue:"48"},{value:72,displayValue:"72"},{value:96,displayValue:"96"}],takeFocusOnClose:!0}),this.cmbSize.on("selected",_.bind(function(t,e){this._changedProps&&(this._changedProps.get_TextPr()||this._changedProps.put_TextPr(new AscCommonWord.CTextPr),this._changedProps.get_TextPr().put_FontSize(e.value>0?e.value:void 0)),this.api&&this.api.SetDrawImagePreviewBullet("bulleted-list-preview",this.props,this.level,2==this.type)},this));for(var o=[],s=0;s<9;s++)o.push({value:s});this.levelsList=new Common.UI.ListView({el:$("#levels-list",this.$window),store:new Common.UI.DataViewStore(o),tabindex:1,itemTemplate:_.template('
    <%= (value+1) %>
    ')}),this.levelsList.on("item:select",_.bind(this.onSelectLevel,this)),this.afterRender()},getFocusedComponents:function(){return[this.cmbFormat,this.cmbAlign,this.cmbSize,{cmp:this.levelsList,selector:".listview"}]},getDefaultFocusableComponent:function(){return this.type>0?this.cmbFormat:this.cmbAlign},afterRender:function(){this.updateThemeColors(),this._setDefaults(this.props);var t=this,e=function(e){t.levelsList.selectByIndex(e)};this.api.asc_registerCallback("asc_onPreviewLevelChange",e),this.on("close",function(i){t.api.asc_unregisterCallback("asc_onPreviewLevelChange",e)})},updateThemeColors:function(){this.colors.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors())},onAutoColor:function(t,e){if(e){var i=Common.Utils.ThemeColor.getHexColor(0,0,0);if(this.btnColor.setColor(i),this.colors.clearSelection(),this._changedProps){this._changedProps.get_TextPr()||this._changedProps.put_TextPr(new AscCommonWord.CTextPr);var i=new Asc.asc_CColor;i.put_auto(!0),this._changedProps.get_TextPr().put_Color(i)}this.api&&this.api.SetDrawImagePreviewBullet("bulleted-list-preview",this.props,this.level,2==this.type)}},onLikeTextColor:function(t,e){if(e){var i=Common.Utils.ThemeColor.getHexColor(255,255,255);this.btnColor.setColor(i),this.colors.clearSelection(),this._changedProps&&(this._changedProps.get_TextPr()||this._changedProps.put_TextPr(new AscCommonWord.CTextPr),this._changedProps.get_TextPr().put_Color(void 0)),this.api&&this.api.SetDrawImagePreviewBullet("bulleted-list-preview",this.props,this.level,2==this.type)}},onColorsSelect:function(t,e){this._changedProps&&(this._changedProps.get_TextPr()||this._changedProps.put_TextPr(new AscCommonWord.CTextPr),this._changedProps.get_TextPr().put_Color(Common.Utils.ThemeColor.getRgbColor(e))),this.btnColor.menu.items[0].setChecked(!1,!0),this.btnColor.menu.items[1].setChecked(!1,!0),this.api&&this.api.SetDrawImagePreviewBullet("bulleted-list-preview",this.props,this.level,2==this.type)},onEditBullet:function(t){this.addNewBullet()},addNewBullet:function(t){var e=this,i=e.bulletProps,n=function(n,o,s){"ok"==o&&(i.changed=!0,i.code=s.code,i.font=s.font,i.symbol=s.symbol,e._changedProps&&(e._changedProps.put_Format(Asc.c_oAscNumberingFormat.Bullet),e._changedProps.get_TextPr()||e._changedProps.put_TextPr(new AscCommonWord.CTextPr),e._changedProps.get_TextPr().put_FontFamily(i.font),e._changedProps.put_Text([new Asc.CAscNumberingLvlText]),e._changedProps.get_Text()[0].put_Value(i.symbol),e.api&&e.api.SetDrawImagePreviewBullet("bulleted-list-preview",e.props,e.level,2==e.type))),t&&t.call(e,o)},o=new Common.Views.SymbolTableDialog({api:e.options.api,lang:e.options.interfaceLang,modal:!0,type:0,font:i.font,symbol:i.symbol,handler:n});o.show(),o.on("symbol:dblclick",n)},_handleInput:function(t){if(this.options.handler){for(var e=[],i=[],n=0;n<9;n++)this.levels[n]&&(e.push(this.levels[n]),i.push(n));this.options.handler.call(this,t,{props:1==e.length?e[0]:e,num:1==i.length?i[0]:i})}this.close()},onBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value)},onPrimary:function(t){return this._handleInput("ok"),!1},_setDefaults:function(t){if(this.bulletProps={},t){var e=t.get_Lvl(this.level);if(this.level<0&&(this.level=0),this.levels[this.level]=e||new Asc.CAscNumberingLvl(this.level),2==this.type){var i=this.cmbFormat.store;i.push([{displayValue:this.txtSymbol+": ",value:Asc.c_oAscNumberingFormat.Bullet,symbol:"·",font:"Symbol"},{displayValue:this.txtSymbol+": ",value:Asc.c_oAscNumberingFormat.Bullet,symbol:"o",font:"Courier New"},{displayValue:this.txtSymbol+": ",value:Asc.c_oAscNumberingFormat.Bullet,symbol:"§",font:"Wingdings"},{displayValue:this.txtSymbol+": ",value:Asc.c_oAscNumberingFormat.Bullet,symbol:"v",font:"Wingdings"},{displayValue:this.txtSymbol+": ",value:Asc.c_oAscNumberingFormat.Bullet,symbol:"Ø",font:"Wingdings"},{displayValue:this.txtSymbol+": ",value:Asc.c_oAscNumberingFormat.Bullet,symbol:"ü",font:"Wingdings"},{displayValue:this.txtSymbol+": ",value:Asc.c_oAscNumberingFormat.Bullet,symbol:"¨",font:"Symbol"},{displayValue:this.txtSymbol+": ",value:Asc.c_oAscNumberingFormat.Bullet,symbol:"–",font:"Arial"},{displayValue:this.txtNewBullet,value:-1}]),this.cmbFormat.setData(i.models),this.levelsList.selectByIndex(this.level)}else this.fillLevelProps(this.levels[this.level])}this._changedProps=this.levels[this.level]},onSelectLevel:function(t,e,i){this.level=i.get("value"),void 0===this.levels[this.level]&&(this.levels[this.level]=this.props.get_Lvl(this.level)),this.fillLevelProps(this.levels[this.level]),this._changedProps=this.levels[this.level]},fillLevelProps:function(t){if(t){this.cmbAlign.setValue(void 0!==t.get_Align()?t.get_Align():"");var e=t.get_Format(),i=t.get_TextPr(),n=t.get_Text();if(n&&e==Asc.c_oAscNumberingFormat.Bullet&&(this.bulletProps.symbol=n[0].get_Value()),i){this.cmbSize.setValue(i.get_FontSize()||-1),this.bulletProps.font=i.get_FontFamily();var o=i.get_Color();if(this.btnColor.menu.items[0].setChecked(void 0===o,!0),this.btnColor.menu.items[1].setChecked(!!o&&o.get_auto(),!0),o&&!o.get_auto())if("object"==typeof o){for(var s=!1,a=0;a<10;a++)if(Common.Utils.ThemeColor.ThemeValues[a]==o.effectValue){this.colors.select(o,!0),s=!0;break}s||this.colors.clearSelection(),o=Common.Utils.ThemeColor.getHexColor(o.get_r(),o.get_g(),o.get_b())}else this.colors.select(o,!0);else this.colors.clearSelection(),o=o&&o.get_auto()?"000000":"ffffff";this.btnColor.setColor(o)}this.type>0&&(e==Asc.c_oAscNumberingFormat.Bullet?(this.cmbFormat.store.findWhere({value:Asc.c_oAscNumberingFormat.Bullet,symbol:this.bulletProps.symbol,font:this.bulletProps.font})||this.cmbFormat.store.add({displayValue:this.txtSymbol+": ",value:Asc.c_oAscNumberingFormat.Bullet,symbol:this.bulletProps.symbol,font:this.bulletProps.font},{at:this.cmbFormat.store.length-1}),this.cmbFormat.setData(this.cmbFormat.store.models),this.cmbFormat.selectRecord(this.cmbFormat.store.findWhere({value:Asc.c_oAscNumberingFormat.Bullet,symbol:this.bulletProps.symbol,font:this.bulletProps.font}))):this.cmbFormat.setValue(void 0!==e?e:"")),this.api&&this.api.SetDrawImagePreviewBullet("bulleted-list-preview",this.props,this.level,2==this.type)}},txtTitle:"List Settings",txtSize:"Size",txtColor:"Color",txtBullet:"Bullet",txtFont:"Font and Symbol",txtAlign:"Alignment",textLeft:"Left",textCenter:"Center",textRight:"Right",textAuto:"Automatic",textPreview:"Preview",txtType:"Type",txtLikeText:"Like a text",textLevel:"Level",txtNone:"None",txtNewBullet:"New bullet",txtSymbol:"Symbol"},DE.Views.ListSettingsDialog||{}))}),define("documenteditor/main/app/view/DateTimeDialog",["common/main/lib/component/Window","common/main/lib/component/ComboBox","common/main/lib/component/ListView"],function(){"use strict";DE.Views.DateTimeDialog=Common.UI.Window.extend(_.extend({options:{width:350,style:"min-width: 230px;",cls:"modal-dlg",buttons:["ok","cancel"]},initialize:function(t){_.extend(this.options,{title:this.txtTitle},t||{}),this.template=['
    ','
    ','","
    ",'
    ','
    ','","
    ",'
    ','
    ','
    ','","
    ","
    "].join(""),this.options.tpl=_.template(this.template)(this.options),this.api=this.options.api,this.lang=this.options.lang,this.handler=this.options.handler,Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this);var t=[{value:1068},{value:1026},{value:1029},{value:1031},{value:2055},{value:1032},{value:3081},{value:2057},{value:1033},{value:3082},{value:2058},{value:1035},{value:1036},{value:1040},{value:1041},{value:1042},{value:1062},{value:1043},{value:1045},{value:1046},{value:2070},{value:1049},{value:1051},{value:1060},{value:2077},{value:1053},{value:1055},{value:1058},{value:1066},{value:2052}];t.forEach(function(t){var e=Common.util.LanguageInfo.getLocalLanguageName(t.value);t.displayValue=e[1],t.langName=e[0]}),this.cmbLang=new Common.UI.ComboBox({el:$("#datetime-dlg-lang"),menuStyle:"min-width: 100%; max-height: 185px;",cls:"input-group-nr",editable:!1,takeFocusOnClose:!0,data:t,search:!0,scrollAlwaysVisible:!0}),this.cmbLang.setValue(1033),this.cmbLang.on("selected",_.bind(function(t,e){this.updateFormats(e.value)},this)),this.chUpdate=new Common.UI.CheckBox({el:$("#datetime-dlg-update"),labelText:this.textUpdate}),this.chUpdate.on("change",_.bind(function(t,e,i,n){this.onSelectFormat(this.listFormats,null,this.listFormats.getSelectedRec())},this)),this.listFormats=new Common.UI.ListView({el:$("#datetime-dlg-format"),store:new Common.UI.DataViewStore,tabindex:1,scrollAlwaysVisible:!0}),this.listFormats.on("item:select",_.bind(this.onSelectFormat,this)),this.listFormats.on("item:dblclick",_.bind(this.onDblClickFormat,this)),this.listFormats.on("entervalue",_.bind(this.onPrimary,this)),this.btnDefault=new Common.UI.Button({el:$("#datetime-dlg-default")}),this.btnDefault.on("click",_.bind(function(t,e){var i=this.listFormats.getSelectedRec();Common.UI.warning({msg:Common.Utils.String.format(this.confirmDefault,Common.util.LanguageInfo.getLocalLanguageName(this.cmbLang.getValue())[1],i?i.get("value"):""),buttons:["yes","no"],primary:"yes",callback:_.bind(function(t){if("yes"==t){this.defaultFormats[this.cmbLang.getValue()]=i?i.get("format"):"";var e=[];for(var n in this.defaultFormats)n&&e.push({lang:n,format:this.defaultFormats[n]});var o=JSON.stringify(e);Common.localStorage.setItem("de-settings-datetime-default",o),Common.Utils.InternalSettings.set("de-settings-datetime-default",o)}},this)})},this)),this.$window.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this)),this.afterRender()},afterRender:function(){var t=this,e=Common.Utils.InternalSettings.get("de-settings-datetime-default"),i=e?JSON.parse(e):[];this.defaultFormats=[],i.forEach(function(e){e.lang&&(t.defaultFormats[parseInt(e.lang)]=e.format)}),this._setDefaults()},getFocusedComponents:function(){return[this.cmbLang,{cmp:this.listFormats,selector:".listview"}]},getDefaultFocusableComponent:function(){return this.cmbLang},_setDefaults:function(){if(this.props=new Asc.CAscDateTime,this.lang){var t=this.cmbLang.store.findWhere({value:this.lang});t=t?t.get("value"):1033,this.cmbLang.setValue(t)}this.updateFormats(this.cmbLang.getValue())},getSettings:function(){return this.props},updateFormats:function(t){this.props.put_Lang(t);for(var e=this.props.get_FormatsExamples(),i=[],n=this.listFormats.store,o=0,s=e.length;o','
    ','
    ','
    ','
    ','
    ',"
    ",'
    ",'
    ','
    ','
    ','
    ',"
    ',"
    ",""].join(""),this.options.tpl=_.template(this.template)(this.options),this.spinners=[],this._noApply=!1,Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this),this.chAddLineNumbering=new Common.UI.CheckBox({el:$("#line-numbers-add-line-numbering"),labelText:this.textAddLineNumbering}).on("change",_.bind(function(t,e,i,n){var o="checked"!==t.getValue();this.spnStartAt.setDisabled(o),this.spnFromText.setDisabled(o),this.spnCountBy.setDisabled(o),this.rbRestartEachPage.setDisabled(o),this.rbRestartEachSection.setDisabled(o),this.rbContinuous.setDisabled(o)},this)),this.spnStartAt=new Common.UI.MetricSpinner({el:$("#line-numbers-start-at"),step:1,width:80,defaultUnit:"",value:1,maxValue:32767,minValue:1,disabled:!0}),this.spnFromText=new Common.UI.MetricSpinner({el:$("#line-numbers-from-text"),step:.1,width:80,defaultUnit:"cm",value:"Auto",autoText:this.txtAutoText,maxValue:55.87,minValue:.1,allowAuto:!0,disabled:!0}),this.spinners.push(this.spnFromText),this.spnCountBy=new Common.UI.MetricSpinner({el:$("#line-numbers-count-by"),step:1,width:80,defaultUnit:"",value:1,maxValue:100,minValue:1,disabled:!0}),this.rbRestartEachPage=new Common.UI.RadioBox({el:$("#line-numbers-restart-each-page"),labelText:this.textRestartEachPage,name:"asc-radio-line-numbers",disabled:!0,checked:!0}),this.rbRestartEachSection=new Common.UI.RadioBox({el:$("#line-numbers-restart-each-section"),labelText:this.textRestartEachSection,name:"asc-radio-line-numbers",disabled:!0}),this.rbContinuous=new Common.UI.RadioBox({el:$("#line-numbers-continuous"),labelText:this.textContinuous,name:"asc-radio-line-numbers",disabled:!0}),this.cmbApply=new Common.UI.ComboBox({el:$("#line-numbers-combo-apply"),cls:"input-group-nr",menuStyle:"min-width: 150px;",editable:!1,data:[{displayValue:this.textSection,value:Asc.c_oAscSectionApplyType.Current},{displayValue:this.textForward,value:Asc.c_oAscSectionApplyType.ToEnd},{displayValue:this.textDocument,value:Asc.c_oAscSectionApplyType.All}]}),this.cmbApply.setValue(this.options.applyTo),this.getChild().find(".dlg-btn").on("click",_.bind(this.onBtnClick,this)),this.updateMetricUnit()},afterRender:function(){},setSettings:function(t){if(t){var e=t.get_Restart();switch(this.chAddLineNumbering.setValue(!0),e){case Asc.c_oAscLineNumberRestartType.Continuous:this.rbContinuous.setValue(!0,!0);break;case Asc.c_oAscLineNumberRestartType.NewPage:this.rbRestartEachPage.setValue(!0,!0);break;case Asc.c_oAscLineNumberRestartType.NewSection:this.rbRestartEachSection.setValue(!0,!0)}this.spnStartAt.setValue(null!==t.get_Start()&&void 0!==t.get_Start()?t.get_Start():"",!0),this.spnFromText.setValue(null!==t.get_Distance()&&void 0!==t.get_Distance()?Common.Utils.Metric.fnRecalcFromMM(25.4*t.get_Distance()/20/72):-1,!0),this.spnCountBy.setValue(null!==t.get_CountBy()&&void 0!==t.get_CountBy()?t.get_CountBy():"",!0)}else this.chAddLineNumbering.setValue(!1)},_handleInput:function(t){this.options.handler&&this.options.handler.call(this,this,t),this.close()},onBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value)},onPrimary:function(){return this._handleInput("ok"),!1},getSettings:function(){var t;if("checked"===this.chAddLineNumbering.getValue()){t=new Asc.CSectionLnNumType,this.rbContinuous.getValue()?t.put_Restart(Asc.c_oAscLineNumberRestartType.Continuous):this.rbRestartEachPage.getValue()?t.put_Restart(Asc.c_oAscLineNumberRestartType.NewPage):this.rbRestartEachSection.getValue()&&t.put_Restart(Asc.c_oAscLineNumberRestartType.NewSection),t.put_Start(""!==this.spnStartAt.getValue()?this.spnStartAt.getNumberValue():void 0);var e=this.spnFromText.getNumberValue();t.put_Distance(e<0?null:parseInt(72*Common.Utils.Metric.fnRecalcToMM(e)*20/25.4)),t.put_CountBy(""!==this.spnCountBy.getValue()?this.spnCountBy.getNumberValue():void 0)}return{props:t,type:this.cmbApply.getValue()}},updateMetricUnit:function(){if(this.spinners)for(var t=0;t0?this.toolbar.mnuMarkersPicker.selectByIndex(this._state.bullets.subtype,!0):this.toolbar.mnuMarkersPicker.deselectAll(!0),this.toolbar.mnuMultilevelPicker.deselectAll(!0),this.toolbar.mnuMarkerSettings&&this.toolbar.mnuMarkerSettings.setDisabled(this._state.bullets.subtype<0),this.toolbar.mnuMultilevelSettings&&this.toolbar.mnuMultilevelSettings.setDisabled(this._state.bullets.subtype<0);break;case 1:var i;switch(this._state.bullets.subtype){case 1:i=4;break;case 2:i=5;break;case 3:i=6;break;case 4:i=1;break;case 5:i=2;break;case 6:i=3;break;case 7:i=7}this.toolbar.btnNumbers.toggle(!0,!0),void 0!==i?this.toolbar.mnuNumbersPicker.selectByIndex(i,!0):this.toolbar.mnuNumbersPicker.deselectAll(!0),this.toolbar.mnuMultilevelPicker.deselectAll(!0),this.toolbar.mnuNumberSettings&&this.toolbar.mnuNumberSettings.setDisabled(0==i),this.toolbar.mnuMultilevelSettings&&this.toolbar.mnuMultilevelSettings.setDisabled(0==i);break;case 2:this.toolbar.btnMultilevels.toggle(!0,!0),this.toolbar.mnuMultilevelPicker.selectByIndex(this._state.bullets.subtype,!0)}},onApiParagraphAlign:function(t){if(this._state.pralign!==t){this._state.pralign=t;var e=this.toolbar;switch(t){case 0:2,"btn-align-right";break;case 1:0,"btn-align-left";break;case 2:1,"btn-align-center";break;case 3:3,"btn-align-just";break;default:-255,"btn-align-left"}if(null===t||void 0===t)return e.btnAlignRight.toggle(!1,!0),e.btnAlignLeft.toggle(!1,!0),e.btnAlignCenter.toggle(!1,!0),void e.btnAlignJust.toggle(!1,!0);e.btnAlignRight.toggle(0===t,!0),e.btnAlignLeft.toggle(1===t,!0),e.btnAlignCenter.toggle(2===t,!0),e.btnAlignJust.toggle(3===t,!0)}},onApiLineSpacing:function(t){var e=null===t.get_Line()||null===t.get_LineRule()||1!=t.get_LineRule()?-1:t.get_Line();if(this._state.linespace!==e){if(this._state.linespace=e,_.each(this.toolbar.mnuLineSpace.items,function(t){t.setChecked(!1,!0)}),e<0)return;Math.abs(e-1)<1e-4?this.toolbar.mnuLineSpace.items[0].setChecked(!0,!0):Math.abs(e-1.15)<1e-4?this.toolbar.mnuLineSpace.items[1].setChecked(!0,!0):Math.abs(e-1.5)<1e-4?this.toolbar.mnuLineSpace.items[2].setChecked(!0,!0):Math.abs(e-2)<1e-4?this.toolbar.mnuLineSpace.items[3].setChecked(!0,!0):Math.abs(e-2.5)<1e-4?this.toolbar.mnuLineSpace.items[4].setChecked(!0,!0):Math.abs(e-3)<1e-4&&this.toolbar.mnuLineSpace.items[5].setChecked(!0,!0)}},onApiPageSize:function(t,e){if(void 0!==this._state.pgorient){var i=this._state.pgorient?t:e,n=this._state.pgorient?e:t;(Math.abs(this._state.pgsize[0]-t)>.1||Math.abs(this._state.pgsize[1]-e)>.1)&&(this._state.pgsize=[t,e],this.toolbar.mnuPageSize&&(this.toolbar.mnuPageSize.clearAll(),_.each(this.toolbar.mnuPageSize.items,function(t){if(t.value&&"object"==typeof t.value&&Math.abs(t.value[0]-i)<.1&&Math.abs(t.value[1]-n)<.1)return t.setChecked(!0),!1},this)))}},onSectionProps:function(t){if(t){var e=t.get_LeftMargin(),i=t.get_TopMargin(),n=t.get_RightMargin(),o=t.get_BottomMargin();(!this._state.pgmargins||Math.abs(this._state.pgmargins[0]-i)>.1||Math.abs(this._state.pgmargins[1]-e)>.1||Math.abs(this._state.pgmargins[2]-o)>.1||Math.abs(this._state.pgmargins[3]-n)>.1)&&(this._state.pgmargins=[i,e,o,n],this.toolbar.btnPageMargins.menu&&(this.toolbar.btnPageMargins.menu.clearAll(),_.each(this.toolbar.btnPageMargins.menu.items,function(t){if(t.value&&"object"==typeof t.value&&Math.abs(t.value[0]-i)<.1&&Math.abs(t.value[1]-e)<.1&&Math.abs(t.value[2]-o)<.1&&Math.abs(t.value[3]-n)<.1)return t.setChecked(!0),!1},this)))}},onShowParaMarks:function(t){this.toolbar.mnuNonPrinting.items[0].setChecked(t,!0),this.toolbar.btnShowHidenChars.toggle(t,!0),Common.localStorage.setItem("de-show-hiddenchars",t)},onApiFocusObjectRestrictedEdit:function(t){if(this.editMode){for(var e,i=-1,n=!1,o=!1,s=!1,a=!1,r=void 0;++i0&&this.btnsComment.setDisabled(p)}},onApiFocusObject:function(t){if(this.editMode){for(var e,i,n,o=-1,s=!1,a=!1,r=!1,l=!1,c=!1,d=void 0,h=!0,p=void 0,m=this.toolbar,u=!1,g=!1,b=!1,f=!1,C=!1,v=!1,y=!1;++o0&&this.btnsComment.setDisabled(k),m.btnWatermark.setDisabled(a),p&&(this._state.suppress_num=!!p.get_SuppressLineNumbers()),this._state.in_equation=b}},onApiStyleChange:function(t){this.toolbar.btnCopyStyle.toggle(t,!0),this.modeAlwaysSetStyle=!1},onTableDraw:function(t){this.toolbar.mnuInsertTable&&this.toolbar.mnuInsertTable.items[2].setChecked(!!t,!0)},onTableErase:function(t){this.toolbar.mnuInsertTable&&this.toolbar.mnuInsertTable.items[3].setChecked(!!t,!0)},onApiParagraphStyleChange:function(t){if(this._state.prstyle!=t){var e=this.toolbar.listStyles;if(e.rendered){e.suspendEvents();var i=e.menuPicker.store.findWhere({title:t});this._state.prstyle=e.menuPicker.store.length>0||window.styles_loaded?t:void 0,e.menuPicker.selectRecord(i),e.resumeEvents()}}},onApiPageOrient:function(t){this._state.pgorient!==t&&(this.toolbar.btnPageOrient.menu.items[t?0:1].setChecked(!0),this._state.pgorient=t)},onApiLockDocumentProps:function(){!0!==this._state.lock_doc&&(this.toolbar.btnPageOrient.setDisabled(!0),this.toolbar.btnPageSize.setDisabled(!0),this.toolbar.btnPageMargins.setDisabled(!0),this._state.activated&&(this._state.lock_doc=!0))},onApiUnLockDocumentProps:function(){!1!==this._state.lock_doc&&(this.toolbar.btnPageOrient.setDisabled(!1),this.toolbar.btnPageSize.setDisabled(!1),this.toolbar.btnPageMargins.setDisabled(!1),this._state.activated&&(this._state.lock_doc=!1))},onApiLockDocumentSchema:function(){this.toolbar.btnColorSchemas.setDisabled(!0)},onApiUnLockDocumentSchema:function(){this.toolbar.btnColorSchemas.setDisabled(!1)},onApiLockHeaderFooters:function(){this.toolbar.mnuPageNumberPosPicker.setDisabled(!0),this.toolbar.mnuInsertPageNum.setDisabled(this.toolbar.mnuPageNumCurrentPos.isDisabled())},onApiUnLockHeaderFooters:function(){this.toolbar.mnuPageNumberPosPicker.setDisabled(!1),this.toolbar.mnuInsertPageNum.setDisabled(!1)},onApiZoomChange:function(t,e){},onApiStartHighlight:function(t){this.toolbar.btnHighlightColor.toggle(t,!0)},onApiHighlightColor:function(t){var e=this.api.get_TextProps().get_TextPr();e&&(t=e.get_HighLight(),-1==t?-1!=this._state.clrhighlight&&(this.toolbar.mnuHighlightTransparent.setChecked(!0,!0),this.toolbar.mnuHighlightColorPicker.cmpEl&&(this._state.clrhighlight=-1,this.toolbar.mnuHighlightColorPicker.select(null,!0))):null!==t?this._state.clrhighlight!=t.get_hex().toUpperCase()&&(this.toolbar.mnuHighlightTransparent.setChecked(!1),this._state.clrhighlight=t.get_hex().toUpperCase(),_.contains(this.toolbar.mnuHighlightColorPicker.colors,this._state.clrhighlight)&&this.toolbar.mnuHighlightColorPicker.select(this._state.clrhighlight,!0)):this._state.clrhighlight!==t&&(this.toolbar.mnuHighlightTransparent.setChecked(!1,!0),this.toolbar.mnuHighlightColorPicker.select(null,!0),this._state.clrhighlight=t))},onApiInitEditorStyles:function(t){this._onInitEditorStyles(t)},onChangeSdtGlobalSettings:function(){var t=this.api.asc_GetGlobalContentControlShowHighlight();if(this.toolbar.mnuNoControlsColor&&this.toolbar.mnuNoControlsColor.setChecked(!t,!0),this.toolbar.mnuControlsColorPicker&&this.toolbar.mnuControlsColorPicker.clearSelection(),t){var e=this.api.asc_GetGlobalContentControlHighlightColor();e&&(e=Common.Utils.ThemeColor.getHexColor(e.get_r(),e.get_g(),e.get_b()),this.toolbar.mnuControlsColorPicker&&this.toolbar.mnuControlsColorPicker.selectByRGB(e,!0))}},onNewDocument:function(t,e){this.api&&this.api.OpenNewDocument(),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","New Document")},onOpenDocument:function(t,e){this.api&&this.api.LoadDocumentFromDisk(),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Open Document")},onPrint:function(t){this.api&&this.api.asc_Print(new Asc.asc_CDownloadOptions(null,Common.Utils.isChrome||Common.Utils.isSafari||Common.Utils.isOpera)),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("Print"),Common.component.Analytics.trackEvent("ToolBar","Print")},onSave:function(t){var e=this.toolbar;if(this.api){var i=this.api.asc_isDocumentCanSave(),n=e.btnCollabChanges&&e.btnCollabChanges.cmpEl.hasClass("notify");if(!i&&!n&&!e.mode.forcesave)return;this.api.asc_Save()}e.btnSave.setDisabled(!e.mode.forcesave),Common.NotificationCenter.trigger("edit:complete",e),Common.component.Analytics.trackEvent("Save"),Common.component.Analytics.trackEvent("ToolBar","Save")},onBtnChangeState:function(t){if(/\:disabled$/.test(t)){var e=arguments[2];this.toolbar.fireEvent(t,[e])}},onUndo:function(t,e){this.api&&this.api.Undo(),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Undo")},onRedo:function(t,e){this.api&&this.api.Redo(),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Redo")},onCopyPaste:function(t,e){var i=this;if(i.api){(t?i.api.Copy():i.api.Paste())?Common.component.Analytics.trackEvent("ToolBar","Copy Warning"):Common.localStorage.getBool("de-hide-copywarning")||new Common.Views.CopyWarningDialog({handler:function(t){t&&Common.localStorage.setItem("de-hide-copywarning",1),Common.NotificationCenter.trigger("edit:complete",i.toolbar)}}).show()}Common.NotificationCenter.trigger("edit:complete",i.toolbar)},onIncrease:function(t){this.api&&this.api.FontSizeIn(),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Font Size")},onDecrease:function(t){this.api&&this.api.FontSizeOut(),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Font Size")},onBold:function(t,e){this._state.bold=void 0,this.api&&this.api.put_TextPrBold(t.pressed),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Bold")},onItalic:function(t,e){this._state.italic=void 0,this.api&&this.api.put_TextPrItalic(t.pressed),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Italic")},onUnderline:function(t,e){this._state.underline=void 0,this.api&&this.api.put_TextPrUnderline(t.pressed),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Underline")},onStrikeout:function(t,e){this._state.strike=void 0,this.api&&this.api.put_TextPrStrikeout(t.pressed),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Strikeout")},onSuperscript:function(t,e){this.toolbar.btnSubscript.pressed||(this._state.valign=void 0,this.api&&this.api.put_TextPrBaseline(t.pressed?1:0),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Superscript"))},onSubscript:function(t,e){this.toolbar.btnSuperscript.pressed||(this._state.valign=void 0,this.api&&this.api.put_TextPrBaseline(t.pressed?2:0),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Subscript"))},onDecOffset:function(t,e){this.api&&this.api.DecreaseIndent(),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Indent")},onIncOffset:function(t,e){this.api&&this.api.IncreaseIndent(),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Indent")},onHorizontalAlign:function(t,e,i){this._state.pralign=void 0,this.api&&this.api.put_PrAlign(t),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Align")},onMarkers:function(t,e){var i={data:{type:0,subtype:t.pressed?0:-1}};this.onSelectBullets(null,null,null,i),Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onNumbers:function(t,e){var i={data:{type:1,subtype:t.pressed?0:-1}};this.onSelectBullets(null,null,null,i),Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onComboBlur:function(){Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onFontNameSelect:function(t,e){this.api&&(e.isNewFont?!Common.Utils.ModalWindow.isVisible()&&Common.UI.warning({width:500,closable:!1,msg:this.confirmAddFontName,buttons:["yes","no"],primary:"yes",callback:_.bind(function(t){"yes"==t?(this.api.put_TextPrFontName(e.name),Common.component.Analytics.trackEvent("ToolBar","Font Name")):this.toolbar.cmbFontName.setValue(this.api.get_TextProps().get_TextPr().get_FontFamily().get_Name()),Common.NotificationCenter.trigger("edit:complete",this.toolbar)},this)}):(this.api.put_TextPrFontName(e.name),Common.component.Analytics.trackEvent("ToolBar","Font Name"))),Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onComboOpen:function(t,e){_.delay(function(){var i=$("input",e.cmpEl).select();t?i.focus():e.isMenuOpen()||i.one("mouseup",function(t){t.preventDefault()})},10)},onFontSizeSelect:function(t,e){this._state.fontsize=void 0,this.api&&this.api.put_TextPrFontSize(e.value),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Font Size")},onFontSizeChanged:function(t,e,i,n){var o;if(t){if(!e.store.findWhere({displayValue:i.value})&&!(o=/^\+?(\d*(\.|,)?\d+)$|^\+?(\d+(\.|,)?\d*)$/.exec(i.value)))return o=this._getApiTextSize(),Common.UI.warning({msg:this.textFontSizeErr,callback:function(){_.defer(function(t){$("input",e.cmpEl).focus()})}}),e.setRawValue(o),n.preventDefault(),!1}else o=Common.Utils.String.parseFloat(i.value),o=o>300?300:o<1?1:Math.floor(2*(o+.4))/2,e.setRawValue(o),this._state.fontsize=void 0,this.api&&this.api.put_TextPrFontSize(o),Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onSelectBullets:function(t,e,i,n){var o={};if(_.isFunction(n.toJSON)){if(!n.get("selected"))return;o=n.toJSON()}else o=n;t&&t.toggle(o.data.subtype>-1,!0),this._state.bullets.type=void 0,this._state.bullets.subtype=void 0,this.api&&this.api.put_ListType(o.data.type,o.data.subtype),Common.component.Analytics.trackEvent("ToolBar","List Type"),Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onMarkerSettingsClick:function(t){var e=this,i=e.api.asc_GetCurrentNumberingId(),n=e.api.asc_GetCurrentNumberingLvl(),o=null!==i?e.api.asc_GetNumberingPr(i):null;o&&new DE.Views.ListSettingsDialog({api:e.api,props:o,level:n,type:t,interfaceLang:e.mode.lang,handler:function(t,n){"ok"==t&&e.api&&e.api.asc_ChangeNumberingLvl(i,n.props,n.num),Common.NotificationCenter.trigger("edit:complete",e.toolbar)}}).show()},onLineSpaceToggle:function(t,e,i,n){i&&(this._state.linespace=void 0,this.api&&this.api.put_PrLineSpacing(c_paragraphLinerule.LINERULE_AUTO,e.value),Common.component.Analytics.trackEvent("ToolBar","Line Spacing"),Common.NotificationCenter.trigger("edit:complete",this.toolbar))},onMenuNonPrintingToggle:function(t,e,i,n){var o=this;"characters"===e.value?(Common.localStorage.setItem("de-show-hiddenchars",i),o.toolbar.btnShowHidenChars.toggle(i,!0),o.api&&o.api.put_ShowParaMarks(i),Common.NotificationCenter.trigger("edit:complete",o),Common.component.Analytics.trackEvent("ToolBar","Hidden Characters")):"table"===e.value&&(Common.localStorage.setItem("de-show-tableline",i),o.api&&o.api.put_ShowTableEmptyLine(i),Common.NotificationCenter.trigger("edit:complete",o))},onNonPrintingToggle:function(t,e){var i=this;e?(i.toolbar.mnuNonPrinting.items[0].setChecked(!0,!0),Common.component.Analytics.trackEvent("ToolBar","Hidden Characters")):i.toolbar.mnuNonPrinting.items[0].setChecked(!1,!0),i.api&&i.api.put_ShowParaMarks(e),Common.localStorage.setItem("de-show-hiddenchars",e),Common.NotificationCenter.trigger("edit:complete",i)},onClickPageBreak:function(t,e){"column"===t?(this.api.put_AddColumnBreak(),Common.component.Analytics.trackEvent("ToolBar","Column Break")):"page"==t?(this.api.put_AddPageBreak(),Common.component.Analytics.trackEvent("ToolBar","Page Break")):(this.api.add_SectionBreak(t),Common.component.Analytics.trackEvent("ToolBar","Section Break")),Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onTablePickerSelect:function(t,e,i,n){this.api&&(this.toolbar.fireEvent("inserttable",this.toolbar),this.api.put_Table(e,i)),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Table")},onInsertTableClick:function(t,e,i){if("custom"===e.value){var n=this;new Common.Views.InsertTableDialog({handler:function(t,e){"ok"==t&&(n.api&&(n.toolbar.fireEvent("inserttable",n.toolbar),n.api.put_Table(e.columns,e.rows)),Common.component.Analytics.trackEvent("ToolBar","Table")),Common.NotificationCenter.trigger("edit:complete",n.toolbar)}}).show()}else"draw"==e.value?(e.isChecked()&&t.items[3].setChecked(!1,!0),this.api.SetTableDrawMode(e.isChecked())):"erase"==e.value&&(e.isChecked()&&t.items[2].setChecked(!1,!0),this.api.SetTableEraseMode(e.isChecked()))},onInsertImageClick:function(t,e,i){var n=this;"file"===e.value?(this.toolbar.fireEvent("insertimage",this.toolbar),this.api&&this.api.asc_addImage(),Common.NotificationCenter.trigger("edit:complete",n.toolbar),Common.component.Analytics.trackEvent("ToolBar","Image")):"url"===e.value?new Common.Views.ImageFromUrlDialog({handler:function(t,e){if("ok"==t){if(n.api){var i=e.replace(/ /g,"");_.isEmpty(i)?Common.UI.warning({msg:this.textEmptyImgUrl}):(n.toolbar.fireEvent("insertimage",n.toolbar),n.api.AddImageUrl(i),Common.component.Analytics.trackEvent("ToolBar","Image"))}Common.NotificationCenter.trigger("edit:complete",n.toolbar)}}}).show():"storage"===e.value&&Common.NotificationCenter.trigger("storage:image-load","add")},openImageFromStorage:function(t){var e=this;this.toolbar.mode.canRequestInsertImage?Common.Gateway.requestInsertImage(t):new Common.Views.SelectFileDlg({fileChoiceUrl:this.toolbar.mode.fileChoiceUrl.replace("{fileExt}","").replace("{documentType}","ImagesOnly")}).on("selectfile",function(i,n){n&&(n.c=t),e.insertImage(n)}).show()},insertImageFromStorage:function(t){!t||!t.url||t.c&&"add"!=t.c||(this.toolbar.fireEvent("insertimage",this.toolbar),this.api.AddImageUrl(t.url,void 0,t.token),Common.component.Analytics.trackEvent("ToolBar","Image"))},insertImage:function(t){Common.NotificationCenter.trigger("storage:image-insert",t)},onBtnInsertTextClick:function(t,e){this.api&&this._addAutoshape(t.pressed,"textRect"),this.toolbar.btnInsertShape.pressed&&this.toolbar.btnInsertShape.toggle(!1,!0),Common.NotificationCenter.trigger("edit:complete",this.toolbar,this.toolbar.btnInsertShape),Common.component.Analytics.trackEvent("ToolBar","Add Text")},onInsertShapeHide:function(t,e){this.toolbar.btnInsertShape.pressed&&!this._isAddingShape&&this.toolbar.btnInsertShape.toggle(!1,!0),this._isAddingShape=!1,Common.NotificationCenter.trigger("edit:complete",this.toolbar,this.toolbar.btnInsertShape)},onPageOrientSelect:function(t,e){this._state.pgorient=void 0,this.api&&e.checked&&this.api.change_PageOrient(e.value),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Page Orientation")},onClearStyleClick:function(t,e){this.api&&this.api.ClearFormating(),Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onCopyStyleToggle:function(t,e,i){this.api&&this.api.SetPaintFormat(e?1:0),Common.NotificationCenter.trigger("edit:complete",this.toolbar),this.modeAlwaysSetStyle=e},onPageSizeClick:function(t,e,i){if(this.api&&i){if(this._state.pgsize=[0,0],"advanced"!==e.value)this.api.change_DocSize(e.value[0],e.value[1]);else{var n,o,s=this;n=new DE.Views.PageSizeDialog({handler:function(t,e){"ok"==e&&(o=t.getSettings(),s.api.change_DocSize(o[0],o[1]),Common.NotificationCenter.trigger("edit:complete",s.toolbar))}}),n.show(),n.setSettings(s.api.asc_GetSectionProps())}Common.component.Analytics.trackEvent("ToolBar","Page Size")} diff --git a/www/common/onlyoffice/v4/web-apps/apps/presentationeditor/main/app.js b/www/common/onlyoffice/v4/web-apps/apps/presentationeditor/main/app.js index be4ccb024..f5baa2341 100644 --- a/www/common/onlyoffice/v4/web-apps/apps/presentationeditor/main/app.js +++ b/www/common/onlyoffice/v4/web-apps/apps/presentationeditor/main/app.js @@ -20,40 +20,40 @@ scrollXMarginOffset:0,scrollYMarginOffset:0,includePadding:!1,includeMargin:!0}, c.inputDisplay.focus()},50)}else{this.btnOk.setDisabled(""==$.trim(this.inputUrl.getValue()));var c=this;_.delay(function(){c.inputUrl.focus()},50)}},onLinkTypeClick:function(t,e,i){if(this.ShowHideElem(t),this.isAutoUpdate){if(t==c_oHyperlinkType.InternalLink){var n=this.internalList.getSelectedRec();this.inputDisplay.setValue(n&&(n.get("level")||n.get("index")<4)?n.get("name"):"")}else this.inputDisplay.setValue(this.inputUrl.getValue());this.isTextChanged=!0}},parseUrl:function(t){return null===t||void 0===t||""==t?Common.Utils.InternalSettings.get("pe-settings-link-type")?c_oHyperlinkType.InternalLink:c_oHyperlinkType.WebLink:0==t.indexOf("ppaction://hlink")?c_oHyperlinkType.InternalLink:(this.inputUrl.setValue(t?t.replace(new RegExp(" ","g"),"%20"):""),c_oHyperlinkType.WebLink)},onSelectItem:function(t,e,i,n){this.btnOk.setDisabled(4==i.get("index")),this.isAutoUpdate&&(this.inputDisplay.setValue(i.get("level")||i.get("index")<4?i.get("name"):""),this.isTextChanged=!0)},textTitle:"Hyperlink Settings",textInternalLink:"Place in Document",textExternalLink:"External Link",textEmptyLink:"Enter link here",textEmptyDesc:"Enter caption here",textEmptyTooltip:"Enter tooltip here",txtSlide:"Slide",strDisplay:"Display",textTipText:"Screen Tip Text",strLinkTo:"Link To",txtEmpty:"This field is required",txtNotUrl:'This field should be a URL in the format "http://www.example.com"',txtNext:"Next Slide",txtPrev:"Previous Slide",txtFirst:"First Slide",txtLast:"Last Slide",textDefault:"Selected text",textSlides:"Slides"},PE.Views.HyperlinkSettingsDialog||{}))}),define("text!presentationeditor/main/app/template/ParagraphSettingsAdvanced.template",[],function(){return'
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \x3c!--\r\n --\x3e
    \r\n \r\n
    \r\n
    \x3c!--\r\n --\x3e
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \x3c!--\r\n --\x3e
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \x3c!--\r\n --\x3e
    \r\n \r\n
    \r\n
    \x3c!--\r\n --\x3e
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \x3c!--\r\n --\x3e
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n\r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n \r\n \r\n
    \r\n
    \r\n
    '}),define("common/main/lib/view/AdvancedSettingsWindow",["common/main/lib/component/Window"],function(){"use strict";Common.Views.AdvancedSettingsWindow=Common.UI.Window.extend(_.extend({initialize:function(t){var e={};_.extend(e,{height:200,header:!0,cls:"advanced-settings-dlg",toggleGroup:"advanced-settings-group",contentTemplate:"",items:[],buttons:["ok","cancel"]},t),this.template=t.template||['
    ','",'
    ','
    '+e.contentTemplate+"
    ","
    ",'
    '].join(""),e.tpl=_.template(this.template)(e),this.handler=e.handler,this.toggleGroup=e.toggleGroup,this.contentWidth=e.contentWidth,this.storageName=e.storageName,Common.UI.Window.prototype.initialize.call(this,e)},render:function(){Common.UI.Window.prototype.render.call(this);var t=this,e=this.getChild();e.find(".dlg-btn").on("click",_.bind(this.onDlgBtnClick,this)),this.btnsCategory=[],_.each(e.find(".btn-category"),function(e,i){var n=$(e),o=new Common.UI.Button({el:n,enableToggle:!0,toggleGroup:t.toggleGroup,allowDepress:!1,contentTarget:n.attr("content-target")});o.on("click",_.bind(t.onCategoryClick,t,o,i)),t.btnsCategory.push(o)});var i=e.find(".content-panel"),n=e.find(".menu-panel");i.width(this.contentWidth),e.width((n.length>0?n.width():0)+i.outerWidth()+2),this.content_panels=e.find(".settings-panel"),this.btnsCategory.length>0&&this.btnsCategory[0].toggle(!0,!0)},setHeight:function(t){Common.UI.Window.prototype.setHeight.call(this,t),this.getChild().find(".body > .box").css("height",t-85)},onDlgBtnClick:function(t){var e=t.currentTarget.attributes.result.value;this.handler&&this.handler.call(this,e,"ok"==e?this.getSettings():void 0)||this.close()},onCategoryClick:function(t,e){this.content_panels.filter(".active").removeClass("active"),$("#"+t.options.contentTarget).addClass("active")},getSettings:function(){},onPrimary:function(){if(!this.handler||!this.handler.call(this,"ok",this.getSettings()))return this.close(),!1},setActiveCategory:function(t){if(!(this.btnsCategory.length<1)){t=t>=0&&t
    ',initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t);var e=this,i=e.$el||$(this.el);i.addClass("spinner"),i.on("mousedown",".spinner-up",_.bind(this.onMouseDown,this,!0)),i.on("mousedown",".spinner-down",_.bind(this.onMouseDown,this,!1)),i.on("mouseup",".spinner-up",_.bind(this.onMouseUp,this,!0)),i.on("mouseup",".spinner-down",_.bind(this.onMouseUp,this,!1)),i.on("mouseover",".spinner-up, .spinner-down",_.bind(this.onMouseOver,this)),i.on("mouseout",".spinner-up, .spinner-down",_.bind(this.onMouseOut,this)),i.on("keydown",".form-control",_.bind(this.onKeyDown,this)),i.on("keyup",".form-control",_.bind(this.onKeyUp,this)),i.on("blur",".form-control",_.bind(this.onBlur,this)),i.on("input",".form-control",_.bind(this.onInput,this)),this.options.allowDecimal||i.on("keypress",".form-control",_.bind(this.onKeyPress,this)),i.on("focus","input.form-control",function(){setTimeout(function(){e.$input&&e.$input.select()},1)}),Common.Utils.isGecko&&i.on("blur","input.form-control",function(){setTimeout(function(){e.$input&&(e.$input[0].selectionStart=e.$input[0].selectionEnd=0)},1)}),this.switches={count:1,enabled:!0,fromKeyDown:!1},"medium"===this.options.speed?this.switches.speed=300:"fast"===this.options.speed?this.switches.speed=100:this.switches.speed=500,this.render(),this.options.disabled&&this.setDisabled(this.options.disabled),void 0!==this.options.value&&(this.value=this.options.value),this.setRawValue(this.value),this.options.width&&i.width(this.options.width),void 0===this.options.defaultValue&&(this.options.defaultValue=this.options.minValue),this.oldValue=this.options.minValue,this.lastValue=null},render:function(){var t=this.$el||$(this.el);return t.html(this.template),this.$input=t.find(".form-control"),this.rendered=!0,void 0!=this.options.tabindex&&this.$input.attr("tabindex",this.options.tabindex),this},setDisabled:function(t){var e=this.$el||$(this.el);t!==this.disabled&&(e.find("button").toggleClass("disabled",t),e.toggleClass("disabled",t),t?this.$input.attr({disabled:t}):this.$input.removeAttr("disabled")),this.disabled=t},isDisabled:function(){return this.disabled},setDefaultUnit:function(t){if(this.options.defaultUnit!=t){var e=this.options.defaultUnit;this.options.defaultUnit=t,this.setMinValue(this._recalcUnits(this.options.minValue,e)),this.setMaxValue(this._recalcUnits(this.options.maxValue,e)),this.setValue(this._recalcUnits(this.getNumberValue(),e),!0)}},setMinValue:function(t){this.options.minValue=t},setMaxValue:function(t){this.options.maxValue=t},setStep:function(t){this.options.step=t},getNumberValue:function(){return this.checkAutoText(this.value)?-1:parseFloat(this.value)},getUnitValue:function(){return this.options.defaultUnit},getValue:function(){return this.value},setRawValue:function(t){this.$input&&this.$input.val(t)},getRawValue:function(){return this.$input.val()},setValue:function(t,e){var i=!1;if(this._fromKeyDown=!1,this.lastValue=this.value,void 0===t||""===t)this.value="";else if(this.options.allowAuto&&(Math.abs(Common.Utils.String.parseFloat(t)+1)<1e-4||this.checkAutoText(t)))this.value=this.options.autoText;else{var n=this._add(Common.Utils.String.parseFloat(t),0,this.options.allowDecimal?3:0);(void 0===t||isNaN(n))&&(n=this.oldValue,i=!0);var o=this.options.defaultUnit;if(void 0!==t.match){var s=t.match(/(px|em|%|en|ex|pt|"|cm|mm|pc|s|ms|см|мм|пт|сек|мс)$/i);null!==s&&"undefined"!==s[0]&&(o=s[0].toLowerCase())}this.options.defaultUnit===o||i||(n=this._recalcUnits(n,o)),n>this.options.maxValue&&(n=this.options.maxValue,i=!0),n<%= labelText %>'),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t);this.name=this.options.name||Common.UI.getId(),this.render(),this.options.disabled&&this.setDisabled(this.options.disabled),void 0!==this.options.checked&&this.setValue(this.options.checked,!0),this.$radio.on("click",e.bind(this.onItemCheck,this))},render:function(){var t=this.$el||$(this.el);return t.html(this.template({labelText:this.options.labelText,name:this.name,id:Common.UI.getId("rdb-")})),this.$radio=t.find("input[type=radio]"),this.$label=t.find("label.radiobox"),this.rendered=!0,this},setDisabled:function(t){this.rendered&&(t!==this.disabled&&(this.$label.toggleClass("disabled",t),this.$radio.toggleClass("disabled",t),t?this.$radio.attr({disabled:t}):this.$radio.removeAttr("disabled")),this.disabled=t)},isDisabled:function(){return this.disabled},onItemCheck:function(t){this.disabled||this.setValue(!0)},setRawValue:function(t){var t=!0===t||"true"===t||"1"===t||1===t;$("input[type=radio][name="+this.name+"]").removeClass("checked"),this.$radio.toggleClass("checked",t),this.$radio.prop("checked",t)},setValue:function(t,e){if(this.rendered){var i=this.$radio.hasClass("checked");this.setRawValue(t),!0!==e&&i!==t&&this.trigger("change",this,this.$radio.is(":checked"))}else this.options.checked=t},getValue:function(){return this.$radio.is(":checked")},setCaption:function(t){this.$label.find("span").text(t)}})}),void 0===Common)var Common={};if(define("common/main/lib/component/ListView",["common/main/lib/component/DataView"],function(){"use strict";Common.UI.ListView=Common.UI.DataView.extend(function(){return{options:{handleSelect:!0,enableKeyEvents:!0,showLast:!0,simpleAddMode:!1,keyMoveDirection:"vertical",itemTemplate:_.template('
    <%= value %>
    ')},template:_.template(['
    '].join("")),onResetItems:function(){this.innerEl=null,Common.UI.DataView.prototype.onResetItems.call(this),this.trigger("items:reset",this)},createNewItem:function(t){return new Common.UI.DataViewItem({template:this.itemTemplate,model:t})},onAddItem:function(t,e,i){var n=this.createNewItem(t);if(this.innerEl||(this.innerEl=$(this.el).find(".inner")),n&&this.innerEl){if(this.dataViewItems.length<1&&this.innerEl.find(".empty-text").remove(),this.options.simpleAddMode)this.innerEl.append(n.render().el),this.dataViewItems.push(n);else{var o=_.indexOf(this.store.models,t),s=this.innerEl.find("> div");o>0?$(s.get(o-1)).after(n.render().el):s.length>0?$(s[o]).before(n.render().el):this.innerEl.append(n.render().el),this.dataViewItems=this.dataViewItems.slice(0,o).concat(n).concat(this.dataViewItems.slice(o))}if(this.listenTo(n,"change",this.onChangeItem),this.listenTo(n,"remove",this.onRemoveItem),this.listenTo(n,"click",this.onClickItem),this.listenTo(n,"dblclick",this.onDblClickItem),this.listenTo(n,"select",this.onSelectItem),t.get("tip")){var a=$(n.el);a.attr("data-toggle","tooltip"),a.tooltip({title:t.get("tip"),placement:"cursor",zIndex:this.tipZIndex})}this.isSuspendEvents||this.trigger("item:add",this,n,t)}},focus:function(){this.cmpEl&&this.cmpEl.find(".listview").focus()}}}())}),define("presentationeditor/main/app/view/ParagraphSettingsAdvanced",["text!presentationeditor/main/app/template/ParagraphSettingsAdvanced.template","common/main/lib/view/AdvancedSettingsWindow","common/main/lib/component/MetricSpinner","common/main/lib/component/CheckBox","common/main/lib/component/RadioBox","common/main/lib/component/ListView"],function(t){"use strict";PE.Views.ParagraphSettingsAdvanced=Common.Views.AdvancedSettingsWindow.extend(_.extend({options:{contentWidth:370,height:394,toggleGroup:"paragraph-adv-settings-group",storageName:"pe-para-settings-adv-category"},initialize:function(e){var i=this;_.extend(this.options,{title:this.textTitle,items:[{panelId:"id-adv-paragraph-indents",panelCaption:this.strParagraphIndents},{panelId:"id-adv-paragraph-font",panelCaption:this.strParagraphFont},{panelId:"id-adv-paragraph-tabs",panelCaption:this.strTabs}],contentTemplate:_.template(t)({scope:this})},e),Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this,this.options),this._changedProps=null,this.checkGroup=0,this._noApply=!0,this._tabListChanged=!1,this.spinners=[],this.FirstLine=void 0,this.Spacing=null,this.api=this.options.api,this._originalProps=new Asc.asc_CParagraphProperty(this.options.paragraphProps),this._arrLineRule=[{displayValue:this.textAuto,defaultValue:1,value:c_paragraphLinerule.LINERULE_AUTO,minValue:.5,step:.01,defaultUnit:""},{displayValue:this.textExact,defaultValue:5,value:c_paragraphLinerule.LINERULE_EXACT,minValue:.03,step:.01,defaultUnit:"cm"}];var n=this._originalProps.get_Spacing().get_LineRule(),o=_.findWhere(this._arrLineRule,{value:n});this.CurLineRuleIdx=this._arrLineRule.indexOf(o),this._arrTextAlignment=[{displayValue:this.textTabLeft,value:c_paragraphTextAlignment.LEFT},{displayValue:this.textTabCenter,value:c_paragraphTextAlignment.CENTERED},{displayValue:this.textTabRight,value:c_paragraphTextAlignment.RIGHT},{displayValue:this.textJustified,value:c_paragraphTextAlignment.JUSTIFIED}],this._arrSpecial=[{displayValue:this.textNoneSpecial,value:c_paragraphSpecial.NONE_SPECIAL,defaultValue:0},{displayValue:this.textFirstLine,value:c_paragraphSpecial.FIRST_LINE,defaultValue:12.7},{displayValue:this.textHanging,value:c_paragraphSpecial.HANGING,defaultValue:12.7}],this._arrTabAlign=[{value:Asc.c_oAscTabType.Left,displayValue:this.textTabLeft},{value:Asc.c_oAscTabType.Center,displayValue:this.textTabCenter},{value:Asc.c_oAscTabType.Right,displayValue:this.textTabRight}],this._arrKeyTabAlign=[],this._arrTabAlign.forEach(function(t){i._arrKeyTabAlign[t.value]=t.displayValue})},render:function(){Common.Views.AdvancedSettingsWindow.prototype.render.call(this);var t=this;this.cmbTextAlignment=new Common.UI.ComboBox({el:$("#paragraphadv-spin-text-alignment"),cls:"input-group-nr",editable:!1,data:this._arrTextAlignment,style:"width: 173px;",menuStyle:"min-width: 173px;",takeFocusOnClose:!0}),this.cmbTextAlignment.setValue(""),this.numIndentsLeft=new Common.UI.MetricSpinner({el:$("#paragraphadv-spin-indent-left"),step:.1,width:85,defaultUnit:"cm",defaultValue:0,value:"0 cm",maxValue:55.87,minValue:0}),this.numIndentsLeft.on("change",_.bind(function(t,e,i,n){var o=t.getNumberValue();this._changedProps&&(null!==this._changedProps.get_Ind()&&void 0!==this._changedProps.get_Ind()||this._changedProps.put_Ind(new Asc.asc_CParagraphInd),this._changedProps.get_Ind().put_Left(Common.Utils.Metric.fnRecalcToMM(o)))},this)),this.spinners.push(this.numIndentsLeft),this.numIndentsRight=new Common.UI.MetricSpinner({el:$("#paragraphadv-spin-indent-right"),step:.1,width:85,defaultUnit:"cm",defaultValue:0,value:"0 cm",maxValue:55.87,minValue:0}),this.numIndentsRight.on("change",_.bind(function(t,e,i,n){this._changedProps&&(null!==this._changedProps.get_Ind()&&void 0!==this._changedProps.get_Ind()||this._changedProps.put_Ind(new Asc.asc_CParagraphInd),this._changedProps.get_Ind().put_Right(Common.Utils.Metric.fnRecalcToMM(t.getNumberValue())))},this)),this.spinners.push(this.numIndentsRight),this.cmbSpecial=new Common.UI.ComboBox({el:$("#paragraphadv-spin-special"),cls:"input-group-nr",editable:!1,data:this._arrSpecial,style:"width: 85px;",menuStyle:"min-width: 85px;",takeFocusOnClose:!0}),this.cmbSpecial.setValue(""),this.cmbSpecial.on("selected",_.bind(this.onSpecialSelect,this)),this.numSpecialBy=new Common.UI.MetricSpinner({el:$("#paragraphadv-spin-special-by"),step:.1,width:85,defaultUnit:"cm",defaultValue:0,value:"0 cm",maxValue:55.87,minValue:0}),this.spinners.push(this.numSpecialBy),this.numSpecialBy.on("change",_.bind(this.onFirstLineChange,this)),this.numSpacingBefore=new Common.UI.MetricSpinner({el:$("#paragraphadv-spin-spacing-before"),step:.1,width:85,value:"",defaultUnit:"cm",maxValue:55.88,minValue:0,allowAuto:!0,autoText:this.txtAutoText}),this.numSpacingBefore.on("change",_.bind(function(t,e,i,n){if(null===this.Spacing){var o=this._originalProps?this._originalProps:new Asc.asc_CParagraphProperty;this.Spacing=o.get_Spacing()}var s=t.getNumberValue();this.Spacing.put_Before(s<0?-1:Common.Utils.Metric.fnRecalcToMM(s))},this)),this.spinners.push(this.numSpacingBefore),this.numSpacingAfter=new Common.UI.MetricSpinner({el:$("#paragraphadv-spin-spacing-after"),step:.1,width:85,value:"",defaultUnit:"cm",maxValue:55.88,minValue:0,allowAuto:!0,autoText:this.txtAutoText}),this.numSpacingAfter.on("change",_.bind(function(t,e,i,n){if(null===this.Spacing){var o=this._originalProps?this._originalProps:new Asc.asc_CParagraphProperty;this.Spacing=o.get_Spacing()}var s=t.getNumberValue();this.Spacing.put_After(s<0?-1:Common.Utils.Metric.fnRecalcToMM(s))},this)),this.spinners.push(this.numSpacingAfter),this.cmbLineRule=new Common.UI.ComboBox({el:$("#paragraphadv-spin-line-rule"),cls:"input-group-nr",editable:!1,data:this._arrLineRule,style:"width: 85px;",menuStyle:"min-width: 85px;",takeFocusOnClose:!0}),this.cmbLineRule.setValue(this.CurLineRuleIdx),this.cmbLineRule.on("selected",_.bind(this.onLineRuleSelect,this)),this.numLineHeight=new Common.UI.MetricSpinner({el:$("#paragraphadv-spin-line-height"),step:.01,width:85,value:"",defaultUnit:"",maxValue:132,minValue:.5}),this.spinners.push(this.numLineHeight),this.numLineHeight.on("change",_.bind(this.onNumLineHeightChange,this)),this.chStrike=new Common.UI.CheckBox({el:$("#paragraphadv-checkbox-strike"),labelText:this.strStrike}),this.chStrike.on("change",_.bind(this.onStrikeChange,this)),this.chDoubleStrike=new Common.UI.CheckBox({el:$("#paragraphadv-checkbox-double-strike"),labelText:this.strDoubleStrike}),this.chDoubleStrike.on("change",_.bind(this.onDoubleStrikeChange,this)),this.chSuperscript=new Common.UI.CheckBox({el:$("#paragraphadv-checkbox-superscript"),labelText:this.strSuperscript}),this.chSuperscript.on("change",_.bind(this.onSuperscriptChange,this)),this.chSubscript=new Common.UI.CheckBox({el:$("#paragraphadv-checkbox-subscript"),labelText:this.strSubscript}),this.chSubscript.on("change",_.bind(this.onSubscriptChange,this)),this.chSmallCaps=new Common.UI.CheckBox({el:$("#paragraphadv-checkbox-small-caps"),labelText:this.strSmallCaps}),this.chSmallCaps.on("change",_.bind(this.onSmallCapsChange,this)),this.chAllCaps=new Common.UI.CheckBox({el:$("#paragraphadv-checkbox-all-caps"),labelText:this.strAllCaps}),this.chAllCaps.on("change",_.bind(this.onAllCapsChange,this)),this.numSpacing=new Common.UI.MetricSpinner({el:$("#paragraphadv-spin-spacing"),step:.01,width:100,defaultUnit:"cm", defaultValue:0,value:"0 cm",maxValue:55.87,minValue:-55.87}),this.numSpacing.on("change",_.bind(function(t,e,i,n){if(this._changedProps&&this._changedProps.put_TextSpacing(Common.Utils.Metric.fnRecalcToMM(t.getNumberValue())),this.api&&!this._noApply){var o=this._originalProps?this._originalProps:new Asc.asc_CParagraphProperty;o.put_TextSpacing(Common.Utils.Metric.fnRecalcToMM(t.getNumberValue())),this.api.SetDrawImagePlaceParagraph("paragraphadv-font-img",o)}},this)),this.spinners.push(this.numSpacing),this.numTab=new Common.UI.MetricSpinner({el:$("#paraadv-spin-tab"),step:.1,width:108,defaultUnit:"cm",value:"1.25 cm",maxValue:55.87,minValue:0}),this.spinners.push(this.numTab),this.numDefaultTab=new Common.UI.MetricSpinner({el:$("#paraadv-spin-default-tab"),step:.1,width:108,defaultUnit:"cm",value:"1.25 cm",maxValue:55.87,minValue:0}),this.numDefaultTab.on("change",_.bind(function(t,e,i,n){this._changedProps&&this._changedProps.put_DefaultTab(parseFloat(Common.Utils.Metric.fnRecalcToMM(t.getNumberValue()).toFixed(1)))},this)),this.spinners.push(this.numDefaultTab),this.tabList=new Common.UI.ListView({el:$("#paraadv-list-tabs"),emptyText:this.noTabs,store:new Common.UI.DataViewStore,template:_.template(['
    '].join("")),itemTemplate:_.template(['
    ','
    <%= value %>
    ','
    <%= displayTabAlign %>
    ',"
    "].join("")),tabindex:1}),this.tabList.store.comparator=function(t){return t.get("tabPos")},this.tabList.on("item:select",_.bind(this.onSelectTab,this));var e=function(){t._noApply||(t._tabListChanged=!0)};this.listenTo(this.tabList.store,"add",e),this.listenTo(this.tabList.store,"remove",e),this.listenTo(this.tabList.store,"reset",e),this.cmbAlign=new Common.UI.ComboBox({el:$("#paraadv-cmb-align"),style:"width: 108px;",menuStyle:"min-width: 108px;",editable:!1,cls:"input-group-nr",data:this._arrTabAlign,takeFocusOnClose:!0}),this.cmbAlign.setValue(Asc.c_oAscTabType.Left),this.btnAddTab=new Common.UI.Button({el:$("#paraadv-button-add-tab")}),this.btnAddTab.on("click",_.bind(this.addTab,this)),this.btnRemoveTab=new Common.UI.Button({el:$("#paraadv-button-remove-tab")}),this.btnRemoveTab.on("click",_.bind(this.removeTab,this)),this.btnRemoveAll=new Common.UI.Button({el:$("#paraadv-button-remove-all")}),this.btnRemoveAll.on("click",_.bind(this.removeAllTabs,this)),this.afterRender()},getFocusedComponents:function(){return[this.cmbTextAlignment,this.numIndentsLeft,this.numIndentsRight,this.cmbSpecial,this.numSpecialBy,this.numSpacingBefore,this.numSpacingAfter,this.cmbLineRule,this.numLineHeight,this.numSpacing,this.numDefaultTab,this.numTab,this.cmbAlign,{cmp:this.tabList,selector:".listview"}]},onCategoryClick:function(t,e){Common.Views.AdvancedSettingsWindow.prototype.onCategoryClick.call(this,t,e);var i=this;setTimeout(function(){switch(e){case 0:i.cmbTextAlignment.focus();break;case 1:i.numSpacing.focus();break;case 2:i.numDefaultTab.focus()}},10)},getSettings:function(){this._tabListChanged&&(null!==this._changedProps.get_Tabs()&&void 0!==this._changedProps.get_Tabs()||this._changedProps.put_Tabs(new Asc.asc_CParagraphTabs),this.tabList.store.each(function(t,e){var i=new Asc.asc_CParagraphTab(Common.Utils.Metric.fnRecalcToMM(t.get("tabPos")),t.get("tabAlign"));this._changedProps.get_Tabs().add_Tab(i)},this));var t=this.cmbTextAlignment.getValue();return this._changedProps.asc_putJc(void 0!==t&&null!==t?t:c_paragraphTextAlignment.LEFT),null!==this.Spacing&&this._changedProps.asc_putSpacing(this.Spacing),{paragraphProps:this._changedProps}},_setDefaults:function(t){if(t){this._originalProps=new Asc.asc_CParagraphProperty(t),this.FirstLine=null!==t.get_Ind()?t.get_Ind().get_FirstLine():null,this.numIndentsLeft.setValue(null!==t.get_Ind()&&null!==t.get_Ind().get_Left()?Common.Utils.Metric.fnRecalcFromMM(t.get_Ind().get_Left()):"",!0),this.numIndentsRight.setValue(null!==t.get_Ind()&&null!==t.get_Ind().get_Right()?Common.Utils.Metric.fnRecalcFromMM(t.get_Ind().get_Right()):"",!0),this.cmbTextAlignment.setValue(void 0!==t.get_Jc()&&null!==t.get_Jc()?t.get_Jc():c_paragraphTextAlignment.CENTERED,!0),void 0===this.CurSpecial&&(this.CurSpecial=0===t.get_Ind().get_FirstLine()?c_paragraphSpecial.NONE_SPECIAL:t.get_Ind().get_FirstLine()>0?c_paragraphSpecial.FIRST_LINE:c_paragraphSpecial.HANGING),this.cmbSpecial.setValue(this.CurSpecial),this.numSpecialBy.setValue(null!==this.FirstLine?Math.abs(Common.Utils.Metric.fnRecalcFromMM(this.FirstLine)):"",!0);var e=t.get_Spacing()?t.get_Spacing().get_Before():null;this.numSpacingBefore.setValue(null!==e?e<0?e:Common.Utils.Metric.fnRecalcFromMM(e):"",!0),e=t.get_Spacing()?t.get_Spacing().get_After():null,this.numSpacingAfter.setValue(null!==e?e<0?e:Common.Utils.Metric.fnRecalcFromMM(e):"",!0);var i=t.get_Spacing().get_LineRule();this.cmbLineRule.setValue(null!==i?i:"",!0),null!==t.get_Spacing()&&null!==t.get_Spacing().get_Line()?this.numLineHeight.setValue(i==c_paragraphLinerule.LINERULE_AUTO?t.get_Spacing().get_Line():Common.Utils.Metric.fnRecalcFromMM(t.get_Spacing().get_Line()),!0):this.numLineHeight.setValue("",!0),this._noApply=!0,this.chStrike.setValue(null!==t.get_Strikeout()&&void 0!==t.get_Strikeout()?t.get_Strikeout():"indeterminate",!0),this.chDoubleStrike.setValue(null!==t.get_DStrikeout()&&void 0!==t.get_DStrikeout()?t.get_DStrikeout():"indeterminate",!0),this.chSubscript.setValue(null!==t.get_Subscript()&&void 0!==t.get_Subscript()?t.get_Subscript():"indeterminate",!0),this.chSuperscript.setValue(null!==t.get_Superscript()&&void 0!==t.get_Superscript()?t.get_Superscript():"indeterminate",!0),this.chSmallCaps.setValue(null!==t.get_SmallCaps()&&void 0!==t.get_SmallCaps()?t.get_SmallCaps():"indeterminate",!0),this.chAllCaps.setValue(null!==t.get_AllCaps()&&void 0!==t.get_AllCaps()?t.get_AllCaps():"indeterminate",!0),this.numSpacing.setValue(null!==t.get_TextSpacing()&&void 0!==t.get_TextSpacing()?Common.Utils.Metric.fnRecalcFromMM(t.get_TextSpacing()):"",!0),this.api.SetDrawImagePlaceParagraph("paragraphadv-font-img",this._originalProps),this.numDefaultTab.setValue(null!==t.get_DefaultTab()&&void 0!==t.get_DefaultTab()?Common.Utils.Metric.fnRecalcFromMM(parseFloat(t.get_DefaultTab().toFixed(1))):"",!0);var n=this.tabList.store,o=t.get_Tabs();if(o){for(var s=[],a=o.get_Count(),l=0;ln.length-1&&(o=n.length-1),n.length>0&&(this.tabList.selectByIndex(o),this.tabList.scrollToRecord(n.at(o)))}},removeAllTabs:function(t,e){this.tabList.store.reset()},onSelectTab:function(t,e,i){var n={};if(_.isFunction(i.toJSON)){if(!i.get("selected"))return;n=i.toJSON()}else n=i;this.numTab.setValue(n.tabPos),this.cmbAlign.setValue(n.tabAlign)},onSpecialSelect:function(t,e){if(this.CurSpecial=e.value,this.CurSpecial===c_paragraphSpecial.NONE_SPECIAL&&this.numSpecialBy.setValue(0,!0),this._changedProps){null!==this._changedProps.get_Ind()&&void 0!==this._changedProps.get_Ind()||this._changedProps.put_Ind(new Asc.asc_CParagraphInd);var i=Common.Utils.Metric.fnRecalcToMM(this.numSpecialBy.getNumberValue());0===i&&(this.numSpecialBy.setValue(Common.Utils.Metric.fnRecalcFromMM(this._arrSpecial[e.value].defaultValue),!0),i=this._arrSpecial[e.value].defaultValue),this.CurSpecial===c_paragraphSpecial.HANGING&&(i=-i),this._changedProps.get_Ind().put_FirstLine(i)}},onFirstLineChange:function(t,e,i,n){if(this._changedProps){null!==this._changedProps.get_Ind()&&void 0!==this._changedProps.get_Ind()||this._changedProps.put_Ind(new Asc.asc_CParagraphInd);var o=Common.Utils.Metric.fnRecalcToMM(t.getNumberValue());this.CurSpecial===c_paragraphSpecial.HANGING?o=-o:this.CurSpecial===c_paragraphSpecial.NONE_SPECIAL&&o>0?(this.CurSpecial=c_paragraphSpecial.FIRST_LINE,this.cmbSpecial.setValue(c_paragraphSpecial.FIRST_LINE)):0===o&&(this.CurSpecial=c_paragraphSpecial.NONE_SPECIAL,this.cmbSpecial.setValue(c_paragraphSpecial.NONE_SPECIAL)),this._changedProps.get_Ind().put_FirstLine(o)}},onLineRuleSelect:function(t,e){if(null===this.Spacing){var i=this._originalProps?this._originalProps:new Asc.asc_CParagraphProperty;this.Spacing=i.get_Spacing()}this.Spacing.put_LineRule(e.value);var n=_.findWhere(this._arrLineRule,{value:e.value}),o=this._arrLineRule.indexOf(n);this.CurLineRuleIdx!==o&&(this.numLineHeight.setDefaultUnit(this._arrLineRule[o].defaultUnit),this.numLineHeight.setMinValue(this._arrLineRule[o].minValue),this.numLineHeight.setStep(this._arrLineRule[o].step),this.Spacing.get_LineRule()===c_paragraphLinerule.LINERULE_AUTO?this.numLineHeight.setValue(this._arrLineRule[o].defaultValue):this.numLineHeight.setValue(Common.Utils.Metric.fnRecalcFromMM(this._arrLineRule[o].defaultValue)),this.CurLineRuleIdx=o)},onNumLineHeightChange:function(t,e,i,n){if(""!==this.cmbLineRule.getRawValue()){if(null===this.Spacing){var o=this._originalProps?this._originalProps:new Asc.asc_CParagraphProperty;this.Spacing=o.get_Spacing()}this.Spacing.put_Line(this.cmbLineRule.getValue()==c_paragraphLinerule.LINERULE_AUTO?t.getNumberValue():Common.Utils.Metric.fnRecalcToMM(t.getNumberValue()))}},textTitle:"Paragraph - Advanced Settings",strIndentsLeftText:"Left",strIndentsRightText:"Right",strParagraphIndents:"Indents & Spacing",strParagraphFont:"Font",textEffects:"Effects",textCharacterSpacing:"Character Spacing",strDoubleStrike:"Double strikethrough",strStrike:"Strikethrough",strSuperscript:"Superscript",strSubscript:"Subscript",strSmallCaps:"Small caps",strAllCaps:"All caps",strTabs:"Tab",textSet:"Specify",textRemove:"Remove",textRemoveAll:"Remove All",textTabLeft:"Left",textTabRight:"Right",textTabCenter:"Center",textAlign:"Alignment",textTabPosition:"Tab Position",textDefault:"Default Tab",noTabs:"The specified tabs will appear in this field",textJustified:"Justified",strIndentsSpecial:"Special",textNoneSpecial:"(none)",textFirstLine:"First line",textHanging:"Hanging",strIndentsSpacingBefore:"Before",strIndentsSpacingAfter:"After",strIndentsLineSpacing:"Line Spacing",txtAutoText:"Auto",textAuto:"Multiple",textExact:"Exactly",strIndent:"Indents",strSpacing:"Spacing"},PE.Views.ParagraphSettingsAdvanced||{}))}),define("text!presentationeditor/main/app/template/ShapeSettingsAdvanced.template",[],function(){return'
    \r\n
    \r\n \r\n \r\n \r\n \r\n \r\n \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
    \r\n \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
    \r\n \r\n
    \r\n \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
    \r\n \r\n
    \r\n \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
    \r\n \r\n
    \r\n \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
    \r\n \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
    \r\n \r\n
    \r\n
    \r\n \r\n \r\n
    \r\n \r\n
    \r\n
    \r\n
    '}),void 0===Common)var Common={};define("common/main/lib/component/ComboBox",["common/main/lib/component/BaseView","common/main/lib/component/Scroller"],function(){"use strict";Common.UI.ComboBoxModel=Backbone.Model.extend({defaults:function(){return{id:Common.UI.getId(),value:null,displayValue:null}}}),Common.UI.ComboBoxStore=Backbone.Collection.extend({model:Common.UI.ComboBoxModel}),Common.UI.ComboBox=Common.UI.BaseView.extend(function(){return{options:{id:null,cls:"",style:"",hint:!1,editable:!0,disabled:!1,menuCls:"",menuStyle:"",displayField:"displayValue",valueField:"value",search:!1,scrollAlwaysVisible:!1,takeFocusOnClose:!1},template:_.template(['','','','",""].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t);var e=this;this.id=e.options.id||Common.UI.getId(),this.cls=e.options.cls,this.style=e.options.style,this.menuCls=e.options.menuCls,this.menuStyle=e.options.menuStyle,this.template=e.options.template||e.template,this.itemsTemplate=e.options.itemsTemplate,this.hint=e.options.hint,this.editable=e.options.editable,this.disabled=e.options.disabled,this.store=e.options.store||new Common.UI.ComboBoxStore,this.displayField=e.options.displayField,this.valueField=e.options.valueField,this.search=e.options.search,this.scrollAlwaysVisible=e.options.scrollAlwaysVisible,e.rendered=e.options.rendered||!1,this.lastValue=null,e.store.add(e.options.data),e.options.el&&e.render()},render:function(t){var e=this;if(e.rendered)this.cmpEl=e.$el||$(this.el);else{var i=this.store.toJSON();this.cmpEl=$(this.template({id:this.id,cls:this.cls,style:this.style,menuCls:this.menuCls,menuStyle:this.menuStyle,items:i,scope:e})),this.itemsTemplate&&this.cmpEl.find("ul").html($(this.itemsTemplate({items:i,scope:e}))),t?(this.setElement(t,!1),t.html(this.cmpEl)):this.$el.html(this.cmpEl)}if(!e.rendered){var n=this.cmpEl;if(this._input=n.find("input"),this._button=n.find(".btn"),n.on("click","a",_.bind(this.itemClicked,this)),n.on("mousedown","a",_.bind(this.itemMouseDown,this)),this.editable?(n.on("change","input",_.bind(this.onInputChanged,this)),n.on("keydown","input",_.bind(this.onInputKeyDown,this)),n.on("focusin","input",_.bind(this.onInputFocusIn,this)),n.on("click",".form-control",_.bind(this.onEditableInputClick,this))):(n.on("click",".form-control",_.bind(this.onInputClick,this)),this._input.attr("readonly","readonly"),this._input.attr("data-can-copy",!1)),e.options.hint){n.attr("data-toggle","tooltip"),n.tooltip({title:e.options.hint,placement:e.options.hintAnchor||"cursor"});var o=n.closest(".asc-window");if(o.length>0){n.data("bs.tooltip").tip().css("z-index",parseInt(o.css("z-index"))+10);var s=function(t){if(o[0]===t.$window[0]){var e=n.data("bs.tooltip");e&&(void 0===e.dontShow&&(e.dontShow=!0),e.hide()),Common.NotificationCenter.off({"modal:close":s})}};Common.NotificationCenter.on({"modal:close":s})}n.find(".dropdown-menu").on("mouseenter",function(){var t=n.data("bs.tooltip");t&&(void 0===t.dontShow&&(t.dontShow=!0),t.hide())})}var a=n.find(".dropdown-menu");a.hasClass("menu-absolute")&&a.css("min-width",n.outerWidth()),n.on("show.bs.dropdown",_.bind(e.onBeforeShowMenu,e)),n.on("shown.bs.dropdown",_.bind(e.onAfterShowMenu,e)),n.on("hide.bs.dropdown",_.bind(e.onBeforeHideMenu,e)),n.on("hidden.bs.dropdown",_.bind(e.onAfterHideMenu,e)),n.on("keydown.after.bs.dropdown",_.bind(e.onAfterKeydownMenu,e)),Common.NotificationCenter.on("menumanager:hideall",_.bind(e.closeMenu,e)),this.setDefaultSelection(),this.listenTo(this.store,"reset",this.onResetItems)}return e.rendered=!0,e.disabled&&e.setDisabled(e.disabled),this},setData:function(t){this.store.reset([]),this.store.add(t),this.setRawValue(""),this.onResetItems()},openMenu:function(t){var e=this;this.scroller||(this.scroller=new Common.UI.Scroller(_.extend({el:$(".dropdown-menu",this.cmpEl),minScrollbarLength:40,includePadding:!0,wheelSpeed:10,alwaysVisibleY:this.scrollAlwaysVisible},this.options.scroller))),_.delay(function(){e.cmpEl.addClass("open")},t||0)},closeMenu:function(){this.cmpEl.removeClass("open")},isMenuOpen:function(){return this.cmpEl.hasClass("open")},onBeforeShowMenu:function(t){if(this.scroller||(this.scroller=new Common.UI.Scroller(_.extend({el:$(".dropdown-menu",this.cmpEl),minScrollbarLength:40,includePadding:!0,wheelSpeed:10,alwaysVisibleY:this.scrollAlwaysVisible},this.options.scroller))),Common.NotificationCenter.trigger("menu:show"),this.trigger("show:before",this,t),this.options.hint){var e=this.cmpEl.data("bs.tooltip");e&&(void 0===e.dontShow&&(e.dontShow=!0),e.hide())}var i=this.cmpEl.find("ul");if(i.hasClass("menu-absolute")){var n=this.cmpEl.offset();i.css({left:n.left,top:n.top+this.cmpEl.outerHeight()+2})}else if(i.hasClass("menu-aligned")){var n=this.cmpEl.offset();i.toggleClass("show-top",n.top+this.cmpEl.outerHeight()+i.outerHeight()>Common.Utils.innerHeight())}},onAfterShowMenu:function(t){var e=$(this.el).find("ul"),i=e.find("> li.selected");if(i.length){var n=i.position().top,o=i.outerHeight(),s=e.outerHeight();if(n<0||n+o>s){var a=e.scrollTop()+n+(o-s)/2;a=Math.floor(a/o)*o,e.scrollTop(a)}setTimeout(function(){i.find("a").focus()},1)}else{var l=this;setTimeout(function(){l.cmpEl.find("ul li:first a").focus()},1)}this.scroller&&this.scroller.update({alwaysVisibleY:this.scrollAlwaysVisible}),this.trigger("show:after",this,t),this._search={}},onBeforeHideMenu:function(t){this.trigger("hide:before",this,t),Common.UI.Scroller.isMouseCapture()&&t.preventDefault()},onAfterHideMenu:function(t,e){if(this.cmpEl.find(".dropdown-toggle").blur(),this.trigger("hide:after",this,t,e),Common.NotificationCenter.trigger("menu:hide",this,e),this.options.takeFocusOnClose){var i=this;setTimeout(function(){i.focus()},1)}},onAfterKeydownMenu:function(t){if(t.keyCode==Common.UI.Keys.DOWN&&!this.editable&&!this.isMenuOpen())return this.openMenu(),this.onAfterShowMenu(),!1;if(t.keyCode==Common.UI.Keys.RETURN&&(this.editable||this.isMenuOpen())){$(t.target).click();var e=this;return this.rendered&&(Common.Utils.isIE?this._input.trigger("change",{onkeydown:!0}):this._input.blur()),!1}if(t.keyCode==Common.UI.Keys.ESC&&this.isMenuOpen())return this._input.val(this.lastValue),this.closeMenu(),this.onAfterHideMenu(t),!1;if(this.search&&t.keyCode>64&&t.keyCode<91&&t.key){if("object"!=typeof this._search)return;var e=this;if(clearTimeout(this._search.timer),this._search.timer=setTimeout(function(){e._search={}},1e3),!this._search.text&&(this._search.text=""),!this._search.char&&(this._search.char=t.key),this._search.char!==t.key&&(this._search.full=!0),this._search.text+=t.key,void 0===this._search.index){var i=this.cmpEl.find("ul > li").find("> a");this._search.index=i.index(i.filter(":focus"))}this.selectCandidate()}},selectCandidate:function(){for(var t,e,i=this._search.index||0,n=new RegExp("^"+(this._search.full?this._search.text:this._search.char),"i"),o=0;oi)){t=s,e=o;break}}if(t){this._search.index=e;var s=$("#"+t.get("id")+" a",$(this.el));if(this.scroller){this.scroller.update({alwaysVisibleY:this.scrollAlwaysVisible});var a=$(this.el).find("ul"),l=s.position().top,r=s.outerHeight(),c=a.outerHeight();if(l<0||l+r>c){var d=a.scrollTop()+l;d=Math.floor(d/r)*r,a.scrollTop(d)}}s.focus()}},onInputKeyDown:function(t){var e=this;t.keyCode==Common.UI.Keys.ESC?(this._input.val(this.lastValue),this.closeMenu(), this.onAfterHideMenu(t)):t.keyCode==Common.UI.Keys.UP||t.keyCode==Common.UI.Keys.DOWN?(this.isMenuOpen()||this.openMenu(),_.delay(function(){e._skipInputChange=!0,e.cmpEl.find("ul li:first a").focus()},10)):t.keyCode==Common.UI.Keys.RETURN&&$(t.target).val()===e.lastValue?this._input.trigger("change",{reapply:!0}):e._skipInputChange=!1},onInputFocusIn:function(t){this.trigger("combo:focusin",this,t)},onInputChanged:function(t,e){if(!e||!e.synthetic){if(this._skipInputChange)return void(this._skipInputChange=!1);var i=$(t.target).val(),n={};if(!(this.lastValue!==i||e&&e.reapply))return void(e&&e.onkeydown&&this.trigger("combo:blur",this,t));if(n[this.valueField]=i,this.trigger("changed:before",this,n,t),!t.isDefaultPrevented()){var o;this._selectedItem=this.store.findWhere((o={},o[this.displayField]=i,o)),this._selectedItem&&(n=this._selectedItem.toJSON(),$(".selected",$(this.el)).removeClass("selected"),$("#"+this._selectedItem.get("id"),$(this.el)).addClass("selected")),this.trigger("changed:after",this,n,t)}}},onInputClick:function(t){this._button&&this._button.dropdown("toggle"),t.preventDefault(),t.stopPropagation()},onEditableInputClick:function(t){if(this.options.hint){var e=this.cmpEl.data("bs.tooltip");e&&(void 0===e.dontShow&&(e.dontShow=!0),e.hide())}this.isMenuOpen()&&1==t.which&&t.stopPropagation()},setDefaultSelection:function(){if(this.rendered){var t,e=this._input.val();e&&(this._selectedItem=this.store.findWhere((t={},t[this.displayField]=e,t)),this._selectedItem&&($(".selected",$(this.el)).removeClass("selected"),$("#"+this._selectedItem.get("id"),$(this.el)).addClass("selected")))}},setDisabled:function(t){this.disabled=t,this.rendered&&(t?this._input.attr("disabled",!0):this._input.removeAttr("disabled"),this.cmpEl.toggleClass("disabled",t),this._button.toggleClass("disabled",t))},isDisabled:function(){return this.disabled},setRawValue:function(t){this.rendered&&(this._input.val(t).trigger("change",{synthetic:!0}),this.lastValue=null!==t&&void 0!==t?t.toString():t)},getRawValue:function(){return this.rendered?this._input.val():null},setValue:function(t,e){if(this.rendered){var i;this._selectedItem=this.store.findWhere((i={},i[this.valueField]=t,i)),$(".selected",$(this.el)).removeClass("selected"),this._selectedItem?(this.setRawValue(this._selectedItem.get(this.displayField)),$("#"+this._selectedItem.get("id"),$(this.el)).addClass("selected")):this.setRawValue(void 0!==e?e:t)}},getValue:function(){return this.rendered?this._selectedItem&&!_.isUndefined(this._selectedItem.get(this.valueField))?this._selectedItem.get(this.valueField):this._input.val():null},getDisplayValue:function(t){return Common.Utils.String.htmlEncode(t[this.displayField])},getSelectedRecord:function(){return this.rendered&&this._selectedItem&&!_.isUndefined(this._selectedItem.get(this.valueField))?_.extend({},this._selectedItem.toJSON()):null},selectRecord:function(t){this.rendered&&t&&(this._selectedItem=t,$(".selected",$(this.el)).removeClass("selected"),this.setRawValue(this._selectedItem.get(this.displayField)),$("#"+this._selectedItem.get("id"),$(this.el)).addClass("selected"))},itemClicked:function(t){var e=$(t.target).closest("li");this._selectedItem=this.store.findWhere({id:e.attr("id")}),this._selectedItem&&(this.lastValue=this._selectedItem.get(this.displayField),this._input.val(this.lastValue).trigger("change",{synthetic:!0}),$(".selected",$(this.el)).removeClass("selected"),e.addClass("selected"),this.trigger("selected",this,_.extend({},this._selectedItem.toJSON()),t),t.preventDefault()),this._isMouseDownMenu=!1},itemMouseDown:function(t){if(1!=t.which)return t.preventDefault(),t.stopPropagation(),!1;this._isMouseDownMenu=!0},onResetItems:function(){this.itemsTemplate?$(this.el).find("ul").html($(this.itemsTemplate({items:this.store.toJSON(),scope:this}))):$(this.el).find("ul").html(_.template(["<% _.each(items, function(item) { %>",'
  • <%= scope.getDisplayValue(item) %>
  • ',"<% }); %>"].join(""))({items:this.store.toJSON(),scope:this})),_.isUndefined(this.scroller)||(this.scroller.destroy(),delete this.scroller),this.scroller=new Common.UI.Scroller(_.extend({el:$(".dropdown-menu",this.cmpEl),minScrollbarLength:40,includePadding:!0,wheelSpeed:10,alwaysVisibleY:this.scrollAlwaysVisible},this.options.scroller))},focus:function(){this._input&&this._input.focus()}}}()),Common.UI.ComboBoxCustom=Common.UI.ComboBox.extend(_.extend({itemClicked:function(t){Common.UI.ComboBox.prototype.itemClicked.call(this,t),this.options.updateFormControl&&this.options.updateFormControl.call(this,this._selectedItem)},setValue:function(t){Common.UI.ComboBox.prototype.setValue.call(this,t),this.options.updateFormControl&&this.options.updateFormControl.call(this,this._selectedItem)},selectRecord:function(t){Common.UI.ComboBox.prototype.selectRecord.call(this,t),this.options.updateFormControl&&this.options.updateFormControl.call(this,this._selectedItem)},focus:function(){this.cmpEl&&this.cmpEl.find(".form-control").focus()}},Common.UI.ComboBoxCustom||{}))}),define("presentationeditor/main/app/view/ShapeSettingsAdvanced",["text!presentationeditor/main/app/template/ShapeSettingsAdvanced.template","common/main/lib/view/AdvancedSettingsWindow","common/main/lib/component/ComboBox","common/main/lib/component/MetricSpinner","common/main/lib/component/CheckBox"],function(t){"use strict";PE.Views.ShapeSettingsAdvanced=Common.Views.AdvancedSettingsWindow.extend(_.extend({options:{contentWidth:300,height:342,toggleGroup:"shape-adv-settings-group",sizeOriginal:{width:0,height:0},sizeMax:{width:55.88,height:55.88},properties:null,storageName:"pe-shape-settings-adv-category"},initialize:function(e){_.extend(this.options,{title:this.textTitle,items:[{panelId:"id-adv-shape-width",panelCaption:this.textSize},{panelId:"id-adv-shape-rotate",panelCaption:this.textRotation},{panelId:"id-adv-shape-shape",panelCaption:this.textWeightArrows},{panelId:"id-adv-shape-margins",panelCaption:this.textTextBox},{panelId:"id-adv-shape-columns",panelCaption:this.strColumns},{panelId:"id-adv-shape-alttext",panelCaption:this.textAlt}],contentTemplate:_.template(t)({scope:this})},e),Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this,this.options),this.spinners=[],this.Margins=void 0,this._nRatio=1,this._originalProps=this.options.shapeProps,this._changedProps=null},render:function(){Common.Views.AdvancedSettingsWindow.prototype.render.call(this);var t=this;this.spnWidth=new Common.UI.MetricSpinner({el:$("#shape-advanced-spin-width"),step:.1,width:100,defaultUnit:"cm",value:"3 cm",maxValue:55.88,minValue:0}),this.spnWidth.on("change",_.bind(function(t,e,i,n){if(this.btnRatio.pressed){var o=t.getNumberValue(),s=o/this._nRatio;s>this.sizeMax.height&&(s=this.sizeMax.height,o=s*this._nRatio,this.spnWidth.setValue(o,!0)),this.spnHeight.setValue(s,!0)}this._changedProps&&(this._changedProps.put_Width(Common.Utils.Metric.fnRecalcToMM(t.getNumberValue())),this._changedProps.put_Height(Common.Utils.Metric.fnRecalcToMM(this.spnHeight.getNumberValue())))},this)),this.spinners.push(this.spnWidth),this.spnHeight=new Common.UI.MetricSpinner({el:$("#shape-advanced-spin-height"),step:.1,width:100,defaultUnit:"cm",value:"3 cm",maxValue:55.88,minValue:0}),this.spnHeight.on("change",_.bind(function(t,e,i,n){var o=t.getNumberValue(),s=null;this.btnRatio.pressed&&(s=o*this._nRatio,s>this.sizeMax.width&&(s=this.sizeMax.width,o=s/this._nRatio,this.spnHeight.setValue(o,!0)),this.spnWidth.setValue(s,!0)),this._changedProps&&(this._changedProps.put_Height(Common.Utils.Metric.fnRecalcToMM(t.getNumberValue())),this._changedProps.put_Width(Common.Utils.Metric.fnRecalcToMM(this.spnWidth.getNumberValue())))},this)),this.spinners.push(this.spnHeight),this.btnRatio=new Common.UI.Button({parentEl:$("#shape-advanced-button-ratio"),cls:"btn-toolbar",iconCls:"toolbar__icon advanced-btn-ratio",style:"margin-bottom: 1px;",enableToggle:!0,hint:this.textKeepRatio}),this.btnRatio.on("click",_.bind(function(t,e){t.pressed&&this.spnHeight.getNumberValue()>0&&(this._nRatio=this.spnWidth.getNumberValue()/this.spnHeight.getNumberValue()),this._changedProps&&this._changedProps.asc_putLockAspect(t.pressed)},this)),this.spnMarginTop=new Common.UI.MetricSpinner({el:$("#shape-margin-top"),step:.1,width:100,defaultUnit:"cm",value:"0 cm",maxValue:55.87,minValue:0}),this.spnMarginTop.on("change",_.bind(function(t,e,i,n){this._changedProps&&(null!==this._changedProps.get_paddings()&&void 0!==this._changedProps.get_paddings()||this._changedProps.put_paddings(new Asc.asc_CPaddings),this._changedProps.get_paddings().put_Top(Common.Utils.Metric.fnRecalcToMM(t.getNumberValue())))},this)),this.spinners.push(this.spnMarginTop),this.spnMarginBottom=new Common.UI.MetricSpinner({el:$("#shape-margin-bottom"),step:.1,width:100,defaultUnit:"cm",value:"0 cm",maxValue:55.87,minValue:0}),this.spnMarginBottom.on("change",_.bind(function(t,e,i,n){this._changedProps&&(null!==this._changedProps.get_paddings()&&void 0!==this._changedProps.get_paddings()||this._changedProps.put_paddings(new Asc.asc_CPaddings),this._changedProps.get_paddings().put_Bottom(Common.Utils.Metric.fnRecalcToMM(t.getNumberValue())))},this)),this.spinners.push(this.spnMarginBottom),this.spnMarginLeft=new Common.UI.MetricSpinner({el:$("#shape-margin-left"),step:.1,width:100,defaultUnit:"cm",value:"0.19 cm",maxValue:55.87,minValue:0}),this.spnMarginLeft.on("change",_.bind(function(t,e,i,n){this._changedProps&&(null!==this._changedProps.get_paddings()&&void 0!==this._changedProps.get_paddings()||this._changedProps.put_paddings(new Asc.asc_CPaddings),this._changedProps.get_paddings().put_Left(Common.Utils.Metric.fnRecalcToMM(t.getNumberValue())))},this)),this.spinners.push(this.spnMarginLeft),this.spnMarginRight=new Common.UI.MetricSpinner({el:$("#shape-margin-right"),step:.1,width:100,defaultUnit:"cm",value:"0.19 cm",maxValue:55.87,minValue:0}),this.spnMarginRight.on("change",_.bind(function(t,e,i,n){this._changedProps&&(null!==this._changedProps.get_paddings()&&void 0!==this._changedProps.get_paddings()||this._changedProps.put_paddings(new Asc.asc_CPaddings),this._changedProps.get_paddings().put_Right(Common.Utils.Metric.fnRecalcToMM(t.getNumberValue())))},this)),this.spinners.push(this.spnMarginRight),this.radioNofit=new Common.UI.RadioBox({el:$("#shape-radio-nofit"),name:"asc-radio-fit",labelText:this.textNofit,value:AscFormat.text_fit_No}),this.radioNofit.on("change",_.bind(this.onRadioFitChange,this)),this.radioShrink=new Common.UI.RadioBox({el:$("#shape-radio-shrink"),name:"asc-radio-fit",labelText:this.textShrink,value:AscFormat.text_fit_NormAuto}),this.radioShrink.on("change",_.bind(this.onRadioFitChange,this)),this.radioFit=new Common.UI.RadioBox({el:$("#shape-radio-fit"),name:"asc-radio-fit",labelText:this.textResizeFit,value:AscFormat.text_fit_Auto}),this.radioFit.on("change",_.bind(this.onRadioFitChange,this)),this.spnAngle=new Common.UI.MetricSpinner({el:$("#shape-advanced-spin-angle"),step:1,width:80,defaultUnit:"°",value:"0 °",maxValue:3600,minValue:-3600}),this.chFlipHor=new Common.UI.CheckBox({el:$("#shape-advanced-checkbox-hor"),labelText:this.textHorizontally}),this.chFlipVert=new Common.UI.CheckBox({el:$("#shape-advanced-checkbox-vert"),labelText:this.textVertically}),this._arrCapType=[{displayValue:this.textFlat,value:Asc.c_oAscLineCapType.Flat},{displayValue:this.textRound,value:Asc.c_oAscLineCapType.Round},{displayValue:this.textSquare,value:Asc.c_oAscLineCapType.Square}],this.cmbCapType=new Common.UI.ComboBox({el:$("#shape-advanced-cap-type"),cls:"input-group-nr",menuStyle:"min-width: 100px;",editable:!1,data:this._arrCapType,takeFocusOnClose:!0}),this.cmbCapType.setValue(Asc.c_oAscLineCapType.Flat),this.cmbCapType.on("selected",_.bind(function(t,e){this._changedProps&&(null===this._changedProps.get_stroke()&&this._changedProps.put_stroke(new Asc.asc_CStroke),this._changedProps.get_stroke().put_linecap(e.value))},this)),this._arrJoinType=[{displayValue:this.textRound,value:Asc.c_oAscLineJoinType.Round},{displayValue:this.textBevel,value:Asc.c_oAscLineJoinType.Bevel},{displayValue:this.textMiter,value:Asc.c_oAscLineJoinType.Miter}],this.cmbJoinType=new Common.UI.ComboBox({el:$("#shape-advanced-join-type"),cls:"input-group-nr",menuStyle:"min-width: 100px;",editable:!1,data:this._arrJoinType,takeFocusOnClose:!0}),this.cmbJoinType.setValue(Asc.c_oAscLineJoinType.Round),this.cmbJoinType.on("selected",_.bind(function(t,e){this._changedProps&&(null===this._changedProps.get_stroke()&&this._changedProps.put_stroke(new Asc.asc_CStroke),this._changedProps.get_stroke().put_linejoin(e.value))},this));for(var e=[],i=[],n=0;n<6;n++)e.push({value:n,offsetx:80*n+10,offsety:0});for(e[0].type=Asc.c_oAscLineBeginType.None,e[1].type=Asc.c_oAscLineBeginType.Triangle,e[2].type=Asc.c_oAscLineBeginType.Arrow,e[3].type=Asc.c_oAscLineBeginType.Stealth,e[4].type=Asc.c_oAscLineBeginType.Diamond,e[5].type=Asc.c_oAscLineBeginType.Oval,n=0;n<9;n++)i.push({value:n,offsetx:90,offsety:20*(n+1)});for(i[0].type=Asc.c_oAscLineBeginSize.small_small,i[1].type=Asc.c_oAscLineBeginSize.small_mid,i[2].type=Asc.c_oAscLineBeginSize.small_large,i[3].type=Asc.c_oAscLineBeginSize.mid_small,i[4].type=Asc.c_oAscLineBeginSize.mid_mid,i[5].type=Asc.c_oAscLineBeginSize.mid_large,i[6].type=Asc.c_oAscLineBeginSize.large_small,i[7].type=Asc.c_oAscLineBeginSize.large_mid,i[8].type=Asc.c_oAscLineBeginSize.large_large,this.btnBeginStyle=new Common.UI.ComboBox({el:$("#shape-advanced-begin-style"),template:_.template(['"].join(""))}),this.btnBeginStyleMenu=new Common.UI.Menu({style:"min-width: 105px;",additionalAlign:this.menuAddAlign,items:[{template:_.template('
    ')}]}).render($("#shape-advanced-begin-style")),this.mnuBeginStylePicker=new Common.UI.DataView({el:$("#shape-advanced-menu-begin-style"),parentMenu:this.btnBeginStyleMenu,store:new Common.UI.DataViewStore(e),itemTemplate:_.template('
    ')}),this.mnuBeginStylePicker.on("item:click",_.bind(this.onSelectBeginStyle,this)),this._selectStyleItem(this.btnBeginStyle,null),this.btnBeginSize=new Common.UI.ComboBox({el:$("#shape-advanced-begin-size"),template:_.template(['"].join(""))}),this.btnBeginSizeMenu=new Common.UI.Menu({style:"min-width: 160px;",additionalAlign:this.menuAddAlign,items:[{template:_.template('
    ')}]}).render($("#shape-advanced-begin-size")),this.mnuBeginSizePicker=new Common.UI.DataView({el:$("#shape-advanced-menu-begin-size"),parentMenu:this.btnBeginSizeMenu,store:new Common.UI.DataViewStore(i),itemTemplate:_.template('
    ')}),this.mnuBeginSizePicker.on("item:click",_.bind(this.onSelectBeginSize,this)),this._selectStyleItem(this.btnBeginSize,null),n=0;n','
    ','
    ','',""].join(""))}),this.btnEndStyleMenu=new Common.UI.Menu({style:"min-width: 105px;",additionalAlign:this.menuAddAlign,items:[{template:_.template('
    ')}]}).render($("#shape-advanced-end-style")),this.mnuEndStylePicker=new Common.UI.DataView({el:$("#shape-advanced-menu-end-style"),parentMenu:this.btnEndStyleMenu,store:new Common.UI.DataViewStore(e),itemTemplate:_.template('
    ')}),this.mnuEndStylePicker.on("item:click",_.bind(this.onSelectEndStyle,this)),this._selectStyleItem(this.btnEndStyle,null),this.btnEndSize=new Common.UI.ComboBox({el:$("#shape-advanced-end-size"),template:_.template(['"].join(""))}),this.btnEndSizeMenu=new Common.UI.Menu({style:"min-width: 160px;",additionalAlign:this.menuAddAlign,items:[{template:_.template('
    ')}]}).render($("#shape-advanced-end-size")),this.mnuEndSizePicker=new Common.UI.DataView({el:$("#shape-advanced-menu-end-size"),parentMenu:this.btnEndSizeMenu,store:new Common.UI.DataViewStore(i),itemTemplate:_.template('
    ')}),this.mnuEndSizePicker.on("item:click",_.bind(this.onSelectEndSize,this)),this._selectStyleItem(this.btnEndSize,null),this.spnColumns=new Common.UI.MetricSpinner({el:$("#shape-columns-number"),step:1,allowDecimal:!1,width:100,defaultUnit:"",value:"1",maxValue:16,minValue:1}),this.spnColumns.on("change",_.bind(function(t,e,i,n){this._changedProps&&this._changedProps.asc_putColumnNumber(t.getNumberValue())},this)),this.spnSpacing=new Common.UI.MetricSpinner({el:$("#shape-columns-spacing"),step:.1,width:100,defaultUnit:"cm",value:"0 cm",maxValue:40.64,minValue:0}),this.spnSpacing.on("change",_.bind(function(t,e,i,n){this._changedProps&&this._changedProps.asc_putColumnSpace(Common.Utils.Metric.fnRecalcToMM(t.getNumberValue()))},this)),this.spinners.push(this.spnSpacing),this.inputAltTitle=new Common.UI.InputField({el:$("#shape-advanced-alt-title"),allowBlank:!0,validateOnBlur:!1,style:"width: 100%;"}).on("changed:after",function(){t.isAltTitleChanged=!0}),this.textareaAltDescription=this.$window.find("textarea"),this.textareaAltDescription.keydown(function(e){e.keyCode==Common.UI.Keys.RETURN&&e.stopPropagation(),t.isAltDescChanged=!0}),this.afterRender()},getFocusedComponents:function(){return[this.spnWidth,this.spnHeight,this.spnAngle,this.cmbCapType,this.cmbJoinType,this.spnMarginTop,this.spnMarginLeft,this.spnMarginBottom,this.spnMarginRight,this.spnColumns,this.spnSpacing,this.inputAltTitle,this.textareaAltDescription]},onCategoryClick:function(t,e){Common.Views.AdvancedSettingsWindow.prototype.onCategoryClick.call(this,t,e);var i=this;setTimeout(function(){switch(e){case 0:i.spnWidth.focus();break;case 1:i.spnAngle.focus();break;case 2:i.cmbCapType.focus();break;case 3:i.spnMarginTop.focus();break;case 4:i.spnColumns.focus();break;case 5:i.inputAltTitle.focus()}},10)},afterRender:function(){if(this.updateMetricUnit(),this._setDefaults(this._originalProps),this.storageName){var t=Common.localStorage.getItem(this.storageName);this.setActiveCategory(null!==t?parseInt(t):0)}},_setDefaults:function(t){if(t){this.spnWidth.setValue(Common.Utils.Metric.fnRecalcFromMM(t.get_Width()).toFixed(2),!0),this.spnHeight.setValue(Common.Utils.Metric.fnRecalcFromMM(t.get_Height()).toFixed(2),!0),t.get_Height()>0&&(this._nRatio=t.get_Width()/t.get_Height());var e=t.asc_getLockAspect();this.btnRatio.toggle(e),this._setShapeDefaults(t);var i=t.get_paddings();if(i){var n=i.get_Left();this.spnMarginLeft.setValue(null!==n&&void 0!==n?Common.Utils.Metric.fnRecalcFromMM(n):"",!0),n=i.get_Top(),this.spnMarginTop.setValue(null!==n&&void 0!==n?Common.Utils.Metric.fnRecalcFromMM(n):"",!0),n=i.get_Right(),this.spnMarginRight.setValue(null!==n&&void 0!==n?Common.Utils.Metric.fnRecalcFromMM(n):"",!0),n=i.get_Bottom(),this.spnMarginBottom.setValue(null!==n&&void 0!==n?Common.Utils.Metric.fnRecalcFromMM(n):"",!0)}switch(e=t.asc_getTextFitType()){case AscFormat.text_fit_No:this.radioNofit.setValue(!0,!0);break;case AscFormat.text_fit_Auto:this.radioFit.setValue(!0,!0);break;case AscFormat.text_fit_NormAuto:this.radioShrink.setValue(!0,!0)}this.btnsCategory[3].setDisabled(null===i);var o=t.asc_getType();this.btnsCategory[4].setDisabled("line"==o||"bentConnector2"==o||"bentConnector3"==o||"bentConnector4"==o||"bentConnector5"==o||"curvedConnector2"==o||"curvedConnector3"==o||"curvedConnector4"==o||"curvedConnector5"==o||"straightConnector1"==o),e=t.asc_getColumnNumber(),this.spnColumns.setValue(null!==e&&void 0!==e?e:"",!0),e=t.asc_getColumnSpace(),this.spnSpacing.setValue(null!==e&&void 0!==e?Common.Utils.Metric.fnRecalcFromMM(e):"",!0),e=t.asc_getTitle(),this.inputAltTitle.setValue(e||""),e=t.asc_getDescription(),this.textareaAltDescription.val(e||""),e=t.asc_getRot(),this.spnAngle.setValue(void 0==e||null===e?"":Math.floor(180*e/3.14159265358979+.5),!0),this.chFlipHor.setValue(t.asc_getFlipH()),this.chFlipVert.setValue(t.asc_getFlipV()),this._changedProps=new Asc.asc_CShapeProperty}},getSettings:function(){return this.isAltTitleChanged&&this._changedProps.asc_putTitle(this.inputAltTitle.getValue()),this.isAltDescChanged&&this._changedProps.asc_putDescription(this.textareaAltDescription.val()),this._changedProps.asc_putRot(3.14159265358979*this.spnAngle.getNumberValue()/180),this._changedProps.asc_putFlipH("checked"==this.chFlipHor.getValue()),this._changedProps.asc_putFlipV("checked"==this.chFlipVert.getValue()),Common.localStorage.setItem("pe-settings-shaperatio",this.btnRatio.pressed?1:0),{shapeProps:this._changedProps}},_setShapeDefaults:function(t){if(t){var e=t.get_stroke();if(e){this.btnsCategory[2].setDisabled(e.get_type()==Asc.c_oAscStrokeType.STROKE_NONE);for(var i=e.get_linejoin(),n=0;n0?(e.store.each(function(t){t.set({offsetx:80*i.get("value")+10})},this),t.setDisabled(!1),null!==n?(e.selectByIndex(n,!0),this._selectStyleItem(t,e.store.at(n))):this._selectStyleItem(t,null)):(this._selectStyleItem(t,null),t.setDisabled(!0))},_selectStyleItem:function(t,e){$(t.el).find(".form-control").css("background-position",(e?20-e.get("offsetx")+"px":"0")+" "+(e?"-"+e.get("offsety")+"px":"-30px"))},onSelectBeginStyle:function(t,e,i){this._changedProps&&(null===this._changedProps.get_stroke()&&this._changedProps.put_stroke(new Asc.asc_CStroke),this._changedProps.get_stroke().put_linebeginstyle(i.get("type"))),null!==this._beginSizeIdx&&void 0!==this._beginSizeIdx||(this._beginSizeIdx=4),this._updateSizeArr(this.btnBeginSize,this.mnuBeginSizePicker,i,this._beginSizeIdx),this._selectStyleItem(this.btnBeginStyle,i)},onSelectBeginSize:function(t,e,i){this._changedProps&&(null===this._changedProps.get_stroke()&&this._changedProps.put_stroke(new Asc.asc_CStroke),this._changedProps.get_stroke().put_linebeginsize(i.get("type"))),this._beginSizeIdx=i.get("value"),this._selectStyleItem(this.btnBeginSize,i)},onSelectEndStyle:function(t,e,i){this._changedProps&&(null===this._changedProps.get_stroke()&&this._changedProps.put_stroke(new Asc.asc_CStroke),this._changedProps.get_stroke().put_lineendstyle(i.get("type"))),null!==this._endSizeIdx&&void 0!==this._endSizeIdx||(this._endSizeIdx=4),this._updateSizeArr(this.btnEndSize,this.mnuEndSizePicker,i,this._endSizeIdx),this._selectStyleItem(this.btnEndStyle,i)},onSelectEndSize:function(t,e,i){this._changedProps&&(null===this._changedProps.get_stroke()&&this._changedProps.put_stroke(new Asc.asc_CStroke),this._changedProps.get_stroke().put_lineendsize(i.get("type"))),this._endSizeIdx=i.get("value"),this._selectStyleItem(this.btnEndSize,i)},onRadioFitChange:function(t,e,i){e&&this._changedProps&&this._changedProps.asc_putTextFitType(t.options.value)},textRound:"Round",textMiter:"Miter",textSquare:"Square",textFlat:"Flat",textBevel:"Bevel",textTitle:"Shape - Advanced Settings",txtNone:"None",textWeightArrows:"Weights & Arrows",textArrows:"Arrows",textLineStyle:"Line Style",textCapType:"Cap Type",textJoinType:"Join Type",textBeginStyle:"Begin Style",textBeginSize:"Begin Size",textEndStyle:"End Style",textEndSize:"End Size",textSize:"Size",textWidth:"Width",textHeight:"Height",textKeepRatio:"Constant Proportions",textTop:"Top",textLeft:"Left",textBottom:"Bottom",textRight:"Right",strMargins:"Text Padding",textAlt:"Alternative Text",textAltTitle:"Title",textAltDescription:"Description",textAltTip:"The alternative text-based representation of the visual object information, which will be read to the people with vision or cognitive impairments to help them better understand what information there is in the image, autoshape, chart or table.",strColumns:"Columns",textSpacing:"Spacing between columns",textColNumber:"Number of columns",textRotation:"Rotation",textAngle:"Angle",textFlipped:"Flipped",textHorizontally:"Horizontally",textVertically:"Vertically",textTextBox:"Text Box",textAutofit:"AutoFit",textNofit:"Do not Autofit",textShrink:"Shrink text on overflow",textResizeFit:"Resize shape to fit text"},PE.Views.ShapeSettingsAdvanced||{}))}),define("text!presentationeditor/main/app/template/TableSettingsAdvanced.template",[],function(){return'
    \r\n
    \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n \r\n
    \r\n \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
    \r\n \r\n
    \r\n
    \r\n \r\n \r\n
    \r\n \r\n
    \r\n
    \r\n
    '}), -define("presentationeditor/main/app/view/TableSettingsAdvanced",["text!presentationeditor/main/app/template/TableSettingsAdvanced.template","common/main/lib/view/AdvancedSettingsWindow","common/main/lib/component/MetricSpinner"],function(t){"use strict";PE.Views.TableSettingsAdvanced=Common.Views.AdvancedSettingsWindow.extend(_.extend({options:{alias:"TableSettingsAdvanced",contentWidth:280,height:385,storageName:"pe-table-settings-adv-category"},initialize:function(e){_.extend(this.options,{title:this.textTitle,items:[{panelId:"id-adv-table-cell-props",panelCaption:this.textWidthSpaces},{panelId:"id-adv-table-alttext",panelCaption:this.textAlt}],contentTemplate:_.template(t)({scope:this})},e),Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this,this.options),this.spinners=[],this._changedProps=null,this._allTable=!1,this.TableMargins={Left:.19,Right:.19,Top:0,Bottom:0},this.CellMargins={Left:.19,Right:.19,Top:null,Bottom:null,Flag:0},this._initialMarginsDefault=!1,this._originalProps=new Asc.CTableProp(this.options.tableProps)},render:function(){Common.Views.AdvancedSettingsWindow.prototype.render.call(this);var t=this;this._marginsChange=function(t,e,i,n,o,s){"table"==o?this.TableMargins[s]=t.getNumberValue():this.CellMargins[s]=t.getNumberValue()},this.spnTableMarginTop=new Common.UI.MetricSpinner({el:$("#tableadv-number-margin-table-top"),step:.1,width:85,defaultUnit:"cm",value:"0 cm",maxValue:55.87,minValue:0}),this.spnTableMarginTop.on("change",_.bind(function(t,e,i,n){this._marginsChange(t,e,i,n,"table","Top"),this._changedProps&&(void 0===this._changedProps.get_DefaultMargins()&&this._changedProps.put_DefaultMargins(new Asc.asc_CPaddings),this._changedProps.get_DefaultMargins().put_Top(null!==this.TableMargins.Top?Common.Utils.Metric.fnRecalcToMM(this.TableMargins.Top):null),this.TableMargins.isChanged=!0)},this)),this.spinners.push(this.spnTableMarginTop),this.spnTableMarginBottom=new Common.UI.MetricSpinner({el:$("#tableadv-number-margin-table-bottom"),step:.1,width:85,defaultUnit:"cm",value:"0 cm",maxValue:55.87,minValue:0}),this.spnTableMarginBottom.on("change",_.bind(function(t,e,i,n){this._marginsChange(t,e,i,n,"table","Bottom"),this._changedProps&&(void 0===this._changedProps.get_DefaultMargins()&&this._changedProps.put_DefaultMargins(new Asc.asc_CPaddings),this._changedProps.get_DefaultMargins().put_Bottom(null!==this.TableMargins.Bottom?Common.Utils.Metric.fnRecalcToMM(this.TableMargins.Bottom):null),this.TableMargins.isChanged=!0)},this)),this.spinners.push(this.spnTableMarginBottom),this.spnTableMarginLeft=new Common.UI.MetricSpinner({el:$("#tableadv-number-margin-table-left"),step:.1,width:85,defaultUnit:"cm",value:"0.19 cm",maxValue:55.87,minValue:0}),this.spnTableMarginLeft.on("change",_.bind(function(t,e,i,n){this._marginsChange(t,e,i,n,"table","Left"),this._changedProps&&(void 0===this._changedProps.get_DefaultMargins()&&this._changedProps.put_DefaultMargins(new Asc.asc_CPaddings),this._changedProps.get_DefaultMargins().put_Left(null!==this.TableMargins.Left?Common.Utils.Metric.fnRecalcToMM(this.TableMargins.Left):null),this.TableMargins.isChanged=!0)},this)),this.spinners.push(this.spnTableMarginLeft),this.spnTableMarginRight=new Common.UI.MetricSpinner({el:$("#tableadv-number-margin-table-right"),step:.1,width:85,defaultUnit:"cm",value:"0.19 cm",maxValue:55.87,minValue:0}),this.spnTableMarginRight.on("change",_.bind(function(t,e,i,n){this._marginsChange(t,e,i,n,"table","Right"),this._changedProps&&(void 0===this._changedProps.get_DefaultMargins()&&this._changedProps.put_DefaultMargins(new Asc.asc_CPaddings),this._changedProps.get_DefaultMargins().put_Right(null!==this.TableMargins.Right?Common.Utils.Metric.fnRecalcToMM(this.TableMargins.Right):null),this.TableMargins.isChanged=!0)},this)),this.spinners.push(this.spnTableMarginRight);var e=function(){"indeterminate"==t.CellMargins.Flag?t._changedProps.get_CellMargins().put_Flag(1):"checked"==t.CellMargins.Flag?t._changedProps.get_CellMargins().put_Flag(0):t._changedProps.get_CellMargins().put_Flag(2)};this.chCellMargins=new Common.UI.CheckBox({el:$("#tableadv-checkbox-margins"),value:!0,labelText:this.textCheckMargins}),this.chCellMargins.on("change",_.bind(function(t,i,n,o){"checked"==n&&this._originalProps&&1==this._originalProps.get_CellMargins().get_Flag()&&t.setValue("indeterminate",!0),this.fillMargins.call(this,t.getValue()),this.CellMargins.Flag=t.getValue(),this._changedProps&&(void 0===this._changedProps.get_CellMargins()&&this._changedProps.put_CellMargins(new Asc.CMargins),this._changedProps.get_CellMargins().put_Left(null!==this.CellMargins.Left?Common.Utils.Metric.fnRecalcToMM(this.CellMargins.Left):null),this._changedProps.get_CellMargins().put_Top(null!==this.CellMargins.Top?Common.Utils.Metric.fnRecalcToMM(this.CellMargins.Top):null),this._changedProps.get_CellMargins().put_Bottom(null!==this.CellMargins.Bottom?Common.Utils.Metric.fnRecalcToMM(this.CellMargins.Bottom):null),this._changedProps.get_CellMargins().put_Right(null!==this.CellMargins.Right?Common.Utils.Metric.fnRecalcToMM(this.CellMargins.Right):null),e())},this)),this.spnMarginTop=new Common.UI.MetricSpinner({el:$("#tableadv-number-margin-top"),step:.1,width:85,defaultUnit:"cm",value:"0 cm",maxValue:55.87,minValue:0}),this.spnMarginTop.on("change",_.bind(function(t,i,n,o){this._marginsChange(t,i,n,o,"cell","Top"),this._changedProps&&(void 0===this._changedProps.get_CellMargins()&&this._changedProps.put_CellMargins(new Asc.CMargins),this._changedProps.get_CellMargins().put_Top(null!==this.CellMargins.Top?Common.Utils.Metric.fnRecalcToMM(this.CellMargins.Top):null),e())},this)),this.spinners.push(this.spnMarginTop),this.spnMarginBottom=new Common.UI.MetricSpinner({el:$("#tableadv-number-margin-bottom"),step:.1,width:85,defaultUnit:"cm",value:"0 cm",maxValue:55.87,minValue:0}),this.spnMarginBottom.on("change",_.bind(function(t,i,n,o){this._marginsChange(t,i,n,o,"cell","Bottom"),this._changedProps&&(void 0===this._changedProps.get_CellMargins()&&this._changedProps.put_CellMargins(new Asc.CMargins),this._changedProps.get_CellMargins().put_Bottom(null!==this.CellMargins.Bottom?Common.Utils.Metric.fnRecalcToMM(this.CellMargins.Bottom):null),e())},this)),this.spinners.push(this.spnMarginBottom),this.spnMarginLeft=new Common.UI.MetricSpinner({el:$("#tableadv-number-margin-left"),step:.1,width:85,defaultUnit:"cm",value:"0.19 cm",maxValue:55.87,minValue:0}),this.spnMarginLeft.on("change",_.bind(function(t,i,n,o){this._marginsChange(t,i,n,o,"cell","Left"),this._changedProps&&(void 0===this._changedProps.get_CellMargins()&&this._changedProps.put_CellMargins(new Asc.CMargins),this._changedProps.get_CellMargins().put_Left(null!==this.CellMargins.Left?Common.Utils.Metric.fnRecalcToMM(this.CellMargins.Left):null),e())},this)),this.spinners.push(this.spnMarginLeft),this.spnMarginRight=new Common.UI.MetricSpinner({el:$("#tableadv-number-margin-right"),step:.1,width:85,defaultUnit:"cm",value:"0.19 cm",maxValue:55.87,minValue:0}),this.spnMarginRight.on("change",_.bind(function(t,i,n,o){this._marginsChange(t,i,n,o,"cell","Right"),this._changedProps&&(void 0===this._changedProps.get_CellMargins()&&this._changedProps.put_CellMargins(new Asc.CMargins),this._changedProps.get_CellMargins().put_Right(null!==this.CellMargins.Right?Common.Utils.Metric.fnRecalcToMM(this.CellMargins.Right):null),e())},this)),this.spinners.push(this.spnMarginRight),this.inputAltTitle=new Common.UI.InputField({el:$("#tableadv-alt-title"),allowBlank:!0,validateOnBlur:!1,style:"width: 100%;"}).on("changed:after",function(){t.isAltTitleChanged=!0}),this.textareaAltDescription=this.$window.find("textarea"),this.textareaAltDescription.keydown(function(e){e.keyCode==Common.UI.Keys.RETURN&&e.stopPropagation(),t.isAltDescChanged=!0}),this.afterRender()},getFocusedComponents:function(){return[this.spnMarginTop,this.spnMarginLeft,this.spnMarginBottom,this.spnMarginRight,this.spnTableMarginTop,this.spnTableMarginLeft,this.spnTableMarginBottom,this.spnTableMarginRight,this.inputAltTitle,this.textareaAltDescription]},onCategoryClick:function(t,e){Common.Views.AdvancedSettingsWindow.prototype.onCategoryClick.call(this,t,e);var i=this;setTimeout(function(){switch(e){case 0:i.spnMarginTop.isDisabled()?i.spnTableMarginTop.focus():i.spnMarginTop.focus();break;case 1:i.inputAltTitle.focus()}},10)},afterRender:function(){if(this.updateMetricUnit(),this._setDefaults(this._originalProps),this.storageName){var t=Common.localStorage.getItem(this.storageName);this.setActiveCategory(null!==t?parseInt(t):0)}},getSettings:function(){return this.isAltTitleChanged&&this._changedProps.put_TableCaption(this.inputAltTitle.getValue()),this.isAltDescChanged&&this._changedProps.put_TableDescription(this.textareaAltDescription.val()),{tableProps:this._changedProps}},_setDefaults:function(t){if(t){this._allTable=!t.get_CellSelect();var e=t.get_DefaultMargins();e&&(this.TableMargins={Left:null!==e.get_Left()?Common.Utils.Metric.fnRecalcFromMM(e.get_Left()):null,Right:null!==e.get_Right()?Common.Utils.Metric.fnRecalcFromMM(e.get_Right()):null,Top:null!==e.get_Top()?Common.Utils.Metric.fnRecalcFromMM(e.get_Top()):null,Bottom:null!==e.get_Bottom()?Common.Utils.Metric.fnRecalcFromMM(e.get_Bottom()):null}),e=t.get_CellMargins();var i=void 0;e&&(this.CellMargins={Left:null!==e.get_Left()?Common.Utils.Metric.fnRecalcFromMM(e.get_Left()):null,Right:null!==e.get_Right()?Common.Utils.Metric.fnRecalcFromMM(e.get_Right()):null,Top:null!==e.get_Top()?Common.Utils.Metric.fnRecalcFromMM(e.get_Top()):null,Bottom:null!==e.get_Bottom()?Common.Utils.Metric.fnRecalcFromMM(e.get_Bottom()):null},i=e.get_Flag(),this.CellMargins.Flag=1==i?"indeterminate":0==i?"checked":"unchecked",this.chCellMargins.setValue(this.CellMargins.Flag,!0)),0===i&&(null===this.CellMargins.Left&&(this.CellMargins.Left=this.TableMargins.Left),null===this.CellMargins.Top&&(this.CellMargins.Top=this.TableMargins.Top),null===this.CellMargins.Right&&(this.CellMargins.Right=this.TableMargins.Right),null===this.CellMargins.Bottom&&(this.CellMargins.Bottom=this.TableMargins.Bottom)),this.fillMargins(this.CellMargins.Flag);var n=t.get_TableCaption();this.inputAltTitle.setValue(n||""),n=t.get_TableDescription(),this.textareaAltDescription.val(n||""),this._changedProps=new Asc.CTableProp}},fillMargins:function(t){this._initialMarginsDefault&&"unchecked"==t&&(null===this.CellMargins.Left&&(this.CellMargins.Left=0),null===this.CellMargins.Top&&(this.CellMargins.Top=0),null===this.CellMargins.Right&&(this.CellMargins.Right=0),null===this.CellMargins.Bottom&&(this.CellMargins.Bottom=0)),this.spnMarginLeft.setValue(null!==this.CellMargins.Left?this.CellMargins.Left:"",!0),this.spnMarginTop.setValue(null!==this.CellMargins.Top?this.CellMargins.Top:"",!0),this.spnMarginRight.setValue(null!==this.CellMargins.Right?this.CellMargins.Right:"",!0),this.spnMarginBottom.setValue(null!==this.CellMargins.Bottom?this.CellMargins.Bottom:"",!0);var e="checked"==t;this.spnMarginTop.setDisabled(e),this.spnMarginBottom.setDisabled(e),this.spnMarginLeft.setDisabled(e),this.spnMarginRight.setDisabled(e),this.spnTableMarginLeft.setValue(null!==this.TableMargins.Left?this.TableMargins.Left:"",!0),this.spnTableMarginTop.setValue(null!==this.TableMargins.Top?this.TableMargins.Top:"",!0),this.spnTableMarginRight.setValue(null!==this.TableMargins.Right?this.TableMargins.Right:"",!0),this.spnTableMarginBottom.setValue(null!==this.TableMargins.Bottom?this.TableMargins.Bottom:"",!0)},updateMetricUnit:function(){if(this.spinners)for(var t=0;t',n.id)),t(i.el).append(c)),n.render(c),n.cmpEl.attr({tabindex:"-1"})),c.css({left:r[0],top:r[1]}),n.show(),e.isFunction(n.options.initMenu)&&(n.options.initMenu(o),n.alignPosition()),e.delay(function(){n.cmpEl.focus()},10),i.currentMenu=n}},s=function(t){if(t&&e.isArray(t)){var n={},o=null;return e.each(t,function(t,s){var a=t.get_ObjectType(),l=t.get_ObjectValue();Asc.c_oAscTypeSelectElement.Image==a?(o=i.pictureMenu,n.imgProps={},n.imgProps.value=l,n.imgProps.locked=!!l&&l.get_Locked()):Asc.c_oAscTypeSelectElement.Table==a?(o=i.tableMenu,n.tableProps={},n.tableProps.value=l,n.tableProps.locked=!!l&&l.get_Locked()):Asc.c_oAscTypeSelectElement.Hyperlink==a?(n.hyperProps={},n.hyperProps.value=l):Asc.c_oAscTypeSelectElement.Shape==a?(o=i.pictureMenu,n.shapeProps={},n.shapeProps.value=l,n.shapeProps.locked=!!l&&l.get_Locked(),l.get_FromChart()&&(n.shapeProps.isChart=!0)):Asc.c_oAscTypeSelectElement.Chart==a?(o=i.pictureMenu,n.chartProps={},n.chartProps.value=l,n.chartProps.locked=!!l&&l.get_Locked()):Asc.c_oAscTypeSelectElement.Slide==a?(n.slideProps={},n.slideProps.value=l,n.slideProps.locked=!!l&&l.get_LockDelete()):Asc.c_oAscTypeSelectElement.Paragraph==a?(n.paraProps={},n.paraProps.value=l,n.paraProps.locked=!!l&&l.get_Locked(),(n.shapeProps&&n.shapeProps.value||n.chartProps&&n.chartProps.value)&&e.isUndefined(n.tableProps)&&(o=i.textMenu)):Asc.c_oAscTypeSelectElement.SpellCheck==a?(n.spellProps={},n.spellProps.value=l,i._currentSpellObj=l):Asc.c_oAscTypeSelectElement.Math==a&&(n.mathProps={},n.mathProps.value=l,i._currentMathObj=l)}),null===o&&(e.isUndefined(n.paraProps)?e.isUndefined(n.slideProps)||(o=i.slideMenu):o=i.textMenu),{menu_to_show:o,menu_props:n}}},a=function(t){if(t&&e.isArray(t)){i.viewModeMenu||i.createDelayedElementsViewer();var n={},o=null;return e.each(t,function(t,e){var s=t.get_ObjectType(),a=t.get_ObjectValue();Asc.c_oAscTypeSelectElement.Image==s||Asc.c_oAscTypeSelectElement.Table==s||Asc.c_oAscTypeSelectElement.Shape==s||Asc.c_oAscTypeSelectElement.Chart==s||Asc.c_oAscTypeSelectElement.Paragraph==s?(o=i.viewModeMenu,n.locked=n.locked||!!a&&a.get_Locked(),Asc.c_oAscTypeSelectElement.Chart==s&&(n.isChart=!0)):Asc.c_oAscTypeSelectElement.Slide==s&&(n.locked=n.locked||!!a&&a.get_LockDelete())}),o?{menu_to_show:o,menu_props:n}:null}},l=function(t,e,n){if(i.api){var l=i.mode.isEdit&&!i._isDisabled?s(i.api.getSelectedElements()):a(i.api.getSelectedElements());l&&o(l.menu_to_show,l.menu_props,t)}},r=function(t){e.delay(function(){t.get_Type()==Asc.c_oAscContextMenuTypes.Thumbnails?o.call(i,i.mode.isEdit&&!i._isDisabled?i.slideMenu:i.viewModeMenuSlide,{isSlideSelect:t.get_IsSlideSelect(),isSlideHidden:t.get_IsSlideHidden(),fromThumbs:!0},t):l.call(i,t)},10)},c=function(t){if(i.currentMenu&&i.currentMenu.isVisible())if(0===i.api.asc_getCurrentFocusObject()){if(i.slideMenu===i.currentMenu&&!i._isDisabled){var n=!1;e.each(t,function(t,e){Asc.c_oAscTypeSelectElement.Slide==t.get_ObjectType()&&(n=t.get_ObjectValue().get_IsHidden())}),i.currentMenu.options.initMenu({isSlideSelect:i.slideMenu.items[2].isVisible(),isSlideHidden:n,fromThumbs:!0}),i.currentMenu.alignPosition()}}else{var o=i.mode.isEdit&&!i._isDisabled?s(t):a(t);o&&o.menu_to_show===i.currentMenu&&(i.currentMenu.options.initMenu(o.menu_props),i.currentMenu.alignPosition())}},d=function(t){if(i.api){var n=e.isUndefined(t.originalEvent)?t.wheelDelta:t.originalEvent.wheelDelta;e.isUndefined(n)&&(n=t.deltaY),!t.ctrlKey&&!t.metaKey||t.altKey||(n<0?i.api.zoomOut():n>0&&i.api.zoomIn(),t.preventDefault(),t.stopPropagation())}},h=function(e){if(i.api){var n=e.keyCode;if((e.ctrlKey||e.metaKey)&&!e.shiftKey&&!e.altKey){if(n===Common.UI.Keys.NUM_PLUS||n===Common.UI.Keys.EQUALITY||Common.Utils.isGecko&&n===Common.UI.Keys.EQUALITY_FF||Common.Utils.isOpera&&43==n)return i.api.zoomIn(),e.preventDefault(),e.stopPropagation(),!1;if(n===Common.UI.Keys.NUM_MINUS||n===Common.UI.Keys.MINUS||Common.Utils.isGecko&&n===Common.UI.Keys.MINUS_FF||Common.Utils.isOpera&&45==n)return i.api.zoomOut(),e.preventDefault(),e.stopPropagation(),!1;if(48===n||96===n)return i.api.zoomFitToPage(),e.preventDefault(),e.stopPropagation(),!1}i.currentMenu&&i.currentMenu.isVisible()&&(n!=Common.UI.Keys.UP&&n!=Common.UI.Keys.DOWN||t("ul.dropdown-menu",i.currentMenu.el).focus()),n==Common.UI.Keys.ESC&&(Common.UI.Menu.Manager.hideAll(),Common.NotificationCenter.trigger("leftmenu:change","hide"))}},p=function(){i._Height=i.cmpEl.height(),i._Width=i.cmpEl.width(),i._BodyWidth=t("body").width(),i._XY=void 0,i.slideNumDiv&&(i.slideNumDiv.remove(),i.slideNumDiv=void 0)},u=function(e){var n=i.cmpEl;if(n){n.on("contextmenu",function(t){return t.preventDefault(),t.stopPropagation(),!1}),n.on("click",function(t){"canvas"==t.target.localName&&(i._preventClick?i._preventClick=!1:n.focus())}),n.on("mousedown",function(t){"canvas"==t.target.localName&&Common.UI.Menu.Manager.hideAll()});var o=/Firefox/i.test(navigator.userAgent)?"DOMMouseScroll":"mousewheel";!function(t,e,i){t.addEventListener?t.addEventListener(e,i,!1):t.attachEvent("on"+e,i)}(i.el,o,d)}t(document).on("mousewheel",d),t(document).on("keydown",h),t(window).on("resize",p),PE.getController("Viewport").getView("Viewport").hlayout.on("layout:resizedrag",p)},m=function(t){if(n){var e=n.findUser(t);if(e)return Common.Utils.UserInfoParser.getParsedName(e.get("username"))}return i.guestText},g={toolTip:new Common.UI.Tooltip({owner:this,html:!0,title:"
    Press Ctrl and click link"}),strTip:"",isHidden:!0,isVisible:!1},f=!0,b=function(t,e,n){!0===f&&(f=new Common.UI.Tooltip({owner:t.currentTarget,title:i.tipIsLocked}),f.show())},C=function(){if("object"==typeof f){f.hide(),f=void 0;for(var t=0;t0&&("object"==typeof f&&(f.hide(),f=!0),e.each(i.usertips,function(t){t.remove()})),i.usertips=[],i.usertipcount=0},w=function(){g.isHidden&&g.isVisible&&(g.isVisible=!1,g.toolTip.hide())},x=function(n){if(e.isUndefined(i._XY)&&(i._XY=[i.cmpEl.offset().left-t(window).scrollLeft(),i.cmpEl.offset().top-t(window).scrollTop()],i._Width=i.cmpEl.width(),i._Height=i.cmpEl.height(),i._BodyWidth=t("body").width()),n){var o,s;if(1==n.get_Type()){var a=n.get_Hyperlink(),l=!1;a&&(g.isHidden=!1,s=e.isEmpty(a.get_ToolTip())?a.get_Value():a.get_ToolTip(),s=Common.Utils.String.htmlEncode(s),(g.tipLength!==s.length||g.strTip.indexOf(s)<0)&&(g.toolTip.setTitle(s+"
    "+i.txtPressLink+""),g.tipLength=s.length,g.strTip=s,l=!0),o=[n.get_X(),n.get_Y()],o[1]+=i._XY[1]-15,o[0]+=i._XY[0]+5,g.isVisible&&!l||(g.isVisible=!0,g.toolTip.show([-1e4,-1e4])),l&&(g.tipHeight=g.toolTip.getBSTip().$tip.height(),g.tipWidth=g.toolTip.getBSTip().$tip.width()),o[1]-=g.tipHeight,o[0]+g.tipWidth>i._BodyWidth&&(o[0]=i._BodyWidth-g.tipWidth),g.toolTip.getBSTip().$tip.css({top:o[1]+"px",left:o[0]+"px"}))}else if(2==n.get_Type()&&i.mode.isEdit){var r;i.usertipcount>=i.usertips.length&&(r=t(document.createElement("div")),r.addClass("username-tip"),r.css({height:i._TtHeight+"px",position:"absolute",zIndex:"900",visibility:"visible"}),t(document.body).append(r),f&&(r.on("mouseover",b),r.on("mouseout",v)),i.usertips.push(r)),r=i.usertips[i.usertipcount],i.usertipcount++,s=m(n.get_UserId()),o=[n.get_X()+i._XY[0],n.get_Y()+i._XY[1]];var c=o[0];o[0]=i._BodyWidth-o[0],o[1]-=2==n.get_LockedObjectType()?i._TtHeight:0,o[1]>i._XY[1]&&o[1]+i._TtHeight-1&&!t.items[n].checked&&t.setChecked(n,!0)}};var M=function(){var t,n=i.api.getSelectedElements(!0);if(n&&e.isArray(n))for(var o=0;o0?(n.setVisible(l.length>3),n.setDisabled(i._currentParaObjDisabled),e.each(l,function(t,e){var n=new Common.UI.MenuItem({caption:t,spellword:!0,disabled:i._currentParaObjDisabled}).on("click",function(t,e){i.api&&(i.api.asc_replaceMisspelledWord(t.caption,i._currentSpellObj),i.fireEvent("editcomplete",i))});e<3?s.push(n):a.push(n)}),s.length>0&&(t?e.each(s,function(t,e){i.textMenu.insertItem(e,t)}):e.each(s,function(t,e){i.menuSpellCheckTable.menu.insertItem(e,t)})),a.length>0&&e.each(a,function(t,e){n.menu.addItem(t)}),o.setVisible(!1)):(n.setVisible(!1),o.setVisible(!0),o.setCaption(i.noSpellVariantsText,!0))}},this.clearWordVariants=function(t){for(var e=t?i.textMenu:i.menuSpellCheckTable.menu,n=0;n0&&e.each(s,function(t,s){t.menu?e.each(t.menu.items,function(t){t.on("click",e.bind(i.equationCallback,i,t.options.equationProps))}):t.on("click",e.bind(i.equationCallback,i,t.options.equationProps)),o.insertItem(n,t),n++}),s.length},this.clearEquationMenu=function(t,n){for(var o=t?i.textMenu:i.tableMenu,s=n;s0&&i.addComment()};U["command+f5,ctrl+f5"]=function(t){t.preventDefault(),t.stopPropagation(),i.slidesCount>0&&Common.NotificationCenter.trigger("preview:start",0)},Common.util.Shortcuts.delegateShortcuts({shortcuts:U});var D=function(){i.slidesCount>0&&Common.NotificationCenter.trigger("preview:start",0)},L=function(t){i.slidesCount=t},F=function(t){i.currentMenu&&i.currentMenu.isVisible()&&!0!==i._isFromSlideMenu&&i._isFromSlideMenu!==t&&i.currentMenu.hide(),i._isFromSlideMenu=t},V=function(t){i._state.themeId=t},B=function(){i._state.themeLock=!0},R=function(){i._state.themeLock=!1},O=function(n){var o=n.asc_getCellCoord(),s=i.cmpEl.find("#special-paste-container"),a=n.asc_getOptions();if(a){if(s.length<1&&(i._arrSpecialPaste=[],i._arrSpecialPaste[Asc.c_oSpecialPasteProps.paste]=i.textPaste,i._arrSpecialPaste[Asc.c_oSpecialPasteProps.keepTextOnly]=i.txtKeepTextOnly,i._arrSpecialPaste[Asc.c_oSpecialPasteProps.picture]=i.txtPastePicture,i._arrSpecialPaste[Asc.c_oSpecialPasteProps.sourceformatting]=i.txtPasteSourceFormat,i._arrSpecialPaste[Asc.c_oSpecialPasteProps.destinationFormatting]=i.txtPasteDestFormat,s=t('
    '),i.cmpEl.append(s),i.btnSpecialPaste=new Common.UI.Button({parentEl:t("#id-document-holder-btn-special-paste"),cls:"btn-toolbar",iconCls:"toolbar__icon btn-paste",menu:new Common.UI.Menu({items:[]})})),a.length>0){for(var l=i.btnSpecialPaste.menu,r=0;r0&&l.items[0].setChecked(!0,!0)}if(o.asc_getX()<0||o.asc_getY()<0)s.is(":visible")&&s.hide();else{var c=[o.asc_getX()+o.asc_getWidth()+3,o.asc_getY()+o.asc_getHeight()+3];s.css({left:c[0],top:c[1]}),s.show()}}},N=function(){var t=i.cmpEl.find("#special-paste-container");t.is(":visible")&&t.hide()},G=function(t){this.menuImgCrop.menu.items[0].setChecked(t,!0)};this.setApi=function(t){return i.api=t,i.api&&(i.api.asc_registerCallback("asc_onContextMenu",e.bind(r,i)),i.api.asc_registerCallback("asc_onMouseMoveStart",e.bind(y,i)),i.api.asc_registerCallback("asc_onMouseMoveEnd",e.bind(w,i)),i.api.asc_registerCallback("asc_onPaintSlideNum",e.bind(k,i)),i.api.asc_registerCallback("asc_onEndPaintSlideNum",e.bind(I,i)),i.api.asc_registerCallback("asc_onCountPages",e.bind(L,i)),i.api.asc_registerCallback("asc_onCurrentPage",e.bind(F,i)),i.slidesCount=i.api.getCountPages(),i.api.asc_registerCallback("asc_onHyperlinkClick",e.bind(_,i)),i.api.asc_registerCallback("asc_onMouseMove",e.bind(x,i)),!0===i.mode.isEdit&&(i.api.asc_registerCallback("asc_onDialogAddHyperlink",e.bind(T,i)),i.api.asc_registerCallback("asc_doubleClickOnChart",e.bind(i.editChartClick,i)),i.api.asc_registerCallback("asc_onSpellCheckVariantsFound",e.bind(M,i)),i.api.asc_registerCallback("asc_onShowSpecialPasteOptions",e.bind(O,i)),i.api.asc_registerCallback("asc_onHideSpecialPasteOptions",e.bind(N,i)),i.api.asc_registerCallback("asc_ChangeCropState",e.bind(G,i)),i.api.asc_registerCallback("asc_onHidePlaceholderActions",e.bind(i.onHidePlaceholderActions,i)),i.api.asc_registerPlaceholderCallback(AscCommon.PlaceholderButtonType.Image,e.bind(i.onInsertImage,i,!0)),i.api.asc_registerPlaceholderCallback(AscCommon.PlaceholderButtonType.ImageUrl,e.bind(i.onInsertImageUrl,i,!0)),i.api.asc_registerPlaceholderCallback(AscCommon.PlaceholderButtonType.Chart,e.bind(i.onClickPlaceholderChart,i)),i.api.asc_registerPlaceholderCallback(AscCommon.PlaceholderButtonType.Table,e.bind(i.onClickPlaceholderTable,i)),i.api.asc_registerPlaceholderCallback(AscCommon.PlaceholderButtonType.Video,e.bind(i.onClickPlaceholder,i,AscCommon.PlaceholderButtonType.Video)),i.api.asc_registerPlaceholderCallback(AscCommon.PlaceholderButtonType.Audio,e.bind(i.onClickPlaceholder,i,AscCommon.PlaceholderButtonType.Audio))),i.api.asc_registerCallback("asc_onCoAuthoringDisconnect",e.bind(E,i)),Common.NotificationCenter.on("api:disconnect",e.bind(E,i)),i.api.asc_registerCallback("asc_onTextLanguage",e.bind(P,i)),i.api.asc_registerCallback("asc_onShowForeignCursorLabel",e.bind(S,i)),i.api.asc_registerCallback("asc_onHideForeignCursorLabel",e.bind(A,i)),i.api.asc_registerCallback("asc_onFocusObject",e.bind(c,i)),i.api.asc_registerCallback("asc_onUpdateThemeIndex",e.bind(V,i)),i.api.asc_registerCallback("asc_onLockDocumentTheme",e.bind(B,i)),i.api.asc_registerCallback("asc_onUnLockDocumentTheme",e.bind(R,i)),i.api.asc_registerCallback("asc_onStartDemonstration",e.bind(D))),i},this.mode={},this.setMode=function(t){i.mode=t,i.mode.canCoAuthoring&&i.mode.canComments?Common.util.Shortcuts.resumeEvents("alt+h"):Common.util.Shortcuts.suspendEvents("alt+h"),i.editorConfig={user:t.user}},i.on("render:after",u,i)},render:function(){return this.fireEvent("render:before",this),this.cmpEl=t(this.el),this.fireEvent("render:after",this),this},focus:function(){var t=this;e.defer(function(){t.cmpEl.focus()},50)},addHyperlink:function(t){var e,i=this;if(i.api){for(var n=[],o=0;o0){var i=e.dataViewItems,n=t(i[0].el),o=n.outerWidth()+parseInt(n.css("margin-left"))+parseInt(n.css("margin-right")),s=Math.floor(e.options.restoreWidth/o+.5)||1,a=0,l=0;e.cmpEl.width(o*s+11);for(var r=0;rl?l=d:c.css({height:l}),a++,a>s-1&&(a=0,l=0)}e._needRecalcSlideLayout=!1}},addToLayout:function(){this.api&&this.api.asc_AddToLayout()},createDelayedElementsViewer:function(){var t=this,i=new Common.UI.MenuItem({iconCls:"menu__icon btn-copy",caption:t.textCopy,value:"copy"}).on("click",e.bind(t.onCutCopyPaste,t)),n=new Common.UI.MenuItem({iconCls:"menu__icon btn-undo",caption:t.textUndo}).on("click",function(){t.api.Undo()}),o=new Common.UI.MenuItem({caption:"--"}),s=new Common.UI.MenuItem({iconCls:"menu__icon btn-menu-comments",caption:t.addCommentText}).on("click",e.bind(t.addComment,t));this.viewModeMenu=new Common.UI.Menu({cls:"shifted-right",initMenu:function(e){n.setVisible(t.mode.canCoAuthoring&&t.mode.canComments&&!t._isDisabled),n.setDisabled(!t.api.asc_getCanUndo()&&!t._isDisabled),o.setVisible(!e.isChart&&!1!==t.api.can_AddQuotedComment()&&t.mode.canCoAuthoring&&t.mode.canComments&&!t._isDisabled),s.setVisible(!e.isChart&&!1!==t.api.can_AddQuotedComment()&&t.mode.canCoAuthoring&&t.mode.canComments&&!t._isDisabled),s.setDisabled(e.locked)},items:[i,n,o,s]}).on("hide:after",function(e,i,n){if(t.suppressEditComplete)return void(t.suppressEditComplete=!1);n||t.fireEvent("editcomplete",t),t.currentMenu=null});var a=new Common.UI.MenuItem({iconCls:"menu__icon btn-preview",caption:t.txtPreview}).on("click",function(i){var n=t.api.getCurrentPage();Common.NotificationCenter.trigger("preview:start",e.isNumber(n)?n:0)}),l=new Common.UI.MenuItem({caption:t.txtSelectAll}).on("click",function(e){t.api&&(t.api.SelectAllSlides(),t.fireEvent("editcomplete",t),Common.component.Analytics.trackEvent("DocumentHolder","Select All Slides"))}),r=new Common.UI.MenuItem({iconCls:"menu__icon btn-print",caption:t.txtPrintSelection}).on("click",function(e){if(t.api){var i=new Asc.asc_CAdjustPrint;i.asc_setPrintType(Asc.c_oAscPrintType.Selection);var n=new Asc.asc_CDownloadOptions(null,Common.Utils.isChrome||Common.Utils.isSafari||Common.Utils.isOpera);n.asc_setAdvancedOptions(i),t.api.asc_Print(n),t.fireEvent("editcomplete",t),Common.component.Analytics.trackEvent("DocumentHolder","Print Selection")}});this.viewModeMenuSlide=new Common.UI.Menu({cls:"shifted-right",initMenu:function(e){l.setDisabled(t.slidesCount<2),r.setVisible(t.mode.canPrint&&!0===e.fromThumbs),r.setDisabled(t.slidesCount<1),a.setDisabled(t.slidesCount<1)},items:[l,r,{caption:"--"},a]}).on("hide:after",function(e,i,n){if(t.suppressEditComplete)return void(t.suppressEditComplete=!1);n||t.fireEvent("editcomplete",t),t.currentMenu=null})},createDelayedElements:function(){var i=this,n=new Common.UI.MenuItem({caption:i.txtDeleteSlide}).on("click",function(t){i.api&&(i._isFromSlideMenu=!0,i.api.DeleteSlide(),i.fireEvent("editcomplete",i),Common.component.Analytics.trackEvent("DocumentHolder","Delete Slide"))}),o=new Common.UI.MenuItem({iconCls:"menu__icon btn-changeslide",caption:i.txtChangeLayout,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{template:e.template('')}]})}),s=new Common.UI.MenuItem({caption:i.txtResetLayout}).on("click",function(t){i.api&&(i.api.ResetSlide(),i.fireEvent("editcomplete",i),Common.component.Analytics.trackEvent("DocumentHolder","Reset Slide"))}),a=new Common.UI.MenuItem({caption:i.txtChangeTheme,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{template:e.template('
    ')}]})}),l=new Common.UI.MenuItem({iconCls:"menu__icon btn-preview",caption:i.txtPreview}).on("click",function(t){var n=i.api.getCurrentPage();Common.NotificationCenter.trigger("preview:start",e.isNumber(n)?n:0)}),r=new Common.UI.MenuItem({caption:i.txtSelectAll}).on("click",function(t){i.api&&(i.api.SelectAllSlides(),i.fireEvent("editcomplete",i),Common.component.Analytics.trackEvent("DocumentHolder","Select All Slides"))}),c=new Common.UI.MenuItem({iconCls:"menu__icon btn-print",caption:i.txtPrintSelection}).on("click",function(t){if(i.api){var e=new Asc.asc_CAdjustPrint;e.asc_setPrintType(Asc.c_oAscPrintType.Selection);var n=new Asc.asc_CDownloadOptions(null,Common.Utils.isChrome||Common.Utils.isSafari||Common.Utils.isOpera);n.asc_setAdvancedOptions(e),i.api.asc_Print(n),i.fireEvent("editcomplete",i),Common.component.Analytics.trackEvent("DocumentHolder","Print Selection")}}),d=new Common.UI.MenuItem({iconCls:"menu__icon btn-paste",caption:i.textPaste,value:"paste"}).on("click",e.bind(i.onCutCopyPaste,i)),h=new Common.UI.MenuItem({iconCls:"menu__icon btn-menu-slide",caption:i.textSlideSettings,value:null}).on("click",function(t){PE.getController("RightMenu").onDoubleClickOnObject(t.options.value)}),p=new Common.UI.MenuItem({caption:i.txtSlideHide,checkable:!0,checked:!1}).on("click",function(t){i.api&&(i.api.asc_HideSlides(t.checked),i.fireEvent("editcomplete",i),Common.component.Analytics.trackEvent("DocumentHolder","Hide Slides"))});i.slideMenu=new Common.UI.Menu({cls:"shifted-right",initMenu:function(t){d.setVisible(!0!==t.fromThumbs),i.slideMenu.items[1].setVisible(!0===t.fromThumbs),i.slideMenu.items[2].setVisible(!0===t.isSlideSelect),n.setVisible(!0===t.isSlideSelect),p.setVisible(!0===t.isSlideSelect),p.setChecked(!0===t.isSlideHidden),i.slideMenu.items[5].setVisible(!0===t.isSlideSelect||!0!==t.fromThumbs),o.setVisible(!0===t.isSlideSelect||!0!==t.fromThumbs),s.setVisible(!0===t.isSlideSelect||!0!==t.fromThumbs),a.setVisible(!0===t.isSlideSelect||!0!==t.fromThumbs),h.setVisible(!0===t.isSlideSelect||!0!==t.fromThumbs),h.options.value=null;for(var u=10;u<15;u++)i.slideMenu.items[u].setVisible(!0===t.fromThumbs);c.setVisible(i.mode.canPrint&&!0===t.fromThumbs);var m=i.api.getSelectedElements(),g=!1,f=!1,b=!1;m&&e.isArray(m)&&e.each(m,function(t,e){if(Asc.c_oAscTypeSelectElement.Slide==t.get_ObjectType()){var n=t.get_ObjectValue();return g=n.get_LockDelete(),f=n.get_LockRemove(),b=n.get_LockLayout(),h.options.value=t,i.slideLayoutMenu.options.layout_index=n.get_LayoutIndex(),!1}});for(var u=0;u<3;u++)i.slideMenu.items[u].setDisabled(g);l.setDisabled(i.slidesCount<1),r.setDisabled(i.slidesCount<2),n.setDisabled(f||g),o.setDisabled(b||g),s.setDisabled(b||g),a.setDisabled(i._state.themeLock||g),p.setDisabled(b||g),c.setDisabled(i.slidesCount<1)},items:[d,new Common.UI.MenuItem({caption:i.txtNewSlide}).on("click",function(t){i.api&&(i._isFromSlideMenu=!0,i.api.AddSlide(),i.fireEvent("editcomplete",i),Common.component.Analytics.trackEvent("DocumentHolder","Add Slide"))}),new Common.UI.MenuItem({caption:i.txtDuplicateSlide}).on("click",function(t){i.api&&(i._isFromSlideMenu=!0,i.api.DublicateSlide(),i.fireEvent("editcomplete",i),Common.component.Analytics.trackEvent("DocumentHolder","Dublicate Hyperlink"))}),n,p,{caption:"--"},o,s,a,h,{caption:"--"},r,c,{caption:"--"},l]}).on("hide:after",function(t,e,n){if(i.suppressEditComplete)return void(i.suppressEditComplete=!1);n||i.fireEvent("editcomplete",i),i.currentMenu=null}).on("render:after",function(n){i.slideLayoutMenu=new Common.UI.DataView({el:t("#id-docholder-menu-changeslide"),parentMenu:o.menu,style:"max-height: 300px;",restoreWidth:302,store:PE.getCollection("SlideLayouts"),itemTemplate:e.template(['
    ','
    ','
    <%= title %>
    ',"
    "].join(""))}).on("item:click",function(t,e,n,o){i.api&&(i.api.ChangeLayout(n.get("data").idx),"click"!==o.type&&i.slideMenu.hide(),i.fireEvent("editcomplete",i),Common.component.Analytics.trackEvent("DocumentHolder","Change Layout"))}),i.slideMenu&&o.menu.on("show:after",function(t){i.onSlidePickerShowAfter(i.slideLayoutMenu),i.slideLayoutMenu.scroller.update({alwaysVisibleY:!0});var e=i.slideLayoutMenu.store.findLayoutByIndex(i.slideLayoutMenu.options.layout_index);e&&(i.slideLayoutMenu.selectRecord(e,!0),i.slideLayoutMenu.scrollToRecord(e))}),i.slideLayoutMenu._needRecalcSlideLayout=!0,i.listenTo(PE.getCollection("SlideLayouts"),"reset",function(){i.slideLayoutMenu._needRecalcSlideLayout=!0}),i.slideThemeMenu=new Common.UI.DataView({el:t("#id-docholder-menu-changetheme"),parentMenu:a.menu,style:"max-height: 300px;",store:PE.getCollection("SlideThemes"),itemTemplate:e.template(['
    ','
    background-image: url(<%= imageUrl %>);<% } %> background-position: 0 -<%= offsety %>px;">
    ',"
    "].join(""))}).on("item:click",function(t,e,n,o){i.api&&(i.api.ChangeTheme(n.get("themeId"),!0),"click"!==o.type&&i.slideMenu.hide(),i.fireEvent("editcomplete",i),Common.component.Analytics.trackEvent("DocumentHolder","Change Theme"))}),i.slideMenu&&a.menu.on("show:after",function(t){var e=i.slideThemeMenu.store.findWhere({themeId:i._state.themeId});i.slideThemeMenu.selectRecord(e,!0),i.slideThemeMenu.scroller.update({alwaysVisibleY:!0}),i.slideThemeMenu.scroller.scrollTop(0)})});var u=new Common.UI.MenuItem({iconCls:"menu__icon btn-merge",caption:i.mergeCellsText}).on("click",function(t){i.api&&i.api.MergeCells()}),m=new Common.UI.MenuItem({caption:i.splitCellsText}).on("click",function(t){i.api&&new Common.Views.InsertTableDialog({split:!0,handler:function(t,e){"ok"==t&&(i.api&&i.api.SplitCell(e.columns,e.rows),Common.component.Analytics.trackEvent("DocumentHolder","Table Split")),i.fireEvent("editcomplete",i)}}).show()}),g=new Common.UI.MenuItem({iconCls:"menu__icon btn-align-top",caption:i.cellAlignText,menu:function(){function t(t,e){if(i.api){var n=new Asc.CTableProp;n.put_CellsVAlign(t.value),i.api.tblApply(n)}i.fireEvent("editcomplete",i),Common.component.Analytics.trackEvent("DocumentHolder","Table Cell Align")}return new Common.UI.Menu({cls:"shifted-right",menuAlign:"tl-tr",items:[i.menuTableCellTop=new Common.UI.MenuItem({iconCls:"menu__icon btn-align-top",caption:i.textShapeAlignTop,checkable:!0,checkmark:!1,toggleGroup:"popuptablecellalign",value:Asc.c_oAscVertAlignJc.Top}).on("click",e.bind(t,i)),i.menuTableCellCenter=new Common.UI.MenuItem({iconCls:"menu__icon btn-align-middle",caption:i.textShapeAlignMiddle,checkable:!0,checkmark:!1,toggleGroup:"popuptablecellalign",value:Asc.c_oAscVertAlignJc.Center}).on("click",e.bind(t,i)),i.menuTableCellBottom=new Common.UI.MenuItem({iconCls:"menu__icon btn-align-bottom",caption:i.textShapeAlignBottom,checkable:!0,checkmark:!1,toggleGroup:"popuptablecellalign",value:Asc.c_oAscVertAlignJc.Bottom}).on("click",e.bind(t,i))]})}()}),f=new Common.UI.MenuItem({caption:i.textDistributeRows}).on("click",e.bind(function(){i.api&&i.api.asc_DistributeTableCells(!1),i.fireEvent("editcomplete",i)},i)),b=new Common.UI.MenuItem({caption:i.textDistributeCols}).on("click",e.bind(function(){i.api&&i.api.asc_DistributeTableCells(!0),i.fireEvent("editcomplete",i)},i));i.menuSpellTable=new Common.UI.MenuItem({caption:i.loadSpellText,disabled:!0}),i.menuSpellMoreTable=new Common.UI.MenuItem({caption:i.moreText,menu:new Common.UI.Menu({cls:"shifted-right",menuAlign:"tl-tr",restoreHeight:!0,items:[]})});var C=e.template(['','',"<%= caption %>",""].join(""));i.langTableMenu=new Common.UI.MenuItem({iconCls:"menu__icon btn-ic-doclang",caption:i.langText,menu:new Common.UI.MenuSimple({cls:"lang-menu",menuAlign:"tl-tr",restoreHeight:285,items:[],itemTemplate:C,search:!0})});var v=new Common.UI.MenuItem({caption:i.ignoreSpellText}).on("click",function(t){i.api&&(i.api.asc_ignoreMisspelledWord(i._currentSpellObj,!1),i.fireEvent("editcomplete",i))}),_=new Common.UI.MenuItem({caption:i.ignoreAllSpellText}).on("click",function(t){i.api&&(i.api.asc_ignoreMisspelledWord(i._currentSpellObj,!0),i.fireEvent("editcomplete",i))}),y=new Common.UI.MenuItem({caption:i.toDictionaryText}).on("click",function(t,e){i.api.asc_spellCheckAddToDictionary(i._currentSpellObj),i.fireEvent("editcomplete",i)}),w=new Common.UI.MenuItem({caption:"--"}),x=new Common.UI.MenuItem({caption:"--"});i.menuSpellCheckTable=new Common.UI.MenuItem({iconCls:"menu__icon btn-ic-docspell",caption:i.spellcheckText,menu:new Common.UI.Menu({cls:"shifted-right",menuAlign:"tl-tr",items:[i.menuSpellTable,i.menuSpellMoreTable,w,v,_,y,{caption:"--"},i.langTableMenu]})}),i.menuSpellPara=new Common.UI.MenuItem({caption:i.loadSpellText,disabled:!0}),i.menuSpellMorePara=new Common.UI.MenuItem({caption:i.moreText,menu:new Common.UI.Menu({cls:"shifted-right",menuAlign:"tl-tr",restoreHeight:!0,items:[]})}),i.langParaMenu=new Common.UI.MenuItem({iconCls:"menu__icon btn-ic-doclang",caption:i.langText,menu:new Common.UI.MenuSimple({cls:"lang-menu",menuAlign:"tl-tr",restoreHeight:285,items:[],itemTemplate:C,search:!0})});var S=new Common.UI.MenuItem({caption:i.ignoreSpellText}).on("click",function(t,e){i.api.asc_ignoreMisspelledWord(i._currentSpellObj,!1),i.fireEvent("editcomplete",i)}),A=new Common.UI.MenuItem({caption:i.ignoreAllSpellText}).on("click",function(t,e){i.api.asc_ignoreMisspelledWord(i._currentSpellObj,!0),i.fireEvent("editcomplete",i)}),T=new Common.UI.MenuItem({caption:i.toDictionaryText}).on("click",function(t,e){i.api.asc_spellCheckAddToDictionary(i._currentSpellObj),i.fireEvent("editcomplete",i)}),k=new Common.UI.MenuItem({caption:"--"}),I=new Common.UI.MenuItem({caption:"--"}),E=new Common.UI.MenuItem({iconCls:"menu__icon btn-menu-table",caption:i.advancedTableText}).on("click",function(t){if(i.api){var e=i.api.getSelectedElements();if(e&&e.length>0)for(var n,o,s=e.length-1;s>=0;s--)if(n=e[s].get_ObjectType(),o=e[s].get_ObjectValue(),Asc.c_oAscTypeSelectElement.Table==n){new PE.Views.TableSettingsAdvanced({tableProps:o,handler:function(t,e){"ok"==t&&i.api&&i.api.tblApply(e.tableProps),i.fireEvent("editcomplete",i),Common.component.Analytics.trackEvent("DocumentHolder","Table Settings Advanced")}}).show();break}} -}),P=new Common.UI.MenuItem({iconCls:"menu__icon btn-menu-image",caption:i.advancedImageText}).on("click",function(t){if(i.api){var e=i.api.getSelectedElements();if(e&&e.length>0)for(var n,o,s=e.length-1;s>=0;s--)if(n=e[s].get_ObjectType(),o=e[s].get_ObjectValue(),Asc.c_oAscTypeSelectElement.Image==n){var a;Z.isDisabled()||(a=i.api.get_OriginalSizeImage())&&(a={width:a.get_ImageWidth(),height:a.get_ImageHeight()}),new PE.Views.ImageSettingsAdvanced({imageProps:o,sizeOriginal:a,handler:function(t,e){"ok"==t&&i.api&&i.api.ImgApply(e.imageProps),i.fireEvent("editcomplete",i),Common.component.Analytics.trackEvent("DocumentHolder","Image Settings Advanced")}}).show();break}}}),M=new Common.UI.MenuItem({iconCls:"menu__icon btn-menu-shape",caption:i.advancedShapeText}).on("click",function(t){if(i.api){var e=i.api.getSelectedElements();if(e&&e.length>0)for(var n,o,s=e.length-1;s>=0;s--)if(n=e[s].get_ObjectType(),o=e[s].get_ObjectValue(),Asc.c_oAscTypeSelectElement.Shape==n){new PE.Views.ShapeSettingsAdvanced({shapeProps:o,handler:function(t,e){"ok"==t&&i.api&&i.api.ShapeApply(e.shapeProps),i.fireEvent("editcomplete",i),Common.component.Analytics.trackEvent("DocumentHolder","Image Shape Advanced")}}).show();break}}}),U=new Common.UI.MenuItem({iconCls:"menu__icon btn-paragraph",caption:i.advancedParagraphText}).on("click",function(t){if(i.api){var e=i.api.getSelectedElements();if(e&&e.length>0)for(var n,o,s=e.length-1;s>=0;s--)if(n=e[s].get_ObjectType(),o=e[s].get_ObjectValue(),Asc.c_oAscTypeSelectElement.Paragraph==n){new PE.Views.ParagraphSettingsAdvanced({paragraphProps:o,api:i.api,handler:function(t,e){"ok"==t&&i.api&&i.api.paraApply(e.paragraphProps),i.fireEvent("editcomplete",i),Common.component.Analytics.trackEvent("DocumentHolder","Image Paragraph Advanced")}}).show();break}}}),D=new Common.UI.MenuItem({caption:"--"}),L=new Common.UI.MenuItem({iconCls:"menu__icon btn-inserthyperlink",caption:i.hyperlinkText}).on("click",e.bind(i.addHyperlink,i)),F=new Common.UI.MenuItem({caption:i.editHyperlinkText}).on("click",e.bind(i.editHyperlink,i)),V=new Common.UI.MenuItem({caption:i.removeHyperlinkText}).on("click",function(t){i.api&&i.api.remove_Hyperlink(),i.fireEvent("editcomplete",i),Common.component.Analytics.trackEvent("DocumentHolder","Remove Hyperlink")}),B=new Common.UI.MenuItem({iconCls:"menu__icon btn-inserthyperlink",caption:i.hyperlinkText,menu:new Common.UI.Menu({cls:"shifted-right",menuAlign:"tl-tr",items:[F,V]})}),R=new Common.UI.MenuItem({iconCls:"menu__icon btn-inserthyperlink",caption:i.hyperlinkText}).on("click",e.bind(i.addHyperlink,i)),O=new Common.UI.MenuItem({caption:i.editHyperlinkText}).on("click",e.bind(i.editHyperlink,i)),N=new Common.UI.MenuItem({caption:i.removeHyperlinkText}).on("click",function(t){i.api&&i.api.remove_Hyperlink(),i.fireEvent("editcomplete",i),Common.component.Analytics.trackEvent("DocumentHolder","Remove Hyperlink Table")}),G=new Common.UI.MenuItem({iconCls:"menu__icon btn-inserthyperlink",caption:i.hyperlinkText,menu:new Common.UI.Menu({cls:"shifted-right",menuAlign:"tl-tr",items:[O,N]})}),H=new Common.UI.MenuItem({caption:"--"}),z=new Common.UI.MenuItem({caption:this.txtGroup,iconCls:"menu__icon shape-group"}).on("click",function(t){i.api&&i.api.groupShapes(),i.fireEvent("editcomplete",this),Common.component.Analytics.trackEvent("DocumentHolder","Group Image")}),$=new Common.UI.MenuItem({caption:this.txtUngroup,iconCls:"menu__icon shape-ungroup"}).on("click",function(t){i.api&&i.api.unGroupShapes(),i.fireEvent("editcomplete",this),Common.component.Analytics.trackEvent("DocumentHolder","Ungroup Image")}),j=new Common.UI.MenuItem({caption:i.txtArrange,menu:new Common.UI.Menu({cls:"shifted-right",menuAlign:"tl-tr",items:[new Common.UI.MenuItem({caption:this.textArrangeFront,iconCls:"menu__icon arrange-front"}).on("click",function(t){i.api&&i.api.shapes_bringToFront(),i.fireEvent("editcomplete",i),Common.component.Analytics.trackEvent("DocumentHolder","Bring To Front")}),new Common.UI.MenuItem({caption:this.textArrangeBack,iconCls:"menu__icon arrange-back"}).on("click",function(t){i.api&&i.api.shapes_bringToBack(),i.fireEvent("editcomplete",i),Common.component.Analytics.trackEvent("DocumentHolder","Bring To Back")}),new Common.UI.MenuItem({caption:this.textArrangeForward,iconCls:"menu__icon arrange-forward"}).on("click",function(t){i.api&&i.api.shapes_bringForward(),i.fireEvent("editcomplete",i),Common.component.Analytics.trackEvent("DocumentHolder","Send Forward")}),new Common.UI.MenuItem({caption:this.textArrangeBackward,iconCls:"menu__icon arrange-backward"}).on("click",function(t){i.api&&i.api.shapes_bringBackward(),i.fireEvent("editcomplete",i),Common.component.Analytics.trackEvent("DocumentHolder","Send Backward")}),{caption:"--"},z,$]})}),W=new Common.UI.MenuItem({caption:i.txtAlign,menu:function(){function t(t){if(i.api){var e=i.api.asc_getSelectedDrawingObjectsCount()<2||Common.Utils.InternalSettings.get("pe-align-to-slide");e=e?Asc.c_oAscObjectsAlignType.Slide:Asc.c_oAscObjectsAlignType.Selected,t.value<6?(i.api.put_ShapesAlign(t.value,e),Common.component.Analytics.trackEvent("DocumentHolder","Shape Align")):6==t.value?(i.api.DistributeHorizontally(e),Common.component.Analytics.trackEvent("DocumentHolder","Distribute Horizontally")):7==t.value&&(i.api.DistributeVertically(e),Common.component.Analytics.trackEvent("DocumentHolder","Distribute Vertically"))}i.fireEvent("editcomplete",i)}return new Common.UI.Menu({cls:"shifted-right",menuAlign:"tl-tr",items:[new Common.UI.MenuItem({caption:i.textShapeAlignLeft,iconCls:"menu__icon shape-align-left",value:Asc.c_oAscAlignShapeType.ALIGN_LEFT}).on("click",e.bind(t,i)),new Common.UI.MenuItem({caption:i.textShapeAlignCenter,iconCls:"menu__icon shape-align-center",value:Asc.c_oAscAlignShapeType.ALIGN_CENTER}).on("click",e.bind(t,i)),new Common.UI.MenuItem({caption:i.textShapeAlignRight,iconCls:"menu__icon shape-align-right",value:Asc.c_oAscAlignShapeType.ALIGN_RIGHT}).on("click",e.bind(t,i)),new Common.UI.MenuItem({caption:i.textShapeAlignTop,iconCls:"menu__icon shape-align-top",value:Asc.c_oAscAlignShapeType.ALIGN_TOP}).on("click",e.bind(t,i)),new Common.UI.MenuItem({caption:i.textShapeAlignMiddle,iconCls:"menu__icon shape-align-middle",value:Asc.c_oAscAlignShapeType.ALIGN_MIDDLE}).on("click",e.bind(t,i)),new Common.UI.MenuItem({caption:i.textShapeAlignBottom,iconCls:"menu__icon shape-align-bottom",value:Asc.c_oAscAlignShapeType.ALIGN_BOTTOM}).on("click",e.bind(t,i)),{caption:"--"},new Common.UI.MenuItem({caption:i.txtDistribHor,iconCls:"menu__icon shape-distribute-hor",value:6}).on("click",e.bind(t,i)),new Common.UI.MenuItem({caption:i.txtDistribVert,iconCls:"menu__icon shape-distribute-vert",value:7}).on("click",e.bind(t,i))]})}()}),K=new Common.UI.MenuItem({iconCls:"menu__icon btn-menu-chart",caption:i.editChartText}).on("click",e.bind(i.editChartClick,i,void 0)),q=new Common.UI.MenuItem({iconCls:"menu__icon btn-align-top",caption:i.vertAlignText,menu:function(){function t(t){if(i.api){var e=new Asc.asc_CShapeProperty;e.put_VerticalTextAlign(t.value),i.api.ShapeApply(e)}i.fireEvent("editcomplete",i),Common.component.Analytics.trackEvent("DocumentHolder","Text Vertical Align")}return new Common.UI.Menu({cls:"shifted-right",menuAlign:"tl-tr",items:[i.menuParagraphTop=new Common.UI.MenuItem({iconCls:"menu__icon btn-align-top",caption:i.textShapeAlignTop,checkable:!0,checkmark:!1,toggleGroup:"popupparagraphvalign",value:Asc.c_oAscVAlign.Top}).on("click",e.bind(t,i)),i.menuParagraphCenter=new Common.UI.MenuItem({iconCls:"menu__icon btn-align-middle",caption:i.textShapeAlignMiddle,checkable:!0,checkmark:!1,toggleGroup:"popupparagraphvalign",value:Asc.c_oAscVAlign.Center}).on("click",e.bind(t,i)),i.menuParagraphBottom=new Common.UI.MenuItem({iconCls:"menu__icon btn-align-bottom",caption:i.textShapeAlignBottom,checkable:!0,checkmark:!1,toggleGroup:"popupparagraphvalign",value:Asc.c_oAscVAlign.Bottom}).on("click",e.bind(t,i))]})}()}),Y=function(t,e){if(i.api){var n=new Asc.asc_CShapeProperty;n.put_Vert(t.options.direction),i.api.ShapeApply(n)}i.fireEvent("editcomplete",i),Common.component.Analytics.trackEvent("DocumentHolder","Text Direction")},J=new Common.UI.MenuItem({iconCls:"menu__icon text-orient-hor",caption:i.directionText,menu:new Common.UI.Menu({cls:"shifted-right",menuAlign:"tl-tr",items:[i.menuParagraphDirectH=new Common.UI.MenuItem({caption:i.directHText,iconCls:"menu__icon text-orient-hor",checkable:!0,checkmark:!1,checked:!1,toggleGroup:"popupparagraphdirect",direction:Asc.c_oAscVertDrawingText.normal}).on("click",e.bind(Y,i)),i.menuParagraphDirect90=new Common.UI.MenuItem({caption:i.direct90Text,iconCls:"menu__icon text-orient-rdown",checkable:!0,checkmark:!1,checked:!1,toggleGroup:"popupparagraphdirect",direction:Asc.c_oAscVertDrawingText.vert}).on("click",e.bind(Y,i)),i.menuParagraphDirect270=new Common.UI.MenuItem({caption:i.direct270Text,iconCls:"menu__icon text-orient-rup",checkable:!0,checkmark:!1,checked:!1,toggleGroup:"popupparagraphdirect",direction:Asc.c_oAscVertDrawingText.vert270}).on("click",e.bind(Y,i))]})}),X=new Common.UI.MenuItem({caption:"--"}),Z=new Common.UI.MenuItem({caption:i.originalSizeText}).on("click",function(t){if(i.api){var e=i.api.get_OriginalSizeImage();if(e){var n=new Asc.asc_CImgProperty;n.put_Width(e.get_ImageWidth()),n.put_Height(e.get_ImageHeight()),n.put_ResetCrop(!0),i.api.ImgApply(n)}i.fireEvent("editcomplete",i),Common.component.Analytics.trackEvent("DocumentHolder","Set Image Original Size")}}),Q=new Common.UI.MenuItem({caption:i.textReplace,menu:new Common.UI.Menu({cls:"shifted-right",menuAlign:"tl-tr",items:[new Common.UI.MenuItem({caption:this.textFromFile}).on("click",function(t){setTimeout(function(){i.onInsertImage()},10)}),new Common.UI.MenuItem({caption:this.textFromUrl}).on("click",e.bind(i.onInsertImageUrl,i,!1)),new Common.UI.MenuItem({caption:this.textFromStorage}).on("click",function(t){Common.NotificationCenter.trigger("storage:image-load","change")})]})}),tt=function(t){var e=new Asc.asc_CShapeProperty;e.asc_putRotAdd(3.14159265358979*(1==t.value?90:270)/180),i.api.ShapeApply(e),i.fireEvent("editcomplete",i)},et=function(t){var e=new Asc.asc_CShapeProperty;1==t.value?e.asc_putFlipHInvert(!0):e.asc_putFlipVInvert(!0),i.api.ShapeApply(e),i.fireEvent("editcomplete",i)},it=new Common.UI.MenuItem({caption:i.textRotate,menu:new Common.UI.Menu({cls:"shifted-right",menuAlign:"tl-tr",items:[new Common.UI.MenuItem({iconCls:"menu__icon btn-rotate-90",caption:i.textRotate90,value:1}).on("click",e.bind(tt,i)),new Common.UI.MenuItem({iconCls:"menu__icon btn-rotate-270",caption:i.textRotate270,value:0}).on("click",e.bind(tt,i)),{caption:"--"},new Common.UI.MenuItem({iconCls:"menu__icon btn-flip-hor",caption:i.textFlipH,value:1}).on("click",e.bind(et,i)),new Common.UI.MenuItem({iconCls:"menu__icon btn-flip-vert",caption:i.textFlipV,value:0}).on("click",e.bind(et,i))]})}),nt=function(t){1==t.value?i.api.asc_cropFill():2==t.value?i.api.asc_cropFit():t.checked?i.api.asc_startEditCrop():i.api.asc_endEditCrop(),i.fireEvent("editcomplete",i)};i.menuImgCrop=new Common.UI.MenuItem({caption:i.textCrop,menu:new Common.UI.Menu({cls:"shifted-right",menuAlign:"tl-tr",items:[new Common.UI.MenuItem({caption:i.textCrop,checkable:!0,allowDepress:!0,value:0}).on("click",e.bind(nt,i)),new Common.UI.MenuItem({caption:i.textCropFill,value:1}).on("click",e.bind(nt,i)),new Common.UI.MenuItem({caption:i.textCropFit,value:2}).on("click",e.bind(nt,i))]})});var ot=new Common.UI.MenuItem({iconCls:"menu__icon btn-menu-comments",caption:i.addCommentText}).on("click",e.bind(i.addComment,i));ot.hide();var st=new Common.UI.MenuItem({iconCls:"menu__icon btn-menu-comments",caption:i.addCommentText}).on("click",e.bind(i.addComment,i));st.hide();var at=new Common.UI.MenuItem({caption:"--"});at.hide();var lt=new Common.UI.MenuItem({iconCls:"menu__icon btn-menu-comments",caption:i.addCommentText}).on("click",e.bind(i.addComment,i));lt.hide();var rt=new Common.UI.MenuItem({caption:i.addToLayoutText}).on("click",e.bind(i.addToLayout,i)),ct=new Common.UI.MenuItem({iconCls:"menu__icon btn-copy",caption:i.textCopy,value:"copy"}).on("click",e.bind(i.onCutCopyPaste,i)),dt=new Common.UI.MenuItem({iconCls:"menu__icon btn-paste",caption:i.textPaste,value:"paste"}).on("click",e.bind(i.onCutCopyPaste,i)),ht=new Common.UI.MenuItem({iconCls:"menu__icon btn-cut",caption:i.textCut,value:"cut"}).on("click",e.bind(i.onCutCopyPaste,i)),pt=new Common.UI.MenuItem({iconCls:"menu__icon btn-copy",caption:i.textCopy,value:"copy"}).on("click",e.bind(i.onCutCopyPaste,i)),ut=new Common.UI.MenuItem({iconCls:"menu__icon btn-paste",caption:i.textPaste,value:"paste"}).on("click",e.bind(i.onCutCopyPaste,i)),mt=new Common.UI.MenuItem({iconCls:"menu__icon btn-cut",caption:i.textCut,value:"cut"}).on("click",e.bind(i.onCutCopyPaste,i)),gt=new Common.UI.MenuItem({iconCls:"menu__icon btn-copy",caption:i.textCopy,value:"copy"}).on("click",e.bind(i.onCutCopyPaste,i)),ft=new Common.UI.MenuItem({iconCls:"menu__icon btn-paste",caption:i.textPaste,value:"paste"}).on("click",e.bind(i.onCutCopyPaste,i)),bt=new Common.UI.MenuItem({iconCls:"menu__icon btn-cut",caption:i.textCut,value:"cut"}).on("click",e.bind(i.onCutCopyPaste,i)),Ct=new Common.UI.MenuItem({caption:"--"}),vt=(new Common.UI.MenuItem({caption:"--"}),new Common.UI.MenuItem({caption:i.addToLayoutText}).on("click",e.bind(i.addToLayout,i)));i.textMenu=new Common.UI.Menu({cls:"shifted-right",initMenu:function(t){var n=t.shapeProps&&!e.isNull(t.shapeProps.value),o=t.chartProps&&!e.isNull(t.chartProps.value),s=void 0!==t.paraProps&&t.paraProps.locked||void 0!==t.slideProps&&t.slideProps.locked||n&&t.shapeProps.locked,a=t.mathProps&&t.mathProps.value;if(i._currentParaObjDisabled=s,q.setVisible(n&&!o&&!a),J.setVisible(n&&!o&&!a),n||o){var l=t.shapeProps.value.get_VerticalTextAlign(),r="";switch(l){case Asc.c_oAscVAlign.Top:r="menu__icon btn-align-top";break;case Asc.c_oAscVAlign.Center:r="menu__icon btn-align-middle";break;case Asc.c_oAscVAlign.Bottom:r="menu__icon btn-align-bottom"}q.setIconCls(r),i.menuParagraphTop.setChecked(l==Asc.c_oAscVAlign.Top),i.menuParagraphCenter.setChecked(l==Asc.c_oAscVAlign.Center),i.menuParagraphBottom.setChecked(l==Asc.c_oAscVAlign.Bottom);var c=t.shapeProps.value.get_Vert();switch(r="",c){case Asc.c_oAscVertDrawingText.normal:r="menu__icon text-orient-hor";break;case Asc.c_oAscVertDrawingText.vert:r="menu__icon text-orient-rdown";break;case Asc.c_oAscVertDrawingText.vert270:r="menu__icon text-orient-rup"}J.setIconCls(r),i.menuParagraphDirectH.setChecked(c==Asc.c_oAscVertDrawingText.normal),i.menuParagraphDirect90.setChecked(c==Asc.c_oAscVertDrawingText.vert),i.menuParagraphDirect270.setChecked(c==Asc.c_oAscVertDrawingText.vert270)}else q.setIconCls(""),J.setIconCls("");q.setDisabled(s),J.setDisabled(s);var d=null;i.api&&(d=i.api.can_AddHyperlink()),L.setVisible(void 0===t.hyperProps&&!1!==d),B.setVisible(void 0!==t.hyperProps),F.hyperProps=t.hyperProps,!1!==d&&(L.hyperProps={},L.hyperProps.value=new Asc.CHyperlinkProperty,L.hyperProps.value.put_Text(d)),ot.setVisible(!o&&n&&!1!==i.api.can_AddQuotedComment()&&i.mode.canCoAuthoring&&i.mode.canComments),D.setVisible(ot.isVisible()||L.isVisible()||B.isVisible()),L.setDisabled(s),B.setDisabled(s),ot.setDisabled(s),U.setDisabled(s),ht.setDisabled(s),dt.setDisabled(s);var h=void 0!==t.spellProps&&!1===t.spellProps.value.get_Checked();i.menuSpellPara.setVisible(h),I.setVisible(h),S.setVisible(h),A.setVisible(h),T.setVisible(h&&i.mode.isDesktopApp),i.langParaMenu.setVisible(h),i.langParaMenu.setDisabled(s),k.setVisible(h),h&&null!==t.spellProps.value.get_Variants()&&void 0!==t.spellProps.value.get_Variants()?i.addWordVariants(!0):(i.menuSpellPara.setCaption(i.loadSpellText,!0),i.clearWordVariants(!0),i.menuSpellMorePara.setVisible(!1)),i.langParaMenu.isVisible()&&i._currLang.id!==i._currLang.paraid&&(i.changeLanguageMenu(i.langParaMenu.menu),i._currLang.paraid=i._currLang.id);var p=0;a?p=i.addEquationMenu(!0,12):i.clearEquationMenu(!0,12),Ct.setVisible(a&&p>0)},items:[i.menuSpellPara,i.menuSpellMorePara,I,S,A,T,i.langParaMenu,k,ht,ct,dt,Ct,{caption:"--"},q,J,U,D,ot,L,B]}).on("hide:after",function(t,e,n){if(i.suppressEditComplete)return void(i.suppressEditComplete=!1);n||i.fireEvent("editcomplete",i),i.currentMenu=null}),i.tableMenu=new Common.UI.Menu({cls:"shifted-right",initMenu:function(t){if(!e.isUndefined(t.tableProps)){for(var n=t.mathProps&&t.mathProps.value,o=6;o<19;o++)i.tableMenu.items[o].setVisible(!n);var s=void 0!==t.slideProps&&t.slideProps.locked,a=t.tableProps.value.get_CellsVAlign(),l="";switch(a){case Asc.c_oAscVertAlignJc.Top:l="menu__icon btn-align-top";break;case Asc.c_oAscVertAlignJc.Center:l="menu__icon btn-align-middle";break;case Asc.c_oAscVertAlignJc.Bottom:l="menu__icon btn-align-bottom"}g.setIconCls(l),i.menuTableCellTop.setChecked(a==Asc.c_oAscVertAlignJc.Top),i.menuTableCellCenter.setChecked(a==Asc.c_oAscVertAlignJc.Center),i.menuTableCellBottom.setChecked(a==Asc.c_oAscVertAlignJc.Bottom),i.api&&(u.setDisabled(t.tableProps.locked||s||!i.api.CheckBeforeMergeCells()),m.setDisabled(t.tableProps.locked||s||!i.api.CheckBeforeSplitCells())),f.setDisabled(t.tableProps.locked||s),b.setDisabled(t.tableProps.locked||s),i.tableMenu.items[7].setDisabled(t.tableProps.locked||s),i.tableMenu.items[8].setDisabled(t.tableProps.locked||s),g.setDisabled(t.tableProps.locked||s),E.setDisabled(t.tableProps.locked||s),bt.setDisabled(t.tableProps.locked||s),ft.setDisabled(t.tableProps.locked||s);var r=null;i.api&&(r=i.api.can_AddHyperlink()),R.setVisible(!e.isUndefined(t.paraProps)&&e.isUndefined(t.hyperProps)&&!1!==r),G.setVisible(!e.isUndefined(t.paraProps)&&!e.isUndefined(t.hyperProps)),O.hyperProps=t.hyperProps,!1!==r&&(R.hyperProps={},R.hyperProps.value=new Asc.CHyperlinkProperty,R.hyperProps.value.put_Text(r)),e.isUndefined(t.paraProps)||(R.setDisabled(t.paraProps.locked||s),G.setDisabled(t.paraProps.locked||s),i._currentParaObjDisabled=t.paraProps.locked||s),st.setVisible(!1!==i.api.can_AddQuotedComment()&&i.mode.canCoAuthoring&&i.mode.canComments),st.setDisabled(!e.isUndefined(t.paraProps)&&t.paraProps.locked||s),H.setVisible(R.isVisible()||G.isVisible()||st.isVisible()),i.menuSpellCheckTable.setVisible(void 0!==t.spellProps&&!1===t.spellProps.value.get_Checked()),y.setVisible(i.mode.isDesktopApp),x.setVisible(void 0!==t.spellProps&&!1===t.spellProps.value.get_Checked()),i.langTableMenu.setDisabled(s),void 0!==t.spellProps&&!1===t.spellProps.value.get_Checked()&&null!==t.spellProps.value.get_Variants()&&void 0!==t.spellProps.value.get_Variants()?i.addWordVariants(!1):(i.menuSpellTable.setCaption(i.loadSpellText,!0),i.clearWordVariants(!1),i.menuSpellMoreTable.setVisible(!1)),i.menuSpellCheckTable.isVisible()&&i._currLang.id!==i._currLang.tableid&&(i.changeLanguageMenu(i.langTableMenu.menu),i._currLang.tableid=i._currLang.id);var c=0;n?(c=i.addEquationMenu(!1,6),H.setVisible(H.isVisible()&&c>0)):i.clearEquationMenu(!1,6)}},items:[i.menuSpellCheckTable,x,bt,gt,ft,{caption:"--"},new Common.UI.MenuItem({caption:i.selectText,menu:new Common.UI.Menu({cls:"shifted-right",menuAlign:"tl-tr",items:[new Common.UI.MenuItem({caption:i.rowText}).on("click",function(){i.api&&i.api.selectRow()}),new Common.UI.MenuItem({caption:i.columnText}).on("click",function(){i.api&&i.api.selectColumn()}),new Common.UI.MenuItem({caption:i.cellText}).on("click",function(){i.api&&i.api.selectCell()}),new Common.UI.MenuItem({caption:i.tableText}).on("click",function(){i.api&&i.api.selectTable()})]})}),{iconCls:"menu__icon btn-addcell",caption:i.insertText,menu:new Common.UI.Menu({cls:"shifted-right",menuAlign:"tl-tr",style:"width: 100px",items:[new Common.UI.MenuItem({caption:i.insertColumnLeftText}).on("click",function(t){i.api&&i.api.addColumnLeft()}),new Common.UI.MenuItem({caption:i.insertColumnRightText}).on("click",function(t){i.api&&i.api.addColumnRight()}),new Common.UI.MenuItem({caption:i.insertRowAboveText}).on("click",function(t){i.api&&i.api.addRowAbove()}),new Common.UI.MenuItem({caption:i.insertRowBelowText}).on("click",function(t){i.api&&i.api.addRowBelow()})]})},new Common.UI.MenuItem({iconCls:"menu__icon btn-delcell",caption:i.deleteText,menu:new Common.UI.Menu({cls:"shifted-right",menuAlign:"tl-tr",items:[new Common.UI.MenuItem({caption:i.rowText}).on("click",function(){i.api&&i.api.remRow()}),new Common.UI.MenuItem({caption:i.columnText}).on("click",function(){i.api&&i.api.remColumn()}),new Common.UI.MenuItem({caption:i.tableText}).on("click",function(){i.api&&i.api.remTable()})]})}),{caption:"--"},u,m,{caption:"--"},f,b,{caption:"--"},g,{caption:"--"},E,H,st,R,G,{caption:"--"},vt]}).on("hide:after",function(t,e,n){if(i.suppressEditComplete)return void(i.suppressEditComplete=!1);n||i.fireEvent("editcomplete",i),i.currentMenu=null}),i.pictureMenu=new Common.UI.Menu({cls:"shifted-right",initMenu:function(t){i.api&&($.setDisabled(!i.api.canUnGroup()),z.setDisabled(!i.api.canGroup()));var n=(e.isUndefined(t.shapeProps)||t.shapeProps.value.get_FromImage())&&e.isUndefined(t.chartProps),o=void 0!==t.imgProps&&t.imgProps.locked,s=void 0!==t.shapeProps&&t.shapeProps.locked,a=void 0!==t.chartProps&&t.chartProps.locked,l=o||s||a||void 0!==t.slideProps&&t.slideProps.locked,r=t.imgProps?t.imgProps.value.asc_getPluginGuid():null;if(it.setVisible(e.isUndefined(t.chartProps)&&(null===r||void 0===r)),it.isVisible()&&it.setDisabled(l),Z.setVisible(n),Z.isVisible()&&Z.setDisabled(l||e.isNull(t.imgProps.value.get_ImageUrl())||e.isUndefined(t.imgProps.value.get_ImageUrl())),Q.setVisible(n&&(null===r||void 0===r)),Q.isVisible()&&Q.setDisabled(l||null===r),Q.menu.items[2].setVisible(i.mode.canRequestInsertImage||i.mode.fileChoiceUrl&&i.mode.fileChoiceUrl.indexOf("{documentType}")>-1),i.menuImgCrop.setVisible(i.api.asc_canEditCrop()),i.menuImgCrop.isVisible()&&i.menuImgCrop.setDisabled(l),P.setVisible(n),M.setVisible(e.isUndefined(t.imgProps)&&e.isUndefined(t.chartProps)),K.setVisible(e.isUndefined(t.imgProps)&&!e.isUndefined(t.chartProps)&&(e.isUndefined(t.shapeProps)||t.shapeProps.isChart)),X.setVisible(P.isVisible()||M.isVisible()||K.isVisible()),lt.setVisible(!1!==i.api.can_AddQuotedComment()&&i.mode.canCoAuthoring&&i.mode.canComments),at.setVisible(lt.isVisible()),lt.setDisabled(l),W.setDisabled(l),!l){var c=i.api.asc_getSelectedDrawingObjectsCount(),d=Common.Utils.InternalSettings.get("pe-align-to-slide")||!1;W.menu.items[7].setDisabled(2==c&&!d),W.menu.items[8].setDisabled(2==c&&!d)}P.setDisabled(l),M.setDisabled(l),K.isVisible()&&K.setDisabled(l),mt.setDisabled(l),ut.setDisabled(l)},items:[mt,pt,ut,{caption:"--"},j,W,it,X,i.menuImgCrop,Z,Q,P,M,K,at,lt,{caption:"--"},rt]}).on("hide:after",function(t,e,n){if(i.suppressEditComplete)return void(i.suppressEditComplete=!1);n||i.fireEvent("editcomplete",i),i.currentMenu=null});var _t=t("#id_buttonNextPage");_t.attr("data-toggle","tooltip"),_t.tooltip({title:i.textNextPage+Common.Utils.String.platformKey("PgDn"),placement:"top-right"});var yt=t("#id_buttonPrevPage");yt.attr("data-toggle","tooltip"),yt.tooltip({title:i.textPrevPage+Common.Utils.String.platformKey("PgUp"),placement:"top-right"})},setLanguages:function(t){var i=this;if(t&&t.length>0&&i.langParaMenu&&i.langTableMenu){var n=[],o=[];e.each(t,function(t){var i={caption:t.displayValue,value:t.value,checkable:!0,langid:t.code,spellcheck:t.spellcheck};n.push(i),o.push(e.clone(i))}),i.langParaMenu.menu.resetItems(n),i.langTableMenu.menu.resetItems(o),i.langParaMenu.menu.on("item:click",function(t,n){i.api&&(e.isUndefined(n.langid)||i.api.put_TextPrLang(n.langid),i._currLang.paraid=n.langid,i.fireEvent("editcomplete",i))}),i.langTableMenu.menu.on("item:click",function(t,n,o){i.api&&(e.isUndefined(n.langid)||i.api.put_TextPrLang(n.langid),i._currLang.tableid=n.langid,i.fireEvent("editcomplete",i))})}},SetDisabled:function(t){this._isDisabled=t},onInsertImage:function(t,e,i,n){this.api&&(t?this.api.asc_addImage(e):this.api.ChangeImageFromFile()),this.fireEvent("editcomplete",this)},onInsertImageUrl:function(t,i,n,o){var s=this;new Common.Views.ImageFromUrlDialog({handler:function(n,o){if("ok"==n&&s.api){var a=o.replace(/ /g,"");if(!e.isEmpty(a))if(t)s.api.AddImageUrl(a,void 0,void 0,i);else{var l=new Asc.asc_CImgProperty;l.put_ImageUrl(a),s.api.ImgApply(l,i)}}s.fireEvent("editcomplete",s)}}).show()},onClickPlaceholderChart:function(i,n,o){if(this.api){this._state.placeholderObj=i;var s=this.placeholderMenuChart,a=s?this.cmpEl.find(Common.Utils.String.format("#menu-container-{0}",s.id)):null,l=this;if(this._fromShowPlaceholder=!0,Common.UI.Menu.Manager.hideAll(),!s){this.placeholderMenuChart=s=new Common.UI.Menu({style:"width: 364px;padding-top: 12px;",items:[{template:e.template('')}]}),a=t(Common.Utils.String.format('',s.id)),this.cmpEl.append(a),s.render(a),s.cmpEl.attr({tabindex:"-1"}),s.on("hide:after",function(){l._fromShowPlaceholder||l.api.asc_uncheckPlaceholders()});new Common.UI.DataView({el:t("#id-placeholder-menu-chart"),parentMenu:s,showLast:!1,groups:new Common.UI.DataViewGroupStore(Common.define.chartData.getChartGroupData()),store:new Common.UI.DataViewStore(Common.define.chartData.getChartData()),itemTemplate:e.template('
    ')}).on("item:click",function(t,e,i,n){l.editChartClick(i.get("type"),l._state.placeholderObj)})}a.css({left:n,top:o}),a.attr("data-value","prevent-canvas-click"),this._preventClick=!0,s.show(),s.alignPosition(),e.delay(function(){s.cmpEl.find(".dataview").focus()},10),this._fromShowPlaceholder=!1}},onClickPlaceholderTable:function(i,n,o){if(this.api){this._state.placeholderObj=i;var s=this.placeholderMenuTable,a=s?this.cmpEl.find(Common.Utils.String.format("#menu-container-{0}",s.id)):null,l=this;if(this._fromShowPlaceholder=!0,Common.UI.Menu.Manager.hideAll(),!s){this.placeholderMenuTable=s=new Common.UI.Menu({cls:"shifted-left",items:[{template:e.template('
    ')},{caption:l.mniCustomTable,value:"custom"}]}),a=t(Common.Utils.String.format('',s.id)),this.cmpEl.append(a),s.render(a),s.cmpEl.attr({tabindex:"-1"}),s.on("hide:after",function(){l._fromShowPlaceholder||l.api.asc_uncheckPlaceholders()});new Common.UI.DimensionPicker({el:t("#id-placeholder-menu-tablepicker"),minRows:8,minColumns:10,maxRows:8,maxColumns:10}).on("select",function(t,e,i){l.api.put_Table(e,i,l._state.placeholderObj),l.fireEvent("editcomplete",l)}),s.on("item:click",function(t,e,i){"custom"===e.value&&new Common.Views.InsertTableDialog({handler:function(t,e){"ok"==t&&l.api.put_Table(e.columns,e.rows,l._state.placeholderObj),l.fireEvent("editcomplete",l)}}).show()})}a.css({left:n,top:o}),a.attr("data-value","prevent-canvas-click"),this._preventClick=!0,s.show(),s.alignPosition(),e.delay(function(){s.cmpEl.focus()},10),this._fromShowPlaceholder=!1}},onHidePlaceholderActions:function(){this.placeholderMenuChart&&this.placeholderMenuChart.hide(),this.placeholderMenuTable&&this.placeholderMenuTable.hide()},onClickPlaceholder:function(t,e,i,n){this.api&&(t==AscCommon.PlaceholderButtonType.Video?this.api.asc_AddVideo(e):t==AscCommon.PlaceholderButtonType.Audio&&this.api.asc_AddAudio(e),this.fireEvent("editcomplete",this))},insertRowAboveText:"Row Above",insertRowBelowText:"Row Below",insertColumnLeftText:"Column Left",insertColumnRightText:"Column Right",deleteText:"Delete",deleteRowText:"Delete Row",deleteColumnText:"Delete Column",deleteTableText:"Delete Table",mergeCellsText:"Merge Cells",splitCellsText:"Split Cell...",splitCellTitleText:"Split Cell",originalSizeText:"Actual Size",advancedImageText:"Image Advanced Settings",hyperlinkText:"Hyperlink",editHyperlinkText:"Edit Hyperlink",removeHyperlinkText:"Remove Hyperlink",txtPressLink:"Press CTRL and click link",selectText:"Select",insertRowText:"Insert Row",insertColumnText:"Insert Column",rowText:"Row",columnText:"Column",cellText:"Cell",tableText:"Table",aboveText:"Above",belowText:"Below",advancedTableText:"Table Advanced Settings",txtSelectAll:"Select All",txtNewSlide:"New Slide",txtDuplicateSlide:"Duplicate Slide",txtDeleteSlide:"Delete Slide",txtBackground:"Background",txtChangeLayout:"Change Layout",txtPreview:"Start slideshow",textShapeAlignLeft:"Align Left",textShapeAlignRight:"Align Right",textShapeAlignCenter:"Align Center",textShapeAlignTop:"Align Top",textShapeAlignBottom:"Align Bottom",textShapeAlignMiddle:"Align Middle",textArrangeFront:"Bring To Front",textArrangeBack:"Send To Back",textArrangeForward:"Bring Forward",textArrangeBackward:"Send Backward",txtGroup:"Group",txtUngroup:"Ungroup",txtArrange:"Arrange",txtAlign:"Align",txtDistribHor:"Distribute Horizontally",txtDistribVert:"Distribute Vertically",txtSlide:"Slide",cellAlignText:"Cell Vertical Alignment",advancedShapeText:"Shape Advanced Settings",addCommentText:"Add Comment",editChartText:"Edit Data",vertAlignText:"Vertical Alignment",advancedParagraphText:"Text Advanced Settings",tipIsLocked:"This element is currently being edited by another user.",textNextPage:"Next Slide",textPrevPage:"Previous Slide",insertText:"Insert",textCopy:"Copy",textPaste:"Paste",textCut:"Cut",textSlideSettings:"Slide Settings",directionText:"Text Direction",directHText:"Horizontal",direct90Text:"Rotate Text Down",direct270Text:"Rotate Text Up",txtRemoveAccentChar:"Remove accent character",txtBorderProps:"Borders property",txtHideTop:"Hide top border",txtHideBottom:"Hide bottom border",txtHideLeft:"Hide left border",txtHideRight:"Hide right border",txtHideHor:"Hide horizontal line",txtHideVer:"Hide vertical line",txtHideLT:"Hide left top line",txtHideLB:"Hide left bottom line",txtAddTop:"Add top border",txtAddBottom:"Add bottom border",txtAddLeft:"Add left border",txtAddRight:"Add right border",txtAddHor:"Add horizontal line",txtAddVer:"Add vertical line",txtAddLT:"Add left top line",txtAddLB:"Add left bottom line",txtRemoveBar:"Remove bar",txtOverbar:"Bar over text",txtUnderbar:"Bar under text",txtRemScripts:"Remove scripts",txtRemSubscript:"Remove subscript",txtRemSuperscript:"Remove superscript",txtScriptsAfter:"Scripts after text",txtScriptsBefore:"Scripts before text",txtFractionStacked:"Change to stacked fraction",txtFractionSkewed:"Change to skewed fraction",txtFractionLinear:"Change to linear fraction",txtRemFractionBar:"Remove fraction bar",txtAddFractionBar:"Add fraction bar",txtRemLimit:"Remove limit",txtLimitOver:"Limit over text",txtLimitUnder:"Limit under text",txtHidePlaceholder:"Hide placeholder",txtShowPlaceholder:"Show placeholder",txtMatrixAlign:"Matrix alignment",txtColumnAlign:"Column alignment",txtTop:"Top",txtBottom:"Bottom",txtInsertEqBefore:"Insert equation before",txtInsertEqAfter:"Insert equation after",txtDeleteEq:"Delete equation",txtLimitChange:"Change limits location",txtHideTopLimit:"Hide top limit",txtShowTopLimit:"Show top limit",txtHideBottomLimit:"Hide bottom limit",txtShowBottomLimit:"Show bottom limit",txtInsertArgBefore:"Insert argument before",txtInsertArgAfter:"Insert argument after",txtDeleteArg:"Delete argument",txtHideOpenBracket:"Hide opening bracket",txtShowOpenBracket:"Show opening bracket",txtHideCloseBracket:"Hide closing bracket",txtShowCloseBracket:"Show closing bracket",txtStretchBrackets:"Stretch brackets",txtMatchBrackets:"Match brackets to argument height",txtGroupCharOver:"Char over text",txtGroupCharUnder:"Char under text",txtDeleteGroupChar:"Delete char",txtHideDegree:"Hide degree",txtShowDegree:"Show degree",txtIncreaseArg:"Increase argument size", -txtDecreaseArg:"Decrease argument size",txtInsertBreak:"Insert manual break",txtDeleteBreak:"Delete manual break",txtAlignToChar:"Align to character",txtDeleteRadical:"Delete radical",txtDeleteChars:"Delete enclosing characters",txtDeleteCharsAndSeparators:"Delete enclosing characters and separators",alignmentText:"Alignment",leftText:"Left",rightText:"Right",centerText:"Center",loadSpellText:"Loading variants...",ignoreAllSpellText:"Ignore All",ignoreSpellText:"Ignore",noSpellVariantsText:"No variants",moreText:"More variants...",spellcheckText:"Spellcheck",langText:"Select Language",textUndo:"Undo",txtSlideHide:"Hide Slide",txtChangeTheme:"Change Theme",txtKeepTextOnly:"Keep text only",txtPastePicture:"Picture",txtPasteSourceFormat:"Keep source formatting",txtPasteDestFormat:"Use destination theme",textDistributeRows:"Distribute rows",textDistributeCols:"Distribute columns",textReplace:"Replace image",textFromUrl:"From URL",textFromFile:"From File",textRotate270:"Rotate 90° Counterclockwise",textRotate90:"Rotate 90° Clockwise",textFlipV:"Flip Vertically",textFlipH:"Flip Horizontally",textRotate:"Rotate",textCrop:"Crop",textCropFill:"Fill",textCropFit:"Fit",toDictionaryText:"Add to Dictionary",txtPrintSelection:"Print Selection",addToLayoutText:"Add to Layout",txtResetLayout:"Reset Slide",mniCustomTable:"Insert Custom Table",textFromStorage:"From Storage"},PE.Views.DocumentHolder||{}))});var c_paragraphLinerule={LINERULE_LEAST:0,LINERULE_AUTO:1,LINERULE_EXACT:2},c_tableBorder={BORDER_VERTICAL_LEFT:0,BORDER_HORIZONTAL_TOP:1,BORDER_VERTICAL_RIGHT:2,BORDER_HORIZONTAL_BOTTOM:3,BORDER_VERTICAL_CENTER:4,BORDER_HORIZONTAL_CENTER:5,BORDER_INNER:6,BORDER_OUTER:7,BORDER_ALL:8,BORDER_NONE:9,BORDER_ALL_TABLE:10,BORDER_NONE_TABLE:11,BORDER_INNER_TABLE:12,BORDER_OUTER_TABLE:13},c_paragraphTextAlignment={RIGHT:0,LEFT:1,CENTERED:2,JUSTIFIED:3},c_paragraphSpecial={NONE_SPECIAL:0,FIRST_LINE:1,HANGING:2};if(define("presentationeditor/main/app/controller/DocumentHolder",["core","presentationeditor/main/app/view/DocumentHolder"],function(){"use strict";PE.Controllers.DocumentHolder=Backbone.Controller.extend({models:[],collections:[],views:["DocumentHolder"],initialize:function(){},onLaunch:function(){this.documentHolder=this.createView("DocumentHolder").render(),this.documentHolder.el.tabIndex=-1},setApi:function(t){this.api=t},createDelayedElements:function(){var t=this.getApplication().getController("Common.Controllers.ExternalDiagramEditor").getView("Common.Views.ExternalDiagramEditor");t&&(t.on("internalmessage",_.bind(function(e,i){var n=(i.data.command,i.data.data);this.api&&(t.isEditMode()?this.api.asc_editChartDrawingObject(n):this.api.asc_addChartDrawingObject(n,t.getPlaceholder()))},this)),t.on("hide",_.bind(function(t,e){this.api&&(this.api.asc_onCloseChartFrame(),this.api.asc_enableKeyEvents(!0));var i=this;setTimeout(function(){i.documentHolder.fireEvent("editcomplete",i.documentHolder)},10)},this)))}})}),define("common/main/lib/view/ImageFromUrlDialog",["common/main/lib/component/Window"],function(){"use strict";Common.Views.ImageFromUrlDialog=Common.UI.Window.extend(_.extend({options:{width:330,header:!1,cls:"modal-dlg",buttons:["ok","cancel"]},initialize:function(t){_.extend(this.options,t||{}),this.template=['
    ','
    ',"","
    ",'
    ',"
    "].join(""),this.options.tpl=_.template(this.template)(this.options),Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this);var t=this;t.inputUrl=new Common.UI.InputField({el:$("#id-dlg-url"),allowBlank:!1,blankError:t.txtEmpty,style:"width: 100%;",validateOnBlur:!1,validation:function(e){return!!/((^https?)|(^ftp)):\/\/.+/i.test(e)||t.txtNotUrl}}),this.getChild().find(".btn").on("click",_.bind(this.onBtnClick,this))},show:function(){Common.UI.Window.prototype.show.apply(this,arguments);var t=this;_.delay(function(){t.getChild("input").focus()},100)},onPrimary:function(t){return this._handleInput("ok"),!1},onBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value)},_handleInput:function(t){if(this.options.handler){if("ok"==t&&!0!==this.inputUrl.checkValidate())return void this.inputUrl.cmpEl.find("input").focus();this.options.handler.call(this,t,this.inputUrl.getValue())}this.close()},textUrl:"Paste an image URL:",txtEmpty:"This field is required",txtNotUrl:'This field should be a URL in the format "http://www.example.com"'},Common.Views.ImageFromUrlDialog||{}))}),void 0===Common)var Common={};if(define("common/main/lib/view/InsertTableDialog",["common/main/lib/component/Window"],function(){"use strict";Common.Views.InsertTableDialog=Common.UI.Window.extend(_.extend({options:{width:230,height:156,style:"min-width: 230px;",cls:"modal-dlg",split:!1,buttons:["ok","cancel"]},initialize:function(t){_.extend(this.options,{title:t.split?this.txtTitleSplit:this.txtTitle},t||{}),this.template=['
    ','
    ','
    ',"
    ",'
    ','
    ',"
    ","
    "].join(""),this.options.tpl=_.template(this.template)(this.options),Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this);var t=this.getChild();t.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this)),this.udColumns=new Common.UI.MetricSpinner({el:t.find(".columns-val"),step:1,width:64,value:2,defaultUnit:"",maxValue:63,minValue:1,allowDecimal:!1}),this.udRows=new Common.UI.MetricSpinner({el:t.find(".rows-val"),step:1,width:64,value:2,defaultUnit:"",maxValue:100,minValue:1,allowDecimal:!1})},getFocusedComponents:function(){return[this.udColumns,this.udRows]},getDefaultFocusableComponent:function(){return this.udColumns},onBtnClick:function(t){this.options.handler&&this.options.handler.call(this,t.currentTarget.attributes.result.value,{columns:this.udColumns.getNumberValue(),rows:this.udRows.getNumberValue()}),this.close()},onPrimary:function(){return this.options.handler&&this.options.handler.call(this,"ok",{columns:this.udColumns.getNumberValue(),rows:this.udRows.getNumberValue()}),this.close(),!1},txtTitle:"Table Size",txtTitleSplit:"Split Cell",txtColumns:"Number of Columns",txtRows:"Number of Rows",textInvalidRowsCols:"You need to specify valid rows and columns count.",txtMinText:"The minimum value for this field is {0}",txtMaxText:"The maximum value for this field is {0}"},Common.Views.InsertTableDialog||{}))}),void 0===Common)var Common={};if(define("common/main/lib/component/LoadMask",["common/main/lib/component/BaseView"],function(){"use strict";Common.UI.LoadMask=Common.UI.BaseView.extend(function(){return{options:{cls:"",style:"",title:"Loading...",owner:document.body},template:_.template(['"].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t),this.template=this.options.template||this.template,this.title=this.options.title,this.ownerEl=this.options.owner instanceof Common.UI.BaseView?$(this.options.owner.el):$(this.options.owner),this.loaderEl=$(this.template({id:this.id,cls:this.options.cls,style:this.options.style,title:this.title})),this.maskeEl=$('
    '),this.timerId=0},render:function(){return this},show:function(){var t=this.ownerEl,e=this.loaderEl,i=this.maskeEl;if(t.ismasked)return this;t.ismasked=!0;var n=this;return n.title!=n.options.title&&(n.options.title=n.title,$(".asc-loadmask-title",e).html(n.title)),n.timerId=setTimeout(function(){t.append(i),t.append(e),t&&0==t.closest(".asc-window.modal").length&&Common.util.Shortcuts.suspendEvents()},500),this},hide:function(){var t=this.ownerEl;this.timerId&&(clearTimeout(this.timerId),this.timerId=0),t&&t.ismasked&&(0!=t.closest(".asc-window.modal").length||Common.Utils.ModalWindow.isVisible()||Common.util.Shortcuts.resumeEvents(),this.maskeEl&&this.maskeEl.remove(),this.loaderEl&&this.loaderEl.remove()),delete t.ismasked},setTitle:function(t){this.title=t,this.ownerEl&&this.ownerEl.ismasked&&this.loaderEl&&$(".asc-loadmask-title",this.loaderEl).html(t)},isVisible:function(){return!!this.ownerEl.ismasked},updatePosition:function(){var t=this.ownerEl,e=this.loaderEl;t&&t.ismasked&&e&&(e.css({top:Math.round(t.height()/2-(e.height()+parseInt(e.css("padding-top"))+parseInt(e.css("padding-bottom")))/2)+"px",left:Math.round(t.width()/2-(e.width()+parseInt(e.css("padding-left"))+parseInt(e.css("padding-right")))/2)+"px"}),e.css({visibility:"visible"}))}}}())}),define("common/main/lib/view/SelectFileDlg",["common/main/lib/component/Window","common/main/lib/component/LoadMask"],function(){"use strict";Common.Views.SelectFileDlg=Common.UI.Window.extend(_.extend({initialize:function(t){var e={};_.extend(e,{title:this.textTitle,width:1024,height:621,header:!0},t),this.template=['
    '].join(""),e.tpl=_.template(this.template)(e),this.fileChoiceUrl=t.fileChoiceUrl||"",Common.UI.Window.prototype.initialize.call(this,e)},render:function(){Common.UI.Window.prototype.render.call(this),this.$window.find("> .body").css({height:"auto",overflow:"hidden"});var t=document.createElement("iframe");t.width="100%",t.height=585,t.align="top",t.frameBorder=0,t.scrolling="no",t.onload=_.bind(this._onLoad,this),$("#id-select-file-placeholder").append(t),this.loadMask=new Common.UI.LoadMask({owner:$("#id-select-file-placeholder")}),this.loadMask.setTitle(this.textLoading),this.loadMask.show(),t.src=this.fileChoiceUrl;var e=this;this._eventfunc=function(t){e._onWindowMessage(t)},this._bindWindowEvents.call(this),this.on("close",function(t){e._unbindWindowEvents()})},_bindWindowEvents:function(){window.addEventListener?window.addEventListener("message",this._eventfunc,!1):window.attachEvent&&window.attachEvent("onmessage",this._eventfunc)},_unbindWindowEvents:function(){window.removeEventListener?window.removeEventListener("message",this._eventfunc):window.detachEvent&&window.detachEvent("onmessage",this._eventfunc)},_onWindowMessage:function(t){if(t&&window.JSON)try{this._onMessage.call(this,window.JSON.parse(t.data))}catch(t){}},_onMessage:function(t){if(t&&"onlyoffice"==t.Referer&&void 0!==t.file){Common.NotificationCenter.trigger("window:close",this);var e=this;setTimeout(function(){_.isEmpty(t.file)||e.trigger("selectfile",e,t.file)},50)}},_onLoad:function(){this.loadMask&&this.loadMask.hide()},textTitle:"Select Data Source",textLoading:"Loading"},Common.Views.SelectFileDlg||{}))}),define("text!common/main/lib/template/ExtendedColorDialog.template",[],function(){return'
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n \r\n \r\n
    \r\n
    \r\n
    \r\n\r\n'}),void 0===Common)var Common={};if(define("common/main/lib/component/HSBColorPicker",["common/main/lib/component/BaseView","common/main/lib/util/utils"],function(){"use strict";Common.UI.HSBColorPicker=Common.UI.BaseView.extend({template:_.template('
    <% if (this.showCurrentColor) { %>
    <% } %>
    <% if (this.changeSaturation) { %>
    <% } %>
    <% if (this.allowEmptyColor) { %>
    <%= this.textNoColor %>
    <% } %>
    '),color:"#ff0000",options:{allowEmptyColor:!1,changeSaturation:!0,showCurrentColor:!0},initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t);var e,i,n,o,s,a,l,r,c=this,d=(c.$el||$(this.el),0),h=100,p=100;c.allowEmptyColor=c.options.allowEmptyColor,c.changeSaturation=c.options.changeSaturation,c.showCurrentColor=c.options.showCurrentColor;var u=function(t,e){var i=new Common.Utils.RGBColor("hsb("+t.h+","+t.s+","+t.b+")"),n=i.toHex();c.color=e?"transparent":n,m(),c.trigger("changecolor",c,c.color)},m=function(){s.length>0&&a.length>0&&("transparent"==c.color?a.show():(s.css("background-color",c.color),a.hide())),n.length>0&&n.css("background-color",new Common.Utils.RGBColor("hsb("+d+", 100, 100)").toHex()),l.length>0&&(l[0].innerHTML="transparent"==c.color?c.textNoColor:c.color.toUpperCase()),e.length>0&&i.length>0&&(e.css("left",h+"%"),e.css("top",100-p+"%"),i.css("top",parseInt(100*d/360)+"%"))},g=function(t,i,o){if(e.length>0&&n.length>0){var s=[Math.max(0,Math.min(100,parseInt((t.pageX*Common.Utils.zoom()-n.offset().left)/n.width()*100))),Math.max(0,Math.min(100,parseInt((t.pageY*Common.Utils.zoom()-n.offset().top)/n.height()*100)))];e.css("left",s[0]+"%"),e.css("top",s[1]+"%"),h=s[0],p=100-s[1],u({h:d,s:h,b:p})}},f=function(t,e,n){if(i&&o){var s=Math.max(0,Math.min(100,parseInt((t.pageY*Common.Utils.zoom()-o.offset().top)/o.height()*100)));i.css("top",s+"%"),d=parseInt(360*s/100),u({h:d,s:h,b:p})}},b=function(t,e,i){$(document).on("mouseup",C),$(document).on("mousemove",g)},C=function(t,e,i){$(document).off("mouseup",C),$(document).off("mousemove",g),g(t)},v=function(t,e,i){$(document).on("mouseup",_),$(document).on("mousemove",f),f(t)},_=function(t,e,i){$(document).off("mouseup",_),$(document).off("mousemove",f)},y=function(t){var e=new Common.util.RGBColor(c.color).toHSB();u(e,!0)},w=function(t){var u,g=$(c.el);g&&(e=g.find(".cnt-hb-arrow"),i=g.find(".cnt-sat-arrow"),n=g.find(".cnt-hb"),o=g.find(".cnt-sat"),s=g.find(".color-value"),l=g.find(".color-text"),r=g.find(".empty-color"),s.length>0&&(a=s.find(".transparent-color")),n.length>0&&(n.off("mousedown"),n.on("mousedown",b)),o.length>0&&(o.off("mousedown"),o.on("mousedown",v)),r.length>0&&(r.off("click"),r.on("click",y)),u="transparent"==c.color?{h:0,s:100,b:100}:new Common.Utils.RGBColor(c.color).toHSB(),d=u.h,h=u.s,p=u.b,d==h&&d==p&&0==d&&(h=100),m())};c.setColor=function(t){if(c.color!=t){var e;e="transparent"==t?{h:0,s:100,b:100}:new Common.Utils.RGBColor(t).toHSB(),d=e.h,h=e.s,p=e.b,d==h&&d==p&&0==d&&(h=100),c.color=t,m()}},c.getColor=function(){return c.color},c.on("render:after",w),c.render()},render:function(){return(this.$el||$(this.el)).html(this.template()),this.trigger("render:after",this),this},textNoColor:"No Color"})}),void 0===Common)var Common={};if(define("common/main/lib/component/MaskedField",["common/main/lib/component/BaseView"],function(){"use strict";Common.UI.MaskedField=Common.UI.BaseView.extend({options:{maskExp:"",maxLength:999},initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t);var e=this,i=e.$el||$(this.el);i.addClass("masked-field user-select"),i.attr("maxlength",e.options.maxLength),i.on("keypress",function(t){var n=String.fromCharCode(t.which);e.options.maskExp.test(n)||t.ctrlKey||(t.keyCode==Common.UI.Keys.RETURN&&e.trigger("changed",e,i.val()),t.preventDefault(),t.stopPropagation())}),i.on("input",function(t){e.trigger("change",e,i.val())}),i.on("blur",function(t){e.trigger("changed",e,i.val())})},render:function(){return this},setValue:function(t){this.options.maskExp.test(t)&&t.length<=this.options.maxLength&&this.$el.val(t)},getValue:function(){this.$el.val()}})}),void 0===Common)var Common={};if(define("common/main/lib/view/ExtendedColorDialog",["text!common/main/lib/template/ExtendedColorDialog.template","common/main/lib/component/HSBColorPicker","common/main/lib/component/MetricSpinner","common/main/lib/component/MaskedField","common/main/lib/component/Window"],function(t){"use strict";Common.UI.ExtendedColorDialog=Common.UI.Window.extend(_.extend({tpl:_.template(t),options:{},rendered:!1,initialize:function(t){Common.UI.Window.prototype.initialize.call(this,{cls:"extended-color-dlg",tpl:this.tpl({txtNew:this.textNew,txtCurrent:this.textCurrent,txtAdd:this.addButtonText,txtCancel:this.cancelButtonText}),header:!1,width:340,height:272}),this.hexRe=/\s*#?([0-9a-fA-F][0-9a-fA-F]?)([0-9a-fA-F][0-9a-fA-F]?)([0-9a-fA-F][0-9a-fA-F]?)\s*/},render:function(){function t(t){e.trigger("onmodalresult",parseInt(t.currentTarget.attributes.result.value)),e.close(!0)}var e=this;return Common.UI.Window.prototype.render.call(this),this.colorsPicker=new Common.UI.HSBColorPicker({el:$("#id-hsb-colorpicker"),showCurrentColor:!1}),this.colorsPicker.on("changecolor",_.bind(this.onChangeColor,this)),this.colorNew=$("#field-new-color"),this.colorSaved=$("#field-start-color"),this.spinR=new Common.UI.MetricSpinner({el:$("#extended-spin-r"),step:1,width:63,value:"0",defaultUnit:"",maxValue:255,minValue:0,maskExp:/[0-9]/,allowDecimal:!1}),this.spinG=new Common.UI.MetricSpinner({el:$("#extended-spin-g"),step:1,width:63,value:"0",defaultUnit:"",maxValue:255,minValue:0,maskExp:/[0-9]/,allowDecimal:!1}),this.spinB=new Common.UI.MetricSpinner({el:$("#extended-spin-b"),step:1,width:63,value:"0",defaultUnit:"",maxValue:255,minValue:0,maskExp:/[0-9]/,allowDecimal:!1}),this.textColor=new Common.UI.MaskedField({el:$("#extended-text-color"),width:55,maskExp:/[a-fA-F0-9]/,maxLength:6}),this.spinR.on("change",_.bind(this.showColor,this,null,!0)).on("changing",_.bind(this.onChangingRGB,this,1)),this.spinG.on("change",_.bind(this.showColor,this,null,!0)).on("changing",_.bind(this.onChangingRGB,this,2)),this.spinB.on("change",_.bind(this.showColor,this,null,!0)).on("changing",_.bind(this.onChangingRGB,this,3)),this.textColor.on("change",_.bind(this.onChangeMaskedField,this)),this.textColor.on("changed",_.bind(this.onChangedMaskedField,this)),this.spinR.$el.find("input").attr("maxlength",3),this.spinG.$el.find("input").attr("maxlength",3),this.spinB.$el.find("input").attr("maxlength",3),this.on("close",function(){e.trigger("onmodalresult",0)}),$(this)[0].getChild(".footer .dlg-btn").on("click",t),this.rendered=!0,void 0!==this.color&&this.setColor(this.color),this},getFocusedComponents:function(){return[this.spinR,this.spinG,this.spinB,{cmp:this.textColor,selector:"input"}]},getDefaultFocusableComponent:function(){return this.getChild("#extended-text-color")},onChangeColor:function(t,e){this.colorNew.css({"background-color":e}),this.stopevents=!0;var i=e.match(this.hexRe);this.spinR.setValue(parseInt(i[1],16)),this.spinG.setValue(parseInt(i[2],16)),this.spinB.setValue(parseInt(i[3],16)),this.textColor.setValue((i[1]+i[2]+i[3]).toUpperCase()),this.stopevents=!1},showColor:function(t,e){if(!this.stopevents){var i=this.spinR.getNumberValue(),n=null==i||i<0?0:i>255?255:i;e&&this.spinR.setValue(n,!0),n=n.toString(16),i=this.spinG.getNumberValue();var o=null==i||i<0?0:i>255?255:i;e&&this.spinG.setValue(o,!0),o=o.toString(16),i=this.spinB.getNumberValue();var s=null==i||i<0?0:i>255?255:i;e&&this.spinB.setValue(s,!0),s=s.toString(16);var a=(1==n.length?"0"+n:n)+(1==o.length?"0"+o:o)+(1==s.length?"0"+s:s);this.colorsPicker.setColor("#"+a),"hex"!=t&&this.textColor.setValue(a.toUpperCase()),this.colorNew.css("background-color","#"+a)}},onChangingRGB:function(t,e,i,n){if(!this.stopevents){var o,s,a,l;switch(i=_.isEmpty(i)||isNaN(parseInt(i))?parseInt(e.getValue()):parseInt(i),t){case 1:o=(null==i||isNaN(i)||i<0?0:i>255?255:i).toString(16),l=this.spinG.getNumberValue(),s=(null==l||l<0?0:l>255?255:l).toString(16),l=this.spinB.getNumberValue(),a=(null==l||l<0?0:l>255?255:l).toString(16);break;case 2:l=this.spinR.getNumberValue(),o=(null==l||l<0?0:l>255?255:l).toString(16),s=(null==i||isNaN(i)||i<0?0:i>255?255:i).toString(16),l=this.spinB.getNumberValue(),a=(null==l||l<0?0:l>255?255:l).toString(16);break;case 3:l=this.spinR.getNumberValue(),o=(null==l||l<0?0:l>255?255:l).toString(16),l=this.spinG.getNumberValue(),s=(null==l||l<0?0:l>255?255:l).toString(16),a=(null==i||isNaN(i)||i<0?0:i>255?255:i).toString(16)}var r=(1==o.length?"0"+o:o)+(1==s.length?"0"+s:s)+(1==a.length?"0"+a:a);this.colorsPicker.setColor("#"+r),this.textColor.setValue(r.toUpperCase()),this.colorNew.css("background-color","#"+r)}},onChangeMaskedField:function(t,e){e=/^[a-fA-F0-9]{0,6}$/.test(e)?e:"000000",e="000000"+e;var i=e.match(/([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})$/i);this.stopevents=!0,this.spinR.setValue(parseInt(i[1],16)),this.spinG.setValue(parseInt(i[2],16)),this.spinB.setValue(parseInt(i[3],16)),this.stopevents=!1,this.rendered&&this.showColor("hex")},onChangedMaskedField:function(t,e){/^[a-fA-F0-9]{0,6}$/.test(e)&&!_.isEmpty(e)||t.setValue("000000"),this.rendered&&this.showColor("",!0)},getColor:function(){var t=/#?([a-fA-F0-9]{6})/.exec(this.colorsPicker.getColor());return t?t[1]:null},setColor:function(t){var e=this;if(!0!==this.rendered)return void(this.color=t);var i=/#?([a-fA-F0-9]{6})/.test(t)?t:"ff0000";e.colorsPicker.setColor("#"+i),function(){"transparent"==t?e.colorSaved.addClass("color-transparent"):(e.colorSaved.removeClass("color-transparent"),e.colorSaved.css("background-color","#"+t)),e.colorNew.css("background-color","#"+i)}(),e.stopevents=!0;var n=e.hexRe.exec(i);e.spinR.setValue(parseInt(n[1],16)),e.spinG.setValue(parseInt(n[2],16)),e.spinB.setValue(parseInt(n[3],16)),e.textColor.setValue((n[1]+n[2]+n[3]).toUpperCase()),e.stopevents=!1},onPrimary:function(){return this.trigger("onmodalresult",1),this.close(!0),!1},addButtonText:"Add",textNew:"New",textCurrent:"Current",textRGBErr:"The entered value is incorrect.
    Please enter a numeric value between 0 and 255.",textHexErr:"The entered value is incorrect.
    Please enter a value between 000000 and FFFFFF."},Common.UI.ExtendedColorDialog||{}))}),void 0===Common)var Common={};if(define("common/main/lib/component/ThemeColorPalette",["common/main/lib/component/BaseView","common/main/lib/view/ExtendedColorDialog"],function(){"use strict";Common.UI.ThemeColorPalette=Common.UI.BaseView.extend(_.extend({options:{dynamiccolors:10,standardcolors:10,themecolors:10,effects:5,allowReselect:!0,transparent:!1,value:"000000"},template:_.template('
    <% var me = this; %><% $(colors).each(function(num, item) { %><% if (me.isBlankSeparator(item)) { %>
    <% } else if (me.isSeparator(item)) { %>
    <% } else if (me.isColor(item)) { %>  <% } else if (me.isTransparent(item)) { %> <% } else if (me.isEffect(item)) { %> <% } else if (me.isCaption(item)) { %>
    <%=item%>
    <% } %><% }); %>
    <% if (me.options.dynamiccolors!==undefined) { %>
    <% for (var i=0; i <% } %><% } %>
    '),colorRe:/(?:^|\s)color-(.{6})(?:\s|$)/,selectedCls:"selected",initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t);var e=this,i=e.$el||$(this.el);this.colors=e.options.colors||this.generateColorData(e.options.themecolors,e.options.effects,e.options.standardcolors,e.options.transparent),i.addClass("theme-colorpalette"),this.render(),this.options.updateColorsArr&&this.updateColors(this.options.updateColorsArr[0],this.options.updateColorsArr[1]),this.options.value&&this.select(this.options.value,!0),this.updateCustomColors(),i.closest(".btn-group").on("show.bs.dropdown",_.bind(this.updateCustomColors,this)),i.closest(".dropdown-submenu").on("show.bs.dropdown",_.bind(this.updateCustomColors,this)),i.on("click",_.bind(this.handleClick,this))},render:function(){return this.$el.html(this.template({colors:this.colors})),this},isBlankSeparator:function(t){return"string"==typeof t&&"-"==t},isSeparator:function(t){return"string"==typeof t&&"--"==t},isColor:function(t){return"string"==typeof t&&/[0-9A-F]{6}/.test(t)},isTransparent:function(t){return"string"==typeof t&&"transparent"==t},isCaption:function(t){return"string"==typeof t&&"-"!=t&&"--"!=t&&!/[0-9A-F]{6}|transparent/.test(t)},isEffect:function(t){return"object"==typeof t&&void 0!==t.effectId},getColor:function(){return this.value},updateCustomColors:function(){var t=this.$el||$(this.el);if(t){var e=t.find("a."+this.selectedCls),i=e.length>0&&/color-dynamic/.test(e[0].className)?e.attr("color"):void 0;i&&(i=i.toUpperCase(),e.removeClass(this.selectedCls));var n=Common.localStorage.getItem("asc."+Common.localStorage.getId()+".colors.custom");n=n?n.split(","):[];for(var o,s=-1,a=n.lengththis.options.dynamiccolors&&i.shift(),Common.localStorage.setItem(e,i.join().toUpperCase())},addNewColor:function(t){var e=this,i=new Common.UI.ExtendedColorDialog({});i.on("onmodalresult",function(t){e._isdlgopen=!1,1==t&&(e.setCustomColor(i.getColor()),e.fireEvent("select",e,i.getColor()))}),e._isdlgopen=!0,i.setColor(void 0!==e.value&&!1!==e.value?e.value:void 0!==t?t:"000000"),i.show()},isDialogOpen:function(){return 1==this._isdlgopen},select:function(t,e){var i=this.$el||$(this.el);if(i.find("a."+this.selectedCls).removeClass(this.selectedCls),"object"==typeof t){var n;void 0!==t.effectId?(n=i.find('a[effectid="'+t.effectId+'"]').first(),n.length>0?(n.addClass(this.selectedCls),this.value=n[0].className.match(this.colorRe)[1].toUpperCase()):this.value=!1):void 0!==t.effectValue&&(n=i.find('a[effectvalue="'+t.effectValue+'"].color-'+t.color.toUpperCase()).first(),n.length>0?(n.addClass(this.selectedCls),this.value=n[0].className.match(this.colorRe)[1].toUpperCase()):this.value=!1)}else if(/#?[a-fA-F0-9]{6}/.test(t)&&(t=/#?([a-fA-F0-9]{6})/.exec(t)[1].toUpperCase(),this.value=t),/^[a-fA-F0-9]{6}|transparent$/.test(t)&&_.indexOf(this.colors,t)>=0)_.indexOf(this.colors,this.value)<0&&(this.value=!1),(t!=this.value||this.options.allowReselect)&&("transparent"==t?i.find("a.color-transparent").addClass(this.selectedCls):i.find("a.palette-color.color-"+t).first().addClass(this.selectedCls),this.value=t,!0!==e&&this.fireEvent("select",this,t));else{var o=i.find("#"+t).first();0==o.length&&(o=i.find('a[color="'+t+'"]').first()),o.length>0&&(o.addClass(this.selectedCls),this.value=t.toUpperCase())}},selectByRGB:function(t,e){var i=this.$el||$(this.el);i.find("a."+this.selectedCls).removeClass(this.selectedCls);var n="object"==typeof t?t.color:t;if(/#?[a-fA-F0-9]{6}/.test(n)&&(n=/#?([a-fA-F0-9]{6})/.exec(n)[1].toUpperCase()),/^[a-fA-F0-9]{6}|transparent$/.test(n)&&(n!=this.value||this.options.allowReselect)){var o="transparent"==n?i.find("a.color-transparent"):i.find("a.color-"+n).first();0==o.length&&(o=i.find("#"+n).first()),0==o.length&&(o=i.find('a[color="'+n+'"]').first()),o.length>0&&(o.addClass(this.selectedCls),this.value=n),!0!==e&&this.fireEvent("select",this,n)}},updateColors:function(t,e,i){if(void 0!==t&&void 0!==e){var n=this,o=n.$el||$(this.el);void 0===n.aColorElements&&(n.aColorElements=o.find("a.palette-color")),void 0===n.aEffectElements&&(n.aEffectElements=o.find("a.palette-color-effect"));for(var s,a=0,l=0,r=0;r=e.length)continue;s=$(n.aColorElements[a]),s.removeClass("color-"+n.colors[r]),n.colors[r]=e[a].toUpperCase(),s.addClass("color-"+n.colors[r]),s.css({background:"#"+n.colors[r]}),s.find("span").first().css({background:"#"+n.colors[r]}),a++}else if("object"==typeof n.colors[r]&&void 0!==n.colors[r].effectId){if(l>=t.length)continue;s=$(n.aEffectElements[l]),t[l].color=t[l].color.toUpperCase(),n.colors[r].color!==t[l].color&&(s.removeClass("color-"+n.colors[r].color),s.addClass("color-"+t[l].color),s.css({ -background:"#"+t[l].color}),s.find("span").first().css({background:"#"+t[l].color})),n.colors[r].effectId!==t[l].effectId&&s.attr("effectid",""+t[l].effectId),n.colors[r].effectValue!==t[l].effectValue&&s.attr("effectvalue",""+t[l].effectValue),n.colors[r]=t[l],l++}if(i)this.select(i,!0);else{var c=o.find("a."+this.selectedCls);c.length&&c.hasClass("palette-color-effect")&&(this.value=c[0].className.match(this.colorRe)[1].toUpperCase())}this.options.updateColorsArr=void 0}},clearSelection:function(t){this.$el.find("a."+this.selectedCls).removeClass(this.selectedCls),this.value=void 0},generateColorData:function(t,e,i,n){var o=[],s=t>0&&e>0?t*e:0;if(t>0){o=[this.textThemeColors,"-"];for(var a=0;a0&&o.push("-");for(var a=0;a','",""].join("")),initialize:function(t){if(!t.menu&&!1!==t.menu){var e=this;t.menu=e.getMenu(t),e.on("render:after",function(i){e.getPicker(t.color,t.colors)})}Common.UI.Button.prototype.initialize.call(this,t)},render:function(t){Common.UI.Button.prototype.render.call(this,t),void 0!==this.options.color&&this.setColor(this.options.color)},onColorSelect:function(t,e){this.setColor(e),this.trigger("color:select",this,e)},setColor:function(t){var e=$(this.cmpEl).find("button span:nth-child(1)");this.color=t,e.toggleClass("color-transparent","transparent"==t),e.css({"background-color":"transparent"==t?t:"object"==typeof t?"#"+t.color:"#"+t})},getPicker:function(t,e){return this.colorPicker||(this.colorPicker=new Common.UI.ThemeColorPalette({el:this.cmpEl.find("#"+this.menu.id+"-color-menu"),transparent:this.options.transparent,value:t,colors:e}),this.colorPicker.on("select",_.bind(this.onColorSelect,this)),this.cmpEl.find("#"+this.menu.id+"-color-new").on("click",_.bind(this.addNewColor,this))),this.colorPicker},getMenu:function(t){if("object"!=typeof this.menu){t=t||this.options;var e=t.paletteHeight||216,i=Common.UI.getId();return new Common.UI.Menu({id:i,cls:"shifted-left",additionalAlign:t.additionalAlign,items:(t.additionalItems?t.additionalItems:[]).concat([{template:_.template('
    ')},{template:_.template(''+this.textNewColor+"")}])})}return this.menu},setMenu:function(t){t=t||this.getMenu(),Common.UI.Button.prototype.setMenu.call(this,t),this.getPicker(this.options.color,this.options.colors)},addNewColor:function(){this.colorPicker&&this.colorPicker.addNewColor("object"==typeof this.color?this.color.color:this.color)},textNewColor:"Add New Custom Color"},Common.UI.ColorButton||{}))}),function(t,e){function i(t,e,i,n,o){this.Start=t,this.End=e,this.Name=i,this.Lid=n,this.Param=o}function n(t,e){var i=0,n=e.length-1,o=0,s=null;if(i>=n)return null;for(;i>1,s=e[o];if(s.Start>t)n=o-1;else{if(!(s.Endn?null:(s=e[i],s.Start>t||s.End','
    ','",'","
    ",'
    ','',"",'",'","","
    ','",'
    ',"
    ','",'
    ',"
    ",'',"",'","","",'","","
    ','
    ','
    ','
    ',"
    ",'
    ',"
    ","
    ","
    ","
    ","
    ','",'
    ',"
    ",'',"",'",'","","",'",'","","
    ','","',"
    ','
    ',"
    ','
    ',"
    ","
    ",'
    ','',"","","","","","","
    ","",'","
    ",'
    ',"
    ","
    ",""].join(""),this.options.tpl=_.template(this.template)(this.options);var h=e.length<1;h&&this.initFonts(),this.fillRecentSymbols();var p;if(t.font?p=t.font:n.length>0&&(p=n[0].font),p)for(var u=0;u0&&(s=n[0].symbol),h&&this.options.lang&&"en"!=this.options.lang){var m=this;b(this.options.lang,function(){m.updateRangeSelector()})}Common.UI.Window.prototype.initialize.call(this,this.options),this.on("resizing",_.bind(this.onWindowResizing,this)),this.on("resize",_.bind(this.onWindowResize,this)),a=!0},initFonts:function(){var t=this.api.pluginMethod_GetFontList();t.sort(function(t,e){return t.m_wsFontNamee.m_wsFontName?1:0});for(var i,n,s,a=[],l={},r=0;re.displayValue.toLowerCase()?1:-1}),r=0;r31&&t.getRangeBySymbol(i,r)){var c=0===n.find("#c"+r).length;s=r,a=!0,t.updateView(c,void 0,!1)}}).on("change:after",function(e,i,n){t.updateInput()}),this.symbolTablePanel=n.find("#symbol-table-scrollable-div"),this.previewPanel=n.find("#id-preview-data"),this.previewParent=this.previewPanel.parent(),this.previewScrolled=n.find("#id-preview"),this.previewInner=this.previewScrolled.find("div:first-child"),this.recentPanel=n.find("#symbol-table-recent"),this.fontLabel=n.find("#symbol-table-label-font"),this.boxPanel=n.find(".box"),this.updateView(void 0,void 0,void 0,!0);var l=[{symbol:"—",description:this.textEmDash,shortcutKey:"Alt+Ctrl+Num -",code:"2014"},{symbol:"–",description:this.textEnDash,shortcutKey:"",code:"2013"},{symbol:"‑",description:this.textNBHyphen,shortcutKey:"Ctrl+Shift+_",code:"002D",special:{NonBreakingHyphen:!0}},{symbol:"",description:this.textEmSpace,shortcutKey:"",code:"2003"},{symbol:"",description:this.textEnSpace,shortcutKey:"",code:"2002"},{symbol:"",description:this.textQEmSpace,shortcutKey:"",code:"2005"},{symbol:"°",description:this.textNBSpace,shortcutKey:"Ctrl+Shift+Space",code:"00A0"},{symbol:"©",description:this.textCopyright,shortcutKey:"",code:"00A9"},{symbol:"®",description:this.textRegistered,shortcutKey:"",code:"00AE"},{symbol:"™",description:this.textTradeMark,shortcutKey:"",code:"2122"},{symbol:"§",description:this.textSection,shortcutKey:"",code:"00A7"},{symbol:"¶",description:this.textPilcrow,shortcutKey:"",code:"00B6"},{symbol:"…",description:this.textEllipsis,shortcutKey:"",code:"2026"},{symbol:"‛",description:this.textSOQuote,shortcutKey:"",code:"2018"},{symbol:"’",description:this.textSCQuote,shortcutKey:"",code:"2019"},{symbol:"‟",description:this.textDOQuote,shortcutKey:"",code:"201C"},{symbol:"”",description:this.textDCQuote,shortcutKey:"",code:"201D"}];this.specialList=new Common.UI.ListView({el:n.find("#symbol-table-special-list"),store:new Common.UI.DataViewStore(l),simpleAddMode:!0,template:_.template(['
    '].join("")),itemTemplate:_.template(['
    ','
    <%= symbol %>
    ','
    <%= description %>
    ',"<% if ("+this.showShortcutKey+") { %>",'
    <%= shortcutKey %>
    ',"<% } %>","
    "].join(""))}),this.specialList.on("item:dblclick",_.bind(this.onDblClickSpecialItem,this)).on("entervalue",_.bind(this.onDblClickSpecialItem,this)),this.specialList.selectByIndex(0),this.lblShortCut=n.find("#symbol-table-lbl-shortcut"),this.lblShortCut.toggleClass("hidden",!this.showShortcutKey),n.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this)),this.symbolsPanel=n.find("#symbol-table-pnl-symbols"),this.specialPanel=n.find("#symbol-table-pnl-special")},show:function(){Common.UI.Window.prototype.show.apply(this,arguments),this.binding||(this.binding={}),this.binding.keydownSymbols=_.bind(this.onKeyDown,this),this.binding.keypressSymbols=_.bind(this.onKeyPress,this),$(document).on("keydown."+this.cid,"#symbol-table-scrollable-div #id-preview-data, #symbol-table-recent",this.binding.keydownSymbols),$(document).on("keypress."+this.cid,"#symbol-table-scrollable-div #id-preview-data, #symbol-table-recent",this.binding.keypressSymbols);var t=this.special&&!!Common.Utils.InternalSettings.get(this.appPrefix+"symbol-table-special");t?this.btnSpecial.toggle(!0):this.btnSymbols.toggle(!0),this.ShowHideElem(t)},close:function(t){$(document).off("keydown."+this.cid,this.binding.keydownSymbols),$(document).off("keypress."+this.cid,this.binding.keypressSymbols),this.special&&Common.Utils.InternalSettings.set(this.appPrefix+"symbol-table-special",this.btnSpecial.isActive()),Common.UI.Window.prototype.close.apply(this,arguments)},getPasteSymbol:function(t){var i,n=!1;if(t&&t.length>0)if(n="c"===t[0])i=e[o].displayValue;else{var a=parseInt(t.split("_")[2]);i=e[a].displayValue}return{font:i,symbol:this.encodeSurrogateChar(s),code:s,updateRecents:n}},getSpecialSymbol:function(){var t=this.specialList.getSelectedRec();return{font:void 0,symbol:this.encodeSurrogateChar(t.get("code")),code:parseInt(t.get("code"),16),special:t.get("special")}},onBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value,!0)},onPrimary:function(t){return this._handleInput("ok"),!1},_handleInput:function(t,e){if(e||!document.activeElement||"textarea"!=document.activeElement.localName||!/area_id/.test(document.activeElement.id)){var i=this.btnSpecial.isActive(),n="ok"==t?i?this.getSpecialSymbol():this.getPasteSymbol(this.$window.find(".cell-selected").attr("id")):{};this.options.handler&&this.options.handler.call(this,this,t,n),"ok"==t&&(!i&&this.checkRecent(s,n.font),!i&&n.updateRecents&&this.updateRecents(),this.type)||this.close()}},encodeSurrogateChar:function(t){if(t<65536)return String.fromCharCode(t);t-=65536;var e=55296|t>>10,i=56320|1023&t;return String.fromCharCode(e)+String.fromCharCode(i)},fixedCharCodeAt:function(t,e){e=e||0;var i,n,o=t.charCodeAt(e);if(55296<=o&&o<=56319){if(i=o,n=t.charCodeAt(e+1),isNaN(n))throw"Старшая часть суррогатной пары без следующей младшей в fixedCharCodeAt()";return 1024*(i-55296)+(n-56320)+65536}return!(56320<=o&&o<=57343)&&o},getArrRangesByFont:function(t){var i=getSupportedRangesByFont(e[t]);return 0===i.length&&i.push({Start:32,End:255}),i[0].Start<32&&(i[0].Start=32),i},getRangeBySymbol:function(t,e){for(var i=0;i=e)return t[i];return null},getRangeByName:function(t,e){for(var i=0;ie)return-1;if(i.Start<=e&&i.End>=e)return n+(e-i.Start);n+=i.End-i.Start+1}return-1},getCodeByLinearIndex:function(t,e){if(e<0)return-1;for(var i,n=0,o=t[0],s=0;se)return o.Start+e-n;n+=i}return-1},createTable:function(t,e,i){for(var n,o,s=e*i,a=0,l="",r=0;r>0==e-1?"style='border-bottom: none'":"",r&#'+t[r].toString(10)+""):l+='
    ",++a>=i&&(l+='
    ',a=0);this.previewPanel.html(l)},fillRecentSymbols:function(){var t,e=Common.localStorage.getItem(this.appPrefix+"recentSymbols");""!=e&&(t=JSON.parse(e)),_.isArray(t)&&(n=t)},saveRecent:function(){var t=JSON.stringify(n);Common.localStorage.setItem(this.appPrefix+"recentSymbols",t)},checkRecent:function(t,e){if(0===n.length)return void n.push({symbol:t,font:e});for(var i=0;i36&&n.splice(36,n.length-36),this.saveRecent()},createCell:function(t,i){var n="",o="";if(i){for(var s=0,a=0;a'+o+"");return l.addClass("cell"),l.addClass("noselect"),l.mousedown(_.bind(this.cellClickHandler,this)),i&&l.css("font-family","'"+i+"'"),l},cellClickHandler:function(t){var e=$(t.target).attr("id");if(e){var i=(new Date).getTime();if(e===h&&i-p<300)this.cellDblClickHandler(t);else{if("c"===e[0])s=parseInt(e.slice(1,e.length)),a=!0;else{var n=e.split("_");s=parseInt(n[1]),l=parseInt(n[2]),a=!1}this.updateView(!1)}h=t.target.id,p=i}},cellDblClickHandler:function(t){if(this.type){var e=this.getPasteSymbol($(t.target).attr("id"));this.checkRecent(s,e.font),e.updateRecents&&this.updateView(!1,void 0,void 0,!0),this.fireEvent("symbol:dblclick",this,"ok",e)}else this._handleInput("ok")},onDblClickSpecialItem:function(t){if(this.type){var e=this.getSpecialSymbol();this.fireEvent("symbol:dblclick",this,"ok",e)}else this._handleInput("ok")},updateRecents:function(){var t=this.recentPanel;t.empty();var e=this.getColsCount(),i=n.length;t.width(31*e);for(var o=0;o>0},getMaxHeight:function(){return this.symbolTablePanel.innerHeight()},getRowsCount:function(){return Math.max(1,this.getMaxHeight()/33>>0)},getAllSymbolsCount:function(t){for(var e,i=0,n=0;n>0)),h=d*s,p=a*s,u=[],m=0;m>0),f=Math.min(33*Math.floor(this.previewPanel.height()/33)/10,20),this.scrollerY=new Common.UI.Scroller({el:this.previewScrolled,minScrollbarLength:g,alwaysVisibleY:!0,wheelSpeed:f,useKeyboard:!1,onChange:_.bind(function(){this.scrollerY&&(this._preventUpdateScroll=!0,this.onScrollEnd(),this._preventUpdateScroll=!1,this.previewParent.height(u),this.previewParent.css({top:this.scrollerY.getScrollTop()}))},this)})),this._preventUpdateScroll||(this.scrollerY.update({minScrollbarLength:g,wheelSpeed:f}),this.scrollerY.scrollTop(33*b));var w=this.previewPanel.find(".cell");w.off("mousedown"),w.mousedown(_.bind(this.cellClickHandler,this))}d&&this.updateRecents(),this.$window.find(".cell").removeClass("cell-selected"),a?this.$window.find("#c"+s).addClass("cell-selected"):this.$window.find("#r_"+s+"_"+l).addClass("cell-selected"),!1!==c&&this.updateInput()},onScrollEnd:function(){if(this.scrollerY.getScrollTop()!==d){var t=this.getAllSymbolsCount(i),e=this.getColsCount(),n=this.getRowsCount(),o=Math.ceil(t/e),l=33*o,r=Math.max(0,Math.min(o-n,o*this.scrollerY.getScrollTop()/l+.5>>0));if(d=this.scrollerY.getScrollTop(),a){var c=this.previewPanel.children()[0];if(c){var h=c.id;if(h){var p=parseInt(h.slice(1,h.length)),u=this.getLinearIndexByCode(i,p),m=this.getLinearIndexByCode(i,s),g=m-u,f=r*e+g;s=this.getCodeByLinearIndex(i,f);var b=r*e;for(f-=e;-1===s&&f>=b;)s=this.getCodeByLinearIndex(i,f),f-=e;-1===s&&(s=this.getCodeByLinearIndex(i,b))}else s=this.getCodeByLinearIndex(i,r*e)}}else s=this.getCodeByLinearIndex(i,r*e),a=!0;this.updateView(!0,this.getCodeByLinearIndex(i,r*e))}},updateInput:function(){for(var t=s.toString(16).toUpperCase(),e=t.length,i=e;i<5;++i)t="0"+t;this.inputCode.setValue(t)},updateRangeSelector:function(){var e=this.getRangeBySymbol(i,s);if(e&&e.Name){this.cmbRange.setDisabled(!1);var n,o=[];for(n=0;n0&&(o=i[0].Start):e===Common.UI.Keys.END?i.length>0&&(o=i[i.length-1].End):n=!1,o>-1){s=o;var r=0===this.$window.find("#c"+s).length;this.updateView(r)}}else{var c,d;if(e===Common.UI.Keys.LEFT){if((c=this.$window.find(".cell-selected")[0])&&"r"===c.id[0]){var h=this.$window.find(c).prev();h.length>0&&(d=this.$window.find(h).attr("id").split("_"),s=parseInt(d[1]),l=parseInt(d[2]),this.updateView(!1))}}else if(e===Common.UI.Keys.RIGHT){if((c=this.$window.find(".cell-selected")[0])&&"r"===c.id[0]){var p=this.$window.find(c).next();p.length>0&&(d=this.$window.find(p).attr("id").split("_"),s=parseInt(d[1]),l=parseInt(d[2]),this.updateView(!1))}}else if(e===Common.UI.Keys.HOME){var g=this.$window.find("#recent-table").children()[0];g&&(d=g.id.split("_"),s=parseInt(d[1]),l=parseInt(d[2]),this.updateView(!1))}else if(e===Common.UI.Keys.END){var f=this.recentPanel.children(),b=f[f.length-1];b&&(d=b.id.split("_"),s=parseInt(d[1]),l=parseInt(d[2]),this.updateView(!1))}else n=!1}n&&(m=e,u=(new Date).getTime())}},onKeyPress:function(t){if(!document.activeElement||!document.activeElement.nodeName||"span"!==document.activeElement.nodeName.toLowerCase()){var e=t.which||t.charCode||t.keyCode||0;if(!(m===e&&Math.abs(u-(new Date).getTime())<1e3)){if(!isNaN(e)&&e>31){if(this.getRangeBySymbol(i,e)){var n=0===this.$window.find("#c"+e).length;s=e,a=!0,this.updateView(n,void 0,!0)}}t.preventDefault&&t.preventDefault()}}},onWindowResize:function(t){var e=this.getSize();if(t&&"start"==t[1])this._preventUpdateScroll=!0,this.curSize={resize:!1,width:e[0],height:e[1]};else if(this.curSize.resize){this._preventUpdateScroll=!1,this.curSize.height=e[1]-302+38*(this.special?0:1);var i=Math.max(1,this.curSize.height/33>>0),n=33*i;this.symbolTablePanel.css({height:this.curSize.height+"px"}),this.previewPanel.css({height:n+"px"}),this.previewScrolled.css({height:n+"px"}),this.scrollerY=null,this.updateView(void 0,void 0,void 0,!0),this.specialList.cmpEl.height(e[1]-156+38*(this.special?0:1)),!this.special&&(e[1]+=38);var o=JSON.stringify(e);Common.localStorage.setItem(this.appPrefix+"settings-size-symbol-table",o),Common.Utils.InternalSettings.set(this.appPrefix+"settings-size-symbol-table",o)}},onWindowResizing:function(){if(this.curSize){var t=this.getSize();if(t[0]!==this.curSize.width||t[1]!==this.curSize.height){this.curSize.resize||(this.curSize.resize=!0),this.curSize.width=t[0],this.curSize.height=t[1]-302+38*(this.special?0:1);var e=Math.max(1,this.curSize.height/33>>0),i=33*e;this.symbolTablePanel.css({height:this.curSize.height+"px"}),this.previewPanel.css({height:i+"px"}),this.previewScrolled.css({height:i+"px"}),this.specialList.cmpEl.height(t[1]-156+38*(this.special?0:1)),this.updateView(void 0,void 0,void 0,!0)}}},onModeClick:function(t,e,i){this.ShowHideElem(t)},ShowHideElem:function(t){this.symbolsPanel.toggleClass("hidden",t),this.specialPanel.toggleClass("hidden",!t);var e=this;_.delay(function(){t?e.specialList.focus():e.previewPanel.focus()},50)},textTitle:"Symbol",textFont:"Font",textRange:"Range",textRecent:"Recently used symbols",textCode:"Unicode HEX value",textSymbols:"Symbols",textSpecial:"Special characters",textCharacter:"Character",textShortcut:"Shortcut key",textEmDash:"Em Dash",textEnDash:"En Dash",textNBHyphen:"Non-breaking Hyphen",textSHyphen:"Soft Hyphen",textEmSpace:"Em Space",textEnSpace:"En Space",textQEmSpace:"1/4 Em Space",textNBSpace:"No-break Space",textCopyright:"Copyright Sign",textRegistered:"Registered Sign",textTradeMark:"Trade Mark Sign",textSection:"Section Sign",textPilcrow:"Pilcrow Sign",textEllipsis:"Horizontal Ellipsis",textSOQuote:"Single Opening Quote",textSCQuote:"Single Closing Quote",textDOQuote:"Double Opening Quote",textDCQuote:"Double Closing Quote"},Common.Views.SymbolTableDialog||{}))}),void 0===Common)var Common={};if(define("common/main/lib/view/ListSettingsDialog",["common/main/lib/component/Window","common/main/lib/component/MetricSpinner","common/main/lib/component/ThemeColorPalette","common/main/lib/component/ColorButton","common/main/lib/view/SymbolTableDialog"],function(){"use strict";Common.Views.ListSettingsDialog=Common.UI.Window.extend(_.extend({options:{type:0,width:280,height:255,style:"min-width: 240px;",cls:"modal-dlg",split:!1,buttons:["ok","cancel"]},initialize:function(t){this.type=t.type||0,_.extend(this.options,{title:this.txtTitle},t||{}),this.template=['
    ','
    ','",'","
    ",'
    ','',"",'",'",'',"","",'",'",'","",'','",'",'',"","",'",'",'',"","
    ','","','
    ','
    ',"
    ','","','
    ',"
    ','","
    ','","','
    ',"
    ','","','
    ',"
    ","
    ","
    "].join(""),this.props=t.props, -this.options.tpl=_.template(this.template)(this.options),this.color="000000",Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this);var t=this,e=this.getChild();e.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this)),t.btnBullet=new Common.UI.Button({el:$("#id-dlg-list-bullet"),enableToggle:!0,toggleGroup:"list-type",allowDepress:!1,pressed:!0}),t.btnBullet.on("click",_.bind(t.onListTypeClick,t,0)),t.btnNumbering=new Common.UI.Button({el:$("#id-dlg-list-numbering"),enableToggle:!0,toggleGroup:"list-type",allowDepress:!1}),t.btnNumbering.on("click",_.bind(t.onListTypeClick,t,1)),this.cmbNumFormat=new Common.UI.ComboBox({el:$("#id-dlg-list-numbering-format"),menuStyle:"min-width: 100%;max-height: 183px;",editable:!1,takeFocusOnClose:!0,cls:"input-group-nr",data:[{displayValue:this.txtNone,value:-1},{displayValue:"A, B, C,...",value:4},{displayValue:"a), b), c),...",value:5},{displayValue:"a, b, c,...",value:6},{displayValue:"1, 2, 3,...",value:1},{displayValue:"1), 2), 3),...",value:2},{displayValue:"I, II, III,...",value:3},{displayValue:"i, ii, iii,...",value:7}]}),this.cmbNumFormat.on("selected",_.bind(function(t,e){this._changedProps&&this._changedProps.asc_putListType(1,e.value)},this)),this.cmbNumFormat.setValue(1);var i=["<% _.each(items, function(item) { %>",'
  • ','<%= item.displayValue %><% if (item.value === 0) { %><%=item.symbol%><% } %>',"
  • ","<% }); %>"],n=['
    ','
    ','
    ','','","
    "]);this.cmbBulletFormat=new Common.UI.ComboBoxCustom({el:$("#id-dlg-list-bullet-format"),menuStyle:"min-width: 100%;max-height: 183px;",style:"width: 100px;",editable:!1,takeFocusOnClose:!0,template:_.template(n.join("")),itemsTemplate:_.template(i.join("")),data:[{displayValue:this.txtNone,value:-1},{displayValue:this.txtSymbol+": ",value:0,symbol:"•",font:"Arial"},{displayValue:this.txtSymbol+": ",value:0,symbol:"o",font:"Courier New"},{displayValue:this.txtSymbol+": ",value:0,symbol:"§",font:"Wingdings"},{displayValue:this.txtSymbol+": ",value:0,symbol:"v",font:"Wingdings"},{displayValue:this.txtSymbol+": ",value:0,symbol:"Ø",font:"Wingdings"},{displayValue:this.txtSymbol+": ",value:0,symbol:"ü",font:"Wingdings"},{displayValue:this.txtSymbol+": ",value:0,symbol:"w",font:"Wingdings"},{displayValue:this.txtSymbol+": ",value:0,symbol:"–",font:"Arial"},{displayValue:this.txtNewBullet,value:1}],updateFormControl:function(t){var e=$(this.el).find(".form-control");t?0==t.get("value")?e[0].innerHTML=t.get("displayValue")+''+t.get("symbol")+"":e[0].innerHTML=t.get("displayValue"):e[0].innerHTML=""}});var o=this.cmbBulletFormat.store.at(1);this.cmbBulletFormat.selectRecord(o),this.bulletProps={symbol:o.get("symbol"),font:o.get("font")},this.cmbBulletFormat.on("selected",_.bind(function(t,e){if(1===e.value){var i=this,n=i.bulletProps,o=function(e,o,s){"ok"==o&&(n.changed=!0,n.code=s.code,n.font=s.font,n.symbol=s.symbol,i._changedProps&&(i._changedProps.asc_putFont(n.font),i._changedProps.asc_putSymbol(n.symbol)));var a=t.store;a.findWhere({value:0,symbol:n.symbol,font:n.font})||a.add({displayValue:i.txtSymbol+": ",value:0,symbol:n.symbol,font:n.font},{at:a.length-1}),t.setData(a.models),t.selectRecord(t.store.findWhere({value:0,symbol:n.symbol,font:n.font}))},s=new Common.Views.SymbolTableDialog({api:i.options.api,lang:i.options.interfaceLang,modal:!0,type:0,font:n.font,symbol:n.symbol,handler:o});s.show(),s.on("symbol:dblclick",o)}else-1==e.value?this._changedProps&&this._changedProps.asc_putListType(0,e.value):(this.bulletProps.changed=!0,this.bulletProps.code=e.code,this.bulletProps.font=e.font,this.bulletProps.symbol=e.symbol,this._changedProps&&(this._changedProps.asc_putFont(this.bulletProps.font),this._changedProps.asc_putSymbol(this.bulletProps.symbol)))},this)),this.spnSize=new Common.UI.MetricSpinner({el:e.find("#id-dlg-list-size"),step:1,width:100,value:100,defaultUnit:"",maxValue:400,minValue:25,allowDecimal:!1}).on("change",function(e,i,n,o){t._changedProps&&t._changedProps.asc_putSize(e.getNumberValue())}),this.btnColor=new Common.UI.ColorButton({parentEl:e.find("#id-dlg-list-color"),style:"width:45px;",additionalAlign:this.menuAddAlign,color:this.color}),this.btnColor.on("color:select",_.bind(this.onColorsSelect,this)),this.colors=this.btnColor.getPicker(),this.spnStart=new Common.UI.MetricSpinner({el:e.find("#id-dlg-list-start"),step:1,width:100,value:1,defaultUnit:"",maxValue:32767,minValue:1,allowDecimal:!1}).on("change",function(e,i,n,o){t._changedProps&&t._changedProps.asc_putNumStartAt(e.getNumberValue())}),t.numberingControls=e.find(".numbering");var s=e.find("table tr:first() td:first()");s.width(Math.max(e.find(".numbering .text").width(),s.width())),this.afterRender()},getFocusedComponents:function(){return[this.cmbNumFormat,this.cmbBulletFormat,this.spnSize,this.spnStart]},afterRender:function(){this.updateThemeColors(),this._setDefaults(this.props)},updateThemeColors:function(){this.colors.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors())},onColorsSelect:function(t,e){this.color=e,this._changedProps&&this._changedProps.asc_putColor(Common.Utils.ThemeColor.getRgbColor(e))},onListTypeClick:function(t,e,i){this.ShowHideElem(t)},ShowHideElem:function(t){this.numberingControls.toggleClass("hidden",0==t),this.cmbNumFormat.setVisible(1==t),this.cmbBulletFormat.setVisible(0==t);var e=this;_.delay(function(){t?e.cmbNumFormat.focus():e.cmbBulletFormat.focus()},50)},_handleInput:function(t){if(this.options.handler){var e=this.btnBullet.pressed?0:1;this.originalType==AscFormat.BULLET_TYPE_BULLET_NONE&&(this._changedProps=new Asc.asc_CBullet,this._changedProps.asc_putColor(Common.Utils.ThemeColor.getRgbColor(this.color)),this._changedProps.asc_putSize(this.spnSize.getNumberValue())),(this.originalType==AscFormat.BULLET_TYPE_BULLET_NONE||this.originalType==AscFormat.BULLET_TYPE_BULLET_CHAR&&1==e||this.originalType==AscFormat.BULLET_TYPE_BULLET_AUTONUM&&0==e)&&(0==e?-1==this.cmbBulletFormat.getValue()?this._changedProps.asc_putListType(0,-1):(this._changedProps.asc_putFont(this.bulletProps.font),this._changedProps.asc_putSymbol(this.bulletProps.symbol)):(this._changedProps.asc_putListType(1,this.cmbNumFormat.getValue()),this._changedProps.asc_putNumStartAt(this.spnStart.getNumberValue()))),this.options.handler.call(this,t,this._changedProps)}this.close()},onBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value)},onPrimary:function(t){return this._handleInput("ok"),!1},_setDefaults:function(t){if(t){var e=0,i=t.asc_getBullet();if(i){this.originalType=i.asc_getType(),this.spnSize.setValue(i.asc_getSize()||"",!0);var n=i.asc_getColor();if(n=n?n.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?{color:Common.Utils.ThemeColor.getHexColor(n.get_r(),n.get_g(),n.get_b()),effectValue:n.get_value()}:Common.Utils.ThemeColor.getHexColor(n.get_r(),n.get_g(),n.get_b()):"transparent",this.color=Common.Utils.ThemeColor.colorValue2EffectId(n),this.btnColor.setColor(n),"object"==typeof n){for(var o=!1,s=0;s<10;s++)if(Common.Utils.ThemeColor.ThemeValues[s]==n.effectValue){this.colors.select(n,!0),o=!0;break}o||this.colors.clearSelection()}else this.colors.select(n,!0);if(this.originalType==AscFormat.BULLET_TYPE_BULLET_NONE)this.cmbNumFormat.setValue(-1),this.cmbBulletFormat.setValue(-1),e=this.type;else if(this.originalType==AscFormat.BULLET_TYPE_BULLET_CHAR){var a=i.asc_getSymbol();a?(this.bulletProps={symbol:a,font:i.asc_getFont()},this.cmbBulletFormat.store.findWhere({value:0,symbol:this.bulletProps.symbol,font:this.bulletProps.font})||this.cmbBulletFormat.store.add({displayValue:this.txtSymbol+": ",value:0,symbol:this.bulletProps.symbol,font:this.bulletProps.font},{at:this.cmbBulletFormat.store.length-1}),this.cmbBulletFormat.setData(this.cmbBulletFormat.store.models),this.cmbBulletFormat.selectRecord(this.cmbBulletFormat.store.findWhere({value:0,symbol:this.bulletProps.symbol,font:this.bulletProps.font}))):this.cmbBulletFormat.setValue(""),this._changedProps=i,e=0}else if(this.originalType==AscFormat.BULLET_TYPE_BULLET_AUTONUM){var l=i.asc_getAutoNumType();this.cmbNumFormat.setValue(l,"");var r=i.asc_getNumStartAt();this.spnStart.setValue(r||"",!0),this.spnStart.setDisabled(null===r),this._changedProps=i,e=1}}else this.cmbNumFormat.setValue(-1),this.cmbBulletFormat.setValue(-1),this._changedProps=new Asc.asc_CBullet,e=this.type}1==e?this.btnNumbering.toggle(!0):this.btnBullet.toggle(!0),this.ShowHideElem(e)},txtTitle:"List Settings",txtSize:"Size",txtColor:"Color",txtOfText:"% of text",txtStart:"Start at",textBulleted:"Bulleted",textNumbering:"Numbered",txtType:"Type",txtNone:"None",txtNewBullet:"New bullet",txtSymbol:"Symbol"},Common.Views.ListSettingsDialog||{}))}),void 0===Common)var Common={};if(void 0===Common.define&&(Common.define={}),define("common/main/lib/util/define",[],function(){"use strict";Common.define.c_oAscMathMainType={Symbol:0,Fraction:1,Script:2,Radical:3,Integral:4,LargeOperator:5,Bracket:6,Function:7,Accent:8,LimitLog:9,Operator:10,Matrix:11},Common.define.c_oAscMathType={Symbol_pm:0,Symbol_infinity:1,Symbol_equals:2,Symbol_neq:3,Symbol_about:4,Symbol_times:5,Symbol_div:6,Symbol_factorial:7,Symbol_propto:8,Symbol_less:9,Symbol_ll:10,Symbol_greater:11,Symbol_gg:12,Symbol_leq:13,Symbol_geq:14,Symbol_mp:15,Symbol_cong:16,Symbol_approx:17,Symbol_equiv:18,Symbol_forall:19,Symbol_additional:20,Symbol_partial:21,Symbol_sqrt:22,Symbol_cbrt:23,Symbol_qdrt:24,Symbol_cup:25,Symbol_cap:26,Symbol_emptyset:27,Symbol_percent:28,Symbol_degree:29,Symbol_fahrenheit:30,Symbol_celsius:31,Symbol_inc:32,Symbol_nabla:33,Symbol_exists:34,Symbol_notexists:35,Symbol_in:36,Symbol_ni:37,Symbol_leftarrow:38,Symbol_uparrow:39,Symbol_rightarrow:40,Symbol_downarrow:41,Symbol_leftrightarrow:42,Symbol_therefore:43,Symbol_plus:44,Symbol_minus:45,Symbol_not:46,Symbol_ast:47,Symbol_bullet:48,Symbol_vdots:49,Symbol_cdots:50,Symbol_rddots:51,Symbol_ddots:52,Symbol_aleph:53,Symbol_beth:54,Symbol_QED:55,Symbol_alpha:65536,Symbol_beta:65537,Symbol_gamma:65538,Symbol_delta:65539,Symbol_varepsilon:65540,Symbol_epsilon:65541,Symbol_zeta:65542,Symbol_eta:65543,Symbol_theta:65544,Symbol_vartheta:65545,Symbol_iota:65546,Symbol_kappa:65547,Symbol_lambda:65548,Symbol_mu:65549,Symbol_nu:65550,Symbol_xsi:65551,Symbol_o:65552,Symbol_pi:65553,Symbol_varpi:65554,Symbol_rho:65555,Symbol_varrho:65556,Symbol_sigma:65557,Symbol_varsigma:65558,Symbol_tau:65559,Symbol_upsilon:65560,Symbol_varphi:65561,Symbol_phi:65562,Symbol_chi:65563,Symbol_psi:65564,Symbol_omega:65565,Symbol_Alpha:131072,Symbol_Beta:131073,Symbol_Gamma:131074,Symbol_Delta:131075,Symbol_Epsilon:131076,Symbol_Zeta:131077,Symbol_Eta:131078,Symbol_Theta:131079,Symbol_Iota:131080,Symbol_Kappa:131081,Symbol_Lambda:131082,Symbol_Mu:131083,Symbol_Nu:131084,Symbol_Xsi:131085,Symbol_O:131086,Symbol_Pi:131087,Symbol_Rho:131088,Symbol_Sigma:131089,Symbol_Tau:131090,Symbol_Upsilon:131091,Symbol_Phi:131092,Symbol_Chi:131093,Symbol_Psi:131094,Symbol_Omega:131095,FractionVertical:16777216,FractionDiagonal:16777217,FractionHorizontal:16777218,FractionSmall:16777219,FractionDifferential_1:16842752,FractionDifferential_2:16842753,FractionDifferential_3:16842754,FractionDifferential_4:16842755,FractionPi_2:16842756,ScriptSup:33554432,ScriptSub:33554433,ScriptSubSup:33554434,ScriptSubSupLeft:33554435,ScriptCustom_1:33619968,ScriptCustom_2:33619969,ScriptCustom_3:33619970,ScriptCustom_4:33619971,RadicalSqrt:50331648,RadicalRoot_n:50331649,RadicalRoot_2:50331650,RadicalRoot_3:50331651,RadicalCustom_1:50397184,RadicalCustom_2:50397185,Integral:67108864,IntegralSubSup:67108865,IntegralCenterSubSup:67108866,IntegralDouble:67108867,IntegralDoubleSubSup:67108868,IntegralDoubleCenterSubSup:67108869,IntegralTriple:67108870,IntegralTripleSubSup:67108871,IntegralTripleCenterSubSup:67108872,IntegralOriented:67174400,IntegralOrientedSubSup:67174401,IntegralOrientedCenterSubSup:67174402,IntegralOrientedDouble:67174403,IntegralOrientedDoubleSubSup:67174404,IntegralOrientedDoubleCenterSubSup:67174405,IntegralOrientedTriple:67174406,IntegralOrientedTripleSubSup:67174407,IntegralOrientedTripleCenterSubSup:67174408,Integral_dx:67239936,Integral_dy:67239937,Integral_dtheta:67239938,LargeOperator_Sum:83886080,LargeOperator_Sum_CenterSubSup:83886081,LargeOperator_Sum_SubSup:83886082,LargeOperator_Sum_CenterSub:83886083,LargeOperator_Sum_Sub:83886084,LargeOperator_Prod:83951616,LargeOperator_Prod_CenterSubSup:83951617,LargeOperator_Prod_SubSup:83951618,LargeOperator_Prod_CenterSub:83951619,LargeOperator_Prod_Sub:83951620,LargeOperator_CoProd:83951621,LargeOperator_CoProd_CenterSubSup:83951622,LargeOperator_CoProd_SubSup:83951623,LargeOperator_CoProd_CenterSub:83951624,LargeOperator_CoProd_Sub:83951625,LargeOperator_Union:84017152,LargeOperator_Union_CenterSubSup:84017153,LargeOperator_Union_SubSup:84017154,LargeOperator_Union_CenterSub:84017155,LargeOperator_Union_Sub:84017156,LargeOperator_Intersection:84017157,LargeOperator_Intersection_CenterSubSup:84017158,LargeOperator_Intersection_SubSup:84017159,LargeOperator_Intersection_CenterSub:84017160,LargeOperator_Intersection_Sub:84017161,LargeOperator_Disjunction:84082688,LargeOperator_Disjunction_CenterSubSup:84082689,LargeOperator_Disjunction_SubSup:84082690,LargeOperator_Disjunction_CenterSub:84082691,LargeOperator_Disjunction_Sub:84082692,LargeOperator_Conjunction:84082693,LargeOperator_Conjunction_CenterSubSup:84082694,LargeOperator_Conjunction_SubSup:84082695,LargeOperator_Conjunction_CenterSub:84082696,LargeOperator_Conjunction_Sub:84082697,LargeOperator_Custom_1:84148224,LargeOperator_Custom_2:84148225,LargeOperator_Custom_3:84148226,LargeOperator_Custom_4:84148227,LargeOperator_Custom_5:84148228,Bracket_Round:100663296,Bracket_Square:100663297,Bracket_Curve:100663298,Bracket_Angle:100663299,Bracket_LowLim:100663300,Bracket_UppLim:100663301,Bracket_Line:100663302,Bracket_LineDouble:100663303,Bracket_Square_OpenOpen:100663304,Bracket_Square_CloseClose:100663305,Bracket_Square_CloseOpen:100663306,Bracket_SquareDouble:100663307,Bracket_Round_Delimiter_2:100728832,Bracket_Curve_Delimiter_2:100728833,Bracket_Angle_Delimiter_2:100728834,Bracket_Angle_Delimiter_3:100728835,Bracket_Round_OpenNone:100794368,Bracket_Round_NoneOpen:100794369,Bracket_Square_OpenNone:100794370,Bracket_Square_NoneOpen:100794371,Bracket_Curve_OpenNone:100794372,Bracket_Curve_NoneOpen:100794373,Bracket_Angle_OpenNone:100794374,Bracket_Angle_NoneOpen:100794375,Bracket_LowLim_OpenNone:100794376,Bracket_LowLim_NoneNone:100794377,Bracket_UppLim_OpenNone:100794378,Bracket_UppLim_NoneOpen:100794379,Bracket_Line_OpenNone:100794380,Bracket_Line_NoneOpen:100794381,Bracket_LineDouble_OpenNone:100794382,Bracket_LineDouble_NoneOpen:100794383,Bracket_SquareDouble_OpenNone:100794384,Bracket_SquareDouble_NoneOpen:100794385,Bracket_Custom_1:100859904,Bracket_Custom_2:100859905,Bracket_Custom_3:100859906,Bracket_Custom_4:100859907,Bracket_Custom_5:100925440,Bracket_Custom_6:100925441,Bracket_Custom_7:100925442,Function_Sin:117440512,Function_Cos:117440513,Function_Tan:117440514,Function_Csc:117440515,Function_Sec:117440516,Function_Cot:117440517,Function_1_Sin:117506048,Function_1_Cos:117506049,Function_1_Tan:117506050,Function_1_Csc:117506051,Function_1_Sec:117506052,Function_1_Cot:117506053,Function_Sinh:117571584,Function_Cosh:117571585,Function_Tanh:117571586,Function_Csch:117571587,Function_Sech:117571588,Function_Coth:117571589,Function_1_Sinh:117637120,Function_1_Cosh:117637121,Function_1_Tanh:117637122,Function_1_Csch:117637123,Function_1_Sech:117637124,Function_1_Coth:117637125,Function_Custom_1:117702656,Function_Custom_2:117702657,Function_Custom_3:117702658,Accent_Dot:134217728,Accent_DDot:134217729,Accent_DDDot:134217730,Accent_Hat:134217731,Accent_Check:134217732,Accent_Accent:134217733,Accent_Grave:134217734,Accent_Smile:134217735,Accent_Tilde:134217736,Accent_Bar:134217737,Accent_DoubleBar:134217738,Accent_CurveBracketTop:134217739,Accent_CurveBracketBot:134217740,Accent_GroupTop:134217741,Accent_GroupBot:134217742,Accent_ArrowL:134217743,Accent_ArrowR:134217744,Accent_ArrowD:134217745,Accent_HarpoonL:134217746,Accent_HarpoonR:134217747,Accent_BorderBox:134283264,Accent_BorderBoxCustom:134283265,Accent_BarTop:134348800,Accent_BarBot:134348801,Accent_Custom_1:134414336,Accent_Custom_2:134414337,Accent_Custom_3:134414338,LimitLog_LogBase:150994944,LimitLog_Log:150994945,LimitLog_Lim:150994946,LimitLog_Min:150994947,LimitLog_Max:150994948,LimitLog_Ln:150994949,LimitLog_Custom_1:151060480,LimitLog_Custom_2:151060481,Operator_ColonEquals:167772160,Operator_EqualsEquals:167772161,Operator_PlusEquals:167772162,Operator_MinusEquals:167772163,Operator_Definition:167772164,Operator_UnitOfMeasure:167772165,Operator_DeltaEquals:167772166,Operator_ArrowL_Top:167837696,Operator_ArrowR_Top:167837697,Operator_ArrowL_Bot:167837698,Operator_ArrowR_Bot:167837699,Operator_DoubleArrowL_Top:167837700,Operator_DoubleArrowR_Top:167837701,Operator_DoubleArrowL_Bot:167837702,Operator_DoubleArrowR_Bot:167837703,Operator_ArrowD_Top:167837704,Operator_ArrowD_Bot:167837705,Operator_DoubleArrowD_Top:167837706,Operator_DoubleArrowD_Bot:167837707,Operator_Custom_1:167903232,Operator_Custom_2:167903233,Matrix_1_2:184549376,Matrix_2_1:184549377,Matrix_1_3:184549378,Matrix_3_1:184549379,Matrix_2_2:184549380,Matrix_2_3:184549381,Matrix_3_2:184549382,Matrix_3_3:184549383,Matrix_Dots_Center:184614912,Matrix_Dots_Baseline:184614913,Matrix_Dots_Vertical:184614914,Matrix_Dots_Diagonal:184614915,Matrix_Identity_2:184680448,Matrix_Identity_2_NoZeros:184680449,Matrix_Identity_3:184680450,Matrix_Identity_3_NoZeros:184680451,Matrix_2_2_RoundBracket:184745984,Matrix_2_2_SquareBracket:184745985,Matrix_2_2_LineBracket:184745986,Matrix_2_2_DLineBracket:184745987,Matrix_Flat_Round:184811520,Matrix_Flat_Square:184811521},Common.define.chartData=_.extend(new function(){return{textLine:"Line",textColumn:"Column",textBar:"Bar",textArea:"Area",textPie:"Pie",textPoint:"XY (Scatter)",textStock:"Stock",textSurface:"Surface",textCharts:"Charts",textSparks:"Sparklines",textLineSpark:"Line",textColumnSpark:"Column",textWinLossSpark:"Win/Loss",getChartGroupData:function(t){return[{id:"menu-chart-group-bar",caption:this.textColumn,headername:t?this.textCharts:void 0},{id:"menu-chart-group-line",caption:this.textLine},{id:"menu-chart-group-pie",caption:this.textPie},{id:"menu-chart-group-hbar",caption:this.textBar},{id:"menu-chart-group-area",caption:this.textArea,inline:!0},{id:"menu-chart-group-scatter",caption:this.textPoint,inline:!0},{id:"menu-chart-group-stock",caption:this.textStock,inline:!0}]},getChartData:function(){return[{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barNormal,iconCls:"column-normal"},{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barStacked,iconCls:"column-stack"},{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barStackedPer,iconCls:"column-pstack"},{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barNormal3d,iconCls:"column-3d-normal"},{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barStacked3d,iconCls:"column-3d-stack"},{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barStackedPer3d,iconCls:"column-3d-pstack"},{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barNormal3dPerspective,iconCls:"column-3d-normal-per"},{group:"menu-chart-group-line",type:Asc.c_oAscChartTypeSettings.lineNormal,iconCls:"line-normal"},{group:"menu-chart-group-line",type:Asc.c_oAscChartTypeSettings.lineStacked,iconCls:"line-stack"},{group:"menu-chart-group-line",type:Asc.c_oAscChartTypeSettings.lineStackedPer,iconCls:"line-pstack"},{group:"menu-chart-group-line",type:Asc.c_oAscChartTypeSettings.line3d,iconCls:"line-3d"},{group:"menu-chart-group-pie",type:Asc.c_oAscChartTypeSettings.pie,iconCls:"pie-normal"},{group:"menu-chart-group-pie",type:Asc.c_oAscChartTypeSettings.doughnut,iconCls:"pie-doughnut"},{group:"menu-chart-group-pie",type:Asc.c_oAscChartTypeSettings.pie3d,iconCls:"pie-3d-normal"},{group:"menu-chart-group-hbar",type:Asc.c_oAscChartTypeSettings.hBarNormal,iconCls:"bar-normal"},{group:"menu-chart-group-hbar",type:Asc.c_oAscChartTypeSettings.hBarStacked,iconCls:"bar-stack"},{group:"menu-chart-group-hbar",type:Asc.c_oAscChartTypeSettings.hBarStackedPer,iconCls:"bar-pstack"},{group:"menu-chart-group-hbar",type:Asc.c_oAscChartTypeSettings.hBarNormal3d,iconCls:"bar-3d-normal"},{group:"menu-chart-group-hbar",type:Asc.c_oAscChartTypeSettings.hBarStacked3d,iconCls:"bar-3d-stack"},{group:"menu-chart-group-hbar",type:Asc.c_oAscChartTypeSettings.hBarStackedPer3d,iconCls:"bar-3d-pstack"},{group:"menu-chart-group-area",type:Asc.c_oAscChartTypeSettings.areaNormal,iconCls:"area-normal"},{group:"menu-chart-group-area",type:Asc.c_oAscChartTypeSettings.areaStacked,iconCls:"area-stack"},{group:"menu-chart-group-area",type:Asc.c_oAscChartTypeSettings.areaStackedPer,iconCls:"area-pstack"},{group:"menu-chart-group-scatter",type:Asc.c_oAscChartTypeSettings.scatter,iconCls:"point-normal"},{group:"menu-chart-group-stock",type:Asc.c_oAscChartTypeSettings.stock,iconCls:"stock-normal"}]},getSparkGroupData:function(t){return[{id:"menu-chart-group-sparkcolumn",inline:!0,headername:t?this.textSparks:void 0},{id:"menu-chart-group-sparkline",inline:!0},{id:"menu-chart-group-sparkwin",inline:!0}]},getSparkData:function(){return[{group:"menu-chart-group-sparkcolumn",type:Asc.c_oAscSparklineType.Column,allowSelected:!0,iconCls:"spark-column",tip:this.textColumnSpark},{group:"menu-chart-group-sparkline",type:Asc.c_oAscSparklineType.Line,allowSelected:!0,iconCls:"spark-line",tip:this.textLineSpark},{group:"menu-chart-group-sparkwin",type:Asc.c_oAscSparklineType.Stacked,allowSelected:!0,iconCls:"spark-win",tip:this.textWinLossSpark}]}}},Common.define.chartData||{})}),define("presentationeditor/main/app/collection/SlideThemes",["backbone"],function(t){"use strict";PE.Collections=PE.Collections||{},PE.Collections.SlideThemes=t.Collection.extend({})}),define("text!presentationeditor/main/app/template/Toolbar.template",[],function(){return'
    \n
    \n
    \n <%= tabsmarkup %>\n
    \n
    \n
    \n
    \n
    \n
    \n \n
    \n
    \n \n
    \n
    \n
    \n
    \n
    \n \n \n
    \n
    \n \n \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n \n
    \n \n
    \n
    \n \n
    \n
    \n \n
    \n
    \n
    \n
    \n
    \n \n \n \n \n
    \n
    \n \n \n \n \n \n \n \n
    \n
    \n
    \n
    \n
    \n \n \n \n \n
    \n
    \n \n \n \n
    \n
    \n
    \n
    \n \n \n \n
    \n
    \n
    \n \n
    \n
    \n \n
    \n
    \n
    \n
    \n
    \n \n \n
    \n
    \n \n \n
    \n
    \n
    \n
    \n
    \n
    \n \n
    \n \n
    \n
    \n \n
    \n
    \n
    \n \n \n \n \n \n
    \n
    \n
    \n \n \n
    \n
    \n
    \n \n \n \n
    \n
    \n
    \n \n \n
    \n
    \n
    \n \n \n
    \n
    \n
    \n
    \n
    '}),define("text!presentationeditor/main/app/template/ToolbarView.template",[],function(){return'
    \n
    \n
    \n <%= tabsmarkup %>\n
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    '}),void 0===Common)var Common={};if(Common.Models=Common.Models||{},define("common/main/lib/model/Font",["backbone"],function(t){"use strict";Common.Models.Font=t.Model.extend({defaults:function(){return{id:Common.UI.getId(),name:null,cloneid:null,imgidx:0,type:0}}})}),void 0===Common)var Common={};if(Common.Collections=Common.Collections||{},define("common/main/lib/collection/Fonts",["backbone","common/main/lib/model/Font"],function(t){"use strict";Common.Collections.Fonts=t.Collection.extend({model:Common.Models.Font,comparator:function(t,e){var i=t.get("name").toLowerCase(),n=e.get("name").toLowerCase();return i==n?0:i',"<% _.each(colors, function(color, index) { %>",'',"<% }) %>",""].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t);var e=this;this.id=e.options.id,this.cls=e.options.cls,this.style=e.options.style,this.colors=e.options.colors||[],this.value=e.options.value,e.options.el&&e.render()},render:function(t){var e=this;return e.rendered?this.cmpEl=e.$el||$(this.el):(this.cmpEl=$(this.template({id:this.id,cls:this.cls,style:this.style,colors:this.colors})),t?(this.setElement(t,!1),t.html(this.cmpEl)):e.$el.html(this.cmpEl)),e.rendered||e.cmpEl.on("click","span.color-item",e.itemClick.bind(e)),e.rendered=!0,this},itemClick:function(t){var e=$(t.target);this.select(e.attr("data-color"))},select:function(t,e){if(this.value!=t){var i=this;$("span.color-item",this.cmpEl).removeClass("selected"),this.value=t,t&&/#?[a-fA-F0-9]{6}/.test(t)&&(t=/#?([a-fA-F0-9]{6})/.exec(t)[1].toUpperCase(),$("span[data-color="+t+"]",this.cmpEl).addClass("selected"),e||i.trigger("select",i,this.value))}}})}),void 0===Common)var Common={};if(define("common/main/lib/component/DimensionPicker",["common/main/lib/component/BaseView"],function(){"use strict";Common.UI.DimensionPicker=Common.UI.BaseView.extend(function(){return{options:{itemSize:18,minRows:5,minColumns:5,maxRows:20,maxColumns:20},template:_.template(['
    ','
    0x0
    ','
    ','
    ','
    ','
    ',"
    ","
    "].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t);var e=this;this.render(),this.cmpEl=e.$el||$(this.el);var i=this.cmpEl;e.itemSize=e.options.itemSize,e.minRows=e.options.minRows,e.minColumns=e.options.minColumns,e.maxRows=e.options.maxRows,e.maxColumns=e.options.maxColumns,e.curColumns=0,e.curRows=0;var n=function(t){e.setTableSize(Math.ceil((void 0===t.offsetX?t.originalEvent.layerX:t.offsetX*Common.Utils.zoom())/e.itemSize),Math.ceil((void 0===t.offsetY?t.originalEvent.layerY:t.offsetY*Common.Utils.zoom())/e.itemSize),t)},o=function(t){e.setTableSize(0,0,t)},s=function(t){e.trigger("select",e,e.curColumns,e.curRows,t)};if(i){var a=i.find(".dimension-picker-mousecatcher");e.areaUnHighLighted=i.find(".dimension-picker-unhighlighted"),e.areaHighLighted=i.find(".dimension-picker-highlighted"),e.areaStatus=i.find(".dimension-picker-status"),i.css({width:e.minColumns+"em"}),a.css("z-index",1),a.width(e.maxColumns+"em").height(e.maxRows+"em"),e.areaUnHighLighted.width(e.minColumns+"em").height(e.minRows+"em"),e.areaStatus.html(e.curColumns+" x "+e.curRows),e.areaStatus.width(e.areaUnHighLighted.width()),a.on("mousemove",n),e.areaHighLighted.on("mousemove",n),e.areaUnHighLighted.on("mousemove",n),a.on("mouseleave",o),e.areaHighLighted.on("mouseleave",o),e.areaUnHighLighted.on("mouseleave",o),a.on("click",s),e.areaHighLighted.on("click",s),e.areaUnHighLighted.on("click",s)}},render:function(){return(this.$el||$(this.el)).html(this.template()),this},setTableSize:function(t,e,i){t>this.maxColumns&&(t=this.maxColumns),e>this.maxRows&&(e=this.maxRows),this.curColumns==t&&this.curRows==e||(this.curColumns=t,this.curRows=e,this.areaHighLighted.width(this.curColumns+"em").height(this.curRows+"em"),this.areaUnHighLighted.width((this.curColumnsthis.maxColumns?this.maxColumns:this.curColumns+1)+"em").height((this.curRowsthis.maxRows?this.maxRows:this.curRows+1)+"em"),this.cmpEl.width(this.areaUnHighLighted.width()),this.areaStatus.html(this.curColumns+" x "+this.curRows),this.areaStatus.width(this.areaUnHighLighted.width()),this.trigger("change",this,this.curColumns,this.curRows,i))},getColumnsCount:function(){return this.curColumns},getRowsCount:function(){return this.curRows}}}())}),void 0===Common)var Common={};var FONT_TYPE_RECENT=4;if(define("common/main/lib/component/ComboBoxFonts",["common/main/lib/component/ComboBox"],function(){"use strict";Common.UI.ComboBoxFonts=Common.UI.ComboBox.extend(function(){var t=Asc.FONT_THUMBNAIL_HEIGHT||26,e=window.devicePixelRatio>1,i=document.createElement("canvas"),n=i.getContext("2d"),o="../../../../sdkjs/common/Images/fonts_thumbnail.png?"+window.CP_urlArgs,s="../../../../sdkjs/common/Images/fonts_thumbnail@2x.png?"+window.CP_urlArgs,a=1;return"object"==typeof window.AscDesktopEditor&&(o=window.AscDesktopEditor.getFontsSprite(),s=window.AscDesktopEditor.getFontsSprite(!0)),i.height=e?2*t:t,i.width=e?604:302,{template:_.template(['
    ',' ','
    ','','","
    "].join("")),initialize:function(t){Common.UI.ComboBox.prototype.initialize.call(this,_.extend(t,{displayField:"name",scroller:{wheelSpeed:20,alwaysVisibleY:!0,onChange:this.updateVisibleFontsTiles.bind(this)}})),this.recent=_.isNumber(t.recent)?t.recent:5;var e=Common.localStorage.getKeysFilter();this.appPrefix=e&&e.length?e.split(",")[0]:"",Common.NotificationCenter.on("fonts:load",_.bind(this.fillFonts,this))},render:function(t){var e=null,i="";return _.isUndefined(this._input)||(e=this._input.val(),i=this._input.attr("tabindex")),Common.UI.ComboBox.prototype.render.call(this,t),this.setRawValue(e),this._input.attr("tabindex",i),this._input.on("keyup",_.bind(this.onInputKeyUp,this)),this._input.on("keydown",_.bind(this.onInputKeyDown,this)),this._input.on("focus",_.bind(function(){this.inFormControl=!0},this)),this._input.on("blur",_.bind(function(){this.inFormControl=!1},this)),this},onAfterKeydownMenu:function(t){var e=this;if(t.keyCode==Common.UI.Keys.RETURN){if($(t.target).closest("input").length){if(this.lastValue===this._input.val())return!0;this._input.trigger("change")}else $(t.target).click(),this.rendered&&(Common.Utils.isIE?this._input.trigger("change",{onkeydown:!0}):this._input.blur());return!1}if(t.keyCode==Common.UI.Keys.ESC&&this.isMenuOpen())return this._input.val(this.lastValue),setTimeout(function(){e.closeMenu(),e.onAfterHideMenu(t)},10),!1;(t.keyCode==Common.UI.Keys.HOME&&!t.shiftKey||t.keyCode==Common.UI.Keys.END&&!t.shiftKey||t.keyCode==Common.UI.Keys.BACKSPACE&&!e._input.is(":focus"))&&this.isMenuOpen()&&(e._input.focus(),setTimeout(function(){e._input[0].selectionStart=e._input[0].selectionEnd=t.keyCode==Common.UI.Keys.HOME?0:e._input[0].value.length},10)),this.updateVisibleFontsTiles()},onInputKeyUp:function(t){if(t.keyCode!=Common.UI.Keys.RETURN&&t.keyCode!==Common.UI.Keys.SHIFT&&t.keyCode!==Common.UI.Keys.CTRL&&t.keyCode!==Common.UI.Keys.ALT&&t.keyCode!==Common.UI.Keys.LEFT&&t.keyCode!==Common.UI.Keys.RIGHT&&t.keyCode!==Common.UI.Keys.HOME&&t.keyCode!==Common.UI.Keys.END&&t.keyCode!==Common.UI.Keys.ESC&&t.keyCode!==Common.UI.Keys.INSERT&&t.keyCode!==Common.UI.Keys.TAB&&(t.stopPropagation(),this.selectCandidate(t.keyCode==Common.UI.Keys.DELETE||t.keyCode==Common.UI.Keys.BACKSPACE),this._selectedItem)){var e=this;void 0===e._timerSelection&&(e._timerSelection=setInterval(function(){if(!(new Date-e._inInputKeyDown<100)&&e._selectedItem){clearInterval(e._timerSelection),e._timerSelection=void 0;var t=e._input[0],i=e._selectedItem.get(e.displayField),n=t.value;e.rendered&&(document.selection?document.selection.createRange().text=i:(t.selectionStart||"0"==t.selectionStart)&&(t.value=i,t.selectionStart=n.length,t.selectionEnd=i.length))}},10))}},onInputKeyDown:function(t){this._inInputKeyDown=new Date;var e=this;t.keyCode==Common.UI.Keys.ESC?(this._input.val(this.lastValue),setTimeout(function(){e.closeMenu(),e.onAfterHideMenu(t)},10)):t.keyCode!=Common.UI.Keys.RETURN&&t.keyCode!=Common.UI.Keys.CTRL&&t.keyCode!=Common.UI.Keys.SHIFT&&t.keyCode!=Common.UI.Keys.ALT&&t.keyCode!=Common.UI.Keys.TAB?(this.isMenuOpen()||t.ctrlKey||this.openMenu(),t.keyCode==Common.UI.Keys.UP||t.keyCode==Common.UI.Keys.DOWN?_.delay(function(){var i=t.keyCode==Common.UI.Keys.DOWN?e.cmpEl.find("ul li.selected").nextAll("li:not(.divider)"):e.cmpEl.find("ul li.selected").prevAll("li:not(.divider)");i=i.length>0?i.eq(0):t.keyCode==Common.UI.Keys.DOWN?e.cmpEl.find("ul li:not(.divider):first"):e.cmpEl.find("ul li:not(.divider):last"),i=i.find("a"),e._skipInputChange=!0,i.focus(),e.updateVisibleFontsTiles()},10):e._skipInputChange=!1):t.keyCode==Common.UI.Keys.RETURN&&this._input.val()===e.lastValue&&this._input.trigger("change",{reapply:!0})},onInputChanged:function(t,e){if(!e||!e.synthetic){if(this._skipInputChange)return void(this._skipInputChange=!1);if(this._isMouseDownMenu)return void(this._isMouseDownMenu=!1);var i=$(t.target).val(),n={};if(!(this.lastValue!==i||e&&e.reapply))return void(e&&e.onkeydown&&this.trigger("combo:blur",this,t));n[this.valueField]=i,n[this.displayField]=i,this.trigger("changed:before",this,n,t),t.isDefaultPrevented()||(this._selectedItem?(n[this.valueField]=this._selectedItem.get(this.displayField),this.setRawValue(n[this.valueField]),this.trigger("selected",this,_.extend({},this._selectedItem.toJSON()),t),this.addItemToRecent(this._selectedItem),this.closeMenu()):(this.setRawValue(n[this.valueField]),n.isNewFont=!0,this.trigger("selected",this,n,t),this.closeMenu()),this.trigger("changed:after",this,n,t))}},getImageUri:function(o){if(o.cloneid){var s=$(this.el).find("ul > li#"+o.cloneid+" img");return null!=s?s[0].src:void 0}return e?(n.clearRect(0,0,604,2*t),n.drawImage(this.spriteThumbs,0,2*-Asc.FONT_THUMBNAIL_HEIGHT*Math.floor(o.imgidx/a))):(n.clearRect(0,0,302,t),n.drawImage(this.spriteThumbs,0,-Asc.FONT_THUMBNAIL_HEIGHT*Math.floor(o.imgidx/a))),i.toDataURL()},getImageWidth:function(){return 302},getImageHeight:function(){return t},getListItemHeight:function(){return 26},loadSprite:function(t){t&&(this.spriteThumbs=new Image,this.spriteThumbs.onload=t,this.spriteThumbs.src=e?s:o)},fillFonts:function(t,i){var n=this;this.loadSprite(function(){if(a=Math.floor(n.spriteThumbs.width/(e?604:302))||1,n.store.set(t.toJSON()),n.rendered=!1,_.isUndefined(n.scroller)||(n.scroller.destroy(),delete n.scroller),n._scrollerIsInited=!1,n.render($(n.el)),n._fontsArray=n.store.toJSON(),n.recent>0){n.store.on("add",n.onInsertItem,n),n.store.on("remove",n.onRemoveItem,n),Common.Utils.InternalSettings.set(n.appPrefix+"-settings-recent-fonts",Common.localStorage.getItem(n.appPrefix+"-settings-recent-fonts"));var i=Common.Utils.InternalSettings.get(n.appPrefix+"-settings-recent-fonts");i=i?i.split(";"):[],i.reverse().forEach(function(t){t&&n.addItemToRecent(n.store.findWhere({name:t}),!0)})}})},onApiChangeFont:function(t){var e=this,i=_.isFunction(t.get_Name)?t.get_Name():t.asc_getFontName();this.__name!==i&&(this.__nameId||(this.__nameId=setTimeout(function(){e.onApiChangeFontInternal(i),e.__nameId=null},100)))},onApiChangeFontInternal:function(t){if(!this.inFormControl&&(this.__name=t,this.getRawValue()!==t)){var e=this.store.findWhere({name:t});if($(".selected",$(this.el)).removeClass("selected"),e){this.setRawValue(e.get(this.displayField));var i=$("#"+e.get("id"),$(this.el)),n=$("ul.dropdown-menu",this.cmpEl);i&&n&&(i.addClass("selected"),this.recent<=0&&n.scrollTop(i.offset().top-n.offset().top))}else this.setRawValue(t)}},itemClicked:function(t){Common.UI.ComboBox.prototype.itemClicked.apply(this,arguments);var e=$(t.target).closest("li"),i=this.store.findWhere({id:e.attr("id")});this.addItemToRecent(i)},onInsertItem:function(t){$(this.el).find("ul").prepend(_.template(['
  • ','',"
  • "].join(""))({item:t.attributes,scope:this}))},onRemoveItem:function(t,e,i){$(this.el).find("ul > li#"+t.id).remove()},onBeforeShowMenu:function(t){if(this.store.length<1)return void t.preventDefault();if(Common.UI.ComboBox.prototype.onBeforeShowMenu.apply(this,arguments),!this.getSelectedRecord()&&this.getRawValue()){var e=this.store.where({name:this.getRawValue()});e&&e.length&&this.selectRecord(e[e.length-1])}},onAfterShowMenu:function(t){this.recent>0?(this.scroller&&!this._scrollerIsInited&&(this.scroller.update(),this._scrollerIsInited=!0),$(this.el).find("ul").scrollTop(0),this.trigger("show:after",this,t),this.flushVisibleFontsTiles(),this.updateVisibleFontsTiles(null,0)):Common.UI.ComboBox.prototype.onAfterShowMenu.apply(this,arguments)},onAfterHideMenu:function(t){this.lastValue!==this._input.val()&&this._input.val(this.lastValue),Common.UI.ComboBox.prototype.onAfterHideMenu.apply(this,arguments)},addItemToRecent:function(t,e){if(t&&!(this.recent<1)){var i=this.store.findWhere({name:t.get("name"),type:FONT_TYPE_RECENT});i&&this.store.remove(i);var n=this.store.where({type:FONT_TYPE_RECENT});n.length0&&s.length>0){o.addClass("selected");var a=o.position().top,l=s.scrollTop();0!=a&&s.scrollTop(l+a)}}},updateVisibleFontsTiles:function(i,n){var o=this,s=0,l=o.store.length,r=0;if(o.tiles||(o.tiles=[]),l!==o.tiles.length)for(s=o.tiles.length;s=0;--t)this.tiles[t]&&(this.tiles[t].parentNode.removeChild(this.tiles[t]),this.tiles[t]=null)}}}())}),void 0===Common)var Common={};if(define("common/main/lib/component/ComboDataView",["common/main/lib/component/BaseView","common/main/lib/component/DataView"],function(){"use strict";Common.UI.ComboDataView=Common.UI.BaseView.extend({options:{id:null,cls:"",style:"",hint:!1,itemWidth:80,itemHeight:40,menuMaxHeight:300,enableKeyEvents:!1,beforeOpenHandler:null,additionalMenuItems:null,showLast:!0,minWidth:-1},template:_.template(['
    ','
    ','
    ',"
    "].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t),this.id=this.options.id||Common.UI.getId(),this.cls=this.options.cls,this.style=this.options.style,this.hint=this.options.hint,this.store=this.options.store||new Common.UI.DataViewStore,this.itemWidth=this.options.itemWidth,this.itemHeight=this.options.itemHeight,this.menuMaxHeight=this.options.menuMaxHeight,this.beforeOpenHandler=this.options.beforeOpenHandler,this.showLast=this.options.showLast,this.rootWidth=0,this.rootHeight=0,this.rendered=!1,this.needFillComboView=!1,this.minWidth=this.options.minWidth,this.fieldPicker=new Common.UI.DataView({cls:"field-picker",allowScrollbar:!1,itemTemplate:_.template(['
    ','','<% if (typeof title !== "undefined") {%>','<%= title %>',"<% } %>","
    "].join(""))}),this.openButton=new Common.UI.Button({cls:"open-menu",menu:new Common.UI.Menu({menuAlign:"tl-tl",offset:[0,3],items:[{template:_.template('')}]})}),null!=this.options.additionalMenuItems&&(this.openButton.menu.items=this.openButton.menu.items.concat(this.options.additionalMenuItems)),this.menuPicker=new Common.UI.DataView({cls:"menu-picker",parentMenu:this.openButton.menu,restoreHeight:this.menuMaxHeight,style:"max-height: "+this.menuMaxHeight+"px;",enableKeyEvents:this.options.enableKeyEvents,store:this.store,itemTemplate:_.template(['
    ','','<% if (typeof title !== "undefined") {%>','<%= title %>',"<% } %>","
    "].join(""))}),setInterval(_.bind(this.checkSize,this),500),this.options.el&&this.render()},render:function(t){if(!this.rendered){var e=this;e.trigger("render:before",e),e.cmpEl=e.$el||$(e.el);var i=e.template({id:e.id,cls:e.cls,style:e.style});t?(e.setElement(t,!1),e.cmpEl=$(i),t.html(e.cmpEl)):e.cmpEl.html(i),e.rootWidth=e.cmpEl.width(),e.rootHeight=e.cmpEl.height(),e.fieldPicker.render($(".view",e.cmpEl)),e.openButton.render($(".button",e.cmpEl)),e.menuPicker.render($(".menu-picker-container",e.cmpEl)),e.openButton.menu.cmpEl&&e.openButton.menu.cmpEl&&(e.openButton.menu.menuAlignEl=e.cmpEl,e.openButton.menu.cmpEl.css("min-width",e.itemWidth),e.openButton.menu.on("show:before",_.bind(e.onBeforeShowMenu,e)),e.openButton.menu.on("show:after",_.bind(e.onAfterShowMenu,e)),e.openButton.cmpEl.on("hide.bs.dropdown",_.bind(e.onBeforeHideMenu,e)),e.openButton.cmpEl.on("hidden.bs.dropdown",_.bind(e.onAfterHideMenu,e))),e.options.hint&&(e.cmpEl.attr("data-toggle","tooltip"),e.cmpEl.tooltip({title:e.options.hint,placement:e.options.hintAnchor||"cursor"})),e.fieldPicker.on("item:select",_.bind(e.onFieldPickerSelect,e)),e.menuPicker.on("item:select",_.bind(e.onMenuPickerSelect,e)),e.fieldPicker.on("item:click",_.bind(e.onFieldPickerClick,e)),e.menuPicker.on("item:click",_.bind(e.onMenuPickerClick,e)),e.fieldPicker.on("item:contextmenu",_.bind(e.onPickerItemContextMenu,e)),e.menuPicker.on("item:contextmenu",_.bind(e.onPickerItemContextMenu,e)),e.fieldPicker.el.addEventListener("contextmenu",_.bind(e.onPickerComboContextMenu,e),!1),e.menuPicker.el.addEventListener("contextmenu",_.bind(e.onPickerComboContextMenu,e),!1),e.onResize(),e.rendered=!0,e.trigger("render:after",e)}return this},checkSize:function(){if(this.cmpEl&&this.cmpEl.is(":visible")){var t=this,e=this.cmpEl.width(),i=this.cmpEl.height();if(e div:not(.grouped-data):not(.ps-scrollbar-x-rail):not(.ps-scrollbar-y-rail)")[0]);a.length>0&&(n.itemMarginLeft=parseInt(a.css("margin-left")),n.itemMarginRight=parseInt(a.css("margin-right")),n.itemPaddingLeft=parseInt(a.css("padding-left")),n.itemPaddingRight=parseInt(a.css("padding-right")),n.itemBorderLeft=parseInt(a.css("border-left-width")),n.itemBorderRight=parseInt(a.css("border-right-width")))}var l=o.indexOf(t);if(l<0)return;var r=o.length,c=Math.floor(Math.max(s.width(),n.minWidth)/(n.itemWidth+(n.itemMarginLeft||0)+(n.itemMarginRight||0)+(n.itemPaddingLeft||0)+(n.itemPaddingRight||0)+(n.itemBorderLeft||0)+(n.itemBorderRight||0))),d=[];s.height()/n.itemHeight>2&&(c*=Math.floor(s.height()/n.itemHeight)),l=Math.floor(l/c)*c,r-l1?t/2:t)},setItemHeight:function(t){this.itemHeight!=t&&(this.itemHeight=window.devicePixelRatio>1?t/2:t)},removeTips:function(){var t=this.menuPicker;_.each(t.dataViewItems,function(t){var e=t.$el.data("bs.tooltip");e&&e.tip().remove()},t)}})}),void 0===Common)var Common={};if(define("common/main/lib/component/SynchronizeTip",["common/main/lib/component/BaseView"],function(){"use strict";Common.UI.SynchronizeTip=Common.UI.BaseView.extend(_.extend(function(){return{options:{target:$(document.body),text:"",placement:"right",showLink:!0},template:_.template(['
    <%= scope.placement %>">','
    ','
    ',"
    ",'
    <%= scope.text %>
    ','
    ',"
    ","<% if ( scope.showLink ) { %>",'',"<% } %>","
    ","
    "].join("")),initialize:function(t){this.textSynchronize+=Common.Utils.String.platformKey("Ctrl+S"),Common.UI.BaseView.prototype.initialize.call(this,t),this.target=this.options.target,this.text=_.isEmpty(this.options.text)?this.textSynchronize:this.options.text,this.textLink=_.isEmpty(this.options.textLink)?this.textDontShow:this.options.textLink,this.placement=this.options.placement,this.showLink=this.options.showLink},render:function(){return this.cmpEl||(this.cmpEl=$(this.template({scope:this})),$(document.body).append(this.cmpEl),this.cmpEl.find(".close").on("click",_.bind(function(){this.trigger("closeclick")},this)),this.cmpEl.find(".show-link label").on("click",_.bind(function(){this.trigger("dontshowclick")},this))),this.applyPlacement(),this},show:function(){this.cmpEl?(this.applyPlacement(),this.cmpEl.show()):this.render()},hide:function(){this.cmpEl&&this.cmpEl.hide()},close:function(){this.cmpEl&&this.cmpEl.remove()},applyPlacement:function(){var t=this.target.offset(),e=Common.Utils.innerHeight();if("document"==this.placement);else if("top"==this.placement)this.cmpEl.css({bottom:e-t.top+"px",right:Common.Utils.innerWidth()-t.left-this.target.width()/2+"px"});else if("target"==this.placement)this.cmpEl.css({top:t.top+5+"px",left:t.left+5+"px"});else{var i=t.top+this.target.height()/2,n=this.cmpEl.height();i+n>e&&(i=e-n),"left"==this.placement?this.cmpEl.css({top:i+"px",right:Common.Utils.innerWidth()-t.left-5+"px"}):this.cmpEl.css({top:i+"px",left:t.left+this.target.width()+"px"})}},isVisible:function(){return this.cmpEl&&this.cmpEl.is(":visible")},textDontShow:"Don't show this message again",textSynchronize:"The document has been changed by another user.
    Please click to save your changes and reload the updates."}}(),Common.UI.SynchronizeTip||{}))}),define("common/main/lib/component/Mixtbar",["backbone","common/main/lib/component/BaseView"],function(t){"use strict";Common.UI.Mixtbar=Common.UI.BaseView.extend(function(){function t(t){var e=$(t.currentTarget).find("> a[data-tab]").data("tab");this.dblclick_el==e&&(this.fireEvent("change:compact",[e]),this.dblclick_el=void 0)}function e(t){this.isFolded&&($(t.target).parents(".toolbar, #file-menu-panel").length||o.$bar&&o.$bar.hasClass("expanded")&&this.collapse())}var i,n,o={timeout:2e3},s={},a=function(t,e){var n=i.scrollLeft();(n||"right"==t)&&i.animate({scrollLeft:"left"==t?n-100:n+100},200)};return{$tabs:void 0,$panels:void 0,isFolded:!1,initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t);this.$layout=$(t.template({tabsmarkup:_.template('
      <% for(var i in items) { %><% if (typeof items[i] == "object") { %>
    • <% if (items[i].extcls) print(\' \' + items[i].extcls) %>"><%= items[i].caption %>
    • <% } %><% } %>
    ')({items:t.tabs})})),s.tabs=t.tabs,$(document.body).on("click",e.bind(this)),Common.NotificationCenter.on("tab:visible",_.bind(function(t,e){this.setVisible(t,e)},this))},afterRender:function(){var e=this;i=e.$(".tabs > ul"),e.$tabs=i.find("> li"),e.$panels=e.$(".box-panels > .panel"),o.$bar=e.$(".toolbar");var s=e.$(".tabs .scroll.right");n=e.$(".tabs .scroll.left"),n.on("click",a.bind(this,"left")),s.on("click",a.bind(this,"right")),i.on("dblclick","> .ribtab",t.bind(this)),i.on("click","> .ribtab",e.onTabClick.bind(this))},isTabActive:function(t){var e=this.$tabs.filter(".active").find("> a");return e.length&&e.data("tab")==t},setFolded:function(t){this.isFolded=t;var e=this;if(this.isFolded)o.$box||(o.$box=e.$el.find(".box-controls")),o.$bar.addClass("folded z-clear").toggleClass("expanded",!1),o.$bar.find(".tabs .ribtab").removeClass("active"),o.$bar.on($.support.transition.end,function(t){o.$bar.hasClass("folded")&&!o.$bar.hasClass("expanded")&&o.$bar.toggleClass("z-clear",!0)}),o.$box.on({mouseleave:function(t){},mouseenter:function(t){}});else{o.$bar.removeClass("folded z-clear"),o.$box.off();var i=o.$box.find(".panel.active");if(i.length){var n=i.data("tab");e.$tabs.find("> a[data-tab="+n+"]").parent().toggleClass("active",!0)}else n=e.$tabs.siblings(":not(.x-lone):visible").first().find("> a[data-tab]").data("tab"),e.setTab(n)}},collapse:function(){Common.UI.Menu.Manager.hideAll(),this.isFolded&&o.$bar&&(o.$bar.removeClass("expanded"),o.$bar.find(".tabs .ribtab").removeClass("active"))},expand:function(){o.$bar.removeClass("z-clear"),o.$bar.addClass("expanded")},onResize:function(t){this.hasTabInvisible()?i.parent().hasClass("short")||i.parent().addClass("short"):i.parent().hasClass("short")&&i.parent().removeClass("short"),this.processPanelVisible()},onTabClick:function(t){var e=this,i=$(t.currentTarget),n=i.find("> a[data-tab]").data("tab");i.hasClass("x-lone")?e.isFolded&&e.collapse():i.hasClass("active")?e._timerSetTab||(e.dblclick_el=n,e.isFolded&&(e.collapse(),setTimeout(function(){e.dblclick_el=void 0},500))):(e._timerSetTab=!0,setTimeout(function(){e._timerSetTab=!1},500),e.setTab(n),e.processPanelVisible(null,!0),e.isFolded?e.dblclick_el=n:(e.dblclick_timer&&clearTimeout(e.dblclick_timer),e.dblclick_timer=setTimeout(function(){e.dblclick_el=n,delete e.dblclick_timer},500)))},setTab:function(t){var e=this;if(t||(this.isFolded?this.collapse():t=this.lastPanel),t){e.$tabs.removeClass("active"),e.$panels.removeClass("active");var i=this.$panels.filter("[data-tab="+t+"]");i.length&&(this.lastPanel=t,i.addClass("active")),i.length?e.isFolded&&e.expand():e.isFolded&&e.collapse();var n=this.$tabs.find("> a[data-tab="+t+"]").parent();n.length&&n.addClass("active"),this.fireEvent("tab:active",[t])}},addTab:function(t,e,n){function o(t){return s.tabs[t]?s.tabs[t].action:o(--t)}var a=_.template('');s.tabs[n+1]=t;var l=o(n),r=this.$tabs||this.$layout.find(".tabs"),c=r.find("a[data-tab="+l+"]");c.length&&(c.parent().after(a(t)),e&&(r=this.$panels||this.$layout.find(".box-panels > .panel"),c=r.filter("[data-tab="+l+"]"),c.length?c.after(e):e.appendTo(this.$layout.find(".box-panels"))),this.$tabs&&(this.$tabs=i.find("> li")),this.$panels&&(this.$panels=this.$el.find(".box-panels > .panel")))},isCompact:function(){return this.isFolded},hasTabInvisible:function(){if(i.length<1)return!1;var t=Math.round(i.offset().left),e=Math.round(t+i.width()),n=this.$tabs.filter(":visible:first").get(0);if(!n)return!1;var o=n.getBoundingClientRect();return Math.round(o.left)e)},processPanelVisible:function(t,e){function i(){var e=t||n.$panels.filter(".active");if(e&&e.length){var i=e.parents(".box-controls").width(),o=e.data(),s=o.rightedge,a=o.buttons,l=o.flex;if(s||(s=e.get(0).getBoundingClientRect().right),a||(a=[],_.each(e.find(".btn-slot .x-huge"),function(t){a.push($(t).closest(".btn-slot"))}),o.buttons=a),l||(l=[],_.each(e.find(".group.flex"),function(t){var e=$(t);l.push({el:e,width:e.attr("data-group-width")||e.attr("max-width")})}),o.flex=l),s>i){if(l.length>0)for(var r=0;rparseInt(c.css("min-width")))return;c.css("width",c.css("min-width"))}for(var r=a.length-1;r>=0;r--){var d=a[r];if(!d.hasClass("compactwidth")&&(d.addClass("compactwidth"),(s=e.get(0).getBoundingClientRect().right)<=i))break}o.rightedge=s}else{for(var r=0;ri)){d.addClass("compactwidth"),s=e.get(0).getBoundingClientRect().right;break}}if(o.rightedge=s,l.length>0&&e.find(".btn-slot.compactwidth").length<1)for(var r=0;r a[data-tab="+t+"]").parent().css("display",e?"":"none"),this.onResize())}}}())}),define("presentationeditor/main/app/view/Toolbar",["backbone","text!presentationeditor/main/app/template/Toolbar.template","text!presentationeditor/main/app/template/ToolbarView.template","common/main/lib/collection/Fonts","common/main/lib/component/Button","common/main/lib/component/ComboBox","common/main/lib/component/DataView","common/main/lib/component/ColorPalette","common/main/lib/component/ThemeColorPalette","common/main/lib/component/Menu","common/main/lib/component/DimensionPicker","common/main/lib/component/Window","common/main/lib/component/ComboBoxFonts","common/main/lib/component/ComboDataView","common/main/lib/component/SynchronizeTip","common/main/lib/component/Mixtbar"],function(t,e,i){"use strict";PE.enumLock={paragraphLock:"para-lock",shapeLock:"shape-lock",slideLock:"slide-lock",slideDeleted:"slide-deleted",noSlides:"no-slides",lostConnect:"disconnect",incIndentLock:"can-inc-indent",decIndentLock:"can-dec-indent",hyperlinkLock:"can-hyperlink",undoLock:"can-undo",redoLock:"can-redo",docPropsLock:"doc-props-lock",themeLock:"theme-lock",menuFileOpen:"menu-file-open",noParagraphSelected:"no-paragraph",noObjectSelected:"no-object",disableOnStart:"on-start",cantPrint:"cant-print",noTextSelected:"no-text",inEquation:"in-equation",commentLock:"can-comment"},PE.Views.Toolbar=Common.UI.Mixtbar.extend(_.extend(function(){return{el:"#toolbar",events:{},initialize:function(){var t=this;return t.paragraphControls=[],t.shapeControls=[],t.slideOnlyControls=[],t.synchTooltip=void 0,t.needShowSynchTip=!1,t.SchemeNames=[t.txtScheme1,t.txtScheme2,t.txtScheme3,t.txtScheme4,t.txtScheme5,t.txtScheme6,t.txtScheme7,t.txtScheme8,t.txtScheme9,t.txtScheme10,t.txtScheme11,t.txtScheme12,t.txtScheme13,t.txtScheme14,t.txtScheme15,t.txtScheme16,t.txtScheme17,t.txtScheme18,t.txtScheme19,t.txtScheme20,t.txtScheme21],t._state={hasCollaborativeChanges:void 0},t.binding={},Common.NotificationCenter.on("app:ready",t.onAppReady.bind(this)),this},applyLayout:function(t){var n=this;if(n.lockControls=[],t.isEdit){Common.UI.Mixtbar.prototype.initialize.call(this,{template:_.template(e),tabs:[{caption:n.textTabFile,action:"file",extcls:"canedit",haspanel:!1},{caption:n.textTabHome,action:"home",extcls:"canedit"},{caption:n.textTabInsert,action:"ins",extcls:"canedit"}]}),n.btnSaveCls="btn-save",n.btnSaveTip=this.tipSave+Common.Utils.String.platformKey("Ctrl+S");var o=PE.enumLock;n.btnChangeSlide=new Common.UI.Button({id:"id-toolbar-button-change-slide",cls:"btn-toolbar",iconCls:"toolbar__icon btn-changeslide",lock:[o.menuFileOpen,o.slideDeleted,o.slideLock,o.lostConnect,o.noSlides,o.disableOnStart],menu:!0}),n.slideOnlyControls.push(n.btnChangeSlide),n.btnPreview=new Common.UI.Button({id:"id-toolbar-button-preview",cls:"btn-toolbar",iconCls:"toolbar__icon btn-preview",lock:[o.menuFileOpen,o.slideDeleted,o.noSlides,o.disableOnStart],split:!0,menu:new Common.UI.Menu({items:[{caption:this.textShowBegin,value:0},{caption:this.textShowCurrent,value:1},{caption:this.textShowPresenterView,value:2},{caption:"--"},n.mnuShowSettings=new Common.UI.MenuItem({caption:this.textShowSettings,value:3,lock:[o.lostConnect]})]})}),n.slideOnlyControls.push(n.btnPreview),n.btnPrint=new Common.UI.Button({id:"id-toolbar-btn-print",cls:"btn-toolbar",iconCls:"toolbar__icon btn-print no-mask",lock:[o.slideDeleted,o.noSlides,o.cantPrint,o.disableOnStart],signals:["disabled"]}),n.slideOnlyControls.push(n.btnPrint),n.btnSave=new Common.UI.Button({id:"id-toolbar-btn-save",cls:"btn-toolbar",iconCls:"toolbar__icon no-mask "+n.btnSaveCls,lock:[o.lostConnect],signals:["disabled"]}),n.btnCollabChanges=n.btnSave,n.btnUndo=new Common.UI.Button({id:"id-toolbar-btn-undo",cls:"btn-toolbar",iconCls:"toolbar__icon btn-undo",lock:[o.undoLock,o.slideDeleted,o.lostConnect,o.disableOnStart],signals:["disabled"]}),n.slideOnlyControls.push(n.btnUndo),n.btnRedo=new Common.UI.Button({id:"id-toolbar-btn-redo",cls:"btn-toolbar",iconCls:"toolbar__icon btn-redo",lock:[o.redoLock,o.slideDeleted,o.lostConnect,o.disableOnStart],signals:["disabled"]}),n.slideOnlyControls.push(n.btnRedo),n.btnCopy=new Common.UI.Button({id:"id-toolbar-btn-copy",cls:"btn-toolbar",iconCls:"toolbar__icon btn-copy",lock:[o.slideDeleted,o.lostConnect,o.noSlides,o.disableOnStart]}),n.slideOnlyControls.push(n.btnCopy),n.btnPaste=new Common.UI.Button({id:"id-toolbar-btn-paste",cls:"btn-toolbar",iconCls:"toolbar__icon btn-paste",lock:[o.slideDeleted,o.paragraphLock,o.lostConnect,o.noSlides]}),n.paragraphControls.push(n.btnPaste),n.cmbFontName=new Common.UI.ComboBoxFonts({cls:"input-group-nr",menuCls:"scrollable-menu",menuStyle:"min-width: 325px;",hint:n.tipFontName,lock:[o.slideDeleted,o.paragraphLock,o.lostConnect,o.noSlides,o.noTextSelected,o.shapeLock],store:new Common.Collections.Fonts}),n.paragraphControls.push(n.cmbFontName),n.cmbFontSize=new Common.UI.ComboBox({cls:"input-group-nr",menuStyle:"min-width: 55px;",hint:n.tipFontSize,lock:[o.slideDeleted,o.paragraphLock,o.lostConnect,o.noSlides,o.noTextSelected,o.shapeLock],data:[{value:8,displayValue:"8"},{value:9,displayValue:"9"},{value:10,displayValue:"10"},{value:11,displayValue:"11"},{value:12,displayValue:"12"},{value:14,displayValue:"14"},{value:16,displayValue:"16"},{value:18,displayValue:"18"},{value:20,displayValue:"20"},{value:22,displayValue:"22"},{value:24,displayValue:"24"},{value:26,displayValue:"26"},{value:28,displayValue:"28"},{value:36,displayValue:"36"},{value:48,displayValue:"48"},{value:72,displayValue:"72"},{value:96,displayValue:"96"}]}),n.paragraphControls.push(n.cmbFontSize),n.btnIncFontSize=new Common.UI.Button({id:"id-toolbar-btn-incfont",cls:"btn-toolbar",iconCls:"toolbar__icon btn-incfont",lock:[o.slideDeleted,o.paragraphLock,o.lostConnect,o.noSlides,o.noTextSelected,o.shapeLock]}),n.paragraphControls.push(n.btnIncFontSize),n.btnDecFontSize=new Common.UI.Button({id:"id-toolbar-btn-decfont",cls:"btn-toolbar",iconCls:"toolbar__icon btn-decfont",lock:[o.slideDeleted,o.paragraphLock,o.lostConnect,o.noSlides,o.noTextSelected,o.shapeLock]}),n.paragraphControls.push(n.btnDecFontSize),n.btnBold=new Common.UI.Button({id:"id-toolbar-btn-bold",cls:"btn-toolbar",iconCls:"toolbar__icon btn-bold",lock:[o.slideDeleted,o.paragraphLock,o.lostConnect,o.noSlides,o.noTextSelected,o.shapeLock],enableToggle:!0}),n.paragraphControls.push(n.btnBold),n.btnItalic=new Common.UI.Button({id:"id-toolbar-btn-italic",cls:"btn-toolbar",iconCls:"toolbar__icon btn-italic",lock:[o.slideDeleted,o.paragraphLock,o.lostConnect,o.noSlides,o.noTextSelected,o.shapeLock],enableToggle:!0}),n.paragraphControls.push(n.btnItalic),n.btnUnderline=new Common.UI.Button({id:"id-toolbar-btn-underline",cls:"btn-toolbar",iconCls:"toolbar__icon btn-underline",lock:[o.slideDeleted,o.paragraphLock,o.lostConnect,o.noSlides,o.noTextSelected,o.shapeLock],enableToggle:!0}),n.paragraphControls.push(n.btnUnderline),n.btnStrikeout=new Common.UI.Button({id:"id-toolbar-btn-strikeout",cls:"btn-toolbar",iconCls:"toolbar__icon btn-strikeout",lock:[o.slideDeleted,o.paragraphLock,o.lostConnect,o.noSlides,o.noTextSelected,o.shapeLock],enableToggle:!0}),n.paragraphControls.push(n.btnStrikeout),n.btnSuperscript=new Common.UI.Button({id:"id-toolbar-btn-superscript",cls:"btn-toolbar",iconCls:"toolbar__icon btn-superscript",lock:[o.slideDeleted,o.paragraphLock,o.lostConnect,o.noSlides,o.noTextSelected,o.shapeLock,o.inEquation],enableToggle:!0,toggleGroup:"superscriptGroup"}),n.paragraphControls.push(n.btnSuperscript),n.btnSubscript=new Common.UI.Button({id:"id-toolbar-btn-subscript",cls:"btn-toolbar",iconCls:"toolbar__icon btn-subscript",lock:[o.slideDeleted,o.paragraphLock,o.lostConnect,o.noSlides,o.noTextSelected,o.shapeLock,o.inEquation],enableToggle:!0,toggleGroup:"superscriptGroup"}),n.paragraphControls.push(n.btnSubscript),n.btnFontColor=new Common.UI.Button({id:"id-toolbar-btn-fontcolor",cls:"btn-toolbar",iconCls:"toolbar__icon btn-fontcolor",lock:[o.slideDeleted,o.paragraphLock,o.lostConnect,o.noSlides,o.noTextSelected,o.shapeLock],split:!0,menu:new Common.UI.Menu({cls:"shifted-left",items:[{template:_.template('
    ')},{template:_.template(''+n.textNewColor+"")}]})}),n.paragraphControls.push(n.btnFontColor),n.btnClearStyle=new Common.UI.Button({id:"id-toolbar-btn-clearstyle",cls:"btn-toolbar",iconCls:"toolbar__icon btn-clearstyle",lock:[o.slideDeleted,o.paragraphLock,o.lostConnect,o.noSlides,o.noParagraphSelected]}),n.paragraphControls.push(n.btnClearStyle),n.btnCopyStyle=new Common.UI.Button({id:"id-toolbar-btn-copystyle",cls:"btn-toolbar",iconCls:"toolbar__icon btn-copystyle",lock:[o.slideDeleted,o.lostConnect,o.noSlides,o.noParagraphSelected,o.disableOnStart],enableToggle:!0}),n.slideOnlyControls.push(n.btnCopyStyle),n.btnMarkers=new Common.UI.Button({id:"id-toolbar-btn-markers",cls:"btn-toolbar",iconCls:"toolbar__icon btn-setmarkers",lock:[o.slideDeleted,o.paragraphLock,o.lostConnect,o.noSlides,o.noParagraphSelected],enableToggle:!0,toggleGroup:"markersGroup",split:!0,menu:!0}),n.paragraphControls.push(n.btnMarkers),n.btnNumbers=new Common.UI.Button({id:"id-toolbar-btn-numbering",cls:"btn-toolbar",iconCls:"toolbar__icon btn-numbering",lock:[o.slideDeleted,o.paragraphLock,o.lostConnect,o.noSlides,o.noParagraphSelected],enableToggle:!0,toggleGroup:"markersGroup",split:!0,menu:!0}),n.paragraphControls.push(n.btnNumbers);var s=function(t){var e={};for(var i in t)e[i]="object"==typeof t[i]?s(t[i]):t[i];return e};this.mnuMarkersPicker={conf:{index:0},selectByIndex:function(t){this.conf.index=t}},this.mnuNumbersPicker=s(this.mnuMarkersPicker),n.btnHorizontalAlign=new Common.UI.Button({id:"id-toolbar-btn-halign",cls:"btn-toolbar",iconCls:"toolbar__icon btn-align-left",icls:"btn-align-left",lock:[o.slideDeleted,o.paragraphLock,o.lostConnect,o.noSlides,o.noParagraphSelected],menu:new Common.UI.Menu({items:[{caption:n.textAlignLeft+Common.Utils.String.platformKey("Ctrl+L"),iconCls:"menu__icon btn-align-left",icls:"btn-align-left",checkable:!0,checkmark:!1,toggleGroup:"halignGroup",checked:!0,value:1},{caption:n.textAlignCenter+Common.Utils.String.platformKey("Ctrl+E"),iconCls:"menu__icon btn-align-center",icls:"btn-align-center",checkable:!0,checkmark:!1,toggleGroup:"halignGroup",value:2},{caption:n.textAlignRight+Common.Utils.String.platformKey("Ctrl+R"),iconCls:"menu__icon btn-align-right",icls:"btn-align-right",checkable:!0,checkmark:!1,toggleGroup:"halignGroup",value:0},{caption:n.textAlignJust+Common.Utils.String.platformKey("Ctrl+J"),iconCls:"menu__icon btn-align-just",icls:"btn-align-just",checkable:!0,checkmark:!1,toggleGroup:"halignGroup",value:3}]})}),n.paragraphControls.push(n.btnHorizontalAlign),n.btnVerticalAlign=new Common.UI.Button({id:"id-toolbar-btn-valign",cls:"btn-toolbar",lock:[o.slideDeleted,o.paragraphLock,o.lostConnect,o.noSlides,o.noParagraphSelected,o.noObjectSelected],iconCls:"toolbar__icon btn-align-middle",icls:"btn-align-middle",menu:new Common.UI.Menu({items:[{caption:n.textAlignTop,iconCls:"menu__icon btn-align-top",icls:"btn-align-top",checkable:!0,checkmark:!1,toggleGroup:"valignGroup",value:Asc.c_oAscVAlign.Top},{caption:n.textAlignMiddle,iconCls:"menu__icon btn-align-middle",icls:"btn-align-middle",checkable:!0,checkmark:!1,toggleGroup:"valignGroup",value:Asc.c_oAscVAlign.Center,checked:!0},{caption:n.textAlignBottom,iconCls:"menu__icon btn-align-bottom",icls:"btn-align-bottom",checkable:!0,checkmark:!1,toggleGroup:"valignGroup",value:Asc.c_oAscVAlign.Bottom}]})}),n.paragraphControls.push(n.btnVerticalAlign),n.btnDecLeftOffset=new Common.UI.Button({id:"id-toolbar-btn-decoffset",cls:"btn-toolbar",iconCls:"toolbar__icon btn-decoffset",lock:[o.decIndentLock,o.slideDeleted,o.paragraphLock,o.lostConnect,o.noSlides,o.noParagraphSelected]}),n.paragraphControls.push(n.btnDecLeftOffset),n.btnIncLeftOffset=new Common.UI.Button({id:"id-toolbar-btn-incoffset",cls:"btn-toolbar",iconCls:"toolbar__icon btn-incoffset",lock:[o.incIndentLock,o.slideDeleted,o.paragraphLock,o.lostConnect,o.noSlides,o.noParagraphSelected]}),n.paragraphControls.push(n.btnIncLeftOffset),n.btnLineSpace=new Common.UI.Button({id:"id-toolbar-btn-linespace",cls:"btn-toolbar",iconCls:"toolbar__icon btn-linespace",lock:[o.slideDeleted,o.paragraphLock,o.lostConnect,o.noSlides,o.noParagraphSelected],menu:new Common.UI.Menu({style:"min-width: 60px;",items:[{caption:"1.0",value:1,checkable:!0,toggleGroup:"linesize"},{caption:"1.15",value:1.15,checkable:!0,toggleGroup:"linesize"},{caption:"1.5",value:1.5,checkable:!0,toggleGroup:"linesize"},{caption:"2.0",value:2,checkable:!0,toggleGroup:"linesize"},{caption:"2.5",value:2.5,checkable:!0,toggleGroup:"linesize"},{caption:"3.0",value:3,checkable:!0,toggleGroup:"linesize"}]})}),n.paragraphControls.push(n.btnLineSpace),n.btnInsertTable=new Common.UI.Button({id:"tlbtn-inserttable",cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-inserttable",caption:n.capInsertTable,lock:[o.slideDeleted,o.lostConnect,o.noSlides,o.disableOnStart],menu:new Common.UI.Menu({cls:"shifted-left",items:[{template:_.template('
    ')},{caption:n.mniCustomTable,value:"custom"}]})}),n.slideOnlyControls.push(n.btnInsertTable),n.btnInsertChart=new Common.UI.Button({id:"tlbtn-insertchart",cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-insertchart",caption:n.capInsertChart,lock:[o.slideDeleted,o.lostConnect,o.noSlides,o.disableOnStart],menu:!0}),n.slideOnlyControls.push(n.btnInsertChart),n.btnInsertEquation=new Common.UI.Button({id:"tlbtn-insertequation",cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-insertequation",caption:n.capInsertEquation,lock:[o.slideDeleted,o.lostConnect,o.noSlides,o.disableOnStart],split:!0,menu:new Common.UI.Menu({cls:"menu-shapes"})}),n.slideOnlyControls.push(this.btnInsertEquation),n.btnInsertSymbol=new Common.UI.Button({id:"tlbtn-insertsymbol",cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-symbol",caption:n.capBtnInsSymbol,lock:[o.slideDeleted,o.paragraphLock,o.lostConnect,o.noSlides,o.noParagraphSelected]}),n.paragraphControls.push(n.btnInsertSymbol),n.btnInsertHyperlink=new Common.UI.Button({id:"tlbtn-insertlink",cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-inserthyperlink",caption:n.capInsertHyperlink,lock:[o.hyperlinkLock,o.slideDeleted,o.paragraphLock,o.lostConnect,o.noSlides,o.noParagraphSelected]}),n.paragraphControls.push(n.btnInsertHyperlink),n.btnInsertTextArt=new Common.UI.Button({id:"tlbtn-inserttextart",cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-textart",caption:n.capInsertTextArt,lock:[o.slideDeleted,o.lostConnect,o.noSlides,o.disableOnStart],menu:new Common.UI.Menu({cls:"menu-shapes",items:[{template:_.template('
    ')}]})}),n.slideOnlyControls.push(n.btnInsertTextArt),n.btnEditHeader=new Common.UI.Button({id:"id-toolbar-btn-editheader",cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-editheader",caption:n.capBtnInsHeader,lock:[o.slideDeleted,o.lostConnect,o.noSlides,o.disableOnStart]}),n.slideOnlyControls.push(n.btnEditHeader),n.btnInsDateTime=new Common.UI.Button({id:"id-toolbar-btn-datetime",cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-datetime",caption:n.capBtnDateTime,lock:[o.slideDeleted,o.lostConnect,o.noSlides,o.paragraphLock,o.disableOnStart]}),n.slideOnlyControls.push(n.btnInsDateTime),n.btnInsSlideNum=new Common.UI.Button({id:"id-toolbar-btn-slidenum",cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-pagenum",caption:n.capBtnSlideNum,lock:[o.slideDeleted,o.lostConnect,o.noSlides,o.paragraphLock,o.disableOnStart]}),n.slideOnlyControls.push(n.btnInsSlideNum),window.AscDesktopEditor&&window.AscDesktopEditor.IsSupportMedia&&window.AscDesktopEditor.IsSupportMedia()&&(n.btnInsAudio=new Common.UI.Button({id:"tlbtn-insaudio",cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-audio",caption:n.capInsertAudio,lock:[o.slideDeleted,o.lostConnect,o.noSlides,o.disableOnStart]}),n.slideOnlyControls.push(n.btnInsAudio),n.btnInsVideo=new Common.UI.Button({id:"tlbtn-insvideo",cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-video",caption:n.capInsertVideo,lock:[o.slideDeleted,o.lostConnect,o.noSlides,o.disableOnStart]}),n.slideOnlyControls.push(n.btnInsVideo)),n.btnColorSchemas=new Common.UI.Button({id:"id-toolbar-btn-colorschemas",cls:"btn-toolbar",iconCls:"toolbar__icon btn-colorschemas",lock:[o.themeLock,o.slideDeleted,o.lostConnect,o.noSlides,o.disableOnStart],menu:new Common.UI.Menu({cls:"shifted-left",items:[],restoreHeight:!0})}),n.slideOnlyControls.push(n.btnColorSchemas),n.mniAlignToSlide=new Common.UI.MenuItem({caption:n.txtSlideAlign,checkable:!0,toggleGroup:"slidealign",value:-1}).on("click",function(t){Common.Utils.InternalSettings.set("pe-align-to-slide",!0)}),n.mniAlignObjects=new Common.UI.MenuItem({caption:n.txtObjectsAlign,checkable:!0,toggleGroup:"slidealign",value:-1}).on("click",function(t){Common.Utils.InternalSettings.set("pe-align-to-slide",!1)}),n.mniDistribHor=new Common.UI.MenuItem({caption:n.txtDistribHor,iconCls:"menu__icon shape-distribute-hor",value:6}),n.mniDistribVert=new Common.UI.MenuItem({caption:n.txtDistribVert,iconCls:"menu__icon shape-distribute-vert",value:7}),n.btnShapeAlign=new Common.UI.Button({id:"id-toolbar-btn-shape-align",cls:"btn-toolbar",iconCls:"toolbar__icon shape-align-left",lock:[o.slideDeleted,o.shapeLock,o.lostConnect,o.noSlides,o.noObjectSelected,o.disableOnStart],menu:new Common.UI.Menu({cls:"shifted-right",items:[{caption:n.textShapeAlignLeft,iconCls:"menu__icon shape-align-left",value:Asc.c_oAscAlignShapeType.ALIGN_LEFT},{caption:n.textShapeAlignCenter,iconCls:"menu__icon shape-align-center",value:Asc.c_oAscAlignShapeType.ALIGN_CENTER},{caption:n.textShapeAlignRight,iconCls:"menu__icon shape-align-right",value:Asc.c_oAscAlignShapeType.ALIGN_RIGHT},{caption:n.textShapeAlignTop,iconCls:"menu__icon shape-align-top",value:Asc.c_oAscAlignShapeType.ALIGN_TOP},{caption:n.textShapeAlignMiddle,iconCls:"menu__icon shape-align-middle",value:Asc.c_oAscAlignShapeType.ALIGN_MIDDLE},{caption:n.textShapeAlignBottom,iconCls:"menu__icon shape-align-bottom",value:Asc.c_oAscAlignShapeType.ALIGN_BOTTOM},{caption:"--"},n.mniDistribHor,n.mniDistribVert,{caption:"--"},n.mniAlignToSlide,n.mniAlignObjects]})}),n.shapeControls.push(n.btnShapeAlign),n.slideOnlyControls.push(n.btnShapeAlign),n.btnShapeArrange=new Common.UI.Button({id:"id-toolbar-btn-shape-arrange",cls:"btn-toolbar",iconCls:"toolbar__icon arrange-front",lock:[o.slideDeleted,o.lostConnect,o.noSlides,o.noObjectSelected,o.disableOnStart],menu:new Common.UI.Menu({items:[{caption:n.textArrangeFront,iconCls:"menu__icon arrange-front",value:1},{caption:n.textArrangeBack,iconCls:"menu__icon arrange-back",value:2},{caption:n.textArrangeForward,iconCls:"menu__icon arrange-forward",value:3},{caption:n.textArrangeBackward,iconCls:"menu__icon arrange-backward",value:4},{caption:"--"},n.mnuGroupShapes=new Common.UI.MenuItem({caption:n.txtGroup,iconCls:"menu__icon shape-group",value:5}),n.mnuUnGroupShapes=new Common.UI.MenuItem({caption:n.txtUngroup,iconCls:"menu__icon shape-ungroup",value:6})]})}),n.slideOnlyControls.push(n.btnShapeArrange),n.btnSlideSize=new Common.UI.Button({id:"id-toolbar-btn-slide-size",cls:"btn-toolbar",iconCls:"toolbar__icon btn-slidesize",lock:[o.docPropsLock,o.slideDeleted,o.lostConnect,o.disableOnStart],menu:new Common.UI.Menu({items:[{caption:n.mniSlideStandard,checkable:!0,toggleGroup:"slidesize",value:0},{caption:n.mniSlideWide,checkable:!0,toggleGroup:"slidesize",value:1},{caption:"--"},{caption:n.mniSlideAdvanced,value:"advanced"}]})}),n.slideOnlyControls.push(n.btnSlideSize),n.listTheme=new Common.UI.ComboDataView({cls:"combo-styles",itemWidth:85,enableKeyEvents:!0,itemHeight:38,lock:[o.themeLock,o.lostConnect,o.noSlides],beforeOpenHandler:function(t){var e=this,i=e.openButton.menu;if(i.cmpEl){var n=$(e.cmpEl.find(".dataview.inner .style").get(0)).parent(),o=n.is(":visible")?parseInt(n.css("width")):e.itemWidth+parseInt(n.css("padding-left"))+parseInt(n.css("padding-right"))+parseInt(n.css("border-left-width"))+parseInt(n.css("border-right-width")),s=e.menuPicker.store.length>=6?6:e.menuPicker.store.length,a=Math.min(e.menuPicker.store.length,Math.round($(".dataview",$(e.fieldPicker.el)).width()/(-1+o)+.5));a=a','
    background-image: url(<%= imageUrl %>);<% } %> background-position: 0 -<%= offsety %>px;">
    ',""].join("")),n.listTheme.menuPicker.itemTemplate=_.template(['
    ','
    background-image: url(<%= imageUrl %>);<% } %> background-position: 0 -<%= offsety %>px;">
    ',"
    "].join("")),this.lockControls=[this.btnChangeSlide,this.btnSave,this.btnCopy,this.btnPaste,this.btnUndo,this.btnRedo,this.cmbFontName,this.cmbFontSize,this.btnIncFontSize,this.btnDecFontSize,this.btnBold,this.btnItalic,this.btnUnderline,this.btnStrikeout,this.btnSuperscript,this.btnSubscript,this.btnFontColor,this.btnClearStyle,this.btnCopyStyle,this.btnMarkers,this.btnNumbers,this.btnDecLeftOffset,this.btnIncLeftOffset,this.btnLineSpace,this.btnHorizontalAlign,this.btnVerticalAlign,this.btnShapeArrange,this.btnShapeAlign,this.btnInsertTable,this.btnInsertChart,this.btnInsertEquation,this.btnInsertSymbol,this.btnInsertHyperlink,this.btnColorSchemas,this.btnSlideSize,this.listTheme,this.mnuShowSettings],_.each([n.btnSave].concat(n.paragraphControls),function(t){_.isFunction(t.setDisabled)&&t.setDisabled(!0)}),this.lockToolbar(PE.enumLock.disableOnStart,!0,{array:n.slideOnlyControls.concat(n.shapeControls)}),this.on("render:after",_.bind(this.onToolbarAfterRender,this))}else Common.UI.Mixtbar.prototype.initialize.call(this,{template:_.template(i),tabs:[{caption:n.textTabFile,action:"file",haspanel:!1}]});return this},lockToolbar:function(t,e,i){Common.Utils.lockControls(t,e,i,this.lockControls)},render:function(t){var e=this;return this.fireEvent("render:before",[this]),e.isCompactView=t.compactview,t.isEdit?e.$el.html(e.rendererComponents(e.$layout)):(e.$layout.find(".canedit").hide(),e.$layout.addClass("folded"),e.$el.html(e.$layout)),this.fireEvent("render:after",[this]),Common.UI.Mixtbar.prototype.afterRender.call(this),Common.NotificationCenter.on({"window:resize":function(){Common.UI.Mixtbar.prototype.onResize.apply(e,arguments)}}),t.isEdit&&(e.setTab("home"),e.processPanelVisible()),e.isCompactView&&e.setFolded(!0),this},onTabClick:function(t){var e=this,i=$(t.currentTarget).find("> a[data-tab]").data("tab"),n=e.isTabActive("file");Common.UI.Mixtbar.prototype.onTabClick.apply(e,arguments),n?e.fireEvent("file:close"):"file"==i&&(e.fireEvent("file:open"),e.setTab(i))},rendererComponents:function(t){var e=$(t),i=function(t,i){Common.Utils.injectComponent(e.find(t),i)};i("#slot-field-fontname",this.cmbFontName),i("#slot-field-fontsize",this.cmbFontSize),i("#slot-btn-changeslide",this.btnChangeSlide),i("#slot-btn-preview",this.btnPreview),i("#slot-btn-print",this.btnPrint),i("#slot-btn-save",this.btnSave),i("#slot-btn-undo",this.btnUndo),i("#slot-btn-redo",this.btnRedo),i("#slot-btn-copy",this.btnCopy),i("#slot-btn-paste",this.btnPaste),i("#slot-btn-bold",this.btnBold),i("#slot-btn-italic",this.btnItalic),i("#slot-btn-underline",this.btnUnderline),i("#slot-btn-strikeout",this.btnStrikeout),i("#slot-btn-superscript",this.btnSuperscript),i("#slot-btn-subscript",this.btnSubscript),i("#slot-btn-incfont",this.btnIncFontSize),i("#slot-btn-decfont",this.btnDecFontSize),i("#slot-btn-fontcolor",this.btnFontColor),i("#slot-btn-clearstyle",this.btnClearStyle),i("#slot-btn-copystyle",this.btnCopyStyle),i("#slot-btn-markers",this.btnMarkers),i("#slot-btn-numbering",this.btnNumbers),i("#slot-btn-incoffset",this.btnIncLeftOffset),i("#slot-btn-decoffset",this.btnDecLeftOffset),i("#slot-btn-halign",this.btnHorizontalAlign),i("#slot-btn-valign",this.btnVerticalAlign),i("#slot-btn-linespace",this.btnLineSpace),i("#slot-btn-arrange-shape",this.btnShapeArrange),i("#slot-btn-align-shape",this.btnShapeAlign),i("#slot-btn-insertequation",this.btnInsertEquation),i("#slot-btn-inssymbol",this.btnInsertSymbol),i("#slot-btn-insertlink",this.btnInsertHyperlink),i("#slot-btn-inserttable",this.btnInsertTable),i("#slot-btn-insertchart",this.btnInsertChart),i("#slot-btn-instextart",this.btnInsertTextArt),i("#slot-btn-colorschemas",this.btnColorSchemas),i("#slot-btn-slidesize",this.btnSlideSize),i("#slot-field-styles",this.listTheme),i("#slot-btn-editheader",this.btnEditHeader),i("#slot-btn-datetime",this.btnInsDateTime),i("#slot-btn-slidenum",this.btnInsSlideNum),this.btnInsAudio&&i("#slot-btn-insaudio",this.btnInsAudio),this.btnInsVideo&&i("#slot-btn-insvideo",this.btnInsVideo),this.btnInsAudio||this.btnInsVideo||e.find("#slot-btn-insaudio").parents(".group").hide().prev().hide(),this.btnsInsertImage=Common.Utils.injectButtons(e.find(".slot-insertimg"),"tlbtn-insertimage-","toolbar__icon btn-insertimage",this.capInsertImage,[PE.enumLock.slideDeleted,PE.enumLock.lostConnect,PE.enumLock.noSlides,PE.enumLock.disableOnStart],!1,!0),this.btnsInsertText=Common.Utils.injectButtons(e.find(".slot-instext"),"tlbtn-inserttext-","toolbar__icon btn-text",this.capInsertText,[PE.enumLock.slideDeleted,PE.enumLock.lostConnect,PE.enumLock.noSlides,PE.enumLock.disableOnStart],!1,!1,!0),this.btnsInsertShape=Common.Utils.injectButtons(e.find(".slot-insertshape"),"tlbtn-insertshape-","toolbar__icon btn-insertshape",this.capInsertShape,[PE.enumLock.slideDeleted,PE.enumLock.lostConnect,PE.enumLock.noSlides,PE.enumLock.disableOnStart],!1,!0,!0),this.btnsAddSlide=Common.Utils.injectButtons(e.find(".slot-addslide"),"tlbtn-addslide-","toolbar__icon btn-addslide",this.capAddSlide,[PE.enumLock.menuFileOpen,PE.enumLock.lostConnect,PE.enumLock.disableOnStart],!0,!0);var n=this.btnsInsertImage.concat(this.btnsInsertText,this.btnsInsertShape,this.btnsAddSlide);return this.lockToolbar(PE.enumLock.disableOnStart,!0,{array:n}),Array.prototype.push.apply(this.slideOnlyControls,n),Array.prototype.push.apply(this.lockControls,n),e},onAppReady:function(t){var e=this;t.isEdit&&(e.btnsInsertImage.forEach(function(i){i.updateHint(e.tipInsertImage),i.setMenu(new Common.UI.Menu({items:[{caption:e.mniImageFromFile,value:"file"},{caption:e.mniImageFromUrl,value:"url"},{caption:e.mniImageFromStorage,value:"storage"}]}).on("item:click",function(t,i,n){e.fireEvent("insert:image",[i.value])})),i.menu.items[2].setVisible(t.canRequestInsertImage||t.fileChoiceUrl&&t.fileChoiceUrl.indexOf("{documentType}")>-1)}),e.btnsInsertText.forEach(function(t){t.updateHint(e.tipInsertText),t.on("click",function(t,i){e.fireEvent("insert:text",[t.pressed?"begin":"end"])})}),e.btnsInsertShape.forEach(function(t){t.updateHint(e.tipInsertShape),t.setMenu(new Common.UI.Menu({cls:"menu-shapes"}).on("hide:after",function(t){e.fireEvent("insert:shape",["menu:hide"])}))}),e.btnsAddSlide.forEach(function(t,i){t.updateHint(e.tipAddSlide+Common.Utils.String.platformKey("Ctrl+M")),t.setMenu(new Common.UI.Menu({items:[{template:_.template('')}]})),t.on("click",function(t,i){e.fireEvent("add:slide")})}))},createDelayedElements:function(){this.btnChangeSlide.updateHint(this.tipChangeSlide),this.btnPreview.updateHint(this.tipPreview),this.btnPrint.updateHint(this.tipPrint+Common.Utils.String.platformKey("Ctrl+P")),this.btnSave.updateHint(this.btnSaveTip),this.btnUndo.updateHint(this.tipUndo+Common.Utils.String.platformKey("Ctrl+Z")),this.btnRedo.updateHint(this.tipRedo+Common.Utils.String.platformKey("Ctrl+Y")),this.btnCopy.updateHint(this.tipCopy+Common.Utils.String.platformKey("Ctrl+C")),this.btnPaste.updateHint(this.tipPaste+Common.Utils.String.platformKey("Ctrl+V")),this.btnIncFontSize.updateHint(this.tipIncFont+Common.Utils.String.platformKey("Ctrl+]")),this.btnDecFontSize.updateHint(this.tipDecFont+Common.Utils.String.platformKey("Ctrl+[")),this.btnBold.updateHint(this.textBold+Common.Utils.String.platformKey("Ctrl+B")),this.btnItalic.updateHint(this.textItalic+Common.Utils.String.platformKey("Ctrl+I")),this.btnUnderline.updateHint(this.textUnderline+Common.Utils.String.platformKey("Ctrl+U")),this.btnStrikeout.updateHint(this.textStrikeout),this.btnSuperscript.updateHint(this.textSuperscript),this.btnSubscript.updateHint(this.textSubscript),this.btnFontColor.updateHint(this.tipFontColor),this.btnClearStyle.updateHint(this.tipClearStyle),this.btnCopyStyle.updateHint(this.tipCopyStyle+Common.Utils.String.platformKey("Ctrl+Shift+C")),this.btnMarkers.updateHint(this.tipMarkers),this.btnNumbers.updateHint(this.tipNumbers),this.btnHorizontalAlign.updateHint(this.tipHAligh),this.btnVerticalAlign.updateHint(this.tipVAligh),this.btnDecLeftOffset.updateHint(this.tipDecPrLeft+Common.Utils.String.platformKey("Ctrl+Shift+M")),this.btnIncLeftOffset.updateHint(this.tipIncPrLeft),this.btnLineSpace.updateHint(this.tipLineSpace),this.btnInsertTable.updateHint(this.tipInsertTable),this.btnInsertChart.updateHint(this.tipInsertChart),this.btnInsertEquation.updateHint(this.tipInsertEquation),this.btnInsertSymbol.updateHint(this.tipInsertSymbol),this.btnInsertHyperlink.updateHint(this.tipInsertHyperlink+Common.Utils.String.platformKey("Ctrl+K")),this.btnInsertTextArt.updateHint(this.tipInsertTextArt),this.btnInsAudio&&this.btnInsAudio.updateHint(this.tipInsertAudio),this.btnInsVideo&&this.btnInsVideo.updateHint(this.tipInsertVideo),this.btnColorSchemas.updateHint(this.tipColorSchemas),this.btnShapeAlign.updateHint(this.tipShapeAlign),this.btnShapeArrange.updateHint(this.tipShapeArrange),this.btnSlideSize.updateHint(this.tipSlideSize),this.btnEditHeader.updateHint(this.tipEditHeader), -this.btnInsDateTime.updateHint(this.tipDateTime),this.btnInsSlideNum.updateHint(this.tipSlideNum);var t=this;this.btnMarkers.setMenu(new Common.UI.Menu({cls:"shifted-left",style:"min-width: 139px",items:[{template:_.template('')},this.mnuMarkerSettings=new Common.UI.MenuItem({caption:this.textListSettings,value:"settings"})]})),this.btnNumbers.setMenu(new Common.UI.Menu({cls:"shifted-left",items:[{template:_.template('')},this.mnuNumberSettings=new Common.UI.MenuItem({caption:this.textListSettings,value:"settings"})]})),this.btnChangeSlide.setMenu(new Common.UI.Menu({items:[{template:_.template('')}]})),this.btnInsertChart.setMenu(new Common.UI.Menu({style:"width: 364px;padding-top: 12px;",items:[{template:_.template('')}]}));var e=function(i){new Common.UI.DataView({el:$("#id-toolbar-menu-insertchart"),parentMenu:i,showLast:!1,restoreHeight:421,groups:new Common.UI.DataViewGroupStore(Common.define.chartData.getChartGroupData()),store:new Common.UI.DataViewStore(Common.define.chartData.getChartData()),itemTemplate:_.template('
    ')}).on("item:click",function(e,i,n,o){n&&t.fireEvent("add:chart",[n.get("type")])}),i.off("show:before",e)};this.btnInsertChart.menu.on("show:before",e);var i=function(e){var n=PE.getCollection("Common.Collections.TextArt");n.length<1&&PE.getController("Main").fillTextArt(t.api.asc_getTextArtPreviews()),new Common.UI.DataView({el:$("#view-insert-art",e.$el),store:n,parentMenu:e,showLast:!1,itemTemplate:_.template('
    ')}).on("item:click",function(i,n,o,s){o&&t.fireEvent("insert:textart",[o.get("data")]),"click"!==s.type&&e.hide()}),e.off("show:before",i)};this.btnInsertTextArt.menu.on("show:before",i);var n=this.mnuMarkersPicker.conf;this.mnuMarkersPicker=new Common.UI.DataView({el:$("#id-toolbar-menu-markers"),parentMenu:this.btnMarkers.menu,restoreHeight:138,allowScrollbar:!1,store:new Common.UI.DataViewStore([{offsety:0,data:{type:0,subtype:-1}},{offsety:38,data:{type:0,subtype:1}},{offsety:76,data:{type:0,subtype:2}},{offsety:114,data:{type:0,subtype:3}},{offsety:152,data:{type:0,subtype:4}},{offsety:190,data:{type:0,subtype:5}},{offsety:228,data:{type:0,subtype:6}},{offsety:266,data:{type:0,subtype:7}},{offsety:684,data:{type:0,subtype:8}}]),itemTemplate:_.template('
    ')}),n&&this.mnuMarkersPicker.selectByIndex(n.index,!0),n=this.mnuNumbersPicker.conf,this.mnuNumbersPicker=new Common.UI.DataView({el:$("#id-toolbar-menu-numbering"),parentMenu:this.btnNumbers.menu,restoreHeight:92,allowScrollbar:!1,store:new Common.UI.DataViewStore([{offsety:0,data:{type:1,subtype:-1}},{offsety:570,data:{type:1,subtype:4}},{offsety:532,data:{type:1,subtype:5}},{offsety:608,data:{type:1,subtype:6}},{offsety:418,data:{type:1,subtype:1}},{offsety:456,data:{type:1,subtype:2}},{offsety:494,data:{type:1,subtype:3}},{offsety:646,data:{type:1,subtype:7}}]),itemTemplate:_.template('
    ')}),n&&this.mnuNumbersPicker.selectByIndex(n.index,!0),this.mnuTablePicker=new Common.UI.DimensionPicker({el:$("#id-toolbar-menu-tablepicker"),minRows:8,minColumns:10,maxRows:8,maxColumns:10}),this.showSynchTip=!Common.localStorage.getBool("pe-hide-synch"),this.needShowSynchTip&&(this.needShowSynchTip=!1,this.onCollaborativeChanges())},onToolbarAfterRender:function(t){if(this.btnFontColor.cmpEl){var e=$('
    ');$("button:first-child",this.btnFontColor.cmpEl).append(e),e.css("background-color",this.btnFontColor.currentColor||"transparent"),this.mnuFontColorPicker=new Common.UI.ThemeColorPalette({el:$("#id-toolbar-menu-fontcolor")})}},setApi:function(t){return this.api=t,this.api&&(this.api.asc_registerCallback("asc_onSendThemeColorSchemes",_.bind(this.onSendThemeColorSchemes,this)),this.api.asc_registerCallback("asc_onCollaborativeChanges",_.bind(this.onCollaborativeChanges,this)),this.api.asc_registerCallback("asc_onAuthParticipantsChanged",_.bind(this.onApiUsersChanged,this)),this.api.asc_registerCallback("asc_onParticipantsChanged",_.bind(this.onApiUsersChanged,this))),this},setMode:function(t){t.isDisconnected?(this.lockToolbar(PE.enumLock.lostConnect,!0),t.enableDownload||this.lockToolbar(PE.enumLock.cantPrint,!0,{array:[this.btnPrint]})):this.lockToolbar(PE.enumLock.cantPrint,!t.canPrint,{array:[this.btnPrint]}),this.mode=t},onSendThemeColorSchemes:function(t){var e=this,i=e.btnColorSchemas.menu;if(i){i&&i.items.length>0&&_.each(i.items,function(t){t.remove()}),null==i&&(i=new Common.UI.Menu({cls:"shifted-left",restoreHeight:!0})),i.items=[];var n=_.template(['','',"<% _.each(options.colors, function(color) { %>",'',"<% }) %>","",'<%= caption %>',""].join(""));_.each(t,function(t,o){for(var s=t.get_colors(),a=[],l=2;l<7;l++){var r="#"+Common.Utils.ThemeColor.getHexColor(s[l].get_r(),s[l].get_g(),s[l].get_b());a.push(r)}21==o&&i.addItem({caption:"--"});var c=t.get_name();i.addItem({template:n,cls:"color-schemas-menu",colors:a,caption:o<21?e.SchemeNames[o]||c:c,value:o,checkable:!0,toggleGroup:"menuSchema"})},this)}},onCollaborativeChanges:function(){if(!this._state.hasCollaborativeChanges){if(!this.btnCollabChanges.rendered)return void(this.needShowSynchTip=!0);var t=PE.getController("Viewport").getView("DocumentPreview");if(t&&t.isVisible())return void(this.needShowSynchTip=!0);this._state.hasCollaborativeChanges=!0,this.btnCollabChanges.cmpEl.addClass("notify"),this.showSynchTip?(this.btnCollabChanges.updateHint(""),void 0===this.synchTooltip&&this.createSynchTip(),this.synchTooltip.show()):this.btnCollabChanges.updateHint(this.tipSynchronize+Common.Utils.String.platformKey("Ctrl+S")),this.btnSave.setDisabled(!1),Common.Gateway.collaborativeChanges()}},createSynchTip:function(){this.synchTooltip=new Common.UI.SynchronizeTip({extCls:this.mode.customization&&this.mode.customization.compactHeader?void 0:"inc-index",target:this.btnCollabChanges.$el}),this.synchTooltip.on("dontshowclick",function(){this.showSynchTip=!1,this.synchTooltip.hide(),this.btnCollabChanges.updateHint(this.tipSynchronize+Common.Utils.String.platformKey("Ctrl+S")),Common.localStorage.setItem("pe-hide-synch",1)},this),this.synchTooltip.on("closeclick",function(){this.synchTooltip.hide(),this.btnCollabChanges.updateHint(this.tipSynchronize+Common.Utils.String.platformKey("Ctrl+S"))},this)},synchronizeChanges:function(){if(this.btnCollabChanges.rendered){var t=this;t.btnCollabChanges.cmpEl.hasClass("notify")&&(t.btnCollabChanges.cmpEl.removeClass("notify"),this.synchTooltip&&this.synchTooltip.hide(),this.btnCollabChanges.updateHint(this.btnSaveTip),this.btnSave.setDisabled(!t.mode.forcesave),this._state.hasCollaborativeChanges=!1)}},onApiUsersChanged:function(t){var e=[];_.each(t,function(t){t.asc_getView()||e.push(t)});var i=_.size(e),n=i>1?"btn-save-coauth":"btn-save";n!==this.btnSaveCls&&this.btnCollabChanges.rendered&&(this.btnSaveTip=(i>1?this.tipSaveCoauth:this.tipSave)+Common.Utils.String.platformKey("Ctrl+S"),this.btnCollabChanges.updateHint(this.btnSaveTip),this.btnCollabChanges.$icon.removeClass(this.btnSaveCls).addClass(n),this.btnSaveCls=n)},onSlidePickerShowAfter:function(t){if(t._needRecalcSlideLayout&&t.cmpEl&&t.dataViewItems.length>0){var e=t.dataViewItems,i=$(e[0].el),n=i.outerWidth()+parseInt(i.css("margin-left"))+parseInt(i.css("margin-right")),o=Math.floor(t.options.restoreWidth/n+.5)||1,s=0,a=0;t.cmpEl.width(n*o+11);for(var l=0;la?a=c:r.css({height:a}),s++,s>o-1&&(s=0,a=0)}t._needRecalcSlideLayout=!1}},updateAutoshapeMenu:function(t,e){var i=this,n=function(t){for(var o=0;o')}).on("item:click",function(t,e,n,o){"click"!==o.type&&Common.UI.Menu.Manager.hideAll(),n&&i.fireEvent("insert:shape",[n.get("data").shapeType])})}t.off("show:after",n)};t.on("show:after",n);for(var o=0;o')}]})});t.addItem(a)}},updateAddSlideMenu:function(t){if(!(t.size()<1)){var e=this;e.binding.onShowBeforeAddSlide?e.btnsAddSlide.concat(e.btnChangeSlide).forEach(function(t,e){t.mnuSlidePicker&&(t.mnuSlidePicker._needRecalcSlideLayout=!0)}):(e.binding.onShowBeforeAddSlide=function(t){var i=this.iconCls.indexOf("btn-changeslide")>-1,n=new Common.UI.DataView({el:$(".menu-layouts",t.$el),parentMenu:t,showLast:i,restoreHeight:300,restoreWidth:302,style:"max-height: 300px;",store:PE.getCollection("SlideLayouts"),itemTemplate:_.template(['
    ','
    ','
    <%= title %>
    ',"
    "].join(""))});n.on("item:click",function(t,n,o,s){"click"!==s.type&&Common.UI.Menu.Manager.hideAll(),o&&e.fireEvent(i?"change:slide":"add:slide",[o.get("data").idx])}),t&&t.on("show:after",function(){if(e.onSlidePickerShowAfter(n),n.scroller.update({alwaysVisibleY:!0}),i){var t=n.store.findLayoutByIndex(n.options.layout_index);t&&(n.selectRecord(t,!0),n.scrollToRecord(t))}else n.scroller.scrollTop(0)}),t.off("show:before",e.binding.onShowBeforeAddSlide),i&&this.mnuSlidePicker&&(n.options.layout_index=this.mnuSlidePicker.options.layout_index),this.mnuSlidePicker=n,this.mnuSlidePicker._needRecalcSlideLayout=!0},e.btnsAddSlide.concat(e.btnChangeSlide).forEach(function(t,i){t.menu.on("show:before",e.binding.onShowBeforeAddSlide,t)}))}},textBold:"Bold",textItalic:"Italic",textUnderline:"Underline",textStrikeout:"Strikeout",textSuperscript:"Superscript",textSubscript:"Subscript",tipFontName:"Font Name",tipFontSize:"Font Size",tipCopy:"Copy",tipPaste:"Paste",tipUndo:"Undo",tipRedo:"Redo",tipPrint:"Print",tipSave:"Save",tipFontColor:"Font color",tipMarkers:"Bullets",tipNumbers:"Numbering",tipBack:"Back",tipClearStyle:"Clear Style",tipCopyStyle:"Copy Style",textTitleError:"Error",tipHAligh:"Horizontal Align",tipVAligh:"Vertical Align",textAlignTop:"Align text to the top",textAlignMiddle:"Align text to the middle",textAlignBottom:"Align text to the bottom",textAlignLeft:"Left align text",textAlignRight:"Right align text",textAlignCenter:"Center text",textAlignJust:"Justify",tipDecPrLeft:"Decrease Indent",tipIncPrLeft:"Increase Indent",tipLineSpace:"Line Spacing",tipInsertTable:"Insert Table",tipInsertImage:"Insert Image",mniImageFromFile:"Image from file",mniImageFromUrl:"Image from url",mniCustomTable:"Insert Custom Table",tipInsertHyperlink:"Add Hyperlink",tipInsertText:"Insert Text",tipInsertTextArt:"Insert Text Art",tipInsertShape:"Insert Autoshape",tipPreview:"Start Slideshow",tipAddSlide:"Add Slide",tipShapeAlign:"Align Shape",tipShapeArrange:"Arrange Shape",textShapeAlignLeft:"Align Left",textShapeAlignRight:"Align Right",textShapeAlignCenter:"Align Center",textShapeAlignTop:"Align Top",textShapeAlignBottom:"Align Bottom",textShapeAlignMiddle:"Align Middle",textArrangeFront:"Bring To Front",textArrangeBack:"Send To Back",textArrangeForward:"Bring Forward",textArrangeBackward:"Send Backward",txtGroup:"Group",txtUngroup:"Ungroup",txtDistribHor:"Distribute Horizontally",txtDistribVert:"Distribute Vertically",tipChangeSlide:"Change Slide Layout",tipColorSchemas:"Change Color Scheme",textNewColor:"Add New Custom Color",mniSlideStandard:"Standard (4:3)",mniSlideWide:"Widescreen (16:9)",mniSlideAdvanced:"Advanced Settings",tipSlideSize:"Select Slide Size",tipInsertChart:"Insert Chart",tipSynchronize:"The document has been changed by another user. Please click to save your changes and reload the updates.",txtScheme1:"Office",txtScheme2:"Grayscale",txtScheme3:"Apex",txtScheme4:"Aspect",txtScheme5:"Civic",txtScheme6:"Concourse",txtScheme7:"Equity",txtScheme8:"Flow",txtScheme9:"Foundry",txtScheme10:"Median",txtScheme11:"Metro",txtScheme12:"Module",txtScheme13:"Opulent",txtScheme14:"Oriel",txtScheme15:"Origin",txtScheme16:"Paper",txtScheme17:"Solstice",txtScheme18:"Technic",txtScheme19:"Trek",txtScheme20:"Urban",txtScheme21:"Verve",tipSlideTheme:"Slide Theme",tipSaveCoauth:"Save your changes for the other users to see them.",textShowBegin:"Show from Beginning",textShowCurrent:"Show from Current slide",textShowSettings:"Show Settings",tipInsertEquation:"Insert Equation",tipChangeChart:"Change Chart Type",capInsertText:"Text",capInsertTextArt:"Text Art",capInsertImage:"Image",capInsertShape:"Shape",capInsertTable:"Table",capInsertChart:"Chart",capInsertHyperlink:"Hyperlink",capInsertEquation:"Equation",capAddSlide:"Add Slide",capTabFile:"File",capTabHome:"Home",capTabInsert:"Insert",capBtnComment:"Comment",textTabFile:"File",textTabHome:"Home",textTabInsert:"Insert",textShowPresenterView:"Show presenter view",textTabCollaboration:"Collaboration",textTabProtect:"Protection",mniImageFromStorage:"Image from Storage",txtSlideAlign:"Align to Slide",txtObjectsAlign:"Align Selected Objects",tipEditHeader:"Edit footer",tipSlideNum:"Insert slide number",tipDateTime:"Insert current date and time",capBtnInsHeader:"Footer",capBtnSlideNum:"Slide Number",capBtnDateTime:"Date & Time",textListSettings:"List Settings",capBtnAddComment:"Add Comment",capBtnInsSymbol:"Symbol",tipInsertSymbol:"Insert symbol",capInsertAudio:"Audio",capInsertVideo:"Video",tipInsertAudio:"Insert audio",tipInsertVideo:"Insert video",tipIncFont:"Increment font size",tipDecFont:"Decrement font size"}}(),PE.Views.Toolbar||{}))}),define("presentationeditor/main/app/view/DateTimeDialog",["common/main/lib/component/Window","common/main/lib/component/ComboBox","common/main/lib/component/ListView"],function(){"use strict";PE.Views.DateTimeDialog=Common.UI.Window.extend(_.extend({options:{width:350,style:"min-width: 230px;",cls:"modal-dlg",buttons:["ok","cancel"]},initialize:function(t){_.extend(this.options,{title:this.txtTitle},t||{}),this.template=['
    ','
    ','","
    ",'
    ','
    ','","
    ",'
    ','
    ','
    ','","
    ","
    "].join(""),this.options.tpl=_.template(this.template)(this.options),this.api=this.options.api,this.lang=this.options.lang,this.handler=this.options.handler,Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this);var t=[{value:1068},{value:1026},{value:1029},{value:1031},{value:2055},{value:1032},{value:3081},{value:2057},{value:1033},{value:3082},{value:2058},{value:1035},{value:1036},{value:1040},{value:1041},{value:1042},{value:1062},{value:1043},{value:1045},{value:1046},{value:2070},{value:1049},{value:1051},{value:1060},{value:2077},{value:1053},{value:1055},{value:1058},{value:1066},{value:2052}];t.forEach(function(t){var e=Common.util.LanguageInfo.getLocalLanguageName(t.value);t.displayValue=e[1],t.langName=e[0]}),this.cmbLang=new Common.UI.ComboBox({el:$("#datetime-dlg-lang"),menuStyle:"min-width: 100%; max-height: 185px;",cls:"input-group-nr",editable:!1,takeFocusOnClose:!0,data:t,search:!0,scrollAlwaysVisible:!0}),this.cmbLang.setValue(1033),this.cmbLang.on("selected",_.bind(function(t,e){this.updateFormats(e.value)},this)),this.chUpdate=new Common.UI.CheckBox({el:$("#datetime-dlg-update"),labelText:this.textUpdate}),this.chUpdate.on("change",_.bind(function(t,e,i,n){this.onSelectFormat(this.listFormats,null,this.listFormats.getSelectedRec())},this)),this.listFormats=new Common.UI.ListView({el:$("#datetime-dlg-format"),store:new Common.UI.DataViewStore,scrollAlwaysVisible:!0,tabindex:1}),this.listFormats.on("item:select",_.bind(this.onSelectFormat,this)),this.listFormats.on("item:dblclick",_.bind(this.onDblClickFormat,this)),this.listFormats.on("entervalue",_.bind(this.onPrimary,this)),this.btnDefault=new Common.UI.Button({el:$("#datetime-dlg-default")}),this.btnDefault.on("click",_.bind(function(t,e){var i=this.listFormats.getSelectedRec();Common.UI.warning({msg:Common.Utils.String.format(this.confirmDefault,Common.util.LanguageInfo.getLocalLanguageName(this.cmbLang.getValue())[1],i?i.get("value"):""),buttons:["yes","no"],primary:"yes",callback:_.bind(function(t){if("yes"==t){this.defaultFormats[this.cmbLang.getValue()]=i?i.get("format"):"",this.api.asc_setDefaultDateTimeFormat(this.defaultFormats);var e=[];for(var n in this.defaultFormats)n&&e.push(n+" "+this.defaultFormats[n]);var o=e.join(";");Common.localStorage.setItem("pe-settings-datetime-default",o),Common.Utils.InternalSettings.set("pe-settings-datetime-default",o)}},this)})},this)),this.$window.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this)),this.afterRender()},afterRender:function(){var t=this,e=Common.Utils.InternalSettings.get("pe-settings-datetime-default"),i=e?e.split(";"):[];this.defaultFormats=[],i.forEach(function(e){var i=e.split(" ");t.defaultFormats[parseInt(i[0])]=i[1]}),this._setDefaults()},getFocusedComponents:function(){return[this.cmbLang,{cmp:this.listFormats,selector:".listview"}]},getDefaultFocusableComponent:function(){return this.cmbLang},_setDefaults:function(){if(this.props=new AscCommonSlide.CAscDateTime,this.lang){var t=this.cmbLang.store.findWhere({value:this.lang});t=t?t.get("value"):1033,this.cmbLang.setValue(t)}this.updateFormats(this.cmbLang.getValue())},getSettings:function(){return this.props},updateFormats:function(t){this.props.put_Lang(t);var e=this.props.get_DateTimeExamples(),i=[],n=this.listFormats.store;for(var o in e)if(e[o]){var s=new Common.UI.DataViewModel;s.set({format:o,value:e[o]}),i.push(s)}n.reset(i);var a=this.defaultFormats[t];a?this.listFormats.selectRecord(n.findWhere({format:a})):this.listFormats.selectByIndex(0);var s=this.listFormats.getSelectedRec();this.listFormats.scrollToRecord(s),this.onSelectFormat(this.listFormats,null,s)},onSelectFormat:function(t,e,i){i&&("checked"==this.chUpdate.getValue()?this.props.put_DateTime(i.get("format")):(this.props.put_DateTime(null),this.props.put_CustomDateTime(i.get("value"))))},onBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value)},onDblClickFormat:function(){this._handleInput("ok")},onPrimary:function(t){return this._handleInput("ok"),!1},_handleInput:function(t){this.options.handler&&this.options.handler.call(this,t,this.getSettings()),this.close()},txtTitle:"Date & Time",textLang:"Language",textFormat:"Formats",textUpdate:"Update automatically",textDefault:"Set as default",confirmDefault:'Set default format for {0}: "{1}"'},PE.Views.DateTimeDialog||{}))}),define("text!presentationeditor/main/app/template/HeaderFooterDialog.template",[],function(){return'\n \n \n \n \n \n \n \n
    \n
    \n
    \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
    \n
    \n
    \n \n
    \n
    \n \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n'}),define("presentationeditor/main/app/view/HeaderFooterDialog",["text!presentationeditor/main/app/template/HeaderFooterDialog.template","common/main/lib/util/utils","common/main/lib/component/RadioBox","common/main/lib/component/InputField","common/main/lib/view/AdvancedSettingsWindow"],function(t){"use strict";PE.Views.HeaderFooterDialog=Common.Views.AdvancedSettingsWindow.extend(_.extend({options:{contentWidth:360,height:380,buttons:null},initialize:function(e){var i=this;_.extend(this.options,{title:this.textTitle,template:_.template(['
    ','
    ','
    ',t,"
    ","
    ",'
    ','","
    ",'
    ','"].join(""))({scope:this})},e),this.lang=e.lang,this.handler=e.handler,this.hfProps=e.props,this.api=e.api,this.dateControls=[],Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this,this.options)},render:function(){Common.Views.AdvancedSettingsWindow.prototype.render.call(this);this.chDateTime=new Common.UI.CheckBox({el:$("#hf-dlg-chb-datetime"),labelText:this.textDateTime}),this.chDateTime.on("change",_.bind(this.setType,this,"date")),this.chSlide=new Common.UI.CheckBox({el:$("#hf-dlg-chb-slide"),labelText:this.textSlideNum}),this.chSlide.on("change",_.bind(this.setType,this,"slide")),this.chFooter=new Common.UI.CheckBox({el:$("#hf-dlg-chb-text"),labelText:this.textFooter}),this.chFooter.on("change",_.bind(this.setType,this,"footer")),this.inputFooter=new Common.UI.InputField({el:$("#hf-dlg-text"),validateOnBlur:!1,style:"width: 100%;"});var t=[{value:1068},{value:1026},{value:1029},{value:1031},{value:2055},{value:1032},{value:3081},{value:2057},{value:1033},{value:3082},{value:2058},{value:1035},{value:1036},{value:1040},{value:1041},{value:1042},{value:1062},{value:1043},{value:1045},{value:1046},{value:2070},{value:1049},{value:1051},{value:1060},{value:2077},{value:1053},{value:1055},{value:1058},{value:1066},{value:2052}];t.forEach(function(t){var e=Common.util.LanguageInfo.getLocalLanguageName(t.value);t.displayValue=e[1],t.langName=e[0]}),this.cmbLang=new Common.UI.ComboBox({el:$("#hf-dlg-combo-lang"),menuStyle:"min-width: 100%; max-height: 185px;",cls:"input-group-nr",editable:!1,data:t,search:!0,scrollAlwaysVisible:!0,takeFocusOnClose:!0}),this.cmbLang.setValue(1033),this.cmbLang.on("selected",_.bind(function(t,e){this.updateFormats(e.value)},this)),this.dateControls.push(this.cmbLang),this.cmbFormat=new Common.UI.ComboBox({el:$("#hf-dlg-combo-format"),menuStyle:"min-width: 100%; max-height: 185px;",cls:"input-group-nr",editable:!1,data:[],takeFocusOnClose:!0}),this.dateControls.push(this.cmbFormat),this.radioUpdate=new Common.UI.RadioBox({el:$("#hf-dlg-radio-update"),labelText:this.textUpdate,name:"asc-radio-header-update",checked:!0}).on("change",_.bind(this.setDateTimeType,this,"update")),this.dateControls.push(this.radioUpdate),this.radioFixed=new Common.UI.RadioBox({el:$("#hf-dlg-radio-fixed"),labelText:this.textFixed,name:"asc-radio-header-update"}).on("change",_.bind(this.setDateTimeType,this,"fixed")),this.dateControls.push(this.radioFixed),this.inputFixed=new Common.UI.InputField({el:$("#hf-dlg-input-fixed"),validateOnBlur:!1,style:"width: 100%;"}),this.dateControls.push(this.inputFixed),this.chNotTitle=new Common.UI.CheckBox({el:$("#hf-dlg-chb-not-title"),labelText:this.textNotTitle}),this.afterRender()},getFocusedComponents:function(){return[this.cmbFormat,this.cmbLang,this.inputFixed,this.inputFooter]},getDefaultFocusableComponent:function(){return this.cmbFormat.isDisabled()?this.inputFixed.isDisabled()?this.inputFooter.isDisabled()?void 0:this.inputFooter:this.inputFixed:this.cmbFormat},focusControls:function(){var t=this.getDefaultFocusableComponent();t&&setTimeout(function(){t.focus()},10)},afterRender:function(){var t=this,e=Common.Utils.InternalSettings.get("pe-settings-datetime-default"),i=e?e.split(";"):[];this.defaultFormats=[],i.forEach(function(e){var i=e.split(" ");t.defaultFormats[parseInt(i[0])]=i[1]}),this._setDefaults(this.hfProps)},setType:function(t,e,i){var n=this;i="checked"==i,"date"==t?(_.each(this.dateControls,function(t){t.setDisabled(!i)}),i&&this.setDateTimeType(this.radioFixed.getValue()?"fixed":"update",null,!0),this.props.put_ShowDateTime(i),this.focusControls()):"slide"==t?this.props.put_ShowSlideNum(i):"footer"==t&&(this.inputFooter.setDisabled(!i),this.props.put_ShowFooter(i),i&&setTimeout(function(){n.inputFooter.cmpEl.find("input").focus()},50)),this.props.updateView()},updateFormats:function(t,e){var i=new AscCommonSlide.CAscDateTime;i.put_Lang(t);var n=i.get_DateTimeExamples(),o=[];for(var s in n)n[s]&&o.push({value:s,displayValue:n[s]});this.cmbFormat.setData(o),e=e||this.defaultFormats[t],this.cmbFormat.setValue(e||o[0].value)},setDateTimeType:function(t,e,i){if(i){this.cmbLang.setDisabled("fixed"==t),this.cmbFormat.setDisabled("fixed"==t),this.inputFixed.setDisabled("update"==t),this.focusControls()}},onSelectFormat:function(t){this.radioUpdate.getValue()?(t=t||this.cmbFormat.getValue(),this.props.get_DateTime().put_DateTime(t)):(this.props.get_DateTime().put_DateTime(null),this.props.get_DateTime().put_CustomDateTime(this.inputFixed.getValue()))},_setDefaults:function(t){if(t){var e=t.get_Slide()||new AscCommonSlide.CAscHFProps,i=e.get_ShowDateTime();this.chDateTime.setValue(i,!0),_.each(this.dateControls,function(t){t.setDisabled(!i)});var n,o,s=e.get_DateTime(),a=this.cmbLang.store.findWhere({value:s?s.get_Lang()||this.lang:this.lang});this._originalLang=a?a.get("value"):1033,this.cmbLang.setValue(this._originalLang),i&&(n=s.get_DateTime(),n?this.radioUpdate.setValue(!0):this.radioFixed.setValue(!0),!n&&(o=s.get_CustomDateTime()||""),this.setDateTimeType(n?"update":"fixed",null,!0)),this.updateFormats(this.cmbLang.getValue(),n),this.inputFixed.setValue(void 0!==o?o:this.cmbFormat.getRawValue()),i=e.get_ShowSlideNum(),this.chSlide.setValue(i,!0),i=e.get_ShowFooter(),this.chFooter.setValue(i,!0),this.inputFooter.setDisabled(!i),i&&this.inputFooter.setValue(e.get_Footer()||""),i=e.get_ShowOnTitleSlide(),this.chNotTitle.setValue(!i,!0),this.props=e}else this.props=new AscCommonSlide.CAscHFProps;this.props.put_DivId("hf-dlg-canvas-preview"),this.props.put_Api(this.api),this.props.updateView()},getSettings:function(){var t=this.props;return t.get_ShowDateTime()&&(!t.get_DateTime()&&t.put_DateTime(new AscCommonSlide.CAscDateTime),t.get_DateTime().put_Lang(this.cmbLang.getValue()),this.onSelectFormat()),t.get_ShowFooter()&&t.put_Footer(this.inputFooter.getValue()),t.put_ShowOnTitleSlide("checked"!=this.chNotTitle.getValue()),this.hfProps.put_Slide(this.props),this.hfProps},onDlgBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value)},onPrimary:function(){return this._handleInput("all"),!1},_handleInput:function(t){if(this.handler){if("ok"==t&&this.cmbLang.getValue()!==this._originalLang)return void Common.UI.warning({title:this.notcriticalErrorTitle,maxwidth:600,msg:this.diffLanguage});this.handler.call(this,t,this.getSettings())}this.close()},textTitle:"Footer Settings",applyAllText:"Apply to all",applyText:"Apply",textLang:"Language",textFormat:"Formats",textUpdate:"Update automatically",textDateTime:"Date and time",textSlideNum:"Slide number",textFooter:"Text in footer",textNotTitle:"Don't show on title slide",textPreview:"Preview",diffLanguage:"You can’t use a date format in a different language than the slide master.\nTo change the master, click 'Apply to all' instead of 'Apply'",notcriticalErrorTitle:"Warning",textFixed:"Fixed"},PE.Views.HeaderFooterDialog||{}))}),define("presentationeditor/main/app/view/SlideSizeSettings",["common/main/lib/component/Window","common/main/lib/component/ComboBox"],function(){"use strict";PE.Views.SlideSizeSettings=Common.UI.Window.extend(_.extend({options:{width:250,header:!0,style:"min-width: 250px;",cls:"modal-dlg",id:"window-slide-size-settings",buttons:["ok","cancel"]},initialize:function(t){_.extend(this.options,{title:this.textTitle},t||{}), -this.template=['
    ','
    ','","
    ",'
    ','',"",'",'","","
    ','",'
    ',"
    ','",'
    ',"
    ",'
    ','","
    ",'
    ',"
    ",'
    '].join(""),this.options.tpl=_.template(this.template)(this.options),this.spinners=[],this._noApply=!1,Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this),this.cmbSlideSize=new Common.UI.ComboBox({el:$("#slide-size-combo"),cls:"input-group-nr",style:"width: 100%;",menuStyle:"min-width: 218px;",editable:!1,takeFocusOnClose:!0,data:[{value:0,displayValue:this.txtStandard,size:[254,190.5]},{value:1,displayValue:this.txtWidescreen1,size:[254,143]},{value:2,displayValue:this.txtWidescreen2,size:[254,158.7]},{value:3,displayValue:this.txtLetter,size:[254,190.5]},{value:4,displayValue:this.txtLedger,size:[338.3,253.7]},{value:5,displayValue:this.txtA3,size:[355.6,266.7]},{value:6,displayValue:this.txtA4,size:[275,190.5]},{value:7,displayValue:this.txtB4,size:[300.7,225.5]},{value:8,displayValue:this.txtB5,size:[199.1,149.3]},{value:9,displayValue:this.txt35,size:[285.7,190.5]},{value:10,displayValue:this.txtOverhead,size:[254,190.5]},{value:11,displayValue:this.txtBanner,size:[203.2,25.4]},{value:-1,displayValue:this.txtCustom,size:[]}]}),this.cmbSlideSize.setValue(0),this.cmbSlideSize.on("selected",_.bind(function(t,e){if(this._noApply=!0,e.value<0);else{var i=e.size[0],n=e.size[1],o=this.cmbSlideOrientation.getValue(),s=0==o&&i>n||1==o&&n>i;this.spnWidth.setValue(Common.Utils.Metric.fnRecalcFromMM(s?n:i),!0),this.spnHeight.setValue(Common.Utils.Metric.fnRecalcFromMM(s?i:n),!0)}this._noApply=!1},this)),this.spnWidth=new Common.UI.MetricSpinner({el:$("#slide-size-spin-width"),step:.1,width:98,defaultUnit:"cm",value:"25.4 cm",maxValue:142.24,minValue:2.54}),this.spinners.push(this.spnWidth),this.spnWidth.on("change",_.bind(function(t,e,i,n){if(!this._noApply){this.cmbSlideSize.getValue()>-1&&this.cmbSlideSize.setValue(-1);var o=this.spnWidth.getNumberValue(),s=this.spnHeight.getNumberValue();this.cmbSlideOrientation.setValue(s>o?0:1)}},this)),this.spnHeight=new Common.UI.MetricSpinner({el:$("#slide-size-spin-height"),step:.1,width:98,defaultUnit:"cm",value:"19.05 cm",maxValue:142.24,minValue:2.54}),this.spinners.push(this.spnHeight),this.spnHeight.on("change",_.bind(function(t,e,i,n){if(!this._noApply){this.cmbSlideSize.getValue()>-1&&this.cmbSlideSize.setValue(-1);var o=this.spnWidth.getNumberValue(),s=this.spnHeight.getNumberValue();this.cmbSlideOrientation.setValue(s>o?0:1)}},this)),this.cmbSlideOrientation=new Common.UI.ComboBox({el:$("#slide-orientation-combo"),cls:"input-group-nr",style:"width: 100%;",menuStyle:"min-width: 218px;",editable:!1,takeFocusOnClose:!0,data:[{value:0,displayValue:this.strPortrait},{value:1,displayValue:this.strLandscape}]}),this.cmbSlideOrientation.setValue(1),this.cmbSlideOrientation.on("selected",_.bind(function(t,e){this._noApply=!0;var i=this.spnWidth.getNumberValue(),n=this.spnHeight.getNumberValue();(0==e.value&&i>n||1==e.value&&n>i)&&(this.spnWidth.setValue(n,!0),this.spnHeight.setValue(i,!0)),this._noApply=!1},this)),this.getChild().find(".dlg-btn").on("click",_.bind(this.onBtnClick,this)),this.updateMetricUnit()},getFocusedComponents:function(){return[this.cmbSlideSize,this.spnWidth,this.spnHeight,this.cmbSlideOrientation]},getDefaultFocusableComponent:function(){return this.cmbSlideSize},_handleInput:function(t){this.options.handler&&this.options.handler.call(this,this,t),this.close()},onBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value)},onPrimary:function(){return this._handleInput("ok"),!1},setSettings:function(t,e,i){this.spnWidth.setValue(Common.Utils.Metric.fnRecalcFromMM(e),!0),this.spnHeight.setValue(Common.Utils.Metric.fnRecalcFromMM(i),!0),this.cmbSlideSize.setValue(t),this.cmbSlideOrientation.setValue(i>e?0:1)},getSettings:function(){return[this.cmbSlideSize.getValue(),Common.Utils.Metric.fnRecalcToMM(this.spnWidth.getNumberValue()),Common.Utils.Metric.fnRecalcToMM(this.spnHeight.getNumberValue())]},updateMetricUnit:function(){if(this.spinners)for(var t=0;t','
    ',"",'
    '].join(""),this.options.tpl=_.template(this.template)(this.options),this.spinners=[],this._noApply=!1,Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this),this.chLoop=new Common.UI.CheckBox({el:$("#slideshow-checkbox-loop"),labelText:this.textLoop}),this.getChild().find(".dlg-btn").on("click",_.bind(this.onBtnClick,this))},_handleInput:function(t){this.options.handler&&this.options.handler.call(this,this,t),this.close()},onBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value)},onPrimary:function(){return this._handleInput("ok"),!1},setSettings:function(t){this.chLoop.setValue(t)},getSettings:function(){return"checked"==this.chLoop.getValue()},textTitle:"Show Settings",textLoop:"Loop continuously until 'Esc' is pressed"},PE.Views.SlideshowSettings||{}))}),define("presentationeditor/main/app/controller/Toolbar",["core","common/main/lib/component/Window","common/main/lib/view/CopyWarningDialog","common/main/lib/view/ImageFromUrlDialog","common/main/lib/view/InsertTableDialog","common/main/lib/view/SelectFileDlg","common/main/lib/view/ListSettingsDialog","common/main/lib/view/SymbolTableDialog","common/main/lib/util/define","presentationeditor/main/app/collection/SlideThemes","presentationeditor/main/app/view/Toolbar","presentationeditor/main/app/view/DateTimeDialog","presentationeditor/main/app/view/HeaderFooterDialog","presentationeditor/main/app/view/HyperlinkSettingsDialog","presentationeditor/main/app/view/SlideSizeSettings","presentationeditor/main/app/view/SlideshowSettings"],function(){"use strict";PE.Controllers.Toolbar=Backbone.Controller.extend(_.extend({models:[],collections:["SlideThemes"],views:["Toolbar"],initialize:function(){this._state={activated:!1,themeId:void 0,bullets:{type:void 0,subtype:void 0},prcontrolsdisable:void 0,slidecontrolsdisable:void 0,slidelayoutdisable:void 0,shapecontrolsdisable:void 0,no_paragraph:void 0,no_text:void 0,no_object:void 0,clrtext:void 0,linespace:void 0,pralign:void 0,valign:void 0,vtextalign:void 0,can_undo:void 0,can_redo:void 0,bold:void 0,italic:void 0,strike:void 0,underline:void 0,can_group:void 0,can_ungroup:void 0,lock_doc:void 0,changeslide_inited:!1,no_slides:void 0,can_increase:void 0,can_decrease:void 0,can_hyper:void 0,zoom_type:void 0,zoom_percent:void 0,fontsize:void 0,in_equation:void 0,in_chart:!1},this._isAddingShape=!1,this.slideSizeArr=[[254,190.5],[254,143],[254,158.7],[254,190.5],[338.3,253.7],[355.6,266.7],[275,190.5],[300.7,225.5],[199.1,149.3],[285.7,190.5],[254,190.5],[203.2,25.4]],this.currentPageSize={type:-1,width:0,height:0},this.flg={},this.diagramEditor=null,this.editMode=!0,this.addListeners({Toolbar:{"insert:image":this.onInsertImageClick.bind(this),"insert:text":this.onInsertText.bind(this),"insert:textart":this.onInsertTextart.bind(this),"insert:shape":this.onInsertShape.bind(this),"add:slide":this.onAddSlide.bind(this),"change:slide":this.onChangeSlide.bind(this),"change:compact":this.onClickChangeCompact,"add:chart":this.onSelectChart},FileMenu:{"menu:hide":this.onFileMenu.bind(this,"hide"),"menu:show":this.onFileMenu.bind(this,"show")},"Common.Views.Header":{"toolbar:setcompact":this.onChangeCompactView.bind(this),print:function(t){this.getApplication().getController("Main").onPrint()},save:function(t){this.api.asc_Save()},undo:this.onUndo,redo:this.onRedo,downloadas:function(t){var e,i=this.getApplication().getController("Main"),n=i.document.fileType;n&&(e=Asc.c_oAscFileType[n.toUpperCase()]);var o=[Asc.c_oAscFileType.PPTX,Asc.c_oAscFileType.ODP,Asc.c_oAscFileType.PDFA,Asc.c_oAscFileType.POTX,Asc.c_oAscFileType.OTP];(!e||o.indexOf(e)<0)&&(e=Asc.c_oAscFileType.PDF),i.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(e))},"go:editor":function(){Common.Gateway.requestEditRights()}}});var t=this,e=function(e){var i=$(e.target),n=i.closest("#editor_sdk"),o=i.closest("button").attr("id");void 0===o&&(o=i.closest(".btn-group").attr("id")),"editor_sdk"!=i.attr("id")&&n.length<=0&&(t.toolbar.btnsInsertText.pressed()&&!t.toolbar.btnsInsertText.contains(o)||t.toolbar.btnsInsertShape.pressed()&&!t.toolbar.btnsInsertShape.contains(o)?(t._isAddingShape=!1,t._addAutoshape(!1),t.toolbar.btnsInsertShape.toggle(!1,!0),t.toolbar.btnsInsertText.toggle(!1,!0),Common.NotificationCenter.trigger("edit:complete",t.toolbar)):t.toolbar.btnsInsertShape.pressed()&&t.toolbar.btnsInsertShape.contains(o)&&_.defer(function(){t.api.StartAddShape("",!1),Common.NotificationCenter.trigger("edit:complete",t.toolbar)},100))};this.onApiEndAddShape=function(){this.toolbar.fireEvent("insertshape",this.toolbar),this.toolbar.btnsInsertShape.pressed()&&this.toolbar.btnsInsertShape.toggle(!1,!0),this.toolbar.btnsInsertText.pressed()&&this.toolbar.btnsInsertText.toggle(!1,!0),$(document.body).off("mouseup",e)},this._addAutoshape=function(t,i){this.api&&(t?(this.api.StartAddShape(i,!0),$(document.body).on("mouseup",e)):(this.api.StartAddShape("",!1),$(document.body).off("mouseup",e)))}},onLaunch:function(){var t=this;t.toolbar=t.createView("Toolbar"),Common.NotificationCenter.on("app:ready",t.onAppReady.bind(t)),Common.NotificationCenter.on("app:face",t.onAppShowed.bind(t)),PE.getCollection("ShapeGroups").bind({reset:t.onResetAutoshapes.bind(this)}),PE.getCollection("SlideLayouts").bind({reset:t.onResetSlides.bind(this)})},setMode:function(t){this.mode=t,this.toolbar.applyLayout(t)},attachUIEvents:function(t){t.btnPreview.on("click",_.bind(this.onPreviewBtnClick,this)),t.btnPreview.menu.on("item:click",_.bind(this.onPreviewItemClick,this)),t.btnPrint.on("click",_.bind(this.onPrint,this)),t.btnPrint.on("disabled",_.bind(this.onBtnChangeState,this,"print:disabled")),t.btnSave.on("click",_.bind(this.onSave,this)),t.btnUndo.on("click",_.bind(this.onUndo,this)),t.btnUndo.on("disabled",_.bind(this.onBtnChangeState,this,"undo:disabled")),t.btnRedo.on("click",_.bind(this.onRedo,this)),t.btnRedo.on("disabled",_.bind(this.onBtnChangeState,this,"redo:disabled")),t.btnCopy.on("click",_.bind(this.onCopyPaste,this,!0)),t.btnPaste.on("click",_.bind(this.onCopyPaste,this,!1)),t.btnIncFontSize.on("click",_.bind(this.onIncrease,this)),t.btnDecFontSize.on("click",_.bind(this.onDecrease,this)),t.btnBold.on("click",_.bind(this.onBold,this)),t.btnItalic.on("click",_.bind(this.onItalic,this)),t.btnUnderline.on("click",_.bind(this.onUnderline,this)),t.btnStrikeout.on("click",_.bind(this.onStrikeout,this)),t.btnSuperscript.on("click",_.bind(this.onSuperscript,this)),t.btnSubscript.on("click",_.bind(this.onSubscript,this)),t.btnHorizontalAlign.menu.on("item:click",_.bind(this.onMenuHorizontalAlignSelect,this)),t.btnVerticalAlign.menu.on("item:click",_.bind(this.onMenuVerticalAlignSelect,this)),t.btnDecLeftOffset.on("click",_.bind(this.onDecOffset,this)),t.btnIncLeftOffset.on("click",_.bind(this.onIncOffset,this)),t.btnMarkers.on("click",_.bind(this.onMarkers,this)),t.btnNumbers.on("click",_.bind(this.onNumbers,this)),t.mnuMarkerSettings.on("click",_.bind(this.onMarkerSettingsClick,this,0)),t.mnuNumberSettings.on("click",_.bind(this.onMarkerSettingsClick,this,1)),t.cmbFontName.on("selected",_.bind(this.onFontNameSelect,this)),t.cmbFontName.on("show:after",_.bind(this.onComboOpen,this,!0)),t.cmbFontName.on("hide:after",_.bind(this.onHideMenus,this)),t.cmbFontName.on("combo:blur",_.bind(this.onComboBlur,this)),t.cmbFontName.on("combo:focusin",_.bind(this.onComboOpen,this,!1)),t.cmbFontSize.on("selected",_.bind(this.onFontSizeSelect,this)),t.cmbFontSize.on("changed:before",_.bind(this.onFontSizeChanged,this,!0)),t.cmbFontSize.on("changed:after",_.bind(this.onFontSizeChanged,this,!1)),t.cmbFontSize.on("show:after",_.bind(this.onComboOpen,this,!0)),t.cmbFontSize.on("hide:after",_.bind(this.onHideMenus,this)),t.cmbFontSize.on("combo:blur",_.bind(this.onComboBlur,this)),t.cmbFontSize.on("combo:focusin",_.bind(this.onComboOpen,this,!1)),t.mnuMarkersPicker.on("item:click",_.bind(this.onSelectBullets,this,t.btnMarkers)),t.mnuNumbersPicker.on("item:click",_.bind(this.onSelectBullets,this,t.btnNumbers)),t.btnFontColor.on("click",_.bind(this.onBtnFontColor,this)),t.mnuFontColorPicker.on("select",_.bind(this.onSelectFontColor,this)),$("#id-toolbar-menu-new-fontcolor").on("click",_.bind(this.onNewFontColor,this)),t.btnLineSpace.menu.on("item:toggle",_.bind(this.onLineSpaceToggle,this)),t.btnShapeAlign.menu.on("item:click",_.bind(this.onShapeAlign,this)),t.btnShapeAlign.menu.on("show:before",_.bind(this.onBeforeShapeAlign,this)),t.btnShapeArrange.menu.on("item:click",_.bind(this.onShapeArrange,this)),t.btnInsertHyperlink.on("click",_.bind(this.onHyperlinkClick,this)),t.mnuTablePicker.on("select",_.bind(this.onTablePickerSelect,this)),t.btnInsertTable.menu.on("item:click",_.bind(this.onInsertTableClick,this)),t.btnClearStyle.on("click",_.bind(this.onClearStyleClick,this)),t.btnCopyStyle.on("toggle",_.bind(this.onCopyStyleToggle,this)),t.btnColorSchemas.menu.on("item:click",_.bind(this.onColorSchemaClick,this)),t.btnColorSchemas.menu.on("show:after",_.bind(this.onColorSchemaShow,this)),t.btnSlideSize.menu.on("item:click",_.bind(this.onSlideSize,this)),t.listTheme.on("click",_.bind(this.onListThemeSelect,this)),t.btnInsertEquation.on("click",_.bind(this.onInsertEquationClick,this)),t.btnInsertSymbol.on("click",_.bind(this.onInsertSymbolClick,this)),t.btnEditHeader.on("click",_.bind(this.onEditHeaderClick,this,"header")),t.btnInsDateTime.on("click",_.bind(this.onEditHeaderClick,this,"datetime")),t.btnInsSlideNum.on("click",_.bind(this.onEditHeaderClick,this,"slidenum")),Common.Gateway.on("insertimage",_.bind(this.insertImage,this)),t.btnInsAudio&&t.btnInsAudio.on("click",_.bind(this.onAddAudio,this)),t.btnInsVideo&&t.btnInsVideo.on("click",_.bind(this.onAddVideo,this)),this.onSetupCopyStyleButton()},setApi:function(t){this.api=t,this.mode.isEdit?(this.toolbar.setApi(t),this.api.asc_registerCallback("asc_onFontSize",_.bind(this.onApiFontSize,this)),this.api.asc_registerCallback("asc_onBold",_.bind(this.onApiBold,this)),this.api.asc_registerCallback("asc_onItalic",_.bind(this.onApiItalic,this)),this.api.asc_registerCallback("asc_onUnderline",_.bind(this.onApiUnderline,this)),this.api.asc_registerCallback("asc_onStrikeout",_.bind(this.onApiStrikeout,this)),this.api.asc_registerCallback("asc_onVerticalAlign",_.bind(this.onApiVerticalAlign,this)),Common.NotificationCenter.on("fonts:change",_.bind(this.onApiChangeFont,this)),this.api.asc_registerCallback("asc_onCanUndo",_.bind(this.onApiCanRevert,this,"undo")),this.api.asc_registerCallback("asc_onCanRedo",_.bind(this.onApiCanRevert,this,"redo")),this.api.asc_registerCallback("asc_onPaintFormatChanged",_.bind(this.onApiStyleChange,this)),this.api.asc_registerCallback("asc_onListType",_.bind(this.onApiBullets,this)),this.api.asc_registerCallback("asc_canIncreaseIndent",_.bind(this.onApiCanIncreaseIndent,this)),this.api.asc_registerCallback("asc_canDecreaseIndent",_.bind(this.onApiCanDecreaseIndent,this)),this.api.asc_registerCallback("asc_onLineSpacing",_.bind(this.onApiLineSpacing,this)),this.api.asc_registerCallback("asc_onPrAlign",_.bind(this.onApiParagraphAlign,this)),this.api.asc_registerCallback("asc_onVerticalTextAlign",_.bind(this.onApiVerticalTextAlign,this)),this.api.asc_registerCallback("asc_onCanAddHyperlink",_.bind(this.onApiCanAddHyperlink,this)),this.api.asc_registerCallback("asc_onTextColor",_.bind(this.onApiTextColor,this)),this.api.asc_registerCallback("asc_onUpdateThemeIndex",_.bind(this.onApiUpdateThemeIndex,this)),this.api.asc_registerCallback("asc_onEndAddShape",_.bind(this.onApiEndAddShape,this)),this.api.asc_registerCallback("asc_onCanGroup",_.bind(this.onApiCanGroup,this)),this.api.asc_registerCallback("asc_onCanUnGroup",_.bind(this.onApiCanUnGroup,this)),this.api.asc_registerCallback("asc_onPresentationSize",_.bind(this.onApiPageSize,this)),this.api.asc_registerCallback("asc_onCoAuthoringDisconnect",_.bind(this.onApiCoAuthoringDisconnect,this)),Common.NotificationCenter.on("api:disconnect",_.bind(this.onApiCoAuthoringDisconnect,this)),this.api.asc_registerCallback("asc_onZoomChange",_.bind(this.onApiZoomChange,this)),this.api.asc_registerCallback("asc_onFocusObject",_.bind(this.onApiFocusObject,this)),this.api.asc_registerCallback("asc_onLockDocumentProps",_.bind(this.onApiLockDocumentProps,this)),this.api.asc_registerCallback("asc_onUnLockDocumentProps",_.bind(this.onApiUnLockDocumentProps,this)),this.api.asc_registerCallback("asc_onLockDocumentTheme",_.bind(this.onApiLockDocumentTheme,this)),this.api.asc_registerCallback("asc_onUnLockDocumentTheme",_.bind(this.onApiUnLockDocumentTheme,this)),this.api.asc_registerCallback("asc_onInitEditorStyles",_.bind(this.onApiInitEditorStyles,this)),this.api.asc_registerCallback("asc_onCountPages",_.bind(this.onApiCountPages,this)),this.api.asc_registerCallback("asc_onMathTypes",_.bind(this.onApiMathTypes,this)),this.api.asc_registerCallback("asc_onContextMenu",_.bind(this.onContextMenu,this)),this.api.asc_registerCallback("asc_onTextLanguage",_.bind(this.onTextLanguage,this)),Common.NotificationCenter.on("storage:image-load",_.bind(this.openImageFromStorage,this)),Common.NotificationCenter.on("storage:image-insert",_.bind(this.insertImageFromStorage,this))):this.mode.isRestrictedEdit&&this.api.asc_registerCallback("asc_onCountPages",_.bind(this.onApiCountPagesRestricted,this))},onChangeCompactView:function(t,e){this.toolbar.setFolded(e),this.toolbar.fireEvent("view:compact",[this.toolbar,e]),Common.localStorage.setBool("pe-compact-toolbar",e),Common.NotificationCenter.trigger("layout:changed","toolbar"),Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onClickChangeCompact:function(t){if("file"!=t){var e=this;Common.Utils.asyncCall(function(){e.onChangeCompactView(null,!e.toolbar.isCompact())})}},onContextMenu:function(){this.toolbar.collapse()},onApiChangeFont:function(t){!Common.Utils.ModalWindow.isVisible()&&this.toolbar.cmbFontName.onApiChangeFont(t)},onApiFontSize:function(t){this._state.fontsize!==t&&(this.toolbar.cmbFontSize.setValue(t),this._state.fontsize=t)},onApiBold:function(t){this._state.bold!==t&&(this.toolbar.btnBold.toggle(!0===t,!0),this._state.bold=t)},onApiItalic:function(t){this._state.italic!==t&&(this.toolbar.btnItalic.toggle(!0===t,!0),this._state.italic=t)},onApiUnderline:function(t){this._state.underline!==t&&(this.toolbar.btnUnderline.toggle(!0===t,!0),this._state.underline=t)},onApiStrikeout:function(t){this._state.strike!==t&&(this.toolbar.btnStrikeout.toggle(!0===t,!0),this._state.strike=t)},onApiVerticalAlign:function(t){this._state.valign!==t&&(this.toolbar.btnSuperscript.toggle(1==t,!0),this.toolbar.btnSubscript.toggle(2==t,!0),this._state.valign=t)},onApiCanRevert:function(t,e){"undo"==t?this._state.can_undo!==e&&(this.toolbar.lockToolbar(PE.enumLock.undoLock,!e,{array:[this.toolbar.btnUndo]}),this._state.activated&&(this._state.can_undo=e)):this._state.can_redo!==e&&(this.toolbar.lockToolbar(PE.enumLock.redoLock,!e,{array:[this.toolbar.btnRedo]}),this._state.activated&&(this._state.can_redo=e))},onApiCanIncreaseIndent:function(t){this._state.can_increase!==t&&(this.toolbar.lockToolbar(PE.enumLock.incIndentLock,!t,{array:[this.toolbar.btnIncLeftOffset]}),this._state.activated&&(this._state.can_increase=t))},onApiCanDecreaseIndent:function(t){this._state.can_decrease!==t&&(this.toolbar.lockToolbar(PE.enumLock.decIndentLock,!t,{array:[this.toolbar.btnDecLeftOffset]}),this._state.activated&&(this._state.can_decrease=t))},onApiBullets:function(t){if(this._state.bullets.type!=t.get_ListType()||this._state.bullets.subtype!=t.get_ListSubType())switch(this._state.bullets.type=t.get_ListType(),this._state.bullets.subtype=t.get_ListSubType(),this._clearBullets(),this._state.bullets.type){case 0:this.toolbar.btnMarkers.toggle(!0,!0),void 0!==this._state.bullets.subtype?this.toolbar.mnuMarkersPicker.selectByIndex(this._state.bullets.subtype,!0):this.toolbar.mnuMarkersPicker.deselectAll(!0);break;case 1:var e=0;switch(this._state.bullets.subtype){case 1:e=4;break;case 2:e=5;break;case 3:e=6;break;case 4:e=1;break;case 5:e=2;break;case 6:e=3;break;case 7:e=7}this.toolbar.btnNumbers.toggle(!0,!0),this.toolbar.mnuNumbersPicker.selectByIndex(e,!0)}},onApiParagraphAlign:function(t){if(this._state.pralign!==t){this._state.pralign=t;var e,i=-1,n=this.toolbar.btnHorizontalAlign;switch(t){case 0:i=2,e="btn-align-right";break;case 1:i=0,e="btn-align-left";break;case 2:i=1,e="btn-align-center";break;case 3:i=3,e="btn-align-just";break;default:i=-255,e="btn-align-left"}i<0?-255==i&&n.menu.clearAll():n.menu.items[i].setChecked(!0),n.rendered&&n.$icon&&(n.$icon.removeClass(n.options.icls).addClass(e),n.options.icls=e)}},onApiVerticalTextAlign:function(t){if(this._state.vtextalign!==t){this._state.vtextalign=t;var e=-1,i="",n=this.toolbar.btnVerticalAlign;switch(t){case Asc.c_oAscVAlign.Top:e=0,i="btn-align-top";break;case Asc.c_oAscVAlign.Center:e=1,i="btn-align-middle";break;case Asc.c_oAscVAlign.Bottom:e=2,i="btn-align-bottom";break;default:e=-255,i="btn-align-middle"}e<0?-255==e&&n.menu.clearAll():n.menu.items[e].setChecked(!0),n.rendered&&n.$icon&&(n.$icon.removeClass(n.options.icls).addClass(i),n.options.icls=i)}},onApiLineSpacing:function(t){var e=null===t.get_Line()||null===t.get_LineRule()||1!=t.get_LineRule()?-1:t.get_Line();if(this._state.linespace!==e){this._state.linespace=e;var i=this.toolbar.btnLineSpace.menu;if(_.each(i.items,function(t){t.setChecked(!1,!0)}),e<0)return;Math.abs(e-1)<1e-4?i.items[0].setChecked(!0,!0):Math.abs(e-1.15)<1e-4?i.items[1].setChecked(!0,!0):Math.abs(e-1.5)<1e-4?i.items[2].setChecked(!0,!0):Math.abs(e-2)<1e-4?i.items[3].setChecked(!0,!0):Math.abs(e-2.5)<1e-4?i.items[4].setChecked(!0,!0):Math.abs(e-3)<1e-4&&i.items[5].setChecked(!0,!0)}},onApiCanAddHyperlink:function(t){this._state.can_hyper!==t&&this.editMode&&(this.toolbar.lockToolbar(PE.enumLock.hyperlinkLock,!t,{array:[this.toolbar.btnInsertHyperlink]}),this._state.activated&&(this._state.can_hyper=t))},onApiPageSize:function(t,e){if(Math.abs(this.currentPageSize.width-t)>.001||Math.abs(this.currentPageSize.height-e)>.001){this.currentPageSize.width=t,this.currentPageSize.height=e,this.currentPageSize.type=-1;for(var i=e>t,n=0;n0?t:void 0,e.menuPicker.selectRecord(i),e.resumeEvents()}}},onApiCanGroup:function(t){this._state.can_group!==t&&(this.toolbar.mnuGroupShapes.setDisabled(!t),this._state.activated&&(this._state.can_group=t))},onApiCanUnGroup:function(t){this._state.can_ungroup!==t&&(this.toolbar.mnuUnGroupShapes.setDisabled(!t),this._state.activated&&(this._state.can_ungroup=t))},onApiLockDocumentProps:function(){!0!==this._state.lock_doc&&(this.toolbar.lockToolbar(PE.enumLock.docPropsLock,!0,{array:[this.toolbar.btnSlideSize]}),this._state.activated&&(this._state.lock_doc=!0))},onApiUnLockDocumentProps:function(){!1!==this._state.lock_doc&&(this.toolbar.lockToolbar(PE.enumLock.docPropsLock,!1,{array:[this.toolbar.btnSlideSize]}),this._state.activated&&(this._state.lock_doc=!1))},onApiLockDocumentTheme:function(){this.toolbar.lockToolbar(PE.enumLock.themeLock,!0,{array:[this.toolbar.btnColorSchemas,this.toolbar.listTheme]})},onApiUnLockDocumentTheme:function(){this.toolbar.lockToolbar(PE.enumLock.themeLock,!1,{array:[this.toolbar.btnColorSchemas,this.toolbar.listTheme]})},onApiCoAuthoringDisconnect:function(t){this.toolbar.setMode({isDisconnected:!0,enableDownload:!!t}),this.editMode=!1},onApiZoomChange:function(t,e){},onApiInitEditorStyles:function(t){t&&this._onInitEditorThemes(t[0],t[1])},onNewDocument:function(t,e){this.api&&this.api.OpenNewDocument(),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","New Document")},onOpenDocument:function(t,e){this.api&&this.api.LoadDocumentFromDisk(),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Open Document")},onAddSlide:function(t){this.api&&(this.api.AddSlide(t),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Add Slide"))},onChangeSlide:function(t){this.api&&(this.api.ChangeLayout(t),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Change Layout"))},onPreview:function(t,e){Common.NotificationCenter.trigger("preview:start",_.isNumber(t)?t:0,e)},onPreviewBtnClick:function(t,e){this.onPreview(this.api.getCurrentPage())},onPreviewItemClick:function(t,e){switch(e.value){case 0:this.onPreview(0);break;case 1:this.onPreview(this.api.getCurrentPage());break;case 2:this.onPreview(0,!0);break;case 3: -var i,n=this,o=n.api.getSelectedElements(),s=!1;if(o&&_.isArray(o))for(var a=0;a300?300:o<1?1:Math.floor(2*(o+.4))/2,e.setRawValue(o),this._state.fontsize=void 0,this.api&&this.api.put_TextPrFontSize(o),Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onSelectBullets:function(t,e,i,n){var o={};if(_.isFunction(n.toJSON)){if(!n.get("selected"))return;o=n.toJSON()}else o=n;t&&t.toggle(o.data.subtype>-1,!0),this.api&&this.api.put_ListType(o.data.type,o.data.subtype),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","List Type")},onLineSpaceToggle:function(t,e,i,n){i&&(this._state.linespace=void 0,this.api&&this.api.put_PrLineSpacing(c_paragraphLinerule.LINERULE_AUTO,e.value),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Line Spacing"))},onBeforeShapeAlign:function(){var t=this.api.asc_getSelectedDrawingObjectsCount(),e=Common.Utils.InternalSettings.get("pe-align-to-slide")||!1;this.toolbar.mniAlignObjects.setDisabled(t<2),this.toolbar.mniAlignObjects.setChecked(t>1&&!e,!0),this.toolbar.mniAlignToSlide.setChecked(t<2||e,!0),this.toolbar.mniDistribHor.setDisabled(t<3&&this.toolbar.mniAlignObjects.isChecked()),this.toolbar.mniDistribVert.setDisabled(t<3&&this.toolbar.mniAlignObjects.isChecked())},onShapeAlign:function(t,e){if(this.api){var i=this.toolbar.mniAlignToSlide.isChecked()?Asc.c_oAscObjectsAlignType.Slide:Asc.c_oAscObjectsAlignType.Selected;e.value>-1&&e.value<6?(this.api.put_ShapesAlign(e.value,i),Common.component.Analytics.trackEvent("ToolBar","Shape Align")):6==e.value?(this.api.DistributeHorizontally(i),Common.component.Analytics.trackEvent("ToolBar","Distribute")):7==e.value&&(this.api.DistributeVertically(i),Common.component.Analytics.trackEvent("ToolBar","Distribute")),Common.NotificationCenter.trigger("edit:complete",this.toolbar)}},onShapeArrange:function(t,e){if(this.api){switch(e.value){case 1:this.api.shapes_bringToFront(),Common.component.Analytics.trackEvent("ToolBar","Shape Arrange");break;case 2:this.api.shapes_bringToBack(),Common.component.Analytics.trackEvent("ToolBar","Shape Arrange");break;case 3:this.api.shapes_bringForward(),Common.component.Analytics.trackEvent("ToolBar","Shape Arrange");break;case 4:this.api.shapes_bringBackward(),Common.component.Analytics.trackEvent("ToolBar","Shape Arrange");break;case 5:this.api.groupShapes(),Common.component.Analytics.trackEvent("ToolBar","Shape Group");break;case 6:this.api.unGroupShapes(),Common.component.Analytics.trackEvent("ToolBar","Shape UnGroup")}Common.NotificationCenter.trigger("edit:complete",this.toolbar)}},onHyperlinkClick:function(t){var e,i,n,o=this;if(o.api){var s=function(t,e){"ok"==e&&(i=t.getSettings(),!1!==n?o.api.add_Hyperlink(i):o.api.change_Hyperlink(i)),Common.NotificationCenter.trigger("edit:complete",o.toolbar)};n=o.api.can_AddHyperlink();for(var a=[],l=0;lthis.currentPageSize.width;this.currentPageSize={type:e.value,width:this.slideSizeArr[e.value][i?1:0],height:this.slideSizeArr[e.value][i?0:1]},this.api&&this.api.changeSlideSize(this.slideSizeArr[e.value][i?1:0],this.slideSizeArr[e.value][i?0:1]),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Slide Size")}else{var n,o,s=this,a=function(t,e){"ok"==e&&(o=t.getSettings(),s.currentPageSize={type:o[0],width:o[1],height:o[2]},s.toolbar.btnSlideSize.menu.items[0].setChecked(0==o[0]),s.toolbar.btnSlideSize.menu.items[1].setChecked(1==o[0]),s.api&&s.api.changeSlideSize(o[1],o[2])),Common.NotificationCenter.trigger("edit:complete",s.toolbar)};n=new PE.Views.SlideSizeSettings({handler:a}),n.show(),n.setSettings(s.currentPageSize.type,s.currentPageSize.width,s.currentPageSize.height),Common.component.Analytics.trackEvent("ToolBar","Slide Size")}},onSelectChart:function(t){var e=this,i=!1,n=e.api.getSelectedElements();if(n&&_.isArray(n))for(var o=0;o0)){var t=this,e=this.getApplication().getCollection("EquationGroups");t.toolbar.btnInsertEquation.menu.removeAll();var i=function(n){for(var o=0;o
    ')}).on("item:click",function(e,i,n,o){t.api&&(n&&t.api.asc_AddMath(n.get("data").equationType),t.toolbar.btnsInsertText.pressed()&&t.toolbar.btnsInsertText.toggle(!1,!0),t.toolbar.btnsInsertShape.pressed()&&t.toolbar.btnsInsertShape.toggle(!1,!0),"click"!==o.type&&t.toolbar.btnInsertEquation.menu.hide(),Common.NotificationCenter.trigger("edit:complete",t.toolbar,t.toolbar.btnInsertEquation),Common.component.Analytics.trackEvent("ToolBar","Add Equation"))})}n.off("show:after",i)};t.toolbar.btnInsertEquation.menu.on("show:after",i);for(var n=0;n')}]})});t.toolbar.btnInsertEquation.menu.addItem(s)}}},onInsertEquationClick:function(){this.api&&(this.api.asc_AddMath(),Common.component.Analytics.trackEvent("ToolBar","Add Equation")),Common.NotificationCenter.trigger("edit:complete",this.toolbar,this.toolbar.btnInsertEquation)},onInsertSymbolClick:function(){if(this.api){var t=this,e=t.api.asc_GetSelectedText(),i=new Common.Views.SymbolTableDialog({api:t.api,lang:t.toolbar.mode.lang,type:1,special:!0,buttons:[{value:"ok",caption:this.textInsert},"close"],font:e&&e.length>0?t.api.get_TextProps().get_TextPr().get_FontFamily().get_Name():void 0,symbol:e&&e.length>0?e.charAt(0):void 0,handler:function(e,i,n){"ok"==i?t.api.asc_insertSymbol(n.font?n.font:t.api.get_TextProps().get_TextPr().get_FontFamily().get_Name(),n.code,n.special):Common.NotificationCenter.trigger("edit:complete",t.toolbar)}});i.show(),i.on("symbol:dblclick",function(e,i,n){t.api.asc_insertSymbol(n.font?n.font:t.api.get_TextProps().get_TextPr().get_FontFamily().get_Name(),n.code,n.special)})}},onApiMathTypes:function(t){this._equationTemp=t;var e=this,i=function(t){e.onMathTypes(e._equationTemp),e.toolbar.btnInsertEquation.menu.off("show:before",i)};e.toolbar.btnInsertEquation.menu.on("show:before",i)},onMathTypes:function(t){var e=[],i=this.getCollection("EquationGroups");i.reset();var n={};n[Common.define.c_oAscMathMainType.Symbol]=[this.textSymbols,11],n[Common.define.c_oAscMathMainType.Fraction]=[this.textFraction,4],n[Common.define.c_oAscMathMainType.Script]=[this.textScript,4],n[Common.define.c_oAscMathMainType.Radical]=[this.textRadical,4],n[Common.define.c_oAscMathMainType.Integral]=[this.textIntegral,3,!0],n[Common.define.c_oAscMathMainType.LargeOperator]=[this.textLargeOperator,5,!0],n[Common.define.c_oAscMathMainType.Bracket]=[this.textBracket,4,!0],n[Common.define.c_oAscMathMainType.Function]=[this.textFunction,3,!0],n[Common.define.c_oAscMathMainType.Accent]=[this.textAccent,4],n[Common.define.c_oAscMathMainType.LimitLog]=[this.textLimitAndLog,3],n[Common.define.c_oAscMathMainType.Operator]=[this.textOperator,4],n[Common.define.c_oAscMathMainType.Matrix]=[this.textMatrix,4,!0];var o={},s="",a="";for(s in Common.define.c_oAscMathType)if(Common.define.c_oAscMathType.hasOwnProperty(s)){var l=s.split("_");a=2==l.length&&"Symbol"==l[0]?"txt"+l[0]+"_"+l[1].toLocaleLowerCase():"txt"+s,o[Common.define.c_oAscMathType[s]]=this[a]}var r,c,d=0,h=0,p=0,u=0,m=0,g=null,f=null,b=null;if(t&&(c=t.get_Data(),h=c.length)){for(var C=0;C0&&i.toolbar.listTheme.rendered&&(i.toolbar.listTheme.fillComboView(i.toolbar.listTheme.menuPicker.store.at(0),!0),Common.NotificationCenter.trigger("edit:complete",this)),window.styles_loaded=!0},onHideMenus:function(t){Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onSetupCopyStyleButton:function(){this.modeAlwaysSetStyle=!1;var t=this;Common.NotificationCenter.on({"edit:complete":function(){t.api&&t.modeAlwaysSetStyle&&(t.api.SetPaintFormat(AscCommon.c_oAscFormatPainterState.kOff),t.toolbar.btnCopyStyle.toggle(!1,!0),t.modeAlwaysSetStyle=!1)}}),$(t.toolbar.btnCopyStyle.cmpEl).dblclick(function(){t.api&&(t.modeAlwaysSetStyle=!0,t.toolbar.btnCopyStyle.toggle(!0,!0),t.api.SetPaintFormat(AscCommon.c_oAscFormatPainterState.kMultiple))})},activateControls:function(){this.onApiPageSize(this.api.get_PresentationWidth(),this.api.get_PresentationHeight()),this.toolbar.lockToolbar(PE.enumLock.disableOnStart,!1,{array:this.toolbar.slideOnlyControls.concat(this.toolbar.shapeControls)}),this._state.activated=!0},DisableToolbar:function(t,e){void 0!==e&&(this.editMode=!e),t=t||!this.editMode;var i=$(".toolbar-mask");if(!(t&&i.length>0||!t&&0==i.length)){var n=this.toolbar;n.$el.find(".toolbar").toggleClass("masked",t),n.btnsAddSlide&&this.toolbar.lockToolbar(PE.enumLock.menuFileOpen,t,{array:n.btnsAddSlide.concat(n.btnChangeSlide,n.btnPreview)}),t?(i=$("
    ").appendTo(n.$el.find(".toolbar")),Common.util.Shortcuts.suspendEvents("command+k, ctrl+k, alt+h, command+f5, ctrl+f5")):(i.remove(),Common.util.Shortcuts.resumeEvents("command+k, ctrl+k, alt+h, command+f5, ctrl+f5"))}},createDelayedElements:function(){this.toolbar.createDelayedElements(),this.attachUIEvents(this.toolbar)},onAppShowed:function(t){var e=this,i=!t.isEdit;t.isEdit&&(Common.localStorage.itemExists("pe-compact-toolbar")?i=Common.localStorage.getBool("pe-compact-toolbar"):t.customization&&t.customization.compactToolbar&&(i=!0)),e.toolbar.render(_.extend({compactview:i},t));var n={action:"review",caption:e.toolbar.textTabCollaboration},o=e.getApplication().getController("Common.Controllers.ReviewChanges").createToolbarPanel();if(o&&e.toolbar.addTab(n,o,3),t.isEdit){if(e.toolbar.setMode(t),e.toolbar.btnSave.on("disabled",_.bind(e.onBtnChangeState,e,"save:disabled")),!t.customization||!t.customization.compactHeader){e.toolbar.btnPrint.$el.parents(".group").hide().next().hide();var s=e.toolbar.btnUndo.$el.hide().next().hide().parent();e.toolbar.btnPaste.$el.detach().appendTo(s),e.toolbar.btnCopy.$el.removeClass("split")}t.isDesktopApp&&t.canProtect&&(n={action:"protect",caption:e.toolbar.textTabProtect},(o=e.getApplication().getController("Common.Controllers.Protection").createToolbarPanel())&&e.toolbar.addTab(n,o,4))}},onAppReady:function(t){var e=this;if(e.appOptions=t,this.btnsComment=[],t.canCoAuthoring&&t.canComments){var i=PE.enumLock;if(this.btnsComment=Common.Utils.injectButtons(this.toolbar.$el.find(".slot-comment"),"tlbtn-addcomment-","toolbar__icon btn-menu-comments",e.toolbar.capBtnComment,[i.lostConnect,i.noSlides]),this.btnsComment.length){var n=PE.getController("Common.Controllers.Comments").getView();Array.prototype.push.apply(e.toolbar.lockControls,this.btnsComment),this.btnsComment.forEach(function(t){t.updateHint(n.textHintAddComment),t.on("click",function(t,e){Common.NotificationCenter.trigger("app:comment:add","toolbar")}),t.cmpEl.closest("#review-changes-panel").length>0&&t.setCaption(e.toolbar.capBtnAddComment)},this),this.toolbar.lockToolbar(PE.enumLock.noSlides,this._state.no_slides,{array:this.btnsComment})}}},onFileMenu:function(t){"show"==t?this.toolbar.isTabActive("file")||this.toolbar.setTab("file"):this.toolbar.isTabActive("file")&&this.toolbar.setTab()},onTextLanguage:function(t){this._state.lang=t},onAddAudio:function(){this.api&&this.api.asc_AddAudio()},onAddVideo:function(){this.api&&this.api.asc_AddVideo()},textEmptyImgUrl:"You need to specify image URL.",textWarning:"Warning",textFontSizeErr:"The entered value is incorrect.
    Please enter a numeric value between 1 and 300",confirmAddFontName:"The font you are going to save is not available on the current device.
    The text style will be displayed using one of the device fonts, the saved font will be used when it is available.
    Do you want to continue?",textSymbols:"Symbols",textFraction:"Fraction",textScript:"Script",textRadical:"Radical",textIntegral:"Integral",textLargeOperator:"Large Operator",textBracket:"Bracket",textFunction:"Function",textAccent:"Accent",textLimitAndLog:"Limit And Log",textOperator:"Operator",textMatrix:"Matrix",txtSymbol_pm:"Plus Minus",txtSymbol_infinity:"Infinity",txtSymbol_equals:"Equal",txtSymbol_neq:"Not Equal To",txtSymbol_about:"Approximately",txtSymbol_times:"Multiplication Sign",txtSymbol_div:"Division Sign",txtSymbol_factorial:"Factorial",txtSymbol_propto:"Proportional To",txtSymbol_less:"Less Than",txtSymbol_ll:"Much Less Than",txtSymbol_greater:"Greater Than",txtSymbol_gg:"Much Greater Than",txtSymbol_leq:"Less Than or Equal To",txtSymbol_geq:"Greater Than or Equal To",txtSymbol_mp:"Minus Plus",txtSymbol_cong:"Approximately Equal To",txtSymbol_approx:"Almost Equal To",txtSymbol_equiv:"Identical To",txtSymbol_forall:"For All",txtSymbol_additional:"Complement",txtSymbol_partial:"Partial Differential",txtSymbol_sqrt:"Radical Sign",txtSymbol_cbrt:"Cube Root",txtSymbol_qdrt:"Fourth Root",txtSymbol_cup:"Union",txtSymbol_cap:"Intersection",txtSymbol_emptyset:"Empty Set",txtSymbol_percent:"Percentage",txtSymbol_degree:"Degrees",txtSymbol_fahrenheit:"Degrees Fahrenheit",txtSymbol_celsius:"Degrees Celsius",txtSymbol_inc:"Increment",txtSymbol_nabla:"Nabla",txtSymbol_exists:"There Exist",txtSymbol_notexists:"There Does Not Exist",txtSymbol_in:"Element Of",txtSymbol_ni:"Contains as Member",txtSymbol_leftarrow:"Left Arrow",txtSymbol_uparrow:"Up Arrow",txtSymbol_rightarrow:"Right Arrow",txtSymbol_downarrow:"Down Arrow",txtSymbol_leftrightarrow:"Left-Right Arrow", -txtSymbol_therefore:"Therefore",txtSymbol_plus:"Plus",txtSymbol_minus:"Minus",txtSymbol_not:"Not Sign",txtSymbol_ast:"Asterisk Operator",txtSymbol_bullet:"Bulet Operator",txtSymbol_vdots:"Vertical Ellipsis",txtSymbol_cdots:"Midline Horizontal Ellipsis",txtSymbol_rddots:"Up Right Diagonal Ellipsis",txtSymbol_ddots:"Down Right Diagonal Ellipsis",txtSymbol_aleph:"Alef",txtSymbol_beth:"Bet",txtSymbol_qed:"End of Proof",txtSymbol_alpha:"Alpha",txtSymbol_beta:"Beta",txtSymbol_gamma:"Gamma",txtSymbol_delta:"Delta",txtSymbol_varepsilon:"Epsilon Variant",txtSymbol_epsilon:"Epsilon",txtSymbol_zeta:"Zeta",txtSymbol_eta:"Eta",txtSymbol_theta:"Theta",txtSymbol_vartheta:"Theta Variant",txtSymbol_iota:"Iota",txtSymbol_kappa:"Kappa",txtSymbol_lambda:"Lambda",txtSymbol_mu:"Mu",txtSymbol_nu:"Nu",txtSymbol_xsi:"Xi",txtSymbol_o:"Omicron",txtSymbol_pi:"Pi",txtSymbol_varpi:"Pi Variant",txtSymbol_rho:"Rho",txtSymbol_varrho:"Rho Variant",txtSymbol_sigma:"Sigma",txtSymbol_varsigma:"Sigma Variant",txtSymbol_tau:"Tau",txtSymbol_upsilon:"Upsilon",txtSymbol_varphi:"Phi Variant",txtSymbol_phi:"Phi",txtSymbol_chi:"Chi",txtSymbol_psi:"Psi",txtSymbol_omega:"Omega",txtFractionVertical:"Stacked Fraction",txtFractionDiagonal:"Skewed Fraction",txtFractionHorizontal:"Linear Fraction",txtFractionSmall:"Small Fraction",txtFractionDifferential_1:"Differential",txtFractionDifferential_2:"Differential",txtFractionDifferential_3:"Differential",txtFractionDifferential_4:"Differential",txtFractionPi_2:"Pi Over 2",txtScriptSup:"Superscript",txtScriptSub:"Subscript",txtScriptSubSup:"Subscript-Superscript",txtScriptSubSupLeft:"Left Subscript-Superscript",txtScriptCustom_1:"Script",txtScriptCustom_2:"Script",txtScriptCustom_3:"Script",txtScriptCustom_4:"Script",txtRadicalSqrt:"Square Root",txtRadicalRoot_n:"Radical With Degree",txtRadicalRoot_2:"Square Root With Degree",txtRadicalRoot_3:"Cubic Root",txtRadicalCustom_1:"Radical",txtRadicalCustom_2:"Radical",txtIntegral:"Integral",txtIntegralSubSup:"Integral",txtIntegralCenterSubSup:"Integral",txtIntegralDouble:"Double Integral",txtIntegralDoubleSubSup:"Double Integral",txtIntegralDoubleCenterSubSup:"Double Integral",txtIntegralTriple:"Triple Integral",txtIntegralTripleSubSup:"Triple Integral",txtIntegralTripleCenterSubSup:"Triple Integral",txtIntegralOriented:"Contour Integral",txtIntegralOrientedSubSup:"Contour Integral",txtIntegralOrientedCenterSubSup:"Contour Integral",txtIntegralOrientedDouble:"Surface Integral",txtIntegralOrientedDoubleSubSup:"Surface Integral",txtIntegralOrientedDoubleCenterSubSup:"Surface Integral",txtIntegralOrientedTriple:"Volume Integral",txtIntegralOrientedTripleSubSup:"Volume Integral",txtIntegralOrientedTripleCenterSubSup:"Volume Integral",txtIntegral_dx:"Differential x",txtIntegral_dy:"Differential y",txtIntegral_dtheta:"Differential theta",txtLargeOperator_Sum:"Summation",txtLargeOperator_Sum_CenterSubSup:"Summation",txtLargeOperator_Sum_SubSup:"Summation",txtLargeOperator_Sum_CenterSub:"Summation",txtLargeOperator_Sum_Sub:"Summation",txtLargeOperator_Prod:"Product",txtLargeOperator_Prod_CenterSubSup:"Product",txtLargeOperator_Prod_SubSup:"Product",txtLargeOperator_Prod_CenterSub:"Product",txtLargeOperator_Prod_Sub:"Product",txtLargeOperator_CoProd:"Co-Product",txtLargeOperator_CoProd_CenterSubSup:"Co-Product",txtLargeOperator_CoProd_SubSup:"Co-Product",txtLargeOperator_CoProd_CenterSub:"Co-Product",txtLargeOperator_CoProd_Sub:"Co-Product",txtLargeOperator_Union:"Union",txtLargeOperator_Union_CenterSubSup:"Union",txtLargeOperator_Union_SubSup:"Union",txtLargeOperator_Union_CenterSub:"Union",txtLargeOperator_Union_Sub:"Union",txtLargeOperator_Intersection:"Intersection",txtLargeOperator_Intersection_CenterSubSup:"Intersection",txtLargeOperator_Intersection_SubSup:"Intersection",txtLargeOperator_Intersection_CenterSub:"Intersection",txtLargeOperator_Intersection_Sub:"Intersection",txtLargeOperator_Disjunction:"Vee",txtLargeOperator_Disjunction_CenterSubSup:"Vee",txtLargeOperator_Disjunction_SubSup:"Vee",txtLargeOperator_Disjunction_CenterSub:"Vee",txtLargeOperator_Disjunction_Sub:"Vee",txtLargeOperator_Conjunction:"Wedge",txtLargeOperator_Conjunction_CenterSubSup:"Wedge",txtLargeOperator_Conjunction_SubSup:"Wedge",txtLargeOperator_Conjunction_CenterSub:"Wedge",txtLargeOperator_Conjunction_Sub:"Wedge",txtLargeOperator_Custom_1:"Summation",txtLargeOperator_Custom_2:"Summation",txtLargeOperator_Custom_3:"Summation",txtLargeOperator_Custom_4:"Product",txtLargeOperator_Custom_5:"Union",txtBracket_Round:"Brackets",txtBracket_Square:"Brackets",txtBracket_Curve:"Brackets",txtBracket_Angle:"Brackets",txtBracket_LowLim:"Brackets",txtBracket_UppLim:"Brackets",txtBracket_Line:"Brackets",txtBracket_LineDouble:"Brackets",txtBracket_Square_OpenOpen:"Brackets",txtBracket_Square_CloseClose:"Brackets",txtBracket_Square_CloseOpen:"Brackets",txtBracket_SquareDouble:"Brackets",txtBracket_Round_Delimiter_2:"Brackets with Separators",txtBracket_Curve_Delimiter_2:"Brackets with Separators",txtBracket_Angle_Delimiter_2:"Brackets with Separators",txtBracket_Angle_Delimiter_3:"Brackets with Separators",txtBracket_Round_OpenNone:"Single Bracket",txtBracket_Round_NoneOpen:"Single Bracket",txtBracket_Square_OpenNone:"Single Bracket",txtBracket_Square_NoneOpen:"Single Bracket",txtBracket_Curve_OpenNone:"Single Bracket",txtBracket_Curve_NoneOpen:"Single Bracket",txtBracket_Angle_OpenNone:"Single Bracket",txtBracket_Angle_NoneOpen:"Single Bracket",txtBracket_LowLim_OpenNone:"Single Bracket",txtBracket_LowLim_NoneNone:"Single Bracket",txtBracket_UppLim_OpenNone:"Single Bracket",txtBracket_UppLim_NoneOpen:"Single Bracket",txtBracket_Line_OpenNone:"Single Bracket",txtBracket_Line_NoneOpen:"Single Bracket",txtBracket_LineDouble_OpenNone:"Single Bracket",txtBracket_LineDouble_NoneOpen:"Single Bracket",txtBracket_SquareDouble_OpenNone:"Single Bracket",txtBracket_SquareDouble_NoneOpen:"Single Bracket",txtBracket_Custom_1:"Case (Two Conditions)",txtBracket_Custom_2:"Cases (Three Conditions)",txtBracket_Custom_3:"Stack Object",txtBracket_Custom_4:"Stack Object",txtBracket_Custom_5:"Cases Example",txtBracket_Custom_6:"Binomial Coefficient",txtBracket_Custom_7:"Binomial Coefficient",txtFunction_Sin:"Sine Function",txtFunction_Cos:"Cosine Function",txtFunction_Tan:"Tangent Function",txtFunction_Csc:"Cosecant Function",txtFunction_Sec:"Secant Function",txtFunction_Cot:"Cotangent Function",txtFunction_1_Sin:"Inverse Sine Function",txtFunction_1_Cos:"Inverse Cosine Function",txtFunction_1_Tan:"Inverse Tangent Function",txtFunction_1_Csc:"Inverse Cosecant Function",txtFunction_1_Sec:"Inverse Secant Function",txtFunction_1_Cot:"Inverse Cotangent Function",txtFunction_Sinh:"Hyperbolic Sine Function",txtFunction_Cosh:"Hyperbolic Cosine Function",txtFunction_Tanh:"Hyperbolic Tangent Function",txtFunction_Csch:"Hyperbolic Cosecant Function",txtFunction_Sech:"Hyperbolic Secant Function",txtFunction_Coth:"Hyperbolic Cotangent Function",txtFunction_1_Sinh:"Hyperbolic Inverse Sine Function",txtFunction_1_Cosh:"Hyperbolic Inverse Cosine Function",txtFunction_1_Tanh:"Hyperbolic Inverse Tangent Function",txtFunction_1_Csch:"Hyperbolic Inverse Cosecant Function",txtFunction_1_Sech:"Hyperbolic Inverse Secant Function",txtFunction_1_Coth:"Hyperbolic Inverse Cotangent Function",txtFunction_Custom_1:"Sine theta",txtFunction_Custom_2:"Cos 2x",txtFunction_Custom_3:"Tangent formula",txtAccent_Dot:"Dot",txtAccent_DDot:"Double Dot",txtAccent_DDDot:"Triple Dot",txtAccent_Hat:"Hat",txtAccent_Check:"Check",txtAccent_Accent:"Acute",txtAccent_Grave:"Grave",txtAccent_Smile:"Breve",txtAccent_Tilde:"Tilde",txtAccent_Bar:"Bar",txtAccent_DoubleBar:"Double Overbar",txtAccent_CurveBracketTop:"Overbrace",txtAccent_CurveBracketBot:"Underbrace",txtAccent_GroupTop:"Grouping Character Above",txtAccent_GroupBot:"Grouping Character Below",txtAccent_ArrowL:"Leftwards Arrow Above",txtAccent_ArrowR:"Rightwards Arrow Above",txtAccent_ArrowD:"Right-Left Arrow Above",txtAccent_HarpoonL:"Leftwards Harpoon Above",txtAccent_HarpoonR:"Rightwards Harpoon Above",txtAccent_BorderBox:"Boxed Formula (With Placeholder)",txtAccent_BorderBoxCustom:"Boxed Formula (Example)",txtAccent_BarTop:"Overbar",txtAccent_BarBot:"Underbar",txtAccent_Custom_1:"Vector A",txtAccent_Custom_2:"ABC With Overbar",txtAccent_Custom_3:"x XOR y With Overbar",txtLimitLog_LogBase:"Logarithm",txtLimitLog_Log:"Logarithm",txtLimitLog_Lim:"Limit",txtLimitLog_Min:"Minimum",txtLimitLog_Max:"Maximum",txtLimitLog_Ln:"Natural Logarithm",txtLimitLog_Custom_1:"Limit Example",txtLimitLog_Custom_2:"Maximum Example",txtOperator_ColonEquals:"Colon Equal",txtOperator_EqualsEquals:"Equal Equal",txtOperator_PlusEquals:"Plus Equal",txtOperator_MinusEquals:"Minus Equal",txtOperator_Definition:"Equal to By Definition",txtOperator_UnitOfMeasure:"Measured By",txtOperator_DeltaEquals:"Delta Equal To",txtOperator_ArrowL_Top:"Leftwards Arrow Above",txtOperator_ArrowR_Top:"Rightwards Arrow Above",txtOperator_ArrowL_Bot:"Leftwards Arrow Below",txtOperator_ArrowR_Bot:"Rightwards Arrow Below",txtOperator_DoubleArrowL_Top:"Leftwards Arrow Above",txtOperator_DoubleArrowR_Top:"Rightwards Arrow Above",txtOperator_DoubleArrowL_Bot:"Leftwards Arrow Below",txtOperator_DoubleArrowR_Bot:"Rightwards Arrow Below",txtOperator_ArrowD_Top:"Right-Left Arrow Above",txtOperator_ArrowD_Bot:"Right-Left Arrow Above",txtOperator_DoubleArrowD_Top:"Right-Left Arrow Below",txtOperator_DoubleArrowD_Bot:"Right-Left Arrow Below",txtOperator_Custom_1:"Yileds",txtOperator_Custom_2:"Delta Yields",txtMatrix_1_2:"1x2 Empty Matrix",txtMatrix_2_1:"2x1 Empty Matrix",txtMatrix_1_3:"1x3 Empty Matrix",txtMatrix_3_1:"3x1 Empty Matrix",txtMatrix_2_2:"2x2 Empty Matrix",txtMatrix_2_3:"2x3 Empty Matrix",txtMatrix_3_2:"3x2 Empty Matrix",txtMatrix_3_3:"3x3 Empty Matrix",txtMatrix_Dots_Center:"Midline Dots",txtMatrix_Dots_Baseline:"Baseline Dots",txtMatrix_Dots_Vertical:"Vertical Dots",txtMatrix_Dots_Diagonal:"Diagonal Dots",txtMatrix_Identity_2:"2x2 Identity Matrix",txtMatrix_Identity_2_NoZeros:"3x3 Identity Matrix",txtMatrix_Identity_3:"3x3 Identity Matrix",txtMatrix_Identity_3_NoZeros:"3x3 Identity Matrix",txtMatrix_2_2_RoundBracket:"Empty Matrix with Brackets",txtMatrix_2_2_SquareBracket:"Empty Matrix with Brackets",txtMatrix_2_2_LineBracket:"Empty Matrix with Brackets",txtMatrix_2_2_DLineBracket:"Empty Matrix with Brackets",txtMatrix_Flat_Round:"Sparse Matrix",txtMatrix_Flat_Square:"Sparse Matrix",textInsert:"Insert"},PE.Controllers.Toolbar||{}))}),define("text!presentationeditor/main/app/template/StatusBar.template",[],function(){return'\r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n \r\n
    \r\n \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n \r\n \r\n
    \r\n \r\n \r\n \r\n
    \r\n \r\n
    \r\n \r\n
    \r\n
    \r\n'}),define("presentationeditor/main/app/view/Statusbar",["text!presentationeditor/main/app/template/StatusBar.template","backbone","tip","common/main/lib/component/Menu","common/main/lib/component/Window","presentationeditor/main/app/model/Pages"],function(t,e){"use strict";function i(t){this.pages.get("count")<0&&$("#status-label-pages").css("display","inline-block"),this.pages.set("count",t);var e=t<=0;this.btnPreview.isDisabled()!==e&&this.btnPreview.setDisabled(e)}function n(t){this.pages.set("current",t+1)}function o(t,e,i){$("#status-label-pages").text(Common.Utils.String.format(this.pageIndexText,t.get("current"),t.get("count")))}function s(t,e){t.$el.parent().find("#status-label-lang").text(e.caption),this.langMenu.prevTip=e.value.value,this.fireEvent("langchanged",[this,e.value.code,e.caption])}_.template("Slide <%= current %> of <%= count %>");PE.Views.Statusbar=e.View.extend(_.extend({el:"#statusbar",template:_.template(t),events:{},api:void 0,pages:void 0,initialize:function(t){_.extend(this,t),this.pages=new PE.Models.Pages({current:1,count:-1}),this.pages.on("change",_.bind(o,this)),this._state={no_paragraph:!0}},render:function(){var t=this;$(this.el).html(this.template({scope:this})),this.btnZoomToPage=new Common.UI.Button({el:$("#btn-zoom-topage",this.el),hint:this.tipFitPage,hintAnchor:"top",toggleGroup:"status-zoom",enableToggle:!0}),this.btnZoomToWidth=new Common.UI.Button({el:$("#btn-zoom-towidth",this.el),hint:this.tipFitWidth,hintAnchor:"top",toggleGroup:"status-zoom",enableToggle:!0}),this.btnZoomDown=new Common.UI.Button({el:$("#btn-zoom-down",this.el),hint:this.tipZoomOut+Common.Utils.String.platformKey("Ctrl+-"),hintAnchor:"top"}),this.btnZoomUp=new Common.UI.Button({el:$("#btn-zoom-up",this.el),hint:this.tipZoomIn+Common.Utils.String.platformKey("Ctrl++"),hintAnchor:"top-right"}),this.cntZoom=new Common.UI.Button({el:$(".cnt-zoom",this.el),hint:this.tipZoomFactor,hintAnchor:"top"}),this.cntZoom.cmpEl.on("show.bs.dropdown",function(){_.defer(function(){t.cntZoom.cmpEl.find("ul").focus()},100)}),this.cntZoom.cmpEl.on("hide.bs.dropdown",function(){_.defer(function(){t.api.asc_enableKeyEvents(!0)},100)}),this.zoomMenu=new Common.UI.Menu({style:"margin-top:-5px;",menuAlign:"bl-tl",items:[{caption:"50%",value:50},{caption:"75%",value:75},{caption:"100%",value:100},{caption:"125%",value:125},{caption:"150%",value:150},{caption:"175%",value:175},{caption:"200%",value:200}]}),this.zoomMenu.render($(".cnt-zoom",this.el)),this.zoomMenu.cmpEl.attr({tabindex:-1}),this.txtGoToPage=new Common.UI.InputField({el:$("#status-goto-page"),allowBlank:!0,validateOnChange:!0,style:"width: 60px;",maskExp:/[0-9]/,validation:function(e){return!!(/(^[0-9]+$)/.test(e)&&void 0!==(e=parseInt(e))&&e>0&&e<=t.pages.get("count"))||t.txtPageNumInvalid}}).on("keypress:after",function(e,i){if(i.keyCode===Common.UI.Keys.RETURN){var n=t.$el.find("#status-goto-box"),o=n.find("input[type=text]"),s=parseInt(o.val());return!s||s-- >t.pages.get("count")||s<0?(o.select(),!1):(n.focus(),n.parent().removeClass("open"),t.api.goToPage(s),t.api.asc_enableKeyEvents(!0),!1)}}).on("keyup:after",function(e,i){if(i.keyCode===Common.UI.Keys.ESC){var n=t.$el.find("#status-goto-box");return n.focus(),n.parent().removeClass("open"),t.api.asc_enableKeyEvents(!0),!1}});var e=this.$el.find("#status-goto-box");e.on("click",function(){return!1}),e.parent().on("show.bs.dropdown",function(){t.txtGoToPage.setValue(t.api.getCurrentPage()+1),t.txtGoToPage.checkValidate();var e=t.txtGoToPage.$el.find("input");_.defer(function(){e.focus(),e.select()},100)}),e.parent().on("hide.bs.dropdown",function(){var e=t.$el.find("#status-goto-box");t.api&&e&&(e.focus(),e.parent().removeClass("open"),t.api.asc_enableKeyEvents(!0))}),this.btnPreview=new Common.UI.Button({parentEl:$("#slot-status-btn-preview"),cls:"btn-toolbar",iconCls:"toolbar__icon btn-preview",hint:this.tipPreview,hintAnchor:"top",split:!0,menu:new Common.UI.Menu({menuAlign:"bl-tl",style:"margin-top:-5px;",items:[{caption:this.textShowBegin,value:0},{caption:this.textShowCurrent,value:1},{caption:this.textShowPresenterView,value:2}]})});var i=$(".cnt-lang",this.el);return this.langMenu=new Common.UI.MenuSimple({cls:"lang-menu",style:"margin-top:-5px;",restoreHeight:285,itemTemplate:_.template(['','',"<%= caption %>",""].join("")),menuAlign:"bl-tl",search:!0}),this.btnLanguage=new Common.UI.Button({el:i,hint:this.tipSetLang,hintAnchor:"top-left",disabled:!0}),this.btnLanguage.cmpEl.on({"show.bs.dropdown":function(){_.defer(function(){t.btnLanguage.cmpEl.find("ul").focus()},100)},"hide.bs.dropdown":function(){_.defer(function(){t.api.asc_enableKeyEvents(!0)},100)},click:function(e){if(t.btnLanguage.isDisabled())return!1}}),this.langMenu.render(i),this.langMenu.cmpEl.attr({tabindex:-1}),this.langMenu.prevTip="en",this.langMenu.on("item:click",_.bind(s,this)),this},setApi:function(t){return this.api=t,this.api&&(this.api.asc_registerCallback("asc_onCountPages",_.bind(i,this)),this.api.asc_registerCallback("asc_onCurrentPage",_.bind(n,this)),this.api.asc_registerCallback("asc_onFocusObject",_.bind(this.onApiFocusObject,this)),Common.NotificationCenter.on("api:disconnect",_.bind(this.onApiCoAuthoringDisconnect,this))),this},setMode:function(t){this.mode=t,this.$el.find(".el-edit")[this.mode.isEdit?"show":"hide"]()},setVisible:function(t){t?this.show():this.hide()},showStatusMessage:function(t){$("#status-label-action").text(t)},clearStatusMessage:function(){$("#status-label-action").text("")},reloadLanguages:function(t){var e=[],i=this.langMenu.saved;_.each(t,function(t){e.push({caption:t.displayValue,value:{value:t.value,code:t.code},checkable:!0,checked:i==t.displayValue,spellcheck:t.spellcheck})}),this.langMenu.resetItems(e),this.langMenu.items.length>0&&this.btnLanguage.setDisabled(this._state.no_paragraph)},setLanguage:function(t){if(this.langMenu.prevTip!=t.value&&void 0!==t.code){$(this.langMenu.el.parentNode,this.$el).find("#status-label-lang").text(t.displayValue),this.langMenu.prevTip=t.value;var e=_.find(this.langMenu.items,function(e){return e.caption==t.displayValue});e?this.langMenu.setChecked(this.langMenu.items.indexOf(e),!0):(this.langMenu.saved=t.displayValue,this.langMenu.clearAll())}},SetDisabled:function(t){var e=this.langMenu.items.length>0;this.btnLanguage.setDisabled(t||!e||this._state.no_paragraph),this.mode.isEdit=!t},onApiFocusObject:function(t){if(this.mode&&this.mode.isEdit){this._state.no_paragraph=!0;for(var e=-1;++e
    ',initialize:function(t){_.extend(this.options,t||{},{label:this.labelSelect}),this.options.tpl=_.template(this.template)(this.options),Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this);var t=this.getChild();t.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this)),this.cmbLanguage=new Common.UI.ComboBox({el:t.find("#id-document-language"),cls:"input-group-nr",menuStyle:"min-width: 318px; max-height: 285px;",editable:!1,template:_.template(['','','','','",""].join("")),data:this.options.languages,takeFocusOnClose:!0,search:!0,scrollAlwaysVisible:!0}),this.cmbLanguage.scroller&&this.cmbLanguage.scroller.update({alwaysVisibleY:!0}),this.cmbLanguage.on("selected",_.bind(this.onLangSelect,this));var e=Common.util.LanguageInfo.getLocalLanguageName(this.options.current);this.cmbLanguage.setValue(e[0],e[1]),this.onLangSelect(this.cmbLanguage,this.cmbLanguage.getSelectedRecord());var i=this;setTimeout(function(){i.cmbLanguage.focus()},100)},close:function(t){this.getChild().find(".combobox.open").length||Common.UI.Window.prototype.close.call(this,arguments)},onBtnClick:function(t){this.options.handler&&this.options.handler.call(this,t.currentTarget.attributes.result.value,this.cmbLanguage.getValue()),this.close()},onLangSelect:function(t,e,i){t.$el.find(".input-icon").toggleClass("spellcheck-lang",e&&e.spellcheck),t._input.css("padding-left",e&&e.spellcheck?25:3)},onPrimary:function(){return this.options.handler&&this.options.handler.call(this,"ok",this.cmbLanguage.getValue()),this.close(),!1},labelSelect:"Select document language"},Common.Views.LanguageDialog||{}))}),define("presentationeditor/main/app/controller/Statusbar",["core","presentationeditor/main/app/view/Statusbar","common/main/lib/util/LanguageInfo","common/main/lib/view/LanguageDialog"],function(){"use strict";PE.Controllers.Statusbar=Backbone.Controller.extend(_.extend({models:[],collections:[],views:["Statusbar"],initialize:function(){var t=this;this.addListeners({Statusbar:{langchanged:this.onLangMenu},"Common.Views.Header":{"statusbar:hide":function(e,i){t.statusbar.setVisible(!i),Common.localStorage.setBool("pe-hidden-status",i),Common.NotificationCenter.trigger("layout:changed","status"),Common.NotificationCenter.trigger("edit:complete",this.statusbar)}}}),this._state={zoom_type:void 0,zoom_percent:void 0}},events:function(){return{"click #btn-zoom-down":_.bind(this.zoomDocument,this,"down"),"click #btn-zoom-up":_.bind(this.zoomDocument,this,"up")}},onLaunch:function(){this.statusbar=this.createView("Statusbar",{}).render(),this.statusbar.$el.css("z-index",1),this.bindViewEvents(this.statusbar,this.events),$("#status-label-zoom").css("min-width",80),this.statusbar.btnZoomToPage.on("click",_.bind(this.onBtnZoomTo,this,"topage")),this.statusbar.btnZoomToWidth.on("click",_.bind(this.onBtnZoomTo,this,"towidth")),this.statusbar.zoomMenu.on("item:click",_.bind(this.menuZoomClick,this)),this.statusbar.btnPreview.on("click",_.bind(this.onPreviewBtnClick,this)),this.statusbar.btnPreview.menu.on("item:click",_.bind(this.onPreviewItemClick,this));var t=this;Common.NotificationCenter.on("app:face",function(e){if(e.isEdit){var i=t.getApplication().getController("Common.Controllers.ReviewChanges").getView();t.btnSpelling=i.getButton("spelling","statusbar"),t.btnSpelling.render(t.statusbar.$el.find("#btn-doc-spell")),t.btnDocLang=i.getButton("doclang","statusbar"),t.btnDocLang.render(t.statusbar.$el.find("#btn-doc-lang"))}else t.statusbar.$el.find(".el-edit, .el-review").hide()})},setApi:function(t){this.api=t,this.api.asc_registerCallback("asc_onZoomChange",_.bind(this._onZoomChange,this)),this.api.asc_registerCallback("asc_onTextLanguage",_.bind(this._onTextLanguage,this)),this.statusbar.setApi(t)},onBtnZoomTo:function(t,e,i){this._state.zoom_type=void 0,this._state.zoom_percent=void 0,e.pressed?this.api["topage"==t?"zoomFitToPage":"zoomFitToWidth"]():this.api.zoomCustomMode(),Common.NotificationCenter.trigger("edit:complete",this.statusbar)},zoomDocument:function(t,e){switch(this._state.zoom_type=void 0,this._state.zoom_percent=void 0,t){case"up":this.api.zoomIn();break;case"down":this.api.zoomOut()}Common.NotificationCenter.trigger("edit:complete",this.statusbar)},menuZoomClick:function(t,e){this._state.zoom_type=void 0,this._state.zoom_percent=void 0,this.api.zoom(e.value),Common.NotificationCenter.trigger("edit:complete",this.statusbar)},onPreview:function(t,e){Common.NotificationCenter.trigger("preview:start",_.isNumber(t)?t:0,e)},onPreviewBtnClick:function(t,e){this.onPreview(this.api.getCurrentPage())},onPreviewItemClick:function(t,e){switch(e.value){case 0:this.onPreview(0);break;case 1:this.onPreview(this.api.getCurrentPage());break;case 2:this.onPreview(0,!0)}},_onZoomChange:function(t,e){this._state.zoom_type!==e&&(this.statusbar.btnZoomToPage.toggle(2==e,!0),this.statusbar.btnZoomToWidth.toggle(1==e,!0),this._state.zoom_type=e),this._state.zoom_percent!==t&&($("#status-label-zoom").text(Common.Utils.String.format(this.zoomText,t)),this._state.zoom_percent=t)},_onTextLanguage:function(t){var e=Common.util.LanguageInfo.getLocalLanguageName(t);this.statusbar.setLanguage({value:e[0],displayValue:e[1],code:t})},setLanguages:function(t){this.langs=t,this.statusbar.reloadLanguages(t)},setStatusCaption:function(t,e,i){this.timerCaption&&(new Date0&&(this.timerCaption=(new Date).getTime()+i)):this.statusbar.clearStatusMessage())},createDelayedElements:function(){this.statusbar.$el.css("z-index","")},onLangMenu:function(t,e,i){this.api.put_TextPrLang(e)},zoomText:"Zoom {0}%"},PE.Controllers.Statusbar||{}))}),define("text!presentationeditor/main/app/template/RightMenu.template",[],function(){return'
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n \n \n \n \n \n \n \n \n
    \n
    '}),define("text!presentationeditor/main/app/template/ParagraphSettings.template",[],function(){return'\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    '}),define("presentationeditor/main/app/view/ParagraphSettings",["text!presentationeditor/main/app/template/ParagraphSettings.template","jquery","underscore","backbone","common/main/lib/component/ComboBox","common/main/lib/component/MetricSpinner","presentationeditor/main/app/view/ParagraphSettingsAdvanced"],function(t,e,i,n){"use strict";PE.Views.ParagraphSettings=n.View.extend(i.extend({el:"#id-paragraph-settings",template:i.template(t),events:{},options:{alias:"ParagraphSettings"},initialize:function(){this._initSettings=!0,this._state={LineRule:c_paragraphLinerule.LINERULE_AUTO,LineHeight:1.5,LineSpacingBefore:0,LineSpacingAfter:.35,DisabledControls:!1},this.spinners=[],this.lockedControls=[],this._locked=!1,this.render()},render:function(){e(this.el).html(this.template({scope:this})),this.linkAdvanced=e("#paragraph-advanced-link")},setApi:function(t){return this.api=t,this.api&&this.api.asc_registerCallback("asc_onParaSpacingLine",i.bind(this._onLineSpacing,this)),this},onNumLineHeightChange:function(t,e,i,n){""!==this.cmbLineRule.getRawValue()&&this.api&&this.api.put_PrLineSpacing(this.cmbLineRule.getValue(),this.cmbLineRule.getValue()==c_paragraphLinerule.LINERULE_AUTO?t.getNumberValue():Common.Utils.Metric.fnRecalcToMM(t.getNumberValue()))},onNumSpacingBeforeChange:function(t,e,i,n){if(this.api){t.getNumberValue()<0?this.api.put_LineSpacingBeforeAfter(0,-1):this.api.put_LineSpacingBeforeAfter(0,Common.Utils.Metric.fnRecalcToMM(t.getNumberValue()))}},onNumSpacingAfterChange:function(t,e,i,n){if(this.api){t.getNumberValue()<0?this.api.put_LineSpacingBeforeAfter(1,-1):this.api.put_LineSpacingBeforeAfter(1,Common.Utils.Metric.fnRecalcToMM(t.getNumberValue()))}},onLineRuleSelect:function(t,e){this.api&&this.api.put_PrLineSpacing(e.value,e.defaultValue),this.numLineHeight.setDefaultUnit(e.defaultUnit),this.numLineHeight.setMinValue(e.minValue),this.numLineHeight.setStep(e.step),this.fireEvent("editcomplete",this)},_onLineSpacing:function(t){if(!this._initSettings){var e=t.get_LineRule(),i=t.get_Line();if(this._state.LineRule!==e){var n,o=this.cmbLineRule.store.findWhere((n={},n.value=e,n));o||(o=this.cmbLineRule.store.at(0)),this.cmbLineRule.setValue(null!==e?e:""),this.numLineHeight.setMinValue(o.get("minValue")),this.numLineHeight.setDefaultUnit(o.get("defaultUnit")),this.numLineHeight.setStep(o.get("step")),this._state.LineRule=e}if(Math.abs(this._state.LineHeight-i)>.001||(null===this._state.LineHeight||null===i)&&this._state.LineHeight!==i){var s="";e==c_paragraphLinerule.LINERULE_AUTO?s=i:null!==e&&null!==i&&(s=Common.Utils.Metric.fnRecalcFromMM(i)),this.numLineHeight.setValue(null!==s?s:"",!0),this._state.LineHeight=i}}},ChangeSettings:function(t){if(this._initSettings&&this.createDelayedElements(),this.disableControls(this._locked),t){var e={Line:t.get_Spacing().get_Line(),Before:t.get_Spacing().get_Before(),After:t.get_Spacing().get_After(),LineRule:t.get_Spacing().get_LineRule()};t.get_ContextualSpacing();if(this._state.LineRule!==e.LineRule){var i,n=this.cmbLineRule.store.findWhere((i={},i.value=e.LineRule,i));n||(n=this.cmbLineRule.store.at(0)),this.cmbLineRule.setValue(null!==e.LineRule?e.LineRule:""),this.numLineHeight.setMinValue(n.get("minValue")),this.numLineHeight.setDefaultUnit(n.get("defaultUnit")),this.numLineHeight.setStep(n.get("step")),this._state.LineRule=e.LineRule}if(Math.abs(this._state.LineHeight-e.Line)>.001||(null===this._state.LineHeight||null===e.Line)&&this._state.LineHeight!==e.Line){var o="";e.LineRule==c_paragraphLinerule.LINERULE_AUTO?o=e.Line:null!==e.LineRule&&null!==e.Line&&(o=Common.Utils.Metric.fnRecalcFromMM(e.Line)),this.numLineHeight.setValue(null!==o?o:"",!0),this._state.LineHeight=e.Line}(Math.abs(this._state.LineSpacingBefore-e.Before)>.001||(null===this._state.LineSpacingBefore||null===e.Before)&&this._state.LineSpacingBefore!==e.Before)&&(this.numSpacingBefore.setValue(null!==e.Before?e.Before<0?e.Before:Common.Utils.Metric.fnRecalcFromMM(e.Before):"",!0),this._state.LineSpacingBefore=e.Before),(Math.abs(this._state.LineSpacingAfter-e.After)>.001||(null===this._state.LineSpacingAfter||null===e.After)&&this._state.LineSpacingAfter!==e.After)&&(this.numSpacingAfter.setValue(null!==e.After?e.After<0?e.After:Common.Utils.Metric.fnRecalcFromMM(e.After):"",!0),this._state.LineSpacingAfter=e.After)}},updateMetricUnit:function(){if(this.spinners){for(var t=0;t0)for(var n,o,s=i.length-1;s>=0;s--)if(n=i[s].get_ObjectType(),o=i[s].get_ObjectValue(),Asc.c_oAscTypeSelectElement.Paragraph==n){new PE.Views.ParagraphSettingsAdvanced({paragraphProps:o,api:e.api,handler:function(t,i){"ok"==t&&e.api&&e.api.paraApply(i.paragraphProps),e.fireEvent("editcomplete",e)}}).show();break}}}},onHideMenus:function(t,e,i){i||this.fireEvent("editcomplete",this)},setLocked:function(t){this._locked=t},disableControls:function(t){this._initSettings||this._state.DisabledControls!==t&&(this._state.DisabledControls=t,i.each(this.lockedControls,function(e){e.setDisabled(t)}),this.linkAdvanced.toggleClass("disabled",t))},strParagraphSpacing:"Paragraph Spacing",strLineHeight:"Line Spacing",strSpacingBefore:"Before",strSpacingAfter:"After",textAuto:"Multiple",textAtLeast:"At least",textExact:"Exactly",textAdvanced:"Show advanced settings",textAt:"At",txtAutoText:"Auto"},PE.Views.ParagraphSettings||{}))}),define("text!presentationeditor/main/app/template/ImageSettings.template",[],function(){return'\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
    \r\n \r\n
    \r\n \r\n \r\n \r\n
    \r\n \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n \r\n
    '}), -define("text!presentationeditor/main/app/template/ImageSettingsAdvanced.template",[],function(){return'
    \r\n
    \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
    \r\n \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
    \r\n \r\n
    \r\n \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
    \r\n \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
    \r\n \r\n
    \r\n
    \r\n \r\n \r\n
    \r\n \r\n
    \r\n
    \r\n
    '}),define("presentationeditor/main/app/view/ImageSettingsAdvanced",["text!presentationeditor/main/app/template/ImageSettingsAdvanced.template","common/main/lib/view/AdvancedSettingsWindow","common/main/lib/component/MetricSpinner","common/main/lib/component/CheckBox"],function(t){"use strict";PE.Views.ImageSettingsAdvanced=Common.Views.AdvancedSettingsWindow.extend(_.extend({options:{alias:"ImageSettingsAdvanced",contentWidth:340,height:342,sizeOriginal:{width:0,height:0},sizeMax:{width:55.88,height:55.88},storageName:"pe-img-settings-adv-category"},initialize:function(e){_.extend(this.options,{title:this.textTitle,items:[{panelId:"id-adv-image-size",panelCaption:this.textPlacement},{panelId:"id-adv-image-rotate",panelCaption:this.textRotation},{panelId:"id-adv-image-alttext",panelCaption:this.textAlt}],contentTemplate:_.template(t)({scope:this})},e),Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this,this.options),this.spinners=[],this._nRatio=1,this._isDefaultSize=!1,this._originalProps=this.options.imageProps},render:function(){Common.Views.AdvancedSettingsWindow.prototype.render.call(this);var t=this;this.spnWidth=new Common.UI.MetricSpinner({el:$("#image-advanced-spin-width"),step:.1,width:80,defaultUnit:"cm",value:"3 cm",maxValue:55.88,minValue:0}),this.spnWidth.on("change",_.bind(function(t,e,i,n){if(this.btnRatio.pressed){var o=t.getNumberValue(),s=o/this._nRatio;s>this.sizeMax.height&&(s=this.sizeMax.height,o=s*this._nRatio,this.spnWidth.setValue(o,!0)),this.spnHeight.setValue(s,!0)}this._isDefaultSize=!1},this)),this.spinners.push(this.spnWidth),this.spnHeight=new Common.UI.MetricSpinner({el:$("#image-advanced-spin-height"),step:.1,width:80,defaultUnit:"cm",value:"3 cm",maxValue:55.88,minValue:0}),this.spnHeight.on("change",_.bind(function(t,e,i,n){var o=t.getNumberValue(),s=null;this.btnRatio.pressed&&(s=o*this._nRatio,s>this.sizeMax.width&&(s=this.sizeMax.width,o=s/this._nRatio,this.spnHeight.setValue(o,!0)),this.spnWidth.setValue(s,!0)),this._isDefaultSize=!1},this)),this.spinners.push(this.spnHeight),this.btnOriginalSize=new Common.UI.Button({el:$("#image-advanced-button-original-size")}),this.btnOriginalSize.on("click",_.bind(function(t,e){this.spnWidth.setValue(this.sizeOriginal.width,!0),this.spnHeight.setValue(this.sizeOriginal.height,!0),this._nRatio=this.sizeOriginal.width/this.sizeOriginal.height,this._isDefaultSize=!0},this)),this.btnRatio=new Common.UI.Button({parentEl:$("#image-advanced-button-ratio"),cls:"btn-toolbar",iconCls:"toolbar__icon advanced-btn-ratio",style:"margin-bottom: 1px;",enableToggle:!0,hint:this.textKeepRatio}),this.btnRatio.on("click",_.bind(function(t,e){t.pressed&&this.spnHeight.getNumberValue()>0&&(this._nRatio=this.spnWidth.getNumberValue()/this.spnHeight.getNumberValue())},this)),this.spnX=new Common.UI.MetricSpinner({el:$("#image-advanced-spin-x"),step:.1,width:85,defaultUnit:"cm",defaultValue:0,value:"0 cm",maxValue:55.87,minValue:-55.87}),this.spinners.push(this.spnX),this.spnY=new Common.UI.MetricSpinner({el:$("#image-advanced-spin-y"),step:.1,width:85,defaultUnit:"cm",defaultValue:0,value:"0 cm",maxValue:55.87,minValue:-55.87}),this.spinners.push(this.spnY),this.spnAngle=new Common.UI.MetricSpinner({el:$("#image-advanced-spin-angle"),step:1,width:80,defaultUnit:"°",value:"0 °",maxValue:3600,minValue:-3600}),this.chFlipHor=new Common.UI.CheckBox({el:$("#image-advanced-checkbox-hor"),labelText:this.textHorizontally}),this.chFlipVert=new Common.UI.CheckBox({el:$("#image-advanced-checkbox-vert"),labelText:this.textVertically}),this.inputAltTitle=new Common.UI.InputField({el:$("#image-advanced-alt-title"),allowBlank:!0,validateOnBlur:!1,style:"width: 100%;"}).on("changed:after",function(){t.isAltTitleChanged=!0}),this.textareaAltDescription=this.$window.find("textarea"),this.textareaAltDescription.keydown(function(e){e.keyCode==Common.UI.Keys.RETURN&&e.stopPropagation(),t.isAltDescChanged=!0}),this.afterRender()},getFocusedComponents:function(){return[this.spnWidth,this.spnHeight,this.spnX,this.spnY,this.spnAngle,this.inputAltTitle,this.textareaAltDescription]},onCategoryClick:function(t,e){Common.Views.AdvancedSettingsWindow.prototype.onCategoryClick.call(this,t,e);var i=this;setTimeout(function(){switch(e){case 0:i.spnWidth.focus();break;case 1:i.spnAngle.focus();break;case 2:i.inputAltTitle.focus()}},10)},afterRender:function(){if(this.updateMetricUnit(),this._setDefaults(this._originalProps),this.storageName){var t=Common.localStorage.getItem(this.storageName);this.setActiveCategory(null!==t?parseInt(t):0)}},_setDefaults:function(t){if(t){this.spnWidth.setMaxValue(this.sizeMax.width),this.spnHeight.setMaxValue(this.sizeMax.height),this.spnWidth.setValue(Common.Utils.Metric.fnRecalcFromMM(t.get_Width()).toFixed(2),!0),this.spnHeight.setValue(Common.Utils.Metric.fnRecalcFromMM(t.get_Height()).toFixed(2),!0),this.btnOriginalSize.setDisabled(null===t.get_ImageUrl()||void 0===t.get_ImageUrl());var e=t.asc_getLockAspect();if(this.btnRatio.toggle(e),t.get_Height()>0&&(this._nRatio=t.get_Width()/t.get_Height()),t.get_Position()){var i={X:t.get_Position().get_X(),Y:t.get_Position().get_Y()};this.spnX.setValue(null!==i.X&&void 0!==i.X?Common.Utils.Metric.fnRecalcFromMM(i.X):"",!0),this.spnY.setValue(null!==i.Y&&void 0!==i.Y?Common.Utils.Metric.fnRecalcFromMM(i.Y):"",!0)}else this.spnX.setValue("",!0),this.spnY.setValue("",!0);e=t.asc_getRot(),this.spnAngle.setValue(void 0==e||null===e?"":Math.floor(180*e/3.14159265358979+.5),!0),this.chFlipHor.setValue(t.asc_getFlipH()),this.chFlipVert.setValue(t.asc_getFlipV()),e=t.asc_getTitle(),this.inputAltTitle.setValue(e||""),e=t.asc_getDescription(),this.textareaAltDescription.val(e||"");var n=t.asc_getPluginGuid();this.btnsCategory[1].setVisible(null===n||void 0===n)}},getSettings:function(){var t=new Asc.asc_CImgProperty;""!==this.spnHeight.getValue()&&t.put_Height(Common.Utils.Metric.fnRecalcToMM(this.spnHeight.getNumberValue())),""!==this.spnWidth.getValue()&&t.put_Width(Common.Utils.Metric.fnRecalcToMM(this.spnWidth.getNumberValue())),t.asc_putLockAspect(this.btnRatio.pressed),t.put_ResetCrop(this._isDefaultSize);var e=new Asc.CPosition;return""!==this.spnX.getValue()&&e.put_X(Common.Utils.Metric.fnRecalcToMM(this.spnX.getNumberValue())),""!==this.spnY.getValue()&&e.put_Y(Common.Utils.Metric.fnRecalcToMM(this.spnY.getNumberValue())),t.put_Position(e),this.isAltTitleChanged&&t.asc_putTitle(this.inputAltTitle.getValue()),this.isAltDescChanged&&t.asc_putDescription(this.textareaAltDescription.val()),t.asc_putRot(3.14159265358979*this.spnAngle.getNumberValue()/180),t.asc_putFlipH("checked"==this.chFlipHor.getValue()),t.asc_putFlipV("checked"==this.chFlipVert.getValue()),{imageProps:t}},updateMetricUnit:function(){if(this.spinners)for(var t=0;t-1),this.btnEditObject=new Common.UI.Button({el:e("#image-button-edit-object")}),this.lockedControls.push(this.btnEditObject),this.btnOriginalSize.on("click",i.bind(this.setOriginalSize,this)),this.btnEditObject.on("click",i.bind(function(t){this.api&&this.api.asc_startEditCurrentOleObject(),this.fireEvent("editcomplete",this)},this)),this.btnFitSlide=new Common.UI.Button({el:e("#image-button-fit-slide")}),this.lockedControls.push(this.btnFitSlide),this.btnFitSlide.on("click",i.bind(this.setFitSlide,this));var t=Math.max(this.btnOriginalSize.cmpEl.width(),this.btnFitSlide.cmpEl.width());this.btnOriginalSize.cmpEl.width(t),this.btnFitSlide.cmpEl.width(t),t=this.btnOriginalSize.cmpEl.outerWidth(),this.btnCrop=new Common.UI.Button({parentEl:e("#image-button-crop"),cls:"btn-text-split-default",caption:this.textCrop,split:!0,enableToggle:!0,allowDepress:!0,pressed:this._state.cropMode,width:t,menu:new Common.UI.Menu({style:"min-width:"+t+"px;",items:[{caption:this.textCrop,checkable:!0,allowDepress:!0,checked:this._state.cropMode,value:0},{caption:this.textCropFill,value:1},{caption:this.textCropFit,value:2}]})}),this.btnCrop.on("click",i.bind(this.onCrop,this)),this.btnCrop.menu.on("item:click",i.bind(this.onCropMenu,this)),this.lockedControls.push(this.btnCrop),this.btnRotate270=new Common.UI.Button({parentEl:e("#image-button-270",this.$el),cls:"btn-toolbar",iconCls:"toolbar__icon btn-rotate-270",value:0,hint:this.textHint270}),this.btnRotate270.on("click",i.bind(this.onBtnRotateClick,this)),this.lockedControls.push(this.btnRotate270),this.btnRotate90=new Common.UI.Button({parentEl:e("#image-button-90",this.$el),cls:"btn-toolbar",iconCls:"toolbar__icon btn-rotate-90",value:1,hint:this.textHint90}),this.btnRotate90.on("click",i.bind(this.onBtnRotateClick,this)),this.lockedControls.push(this.btnRotate90),this.btnFlipV=new Common.UI.Button({parentEl:e("#image-button-flipv",this.$el),cls:"btn-toolbar",iconCls:"toolbar__icon btn-flip-vert",value:0,hint:this.textHintFlipV}),this.btnFlipV.on("click",i.bind(this.onBtnFlipClick,this)),this.lockedControls.push(this.btnFlipV),this.btnFlipH=new Common.UI.Button({parentEl:e("#image-button-fliph",this.$el),cls:"btn-toolbar",iconCls:"toolbar__icon btn-flip-hor",value:1,hint:this.textHintFlipH}),this.btnFlipH.on("click",i.bind(this.onBtnFlipClick,this)),this.lockedControls.push(this.btnFlipH),this.linkAdvanced=e("#image-advanced-link"),e(this.el).on("click","#image-advanced-link",i.bind(this.openAdvancedSettings,this))},createDelayedElements:function(){this.createDelayedControls(),this.updateMetricUnit(),this._initSettings=!1},ChangeSettings:function(t){if(this._initSettings&&this.createDelayedElements(),this.disableControls(this._locked),t){this._originalProps=new Asc.asc_CImgProperty(t);var e=t.get_Width();Math.abs(this._state.Width-e)>.001&&(this.labelWidth[0].innerHTML=this.textWidth+": "+Common.Utils.Metric.fnRecalcFromMM(e).toFixed(2)+" "+Common.Utils.Metric.getCurrentMetricName(),this._state.Width=e),e=t.get_Height(),Math.abs(this._state.Height-e)>.001&&(this.labelHeight[0].innerHTML=this.textHeight+": "+Common.Utils.Metric.fnRecalcFromMM(e).toFixed(2)+" "+Common.Utils.Metric.getCurrentMetricName(),this._state.Height=e),this.btnOriginalSize.setDisabled(null===t.get_ImageUrl()||void 0===t.get_ImageUrl()||this._locked);var i=t.asc_getPluginGuid();if(e=null!==i&&void 0!==i,this._state.isOleObject!==e&&(this.btnSelectImage.setVisible(!e),this.btnEditObject.setVisible(e),this.btnRotate270.setDisabled(e),this.btnRotate90.setDisabled(e),this.btnFlipV.setDisabled(e),this.btnFlipH.setDisabled(e),this._state.isOleObject=e),this._state.isOleObject){var n=PE.getCollection("Common.Collections.Plugins").findWhere({guid:i});this.btnEditObject.setDisabled(null===n||void 0===n||this._locked)}else this.btnSelectImage.setDisabled(null===i||this._locked)}},setOriginalSize:function(){if(this.api){var t=this.api.get_OriginalSizeImage(),e=t.get_ImageWidth(),i=t.get_ImageHeight();this.labelWidth[0].innerHTML=this.textWidth+": "+Common.Utils.Metric.fnRecalcFromMM(e).toFixed(2)+" "+Common.Utils.Metric.getCurrentMetricName(),this.labelHeight[0].innerHTML=this.textHeight+": "+Common.Utils.Metric.fnRecalcFromMM(i).toFixed(2)+" "+Common.Utils.Metric.getCurrentMetricName();var n=new Asc.asc_CImgProperty;n.put_Width(e),n.put_Height(i),n.put_ResetCrop(!0),this.api.ImgApply(n),this.fireEvent("editcomplete",this)}},setImageUrl:function(t,e){var i=new Asc.asc_CImgProperty;i.put_ImageUrl(t,e),this.api.ImgApply(i)},insertImageFromStorage:function(t){t&&t.url&&"change"==t.c&&this.setImageUrl(t.url,t.token)},onImageSelect:function(t,e){if(1==e.value){var n=this;new Common.Views.ImageFromUrlDialog({handler:function(t,e){if("ok"==t&&n.api){var o=e.replace(/ /g,"");i.isEmpty(o)||n.setImageUrl(o)}n.fireEvent("editcomplete",n)}}).show()}else if(2==e.value)Common.NotificationCenter.trigger("storage:image-load","change");else{if(this._isFromFile)return;this._isFromFile=!0,this.api&&this.api.ChangeImageFromFile(),this.fireEvent("editcomplete",this),this._isFromFile=!1}},openAdvancedSettings:function(t){if(!this.linkAdvanced.hasClass("disabled")){var e=this;if(e.api&&!this._locked){var i=e.api.getSelectedElements();if(i&&i.length>0)for(var n,o,s=i.length-1;s>=0;s--)if(n=i[s].get_ObjectType(),o=i[s].get_ObjectValue(),Asc.c_oAscTypeSelectElement.Image==n){var a;e.btnOriginalSize.isDisabled()||(a=e.api.get_OriginalSizeImage())&&(a={width:a.get_ImageWidth(),height:a.get_ImageHeight()}),new PE.Views.ImageSettingsAdvanced({imageProps:o,sizeOriginal:a,handler:function(t,i){"ok"==t&&e.api&&e.api.ImgApply(i.imageProps),e.fireEvent("editcomplete",e)}}).show();break}}}},_changeCropState:function(t){this._state.cropMode=t,this.btnCrop&&(this.btnCrop.toggle(t,!0),this.btnCrop.menu.items[0].setChecked(t,!0))},onCrop:function(t,e){this.api&&(t.pressed?this.api.asc_startEditCrop():this.api.asc_endEditCrop()),this.fireEvent("editcomplete",this)},onCropMenu:function(t,e){this.api&&(1==e.value?this.api.asc_cropFill():2==e.value?this.api.asc_cropFit():e.checked?this.api.asc_startEditCrop():this.api.asc_endEditCrop()),this.fireEvent("editcomplete",this)},setFitSlide:function(){this.api&&this.api.asc_FitImagesToSlide(),this.fireEvent("editcomplete",this)},onBtnRotateClick:function(t){var e=new Asc.asc_CImgProperty;e.asc_putRotAdd(3.14159265358979*(1==t.options.value?90:270)/180),this.api.ImgApply(e),this.fireEvent("editcomplete",this)},onBtnFlipClick:function(t){var e=new Asc.asc_CImgProperty;1==t.options.value?e.asc_putFlipHInvert(!0):e.asc_putFlipVInvert(!0),this.api.ImgApply(e),this.fireEvent("editcomplete",this)},setLocked:function(t){this._locked=t},disableControls:function(t){this._initSettings||(this._state.DisabledControls!==t&&(this._state.DisabledControls=t,i.each(this.lockedControls,function(e){e.setDisabled(t)}),this.linkAdvanced.toggleClass("disabled",t)),this.btnCrop.setDisabled(t||!this.api.asc_canEditCrop()))},textSize:"Size",textWidth:"Width",textHeight:"Height",textOriginalSize:"Actual Size",textInsert:"Replace Image",textFromUrl:"From URL",textFromFile:"From File",textAdvanced:"Show advanced settings",textEditObject:"Edit Object",textEdit:"Edit",textRotation:"Rotation",textRotate90:"Rotate 90°",textFlip:"Flip",textHint270:"Rotate 90° Counterclockwise",textHint90:"Rotate 90° Clockwise",textHintFlipV:"Flip Vertically",textHintFlipH:"Flip Horizontally",textCrop:"Crop",textCropFill:"Fill",textCropFit:"Fit",textFitSlide:"Fit to Slide",textFromStorage:"From Storage"},PE.Views.ImageSettings||{}))}),define("text!presentationeditor/main/app/template/ChartSettings.template",[],function(){return'\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
    \r\n \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n \r\n
    '}),define("text!presentationeditor/main/app/template/ChartSettingsAdvanced.template",[],function(){return'
    \n
    \n \n \n \n \n \n \n \n \n \n \n
    \n \n
    \n
    \n \n \n
    \n \n
    \n
    \n
    '}),define("presentationeditor/main/app/view/ChartSettingsAdvanced",["text!presentationeditor/main/app/template/ChartSettingsAdvanced.template","common/main/lib/view/AdvancedSettingsWindow","common/main/lib/component/InputField"],function(t){"use strict";PE.Views.ChartSettingsAdvanced=Common.Views.AdvancedSettingsWindow.extend(_.extend({options:{contentWidth:300,height:342,toggleGroup:"chart-adv-settings-group",properties:null,storageName:"pe-chart-settings-adv-category"},initialize:function(e){_.extend(this.options,{title:this.textTitle,items:[{panelId:"id-adv-chart-alttext",panelCaption:this.textAlt}],contentTemplate:_.template(t)({scope:this})},e),Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this,this.options),this._originalProps=this.options.chartProps,this._changedProps=null},render:function(){Common.Views.AdvancedSettingsWindow.prototype.render.call(this);var t=this;this.inputAltTitle=new Common.UI.InputField({el:$("#chart-advanced-alt-title"),allowBlank:!0,validateOnBlur:!1,style:"width: 100%;"}).on("changed:after",function(){t.isAltTitleChanged=!0}),this.textareaAltDescription=this.$window.find("textarea"),this.textareaAltDescription.keydown(function(e){e.keyCode==Common.UI.Keys.RETURN&&e.stopPropagation(),t.isAltDescChanged=!0}),this.afterRender()},afterRender:function(){if(this._setDefaults(this._originalProps),this.storageName){var t=Common.localStorage.getItem(this.storageName);this.setActiveCategory(null!==t?parseInt(t):0)}},getFocusedComponents:function(){return[this.inputAltTitle,this.textareaAltDescription]},onCategoryClick:function(t,e){Common.Views.AdvancedSettingsWindow.prototype.onCategoryClick.call(this,t,e);var i=this;setTimeout(function(){switch(e){case 0:i.inputAltTitle.focus()}},10)},_setDefaults:function(t){if(t){var e=t.asc_getTitle();this.inputAltTitle.setValue(e||""),e=t.asc_getDescription(),this.textareaAltDescription.val(e||""),this._changedProps=new Asc.CAscChartProp}},getSettings:function(){return this.isAltTitleChanged&&this._changedProps.asc_putTitle(this.inputAltTitle.getValue()),this.isAltDescChanged&&this._changedProps.asc_putDescription(this.textareaAltDescription.val()),{chartProps:this._changedProps}},textTitle:"Chart - Advanced Settings",textAlt:"Alternative Text",textAltTitle:"Title",textAltDescription:"Description",textAltTip:"The alternative text-based representation of the visual object information, which will be read to the people with vision or cognitive impairments to help them better understand what information there is in the image, autoshape, chart or table."},PE.Views.ChartSettingsAdvanced||{}))}),define("presentationeditor/main/app/view/ChartSettings",["text!presentationeditor/main/app/template/ChartSettings.template","jquery","underscore","backbone","common/main/lib/component/Button","common/main/lib/component/ComboDataView","presentationeditor/main/app/view/ChartSettingsAdvanced"],function(t,e,i,n){"use strict";PE.Views.ChartSettings=n.View.extend(i.extend({el:"#id-chart-settings",template:i.template(t),events:{},options:{alias:"ChartSettings"},initialize:function(){this._initSettings=!0,this._state={Width:0,Height:0,ChartStyle:1,ChartType:-1,SeveralCharts:!1,DisabledControls:!1,keepRatio:!1},this._nRatio=1,this.spinners=[],this.lockedControls=[],this._locked=!1,this._noApply=!1,this._originalProps=null,this.render()},render:function(){e(this.el).html(this.template({scope:this}))},setApi:function(t){return this.api=t,this.api&&this.api.asc_registerCallback("asc_onUpdateChartStyles",i.bind(this._onUpdateChartStyles,this)),this},ChangeSettings:function(t){if(this._initSettings&&this.createDelayedElements(),this.disableControls(this._locked),t){this._originalProps=new Asc.CAscChartProp(t),this._noApply=!0;var e=t.get_SeveralCharts()||this._locked;if(this._state.SeveralCharts!==e&&(this.btnEditData.setDisabled(e),this._state.SeveralCharts=e),e=t.get_SeveralChartTypes(),this._state.SeveralCharts&&e)this.btnChartType.setIconCls("svgicon"),this._state.ChartType=null;else{var i=t.getType();if(this._state.ChartType!==i){var n=this.mnuChartTypePicker.store.findWhere({type:i});this.mnuChartTypePicker.selectRecord(n,!0),n?this.btnChartType.setIconCls("svgicon chart-"+n.get("iconCls")):this.btnChartType.setIconCls("svgicon"),this.updateChartStyles(this.api.asc_getChartPreviews(i)),this._state.ChartType=i}}if(e=t.get_SeveralChartStyles(),this._state.SeveralCharts&&e)this.cmbChartStyle.fieldPicker.deselectAll(),this.cmbChartStyle.menuPicker.deselectAll(),this._state.ChartStyle=null;else if(e=t.getStyle(),this._state.ChartStyle!==e||this._isChartStylesChanged){this.cmbChartStyle.suspendEvents();var o=this.cmbChartStyle.menuPicker.store.findWhere({data:e});this.cmbChartStyle.menuPicker.selectRecord(o),this.cmbChartStyle.resumeEvents(),this._isChartStylesChanged&&(o?this.cmbChartStyle.fillComboView(this.cmbChartStyle.menuPicker.getSelectedRec(),!0):this.cmbChartStyle.fillComboView(this.cmbChartStyle.menuPicker.store.at(0),!0)),this._state.ChartStyle=e}this._isChartStylesChanged=!1,this._noApply=!1,e=t.get_Width(),(Math.abs(this._state.Width-e)>.001||(null===this._state.Width||null===e)&&this._state.Width!==e)&&(this.spnWidth.setValue(null!==e?Common.Utils.Metric.fnRecalcFromMM(e):"",!0),this._state.Width=e),e=t.get_Height(),(Math.abs(this._state.Height-e)>.001||(null===this._state.Height||null===e)&&this._state.Height!==e)&&(this.spnHeight.setValue(null!==e?Common.Utils.Metric.fnRecalcFromMM(e):"",!0),this._state.Height=e),t.get_Height()>0&&(this._nRatio=t.get_Width()/t.get_Height()),e=t.asc_getLockAspect(),this._state.keepRatio!==e&&(this.btnRatio.toggle(e),this._state.keepRatio=e)}},updateMetricUnit:function(){if(this.spinners){for(var t=0;t')}]})}),this.btnChartType.on("render:after",function(n){t.mnuChartTypePicker=new Common.UI.DataView({el:e("#id-chart-menu-type"),parentMenu:n.menu,restoreHeight:421,groups:new Common.UI.DataViewGroupStore(Common.define.chartData.getChartGroupData()), -store:new Common.UI.DataViewStore(Common.define.chartData.getChartData()),itemTemplate:i.template('
    ')})}),this.btnChartType.render(e("#chart-button-type")),this.mnuChartTypePicker.on("item:click",i.bind(this.onSelectType,this,this.btnChartType)),this.lockedControls.push(this.btnChartType),this.btnEditData=new Common.UI.Button({el:e("#chart-button-edit-data")}),this.btnEditData.on("click",i.bind(this.setEditData,this)),this.lockedControls.push(this.btnEditData),this.spnWidth=new Common.UI.MetricSpinner({el:e("#chart-spin-width"),step:.1,width:78,defaultUnit:"cm",value:"3 cm",maxValue:55.88,minValue:0}),this.spinners.push(this.spnWidth),this.lockedControls.push(this.spnWidth),this.spnHeight=new Common.UI.MetricSpinner({el:e("#chart-spin-height"),step:.1,width:78,defaultUnit:"cm",value:"3 cm",maxValue:55.88,minValue:0}),this.spinners.push(this.spnHeight),this.lockedControls.push(this.spnHeight),this.spnWidth.on("change",i.bind(this.onWidthChange,this)),this.spnHeight.on("change",i.bind(this.onHeightChange,this)),this.spnWidth.on("inputleave",function(){t.fireEvent("editcomplete",t)}),this.spnHeight.on("inputleave",function(){t.fireEvent("editcomplete",t)}),this.btnRatio=new Common.UI.Button({parentEl:e("#chart-button-ratio"),cls:"btn-toolbar",iconCls:"toolbar__icon advanced-btn-ratio",style:"margin-bottom: 1px;",enableToggle:!0,hint:this.textKeepRatio}),this.lockedControls.push(this.btnRatio),this.btnRatio.on("click",i.bind(function(t,e){if(t.pressed&&this.spnHeight.getNumberValue()>0&&(this._nRatio=this.spnWidth.getNumberValue()/this.spnHeight.getNumberValue()),this.api){var i=new Asc.CAscChartProp;i.asc_putLockAspect(t.pressed),this.api.ChartApply(i)}this.fireEvent("editcomplete",this)},this)),this.linkAdvanced=e("#chart-advanced-link"),e(this.el).on("click","#chart-advanced-link",i.bind(this.openAdvancedSettings,this))},createDelayedElements:function(){this.createDelayedControls(),this.updateMetricUnit(),this._initSettings=!1},setEditData:function(){var t=PE.getController("Common.Controllers.ExternalDiagramEditor").getView("Common.Views.ExternalDiagramEditor");if(t){t.setEditMode(!0),t.show();var e=this.api.asc_getChartObject();e&&t.setChartData(new Asc.asc_CChartBinary(e))}},onSelectType:function(t,e,n,o){if(!this._noApply){var s={};if(i.isFunction(o.toJSON)){if(!o.get("selected"))return;s=o.toJSON()}else s=o;if(this.btnChartType.setIconCls("svgicon chart-"+s.iconCls),this._state.ChartType=-1,this.api&&!this._noApply){var a=new Asc.CAscChartProp;a.changeType(s.type),this.api.ChartApply(a)}this.fireEvent("editcomplete",this)}},onSelectStyle:function(t,e){if(!this._noApply){if(this.api&&!this._noApply){var i=new Asc.CAscChartProp;i.putStyle(e.get("data")),this.api.ChartApply(i)}this.fireEvent("editcomplete",this)}},_onUpdateChartStyles:function(){this.api&&null!==this._state.ChartType&&this._state.ChartType>-1&&this.updateChartStyles(this.api.asc_getChartPreviews(this._state.ChartType))},updateChartStyles:function(t){var n=this;if(this._isChartStylesChanged=!0,this.cmbChartStyle||(this.cmbChartStyle=new Common.UI.ComboDataView({itemWidth:50,itemHeight:50,menuMaxHeight:270,enableKeyEvents:!0,cls:"combo-chart-style"}),this.cmbChartStyle.render(e("#chart-combo-style")),this.cmbChartStyle.openButton.menu.cmpEl.css({"min-width":178,"max-width":178}),this.cmbChartStyle.on("click",i.bind(this.onSelectStyle,this)),this.cmbChartStyle.openButton.menu.on("show:after",function(){n.cmbChartStyle.menuPicker.scroller.update({alwaysVisibleY:!0})}),this.lockedControls.push(this.cmbChartStyle)),t&&t.length>0){var o=this.cmbChartStyle.menuPicker.store;if(o){var s=o.length;if(s>0&&s==t.length){var a=o.models;i.each(t,function(t,e){a[e].set("imageUrl",t.asc_getImage())})}else{var l=[];i.each(t,function(t,e){l.push({imageUrl:t.asc_getImage(),data:t.asc_getName(),tip:n.textStyle+" "+t.asc_getName()})}),o.reset(l,{silent:!1})}}}else this.cmbChartStyle.menuPicker.store.reset(),this.cmbChartStyle.clearComboView();this.cmbChartStyle.setDisabled(!t||t.length<1||this._locked)},onWidthChange:function(t,e,i,n){var o=t.getNumberValue(),s=this.spnHeight.getNumberValue();if(this.btnRatio.pressed&&(s=o/this._nRatio,s>this.spnHeight.options.maxValue&&(s=this.spnHeight.options.maxValue,o=s*this._nRatio,this.spnWidth.setValue(o,!0)),this.spnHeight.setValue(s,!0)),this.api){var a=new Asc.CAscChartProp;a.put_Width(Common.Utils.Metric.fnRecalcToMM(o)),a.put_Height(Common.Utils.Metric.fnRecalcToMM(s)),this.api.ChartApply(a)}},onHeightChange:function(t,e,i,n){var o=t.getNumberValue(),s=this.spnWidth.getNumberValue();if(this.btnRatio.pressed&&(s=o*this._nRatio,s>this.spnWidth.options.maxValue&&(s=this.spnWidth.options.maxValue,o=s/this._nRatio,this.spnHeight.setValue(o,!0)),this.spnWidth.setValue(s,!0)),this.api){var a=new Asc.CAscChartProp;a.put_Width(Common.Utils.Metric.fnRecalcToMM(s)),a.put_Height(Common.Utils.Metric.fnRecalcToMM(o)),this.api.ChartApply(a)}},openAdvancedSettings:function(t){if(!this.linkAdvanced.hasClass("disabled")){var e=this;if(e.api&&!this._locked){var i=e.api.getSelectedElements();if(i&&i.length>0)for(var n,o,s=i.length-1;s>=0;s--)if(n=i[s].get_ObjectType(),o=i[s].get_ObjectValue(),Asc.c_oAscTypeSelectElement.Chart==n){new PE.Views.ChartSettingsAdvanced({chartProps:o,handler:function(t,i){"ok"==t&&e.api&&e.api.ChartApply(i.chartProps),e.fireEvent("editcomplete",e)}}).show();break}}}},setLocked:function(t){this._locked=t},disableControls:function(t){this._initSettings||this._state.DisabledControls!==t&&(this._state.DisabledControls=t,i.each(this.lockedControls,function(e){e.setDisabled(t)}),this.linkAdvanced.toggleClass("disabled",t))},textKeepRatio:"Constant Proportions",textSize:"Size",textWidth:"Width",textHeight:"Height",textEditData:"Edit Data",textChartType:"Change Chart Type",textStyle:"Style",textAdvanced:"Show advanced settings"},PE.Views.ChartSettings||{}))}),define("text!presentationeditor/main/app/template/TableSettings.template",[],function(){return'\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
    \r\n \r\n \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n \r\n
    '}),void 0===Common)var Common={};if(define("common/main/lib/component/ComboBorderSize",["common/main/lib/component/ComboBox"],function(){"use strict";Common.UI.BordersModel=Backbone.Model.extend({defaults:function(){return{value:null,displayValue:null,pxValue:null,id:Common.UI.getId(),offsety:void 0}}}),Common.UI.BordersStore=Backbone.Collection.extend({model:Common.UI.BordersModel}),Common.UI.ComboBorderSize=Common.UI.ComboBox.extend(_.extend({template:_.template(['
    ','
    ','
    ','','","
    "].join("")),initialize:function(t){var e=Common.Utils.Metric.getMetricName(Common.Utils.Metric.c_MetricUnits.pt),i=[{displayValue:"0.5 "+e,value:.5,pxValue:.5,offsety:0},{displayValue:"1 "+e,value:1,pxValue:1,offsety:20},{displayValue:"1.5 "+e,value:1.5,pxValue:2,offsety:40},{displayValue:"2.25 "+e,value:2.25,pxValue:3,offsety:60},{displayValue:"3 "+e,value:3,pxValue:4,offsety:80},{displayValue:"4.5 "+e,value:4.5,pxValue:5,offsety:100},{displayValue:"6 "+e,value:6,pxValue:6,offsety:120}];!1!==t.allowNoBorders&&i.unshift({displayValue:this.txtNoBorders,value:0,pxValue:0}),Common.UI.ComboBox.prototype.initialize.call(this,_.extend({editable:!1,store:new Common.UI.BordersStore,data:i,menuStyle:"min-width: 160px;"},t))},render:function(t){return Common.UI.ComboBox.prototype.render.call(this,t),this},itemClicked:function(t){var e=$(t.currentTarget).parent();this._selectedItem=this.store.findWhere({id:e.attr("id")}),this._selectedItem&&($(".selected",$(this.el)).removeClass("selected"),e.addClass("selected"),this.updateFormControl(this._selectedItem),this.trigger("selected",this,_.extend({},this._selectedItem.toJSON()),t),t.preventDefault())},updateFormControl:function(t){var e=$(this.el).find(".form-control");t.get("value")>0?(e[0].innerHTML="",e.removeClass("text").addClass("image"),e.css("background-position","10px -"+t.get("offsety")+"px")):(e[0].innerHTML=this.txtNoBorders,e.removeClass("image").addClass("text"))},setValue:function(t){if(this._selectedItem=null===t||void 0===t?void 0:_.find(this.store.models,function(e){if(te.attributes.value-.01)return!0}),$(".selected",$(this.el)).removeClass("selected"),this._selectedItem)this.updateFormControl(this._selectedItem),$("#"+this._selectedItem.get("id"),$(this.el)).addClass("selected");else{var e=$(this.el).find(".form-control");e[0].innerHTML="",e.removeClass("image").addClass("text")}},txtNoBorders:"No Borders"},Common.UI.ComboBorderSize||{})),Common.UI.ComboBorderSizeEditable=Common.UI.ComboBox.extend(_.extend({template:_.template(['','','','",""].join("")),initialize:function(t){this.txtNoBorders=t.txtNoBorders||this.txtNoBorders;var e=Common.Utils.Metric.getMetricName(Common.Utils.Metric.c_MetricUnits.pt),i=[{displayValue:"0.5 "+e,value:.5,pxValue:.5,offsety:0},{displayValue:"1 "+e,value:1,pxValue:1,offsety:20},{displayValue:"1.5 "+e,value:1.5,pxValue:2,offsety:40},{displayValue:"2.25 "+e,value:2.25,pxValue:3,offsety:60},{displayValue:"3 "+e,value:3,pxValue:4,offsety:80},{displayValue:"4.5 "+e,value:4.5,pxValue:5,offsety:100},{displayValue:"6 "+e,value:6,pxValue:6,offsety:120}];!1!==t.allowNoBorders&&i.unshift({displayValue:this.txtNoBorders,value:0,pxValue:0}),Common.UI.ComboBox.prototype.initialize.call(this,_.extend({editable:!0,store:new Common.UI.BordersStore,data:i,menuStyle:"min-width: 160px;"},t))},render:function(t){return Common.UI.ComboBox.prototype.render.call(this,t),this},txtNoBorders:"No Borders"},Common.UI.ComboBorderSizeEditable||{})),Common.UI.ComboBorderType=Common.UI.ComboBorderSize.extend(_.extend({template:_.template(['
    ','
    ','
    ','','","
    "].join("")),initialize:function(t){Common.UI.ComboBorderSize.prototype.initialize.call(this,_.extend({store:new Common.UI.BordersStore,data:[{value:Asc.c_oDashType.solid,offsety:140},{value:Asc.c_oDashType.sysDot,offsety:160},{value:Asc.c_oDashType.sysDash,offsety:180},{value:Asc.c_oDashType.dash,offsety:200},{value:Asc.c_oDashType.dashDot,offsety:220},{value:Asc.c_oDashType.lgDash,offsety:240},{value:Asc.c_oDashType.lgDashDot,offsety:260},{value:Asc.c_oDashType.lgDashDotDot,offsety:280}]},t))},render:function(t){return Common.UI.ComboBorderSize.prototype.render.call(this,t),this},updateFormControl:function(t){var e=$(this.el).find(".form-control");e[0].innerHTML="",e.removeClass("text").addClass("image"),e.css("background-position","10px -"+t.get("offsety")+"px")}},Common.UI.ComboBorderType||{})),Common.UI.ComboBoxColor=Common.UI.ComboBox.extend(_.extend({template:_.template(['
    ','
    ','
    ',"
    ",'','","
    "].join("")),itemClicked:function(t){var e=$(t.currentTarget).parent();this._selectedItem=this.store.findWhere({id:e.attr("id")}),this._selectedItem&&($(".selected",$(this.el)).removeClass("selected"),e.addClass("selected"),this.updateFormControl(this._selectedItem),this.trigger("selected",this,_.extend({},this._selectedItem.toJSON()),t),t.preventDefault())},updateFormControl:function(t){var e=$(this.el).find(".form-control > div");-1!=t.get("value")?(e[0].innerHTML="",e.css({background:"#"+t.get("value"),"margin-top":"0"})):(e[0].innerHTML=t.get("displayValue"),e.css({background:"","margin-top":"1px"}))},setValue:function(t){var e;if(this._selectedItem=this.store.findWhere((e={},e[this.valueField]=t,e)),$(".selected",$(this.el)).removeClass("selected"),this._selectedItem)this.updateFormControl(this._selectedItem),$("#"+this._selectedItem.get("id"),$(this.el)).addClass("selected");else{var i=$(this.el).find(".form-control > div");i[0].innerHTML="",i.css("background","")}},onResetItems:function(){this.itemsTemplate?$(this.el).find("ul").html($(this.itemsTemplate({items:this.store.toJSON(),scope:this}))):$(this.el).find("ul").html(_.template(["<% _.each(items, function(item) { %>","<% if (item.value==-1) { %>",'
  • <%= scope.getDisplayValue(item) %>
  • ',"<% } else { %>",'
  • ','
    ',"
  • ","<% } %>","<% }); %>"].join(""))({items:this.store.toJSON(),scope:this})),_.isUndefined(this.scroller)||(this.scroller.destroy(),delete this.scroller),this.scroller=new Common.UI.Scroller(_.extend({el:$(".dropdown-menu",this.cmpEl),minScrollbarLength:40,includePadding:!0,wheelSpeed:10,alwaysVisibleY:this.scrollAlwaysVisible},this.options.scroller))}},Common.UI.ComboBoxColor||{}))}),define("presentationeditor/main/app/view/TableSettings",["text!presentationeditor/main/app/template/TableSettings.template","jquery","underscore","backbone","common/main/lib/component/Button","common/main/lib/component/CheckBox","common/main/lib/component/ThemeColorPalette","common/main/lib/component/ColorButton","common/main/lib/component/ComboBorderSize","common/main/lib/component/ComboDataView","common/main/lib/view/InsertTableDialog","presentationeditor/main/app/view/TableSettingsAdvanced"],function(t,e,i,n){"use strict";PE.Views.TableSettings=n.View.extend(i.extend({el:"#id-table-settings",template:i.template(t),events:{},options:{alias:"TableSettings"},initialize:function(){this._initSettings=!0,this._state={TemplateId:0,CheckHeader:!1,CheckTotal:!1,CheckBanded:!1,CheckFirst:!1,CheckLast:!1,CheckColBanded:!1,BackColor:"#000000",DisabledControls:!1,Width:null,Height:null},this.spinners=[],this.lockedControls=[],this._locked=!1,this._originalLook=new Asc.CTablePropLook,this._originalProps=null,this.CellBorders={},this.CellColor={Value:1,Color:"transparent"},this.BorderSize=1,this._noApply=!1,this.render()},onCheckTemplateChange:function(t,e,i,n,o){if(this.api){var s=new Asc.CTableProp,a=this._originalLook?this._originalLook:new Asc.CTablePropLook;switch(t){case 0:a.put_FirstRow("checked"==e.getValue());break;case 1:a.put_LastRow("checked"==e.getValue());break;case 2:a.put_BandHor("checked"==e.getValue());break;case 3:a.put_FirstCol("checked"==e.getValue());break;case 4:a.put_LastCol("checked"==e.getValue());break;case 5:a.put_BandVer("checked"==e.getValue())}s.put_TableLook(a),this.api.tblApply(s)}this.fireEvent("editcomplete",this)},onTableTemplateSelect:function(t,e,i,n){if(this.api&&!this._noApply){var o=new Asc.CTableProp;o.put_TableStyle(n.get("templateId")),this.api.tblApply(o)}this.fireEvent("editcomplete",this)},onColorsBackSelect:function(t,e){if(this.CellColor={Value:1,Color:e},this.api){var i=new Asc.CTableProp,n=new Asc.CBackground;i.put_CellsBackground(n),"transparent"==this.CellColor.Color?n.put_Value(1):(n.put_Value(0),n.put_Color(Common.Utils.ThemeColor.getRgbColor(this.CellColor.Color))),i.put_CellSelect(!0),this.api.tblApply(i)}this.fireEvent("editcomplete",this)},onBtnBordersClick:function(t,e){if(this._UpdateBordersStyle(t.options.strId,!0),this.api){var i=new Asc.CTableProp;i.put_CellBorders(this.CellBorders),i.put_CellSelect(!0),this.api.tblApply(i)}this.fireEvent("editcomplete",this)},onBorderSizeSelect:function(t,e){this.BorderSize=e.value},onEditClick:function(t,e,i){if(this.api)switch(e.value){case 0:this.api.selectRow();break;case 1:this.api.selectColumn();break;case 2:this.api.selectCell();break;case 3:this.api.selectTable();break;case 4:this.api.addRowAbove();break;case 5:this.api.addRowBelow();break;case 6:this.api.addColumnLeft();break;case 7:this.api.addColumnRight();break;case 8:this.api.remRow();break;case 9:this.api.remColumn();break;case 10:this.api.remTable();break;case 11:this.api.MergeCells();break;case 12:this.splitCells(t,e,i)}this.fireEvent("editcomplete",this)},splitCells:function(t,e,i){var n=this;new Common.Views.InsertTableDialog({split:!0,handler:function(t,e){"ok"==t&&n.api&&n.api.SplitCell(e.columns,e.rows),n.fireEvent("editcomplete",n)}}).show()},render:function(){e(this.el).html(this.template({scope:this}))},setApi:function(t){return this.api=t,t&&this.api.asc_registerCallback("asc_onInitTableTemplates",i.bind(this._onInitTemplates,this)),this},createDelayedControls:function(){var t=this;this.chHeader=new Common.UI.CheckBox({el:e("#table-checkbox-header"),labelText:this.textHeader}),this.lockedControls.push(this.chHeader),this.chTotal=new Common.UI.CheckBox({el:e("#table-checkbox-total"),labelText:this.textTotal}),this.lockedControls.push(this.chTotal),this.chBanded=new Common.UI.CheckBox({el:e("#table-checkbox-banded"),labelText:this.textBanded}),this.lockedControls.push(this.chBanded),this.chFirst=new Common.UI.CheckBox({el:e("#table-checkbox-first"),labelText:this.textFirst}),this.lockedControls.push(this.chFirst),this.chLast=new Common.UI.CheckBox({el:e("#table-checkbox-last"),labelText:this.textLast}),this.lockedControls.push(this.chLast),this.chColBanded=new Common.UI.CheckBox({el:e("#table-checkbox-col-banded"),labelText:this.textBanded}),this.lockedControls.push(this.chColBanded),this.chHeader.on("change",i.bind(this.onCheckTemplateChange,this,0)),this.chTotal.on("change",i.bind(this.onCheckTemplateChange,this,1)),this.chBanded.on("change",i.bind(this.onCheckTemplateChange,this,2)),this.chFirst.on("change",i.bind(this.onCheckTemplateChange,this,3)),this.chLast.on("change",i.bind(this.onCheckTemplateChange,this,4)),this.chColBanded.on("change",i.bind(this.onCheckTemplateChange,this,5));var n=[["l","toolbar__icon btn-border-left","table-button-border-left",this.tipLeft],["c","toolbar__icon btn-border-insidevert","table-button-border-inner-vert",this.tipInnerVert],["r","toolbar__icon btn-border-right","table-button-border-right",this.tipRight],["t","toolbar__icon btn-border-top","table-button-border-top",this.tipTop],["m","toolbar__icon btn-border-insidehor","table-button-border-inner-hor",this.tipInnerHor],["b","toolbar__icon btn-border-bottom","table-button-border-bottom",this.tipBottom],["cm","toolbar__icon btn-border-inside","table-button-border-inner",this.tipInner],["lrtb","toolbar__icon btn-border-out","table-button-border-outer",this.tipOuter],["lrtbcm","toolbar__icon btn-border-all","table-button-border-all",this.tipAll],["","toolbar__icon btn-border-no","table-button-border-none",this.tipNone]];this._btnsBorderPosition=[],i.each(n,function(t,n,o){var s=new Common.UI.Button({parentEl:e("#"+t[2]),cls:"btn-toolbar borders--small",iconCls:t[1],strId:t[0],hint:t[3]});s.on("click",i.bind(this.onBtnBordersClick,this)),this._btnsBorderPosition.push(s),this.lockedControls.push(s)},this),this.cmbBorderSize=new Common.UI.ComboBorderSize({el:e("#table-combo-border-size"),style:"width: 93px;"}),this.BorderSize=this.cmbBorderSize.store.at(2).get("value"),this.cmbBorderSize.setValue(this.BorderSize),this.cmbBorderSize.on("selected",i.bind(this.onBorderSizeSelect,this)),this.lockedControls.push(this.cmbBorderSize),this.btnEdit=new Common.UI.Button({parentEl:e("#table-btn-edit"),cls:"btn-icon-default",iconCls:"btn-edit-table",menu:new Common.UI.Menu({menuAlign:"tr-br",items:[{caption:this.selectRowText,value:0},{caption:this.selectColumnText,value:1},{caption:this.selectCellText,value:2},{caption:this.selectTableText,value:3},{caption:"--"},{caption:this.insertRowAboveText,value:4},{caption:this.insertRowBelowText,value:5},{caption:this.insertColumnLeftText,value:6},{caption:this.insertColumnRightText,value:7},{caption:"--"},{caption:this.deleteRowText,value:8},{caption:this.deleteColumnText,value:9},{caption:this.deleteTableText,value:10},{caption:"--"},{caption:this.mergeCellsText,value:11},{caption:this.splitCellsText,value:12}]})}),this.mnuMerge=this.btnEdit.menu.items[this.btnEdit.menu.items.length-2],this.mnuSplit=this.btnEdit.menu.items[this.btnEdit.menu.items.length-1],this.btnEdit.menu.on("show:after",i.bind(function(){this.api&&(this.mnuMerge.setDisabled(!this.api.CheckBeforeMergeCells()),this.mnuSplit.setDisabled(!this.api.CheckBeforeSplitCells()))},this)),this.btnEdit.menu.on("item:click",i.bind(this.onEditClick,this)),this.lockedControls.push(this.btnEdit),this.numHeight=new Common.UI.MetricSpinner({el:e("#table-spin-cell-height"),step:.1,width:115,defaultUnit:"cm",value:"1 cm",maxValue:55.88,minValue:0}),this.numHeight.on("change",i.bind(function(t,e,i,n){var o=new Asc.CTableProp;o.put_RowHeight(Common.Utils.Metric.fnRecalcToMM(t.getNumberValue())),this.api.tblApply(o)},this)),this.numHeight.on("inputleave",function(){t.fireEvent("editcomplete",t)}),this.lockedControls.push(this.numHeight),this.spinners.push(this.numHeight),this.numWidth=new Common.UI.MetricSpinner({el:e("#table-spin-cell-width"),step:.1,width:115,defaultUnit:"cm",value:"1 cm",maxValue:55.88,minValue:0}),this.numWidth.on("change",i.bind(function(t,e,i,n){var o=new Asc.CTableProp;o.put_ColumnWidth(Common.Utils.Metric.fnRecalcToMM(t.getNumberValue())),this.api.tblApply(o)},this)),this.numWidth.on("inputleave",function(){t.fireEvent("editcomplete",t)}),this.lockedControls.push(this.numWidth),this.spinners.push(this.numWidth),this.btnDistributeRows=new Common.UI.Button({el:e("#table-btn-distrub-rows")}),this.lockedControls.push(this.btnDistributeRows),this.btnDistributeRows.on("click",i.bind(function(t){this.api.asc_DistributeTableCells(!1)},this)),this.btnDistributeCols=new Common.UI.Button({el:e("#table-btn-distrub-cols")}),this.lockedControls.push(this.btnDistributeCols),this.btnDistributeCols.on("click",i.bind(function(t){this.api.asc_DistributeTableCells(!0)},this)),this.linkAdvanced=e("#table-advanced-link"),e(this.el).on("click","#table-advanced-link",i.bind(this.openAdvancedSettings,this))},ChangeSettings:function(t){if(this._initSettings&&this.createDelayedElements(),this.disableControls(this._locked),t){this._originalProps=new Asc.CTableProp(t),this._originalProps.put_CellSelect(!0);var e=t.get_ColumnWidth();if(((void 0===this._state.Width||void 0===e)&&this._state.Width!==e||Math.abs(this._state.Width-e)>.001)&&(this.numWidth.setValue(null!==e&&void 0!==e?Common.Utils.Metric.fnRecalcFromMM(e):"",!0),this._state.Width=e),e=t.get_RowHeight(),((void 0===this._state.Height||void 0===e)&&this._state.Height!==e||Math.abs(this._state.Height-e)>.001)&&(this.numHeight.setValue(null!==e&&void 0!==e?Common.Utils.Metric.fnRecalcFromMM(e):"",!0),this._state.Height=e),e=t.get_TableStyle(),this._state.TemplateId!==e||this._isTemplatesChanged){var i=this.mnuTableTemplatePicker.store.findWhere({templateId:e});i||(i=this.mnuTableTemplatePicker.store.at(0)),this.btnTableTemplate.suspendEvents(),this.mnuTableTemplatePicker.selectRecord(i,!0),this.btnTableTemplate.resumeEvents(),this.$el.find(".icon-template-table").css({"background-image":"url("+i.get("imageUrl")+")",height:"52px",width:"72px","background-position":"center","background-size":"cover"}),this._state.TemplateId=e}this._isTemplatesChanged=!1;var n=t.get_TableLook();n&&(e=n.get_FirstRow(), -this._state.CheckHeader!==e&&(this.chHeader.setValue(e,!0),this._state.CheckHeader=e,this._originalLook.put_FirstRow(e)),e=n.get_LastRow(),this._state.CheckTotal!==e&&(this.chTotal.setValue(e,!0),this._state.CheckTotal=e,this._originalLook.put_LastRow(e)),e=n.get_BandHor(),this._state.CheckBanded!==e&&(this.chBanded.setValue(e,!0),this._state.CheckBanded=e,this._originalLook.put_BandHor(e)),e=n.get_FirstCol(),this._state.CheckFirst!==e&&(this.chFirst.setValue(e,!0),this._state.CheckFirst=e,this._originalLook.put_FirstCol(e)),e=n.get_LastCol(),this._state.CheckLast!==e&&(this.chLast.setValue(e,!0),this._state.CheckLast=e,this._originalLook.put_LastCol(e)),e=n.get_BandVer(),this._state.CheckColBanded!==e&&(this.chColBanded.setValue(e,!0),this._state.CheckColBanded=e,this._originalLook.put_BandVer(e)));var o=t.get_CellsBackground();if(o)if(0==o.get_Value()){var s=o.get_Color();s?s.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?this.CellColor={Value:1,Color:{color:Common.Utils.ThemeColor.getHexColor(s.get_r(),s.get_g(),s.get_b()),effectValue:s.get_value()}}:this.CellColor={Value:1,Color:Common.Utils.ThemeColor.getHexColor(s.get_r(),s.get_g(),s.get_b())}:this.CellColor={Value:1,Color:"transparent"}}else this.CellColor={Value:1,Color:"transparent"};else this.CellColor={Value:0,Color:"transparent"};var a=typeof this.CellColor.Color;if(a!==typeof this._state.BackColor||"object"==a&&(this.CellColor.Color.effectValue!==this._state.BackColor.effectValue||this._state.BackColor.color.indexOf(this.CellColor.Color.color)<0)||"object"!=a&&this._state.BackColor.indexOf(this.CellColor.Color)<0){if(this.btnBackColor.setColor(this.CellColor.Color),"object"==typeof this.CellColor.Color){for(var l=!1,r=0;r<10;r++)if(Common.Utils.ThemeColor.ThemeValues[r]==this.CellColor.Color.effectValue){this.colorsBack.select(this.CellColor.Color,!0),l=!0;break}l||this.colorsBack.clearSelection()}else this.colorsBack.select(this.CellColor.Color,!0);this._state.BackColor=this.CellColor.Color}}},updateMetricUnit:function(){if(this.spinners){for(var t=0;t-1||!i)&&(null!==e.get_Left()&&void 0!==e.get_Left()||e.put_Left(new Asc.asc_CTextBorder),this._UpdateBorderStyle(e.get_Left(),i)),(t.indexOf("t")>-1||!i)&&(null!==e.get_Top()&&void 0!==e.get_Top()||e.put_Top(new Asc.asc_CTextBorder),this._UpdateBorderStyle(e.get_Top(),i)),(t.indexOf("r")>-1||!i)&&(null!==e.get_Right()&&void 0!==e.get_Right()||e.put_Right(new Asc.asc_CTextBorder),this._UpdateBorderStyle(e.get_Right(),i)),(t.indexOf("b")>-1||!i)&&(null!==e.get_Bottom()&&void 0!==e.get_Bottom()||e.put_Bottom(new Asc.asc_CTextBorder),this._UpdateBorderStyle(e.get_Bottom(),i)),(t.indexOf("c")>-1||!i)&&(null!==e.get_InsideV()&&void 0!==e.get_InsideV()||e.put_InsideV(new Asc.asc_CTextBorder),this._UpdateBorderStyle(e.get_InsideV(),i)),(t.indexOf("m")>-1||!i)&&(null!==e.get_InsideH()&&void 0!==e.get_InsideH()||e.put_InsideH(new Asc.asc_CTextBorder),this._UpdateBorderStyle(e.get_InsideH(),i))},_UpdateBorderStyle:function(t,e){if(null==t&&(t=new Asc.asc_CTextBorder),e&&this.BorderSize>0){var i=parseFloat(this.BorderSize);t.put_Value(1),t.put_Size(25.4*i/72);var n=Common.Utils.ThemeColor.getRgbColor(this.btnBorderColor.color);t.put_Color(n)}else t.put_Value(0)},createDelayedElements:function(){this._initSettings=!1,this.createDelayedControls(),this.UpdateThemeColors(),this.updateMetricUnit()},UpdateThemeColors:function(){this._initSettings||(this.btnBackColor||(this.btnBorderColor=new Common.UI.ColorButton({parentEl:e("#table-border-color-btn"),color:"000000"}),this.lockedControls.push(this.btnBorderColor),this.borderColor=this.btnBorderColor.getPicker(),this.btnBackColor=new Common.UI.ColorButton({parentEl:e("#table-back-color-btn"),transparent:!0}),this.lockedControls.push(this.btnBackColor),this.colorsBack=this.btnBackColor.getPicker(),this.btnBackColor.on("color:select",i.bind(this.onColorsBackSelect,this))),this.colorsBack.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors()),this.borderColor.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors()),this.btnBorderColor.setColor(this.borderColor.getColor()))},_onInitTemplates:function(t){var n=this;this._isTemplatesChanged=!0,this.btnTableTemplate||(this.btnTableTemplate=new Common.UI.Button({cls:"btn-large-dataview template-table",iconCls:"icon-template-table",menu:new Common.UI.Menu({style:"width: 575px;",items:[{template:i.template('')}]})}),this.btnTableTemplate.on("render:after",function(t){n.mnuTableTemplatePicker=new Common.UI.DataView({el:e("#id-table-menu-template"),parentMenu:t.menu,restoreHeight:350,groups:new Common.UI.DataViewGroupStore,store:new Common.UI.DataViewStore,itemTemplate:i.template('
    '),style:"max-height: 350px;"})}),this.btnTableTemplate.render(e("#table-btn-template")),this.lockedControls.push(this.btnTableTemplate),this.mnuTableTemplatePicker.on("item:click",i.bind(this.onTableTemplateSelect,this,this.btnTableTemplate)));var o=n.mnuTableTemplatePicker.store.length;if(o>0&&o==t.length){var s=n.mnuTableTemplatePicker.dataViewItems;s&&i.each(t,function(t,i){var n=t.asc_getImage();s[i].model.set("imageUrl",n,{silent:!0}),e(s[i].el).find("img").attr("src",n)})}else{var a=[];i.each(t,function(t){var e=t.asc_getDisplayName();0==t.asc_getType()&&["No Style","No Grid","Table Grid","Themed Style","Light Style","Medium Style","Dark Style","Accent"].forEach(function(t){var i="txtTable_"+t.replace(" ","");n[i]&&(e=e.replace(new RegExp(t,"g"),n[i]))}),a.push({imageUrl:t.asc_getImage(),id:Common.UI.getId(),templateId:t.asc_getId(),tip:e})}),n.mnuTableTemplatePicker.store.reset(a)}},openAdvancedSettings:function(t){if(!this.linkAdvanced.hasClass("disabled")){var e=this;if(e.api&&!this._locked){var i=e.api.getSelectedElements();if(i&&i.length>0)for(var n,o,s=i.length-1;s>=0;s--)if(n=i[s].get_ObjectType(),o=i[s].get_ObjectValue(),Asc.c_oAscTypeSelectElement.Table==n){new PE.Views.TableSettingsAdvanced({tableProps:o,handler:function(t,i){"ok"==t&&e.api&&e.api.tblApply(i.tableProps),e.fireEvent("editcomplete",e)}}).show();break}}}},setLocked:function(t){this._locked=t},disableControls:function(t){this._initSettings||this._state.DisabledControls!==t&&(this._state.DisabledControls=t,i.each(this.lockedControls,function(e){e.setDisabled(t)}),this.linkAdvanced.toggleClass("disabled",t))},textBorders:"Border's Style",textBorderColor:"Color",textBackColor:"Background color",textEdit:"Rows & Columns",selectRowText:"Select Row",selectColumnText:"Select Column",selectCellText:"Select Cell",selectTableText:"Select Table",insertRowAboveText:"Insert Row Above",insertRowBelowText:"Insert Row Below",insertColumnLeftText:"Insert Column Left",insertColumnRightText:"Insert Column Right",deleteRowText:"Delete Row",deleteColumnText:"Delete Column",deleteTableText:"Delete Table",mergeCellsText:"Merge Cells",splitCellsText:"Split Cell...",splitCellTitleText:"Split Cell",textSelectBorders:"Select borders that you want to change",textAdvanced:"Show advanced settings",txtNoBorders:"No borders",textTemplate:"Select From Template",textRows:"Rows",textColumns:"Columns",textHeader:"Header",textTotal:"Total",textBanded:"Banded",textFirst:"First",textLast:"Last",textEmptyTemplate:"No templates",tipTop:"Set Outer Top Border Only",tipLeft:"Set Outer Left Border Only",tipBottom:"Set Outer Bottom Border Only",tipRight:"Set Outer Right Border Only",tipAll:"Set Outer Border and All Inner Lines",tipNone:"Set No Borders",tipInner:"Set Inner Lines Only",tipInnerVert:"Set Vertical Inner Lines Only",tipInnerHor:"Set Horizontal Inner Lines Only",tipOuter:"Set Outer Border Only",textCellSize:"Cell Size",textHeight:"Height",textWidth:"Width",textDistributeRows:"Distribute rows",textDistributeCols:"Distribute columns",txtTable_NoStyle:"No Style",txtTable_NoGrid:"No Grid",txtTable_TableGrid:"Table Grid",txtTable_ThemedStyle:"Themed Style",txtTable_LightStyle:"Light Style",txtTable_MediumStyle:"Medium Style",txtTable_DarkStyle:"Dark Style",txtTable_Accent:"Accent"},PE.Views.TableSettings||{}))}),define("text!presentationeditor/main/app/template/ShapeSettings.template",[],function(){return'\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n \r\n \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n \r\n \r\n \r\n \r\n \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    '}),void 0===Common)var Common={};if(define("common/main/lib/component/Slider",["common/main/lib/component/BaseView","underscore"],function(t,e){"use strict";Common.UI.SingleSlider=Common.UI.BaseView.extend({options:{width:100,minValue:0,maxValue:100,step:1,value:100,enableKeyEvents:!1},disabled:!1,template:e.template(['
    ','
    ','
    ','
    ','
    ',"
    ",'
    ',"<% if (this.options.enableKeyEvents) { %>",'',"<% } %>","
    "].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t);var e=this;e.width=e.options.width,e.minValue=e.options.minValue,e.maxValue=e.options.maxValue,e.delta=100/(e.maxValue-e.minValue),e.step=e.options.step,e.options.el&&e.render(),this.setValue(e.options.value)},render:function(t){var i=this;i.rendered?this.cmpEl=i.$el:(this.cmpEl=$(this.template({})),t?(this.setElement(t,!1),t.html(this.cmpEl)):i.$el.html(this.cmpEl)),this.cmpEl.find(".track-center").width(i.options.width-14),this.cmpEl.width(i.options.width),this.thumb=this.cmpEl.find(".thumb");var n,o=function(t){t.preventDefault(),t.stopPropagation();var e=Math.max(0,Math.min(100,Math.round((t.pageX*Common.Utils.zoom()-i.cmpEl.offset().left-i._dragstart)/i.width*100)));i.setThumbPosition(e),i.lastValue=i.value,i.value=e/i.delta+i.minValue,i.thumb.removeClass("active"),$(document).off("mouseup",o),$(document).off("mousemove",s),i._dragstart=void 0,i.trigger("changecomplete",i,i.value,i.lastValue)},s=function(t){if(!i.disabled&&void 0!==i._dragstart){t.preventDefault(),t.stopPropagation();var e=Math.max(0,Math.min(100,Math.round((t.pageX*Common.Utils.zoom()-i.cmpEl.offset().left-i._dragstart)/i.width*100)));i.setThumbPosition(e),i.lastValue=i.value,i.value=e/i.delta+i.minValue,Math.abs(i.value-i.lastValue)>.001&&i.trigger("change",i,i.value,i.lastValue)}},a=function(t){i.disabled||(i._dragstart=t.pageX*Common.Utils.zoom()-i.thumb.offset().left-7,i.thumb.addClass("active"),$(document).on("mouseup",o),$(document).on("mousemove",s),i.options.enableKeyEvents&&setTimeout(function(){i.input.focus()},10))},l=function(t){if(!i.disabled){var e=Math.max(0,Math.min(100,Math.round((t.pageX*Common.Utils.zoom()-i.cmpEl.offset().left)/i.width*100)));i.setThumbPosition(e),i.lastValue=i.value,i.value=e/i.delta+i.minValue,i.trigger("change",i,i.value,i.lastValue),i.trigger("changecomplete",i,i.value,i.lastValue)}},r=function(t){i.lastValue=i.value,i.value=Math.max(i.minValue,Math.min(i.maxValue,i.value+(t?i.step:-i.step))),i.setThumbPosition(Math.round((i.value-i.minValue)*i.delta)),i.trigger("change",i,i.value,i.lastValue)},c=function(t){i.disabled||t.keyCode!=Common.UI.Keys.UP&&t.keyCode!=Common.UI.Keys.DOWN&&t.keyCode!=Common.UI.Keys.LEFT&&t.keyCode!=Common.UI.Keys.RIGHT||(t.preventDefault(),t.stopPropagation(),h.off("keydown","input",c),n=setInterval(e.bind(r,i,t.keyCode==Common.UI.Keys.UP||t.keyCode==Common.UI.Keys.RIGHT),100))},d=function(t){i.disabled||(t.keyCode==Common.UI.Keys.UP||t.keyCode==Common.UI.Keys.DOWN||Common.UI.Keys.LEFT||Common.UI.Keys.RIGHT)&&(t.stopPropagation(),t.preventDefault(),clearInterval(n),r(t.keyCode==Common.UI.Keys.UP||t.keyCode==Common.UI.Keys.RIGHT),h.on("keydown","input",c),i.trigger("changecomplete",i,i.value,i.lastValue))};if(!i.rendered){var h=i.cmpEl;h.on("mousedown",".thumb",a),h.on("mousedown",".track",l),this.options.enableKeyEvents&&(h.on("keydown","input",c),h.on("keyup","input",d))}return i.rendered=!0,this},setThumbPosition:function(t){this.thumb.css({left:t+"%"})},setValue:function(t){this.lastValue=this.value,this.value=Math.max(this.minValue,Math.min(this.maxValue,t)),this.setThumbPosition(Math.round((t-this.minValue)*this.delta))},getValue:function(){return this.value},setDisabled:function(t){t!==this.disabled&&this.cmpEl.toggleClass("disabled",t),this.disabled=t}}),Common.UI.MultiSlider=Common.UI.BaseView.extend({options:{width:100,minValue:0,maxValue:100,values:[0,100],thumbTemplate:'
    '},disabled:!1,template:e.template(['
    ','
    ','
    ','
    ','
    ',"
    ","<% _.each(items, function(item) { %>","<%= thumbTemplate %>","<% }); %>","
    "].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t);var e=this;e.width=e.options.width,e.minValue=e.options.minValue,e.maxValue=e.options.maxValue,e.delta=100/(e.maxValue-e.minValue),e.thumbs=[],e.options.el&&e.render()},render:function(t){var i=this;i.rendered?this.cmpEl=this.$el:(this.cmpEl=$(this.template({items:this.options.values,thumbTemplate:this.options.thumbTemplate})),t?(this.setElement(t,!1),t.html(this.cmpEl)):this.$el.html(this.cmpEl));var n=this.cmpEl;n.find(".track-center").width(i.options.width-14),n.width(i.options.width);var o=function(t){t.preventDefault(),t.stopPropagation();var n=t.data.index,o=i.thumbs[n].value,s=n-1<0?0:i.thumbs[n-1].position,a=n+1a,c=Math.max(0,Math.min(100,l)),d=c/i.delta+i.minValue;if(i.isRemoveThumb){if(i.thumbs.length<3)return $(document).off("mouseup",i.binding.onMouseUp),$(document).off("mousemove",i.binding.onMouseMove),void(i._dragstart=void 0);i.trigger("removethumb",i,e.findIndex(i.thumbs,{index:n})),i.trigger("change",i,d,o),i.trigger("changecomplete",i,d,o)}else i.setThumbPosition(n,c),i.thumbs[n].value=d,r&&i.sortThumbs();$(document).off("mouseup",i.binding.onMouseUp),$(document).off("mousemove",i.binding.onMouseMove),i._dragstart=void 0,!i.isRemoveThumb&&i.trigger("changecomplete",i,d,o),i.isRemoveThumb=void 0},s=function(t){if(!i.disabled&&void 0!==i._dragstart){t.preventDefault(),t.stopPropagation();var e=t.data.index,n=i.thumbs[e].value,o=e-1<0?0:i.thumbs[e-1].position,s=e+1s,r=Math.max(0,Math.min(100,a)),c=r/i.delta+i.minValue;i.setThumbPosition(e,r),i.thumbs[e].value=c,l&&i.sortThumbs();var d=t.pageY*Common.Utils.zoom()-i.cmpEl.offset().top;i.isRemoveThumb=d>i.cmpEl.height()||d<0,i.setRemoveThumb(e,i.isRemoveThumb),Math.abs(c-n)>.001&&i.trigger("change",i,c,n)}},a=function(t){if(!i.disabled){var n=t.data.index,o=i.thumbs[n].thumb;i._dragstart=t.pageX*Common.Utils.zoom()-o.offset().left-o.width()/2,i.setActiveThumb(n),e.each(i.thumbs,function(t,e){n==e?t.thumb.css("z-index",500):t.thumb.css("z-index","")}),$(document).on("mouseup",null,t.data,i.binding.onMouseUp),$(document).on("mousemove",null,t.data,i.binding.onMouseMove)}},l=function(t){if(!(i.disabled||!e.isUndefined(i._dragstart)||i.thumbs.length>9)){var n=Math.max(0,Math.min(100,Math.round((t.pageX*Common.Utils.zoom()-i.cmpEl.offset().left)/i.width*100))),o=r(n),s=(i.thumbs[o].colorValue,i.thumbs[o].value,n/i.delta+i.minValue);i.addThumb();var a=i.thumbs.length-1;i.setThumbPosition(a,n),i.thumbs[a].value=s,i.trigger("addthumb",i,a,n),i.trigger("change",i),i.trigger("changecomplete",i)}},r=function(t){for(var e,n=100,o=0,s=i.thumbs.length,a=0;al.position)continue;o=a,n=e}return o};return this.binding={onMouseUp:e.bind(o,this),onMouseMove:e.bind(s,this),onMouseDown:e.bind(a,this)},this.$thumbs=n.find(".thumb"),e.each(this.$thumbs,function(t,e){var n=$(t);i.thumbs.push({thumb:n,index:e}),i.setValue(e,i.options.values[e]),n.on("mousedown",null,i.thumbs[e],i.binding.onMouseDown)}),i.setActiveThumb(0,!0),i.rendered||n.on("mouseup",".track",l),i.rendered=!0,this},setActiveThumb:function(t,e){this.currentThumb=t,this.$thumbs=this.cmpEl.find(".thumb"),this.$thumbs.removeClass("active"),this.thumbs[t].thumb.addClass("active"),!0!==e&&this.trigger("thumbclick",this,t)},setRemoveThumb:function(t,i){-1!==e.findIndex(this.thumbs,{index:t})&&(i&&this.thumbs.length>2?this.$el.find(".active").addClass("remove"):this.$el.find(".remove").removeClass("remove"))},setThumbPosition:function(t,e){this.thumbs[t].position=e,this.thumbs[t].thumb.css({left:e+"%"})},setValue:function(t,e){this.thumbs[t].value=Math.max(this.minValue,Math.min(this.maxValue,e)),this.setThumbPosition(t,Math.round((e-this.minValue)*this.delta))},getValue:function(t){return this.thumbs[t].value},getValues:function(){var t=[];return e.each(this.thumbs,function(e){t.push(e.value)}),t},setDisabled:function(t){t!==this.disabled&&this.cmpEl.toggleClass("disabled",t),this.disabled=t},sortThumbs:function(){this.thumbs.sort(function(t,e){return t.position-e.position});var t=[];return e.each(this.thumbs,function(e,i){t.push(e.index),e.index=i}),t},setThumbs:function(t){var e=this.thumbs.length;if(e!=t)for(var i=0;i0&&this.setValue(i,this.getValue(i-1)),e.on("mousedown",null,this.thumbs[i],this.binding.onMouseDown)},removeThumb:function(t){void 0===t&&(t=this.thumbs.length-1),t>0&&(this.thumbs[t].thumb.remove(),this.thumbs.splice(t,1))}})}),void 0===Common)var Common={};define("common/main/lib/component/MultiSliderGradient",["common/main/lib/component/Slider","underscore"],function(t,e){"use strict";Common.UI.MultiSliderGradient=Common.UI.MultiSlider.extend({options:{width:100,minValue:0,maxValue:100,values:[0,100],colorValues:["#000000","#ffffff"],currentThumb:0,thumbTemplate:'
    '},disabled:!1,template:e.template(['
    ','
    ',"<% _.each(items, function(item) { %>","<%= thumbTemplate %>","<% }); %>","
    "].join("")),initialize:function(t){this.styleStr={},Common.UI.MultiSlider.prototype.initialize.call(this,t)},render:function(t){Common.UI.MultiSlider.prototype.render.call(this,t);var i=this;i.trackEl=i.cmpEl.find(".track");for(var n=0;n div"),i.setColorValue(i.options.colorValues[n],n);i.changeSliderStyle(),i.changeGradientStyle(),i.on("change",e.bind(i.changeGradientStyle,i))},setColorValue:function(t,e){var i=void 0!==e?e:this.currentThumb;this.thumbs[i].colorValue=t,this.thumbs[i].thumbcolor.css("background-color",t),this.changeGradientStyle()},getColorValue:function(t){var e=void 0!==t?t:this.currentThumb;return this.thumbs[e].colorValue},setValue:function(t,e){Common.UI.MultiSlider.prototype.setValue.call(this,t,e),this.changeGradientStyle()},getColorValues:function(){var t=[];return e.each(this.thumbs,function(e){t.push(e.colorValue)}),t},changeGradientStyle:function(){if(this.rendered){var t;this.styleStr.specific&&(t=Common.Utils.String.format(this.styleStr.specific,this.getColorValues().concat(this.getValues())),this.trackEl.css("background",t)),Common.Utils.isIE&&(t=Common.Utils.String.format("progid:DXImageTransform.Microsoft.gradient( startColorstr={0}, endColorstr={1},GradientType=1 )",this.getColorValue(0),this.getColorValue(this.thumbs.length-1)),this.trackEl.css("filter",t)),this.styleStr.common&&(t=Common.Utils.String.format(this.styleStr.common,this.getColorValues().concat(this.getValues())),this.trackEl.css("background",t))}},sortThumbs:function(){var t=Common.UI.MultiSlider.prototype.sortThumbs.call(this);return this.trigger("sortthumbs",this,t),t},findLeftThumb:function(t){for(var e,i=this,n=100,o=0,s=this.thumbs.length,a=0;a0&&e<=n){var l=i.thumbs[a+1],r=i.thumbs[a-1];if(void 0!==r&&tl.position)continue;o=a,n=e}return o},calculationNewColor:function(t,e,i){var n=i?i/100:.5,o=1-n,s=Common.Utils.ThemeColor.getRgbColor(t),a=Common.Utils.ThemeColor.getRgbColor(e),l=[Math.round(s.get_r()*o+a.get_r()*n),Math.round(s.get_g()*o+a.get_g()*n),Math.round(s.get_b()*o+a.get_b()*n)];return Common.Utils.ThemeColor.getHexColor(l[0],l[1],l[2])},addThumb:function(){Common.UI.MultiSlider.prototype.addThumb.call(this);var t=this,e=t.thumbs.length-1;t.thumbs[e].thumb.on("dblclick",null,function(){t.trigger("thumbdblclick",t)}),t.thumbs[e].thumbcolor=t.thumbs[e].thumb.find("> div"),e>0&&this.setColorValue(this.getColorValue(e-1),e),t.changeSliderStyle()},addNewThumb:function(t,i,n){ -var o,s=this,a=this.findLeftThumb(i),t=t;if(e.isUndefined(n)){var l=100*(i-this.thumbs[a].value)/(this.thumbs[a+1].value-this.thumbs[a].value);o=l<0?this.thumbs[a].colorValue:this.calculationNewColor(this.thumbs[a].colorValue,this.thumbs[a===t-1?a:a+1].colorValue,l)}else{this.addThumb(),t=this.thumbs.length-1,o=this.calculationNewColor(this.thumbs[a].colorValue,this.thumbs[a===t-1?a:a+1].colorValue),this.setThumbPosition(t,i);var r=i/this.delta+this.minValue;this.thumbs[t].value=r}return s.thumbs[t].thumbcolor=s.thumbs[t].thumb.find("> div"),t>0&&this.setColorValue("#"+o,t),s.sortThumbs(),s.changeSliderStyle(),s.changeGradientStyle(),o},removeThumb:function(t){void 0===t&&(t=this.thumbs.length-1),this.thumbs.length>2&&(this.thumbs[t].thumb.remove(),this.thumbs.splice(t,1),this.sortThumbs(),this.changeSliderStyle())},changeSliderStyle:function(){this.styleStr={specific:"",common:"linear-gradient(to right"},Common.Utils.isChrome&&Common.Utils.chromeVersion<10||Common.Utils.isSafari&&Common.Utils.safariVersion<5.1?this.styleStr.specific="-webkit-gradient(linear, left top, right top":Common.Utils.isChrome||Common.Utils.isSafari?this.styleStr.specific="-webkit-linear-gradient(left":Common.Utils.isGecko?this.styleStr.specific="-moz-linear-gradient(left":Common.Utils.isOpera&&Common.Utils.operaVersion>11?this.styleStr.specific="-o-linear-gradient(left":Common.Utils.isIE&&(this.styleStr.specific="-ms-linear-gradient(left");for(var t=0;t=0?this.btnDirection.setIconCls("item-gradient "+this._viewDataRadial[this.GradRadialDirectionIdx].iconcls):this.btnDirection.setIconCls(""),this.numGradientAngle.setValue(0,!0),this.numGradientAngle.setDisabled(!0));if(this.api&&!this._noApply){var i=new Asc.asc_CShapeProperty,n=new Asc.asc_CShapeFill;n.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD),n.put_fill(new Asc.asc_CFillGrad),n.get_fill().put_grad_type(this.GradFillType),this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR&&(n.get_fill().put_linear_angle(6e4*this.GradLinearDirectionType),n.get_fill().put_linear_scale(!0)),i.put_fill(n),this.api.ShapeApply(i)}this.fireEvent("editcomplete",this)},onSelectGradient:function(t,e,n,o){if(!this._noApply){var s={};if(i.isFunction(o.toJSON)){if(!o.get("selected"))return;s=o.toJSON()}else s=o;if(this.btnDirection.setIconCls("item-gradient "+s.iconcls),this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR?this.GradLinearDirectionType=s.type:this.GradRadialDirectionIdx=0,this.api&&this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR){this.numGradientAngle.setValue(s.type,!0);var a=new Asc.asc_CShapeProperty,l=new Asc.asc_CShapeFill;l.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD),l.put_fill(new Asc.asc_CFillGrad),l.get_fill().put_grad_type(this.GradFillType),l.get_fill().put_linear_angle(6e4*s.type),l.get_fill().put_linear_scale(!0),a.put_fill(l),this.api.ShapeApply(a)}this.fireEvent("editcomplete",this)}},onColorsGradientSelect:function(t,e){if(this.GradColor.colors[this.GradColor.currentIdx]=e,this.sldrGradient.setColorValue(Common.Utils.String.format("#{0}","object"==typeof e?e.color:e)),this.api&&!this._noApply){var i=new Asc.asc_CShapeProperty,n=new Asc.asc_CShapeFill;n.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD),n.put_fill(new Asc.asc_CFillGrad),n.get_fill().put_grad_type(this.GradFillType);var o=[];this.GradColor.colors.forEach(function(t){o.push(Common.Utils.ThemeColor.getRgbColor(t))}),n.get_fill().put_colors(o),this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_GRAD&&(this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR&&(n.get_fill().put_linear_angle(6e4*this.GradLinearDirectionType),n.get_fill().put_linear_scale(!0)),o=[],this.GradColor.values.forEach(function(t){o.push(1e3*t)}),n.get_fill().put_positions(o)),i.put_fill(n),this.api.ShapeApply(i)}this.fireEvent("editcomplete",this)},onGradientChange:function(t,e,n){this.GradColor.values=t.getValues(),this.spnGradPosition.setValue(this.GradColor.values[this.GradColor.currentIdx],!0),this._sliderChanged=!0,this.api&&!this._noApply&&this._sendUndoPoint&&(this.api.setStartPointHistory(),this._sendUndoPoint=!1,this.updateslider=setInterval(i.bind(this._gradientApplyFunc,this),100))},onGradientChangeComplete:function(t,e,i){clearInterval(this.updateslider),this._sliderChanged=!0,this._sendUndoPoint||(this.api.setEndPointHistory(),this._gradientApplyFunc()),this._sendUndoPoint=!0},_gradientApplyFunc:function(){if(this._sliderChanged){var t=new Asc.asc_CShapeProperty,e=new Asc.asc_CShapeFill;e.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD),e.put_fill(new Asc.asc_CFillGrad),e.get_fill().put_grad_type(this.GradFillType);var i=[];this.GradColor.values.forEach(function(t){i.push(1e3*t)}),e.get_fill().put_positions(i),this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR&&(e.get_fill().put_linear_angle(6e4*this.GradLinearDirectionType),e.get_fill().put_linear_scale(!0)),i=[],this.GradColor.colors.forEach(function(t){i.push(Common.Utils.ThemeColor.getRgbColor(t))}),e.get_fill().put_colors(i),t.put_fill(e),this.api.ShapeApply(t),this._sliderChanged=!1}},applyBorderSize:function(t){if(t=Common.Utils.String.parseFloat(t),t=isNaN(t)?0:Math.max(0,Math.min(1584,t)),this.BorderSize=t,this.api&&!this._noApply){var e=new Asc.asc_CShapeProperty,i=new Asc.asc_CStroke;this.BorderSize<1e-5?(i.put_type(Asc.c_oAscStrokeType.STROKE_NONE),this._state.StrokeType=this._state.StrokeWidth=-1):(i.put_type(Asc.c_oAscStrokeType.STROKE_COLOR),"transparent"==this.BorderColor.Color||"transparent"==this.BorderColor.Color.color?i.put_color(Common.Utils.ThemeColor.getRgbColor({color:"000000",effectId:29})):this._state.StrokeType!=Asc.c_oAscStrokeType.STROKE_NONE&&null!==this._state.StrokeType||i.put_color(Common.Utils.ThemeColor.getRgbColor(Common.Utils.ThemeColor.colorValue2EffectId(this.BorderColor.Color))),i.asc_putPrstDash(this.BorderType),i.put_width(this._pt2mm(this.BorderSize))),e.put_stroke(i),this.api.ShapeApply(e)}this.fireEvent("editcomplete",this)},onComboBlur:function(){this.fireEvent("editcomplete",this)},onBorderSizeChanged:function(t,e,n,o){var s=this;if(t){var a=parseFloat(n.value);(!new RegExp("^\\s*(\\d*(\\.|,)?\\d+)\\s*("+s.txtPt+")?\\s*$").exec(n.value)||a<0||a>1584)&&(this._state.StrokeType=this._state.StrokeWidth=-1,Common.UI.error({msg:this.textBorderSizeErr,callback:function(){i.defer(function(t){s.fireEvent("editcomplete",s)})}}))}else this.applyBorderSize(n.value)},onBorderSizeSelect:function(t,e){this.applyBorderSize(e.value)},onBorderTypeSelect:function(t,e){if(this.BorderType=e.value,this.api&&!this._noApply){var i=new Asc.asc_CShapeProperty,n=new Asc.asc_CStroke;this.BorderSize<1e-5?n.put_type(Asc.c_oAscStrokeType.STROKE_NONE):(n.put_type(Asc.c_oAscStrokeType.STROKE_COLOR),n.put_color(Common.Utils.ThemeColor.getRgbColor(this.BorderColor.Color)),n.put_width(this._pt2mm(this.BorderSize)),n.asc_putPrstDash(this.BorderType)),i.put_stroke(n),this.api.ShapeApply(i)}this.fireEvent("editcomplete",this)},onColorsBorderSelect:function(t,e){if(this.BorderColor={Value:1,Color:e},this.api&&this.BorderSize>0&&!this._noApply){var i=new Asc.asc_CShapeProperty,n=new Asc.asc_CStroke;this.BorderSize<1e-5?n.put_type(Asc.c_oAscStrokeType.STROKE_NONE):(n.put_type(Asc.c_oAscStrokeType.STROKE_COLOR),n.put_color(Common.Utils.ThemeColor.getRgbColor(this.BorderColor.Color)),n.put_width(this._pt2mm(this.BorderSize)),n.asc_putPrstDash(this.BorderType)),i.put_stroke(n),this.api.ShapeApply(i)}this.fireEvent("editcomplete",this)},setImageUrl:function(t,e){if(null!==this.BlipFillType){var i=new Asc.asc_CShapeProperty,n=new Asc.asc_CShapeFill;n.put_type(Asc.c_oAscFill.FILL_TYPE_BLIP),n.put_fill(new Asc.asc_CFillBlip),n.get_fill().put_type(this.BlipFillType),n.get_fill().put_url(t,e),i.put_fill(n),this.api.ShapeApply(i)}},insertImageFromStorage:function(t){t&&t.url&&"fill"==t.c&&this.setImageUrl(t.url,t.token)},onImageSelect:function(t,e){if(1==e.value){var n=this;new Common.Views.ImageFromUrlDialog({handler:function(t,e){if("ok"==t&&n.api){var o=e.replace(/ /g,"");i.isEmpty(o)||n.setImageUrl(o)}n.fireEvent("editcomplete",n)}}).show()}else 2==e.value?Common.NotificationCenter.trigger("storage:image-load","fill"):(this.api&&this.api.ChangeShapeImageFromFile(this.BlipFillType),this.fireEvent("editcomplete",this))},openAdvancedSettings:function(t){if(!this.linkAdvanced.hasClass("disabled")){var e=this;if(e.api&&!this._locked){var i=e.api.getSelectedElements();if(i&&i.length>0)for(var n,o,s=i.length-1;s>=0;s--)if(n=i[s].get_ObjectType(),o=i[s].get_ObjectValue(),Asc.c_oAscTypeSelectElement.Shape==n){new PE.Views.ShapeSettingsAdvanced({shapeProps:o,handler:function(t,i){"ok"==t&&e.api&&e.api.ShapeApply(i.shapeProps),e.fireEvent("editcomplete",e)}}).show();break}}}},ChangeSettings:function(t){if(this._initSettings&&this.createDelayedElements(),t){this._originalProps=t,this._noApply=!0;var n=t.asc_getType();this.disableControls(1==this._locked,!0!==t.get_CanFill()),this.hideShapeOnlySettings(t.get_FromChart()||t.get_FromImage());var o=t.get_FromChart()||"line"==n||"bentConnector2"==n||"bentConnector3"==n||"bentConnector4"==n||"bentConnector5"==n||"curvedConnector2"==n||"curvedConnector3"==n||"curvedConnector4"==n||"curvedConnector5"==n||"straightConnector1"==n;this.hideChangeTypeSettings(o),this._state.isFromImage=!!t.get_FromImage(),!o&&this.btnChangeShape.menu.items.length&&(this.btnChangeShape.menu.items[0].setVisible(t.get_FromImage()),this.btnChangeShape.menu.items[1].setVisible(!t.get_FromImage()));var s=null,a=t.get_fill(),l=a.get_type(),r=null,c=a.get_transparent();if((Math.abs(this._state.Transparency-c)>.001||Math.abs(this.numTransparency.getNumberValue()-c)>.001||(null===this._state.Transparency||null===c)&&(this._state.Transparency!==c||this.numTransparency.getNumberValue()!==c))&&(void 0!==c&&(this.sldrTransparency.setValue(null===c?100:c/255*100,!0),this.numTransparency.setValue(this.sldrTransparency.getValue(),!0)),this._state.Transparency=c),null===a||null===l)this.OriginalFillType=null;else if(l==Asc.c_oAscFill.FILL_TYPE_NOFILL)this.OriginalFillType=Asc.c_oAscFill.FILL_TYPE_NOFILL;else if(l==Asc.c_oAscFill.FILL_TYPE_SOLID)a=a.get_fill(),r=a.get_color(),r?r.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?this.ShapeColor={Value:1,Color:{color:Common.Utils.ThemeColor.getHexColor(r.get_r(),r.get_g(),r.get_b()),effectValue:r.get_value()}}:this.ShapeColor={Value:1,Color:Common.Utils.ThemeColor.getHexColor(r.get_r(),r.get_g(),r.get_b())}:this.ShapeColor={Value:0,Color:"transparent"},this.OriginalFillType=Asc.c_oAscFill.FILL_TYPE_SOLID,this.FGColor="transparent"!==this.ShapeColor.Color?{Value:1,Color:Common.Utils.ThemeColor.colorValue2EffectId(this.ShapeColor.Color)}:{Value:1,Color:"000000"},this.BGColor={Value:1,Color:"ffffff"},this.GradColor.colors[0]="transparent"!==this.ShapeColor.Color?Common.Utils.ThemeColor.colorValue2EffectId(this.ShapeColor.Color):"000000",this.GradColor.colors[this.GradColor.colors.length-1]="ffffff";else if(l==Asc.c_oAscFill.FILL_TYPE_BLIP)a=a.get_fill(),this.BlipFillType=a.get_type(),this._state.BlipFillType!==this.BlipFillType&&(this.BlipFillType==Asc.c_oAscFillBlipType.STRETCH||this.BlipFillType==Asc.c_oAscFillBlipType.TILE?this.cmbFillType.setValue(this.BlipFillType):this.cmbFillType.setValue(""),this._state.BlipFillType=this.BlipFillType),this.OriginalFillType=Asc.c_oAscFill.FILL_TYPE_BLIP;else if(l==Asc.c_oAscFill.FILL_TYPE_PATT){if(a=a.get_fill(),this.PatternFillType=a.get_pattern_type(),this._state.PatternFillType!==this.PatternFillType){this.cmbPattern.suspendEvents();var s=this.cmbPattern.menuPicker.store.findWhere({type:this.PatternFillType});this.cmbPattern.menuPicker.selectRecord(s),this.cmbPattern.resumeEvents(),this._state.PatternFillType=this.PatternFillType}r=a.get_color_fg(),r?r.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?this.FGColor={Value:1,Color:{color:Common.Utils.ThemeColor.getHexColor(r.get_r(),r.get_g(),r.get_b()),effectValue:r.get_value()}}:this.FGColor={Value:1,Color:Common.Utils.ThemeColor.getHexColor(r.get_r(),r.get_g(),r.get_b())}:this.FGColor={Value:1,Color:"000000"},r=a.get_color_bg(),r?r.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?this.BGColor={Value:1,Color:{color:Common.Utils.ThemeColor.getHexColor(r.get_r(),r.get_g(),r.get_b()),effectValue:r.get_value()}}:this.BGColor={Value:1,Color:Common.Utils.ThemeColor.getHexColor(r.get_r(),r.get_g(),r.get_b())}:this.BGColor={Value:1,Color:"ffffff"},this.OriginalFillType=Asc.c_oAscFill.FILL_TYPE_PATT,this.ShapeColor={Value:1,Color:Common.Utils.ThemeColor.colorValue2EffectId(this.FGColor.Color)},this.GradColor.colors[0]=Common.Utils.ThemeColor.colorValue2EffectId(this.FGColor.Color),this.GradColor.colors[this.GradColor.colors.length-1]="ffffff"}else if(l==Asc.c_oAscFill.FILL_TYPE_GRAD){a=a.get_fill();var d=a.get_grad_type();if(this._state.GradFillType===d&&this.GradFillType===d||(this.GradFillType=d,s=void 0,this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR||this.GradFillType==Asc.c_oAscFillGradType.GRAD_PATH?(this.cmbGradType.setValue(this.GradFillType),s=this.cmbGradType.store.findWhere({value:this.GradFillType}),this.onGradTypeSelect(this.cmbGradType,s.attributes)):(this.cmbGradType.setValue(""),this.btnDirection.setIconCls("")),this._state.GradFillType=this.GradFillType),this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR){var h=Math.floor(a.get_linear_angle()/6e4);if(Math.abs(this.GradLinearDirectionType-h)>.001){this.GradLinearDirectionType=h;var p=this.mnuDirectionPicker.store.findWhere({type:h});this.mnuDirectionPicker.selectRecord(p,!0),p?this.btnDirection.setIconCls("item-gradient "+p.get("iconcls")):this.btnDirection.setIconCls(""),this.numGradientAngle.setValue(h,!0)}}else this.numGradientAngle.setValue(0,!0);var u=this,m=a.get_colors(),g=a.get_positions(),f=m?m.length:this.GradColor.colors.length;this.sldrGradient.setThumbs(f),this.GradColor.colors.length>f&&(this.GradColor.colors.splice(f,this.GradColor.colors.length-f),this.GradColor.values.splice(f,this.GradColor.colors.length-f),this.GradColor.currentIdx=0),m&&m.forEach(function(t,e){t?t.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?(u.GradColor.colors[e]={color:Common.Utils.ThemeColor.getHexColor(t.get_r(),t.get_g(),t.get_b()),effectValue:t.get_value()},Common.Utils.ThemeColor.colorValue2EffectId(u.GradColor.colors[e])):u.GradColor.colors[e]=Common.Utils.ThemeColor.getHexColor(t.get_r(),t.get_g(),t.get_b()):u.GradColor.colors[e]="000000";var i=g[e];null!==i&&(i/=1e3,u.GradColor.values[e]=i)});for(var b=0;b=this.GradColor.colors.length)&&(u.GradColor.currentIdx=0),this.sldrGradient.setActiveThumb(u.GradColor.currentIdx),this.spnGradPosition.setValue(this.GradColor.values[this.GradColor.currentIdx]),this.OriginalFillType=Asc.c_oAscFill.FILL_TYPE_GRAD,this.FGColor={Value:1,Color:this.GradColor.colors[0]},this.BGColor={Value:1,Color:"ffffff"},this.ShapeColor={Value:1,Color:this.GradColor.colors[0]}}this._state.FillType!==this.OriginalFillType&&(this.cmbFillSrc.setValue(null===this.OriginalFillType?"":this.OriginalFillType),this._state.FillType=this.OriginalFillType,this.ShowHideElem(this.OriginalFillType)),e(this.btnTexture.el).find(".form-control").prop("innerHTML",this.textSelectTexture);var C=typeof this.ShapeColor.Color,v=typeof this._state.ShapeColor;if(C!==v||"object"==C&&(this.ShapeColor.Color.effectValue!==this._state.ShapeColor.effectValue||this._state.ShapeColor.color.indexOf(this.ShapeColor.Color.color)<0)||"object"!=C&&this._state.ShapeColor.indexOf(this.ShapeColor.Color)<0){if(this.btnBackColor.setColor(this.ShapeColor.Color),"object"==typeof this.ShapeColor.Color){for(var _=!1,y=0;y<10;y++)if(Common.Utils.ThemeColor.ThemeValues[y]==this.ShapeColor.Color.effectValue){this.colorsBack.select(this.ShapeColor.Color,!0),_=!0;break}_||this.colorsBack.clearSelection()}else this.colorsBack.select(this.ShapeColor.Color,!0);this._state.ShapeColor=this.ShapeColor.Color}var w,x=t.get_stroke(),S=x.get_type(),A="transparent"==this._state.StrokeColor&&"transparent"!==this.BorderColor.Color;if(x?(S==Asc.c_oAscStrokeType.STROKE_COLOR?(r=x.get_color(),r?r.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?this.BorderColor={Value:1,Color:{color:Common.Utils.ThemeColor.getHexColor(r.get_r(),r.get_g(),r.get_b()),effectValue:r.get_value()}}:this.BorderColor={Value:1,Color:Common.Utils.ThemeColor.getHexColor(r.get_r(),r.get_g(),r.get_b())}:this.BorderColor={Value:1,Color:"transparent"}):this.BorderColor={Value:1,Color:"transparent"},w=x.asc_getPrstDash()):(S=null,this.BorderColor={Value:0,Color:"transparent"}),C=typeof this.BorderColor.Color,v=typeof this._state.StrokeColor,A||C!==v||"object"==C&&(this.BorderColor.Color.effectValue!==this._state.StrokeColor.effectValue||this._state.StrokeColor.color.indexOf(this.BorderColor.Color.color)<0)||"object"!=C&&(this._state.StrokeColor.indexOf(this.BorderColor.Color)<0||"object"==typeof this.btnBorderColor.color)){if(this.btnBorderColor.setColor(this.BorderColor.Color),"object"==typeof this.BorderColor.Color){for(var _=!1,y=0;y<10;y++)if(Common.Utils.ThemeColor.ThemeValues[y]==this.BorderColor.Color.effectValue){this.colorsBorder.select(this.BorderColor.Color,!0),_=!0;break}_||this.colorsBorder.clearSelection()}else this.colorsBorder.select(this.BorderColor.Color,!0);this._state.StrokeColor=this.BorderColor.Color}if(this._state.StrokeType!==S||S==Asc.c_oAscStrokeType.STROKE_COLOR){if(S==Asc.c_oAscStrokeType.STROKE_COLOR){var T=x.get_width(),k=Math.abs(this._state.StrokeWidth-T)<1e-5&&!new RegExp(this.txtPt+"\\s*$").test(this.cmbBorderSize.getRawValue());if(Math.abs(this._state.StrokeWidth-T)>1e-5||k||(null===this._state.StrokeWidth||null===T)&&this._state.StrokeWidth!==T){this._state.StrokeWidth=T,null!==T&&(T=this._mm2pt(T));var I=null===T?T:i.find(this.cmbBorderSize.store.models,function(t){if(Tt.attributes.value-1e-5)return!0});I?this.cmbBorderSize.selectRecord(I):this.cmbBorderSize.setValue(null!==T?parseFloat(T.toFixed(2))+" "+this.txtPt:""),this.BorderSize=T}}else S==Asc.c_oAscStrokeType.STROKE_NONE?(this._state.StrokeWidth=0,this.BorderSize=this.cmbBorderSize.store.at(0).get("value"),this.cmbBorderSize.setValue(this.BorderSize)):(this._state.StrokeWidth=null,this.BorderSize=-1,this.cmbBorderSize.setValue(null));this._state.StrokeType=S}if(this._state.StrokeBorderType!==w&&(this.BorderType=this._state.StrokeBorderType=w,this.cmbBorderType.setValue(w)),C=typeof this.FGColor.Color,v=typeof this._state.FGColor,C!==v||"object"==C&&(this.FGColor.Color.effectValue!==this._state.FGColor.effectValue||this._state.FGColor.color.indexOf(this.FGColor.Color.color)<0)||"object"!=C&&this._state.FGColor.indexOf(this.FGColor.Color)<0){if(this.btnFGColor.setColor(this.FGColor.Color),"object"==typeof this.FGColor.Color){for(var _=!1,y=0;y<10;y++)if(Common.Utils.ThemeColor.ThemeValues[y]==this.FGColor.Color.effectValue){this.colorsFG.select(this.FGColor.Color,!0),_=!0;break}_||this.colorsFG.clearSelection()}else this.colorsFG.select(this.FGColor.Color,!0);this._state.FGColor=this.FGColor.Color}if(C=typeof this.BGColor.Color,v=typeof this._state.BGColor,C!==v||"object"==C&&(this.BGColor.Color.effectValue!==this._state.BGColor.effectValue||this._state.BGColor.color.indexOf(this.BGColor.Color.color)<0)||"object"!=C&&this._state.BGColor.indexOf(this.BGColor.Color)<0){if(this.btnBGColor.setColor(this.BGColor.Color),"object"==typeof this.BGColor.Color){for(var _=!1,y=0;y<10;y++)if(Common.Utils.ThemeColor.ThemeValues[y]==this.BGColor.Color.effectValue){this.colorsBG.select(this.BGColor.Color,!0),_=!0;break}_||this.colorsBG.clearSelection()}else this.colorsBG.select(this.BGColor.Color,!0);this._state.BGColor=this.BGColor.Color}if(r=this.GradColor.colors[this.GradColor.currentIdx],C=typeof r,v=typeof this._state.GradColor,C!==v||"object"==C&&(r.effectValue!==this._state.GradColor.effectValue||this._state.GradColor.color.indexOf(r.color)<0)||"object"!=C&&this._state.GradColor.indexOf(r)<0){if(this.btnGradColor.setColor(r),"object"==typeof r){for(var _=!1,y=0;y<10;y++)if(Common.Utils.ThemeColor.ThemeValues[y]==r.effectValue){this.colorsGrad.select(r,!0),_=!0;break}_||this.colorsGrad.clearSelection()}else this.colorsGrad.select(r,!0);this._state.GradColor=r}this.chShadow.setValue(!!t.asc_getShadow(),!0),this._noApply=!1}},createDelayedControls:function(){var t=this;this._arrFillSrc=[{displayValue:this.textColor,value:Asc.c_oAscFill.FILL_TYPE_SOLID},{displayValue:this.textGradientFill,value:Asc.c_oAscFill.FILL_TYPE_GRAD},{displayValue:this.textImageTexture,value:Asc.c_oAscFill.FILL_TYPE_BLIP},{displayValue:this.textPatternFill,value:Asc.c_oAscFill.FILL_TYPE_PATT},{displayValue:this.textNoFill,value:Asc.c_oAscFill.FILL_TYPE_NOFILL}],this.cmbFillSrc=new Common.UI.ComboBox({el:e("#shape-combo-fill-src"),cls:"input-group-nr",style:"width: 100%;",menuStyle:"min-width: 100%;",editable:!1,data:this._arrFillSrc}),this.cmbFillSrc.setValue(this._arrFillSrc[0].value),this.cmbFillSrc.on("selected",i.bind(this.onFillSrcSelect,this)),this.fillControls.push(this.cmbFillSrc),this.cmbPattern=new Common.UI.ComboDataView({itemWidth:28,itemHeight:28,menuMaxHeight:300,enableKeyEvents:!0,cls:"combo-pattern"}), -this.cmbPattern.menuPicker.itemTemplate=this.cmbPattern.fieldPicker.itemTemplate=i.template(['
    ','',"
    "].join("")),this.cmbPattern.render(e("#shape-combo-pattern")),this.cmbPattern.openButton.menu.cmpEl.css({"min-width":178,"max-width":178}),this.cmbPattern.on("click",i.bind(this.onPatternSelect,this)),this.cmbPattern.openButton.menu.on("show:after",function(){t.cmbPattern.menuPicker.scroller.update({alwaysVisibleY:!0})}),this.fillControls.push(this.cmbPattern),this.btnSelectImage=new Common.UI.Button({parentEl:e("#shape-button-replace"),cls:"btn-text-menu-default",caption:this.textSelectImage,style:"width:100%;",menu:new Common.UI.Menu({style:"min-width: 194px;",maxHeight:200,items:[{caption:this.textFromFile,value:0},{caption:this.textFromUrl,value:1},{caption:this.textFromStorage,value:2}]})}),this.fillControls.push(this.btnSelectImage),this.btnSelectImage.menu.on("item:click",i.bind(this.onImageSelect,this)),this.btnSelectImage.menu.items[2].setVisible(this.mode.canRequestInsertImage||this.mode.fileChoiceUrl&&this.mode.fileChoiceUrl.indexOf("{documentType}")>-1),this._arrFillType=[{displayValue:this.textStretch,value:Asc.c_oAscFillBlipType.STRETCH},{displayValue:this.textTile,value:Asc.c_oAscFillBlipType.TILE}],this.cmbFillType=new Common.UI.ComboBox({el:e("#shape-combo-fill-type"),cls:"input-group-nr",menuStyle:"min-width: 90px;",editable:!1,data:this._arrFillType}),this.cmbFillType.setValue(this._arrFillType[0].value),this.cmbFillType.on("selected",i.bind(this.onFillTypeSelect,this)),this.fillControls.push(this.cmbFillType),this.numTransparency=new Common.UI.MetricSpinner({el:e("#shape-spin-transparency"),step:1,width:62,value:"100 %",defaultUnit:"%",maxValue:100,minValue:0}),this.numTransparency.on("change",i.bind(this.onNumTransparencyChange,this)),this.numTransparency.on("inputleave",function(){t.fireEvent("editcomplete",t)}),this.fillControls.push(this.numTransparency),this.sldrTransparency=new Common.UI.SingleSlider({el:e("#shape-slider-transparency"),width:75,minValue:0,maxValue:100,value:100}),this.sldrTransparency.on("change",i.bind(this.onTransparencyChange,this)),this.sldrTransparency.on("changecomplete",i.bind(this.onTransparencyChangeComplete,this)),this.fillControls.push(this.sldrTransparency),this.lblTransparencyStart=e(this.el).find("#shape-lbl-transparency-start"),this.lblTransparencyEnd=e(this.el).find("#shape-lbl-transparency-end"),this._arrGradType=[{displayValue:this.textLinear,value:Asc.c_oAscFillGradType.GRAD_LINEAR},{displayValue:this.textRadial,value:Asc.c_oAscFillGradType.GRAD_PATH}],this.cmbGradType=new Common.UI.ComboBox({el:e("#shape-combo-grad-type"),cls:"input-group-nr",menuStyle:"min-width: 90px;",editable:!1,data:this._arrGradType}),this.cmbGradType.setValue(this._arrGradType[0].value),this.cmbGradType.on("selected",i.bind(this.onGradTypeSelect,this)),this.fillControls.push(this.cmbGradType),this._viewDataLinear=[{offsetx:0,offsety:0,type:45,subtype:-1,iconcls:"gradient-left-top"},{offsetx:50,offsety:0,type:90,subtype:4,iconcls:"gradient-top"},{offsetx:100,offsety:0,type:135,subtype:5,iconcls:"gradient-right-top"},{offsetx:0,offsety:50,type:0,subtype:6,iconcls:"gradient-left",cls:"item-gradient-separator",selected:!0},{offsetx:100,offsety:50,type:180,subtype:1,iconcls:"gradient-right"},{offsetx:0,offsety:100,type:315,subtype:2,iconcls:"gradient-left-bottom"},{offsetx:50,offsety:100,type:270,subtype:3,iconcls:"gradient-bottom"},{offsetx:100,offsety:100,type:225,subtype:7,iconcls:"gradient-right-bottom"}],this._viewDataRadial=[{offsetx:100,offsety:150,type:2,subtype:5,iconcls:"gradient-radial-center"}],this.btnDirection=new Common.UI.Button({cls:"btn-large-dataview",iconCls:"item-gradient gradient-left",menu:new Common.UI.Menu({style:"min-width: 60px;",menuAlign:"tr-br",items:[{template:i.template('
    ')}]})}),this.btnDirection.on("render:after",function(n){t.mnuDirectionPicker=new Common.UI.DataView({el:e("#id-shape-menu-direction"),parentMenu:n.menu,restoreHeight:174,store:new Common.UI.DataViewStore(t._viewDataLinear),itemTemplate:i.template('
    ')})}),this.btnDirection.render(e("#shape-button-direction")),this.mnuDirectionPicker.on("item:click",i.bind(this.onSelectGradient,this,this.btnDirection)),this.fillControls.push(this.btnDirection),this.sldrGradient=new Common.UI.MultiSliderGradient({el:e("#shape-slider-gradient"),width:192,minValue:0,maxValue:100,values:[0,100]}),this.sldrGradient.on("change",i.bind(this.onGradientChange,this)),this.sldrGradient.on("changecomplete",i.bind(this.onGradientChangeComplete,this)),this.sldrGradient.on("thumbclick",function(e,i){t.GradColor.currentIdx=i;var n=t.GradColor.colors[t.GradColor.currentIdx];t.btnGradColor.setColor(n),t.colorsGrad.select(n,!1);var o=t.GradColor.values[t.GradColor.currentIdx];t.spnGradPosition.setValue(o,!0)}),this.sldrGradient.on("thumbdblclick",function(e){t.btnGradColor.cmpEl.find("button").dropdown("toggle")}),this.sldrGradient.on("sortthumbs",function(e,n){var o,s=[];i.each(n,function(e,i){s.push(t.GradColor.colors[e]),t.GradColor.currentIdx==e&&(o=i)}),t.OriginalFillType=null,t.GradColor.colors=s,t.GradColor.currentIdx=o}),this.sldrGradient.on("addthumb",function(e,i,n){t.GradColor.colors[i]=t.GradColor.colors[t.GradColor.currentIdx],t.GradColor.currentIdx=i;var o=t.sldrGradient.addNewThumb(i,n);t.GradColor.colors[t.GradColor.currentIdx]=o}),this.sldrGradient.on("removethumb",function(e,n){if(t.sldrGradient.removeThumb(n),t.GradColor.values.splice(n,1),t.sldrGradient.changeGradientStyle(),i.isUndefined(t.GradColor.currentIdx)||t.GradColor.currentIdx>=t.GradColor.colors.length){var o=n>0?n-1:n;o=0===o&&t.GradColor.values.length>2?t.GradColor.values.length-2:o,t.GradColor.currentIdx=o}t.sldrGradient.setActiveThumb(t.GradColor.currentIdx)}),this.fillControls.push(this.sldrGradient),this.spnGradPosition=new Common.UI.MetricSpinner({el:e("#shape-gradient-position"),step:1,width:60,defaultUnit:"%",value:"50 %",allowDecimal:!1,maxValue:100,minValue:0,disabled:this._locked}),this.fillControls.push(this.spnGradPosition),this.spnGradPosition.on("change",i.bind(this.onPositionChange,this)),this.spnGradPosition.on("inputleave",function(){t.fireEvent("editcomplete",t)}),this.btnAddGradientStep=new Common.UI.Button({parentEl:e("#shape-gradient-add-step"),cls:"btn-toolbar",iconCls:"toolbar__icon btn-add-breakpoint",disabled:this._locked,hint:this.tipAddGradientPoint}),this.btnAddGradientStep.on("click",i.bind(this.onAddGradientStep,this)),this.fillControls.push(this.btnAddGradientStep),this.btnRemoveGradientStep=new Common.UI.Button({parentEl:e("#shape-gradient-remove-step"),cls:"btn-toolbar",iconCls:"toolbar__icon btn-remove-breakpoint",disabled:this._locked,hint:this.tipRemoveGradientPoint}),this.btnRemoveGradientStep.on("click",i.bind(this.onRemoveGradientStep,this)),this.fillControls.push(this.btnRemoveGradientStep),this.numGradientAngle=new Common.UI.MetricSpinner({el:e("#shape-spin-gradient-angle"),step:10,width:60,defaultUnit:"°",value:"0 °",allowDecimal:!0,maxValue:359.9,minValue:0,disabled:this._locked}),this.fillControls.push(this.numGradientAngle),this.numGradientAngle.on("change",i.bind(this.onGradientAngleChange,this)),this.numGradientAngle.on("inputleave",function(){t.fireEvent("editcomplete",t)}),this.cmbBorderSize=new Common.UI.ComboBorderSizeEditable({el:e("#shape-combo-border-size"),style:"width: 93px;",txtNoBorders:this.txtNoBorders}).on("selected",i.bind(this.onBorderSizeSelect,this)).on("changed:before",i.bind(this.onBorderSizeChanged,this,!0)).on("changed:after",i.bind(this.onBorderSizeChanged,this,!1)).on("combo:blur",i.bind(this.onComboBlur,this,!1)),this.BorderSize=this.cmbBorderSize.store.at(2).get("value"),this.cmbBorderSize.setValue(this.BorderSize),this.lockedControls.push(this.cmbBorderSize),this.cmbBorderType=new Common.UI.ComboBorderType({el:e("#shape-combo-border-type"),style:"width: 93px;",menuStyle:"min-width: 93px;"}).on("selected",i.bind(this.onBorderTypeSelect,this)).on("combo:blur",i.bind(this.onComboBlur,this,!1)),this.BorderType=Asc.c_oDashType.solid,this.cmbBorderType.setValue(this.BorderType),this.lockedControls.push(this.cmbBorderType),this.btnChangeShape=new Common.UI.Button({parentEl:e("#shape-btn-change"),cls:"btn-icon-default",iconCls:"btn-change-shape",menu:new Common.UI.Menu({menuAlign:"tr-br",cls:"menu-shapes",items:[]})}),this.lockedControls.push(this.btnChangeShape),this.btnRotate270=new Common.UI.Button({parentEl:e("#shape-button-270",t.$el),cls:"btn-toolbar",iconCls:"toolbar__icon btn-rotate-270",value:0,hint:this.textHint270}),this.btnRotate270.on("click",i.bind(this.onBtnRotateClick,this)),this.lockedControls.push(this.btnRotate270),this.btnRotate90=new Common.UI.Button({parentEl:e("#shape-button-90",t.$el),cls:"btn-toolbar",iconCls:"toolbar__icon btn-rotate-90",value:1,hint:this.textHint90}),this.btnRotate90.on("click",i.bind(this.onBtnRotateClick,this)),this.lockedControls.push(this.btnRotate90),this.btnFlipV=new Common.UI.Button({parentEl:e("#shape-button-flipv",t.$el),cls:"btn-toolbar",iconCls:"toolbar__icon btn-flip-vert",value:0,hint:this.textHintFlipV}),this.btnFlipV.on("click",i.bind(this.onBtnFlipClick,this)),this.lockedControls.push(this.btnFlipV),this.btnFlipH=new Common.UI.Button({parentEl:e("#shape-button-fliph",t.$el),cls:"btn-toolbar",iconCls:"toolbar__icon btn-flip-hor",value:1,hint:this.textHintFlipH}),this.btnFlipH.on("click",i.bind(this.onBtnFlipClick,this)),this.lockedControls.push(this.btnFlipH),this.chShadow=new Common.UI.CheckBox({el:e("#shape-checkbox-shadow"),labelText:this.strShadow}),this.chShadow.on("change",i.bind(this.onCheckShadow,this)),this.lockedControls.push(this.chShadow),this.linkAdvanced=e("#shape-advanced-link"),e(this.el).on("click","#shape-advanced-link",i.bind(this.openAdvancedSettings,this))},createDelayedElements:function(){this._initSettings=!1,this.createDelayedControls();var t=[0,1,3,2,4,53,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,22,23,24,25,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,49,50,51,52];this.patternViewData=[];for(var e=0;e<13;e++)for(var i=0;i<4;i++){var n=4*e+i;this.patternViewData[n]={offsetx:28*i,offsety:28*e,type:t[n]}}this.patternViewData.splice(this.patternViewData.length-2,2);for(var e=0;e0&&(this.cmbPattern.fillComboView(this.cmbPattern.menuPicker.store.at(0),!0),this.PatternFillType=this.patternViewData[0].type),this.onInitStandartTextures(),this.onApiAutoShapes(),this.UpdateThemeColors()},onInitStandartTextures:function(t){var n=this;if(t&&t.length>0&&(n._texturearray=[],i.each(t,function(t){n._texturearray.push({imageUrl:t.get_image(),name:n.textureNames[t.get_id()],type:t.get_id(),selected:!1})})),n._texturearray&&!(n._texturearray.length<1)&&!this._initSettings&&!this.btnTexture){this.btnTexture=new Common.UI.ComboBox({el:e("#shape-combo-fill-texture"),template:i.template(['"].join(""))}),this.textureMenu=new Common.UI.Menu({items:[{template:i.template('
    ')}]}),this.textureMenu.render(e("#shape-combo-fill-texture")),this.fillControls.push(this.btnTexture);var o=function(t){new Common.UI.DataView({el:e("#id-shape-menu-texture"),restoreHeight:174,parentMenu:t,showLast:!1,store:new Common.UI.DataViewStore(n._texturearray||[]),itemTemplate:i.template('
    ')}).on("item:click",i.bind(n.onSelectTexture,n)),t.off("show:before",o)};this.textureMenu.on("show:before",o)}},onSelectTexture:function(t,i,n){if(this._fromTextureCmb=!0,this.cmbFillType.setValue(this._arrFillType[1].value),this._fromTextureCmb=!1,this.api){var o=new Asc.asc_CShapeProperty,s=new Asc.asc_CShapeFill;s.put_type(Asc.c_oAscFill.FILL_TYPE_BLIP),s.put_fill(new Asc.asc_CFillBlip),s.get_fill().put_type(Asc.c_oAscFillBlipType.TILE),s.get_fill().put_texture_id(n.get("type")),o.put_fill(s),this.api.ShapeApply(o)}e(this.btnTexture.el).find(".form-control").prop("innerHTML",n.get("name")),this.fireEvent("editcomplete",this)},onCheckShadow:function(t,e,i,n){if(this.api){var o=new Asc.asc_CShapeProperty;o.asc_putShadow("checked"==t.getValue()?new Asc.asc_CShadowProperty:null),this.api.ShapeApply(o)}this.fireEvent("editcomplete",this)},onApiAutoShapes:function(){var t=this,e=function(i){t.fillAutoShapes(),i.off("show:before",e)};t.btnChangeShape.menu.on("show:before",e)},fillAutoShapes:function(){var t=this,n=this.application.getCollection("ShapeGroups"),o=n.length,s=function(a){for(var l=-1;l0;l++){var r=n.at(l>-1?l:0).get("groupStore");l<0&&(r=r.clone(),r.shift());new Common.UI.DataViewSimple({el:e("#id-shape-menu-shapegroup"+(l+1),a.items[l+1].$el),store:r,parentMenu:a.items[l+1].menu,itemTemplate:i.template('
    ')}).on("item:click",function(e,i,n,o){t.api&&(t.api.ChangeShapeType(n.get("data").shapeType),t.fireEvent("editcomplete",t)),"click"!==o.type&&t.btnChangeShape.menu.hide()})}a.off("show:after",s)};t.btnChangeShape.menu.on("show:after",s);for(var a=-1;a0;a++){var l=n.at(a>-1?a:a+1),r=new Common.UI.MenuItem({caption:l.get("groupName"),menu:new Common.UI.Menu({menuAlign:"tr-tl",items:[{template:i.template('')}]})});t.btnChangeShape.menu.addItem(r)}t.btnChangeShape.menu.items[0].setVisible(t._state.isFromImage),t.btnChangeShape.menu.items[1].setVisible(!t._state.isFromImage)},UpdateThemeColors:function(){this._initSettings||(this.btnBackColor||(this.btnBackColor=new Common.UI.ColorButton({parentEl:e("#shape-back-color-btn"),transparent:!0,color:"transparent"}),this.fillControls.push(this.btnBackColor),this.colorsBack=this.btnBackColor.getPicker(),this.btnBackColor.on("color:select",i.bind(this.onColorsBackSelect,this)),this.btnFGColor=new Common.UI.ColorButton({parentEl:e("#shape-foreground-color-btn"),color:"000000"}),this.fillControls.push(this.btnFGColor),this.colorsFG=this.btnFGColor.getPicker(),this.btnFGColor.on("color:select",i.bind(this.onColorsFGSelect,this)),this.btnBGColor=new Common.UI.ColorButton({parentEl:e("#shape-background-color-btn"),color:"ffffff"}),this.fillControls.push(this.btnBGColor),this.colorsBG=this.btnBGColor.getPicker(),this.btnBGColor.on("color:select",i.bind(this.onColorsBGSelect,this)),this.btnGradColor=new Common.UI.ColorButton({parentEl:e("#shape-gradient-color-btn"),color:"000000"}),this.fillControls.push(this.btnGradColor),this.colorsGrad=this.btnGradColor.getPicker(),this.btnGradColor.on("color:select",i.bind(this.onColorsGradientSelect,this)),this.btnBorderColor=new Common.UI.ColorButton({parentEl:e("#shape-border-color-btn"),color:"000000"}),this.lockedControls.push(this.btnBorderColor),this.colorsBorder=this.btnBorderColor.getPicker(),this.btnBorderColor.on("color:select",i.bind(this.onColorsBorderSelect,this))),this.colorsBorder.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors()),this.colorsBack.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors()),this.colorsFG.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors()),this.colorsBG.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors()),this.colorsGrad.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors()))},onBtnRotateClick:function(t){var e=new Asc.asc_CShapeProperty;e.asc_putRotAdd(3.14159265358979*(1==t.options.value?90:270)/180),this.api.ShapeApply(e),this.fireEvent("editcomplete",this)},onBtnFlipClick:function(t){var e=new Asc.asc_CShapeProperty;1==t.options.value?e.asc_putFlipHInvert(!0):e.asc_putFlipVInvert(!0),this.api.ShapeApply(e),this.fireEvent("editcomplete",this)},_pt2mm:function(t){return 25.4*t/72},_mm2pt:function(t){return 72*t/25.4},disableFillPanels:function(t){this._state.DisabledFillPanels!==t&&(this._state.DisabledFillPanels=t,i.each(this.fillControls,function(e){e.setDisabled(t)}),this.lblTransparencyStart.toggleClass("disabled",t),this.lblTransparencyEnd.toggleClass("disabled",t),this.numGradientAngle.setDisabled(t||this.GradFillType!==Asc.c_oAscFillGradType.GRAD_LINEAR))},ShowHideElem:function(t){this.FillColorContainer.toggleClass("settings-hidden",t!==Asc.c_oAscFill.FILL_TYPE_SOLID),this.FillImageContainer.toggleClass("settings-hidden",t!==Asc.c_oAscFill.FILL_TYPE_BLIP),this.FillPatternContainer.toggleClass("settings-hidden",t!==Asc.c_oAscFill.FILL_TYPE_PATT),this.FillGradientContainer.toggleClass("settings-hidden",t!==Asc.c_oAscFill.FILL_TYPE_GRAD),this.TransparencyContainer.toggleClass("settings-hidden",t===Asc.c_oAscFill.FILL_TYPE_NOFILL||null===t)},setLocked:function(t){this._locked=t},disableControls:function(t,e){this._initSettings||(this.disableFillPanels(t||e),this._state.DisabledControls!==t&&(this._state.DisabledControls=t,i.each(this.lockedControls,function(e){e.setDisabled(t)}),this.linkAdvanced.toggleClass("disabled",t)))},hideShapeOnlySettings:function(t){this._state.HideShapeOnlySettings!==t&&(this._state.HideShapeOnlySettings=t,this.ShapeOnlySettings.toggleClass("hidden",1==t))},hideChangeTypeSettings:function(t){this._state.HideChangeTypeSettings!==t&&(this._state.HideChangeTypeSettings=t,this.CanChangeType.toggleClass("hidden",1==t))},onPositionChange:function(t){var e=t.getNumberValue(),i=this.GradColor.currentIdx-1<0?0:this.GradColor.values[this.GradColor.currentIdx-1],n=this.GradColor.currentIdx+1n;if(this.api){this.GradColor.values[this.GradColor.currentIdx]=e;var s=new Asc.asc_CShapeProperty,a=new Asc.asc_CShapeFill;a.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD),a.put_fill(new Asc.asc_CFillGrad),a.get_fill().put_grad_type(this.GradFillType);var l=[];this.GradColor.values.forEach(function(t){l.push(1e3*t)}),a.get_fill().put_positions(l),s.put_fill(a),this.api.ShapeApply(s),o&&(this.sldrGradient.sortThumbs(),this.sldrGradient.trigger("change",this.sldrGradient),this.sldrGradient.trigger("changecomplete",this.sldrGradient))}},onAddGradientStep:function(){if(!(this.GradColor.colors.length>9)){var t=this.GradColor.currentIdx,e=(this.GradColor.values[t]+this.GradColor.values[t=this.GradColor.colors.length){var e=t>0?t-1:t;e=0===e&&this.GradColor.values.length>2?this.GradColor.values.length-2:e,this.GradColor.currentIdx=e}this.sldrGradient.setActiveThumb(this.GradColor.currentIdx),this.sldrGradient.trigger("change",this.sldrGradient),this.sldrGradient.trigger("changecomplete",this.sldrGradient)}},onGradientAngleChange:function(t,e,i,n){if(this.api&&!this._noApply){var o=new Asc.asc_CShapeProperty,s=new Asc.asc_CShapeFill;s.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD),s.put_fill(new Asc.asc_CFillGrad),s.get_fill().put_grad_type(this.GradFillType),s.get_fill().put_linear_angle(6e4*t.getNumberValue()),s.get_fill().put_linear_scale(!0),o.put_fill(s),this.api.ShapeApply(o)}},txtNoBorders:"No Line",strStroke:"Stroke",strColor:"Color",strSize:"Size",strChange:"Change Autoshape",strFill:"Fill",textColor:"Color Fill",textImageTexture:"Picture or Texture",textTexture:"From Texture",textFromUrl:"From URL",textFromFile:"From File",textStretch:"Stretch",textTile:"Tile",txtCanvas:"Canvas",txtCarton:"Carton",txtDarkFabric:"Dark Fabric",txtGrain:"Grain",txtGranite:"Granite",txtGreyPaper:"Grey Paper",txtKnit:"Knit",txtLeather:"Leather",txtBrownPaper:"Brown Paper",txtPapyrus:"Papyrus",txtWood:"Wood",textAdvanced:"Show advanced settings",strTransparency:"Opacity",textNoFill:"No Fill",textSelectTexture:"Select",textGradientFill:"Gradient Fill",textPatternFill:"Pattern",strBackground:"Background color",strForeground:"Foreground color",strPattern:"Pattern",textEmptyPattern:"No Pattern",textLinear:"Linear",textRadial:"Radial",textDirection:"Direction",textStyle:"Style",textGradient:"Gradient Points",textBorderSizeErr:"The entered value is incorrect.
    Please enter a value between 0 pt and 1584 pt.",strType:"Type",textRotation:"Rotation",textRotate90:"Rotate 90°",textFlip:"Flip",textHint270:"Rotate 90° Counterclockwise",textHint90:"Rotate 90° Clockwise",textHintFlipV:"Flip Vertically",textHintFlipH:"Flip Horizontally",strShadow:"Show shadow",textFromStorage:"From Storage",textSelectImage:"Select Picture",textPosition:"Position",tipAddGradientPoint:"Add gradient point",tipRemoveGradientPoint:"Remove gradient point",textAngle:"Angle"},PE.Views.ShapeSettings||{}))}),define("text!presentationeditor/main/app/template/SlideSettings.template",[],function(){return'\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n \r\n \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    '}),define("presentationeditor/main/app/view/SlideSettings",["text!presentationeditor/main/app/template/SlideSettings.template","jquery","underscore","backbone","common/main/lib/component/ComboBox","common/main/lib/component/MetricSpinner","common/main/lib/component/ThemeColorPalette","common/main/lib/component/ColorButton","common/main/lib/component/ComboDataView","common/main/lib/component/MultiSliderGradient","common/main/lib/view/ImageFromUrlDialog"],function(t,e,i,n){"use strict";PE.Views.SlideSettings=n.View.extend(i.extend({el:"#id-slide-settings",template:i.template(t),events:{},options:{alias:"SlideSettings"},initialize:function(){this._initSettings=!0,this._originalProps=null,this._noApply=!0,this._sendUndoPoint=!0,this._sliderChanged=!1,this._texturearray=null,this.FillItems=[],this._locked={background:!1,effects:!1,timing:!1,header:!1},this._stateDisabled={},this._state={FillType:void 0,SlideColor:"ffffff",BlipFillType:Asc.c_oAscFillBlipType.STRETCH,FGColor:"000000",BGColor:"ffffff",GradColor:"000000",GradFillType:Asc.c_oAscFillGradType.GRAD_LINEAR},this.OriginalFillType=void 0,this.SlideColor={Value:1,Color:"ffffff"},this.BlipFillType=Asc.c_oAscFillBlipType.STRETCH,this.Effect=Asc.c_oAscSlideTransitionTypes.None,this.EffectType=void 0,this.GradFillType=Asc.c_oAscFillGradType.GRAD_LINEAR,this.GradColor={values:[0,100],colors:["000000","ffffff"],currentIdx:0},this.GradRadialDirectionIdx=0,this.GradLinearDirectionType=0,this.PatternFillType=0,this.FGColor={Value:1,Color:"000000"},this.BGColor={Value:1,Color:"ffffff"}, -this.textureNames=[this.txtCanvas,this.txtCarton,this.txtDarkFabric,this.txtGrain,this.txtGranite,this.txtGreyPaper,this.txtKnit,this.txtLeather,this.txtBrownPaper,this.txtPapyrus,this.txtWood],this.render();var t=this;this._arrFillSrc=[{displayValue:this.textColor,value:Asc.c_oAscFill.FILL_TYPE_SOLID},{displayValue:this.textGradientFill,value:Asc.c_oAscFill.FILL_TYPE_GRAD},{displayValue:this.textImageTexture,value:Asc.c_oAscFill.FILL_TYPE_BLIP},{displayValue:this.textPatternFill,value:Asc.c_oAscFill.FILL_TYPE_PATT},{displayValue:this.textNoFill,value:Asc.c_oAscFill.FILL_TYPE_NOFILL}],this.cmbFillSrc=new Common.UI.ComboBox({el:e("#slide-combo-fill-src"),cls:"input-group-nr",style:"width: 100%;",menuStyle:"min-width: 100%;",editable:!1,data:this._arrFillSrc,disabled:!0}),this.cmbFillSrc.setValue(Asc.c_oAscFill.FILL_TYPE_SOLID),this.cmbFillSrc.on("selected",i.bind(this.onFillSrcSelect,this)),this.btnBackColor=new Common.UI.ColorButton({parentEl:e("#slide-back-color-btn"),disabled:!0,transparent:!0,menu:!0,color:"ffffff"}),this.FillItems.push(this.btnBackColor),this.FillColorContainer=e("#slide-panel-color-fill"),this.FillImageContainer=e("#slide-panel-image-fill"),this.FillPatternContainer=e("#slide-panel-pattern-fill"),this.FillGradientContainer=e("#slide-panel-gradient-fill"),this._arrEffectName=[{displayValue:this.textNone,value:Asc.c_oAscSlideTransitionTypes.None},{displayValue:this.textFade,value:Asc.c_oAscSlideTransitionTypes.Fade},{displayValue:this.textPush,value:Asc.c_oAscSlideTransitionTypes.Push},{displayValue:this.textWipe,value:Asc.c_oAscSlideTransitionTypes.Wipe},{displayValue:this.textSplit,value:Asc.c_oAscSlideTransitionTypes.Split},{displayValue:this.textUnCover,value:Asc.c_oAscSlideTransitionTypes.UnCover},{displayValue:this.textCover,value:Asc.c_oAscSlideTransitionTypes.Cover},{displayValue:this.textClock,value:Asc.c_oAscSlideTransitionTypes.Clock},{displayValue:this.textZoom,value:Asc.c_oAscSlideTransitionTypes.Zoom}],this.cmbEffectName=new Common.UI.ComboBox({el:e("#slide-combo-effect-name"),cls:"input-group-nr",style:"width: 100%;",menuStyle:"min-width: 100%;",editable:!1,data:this._arrEffectName,disabled:!0}),this.cmbEffectName.setValue(""),this.cmbEffectName.on("selected",i.bind(this.onEffectNameSelect,this)),this._arrEffectType=[{displayValue:this.textSmoothly,value:Asc.c_oAscSlideTransitionParams.Fade_Smoothly},{displayValue:this.textBlack,value:Asc.c_oAscSlideTransitionParams.Fade_Through_Black},{displayValue:this.textLeft,value:Asc.c_oAscSlideTransitionParams.Param_Left},{displayValue:this.textTop,value:Asc.c_oAscSlideTransitionParams.Param_Top},{displayValue:this.textRight,value:Asc.c_oAscSlideTransitionParams.Param_Right},{displayValue:this.textBottom,value:Asc.c_oAscSlideTransitionParams.Param_Bottom},{displayValue:this.textTopLeft,value:Asc.c_oAscSlideTransitionParams.Param_TopLeft},{displayValue:this.textTopRight,value:Asc.c_oAscSlideTransitionParams.Param_TopRight},{displayValue:this.textBottomLeft,value:Asc.c_oAscSlideTransitionParams.Param_BottomLeft},{displayValue:this.textBottomRight,value:Asc.c_oAscSlideTransitionParams.Param_BottomRight},{displayValue:this.textVerticalIn,value:Asc.c_oAscSlideTransitionParams.Split_VerticalIn},{displayValue:this.textVerticalOut,value:Asc.c_oAscSlideTransitionParams.Split_VerticalOut},{displayValue:this.textHorizontalIn,value:Asc.c_oAscSlideTransitionParams.Split_HorizontalIn},{displayValue:this.textHorizontalOut,value:Asc.c_oAscSlideTransitionParams.Split_HorizontalOut},{displayValue:this.textClockwise,value:Asc.c_oAscSlideTransitionParams.Clock_Clockwise},{displayValue:this.textCounterclockwise,value:Asc.c_oAscSlideTransitionParams.Clock_Counterclockwise},{displayValue:this.textWedge,value:Asc.c_oAscSlideTransitionParams.Clock_Wedge},{displayValue:this.textZoomIn,value:Asc.c_oAscSlideTransitionParams.Zoom_In},{displayValue:this.textZoomOut,value:Asc.c_oAscSlideTransitionParams.Zoom_Out},{displayValue:this.textZoomRotate,value:Asc.c_oAscSlideTransitionParams.Zoom_AndRotate}],this.cmbEffectType=new Common.UI.ComboBox({el:e("#slide-combo-effect-type"),cls:"input-group-nr",style:"width: 100%;",menuStyle:"min-width: 100%;",editable:!1,data:this._arrEffectType,disabled:!0}),this.cmbEffectType.setValue(""),this.cmbEffectType.on("selected",i.bind(this.onEffectTypeSelect,this)),this.numDuration=new Common.UI.MetricSpinner({el:e("#slide-spin-duration"),step:1,width:70,value:"",defaultUnit:this.textSec,maxValue:300,minValue:0,disabled:!0}),this.numDuration.on("change",i.bind(this.onDurationChange,this)),this.numDuration.on("inputleave",function(){t.fireEvent("editcomplete",t)}),this.numDelay=new Common.UI.MetricSpinner({el:e("#slide-spin-delay"),step:1,width:70,value:"",defaultUnit:this.textSec,maxValue:300,minValue:0,disabled:!0}),this.numDelay.on("change",i.bind(this.onDelayChange,this)),this.numDelay.on("inputleave",function(){t.fireEvent("editcomplete",t)}),this.chStartOnClick=new Common.UI.CheckBox({el:e("#slide-checkbox-start-click"),labelText:this.strStartOnClick,disabled:!0}),this.chStartOnClick.on("change",i.bind(this.onStartOnClickChange,this)),this.chDelay=new Common.UI.CheckBox({el:e("#slide-checkbox-delay"),labelText:this.strDelay,disabled:!0}),this.chDelay.on("change",i.bind(this.onCheckDelayChange,this)),this.btnPreview=new Common.UI.Button({el:e("#slide-button-preview"),disabled:!0}),this.btnPreview.on("click",i.bind(function(t){this.api&&this.api.SlideTransitionPlay(),this.fireEvent("editcomplete",this)},this)),this.btnApplyToAll=new Common.UI.Button({el:e("#slide-button-apply-all"),disabled:!0}),this.btnApplyToAll.on("click",i.bind(function(t){this.api&&this.api.SlideTimingApplyToAll(),this.fireEvent("editcomplete",this)},this)),this.chSlideNum=new Common.UI.CheckBox({el:e("#slide-checkbox-slidenum"),labelText:this.strSlideNum,disabled:!0}),this.chSlideNum.on("change",i.bind(this.onHeaderChange,this,"slidenum")),this.chDateTime=new Common.UI.CheckBox({el:e("#slide-checkbox-datetime"),labelText:this.strDateTime,disabled:!0}),this.chDateTime.on("change",i.bind(this.onHeaderChange,this,"datetime"))},render:function(){e(this.el).html(this.template({scope:this}))},setApi:function(t){return this.api=t,this.api&&(this.api.SetInterfaceDrawImagePlaceSlide("slide-texture-img"),this.api.asc_registerCallback("asc_onInitStandartTextures",i.bind(this.onInitStandartTextures,this))),Common.NotificationCenter.on("storage:image-insert",i.bind(this.insertImageFromStorage,this)),this},setMode:function(t){this.mode=t},onFillSrcSelect:function(t,e){switch(this.ShowHideElem(e.value),e.value){case Asc.c_oAscFill.FILL_TYPE_SOLID:if(this._state.FillType=Asc.c_oAscFill.FILL_TYPE_SOLID,!this._noApply){var i=new Asc.CAscSlideProps,n=new Asc.asc_CShapeFill;n.put_type(Asc.c_oAscFill.FILL_TYPE_SOLID),n.put_fill(new Asc.asc_CFillSolid),n.get_fill().put_color(Common.Utils.ThemeColor.getRgbColor("transparent"==this.SlideColor.Color?{color:"4f81bd",effectId:24}:this.SlideColor.Color)),i.put_background(n),this.api.SetSlideProps(i)}break;case Asc.c_oAscFill.FILL_TYPE_GRAD:if(this._state.FillType=Asc.c_oAscFill.FILL_TYPE_GRAD,!this._noApply){var i=new Asc.CAscSlideProps,n=new Asc.asc_CShapeFill;if(n.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD),n.put_fill(new Asc.asc_CFillGrad),n.get_fill().put_grad_type(this.GradFillType),this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR&&(n.get_fill().put_linear_angle(6e4*this.GradLinearDirectionType),n.get_fill().put_linear_scale(!0)),this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_GRAD){this.GradColor.values=[0,100],this.GradColor.colors=[this.GradColor.colors[0],this.GradColor.colors[this.GradColor.colors.length-1]],this.GradColor.currentIdx=0;var o=Common.Utils.ThemeColor.getRgbColor(this.GradColor.colors[0]).get_color().get_hex(),s=Common.Utils.ThemeColor.getRgbColor(this.GradColor.colors[1]).get_color().get_hex();o="ffffff"===o&&"ffffff"===s?{color:"4f81bd",effectId:24}:this.GradColor.colors[0],n.get_fill().put_positions([1e3*this.GradColor.values[0],1e3*this.GradColor.values[1]]),n.get_fill().put_colors([Common.Utils.ThemeColor.getRgbColor(o),Common.Utils.ThemeColor.getRgbColor(this.GradColor.colors[1])])}i.put_background(n),this.api.SetSlideProps(i)}break;case Asc.c_oAscFill.FILL_TYPE_BLIP:this._state.FillType=Asc.c_oAscFill.FILL_TYPE_BLIP;break;case Asc.c_oAscFill.FILL_TYPE_PATT:if(this._state.FillType=Asc.c_oAscFill.FILL_TYPE_PATT,!this._noApply){var i=new Asc.CAscSlideProps,n=new Asc.asc_CShapeFill;n.put_type(Asc.c_oAscFill.FILL_TYPE_PATT),n.put_fill(new Asc.asc_CFillHatch),n.get_fill().put_pattern_type(this.PatternFillType);var a=Common.Utils.ThemeColor.getRgbColor(this.FGColor.Color).get_color().get_hex();a="ffffff"===Common.Utils.ThemeColor.getRgbColor(this.BGColor.Color).get_color().get_hex()&&"ffffff"===a?{color:"4f81bd",effectId:24}:this.FGColor.Color,n.get_fill().put_color_fg(Common.Utils.ThemeColor.getRgbColor(a)),n.get_fill().put_color_bg(Common.Utils.ThemeColor.getRgbColor(this.BGColor.Color)),i.put_background(n),this.api.SetSlideProps(i)}break;case Asc.c_oAscFill.FILL_TYPE_NOFILL:if(this._state.FillType=Asc.c_oAscFill.FILL_TYPE_NOFILL,!this._noApply){var i=new Asc.CAscSlideProps,n=new Asc.asc_CShapeFill;n.put_type(Asc.c_oAscFill.FILL_TYPE_NOFILL),n.put_fill(null),i.put_background(n),this.api.SetSlideProps(i)}}this.fireEvent("editcomplete",this)},onColorsBackSelect:function(t,e){if(this.SlideColor={Value:1,Color:e},this.api&&!this._noApply){var i=new Asc.CAscSlideProps,n=new Asc.asc_CShapeFill;"transparent"==this.SlideColor.Color?(n.put_type(Asc.c_oAscFill.FILL_TYPE_NOFILL),n.put_fill(null)):(n.put_type(Asc.c_oAscFill.FILL_TYPE_SOLID),n.put_fill(new Asc.asc_CFillSolid),n.get_fill().put_color(Common.Utils.ThemeColor.getRgbColor(this.SlideColor.Color))),i.put_background(n),this.api.SetSlideProps(i)}this.fireEvent("editcomplete",this)},onPatternSelect:function(t,e){if(this.api&&!this._noApply){this.PatternFillType=e.get("type");var i=new Asc.CAscSlideProps,n=new Asc.asc_CShapeFill;n.put_type(Asc.c_oAscFill.FILL_TYPE_PATT),n.put_fill(new Asc.asc_CFillHatch),n.get_fill().put_pattern_type(this.PatternFillType),this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_PATT&&(n.get_fill().put_color_fg(Common.Utils.ThemeColor.getRgbColor(this.FGColor.Color)),n.get_fill().put_color_bg(Common.Utils.ThemeColor.getRgbColor(this.BGColor.Color))),i.put_background(n),this.api.SetSlideProps(i)}this.fireEvent("editcomplete",this)},onColorsFGSelect:function(t,e){if(this.FGColor={Value:1,Color:e},this.api&&!this._noApply){var i=new Asc.CAscSlideProps,n=new Asc.asc_CShapeFill;n.put_type(Asc.c_oAscFill.FILL_TYPE_PATT),n.put_fill(new Asc.asc_CFillHatch),n.get_fill().put_color_fg(Common.Utils.ThemeColor.getRgbColor(this.FGColor.Color)),this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_PATT&&(n.get_fill().put_pattern_type(this.PatternFillType),n.get_fill().put_color_bg(Common.Utils.ThemeColor.getRgbColor(this.BGColor.Color))),i.put_background(n),this.api.SetSlideProps(i)}this.fireEvent("editcomplete",this)},onColorsBGSelect:function(t,e){if(this.BGColor={Value:1,Color:e},this.api&&!this._noApply){var i=new Asc.CAscSlideProps,n=new Asc.asc_CShapeFill;n.put_type(Asc.c_oAscFill.FILL_TYPE_PATT),n.put_fill(new Asc.asc_CFillHatch),this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_PATT&&(n.get_fill().put_pattern_type(this.PatternFillType),n.get_fill().put_color_fg(Common.Utils.ThemeColor.getRgbColor(this.FGColor.Color))),n.get_fill().put_color_bg(Common.Utils.ThemeColor.getRgbColor(this.BGColor.Color)),i.put_background(n),this.api.SetSlideProps(i)}this.fireEvent("editcomplete",this)},onFillTypeSelect:function(t,e){if(this.BlipFillType=e.value,this.api&&!0!==this._fromTextureCmb&&this.OriginalFillType==Asc.c_oAscFill.FILL_TYPE_BLIP){var i=new Asc.CAscSlideProps,n=new Asc.asc_CShapeFill;n.put_type(Asc.c_oAscFill.FILL_TYPE_BLIP),n.put_fill(new Asc.asc_CFillBlip),n.get_fill().put_type(this.BlipFillType),i.put_background(n),this.api.SetSlideProps(i)}this.fireEvent("editcomplete",this)},onGradTypeSelect:function(t,e){if(this.GradFillType=e.value,this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR){this.mnuDirectionPicker.store.reset(this._viewDataLinear),this.mnuDirectionPicker.cmpEl.width(175),this.mnuDirectionPicker.restoreHeight=174;var e=this.mnuDirectionPicker.store.findWhere({type:this.GradLinearDirectionType});this.mnuDirectionPicker.selectRecord(e,!0),e?this.btnDirection.setIconCls("item-gradient "+e.get("iconcls")):this.btnDirection.setIconCls(""),this.numGradientAngle.setValue(this.GradLinearDirectionType,!0),this.numGradientAngle.setDisabled(this._locked.background)}else this.GradFillType==Asc.c_oAscFillGradType.GRAD_PATH&&(this.mnuDirectionPicker.store.reset(this._viewDataRadial),this.mnuDirectionPicker.cmpEl.width(60),this.mnuDirectionPicker.restoreHeight=58,this.mnuDirectionPicker.selectByIndex(this.GradRadialDirectionIdx,!0),this.GradRadialDirectionIdx>=0?this.btnDirection.setIconCls("item-gradient "+this._viewDataRadial[this.GradRadialDirectionIdx].iconcls):this.btnDirection.setIconCls(""),this.numGradientAngle.setValue(0,!0),this.numGradientAngle.setDisabled(!0));if(this.api&&!this._noApply){var i=new Asc.CAscSlideProps,n=new Asc.asc_CShapeFill;n.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD),n.put_fill(new Asc.asc_CFillGrad),n.get_fill().put_grad_type(this.GradFillType),this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR&&(n.get_fill().put_linear_angle(6e4*this.GradLinearDirectionType),n.get_fill().put_linear_scale(!0)),i.put_background(n),this.api.SetSlideProps(i)}this.fireEvent("editcomplete",this)},onSelectGradient:function(t,e,n,o){if(!this._noApply){var s={};if(i.isFunction(o.toJSON)){if(!o.get("selected"))return;s=o.toJSON()}else s=o;if(this.btnDirection.setIconCls("item-gradient "+s.iconcls),this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR?this.GradLinearDirectionType=s.type:this.GradRadialDirectionIdx=0,this.api&&this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR){this.numGradientAngle.setValue(s.type,!0);var a=new Asc.CAscSlideProps,l=new Asc.asc_CShapeFill;l.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD),l.put_fill(new Asc.asc_CFillGrad),l.get_fill().put_grad_type(this.GradFillType),l.get_fill().put_linear_angle(6e4*s.type),l.get_fill().put_linear_scale(!0),a.put_background(l),this.api.SetSlideProps(a)}this.fireEvent("editcomplete",this)}},onColorsGradientSelect:function(t,e){if(this.GradColor.colors[this.GradColor.currentIdx]=e,this.sldrGradient.setColorValue(Common.Utils.String.format("#{0}","object"==typeof e?e.color:e)),this.api&&!this._noApply){var i=new Asc.CAscSlideProps,n=new Asc.asc_CShapeFill;n.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD),n.put_fill(new Asc.asc_CFillGrad),n.get_fill().put_grad_type(this.GradFillType);var o=[];this.GradColor.colors.forEach(function(t){o.push(Common.Utils.ThemeColor.getRgbColor(t))}),n.get_fill().put_colors(o),this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_GRAD&&(this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR&&(n.get_fill().put_linear_angle(6e4*this.GradLinearDirectionType),n.get_fill().put_linear_scale(!0)),o=[],this.GradColor.values.forEach(function(t){o.push(1e3*t)}),n.get_fill().put_positions(o)),i.put_background(n),this.api.SetSlideProps(i)}this.fireEvent("editcomplete",this)},onGradientChange:function(t,e,n){this.GradColor.values=t.getValues(),this.spnGradPosition.setValue(this.GradColor.values[this.GradColor.currentIdx],!0),this._sliderChanged=!0,this.api&&!this._noApply&&this._sendUndoPoint&&(this.api.setStartPointHistory(),this._sendUndoPoint=!1,this.updateslider=setInterval(i.bind(this._gradientApplyFunc,this),100))},onGradientChangeComplete:function(t,e,i){clearInterval(this.updateslider),this._sliderChanged=!0,this._sendUndoPoint||(this.api.setEndPointHistory(),this._gradientApplyFunc()),this._sendUndoPoint=!0},_gradientApplyFunc:function(){if(this._sliderChanged){var t=new Asc.CAscSlideProps,e=new Asc.asc_CShapeFill;e.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD),e.put_fill(new Asc.asc_CFillGrad),e.get_fill().put_grad_type(this.GradFillType);var i=[];this.GradColor.values.forEach(function(t){i.push(1e3*t)}),e.get_fill().put_positions(i),this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_GRAD&&(this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR&&(e.get_fill().put_linear_angle(6e4*this.GradLinearDirectionType),e.get_fill().put_linear_scale(!0)),i=[],this.GradColor.colors.forEach(function(t){i.push(Common.Utils.ThemeColor.getRgbColor(t))}),e.get_fill().put_colors(i)),t.put_background(e),this.api.SetSlideProps(t),this._sliderChanged=!1}},setImageUrl:function(t,e){if(null!==this.BlipFillType){var i=new Asc.CAscSlideProps,n=new Asc.asc_CShapeFill;n.put_type(Asc.c_oAscFill.FILL_TYPE_BLIP),n.put_fill(new Asc.asc_CFillBlip),n.get_fill().put_type(this.BlipFillType),n.get_fill().put_url(t,e),i.put_background(n),this.api.SetSlideProps(i)}},insertImageFromStorage:function(t){t&&t.url&&"slide"==t.c&&this.setImageUrl(t.url,t.token)},onImageSelect:function(t,e){if(1==e.value){var n=this;new Common.Views.ImageFromUrlDialog({handler:function(t,e){if("ok"==t&&n.api){var o=e.replace(/ /g,"");i.isEmpty(o)||n.setImageUrl(o)}n.fireEvent("editcomplete",n)}}).show()}else 2==e.value?Common.NotificationCenter.trigger("storage:image-load","slide"):(this.api&&this.api.ChangeSlideImageFromFile(this.BlipFillType),this.fireEvent("editcomplete",this))},createDelayedControls:function(){var t=this;this.cmbPattern=new Common.UI.ComboDataView({itemWidth:28,itemHeight:28,menuMaxHeight:300,enableKeyEvents:!0,cls:"combo-pattern"}),this.cmbPattern.menuPicker.itemTemplate=this.cmbPattern.fieldPicker.itemTemplate=i.template(['
    ','',"
    "].join("")),this.cmbPattern.render(e("#slide-combo-pattern")),this.cmbPattern.openButton.menu.cmpEl.css({"min-width":178,"max-width":178}),this.cmbPattern.on("click",i.bind(this.onPatternSelect,this)),this.FillItems.push(this.cmbPattern),this.btnSelectImage=new Common.UI.Button({parentEl:e("#slide-button-replace"),cls:"btn-text-menu-default",caption:this.textSelectImage,style:"width:100%;",menu:new Common.UI.Menu({style:"min-width: 194px;",maxHeight:200,items:[{caption:this.textFromFile,value:0},{caption:this.textFromUrl,value:1},{caption:this.textFromStorage,value:2}]})}),this.FillItems.push(this.btnSelectImage),this.btnSelectImage.menu.on("item:click",i.bind(this.onImageSelect,this)),this.btnSelectImage.menu.items[2].setVisible(this.mode.canRequestInsertImage||this.mode.fileChoiceUrl&&this.mode.fileChoiceUrl.indexOf("{documentType}")>-1),this._arrFillType=[{displayValue:this.textStretch,value:Asc.c_oAscFillBlipType.STRETCH},{displayValue:this.textTile,value:Asc.c_oAscFillBlipType.TILE}],this.cmbFillType=new Common.UI.ComboBox({el:e("#slide-combo-fill-type"),cls:"input-group-nr",menuStyle:"min-width: 90px;",editable:!1,data:this._arrFillType}),this.cmbFillType.setValue(this._arrFillType[0].value),this.cmbFillType.on("selected",i.bind(this.onFillTypeSelect,this)),this.FillItems.push(this.cmbFillType),this._arrGradType=[{displayValue:this.textLinear,value:Asc.c_oAscFillGradType.GRAD_LINEAR},{displayValue:this.textRadial,value:Asc.c_oAscFillGradType.GRAD_PATH}],this.cmbGradType=new Common.UI.ComboBox({el:e("#slide-combo-grad-type"),cls:"input-group-nr",menuStyle:"min-width: 90px;",editable:!1,data:this._arrGradType}),this.cmbGradType.setValue(this._arrGradType[0].value),this.cmbGradType.on("selected",i.bind(this.onGradTypeSelect,this)),this.FillItems.push(this.cmbGradType),this._viewDataLinear=[{offsetx:0,offsety:0,type:45,subtype:-1,iconcls:"gradient-left-top"},{offsetx:50,offsety:0,type:90,subtype:4,iconcls:"gradient-top"},{offsetx:100,offsety:0,type:135,subtype:5,iconcls:"gradient-right-top"},{offsetx:0,offsety:50,type:0,subtype:6,iconcls:"gradient-left",cls:"item-gradient-separator",selected:!0},{offsetx:100,offsety:50,type:180,subtype:1,iconcls:"gradient-right"},{offsetx:0,offsety:100,type:315,subtype:2,iconcls:"gradient-left-bottom"},{offsetx:50,offsety:100,type:270,subtype:3,iconcls:"gradient-bottom"},{offsetx:100,offsety:100,type:225,subtype:7,iconcls:"gradient-right-bottom"}],this._viewDataRadial=[{offsetx:100,offsety:150,type:2,subtype:5,iconcls:"gradient-radial-center"}],this.btnDirection=new Common.UI.Button({cls:"btn-large-dataview",iconCls:"item-gradient gradient-left",menu:new Common.UI.Menu({style:"min-width: 60px;",menuAlign:"tr-br",items:[{template:i.template('
    ')}]})}),this.btnDirection.on("render:after",function(n){t.mnuDirectionPicker=new Common.UI.DataView({el:e("#id-slide-menu-direction"),parentMenu:n.menu,restoreHeight:174,store:new Common.UI.DataViewStore(t._viewDataLinear),itemTemplate:i.template('
    ')})}),this.btnDirection.render(e("#slide-button-direction")),this.mnuDirectionPicker.on("item:click",i.bind(this.onSelectGradient,this,this.btnDirection)),this.FillItems.push(this.btnDirection),this.sldrGradient=new Common.UI.MultiSliderGradient({el:e("#slide-slider-gradient"),width:192,minValue:0,maxValue:100,values:[0,100]}),this.sldrGradient.on("change",i.bind(this.onGradientChange,this)),this.sldrGradient.on("changecomplete",i.bind(this.onGradientChangeComplete,this)),this.sldrGradient.on("thumbclick",function(e,i){t.GradColor.currentIdx=i;var n=t.GradColor.colors[t.GradColor.currentIdx];t.btnGradColor.setColor(n),t.colorsGrad.select(n,!1);var o=t.GradColor.values[t.GradColor.currentIdx];t.spnGradPosition.setValue(o,!0)}),this.sldrGradient.on("thumbdblclick",function(e){t.btnGradColor.cmpEl.find("button").dropdown("toggle")}),this.sldrGradient.on("sortthumbs",function(e,n){var o,s=[];i.each(n,function(e,i){s.push(t.GradColor.colors[e]),t.GradColor.currentIdx==e&&(o=i)}),t.OriginalFillType=null,t.GradColor.colors=s,t.GradColor.currentIdx=o}),this.sldrGradient.on("addthumb",function(e,i,n){t.GradColor.colors[i]=t.GradColor.colors[t.GradColor.currentIdx],t.GradColor.currentIdx=i;var o=t.sldrGradient.addNewThumb(i,n);t.GradColor.colors[t.GradColor.currentIdx]=o}),this.sldrGradient.on("removethumb",function(e,n){if(t.sldrGradient.removeThumb(n),t.GradColor.values.splice(n,1),t.sldrGradient.changeGradientStyle(),i.isUndefined(t.GradColor.currentIdx)||t.GradColor.currentIdx>=t.GradColor.colors.length){var o=n>0?n-1:n;o=0===o&&t.GradColor.values.length>2?t.GradColor.values.length-2:o,t.GradColor.currentIdx=o}t.sldrGradient.setActiveThumb(t.GradColor.currentIdx)}),this.FillItems.push(this.sldrGradient),this.spnGradPosition=new Common.UI.MetricSpinner({el:e("#slide-gradient-position"),step:1,width:60,defaultUnit:"%",value:"50 %",allowDecimal:!1,maxValue:100,minValue:0,disabled:this._locked.background}),this.FillItems.push(this.spnGradPosition),this.spnGradPosition.on("change",i.bind(this.onPositionChange,this)),this.spnGradPosition.on("inputleave",function(){t.fireEvent("editcomplete",t)}),this.btnAddGradientStep=new Common.UI.Button({parentEl:e("#slide-gradient-add-step"),cls:"btn-toolbar",iconCls:"toolbar__icon btn-add-breakpoint",disabled:this._locked.background,hint:this.tipAddGradientPoint}),this.btnAddGradientStep.on("click",i.bind(this.onAddGradientStep,this)),this.FillItems.push(this.btnAddGradientStep),this.btnRemoveGradientStep=new Common.UI.Button({parentEl:e("#slide-gradient-remove-step"),cls:"btn-toolbar",iconCls:"toolbar__icon btn-remove-breakpoint",disabled:this._locked.background,hint:this.tipRemoveGradientPoint}),this.btnRemoveGradientStep.on("click",i.bind(this.onRemoveGradientStep,this)),this.FillItems.push(this.btnRemoveGradientStep),this.numGradientAngle=new Common.UI.MetricSpinner({el:e("#slide-spin-gradient-angle"),step:10,width:60,defaultUnit:"°",value:"0 °",allowDecimal:!0,maxValue:359.9,minValue:0,disabled:this._locked.background}),this.FillItems.push(this.numGradientAngle),this.numGradientAngle.on("change",i.bind(this.onGradientAngleChange,this)),this.numGradientAngle.on("inputleave",function(){t.fireEvent("editcomplete",t)})},createDelayedElements:function(){this._initSettings=!1,this.createDelayedControls();var t=[0,1,3,2,4,53,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,22,23,24,25,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,49,50,51,52];this.patternViewData=[];for(var e=0;e<13;e++)for(var i=0;i<4;i++){var n=4*e+i;this.patternViewData[n]={offsetx:28*i,offsety:28*e,type:t[n]}}this.patternViewData.splice(this.patternViewData.length-2,2);for(var e=0;e0&&(this.cmbPattern.fillComboView(this.cmbPattern.menuPicker.store.at(0),!0),this.PatternFillType=this.patternViewData[0].type),this.onInitStandartTextures(),this.UpdateThemeColors()},onInitStandartTextures:function(t){var n=this;if(t&&t.length>0&&(n._texturearray=[],i.each(t,function(t){n._texturearray.push({imageUrl:t.get_image(),name:n.textureNames[t.get_id()],type:t.get_id(),selected:!1})})),n._texturearray&&!(n._texturearray.length<1)&&!this._initSettings&&!this.btnTexture){this.btnTexture=new Common.UI.ComboBox({el:e("#slide-combo-fill-texture"),template:i.template(['"].join(""))}),this.textureMenu=new Common.UI.Menu({items:[{template:i.template('
    ')}]}),this.textureMenu.render(e("#slide-combo-fill-texture")),this.FillItems.push(this.btnTexture);var o=function(t){new Common.UI.DataView({el:e("#id-slide-menu-texture"),restoreHeight:174,parentMenu:t,showLast:!1,store:new Common.UI.DataViewStore(n._texturearray||[]),itemTemplate:i.template('
    ')}).on("item:click",i.bind(n.onSelectTexture,n)),t.off("show:before",o)};this.textureMenu.on("show:before",o)}},onSelectTexture:function(t,i,n){if(this._fromTextureCmb=!0,this.cmbFillType.setValue(this._arrFillType[1].value),this._fromTextureCmb=!1,this.api){var o=new Asc.CAscSlideProps,s=new Asc.asc_CShapeFill;s.put_type(Asc.c_oAscFill.FILL_TYPE_BLIP),s.put_fill(new Asc.asc_CFillBlip),s.get_fill().put_type(Asc.c_oAscFillBlipType.TILE),s.get_fill().put_texture_id(n.get("type")),o.put_background(s),this.api.SetSlideProps(o)}e(this.btnTexture.el).find(".form-control").prop("innerHTML",n.get("name")),this.fireEvent("editcomplete",this)},fillEffectTypeCombo:function(t){var e=[];switch(t){case Asc.c_oAscSlideTransitionTypes.Fade:e.push(this._arrEffectType[0],this._arrEffectType[1]);break;case Asc.c_oAscSlideTransitionTypes.Push:e=this._arrEffectType.slice(2,6);break;case Asc.c_oAscSlideTransitionTypes.Wipe:e=this._arrEffectType.slice(2,10);break;case Asc.c_oAscSlideTransitionTypes.Split:e=this._arrEffectType.slice(10,14);break;case Asc.c_oAscSlideTransitionTypes.UnCover:case Asc.c_oAscSlideTransitionTypes.Cover:e=this._arrEffectType.slice(2,10);break;case Asc.c_oAscSlideTransitionTypes.Clock:e=this._arrEffectType.slice(14,17);break;case Asc.c_oAscSlideTransitionTypes.Zoom:e=this._arrEffectType.slice(17)}e.length>0?(this.cmbEffectType.store.reset(e),this.cmbEffectType.setValue(e[0].value),this.EffectType=e[0].value):(this.cmbEffectType.store.reset(),this.EffectType=void 0),this.cmbEffectType.setDisabled(e.length<1||this._locked.effects),this.numDuration.setDisabled(e.length<1||this._locked.effects),this.btnPreview.setDisabled(e.length<1||this._locked.effects)},onEffectNameSelect:function(t,e){var i=e.value;if(this.Effect!==i&&(this.Effect!==Asc.c_oAscSlideTransitionTypes.Wipe&&this.Effect!==Asc.c_oAscSlideTransitionTypes.UnCover&&this.Effect!==Asc.c_oAscSlideTransitionTypes.Cover||i!==Asc.c_oAscSlideTransitionTypes.Wipe&&i!==Asc.c_oAscSlideTransitionTypes.UnCover&&i!==Asc.c_oAscSlideTransitionTypes.Cover)&&this.fillEffectTypeCombo(i),this.Effect=i,this.api&&!this._noApply){var n=new Asc.CAscSlideProps,o=new Asc.CAscSlideTiming;o.put_TransitionType(i),o.put_TransitionOption(this.EffectType),n.put_timing(o),this.api.SetSlideProps(n)}this.fireEvent("editcomplete",this)},onEffectTypeSelect:function(t,e){if(this.EffectType=e.value,this.api&&!this._noApply){var i=new Asc.CAscSlideProps,n=new Asc.CAscSlideTiming;n.put_TransitionType(this.Effect),n.put_TransitionOption(this.EffectType),i.put_timing(n),this.api.SetSlideProps(i)}this.fireEvent("editcomplete",this)},onDurationChange:function(t,e,i,n){if(this.api&&!this._noApply){var o=new Asc.CAscSlideProps,s=new Asc.CAscSlideTiming;s.put_TransitionDuration(1e3*t.getNumberValue()),o.put_timing(s),this.api.SetSlideProps(o)}},onDelayChange:function(t,e,i,n){if(this.api&&!this._noApply){var o=new Asc.CAscSlideProps,s=new Asc.CAscSlideTiming;s.put_SlideAdvanceDuration(1e3*t.getNumberValue()),o.put_timing(s),this.api.SetSlideProps(o)}},onStartOnClickChange:function(t,e,i,n){if(this.api&&!this._noApply){var o=new Asc.CAscSlideProps,s=new Asc.CAscSlideTiming;s.put_SlideAdvanceOnMouseClick("checked"==t.getValue()),o.put_timing(s),this.api.SetSlideProps(o)}this.fireEvent("editcomplete",this)},onCheckDelayChange:function(t,e,i,n){if(this.numDelay.setDisabled("checked"!==t.getValue()),this.api&&!this._noApply){var o=new Asc.CAscSlideProps,s=new Asc.CAscSlideTiming;s.put_SlideAdvanceAfter("checked"==t.getValue()),o.put_timing(s),this.api.SetSlideProps(o)}this.fireEvent("editcomplete",this)},onHeaderChange:function(t,e,i,n,o){if(this.api&&!this._noApply){var s=this.api.asc_getHeaderFooterProperties();s.get_Slide()["slidenum"==t?"put_ShowSlideNum":"put_ShowDateTime"]("checked"==e.getValue()),this.api.asc_setHeaderFooterProperties(s)}this.fireEvent("editcomplete",this)},UpdateThemeColors:function(){this._initSettings||(this.colorsBack||(this.btnBackColor.setMenu(),this.btnBackColor.on("color:select",i.bind(this.onColorsBackSelect,this)),this.colorsBack=this.btnBackColor.getPicker(),this.btnFGColor=new Common.UI.ColorButton({parentEl:e("#slide-foreground-color-btn"),color:"000000"}),this.FillItems.push(this.btnFGColor),this.colorsFG=this.btnFGColor.getPicker(),this.btnFGColor.on("color:select",i.bind(this.onColorsFGSelect,this)),this.btnBGColor=new Common.UI.ColorButton({parentEl:e("#slide-background-color-btn"),color:"ffffff"}),this.FillItems.push(this.btnBGColor),this.colorsBG=this.btnBGColor.getPicker(),this.btnBGColor.on("color:select",i.bind(this.onColorsBGSelect,this)),this.btnGradColor=new Common.UI.ColorButton({parentEl:e("#slide-gradient-color-btn"),color:"000000"}),this.FillItems.push(this.btnGradColor),this.colorsGrad=this.btnGradColor.getPicker(),this.btnGradColor.on("color:select",i.bind(this.onColorsGradientSelect,this))),this.colorsBack.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors()),this.colorsFG.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors()),this.colorsBG.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors()),this.colorsGrad.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors()))},ShowHideElem:function(t){this.FillColorContainer.toggleClass("settings-hidden",t!==Asc.c_oAscFill.FILL_TYPE_SOLID),this.FillImageContainer.toggleClass("settings-hidden",t!==Asc.c_oAscFill.FILL_TYPE_BLIP),this.FillPatternContainer.toggleClass("settings-hidden",t!==Asc.c_oAscFill.FILL_TYPE_PATT), -this.FillGradientContainer.toggleClass("settings-hidden",t!==Asc.c_oAscFill.FILL_TYPE_GRAD)},ChangeSettings:function(t){if(this._initSettings&&this.createDelayedElements(),this.SetSlideDisabled(this._locked.background,this._locked.effects,this._locked.timing,this._locked.header),t){this._originalProps=t,this._noApply=!0;var n=null,o=t.get_background(),s=o.get_type(),a=null;if(null===o||null===s||s==Asc.c_oAscFill.FILL_TYPE_NOFILL)this.OriginalFillType=Asc.c_oAscFill.FILL_TYPE_NOFILL;else if(s==Asc.c_oAscFill.FILL_TYPE_SOLID)o=o.get_fill(),a=o.get_color(),a?a.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?this.SlideColor={Value:1,Color:{color:Common.Utils.ThemeColor.getHexColor(a.get_r(),a.get_g(),a.get_b()),effectValue:a.get_value()}}:this.SlideColor={Value:1,Color:Common.Utils.ThemeColor.getHexColor(a.get_r(),a.get_g(),a.get_b())}:this.SlideColor={Value:0,Color:"transparent"},this.OriginalFillType=Asc.c_oAscFill.FILL_TYPE_SOLID,this.FGColor="transparent"!==this.SlideColor.Color?{Value:1,Color:Common.Utils.ThemeColor.colorValue2EffectId(this.SlideColor.Color)}:{Value:1,Color:"000000"},this.BGColor={Value:1,Color:"ffffff"},this.GradColor.colors[0]="transparent"!==this.SlideColor.Color?Common.Utils.ThemeColor.colorValue2EffectId(this.SlideColor.Color):"000000",this.GradColor.colors[this.GradColor.colors.length-1]="ffffff";else if(s==Asc.c_oAscFill.FILL_TYPE_BLIP)o=o.get_fill(),this.BlipFillType=o.get_type(),this._state.BlipFillType!==this.BlipFillType&&(this.BlipFillType==Asc.c_oAscFillBlipType.STRETCH||this.BlipFillType==Asc.c_oAscFillBlipType.TILE?this.cmbFillType.setValue(this.BlipFillType):this.cmbFillType.setValue(""),this._state.BlipFillType=this.BlipFillType),this.OriginalFillType=Asc.c_oAscFill.FILL_TYPE_BLIP;else if(s==Asc.c_oAscFill.FILL_TYPE_PATT){if(o=o.get_fill(),this.PatternFillType=o.get_pattern_type(),this._state.PatternFillType!==this.PatternFillType){this.cmbPattern.suspendEvents();var n=this.cmbPattern.menuPicker.store.findWhere({type:this.PatternFillType});this.cmbPattern.menuPicker.selectRecord(n),this.cmbPattern.resumeEvents(),this._state.PatternFillType=this.PatternFillType}a=o.get_color_fg(),a?a.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?this.FGColor={Value:1,Color:{color:Common.Utils.ThemeColor.getHexColor(a.get_r(),a.get_g(),a.get_b()),effectValue:a.get_value()}}:this.FGColor={Value:1,Color:Common.Utils.ThemeColor.getHexColor(a.get_r(),a.get_g(),a.get_b())}:this.FGColor={Value:1,Color:"000000"},a=o.get_color_bg(),a?a.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?this.BGColor={Value:1,Color:{color:Common.Utils.ThemeColor.getHexColor(a.get_r(),a.get_g(),a.get_b()),effectValue:a.get_value()}}:this.BGColor={Value:1,Color:Common.Utils.ThemeColor.getHexColor(a.get_r(),a.get_g(),a.get_b())}:this.BGColor={Value:1,Color:"ffffff"},this.OriginalFillType=Asc.c_oAscFill.FILL_TYPE_PATT,this.SlideColor={Value:1,Color:Common.Utils.ThemeColor.colorValue2EffectId(this.FGColor.Color)},this.GradColor.colors[0]=Common.Utils.ThemeColor.colorValue2EffectId(this.FGColor.Color),this.GradColor.colors[this.GradColor.colors.length-1]="ffffff"}else if(s==Asc.c_oAscFill.FILL_TYPE_GRAD){o=o.get_fill();var l=o.get_grad_type();if(this._state.GradFillType===l&&this.GradFillType===l||(this.GradFillType=l,n=void 0,this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR||this.GradFillType==Asc.c_oAscFillGradType.GRAD_PATH?(this.cmbGradType.setValue(this.GradFillType),n=this.cmbGradType.store.findWhere({value:this.GradFillType}),this.onGradTypeSelect(this.cmbGradType,n.attributes)):(this.cmbGradType.setValue(""),this.btnDirection.setIconCls("")),this._state.GradFillType=this.GradFillType),this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR){var r=Math.floor(o.get_linear_angle()/6e4);if(Math.abs(this.GradLinearDirectionType-r)>.001){this.GradLinearDirectionType=r;var c=this.mnuDirectionPicker.store.findWhere({type:r});this.mnuDirectionPicker.selectRecord(c,!0),c?this.btnDirection.setIconCls("item-gradient "+c.get("iconcls")):this.btnDirection.setIconCls(""),this.numGradientAngle.setValue(r,!0)}}else this.numGradientAngle.setValue(0,!0);var d=this,h=o.get_colors(),p=o.get_positions(),u=h?h.length:this.GradColor.colors.length;this.sldrGradient.setThumbs(u),this.GradColor.colors.length>u&&(this.GradColor.colors.splice(u,this.GradColor.colors.length-u),this.GradColor.values.splice(u,this.GradColor.colors.length-u),this.GradColor.currentIdx=0),h&&h.forEach(function(t,e){t?t.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?(d.GradColor.colors[e]={color:Common.Utils.ThemeColor.getHexColor(t.get_r(),t.get_g(),t.get_b()),effectValue:t.get_value()},Common.Utils.ThemeColor.colorValue2EffectId(d.GradColor.colors[e])):d.GradColor.colors[e]=Common.Utils.ThemeColor.getHexColor(t.get_r(),t.get_g(),t.get_b()):d.GradColor.colors[e]="000000";var i=p[e];null!==i&&(i/=1e3,d.GradColor.values[e]=i)});for(var m=0;m=this.GradColor.colors.length)&&(d.GradColor.currentIdx=0),d.sldrGradient.setActiveThumb(d.GradColor.currentIdx),this.spnGradPosition.setValue(this.GradColor.values[this.GradColor.currentIdx]),this.OriginalFillType=Asc.c_oAscFill.FILL_TYPE_GRAD,this.FGColor={Value:1,Color:this.GradColor.colors[0]},this.BGColor={Value:1,Color:"ffffff"},this.SlideColor={Value:1,Color:this.GradColor.colors[0]}}this._state.FillType!==this.OriginalFillType&&(this.cmbFillSrc.setValue(this.OriginalFillType),this._state.FillType=this.OriginalFillType,this.ShowHideElem(this.OriginalFillType)),e(this.btnTexture.el).find(".form-control").prop("innerHTML",this.textSelectTexture);var g=typeof this.SlideColor.Color,f=typeof this._state.SlideColor;if(g!==f||"object"==g&&(this.SlideColor.Color.effectValue!==this._state.SlideColor.effectValue||this._state.SlideColor.color.indexOf(this.SlideColor.Color.color)<0)||"object"!=g&&this._state.SlideColor.indexOf(this.SlideColor.Color)<0){if(this.btnBackColor.setColor(this.SlideColor.Color),"object"==typeof this.SlideColor.Color){for(var b=!1,C=0;C<10;C++)if(Common.Utils.ThemeColor.ThemeValues[C]==this.SlideColor.Color.effectValue){this.colorsBack.select(this.SlideColor.Color,!0),b=!0;break}b||this.colorsBack.clearSelection()}else this.colorsBack.select(this.SlideColor.Color,!0);this._state.SlideColor=this.SlideColor.Color}var v=t.get_timing();if(v){var r=v.get_TransitionType(),_=!1;if(this._state.Effect!==r){var y=this.cmbEffectName.store.findWhere({value:r});y?(_=!0,this.cmbEffectName.setValue(y.get("value"))):this.cmbEffectName.setValue(""),this.fillEffectTypeCombo(_?r:void 0),this.Effect=r,this._state.Effect=r}r=v.get_TransitionOption(),(this._state.EffectType!==r||_)&&(_=!1,y=this.cmbEffectType.store.findWhere({value:r}),y?(_=!0,this.cmbEffectType.setValue(y.get("value"))):this.cmbEffectType.setValue(""),this._state.EffectType=r),r=v.get_TransitionDuration(),(Math.abs(this._state.Duration-r)>.001||(null===this._state.Duration||null===r)&&this._state.Duration!==r||(void 0===this._state.Duration||void 0===r)&&this._state.Duration!==r)&&(this.numDuration.setValue(null!==r&&void 0!==r?r/1e3:"",!0),this._state.Duration=r),r=v.get_SlideAdvanceDuration(),(Math.abs(this._state.Delay-r)>.001||(null===this._state.Delay||null===r)&&this._state.Delay!==r||(void 0===this._state.Delay||void 0===r)&&this._state.Delay!==r)&&(this.numDelay.setValue(null!==r&&void 0!==r?r/1e3:"",!0),this._state.Delay=r),r=v.get_SlideAdvanceOnMouseClick(),this._state.OnMouseClick!==r&&(this.chStartOnClick.setValue(null!==r&&void 0!==r?r:"indeterminate",!0),this._state.OnMouseClick=r),r=v.get_SlideAdvanceAfter(),this._state.AdvanceAfter!==r&&(this.chDelay.setValue(null!==r&&void 0!==r?r:"indeterminate",!0),this.numDelay.setDisabled("checked"!==this.chDelay.getValue()),this._state.AdvanceAfter=r)}if(g=typeof this.FGColor.Color,f=typeof this._state.FGColor,g!==f||"object"==g&&(this.FGColor.Color.effectValue!==this._state.FGColor.effectValue||this._state.FGColor.color.indexOf(this.FGColor.Color.color)<0)||"object"!=g&&this._state.FGColor.indexOf(this.FGColor.Color)<0){if(this.btnFGColor.setColor(this.FGColor.Color),"object"==typeof this.FGColor.Color){for(var b=!1,C=0;C<10;C++)if(Common.Utils.ThemeColor.ThemeValues[C]==this.FGColor.Color.effectValue){this.colorsFG.select(this.FGColor.Color,!0),b=!0;break}b||this.colorsFG.clearSelection()}else this.colorsFG.select(this.FGColor.Color,!0);this._state.FGColor=this.FGColor.Color}if(g=typeof this.BGColor.Color,f=typeof this._state.BGColor,g!==f||"object"==g&&(this.BGColor.Color.effectValue!==this._state.BGColor.effectValue||this._state.BGColor.color.indexOf(this.BGColor.Color.color)<0)||"object"!=g&&this._state.BGColor.indexOf(this.BGColor.Color)<0){if(this.btnBGColor.setColor(this.BGColor.Color),"object"==typeof this.BGColor.Color){for(var b=!1,C=0;C<10;C++)if(Common.Utils.ThemeColor.ThemeValues[C]==this.BGColor.Color.effectValue){this.colorsBG.select(this.BGColor.Color,!0),b=!0;break}b||this.colorsBG.clearSelection()}else this.colorsBG.select(this.BGColor.Color,!0);this._state.BGColor=this.BGColor.Color}if(a=this.GradColor.colors[this.GradColor.currentIdx],g=typeof a,f=typeof this._state.GradColor,g!==f||"object"==g&&(a.effectValue!==this._state.GradColor.effectValue||this._state.GradColor.color.indexOf(a.color)<0)||"object"!=g&&this._state.GradColor.indexOf(a)<0){if(this.btnGradColor.setColor(a),"object"==typeof a){for(var b=!1,C=0;C<10;C++)if(Common.Utils.ThemeColor.ThemeValues[C]==a.effectValue){this.colorsGrad.select(a,!0),b=!0;break}b||this.colorsGrad.clearSelection()}else this.colorsGrad.select(a,!0);this._state.GradColor=a}if(r=this.api.asc_getHeaderFooterProperties()){var w=r.get_Slide()||new AscCommonSlide.CAscHFProps;this.chSlideNum.setValue(!!w.get_ShowSlideNum(),!0),this.chDateTime.setValue(!!w.get_ShowDateTime(),!0)}this._noApply=!1}},setLocked:function(t,e,i,n){this._locked={background:t,effects:e,timing:i,header:n}},SetSlideDisabled:function(t,e,i,n){if(this._locked={background:t,effects:e,timing:i,header:n},!this._initSettings){if(t!==this._stateDisabled.background){this.cmbFillSrc.setDisabled(t);for(var o=0;on;if(this.api){this.GradColor.values[this.GradColor.currentIdx]=e;var s=new Asc.CAscSlideProps,a=new Asc.asc_CShapeFill;a.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD),a.put_fill(new Asc.asc_CFillGrad),a.get_fill().put_grad_type(this.GradFillType);var l=[];this.GradColor.values.forEach(function(t){l.push(1e3*t)}),a.get_fill().put_positions(l),s.put_background(a),this.api.SetSlideProps(s),o&&(this.sldrGradient.sortThumbs(),this.sldrGradient.trigger("change",this.sldrGradient),this.sldrGradient.trigger("changecomplete",this.sldrGradient))}},onAddGradientStep:function(){if(!(this.GradColor.colors.length>9)){var t=this.GradColor.currentIdx,e=(this.GradColor.values[t]+this.GradColor.values[t=this.GradColor.colors.length){var e=t>0?t-1:t;e=0===e&&this.GradColor.values.length>2?this.GradColor.values.length-2:e,this.GradColor.currentIdx=e}this.sldrGradient.setActiveThumb(this.GradColor.currentIdx),this.sldrGradient.trigger("change",this.sldrGradient),this.sldrGradient.trigger("changecomplete",this.sldrGradient)}},onGradientAngleChange:function(t,e,i,n){if(this.api&&!this._noApply){var o=new Asc.CAscSlideProps,s=new Asc.asc_CShapeFill;s.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD),s.put_fill(new Asc.asc_CFillGrad),s.get_fill().put_grad_type(this.GradFillType),s.get_fill().put_linear_angle(6e4*t.getNumberValue()),s.get_fill().put_linear_scale(!0),o.put_background(s),this.api.SetSlideProps(o)}},strColor:"Color",strFill:"Background",textColor:"Color Fill",textImageTexture:"Picture or Texture",textTexture:"From Texture",textFromUrl:"From URL",textFromFile:"From File",textStretch:"Stretch",textTile:"Tile",txtCanvas:"Canvas",txtCarton:"Carton",txtDarkFabric:"Dark Fabric",txtGrain:"Grain",txtGranite:"Granite",txtGreyPaper:"Grey Paper",txtKnit:"Knit",txtLeather:"Leather",txtBrownPaper:"Brown Paper",txtPapyrus:"Papyrus",txtWood:"Wood",textAdvanced:"Show advanced settings",textNoFill:"No Fill",textSelectTexture:"Select",textNone:"None",textFade:"Fade",textPush:"Push",textWipe:"Wipe",textSplit:"Split",textUnCover:"UnCover",textCover:"Cover",textClock:"Clock",textZoom:"Zoom",textSmoothly:"Smoothly",textBlack:"Through Black",textLeft:"Left",textTop:"Top",textRight:"Right",textBottom:"Bottom",textTopLeft:"Top-Left",textTopRight:"Top-Right",textBottomLeft:"Bottom-Left",textBottomRight:"Bottom-Right",textVerticalIn:"Vertical In",textVerticalOut:"Vertical Out",textHorizontalIn:"Horizontal In",textHorizontalOut:"Horizontal Out",textClockwise:"Clockwise",textCounterclockwise:"Counterclockwise",textWedge:"Wedge",textZoomIn:"Zoom In",textZoomOut:"Zoom Out",textZoomRotate:"Zoom and Rotate",strStartOnClick:"Start On Click",strDelay:"Delay",textApplyAll:"Apply to All Slides",textPreview:"Preview",strEffect:"Effect",strDuration:"Duration",textGradientFill:"Gradient Fill",textPatternFill:"Pattern",strBackground:"Background color",strForeground:"Foreground color",strPattern:"Pattern",textEmptyPattern:"No Pattern",textLinear:"Linear",textRadial:"Radial",textDirection:"Direction",textStyle:"Style",textGradient:"Gradient Points",textSec:"s",strSlideNum:"Show Slide Number",strDateTime:"Show Date and Time",textFromStorage:"From Storage",textSelectImage:"Select Picture",textPosition:"Position",tipAddGradientPoint:"Add gradient point",tipRemoveGradientPoint:"Remove gradient point",textAngle:"Angle"},PE.Views.SlideSettings||{}))}),define("text!presentationeditor/main/app/template/TextArtSettings.template",[],function(){return'\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
    \r\n \r\n \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n \r\n \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    '}),define("presentationeditor/main/app/view/TextArtSettings",["text!presentationeditor/main/app/template/TextArtSettings.template","jquery","underscore","backbone","common/main/lib/component/ComboBox","common/main/lib/component/ComboBorderSize","common/main/lib/component/MetricSpinner","common/main/lib/component/ThemeColorPalette","common/main/lib/component/ColorButton","common/main/lib/component/ComboDataView","common/main/lib/component/Slider","common/main/lib/component/MultiSliderGradient","common/main/lib/view/ImageFromUrlDialog"],function(t,e,i,n){"use strict";PE.Views.TextArtSettings=n.View.extend(i.extend({el:"#id-textart-settings",template:i.template(t),events:{},options:{alias:"TextArtSettings"},initialize:function(){this._initSettings=!0,this._noApply=!0,this.shapeprops=null,this._sendUndoPoint=!0,this._sliderChanged=!1,this._texturearray=null,this.txtPt=Common.Utils.Metric.getMetricName(Common.Utils.Metric.c_MetricUnits.pt),this._state={Transparency:null,FillType:Asc.c_oAscFill.FILL_TYPE_SOLID,ShapeColor:"transparent",BlipFillType:Asc.c_oAscFillBlipType.STRETCH,StrokeType:Asc.c_oAscStrokeType.STROKE_COLOR,StrokeWidth:this._pt2mm(1),StrokeColor:"000000",StrokeBorderType:Asc.c_oDashType.solid,FGColor:"000000",BGColor:"ffffff",GradColor:"000000",GradFillType:Asc.c_oAscFillGradType.GRAD_LINEAR,FormId:null,DisabledControls:!1},this.lockedControls=[],this._locked=!1,this.OriginalFillType=Asc.c_oAscFill.FILL_TYPE_SOLID,this.ShapeColor={Value:1,Color:"transparent"},this.BlipFillType=Asc.c_oAscFillBlipType.STRETCH,this.GradFillType=Asc.c_oAscFillGradType.GRAD_LINEAR,this.GradColor={values:[0,100],colors:["000000","ffffff"],currentIdx:0},this.GradRadialDirectionIdx=0,this.GradLinearDirectionType=0,this.PatternFillType=0,this.FGColor={Value:1,Color:"000000"},this.BGColor={Value:1,Color:"ffffff"},this.BorderColor={Value:1,Color:"transparent"},this.BorderSize=0,this.BorderType=Asc.c_oDashType.solid,this.textureNames=[this.txtCanvas,this.txtCarton,this.txtDarkFabric,this.txtGrain,this.txtGranite,this.txtGreyPaper,this.txtKnit,this.txtLeather,this.txtBrownPaper,this.txtPapyrus,this.txtWood],this.render(),this.FillColorContainer=e("#textart-panel-color-fill"),this.FillImageContainer=e("#textart-panel-image-fill"),this.FillPatternContainer=e("#textart-panel-pattern-fill"),this.FillGradientContainer=e("#textart-panel-gradient-fill"),this.TransparencyContainer=e("#textart-panel-transparent-fill"),PE.getCollection("Common.Collections.TextArt").bind({reset:this.fillTextArt.bind(this)})},render:function(){e(this.el).html(this.template({scope:this}))},setApi:function(t){return this.api=t,this.api&&(this.api.SetInterfaceDrawImagePlaceTextArt("textart-texture-img"),this.api.asc_registerCallback("asc_onInitStandartTextures",i.bind(this.onInitStandartTextures,this))),this},onFillSrcSelect:function(t,e){switch(this.ShowHideElem(e.value),e.value){case Asc.c_oAscFill.FILL_TYPE_SOLID:if(this._state.FillType=Asc.c_oAscFill.FILL_TYPE_SOLID,!this._noApply){var i=new Asc.asc_TextArtProperties,n=new Asc.asc_CShapeFill;n.put_type(Asc.c_oAscFill.FILL_TYPE_SOLID),n.put_fill(new Asc.asc_CFillSolid),n.get_fill().put_color(Common.Utils.ThemeColor.getRgbColor("transparent"==this.ShapeColor.Color?{color:"4f81bd",effectId:24}:this.ShapeColor.Color)),i.asc_putFill(n),this.shapeprops.put_TextArtProperties(i),this.api.ShapeApply(this.shapeprops)}break;case Asc.c_oAscFill.FILL_TYPE_GRAD:if(this._state.FillType=Asc.c_oAscFill.FILL_TYPE_GRAD,!this._noApply){var i=new Asc.asc_TextArtProperties,n=new Asc.asc_CShapeFill;if(n.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD),n.put_fill(new Asc.asc_CFillGrad),n.get_fill().put_grad_type(this.GradFillType),this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR&&(n.get_fill().put_linear_angle(6e4*this.GradLinearDirectionType),n.get_fill().put_linear_scale(!0)),this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_GRAD){this.GradColor.values=[0,100],this.GradColor.colors=[this.GradColor.colors[0],this.GradColor.colors[this.GradColor.colors.length-1]],this.GradColor.currentIdx=0;var o=Common.Utils.ThemeColor.getRgbColor(this.GradColor.colors[0]).get_color().get_hex(),s=Common.Utils.ThemeColor.getRgbColor(this.GradColor.colors[1]).get_color().get_hex();o="ffffff"===o&&"ffffff"===s?{color:"4f81bd",effectId:24}:this.GradColor.colors[0],n.get_fill().put_positions([1e3*this.GradColor.values[0],1e3*this.GradColor.values[1]]),n.get_fill().put_colors([Common.Utils.ThemeColor.getRgbColor(o),Common.Utils.ThemeColor.getRgbColor(this.GradColor.colors[1])])}i.asc_putFill(n),this.shapeprops.put_TextArtProperties(i),this.api.ShapeApply(this.shapeprops)}break;case Asc.c_oAscFill.FILL_TYPE_BLIP:this._state.FillType=Asc.c_oAscFill.FILL_TYPE_BLIP;break;case Asc.c_oAscFill.FILL_TYPE_PATT:if(this._state.FillType=Asc.c_oAscFill.FILL_TYPE_PATT,!this._noApply){var i=new Asc.asc_TextArtProperties,n=new Asc.asc_CShapeFill;n.put_type(Asc.c_oAscFill.FILL_TYPE_PATT),n.put_fill(new Asc.asc_CFillHatch),n.get_fill().put_pattern_type(this.PatternFillType);var a=Common.Utils.ThemeColor.getRgbColor(this.FGColor.Color).get_color().get_hex();a="ffffff"===Common.Utils.ThemeColor.getRgbColor(this.BGColor.Color).get_color().get_hex()&&"ffffff"===a?{color:"4f81bd",effectId:24}:this.FGColor.Color,n.get_fill().put_color_fg(Common.Utils.ThemeColor.getRgbColor(a)),n.get_fill().put_color_bg(Common.Utils.ThemeColor.getRgbColor(this.BGColor.Color)),i.asc_putFill(n),this.shapeprops.put_TextArtProperties(i),this.api.ShapeApply(this.shapeprops)}break;case Asc.c_oAscFill.FILL_TYPE_NOFILL:if(this._state.FillType=Asc.c_oAscFill.FILL_TYPE_NOFILL,!this._noApply){var i=new Asc.asc_TextArtProperties,n=new Asc.asc_CShapeFill;n.put_type(Asc.c_oAscFill.FILL_TYPE_NOFILL),n.put_fill(null),i.asc_putFill(n),this.shapeprops.put_TextArtProperties(i),this.api.ShapeApply(this.shapeprops)}}this.fireEvent("editcomplete",this)},onColorsBackSelect:function(t,e){if(this.ShapeColor={Value:1,Color:e},this.api&&!this._noApply){var i=new Asc.asc_TextArtProperties,n=new Asc.asc_CShapeFill;"transparent"==this.ShapeColor.Color?(n.put_type(Asc.c_oAscFill.FILL_TYPE_NOFILL),n.put_fill(null)):(n.put_type(Asc.c_oAscFill.FILL_TYPE_SOLID),n.put_fill(new Asc.asc_CFillSolid),n.get_fill().put_color(Common.Utils.ThemeColor.getRgbColor(this.ShapeColor.Color))),i.asc_putFill(n),this.shapeprops.put_TextArtProperties(i),this.api.ShapeApply(this.shapeprops)}this.fireEvent("editcomplete",this)},onPatternSelect:function(t,e){if(this.api&&!this._noApply){this.PatternFillType=e.get("type");var i=new Asc.asc_TextArtProperties,n=new Asc.asc_CShapeFill;n.put_type(Asc.c_oAscFill.FILL_TYPE_PATT),n.put_fill(new Asc.asc_CFillHatch),n.get_fill().put_pattern_type(this.PatternFillType),this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_PATT&&(n.get_fill().put_color_fg(Common.Utils.ThemeColor.getRgbColor(this.FGColor.Color)),n.get_fill().put_color_bg(Common.Utils.ThemeColor.getRgbColor(this.BGColor.Color))),i.asc_putFill(n),this.shapeprops.put_TextArtProperties(i),this.api.ShapeApply(this.shapeprops)}this.fireEvent("editcomplete",this)},onColorsFGSelect:function(t,e){if(this.FGColor={Value:1,Color:e},this.api&&!this._noApply){var i=new Asc.asc_TextArtProperties,n=new Asc.asc_CShapeFill;n.put_type(Asc.c_oAscFill.FILL_TYPE_PATT),n.put_fill(new Asc.asc_CFillHatch),n.get_fill().put_color_fg(Common.Utils.ThemeColor.getRgbColor(this.FGColor.Color)),this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_PATT&&(n.get_fill().put_pattern_type(this.PatternFillType),n.get_fill().put_color_bg(Common.Utils.ThemeColor.getRgbColor(this.BGColor.Color))),i.asc_putFill(n),this.shapeprops.put_TextArtProperties(i),this.api.ShapeApply(this.shapeprops)} -this.fireEvent("editcomplete",this)},onColorsBGSelect:function(t,e){if(this.BGColor={Value:1,Color:e},this.api&&!this._noApply){var i=new Asc.asc_TextArtProperties,n=new Asc.asc_CShapeFill;n.put_type(Asc.c_oAscFill.FILL_TYPE_PATT),n.put_fill(new Asc.asc_CFillHatch),this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_PATT&&(n.get_fill().put_pattern_type(this.PatternFillType),n.get_fill().put_color_fg(Common.Utils.ThemeColor.getRgbColor(this.FGColor.Color))),n.get_fill().put_color_bg(Common.Utils.ThemeColor.getRgbColor(this.BGColor.Color)),i.asc_putFill(n),this.shapeprops.put_TextArtProperties(i),this.api.ShapeApply(this.shapeprops)}this.fireEvent("editcomplete",this)},onFillTypeSelect:function(t,e){if(this.BlipFillType=e.value,this.api&&!0!==this._fromTextureCmb&&this.OriginalFillType==Asc.c_oAscFill.FILL_TYPE_BLIP){var i=new Asc.asc_TextArtProperties,n=new Asc.asc_CShapeFill;n.put_type(Asc.c_oAscFill.FILL_TYPE_BLIP),n.put_fill(new Asc.asc_CFillBlip),n.get_fill().put_type(this.BlipFillType),i.asc_putFill(n),this.shapeprops.put_TextArtProperties(i),this.api.ShapeApply(this.shapeprops)}this.fireEvent("editcomplete",this)},onNumTransparencyChange:function(t,e,i,n){if(this.sldrTransparency.setValue(t.getNumberValue(),!0),this.api){var o=t.getNumberValue(),s=new Asc.asc_TextArtProperties,a=new Asc.asc_CShapeFill;a.put_transparent(2.55*o),s.asc_putFill(a),this.shapeprops.put_TextArtProperties(s),this.api.ShapeApply(this.shapeprops)}},onTransparencyChange:function(t,e,n){this._sliderChanged=e,this.numTransparency.setValue(e,!0),this._sendUndoPoint&&(this.api.setStartPointHistory(),this._sendUndoPoint=!1,this.updateslider=setInterval(i.bind(this._transparencyApplyFunc,this),100))},onTransparencyChangeComplete:function(t,e,i){clearInterval(this.updateslider),this._sliderChanged=e,this._sendUndoPoint||(this.api.setEndPointHistory(),this._transparencyApplyFunc()),this._sendUndoPoint=!0},_transparencyApplyFunc:function(){if(void 0!==this._sliderChanged){var t=new Asc.asc_TextArtProperties,e=new Asc.asc_CShapeFill;e.put_transparent(2.55*this._sliderChanged),t.asc_putFill(e),this.shapeprops.put_TextArtProperties(t),this.api.ShapeApply(this.shapeprops),this._sliderChanged=void 0}},onGradTypeSelect:function(t,e){if(this.GradFillType=e.value,this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR){this.mnuDirectionPicker.store.reset(this._viewDataLinear),this.mnuDirectionPicker.cmpEl.width(175),this.mnuDirectionPicker.restoreHeight=174;var e=this.mnuDirectionPicker.store.findWhere({type:this.GradLinearDirectionType});this.mnuDirectionPicker.selectRecord(e,!0),e?this.btnDirection.setIconCls("item-gradient "+e.get("iconcls")):this.btnDirection.setIconCls(""),this.numGradientAngle.setValue(this.GradLinearDirectionType,!0),this.numGradientAngle.setDisabled(this._locked)}else this.GradFillType==Asc.c_oAscFillGradType.GRAD_PATH&&(this.mnuDirectionPicker.store.reset(this._viewDataRadial),this.mnuDirectionPicker.cmpEl.width(60),this.mnuDirectionPicker.restoreHeight=58,this.mnuDirectionPicker.selectByIndex(this.GradRadialDirectionIdx,!0),this.GradRadialDirectionIdx>=0?this.btnDirection.setIconCls("item-gradient "+this._viewDataRadial[this.GradRadialDirectionIdx].iconcls):this.btnDirection.setIconCls(""),this.numGradientAngle.setValue(0,!0),this.numGradientAngle.setDisabled(!0));if(this.api&&!this._noApply){var i=new Asc.asc_TextArtProperties,n=new Asc.asc_CShapeFill;n.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD),n.put_fill(new Asc.asc_CFillGrad),n.get_fill().put_grad_type(this.GradFillType),this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR&&(n.get_fill().put_linear_angle(6e4*this.GradLinearDirectionType),n.get_fill().put_linear_scale(!0)),i.asc_putFill(n),this.shapeprops.put_TextArtProperties(i),this.api.ShapeApply(this.shapeprops)}this.fireEvent("editcomplete",this)},onSelectGradient:function(t,e,n,o){if(!this._noApply){var s={};if(i.isFunction(o.toJSON)){if(!o.get("selected"))return;s=o.toJSON()}else s=o;if(this.btnDirection.setIconCls("item-gradient "+s.iconcls),this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR?this.GradLinearDirectionType=s.type:this.GradRadialDirectionIdx=0,this.api&&this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR){this.numGradientAngle.setValue(s.type,!0);var a=new Asc.asc_TextArtProperties,l=new Asc.asc_CShapeFill;l.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD),l.put_fill(new Asc.asc_CFillGrad),l.get_fill().put_grad_type(this.GradFillType),l.get_fill().put_linear_angle(6e4*s.type),l.get_fill().put_linear_scale(!0),a.asc_putFill(l),this.shapeprops.put_TextArtProperties(a),this.api.ShapeApply(this.shapeprops)}this.fireEvent("editcomplete",this)}},onColorsGradientSelect:function(t,e){if(this.GradColor.colors[this.GradColor.currentIdx]=e,this.sldrGradient.setColorValue(Common.Utils.String.format("#{0}","object"==typeof e?e.color:e)),this.api&&!this._noApply){var i=new Asc.asc_TextArtProperties,n=new Asc.asc_CShapeFill;n.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD),n.put_fill(new Asc.asc_CFillGrad),n.get_fill().put_grad_type(this.GradFillType);var o=[];this.GradColor.colors.forEach(function(t){o.push(Common.Utils.ThemeColor.getRgbColor(t))}),n.get_fill().put_colors(o),this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_GRAD&&(this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR&&(n.get_fill().put_linear_angle(6e4*this.GradLinearDirectionType),n.get_fill().put_linear_scale(!0)),o=[],this.GradColor.values.forEach(function(t){o.push(1e3*t)}),n.get_fill().put_positions(o)),i.asc_putFill(n),this.shapeprops.put_TextArtProperties(i),this.api.ShapeApply(this.shapeprops)}this.fireEvent("editcomplete",this)},onGradientChange:function(t,e,n){this.GradColor.values=t.getValues(),this.spnGradPosition.setValue(this.GradColor.values[this.GradColor.currentIdx],!0),this._sliderChanged=!0,this.api&&!this._noApply&&this._sendUndoPoint&&(this.api.setStartPointHistory(),this._sendUndoPoint=!1,this.updateslider=setInterval(i.bind(this._gradientApplyFunc,this),100))},onGradientChangeComplete:function(t,e,i){clearInterval(this.updateslider),this._sliderChanged=!0,this._sendUndoPoint||(this.api.setEndPointHistory(),this._gradientApplyFunc()),this._sendUndoPoint=!0},_gradientApplyFunc:function(){if(this._sliderChanged){var t=new Asc.asc_TextArtProperties,e=new Asc.asc_CShapeFill;e.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD),e.put_fill(new Asc.asc_CFillGrad),e.get_fill().put_grad_type(this.GradFillType);var i=[];this.GradColor.values.forEach(function(t){i.push(1e3*t)}),e.get_fill().put_positions(i),this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_GRAD&&(this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR&&(e.get_fill().put_linear_angle(6e4*this.GradLinearDirectionType),e.get_fill().put_linear_scale(!0)),i=[],this.GradColor.colors.forEach(function(t){i.push(Common.Utils.ThemeColor.getRgbColor(t))}),e.get_fill().put_colors(i)),t.asc_putFill(e),this.shapeprops.put_TextArtProperties(t),this.api.ShapeApply(this.shapeprops),this._sliderChanged=!1}},applyBorderSize:function(t){if(t=Common.Utils.String.parseFloat(t),t=isNaN(t)?0:Math.max(0,Math.min(1584,t)),this.BorderSize=t,this.api&&!this._noApply){var e=new Asc.asc_TextArtProperties,i=new Asc.asc_CStroke;this.BorderSize<1e-5?(i.put_type(Asc.c_oAscStrokeType.STROKE_NONE),this._state.StrokeType=this._state.StrokeWidth=-1):(i.put_type(Asc.c_oAscStrokeType.STROKE_COLOR),"transparent"==this.BorderColor.Color||"transparent"==this.BorderColor.Color.color?i.put_color(Common.Utils.ThemeColor.getRgbColor({color:"000000",effectId:29})):this._state.StrokeType!=Asc.c_oAscStrokeType.STROKE_NONE&&null!==this._state.StrokeType||i.put_color(Common.Utils.ThemeColor.getRgbColor(Common.Utils.ThemeColor.colorValue2EffectId(this.BorderColor.Color))),i.asc_putPrstDash(this.BorderType),i.put_width(this._pt2mm(this.BorderSize))),e.asc_putLine(i),this.shapeprops.put_TextArtProperties(e),this.api.ShapeApply(this.shapeprops)}this.fireEvent("editcomplete",this)},onComboBlur:function(){this.fireEvent("editcomplete",this)},onBorderSizeChanged:function(t,e,n,o){var s=this;if(t){var a=parseFloat(n.value);(!new RegExp("^\\s*(\\d*(\\.|,)?\\d+)\\s*("+s.txtPt+")?\\s*$").exec(n.value)||a<0||a>1584)&&(this._state.StrokeType=this._state.StrokeWidth=-1,Common.UI.error({msg:this.textBorderSizeErr,callback:function(){i.defer(function(t){s.fireEvent("editcomplete",s)})}}))}else this.applyBorderSize(n.value)},onBorderSizeSelect:function(t,e){this.applyBorderSize(e.value)},onBorderTypeSelect:function(t,e){if(this.BorderType=e.value,this.api&&!this._noApply){var i=new Asc.asc_TextArtProperties,n=new Asc.asc_CStroke;this.BorderSize<1e-5?n.put_type(Asc.c_oAscStrokeType.STROKE_NONE):(n.put_type(Asc.c_oAscStrokeType.STROKE_COLOR),n.put_color(Common.Utils.ThemeColor.getRgbColor(this.BorderColor.Color)),n.put_width(this._pt2mm(this.BorderSize)),n.asc_putPrstDash(this.BorderType)),i.asc_putLine(n),this.shapeprops.put_TextArtProperties(i),this.api.ShapeApply(this.shapeprops)}this.fireEvent("editcomplete",this)},onColorsBorderSelect:function(t,e){if(this.BorderColor={Value:1,Color:e},this.api&&this.BorderSize>0&&!this._noApply){var i=new Asc.asc_TextArtProperties,n=new Asc.asc_CStroke;this.BorderSize<1e-5?n.put_type(Asc.c_oAscStrokeType.STROKE_NONE):(n.put_type(Asc.c_oAscStrokeType.STROKE_COLOR),n.put_color(Common.Utils.ThemeColor.getRgbColor(this.BorderColor.Color)),n.put_width(this._pt2mm(this.BorderSize)),n.asc_putPrstDash(this.BorderType)),i.asc_putLine(n),this.shapeprops.put_TextArtProperties(i),this.api.ShapeApply(this.shapeprops)}this.fireEvent("editcomplete",this)},insertFromUrl:function(){var t=this;new Common.Views.ImageFromUrlDialog({handler:function(e,n){if("ok"==e&&t.api){var o=n.replace(/ /g,"");if(!i.isEmpty(o)&&null!==t.BlipFillType){var s=new Asc.asc_TextArtProperties,a=new Asc.asc_CShapeFill;a.put_type(Asc.c_oAscFill.FILL_TYPE_BLIP),a.put_fill(new Asc.asc_CFillBlip),a.get_fill().put_type(t.BlipFillType),a.get_fill().put_url(o),s.asc_putFill(a),t.shapeprops.put_TextArtProperties(s),t.api.ShapeApply(t.shapeprops)}}t.fireEvent("editcomplete",t)}}).show()},ChangeSettings:function(t){if(null==this.shapeprops&&(this.shapeprops=new Asc.asc_CShapeProperty),this._initSettings&&this.createDelayedElements(),t&&t.get_TextArtProperties()){var n=t.get_TextArtProperties();this._noApply=!0,this.disableControls(this._locked);var o=null,s=n.asc_getFill(),a=s?s.get_type():null,l=null;if(s){var r=s.get_transparent();(Math.abs(this._state.Transparency-r)>.001||Math.abs(this.numTransparency.getNumberValue()-r)>.001||(null===this._state.Transparency||null===r)&&(this._state.Transparency!==r||this.numTransparency.getNumberValue()!==r))&&(void 0!==r&&(this.sldrTransparency.setValue(null===r?100:r/255*100,!0),this.numTransparency.setValue(this.sldrTransparency.getValue(),!0)),this._state.Transparency=r)}if(null===s||void 0===s||null===a)this.OriginalFillType=null;else if(a==Asc.c_oAscFill.FILL_TYPE_NOFILL)this.OriginalFillType=Asc.c_oAscFill.FILL_TYPE_NOFILL;else if(a==Asc.c_oAscFill.FILL_TYPE_SOLID)s=s.get_fill(),l=s.get_color(),l?l.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?this.ShapeColor={Value:1,Color:{color:Common.Utils.ThemeColor.getHexColor(l.get_r(),l.get_g(),l.get_b()),effectValue:l.get_value()}}:this.ShapeColor={Value:1,Color:Common.Utils.ThemeColor.getHexColor(l.get_r(),l.get_g(),l.get_b())}:this.ShapeColor={Value:0,Color:"transparent"},this.OriginalFillType=Asc.c_oAscFill.FILL_TYPE_SOLID,this.FGColor="transparent"!==this.ShapeColor.Color?{Value:1,Color:Common.Utils.ThemeColor.colorValue2EffectId(this.ShapeColor.Color)}:{Value:1,Color:"000000"},this.BGColor={Value:1,Color:"ffffff"},this.GradColor.colors[0]="transparent"!==this.ShapeColor.Color?Common.Utils.ThemeColor.colorValue2EffectId(this.ShapeColor.Color):"000000",this.GradColor.colors[this.GradColor.colors.length-1]="ffffff";else if(a==Asc.c_oAscFill.FILL_TYPE_BLIP)s=s.get_fill(),this.BlipFillType=s.get_type(),this._state.BlipFillType!==this.BlipFillType&&(this.BlipFillType==Asc.c_oAscFillBlipType.STRETCH||this.BlipFillType==Asc.c_oAscFillBlipType.TILE?this.cmbFillType.setValue(this.BlipFillType):this.cmbFillType.setValue(""),this._state.BlipFillType=this.BlipFillType),this.OriginalFillType=Asc.c_oAscFill.FILL_TYPE_BLIP;else if(a==Asc.c_oAscFill.FILL_TYPE_PATT){if(s=s.get_fill(),this.PatternFillType=s.get_pattern_type(),this._state.PatternFillType!==this.PatternFillType){this.cmbPattern.suspendEvents();var o=this.cmbPattern.menuPicker.store.findWhere({type:this.PatternFillType});this.cmbPattern.menuPicker.selectRecord(o),this.cmbPattern.resumeEvents(),this._state.PatternFillType=this.PatternFillType}l=s.get_color_fg(),l?l.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?this.FGColor={Value:1,Color:{color:Common.Utils.ThemeColor.getHexColor(l.get_r(),l.get_g(),l.get_b()),effectValue:l.get_value()}}:this.FGColor={Value:1,Color:Common.Utils.ThemeColor.getHexColor(l.get_r(),l.get_g(),l.get_b())}:this.FGColor={Value:1,Color:"000000"},l=s.get_color_bg(),l?l.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?this.BGColor={Value:1,Color:{color:Common.Utils.ThemeColor.getHexColor(l.get_r(),l.get_g(),l.get_b()),effectValue:l.get_value()}}:this.BGColor={Value:1,Color:Common.Utils.ThemeColor.getHexColor(l.get_r(),l.get_g(),l.get_b())}:this.BGColor={Value:1,Color:"ffffff"},this.OriginalFillType=Asc.c_oAscFill.FILL_TYPE_PATT,this.ShapeColor={Value:1,Color:Common.Utils.ThemeColor.colorValue2EffectId(this.FGColor.Color)},this.GradColor.colors[0]=Common.Utils.ThemeColor.colorValue2EffectId(this.FGColor.Color),this.GradColor.colors[this.GradColor.colors.length-1]="ffffff"}else if(a==Asc.c_oAscFill.FILL_TYPE_GRAD){s=s.get_fill();var c=s.get_grad_type();if(this._state.GradFillType===c&&this.GradFillType===c||(this.GradFillType=c,o=void 0,this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR||this.GradFillType==Asc.c_oAscFillGradType.GRAD_PATH?(this.cmbGradType.setValue(this.GradFillType),o=this.cmbGradType.store.findWhere({value:this.GradFillType}),this.onGradTypeSelect(this.cmbGradType,o.attributes)):(this.cmbGradType.setValue(""),this.btnDirection.setIconCls("")),this._state.GradFillType=this.GradFillType),this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR){var d=Math.floor(s.get_linear_angle()/6e4);if(Math.abs(this.GradLinearDirectionType-d)>.001){this.GradLinearDirectionType=d;var h=this.mnuDirectionPicker.store.findWhere({type:d});this.mnuDirectionPicker.selectRecord(h,!0),h?this.btnDirection.setIconCls("item-gradient "+h.get("iconcls")):this.btnDirection.setIconCls(""),this.numGradientAngle.setValue(d,!0)}}else this.numGradientAngle.setValue(0,!0);var p=this,u=s.get_colors(),m=s.get_positions(),g=u?u.length:this.GradColor.colors.length;this.sldrGradient.setThumbs(g),this.GradColor.colors.length>g&&(this.GradColor.colors.splice(g,this.GradColor.colors.length-g),this.GradColor.values.splice(g,this.GradColor.colors.length-g),this.GradColor.currentIdx=0),u&&u.forEach(function(t,e){t?t.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?(p.GradColor.colors[e]={color:Common.Utils.ThemeColor.getHexColor(t.get_r(),t.get_g(),t.get_b()),effectValue:t.get_value()},Common.Utils.ThemeColor.colorValue2EffectId(p.GradColor.colors[e])):p.GradColor.colors[e]=Common.Utils.ThemeColor.getHexColor(t.get_r(),t.get_g(),t.get_b()):p.GradColor.colors[e]="000000";var i=m[e];null!==i&&(i/=1e3,p.GradColor.values[e]=i)});for(var f=0;f=this.GradColor.colors.length)&&(p.GradColor.currentIdx=0),p.sldrGradient.setActiveThumb(p.GradColor.currentIdx),this.spnGradPosition.setValue(this.GradColor.values[this.GradColor.currentIdx]),this.OriginalFillType=Asc.c_oAscFill.FILL_TYPE_GRAD,this.FGColor={Value:1,Color:this.GradColor.colors[0]},this.BGColor={Value:1,Color:"ffffff"},this.ShapeColor={Value:1,Color:this.GradColor.colors[0]}}this._state.FillType!==this.OriginalFillType&&(this.cmbFillSrc.setValue(null===this.OriginalFillType?"":this.OriginalFillType),this._state.FillType=this.OriginalFillType,this.ShowHideElem(this.OriginalFillType)),e(this.btnTexture.el).find(".form-control").prop("innerHTML",this.textSelectTexture);var b=typeof this.ShapeColor.Color,C=typeof this._state.ShapeColor;if(b!==C||"object"==b&&(this.ShapeColor.Color.effectValue!==this._state.ShapeColor.effectValue||this._state.ShapeColor.color.indexOf(this.ShapeColor.Color.color)<0)||"object"!=b&&this._state.ShapeColor.indexOf(this.ShapeColor.Color)<0){if(this.btnBackColor.setColor(this.ShapeColor.Color),"object"==typeof this.ShapeColor.Color){for(var v=!1,_=0;_<10;_++)if(Common.Utils.ThemeColor.ThemeValues[_]==this.ShapeColor.Color.effectValue){this.colorsBack.select(this.ShapeColor.Color,!0),v=!0;break}v||this.colorsBack.clearSelection()}else this.colorsBack.select(this.ShapeColor.Color,!0);this._state.ShapeColor=this.ShapeColor.Color}var y,w=n.asc_getLine(),x=w?w.get_type():null,S="transparent"==this._state.StrokeColor&&"transparent"!==this.BorderColor.Color;if(w?(x==Asc.c_oAscStrokeType.STROKE_COLOR?(l=w.get_color(),l?l.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?this.BorderColor={Value:1,Color:{color:Common.Utils.ThemeColor.getHexColor(l.get_r(),l.get_g(),l.get_b()),effectValue:l.get_value()}}:this.BorderColor={Value:1,Color:Common.Utils.ThemeColor.getHexColor(l.get_r(),l.get_g(),l.get_b())}:this.BorderColor={Value:1,Color:"transparent"}):this.BorderColor={Value:1,Color:"transparent"},y=w.asc_getPrstDash()):this.BorderColor={Value:0,Color:"transparent"},b=typeof this.BorderColor.Color,C=typeof this._state.StrokeColor,S||b!==C||"object"==b&&(this.BorderColor.Color.effectValue!==this._state.StrokeColor.effectValue||this._state.StrokeColor.color.indexOf(this.BorderColor.Color.color)<0)||"object"!=b&&(this._state.StrokeColor.indexOf(this.BorderColor.Color)<0||"object"==typeof this.btnBorderColor.color)){if(this.btnBorderColor.setColor(this.BorderColor.Color),"object"==typeof this.BorderColor.Color){for(var v=!1,_=0;_<10;_++)if(Common.Utils.ThemeColor.ThemeValues[_]==this.BorderColor.Color.effectValue){this.colorsBorder.select(this.BorderColor.Color,!0),v=!0;break}v||this.colorsBorder.clearSelection()}else this.colorsBorder.select(this.BorderColor.Color,!0);this._state.StrokeColor=this.BorderColor.Color}if(this._state.StrokeType!==x||x==Asc.c_oAscStrokeType.STROKE_COLOR){if(x==Asc.c_oAscStrokeType.STROKE_COLOR){var A=w.get_width(),T=Math.abs(this._state.StrokeWidth-A)<1e-5&&!new RegExp(this.txtPt+"\\s*$").test(this.cmbBorderSize.getRawValue());if(Math.abs(this._state.StrokeWidth-A)>1e-5||T||(null===this._state.StrokeWidth||null===A)&&this._state.StrokeWidth!==A){this._state.StrokeWidth=A,null!==A&&(A=this._mm2pt(A));var k=null===A?A:i.find(this.cmbBorderSize.store.models,function(t){if(At.attributes.value-1e-5)return!0});k?this.cmbBorderSize.selectRecord(k):this.cmbBorderSize.setValue(null!==A?parseFloat(A.toFixed(2))+" "+this.txtPt:""),this.BorderSize=A}}else x==Asc.c_oAscStrokeType.STROKE_NONE?(this._state.StrokeWidth=0,this.BorderSize=this.cmbBorderSize.store.at(0).get("value"),this.cmbBorderSize.setValue(this.BorderSize)):(this._state.StrokeWidth=null,this.BorderSize=-1,this.cmbBorderSize.setValue(null));this._state.StrokeType=x}if(this._state.StrokeBorderType!==y&&(this.BorderType=this._state.StrokeBorderType=y,this.cmbBorderType.setValue(y)),b=typeof this.FGColor.Color,C=typeof this._state.FGColor,b!==C||"object"==b&&(this.FGColor.Color.effectValue!==this._state.FGColor.effectValue||this._state.FGColor.color.indexOf(this.FGColor.Color.color)<0)||"object"!=b&&this._state.FGColor.indexOf(this.FGColor.Color)<0){if(this.btnFGColor.setColor(this.FGColor.Color),"object"==typeof this.FGColor.Color){for(var v=!1,_=0;_<10;_++)if(Common.Utils.ThemeColor.ThemeValues[_]==this.FGColor.Color.effectValue){this.colorsFG.select(this.FGColor.Color,!0),v=!0;break}v||this.colorsFG.clearSelection()}else this.colorsFG.select(this.FGColor.Color,!0);this._state.FGColor=this.FGColor.Color}if(b=typeof this.BGColor.Color,C=typeof this._state.BGColor,b!==C||"object"==b&&(this.BGColor.Color.effectValue!==this._state.BGColor.effectValue||this._state.BGColor.color.indexOf(this.BGColor.Color.color)<0)||"object"!=b&&this._state.BGColor.indexOf(this.BGColor.Color)<0){if(this.btnBGColor.setColor(this.BGColor.Color),"object"==typeof this.BGColor.Color){for(var v=!1,_=0;_<10;_++)if(Common.Utils.ThemeColor.ThemeValues[_]==this.BGColor.Color.effectValue){this.colorsBG.select(this.BGColor.Color,!0),v=!0;break}v||this.colorsBG.clearSelection()}else this.colorsBG.select(this.BGColor.Color,!0);this._state.BGColor=this.BGColor.Color}if(l=this.GradColor.colors[this.GradColor.currentIdx],b=typeof l,C=typeof this._state.GradColor,b!==C||"object"==b&&(l.effectValue!==this._state.GradColor.effectValue||this._state.GradColor.color.indexOf(l.color)<0)||"object"!=b&&this._state.GradColor.indexOf(l)<0){if(this.btnGradColor.setColor(l),"object"==typeof l){for(var v=!1,_=0;_<10;_++)if(Common.Utils.ThemeColor.ThemeValues[_]==l.effectValue){this.colorsGrad.select(l,!0),v=!0;break}v||this.colorsGrad.clearSelection()}else this.colorsGrad.select(l,!0);this._state.GradColor=l}var I=n.asc_getForm();if(this._state.FormId!==I){this.cmbTransform.suspendEvents();var o=this.cmbTransform.menuPicker.store.findWhere({type:I});this.cmbTransform.menuPicker.selectRecord(o),this.cmbTransform.resumeEvents(),this._state.FormId=I}this._noApply=!1}},createDelayedControls:function(){var t=this;this._arrFillSrc=[{displayValue:this.textColor,value:Asc.c_oAscFill.FILL_TYPE_SOLID},{displayValue:this.textGradientFill,value:Asc.c_oAscFill.FILL_TYPE_GRAD},{displayValue:this.textImageTexture,value:Asc.c_oAscFill.FILL_TYPE_BLIP},{displayValue:this.textPatternFill,value:Asc.c_oAscFill.FILL_TYPE_PATT},{displayValue:this.textNoFill,value:Asc.c_oAscFill.FILL_TYPE_NOFILL}],this.cmbFillSrc=new Common.UI.ComboBox({el:e("#textart-combo-fill-src"),cls:"input-group-nr",style:"width: 100%;",menuStyle:"min-width: 100%;",editable:!1,data:this._arrFillSrc}),this.cmbFillSrc.setValue(this._arrFillSrc[0].value),this.cmbFillSrc.on("selected",i.bind(this.onFillSrcSelect,this)),this.lockedControls.push(this.cmbFillSrc),this.cmbPattern=new Common.UI.ComboDataView({itemWidth:28,itemHeight:28,menuMaxHeight:300,enableKeyEvents:!0,cls:"combo-pattern"}),this.cmbPattern.menuPicker.itemTemplate=this.cmbPattern.fieldPicker.itemTemplate=i.template(['
    ','',"
    "].join("")),this.cmbPattern.render(e("#textart-combo-pattern")),this.cmbPattern.openButton.menu.cmpEl.css({"min-width":178,"max-width":178}),this.cmbPattern.on("click",i.bind(this.onPatternSelect,this)),this.cmbPattern.openButton.menu.on("show:after",function(){t.cmbPattern.menuPicker.scroller.update({alwaysVisibleY:!0})}),this.lockedControls.push(this.cmbPattern),this.btnInsertFromFile=new Common.UI.Button({el:e("#textart-button-from-file")}),this.lockedControls.push(this.btnInsertFromFile),this.btnInsertFromUrl=new Common.UI.Button({el:e("#textart-button-from-url")}),this.lockedControls.push(this.btnInsertFromUrl),this.btnInsertFromFile.on("click",i.bind(function(t){this.api&&this.api.ChangeArtImageFromFile(this.BlipFillType),this.fireEvent("editcomplete",this)},this)),this.btnInsertFromUrl.on("click",i.bind(this.insertFromUrl,this)),this._arrFillType=[{displayValue:this.textStretch,value:Asc.c_oAscFillBlipType.STRETCH},{displayValue:this.textTile,value:Asc.c_oAscFillBlipType.TILE}],this.cmbFillType=new Common.UI.ComboBox({el:e("#textart-combo-fill-type"),cls:"input-group-nr",menuStyle:"min-width: 90px;",editable:!1,data:this._arrFillType}),this.cmbFillType.setValue(this._arrFillType[0].value),this.cmbFillType.on("selected",i.bind(this.onFillTypeSelect,this)),this.lockedControls.push(this.cmbFillType),this.numTransparency=new Common.UI.MetricSpinner({el:e("#textart-spin-transparency"),step:1,width:62,value:"100 %",defaultUnit:"%",maxValue:100,minValue:0}),this.numTransparency.on("change",i.bind(this.onNumTransparencyChange,this)),this.numTransparency.on("inputleave",function(){t.fireEvent("editcomplete",t)}),this.lockedControls.push(this.numTransparency),this.sldrTransparency=new Common.UI.SingleSlider({el:e("#textart-slider-transparency"),width:75,minValue:0,maxValue:100,value:100}),this.sldrTransparency.on("change",i.bind(this.onTransparencyChange,this)),this.sldrTransparency.on("changecomplete",i.bind(this.onTransparencyChangeComplete,this)),this.lockedControls.push(this.sldrTransparency),this.lblTransparencyStart=e(this.el).find("#textart-lbl-transparency-start"),this.lblTransparencyEnd=e(this.el).find("#textart-lbl-transparency-end"),this._arrGradType=[{displayValue:this.textLinear,value:Asc.c_oAscFillGradType.GRAD_LINEAR},{displayValue:this.textRadial,value:Asc.c_oAscFillGradType.GRAD_PATH}],this.cmbGradType=new Common.UI.ComboBox({el:e("#textart-combo-grad-type"),cls:"input-group-nr",menuStyle:"min-width: 90px;",editable:!1,data:this._arrGradType}),this.cmbGradType.setValue(this._arrGradType[0].value),this.cmbGradType.on("selected",i.bind(this.onGradTypeSelect,this)),this.lockedControls.push(this.cmbGradType),this._viewDataLinear=[{offsetx:0,offsety:0,type:45,subtype:-1,iconcls:"gradient-left-top"},{offsetx:50,offsety:0,type:90,subtype:4,iconcls:"gradient-top"},{offsetx:100,offsety:0,type:135,subtype:5,iconcls:"gradient-right-top"},{offsetx:0,offsety:50,type:0,subtype:6,iconcls:"gradient-left",cls:"item-gradient-separator",selected:!0},{offsetx:100,offsety:50,type:180,subtype:1,iconcls:"gradient-right"},{offsetx:0,offsety:100,type:315,subtype:2,iconcls:"gradient-left-bottom"},{offsetx:50,offsety:100,type:270,subtype:3,iconcls:"gradient-bottom"},{offsetx:100,offsety:100,type:225,subtype:7,iconcls:"gradient-right-bottom"}],this._viewDataRadial=[{offsetx:100,offsety:150,type:2,subtype:5,iconcls:"gradient-radial-center"}],this.btnDirection=new Common.UI.Button({cls:"btn-large-dataview",iconCls:"item-gradient gradient-left",menu:new Common.UI.Menu({style:"min-width: 60px;",menuAlign:"tr-br",items:[{template:i.template('
    ')}]})}),this.btnDirection.on("render:after",function(n){t.mnuDirectionPicker=new Common.UI.DataView({el:e("#id-textart-menu-direction"),parentMenu:n.menu,restoreHeight:174,store:new Common.UI.DataViewStore(t._viewDataLinear),itemTemplate:i.template('
    ')})}),this.btnDirection.render(e("#textart-button-direction")),this.mnuDirectionPicker.on("item:click",i.bind(this.onSelectGradient,this,this.btnDirection)),this.lockedControls.push(this.btnDirection),this.sldrGradient=new Common.UI.MultiSliderGradient({el:e("#textart-slider-gradient"),width:192,minValue:0,maxValue:100,values:[0,100]}),this.sldrGradient.on("change",i.bind(this.onGradientChange,this)),this.sldrGradient.on("changecomplete",i.bind(this.onGradientChangeComplete,this)),this.sldrGradient.on("thumbclick",function(e,i){t.GradColor.currentIdx=i;var n=t.GradColor.colors[t.GradColor.currentIdx];t.btnGradColor.setColor(n),t.colorsGrad.select(n,!1);var o=t.GradColor.values[t.GradColor.currentIdx];t.spnGradPosition.setValue(o,!0)}),this.sldrGradient.on("thumbdblclick",function(e){t.btnGradColor.cmpEl.find("button").dropdown("toggle")}),this.sldrGradient.on("sortthumbs",function(e,n){var o,s=[];i.each(n,function(e,i){s.push(t.GradColor.colors[e]),t.GradColor.currentIdx==e&&(o=i)}),t.OriginalFillType=null,t.GradColor.colors=s,t.GradColor.currentIdx=o}),this.sldrGradient.on("addthumb",function(e,i,n){t.GradColor.colors[i]=t.GradColor.colors[t.GradColor.currentIdx],t.GradColor.currentIdx=i;var o=t.sldrGradient.addNewThumb(i,n);t.GradColor.colors[t.GradColor.currentIdx]=o}),this.sldrGradient.on("removethumb",function(e,n){if(t.sldrGradient.removeThumb(n),t.GradColor.values.splice(n,1),t.sldrGradient.changeGradientStyle(),i.isUndefined(t.GradColor.currentIdx)||t.GradColor.currentIdx>=t.GradColor.colors.length){var o=n>0?n-1:n;o=0===o&&t.GradColor.values.length>2?t.GradColor.values.length-2:o,t.GradColor.currentIdx=o}t.sldrGradient.setActiveThumb(t.GradColor.currentIdx)}),this.lockedControls.push(this.sldrGradient),this.spnGradPosition=new Common.UI.MetricSpinner({el:e("#textart-gradient-position"),step:1,width:60,defaultUnit:"%",value:"50 %",allowDecimal:!1,maxValue:100,minValue:0,disabled:this._locked}),this.lockedControls.push(this.spnGradPosition),this.spnGradPosition.on("change",i.bind(this.onPositionChange,this)),this.spnGradPosition.on("inputleave",function(){t.fireEvent("editcomplete",t)}),this.btnAddGradientStep=new Common.UI.Button({parentEl:e("#textart-gradient-add-step"),cls:"btn-toolbar",iconCls:"toolbar__icon btn-add-breakpoint",disabled:this._locked,hint:this.tipAddGradientPoint}),this.btnAddGradientStep.on("click",i.bind(this.onAddGradientStep,this)),this.lockedControls.push(this.btnAddGradientStep),this.btnRemoveGradientStep=new Common.UI.Button({parentEl:e("#textart-gradient-remove-step"),cls:"btn-toolbar",iconCls:"toolbar__icon btn-remove-breakpoint",disabled:this._locked,hint:this.tipRemoveGradientPoint}),this.btnRemoveGradientStep.on("click",i.bind(this.onRemoveGradientStep,this)),this.lockedControls.push(this.btnRemoveGradientStep),this.numGradientAngle=new Common.UI.MetricSpinner({el:e("#textart-spin-gradient-angle"),step:10,width:60,defaultUnit:"°",value:"0 °",allowDecimal:!0,maxValue:359.9,minValue:0,disabled:this._locked}),this.lockedControls.push(this.numGradientAngle),this.numGradientAngle.on("change",i.bind(this.onGradientAngleChange,this)),this.numGradientAngle.on("inputleave",function(){t.fireEvent("editcomplete",t)}),this.cmbBorderSize=new Common.UI.ComboBorderSizeEditable({el:e("#textart-combo-border-size"),style:"width: 93px;",txtNoBorders:this.txtNoBorders}).on("selected",i.bind(this.onBorderSizeSelect,this)).on("changed:before",i.bind(this.onBorderSizeChanged,this,!0)).on("changed:after",i.bind(this.onBorderSizeChanged,this,!1)).on("combo:blur",i.bind(this.onComboBlur,this,!1)),this.BorderSize=this.cmbBorderSize.store.at(2).get("value"),this.cmbBorderSize.setValue(this.BorderSize),this.lockedControls.push(this.cmbBorderSize),this.cmbBorderType=new Common.UI.ComboBorderType({el:e("#textart-combo-border-type"),style:"width: 93px;",menuStyle:"min-width: 93px;"}).on("selected",i.bind(this.onBorderTypeSelect,this)).on("combo:blur",i.bind(this.onComboBlur,this,!1)),this.BorderType=Asc.c_oDashType.solid,this.cmbBorderType.setValue(this.BorderType),this.lockedControls.push(this.cmbBorderType),this.cmbTransform=new Common.UI.ComboDataView({itemWidth:50,itemHeight:50,menuMaxHeight:300,enableKeyEvents:!0,cls:"combo-textart"}),this.cmbTransform.render(e("#textart-combo-transform")),this.cmbTransform.openButton.menu.cmpEl.css({"min-width":178,"max-width":178}),this.cmbTransform.on("click",i.bind(this.onTransformSelect,this)),this.cmbTransform.openButton.menu.on("show:after",function(){t.cmbTransform.menuPicker.scroller.update({alwaysVisibleY:!0})}),this.lockedControls.push(this.cmbTransform)},createDelayedElements:function(){this._initSettings=!1,this.createDelayedControls();var t=[0,1,3,2,4,53,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,22,23,24,25,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,49,50,51,52];this.patternViewData=[];for(var e=0;e<13;e++)for(var i=0;i<4;i++){var n=4*e+i;this.patternViewData[n]={offsetx:28*i,offsety:28*e,type:t[n]}}this.patternViewData.splice(this.patternViewData.length-2,2);for(var e=0;e0&&(this.cmbPattern.fillComboView(this.cmbPattern.menuPicker.store.at(0),!0),this.PatternFillType=this.patternViewData[0].type),this.UpdateThemeColors(),this.onInitStandartTextures(),this.fillTextArt(),this.fillTransform(this.api.asc_getPropertyEditorTextArts())},onInitStandartTextures:function(t){var n=this;if(t&&t.length>0&&(n._texturearray=[],i.each(t,function(t){n._texturearray.push({imageUrl:t.get_image(),name:n.textureNames[t.get_id()],type:t.get_id(),selected:!1})})),n._texturearray&&!(n._texturearray.length<1)&&!this._initSettings&&!this.btnTexture){this.btnTexture=new Common.UI.ComboBox({el:e("#textart-combo-fill-texture"),template:i.template(['"].join(""))}),this.textureMenu=new Common.UI.Menu({items:[{template:i.template('
    ')}]}),this.textureMenu.render(e("#textart-combo-fill-texture")),this.lockedControls.push(this.btnTexture);var o=function(t){new Common.UI.DataView({el:e("#id-textart-menu-texture"),restoreHeight:174,parentMenu:t,showLast:!1,store:new Common.UI.DataViewStore(n._texturearray||[]),itemTemplate:i.template('
    ')}).on("item:click",i.bind(n.onSelectTexture,n)),t.off("show:before",o)};this.textureMenu.on("show:before",o)}},onSelectTexture:function(t,i,n){if(this._fromTextureCmb=!0,this.cmbFillType.setValue(this._arrFillType[1].value),this._fromTextureCmb=!1,this.api){var o=new Asc.asc_TextArtProperties,s=new Asc.asc_CShapeFill;s.put_type(Asc.c_oAscFill.FILL_TYPE_BLIP),s.put_fill(new Asc.asc_CFillBlip),s.get_fill().put_type(Asc.c_oAscFillBlipType.TILE),s.get_fill().put_texture_id(n.get("type")),o.asc_putFill(s),this.shapeprops.put_TextArtProperties(o),this.api.ShapeApply(this.shapeprops)}e(this.btnTexture.el).find(".form-control").prop("innerHTML",n.get("name")),this.fireEvent("editcomplete",this)},fillTextArt:function(){if(!this._initSettings){var t=this;this.cmbTextArt||(this.cmbTextArt=new Common.UI.ComboDataView({itemWidth:50,itemHeight:50,menuMaxHeight:300,enableKeyEvents:!0,showLast:!1,cls:"combo-textart"}),this.cmbTextArt.render(e("#textart-combo-template")),this.cmbTextArt.openButton.menu.cmpEl.css({"min-width":178,"max-width":178}),this.cmbTextArt.on("click",i.bind(this.onTextArtSelect,this)),this.cmbTextArt.openButton.menu.on("show:after",function(){t.cmbTextArt.menuPicker.scroller.update({alwaysVisibleY:!0})}),this.lockedControls.push(this.cmbTextArt));var n=this.application.getCollection("Common.Collections.TextArt").models,o=this.cmbTextArt.menuPicker.store.length;if(n.length<1)return void PE.getController("Main").fillTextArt(this.api.asc_getTextArtPreviews());if(o>0&&o==n.length){var s=this.cmbTextArt.menuPicker.store.models;i.each(n,function(t,e){s[e].set("imageUrl",t.get("imageUrl"))})}else this.cmbTextArt.menuPicker.store.reset(n),this.cmbTextArt.menuPicker.store.length>0&&this.cmbTextArt.fillComboView(this.cmbTextArt.menuPicker.store.at(0))}},onTextArtSelect:function(t,e){if(this.api&&!this._noApply){var i=new Asc.asc_TextArtProperties;i.asc_putStyle(e.get("data")),this.shapeprops.put_TextArtProperties(i),this.api.ShapeApply(this.shapeprops)}this.fireEvent("editcomplete",this)},fillTransform:function(t){if(t&&t.length>1&&t[1]){for(var e=[],n=t[1],o=0;o0&&i.each(s,function(t){e.push({imageUrl:t.Image,type:t.Type,selected:!1})})}this.cmbTransform.menuPicker.store.add(e),this.cmbTransform.menuPicker.store.length>0&&this.cmbTransform.fillComboView(this.cmbTransform.menuPicker.store.at(0),!0)}},onTransformSelect:function(t,e){if(this.api&&!this._noApply){var i=new Asc.asc_TextArtProperties;i.asc_putForm(e.get("type")),this.shapeprops.put_TextArtProperties(i),this.api.ShapeApply(this.shapeprops)}this.fireEvent("editcomplete",this)},UpdateThemeColors:function(){this._initSettings||(this.btnBackColor||(this.btnBackColor=new Common.UI.ColorButton({parentEl:e("#textart-back-color-btn"),transparent:!0,color:"transparent"}),this.lockedControls.push(this.btnBackColor),this.colorsBack=this.btnBackColor.getPicker(),this.btnBackColor.on("color:select",i.bind(this.onColorsBackSelect,this)),this.btnFGColor=new Common.UI.ColorButton({parentEl:e("#textart-foreground-color-btn"),color:"000000"}),this.lockedControls.push(this.btnFGColor),this.colorsFG=this.btnFGColor.getPicker(),this.btnFGColor.on("color:select",i.bind(this.onColorsFGSelect,this)),this.btnBGColor=new Common.UI.ColorButton({parentEl:e("#textart-background-color-btn"),color:"ffffff"}),this.lockedControls.push(this.btnBGColor),this.colorsBG=this.btnBGColor.getPicker(),this.btnBGColor.on("color:select",i.bind(this.onColorsBGSelect,this)),this.btnGradColor=new Common.UI.ColorButton({parentEl:e("#textart-gradient-color-btn"),color:"000000"}),this.lockedControls.push(this.btnGradColor),this.colorsGrad=this.btnGradColor.getPicker(),this.btnGradColor.on("color:select",i.bind(this.onColorsGradientSelect,this)),this.btnBorderColor=new Common.UI.ColorButton({parentEl:e("#textart-border-color-btn"),color:"000000"}),this.lockedControls.push(this.btnBorderColor),this.colorsBorder=this.btnBorderColor.getPicker(),this.btnBorderColor.on("color:select",i.bind(this.onColorsBorderSelect,this))),this.colorsBorder.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors()),this.colorsBack.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors()),this.colorsFG.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors()),this.colorsBG.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors()),this.colorsGrad.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors()))},_pt2mm:function(t){return 25.4*t/72},_mm2pt:function(t){return 72*t/25.4},ShowHideElem:function(t){this.FillColorContainer.toggleClass("settings-hidden",t!==Asc.c_oAscFill.FILL_TYPE_SOLID),this.FillImageContainer.toggleClass("settings-hidden",t!==Asc.c_oAscFill.FILL_TYPE_BLIP),this.FillPatternContainer.toggleClass("settings-hidden",t!==Asc.c_oAscFill.FILL_TYPE_PATT),this.FillGradientContainer.toggleClass("settings-hidden",t!==Asc.c_oAscFill.FILL_TYPE_GRAD),this.TransparencyContainer.toggleClass("settings-hidden",t===Asc.c_oAscFill.FILL_TYPE_NOFILL||null===t)},setLocked:function(t){this._locked=t},disableControls:function(t){this._initSettings||this._state.DisabledControls!==t&&(this._state.DisabledControls=t,i.each(this.lockedControls,function(e){e.setDisabled(t)}),this.numGradientAngle.setDisabled(t||this.GradFillType!==Asc.c_oAscFillGradType.GRAD_LINEAR))},onPositionChange:function(t){var e=t.getNumberValue(),i=this.GradColor.currentIdx-1<0?0:this.GradColor.values[this.GradColor.currentIdx-1],n=this.GradColor.currentIdx+1n;if(this.api){this.GradColor.values[this.GradColor.currentIdx]=e;var s=new Asc.asc_TextArtProperties,a=new Asc.asc_CShapeFill;a.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD),a.put_fill(new Asc.asc_CFillGrad),a.get_fill().put_grad_type(this.GradFillType);var l=[];this.GradColor.values.forEach(function(t){l.push(1e3*t)}),a.get_fill().put_positions(l),s.asc_putFill(a),this.shapeprops.put_TextArtProperties(s),this.api.ShapeApply(this.shapeprops),o&&(this.sldrGradient.sortThumbs(),this.sldrGradient.trigger("change",this.sldrGradient),this.sldrGradient.trigger("changecomplete",this.sldrGradient))}},onAddGradientStep:function(){if(!(this.GradColor.colors.length>9)){var t=this.GradColor.currentIdx,e=(this.GradColor.values[t]+this.GradColor.values[t=this.GradColor.colors.length){var e=t>0?t-1:t;e=0===e&&this.GradColor.values.length>2?this.GradColor.values.length-2:e,this.GradColor.currentIdx=e}this.sldrGradient.setActiveThumb(this.GradColor.currentIdx),this.sldrGradient.trigger("change",this.sldrGradient),this.sldrGradient.trigger("changecomplete",this.sldrGradient)}},onGradientAngleChange:function(t,e,i,n){if(this.api&&!this._noApply){var o=new Asc.asc_TextArtProperties,s=new Asc.asc_CShapeFill;s.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD),s.put_fill(new Asc.asc_CFillGrad),s.get_fill().put_grad_type(this.GradFillType),s.get_fill().put_linear_angle(6e4*t.getNumberValue()),s.get_fill().put_linear_scale(!0),o.asc_putFill(s),this.shapeprops.put_TextArtProperties(o),this.api.ShapeApply(this.shapeprops)}},txtNoBorders:"No Line",strStroke:"Stroke",strColor:"Color",strSize:"Size",strFill:"Fill",textColor:"Color Fill",textImageTexture:"Picture or Texture",textTexture:"From Texture",textFromUrl:"From URL",textFromFile:"From File",textStretch:"Stretch",textTile:"Tile",txtCanvas:"Canvas",txtCarton:"Carton",txtDarkFabric:"Dark Fabric",txtGrain:"Grain",txtGranite:"Granite",txtGreyPaper:"Grey Paper",txtKnit:"Knit",txtLeather:"Leather",txtBrownPaper:"Brown Paper",txtPapyrus:"Papyrus",txtWood:"Wood",strTransparency:"Opacity",textNoFill:"No Fill",textSelectTexture:"Select",textGradientFill:"Gradient Fill",textPatternFill:"Pattern",strBackground:"Background color",strForeground:"Foreground color",strPattern:"Pattern",textEmptyPattern:"No Pattern",textLinear:"Linear",textRadial:"Radial",textDirection:"Direction",textStyle:"Style",textGradient:"Gradient Points",textBorderSizeErr:"The entered value is incorrect.
    Please enter a value between 0 pt and 1584 pt.",textTransform:"Transform",textTemplate:"Template",strType:"Type",textPosition:"Position",tipAddGradientPoint:"Add gradient point",tipRemoveGradientPoint:"Remove gradient point",textAngle:"Angle"},PE.Views.TextArtSettings||{}))}),define("text!presentationeditor/main/app/template/SignatureSettings.template",[],function(){return'\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
    \n \n
    \n
    \n
    \n \n
    \n
    \n
    \n \n
    '}),define("presentationeditor/main/app/view/SignatureSettings",["text!presentationeditor/main/app/template/SignatureSettings.template","jquery","underscore","backbone","common/main/lib/component/Button"],function(t,e,i,n){"use strict";PE.Views.SignatureSettings=n.View.extend(i.extend({el:"#id-signature-settings",template:i.template(t),events:{},options:{alias:"SignatureSettings"},initialize:function(){this._state={DisabledEditing:!1,ready:!1,hasValid:!1,hasInvalid:!1,tip:void 0},this._locked=!1,this.render()},render:function(){this.$el.html(this.template({scope:this}));var t=PE.getController("Common.Controllers.Protection").getView();this.btnAddInvisibleSign=t.getButton("signature"),this.btnAddInvisibleSign.render(this.$el.find("#signature-invisible-sign")),this.viewValidList=new Common.UI.DataView({el:e("#signature-valid-sign"),enableKeyEvents:!1,itemTemplate:i.template(['
    ','
    nomargin<% } %>">
    ','
    <%= Common.Utils.String.htmlEncode(name) %>
    ','
    <%= Common.Utils.String.htmlEncode(date) %>
    ',"
    "].join(""))}),this.viewInvalidList=new Common.UI.DataView({el:e("#signature-invalid-sign"),enableKeyEvents:!1,itemTemplate:i.template(['
    ','
    nomargin<% } %>">
    ','
    <%= Common.Utils.String.htmlEncode(name) %>
    ','
    <%= Common.Utils.String.htmlEncode(date) %>
    ',"
    "].join(""))}),this.viewValidList.on("item:click",i.bind(this.onSelectSignature,this)),this.viewInvalidList.on("item:click",i.bind(this.onSelectSignature,this)),this.viewValidList.on("item:contextmenu",i.bind(this.onItemContextMenu,this)),this.viewInvalidList.on("item:contextmenu",i.bind(this.onItemContextMenu,this)),this.signatureMenu=new Common.UI.Menu({menuAlign:"tr-br",items:[{caption:this.strDetails,value:1},{caption:this.strDelete,value:3}]}),this.signatureMenu.on("item:click",i.bind(this.onMenuSignatureClick,this))},setApi:function(t){return this.api=t,this.api&&this.api.asc_registerCallback("asc_onUpdateSignatures",i.bind(this.onApiUpdateSignatures,this)),Common.NotificationCenter.on("document:ready",i.bind(this.onDocumentReady,this)),this},ChangeSettings:function(t){this._state.hasValid||this._state.hasInvalid||this.updateSignatures(this.api.asc_getSignatures())},setLocked:function(t){this._locked=t},setMode:function(t){this.mode=t},onApiUpdateSignatures:function(t){this._state.ready&&(this.updateSignatures(t),this.showSignatureTooltip(this._state.hasValid,this._state.hasInvalid))},updateSignatures:function(t){var e=this,n=[],o=[];i.each(t,function(t,e){var s=t.asc_getDate(),a={name:t.asc_getSigner1(),certificateId:t.asc_getId(),guid:t.asc_getGuid(),date:i.isEmpty(s)?"":new Date(s).toLocaleString(),invisible:!t.asc_getVisible()};0==t.asc_getValid()?n.push(a):o.push(a)}),e._state.hasValid=n.length>0,e._state.hasInvalid=o.length>0,this.viewValidList.store.reset(n),this.viewInvalidList.store.reset(o),this.$el.find(".valid").toggleClass("hidden",!e._state.hasValid),this.$el.find(".invalid").toggleClass("hidden",!e._state.hasInvalid),e.disableEditing(e._state.hasValid||e._state.hasInvalid)},onItemContextMenu:function(t,n,o,s){var a=this.signatureMenu;a.isVisible()&&a.hide();var l=e(this.el).offset(),r=[s.clientX*Common.Utils.zoom()-l.left+5,s.clientY*Common.Utils.zoom()-l.top+5];this.showSignatureMenu(o,r),a.menuAlign="tl-bl",a.menuAlignEl=null,a.setOffset(15,5),a.show(),i.delay(function(){a.cmpEl.focus()},10)},onSelectSignature:function(t,n,o,s){if(o){var a=e(s.target);if(a&&a.hasClass("caret")){var l=this.signatureMenu;if(l.isVisible())return void l.hide();var r=e(s.currentTarget),c=r.offset(),d=e(this.el).offset(),h=[c.left-d.left+r.width(),c.top-d.top+r.height()/2];this.showSignatureMenu(o,h),l.menuAlign="tr-br",l.menuAlignEl=r,l.setOffset(-20,-r.height()/2+3),l.show(),i.delay(function(){l.cmpEl.focus()},10),s.stopPropagation(),s.preventDefault()}}},showSignatureMenu:function(t,i){this.api.asc_gotoSignature(t.get("guid"));var n=this.signatureMenu,o=e(this.el),s=o.find("#menu-signature-container");n.rendered||(s.length<1&&(s=e('',n.id),o.append(s)),n.render(s),n.cmpEl.attr({tabindex:"-1"}),n.on({"show:after":function(t){t&&t.menuAlignEl&&t.menuAlignEl.toggleClass("over",!0)},"hide:after":function(t){t&&t.menuAlignEl&&t.menuAlignEl.toggleClass("over",!1)}})),n.items[1].setDisabled(this._locked),n.items[0].cmpEl.attr("data-value",t.get("certificateId")),n.cmpEl.attr("data-value",t.get("guid")),s.css({left:i[0],top:i[1]})},onMenuSignatureClick:function(t,e){var i=t.cmpEl.attr("data-value");switch(e.value){case 1:this.api.asc_ViewCertificate(e.cmpEl.attr("data-value"));break;case 3:this.api.asc_RemoveSignature(i)}},onDocumentReady:function(){this._state.ready=!0,this.updateSignatures(this.api.asc_getSignatures(),this.api.asc_getRequestSignatures()),this.showSignatureTooltip(this._state.hasValid,this._state.hasInvalid)},showSignatureTooltip:function(t,e){var i=this,n=i._state.tip;if(!t&&!e)return void(n&&n.isVisible()&&(n.close(),i._state.tip=void 0));var o=t||e,s=e?i.txtSignedInvalid:t?i.txtSigned:"";n&&n.isVisible()&&(s!==n.text||o!==n.showLink)&&(n.close(),i._state.tip=void 0),i._state.tip||(n=new Common.UI.SynchronizeTip({target:PE.getController("RightMenu").getView("RightMenu").btnSignature.btnEl,text:s,showLink:o,textLink:this.txtContinueEditing,placement:"left"}),n.on({dontshowclick:function(){Common.UI.warning({title:i.notcriticalErrorTitle,msg:i.txtEditWarning,buttons:["ok","cancel"],primary:"ok",callback:function(t){"ok"==t&&(n.close(),i._state.tip=void 0,i.api.asc_RemoveAllSignatures())}})},closeclick:function(){n.close(),i._state.tip=void 0}}),i._state.tip=n,n.show())},disableEditing:function(t){if(this._state.DisabledEditing!=t){this._state.DisabledEditing=t;var e=PE.getController("RightMenu");t&&"id-signature-settings"!==e.rightmenu.GetActivePane()&&e.rightmenu.clearSelection(),e.SetDisabled(t,!0),PE.getController("Toolbar").DisableToolbar(t,t),PE.getController("Statusbar").getView("Statusbar").SetDisabled(t),PE.getController("Common.Controllers.ReviewChanges").SetDisabled(t),PE.getController("DocumentHolder").getView("DocumentHolder").SetDisabled(t),PE.getController("LeftMenu").setPreviewMode(t);var i=PE.getController("Common.Controllers.Comments");i&&i.setPreviewMode(t)}},strSignature:"Signature",strValid:"Valid signatures",strInvalid:"Invalid signatures",strDetails:"Signature Details",txtSigned:"Valid signatures has been added to the presentation. The presentation is protected from editing.",txtSignedInvalid:"Some of the digital signatures in presentation are invalid or could not be verified. The presentation is protected from editing.",txtContinueEditing:"Edit anyway",notcriticalErrorTitle:"Warning",txtEditWarning:"Editing will remove the signatures from the presentation.
    Are you sure you want to continue?",strDelete:"Remove Signature"},PE.Views.SignatureSettings||{}))});var SCALE_MIN=40,MENU_SCALE_PART=260;if(define("presentationeditor/main/app/view/RightMenu",["text!presentationeditor/main/app/template/RightMenu.template","jquery","underscore","backbone","common/main/lib/component/Button","common/main/lib/component/MetricSpinner","common/main/lib/component/CheckBox","presentationeditor/main/app/view/ParagraphSettings","presentationeditor/main/app/view/ImageSettings","presentationeditor/main/app/view/ChartSettings","presentationeditor/main/app/view/TableSettings","presentationeditor/main/app/view/ShapeSettings","presentationeditor/main/app/view/SlideSettings","presentationeditor/main/app/view/TextArtSettings","presentationeditor/main/app/view/SignatureSettings","common/main/lib/component/Scroller"],function(t,e,i,n){"use strict";PE.Views.RightMenu=n.View.extend(i.extend({el:"#right-menu",template:i.template(t),events:{},initialize:function(){return this.minimizedMode=!0,this.btnText=new Common.UI.Button({hint:this.txtParagraphSettings,asctype:Common.Utils.documentSettingsType.Paragraph,enableToggle:!0,disabled:!0,toggleGroup:"tabpanelbtnsGroup",allowMouseEventsOnDisabled:!0}),this.btnTable=new Common.UI.Button({hint:this.txtTableSettings,asctype:Common.Utils.documentSettingsType.Table,enableToggle:!0,disabled:!0,toggleGroup:"tabpanelbtnsGroup",allowMouseEventsOnDisabled:!0}),this.btnImage=new Common.UI.Button({hint:this.txtImageSettings,asctype:Common.Utils.documentSettingsType.Image,enableToggle:!0,disabled:!0,toggleGroup:"tabpanelbtnsGroup",allowMouseEventsOnDisabled:!0}),this.btnSlide=new Common.UI.Button({hint:this.txtSlideSettings,asctype:Common.Utils.documentSettingsType.Slide,enableToggle:!0,disabled:!0,toggleGroup:"tabpanelbtnsGroup",allowMouseEventsOnDisabled:!0}),this.btnChart=new Common.UI.Button({hint:this.txtChartSettings,asctype:Common.Utils.documentSettingsType.Chart,enableToggle:!0,disabled:!0,toggleGroup:"tabpanelbtnsGroup",allowMouseEventsOnDisabled:!0}),this.btnShape=new Common.UI.Button({hint:this.txtShapeSettings,asctype:Common.Utils.documentSettingsType.Shape,enableToggle:!0,disabled:!0,toggleGroup:"tabpanelbtnsGroup",allowMouseEventsOnDisabled:!0}),this.btnTextArt=new Common.UI.Button({hint:this.txtTextArtSettings,asctype:Common.Utils.documentSettingsType.TextArt,enableToggle:!0,disabled:!0,toggleGroup:"tabpanelbtnsGroup",allowMouseEventsOnDisabled:!0}),this._settings=[],this._settings[Common.Utils.documentSettingsType.Paragraph]={panel:"id-paragraph-settings",btn:this.btnText},this._settings[Common.Utils.documentSettingsType.Table]={panel:"id-table-settings",btn:this.btnTable},this._settings[Common.Utils.documentSettingsType.Image]={panel:"id-image-settings",btn:this.btnImage},this._settings[Common.Utils.documentSettingsType.Slide]={panel:"id-slide-settings",btn:this.btnSlide},this._settings[Common.Utils.documentSettingsType.Shape]={panel:"id-shape-settings",btn:this.btnShape},this._settings[Common.Utils.documentSettingsType.Chart]={panel:"id-chart-settings",btn:this.btnChart},this._settings[Common.Utils.documentSettingsType.TextArt]={panel:"id-textart-settings",btn:this.btnTextArt},this},render:function(t){var n=e(this.el);this.trigger("render:before",this),this.defaultHideRightMenu=t.customization&&!!t.customization.hideRightMenu;var o=!Common.localStorage.getBool("pe-hide-right-settings",this.defaultHideRightMenu);return n.css("width",(o?MENU_SCALE_PART:SCALE_MIN)+"px"),n.show(),n.html(this.template({})),this.btnText.setElement(e("#id-right-menu-text"),!1),this.btnText.render(),this.btnTable.setElement(e("#id-right-menu-table"),!1),this.btnTable.render(),this.btnImage.setElement(e("#id-right-menu-image"),!1),this.btnImage.render(),this.btnSlide.setElement(e("#id-right-menu-slide"),!1),this.btnSlide.render(),this.btnChart.setElement(e("#id-right-menu-chart"),!1),this.btnChart.render(),this.btnShape.setElement(e("#id-right-menu-shape"),!1),this.btnShape.render(),this.btnTextArt.setElement(e("#id-right-menu-textart"),!1),this.btnTextArt.render(),this.btnText.on("click",i.bind(this.onBtnMenuClick,this)),this.btnTable.on("click",i.bind(this.onBtnMenuClick,this)),this.btnImage.on("click",i.bind(this.onBtnMenuClick,this)),this.btnSlide.on("click",i.bind(this.onBtnMenuClick,this)),this.btnChart.on("click",i.bind(this.onBtnMenuClick,this)),this.btnShape.on("click",i.bind(this.onBtnMenuClick,this)),this.btnTextArt.on("click",i.bind(this.onBtnMenuClick,this)),this.paragraphSettings=new PE.Views.ParagraphSettings,this.slideSettings=new PE.Views.SlideSettings,this.imageSettings=new PE.Views.ImageSettings,this.chartSettings=new PE.Views.ChartSettings,this.tableSettings=new PE.Views.TableSettings,this.shapeSettings=new PE.Views.ShapeSettings,this.textartSettings=new PE.Views.TextArtSettings,t&&t.isSignatureSupport&&(this.btnSignature=new Common.UI.Button({hint:this.txtSignatureSettings,asctype:Common.Utils.documentSettingsType.Signature,enableToggle:!0,disabled:!0,toggleGroup:"tabpanelbtnsGroup",allowMouseEventsOnDisabled:!0}),this._settings[Common.Utils.documentSettingsType.Signature]={panel:"id-signature-settings",btn:this.btnSignature},this.btnSignature.setElement(e("#id-right-menu-signature"),!1),this.btnSignature.render().setVisible(!0),this.btnSignature.on("click",i.bind(this.onBtnMenuClick,this)),this.signatureSettings=new PE.Views.SignatureSettings),i.isUndefined(this.scroller)&&(this.scroller=new Common.UI.Scroller({el:e(this.el).find(".right-panel"),suppressScrollX:!0,useKeyboard:!1})),o&&(e("#id-slide-settings").parent().css("display","inline-block"),e("#id-slide-settings").addClass("active")),this.trigger("render:after",this),this},setApi:function(t){this.api=t;var e=function(){this.fireEvent("editcomplete",this)};this.paragraphSettings.setApi(t).on("editcomplete",i.bind(e,this)),this.slideSettings.setApi(t).on("editcomplete",i.bind(e,this)),this.imageSettings.setApi(t).on("editcomplete",i.bind(e,this)),this.chartSettings.setApi(t).on("editcomplete",i.bind(e,this)),this.tableSettings.setApi(t).on("editcomplete",i.bind(e,this)),this.shapeSettings.setApi(t).on("editcomplete",i.bind(e,this)),this.textartSettings.setApi(t).on("editcomplete",i.bind(e,this)),this.signatureSettings&&this.signatureSettings.setApi(t).on("editcomplete",i.bind(e,this))},setMode:function(t){this.imageSettings&&this.imageSettings.setMode(t),this.shapeSettings&&this.shapeSettings.setMode(t),this.slideSettings&&this.slideSettings.setMode(t)},onBtnMenuClick:function(t,i){var n=e("#"+this._settings[t.options.asctype].panel),o=n.parent();t.pressed?(this.minimizedMode&&(e(this.el).width(MENU_SCALE_PART),o.css("display","inline-block"),this.minimizedMode=!1,Common.localStorage.setItem("pe-hide-right-settings",0)),o.find("> .active").removeClass("active"),n.addClass("active"),this.scroller&&this.scroller.scrollTop(0),this._settings[Common.Utils.documentSettingsType.Slide].isCurrent=t.options.asctype==Common.Utils.documentSettingsType.Slide):(o.css("display","none"),e(this.el).width(SCALE_MIN),this.minimizedMode=!0,Common.localStorage.setItem("pe-hide-right-settings",1)),this.fireEvent("rightmenuclick",[this,t.options.asctype,this.minimizedMode])},SetActivePane:function(t,i){if(!(this.minimizedMode&&!0!==i||void 0===this._settings[t]))if(this.minimizedMode)this._settings[t].btn.toggle(!0,!1),this._settings[t].btn.trigger("click",this._settings[t].btn);else{var n=e("#"+this._settings[t].panel);n.hasClass("active")||(n.parent().find("> .active").removeClass("active"),n.addClass("active"),this.scroller&&(this.scroller.update(),this.scroller.scrollTop(0))),this._settings[t].btn.isActive()||this._settings[t].btn.toggle(!0,!1)}},GetActivePane:function(){return this.minimizedMode?null:this.$el.find(".settings-panel.active")[0].id},clearSelection:function(){var t=e(".right-panel");t.find("> .active").removeClass("active"),this._settings.forEach(function(t){t.btn.isActive()&&t.btn.toggle(!1,!0)}),t.css("display","none"),e(this.el).width(SCALE_MIN),this.minimizedMode=!0,Common.NotificationCenter.trigger("layout:changed","rightmenu")},txtParagraphSettings:"Text Settings",txtImageSettings:"Image Settings",txtTableSettings:"Table Settings",txtShapeSettings:"Shape Settings",txtTextArtSettings:"Text Art Settings",txtSlideSettings:"Slide Settings",txtChartSettings:"Chart Settings",txtSignatureSettings:"Signature Settings"},PE.Views.RightMenu||{}))}),define("presentationeditor/main/app/controller/RightMenu",["core","presentationeditor/main/app/view/RightMenu"],function(){"use strict";PE.Controllers.RightMenu=Backbone.Controller.extend({models:[],collections:[],views:["RightMenu"],initialize:function(){this.editMode=!0,this._state={no_slides:void 0},this._initSettings=!0,this.addListeners({RightMenu:{rightmenuclick:this.onRightMenuClick}})},onLaunch:function(){this.rightmenu=this.createView("RightMenu"),this.rightmenu.on("render:after",_.bind(this.onRightMenuAfterRender,this))},onRightMenuAfterRender:function(t){t.shapeSettings.application=t.textartSettings.application=this.getApplication(),this._settings=[],this._settings[Common.Utils.documentSettingsType.Paragraph]={panelId:"id-paragraph-settings",panel:t.paragraphSettings,btn:t.btnText,hidden:1,locked:!1},this._settings[Common.Utils.documentSettingsType.Table]={panelId:"id-table-settings",panel:t.tableSettings,btn:t.btnTable,hidden:1,locked:!1},this._settings[Common.Utils.documentSettingsType.Image]={panelId:"id-image-settings",panel:t.imageSettings,btn:t.btnImage,hidden:1,locked:!1},this._settings[Common.Utils.documentSettingsType.Slide]={panelId:"id-slide-settings",panel:t.slideSettings,btn:t.btnSlide,hidden:1,locked:!1},this._settings[Common.Utils.documentSettingsType.Shape]={panelId:"id-shape-settings",panel:t.shapeSettings,btn:t.btnShape,hidden:1,locked:!1},this._settings[Common.Utils.documentSettingsType.TextArt]={panelId:"id-textart-settings",panel:t.textartSettings,btn:t.btnTextArt,hidden:1,locked:!1},this._settings[Common.Utils.documentSettingsType.Chart]={panelId:"id-chart-settings",panel:t.chartSettings,btn:t.btnChart,hidden:1,locked:!1},this._settings[Common.Utils.documentSettingsType.Signature]={panelId:"id-signature-settings",panel:t.signatureSettings,btn:t.btnSignature,hidden:1,props:{},locked:!1}},setApi:function(t){this.api=t,this.api.asc_registerCallback("asc_onUpdateSignatures",_.bind(this.onApiUpdateSignatures,this)),this.api.asc_registerCallback("asc_onCountPages",_.bind(this.onApiCountPages,this)),this.api.asc_registerCallback("asc_onCoAuthoringDisconnect",_.bind(this.onCoAuthoringDisconnect,this)),Common.NotificationCenter.on("api:disconnect",_.bind(this.onCoAuthoringDisconnect,this))},setMode:function(t){this.editMode=t.isEdit},onRightMenuClick:function(t,e,i){if(!i&&this.editMode){var n=this._settings[e].panel,o=this._settings[e].props;o&&n&&n.ChangeSettings.call(n,e==Common.Utils.documentSettingsType.Signature?void 0:o)}Common.NotificationCenter.trigger("layout:changed","rightmenu"),this.rightmenu.fireEvent("editcomplete",this.rightmenu)},onFocusObject:function(t){if(this.editMode){var e=!!this._initSettings&&!Common.localStorage.getBool("pe-hide-right-settings",this.rightmenu.defaultHideRightMenu);this._initSettings=!1;for(var i=0;i0?0:1,this._settings[Common.Utils.documentSettingsType.Signature].locked=!1,i=0;i=this._settings.length||void 0===this._settings[o])){var s=t[i].get_ObjectValue();this._settings[o].props=s,this._settings[o].hidden=0,o==Common.Utils.documentSettingsType.Slide?(this._settings[o].locked=s.get_LockDelete(),this._settings[o].lockedBackground=s.get_LockBackground(),this._settings[o].lockedEffects=s.get_LockTranzition(),this._settings[o].lockedTiming=s.get_LockTiming(),this._settings[o].lockedHeader=!!s.get_LockHeader&&s.get_LockHeader()):(this._settings[o].locked=s.get_Locked(),o==Common.Utils.documentSettingsType.Shape&&s.asc_getTextArtProperties()&&(this._settings[Common.Utils.documentSettingsType.TextArt].props=s,this._settings[Common.Utils.documentSettingsType.TextArt].hidden=0,this._settings[Common.Utils.documentSettingsType.TextArt].locked=s.get_Locked()))}}if(this._settings[Common.Utils.documentSettingsType.Slide].locked)for(i=0;i-1?r:a>=0?a:l>=0?l:Common.Utils.documentSettingsType.Slide,void 0!==h&&(this.rightmenu.SetActivePane(h,e),h!=Common.Utils.documentSettingsType.Signature?this._settings[h].panel.ChangeSettings.call(this._settings[h].panel,this._settings[h].props):this._settings[h].panel.ChangeSettings.call(this._settings[h].panel))}this._settings[Common.Utils.documentSettingsType.Image].needShow=!1,this._settings[Common.Utils.documentSettingsType.Chart].needShow=!1,this._settings[Common.Utils.documentSettingsType.Shape].needShow=!1}},onCoAuthoringDisconnect:function(){this.SetDisabled(!0),this.setMode({isEdit:!1})},SetDisabled:function(t,e){if(this.setMode({isEdit:!t}),this.rightmenu&&this.rightmenu.paragraphSettings)if(this.rightmenu.slideSettings.SetSlideDisabled(t,t,t,t),this.rightmenu.paragraphSettings.disableControls(t),this.rightmenu.shapeSettings.disableControls(t),this.rightmenu.textartSettings.disableControls(t),this.rightmenu.tableSettings.disableControls(t),this.rightmenu.imageSettings.disableControls(t),this.rightmenu.chartSettings.disableControls(t),!e&&this.rightmenu.signatureSettings&&this.rightmenu.btnSignature.setDisabled(t),t)this.rightmenu.btnSlide.setDisabled(t),this.rightmenu.btnText.setDisabled(t),this.rightmenu.btnTable.setDisabled(t),this.rightmenu.btnImage.setDisabled(t),this.rightmenu.btnShape.setDisabled(t),this.rightmenu.btnTextArt.setDisabled(t),this.rightmenu.btnChart.setDisabled(t);else{var i=this.api.getSelectedElements();i.length>0&&this.onFocusObject(i)}},onInsertTable:function(){this._settings[Common.Utils.documentSettingsType.Table].needShow=!0},onInsertImage:function(){this._settings[Common.Utils.documentSettingsType.Image].needShow=!0},onInsertChart:function(){this._settings[Common.Utils.documentSettingsType.Chart].needShow=!0},onInsertShape:function(){this._settings[Common.Utils.documentSettingsType.Shape].needShow=!0},onInsertTextArt:function(){this._settings[Common.Utils.documentSettingsType.TextArt].needShow=!0},UpdateThemeColors:function(){this.rightmenu.slideSettings.UpdateThemeColors(),this.rightmenu.tableSettings.UpdateThemeColors(),this.rightmenu.shapeSettings.UpdateThemeColors(),this.rightmenu.textartSettings.UpdateThemeColors()},updateMetricUnit:function(){this.rightmenu.paragraphSettings.updateMetricUnit(),this.rightmenu.chartSettings.updateMetricUnit(),this.rightmenu.imageSettings.updateMetricUnit(),this.rightmenu.tableSettings.updateMetricUnit()},createDelayedElements:function(){if(this.editMode&&this.api){this.api.asc_registerCallback("asc_doubleClickOnObject",_.bind(this.onDoubleClickOnObject,this));var t=this.api.getSelectedElements();t.length>0&&this.onFocusObject(t)}},onDoubleClickOnObject:function(t){if(this.editMode){var e=t.get_ObjectType(),i=this.getDocumentSettingsType(e);void 0===i||i>=this._settings.length||void 0===this._settings[i]||i!==Common.Utils.documentSettingsType.Paragraph&&(this.rightmenu.SetActivePane(i,!0),this._settings[i].panel.ChangeSettings.call(this._settings[i].panel,this._settings[i].props))}},onApiUpdateSignatures:function(t){if(this.rightmenu.signatureSettings){var e=!t||t.length<1,i=Common.Utils.documentSettingsType.Signature;this._settings[i].hidden=e?1:0,this._settings[i].btn.setDisabled(e),this._settings[i].panel.setLocked(this._settings[i].locked)}},onApiCountPages:function(t){this._state.no_slides!==t<=0&&this.editMode&&(this._state.no_slides=t<=0,this._state.no_slides&&!this.rightmenu.minimizedMode&&this.rightmenu.clearSelection(),this._settings[Common.Utils.documentSettingsType.Slide].btn.setDisabled(this._state.no_slides))},getDocumentSettingsType:function(t){switch(t){case Asc.c_oAscTypeSelectElement.Paragraph:return Common.Utils.documentSettingsType.Paragraph;case Asc.c_oAscTypeSelectElement.Table:return Common.Utils.documentSettingsType.Table;case Asc.c_oAscTypeSelectElement.Image:return Common.Utils.documentSettingsType.Image;case Asc.c_oAscTypeSelectElement.Shape:return Common.Utils.documentSettingsType.Shape;case Asc.c_oAscTypeSelectElement.Slide:return Common.Utils.documentSettingsType.Slide;case Asc.c_oAscTypeSelectElement.Chart:return Common.Utils.documentSettingsType.Chart}}})}),function(t){function e(t,e){for(var i=t.length;i--;)if(t[i]===e)return i;return-1}function i(t,e){if(t.length!=e.length)return!1;for(var i=0;i0;for(s in A)(!A[s]&&e(o.mods,+s)>-1||A[s]&&-1==e(o.mods,+s))&&(r=!1);(0!=o.mods.length||A[16]||A[18]||A[17]||A[91])&&!r||(!0===x||o.locked||!1===o.method(t,o))&&(t.preventDefault?t.preventDefault():t.returnValue=!1,t.stopPropagation&&t.stopPropagation(),t.cancelBubble&&(t.cancelBubble=!0))}}function s(t){var i,n=t.keyCode,o=e(P,n);if(o>=0&&P.splice(o,1),93!=n&&224!=n||(n=91),n in A){A[n]=!1;for(i in k)k[i]==n&&(l[i]=!1)}}function a(){for(w in A)A[w]=!1;for(w in k)l[w]=!1}function l(t,e,i){var n,o;n=g(t),void 0===i&&(i=e,e="all");for(var s=0;s1&&(o=f(t),t=[t[t.length-1]]),t=t[0],t=E(t),t in S||(S[t]=[]),S[t].push({shortcut:n[s],scope:e,method:i,key:n[s],mods:o})}function r(t,e){var n,o,s,a,l,r=[];for(n=g(t),a=0;a1&&(r=f(o),t=o[o.length-1]),t=E(t),void 0===e&&(e=u()),!S[t])return;for(s in S[t])l=S[t][s],l.scope===e&&i(l.mods,r)&&(S[t][s]={})}}function c(t){return"string"==typeof t&&(t=E(t)),-1!=e(P,t)}function d(){return P.slice(0)}function h(t){var e=(t.target||t.srcElement).tagName;return!("INPUT"==e||"SELECT"==e||"TEXTAREA"==e)}function p(t){T=t||"all"}function u(){return T||"all"}function m(t){var e,i,n;for(e in S)for(i=S[e],n=0;n1&&(r=f(s),t=s[s.length-1]),t=E(t),void 0===e&&(e=u()),S[t])for(a in S[t])l=S[t][a],l.scope===e&&i(l.mods,r)&&(S[t][a][n]=o)}function _(t,e){t?v(t,e,"locked",!0):x=!0}function y(t,e){t?v(t,e,"locked",!1):x=!1}var w,x,S={},A={16:!1,18:!1,17:!1,91:!1},T="all",k={"⇧":16,shift:16,"⌥":18,alt:18,option:18,"⌃":17,ctrl:17,control:17,"⌘":91,command:91},I={backspace:8,tab:9,clear:12,enter:13,return:13,esc:27,escape:27,space:32,left:37,up:38,right:39,down:40,del:46,delete:46,home:36,end:35,pageup:33,pagedown:34,",":188,".":190,"/":191,"`":192,"-":189,"=":187,";":186,"'":222,"[":219,"]":221,"\\":220,"ff-":173,"ff=":61},E=function(t){return I[t]||t.toUpperCase().charCodeAt(0)},P=[];for(w=1;w<20;w++)I["f"+w]=111+w;var M={16:"shiftKey",18:"altKey",17:"ctrlKey",91:"metaKey"};for(w in k)l[w]=!1;b(document,"keydown",function(t){o(t)}),b(document,"keyup",s),b(window,"focus",a);var U=t.key;t.key=l,t.key.setScope=p,t.key.getScope=u,t.key.deleteScope=m,t.key.filter=h,t.key.isPressed=c,t.key.getPressedKeyCodes=d,t.key.noConflict=C,t.key.unbind=r,t.key.suspend=_,t.key.resume=y,"undefined"!=typeof module&&(module.exports=key)}(this),define("keymaster",function(){}),void 0===Common)var Common={};if(Common.util=Common.util||{},define("common/main/lib/util/Shortcuts",["backbone","keymaster"],function(t){"use strict";var e=function(t){return this.cid=_.uniqueId("shortcuts"),this.initialize.apply(this,arguments),this};_.extend(e.prototype,t.Events,{initialize:function(){window.key.filter=function(t){return!0},Common.NotificationCenter.on({"modal:show":function(t){window.key.suspend()},"modal:close":function(t,e){e&&window.key.resume()},"modal:hide":function(t,e){e&&window.key.resume()}})},delegateShortcuts:function(t){if(t&&t.shortcuts){this.removeShortcuts(t);var e,i,n,o,s,a,l=[];for(s in t.shortcuts){if(e=t.shortcuts[s],_.isFunction(e))n=e;else if(!(n=t[e]))throw new Error("Method "+e+" does not exist");i=s.match(/^(\S+)\s*(.*)$/),a=i[1],o=i[2].length?i[2]:"all",n=_.bind(n,this),l.push(window.key(a,o,n))}}},removeShortcuts:function(t){if(t&&t.shortcuts){var e,i,n,o;for(n in t.shortcuts)e=n.match(/^(\S+)\s*(.*)$/),o=e[1],i=e[2].length?e[2]:"all",window.key.unbind(o,i)}},suspendEvents:function(t,e){window.key.suspend(t,e)},resumeEvents:function(t,e){window.key.resume(t,e)}}),e.extend=t.View.extend,Common.util.Shortcuts=new e}),define("common/main/lib/view/SaveAsDlg",["common/main/lib/component/Window","common/main/lib/component/LoadMask"],function(){"use strict";Common.Views.SaveAsDlg=Common.UI.Window.extend(_.extend({initialize:function(t){var e={};_.extend(e,{title:this.textTitle,width:420,height:681,header:!0},t),this.template=['
    '].join(""),e.tpl=_.template(this.template)(e),this.saveFolderUrl=t.saveFolderUrl||"",this.saveFileUrl=t.saveFileUrl||"",this.defFileName=t.defFileName||"",this.saveFolderUrl=this.saveFolderUrl.replace("{title}",encodeURIComponent(this.defFileName)).replace("{fileuri}",encodeURIComponent(this.saveFileUrl)),Common.UI.Window.prototype.initialize.call(this,e)},render:function(){Common.UI.Window.prototype.render.call(this),this.$window.find("> .body").css({height:"auto",overflow:"hidden"});var t=document.createElement("iframe");t.width="100%",t.height=645,t.align="top",t.frameBorder=0,t.scrolling="no",t.onload=_.bind(this._onLoad,this),$("#id-saveas-folder-placeholder").append(t),this.loadMask=new Common.UI.LoadMask({owner:$("#id-saveas-folder-placeholder")}),this.loadMask.setTitle(this.textLoading),this.loadMask.show(),t.src=this.saveFolderUrl;var e=this;this._eventfunc=function(t){e._onWindowMessage(t)},this._bindWindowEvents.call(this),this.on("close",function(t){e._unbindWindowEvents()})},_bindWindowEvents:function(){window.addEventListener?window.addEventListener("message",this._eventfunc,!1):window.attachEvent&&window.attachEvent("onmessage",this._eventfunc)},_unbindWindowEvents:function(){window.removeEventListener?window.removeEventListener("message",this._eventfunc):window.detachEvent&&window.detachEvent("onmessage",this._eventfunc)},_onWindowMessage:function(t){if(t&&window.JSON)try{this._onMessage.call(this,window.JSON.parse(t.data))}catch(t){}},_onMessage:function(t){t&&"onlyoffice"==t.Referer&&(_.isEmpty(t.error)?_.isEmpty(t.message)||Common.NotificationCenter.trigger("showmessage",{msg:t.message}):this.trigger("saveaserror",this,t.error),Common.NotificationCenter.trigger("window:close",this))},_onLoad:function(){this.loadMask&&this.loadMask.hide()},textTitle:"Folder for save",textLoading:"Loading"},Common.Views.SaveAsDlg||{}))}),define("text!presentationeditor/main/app/template/LeftMenu.template",[],function(){return'
    \r\n
    \r\n \r\n \r\n \x3c!-- /** coauthoring begin **/ --\x3e\r\n \r\n \r\n \x3c!-- /** coauthoring end **/ --\x3e\r\n \r\n \r\n \r\n
    \r\n
    \r\n \x3c!-- /** coauthoring begin **/ --\x3e\r\n \r\n \r\n \x3c!-- /** coauthoring end **/ --\x3e\r\n \r\n
    \r\n
    '}),define("common/main/lib/view/About",["common/main/lib/component/BaseView","common/main/lib/component/Scroller"],function(){"use strict";Common.Views.About=Common.UI.BaseView.extend(_.extend({menu:void 0,rendered:!1,options:{alias:"Common.Views.About"},initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,arguments),this.txtVersionNum="0.0.0",this.template=_.template(['',"",'',"","",'","","",'","","",'',"",'',"","",'","","",'","","",'","","",'","","
    ','",'',"
    ','",'<%= supportemail %>',"
    ','",'',"
    ','<% print(publisherurl.replace(/https?:\\/{2}/, "").replace(/\\/$/,"")) %>',"
    ",'',"",'',"","",'","","",'","","",'","","",'","","",'","","",'","","",'","","",'',"",'','",'',"","",'',"","",'","",""].join("")),this.menu=t.menu},render:function(){if(!this.rendered){this.rendered=!0;var t=$(this.template({publishername:"Ascensio System SIA",publisheraddr:"20A-12 Ernesta Birznieka-Upisha street, Riga, Latvia, EU, LV-1050",publisherurl:"https://www.onlyoffice.com/",supportemail:"support@onlyoffice.com",phonenum:"+371 633-99867",scope:this}));this.cntLicenseeInfo=t.findById("#id-about-licensee-info"),this.cntLicensorInfo=t.findById("#id-about-licensor-info"),this.divCompanyLogo=t.findById("#id-about-company-logo"),this.lblCompanyName=t.findById("#id-about-company-name"),this.lblCompanyAddress=t.findById("#id-about-company-address"),this.lblCompanyMail=t.findById("#id-about-company-mail"),this.lblCompanyUrl=t.findById("#id-about-company-url"),this.lblCompanyLic=t.findById("#id-about-company-lic"),this.$el.html(t),this.$el.addClass("about-dlg"),this.licData&&this.setLicInfo(this.licData),_.isUndefined(this.scroller)&&(this.scroller=new Common.UI.Scroller({el:this.$el,suppressScrollX:!0}))}return this},setLicInfo:function(t){if(this.rendered)if(t&&"object"==typeof t&&"object"==typeof t.customer){var e=t.customer;$("#id-about-licensor-logo").addClass("hidden"),$("#id-about-licensor-short").removeClass("hidden"),this.cntLicensorInfo.addClass("hidden"),this.cntLicenseeInfo.removeClass("hidden"),this.cntLicensorInfo.removeClass("margin-bottom");var i=e.name;if(i&&i.length?this.lblCompanyName.text(i):this.lblCompanyName.parents("tr").addClass("hidden"),i=e.address,i&&i.length?this.lblCompanyAddress.text(i):this.lblCompanyAddress.parents("tr").addClass("hidden"),(i=e.mail)&&i.length?this.lblCompanyMail.attr("href","mailto:"+i).text(i):this.lblCompanyMail.parents("tr").addClass("hidden"),(i=e.www)&&i.length){var n=/^https?:\/{2}/i.test(i)?"":"http://";this.lblCompanyUrl.attr("href",n+i).text(i)}else this.lblCompanyUrl.parents("tr").addClass("hidden");(i=e.info)&&i.length?this.lblCompanyLic.text(i):this.lblCompanyLic.parents("tr").addClass("hidden"),(i=e.logo)&&i.length?this.divCompanyLogo.html(''):this.divCompanyLogo.parents("tr").addClass("hidden")}else this.cntLicenseeInfo.addClass("hidden"),this.cntLicensorInfo.addClass("margin-bottom");else this.licData=t||!0},show:function(){this.rendered||this.render(),Common.UI.BaseView.prototype.show.call(this,arguments),this.fireEvent("show",this)},hide:function(){Common.UI.BaseView.prototype.hide.call(this,arguments),this.fireEvent("hide",this)},setMode:function(t){t.isLightVersion&&($("#id-about-licensor-version-name").text(this.txtEdition+this.txtVersion+this.txtVersionNum),$("#id-about-licensee-version-name").text(this.txtEdition+this.txtVersion+this.txtVersionNum))},txtPoweredBy:"Powered by",txtVersion:"Version ",txtLicensor:"LICENSOR",txtLicensee:"LICENSEE",txtAddress:"address: ",txtMail:"email: ",txtTel:"tel.: ",txtEdition:"Integration Edition "},Common.Views.About||{}))}),define("text!common/main/lib/template/Comments.template",[],function(){return'<% if (!hide) { %>\r\n
    \r\n\r\n \x3c!-- comment block --\x3e\r\n\r\n
    \r\n
    <%= scope.getUserName(username) %>\r\n
    \r\n
    <%=date%>
    \r\n <% if (quote!==null && quote!==\'\') { %>\r\n
    <%=scope.getFixedQuote(quote)%>
    \r\n <% } %>\r\n <% if (!editText || scope.viewmode) { %>\r\n
    <%=scope.pickLink(comment)%>
    \r\n <% } else { %>\r\n
    \r\n \r\n \r\n \r\n
    \r\n <% } %>\r\n\r\n \x3c!-- replys elements --\x3e\r\n\r\n <% if (replys.length) { %>\r\n
    \r\n <% _.each(replys, function (item, index) { %>\r\n
    style="padding-bottom: 0;" <% } %>;>\r\n
    \r\n
    <%=item.get("usercolor")%><% } else { %> #cfcfcf <% } %>; " >
    <%= scope.getUserName(item.get("username")) %>\r\n
    \r\n
    <%=item.get("date")%>
    \r\n <% if (!item.get("editText")) { %>\r\n
    <%=scope.pickLink(item.get("reply"))%>
    \r\n <% if (!scope.viewmode) { %>\r\n
    \r\n <% if (item.get("editable")) { %>\r\n
    ">
    \r\n
    ">
    \r\n <% } %>\r\n
    \r\n <%}%>\r\n <% } else { %>\r\n
    \r\n \r\n \r\n \r\n
    \r\n <% } %>\r\n
    \r\n <% }); %>\r\n <% } %>\r\n\r\n \x3c!-- add reply button --\x3e\r\n\r\n <% if (!showReply && !scope.viewmode) { %>\r\n <% if (replys.length) { %>\r\n \r\n <% } else { %>\r\n \r\n <% } %>\r\n <% } %>\r\n\r\n \x3c!-- edit buttons --\x3e\r\n\r\n <% if (!editText && !lock && !scope.viewmode) { %>\r\n
    \r\n <% if (editable) { %>\r\n
    \r\n
    \r\n <% } %>\r\n <% if (resolved) { %>\r\n
    \r\n <% } else { %>\r\n
    \r\n <% } %>\r\n
    \r\n <% } %>\r\n\r\n \x3c!-- reply --\x3e\r\n\r\n <% if (showReply) { %>\r\n
    \r\n \r\n \r\n \r\n
    \r\n <% } %>\r\n <% if (lock) { %>\r\n
    \r\n
    <%=lockuserid%>
    \r\n <% } %>\r\n <% if (!last) { %>\r\n
    \r\n <% } %>\r\n
    \r\n<% } %>\r\n'}),define("text!common/main/lib/template/CommentsPanel.template",[],function(){return'
    \r\n
    \r\n \r\n \r\n
    \r\n'}),void 0===Common)var Common={};if(Common.Views=Common.Views||{},define("common/main/lib/view/Comments",["text!common/main/lib/template/Comments.template","text!common/main/lib/template/CommentsPanel.template","common/main/lib/util/utils","common/main/lib/component/Button","common/main/lib/component/ComboBox","common/main/lib/component/DataView","common/main/lib/component/Layout","common/main/lib/component/Window"],function(t,e){"use strict";function i(t,e){var i,n,o=t;for(i in e)void 0!==i&&(n=e[i],o=o.replace(new RegExp(i,"g"),n));return o}var n=Common.UI.DataView.extend(function(){return{options:{handleSelect:!1,scrollable:!0,listenStoreEvents:!1,template:_.template('
    ')},getTextBox:function(){var t=$(this.el).find("textarea");return t&&t.length?t:void 0},setFocusToTextBox:function(){var t=$(this.el).find("textarea");if(t&&t.length){var e=t.val();t.focus(),t.val(""),t.val(e)}},getActiveTextBoxVal:function(){var t=$(this.el).find("textarea");return t&&t.length?t.val().trim():""},autoHeightTextBox:function(){function t(){n.scrollHeight>n.clientHeight?i.css({height:n.scrollHeight+s+"px"}):(a=n.clientHeight)>=o&&(i.css({height:o+"px"}),n.scrollHeight>n.clientHeight&&(l=Math.max(n.scrollHeight+s,o),i.css({height:l+"px"}))),e.autoScrollToEditButtons()}var e=this,i=$(this.el).find("textarea"),n=null,o=50,s=0,a=0,l=0;i&&i.length&&(n=i.get(0))&&(s=.25*parseInt(i.css("lineHeight"),10),t(),i.bind("input propertychange",t)),this.textBox=i},clearTextBoxBind:function(){this.textBox&&(this.textBox.unbind("input propertychange"),this.textBox=void 0)},autoScrollToEditButtons:function(){var t=$("#id-comments-change"),e=null,i=this.el.getBoundingClientRect(),n=0;t.length&&(e=t.get(0).getBoundingClientRect())&&i&&(n=i.bottom-(e.bottom+7))<0&&this.scroller.scrollTop(this.scroller.getScrollTop()-n)}}}());Common.Views.Comments=Common.UI.BaseView.extend(_.extend({el:"#left-panel-comments",template:_.template(e),addCommentHeight:45,newCommentHeight:110,textBoxAutoSizeLocked:void 0,viewmode:!1,_commentsViewOnItemClick:function(t,e,i,n){function o(){d.update()}var s,a,l,r,c,d=this;if(s=$(n.target))if(a=i.get("editText"),l=i.get("showReply"),r=i.get("uid"),c=s.attr("data-value"),s.hasClass("btn-edit"))_.isUndefined(c)?a||(d.fireEvent("comment:closeEditing"),i.set("editText",!0),t.autoHeightTextBox(),o(),t.setFocusToTextBox(),d.hookTextBox()):(d.fireEvent("comment:closeEditing",[r]),d.fireEvent("comment:editReply",[r,c]),d.commentsView.reply=c,t.autoHeightTextBox(),o(),d.hookTextBox(),t.autoScrollToEditButtons(),t.setFocusToTextBox());else if(s.hasClass("btn-delete"))_.isUndefined(c)?(d.fireEvent("comment:remove",[r]),Common.NotificationCenter.trigger("edit:complete",d)):d.fireEvent("comment:removeReply",[r,c]),d.fireEvent("comment:closeEditing"),o();else if(s.hasClass("user-reply"))d.fireEvent("comment:closeEditing"),i.set("showReply",!0),o(),t.autoHeightTextBox(),d.hookTextBox(),t.autoScrollToEditButtons(),t.setFocusToTextBox();else if(s.hasClass("btn-reply",!1))l&&(d.fireEvent("comment:addReply",[r,t.getActiveTextBoxVal()]),d.fireEvent("comment:closeEditing"),o());else if(s.hasClass("btn-close",!1))d.fireEvent("comment:closeEditing",[r]);else if(s.hasClass("btn-inner-edit",!1))_.isUndefined(d.commentsView.reply)?a&&d.fireEvent("comment:change",[r,t.getActiveTextBoxVal()]):(d.fireEvent("comment:changeReply",[r,d.commentsView.reply,t.getActiveTextBoxVal()]),d.commentsView.reply=void 0),d.fireEvent("comment:closeEditing"),o();else if(s.hasClass("btn-inner-close",!1))d.fireEvent("comment:closeEditing"),d.commentsView.reply=void 0,o();else if(s.hasClass("btn-resolve",!1)){var h=s.data("bs.tooltip");h&&(h.dontShow=!0),d.fireEvent("comment:resolve",[r]),o()}else if(s.hasClass("btn-resolve-check",!1)){var h=s.data("bs.tooltip");h&&(h.dontShow=!0),d.fireEvent("comment:resolve",[r]),o()}else if(!s.hasClass("msg-reply")&&!s.hasClass("btn-resolve-check")&&!s.hasClass("btn-resolve")){var p=!1;if(s.hasClass("user-message"))if(window.getSelection){var u=window.getSelection();p=""!==u.toString()}else document.selection&&(p=document.selection);d.fireEvent("comment:show",[r,!1,p])}},initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t),this.store=this.options.store},render:function(){var e=this;if(this.rendered||(this.$el.html(this.template({textAddCommentToDoc:e.textAddCommentToDoc,textAddComment:e.textAddComment,textCancel:e.textCancel,textEnterCommentHint:e.textEnterCommentHint,maxCommLength:Asc.c_oAscMaxCellOrCommentLength})),this.buttonAddCommentToDoc=new Common.UI.Button({el:$(".btn.new",this.$el),enableToggle:!1}),this.buttonAdd=new Common.UI.Button({action:"add",el:$(".btn.add",this.$el),enableToggle:!1}),this.buttonCancel=new Common.UI.Button({el:$(".btn.cancel",this.$el),enableToggle:!1}),this.buttonAddCommentToDoc.on("click",_.bind(this.onClickShowBoxDocumentComment,this)),this.buttonAdd.on("click",_.bind(this.onClickAddDocumentComment,this)),this.buttonCancel.on("click",_.bind(this.onClickCancelDocumentComment,this)),this.txtComment=$("#comment-msg-new",this.el),this.txtComment.keydown(function(t){if(!t.ctrlKey&&!t.metaKey||t.altKey||t.keyCode!=Common.UI.Keys.RETURN){if(t.keyCode===Common.UI.Keys.TAB){var i,n,o;o=this.selectionStart,n=this.selectionEnd,i=$(this),i.val(i.val().substring(0,o)+"\t"+i.val().substring(n)),this.selectionStart=this.selectionEnd=o+1,t.stopImmediatePropagation(),t.preventDefault()}}else e.onClickAddDocumentComment(),t.stopImmediatePropagation()})),this.commentsView)this.commentsView.onResetItems();else{this.commentsView=new n({el:$(".messages-ct",e.el),store:e.store,itemTemplate:_.template(i(t,{textAddReply:e.textAddReply,textAdd:e.textAdd,textCancel:e.textCancel,textEdit:e.textEdit,textReply:e.textReply,textClose:e.textClose,maxCommLength:Asc.c_oAscMaxCellOrCommentLength}))});var o=function(t,i,n){i.tipsArray&&i.tipsArray.forEach(function(t){t.remove()});var o=[],s=$(i.el).find(".btn-resolve") -;s.tooltip({title:e.textResolve,placement:"cursor"}),s.each(function(t,e){o.push($(e).data("bs.tooltip").tip())}),s=$(i.el).find(".btn-resolve-check"),s.tooltip({title:e.textOpenAgain,placement:"cursor"}),s.each(function(t,e){o.push($(e).data("bs.tooltip").tip())}),i.tipsArray=o};this.commentsView.on({"item:add":o,"item:remove":o,"item:change":o,"item:click":this._commentsViewOnItemClick.bind(this)})}return this.rendered||this.setupLayout(),this.update(),this.rendered=!0,this},update:function(){this.updateLayout(),this.updateScrolls()},updateScrolls:function(){this.commentsView&&this.commentsView.scroller&&this.commentsView.scroller.update({minScrollbarLength:40,alwaysVisibleY:!0})},showEditContainer:function(t){var e=$(".add-link-ct",this.el),i=$(".new-comment-ct",this.el);$(".messages-ct",this.el),$("#comments-box",this.el);this.layout.freezePanels(!t),t?(e.css({display:"none"}),i.css({display:"table-row"}),this.txtComment.val(""),this.txtComment.focus(),this.textBoxAutoSizeLocked=void 0):(e.css({display:"table-row"}),i.css({display:"none"})),this.updateLayout(),this.updateScrolls()},onClickShowBoxDocumentComment:function(){this.fireEvent("comment:closeEditing"),this.showEditContainer(!0)},onClickAddDocumentComment:function(){this.fireEvent("comment:add",[this,this.txtComment.val().trim(),void 0,!1,!0]),this.txtComment.val("")},onClickCancelDocumentComment:function(){this.showEditContainer(!1)},saveText:function(t){this.commentsView&&this.commentsView.cmpEl.find(".lock-area").length<1&&(this.textVal=void 0,t?this.commentsView.clearTextBoxBind():this.textVal=this.commentsView.getActiveTextBoxVal())},loadText:function(){if(this.textVal&&this.commentsView){var t=this.commentsView.getTextBox();t&&t.val(this.textVal)}},hookTextBox:function(){var t=this.commentsView.getTextBox();t&&t.keydown(function(t){if(!t.ctrlKey&&!t.metaKey||t.altKey||t.keyCode!=Common.UI.Keys.RETURN){if(t.keyCode===Common.UI.Keys.TAB){var e,i,n;n=this.selectionStart,i=this.selectionEnd,e=$(this),e.val(e.val().substring(0,n)+"\t"+e.val().substring(i)),this.selectionStart=this.selectionEnd=n+1,t.stopImmediatePropagation(),t.preventDefault()}}else{var o=$("#id-comments-change");o&&o.length&&o.click(),t.stopImmediatePropagation()}})},setupLayout:function(){var t=this,e=t.$el,i=$(".new-comment-ct",t.el),n=($(".add-link-ct",t.el),$("#comments-box",t.el)),o=n.find(" > .layout-item");t.layout=new Common.UI.VBoxLayout({box:n,freeze:!0,items:[{el:o[0],rely:!0,resize:{hidden:!1,autohide:!1,fmin:function(){var e=n.height();return"none"!==i.css("display")&&.5*e .layout-item");n.show(),this.layout.changeLayout([{el:a[0],rely:!0,resize:{hidden:!1,autohide:!1,fmin:function(){var t=s.height();return"none"!==i.css("display")&&.5*t'+t+""}),""}),(t.length<1e3||t.search(/\S{255,}/)<0)&&t.replace(Common.Utils.hostnameStrongRe,function(t){var o=/[\.,\?\+;:=!\(\)]+$/.exec(t);o&&(t=t.substring(0,o.index));var s=/(((^https?)|(^ftp)):\/\/)/i.test(t)?t:"http://"+t;return e=arguments[arguments.length-2],i=t.length,_.find(n,function(t){return e>=t.start&&et.start})||n.push({start:e,end:i+e,str:''+t+""}),""}),t.replace(Common.Utils.emailStrongRe,function(t){var o=/((^mailto:)\/\/)/i.test(t)?t:"mailto:"+t;return e=arguments[arguments.length-2],i=t.length,_.find(n,function(t){return e>=t.start&&et.start})||n.push({start:e,end:i+e,str:''+t+""}),""}),n=_.sortBy(n,function(t){return t.start});for(var o=n.length>0?Common.Utils.String.htmlEncode(t.substring(0,n[0].start))+n[0].str:Common.Utils.String.htmlEncode(t),s=1;s0&&(o+=Common.Utils.String.htmlEncode(t.substring(n[s-1].end,t.length))),o},pickEMail:function(t,e){var i=Common.Utils.String.htmlEncode(e).match(/\B[@+][A-Z0-9._%+-]+@[A-Z0-9._]+\.[A-Z]+\b/gi);i=_.map(i,function(t){return t.slice(1,t.length)}),i.length>0&&Common.Gateway.requestSendNotify({emails:i,actionId:t,actionLink:{action:{type:"comment",data:t}},message:e})},textComments:"Comments",textAnonym:"Guest",textAddCommentToDoc:"Add Comment to Document",textAddComment:"Add Comment",textCancel:"Cancel",textAddReply:"Add Reply",textReply:"Reply",textClose:"Close",textResolved:"Resolved",textResolve:"Resolve",textEnterCommentHint:"Enter your comment here",textEdit:"Edit",textAdd:"Add",textOpenAgain:"Open Again",textHintAddComment:"Add Comment"},Common.Views.Comments||{}))}),define("text!common/main/lib/template/Chat.template",[],function(){return'
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n \r\n
    \r\n
    \r\n
    '}),void 0===Common)var Common={};if(Common.Views=Common.Views||{},define("common/main/lib/view/Chat",["text!common/main/lib/template/Chat.template","common/main/lib/util/utils","common/main/lib/component/BaseView","common/main/lib/component/Layout"],function(t){"use strict";Common.Views.Chat=Common.UI.BaseView.extend(_.extend({el:"#left-panel-chat",template:_.template(t),storeUsers:void 0,storeMessages:void 0,tplUser:['
  • "<% if (!user.get("online")) { %> class="offline"<% } %>>','
    ;" >
    <%= scope.getUserName(user.get("username")) %>',"
    ","
  • "].join(""),templateUserList:_.template("
      <% for (originalId in users) { %><%= _.template(usertpl)({user: users[originalId][0], scope: scope}) %><% } %>
    "),tplMsg:["
  • ",'<% if (msg.get("type")==1) { %>','
    <%= msg.get("message") %>
    ',"<% } else { %>",'
    ','
    <%=msg.get("usercolor")%><% } else { %> #cfcfcf <% } %>; " >
    <%= scope.getUserName(msg.get("username")) %>',"
    ",'',"<% } %>","
  • "].join(""),templateMsgList:_.template("
      <% _.each(messages, function(item) { %><%= _.template(msgtpl)({msg: item, scope: scope}) %><% }); %>
    "),events:{},usersBoxHeight:72,messageBoxHeight:70,addMessageBoxHeight:110,initialize:function(t){_.extend(this,t),Common.UI.BaseView.prototype.initialize.call(this,arguments),this.storeUsers.bind({add:_.bind(this._onResetUsers,this),change:_.bind(this._onResetUsers,this),reset:_.bind(this._onResetUsers,this)}),this.storeMessages.bind({add:_.bind(this._onAddMessage,this),reset:_.bind(this._onResetMessages,this)})},render:function(t){return t=t||this.el,$(t).html(this.template({scope:this,maxMsgLength:Asc.c_oAscMaxCellOrCommentLength})),this.panelBox=$("#chat-box",this.el),this.panelUsers=$("#chat-users",this.el),this.panelMessages=$("#chat-messages",this.el),this.txtMessage=$("#chat-msg-text",this.el),this.panelOptions=$("#chat-options",this.el),this.panelUsers.scroller=new Common.UI.Scroller({el:$("#chat-users"),useKeyboard:!0,minScrollbarLength:25}),this.panelMessages.scroller=new Common.UI.Scroller({el:$("#chat-messages"),includePadding:!0,useKeyboard:!0,minScrollbarLength:40}),$("#chat-msg-btn-add",this.el).on("click",_.bind(this._onBtnAddMessage,this)),this.txtMessage.on("keydown",_.bind(this._onKeyDown,this)),this.setupLayout(),this},focus:function(){var t=this;_.defer(function(){t.txtMessage.focus()},100),this.updateLayout(!0),this.setupAutoSizingTextBox()},_onKeyDown:function(t){t.keyCode==Common.UI.Keys.RETURN?!t.ctrlKey&&!t.metaKey||t.altKey||this._onBtnAddMessage(t):t.keyCode==Common.UI.Keys.ESC&&this.hide()},_onResetUsers:function(t,e){this.panelUsers&&(this.panelUsers.html(this.templateUserList({users:this.storeUsers.chain().filter(function(t){return t.get("online")}).groupBy(function(t){return t.get("idOriginal")}).value(),usertpl:this.tplUser,scope:this})),this.panelUsers.scroller.update({minScrollbarLength:25,alwaysVisibleY:!0}))},_onAddMessage:function(t,e,i){if(this.panelMessages){var n=this.panelMessages.find("ul");n&&n.length&&(this._prepareMessage(t),n.append(_.template(this.tplMsg)({msg:t,scope:this})),this.panelMessages.scroller.update({minScrollbarLength:40,alwaysVisibleY:!0}),this.panelMessages.scroller.scrollTop(n.get(0).getBoundingClientRect().height))}},_onResetMessages:function(t,e){if(this.panelMessages){t.each(function(t){this._prepareMessage(t)},this),this.panelMessages.html(this.templateMsgList({messages:t.models,msgtpl:this.tplMsg,scope:this})),this.panelMessages.scroller.update({minScrollbarLength:40,alwaysVisibleY:!0})}},_onBtnAddMessage:function(t){this.txtMessage&&(this.fireEvent("message:add",[this,this.txtMessage.val().trim()]),this.txtMessage.val(""),this.focus())},_prepareMessage:function(t){var e=this.storeUsers.findOriginalUser(t.get("userid"));t.set({usercolor:e?e.get("color"):null,message:this._pickLink(t.get("message"))},{silent:!0})},_pickLink:function(t){var e,i,n=[];t.replace(Common.Utils.ipStrongRe,function(t){var i=/[\.,\?\+;:=!\(\)]+$/.exec(t);return i&&(t=t.substring(0,i.index)),e=arguments[arguments.length-2],n.push({start:e,end:t.length+e,str:''+t+""}),""}),(t.length<1e3||t.search(/\S{255,}/)<0)&&t.replace(Common.Utils.hostnameStrongRe,function(t){var o=/[\.,\?\+;:=!\(\)]+$/.exec(t);o&&(t=t.substring(0,o.index));var s=/(((^https?)|(^ftp)):\/\/)/i.test(t)?t:"http://"+t;return e=arguments[arguments.length-2],i=t.length,_.find(n,function(t){return e>=t.start&&et.start})||n.push({start:e,end:i+e,str:''+t+""}),""}),t.replace(Common.Utils.emailStrongRe,function(t){var o=/((^mailto:)\/\/)/i.test(t)?t:"mailto:"+t;return e=arguments[arguments.length-2],i=t.length,_.find(n,function(t){return e>=t.start&&et.start})||n.push({start:e,end:i+e,str:''+t+""}),""}),n=_.sortBy(n,function(t){return t.start});for(var o=n.length>0?Common.Utils.String.htmlEncode(t.substring(0,n[0].start))+n[0].str:Common.Utils.String.htmlEncode(t),s=1;s0&&(o+=Common.Utils.String.htmlEncode(t.substring(n[s-1].end,t.length))),o},getUserName:function(t){return Common.Utils.String.htmlEncode(Common.Utils.UserInfoParser.getParsedName(t))},hide:function(){Common.UI.BaseView.prototype.hide.call(this,arguments),this.fireEvent("hide",this),this.textBoxAutoSizeLocked=void 0},setupLayout:function(){var t=this,e=$(t.el),i=this.panelBox.find(" > .layout-item");t.layout=new Common.UI.VBoxLayout({box:this.panelBox,items:[{el:i[0],rely:!0,behaviour:"splitter",resize:{hidden:!1,autohide:!1,fmin:function(){return t.usersBoxHeight},fmax:function(){return.5*t.panelBox.height()-t.messageBoxHeight}}},{el:i[1],rely:!0,behaviour:"splitter",resize:{hidden:!1,autohide:!1,fmin:function(){return Math.max(t.messageBoxHeight+t.usersBoxHeight,.5*t.panelBox.height())},fmax:function(){return t.panelBox.height()-t.addMessageBoxHeight}}},{el:i[2],stretch:!0}]}),t.layout.on("layout:resizedrag",function(e){t.updateScrolls(),t.usersCachedHeigt=t.panelUsers.height()+8+1,e.index||(t.textBoxAutoSizeLocked=!0)},this),$(window).on("resize",function(){"none"!==e.css("display")&&t.updateLayout()}),this.updateLayout();var n=this.panelBox.height();this.layout.setResizeValue(0,this.usersBoxHeight),this.layout.setResizeValue(1,Math.max(this.addMessageBoxHeight,Math.max(.5*n,n-t.panelOptions.height()-4))),this.setupAutoSizingTextBox(),this.txtMessage.bind("input propertychange",_.bind(this.updateHeightTextBox,this))},updateLayout:function(t){var e=this,i=this.panelBox.height();if(e.layout.setResizeValue(1,Math.max(e.addMessageBoxHeight,Math.max(.5*i,i-e.panelOptions.height()-4))),t){this.panelUsers.css("height");this.panelUsers.css("height","1px");var n=this.panelUsers.get(0).scrollHeight;e.layout.setResizeValue(0,Math.max(e.usersBoxHeight,Math.min(n+2,Math.floor(.5*i)-e.messageBoxHeight)))}else e.layout.setResizeValue(0,Math.max(e.usersBoxHeight,Math.min(e.usersCachedHeigt+2,Math.floor(.5*i)-e.messageBoxHeight)));e.updateScrolls(),e.updateHeightTextBox(null)},setupAutoSizingTextBox:function(){this.lineHeight=0,this.minHeight=44,this.lineHeight=1.25*parseInt(this.txtMessage.css("lineHeight"),10),this.updateHeightTextBox(!0)},updateHeightTextBox:function(t){var e,i,n=this.txtMessage;if(i=this.panelBox.height(),t&&0==n.val().length)return this.layout.setResizeValue(1,Math.max(this.addMessageBoxHeight,i-this.addMessageBoxHeight)),this.textBoxAutoSizeLocked=void 0,void this.updateScrolls();_.isUndefined(this.textBoxAutoSizeLocked)&&(n.height(),e=n.get(0).scrollHeight,n.css({height:this.minHeight+"px"}),n.height(),e=Math.max(n.get(0).scrollHeight+this.lineHeight,1),n.css({height:"100%"}),i=this.panelBox.height(),this.layout.setResizeValue(1,Math.max(this.addMessageBoxHeight,Math.min(i-e-40,i-this.addMessageBoxHeight)))&&this.updateScrolls())},updateScrolls:function(){this.panelUsers&&this.panelUsers.scroller&&this.panelMessages&&this.panelMessages.scroller&&(this.panelUsers.scroller.update({minScrollbarLength:25,alwaysVisibleY:!0}),this.panelMessages.scroller.update({minScrollbarLength:40,alwaysVisibleY:!0}))},textSend:"Send"},Common.Views.Chat||{}))}),void 0===Common)var Common={};if(Common.Views=Common.Views||{},define("common/main/lib/view/Plugins",["common/main/lib/util/utils","common/main/lib/component/BaseView","common/main/lib/component/Layout","common/main/lib/component/Window"],function(t){"use strict";Common.Views.Plugins=Common.UI.BaseView.extend(_.extend({el:"#left-panel-plugins",storePlugins:void 0,template:_.template(['
    ','','
    ',"
    ","
    ",'",'",'"].join(""),this.handler=o.handler,this.type=o.type,this.preview=o.preview,this.previewData=o.previewData,this.warning=o.warning||!1,this.closable=o.closable,this.codepages=o.codepages,this.settings=o.settings,this.api=o.api,this.validatePwd=o.validatePwd||!1,o.tpl=_.template(this.template)(o),Common.UI.Window.prototype.initialize.call(this,o)},render:function(){if(Common.UI.Window.prototype.render.call(this),this.$window){var t=this;this.closable||this.$window.find(".tool").hide(),this.$window.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this)),this.previewPanel=this.$window.find("#id-preview-data"),this.previewParent=this.previewPanel.parent(),this.previewScrolled=this.$window.find("#id-preview"),this.previewInner=this.previewScrolled.find("div:first-child"),this.type==Common.Utils.importTextType.DRM?(this.inputPwd=new Common.UI.InputField({el:$("#id-password-txt"),type:"text",validateOnBlur:!1,validation:function(e){return t.txtIncorrectPwd}}),this.$window.find("input").on("input",function(){""!==$(this).val()?"password"!==$(this).attr("type")&&$(this).attr("type","password"):$(this).attr("type","text")})):(this.initCodePages(),this.preview&&(this.previewData?this.previewCallback(this.previewData):this.updatePreview())),this.onPrimary=function(){return t._handleInput("ok"),!1}}},show:function(){if(Common.UI.Window.prototype.show.apply(this,arguments),this.type==Common.Utils.importTextType.DRM){var t=this;setTimeout(function(){t.inputPwd.cmpEl.find("input").focus(),t.validatePwd&&t.inputPwd.checkValidate()},500)}},onBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value)},onToolClose:function(){this._handleInput("cancel")},_handleInput:function(t){if(this.handler)if(this.type==Common.Utils.importTextType.DRM)this.handler.call(this,t,this.inputPwd.getValue());else{var e=this.cmbEncoding&&!this.cmbEncoding.isDisabled()?this.cmbEncoding.getValue():this.settings&&this.settings.asc_getCodePage()?this.settings.asc_getCodePage():0,i=this.cmbDelimiter?this.cmbDelimiter.getValue():null,n=-1==i?this.inputDelimiter.getValue():null;-1==i&&(i=null),this.closable||this.type!=Common.Utils.importTextType.TXT||Common.localStorage.setItem("de-settings-open-encoding",e);var o=this.separatorOptions?this.separatorOptions.decimal:void 0,s=this.separatorOptions?this.separatorOptions.thousands:void 0;this.handler.call(this,t,e,i,n,o,s)}this.close()},initCodePages:function(){var t,e,i,n=[],o=[],s=0,a=0;if(this.codepages){for(n=[],t=0;t",'
  • ','
    <%= item.displayValue %>
    ','',"
  • ","<% }); %>"].join(""));this.cmbEncoding=new Common.UI.ComboBox({el:$("#id-codepages-combo",this.$window),style:"width: 100%;",menuStyle:"min-width: 100%; max-height: 200px;",cls:"input-group-nr",menuCls:"scrollable-menu",data:o,editable:!1,disabled:!0,search:!0,itemsTemplate:l}),this.cmbEncoding.setDisabled(!1);var r=this.settings&&this.settings.asc_getCodePage()?this.settings.asc_getCodePage():n[0][0];if(!this.closable&&this.type==Common.Utils.importTextType.TXT){var c=Common.localStorage.getItem("de-settings-open-encoding");c&&(r=parseInt(c))}this.cmbEncoding.setValue(r),this.preview&&this.cmbEncoding.on("selected",_.bind(this.onCmbEncodingSelect,this));var d=this.cmbEncoding.cmpEl.find("ul"),h=d.find("li:nth(0) a"),p=d.width()-parseInt(h.css("padding-left"))-parseInt(h.css("padding-right"))-50;d.find("li div").width(p)}this.type!=Common.Utils.importTextType.CSV&&this.type!=Common.Utils.importTextType.Paste&&this.type!=Common.Utils.importTextType.Columns||(this.cmbDelimiter=new Common.UI.ComboBox({el:$("#id-delimiters-combo",this.$window),style:"width: 100px;",menuStyle:"min-width: 100px;",cls:"input-group-nr",data:[{value:4,displayValue:this.txtComma},{value:2,displayValue:this.txtSemicolon},{value:3,displayValue:this.txtColon},{value:1,displayValue:this.txtTab},{value:5,displayValue:this.txtSpace},{value:-1,displayValue:this.txtOther}],editable:!1}),this.cmbDelimiter.setValue(this.settings&&this.settings.asc_getDelimiter()?this.settings.asc_getDelimiter():4),this.cmbDelimiter.on("selected",_.bind(this.onCmbDelimiterSelect,this)),this.inputDelimiter=new Common.UI.InputField({el:$("#id-delimiter-other"),style:"width: 30px;",maxLength:1,validateOnChange:!0,validateOnBlur:!1,value:this.settings&&this.settings.asc_getDelimiterChar()?this.settings.asc_getDelimiterChar():""}),this.inputDelimiter.setVisible(!1),this.preview&&this.inputDelimiter.on("changing",_.bind(this.updatePreview,this)),this.type!=Common.Utils.importTextType.Paste&&this.type!=Common.Utils.importTextType.Columns||(this.btnAdvanced=new Common.UI.Button({el:$("#id-delimiters-advanced")}),this.btnAdvanced.on("click",_.bind(this.onAdvancedClick,this))))},updatePreview:function(){var t=this.cmbEncoding&&!this.cmbEncoding.isDisabled()?this.cmbEncoding.getValue():this.settings&&this.settings.asc_getCodePage()?this.settings.asc_getCodePage():0,e=this.cmbDelimiter?this.cmbDelimiter.getValue():null,i=-1==e?this.inputDelimiter.getValue():null;switch(-1==e&&(e=null),this.type){case Common.Utils.importTextType.CSV:this.api.asc_decodeBuffer(this.preview,new Asc.asc_CTextOptions(t,e,i),_.bind(this.previewCallback,this));break;case Common.Utils.importTextType.TXT:this.api.asc_decodeBuffer(this.preview,new Asc.asc_CTextOptions(t),_.bind(this.previewCallback,this));break;case Common.Utils.importTextType.Paste:case Common.Utils.importTextType.Columns:var n=new Asc.asc_CTextOptions(t,e,i);this.separatorOptions&&(n.asc_setNumberDecimalSeparator(this.separatorOptions.decimal),n.asc_setNumberGroupSeparator(this.separatorOptions.thousands)),this.api.asc_TextImport(n,_.bind(this.previewCallback,this),this.type==Common.Utils.importTextType.Paste)}},previewCallback:function(t){t&&t.length&&(this.data=t,this.previewInner.height(17*t.length),this.scrollerY||(this.scrollerY=new Common.UI.Scroller({el:this.previewScrolled,minScrollbarLength:20,alwaysVisibleY:!0,alwaysVisibleX:!0,onChange:_.bind(function(){if(this.scrollerY){var t=this.scrollerY.getScrollTop(),e=Math.floor(t/17+.5),i=e+Math.min(6,this.data.length);i>this.data.length&&(i=this.data.length,e=this.data.length-6,t=17*e),this.previewParent.height(108),this.previewParent.css({top:t}),this.previewDataBlock(this.data.slice(e,i))}},this)})),this.scrollerY.update(),this.scrollerY.scrollTop(0))},previewDataBlock:function(t){if(_.isUndefined(this.scrollerX)||(this.scrollerX.destroy(),delete this.scrollerX),this.type==Common.Utils.importTextType.CSV||this.type==Common.Utils.importTextType.Paste||this.type==Common.Utils.importTextType.Columns){for(var e=0,i=0;ie&&(e=t[i].length);for(var n="",i=0;i';for(var o=0;o"+Common.Utils.String.htmlEncode(t[i][o])+"";for(o=t[i].length;o";n+=""}n+="
    "}else{for(var n="",i=0;i";n+="
    '+Common.Utils.String.htmlEncode(t[i])+"
    "}this.previewPanel.html(n),this.scrollerX=new Common.UI.Scroller({el:this.previewPanel,suppressScrollY:!0,alwaysVisibleX:!0,minScrollbarLength:20})},onCmbDelimiterSelect:function(t,e){this.inputDelimiter.setVisible(-1==e.value),-1==e.value&&this.inputDelimiter.cmpEl.find("input").focus(),this.preview&&this.updatePreview()},onCmbEncodingSelect:function(t,e){this.updatePreview()},onAdvancedClick:function(){if(SSE){var t=this,e=this.api.asc_getDecimalSeparator(),i=this.api.asc_getGroupSeparator();new SSE.Views.AdvancedSeparatorDialog({props:{decimal:e,thousands:i},handler:function(n,o){"ok"==n&&(t.separatorOptions={decimal:o.decimal.length>0?o.decimal:e,thousands:o.thousands.length>0?o.thousands:i})}}).show()}},txtDelimiter:"Delimiter",txtEncoding:"Encoding ",txtSpace:"Space",txtTab:"Tab",txtTitle:"Choose %1 options",txtPassword:"Password",txtTitleProtected:"Protected File",txtOther:"Other",txtIncorrectPwd:"Password is incorrect.",closeButtonText:"Close File",txtPreview:"Preview",txtComma:"Comma",txtColon:"Colon",txtSemicolon:"Semicolon",txtProtected:"Once you enter the password and open the file, the current password to the file will be reset.",txtAdvanced:"Advanced",txtOpenFile:"Enter a password to open the file"},Common.Views.OpenDialog||{}))}),define("common/main/lib/util/LocalStorage",["gateway"],function(){Common.localStorage=new function(){var t,e,i={},n=function(t){"localstorage"==t.type&&(i=t.keys)};Common.Gateway.on("internalcommand",n);var o=function(){h||Common.Gateway.internalMessage("localstorage",{cmd:"get",keys:e})},s=function(){h||Common.Gateway.internalMessage("localstorage",{cmd:"set",keys:i})},a=function(t,e,n){if(h)try{localStorage.setItem(t,e)}catch(t){}else i[t]=e,!0===n&&Common.Gateway.internalMessage("localstorage",{cmd:"set",keys:{name:e}})},l=function(t,e,i){a(t,e?1:0,i)},r=function(t){return h?localStorage.getItem(t):void 0===i[t]?null:i[t]},c=function(t,e){var i=r(t);return e=e||!1,null!==i?0!=parseInt(i):e},d=function(t){return null!==r(t)};try{var h=!!window.localStorage}catch(t){h=!1}return{getId:function(){return t},setId:function(e){t=e},getItem:r,getBool:c,setBool:l,setItem:a,setKeysFilter:function(t){e=t},getKeysFilter:function(){return e},itemExists:d,sync:o,save:s}}}),define("presentationeditor/main/app/model/ShapeGroup",["backbone"],function(t){"use strict";PE.Models=PE.Models||{},PE.Models.ShapeModel=t.Model.extend({defaults:function(){return{id:Common.UI.getId(),imageUrl:null,data:null}}}),PE.Models.ShapeGroup=t.Model.extend({defaults:function(){return{id:Common.UI.getId(),groupName:null,groupId:null,groupStore:null}}})}),define("presentationeditor/main/app/collection/ShapeGroups",["backbone","presentationeditor/main/app/model/ShapeGroup"],function(t){"use strict";if(void 0===e)var e={};e.Collections=e.Collections||{},PE.Collections.ShapeGroups=t.Collection.extend({model:PE.Models.ShapeGroup})}),define("presentationeditor/main/app/model/SlideLayout",["backbone"],function(t){"use strict";PE.Models=PE.Models||{},PE.Models.SlideLayout=t.Model.extend({defaults:function(){return{id:Common.UI.getId(),imageUrl:null,title:null,data:null}}})}),define("presentationeditor/main/app/collection/SlideLayouts",["backbone","presentationeditor/main/app/model/SlideLayout"],function(t){"use strict";PE.Collections=PE.Collections||{},PE.Collections.SlideLayouts=t.Collection.extend({model:PE.Models.SlideLayout,findLayoutByIndex:function(t){return this.find(function(e){return e.get("data").idx==t})}})}),define("presentationeditor/main/app/model/EquationGroup",["backbone"],function(t){"use strict";PE.Models=PE.Models||{},PE.Models.EquationModel=t.Model.extend({defaults:function(){return{id:Common.UI.getId(),data:null,width:0,height:0,posX:0,posY:0}}}),PE.Models.EquationGroup=t.Model.extend({defaults:function(){return{id:Common.UI.getId(),groupName:null,groupId:null,groupStore:null}}})}),define("presentationeditor/main/app/collection/EquationGroups",["backbone","presentationeditor/main/app/model/EquationGroup"],function(t){"use strict";if(void 0===e)var e={};e.Collections=e.Collections||{},PE.Collections.EquationGroups=t.Collection.extend({model:PE.Models.EquationGroup})}),define("presentationeditor/main/app/controller/Main",["core","irregularstack","common/main/lib/component/Window","common/main/lib/component/LoadMask","common/main/lib/component/Tooltip","common/main/lib/controller/Fonts","common/main/lib/collection/TextArt","common/main/lib/view/OpenDialog","common/main/lib/util/LocalStorage","presentationeditor/main/app/collection/ShapeGroups","presentationeditor/main/app/collection/SlideLayouts","presentationeditor/main/app/collection/EquationGroups"],function(){"use strict";PE.Controllers.Main=Backbone.Controller.extend(_.extend(function(){var t,e={about:"button#left-btn-about",feedback:"button#left-btn-support",goback:"#fm-btn-back > a, #header-back > div"},i={toolbar:"#viewport #toolbar",leftMenu:"#viewport #left-menu, #viewport #id-toolbar-full-placeholder-btn-settings, #viewport #id-toolbar-short-placeholder-btn-settings",rightMenu:"#viewport #right-menu",statusBar:"#statusbar"};return Common.localStorage.setId("presentation"),Common.localStorage.setKeysFilter("pe-,asc.presentation"),Common.localStorage.sync(),{models:[],collections:["ShapeGroups","SlideLayouts","EquationGroups","Common.Collections.TextArt"],views:[],initialize:function(){this.addListeners({FileMenu:{"settings:apply":_.bind(this.applySettings,this)},"Common.Views.ReviewChanges":{"settings:apply":_.bind(this.applySettings,this)}});var t=this,e=["blank","pixel","classic","official","green","lines","office","safari","dotted","corner","turtle","basic","office theme","green leaf"],i={Series:this.txtSeries,"Diagram Title":this.txtDiagramTitle,"X Axis":this.txtXAxis,"Y Axis":this.txtYAxis,"Your text here":this.txtArt,"Slide text":this.txtSlideText,Chart:this.txtSldLtTChart,ClipArt:this.txtClipArt,Diagram:this.txtDiagram,"Date and time":this.txtDateTime,Footer:this.txtFooter,Header:this.txtHeader,Media:this.txtMedia,Picture:this.txtPicture,Image:this.txtImage,"Slide number":this.txtSlideNumber,"Slide subtitle":this.txtSlideSubtitle,Table:this.txtSldLtTTbl,"Slide title":this.txtSlideTitle,Loading:this.txtLoading,"Click to add notes":this.txtAddNotes,"Click to add first slide":this.txtAddFirstSlide};e.forEach(function(e){i[e]=t["txtTheme_"+e.replace(/ /g,"_")]||e}),t.translationTable=i},onLaunch:function(){var t=this;if(this._state={isDisconnected:!1,usersCount:1,fastCoauth:!0,lostEditingRights:!1,licenseType:!1},this.languages=null,window.storagename="presentation",this.stackLongActions=new Common.IrregularStack({strongCompare:function(t,e){return t.id===e.id&&t.type===e.type},weakCompare:function(t,e){return t.type===e.type}}),!Common.Utils.isBrowserSupported())return Common.Utils.showBrowserRestriction(),void Common.Gateway.reportError(void 0,this.unsupportedBrowserErrorText);if(window.flat_desine=!0,this.api=this.getApplication().getController("Viewport").getApi(),Common.UI.FocusManager.init(),this.api){this.api.SetDrawingFreeze(!0),this.api.SetThemesPath("../../../../sdkjs/slide/themes/");var e=Common.localStorage.getBool("pe-settings-cachemode",!0);Common.Utils.InternalSettings.set("pe-settings-cachemode",e),this.api.asc_setDefaultBlitMode(!!e),e=Common.localStorage.getItem("pe-settings-fontrender"),null===e&&(e="3"),Common.Utils.InternalSettings.set("pe-settings-fontrender",e),this.api.SetFontRenderingMode(parseInt(e)),this.api.asc_registerCallback("asc_onError",_.bind(this.onError,this)),this.api.asc_registerCallback("asc_onDocumentContentReady",_.bind(this.onDocumentContentReady,this)),this.api.asc_registerCallback("asc_onOpenDocumentProgress",_.bind(this.onOpenDocument,this)),this.api.asc_registerCallback("asc_onThumbnailsShow",_.bind(this.onThumbnailsShow,this)),this.api.asc_registerCallback("asc_onDocumentUpdateVersion",_.bind(this.onUpdateVersion,this)),this.api.asc_registerCallback("asc_onServerVersion",_.bind(this.onServerVersion,this)),this.api.asc_registerCallback("asc_onDocumentName",_.bind(this.onDocumentName,this)),this.api.asc_registerCallback("asc_onPrintUrl",_.bind(this.onPrintUrl,this)),this.api.asc_registerCallback("asc_onMeta",_.bind(this.onMeta,this)),this.api.asc_registerCallback("asc_onAdvancedOptions",_.bind(this.onAdvancedOptions,this)),this.api.asc_registerCallback("asc_onSpellCheckInit",_.bind(this.loadLanguages,this)),Common.NotificationCenter.on("api:disconnect",_.bind(this.onCoAuthoringDisconnect,this)),Common.NotificationCenter.on("goback",_.bind(this.goBack,this)),Common.NotificationCenter.on("showmessage",_.bind(this.onExternalMessage,this)),this.isShowOpenDialog=!1,this.editorConfig={},this.appOptions={},Common.Gateway.on("init",_.bind(this.loadConfig,this)),Common.Gateway.on("showmessage",_.bind(this.onExternalMessage,this)),Common.Gateway.on("opendocument",_.bind(this.loadDocument,this)),Common.Gateway.appReady(),this.getApplication().getController("Viewport").setApi(this.api),this.getApplication().getController("Statusbar").setApi(t.api),$(document.body).on("focus","input, textarea",function(e){/area_id/.test(e.target.id)||(/msg-reply/.test(e.target.className)?t.dontCloseDummyComment=!0:/textarea-control/.test(e.target.className)?t.inTextareaControl=!0:!Common.Utils.ModalWindow.isVisible()&&/form-control/.test(e.target.className)&&(t.inFormControl=!0))}),$(document.body).on("blur","input, textarea",function(e){if(!Common.Utils.ModalWindow.isVisible()){if(/form-control/.test(e.target.className)&&(t.inFormControl=!1),t.getApplication().getController("LeftMenu").getView("LeftMenu").getMenu("file").isVisible())return;if(!e.relatedTarget||!/area_id/.test(e.target.id)&&!("input"==e.target.localName&&$(e.target).parent().find(e.relatedTarget).length>0)&&!("textarea"==e.target.localName&&$(e.target).closest(".asc-window").find(".dropdown-menu").find(e.relatedTarget).length>0)&&("input"!=e.relatedTarget.localName||!/form-control/.test(e.relatedTarget.className))&&("textarea"!=e.relatedTarget.localName||/area_id/.test(e.relatedTarget.id))){if(Common.Utils.isIE&&e.originalEvent&&e.originalEvent.target&&/area_id/.test(e.originalEvent.target.id)&&e.originalEvent.target===e.originalEvent.srcElement)return;t.api.asc_enableKeyEvents(!0),/msg-reply/.test(e.target.className)?t.dontCloseDummyComment=!1:/textarea-control/.test(e.target.className)&&(t.inTextareaControl=!1)}}}).on("dragover",function(t){var e=t.originalEvent;if(e.target&&$(e.target).closest("#editor_sdk").length<1)return e.preventDefault(),e.dataTransfer.dropEffect="none",!1}).on("dragstart",function(t){var e=t.originalEvent;if(e.target){var i=$(e.target);(i.closest(".combobox").length>0||i.closest(".dropdown-menu").length>0||i.closest(".ribtab").length>0||i.closest(".combo-dataview").length>0)&&e.preventDefault()}}),Common.NotificationCenter.on({"modal:show":function(e){Common.Utils.ModalWindow.show(),t.api.asc_enableKeyEvents(!1)},"modal:close":function(e){Common.Utils.ModalWindow.close(),Common.Utils.ModalWindow.isVisible()||t.api.asc_enableKeyEvents(!0)},"modal:hide":function(e){Common.Utils.ModalWindow.close(),Common.Utils.ModalWindow.isVisible()||t.api.asc_enableKeyEvents(!0)},"settings:unitschanged":_.bind(this.unitsChanged,this),"dataview:focus":function(t){},"dataview:blur":function(e){Common.Utils.ModalWindow.isVisible()||t.api.asc_enableKeyEvents(!0)},"menu:show":function(t){},"menu:hide":function(e,i){Common.Utils.ModalWindow.isVisible()||i||t.api.asc_enableKeyEvents(!0)},"edit:complete":_.bind(t.onEditComplete,t)}),this.initNames(),Common.util.Shortcuts.delegateShortcuts({shortcuts:{"command+s,ctrl+s,command+p,ctrl+p,command+k,ctrl+k,command+d,ctrl+d":_.bind(function(t){t.preventDefault(),t.stopPropagation()},this)}})}t.defaultTitleText="ONLYOFFICE",t.warnNoLicense=t.warnNoLicense.replace(/%1/g,"ONLYOFFICE"),t.warnNoLicenseUsers=t.warnNoLicenseUsers.replace(/%1/g,"ONLYOFFICE"),t.textNoLicenseTitle=t.textNoLicenseTitle.replace(/%1/g,"ONLYOFFICE"),t.warnLicenseExceeded=t.warnLicenseExceeded.replace(/%1/g,"ONLYOFFICE"),t.warnLicenseUsersExceeded=t.warnLicenseUsersExceeded.replace(/%1/g,"ONLYOFFICE")},loadConfig:function(e){this.editorConfig=$.extend(this.editorConfig,e.config),this.editorConfig.user=this.appOptions.user=Common.Utils.fillUserInfo(e.config.user,this.editorConfig.lang,this.textAnonymous),this.appOptions.isDesktopApp="desktop"==this.editorConfig.targetApp,this.appOptions.canCreateNew=this.editorConfig.canRequestCreateNew||!_.isEmpty(this.editorConfig.createUrl),this.appOptions.canOpenRecent=void 0!==this.editorConfig.recent&&!this.appOptions.isDesktopApp,this.appOptions.templates=this.editorConfig.templates,this.appOptions.recent=this.editorConfig.recent,this.appOptions.createUrl=this.editorConfig.createUrl,this.appOptions.canRequestCreateNew=this.editorConfig.canRequestCreateNew,this.appOptions.lang=this.editorConfig.lang,this.appOptions.location="string"==typeof this.editorConfig.location?this.editorConfig.location.toLowerCase():"",this.appOptions.sharingSettingsUrl=this.editorConfig.sharingSettingsUrl,this.appOptions.saveAsUrl=this.editorConfig.saveAsUrl,this.appOptions.fileChoiceUrl=this.editorConfig.fileChoiceUrl,this.appOptions.canAnalytics=!1,this.appOptions.canRequestClose=this.editorConfig.canRequestClose,this.appOptions.customization=this.editorConfig.customization, -this.appOptions.canBackToFolder=!1!==this.editorConfig.canBackToFolder&&"object"==typeof this.editorConfig.customization&&"object"==typeof this.editorConfig.customization.goback&&(!_.isEmpty(this.editorConfig.customization.goback.url)||this.editorConfig.customization.goback.requestClose&&this.appOptions.canRequestClose),this.appOptions.canBack=!0===this.appOptions.canBackToFolder,this.appOptions.canPlugins=!1,this.appOptions.canRequestUsers=this.editorConfig.canRequestUsers,this.appOptions.canRequestSendNotify=this.editorConfig.canRequestSendNotify,this.appOptions.canRequestSaveAs=this.editorConfig.canRequestSaveAs,this.appOptions.canRequestInsertImage=this.editorConfig.canRequestInsertImage,this.appOptions.compatibleFeatures="object"==typeof this.appOptions.customization&&!!this.appOptions.customization.compatibleFeatures,this.appOptions.canRequestSharingSettings=this.editorConfig.canRequestSharingSettings,this.appOptions.mentionShare=!("object"==typeof this.appOptions.customization&&0==this.appOptions.customization.mentionShare),t=this.getApplication().getController("Viewport").getView("Common.Views.Header"),t.setCanBack(!0===this.appOptions.canBackToFolder,this.appOptions.canBackToFolder?this.editorConfig.customization.goback.text:""),this.editorConfig.lang&&this.api.asc_setLocale(this.editorConfig.lang),"us"!=this.appOptions.location&&"ca"!=this.appOptions.location||Common.Utils.Metric.setDefaultMetric(Common.Utils.Metric.c_MetricUnits.inch),this.editorConfig.customization&&(this.editorConfig.customization.toolbarNoTabs||"desktop"!==this.editorConfig.targetApp&&(this.editorConfig.customization.loaderName||this.editorConfig.customization.loaderLogo))||$("#editor-container").append('
    ');var i=Common.localStorage.getItem("pe-macros-mode");null===i?(i=this.editorConfig.customization?this.editorConfig.customization.macrosMode:"warn",i="enable"==i?1:"disable"==i?2:0):i=parseInt(i),Common.Utils.InternalSettings.set("pe-macros-mode",i),Common.Controllers.Desktop.init(this.appOptions)},loadDocument:function(e){this.permissions={},this.document=e.doc;var i={};if(e.doc){this.permissions=$.extend(this.permissions,e.doc.permissions);var n=$.extend({},e.doc.permissions),o=$.extend({},e.doc.options,this.editorConfig.actionLink||{}),s=new Asc.asc_CUserInfo;s.put_Id(this.appOptions.user.id),s.put_FullName(this.appOptions.user.fullname),i=new Asc.asc_CDocInfo,i.put_Id(e.doc.key),i.put_Url(e.doc.url),i.put_Title(e.doc.title),i.put_Format(e.doc.fileType),i.put_VKey(e.doc.vkey),i.put_Options(o),i.put_UserInfo(s),i.put_CallbackUrl(this.editorConfig.callbackUrl),i.put_Token(e.doc.token),i.put_Permissions(n),i.put_EncryptedInfo(this.editorConfig.encryptionKeys);var a=!this.editorConfig.customization||!1!==this.editorConfig.customization.macros;i.asc_putIsEnabledMacroses(!!a),a=!this.editorConfig.customization||!1!==this.editorConfig.customization.plugins,i.asc_putIsEnabledPlugins(!!a)}this.api.asc_registerCallback("asc_onGetEditorPermissions",_.bind(this.onEditorPermissions,this)),this.api.asc_registerCallback("asc_onLicenseChanged",_.bind(this.onLicenseChanged,this)),this.api.asc_registerCallback("asc_onRunAutostartMacroses",_.bind(this.onRunAutostartMacroses,this)),this.api.asc_setDocInfo(i),this.api.asc_getEditorPermissions(this.editorConfig.licenseUrl,this.editorConfig.customerId),e.doc&&t.setDocumentCaption(e.doc.title)},onProcessSaveResult:function(t){this.api.asc_OnSaveEnd(t.result),t&&!1===t.result&&Common.UI.error({title:this.criticalErrorTitle,msg:_.isEmpty(t.message)?this.errorProcessSaveResult:t.message})},onProcessRightsChange:function(t){if(t&&!1===t.enabled){var e=this,i=this._state.lostEditingRights;this._state.lostEditingRights=!this._state.lostEditingRights,this.api.asc_coAuthoringDisconnect(),Common.NotificationCenter.trigger("collaboration:sharingdeny"),Common.NotificationCenter.trigger("api:disconnect"),i||Common.UI.warning({title:this.notcriticalErrorTitle,maxwidth:600,msg:_.isEmpty(t.message)?this.warnProcessRightsChange:t.message,callback:function(){e._state.lostEditingRights=!1,e.onEditComplete()}})}},onDownloadAs:function(t){if(!this.appOptions.canDownload)return void Common.Gateway.reportError(Asc.c_oAscError.ID.AccessDeny,this.errorAccessDeny);this._state.isFromGatewayDownloadAs=!0;var e=t&&"string"==typeof t?Asc.c_oAscFileType[t.toUpperCase()]:null,i=[Asc.c_oAscFileType.PPTX,Asc.c_oAscFileType.ODP,Asc.c_oAscFileType.PDF,Asc.c_oAscFileType.PDFA,Asc.c_oAscFileType.POTX,Asc.c_oAscFileType.OTP];(!e||i.indexOf(e)<0)&&(e=Asc.c_oAscFileType.PPTX),this.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(e,!0))},onProcessMouse:function(t){if("mouseup"==t.type){var e=document.getElementById("editor_sdk");if(e){var i=e.getBoundingClientRect();this.api.OnMouseUp(t.x-i.left,t.y-i.top)}}},goBack:function(t){var e=this;if(!Common.Controllers.Desktop.process("goback"))if(e.appOptions.customization.goback.requestClose&&e.appOptions.canRequestClose)Common.Gateway.requestClose();else{var i=e.appOptions.customization.goback.url;t||!1===e.appOptions.customization.goback.blank?parent.location.href=i:window.open(i,"_blank")}},onEditComplete:function(t){var e=this.getApplication(),i=e.getController("Toolbar").getView("Toolbar");if(e.getController("DocumentHolder").getView("DocumentHolder").focus(),this.api&&this.appOptions.isEdit&&this.api.asc_isDocumentCanSave){var n=this.api.asc_isDocumentCanSave(),o=this.appOptions.forcesave,s=!!i.btnCollabChanges.rendered&&i.btnCollabChanges.cmpEl.hasClass("notify"),a=!n&&!s&&!o||this._state.isDisconnected||this._state.fastCoauth&&this._state.usersCount>1&&!o;i.btnSave.setDisabled(a)}},onLongActionBegin:function(t,e){var i={id:e,type:t};this.stackLongActions.push(i),this.setLongActionView(i)},onLongActionEnd:function(e,i){var n={id:i,type:e};if(this.stackLongActions.pop(n),t&&t.setDocumentCaption(this.api.asc_getDocumentName()),this.updateWindowTitle(!0),n=this.stackLongActions.get({type:Asc.c_oAscAsyncActionType.Information}))this.setLongActionView(n);else{var o=this;i!=Asc.c_oAscAsyncAction.Save&&i!=Asc.c_oAscAsyncAction.ForceSaveButton||this.appOptions.isOffline?o.getApplication().getController("Statusbar").setStatusCaption(""):this._state.fastCoauth&&this._state.usersCount>1?o._state.timerSave=setTimeout(function(){o.getApplication().getController("Statusbar").setStatusCaption(o.textChangesSaved,!1,3e3)},500):o.getApplication().getController("Statusbar").setStatusCaption(o.textChangesSaved,!1,3e3)}n=this.stackLongActions.get({type:Asc.c_oAscAsyncActionType.BlockInteraction}),n?this.setLongActionView(n):this.loadMask&&this.loadMask.hide(),!this.appOptions.isEdit||i!=Asc.c_oAscAsyncAction.Save&&i!=Asc.c_oAscAsyncAction.ForceSaveButton||this._state.fastCoauth&&!(this._state.usersCount<2)||this.synchronizeChanges(),e!=Asc.c_oAscAsyncActionType.BlockInteraction||(i==Asc.c_oAscAsyncAction.LoadDocumentFonts||i==Asc.c_oAscAsyncAction.ApplyChanges)&&(this.dontCloseDummyComment||this.inTextareaControl||Common.Utils.ModalWindow.isVisible()||this.inFormControl)||(this.onEditComplete(this.loadMask),this.api.asc_enableKeyEvents(!0))},setLongActionView:function(t){var e="",i="",n=!1;switch(t.id){case Asc.c_oAscAsyncAction.Open:e=this.openTitleText,i=this.openTextText;break;case Asc.c_oAscAsyncAction.Save:case Asc.c_oAscAsyncAction.ForceSaveButton:clearTimeout(this._state.timerSave),n=!0,e=this.saveTitleText,i=this.appOptions.isOffline?"":this.saveTextText;break;case Asc.c_oAscAsyncAction.ForceSaveTimeout:break;case Asc.c_oAscAsyncAction.LoadDocumentFonts:e=this.loadFontsTitleText,i=this.loadFontsTextText;break;case Asc.c_oAscAsyncAction.LoadDocumentImages:e=this.loadImagesTitleText,i=this.loadImagesTextText;break;case Asc.c_oAscAsyncAction.LoadFont:e=this.loadFontTitleText,i=this.loadFontTextText;break;case Asc.c_oAscAsyncAction.LoadImage:e=this.loadImageTitleText,i=this.loadImageTextText;break;case Asc.c_oAscAsyncAction.DownloadAs:e=this.downloadTitleText,i=this.downloadTextText;break;case Asc.c_oAscAsyncAction.Print:e=this.printTitleText,i=this.printTextText;break;case Asc.c_oAscAsyncAction.UploadImage:e=this.uploadImageTitleText,i=this.uploadImageTextText;break;case Asc.c_oAscAsyncAction.LoadTheme:e=this.loadThemeTitleText,i=this.loadThemeTextText;break;case Asc.c_oAscAsyncAction.ApplyChanges:e=this.applyChangesTitleText,i=this.applyChangesTextText;break;case Asc.c_oAscAsyncAction.PrepareToSave:e=this.savePreparingText,i=this.savePreparingTitle;break;case Asc.c_oAscAsyncAction.Waiting:e=this.waitText,i=this.waitText;break;case-255:e=this.txtEditingMode,i=this.txtEditingMode;break;case-256:e=this.loadingDocumentTitleText,i=this.loadingDocumentTextText;break;default:"string"==typeof t.id&&(e=t.id,i=t.id)}t.type==Asc.c_oAscAsyncActionType.BlockInteraction?(this.loadMask||(this.loadMask=new Common.UI.LoadMask({owner:$("#viewport")})),this.loadMask.setTitle(e),this.isShowOpenDialog||this.loadMask.show()):this.getApplication().getController("Statusbar").setStatusCaption(i,n)},onApplyEditRights:function(t){this.getApplication().getController("Statusbar").setStatusCaption(""),t&&!t.allowed&&Common.UI.info({title:this.requestEditFailedTitleText,msg:t.message||this.requestEditFailedMessageText})},onDocumentContentReady:function(){function e(){if(!window.AscDesktopEditor){var t=[];Common.Utils.isIE9m&&t.push(n.warnBrowserIE9),t.length&&n.showTips(t)}document.removeEventListener("visibilitychange",e)}if(!this._isDocReady){this._state.openDlg&&this._state.openDlg.close();var i,n=this;n._isDocReady=!0,Common.NotificationCenter.trigger("app:ready",n.appOptions),n.api.SetDrawingFreeze(!1),n.hidePreloader(),n.onLongActionEnd(Asc.c_oAscAsyncActionType.BlockInteraction,-256),Common.Utils.InternalSettings.set("pe-settings-datetime-default",Common.localStorage.getItem("pe-settings-datetime-default")),i=Common.localStorage.getItem("pe-settings-zoom"),Common.Utils.InternalSettings.set("pe-settings-zoom",i);var o=null!==i?parseInt(i):this.appOptions.customization&&this.appOptions.customization.zoom?parseInt(this.appOptions.customization.zoom):-1;-1==o?this.api.zoomFitToPage():-2==o?this.api.zoomFitToWidth():this.api.zoom(o>0?o:100),i=Common.localStorage.getBool("pe-settings-spellcheck",!(this.appOptions.customization&&!1===this.appOptions.customization.spellcheck)),Common.Utils.InternalSettings.set("pe-settings-spellcheck",i),n.api.asc_setSpellCheck(i),void 0!==document.hidden&&document.hidden?document.addEventListener("visibilitychange",e):e(),n.api.asc_registerCallback("asc_onStartAction",_.bind(n.onLongActionBegin,n)),n.api.asc_registerCallback("asc_onEndAction",_.bind(n.onLongActionEnd,n)),n.api.asc_registerCallback("asc_onCoAuthoringDisconnect",_.bind(n.onCoAuthoringDisconnect,n)),n.api.asc_registerCallback("asc_onPrint",_.bind(n.onPrint,n)),t.setDocumentCaption(n.api.asc_getDocumentName()),n.updateWindowTitle(!0),i=Common.localStorage.getBool("pe-settings-inputmode"),Common.Utils.InternalSettings.set("pe-settings-inputmode",i),n.api.SetTextBoxInputMode(i),n.appOptions.isEdit&&!n.appOptions.isOffline&&n.appOptions.canCoAuthoring?(i=Common.localStorage.getItem("pe-settings-coauthmode"),null===i&&!Common.localStorage.itemExists("pe-settings-autosave")&&n.appOptions.customization&&!1===n.appOptions.customization.autosave&&(i=0),n._state.fastCoauth=null===i||1==parseInt(i)):(n._state.fastCoauth=!n.appOptions.isEdit&&n.appOptions.isRestrictedEdit,n._state.fastCoauth&&(n.api.asc_setAutoSaveGap(1),Common.Utils.InternalSettings.set("pe-settings-autosave",1))),n.api.asc_SetFastCollaborative(n._state.fastCoauth),Common.Utils.InternalSettings.set("pe-settings-coauthmode",n._state.fastCoauth),Common.Utils.InternalSettings.set("pe-settings-showsnaplines",n.api.get_ShowSnapLines());var s=n.getApplication(),a=s.getController("Toolbar"),l=s.getController("Statusbar"),r=s.getController("DocumentHolder"),c=(s.getController("Common.Controllers.Fonts"),s.getController("RightMenu")),d=s.getController("LeftMenu"),h=s.getController("Common.Controllers.Chat"),p=s.getController("Common.Controllers.Plugins");if(d.getView("LeftMenu").getMenu("file").loadDocument({doc:n.document}),d.setMode(n.appOptions).setApi(n.api).createDelayedElements(),h.setApi(this.api).setMode(this.appOptions),s.getController("Common.Controllers.ExternalDiagramEditor").setApi(this.api).loadConfig({config:this.editorConfig,customization:this.editorConfig.customization}),p.setApi(n.api),r.setApi(n.api),r.createDelayedElements(),l.createDelayedElements(),d.getView("LeftMenu").disableMenu("all",!1),n.appOptions.canBranding&&n.getApplication().getController("LeftMenu").leftMenu.getMenu("about").setLicInfo(n.editorConfig.customization),r.getView("DocumentHolder").setApi(n.api).on("editcomplete",_.bind(n.onEditComplete,n)),s.getController("Viewport").getView("DocumentPreview").setApi(n.api).setMode(n.appOptions).on("editcomplete",_.bind(n.onEditComplete,n)),n.appOptions.isEdit){i=Common.localStorage.getItem("pe-settings-autosave"),null===i&&n.appOptions.customization&&!1===n.appOptions.customization.autosave&&(i=0),i=n._state.fastCoauth||null===i?n.appOptions.canCoAuthoring?1:0:parseInt(i),n.api.asc_setAutoSaveGap(i),Common.Utils.InternalSettings.set("pe-settings-autosave",i),n.appOptions.canForcesave&&(n.appOptions.forcesave=Common.localStorage.getBool("pe-settings-forcesave",n.appOptions.canForcesave),Common.Utils.InternalSettings.set("pe-settings-forcesave",n.appOptions.forcesave),n.api.asc_setIsForceSaveOnUserSave(n.appOptions.forcesave)),i=Common.localStorage.getItem("pe-settings-paste-button"),null===i&&(i="1"),Common.Utils.InternalSettings.set("pe-settings-paste-button",parseInt(i)),n.api.asc_setVisiblePasteButton(!!parseInt(i)),n.loadAutoCorrectSettings(),n.needToUpdateVersion&&Common.NotificationCenter.trigger("api:disconnect");var u=setInterval(function(){if(window.styles_loaded){clearInterval(u),a.createDelayedElements(),r.getView("DocumentHolder").createDelayedElements(),n.setLanguages(),n.api.asc_registerCallback("asc_onUpdateLayout",_.bind(n.fillLayoutsStore,n)),n.updateThemeColors();var t=n.api.asc_getPropertyEditorShapes();t&&n.fillAutoShapes(t[0],t[1]),c.createDelayedElements(),n.api.asc_registerCallback("asc_onFocusObject",_.bind(n.onFocusObject,n)),a.activateControls(),n.needToUpdateVersion&&a.onApiCoAuthoringDisconnect(),n.api.UpdateInterfaceState(),Common.NotificationCenter.trigger("document:ready","main"),n.applyLicense()}},50)}else r.getView("DocumentHolder").createDelayedElementsViewer(),Common.NotificationCenter.trigger("document:ready","main"),"view"!==n.editorConfig.mode&&n.applyLicense();var m=~~(1e6*Math.random());$(".toolbar").prepend(Common.Utils.String.format('
    ',m)),setTimeout(function(){$(Common.Utils.String.format(".toolbar .lazy-{0}",m)).remove()},10),this.appOptions.canAnalytics,Common.Gateway.on("applyeditrights",_.bind(n.onApplyEditRights,n)),Common.Gateway.on("processsaveresult",_.bind(n.onProcessSaveResult,n)),Common.Gateway.on("processrightschange",_.bind(n.onProcessRightsChange,n)),Common.Gateway.on("processmouse",_.bind(n.onProcessMouse,n)),Common.Gateway.on("downloadas",_.bind(n.onDownloadAs,n)),Common.Gateway.sendInfo({mode:n.appOptions.isEdit?"edit":"view"}),$(document).on("contextmenu",_.bind(n.onContextMenu,n)),Common.Gateway.documentReady(),$(".doc-placeholder").remove()}},onLicenseChanged:function(t){var e=t.asc_getLicenseType();void 0!==e&&this.appOptions.canEdit&&"view"!==this.editorConfig.mode&&(e===Asc.c_oLicenseResult.Connections||e===Asc.c_oLicenseResult.UsersCount||e===Asc.c_oLicenseResult.ConnectionsOS||e===Asc.c_oLicenseResult.UsersCountOS||e===Asc.c_oLicenseResult.SuccessLimit&&0!=(this.appOptions.trialMode&Asc.c_oLicenseMode.Limited))&&(this._state.licenseType=e),this._isDocReady&&this.applyLicense()},applyLicense:function(){},disableEditing:function(t){var e=this.getApplication();this.appOptions.canEdit&&"view"!==this.editorConfig.mode&&(e.getController("RightMenu").getView("RightMenu").clearSelection(),e.getController("Toolbar").DisableToolbar(t),e.getController("Statusbar").getView("Statusbar").SetDisabled(t))},onOpenDocument:function(t){var e=document.getElementById("loadmask-text"),i=(t.asc_getCurrentFont()+t.asc_getCurrentImage())/(t.asc_getFontsCount()+t.asc_getImagesCount());i=this.textLoadingDocument+": "+Math.min(Math.round(100*i),100)+"%",e?e.innerHTML=i:this.loadMask&&this.loadMask.setTitle(i)},onEditorPermissions:function(e){var i=e.asc_getLicenseType();this.onServerVersion(e.asc_getBuildVersion())||(e.asc_getRights()!==Asc.c_oRights.Edit&&(this.permissions.edit=!1),this.appOptions.permissionsLicense=i,this.appOptions.isOffline=this.api.asc_isOffline(),this.appOptions.isCrypted=this.api.asc_isCrypto(),this.appOptions.canLicense=i===Asc.c_oLicenseResult.Success||i===Asc.c_oLicenseResult.SuccessLimit,this.appOptions.isLightVersion=e.asc_getIsLight(),this.appOptions.canCoAuthoring=!this.appOptions.isLightVersion,this.appOptions.canRequestEditRights=this.editorConfig.canRequestEditRights,this.appOptions.canEdit=!1!==this.permissions.edit&&(this.editorConfig.canRequestEditRights||"view"!==this.editorConfig.mode),this.appOptions.isEdit=this.appOptions.canLicense&&this.appOptions.canEdit&&"view"!==this.editorConfig.mode,this.appOptions.canDownload=!1!==this.permissions.download,this.appOptions.canAnalytics=e.asc_getIsAnalyticsEnable(),this.appOptions.canComments=this.appOptions.canLicense&&(void 0===this.permissions.comment?this.appOptions.isEdit:this.permissions.comment)&&"view"!==this.editorConfig.mode,this.appOptions.canComments=this.appOptions.canComments&&!("object"==typeof this.editorConfig.customization&&!1===this.editorConfig.customization.comments),this.appOptions.canViewComments=this.appOptions.canComments||!("object"==typeof this.editorConfig.customization&&!1===this.editorConfig.customization.comments),this.appOptions.canChat=this.appOptions.canLicense&&!this.appOptions.isOffline&&!("object"==typeof this.editorConfig.customization&&!1===this.editorConfig.customization.chat),this.appOptions.canPrint=!1!==this.permissions.print,this.appOptions.canRename=this.editorConfig.canRename,this.appOptions.canForcesave=this.appOptions.isEdit&&!this.appOptions.isOffline&&"object"==typeof this.editorConfig.customization&&!!this.editorConfig.customization.forcesave,this.appOptions.forcesave=this.appOptions.canForcesave,this.appOptions.canEditComments=this.appOptions.isOffline||!("object"==typeof this.editorConfig.customization&&this.editorConfig.customization.commentAuthorOnly),this.appOptions.buildVersion=e.asc_getBuildVersion(),this.appOptions.trialMode=e.asc_getLicenseMode(),this.appOptions.isBeta=e.asc_getIsBeta(),this.appOptions.isSignatureSupport=this.appOptions.isEdit&&this.appOptions.isDesktopApp&&this.appOptions.isOffline&&this.api.asc_isSignaturesSupport(),this.appOptions.isPasswordSupport=this.appOptions.isEdit&&this.appOptions.isDesktopApp&&this.appOptions.isOffline&&this.api.asc_isProtectionSupport(),this.appOptions.canProtect=this.appOptions.isSignatureSupport||this.appOptions.isPasswordSupport,this.appOptions.canHelp=!("object"==typeof this.editorConfig.customization&&!1===this.editorConfig.customization.help),this.appOptions.isRestrictedEdit=!this.appOptions.isEdit&&this.appOptions.canComments,this.appOptions.canBranding=e.asc_getCustomization(),this.appOptions.canBranding&&t.setBranding(this.editorConfig.customization),this.appOptions.canUseReviewPermissions=this.appOptions.canLicense&&this.editorConfig.customization&&this.editorConfig.customization.reviewPermissions&&"object"==typeof this.editorConfig.customization.reviewPermissions,Common.Utils.UserInfoParser.setParser(this.appOptions.canUseReviewPermissions),t.setUserName(Common.Utils.UserInfoParser.getParsedName(this.appOptions.user.fullname)),this.appOptions.canRename&&t.setCanRename(!0),this.appOptions.canBrandingExt=e.asc_getCanBranding()&&("object"==typeof this.editorConfig.customization||this.editorConfig.plugins),this.getApplication().getController("Common.Controllers.Plugins").setMode(this.appOptions),this.applyModeCommonElements(),this.applyModeEditorElements(),this.appOptions.isEdit||(Common.NotificationCenter.trigger("app:face",this.appOptions),this.hidePreloader(),this.onLongActionBegin(Asc.c_oAscAsyncActionType.BlockInteraction,-256)),this.api.asc_setViewMode(!this.appOptions.isEdit&&!this.appOptions.isRestrictedEdit),this.appOptions.isRestrictedEdit&&this.appOptions.canComments&&this.api.asc_setRestriction(Asc.c_oAscRestrictionType.OnlyComments),this.api.asc_LoadDocument())},applyModeCommonElements:function(){window.editor_elements_prepared=!0;var t=this.getApplication(),e=t.getController("Viewport").getView("Viewport"),i=t.getController("Statusbar").getView("Statusbar"),n=t.getController("DocumentHolder").getView("DocumentHolder"),o=t.getController("Toolbar");e&&e.setMode(this.appOptions,!0),i&&i.setMode(this.appOptions),o.setMode(this.appOptions),n.setMode(this.appOptions),this.api.asc_registerCallback("asc_onSendThemeColors",_.bind(this.onSendThemeColors,this)),this.api.asc_registerCallback("asc_onDownloadUrl",_.bind(this.onDownloadUrl,this)),this.api.asc_registerCallback("asc_onDocumentModifiedChanged",_.bind(this.onDocumentModifiedChanged,this))},applyModeEditorElements:function(t){var e=this.getApplication().getController("Common.Controllers.Comments");e&&(e.setMode(this.appOptions),e.setConfig({config:this.editorConfig,sdkviewname:"#id_main_parent"},this.api));var i=this,n=this.getApplication();if(n.getController("Common.Controllers.ReviewChanges").setMode(i.appOptions).setConfig({config:i.editorConfig},i.api).loadDocument({doc:i.document}),this.appOptions.isEdit||this.appOptions.isRestrictedEdit){var o=n.getController("Toolbar");if(o&&o.setApi(i.api),!this.appOptions.isEdit)return;var s=n.getController("RightMenu"),a=n.getController("Common.Controllers.Fonts");a&&a.setApi(i.api),s&&s.setApi(i.api),i.appOptions.canProtect&&n.getController("Common.Controllers.Protection").setMode(i.appOptions).setConfig({config:i.editorConfig},i.api),this.getApplication().getController("Viewport").getView("Viewport").applyEditorMode();var l=s.getView("RightMenu");l&&(l.setApi(i.api),l.on("editcomplete",_.bind(i.onEditComplete,i)),l.setMode(i.appOptions));var r=o?o.getView("Toolbar"):null;r&&(r.setApi(i.api),r.on("editcomplete",_.bind(i.onEditComplete,i)),r.on("insertimage",_.bind(i.onInsertImage,i)),r.on("inserttable",_.bind(i.onInsertTable,i)),r.on("insertshape",_.bind(i.onInsertShape,i)),r.on("insertchart",_.bind(i.onInsertChart,i)),r.on("inserttextart",_.bind(i.onInsertTextArt,i)));var c=Common.localStorage.getItem("pe-settings-unit");c=null!==c?parseInt(c):i.appOptions.customization&&i.appOptions.customization.unit?Common.Utils.Metric.c_MetricUnits[i.appOptions.customization.unit.toLocaleLowerCase()]:Common.Utils.Metric.getDefaultMetric(),void 0===c&&(c=Common.Utils.Metric.getDefaultMetric()),Common.Utils.Metric.setCurrentMetric(c),Common.Utils.InternalSettings.set("pe-settings-unit",c),i.api.asc_SetDocumentUnits(c==Common.Utils.Metric.c_MetricUnits.inch?Asc.c_oAscDocumentUnits.Inch:c==Common.Utils.Metric.c_MetricUnits.pt?Asc.c_oAscDocumentUnits.Point:Asc.c_oAscDocumentUnits.Millimeter),i.api.asc_SetViewRulers&&i.api.asc_SetViewRulers(!Common.localStorage.getBool("pe-hidden-rulers",!0)),i.api.asc_registerCallback("asc_onChangeObjectLock",_.bind(i._onChangeObjectLock,i)),i.api.asc_registerCallback("asc_onDocumentCanSaveChanged",_.bind(i.onDocumentCanSaveChanged,i)),i.api.asc_registerCallback("asc_onCollaborativeChanges",_.bind(i.onCollaborativeChanges,i)),i.api.asc_registerCallback("asc_OnTryUndoInFastCollaborative",_.bind(i.onTryUndoInFastCollaborative,i)),i.api.asc_registerCallback("asc_onAuthParticipantsChanged",_.bind(i.onAuthParticipantsChanged,i)),i.api.asc_registerCallback("asc_onParticipantsChanged",_.bind(i.onAuthParticipantsChanged,i)),i.stackLongActions.exist({id:-255,type:Asc.c_oAscAsyncActionType.BlockInteraction})?i.onLongActionEnd(Asc.c_oAscAsyncActionType.BlockInteraction,-255):this._isDocReady||(Common.NotificationCenter.trigger("app:face",i.appOptions),i.hidePreloader(),i.onLongActionBegin(Asc.c_oAscAsyncActionType.BlockInteraction,-256)),window.onbeforeunload=_.bind(i.onBeforeUnload,i),window.onunload=_.bind(i.onUnload,i)}},onExternalMessage:function(t){t&&t.msg&&(t.msg=t.msg.toString(),this.showTips([t.msg.charAt(0).toUpperCase()+t.msg.substring(1)]),Common.component.Analytics.trackEvent("External Error"))},onError:function(t,e,i){if(t==Asc.c_oAscError.ID.LoadingScriptError)return this.showTips([this.scriptLoadError]),void(this.tooltip&&this.tooltip.getBSTip().$tip.css("z-index",1e4));this.hidePreloader(),this.onLongActionEnd(Asc.c_oAscAsyncActionType.BlockInteraction,-256);var n={closable:!0};switch(t){case Asc.c_oAscError.ID.Unknown:n.msg=this.unknownErrorText;break;case Asc.c_oAscError.ID.ConvertationTimeout:n.msg=this.convertationTimeoutText;break;case Asc.c_oAscError.ID.ConvertationOpenError:n.msg=this.openErrorText;break;case Asc.c_oAscError.ID.ConvertationSaveError:n.msg=this.appOptions.isDesktopApp&&this.appOptions.isOffline?this.saveErrorTextDesktop:this.saveErrorText;break;case Asc.c_oAscError.ID.DownloadError:n.msg=this.downloadErrorText;break;case Asc.c_oAscError.ID.UplImageSize:n.msg=this.uploadImageSizeMessage;break;case Asc.c_oAscError.ID.UplImageExt:n.msg=this.uploadImageExtMessage;break;case Asc.c_oAscError.ID.UplImageFileCount:n.msg=this.uploadImageFileCountMessage;break;case Asc.c_oAscError.ID.SplitCellMaxRows:n.msg=this.splitMaxRowsErrorText.replace("%1",i.get_Value());break;case Asc.c_oAscError.ID.SplitCellMaxCols:n.msg=this.splitMaxColsErrorText.replace("%1",i.get_Value());break;case Asc.c_oAscError.ID.SplitCellRowsDivider:n.msg=this.splitDividerErrorText.replace("%1",i.get_Value());break;case Asc.c_oAscError.ID.VKeyEncrypt:n.msg=this.errorToken;break;case Asc.c_oAscError.ID.KeyExpire:n.msg=this.errorTokenExpire;break;case Asc.c_oAscError.ID.UserCountExceed:n.msg=this.errorUsersExceed;break;case Asc.c_oAscError.ID.CoAuthoringDisconnect:n.msg=this.errorViewerDisconnect;break;case Asc.c_oAscError.ID.ConvertationPassword:n.msg=this.errorFilePassProtect;break;case Asc.c_oAscError.ID.StockChartError:n.msg=this.errorStockChart;break;case Asc.c_oAscError.ID.DataRangeError:n.msg=this.errorDataRange;break;case Asc.c_oAscError.ID.Database:n.msg=this.errorDatabaseConnection;break;case Asc.c_oAscError.ID.UserDrop:if(this._state.lostEditingRights)return void(this._state.lostEditingRights=!1);this._state.lostEditingRights=!0,n.msg=this.errorUserDrop,Common.NotificationCenter.trigger("collaboration:sharingdeny");break;case Asc.c_oAscError.ID.Warning:n.msg=this.errorConnectToServer,n.closable=!1;break;case Asc.c_oAscError.ID.SessionAbsolute:n.msg=this.errorSessionAbsolute;break;case Asc.c_oAscError.ID.SessionIdle:n.msg=this.errorSessionIdle;break;case Asc.c_oAscError.ID.SessionToken:n.msg=this.errorSessionToken;break;case Asc.c_oAscError.ID.AccessDeny:n.msg=this.errorAccessDeny;break;case Asc.c_oAscError.ID.UplImageUrl:n.msg=this.errorBadImageUrl;break;case Asc.c_oAscError.ID.ForceSaveButton:n.msg=this.errorForceSave;break;case Asc.c_oAscError.ID.ForceSaveTimeout:n.msg=this.errorForceSave,console.warn(n.msg);break;case Asc.c_oAscError.ID.DataEncrypted:n.msg=this.errorDataEncrypted;break;case Asc.c_oAscError.ID.EditingError:n.msg=this.appOptions.isDesktopApp&&this.appOptions.isOffline?this.errorEditingSaveas:this.errorEditingDownloadas;break;case Asc.c_oAscError.ID.MailToClientMissing:n.msg=this.errorEmailClient;break;case Asc.c_oAscError.ID.ConvertationOpenLimitError:n.msg=this.errorFileSizeExceed;break;case Asc.c_oAscError.ID.UpdateVersion:n.msg=this.errorUpdateVersionOnDisconnect,n.maxwidth=600;break;default:n.msg="string"==typeof t?t:this.errorDefaultMessage.replace("%1",t)}e==Asc.c_oAscError.Level.Critical?(Common.Gateway.reportError(t,n.msg),n.title=this.criticalErrorTitle,n.iconCls="error",n.closable=!1,this.appOptions.canBackToFolder&&!this.appOptions.isDesktopApp&&"string"!=typeof t&&(n.msg+="

    "+this.criticalErrorExtText,n.callback=function(t){"ok"==t&&Common.NotificationCenter.trigger("goback",!0)}),t==Asc.c_oAscError.ID.DataEncrypted&&(this.api.asc_coAuthoringDisconnect(),Common.NotificationCenter.trigger("api:disconnect"))):(Common.Gateway.reportWarning(t,n.msg),n.title=this.notcriticalErrorTitle,n.iconCls="warn",n.buttons=["ok"],n.callback=_.bind(function(e){if(t==Asc.c_oAscError.ID.Warning&&"ok"==e&&this.appOptions.canDownload)Common.UI.Menu.Manager.hideAll(),this.appOptions.isDesktopApp&&this.appOptions.isOffline?this.api.asc_DownloadAs():this.getApplication().getController("LeftMenu").leftMenu.showMenu("file:saveas");else if(t==Asc.c_oAscError.ID.SplitCellMaxRows||t==Asc.c_oAscError.ID.SplitCellMaxCols||t==Asc.c_oAscError.ID.SplitCellRowsDivider){var i=this;setTimeout(function(){new Common.Views.InsertTableDialog({split:!0,handler:function(t,e){"ok"==t&&i.api&&i.api.SplitCell(e.columns,e.rows),i.onEditComplete()}}).show()},10)}else t==Asc.c_oAscError.ID.EditingError&&(this.disableEditing(!0),Common.NotificationCenter.trigger("api:disconnect",!0));this._state.lostEditingRights=!1,this.onEditComplete()},this)),t!==Asc.c_oAscError.ID.ForceSaveTimeout&&(!Common.Utils.ModalWindow.isVisible()||$(".asc-window.modal.alert[data-value="+t+"]").length<1)&&Common.UI.alert(n).$window.attr("data-value",t),void 0!==t&&Common.component.Analytics.trackEvent("Internal Error",t.toString())},onCoAuthoringDisconnect:function(){this.getApplication().getController("Viewport").getView("Viewport").setMode({isDisconnected:!0}),t.setCanRename(!1),this.appOptions.canRename=!1,this._state.isDisconnected=!0},showTips:function(t){function e(){var e=t.shift();e&&(e+="\n"+i.textCloseTip,n.setTitle(e),n.show())}var i=this;if(t.length){"object"!=typeof t&&(t=[t]),this.tooltip||(this.tooltip=new Common.UI.Tooltip({owner:this.getApplication().getController("Toolbar").getView("Toolbar"),hideonclick:!0,placement:"bottom",cls:"main-info",offset:30}));var n=this.tooltip;n.on("tooltip:hide",function(){setTimeout(e,300)}),e()}},updateWindowTitle:function(e){var i=this.api.isDocumentModified();if(this._state.isDocModified!==i||e){var n=this.defaultTitleText;t&&!_.isEmpty(t.getDocumentCaption())&&(n=t.getDocumentCaption()+" - "+n),i&&(clearTimeout(this._state.timerCaption),_.isUndefined(n)||(n="* "+n)),window.document.title!=n&&(window.document.title=n),Common.Gateway.setDocumentModified(i),i&&(!this._state.fastCoauth||this._state.usersCount<2)&&this.getApplication().getController("Statusbar").setStatusCaption("",!0),this._state.isDocModified=i}},onDocumentChanged:function(){},onDocumentModifiedChanged:function(){var t=this.api.asc_isDocumentCanSave();this._state.isDocModified!==t&&Common.Gateway.setDocumentModified(this.api.isDocumentModified()),this.updateWindowTitle();var e=this.getApplication().getController("Toolbar").getView("Toolbar");if(e&&e.btnCollabChanges){var i=e.btnCollabChanges.cmpEl.hasClass("notify"),n=this.appOptions.forcesave,o=!t&&!i&&!n||this._state.isDisconnected||this._state.fastCoauth&&this._state.usersCount>1&&!n;e.btnSave.setDisabled(o)}},onDocumentCanSaveChanged:function(t){var e=this.getApplication().getController("Toolbar").getView("Toolbar");if(e){var i=e.btnCollabChanges.cmpEl.hasClass("notify"),n=this.appOptions.forcesave,o=!t&&!i&&!n||this._state.isDisconnected||this._state.fastCoauth&&this._state.usersCount>1&&!n;e.btnSave.setDisabled(o)}},onContextMenu:function(t){var e=t.target.getAttribute("data-can-copy"),i=t.target instanceof HTMLInputElement||t.target instanceof HTMLTextAreaElement;if(i&&"false"===e||!i&&"true"!==e)return t.stopPropagation(),t.preventDefault(),!1},onBeforeUnload:function(){if(Common.localStorage.save(),this.api.isDocumentModified()){ -var t=this;return this.api.asc_stopSaving(),this.continueSavingTimer=window.setTimeout(function(){t.api.asc_continueSaving()},500),this.leavePageText}},onUnload:function(){this.continueSavingTimer&&clearTimeout(this.continueSavingTimer)},hidePreloader:function(){var t;this._state.customizationDone||(this._state.customizationDone=!0,this.appOptions.customization&&(this.appOptions.isDesktopApp?this.appOptions.customization.about=!1:this.appOptions.canBrandingExt||(this.appOptions.customization.about=!0)),Common.Utils.applyCustomization(this.appOptions.customization,e),this.appOptions.canBrandingExt&&(Common.Utils.applyCustomization(this.appOptions.customization,i),t=this.getApplication().getController("Common.Controllers.Plugins").applyUICustomization())),Common.NotificationCenter.trigger("layout:changed","main"),(t||new Promise(function(t,e){t()})).then(function(){$("#loading-mask").hide().remove(),Common.Controllers.Desktop.process("preloader:hide")})},onDownloadUrl:function(t){this._state.isFromGatewayDownloadAs&&Common.Gateway.downloadAs(t),this._state.isFromGatewayDownloadAs=!1},onUpdateVersion:function(t){var e=this;e.needToUpdateVersion=!0,e.onLongActionEnd(Asc.c_oAscAsyncActionType.BlockInteraction,-256),Common.UI.error({msg:this.errorUpdateVersion,callback:function(){_.defer(function(){Common.Gateway.updateVersion(),t&&t.call(e),e.onLongActionBegin(Asc.c_oAscAsyncActionType.BlockInteraction,-256)})}})},onServerVersion:function(t){return!1},fillUserStore:function(t){if(!_.isEmpty(t)){var e=this.getCommonStoreUsersStore();e&&e.add(t)}},onCollaborativeChanges:function(){this._state.hasCollaborativeChanges||(this._state.hasCollaborativeChanges=!0,this.appOptions.isEdit&&this.getApplication().getController("Statusbar").setStatusCaption(this.txtNeedSynchronize,!0))},synchronizeChanges:function(){this.getApplication().getController("Statusbar").setStatusCaption(""),this.getApplication().getController("DocumentHolder").getView("DocumentHolder").hideTips(),this.getApplication().getController("Toolbar").getView("Toolbar").synchronizeChanges(),this._state.hasCollaborativeChanges=!1},initNames:function(){this.shapeGroupNames=[this.txtBasicShapes,this.txtFiguredArrows,this.txtMath,this.txtCharts,this.txtStarsRibbons,this.txtCallouts,this.txtButtons,this.txtRectangles,this.txtLines],this.layoutNames=[this.txtSldLtTBlank,this.txtSldLtTChart,this.txtSldLtTChartAndTx,this.txtSldLtTClipArtAndTx,this.txtSldLtTClipArtAndVertTx,this.txtSldLtTCust,this.txtSldLtTDgm,this.txtSldLtTFourObj,this.txtSldLtTMediaAndTx,this.txtSldLtTObj,this.txtSldLtTObjAndTwoObj,this.txtSldLtTObjAndTx,this.txtSldLtTObjOnly,this.txtSldLtTObjOverTx,this.txtSldLtTObjTx,this.txtSldLtTPicTx,this.txtSldLtTSecHead,this.txtSldLtTTbl,this.txtSldLtTTitle,this.txtSldLtTTitleOnly,this.txtSldLtTTwoColTx,this.txtSldLtTTwoObj,this.txtSldLtTTwoObjAndObj,this.txtSldLtTTwoObjAndTx,this.txtSldLtTTwoObjOverTx,this.txtSldLtTTwoTxTwoObj,this.txtSldLtTTx,this.txtSldLtTTxAndChart,this.txtSldLtTTxAndClipArt,this.txtSldLtTTxAndMedia,this.txtSldLtTTxAndObj,this.txtSldLtTTxAndTwoObj,this.txtSldLtTTxOverObj,this.txtSldLtTVertTitleAndTx,this.txtSldLtTVertTitleAndTxOverChart,this.txtSldLtTVertTx]},onInsertTable:function(){this.getApplication().getController("RightMenu").onInsertTable()},onInsertImage:function(){this.getApplication().getController("RightMenu").onInsertImage()},onInsertChart:function(){this.getApplication().getController("RightMenu").onInsertChart()},onInsertShape:function(){this.getApplication().getController("RightMenu").onInsertShape()},onInsertTextArt:function(){this.getApplication().getController("RightMenu").onInsertTextArt()},unitsChanged:function(t){var e=Common.localStorage.getItem("pe-settings-unit");e=null!==e?parseInt(e):Common.Utils.Metric.getDefaultMetric(),Common.Utils.Metric.setCurrentMetric(e),Common.Utils.InternalSettings.set("pe-settings-unit",e),this.api.asc_SetDocumentUnits(e==Common.Utils.Metric.c_MetricUnits.inch?Asc.c_oAscDocumentUnits.Inch:e==Common.Utils.Metric.c_MetricUnits.pt?Asc.c_oAscDocumentUnits.Point:Asc.c_oAscDocumentUnits.Millimeter),this.getApplication().getController("RightMenu").updateMetricUnit()},updateThemeColors:function(){var t=this;setTimeout(function(){t.getApplication().getController("RightMenu").UpdateThemeColors()},50),setTimeout(function(){t.getApplication().getController("Toolbar").updateThemeColors()},50)},onSendThemeColors:function(t,e){if(Common.Utils.ThemeColor.setColors(t,e),window.styles_loaded){this.updateThemeColors();var i=this;setTimeout(function(){i.fillTextArt()},1)}},onFocusObject:function(t){var e=this.getApplication().getController("RightMenu");e&&e.onFocusObject.call(e,t)},_onChangeObjectLock:function(){var t=this.api.getSelectedElements();this.onFocusObject(t),this.getApplication().getController("Toolbar")._onFocusObject(t)},onThumbnailsShow:function(t){this.isThumbnailsShow=t},fillAutoShapes:function(t,e){if(!_.isEmpty(e)&&!_.isEmpty(t)&&e.length==t.length){var i=this,n=[];_.each(t,function(t,o){var s=new Backbone.Collection([],{model:PE.Models.ShapeModel}),a=[],l=e[o].length>18?7:6,r=35*Math.ceil(e[o].length/l)+3,c=30*l;_.each(e[o],function(t,e){a.push({data:{shapeType:t.Type},tip:i["txtShape_"+t.Type]||i.textShape+" "+(e+1),allowSelected:!0,selected:!1})}),s.add(a),n.push({groupName:i.shapeGroupNames[o],groupStore:s,groupWidth:c,groupHeight:r})}),this.getCollection("ShapeGroups").reset(n)}},fillLayoutsStore:function(t){var e=this;if(!_.isEmpty(t)){var i=this.getCollection("SlideLayouts");if(i){var n=[];_.each(t,function(t){var i=t.get_Name();n.push({imageUrl:t.get_Image(),title:""!==i?i:e.layoutNames[t.getType()],itemWidth:t.get_Width(),itemHeight:t.get_Height(),data:{type:t.getType(),idx:t.getIndex()},allowSelected:!0,selected:!1})}),i.reset(n)}}},fillTextArt:function(t){var e=[],i=this.getCollection("Common.Collections.TextArt");!t&&i.length>0&&(t=this.api.asc_getTextArtPreviews()),_.isEmpty(t)||(_.each(t,function(t,i){e.push({imageUrl:t,data:i,allowSelected:!0,selected:!1})}),i.reset(e))},loadLanguages:function(t){var e,i=[],n=Common.util.LanguageInfo.getLanguages();for(var o in n)n.hasOwnProperty(o)&&(e=n[o],e[2]&&i.push({displayValue:e[1],value:e[0],code:parseInt(o),spellcheck:_.indexOf(t,o)>-1}));i.sort(function(t,e){return t.valuee.value?1:0}),this.languages=i,window.styles_loaded&&this.setLanguages()},setLanguages:function(){(!this.languages||this.languages.length<1)&&this.loadLanguages([]),this.languages&&this.languages.length>0&&(this.getApplication().getController("DocumentHolder").getView("DocumentHolder").setLanguages(this.languages),this.getApplication().getController("Statusbar").setLanguages(this.languages),this.getApplication().getController("Common.Controllers.ReviewChanges").setLanguages(this.languages))},onTryUndoInFastCollaborative:function(){Common.localStorage.getBool("pe-hide-try-undoredo")||Common.UI.info({width:500,msg:this.textTryUndoRedo,iconCls:"info",buttons:["custom","cancel"],primary:"custom",customButtonText:this.textStrict,dontshow:!0,callback:_.bind(function(t,e){e&&Common.localStorage.setItem("pe-hide-try-undoredo",1),"custom"==t&&(Common.localStorage.setItem("pe-settings-coauthmode",0),this.api.asc_SetFastCollaborative(!1),Common.Utils.InternalSettings.set("pe-settings-coauthmode",!1),this.getApplication().getController("Common.Controllers.ReviewChanges").applySettings(),this._state.fastCoauth=!1),this.onEditComplete()},this)})},onAuthParticipantsChanged:function(t){var e=0;_.each(t,function(t){t.asc_getView()||e++}),this._state.usersCount=e},applySettings:function(){if(this.appOptions.isEdit&&!this.appOptions.isOffline&&this.appOptions.canCoAuthoring){var t=this._state.fastCoauth;this._state.fastCoauth=Common.localStorage.getBool("pe-settings-coauthmode",!0),this._state.fastCoauth&&!t&&this.synchronizeChanges()}this.appOptions.canForcesave&&(this.appOptions.forcesave=Common.localStorage.getBool("pe-settings-forcesave",this.appOptions.canForcesave),Common.Utils.InternalSettings.set("pe-settings-forcesave",this.appOptions.forcesave),this.api.asc_setIsForceSaveOnUserSave(this.appOptions.forcesave))},onDocumentName:function(e){t.setDocumentCaption(e),this.updateWindowTitle(!0)},onMeta:function(e){t.setDocumentCaption(e.title),this.updateWindowTitle(!0),this.document.title=e.title;var i=this.getApplication().getController("LeftMenu").getView("LeftMenu").getMenu("file");i.loadDocument({doc:this.document}),i.panels&&i.panels.info&&i.panels.info.updateInfo(this.document),this.getApplication().getController("Common.Controllers.ReviewChanges").loadDocument({doc:this.document}),Common.Gateway.metaChange(e)},onPrint:function(){this.appOptions.canPrint&&!Common.Utils.ModalWindow.isVisible()&&(this.api&&this.api.asc_Print(new Asc.asc_CDownloadOptions(null,Common.Utils.isChrome||Common.Utils.isSafari||Common.Utils.isOpera)),Common.component.Analytics.trackEvent("Print"))},onPrintUrl:function(t){if(this.iframePrint&&(this.iframePrint.parentNode.removeChild(this.iframePrint),this.iframePrint=null),!this.iframePrint){var e=this;this.iframePrint=document.createElement("iframe"),this.iframePrint.id="id-print-frame",this.iframePrint.style.display="none",this.iframePrint.style.visibility="hidden",this.iframePrint.style.position="fixed",this.iframePrint.style.right="0",this.iframePrint.style.bottom="0",document.body.appendChild(this.iframePrint),this.iframePrint.onload=function(){try{e.iframePrint.contentWindow.focus(),e.iframePrint.contentWindow.print(),e.iframePrint.contentWindow.blur(),window.focus()}catch(t){e.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(Asc.c_oAscFileType.PDF))}}}t&&(this.iframePrint.src=t)},onAdvancedOptions:function(t,e){if(!this._state.openDlg){var i=this;t==Asc.c_oAscAdvancedOptionsID.DRM&&(i._state.openDlg=new Common.Views.OpenDialog({title:Common.Views.OpenDialog.prototype.txtTitleProtected,closeFile:i.appOptions.canRequestClose,type:Common.Utils.importTextType.DRM,warning:!(i.appOptions.isDesktopApp&&i.appOptions.isOffline),warningMsg:e,validatePwd:!!i._state.isDRM,handler:function(e,n){i.isShowOpenDialog=!1,"ok"==e?i.api&&(i.api.asc_setAdvancedOptions(t,new Asc.asc_CDRMAdvancedOptions(n)),i.loadMask&&i.loadMask.show()):(Common.Gateway.requestClose(),Common.Controllers.Desktop.requestClose()),i._state.openDlg=null}}),i._state.isDRM=!0),i._state.openDlg&&(this.isShowOpenDialog=!0,this.loadMask&&this.loadMask.hide(),this.onLongActionEnd(Asc.c_oAscAsyncActionType.BlockInteraction,-256),i._state.openDlg.show())}},warningDocumentIsLocked:function(){var t=this;Common.Utils.warningDocumentIsLocked({disablefunc:function(e){var i=t.getApplication();t.disableEditing(e),i.getController("RightMenu").SetDisabled(e,!0),i.getController("Common.Controllers.ReviewChanges").SetDisabled(e),i.getController("DocumentHolder").getView("DocumentHolder").SetDisabled(e);var n=i.getController("LeftMenu");n.leftMenu.getMenu("file").getButton("protect").setDisabled(e),n.setPreviewMode(e);var o=i.getController("Common.Controllers.Comments");o&&o.setPreviewMode(e)}})},onRunAutostartMacroses:function(){var t=this;if(!this.editorConfig.customization||!1!==this.editorConfig.customization.macros){var e=Common.Utils.InternalSettings.get("pe-macros-mode");1==e?this.api.asc_runAutostartMacroses():0===e&&Common.UI.warning({msg:this.textHasMacros+"
    ",buttons:["yes","no"],primary:"yes",dontshow:!0,textDontShow:this.textRemember,callback:function(e,i){i&&(Common.Utils.InternalSettings.set("pe-macros-mode","yes"==e?1:2),Common.localStorage.setItem("pe-macros-mode","yes"==e?1:2)),"yes"==e&&setTimeout(function(){t.api.asc_runAutostartMacroses()},1)}})}},loadAutoCorrectSettings:function(){var t=this,e=Common.localStorage.getItem("pe-settings-math-correct-add");Common.Utils.InternalSettings.set("pe-settings-math-correct-add",e);var i=e?JSON.parse(e):[];e=Common.localStorage.getItem("pe-settings-math-correct-rem"),Common.Utils.InternalSettings.set("pe-settings-math-correct-rem",e);var n=e?JSON.parse(e):[];e=Common.localStorage.getBool("pe-settings-math-correct-replace-type",!0),Common.Utils.InternalSettings.set("pe-settings-math-correct-replace-type",e),t.api.asc_refreshOnStartAutoCorrectMathSymbols(n,i,e),e=Common.localStorage.getItem("pe-settings-rec-functions-add"),Common.Utils.InternalSettings.set("pe-settings-rec-functions-add",e),i=e?JSON.parse(e):[],e=Common.localStorage.getItem("pe-settings-rec-functions-rem"),Common.Utils.InternalSettings.set("pe-settings-rec-functions-rem",e),n=e?JSON.parse(e):[],t.api.asc_refreshOnStartAutoCorrectMathFunctions(n,i),e=Common.localStorage.getBool("pe-settings-autoformat-bulleted",!0),Common.Utils.InternalSettings.set("pe-settings-autoformat-bulleted",e),t.api.asc_SetAutomaticBulletedLists(e),e=Common.localStorage.getBool("pe-settings-autoformat-numbered",!0),Common.Utils.InternalSettings.set("pe-settings-autoformat-numbered",e),t.api.asc_SetAutomaticNumberedLists(e),e=Common.localStorage.getBool("pe-settings-autoformat-smart-quotes",!0),Common.Utils.InternalSettings.set("pe-settings-autoformat-smart-quotes",e),t.api.asc_SetAutoCorrectSmartQuotes(e),e=Common.localStorage.getBool("pe-settings-autoformat-hyphens",!0),Common.Utils.InternalSettings.set("pe-settings-autoformat-hyphens",e),t.api.asc_SetAutoCorrectHyphensWithDash(e)},leavePageText:"You have unsaved changes in this document. Click 'Stay on this Page' then 'Save' to save them. Click 'Leave this Page' to discard all the unsaved changes.",criticalErrorTitle:"Error",notcriticalErrorTitle:"Warning",errorDefaultMessage:"Error code: %1",criticalErrorExtText:'Press "OK" to to back to document list.',openTitleText:"Opening Document",openTextText:"Opening document...",loadFontsTitleText:"Loading Data",loadFontsTextText:"Loading data...",loadImagesTitleText:"Loading Images",loadImagesTextText:"Loading images...",loadFontTitleText:"Loading Data",loadFontTextText:"Loading data...",loadImageTitleText:"Loading Image",loadImageTextText:"Loading image...",downloadTitleText:"Downloading Document",downloadTextText:"Downloading document...",printTitleText:"Printing Document",printTextText:"Printing document...",uploadImageTitleText:"Uploading Image",uploadImageTextText:"Uploading image...",uploadImageSizeMessage:"Maximium image size limit exceeded.",uploadImageExtMessage:"Unknown image format.",uploadImageFileCountMessage:"No images uploaded.",reloadButtonText:"Reload Page",unknownErrorText:"Unknown error.",convertationTimeoutText:"Convertation timeout exceeded.",downloadErrorText:"Download failed.",unsupportedBrowserErrorText:"Your browser is not supported.",splitMaxRowsErrorText:"The number of rows must be less than %1",splitMaxColsErrorText:"The number of columns must be less than %1",splitDividerErrorText:"The number of rows must be a divisor of %1",requestEditFailedTitleText:"Access denied",requestEditFailedMessageText:"Someone is editing this document right now. Please try again later.",txtSldLtTBlank:"Blank",txtSldLtTChart:"Chart",txtSldLtTChartAndTx:"Chart and Text",txtSldLtTClipArtAndTx:"Clip Art and Text",txtSldLtTClipArtAndVertTx:"Clip Art and Vertical Text",txtSldLtTCust:"Custom",txtSldLtTDgm:"Diagram",txtSldLtTFourObj:"Four Objects",txtSldLtTMediaAndTx:"Media and Text",txtSldLtTObj:"Title and Object",txtSldLtTObjAndTwoObj:"Object and Two Object",txtSldLtTObjAndTx:"Object and Text",txtSldLtTObjOnly:"Object",txtSldLtTObjOverTx:"Object over Text",txtSldLtTObjTx:"Title, Object, and Caption",txtSldLtTPicTx:"Picture and Caption",txtSldLtTSecHead:"Section Header",txtSldLtTTbl:"Table",txtSldLtTTitle:"Title",txtSldLtTTitleOnly:"Title Only",txtSldLtTTwoColTx:"Two Column Text",txtSldLtTTwoObj:"Two Objects",txtSldLtTTwoObjAndObj:"Two Objects and Object",txtSldLtTTwoObjAndTx:"Two Objects and Text",txtSldLtTTwoObjOverTx:"Two Objects over Text",txtSldLtTTwoTxTwoObj:"Two Text and Two Objects",txtSldLtTTx:"Text",txtSldLtTTxAndChart:"Text and Chart",txtSldLtTTxAndClipArt:"Text and Clip Art",txtSldLtTTxAndMedia:"Text and Media",txtSldLtTTxAndObj:"Text and Object",txtSldLtTTxAndTwoObj:"Text and Two Objects",txtSldLtTTxOverObj:"Text over Object",txtSldLtTVertTitleAndTx:"Vertical Title and Text",txtSldLtTVertTitleAndTxOverChart:"Vertical Title and Text Over Chart",txtSldLtTVertTx:"Vertical Text",textLoadingDocument:"Loading presentation",warnBrowserZoom:"Your browser's current zoom setting is not fully supported. Please reset to the default zoom by pressing Ctrl+0.",warnBrowserIE9:"The application has low capabilities on IE9. Use IE10 or higher",loadThemeTitleText:"Loading Theme",loadThemeTextText:"Loading theme...",txtBasicShapes:"Basic Shapes",txtFiguredArrows:"Figured Arrows",txtMath:"Math",txtCharts:"Charts",txtStarsRibbons:"Stars & Ribbons",txtCallouts:"Callouts",txtButtons:"Buttons",txtRectangles:"Rectangles",txtLines:"Lines",errorKeyEncrypt:"Unknown key descriptor",errorKeyExpire:"Key descriptor expired",errorUsersExceed:"Count of users was exceed",txtEditingMode:"Set editing mode...",errorCoAuthoringDisconnect:"Server connection lost. You can't edit anymore.",errorFilePassProtect:"The file is password protected and cannot be opened.",textAnonymous:"Anonymous",txtNeedSynchronize:"You have an updates",applyChangesTitleText:"Loading Data",applyChangesTextText:"Loading data...",savePreparingText:"Preparing to save",savePreparingTitle:"Preparing to save. Please wait...",loadingDocumentTitleText:"Loading presentation",loadingDocumentTextText:"Loading presentation...",warnProcessRightsChange:"You have been denied the right to edit the file.",errorProcessSaveResult:"Saving is failed.",textCloseTip:"Click to close the tip.",textShape:"Shape",errorStockChart:"Incorrect row order. To build a stock chart place the data on the sheet in the following order:
    opening price, max price, min price, closing price.",errorDataRange:"Incorrect data range.",errorDatabaseConnection:"External error.
    Database connection error. Please, contact support.",errorUpdateVersion:"The file version has been changed. The page will be reloaded.",errorUserDrop:"The file cannot be accessed right now.",txtDiagramTitle:"Chart Title",txtXAxis:"X Axis",txtYAxis:"Y Axis",txtSeries:"Seria",txtArt:"Your text here",errorConnectToServer:" The document could not be saved. Please check connection settings or contact your administrator.
    When you click the 'OK' button, you will be prompted to download the document.",textTryUndoRedo:"The Undo/Redo functions are disabled for the Fast co-editing mode.
    Click the 'Strict mode' button to switch to the Strict co-editing mode to edit the file without other users interference and send your changes only after you save them. You can switch between the co-editing modes using the editor Advanced settings.",textStrict:"Strict mode",textBuyNow:"Visit website",textNoLicenseTitle:"License limit reached",textContactUs:"Contact sales",errorViewerDisconnect:"Connection is lost. You can still view the document,
    but will not be able to download or print until the connection is restored and page is reloaded.",warnLicenseExp:"Your license has expired.
    Please update your license and refresh the page.",titleLicenseExp:"License expired",openErrorText:"An error has occurred while opening the file",saveErrorText:"An error has occurred while saving the file",errorToken:"The document security token is not correctly formed.
    Please contact your Document Server administrator.",errorTokenExpire:"The document security token has expired.
    Please contact your Document Server administrator.",errorSessionAbsolute:"The document editing session has expired. Please reload the page.",errorSessionIdle:"The document has not been edited for quite a long time. Please reload the page.",errorSessionToken:"The connection to the server has been interrupted. Please reload the page.",errorAccessDeny:"You are trying to perform an action you do not have rights for.
    Please contact your Document Server administrator.",titleServerVersion:"Editor updated",errorServerVersion:"The editor version has been updated. The page will be reloaded to apply the changes.",errorBadImageUrl:"Image url is incorrect",txtSlideText:"Slide text",txtClipArt:"Clip Art",txtDiagram:"SmartArt",txtDateTime:"Date and time",txtFooter:"Footer",txtHeader:"Header",txtMedia:"Media",txtPicture:"Picture",txtImage:"Image",txtSlideNumber:"Slide number",txtSlideSubtitle:"Slide subtitle",txtSlideTitle:"Slide title",textChangesSaved:"All changes saved",saveTitleText:"Saving Document",saveTextText:"Saving document...",txtLoading:"Loading...",txtAddNotes:"Click to add notes",errorForceSave:"An error occurred while saving the file. Please use the 'Download as' option to save the file to your computer hard drive or try again later.",txtAddFirstSlide:"Click to add first slide",txtTheme_blank:"Blank",txtTheme_pixel:"Pixel",txtTheme_classic:"Classic",txtTheme_official:"Official",txtTheme_green:"Green",txtTheme_lines:"Lines",txtTheme_office:"Office",txtTheme_safari:"Safari",txtTheme_dotted:"Dotted",txtTheme_corner:"Corner",txtTheme_turtle:"Turtle",txtTheme_basic:"Basic",txtTheme_green_leaf:"Green leaf",txtTheme_office_theme:"Office Theme",warnNoLicense:"You've reached the limit for simultaneous connections to %1 editors. This document will be opened for viewing only.
    Contact %1 sales team for personal upgrade terms.",warnNoLicenseUsers:"You've reached the user limit for %1 editors. Contact %1 sales team for personal upgrade terms.",warnLicenseExceeded:"You've reached the limit for simultaneous connections to %1 editors. This document will be opened for viewing only.
    Contact your administrator to learn more.",warnLicenseUsersExceeded:"You've reached the user limit for %1 editors. Contact your administrator to learn more.",errorDataEncrypted:"Encrypted changes have been received, they cannot be deciphered.",textClose:"Close",textPaidFeature:"Paid feature",scriptLoadError:"The connection is too slow, some of the components could not be loaded. Please reload the page.",errorEditingSaveas:"An error occurred during the work with the document.
    Use the 'Save as...' option to save the file backup copy to your computer hard drive.",errorEditingDownloadas:"An error occurred during the work with the document.
    Use the 'Download as...' option to save the file backup copy to your computer hard drive.",txtShape_textRect:"Text Box",txtShape_rect:"Rectangle",txtShape_ellipse:"Ellipse",txtShape_triangle:"Triangle",txtShape_rtTriangle:"Right Triangle",txtShape_parallelogram:"Parallelogram",txtShape_trapezoid:"Trapezoid",txtShape_diamond:"Diamond",txtShape_pentagon:"Pentagon",txtShape_hexagon:"Hexagon",txtShape_heptagon:"Heptagon",txtShape_octagon:"Octagon",txtShape_decagon:"Decagon",txtShape_dodecagon:"Dodecagon",txtShape_pie:"Pie",txtShape_chord:"Chord",txtShape_teardrop:"Teardrop",txtShape_frame:"Frame",txtShape_halfFrame:"Half Frame",txtShape_corner:"Corner",txtShape_diagStripe:"Diagonal Stripe",txtShape_plus:"Plus",txtShape_plaque:"Sign",txtShape_can:"Can",txtShape_cube:"Cube",txtShape_bevel:"Bevel",txtShape_donut:"Donut",txtShape_noSmoking:'"No" Symbol',txtShape_blockArc:"Block Arc",txtShape_foldedCorner:"Folded Corner",txtShape_smileyFace:"Smiley Face",txtShape_heart:"Heart",txtShape_lightningBolt:"Lightning Bolt",txtShape_sun:"Sun",txtShape_moon:"Moon",txtShape_cloud:"Cloud",txtShape_arc:"Arc",txtShape_bracePair:"Double Brace",txtShape_leftBracket:"Left Bracket",txtShape_rightBracket:"Right Bracket",txtShape_leftBrace:"Left Brace",txtShape_rightBrace:"Right Brace",txtShape_rightArrow:"Right Arrow",txtShape_leftArrow:"Left Arrow",txtShape_upArrow:"Up Arrow",txtShape_downArrow:"Down Arrow",txtShape_leftRightArrow:"Left Right Arrow",txtShape_upDownArrow:"Up Down Arrow",txtShape_quadArrow:"Quad Arrow",txtShape_leftRightUpArrow:"Left Right Up Arrow",txtShape_bentArrow:"Bent Arrow",txtShape_uturnArrow:"U-Turn Arrow",txtShape_leftUpArrow:"Left Up Arrow",txtShape_bentUpArrow:"Bent Up Arrow",txtShape_curvedRightArrow:"Curved Right Arrow",txtShape_curvedLeftArrow:"Curved Left Arrow",txtShape_curvedUpArrow:"Curved Up Arrow",txtShape_curvedDownArrow:"Curved Down Arrow",txtShape_stripedRightArrow:"Striped Right Arrow",txtShape_notchedRightArrow:"Notched Right Arrow",txtShape_homePlate:"Pentagon",txtShape_chevron:"Chevron",txtShape_rightArrowCallout:"Right Arrow Callout",txtShape_downArrowCallout:"Down Arrow Callout",txtShape_leftArrowCallout:"Left Arrow Callout",txtShape_upArrowCallout:"Up Arrow Callout",txtShape_leftRightArrowCallout:"Left Right Arrow Callout",txtShape_quadArrowCallout:"Quad Arrow Callout",txtShape_circularArrow:"Circular Arrow",txtShape_mathPlus:"Plus",txtShape_mathMinus:"Minus",txtShape_mathMultiply:"Multiply",txtShape_mathDivide:"Division",txtShape_mathEqual:"Equal",txtShape_mathNotEqual:"Not Equal",txtShape_flowChartProcess:"Flowchart: Process",txtShape_flowChartAlternateProcess:"Flowchart: Alternate Process",txtShape_flowChartDecision:"Flowchart: Decision",txtShape_flowChartInputOutput:"Flowchart: Data",txtShape_flowChartPredefinedProcess:"Flowchart: Predefined Process",txtShape_flowChartInternalStorage:"Flowchart: Internal Storage",txtShape_flowChartDocument:"Flowchart: Document",txtShape_flowChartMultidocument:"Flowchart: Multidocument ",txtShape_flowChartTerminator:"Flowchart: Terminator",txtShape_flowChartPreparation:"Flowchart: Preparation",txtShape_flowChartManualInput:"Flowchart: Manual Input",txtShape_flowChartManualOperation:"Flowchart: Manual Operation",txtShape_flowChartConnector:"Flowchart: Connector",txtShape_flowChartOffpageConnector:"Flowchart: Off-page Connector",txtShape_flowChartPunchedCard:"Flowchart: Card",txtShape_flowChartPunchedTape:"Flowchart: Punched Tape",txtShape_flowChartSummingJunction:"Flowchart: Summing Junction",txtShape_flowChartOr:"Flowchart: Or",txtShape_flowChartCollate:"Flowchart: Collate",txtShape_flowChartSort:"Flowchart: Sort",txtShape_flowChartExtract:"Flowchart: Extract",txtShape_flowChartMerge:"Flowchart: Merge",txtShape_flowChartOnlineStorage:"Flowchart: Stored Data",txtShape_flowChartDelay:"Flowchart: Delay",txtShape_flowChartMagneticTape:"Flowchart: Sequential Access Storage",txtShape_flowChartMagneticDisk:"Flowchart: Magnetic Disk",txtShape_flowChartMagneticDrum:"Flowchart: Direct Access Storage",txtShape_flowChartDisplay:"Flowchart: Display",txtShape_irregularSeal1:"Explosion 1",txtShape_irregularSeal2:"Explosion 2",txtShape_star4:"4-Point Star",txtShape_star5:"5-Point Star",txtShape_star6:"6-Point Star",txtShape_star7:"7-Point Star",txtShape_star8:"8-Point Star",txtShape_star10:"10-Point Star",txtShape_star12:"12-Point Star",txtShape_star16:"16-Point Star",txtShape_star24:"24-Point Star",txtShape_star32:"32-Point Star",txtShape_ribbon2:"Up Ribbon",txtShape_ribbon:"Down Ribbon",txtShape_ellipseRibbon2:"Curved Up Ribbon",txtShape_ellipseRibbon:"Curved Down Ribbon",txtShape_verticalScroll:"Vertical Scroll",txtShape_horizontalScroll:"Horizontal Scroll",txtShape_wave:"Wave",txtShape_doubleWave:"Double Wave",txtShape_wedgeRectCallout:"Rectangular Callout",txtShape_wedgeRoundRectCallout:"Rounded Rectangular Callout",txtShape_wedgeEllipseCallout:"Oval Callout",txtShape_cloudCallout:"Cloud Callout",txtShape_borderCallout1:"Line Callout 1",txtShape_borderCallout2:"Line Callout 2",txtShape_borderCallout3:"Line Callout 3",txtShape_accentCallout1:"Line Callout 1 (Accent Bar)",txtShape_accentCallout2:"Line Callout 2 (Accent Bar)",txtShape_accentCallout3:"Line Callout 3 (Accent Bar)",txtShape_callout1:"Line Callout 1 (No Border)",txtShape_callout2:"Line Callout 2 (No Border)",txtShape_callout3:"Line Callout 3 (No Border)",txtShape_accentBorderCallout1:"Line Callout 1 (Border and Accent Bar)",txtShape_accentBorderCallout2:"Line Callout 2 (Border and Accent Bar)",txtShape_accentBorderCallout3:"Line Callout 3 (Border and Accent Bar)",txtShape_actionButtonBackPrevious:"Back or Previous Button",txtShape_actionButtonForwardNext:"Forward or Next Button",txtShape_actionButtonBeginning:"Beginning Button",txtShape_actionButtonEnd:"End Button",txtShape_actionButtonHome:"Home Button",txtShape_actionButtonInformation:"Information Button",txtShape_actionButtonReturn:"Return Button",txtShape_actionButtonMovie:"Movie Button",txtShape_actionButtonDocument:"Document Button",txtShape_actionButtonSound:"Sound Button",txtShape_actionButtonHelp:"Help Button",txtShape_actionButtonBlank:"Blank Button",txtShape_roundRect:"Round Corner Rectangle",txtShape_snip1Rect:"Snip Single Corner Rectangle",txtShape_snip2SameRect:"Snip Same Side Corner Rectangle",txtShape_snip2DiagRect:"Snip Diagonal Corner Rectangle",txtShape_snipRoundRect:"Snip and Round Single Corner Rectangle",txtShape_round1Rect:"Round Single Corner Rectangle",txtShape_round2SameRect:"Round Same Side Corner Rectangle",txtShape_round2DiagRect:"Round Diagonal Corner Rectangle",txtShape_line:"Line",txtShape_lineWithArrow:"Arrow",txtShape_lineWithTwoArrows:"Double Arrow",txtShape_bentConnector5:"Elbow Connector",txtShape_bentConnector5WithArrow:"Elbow Arrow Connector",txtShape_bentConnector5WithTwoArrows:"Elbow Double-Arrow Connector",txtShape_curvedConnector3:"Curved Connector",txtShape_curvedConnector3WithArrow:"Curved Arrow Connector",txtShape_curvedConnector3WithTwoArrows:"Curved Double-Arrow Connector",txtShape_spline:"Curve",txtShape_polyline1:"Scribble",txtShape_polyline2:"Freeform",errorEmailClient:"No email client could be found",textCustomLoader:"Please note that according to the terms of the license you are not entitled to change the loader.
    Please contact our Sales Department to get a quote.",waitText:"Please, wait...",errorFileSizeExceed:"The file size exceeds the limitation set for your server.
    Please contact your Document Server administrator for details.",errorUpdateVersionOnDisconnect:"Internet connection has been restored, and the file version has been changed.
    Before you can continue working, you need to download the file or copy its content to make sure nothing is lost, and then reload this page.",textHasMacros:"The file contains automatic macros.
    Do you want to run macros?",textRemember:"Remember my choice",warnLicenseLimitedRenewed:"License needs to be renewed.
    You have a limited access to document editing functionality.
    Please contact your administrator to get full access",warnLicenseLimitedNoAccess:"License expired.
    You have no access to document editing functionality.
    Please contact your administrator.",saveErrorTextDesktop:"This file cannot be saved or created.
    Possible reasons are:
    1. The file is read-only.
    2. The file is being edited by other users.
    3. The disk is full or corrupted."}}(),PE.Controllers.Main||{}))}),define("common/main/lib/view/DocumentAccessDialog",["common/main/lib/component/Window","common/main/lib/component/LoadMask"],function(){"use strict";Common.Views.DocumentAccessDialog=Common.UI.Window.extend(_.extend({initialize:function(t){var e={};_.extend(e,{title:this.textTitle,width:600,height:536,header:!0},t),this.template=['
    '].join(""),e.tpl=_.template(this.template)(e),this.settingsurl=t.settingsurl||"",Common.UI.Window.prototype.initialize.call(this,e)},render:function(){Common.UI.Window.prototype.render.call(this),this.$window.find("> .body").css({height:"auto",overflow:"hidden"});var t=document.createElement("iframe");t.width="100%",t.height=500,t.align="top",t.frameBorder=0,t.scrolling="no",t.onload=_.bind(this._onLoad,this),$("#id-sharing-placeholder").append(t),this.loadMask=new Common.UI.LoadMask({owner:$("#id-sharing-placeholder")}),this.loadMask.setTitle(this.textLoading),this.loadMask.show(),t.src=this.settingsurl;var e=this;this._eventfunc=function(t){e._onWindowMessage(t)},this._bindWindowEvents.call(this),this.on("close",function(t){e._unbindWindowEvents()})},_bindWindowEvents:function(){window.addEventListener?window.addEventListener("message",this._eventfunc,!1):window.attachEvent&&window.attachEvent("onmessage",this._eventfunc)},_unbindWindowEvents:function(){ -window.removeEventListener?window.removeEventListener("message",this._eventfunc):window.detachEvent&&window.detachEvent("onmessage",this._eventfunc)},_onWindowMessage:function(t){if(t&&window.JSON)try{this._onMessage.call(this,window.JSON.parse(t.data))}catch(t){}},_onMessage:function(t){t&&"onlyoffice"==t.Referer&&(t.needUpdate&&this.trigger("accessrights",this,t.sharingSettings),Common.NotificationCenter.trigger("window:close",this))},_onLoad:function(){this.loadMask&&this.loadMask.hide()},textTitle:"Sharing Settings",textLoading:"Loading"},Common.Views.DocumentAccessDialog||{}))}),define("text!common/main/lib/template/AutoCorrectDialog.template",[],function(){return'
    \n
    \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
    \n
    \n
    \n \n \n
    \n
    \n
    \n
    \n
    \n
    \n \n \n \n
    \n
    \n
    \n
    \n
    \n \n \n \n \n \n \n \n \n \n \n \n \n \n
    \n \n
    \n
    \n
    \n
    \n
    \n \n \n \n
    \n
    \n
    \n
    \n
    \n
    \n \n
    \n
    \n
    \n
    \n
    \n
    \n \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n \n
    \n
    \n
    \n
    \n
    \n
    \n'}),void 0===Common)var Common={};if(define("common/main/lib/view/AutoCorrectDialog",["text!common/main/lib/template/AutoCorrectDialog.template","common/main/lib/component/ListView","common/main/lib/component/Window","common/main/lib/component/CheckBox"],function(t){"use strict";var e=new Common.UI.DataViewStore,i=new Common.UI.DataViewStore;Common.Views.AutoCorrectDialog=Common.Views.AdvancedSettingsWindow.extend(_.extend({options:{contentWidth:375,height:430,buttons:null,toggleGroup:"autocorrect-dialog-group"},initialize:function(e){var i=Common.localStorage.getKeysFilter();this.appPrefix=i&&i.length?i.split(",")[0]:"";var n=[{panelId:"id-autocorrect-dialog-settings-math",panelCaption:this.textMathCorrect},{panelId:"id-autocorrect-dialog-settings-recognized",panelCaption:this.textRecognized}];"de-"==this.appPrefix||"pe-"==this.appPrefix?n.push({panelId:"id-autocorrect-dialog-settings-de-autoformat",panelCaption:this.textAutoFormat}):"sse-"==this.appPrefix&&n.push({panelId:"id-autocorrect-dialog-settings-sse-autoformat",panelCaption:this.textAutoFormat}),_.extend(this.options,{title:this.textTitle,storageName:this.appPrefix+"autocorrect-dialog-category",items:n,template:['
    ','",'
    ','
    '+_.template(t)({scope:this})+"
    ","
    ",'
    ','"].join("")},e||{}),this.api=this.options.api;var o=this.appPrefix+"settings-math-correct",s=Common.Utils.InternalSettings.get(o+"-add");this.arrAdd=s?JSON.parse(s):[],s=Common.Utils.InternalSettings.get(o+"-rem"),this.arrRem=s?JSON.parse(s):[],o=this.appPrefix+"settings-rec-functions",s=Common.Utils.InternalSettings.get(o+"-add"),this.arrAddRec=s?JSON.parse(s):[],s=Common.Utils.InternalSettings.get(o+"-rem"),this.arrRemRec=s?JSON.parse(s):[],Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this,this.options)},render:function(){Common.Views.AdvancedSettingsWindow.prototype.render.call(this);var t=this.getChild(),n=this;this.chReplaceType=new Common.UI.CheckBox({el:t.findById("#auto-correct-chb-replace-type"),labelText:this.textReplaceType,value:Common.Utils.InternalSettings.get(this.appPrefix+"settings-math-correct-replace-type")}).on("change",function(t,e,i,o){var s="checked"===t.getValue();Common.localStorage.setBool(n.appPrefix+"settings-math-correct-replace-type",s),Common.Utils.InternalSettings.set(n.appPrefix+"settings-math-correct-replace-type",s),n.api.asc_updateFlagAutoCorrectMathSymbols(s)}),this.onInitList(),this.mathList=new Common.UI.ListView({el:t.find("#auto-correct-math-list"),store:new Common.UI.DataViewStore(e.slice(0,9)),simpleAddMode:!1,template:_.template(['
    '].join("")),itemTemplate:_.template(['
    ','
    <%= replaced %>
    ','
    <%= by %>
    ',"
    "].join("")),scrollAlwaysVisible:!0,tabindex:1}),this.mathList.on("item:select",_.bind(this.onSelectMathItem,this)),this.inputReplace=new Common.UI.InputField({el:t.find("#auto-correct-replace"),allowBlank:!0,validateOnChange:!0,maxLength:31,validation:function(){return!0}}).on("changing",function(t,e){var i;if(e.length){i=n.mathList.store.find(function(t){if(0==t.get("replaced").indexOf(e))return!0}),i&&(n.mathList.scrollToRecord(i,!0),i.get("replaced")==e?n.mathList.selectRecord(i,!0):i=null)}!i&&n.mathList.deselectAll(),n.updateControls(i)}),this.inputReplace.cmpEl.find("input").on("keydown",function(t){if("ArrowDown"==t.key){var e=n.mathList.getSelectedRec()||n.mathList.store.at(0);e&&(n.mathList.selectRecord(e),n.mathList.scrollToRecord(e)),_.delay(function(){n.mathList.focus()},10)}}),this.inputBy=new Common.UI.InputField({el:t.find("#auto-correct-by"),allowBlank:!0,validateOnChange:!0,maxLength:255,validation:function(){return!0}}).on("changing",function(t,e){n.updateControls()}),this.btnReset=new Common.UI.Button({el:$("#auto-correct-btn-reset")}),this.btnReset.on("click",_.bind(this.onResetToDefault,this)),this.btnEdit=new Common.UI.Button({el:$("#auto-correct-btn-edit")}),this.btnEdit.on("click",_.bind(this.onEdit,this,!1)),this.btnDelete=new Common.UI.Button({el:$("#auto-correct-btn-delete")}),this.btnDelete.on("click",_.bind(this.onDelete,this,!1)),this.onInitRecList(),this.mathRecList=new Common.UI.ListView({el:t.find("#auto-correct-recognized-list"),store:new Common.UI.DataViewStore(i.slice(0,9)),simpleAddMode:!1,template:_.template(['
    '].join("")),itemTemplate:_.template(['
    <%= value %>
    '].join("")),scrollAlwaysVisible:!0,tabindex:1}),this.mathRecList.on("item:select",_.bind(this.onSelectRecItem,this)),this.inputRecFind=new Common.UI.InputField({el:t.find("#auto-correct-rec-find"),allowBlank:!0,validateOnChange:!0,maxLength:255,validation:function(){return!0}}).on("changing",function(t,e){var i;if(e.length){i=n.mathRecList.store.find(function(t){if(0==t.get("value").indexOf(e))return!0}),i&&(n.mathRecList.scrollToRecord(i,!0),i.get("value")==e?n.mathRecList.selectRecord(i,!0):i=null)}!i&&n.mathRecList.deselectAll(),n.updateRecControls(i)}),this.inputRecFind.cmpEl.find("input").on("keydown",function(t){if("ArrowDown"==t.key){var e=n.mathRecList.getSelectedRec()||n.mathRecList.store.at(0);e&&(n.mathRecList.selectRecord(e),n.mathRecList.scrollToRecord(e)),_.delay(function(){n.mathRecList.focus()},10)}}),this.btnResetRec=new Common.UI.Button({el:$("#auto-correct-btn-rec-reset")}),this.btnResetRec.on("click",_.bind(this.onResetRecToDefault,this)),this.btnAddRec=new Common.UI.Button({el:$("#auto-correct-btn-rec-edit")}),this.btnAddRec.on("click",_.bind(this.onAddRec,this,!1)),this.btnDeleteRec=new Common.UI.Button({el:$("#auto-correct-btn-rec-delete")}),this.btnDeleteRec.on("click",_.bind(this.onDeleteRec,this,!1)),"de-"==this.appPrefix||"pe-"==this.appPrefix?(this.chQuotes=new Common.UI.CheckBox({el:$("#id-autocorrect-dialog-chk-quotes"),labelText:this.textQuotes,value:Common.Utils.InternalSettings.get(this.appPrefix+"settings-autoformat-smart-quotes")}).on("change",function(t,e,i,o){var s="checked"===t.getValue();Common.localStorage.setBool(n.appPrefix+"settings-autoformat-smart-quotes",s),Common.Utils.InternalSettings.set(n.appPrefix+"settings-autoformat-smart-quotes",s),n.api.asc_SetAutoCorrectSmartQuotes(s)}),this.chHyphens=new Common.UI.CheckBox({el:$("#id-autocorrect-dialog-chk-hyphens"),labelText:this.textHyphens,value:Common.Utils.InternalSettings.get(this.appPrefix+"settings-autoformat-hyphens")}).on("change",function(t,e,i,o){var s="checked"===t.getValue();Common.localStorage.setBool(n.appPrefix+"settings-autoformat-hyphens",s),Common.Utils.InternalSettings.set(n.appPrefix+"settings-autoformat-hyphens",s),n.api.asc_SetAutoCorrectHyphensWithDash(s)}),this.chBulleted=new Common.UI.CheckBox({el:$("#id-autocorrect-dialog-chk-bulleted"),labelText:this.textBulleted,value:Common.Utils.InternalSettings.get(this.appPrefix+"settings-autoformat-bulleted")}).on("change",function(t,e,i,o){var s="checked"===t.getValue();Common.localStorage.setBool(n.appPrefix+"settings-autoformat-bulleted",s),Common.Utils.InternalSettings.set(n.appPrefix+"settings-autoformat-bulleted",s),n.api.asc_SetAutomaticBulletedLists(s)}),this.chNumbered=new Common.UI.CheckBox({el:$("#id-autocorrect-dialog-chk-numbered"),labelText:this.textNumbered,value:Common.Utils.InternalSettings.get(this.appPrefix+"settings-autoformat-numbered")}).on("change",function(t,e,i,o){var s="checked"===t.getValue();Common.localStorage.setBool(n.appPrefix+"settings-autoformat-numbered",s),Common.Utils.InternalSettings.set(n.appPrefix+"settings-autoformat-numbered",s),n.api.asc_SetAutomaticNumberedLists(s)})):"sse-"==this.appPrefix&&(this.chNewRows=new Common.UI.CheckBox({el:$("#id-autocorrect-dialog-chk-new-rows"),labelText:this.textNewRowCol,value:Common.Utils.InternalSettings.get(this.appPrefix+"settings-autoformat-new-rows")}).on("change",function(t,e,i,o){var s="checked"===t.getValue();Common.localStorage.setBool(n.appPrefix+"settings-autoformat-new-rows",s),Common.Utils.InternalSettings.set(n.appPrefix+"settings-autoformat-new-rows",s),n.api.asc_setIncludeNewRowColTable(s)})),this.btnsCategory[0].on("click",_.bind(this.onMathCategoryClick,this,!1)),this.btnsCategory[1].on("click",_.bind(this.onRecCategoryClick,this,!1)),this.afterRender()},afterRender:function(){if(this.updateControls(),this.updateRecControls(),this.storageName){var t=Common.localStorage.getItem(this.storageName);this.setActiveCategory(null!==t?parseInt(t):0)}},getFocusedComponents:function(){return[this.inputReplace,this.inputBy,{cmp:this.mathList,selector:".listview"},this.inputRecFind,{cmp:this.mathRecList,selector:".listview"}]},getSettings:function(){},onSelectMathItem:function(t,e,i){i&&(this.inputReplace.setValue(i.get("replaced")),this.inputBy.setValue(i.get("by"))),this.updateControls(i)},updateControls:function(t){if(this.mathList){t=t||this.mathList.getSelectedRec();var e=this.inputBy.getValue(),i=this.inputReplace.getValue();if(t){var n=t.get("defaultDisabled"),o=t.get("defaultValue")&&t.get("defaultValueStr")!==t.get("by");this.btnDelete.setCaption(n?this.textRestore:this.textDelete),this.btnEdit.setDisabled(n||e===t.get("by")&&!o||!e||!i),this.btnEdit.setCaption(o&&e===t.get("by")?this.textReset:this.textReplace)}else this.btnDelete.setCaption(this.textDelete),this.btnEdit.setDisabled(!e||!i),this.btnEdit.setCaption(this.textAdd);this.btnDelete.setDisabled(!t)}},show:function(){Common.Views.AdvancedSettingsWindow.prototype.show.apply(this,arguments);var t=this.getActiveCategory();0==t?this.onMathCategoryClick(!0):1==t&&this.onRecCategoryClick(!0)},close:function(){Common.Views.AdvancedSettingsWindow.prototype.close.apply(this,arguments),this.mathList&&this.mathList.deselectAll(),this.mathRecList&&this.mathRecList.deselectAll()},onMathCategoryClick:function(t){var i=this;_.delay(function(){$("input",i.inputReplace.cmpEl).select().focus()},t?50:0),i.mathList.store.length=0&&this.arrAdd.splice(s,1)):(i=this.inputBy.getValue(),t.set("by",i),s<0?this.arrAdd.push([t.get("replaced"),i]):this.arrAdd[s][1]=i),o(t,i))},this)})}else t=e.add({replaced:this.inputReplace.getValue(),by:this.inputBy.getValue(),defaultDisabled:!1}),i=t.get("by"),this.arrAdd.push([t.get("replaced"),i]),o(t,i)},onResetToDefault:function(){Common.UI.warning({maxwidth:500,msg:this.warnReset,buttons:["yes","no"],primary:"yes",callback:_.bind(function(t,e){"yes"==t&&(this.api.asc_resetToDefaultAutoCorrectMathSymbols(),this.onResetList())},this)})},onResetList:function(){var t=this.appPrefix+"settings-math-correct",i=JSON.stringify([]);Common.Utils.InternalSettings.set(t+"-add",i),Common.localStorage.setItem(t+"-add",i),Common.Utils.InternalSettings.set(t+"-rem",i),Common.localStorage.setItem(t+"-rem",i),this.arrAdd=[],this.arrRem=[],e.remove(e.where({defaultValue:void 0})),e.each(function(t,e){t.set("by",t.get("defaultValueStr")),t.set("defaultDisabled",!1)}),this.mathList.deselectAll(),this.mathList.scroller&&(this.mathList.scroller.update(),this.mathList.scroller.scrollTop(0)),this.updateControls()},onInitList:function(){if(!(e.length>0)){e.comparator=function(t,e){var i=t.get("replaced").toLowerCase(),n=e.get("replaced").toLowerCase();return i==n?0:i-1};"object"==typeof t[1]?(n.defaultValueStr="",_.each(t[1],function(t){n.defaultValueStr+=Common.Utils.String.encodeSurrogateChar(t)}),n.by=n.defaultValueStr):n.by=n.defaultValueStr=Common.Utils.String.encodeSurrogateChar(t[1]),o.push(n)});var s=[];_.each(t,function(t,e){var i=_.findIndex(o,{replaced:t[0]});if(i<0)s.push({replaced:t[0],by:t[1],defaultDisabled:!1});else{o[i].by=t[1]}}),e.reset(o.concat(s)),this.updateControls()}},onInitRecList:function(){if(!(i.length>0)){i.comparator=function(t,e){var i=t.get("value").toLowerCase(),n=e.get("value").toLowerCase();return i==n?0:i-1})});var s=[];_.each(t,function(t,e){_.findIndex(o,{value:t})<0&&s.push({value:t,defaultValue:!1,defaultDisabled:!1})}),i.reset(o.concat(s)),this.updateRecControls()}},onResetRecToDefault:function(){Common.UI.warning({maxwidth:500,msg:this.textWarnResetRec,buttons:["yes","no"],primary:"yes",callback:_.bind(function(t,e){"yes"==t&&(this.api.asc_resetToDefaultAutoCorrectMathFunctions(),this.onResetRecList())},this)})},onResetRecList:function(){var t=this.appPrefix+"settings-rec-functions",e=JSON.stringify([]);Common.Utils.InternalSettings.set(t+"-add",e),Common.localStorage.setItem(t+"-add",e),Common.Utils.InternalSettings.set(t+"-rem",e),Common.localStorage.setItem(t+"-rem",e),this.arrAddRec=[],this.arrRemRec=[],i.remove(i.where({defaultValue:!1})),i.each(function(t,e){t.set("defaultDisabled",!1)}),this.mathRecList.deselectAll(),this.mathRecList.scroller&&(this.mathRecList.scroller.update(),this.mathRecList.scroller.scrollTop(0)),this.updateRecControls()},onRecCategoryClick:function(t){var e=this;_.delay(function(){$("input",e.inputRecFind.cmpEl).select().focus()},t?50:0),e.mathRecList.store.length","<% _.each(rows, function(row) { %>","","<% _.each(row, function(item) { %>",'
    ','',"
    ","<% }) %>","","<% }) %>",""].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,arguments),this.menu=t.menu},render:function(){return this.$el.html(this.template({rows:this.formats})),$(".btn-doc-format",this.el).on("click",_.bind(this.onFormatClick,this)),_.isUndefined(this.scroller)&&(this.scroller=new Common.UI.Scroller({el:this.$el,suppressScrollX:!0,alwaysVisibleY:!0})),this},show:function(){Common.UI.BaseView.prototype.show.call(this,arguments),this.scroller&&this.scroller.update()},onFormatClick:function(t){var e=t.currentTarget.attributes.format;!_.isUndefined(e)&&this.menu&&this.menu.fireEvent("saveas:format",[this.menu,parseInt(e.value)])}}),PE.Views.FileMenuPanels.ViewSaveCopy=Common.UI.BaseView.extend({el:"#panel-savecopy",menu:void 0,formats:[[{name:"PPTX",imgCls:"pptx",type:Asc.c_oAscFileType.PPTX,ext:".pptx"},{name:"PDF",imgCls:"pdf",type:Asc.c_oAscFileType.PDF,ext:".pdf"},{name:"ODP",imgCls:"odp",type:Asc.c_oAscFileType.ODP,ext:".odp"}],[{name:"POTX",imgCls:"potx",type:Asc.c_oAscFileType.POTX,ext:".potx"},{name:"PDFA",imgCls:"pdfa",type:Asc.c_oAscFileType.PDFA,ext:".pdf"},{name:"OTP",imgCls:"otp",type:Asc.c_oAscFileType.OTP,ext:".otp"}]],template:_.template(["","<% _.each(rows, function(row) { %>","","<% _.each(row, function(item) { %>",'","<% }) %>","","<% }) %>","
    ','',"
    "].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,arguments),this.menu=t.menu},render:function(){return this.$el.html(this.template({rows:this.formats})),$(".btn-doc-format",this.el).on("click",_.bind(this.onFormatClick,this)),_.isUndefined(this.scroller)&&(this.scroller=new Common.UI.Scroller({el:this.$el,suppressScrollX:!0,alwaysVisibleY:!0})),this},show:function(){Common.UI.BaseView.prototype.show.call(this,arguments),this.scroller&&this.scroller.update()},onFormatClick:function(t){var e=t.currentTarget.attributes.format,i=t.currentTarget.attributes["format-ext"];_.isUndefined(e)||_.isUndefined(i)||!this.menu||this.menu.fireEvent("savecopy:format",[this.menu,parseInt(e.value),i.value])}}),PE.Views.FileMenuPanels.Settings=Common.UI.BaseView.extend(_.extend({el:"#panel-settings",menu:void 0,template:_.template(['
    ','','','','',"",'','','','',"",'','','','',"",'','','','',"",'','','','',"",'','','','',"",'','','','',"",'',"",'','',"",'',"",'','',"",'','','','',"",'','','','',"",'','','','',"",'','','','',"","
    ','
    ','
    ','
    ','
    ","
    ",'"].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,arguments),this.menu=t.menu},render:function(t){var e=this,i=$(this.template({scope:this}));this.chSpell=new Common.UI.CheckBox({el:i.findById("#fms-chb-spell-check"),labelText:this.strSpellCheckMode}),this.chInputMode=new Common.UI.CheckBox({el:i.findById("#fms-chb-input-mode"),labelText:this.strInputMode}),this.cmbZoom=new Common.UI.ComboBox({el:i.findById("#fms-cmb-zoom"),style:"width: 160px;",editable:!1,cls:"input-group-nr",menuStyle:"max-height: 157px;",data:[{value:-1,displayValue:this.txtFitSlide},{value:-2,displayValue:this.txtFitWidth},{value:50,displayValue:"50%"},{value:60,displayValue:"60%"},{value:70,displayValue:"70%"},{value:80,displayValue:"80%"},{value:90, -displayValue:"90%"},{value:100,displayValue:"100%"},{value:110,displayValue:"110%"},{value:120,displayValue:"120%"},{value:150,displayValue:"150%"},{value:175,displayValue:"175%"},{value:200,displayValue:"200%"}]}),this.cmbCoAuthMode=new Common.UI.ComboBox({el:i.findById("#fms-cmb-coauth-mode"),style:"width: 160px;",editable:!1,cls:"input-group-nr",data:[{value:1,displayValue:this.strFast,descValue:this.strCoAuthModeDescFast},{value:0,displayValue:this.strStrict,descValue:this.strCoAuthModeDescStrict}]}).on("selected",function(t,i){1==i.value&&"checked"!==e.chAutosave.getValue()&&e.chAutosave.setValue(1),e.lblCoAuthMode.text(i.descValue)}),this.lblCoAuthMode=i.findById("#fms-lbl-coauth-mode"),this.chAutosave=new Common.UI.CheckBox({el:i.findById("#fms-chb-autosave"),labelText:this.strAutosave}).on("change",function(t,i,n,o){"checked"!==t.getValue()&&e.cmbCoAuthMode.getValue()&&(e.cmbCoAuthMode.setValue(0),e.lblCoAuthMode.text(e.strCoAuthModeDescStrict))}),this.lblAutosave=i.findById("#fms-lbl-autosave"),this.chForcesave=new Common.UI.CheckBox({el:i.findById("#fms-chb-forcesave"),labelText:this.strForcesave}),this.chAlignGuides=new Common.UI.CheckBox({el:i.findById("#fms-chb-align-guides"),labelText:this.strAlignGuides});var n=_.template(["<% _.each(items, function(item) { %>",'
  • style="border-top: 1px solid #e5e5e5;margin-top: 5px;" <% } %> > class="checked" <% } %> ><%= scope.getDisplayValue(item) %>
  • ',"<% }); %>"].join(""));return this.cmbFontRender=new Common.UI.ComboBox({el:i.findById("#fms-cmb-font-render"),style:"width: 160px;",editable:!1,cls:"input-group-nr",itemsTemplate:n,data:[{value:Asc.c_oAscFontRenderingModeType.hintingAndSubpixeling,displayValue:this.txtWin},{value:Asc.c_oAscFontRenderingModeType.noHinting,displayValue:this.txtMac},{value:Asc.c_oAscFontRenderingModeType.hinting,displayValue:this.txtNative},{value:"custom",displayValue:this.txtCacheMode}]}),this.cmbFontRender.on("selected",_.bind(this.onFontRenderSelected,this)),this.cmbUnit=new Common.UI.ComboBox({el:i.findById("#fms-cmb-unit"),style:"width: 160px;",editable:!1,cls:"input-group-nr",data:[{value:Common.Utils.Metric.c_MetricUnits.cm,displayValue:this.txtCm},{value:Common.Utils.Metric.c_MetricUnits.pt,displayValue:this.txtPt},{value:Common.Utils.Metric.c_MetricUnits.inch,displayValue:this.txtInch}]}),this.cmbMacros=new Common.UI.ComboBox({el:i.findById("#fms-cmb-macros"),style:"width: 160px;",editable:!1,menuCls:"menu-aligned",cls:"input-group-nr",data:[{value:2,displayValue:this.txtStopMacros,descValue:this.txtStopMacrosDesc},{value:0,displayValue:this.txtWarnMacros,descValue:this.txtWarnMacrosDesc},{value:1,displayValue:this.txtRunMacros,descValue:this.txtRunMacrosDesc}]}).on("selected",function(t,i){e.lblMacrosDesc.text(i.descValue)}),this.lblMacrosDesc=i.findById("#fms-lbl-macros"),this.chPaste=new Common.UI.CheckBox({el:i.findById("#fms-chb-paste-settings"),labelText:this.strPasteButton}),this.btnAutoCorrect=new Common.UI.Button({el:i.findById("#fms-btn-auto-correct")}),this.btnAutoCorrect.on("click",_.bind(this.autoCorrect,this)),i.find(".btn.primary").each(function(t,i){new Common.UI.Button({el:$(i)}).on("click",_.bind(e.applySettings,e))}),this.pnlSettings=i.find(".flex-settings").addBack().filter(".flex-settings"),this.pnlApply=i.find(".fms-flex-apply").addBack().filter(".fms-flex-apply"),this.pnlTable=this.pnlSettings.find("table"),this.trApply=i.find(".fms-btn-apply"),this.$el=$(t).html(i),_.isUndefined(this.scroller)&&(this.scroller=new Common.UI.Scroller({el:this.pnlSettings,suppressScrollX:!0,alwaysVisibleY:!0})),Common.NotificationCenter.on({"window:resize":function(){e.isVisible()&&e.updateScroller()}}),this},show:function(){Common.UI.BaseView.prototype.show.call(this,arguments),this.updateSettings(),this.updateScroller()},updateScroller:function(){if(this.scroller){Common.UI.Menu.Manager.hideAll();var t=this.$el.height()0?t+"%":100);var i=Common.Utils.InternalSettings.get("pe-settings-coauthmode");e=this.cmbCoAuthMode.store.findWhere({value:i?1:0}),this.cmbCoAuthMode.setValue(e?e.get("value"):1),this.lblCoAuthMode.text(e?e.get("descValue"):this.strCoAuthModeDescFast),t=Common.Utils.InternalSettings.get("pe-settings-fontrender"),e=this.cmbFontRender.store.findWhere({value:parseInt(t)}),this.cmbFontRender.setValue(e?e.get("value"):Asc.c_oAscFontRenderingModeType.hintingAndSubpixeling),this._fontRender=this.cmbFontRender.getValue(),t=Common.Utils.InternalSettings.get("pe-settings-cachemode"),e=this.cmbFontRender.store.findWhere({value:"custom"}),e&&t&&e.set("checked",!!t),e&&t&&this.cmbFontRender.cmpEl.find("#"+e.get("id")+" a").addClass("checked"),t=Common.Utils.InternalSettings.get("pe-settings-unit"),e=this.cmbUnit.store.findWhere({value:t}),this.cmbUnit.setValue(e?parseInt(e.get("value")):Common.Utils.Metric.getDefaultMetric()),this._oldUnits=this.cmbUnit.getValue(),t=Common.Utils.InternalSettings.get("pe-settings-autosave"),this.chAutosave.setValue(1==t),this.mode.canForcesave&&this.chForcesave.setValue(Common.Utils.InternalSettings.get("pe-settings-forcesave")),this.chAlignGuides.setValue(Common.Utils.InternalSettings.get("pe-settings-showsnaplines")),e=this.cmbMacros.store.findWhere({value:Common.Utils.InternalSettings.get("pe-macros-mode")}),this.cmbMacros.setValue(e?e.get("value"):0),this.lblMacrosDesc.text(e?e.get("descValue"):this.txtWarnMacrosDesc),this.chPaste.setValue(Common.Utils.InternalSettings.get("pe-settings-paste-button"))},applySettings:function(){Common.localStorage.setItem("pe-settings-spellcheck",this.chSpell.isChecked()?1:0),Common.localStorage.setItem("pe-settings-inputmode",this.chInputMode.isChecked()?1:0),Common.localStorage.setItem("pe-settings-zoom",this.cmbZoom.getValue()),Common.Utils.InternalSettings.set("pe-settings-zoom",Common.localStorage.getItem("pe-settings-zoom")),this.mode.isEdit&&!this.mode.isOffline&&this.mode.canCoAuthoring&&Common.localStorage.setItem("pe-settings-coauthmode",this.cmbCoAuthMode.getValue()),Common.localStorage.setItem("pe-settings-fontrender",this.cmbFontRender.getValue());var t=this.cmbFontRender.store.findWhere({value:"custom"});Common.localStorage.setItem("pe-settings-cachemode",t&&!t.get("checked")?0:1),Common.localStorage.setItem("pe-settings-unit",this.cmbUnit.getValue()),Common.localStorage.setItem("pe-settings-autosave",this.chAutosave.isChecked()?1:0),this.mode.canForcesave&&Common.localStorage.setItem("pe-settings-forcesave",this.chForcesave.isChecked()?1:0),Common.Utils.InternalSettings.set("pe-settings-showsnaplines",this.chAlignGuides.isChecked()),Common.localStorage.setItem("pe-macros-mode",this.cmbMacros.getValue()),Common.Utils.InternalSettings.set("pe-macros-mode",this.cmbMacros.getValue()),Common.localStorage.setItem("pe-settings-paste-button",this.chPaste.isChecked()?1:0),Common.localStorage.save(),this.menu&&(this.menu.fireEvent("settings:apply",[this.menu]),this._oldUnits!==this.cmbUnit.getValue()&&Common.NotificationCenter.trigger("settings:unitschanged",this))},onFontRenderSelected:function(t,e){if("custom"==e.value){var i=t.store.findWhere({value:"custom"});i&&i.set("checked",!e.checked),t.cmpEl.find("#"+e.id+" a").toggleClass("checked",!e.checked),t.setValue(this._fontRender)}this._fontRender=t.getValue()},autoCorrect:function(){this.dlgAutoCorrect&&this.dlgAutoCorrect.isVisible()||(this.dlgAutoCorrect=new Common.Views.AutoCorrectDialog({api:this.api}),this.dlgAutoCorrect.show())},strInputMode:"Turn on hieroglyphs",strZoom:"Default Zoom Value",okButtonText:"Apply",txtFitSlide:"Fit to Slide",txtInput:"Alternate Input",txtWin:"as Windows",txtMac:"as OS X",txtNative:"Native",strFontRender:"Font Hinting",strUnit:"Unit of Measurement",txtCm:"Centimeter",txtPt:"Point",textAutoSave:"Autosave",strAutosave:"Turn on autosave",strShowChanges:"Realtime Collaboration Changes",txtAll:"View All",txtLast:"View Last",textAlignGuides:"Alignment Guides",strAlignGuides:"Turn on alignment guides",strCoAuthMode:"Co-editing mode",strCoAuthModeDescFast:"Other users will see your changes at once",strCoAuthModeDescStrict:"You will need to accept changes before you can see them",strFast:"Fast",strStrict:"Strict",textAutoRecover:"Autorecover",strAutoRecover:"Turn on autorecover",txtInch:"Inch",txtFitWidth:"Fit to Width",textForceSave:"Save to Server",strForcesave:"Always save to server (otherwise save to server on document close)",txtSpellCheck:"Spell Checking",strSpellCheckMode:"Turn on spell checking option",txtCacheMode:"Default cache mode",strMacrosSettings:"Macros Settings",txtWarnMacros:"Show Notification",txtRunMacros:"Enable All",txtStopMacros:"Disable All",txtWarnMacrosDesc:"Disable all macros with notification",txtRunMacrosDesc:"Enable all macros without notification",txtStopMacrosDesc:"Disable all macros without notification",strPaste:"Cut, copy and paste",strPasteButton:"Show Paste Options button when content is pasted",txtProofing:"Proofing",txtAutoCorrect:"AutoCorrect options..."},PE.Views.FileMenuPanels.Settings||{})),PE.Views.FileMenuPanels.RecentFiles=Common.UI.BaseView.extend({el:"#panel-recentfiles",menu:void 0,template:_.template(['
    '].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,arguments),this.menu=t.menu,this.recent=t.recent},render:function(){return this.$el.html(this.template()),this.viewRecentPicker=new Common.UI.DataView({el:$("#id-recent-view"),store:new Common.UI.DataViewStore(this.recent),itemTemplate:_.template(['
    ','
    ',"",'',"","
    ",'
    <% if (typeof title !== "undefined") {%><%= Common.Utils.String.htmlEncode(title || "") %><% } %>
    ','
    <% if (typeof folder !== "undefined") {%><%= Common.Utils.String.htmlEncode(folder || "") %><% } %>
    ',"
    "].join(""))}),this.viewRecentPicker.on("item:click",_.bind(this.onRecentFileClick,this)),_.isUndefined(this.scroller)&&(this.scroller=new Common.UI.Scroller({el:this.$el,suppressScrollX:!0,alwaysVisibleY:!0})),this},show:function(){Common.UI.BaseView.prototype.show.call(this,arguments),this.scroller&&this.scroller.update()},onRecentFileClick:function(t,e,i){this.menu&&this.menu.fireEvent("recent:open",[this.menu,i.get("url")])}}),PE.Views.FileMenuPanels.CreateNew=Common.UI.BaseView.extend(_.extend({el:"#panel-createnew",menu:void 0,events:function(){return{"click .blank-document-btn":_.bind(this._onBlankDocument,this),"click .thumb-list .thumb-wrap":_.bind(this._onDocumentTemplate,this)}},template:_.template(['

    <%= scope.fromBlankText %>


    ','
    ','
    ','','',"","
    ",'
    ',"

    <%= scope.newDocumentText %>

    ","<%= scope.newDescriptionText %>","
    ","
    ","

    <%= scope.fromTemplateText %>


    ",'
    ',"<% _.each(docs, function(item) { %>",'
    ','
    ",' style="background-image: url(<%= item.image %>);">',"<% } else { print(\">\") } %>","
    ",'
    <%= Common.Utils.String.htmlEncode(item.title || item.name || "") %>
    ',"
    ","<% }) %>","
    "].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,arguments),this.menu=t.menu},render:function(){return this.$el.html(this.template({scope:this,docs:this.options[0].docs})),_.isUndefined(this.scroller)&&(this.scroller=new Common.UI.Scroller({el:this.$el,suppressScrollX:!0,alwaysVisibleY:!0})),this},show:function(){Common.UI.BaseView.prototype.show.call(this,arguments),this.scroller&&this.scroller.update()},_onBlankDocument:function(){this.menu&&this.menu.fireEvent("create:new",[this.menu,"blank"])},_onDocumentTemplate:function(t){this.menu&&this.menu.fireEvent("create:new",[this.menu,t.currentTarget.attributes.template.value])},fromBlankText:"From Blank",newDocumentText:"New Presentation",newDescriptionText:"Create a new blank presentation which you will be able to style and format after it is created during the editing. Or choose one of the templates to start a document of a certain type or purpose where some styles have already been pre-applied.",fromTemplateText:"From Template",noTemplatesText:"There are no templates"},PE.Views.FileMenuPanels.CreateNew||{})),PE.Views.FileMenuPanels.DocumentInfo=Common.UI.BaseView.extend(_.extend({el:"#panel-info",menu:void 0,initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,arguments),this.rendered=!1,this.template=_.template(['
    ','',"",'",'',"","",'",'',"","",'",'',"",'','',"",'",'',"","",'",'',"","",'",'',"",'','',"",'",'',"","",'",'',"",'','',"",'",'',"","",'",'',"","",'",'","",'',"
    ',"","",'',"","
    ","
    ","
    ",'
    ','',"",'','',"","
    ","
    "].join("")),this.menu=t.menu,this.coreProps=null,this.authors=[],this._locked=!1},render:function(t){var e=this,i=$(e.template({scope:e}));this.lblPlacement=i.findById("#id-info-placement"),this.lblOwner=i.findById("#id-info-owner"),this.lblUploaded=i.findById("#id-info-uploaded");var n=function(t,e){if(e.keyCode===Common.UI.Keys.ESC){var i=t._input.val(),n=t.getValue();i!==n&&(t.setValue(n),e.stopPropagation())}};return this.inputTitle=new Common.UI.InputField({el:i.findById("#id-info-title"),style:"width: 200px;",placeHolder:this.txtAddText,validateOnBlur:!1}).on("keydown:before",n),this.inputSubject=new Common.UI.InputField({el:i.findById("#id-info-subject"),style:"width: 200px;",placeHolder:this.txtAddText,validateOnBlur:!1}).on("keydown:before",n),this.inputComment=new Common.UI.InputField({el:i.findById("#id-info-comment"),style:"width: 200px;",placeHolder:this.txtAddText,validateOnBlur:!1}).on("keydown:before",n),this.lblModifyDate=i.findById("#id-info-modify-date"),this.lblModifyBy=i.findById("#id-info-modify-by"),this.lblDate=i.findById("#id-info-date"),this.lblApplication=i.findById("#id-info-appname"),this.tblAuthor=i.findById("#id-info-author table"),this.trAuthor=i.findById("#id-info-add-author").closest("tr"),this.authorTpl='
    ',this.tblAuthor.on("click",function(t){var n=i.find(t.target);if(n.hasClass("close")&&!n.hasClass("disabled")){var o=n.closest("tr"),s=e.tblAuthor.find("tr").index(o);o.remove(),e.authors.splice(s,1),e.updateScroller(!0)}}),this.inputAuthor=new Common.UI.InputField({el:i.findById("#id-info-add-author"),style:"width: 200px;",validateOnBlur:!1,placeHolder:this.txtAddAuthor}).on("changed:after",function(t,i,n,o){if(i!=n){var s=i.trim();if(s&&s!==n.trim()){var a=o&&o.relatedTarget&&"fminfo-btn-apply"==o.relatedTarget.id;s.split(/\s*[,;]\s*/).forEach(function(t){var i=t.trim();if(i&&(e.authors.push(t),!a)){var n=$(Common.Utils.String.format(e.authorTpl,Common.Utils.String.htmlEncode(i)));e.trAuthor.before(n),e.updateScroller()}}),!a&&e.inputAuthor.setValue("")}}}).on("keydown:before",n),this.btnApply=new Common.UI.Button({el:i.findById("#fminfo-btn-apply")}),this.btnApply.on("click",_.bind(this.applySettings,this)),this.pnlInfo=i.find(".flex-settings").addBack().filter(".flex-settings"),this.pnlApply=i.findById("#fms-flex-apply"),this.rendered=!0,this.updateInfo(this.doc),this.$el=$(t).html(i),_.isUndefined(this.scroller)&&(this.scroller=new Common.UI.Scroller({el:this.pnlInfo,suppressScrollX:!0,alwaysVisibleY:!0})),Common.NotificationCenter.on({"window:resize":function(){e.isVisible()&&e.updateScroller()}}),this},show:function(){Common.UI.BaseView.prototype.show.call(this,arguments),this.updateFileInfo(),this.scroller&&this.scroller.scrollTop(0),this.updateScroller()},hide:function(){Common.UI.BaseView.prototype.hide.call(this,arguments)},updateScroller:function(t){this.scroller&&(this.scroller.update(t?{}:void 0),this.pnlInfo.toggleClass("bordered",this.scroller.isVisible()))},updateInfo:function(t){if(!this.doc&&t&&t.info&&(t.info.author&&console.log("Obsolete: The 'author' parameter of the document 'info' section is deprecated. Please use 'owner' instead."),t.info.created&&console.log("Obsolete: The 'created' parameter of the document 'info' section is deprecated. Please use 'uploaded' instead.")),this.doc=t,this.rendered){var e=!1;if(t=t||{},t.info){t.info.folder&&this.lblPlacement.text(t.info.folder),e=this._ShowHideInfoItem(this.lblPlacement,void 0!==t.info.folder&&null!==t.info.folder)||e;var i=t.info.owner||t.info.author;i&&this.lblOwner.text(i),e=this._ShowHideInfoItem(this.lblOwner,!!i)||e,i=t.info.uploaded||t.info.created,i&&this.lblUploaded.text(i),e=this._ShowHideInfoItem(this.lblUploaded,!!i)||e}else this._ShowHideDocInfo(!1);$("tr.divider.general",this.el)[e?"show":"hide"]();var n=this.api?this.api.asc_getAppProps():null;if(n&&(n=(n.asc_getApplication()||"")+(n.asc_getAppVersion()?" ":"")+(n.asc_getAppVersion()||""),this.lblApplication.text(n)),this._ShowHideInfoItem(this.lblApplication,!!n),this.coreProps=this.api?this.api.asc_getCoreProps():null,this.coreProps){var i=this.coreProps.asc_getCreated();i&&this.lblDate.text(i.toLocaleString(this.mode.lang,{year:"numeric",month:"2-digit",day:"2-digit"})+" "+i.toLocaleString(this.mode.lang,{timeStyle:"short"})),this._ShowHideInfoItem(this.lblDate,!!i)}}},updateFileInfo:function(){if(this.rendered){var t,e=this,i=this.api?this.api.asc_getCoreProps():null;if(this.coreProps=i,i){var n=!1;t=i.asc_getModified(),t&&this.lblModifyDate.text(t.toLocaleString(this.mode.lang,{year:"numeric",month:"2-digit",day:"2-digit"})+" "+t.toLocaleString(this.mode.lang,{timeStyle:"short"})),n=this._ShowHideInfoItem(this.lblModifyDate,!!t)||n,t=i.asc_getLastModifiedBy(),t&&this.lblModifyBy.text(Common.Utils.UserInfoParser.getParsedName(t)),n=this._ShowHideInfoItem(this.lblModifyBy,!!t)||n,$("tr.divider.modify",this.el)[n?"show":"hide"](),t=i.asc_getTitle(),this.inputTitle.setValue(t||""),t=i.asc_getSubject(),this.inputSubject.setValue(t||""),t=i.asc_getDescription(),this.inputComment.setValue(t||""),this.inputAuthor.setValue(""),this.tblAuthor.find("tr:not(:last-of-type)").remove(),this.authors=[],t=i.asc_getCreator(),t&&t.split(/\s*[,;]\s*/).forEach(function(t){var i=$(Common.Utils.String.format(e.authorTpl,Common.Utils.String.htmlEncode(t)));e.trAuthor.before(i),e.authors.push(t)}),this.tblAuthor.find(".close").toggleClass("hidden",!this.mode.isEdit),!this.mode.isEdit&&this._ShowHideInfoItem(this.tblAuthor,!!this.authors.length)}this.SetDisabled()}},_ShowHideInfoItem:function(t,e){return t.closest("tr")[e?"show":"hide"](),e},_ShowHideDocInfo:function(t){this._ShowHideInfoItem(this.lblPlacement,t),this._ShowHideInfoItem(this.lblOwner,t),this._ShowHideInfoItem(this.lblUploaded,t)},setMode:function(t){return this.mode=t,this.inputAuthor.setVisible(t.isEdit),this.pnlApply.toggleClass("hidden",!t.isEdit),this.tblAuthor.find(".close").toggleClass("hidden",!t.isEdit),t.isEdit||(this.inputTitle._input.attr("placeholder",""),this.inputSubject._input.attr("placeholder",""),this.inputComment._input.attr("placeholder",""),this.inputAuthor._input.attr("placeholder","")),this.SetDisabled(),this},setApi:function(t){return this.api=t,this.api.asc_registerCallback("asc_onLockCore",_.bind(this.onLockCore,this)),this.updateInfo(this.doc),this},onLockCore:function(t){this._locked=t,this.updateFileInfo()},SetDisabled:function(){var t=!this.mode.isEdit||this._locked;this.inputTitle.setDisabled(t),this.inputSubject.setDisabled(t),this.inputComment.setDisabled(t),this.inputAuthor.setDisabled(t),this.tblAuthor.find(".close").toggleClass("disabled",this._locked),this.tblAuthor.toggleClass("disabled",t),this.btnApply.setDisabled(this._locked)},applySettings:function(){this.coreProps&&this.api&&(this.coreProps.asc_putTitle(this.inputTitle.getValue()),this.coreProps.asc_putSubject(this.inputSubject.getValue()),this.coreProps.asc_putDescription(this.inputComment.getValue()),this.coreProps.asc_putCreator(this.authors.join(";")),this.api.asc_setCoreProps(this.coreProps)),this.menu.hide()},txtPlacement:"Location",txtOwner:"Owner",txtUploaded:"Uploaded",txtAppName:"Application",txtEditTime:"Total Editing time",txtTitle:"Title",txtSubject:"Subject",txtComment:"Comment",txtModifyDate:"Last Modified",txtModifyBy:"Last Modified By",txtCreated:"Created",txtAuthor:"Author",txtAddAuthor:"Add Author",txtAddText:"Add Text",txtMinutes:"min",okButtonText:"Apply"},PE.Views.FileMenuPanels.DocumentInfo||{})),PE.Views.FileMenuPanels.DocumentRights=Common.UI.BaseView.extend(_.extend({el:"#panel-rights",menu:void 0,initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,arguments),this.rendered=!1,this.template=_.template(['','','",'',"",'','","","
    "].join("")),this.templateRights=_.template(["","<% _.each(users, function(item) { %>","",'',"","","<% }); %>","
    <%= Common.Utils.String.htmlEncode(item.user) %><%= Common.Utils.String.htmlEncode(item.permissions) %>
    "].join("")),this.menu=t.menu},render:function(t){var e=$(this.template());return this.cntRights=e.findById("#id-info-rights"),this.btnEditRights=new Common.UI.Button({el:e.findById("#id-info-btn-edit")}),this.btnEditRights.on("click",_.bind(this.changeAccessRights,this)),this.rendered=!0,this.updateInfo(this.doc),this.$el=$(t).html(e),_.isUndefined(this.scroller)&&(this.scroller=new Common.UI.Scroller({el:this.$el,suppressScrollX:!0,alwaysVisibleY:!0})),Common.NotificationCenter.on("collaboration:sharingupdate",this.updateSharingSettings.bind(this)),Common.NotificationCenter.on("collaboration:sharingdeny",this.onLostEditRights.bind(this)),this},show:function(){Common.UI.BaseView.prototype.show.call(this,arguments),this.scroller&&this.scroller.update()},hide:function(){Common.UI.BaseView.prototype.hide.call(this,arguments)},updateInfo:function(t){this.doc=t,this.rendered&&(t=t||{},t.info?(t.info.sharingSettings&&this.cntRights.html(this.templateRights({users:t.info.sharingSettings})),this._ShowHideInfoItem("rights",void 0!==t.info.sharingSettings&&null!==t.info.sharingSettings&&t.info.sharingSettings.length>0),this._ShowHideInfoItem("edit-rights",(!!this.sharingSettingsUrl&&this.sharingSettingsUrl.length||this.mode.canRequestSharingSettings)&&!0!==this._readonlyRights)):this._ShowHideDocInfo(!1))},_ShowHideInfoItem:function(t,e){$("tr."+t,this.el)[e?"show":"hide"]()},_ShowHideDocInfo:function(t){this._ShowHideInfoItem("rights",t),this._ShowHideInfoItem("edit-rights",t)},setMode:function(t){return this.mode=t,this.sharingSettingsUrl=t.sharingSettingsUrl,this},changeAccessRights:function(t,e,i){Common.NotificationCenter.trigger("collaboration:sharing")},updateSharingSettings:function(t){this._ShowHideInfoItem("rights",void 0!==this.doc.info.sharingSettings&&null!==this.doc.info.sharingSettings&&this.doc.info.sharingSettings.length>0),this.cntRights.html(this.templateRights({users:this.doc.info.sharingSettings}))},onLostEditRights:function(){this._readonlyRights=!0,this.rendered&&this._ShowHideInfoItem("edit-rights",!1)},txtRights:"Persons who have rights",txtBtnAccessRights:"Change access rights"},PE.Views.FileMenuPanels.DocumentRights||{})),PE.Views.FileMenuPanels.Help=Common.UI.BaseView.extend({el:"#panel-help",menu:void 0,template:_.template(['
    ','
    ','
    ',"
    "].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,arguments),this.menu=t.menu,this.urlPref="resources/help/en/",this.en_data=[{src:"ProgramInterface/ProgramInterface.htm",name:"Introducing Presentation Editor user interface",headername:"Program Interface"},{src:"ProgramInterface/FileTab.htm",name:"File tab"},{src:"ProgramInterface/HomeTab.htm",name:"Home Tab"},{src:"ProgramInterface/InsertTab.htm",name:"Insert tab"},{src:"ProgramInterface/PluginsTab.htm",name:"Plugins tab"},{src:"UsageInstructions/OpenCreateNew.htm",name:"Create a new presentation or open an existing one",headername:"Basic operations"},{src:"UsageInstructions/CopyPasteUndoRedo.htm",name:"Copy/paste data, undo/redo your actions"},{src:"UsageInstructions/ManageSlides.htm",name:"Manage slides",headername:"Working with slides"},{src:"UsageInstructions/SetSlideParameters.htm",name:"Set slide parameters"},{src:"UsageInstructions/ApplyTransitions.htm",name:"Apply transitions"},{src:"UsageInstructions/PreviewPresentation.htm",name:"Preview your presentation"},{src:"UsageInstructions/InsertText.htm",name:"Insert and format your text",headername:"Text formatting"},{src:"UsageInstructions/AddHyperlinks.htm",name:"Add hyperlinks"},{src:"UsageInstructions/CreateLists.htm",name:"Create lists"},{src:"UsageInstructions/CopyClearFormatting.htm",name:"Copy/clear formatting"},{src:"UsageInstructions/InsertAutoshapes.htm",name:"Insert and format autoshapes",headername:"Operations on objects"},{src:"UsageInstructions/InsertImages.htm",name:"Insert and adjust images"},{src:"UsageInstructions/InsertCharts.htm",name:"Insert and edit charts"},{src:"UsageInstructions/InsertTables.htm",name:"Insert and format tables"},{src:"UsageInstructions/FillObjectsSelectColor.htm",name:"Fill objects and select colors"},{src:"UsageInstructions/ManipulateObjects.htm",name:"Manipulate objects on a slide"},{src:"UsageInstructions/AlignArrangeObjects.htm",name:"Align and arrange objects on a slide"},{src:"UsageInstructions/InsertEquation.htm",name:"Insert equations",headername:"Math equations"},{src:"HelpfulHints/CollaborativeEditing.htm",name:"Collaborative presentation editing",headername:"Presentation co-editing"},{src:"UsageInstructions/ViewPresentationInfo.htm",name:"View presentation information",headername:"Tools and settings"},{src:"UsageInstructions/SavePrintDownload.htm",name:"Save/print/download your presentation"},{src:"HelpfulHints/AdvancedSettings.htm",name:"Advanced settings of Presentation Editor"},{src:"HelpfulHints/Navigation.htm",name:"View settings and navigation tools"},{src:"HelpfulHints/Search.htm",name:"Search function"},{src:"HelpfulHints/SpellChecking.htm",name:"Spell-checking"},{src:"HelpfulHints/About.htm",name:"About Presentation Editor",headername:"Helpful hints"},{src:"HelpfulHints/SupportedFormats.htm",name:"Supported formats of electronic presentations"},{src:"HelpfulHints/KeyboardShortcuts.htm",name:"Keyboard shortcuts"}],Common.Utils.isIE&&(window.onhelp=function(){return!1})},render:function(){var t=this;return this.$el.html(this.template()),this.viewHelpPicker=new Common.UI.DataView({el:$("#id-help-contents"),store:new Common.UI.DataViewStore([]),keyMoveDirection:"vertical",itemTemplate:_.template(['
    ','
    <%= name %>
    ',"
    "].join(""))}),this.viewHelpPicker.on("item:add",function(t,e,i){i.has("headername")&&$(e.el).before('
    '+i.get("headername")+"
    ")}),this.viewHelpPicker.on("item:select",function(e,i,n){t.iFrame.src=t.urlPref+n.get("src")}),this.iFrame=document.createElement("iframe"),this.iFrame.src="",this.iFrame.align="top",this.iFrame.frameBorder="0",this.iFrame.width="100%",this.iFrame.height="100%",Common.Gateway.on("internalcommand",function(e){if("help:hyperlink"==e.type){var i=e.data,n=t.viewHelpPicker.store.find(function(t){return i.indexOf(t.get("src"))>0});n&&(t.viewHelpPicker.selectRecord(n,!0),t.viewHelpPicker.scrollToRecord(n))}}),$("#id-help-frame").append(this.iFrame),this}, -setLangConfig:function(t){var e=this,i=this.viewHelpPicker.store;if(t){t=t.split(/[\-\_]/)[0];var n={dataType:"json",error:function(){e.urlPref.indexOf("resources/help/en/")<0?(e.urlPref="resources/help/en/",i.url="resources/help/en/Contents.json",i.fetch(n)):(e.urlPref="resources/help/en/",i.reset(e.en_data))},success:function(){var t=i.at(0);e.viewHelpPicker.selectRecord(t),e.iFrame.src=e.urlPref+t.get("src")}};i.url="resources/help/"+t+"/Contents.json",i.fetch(n),this.urlPref="resources/help/"+t+"/"}},show:function(){Common.UI.BaseView.prototype.show.call(this),this._scrollerInited||(this.viewHelpPicker.scroller.update(),this._scrollerInited=!0)}}),PE.Views.FileMenuPanels.ProtectDoc=Common.UI.BaseView.extend(_.extend({el:"#panel-protect",menu:void 0,template:_.template(['','
    ','','
    ','',"",'',"","",'','',"","
    ","
    ",'
    ','','
    ','
    ',"
    "].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,arguments),this.menu=t.menu;var e=this;this.templateSignature=_.template(['',"",'',"","",'",'","","
    "].join(""))},render:function(){this.$el.html(this.template({scope:this}));var t=PE.getController("Common.Controllers.Protection").getView();return this.btnAddPwd=t.getButton("add-password"),this.btnAddPwd.render(this.$el.find("#fms-btn-add-pwd")),this.btnAddPwd.on("click",_.bind(this.closeMenu,this)),this.btnChangePwd=t.getButton("change-password"),this.btnChangePwd.render(this.$el.find("#fms-btn-change-pwd")),this.btnChangePwd.on("click",_.bind(this.closeMenu,this)),this.btnDeletePwd=t.getButton("del-password"),this.btnDeletePwd.render(this.$el.find("#fms-btn-delete-pwd")),this.btnDeletePwd.on("click",_.bind(this.closeMenu,this)),this.cntPassword=$("#id-fms-password"),this.cntPasswordView=$("#id-fms-view-pwd"),this.btnAddInvisibleSign=t.getButton("signature"),this.btnAddInvisibleSign.render(this.$el.find("#fms-btn-invisible-sign")),this.btnAddInvisibleSign.on("click",_.bind(this.closeMenu,this)),this.cntSignature=$("#id-fms-signature"),this.cntSignatureView=$("#id-fms-signature-view"),_.isUndefined(this.scroller)&&(this.scroller=new Common.UI.Scroller({el:this.$el,suppressScrollX:!0,alwaysVisibleY:!0})),this.$el.on("click",".signature-edit-link",_.bind(this.onEdit,this)),this.$el.on("click",".signature-view-link",_.bind(this.onView,this)),this},show:function(){Common.UI.BaseView.prototype.show.call(this,arguments),this.updateSignatures(),this.updateEncrypt(),this.scroller&&this.scroller.update()},setMode:function(t){this.mode=t,this.cntSignature.toggleClass("hidden",!this.mode.isSignatureSupport),this.cntPassword.toggleClass("hidden",!this.mode.isPasswordSupport)},setApi:function(t){return this.api=t,this},closeMenu:function(){this.menu&&this.menu.hide()},onEdit:function(){this.menu&&this.menu.hide();var t=this;Common.UI.warning({title:this.notcriticalErrorTitle,msg:this.txtEditWarning,buttons:["ok","cancel"],primary:"ok",callback:function(e){"ok"==e&&t.api.asc_RemoveAllSignatures()}})},onView:function(){this.menu&&this.menu.hide(),PE.getController("RightMenu").rightmenu.SetActivePane(Common.Utils.documentSettingsType.Signature,!0)},updateSignatures:function(){var t=this.api.asc_getSignatures(),e=!1,i=!1;_.each(t,function(t,n){0==t.asc_getValid()?e=!0:i=!0});var n=i?this.txtSignedInvalid:e?this.txtSigned:"";this.cntSignatureView.html(this.templateSignature({tipText:n,hasSigned:e||i}))},updateEncrypt:function(){this.cntPasswordView.toggleClass("hidden",this.btnAddPwd.isVisible())},strProtect:"Protect Presentation",strSignature:"With Signature",txtView:"View signatures",txtEdit:"Edit presentation",txtSigned:"Valid signatures has been added to the presentation. The presentation is protected from editing.",txtSignedInvalid:"Some of the digital signatures in presentation are invalid or could not be verified. The presentation is protected from editing.",notcriticalErrorTitle:"Warning",txtEditWarning:"Editing will remove the signatures from the presentation.
    Are you sure you want to continue?",strEncrypt:"With Password",txtEncrypted:"This presentation has been protected by password"},PE.Views.FileMenuPanels.ProtectDoc||{}))}),void 0===Common)var Common={};if(Common.Models=Common.Models||{},define("common/main/lib/model/Comment",["underscore","backbone","common/main/lib/component/BaseView"],function(t,e){"use strict";Common.Models.Comment=e.Model.extend({defaults:{uid:0,guid:"",userid:0,username:"Guest",usercolor:null,date:void 0,quote:"",comment:"",resolved:!1,lock:!1,lockuserid:"",unattached:!1,userdata:"",id:Common.UI.getId(),time:0,showReply:!1,showReplyInPopover:!1,editText:!1,editTextInPopover:!1,last:void 0,replys:[],hideAddReply:!1,scope:null,hide:!1,hint:!1,dummy:void 0,editable:!0}}),Common.Models.Reply=e.Model.extend({defaults:{time:0,userid:0,username:"Guest",usercolor:null,reply:"",date:void 0,userdata:"",id:Common.UI.getId(),editText:!1,editTextInPopover:!1,scope:null,editable:!0}})}),void 0===Common)var Common={};if(Common.Collections=Common.Collections||{},define("common/main/lib/collection/Comments",["underscore","backbone","common/main/lib/model/Comment"],function(t,e){"use strict";Common.Collections.Comments=e.Collection.extend({model:Common.Models.Comment,groups:null,clearEditing:function(){this.each(function(t){t.set("editText",!1),t.set("editTextInPopover",!1),t.set("showReply",!1),t.set("showReplyInPopover",!1),t.set("hideAddReply",!1)})},getCommentsReplysCount:function(t){var e=0;return this.each(function(i){i.get("userid")==t&&e++;var n=i.get("replys");n&&n.length>0&&n.forEach(function(i){i.get("userid")==t&&e++})}),e}})}),define("text!common/main/lib/template/CommentsPopover.template",[],function(){return'
    \r\n\r\n \x3c!-- comment block --\x3e\r\n\r\n
    \r\n
    <%= scope.getUserName(username) %>\r\n
    \r\n
    <%=date%>
    \r\n <% if (!editTextInPopover || hint) { %>\r\n
    <%=scope.pickLink(comment)%>
    \r\n <% } else { %>\r\n
    \r\n \r\n <% if (hideAddReply) { %>\r\n \r\n <% } else { %>\r\n \r\n <% } %>\r\n \r\n
    \r\n <% } %>\r\n\r\n \x3c!-- replys elements --\x3e\r\n\r\n <% if (replys.length) { %>\r\n
    \r\n <% _.each(replys, function (item) { %>\r\n
    \r\n
    \r\n
    <%=item.get("usercolor")%><% } else { %> #cfcfcf <% } %>; " >
    <%= scope.getUserName(item.get("username")) %>\r\n
    \r\n
    <%=item.get("date")%>
    \r\n <% if (!item.get("editTextInPopover")) { %>\r\n
    <%=scope.pickLink(item.get("reply"))%>
    \r\n <% if (!hint) { %>\r\n
    \r\n <% if (item.get("editable")) { %>\r\n
    ">
    \r\n
    ">
    \r\n <%}%>\r\n
    \r\n <%}%>\r\n <% } else { %>\r\n
    \r\n \r\n \r\n \r\n
    \r\n <% } %>\r\n
    \r\n <% }); %>\r\n\r\n <% } %>\r\n\r\n \x3c!-- add reply button --\x3e\r\n\r\n <% if (!showReplyInPopover && !hideAddReply && !hint) { %>\r\n <% if (replys.length) { %>\r\n \r\n <% } else { %>\r\n \r\n <% } %>\r\n <% } %>\r\n\r\n \x3c!-- edit buttons --\x3e\r\n\r\n <% if (!editTextInPopover && !lock && !hint) { %>\r\n
    \r\n <% if (editable) { %>\r\n
    \r\n
    \r\n <% } %>\r\n <% if (resolved) { %>\r\n
    \r\n <% } else { %>\r\n
    \r\n <% } %>\r\n
    \r\n <% } %>\r\n\r\n \x3c!-- reply --\x3e\r\n\r\n <% if (showReplyInPopover) { %>\r\n
    \r\n \r\n \r\n \r\n
    \r\n <% } %>\r\n\r\n \x3c!-- locked user --\x3e\r\n\r\n <% if (lock) { %>\r\n
    \r\n
    <%=lockuserid%>
    \r\n <% } %>\r\n\r\n
    '}),define("text!common/main/lib/template/ReviewChangesPopover.template",[],function(){return'
    \r\n
    \r\n
    <%= scope.getUserName(username) %>\r\n
    \r\n
    <%=date%>
    \r\n
    <%=changetext%>
    \r\n
    \r\n <% if (goto) { %>\r\n
    \r\n <% } %>\r\n <% if (!hint) { %>\r\n <% if (scope.appConfig.isReviewOnly) { %>\r\n <% if (editable) { %>\r\n
    \r\n <% } %>\r\n <% } else if (editable) { %>\r\n
    \r\n
    \r\n <% } %>\r\n <% } %>\r\n
    \r\n <% if (!hint && lock) { %>\r\n
    \r\n
    <%=lockuser%>
    \r\n <% } %>\r\n
    '}),void 0===Common)var Common={};if(Common.Views=Common.Views||{},define("common/main/lib/view/ReviewPopover",["text!common/main/lib/template/CommentsPopover.template","text!common/main/lib/template/ReviewChangesPopover.template","common/main/lib/util/utils","common/main/lib/component/Button","common/main/lib/component/ComboBox","common/main/lib/component/DataView","common/main/lib/component/Layout","common/main/lib/component/Window"],function(t,e){"use strict";function i(t,e){var i,n,o=t;for(i in e)void 0!==i&&(n=e[i],o=o.replace(new RegExp(i,"g"),n));return o}Common.Views.ReviewPopover=Common.UI.Window.extend(_.extend({initialize:function(t){var e={};return _.extend(e,{closable:!1,width:265,height:120,header:!1,modal:!1,alias:"Common.Views.ReviewPopover"},t),this.template=t.template||['
    ','
    ','
    ','
    ',"
    ",'
    ',"
    "].join(""),this.commentsStore=t.commentsStore,this.reviewStore=t.reviewStore,this.canRequestUsers=t.canRequestUsers,this.canRequestSendNotify=t.canRequestSendNotify,this.mentionShare=t.mentionShare,this.externalUsers=[],this._state={commentsVisible:!1,reviewVisible:!1},e.tpl=_.template(this.template)(e),this.arrow={margin:20,width:10,height:30},this.sdkBounds={width:0,height:0,padding:10,paddingTop:20},Common.UI.Window.prototype.initialize.call(this,e),this.canRequestUsers&&(Common.Gateway.on("setusers",_.bind(this.setUsers,this)),Common.NotificationCenter.on("mentions:clearusers",_.bind(this.clearUsers,this))),this},render:function(n,o){Common.UI.Window.prototype.render.call(this);var s=this,a=this.$window;a.css({height:"",minHeight:"",overflow:"hidden",position:"absolute",zIndex:"990"});var l=a.find(".body");l&&l.css("position","relative");var r=Common.UI.DataView.extend(function(){var t=s;return{options:{handleSelect:!1,allowScrollbar:!1,template:_.template('
    ')},getTextBox:function(){var t=$(this.el).find("textarea");return t&&t.length?t:void 0},setFocusToTextBox:function(t){var e=$(this.el).find("textarea");if(t)e.blur();else if(e&&e.length){var i=e.val();e.focus(),e.val(""),e.val(i)}},getActiveTextBoxVal:function(){var t=$(this.el).find("textarea");return t&&t.length?t.val().trim():""},autoHeightTextBox:function(){function e(){l=t.scroller.getScrollTop(),n.scrollHeight>n.clientHeight?(i.css({height:n.scrollHeight+a+"px"}),t.calculateSizeOfContent()):(r=n.clientHeight)>=o&&(i.css({height:o+"px"}),n.scrollHeight>n.clientHeight&&(c=Math.max(n.scrollHeight+a,o),i.css({height:c+"px"})),t.calculateSizeOfContent(),t.setLeftTop(s.arrowPosX,s.arrowPosY,s.leftX),t.calculateSizeOfContent()),t.scroller.scrollTop(l),t.autoScrollToEditButtons()}var i=this.$el.find("textarea"),n=null,o=50,a=0,l=0,r=0,c=0;i&&i.length&&(n=i.get(0))&&(a=.25*parseInt(i.css("lineHeight"),10),e(),i.bind("input propertychange",e)),this.textBox=i},clearTextBoxBind:function(){this.textBox&&(this.textBox.unbind("input propertychange"),this.textBox=void 0)}}}());if(r)if(this.commentsView)this.commentsView.render($("#id-comments-popover")),this.commentsView.onResetItems();else{this.commentsView=new r({el:$("#id-comments-popover"),store:s.commentsStore,itemTemplate:_.template(i(t,{textAddReply:s.textAddReply,textAdd:s.textAdd,textCancel:s.textCancel,textEdit:s.textEdit,textReply:s.textReply,textClose:s.textClose,maxCommLength:Asc.c_oAscMaxCellOrCommentLength,textMention:s.canRequestSendNotify?s.mentionShare?s.textMention:s.textMentionNotify:""}))});var c=function(t,e,i){e.tipsArray&&e.tipsArray.forEach(function(t){t.remove()});var n=[],o=$(e.el).find(".btn-resolve");o.tooltip({title:s.textResolve,placement:"cursor"}),o.each(function(t,e){n.push($(e).data("bs.tooltip").tip())}),o=$(e.el).find(".btn-resolve-check"),o.tooltip({title:s.textOpenAgain,placement:"cursor"}),o.each(function(t,e){n.push($(e).data("bs.tooltip").tip())}),e.tipsArray=n,this.autoHeightTextBox()},d=function(){s._isMouseOver=!0},h=function(){s._isMouseOver=!1};this.commentsView.on("item:add",c),this.commentsView.on("item:remove",c),this.commentsView.on("item:change",c),this.commentsView.cmpEl.on("mouseover",d).on("mouseout",h),this.commentsView.on("item:click",function(t,e,i,n){function o(){s.update()}var a,l,r,c,d,h;if(a=$(n.target)){if(l=i.get("editTextInPopover"),r=i.get("showReplyInPopover"),h=i.get("hideAddReply"),c=i.get("uid"),d=a.attr("data-value"),i.get("hint"))return void s.fireEvent("comment:disableHint",[i]);if(a.hasClass("btn-edit"))_.isUndefined(d)?l||(s.fireEvent("comment:closeEditing"),i.set("editTextInPopover",!0),s.fireEvent("comment:show",[c]),this.autoHeightTextBox(),s.calculateSizeOfContent(),s.setLeftTop(s.arrowPosX,s.arrowPosY,s.leftX),s.calculateSizeOfContent(),o(),s.hookTextBox(),s.autoScrollToEditButtons(),this.setFocusToTextBox()):(s.fireEvent("comment:closeEditing",[c]),s.fireEvent("comment:editReply",[c,d,!0]),this.replyId=d,this.autoHeightTextBox(),s.calculateSizeOfContent(),s.setLeftTop(s.arrowPosX,s.arrowPosY,s.leftX),s.calculateSizeOfContent(),o(),s.hookTextBox(),s.autoScrollToEditButtons(),this.setFocusToTextBox());else if(a.hasClass("btn-delete"))_.isUndefined(d)?s.fireEvent("comment:remove",[c]):(s.fireEvent("comment:removeReply",[c,d]),s.calculateSizeOfContent(),s.setLeftTop(s.arrowPosX,s.arrowPosY,s.leftX),s.calculateSizeOfContent()),s.fireEvent("comment:closeEditing"),o();else if(a.hasClass("user-reply"))s.fireEvent("comment:closeEditing"),i.set("showReplyInPopover",!0),s.calculateSizeOfContent(),s.setLeftTop(s.arrowPosX,s.arrowPosY,s.leftX),s.calculateSizeOfContent(),o(),this.autoHeightTextBox(),s.hookTextBox(),s.autoScrollToEditButtons(),this.setFocusToTextBox();else if(a.hasClass("btn-reply",!1))r&&(this.clearTextBoxBind(),s.fireEvent("comment:addReply",[c,this.getActiveTextBoxVal()]),s.fireEvent("comment:closeEditing"),s.calculateSizeOfContent(),o());else if(a.hasClass("btn-close",!1))s.fireEvent("comment:closeEditing",[c]),s.calculateSizeOfContent(),s.fireEvent("comment:show",[c]),o();else if(a.hasClass("btn-inner-edit",!1)){if(i.get("dummy")){var p=this.getActiveTextBoxVal();if(s.clearDummyText(),p.length>0)s.fireEvent("comment:addDummyComment",[p]);else{var u=s.$window.find("textarea:not(.user-message)");u&&u.length&&setTimeout(function(){u.focus()},10)}return}this.clearTextBoxBind(),_.isUndefined(this.replyId)?l&&(s.fireEvent("comment:change",[c,this.getActiveTextBoxVal()]),s.fireEvent("comment:closeEditing"),s.calculateSizeOfContent()):(s.fireEvent("comment:changeReply",[c,this.replyId,this.getActiveTextBoxVal()]),this.replyId=void 0,s.fireEvent("comment:closeEditing")),o()}else if(a.hasClass("btn-inner-close",!1)){if(i.get("dummy"))return s.clearDummyText(),void s.hide();h&&this.getActiveTextBoxVal().length>0?(s.saveText(),i.set("hideAddReply",!1),this.getTextBox().val(s.textVal),this.autoHeightTextBox()):(this.clearTextBoxBind(),s.fireEvent("comment:closeEditing",[c])),this.replyId=void 0,s.calculateSizeOfContent(),s.setLeftTop(s.arrowPosX,s.arrowPosY,s.leftX),s.calculateSizeOfContent(),o()}else if(a.hasClass("btn-resolve",!1)){var m=a.data("bs.tooltip");m&&(m.dontShow=!0),s.fireEvent("comment:resolve",[c]),o()}else if(a.hasClass("btn-resolve-check",!1)){var m=a.data("bs.tooltip");m&&(m.dontShow=!0),s.fireEvent("comment:resolve",[c]),o()}}}),this.emailMenu=new Common.UI.Menu({maxHeight:200,cyclic:!1,items:[]}).on("render:after",function(t){this.scroller=new Common.UI.Scroller({el:$(this.el).find(".dropdown-menu "),useKeyboard:this.enableKeyEvents&&!this.handleSelect,minScrollbarLength:40,alwaysVisibleY:!0})}).on("show:after",function(){this.scroller.update({alwaysVisibleY:!0}),s.$window.css({zIndex:"1001"})}).on("hide:after",function(){s.$window.css({zIndex:"990"})}),s.on({show:function(){s.commentsView.autoHeightTextBox(),s.$window.find("textarea").keydown(function(t){t.keyCode==Common.UI.Keys.ESC&&s.hide(!0)})},"animate:before":function(){var t=s.$window.find("textarea");t&&t.length&&t.focus()}})}var p=Common.UI.DataView.extend(function(){return{options:{handleSelect:!1,scrollable:!0,template:_.template('
    ')}}}());if(p)if(this.reviewChangesView)this.reviewChangesView.render($("#id-review-popover")),this.reviewChangesView.onResetItems();else{this.reviewChangesView=new p({el:$("#id-review-popover"),store:s.reviewStore,itemTemplate:_.template(e)});var c=function(t,e,i){e.tipsArray&&e.tipsArray.forEach(function(t){t.remove()});var n=[],o=$(e.el).find(".btn-goto");o.tooltip({title:s.textFollowMove,placement:"cursor"}),o.each(function(t,e){n.push($(e).data("bs.tooltip").tip())}),e.tipsArray=n};this.reviewChangesView.on("item:add",c),this.reviewChangesView.on("item:remove",c),this.reviewChangesView.on("item:change",c),this.reviewChangesView.on("item:click",function(t,e,i,n){var o=$(n.target);if(o)if(o.hasClass("btn-accept"))s.fireEvent("reviewchange:accept",[i.get("changedata")]);else if(o.hasClass("btn-reject"))s.fireEvent("reviewchange:reject",[i.get("changedata")]);else if(o.hasClass("btn-delete"))s.fireEvent("reviewchange:delete",[i.get("changedata")]);else if(o.hasClass("btn-goto")){var a=o.data("bs.tooltip");a&&(a.dontShow=!0),s.fireEvent("reviewchange:goto",[i.get("changedata")])}})}_.isUndefined(this.scroller)&&(this.scroller=new Common.UI.Scroller({el:a.find("#id-popover"),minScrollbarLength:40,wheelSpeed:10,alwaysVisibleY:!0}))},showComments:function(t,e,i,n){this.options.animate=t;var o=this.commentsView.getTextBox();e&&this.textVal&&o&&o.val(this.textVal),n&&n.length&&o&&o.val(n),this.show(t),this.hookTextBox(),this._state.commentsVisible=!0},showReview:function(t,e,i){this.show(t),this._state.reviewVisible=!0},show:function(t,e,i,n){this.options.animate=t,Common.UI.Window.prototype.show.call(this),this.scroller&&this.scroller.update({minScrollbarLength:40,alwaysVisibleY:!0})},hideComments:function(){this.handlerHide&&this.handlerHide(),this.hideTips(),this._state.commentsVisible=!1,this._state.reviewVisible?this.calculateSizeOfContent():this.hide()},hideReview:function(){this.handlerHide&&this.handlerHide(),this.hideTips(),this._state.reviewVisible=!1,this._state.commentsVisible?this.calculateSizeOfContent():this.hide()},hide:function(){this.handlerHide&&this.handlerHide.apply(this,arguments),this.hideTips(),Common.UI.Window.prototype.hide.call(this),_.isUndefined(this.e)||this.e.keyCode!=Common.UI.Keys.ESC||(this.e.preventDefault(),this.e.stopImmediatePropagation(),this.e=void 0)},update:function(t){this.commentsView&&t&&this.commentsView.onResetItems(),this.scroller&&this.scroller.update({minScrollbarLength:40,alwaysVisibleY:!0})},isVisible:function(){return this.$window&&this.$window.is(":visible")},setLeftTop:function(t,e,i,n,o){if(this.$window||this.render(),n&&(t=this.arrowPosX,e=this.arrowPosY,i=this.leftX),!_.isUndefined(t)||!_.isUndefined(e)){this.arrowPosX=t,this.arrowPosY=e,this.leftX=i;var s=$("#id-popover"),a=$("#id-comments-arrow"),l=$("#editor_sdk"),r=null,c=0,d="",h=0,p="",u=0,m="",g=0,f="",b=0,C=0,v=0,y=0,w=0,x=0;s&&a&&l&&l.get(0)&&(r=l.get(0).getBoundingClientRect())&&(c=r.height-2*this.sdkBounds.padding,this.$window.css({maxHeight:c+"px"}),this.sdkBounds.width=r.width,this.sdkBounds.height=r.height,_.isUndefined(t)||(d=$("#id_vertical_scroll"),d.length?h="none"!==d.css("display")?d.width():0:(d=$("#ws-v-scrollbar"),d.length&&(h="none"!==d.css("display")?d.width():0)),this.sdkBounds.width-=h,p=$("#id_panel_left"),p.length&&(u="none"!==p.css("display")?p.width():0),m=$("#id_panel_thumbnails"),m.length&&(g="none"!==m.css("display")?m.width():0,this.sdkBounds.width-=g),C=Math.min(0+t+this.arrow.width,0+this.sdkBounds.width-this.$window.outerWidth()-25),C=Math.max(0+u+this.arrow.width,C),a.removeClass("right").addClass("left"),_.isUndefined(i)||(v=this.$window.outerWidth())&&(t+v>this.sdkBounds.width-this.arrow.width+5&&this.leftX>v?(C=this.leftX-v+0-this.arrow.width,a.removeClass("left").addClass("right")):C=0+t+this.arrow.width),this.$window.css("left",C+"px")),_.isUndefined(e)||(f=$("#id_panel_top"),x=0,f.length?(b="none"!==f.css("display")?f.height():0,x+=this.sdkBounds.paddingTop):(f=$("#ws-h-scrollbar"),f.length&&(b="none"!==f.css("display")?f.height():0)),this.sdkBounds.height-=b,y=this.$window.outerHeight(),w=Math.min(0+c-y,this.arrowPosY+0-this.arrow.height),w=Math.max(w,x),parseInt(a.css("top"))+this.arrow.height>y&&a.css({top:y-this.arrow.height+"px"}),this.$window.css("top",w+"px"))),o||this.calculateSizeOfContent()}},calculateSizeOfContent:function(t){if(!t||this.$window.is(":visible")){this.$window.css({overflow:"hidden"});var e=$("#id-comments-arrow"),i=$("#id-popover"),n=null,o=null,s=null,a=0,l="",r=0,c=0,d=0,h=0,p=0,u=0;if(i&&e&&i.get(0)){var m=this.scroller.getScrollTop();i.css({height:"100%"}),n=i.get(0).getBoundingClientRect(),n&&(o=$("#editor_sdk"))&&o.get(0)&&(s=o.get(0).getBoundingClientRect())&&(a=s.height-2*this.sdkBounds.padding,u=0,d=this.$window.outerHeight(),l=$("#id_panel_top"),l.length?(r="none"!==l.css("display")?l.height():0,u+=this.sdkBounds.paddingTop):(l=$("#ws-h-scrollbar"),l.length&&(r="none"!==l.css("display")?l.height():0)),h=Math.max(i.outerHeight(),this.$window.outerHeight()),a<=h?(this.$window.css({maxHeight:a-r+"px",top:0+r+"px"}),i.css({height:a-r-3+"px"}),c=Math.min(c,a-(r+this.arrow.margin+this.arrow.height)),e.css({top:c+"px"}),this.scroller.scrollTop(m)):(h=d,h>0&&(n.top+h>a+0||0===n.height)&&(p=Math.min(0+a-h,this.arrowPosY+0-this.arrow.height),p=Math.max(p,u),this.$window.css({top:p+"px"})),c=Math.max(this.arrow.margin,this.arrowPosY-(a-h)-this.arrow.height),c=Math.min(c,h-this.arrow.margin-this.arrow.height),e.css({top:c+"px"})))}this.$window.css({overflow:""}),this.scroller&&this.scroller.update({minScrollbarLength:40,alwaysVisibleY:!0})}},saveText:function(t){this.commentsView&&this.commentsView.cmpEl.find(".lock-area").length<1&&(this.textVal=void 0,t?this.commentsView.clearTextBoxBind():this.textVal=this.commentsView.getActiveTextBoxVal())},loadText:function(){if(this.textVal&&this.commentsView){var t=this.commentsView.getTextBox();t&&t.val(this.textVal)}},getEditText:function(){if(this.commentsView)return this.commentsView.getActiveTextBoxVal()},saveDummyText:function(){this.commentsView&&this.commentsView.cmpEl.find(".lock-area").length<1&&(this.textDummyVal=this.commentsView.getActiveTextBoxVal())},clearDummyText:function(){if(this.commentsView&&this.commentsView.cmpEl.find(".lock-area").length<1){this.textDummyVal=void 0;var t=this.commentsView.getTextBox();t&&t.val(""),this.commentsView.clearTextBoxBind()}},getDummyText:function(){return this.textDummyVal||""},hookTextBox:function(){var t=this,e=this.commentsView.getTextBox();e&&e.keydown(function(e){if(!e.ctrlKey&&!e.metaKey||e.altKey||e.keyCode!==Common.UI.Keys.RETURN){if(e.keyCode===Common.UI.Keys.TAB){var i,n,o;o=this.selectionStart,n=this.selectionEnd,i=$(this),i.val(i.val().substring(0,o)+"\t"+i.val().substring(n)),this.selectionStart=this.selectionEnd=o+1,e.preventDefault()}}else{var s=$("#id-comments-change-popover");s&&s.length&&s.click(),e.stopImmediatePropagation()}t.e=e}),this.canRequestUsers&&(e&&e.keydown(function(e){e.keyCode==Common.UI.Keys.SPACE||e.keyCode===Common.UI.Keys.TAB||e.keyCode==Common.UI.Keys.HOME||e.keyCode==Common.UI.Keys.END||e.keyCode==Common.UI.Keys.RIGHT||e.keyCode==Common.UI.Keys.LEFT||e.keyCode==Common.UI.Keys.UP?t.onEmailListMenu():e.keyCode==Common.UI.Keys.DOWN&&t.emailMenu&&t.emailMenu.rendered&&t.emailMenu.isVisible()&&(_.delay(function(){var e=t.emailMenu.cmpEl.find("li:not(.divider):first");e=e.find("a"),e.focus()},10),e.preventDefault()),t.e=e}),e&&e.on("input",function(e){for(var i=$(this),n=this.selectionStart,o=i.val(),s=0,a=o.length-1,l=n-1;l>=0;l--)if(32==o.charCodeAt(l)||13==o.charCodeAt(l)||10==o.charCodeAt(l)||9==o.charCodeAt(l)){s=l+1;break}for(var l=n;l<=a;l++)if(32==o.charCodeAt(l)||13==o.charCodeAt(l)||10==o.charCodeAt(l)||9==o.charCodeAt(l)){a=l-1;break}var r=o.substring(s,a+1),c=r.match(/^(?:[@]|[+](?!1))(\S*)/);c&&c.length>1?(r=c[1],t.onEmailListMenu(r,s,a)):t.onEmailListMenu()}))},hideTips:function(){this.commentsView&&_.each(this.commentsView.dataViewItems,function(t){t.tipsArray&&t.tipsArray.forEach(function(t){t.hide()})},this),this.reviewChangesView&&_.each(this.reviewChangesView.dataViewItems,function(t){t.tipsArray&&t.tipsArray.forEach(function(t){t.hide()})},this),this.emailMenu&&this.emailMenu.rendered&&this.emailMenu.cmpEl.css("display","none")},isCommentsViewMouseOver:function(){return this._isMouseOver},setReviewStore:function(t){this.reviewStore=t,this.reviewChangesView&&this.reviewChangesView.setStore(this.reviewStore)},setCommentsStore:function(t){this.commentsStore=t,this.commentsView&&this.commentsView.setStore(this.commentsStore)},setUsers:function(t){this.externalUsers=t.users||[],this.isUsersLoading=!1,this._state.emailSearch&&this.onEmailListMenu(this._state.emailSearch.str,this._state.emailSearch.left,this._state.emailSearch.right),this._state.emailSearch=null},clearUsers:function(){this.externalUsers=[]},getPopover:function(t){return this.popover||(this.popover=new Common.Views.ReviewPopover(t)),this.popover},autoScrollToEditButtons:function(){var t=$("#id-comments-change-popover"),e=null,i=this.$window[0].getBoundingClientRect(),n=0;t.length&&(e=t.get(0).getBoundingClientRect())&&i&&(n=i.bottom-(e.bottom+7))<0&&this.scroller.scrollTop(this.scroller.getScrollTop()-n)},onEmailListMenu:function(t,e,i,n){var o=this,s=o.externalUsers,a=o.emailMenu;if(s.length<1){if(this._state.emailSearch={str:t,left:e,right:i},this.isUsersLoading)return;return this.isUsersLoading=!0,void Common.Gateway.requestUsers()}if("string"==typeof t){var l=o.$window.find(Common.Utils.String.format("#menu-container-{0}",a.id)),r=this.commentsView.getTextBox(),c=r?r[0]:null,d=c?[c.offsetLeft,c.offsetTop+c.clientHeight+3]:[0,0];a.rendered||(l.length<1&&(l=$(Common.Utils.String.format('',a.id)),o.$window.append(l)),a.render(l),a.cmpEl.css("min-width",c?c.clientWidth:220),a.cmpEl.attr({tabindex:"-1"}),a.on("hide:after",function(){setTimeout(function(){var t=o.commentsView.getTextBox();t&&t.focus()},10)}));for(var h=0;h0){t=t.toLowerCase(),t.length>0&&(s=_.filter(s,function(e){return e.email&&0===e.email.toLowerCase().indexOf(t)||e.name&&0===e.name.toLowerCase().indexOf(t)})) -;var p=_.template('
    <%= Common.Utils.String.htmlEncode(caption) %>
    <%= Common.Utils.String.htmlEncode(options.value) %>
    '),u=!1;_.each(s,function(t,n){if(u&&!t.hasAccess&&(u=!1,a.addItem(new Common.UI.MenuItem({caption:"--"}))),t.email&&t.name){var s=new Common.UI.MenuItem({caption:t.name,value:t.email,template:p}).on("click",function(t,n){o.insertEmailToTextbox(t.options.value,e,i)});a.addItem(s),t.hasAccess&&(u=!0)}})}a.items.length>0?(l.css({left:d[0],top:d[1]}),a.menuAlignEl=r,a.show(),a.cmpEl.css("display",""),a.alignPosition("bl-tl",-5),a.scroller.update({alwaysVisibleY:!0})):a.rendered&&a.cmpEl.css("display","none")}else a.rendered&&a.cmpEl.css("display","none")},insertEmailToTextbox:function(t,e,i){var n=this.commentsView.getTextBox();if(n){var o=n.val();n.val(o.substring(0,e)+"+"+t+" "+o.substring(i+1,o.length)),setTimeout(function(){n[0].selectionStart=n[0].selectionEnd=e+t.length+2},10)}},textAddReply:"Add Reply",textAdd:"Add",textCancel:"Cancel",textEdit:"Edit",textReply:"Reply",textClose:"Close",textResolve:"Resolve",textOpenAgain:"Open Again",textFollowMove:"Follow Move",textMention:"+mention will provide access to the document and send an email",textMentionNotify:"+mention will notify the user via email"},Common.Views.ReviewPopover||{}))}),void 0===Common)var Common={};if(Common.Controllers=Common.Controllers||{},define("common/main/lib/controller/Comments",["core","common/main/lib/model/Comment","common/main/lib/collection/Comments","common/main/lib/view/Comments","common/main/lib/view/ReviewPopover"],function(){"use strict";function t(){return void 0!==Asc.asc_CCommentDataWord?new Asc.asc_CCommentDataWord(null):new Asc.asc_CCommentData(null)}Common.Controllers.Comments=Backbone.Controller.extend(_.extend({models:[],collections:["Common.Collections.Comments"],views:["Common.Views.Comments","Common.Views.ReviewPopover"],sdkViewName:"#id_main",subEditStrings:{},filter:void 0,hintmode:!1,viewmode:!1,isSelectedComment:!1,uids:[],oldUids:[],isDummyComment:!1,initialize:function(){this.addListeners({"Common.Views.Comments":{"comment:add":_.bind(this.onCreateComment,this),"comment:change":_.bind(this.onChangeComment,this),"comment:remove":_.bind(this.onRemoveComment,this),"comment:resolve":_.bind(this.onResolveComment,this),"comment:show":_.bind(this.onShowComment,this),"comment:addReply":_.bind(this.onAddReplyComment,this),"comment:changeReply":_.bind(this.onChangeReplyComment,this),"comment:removeReply":_.bind(this.onRemoveReplyComment,this),"comment:editReply":_.bind(this.onShowEditReplyComment,this),"comment:closeEditing":_.bind(this.closeEditing,this)},"Common.Views.ReviewPopover":{"comment:change":_.bind(this.onChangeComment,this),"comment:remove":_.bind(this.onRemoveComment,this),"comment:resolve":_.bind(this.onResolveComment,this),"comment:show":_.bind(this.onShowComment,this),"comment:addReply":_.bind(this.onAddReplyComment,this),"comment:changeReply":_.bind(this.onChangeReplyComment,this),"comment:removeReply":_.bind(this.onRemoveReplyComment,this),"comment:editReply":_.bind(this.onShowEditReplyComment,this),"comment:closeEditing":_.bind(this.closeEditing,this),"comment:disableHint":_.bind(this.disableHint,this),"comment:addDummyComment":_.bind(this.onAddDummyComment,this)},"Common.Views.ReviewChanges":{"comment:removeComments":_.bind(this.onRemoveComments,this)}}),Common.NotificationCenter.on("comments:updatefilter",_.bind(this.onUpdateFilter,this)),Common.NotificationCenter.on("app:comment:add",_.bind(this.onAppAddComment,this)),Common.NotificationCenter.on("layout:changed",function(t){Common.Utils.asyncCall(function(t){"toolbar"!=t&&"status"!=t||!this.view.$el.is(":visible")||this.onAfterShow()},this,t)}.bind(this))},onLaunch:function(){this.collection=this.getApplication().getCollection("Common.Collections.Comments"),this.collection&&(this.collection.comparator=function(t){return-t.get("time")}),this.popoverComments=new Common.Collections.Comments,this.popoverComments&&(this.popoverComments.comparator=function(t){return t.get("time")}),this.groupCollection=[],this.view=this.createView("Common.Views.Comments",{store:this.collection}),this.view.render(),this.userCollection=this.getApplication().getCollection("Common.Collections.Users"),this.userCollection.on("reset",_.bind(this.onUpdateUsers,this)),this.userCollection.on("add",_.bind(this.onUpdateUsers,this)),this.bindViewEvents(this.view,this.events)},setConfig:function(t,e){this.setApi(e),t&&(this.currentUserId=t.config.user.id,this.currentUserName=t.config.user.fullname,this.sdkViewName=t.sdkviewname||this.sdkViewName,this.hintmode=t.hintmode||!1,this.viewmode=t.viewmode||!1)},setApi:function(t){t&&(this.api=t,this.api.asc_registerCallback("asc_onAddComment",_.bind(this.onApiAddComment,this)),this.api.asc_registerCallback("asc_onAddComments",_.bind(this.onApiAddComments,this)),this.api.asc_registerCallback("asc_onRemoveComment",_.bind(this.onApiRemoveComment,this)),this.api.asc_registerCallback("asc_onChangeComments",_.bind(this.onChangeComments,this)),this.api.asc_registerCallback("asc_onRemoveComments",_.bind(this.onApiRemoveComments,this)),this.api.asc_registerCallback("asc_onChangeCommentData",_.bind(this.onApiChangeCommentData,this)),this.api.asc_registerCallback("asc_onLockComment",_.bind(this.onApiLockComment,this)),this.api.asc_registerCallback("asc_onUnLockComment",_.bind(this.onApiUnLockComment,this)),this.api.asc_registerCallback("asc_onShowComment",_.bind(this.onApiShowComment,this)),this.api.asc_registerCallback("asc_onHideComment",_.bind(this.onApiHideComment,this)),this.api.asc_registerCallback("asc_onUpdateCommentPosition",_.bind(this.onApiUpdateCommentPosition,this)),this.api.asc_registerCallback("asc_onDocumentPlaceChanged",_.bind(this.onDocumentPlaceChanged,this)))},setMode:function(t){return this.mode=t,this.isModeChanged=!0,this.view.viewmode=!this.mode.canComments,this.view.changeLayout(t),this},onCreateComment:function(e,i,n,o,s){if(this.api&&i&&i.length>0){var a=t();a&&(this.showPopover=!0,this.editPopover=!!n,this.hidereply=o,this.isSelectedComment=!1,this.uids=[],a.asc_putText(i),a.asc_putTime(this.utcDateToString(new Date)),a.asc_putOnlyOfficeTime(this.ooDateToString(new Date)),a.asc_putUserId(this.currentUserId),a.asc_putUserName(this.currentUserName),a.asc_putSolved(!1),_.isUndefined(a.asc_putDocumentFlag)||a.asc_putDocumentFlag(s),this.api.asc_addComment(a),this.view.showEditContainer(!1))}this.view.txtComment.focus()},onRemoveComment:function(t){this.api&&t&&this.api.asc_removeComment(t)},onRemoveComments:function(t){this.api&&this.api.asc_RemoveAllComments("my"==t||!this.mode.canEditComments,"current"==t)},onResolveComment:function(e){var i=this,n=null,o=null,s=t(),a=i.findComment(e);return _.isUndefined(e)&&(e=a.get("uid")),!(!s||!a)&&(s.asc_putText(a.get("comment")),s.asc_putQuoteText(a.get("quote")),s.asc_putTime(i.utcDateToString(new Date(a.get("time")))),s.asc_putOnlyOfficeTime(i.ooDateToString(new Date(a.get("time")))),s.asc_putUserId(a.get("userid")),s.asc_putUserName(a.get("username")),s.asc_putSolved(!a.get("resolved")),s.asc_putGuid(a.get("guid")),s.asc_putUserData(a.get("userdata")),_.isUndefined(s.asc_putDocumentFlag)||s.asc_putDocumentFlag(a.get("unattached")),n=a.get("replys"),n&&n.length&&n.forEach(function(e){(o=t())&&(o.asc_putText(e.get("reply")),o.asc_putTime(i.utcDateToString(new Date(e.get("time")))),o.asc_putOnlyOfficeTime(i.ooDateToString(new Date(e.get("time")))),o.asc_putUserId(e.get("userid")),o.asc_putUserName(e.get("username")),o.asc_putUserData(e.get("userdata")),s.asc_addReply(o))}),i.api.asc_changeComment(e,s),!0)},onShowComment:function(t,e,i){var n=this.findComment(t);if(n)if(null!==n.get("quote")){if(this.api){if(this.hintmode){if(this.animate=!0,n.get("unattached")&&this.getPopover())return void this.getPopover().hideComments()}else{var o=this.popoverComments.findWhere({uid:t});if(o&&!this.getPopover().isVisible())return this.getPopover().showComments(!0),void this.api.asc_selectComment(t)}!_.isUndefined(e)&&this.hintmode&&(this.isSelectedComment=e),i&&0===_.difference(this.uids,[t]).length&&0===_.difference([t],this.uids).length||(this.api.asc_selectComment(t),this._dontScrollToComment=!0,this.api.asc_showComment(t,!1))}}else this.hintmode&&this.api.asc_selectComment(t),this.getPopover()&&this.getPopover().hideComments(),this.isSelectedComment=!1,this.uids=[]},onChangeComment:function(e,i){if(i&&i.length>0){var n=this,o=null,s=null,a=null,l=t(),r=n.findComment(e);if(r&&l)return l.asc_putText(i),l.asc_putQuoteText(r.get("quote")),l.asc_putTime(n.utcDateToString(new Date(r.get("time")))),l.asc_putOnlyOfficeTime(n.ooDateToString(new Date(r.get("time")))),l.asc_putUserId(n.currentUserId),l.asc_putUserName(n.currentUserName),l.asc_putSolved(r.get("resolved")),l.asc_putGuid(r.get("guid")),l.asc_putUserData(r.get("userdata")),_.isUndefined(l.asc_putDocumentFlag)||l.asc_putDocumentFlag(r.get("unattached")),r.set("editTextInPopover",!1),o=n.findPopupComment(e),o&&o.set("editTextInPopover",!1),n.subEditStrings[e]&&delete n.subEditStrings[e],n.subEditStrings[e+"-R"]&&delete n.subEditStrings[e+"-R"],s=r.get("replys"),s&&s.length&&s.forEach(function(e){(a=t())&&(a.asc_putText(e.get("reply")),a.asc_putTime(n.utcDateToString(new Date(e.get("time")))),a.asc_putOnlyOfficeTime(n.ooDateToString(new Date(e.get("time")))),a.asc_putUserId(e.get("userid")),a.asc_putUserName(e.get("username")),a.asc_putUserData(e.get("userdata")),l.asc_addReply(a))}),n.api.asc_changeComment(e,l),!0}return!1},onChangeReplyComment:function(e,i,n){if(n&&n.length>0){var o=this,s=null,a=null,l=t(),r=o.findComment(e);if(l&&r)return l.asc_putText(r.get("comment")),l.asc_putQuoteText(r.get("quote")),l.asc_putTime(o.utcDateToString(new Date(r.get("time")))),l.asc_putOnlyOfficeTime(o.ooDateToString(new Date(r.get("time")))),l.asc_putUserId(r.get("userid")),l.asc_putUserName(r.get("username")),l.asc_putSolved(r.get("resolved")),l.asc_putGuid(r.get("guid")),l.asc_putUserData(r.get("userdata")),_.isUndefined(l.asc_putDocumentFlag)||l.asc_putDocumentFlag(r.get("unattached")),s=r.get("replys"),s&&s.length&&s.forEach(function(e){(a=t())&&(e.get("id")!==i||_.isUndefined(n)?(a.asc_putText(e.get("reply")),a.asc_putUserId(e.get("userid")),a.asc_putUserName(e.get("username"))):(a.asc_putText(n),a.asc_putUserId(o.currentUserId),a.asc_putUserName(o.currentUserName)),a.asc_putTime(o.utcDateToString(new Date(e.get("time")))),a.asc_putOnlyOfficeTime(o.ooDateToString(new Date(e.get("time")))),a.asc_putUserData(e.get("userdata")),l.asc_addReply(a))}),o.api.asc_changeComment(e,l),!0}return!1},onAddReplyComment:function(e,i){if(i.length>0){var n=this,o=null,s=null,a=null,l=t(),r=n.findComment(e);if(l&&r&&(o=r.get("uid"),o&&(n.subEditStrings[o]&&delete n.subEditStrings[o],n.subEditStrings[o+"-R"]&&delete n.subEditStrings[o+"-R"],r.set("showReplyInPopover",!1)),l.asc_putText(r.get("comment")),l.asc_putQuoteText(r.get("quote")),l.asc_putTime(n.utcDateToString(new Date(r.get("time")))),l.asc_putOnlyOfficeTime(n.ooDateToString(new Date(r.get("time")))),l.asc_putUserId(r.get("userid")),l.asc_putUserName(r.get("username")),l.asc_putSolved(r.get("resolved")),l.asc_putGuid(r.get("guid")),l.asc_putUserData(r.get("userdata")),_.isUndefined(l.asc_putDocumentFlag)||l.asc_putDocumentFlag(r.get("unattached")),s=r.get("replys"),s&&s.length&&s.forEach(function(e){(a=t())&&(a.asc_putText(e.get("reply")),a.asc_putTime(n.utcDateToString(new Date(e.get("time")))),a.asc_putOnlyOfficeTime(n.ooDateToString(new Date(e.get("time")))),a.asc_putUserId(e.get("userid")),a.asc_putUserName(e.get("username")),a.asc_putUserData(e.get("userdata")),l.asc_addReply(a))}),a=t()))return a.asc_putText(i),a.asc_putTime(n.utcDateToString(new Date)),a.asc_putOnlyOfficeTime(n.ooDateToString(new Date)),a.asc_putUserId(n.currentUserId),a.asc_putUserName(n.currentUserName),l.asc_addReply(a),n.api.asc_changeComment(e,l),n.mode&&n.mode.canRequestSendNotify&&n.view.pickEMail(l.asc_getGuid(),i),!0}return!1},onRemoveReplyComment:function(e,i){if(!_.isUndefined(e)&&!_.isUndefined(i)){var n=this,o=null,s=null,a=t(),l=n.findComment(e);if(a&&l)return a.asc_putText(l.get("comment")),a.asc_putQuoteText(l.get("quote")),a.asc_putTime(n.utcDateToString(new Date(l.get("time")))),a.asc_putOnlyOfficeTime(n.ooDateToString(new Date(l.get("time")))),a.asc_putUserId(l.get("userid")),a.asc_putUserName(l.get("username")),a.asc_putSolved(l.get("resolved")),a.asc_putGuid(l.get("guid")),a.asc_putUserData(l.get("userdata")),_.isUndefined(a.asc_putDocumentFlag)||a.asc_putDocumentFlag(l.get("unattached")),o=l.get("replys"),o&&o.length&&o.forEach(function(e){e.get("id")!==i&&(s=t())&&(s.asc_putText(e.get("reply")),s.asc_putTime(n.utcDateToString(new Date(e.get("time")))),s.asc_putOnlyOfficeTime(n.ooDateToString(new Date(e.get("time")))),s.asc_putUserId(e.get("userid")),s.asc_putUserName(e.get("username")),s.asc_putUserData(e.get("userdata")),a.asc_addReply(s))}),n.api.asc_changeComment(e,a),!0}return!1},onShowEditReplyComment:function(t,e,i){var n,o,s,a;if(!_.isUndefined(t)&&!_.isUndefined(e))if(i){if((o=this.popoverComments.findWhere({uid:t}))&&(s=o.get("replys"),a=_.clone(o.get("replys"))))for(n=0;n=0;--s)o?this.collection.at(s).set("last",!0,{silent:!0}):this.collection.at(s).get("last")&&this.collection.at(s).set("last",!1,{silent:!0}),o=!1;this.view.render(),this.view.update()}}},onAppAddComment:function(t,e){this.api.can_AddQuotedComment&&!1===this.api.can_AddQuotedComment()||e||this.addDummyComment()},addCommentToGroupCollection:function(t){var e=t.get("groupName");this.groupCollection[e]||(this.groupCollection[e]=new Backbone.Collection([],{model:Common.Models.Comment})),this.groupCollection[e].push(t)},onApiAddComment:function(t,e){var i=this.readSDKComment(t,e);i&&(i.get("groupName")?(this.addCommentToGroupCollection(i),_.indexOf(this.collection.groups,i.get("groupName"))>-1&&this.collection.push(i)):this.collection.push(i),this.updateComments(!0),this.showPopover&&(null!==e.asc_getQuoteText()&&(this.api.asc_selectComment(t),this._dontScrollToComment=!0,this.api.asc_showComment(t,!0)),this.showPopover=void 0,this.editPopover=!1))},onApiAddComments:function(t){for(var e=0;e100&&(clearInterval(n.timerUpdateComments),n.timerUpdateComments=void 0,n.updateCommentsView(t,e,i))},25))},updateCommentsView:function(t,e,i){if(t&&!this.view.isVisible())return this.view.needRender=t,void this.onUpdateFilter(this.filter,!0);var n,o=!0;if(_.isUndefined(e)&&this.collection.sort(),t){for(this.onUpdateFilter(this.filter,!0),n=this.collection.length-1;n>=0;--n)o?this.collection.at(n).set("last",!0,{silent:!0}):this.collection.at(n).get("last")&&this.collection.at(n).set("last",!1,{silent:!0}),o=!1;this.view.render(),this.view.needRender=!1}this.view.update(),i&&this.view.loadText()},findComment:function(t){return this.collection.findWhere({uid:t})},findPopupComment:function(t){return this.popoverComments.findWhere({id:t})},findCommentInGroup:function(t){for(var e in this.groupCollection){var i=this.groupCollection[e],n=i.findWhere({uid:t});if(n)return n}},closeEditing:function(t){if(!_.isUndefined(t)){var e=this.findPopupComment(t);e&&(e.set("editTextInPopover",!1),e.set("showReplyInPopover",!1)),this.subEditStrings[t]&&delete this.subEditStrings[t],this.subEditStrings[t+"-R"]&&delete this.subEditStrings[t+"-R"]}this.collection.clearEditing(),this.collection.each(function(t){var e=_.clone(t.get("replys"));t.get("replys").length=0,e.forEach(function(t){t.get("editText")&&t.set("editText",!1),t.get("editTextInPopover")&&t.set("editTextInPopover",!1)}),t.set("replys",e)}),this.view.showEditContainer(!1),this.view.update()},disableHint:function(t){t&&this.mode.canComments&&(t.set("hint",!1),this.api.asc_showComment(t.get("uid"),!1),this.isSelectedComment=!0)},blockPopover:function(t){this.isSelectedComment=t,t&&this.getPopover().isVisible()&&this.getPopover().hide()},getPopover:function(){return _.isUndefined(this.popover)&&(this.popover=Common.Views.ReviewPopover.prototype.getPopover({commentsStore:this.popoverComments,renderTo:this.sdkViewName,canRequestUsers:this.mode?this.mode.canRequestUsers:void 0,canRequestSendNotify:this.mode?this.mode.canRequestSendNotify:void 0,mentionShare:!this.mode||this.mode.mentionShare}),this.popover.setCommentsStore(this.popoverComments)),this.popover},onUpdateUsers:function(){var t=this.userCollection,e=!1;for(var i in this.groupCollection)e=!0,this.groupCollection[i].each(function(e){var i=t.findOriginalUser(e.get("userid")),n=i?i.get("color"):null,o=!1;n!==e.get("usercolor")&&(o=!0,e.set("usercolor",n,{silent:!0})),e.get("replys").forEach(function(e){i=t.findOriginalUser(e.get("userid")),(n=i?i.get("color"):null)!==e.get("usercolor")&&(o=!0,e.set("usercolor",n,{silent:!0}))}),o&&e.trigger("change")});!e&&this.collection.each(function(e){var i=t.findOriginalUser(e.get("userid")),n=i?i.get("color"):null,o=!1;n!==e.get("usercolor")&&(o=!0,e.set("usercolor",n,{silent:!0})),e.get("replys").forEach(function(e){i=t.findOriginalUser(e.get("userid")),(n=i?i.get("color"):null)!==e.get("usercolor")&&(o=!0,e.set("usercolor",n,{silent:!0}))}),o&&e.trigger("change")})},readSDKComment:function(t,e){var i=e.asc_getOnlyOfficeTime()?new Date(this.stringOOToLocalDate(e.asc_getOnlyOfficeTime())):""==e.asc_getTime()?new Date:new Date(this.stringUtcToLocalDate(e.asc_getTime())),n=this.userCollection.findOriginalUser(e.asc_getUserId()),o=t.substr(0,t.lastIndexOf("_")+1).match(/^(doc|sheet[0-9_]+)_/),s=new Common.Models.Comment({uid:t,guid:e.asc_getGuid(),userid:e.asc_getUserId(),username:e.asc_getUserName(),usercolor:n?n.get("color"):null,date:this.dateToLocaleTimeString(i),quote:e.asc_getQuoteText(),comment:e.asc_getText(),resolved:e.asc_getSolved(),unattached:!_.isUndefined(e.asc_getDocumentFlag)&&e.asc_getDocumentFlag(),userdata:e.asc_getUserData(),id:Common.UI.getId(),time:i.getTime(),showReply:!1,editText:!1,last:void 0,editTextInPopover:!!this.editPopover,showReplyInPopover:!1,hideAddReply:_.isUndefined(this.hidereply)?!!this.showPopover:this.hidereply,scope:this.view,editable:this.mode.canEditComments||e.asc_getUserId()==this.currentUserId,hint:!this.mode.canComments,groupName:o&&o.length>1?o[1]:null});if(s){var a=this.readSDKReplies(e);a.length&&s.set("replys",a)}return s},readSDKReplies:function(t){var e=0,i=[],n=null,o=t.asc_getRepliesCount();if(o)for(e=0;e0){var i=t();i&&(this.showPopover=!0,this.editPopover=!1,this.hidereply=!1,this.isSelectedComment=!1,this.uids=[],this.popoverComments.reset(),this.getPopover().isVisible()&&this.getPopover().hideComments(),this.isDummyComment=!1,i.asc_putText(e),i.asc_putTime(this.utcDateToString(new Date)),i.asc_putOnlyOfficeTime(this.ooDateToString(new Date)),i.asc_putUserId(this.currentUserId),i.asc_putUserName(this.currentUserName),i.asc_putSolved(!1),_.isUndefined(i.asc_putDocumentFlag)||i.asc_putDocumentFlag(!1),this.api.asc_addComment(i),this.view.showEditContainer(!1),this.mode&&this.mode.canRequestSendNotify&&this.view.pickEMail(i.asc_getGuid(),e),_.isUndefined(this.api.asc_SetDocumentPlaceChangedEnabled)||this.api.asc_SetDocumentPlaceChangedEnabled(!1))}},clearDummyComment:function(t){if(this.isDummyComment){this.isDummyComment=!1,this.showPopover=!0,this.editPopover=!1,this.hidereply=!1,this.isSelectedComment=!1,this.uids=[];var e=this.getPopover();e&&(t&&e.clearDummyText(),e.saveDummyText(),e.handlerHide=function(){},e.isVisible()&&e.hideComments()),this.popoverComments.reset(),_.isUndefined(this.api.asc_SetDocumentPlaceChangedEnabled)||this.api.asc_SetDocumentPlaceChangedEnabled(!1),Common.NotificationCenter.trigger("comments:cleardummy")}},onEditComments:function(t){if(this.api){var e=0,i=this,n=null,o=this.api.asc_getAnchorPosition();if(o){for(this.isSelectedComment=!0,this.popoverComments.reset(),e=0;e0&&(this.getPopover().isVisible()&&this.getPopover().hide(),this.getPopover().setLeftTop(o.asc_getX()+o.asc_getWidth(),o.asc_getY(),this.hintmode?o.asc_getX():void 0),this.getPopover().showComments(!0,!1,!0))}}},onAfterShow:function(){if(this.view&&this.api){var t=$(".new-comment-ct",this.view.el);t&&t.length&&"none"!==t.css("display")&&this.view.txtComment.focus(),this.view.needRender?this.updateComments(!0):this.view.needUpdateFilter&&this.onUpdateFilter(this.view.needUpdateFilter),this.view.update()}},onBeforeHide:function(){this.view&&this.view.showEditContainer(!1)},timeZoneOffsetInMs:6e4*(new Date).getTimezoneOffset(),stringOOToLocalDate:function(t){return"string"==typeof t?parseInt(t):0},ooDateToString:function(t){return"[object Date]"===Object.prototype.toString.call(t)?t.getTime().toString():""},stringUtcToLocalDate:function(t){return"string"==typeof t?parseInt(t)+this.timeZoneOffsetInMs:0},utcDateToString:function(t){return"[object Date]"===Object.prototype.toString.call(t)?(t.getTime()-this.timeZoneOffsetInMs).toString():""},dateToLocaleTimeString:function(t){return t.getMonth()+1+"/"+t.getDate()+"/"+t.getFullYear()+" "+function(t){var e=t.getHours(),i=t.getMinutes(),n=e>=12?"pm":"am";return e%=12,e=e||12,i=i<10?"0"+i:i,e+":"+i+" "+n}(t)},getView:function(t){return!t&&this.view?this.view:Backbone.Controller.prototype.getView.call(this,t)},setPreviewMode:function(t){this.viewmode!==t&&(this.viewmode=t,t&&(this.prevcanComments=this.mode.canComments),this.mode.canComments=!t&&this.prevcanComments,this.closeEditing(),this.setMode(this.mode),this.updateComments(!0),this.getPopover()&&(t?this.getPopover().hide():this.getPopover().update(!0)))},clearCollections:function(){this.collection.reset(),this.groupCollection=[]}},Common.Controllers.Comments||{}))}),void 0===Common)var Common={};if(Common.Models=Common.Models||{},define("common/main/lib/model/User",["underscore","backbone","common/main/lib/component/BaseView"],function(t,e){"use strict";Common.Models.User=e.Model.extend({defaults:function(){return{iid:Common.UI.getId(),id:void 0,idOriginal:void 0,username:"Guest",color:"#fff",colorval:null,online:!1,view:!1}}})}),define("common/main/lib/collection/Users",["backbone","common/main/lib/model/User"],function(t){"use strict";Common.Collections=Common.Collections||{},Common.Collections.Users=t.Collection.extend({model:Common.Models.User,getOnlineCount:function(){var t=0;return this.each(function(e){e.get("online")&&++t}),t},getEditingCount:function(){return this.filter(function(t){return t.get("online")&&!t.get("view")}).length},getEditingOriginalCount:function(){return this.chain().filter(function(t){return t.get("online")&&!t.get("view")}).groupBy(function(t){return t.get("idOriginal")}).size().value()}, -findUser:function(t){return this.find(function(e){return e.get("id")==t})},findOriginalUser:function(t){return this.find(function(e){return e.get("idOriginal")==t})}}),Common.Collections.HistoryUsers=t.Collection.extend({model:Common.Models.User,findUser:function(t){return this.find(function(e){return e.get("id")==t})}})}),define("common/main/lib/model/ChatMessage",["backbone"],function(t){"use strict";Common.Models=Common.Models||{},Common.Models.ChatMessage=t.Model.extend({defaults:{type:0,userid:null,username:"",message:""}})}),define("common/main/lib/collection/ChatMessages",["backbone","common/main/lib/model/ChatMessage"],function(t){"use strict";!Common.Collections&&(Common.Collections={}),Common.Collections.ChatMessages=t.Collection.extend({model:Common.Models.ChatMessage})}),define("common/main/lib/controller/Chat",["core","common/main/lib/collection/Users","common/main/lib/collection/ChatMessages","common/main/lib/view/Chat"],function(){"use strict";Common.Controllers.Chat=Backbone.Controller.extend(_.extend({models:[],collections:["Common.Collections.Users","Common.Collections.ChatMessages"],views:["Common.Views.Chat"],initialize:function(){this.addListeners({"Common.Views.Chat":{"message:add":_.bind(this.onSendMessage,this)}});var t=this;Common.NotificationCenter.on("layout:changed",function(e){Common.Utils.asyncCall(function(e){"toolbar"!=e&&"status"!=e||!t.panelChat.$el.is(":visible")||(t.panelChat.updateLayout(!0),t.panelChat.setupAutoSizingTextBox())},this,e)})},events:{},onLaunch:function(){this.panelChat=this.createView("Common.Views.Chat",{storeUsers:this.getApplication().getCollection("Common.Collections.Users"),storeMessages:this.getApplication().getCollection("Common.Collections.ChatMessages")})},setMode:function(t){return this.mode=t,this.api&&(this.mode.canCoAuthoring&&this.mode.canChat&&this.api.asc_registerCallback("asc_onCoAuthoringChatReceiveMessage",_.bind(this.onReceiveMessage,this)),this.mode.isEditDiagram||this.mode.isEditMailMerge||(this.api.asc_registerCallback("asc_onAuthParticipantsChanged",_.bind(this.onUsersChanged,this)),this.api.asc_registerCallback("asc_onConnectionStateChanged",_.bind(this.onUserConnection,this)),this.api.asc_coAuthoringGetUsers()),this.mode.canCoAuthoring&&this.mode.canChat&&this.api.asc_coAuthoringChatGetMessages()),this},setApi:function(t){return this.api=t,this},onUsersChanged:function(t,e){if(!this.mode.canLicense||!this.mode.canCoAuthoring){var i=0;for(o in t)void 0!==o&&i++;if(i>1&&void 0==this._isCoAuthoringStopped)return this._isCoAuthoringStopped=!0,this.api.asc_coAuthoringDisconnect(),void Common.NotificationCenter.trigger("api:disconnect")}var n=this.getApplication().getCollection("Common.Collections.Users");if(n){var o,s,a=[];for(o in t)if(void 0!==o&&(s=t[o])){var l=new Common.Models.User({id:s.asc_getId(),idOriginal:s.asc_getIdOriginal(),username:s.asc_getUserName(),online:!0,color:s.asc_getColor(),view:s.asc_getView()});a[s.asc_getId()==e?"unshift":"push"](l)}n[n.size()>0?"add":"reset"](a)}},onUserConnection:function(t){var e=this.getApplication().getCollection("Common.Collections.Users");if(e){var i=e.findUser(t.asc_getId());i?i.set({online:t.asc_getState()}):e.add(new Common.Models.User({id:t.asc_getId(),idOriginal:t.asc_getIdOriginal(),username:t.asc_getUserName(),online:t.asc_getState(),color:t.asc_getColor(),view:t.asc_getView()}))}},onReceiveMessage:function(t,e){var i=this.getApplication().getCollection("Common.Collections.ChatMessages");if(i){var n=[];t.forEach(function(t){n.push(new Common.Models.ChatMessage({userid:t.useridoriginal,message:t.message,username:t.username}))}),i[i.size()<1||e?"reset":"add"](n)}},onSendMessage:function(t,e){if(e.length>0){var i=this;(function(t,e){for(var i=[];t;){if(t.length .group",e.$toolbarPanelPlugins),o=$('').appendTo(n);i.render(o)}},onResetPlugins:function(t){var e=this;if(e.appOptions.canPlugins=!t.isEmpty(),e.$toolbarPanelPlugins){e.$toolbarPanelPlugins.empty();var i=$('
    '),n=-1,o=0;t.each(function(t){var s=t.get("groupRank");s!==n&&n>-1&&o>0&&(i.appendTo(e.$toolbarPanelPlugins),$('
    ').appendTo(e.$toolbarPanelPlugins),i=$('
    '),o=0);var a=e.panelPlugins.createPluginButton(t);if(a){var l=$('').appendTo(i);a.render(l),o++}n=s}),i.appendTo(e.$toolbarPanelPlugins)}else console.error("toolbar panel isnot created")},onSelectPlugin:function(t,e,i,n){var o=$(n.target);if(o&&o.hasClass("plugin-caret")){var s=this.panelPlugins.pluginMenu;if(s.isVisible())return void s.hide();var a,l=this,r=$(n.currentTarget),c=$(this.panelPlugins.el),d=r.offset(),h=c.offset();if(a=[d.left-h.left+r.width(),d.top-h.top+r.height()/2],void 0!=i){for(var p=0;p0?m.get("description"):l.panelPlugins.textStart,value:parseInt(m.get("index"))}).on("click",function(t,e){l.api&&l.api.asc_pluginRun(i.get("guid"),t.value,"")});s.addItem(g)}}var f=c.find("#menu-plugin-container");s.rendered||(f.length<1&&(f=$('',s.id),c.append(f)),s.render(f),s.cmpEl.attr({tabindex:"-1"}),s.on({"show:after":function(t){t&&t.menuAlignEl&&t.menuAlignEl.toggleClass("over",!0)},"hide:after":function(t){t&&t.menuAlignEl&&t.menuAlignEl.toggleClass("over",!1)}})),f.css({left:a[0],top:a[1]}),s.menuAlignEl=r,s.setOffset(-20,-r.height()/2-3),s.show(),_.delay(function(){s.cmpEl.focus()},10),n.stopPropagation(),n.preventDefault()}else this.api.asc_pluginRun(i.get("guid"),0,"")},onPluginShow:function(t,e,i,n){var o=t.get_Variations()[e];if(o.get_Visual()){var s=o.get_Url();if(s=(0==t.get_BaseUrl().length?s:t.get_BaseUrl())+s,n&&(s+=n),o.get_InsideMode())this.panelPlugins.openInsideMode(t.get_Name(),s,i)||this.api.asc_pluginButtonClick(-1);else{var a=this,l=o.get_CustomWindow(),r=o.get_Buttons(),c=[],d=o.get_Size();(!d||d.length<2)&&(d=[800,600]),_.isArray(r)&&_.each(r,function(t,e){t.visible&&(c[e]={caption:t.text,value:e,primary:t.primary})});var h=o.get_Help();a.pluginDlg=new Common.Views.PluginDlg({cls:l?"plain":"",header:!l,title:t.get_Name(),width:d[0],height:d[1],url:s,frameId:i,buttons:l?void 0:c,toolcallback:_.bind(this.onToolClose,this),help:!!h}),a.pluginDlg.on({"render:after":function(t){t.getChild(".footer .dlg-btn").on("click",_.bind(a.onDlgBtnClick,a)),a.pluginContainer=a.pluginDlg.$window.find("#id-plugin-container")},close:function(t){a.pluginDlg=void 0},drag:function(t){a.api.asc_pluginEnableMouseEvents("start"==t[1])},resize:function(t){a.api.asc_pluginEnableMouseEvents("start"==t[1])},help:function(){h&&window.open(h,"_blank")}}),a.pluginDlg.show()}}this.panelPlugins.openedPluginMode(t.get_Guid())},onPluginClose:function(t){this.pluginDlg?this.pluginDlg.close():this.panelPlugins.iframePlugin&&this.panelPlugins.closeInsideMode(),this.panelPlugins.closedPluginMode(t.get_Guid()),this.runAutoStartPlugins()},onPluginResize:function(t,e,i,n){if(this.pluginDlg){var o=e&&e.length>1&&i&&i.length>1&&(i[0]>e[0]||i[1]>e[1]||0==i[0]||0==i[1]);this.pluginDlg.setResizable(o,e,i),this.pluginDlg.setInnerSize(t[0],t[1]),n&&n.call()}},onDlgBtnClick:function(t){var e=t.currentTarget.attributes.result.value;this.api.asc_pluginButtonClick(parseInt(e))},onToolClose:function(){this.api.asc_pluginButtonClick(-1)},onPluginMouseUp:function(t,e){this.pluginDlg?(this.pluginDlg.binding.dragStop&&this.pluginDlg.binding.dragStop(),this.pluginDlg.binding.resizeStop&&this.pluginDlg.binding.resizeStop()):Common.NotificationCenter.trigger("frame:mouseup",{pageX:t*Common.Utils.zoom()+this._moveOffset.x,pageY:e*Common.Utils.zoom()+this._moveOffset.y})},onPluginMouseMove:function(t,e){if(this.pluginDlg){var i=this.pluginContainer.offset();this.pluginDlg.binding.drag&&this.pluginDlg.binding.drag({pageX:t*Common.Utils.zoom()+i.left,pageY:e*Common.Utils.zoom()+i.top}),this.pluginDlg.binding.resize&&this.pluginDlg.binding.resize({pageX:t*Common.Utils.zoom()+i.left,pageY:e*Common.Utils.zoom()+i.top})}else Common.NotificationCenter.trigger("frame:mousemove",{pageX:t*Common.Utils.zoom()+this._moveOffset.x,pageY:e*Common.Utils.zoom()+this._moveOffset.y})},onPluginsInit:function(t){!(t instanceof Array)&&(t=t.pluginsData),this.parsePlugins(t)},runAutoStartPlugins:function(){this.autostart&&this.autostart.length>0&&this.api.asc_pluginRun(this.autostart.shift(),0,"")},resetPluginsList:function(){this.getApplication().getCollection("Common.Collections.Plugins").reset()},applyUICustomization:function(){var me=this;return new Promise(function(resolve,reject){var timer_sl=setInterval(function(){if(me.customPluginsComplete){clearInterval(timer_sl);try{me.configPlugins.UIplugins&&me.configPlugins.UIplugins.forEach(function(c){c.code&&eval(c.code)})}catch(t){}resolve()}},10)})},parsePlugins:function(t,e){var i=this,n=this.getApplication().getCollection("Common.Collections.Plugins"),o=i.appOptions.isEdit,s=i.editor;if(t instanceof Array){var a=[],l=[],r=i.appOptions.lang.split(/[\-_]/)[0];t.forEach(function(t){if(!(a.some(function(e){return e.get("baseUrl")==t.baseUrl||e.get("guid")==t.guid})||n.findWhere({baseUrl:t.baseUrl})||n.findWhere({guid:t.guid}))){var e=[],i=!1;if(t.variations.forEach(function(n){var a=(o||n.isViewer&&!1!==n.isDisplayedInViewer)&&_.contains(n.EditorsSupport,s)&&!n.isSystem;if(a&&(i=!0),t.isUICustomizer)a&&l.push({url:t.baseUrl+n.url});else{var c=new Common.Models.PluginVariation(n),d=n.description;"object"==typeof n.descriptionLocale&&(d=n.descriptionLocale[r]||n.descriptionLocale.en||d||""),_.each(n.buttons,function(t,e){"object"==typeof t.textLocale&&(t.text=t.textLocale[r]||t.textLocale.en||t.text||""),t.visible=o||!1!==t.isViewer}),c.set({description:d,index:e.length,url:n.url,icons:n.icons,buttons:n.buttons,visible:a,help:n.help}),e.push(c)}}),e.length>0&&!t.isUICustomizer){var c=t.name;"object"==typeof t.nameLocale&&(c=t.nameLocale[r]||t.nameLocale.en||c||""),a.push(new Common.Models.Plugin({name:c,guid:t.guid,baseUrl:t.baseUrl,variations:e,currentVariation:0,visible:i,groupName:t.group?t.group.name:"",groupRank:t.group?t.group.rank:0}))}}}),!1!==e&&(i.configPlugins.UIplugins=l),!e&&n&&(a=n.models.concat(a),a.sort(function(t,e){var i=t.get("groupRank"),n=e.get("groupRank");return in?0==n?-1:1:0}),n.reset(a),this.appOptions.canPlugins=!n.isEmpty())}else e||(this.appOptions.canPlugins=!1);e||this.getApplication().getController("LeftMenu").enablePlugins(),this.appOptions.canPlugins&&(this.refreshPluginsList(),this.runAutoStartPlugins())},getPlugins:function(t,e){if(!t||t.length<1)return Promise.resolve([]);e=e||function(t){return fetch(t).then(function(e){return e.ok?e.json():Promise.reject(t)}).then(function(e){return e.baseUrl=t.substring(0,t.lastIndexOf("config.json")),e})};var i=[];return t.map(e).reduce(function(t,e){return t.then(function(){return e}).then(function(t){return i.push(t),Promise.resolve(t)}).catch(function(t){return Promise.resolve(t)})},Promise.resolve()).then(function(){return Promise.resolve(i)})},mergePlugins:function(){if(void 0!==this.serverPlugins.plugins&&void 0!==this.configPlugins.plugins){var t=[],e=[],i=this.configPlugins,n=!1;i.plugins&&i.plugins.length>0&&(e=i.plugins);var o=i.config.autostart||i.config.autoStartGuid;"string"==typeof o&&(o=[o]),n=!!i.config.autoStartGuid,t=o||[],i=this.serverPlugins,i.plugins&&i.plugins.length>0&&(e=e.concat(i.plugins)),o=i.config.autostart||i.config.autoStartGuid,"string"==typeof o&&(o=[o]),(n||i.config.autoStartGuid)&&console.warn("Obsolete: The autoStartGuid parameter is deprecated. Please check the documentation for new plugin connection configuration."),t=t.concat(o||[]),this.autostart=t,this.parsePlugins(e,!1)}},getAppCustomPlugins:function(t){var e=this,i=function(){e.customPluginsComplete=!0};t.config?this.getPlugins(t.config.UIpluginsData).then(function(n){e.parsePlugins(n,!0),e.getPlugins(t.UIplugins,function(t){return fetch(t.url).then(function(t){return t.ok?t.text():Promise.reject()}).then(function(e){return t.code=e,e})}).then(i,i)},i):i()}},Common.Controllers.Plugins||{}))}),define("common/main/lib/view/ExternalDiagramEditor",["common/main/lib/component/Window"],function(){"use strict";Common.Views.ExternalDiagramEditor=Common.UI.Window.extend(_.extend({initialize:function(t){var e={},i=Common.Utils.innerHeight()-Common.Utils.InternalSettings.get("window-inactive-area-top");_.extend(e,{title:this.textTitle,width:910,height:i-700<0?i:700,cls:"advanced-settings-dlg",header:!0,toolclose:"hide",toolcallback:_.bind(this.onToolClose,this)},t),this.template=['
    ','
    ',"
    ",'
    ','"].join(""),e.tpl=_.template(this.template)(e),this.handler=e.handler,this._chartData=null,this._isNewChart=!0,Common.UI.Window.prototype.initialize.call(this,e)},render:function(){Common.UI.Window.prototype.render.call(this),this.btnSave=new Common.UI.Button({el:$("#id-btn-diagram-editor-apply"),disabled:!0}),this.btnCancel=new Common.UI.Button({el:$("#id-btn-diagram-editor-cancel")}),this.$window.find(".dlg-btn").on("click",_.bind(this.onDlgBtnClick,this))},show:function(){this.setPlaceholder(),Common.UI.Window.prototype.show.apply(this,arguments)},setChartData:function(t){this._chartData=t,this._isExternalDocReady&&this.fireEvent("setchartdata",this)},setEditMode:function(t){this._isNewChart=!t},isEditMode:function(){return!this._isNewChart},setControlsDisabled:function(t){this.btnSave.setDisabled(t),this.btnCancel.setDisabled(t),t?this.$window.find(".tool.close").addClass("disabled"):this.$window.find(".tool.close").removeClass("disabled")},onDlgBtnClick:function(t){if(this.handler)return void this.handler.call(this,t.currentTarget.attributes.result.value);this.hide()},onToolClose:function(){if(this.handler)return void this.handler.call(this,"cancel");this.hide()},setHeight:function(t){if(t>=0){var e=parseInt(this.$window.css("min-height"));t .header").css("height")):0;this.$window.find("> .body").css("height",t-i),this.$window.find("> .body > .box").css("height",t-85);var n=(Common.Utils.innerHeight()-Common.Utils.InternalSettings.get("window-inactive-area-top")-parseInt(t))/2,o=(Common.Utils.innerWidth()-parseInt(this.initConfig.width))/2;this.$window.css("left",o),this.$window.css("top",Common.Utils.InternalSettings.get("window-inactive-area-top")+n)}},setPlaceholder:function(t){this._placeholder=t},getPlaceholder:function(){return this._placeholder},textSave:"Save & Exit",textClose:"Close",textTitle:"Chart Editor"},Common.Views.ExternalDiagramEditor||{}))}),void 0===Common)var Common={};if(Common.Controllers=Common.Controllers||{},define("common/main/lib/controller/ExternalDiagramEditor",["core","common/main/lib/view/ExternalDiagramEditor"],function(){"use strict";Common.Controllers.ExternalDiagramEditor=Backbone.Controller.extend(_.extend(function(){var t="en",e=void 0,i="",n=null,o=!0,s=function(){n=new DocsAPI.DocEditor("id-diagram-editor-placeholder",{width:"100%",height:"100%",documentType:"cell",document:{url:"_chart_",permissions:{edit:!0,download:!1}},editorConfig:{mode:"editdiagram",targetApp:i,lang:t,canCoAuthoring:!1,canBackToFolder:!1,canCreateNew:!1,customization:e,user:{id:"uid-"+Date.now()}},events:{onAppReady:function(){},onDocumentStateChange:function(){},onError:function(){},onInternalMessage:_.bind(this.onInternalMessage,this)}}),Common.Gateway.on("processmouse",_.bind(this.onProcessMouse,this))};return{views:["Common.Views.ExternalDiagramEditor"],initialize:function(){this.addListeners({"Common.Views.ExternalDiagramEditor":{setchartdata:_.bind(this.setChartData,this),drag:_.bind(function(t,e){n&&n.serviceCommand("window:drag","start"==e)},this),show:_.bind(function(t){var e=this.diagramEditorView.getHeight(),i=Common.Utils.innerHeight()-Common.Utils.InternalSettings.get("window-inactive-area-top");(i>e&&e<700||i
    <%= caption %>
    <% if (options.description !== null) { %><% } %>');this.btnReviewView=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-ic-reviewview",caption:this.txtView,menu:new Common.UI.Menu({cls:"ppm-toolbar",items:[{caption:this.txtMarkupCap,checkable:!0,toggleGroup:"menuReviewView",checked:!0,value:"markup",template:e,description:this.txtMarkup},{caption:this.txtFinalCap,checkable:!0,toggleGroup:"menuReviewView",checked:!1,template:e,description:this.txtFinal,value:"final"},{caption:this.txtOriginalCap,checkable:!0,toggleGroup:"menuReviewView",checked:!1,template:e,description:this.txtOriginal,value:"original"}]})})}(this.appConfig.sharingSettingsUrl&&this.appConfig.sharingSettingsUrl.length||this.appConfig.canRequestSharingSettings)&&!0!==this._readonlyRights&&(this.btnSharing=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-ic-sharing",caption:this.txtSharing})),this.appConfig.isEdit&&!this.appConfig.isOffline&&this.appConfig.canCoAuthoring&&(this.btnCoAuthMode=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-ic-coedit",caption:this.txtCoAuthMode,menu:!0})),this.btnsSpelling=[],this.btnsDocLang=[], -this.appConfig.canUseHistory&&!this.appConfig.isDisconnected&&(this.btnHistory=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-ic-history",caption:this.txtHistory})),this.appConfig.canCoAuthoring&&this.appConfig.canChat&&(this.btnChat=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-ic-chat",caption:this.txtChat,enableToggle:!0})),this.appConfig.canCoAuthoring&&this.appConfig.canComments&&(this.btnCommentRemove=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",caption:this.txtCommentRemove,split:!0,iconCls:"toolbar__icon btn-rem-comment"}));var i=Common.localStorage.getKeysFilter();this.appPrefix=i&&i.length?i.split(",")[0]:"",Common.NotificationCenter.on("app:ready",this.onAppReady.bind(this))},render:function(t){return this.boxSdk=$("#editor_sdk"),t&&t.html(this.getPanel()),this},onAppReady:function(t){var i=this;new Promise(function(t,e){t()}).then(function(){var n=_.template('
    <%= caption %>
    <% if (options.description !== null) { %><% } %>
    ');if(t.canReview&&(i.btnTurnOn.updateHint(i.tipReview),i.appConfig.canUseReviewPermissions||(i.btnAccept.setMenu(new Common.UI.Menu({items:[{caption:i.txtAcceptCurrent,value:"current"},{caption:i.txtAcceptAll,value:"all"}]})),i.btnReject.setMenu(new Common.UI.Menu({items:[{caption:i.txtRejectCurrent,value:"current"},{caption:i.txtRejectAll,value:"all"}]}))),i.btnAccept.updateHint([i.tipAcceptCurrent,i.txtAcceptChanges]),i.btnReject.updateHint([i.tipRejectCurrent,i.txtRejectChanges]),t.canFeatureComparison&&(i.btnCompare.setMenu(new Common.UI.Menu({items:[{caption:i.mniFromFile,value:"file"},{caption:i.mniFromUrl,value:"url"},{caption:i.mniFromStorage,value:"storage"}]})),i.btnCompare.menu.items[2].setVisible(i.appConfig.canRequestCompareFile||i.appConfig.fileChoiceUrl&&i.appConfig.fileChoiceUrl.indexOf("{documentType}")>-1),i.btnCompare.updateHint(i.tipCompare)),i.btnAccept.setDisabled(t.isReviewOnly),i.btnReject.setDisabled(t.isReviewOnly)),i.appConfig.canViewReview&&(i.btnPrev.updateHint(i.hintPrev),i.btnNext.updateHint(i.hintNext),i.btnReviewView&&i.btnReviewView.updateHint(i.tipReviewView)),i.btnSharing&&i.btnSharing.updateHint(i.tipSharing),i.btnHistory&&i.btnHistory.updateHint(i.tipHistory),i.btnChat&&i.btnChat.updateHint(i.txtChat+Common.Utils.String.platformKey("Alt+Q")),i.btnCoAuthMode){i.btnCoAuthMode.setMenu(new Common.UI.Menu({cls:"ppm-toolbar",style:"max-width: 220px;",items:[{caption:i.strFast,checkable:!0,toggleGroup:"menuCoauthMode",checked:!0,template:n,description:i.strFastDesc,value:1},{caption:i.strStrict,checkable:!0,toggleGroup:"menuCoauthMode",checked:!1,template:n,description:i.strStrictDesc,value:0}]})),i.btnCoAuthMode.updateHint(i.tipCoAuthMode);var o=Common.localStorage.getItem(i.appPrefix+"settings-coauthmode");null===o&&!Common.localStorage.itemExists(i.appPrefix+"settings-autosave")&&t.customization&&!1===t.customization.autosave&&(o=0),i.turnCoAuthMode((null===o||1==parseInt(o))&&!(t.isDesktopApp&&t.isOffline)&&t.canCoAuthoring)}if(i.btnCommentRemove){var s=[{caption:t.canEditComments?i.txtCommentRemCurrent:i.txtCommentRemMyCurrent,value:"current"},{caption:i.txtCommentRemMy,value:"my"}];t.canEditComments&&s.push({caption:i.txtCommentRemAll,value:"all"}),i.btnCommentRemove.setMenu(new Common.UI.Menu({items:s})),i.btnCommentRemove.updateHint([i.tipCommentRemCurrent,i.tipCommentRem])}var a,l=i.btnSharing||i.btnCoAuthMode?".separator.sharing":i.$el.find(".separator.sharing"),r=t.canComments&&t.canCoAuthoring?".separator.comments":i.$el.find(".separator.comments"),c=t.canReview||t.canViewReview?".separator.review":i.$el.find(".separator.review"),d=t.canReview&&t.canFeatureComparison?".separator.compare":i.$el.find(".separator.compare"),h=i.btnChat?".separator.chat":i.$el.find(".separator.chat");"object"==typeof l?l.hide().prev(".group").hide():a=l,"object"==typeof r?r.hide().prev(".group").hide():a=r,"object"==typeof c?c.hide().prevUntil(".separator.comments").hide():a=c,"object"==typeof d?d.hide().prev(".group").hide():a=d,"object"==typeof h?h.hide().prev(".group").hide():a=h,!i.btnHistory&&a&&i.$el.find(a).hide(),Common.NotificationCenter.trigger("tab:visible","review",t.isEdit||t.canViewReview||t.canCoAuthoring&&t.canComments),e.call(i)})},getPanel:function(){return this.$el=$(_.template('
    ')({})),this.appConfig.canReview&&(this.btnAccept.render(this.$el.find("#btn-change-accept")),this.btnReject.render(this.$el.find("#btn-change-reject")),this.appConfig.canFeatureComparison&&this.btnCompare.render(this.$el.find("#btn-compare")),this.btnTurnOn.render(this.$el.find("#btn-review-on"))),this.btnPrev&&this.btnPrev.render(this.$el.find("#btn-change-prev")),this.btnNext&&this.btnNext.render(this.$el.find("#btn-change-next")),this.btnReviewView&&this.btnReviewView.render(this.$el.find("#btn-review-view")),this.btnSharing&&this.btnSharing.render(this.$el.find("#slot-btn-sharing")),this.btnCoAuthMode&&this.btnCoAuthMode.render(this.$el.find("#slot-btn-coauthmode")),this.btnHistory&&this.btnHistory.render(this.$el.find("#slot-btn-history")),this.btnChat&&this.btnChat.render(this.$el.find("#slot-btn-chat")),this.btnCommentRemove&&this.btnCommentRemove.render(this.$el.find("#slot-comment-remove")),this.$el},show:function(){Common.UI.BaseView.prototype.show.call(this),this.fireEvent("show",this)},getButton:function(t,e){if("turn"==t&&"statusbar"==e){var i=new Common.UI.Button({cls:"btn-toolbar",iconCls:"toolbar__icon btn-ic-review",hintAnchor:"top",hint:this.tipReview,enableToggle:!0});return this.btnsTurnReview.push(i),i}return"spelling"==t?(i=new Common.UI.Button({cls:"btn-toolbar",iconCls:"toolbar__icon btn-ic-docspell",hintAnchor:"top",hint:this.tipSetSpelling,enableToggle:!0}),this.btnsSpelling.push(i),i):"doclang"==t&&"statusbar"==e?(i=new Common.UI.Button({cls:"btn-toolbar",iconCls:"toolbar__icon btn-ic-doclang",hintAnchor:"top",hint:this.tipSetDocLang,disabled:!0}),this.btnsDocLang.push(i),i):void 0},getUserName:function(t){return Common.Utils.String.htmlEncode(Common.Utils.UserInfoParser.getParsedName(t))},turnChanges:function(t){this.btnsTurnReview.forEach(function(e){e&&e.pressed!=t&&e.toggle(t,!0)},this)},markChanges:function(t){this.btnsTurnReview.forEach(function(e){if(e){$(".icon",e.cmpEl)[t?"addClass":"removeClass"]("btn-ic-changes")}},this)},turnSpelling:function(t){this.btnsSpelling.forEach(function(e){e&&e.pressed!=t&&e.toggle(t,!0)},this)},turnCoAuthMode:function(t){this.btnCoAuthMode&&(this.btnCoAuthMode.menu.items[0].setChecked(t,!0),this.btnCoAuthMode.menu.items[1].setChecked(!t,!0))},turnChat:function(t){this.btnChat&&this.btnChat.toggle(t,!0)},turnDisplayMode:function(t){this.btnReviewView&&(this.btnReviewView.menu.items[0].setChecked("markup"==t,!0),this.btnReviewView.menu.items[1].setChecked("final"==t,!0),this.btnReviewView.menu.items[2].setChecked("original"==t,!0))},SetDisabled:function(t,e){this.btnsSpelling&&this.btnsSpelling.forEach(function(e){e&&e.setDisabled(t)},this),this.btnsDocLang&&this.btnsDocLang.forEach(function(i){i&&i.setDisabled(t||e&&e.length<1)},this),this.btnsTurnReview&&this.btnsTurnReview.forEach(function(e){e&&e.setDisabled(t)},this),this.btnCommentRemove&&this.btnCommentRemove.setDisabled(t||!Common.Utils.InternalSettings.get(this.appPrefix+"settings-livecomment"))},onLostEditRights:function(){this._readonlyRights=!0,this.rendered&&this.btnSharing&&this.btnSharing.setDisabled(!0)},txtAccept:"Accept",txtAcceptCurrent:"Accept current Changes",txtAcceptAll:"Accept all Changes",txtReject:"Reject",txtRejectCurrent:"Reject current Changes",txtRejectAll:"Reject all Changes",hintNext:"To Next Change",hintPrev:"To Previous Change",txtPrev:"Previous",txtNext:"Next",txtTurnon:"Turn On",txtSpelling:"Spell checking",txtDocLang:"Language",tipSetDocLang:"Set Document Language",tipSetSpelling:"Spell checking",tipReview:"Review",txtAcceptChanges:"Accept Changes",txtRejectChanges:"Reject Changes",txtView:"Display Mode",txtMarkup:"Text with changes (Editing)",txtFinal:"All changes like accept (Preview)",txtOriginal:"Text without changes (Preview)",tipReviewView:"Select the way you want the changes to be displayed",tipAcceptCurrent:"Accept current changes",tipRejectCurrent:"Reject current changes",txtSharing:"Sharing",tipSharing:"Manage document access rights",txtCoAuthMode:"Co-editing Mode",tipCoAuthMode:"Set co-editing mode",strFast:"Fast",strStrict:"Strict",txtHistory:"Version History",tipHistory:"Show version history",txtChat:"Chat",txtMarkupCap:"Markup",txtFinalCap:"Final",txtOriginalCap:"Original",strFastDesc:"Real-time co-editing. All changes are saved automatically.",strStrictDesc:"Use the 'Save' button to sync the changes you and others make.",txtCompare:"Compare",tipCompare:"Compare current document with another one",mniFromFile:"Document from File",mniFromUrl:"Document from URL",mniFromStorage:"Document from Storage",mniSettings:"Comparison Settings",txtCommentRemove:"Remove",tipCommentRemCurrent:"Remove current comments",tipCommentRem:"Remove comments",txtCommentRemCurrent:"Remove Current Comments",txtCommentRemMyCurrent:"Remove My Current Comments",txtCommentRemMy:"Remove My Comments",txtCommentRemAll:"Remove All Comments"}}(),Common.Views.ReviewChanges||{})),Common.Views.ReviewChangesDialog=Common.UI.Window.extend(_.extend({options:{width:330,height:90,title:"Review Changes",modal:!1,cls:"review-changes modal-dlg",alias:"Common.Views.ReviewChangesDialog"},initialize:function(t){_.extend(this.options,{title:this.textTitle},t||{}),this.template=['
    ','
    ','
    ','
    ','
    ','
    ',"
    ","
    "].join(""),this.options.tpl=_.template(this.template)(this.options),this.popoverChanges=this.options.popoverChanges,this.mode=this.options.mode,Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this),this.btnPrev=new Common.UI.Button({cls:"dlg-btn iconic",iconCls:"img-commonctrl prev",hint:this.txtPrev,hintAnchor:"top"}),this.btnPrev.render(this.$window.find("#id-review-button-prev")),this.btnNext=new Common.UI.Button({cls:" dlg-btn iconic",iconCls:"img-commonctrl next",hint:this.txtNext,hintAnchor:"top"}),this.btnNext.render(this.$window.find("#id-review-button-next")),this.btnAccept=new Common.UI.Button({cls:"btn-toolbar",caption:this.txtAccept,split:!0,disabled:this.mode.isReviewOnly,menu:!this.mode.canUseReviewPermissions&&new Common.UI.Menu({items:[this.mnuAcceptCurrent=new Common.UI.MenuItem({caption:this.txtAcceptCurrent,value:"current"}),this.mnuAcceptAll=new Common.UI.MenuItem({caption:this.txtAcceptAll,value:"all"})]})}),this.btnAccept.render(this.$window.find("#id-review-button-accept")),this.btnReject=new Common.UI.Button({cls:"btn-toolbar",caption:this.txtReject,split:!0,disabled:this.mode.isReviewOnly,menu:!this.mode.canUseReviewPermissions&&new Common.UI.Menu({items:[this.mnuRejectCurrent=new Common.UI.MenuItem({caption:this.txtRejectCurrent,value:"current"}),this.mnuRejectAll=new Common.UI.MenuItem({caption:this.txtRejectAll,value:"all"})]})}),this.btnReject.render(this.$window.find("#id-review-button-reject"));var t=this;return this.btnPrev.on("click",function(e){t.fireEvent("reviewchange:preview",[t.btnPrev,"prev"])}),this.btnNext.on("click",function(e){t.fireEvent("reviewchange:preview",[t.btnNext,"next"])}),this.btnAccept.on("click",function(e){t.fireEvent("reviewchange:accept",[t.btnAccept,"current"])}),this.btnAccept.menu&&this.btnAccept.menu.on("item:click",function(e,i,n){t.fireEvent("reviewchange:accept",[e,i])}),this.btnReject.on("click",function(e){t.fireEvent("reviewchange:reject",[t.btnReject,"current"])}),this.btnReject.menu&&this.btnReject.menu.on("item:click",function(e,i,n){t.fireEvent("reviewchange:reject",[e,i])}),this},textTitle:"Review Changes",txtPrev:"To previous change",txtNext:"To next change",txtAccept:"Accept",txtAcceptCurrent:"Accept Current Change",txtAcceptAll:"Accept All Changes",txtReject:"Reject",txtRejectCurrent:"Reject Current Change",txtRejectAll:"Reject All Changes"},Common.Views.ReviewChangesDialog||{}))}),define("common/main/lib/view/OptionsDialog",["common/main/lib/component/Window","common/main/lib/component/RadioBox"],function(){"use strict";Common.Views.OptionsDialog=Common.UI.Window.extend(_.extend({options:{width:214,header:!0,style:"min-width: 214px;",cls:"modal-dlg",items:[],buttons:["ok","cancel"]},initialize:function(t){_.extend(this.options,t||{}),this.template=['
    ','<% if (typeof label !== "undefined" && label !=="") { %>','',"<% } %>","<% _.each(items, function(item, index) { %>","<% if (!item.id) item.id = Common.UI.getId(); %>",'
    ',"<% }) %>","
    "].join(""),this.options.tpl=_.template(this.template)(this.options),this.radio=[],Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this);var t=this,e=t.getChild(),i=this.options.items,n=!0,o=-1;if(i){for(var s=0;s=0&&this.radio[o].setValue(!0)}e.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this))},_handleInput:function(t){this.options.handler&&this.options.handler.call(this,this,t),this.close()},onBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value)},getSettings:function(){return this.currentCell},onPrimary:function(){return this._handleInput("ok"),!1}},Common.Views.OptionsDialog||{}))}),void 0===Common)var Common={};if(Common.Controllers=Common.Controllers||{},define("common/main/lib/controller/ReviewChanges",["core","common/main/lib/model/ReviewChange","common/main/lib/collection/ReviewChanges","common/main/lib/view/ReviewChanges","common/main/lib/view/ReviewPopover","common/main/lib/view/LanguageDialog","common/main/lib/view/OptionsDialog"],function(){"use strict";Common.Controllers.ReviewChanges=Backbone.Controller.extend(_.extend({models:[],collections:["Common.Collections.ReviewChanges"],views:["Common.Views.ReviewChanges","Common.Views.ReviewPopover"],sdkViewName:"#id_main",initialize:function(){this.addListeners({FileMenu:{"settings:apply":this.applySettings.bind(this)},LeftMenu:{"comments:show":_.bind(this.commentsShowHide,this,"show"),"comments:hide":_.bind(this.commentsShowHide,this,"hide")},"Common.Views.ReviewChanges":{"reviewchange:accept":_.bind(this.onAcceptClick,this),"reviewchange:reject":_.bind(this.onRejectClick,this),"reviewchange:delete":_.bind(this.onDeleteClick,this),"reviewchange:preview":_.bind(this.onBtnPreviewClick,this),"reviewchange:view":_.bind(this.onReviewViewClick,this),"reviewchange:compare":_.bind(this.onCompareClick,this),"lang:document":_.bind(this.onDocLanguage,this),"collaboration:coauthmode":_.bind(this.onCoAuthMode,this)},"Common.Views.ReviewChangesDialog":{"reviewchange:accept":_.bind(this.onAcceptClick,this),"reviewchange:reject":_.bind(this.onRejectClick,this),"reviewchange:preview":_.bind(this.onBtnPreviewClick,this)},"Common.Views.ReviewPopover":{"reviewchange:accept":_.bind(this.onAcceptClick,this),"reviewchange:reject":_.bind(this.onRejectClick,this),"reviewchange:delete":_.bind(this.onDeleteClick,this),"reviewchange:goto":_.bind(this.onGotoClick,this)}})},onLaunch:function(){this.collection=this.getApplication().getCollection("Common.Collections.ReviewChanges"),this.userCollection=this.getApplication().getCollection("Common.Collections.Users"),this._state={posx:-1e3,posy:-1e3,popoverVisible:!1,previewMode:!1,compareSettings:null},Common.NotificationCenter.on("reviewchanges:turn",this.onTurnPreview.bind(this)),Common.NotificationCenter.on("spelling:turn",this.onTurnSpelling.bind(this)),Common.NotificationCenter.on("app:ready",this.onAppReady.bind(this)),Common.NotificationCenter.on("api:disconnect",_.bind(this.onCoAuthoringDisconnect,this)),Common.NotificationCenter.on("collaboration:sharing",this.changeAccessRights.bind(this)),Common.NotificationCenter.on("collaboration:sharingdeny",this.onLostEditRights.bind(this)),this.userCollection.on("reset",_.bind(this.onUpdateUsers,this)),this.userCollection.on("add",_.bind(this.onUpdateUsers,this))},setConfig:function(t,e){if(this.setApi(e),t){if(this.currentUserId=t.config.user.id,this.appConfig&&this.appConfig.canUseReviewPermissions){var i=this.appConfig.customization.reviewPermissions,n=[],o=Common.Utils.UserInfoParser.getParsedGroups(t.config.user.fullname);o&&o.forEach(function(t){var e=i[t.trim()];e&&(n=n.concat(e))}),this.currentUserGroups=n}this.sdkViewName=t.sdkviewname||this.sdkViewName}return this},setApi:function(t){t&&(this.api=t,(this.appConfig.canReview||this.appConfig.canViewReview)&&(this.api.asc_registerCallback("asc_onShowRevisionsChange",_.bind(this.onApiShowChange,this)),this.api.asc_registerCallback("asc_onUpdateRevisionsChangesPosition",_.bind(this.onApiUpdateChangePosition,this)),this.api.asc_registerCallback("asc_onAuthParticipantsChanged",_.bind(this.onAuthParticipantsChanged,this)),this.api.asc_registerCallback("asc_onParticipantsChanged",_.bind(this.onAuthParticipantsChanged,this))),this.api.asc_registerCallback("asc_onAcceptChangesBeforeCompare",_.bind(this.onAcceptChangesBeforeCompare,this)),this.api.asc_registerCallback("asc_onCoAuthoringDisconnect",_.bind(this.onCoAuthoringDisconnect,this)),Common.Gateway.on("setrevisedfile",_.bind(this.setRevisedFile,this)))},setMode:function(t){return this.appConfig=t,this.popoverChanges=new Common.Collections.ReviewChanges,this.view=this.createView("Common.Views.ReviewChanges",{mode:t}),(this.appConfig.sharingSettingsUrl&&this.appConfig.sharingSettingsUrl.length||this.appConfig.canRequestSharingSettings)&&(Common.Gateway.on("showsharingsettings",_.bind(this.changeAccessRights,this)),Common.Gateway.on("setsharingsettings",_.bind(this.setSharingSettings,this))),this},loadDocument:function(t){this.document=t.doc},SetDisabled:function(t){this.dlgChanges&&this.dlgChanges.close(),this.view&&this.view.SetDisabled(t,this.langs),this.setPreviewMode(t)},setPreviewMode:function(t){if(this.viewmode!==t){this.viewmode=t,t&&(this.prevcanReview=this.appConfig.canReview),this.appConfig.canReview=!t&&this.prevcanReview;var e=this;this.popoverChanges&&this.popoverChanges.each(function(t){t.set("hint",!e.appConfig.canReview)})}},onApiShowChange:function(t){if(this.getPopover())if(t&&t.length>0){var e=this.readSDKChange(t),i=t[0].get_X(),n=t[0].get_Y(),o=Math.abs(this._state.posx-i)>.001||Math.abs(this._state.posy-n)>.001||t.length!==this._state.changes_length,s=null!==t[0].get_LockUserId(),a=this.getUserName(t[0].get_LockUserId()),l=e[0].get("editable");this.getPopover().hideTips(),this.popoverChanges.reset(e),o&&(this.getPopover().isVisible()&&this.getPopover().hide(),this.getPopover().setLeftTop(i,n)),this.getPopover().showReview(o,s,a);var r=s||!l;this.appConfig.canReview&&!this.appConfig.isReviewOnly&&this._state.lock!==r&&(this.view.btnAccept.setDisabled(r),this.view.btnReject.setDisabled(r),this.dlgChanges&&(this.dlgChanges.btnAccept.setDisabled(r),this.dlgChanges.btnReject.setDisabled(r)),this._state.lock=r),this._state.posx=i,this._state.posy=n,this._state.changes_length=t.length,this._state.popoverVisible=!0}else this._state.popoverVisible&&(this._state.posx=this._state.posy=-1e3,this._state.changes_length=0,this._state.popoverVisible=!1,this.getPopover().hideTips(),this.popoverChanges.reset(),this.getPopover().hideReview())},onApiUpdateChangePosition:function(t,e){this.getPopover()&&(e<0||this.getPopover().sdkBounds.height0&&(this.getPopover().isVisible()||this.getPopover().show(!1),this.getPopover().setLeftTop(t,e)))},findChange:function(t,e){return _.isUndefined(t)?this.collection.findWhere({id:e}):this.collection.findWhere({uid:t})},getPopover:function(){return(this.appConfig.canReview||this.appConfig.canViewReview)&&_.isUndefined(this.popover)&&(this.popover=Common.Views.ReviewPopover.prototype.getPopover({reviewStore:this.popoverChanges,renderTo:this.sdkViewName}),this.popover.setReviewStore(this.popoverChanges)),this.popover},readSDKChange:function(t){var e=this,i=[];return _.each(t,function(t){var n="",o="",s=t.get_Value(),a=t.get_MoveType();switch(t.get_Type()){case Asc.c_oAscRevisionsChangeType.TextAdd:n=a==Asc.c_oAscRevisionsMove.NoMove?e.textInserted:e.textParaMoveTo,"object"==typeof s?_.each(s,function(t){if("string"==typeof t)n+=" "+Common.Utils.String.htmlEncode(t);else switch(t){case 0:n+=" <"+e.textImage+">";break;case 1:n+=" <"+e.textShape+">";break;case 2:n+=" <"+e.textChart+">";break;case 3:n+=" <"+e.textEquation+">"}}):"string"==typeof s&&(n+=" "+Common.Utils.String.htmlEncode(s));break;case Asc.c_oAscRevisionsChangeType.TextRem:n=a==Asc.c_oAscRevisionsMove.NoMove?e.textDeleted:t.is_MovedDown()?e.textParaMoveFromDown:e.textParaMoveFromUp,"object"==typeof s?_.each(s,function(t){if("string"==typeof t)n+=" "+Common.Utils.String.htmlEncode(t);else switch(t){case 0:n+=" <"+e.textImage+">";break;case 1:n+=" <"+e.textShape+">";break;case 2:n+=" <"+e.textChart+">";break;case 3:n+=" <"+e.textEquation+">"}}):"string"==typeof s&&(n+=" "+Common.Utils.String.htmlEncode(s));break;case Asc.c_oAscRevisionsChangeType.ParaAdd:n=e.textParaInserted;break;case Asc.c_oAscRevisionsChangeType.ParaRem:n=e.textParaDeleted;break;case Asc.c_oAscRevisionsChangeType.TextPr:n=""+e.textFormatted,void 0!==s.Get_Bold()&&(o+=(s.Get_Bold()?"":e.textNot)+e.textBold+", "),void 0!==s.Get_Italic()&&(o+=(s.Get_Italic()?"":e.textNot)+e.textItalic+", "),void 0!==s.Get_Underline()&&(o+=(s.Get_Underline()?"":e.textNot)+e.textUnderline+", "),void 0!==s.Get_Strikeout()&&(o+=(s.Get_Strikeout()?"":e.textNot)+e.textStrikeout+", "),void 0!==s.Get_DStrikeout()&&(o+=(s.Get_DStrikeout()?"":e.textNot)+e.textDStrikeout+", "),void 0!==s.Get_Caps()&&(o+=(s.Get_Caps()?"":e.textNot)+e.textCaps+", "),void 0!==s.Get_SmallCaps()&&(o+=(s.Get_SmallCaps()?"":e.textNot)+e.textSmallCaps+", "),void 0!==s.Get_VertAlign()&&(o+=(1==s.Get_VertAlign()?e.textSuperScript:2==s.Get_VertAlign()?e.textSubScript:e.textBaseline)+", "),void 0!==s.Get_Color()&&(o+=e.textColor+", "),void 0!==s.Get_Highlight()&&(o+=e.textHighlight+", "),void 0!==s.Get_Shd()&&(o+=e.textShd+", "),void 0!==s.Get_FontFamily()&&(o+=s.Get_FontFamily()+", "),void 0!==s.Get_FontSize()&&(o+=s.Get_FontSize()+", "),void 0!==s.Get_Spacing()&&(o+=e.textSpacing+" "+Common.Utils.Metric.fnRecalcFromMM(s.Get_Spacing()).toFixed(2)+" "+Common.Utils.Metric.getCurrentMetricName()+", "),void 0!==s.Get_Position()&&(o+=e.textPosition+" "+Common.Utils.Metric.fnRecalcFromMM(s.Get_Position()).toFixed(2)+" "+Common.Utils.Metric.getCurrentMetricName()+", "),void 0!==s.Get_Lang()&&(o+=Common.util.LanguageInfo.getLocalLanguageName(s.Get_Lang())[1]+", "),_.isEmpty(o)||(n+=": ",o=o.substring(0,o.length-2)),n+="",n+=o;break;case Asc.c_oAscRevisionsChangeType.ParaPr:if(n=""+e.textParaFormatted,s.Get_ContextualSpacing()&&(o+=(s.Get_ContextualSpacing()?e.textContextual:e.textNoContextual)+", "),void 0!==s.Get_IndLeft()&&(o+=e.textIndentLeft+" "+Common.Utils.Metric.fnRecalcFromMM(s.Get_IndLeft()).toFixed(2)+" "+Common.Utils.Metric.getCurrentMetricName()+", "),void 0!==s.Get_IndRight()&&(o+=e.textIndentRight+" "+Common.Utils.Metric.fnRecalcFromMM(s.Get_IndRight()).toFixed(2)+" "+Common.Utils.Metric.getCurrentMetricName()+", "),void 0!==s.Get_IndFirstLine()&&(o+=e.textFirstLine+" "+Common.Utils.Metric.fnRecalcFromMM(s.Get_IndFirstLine()).toFixed(2)+" "+Common.Utils.Metric.getCurrentMetricName()+", "),void 0!==s.Get_Jc())switch(s.Get_Jc()){case 0:o+=e.textRight+", ";break;case 1:o+=e.textLeft+", ";break;case 2:o+=e.textCenter+", ";break;case 3:o+=e.textJustify+", "}if(void 0!==s.Get_KeepLines()&&(o+=(s.Get_KeepLines()?e.textKeepLines:e.textNoKeepLines)+", "),s.Get_KeepNext()&&(o+=(s.Get_KeepNext()?e.textKeepNext:e.textNoKeepNext)+", "),s.Get_PageBreakBefore()&&(o+=(s.Get_PageBreakBefore()?e.textBreakBefore:e.textNoBreakBefore)+", "),void 0!==s.Get_SpacingLineRule()&&void 0!==s.Get_SpacingLine()&&(o+=e.textLineSpacing,o+=(s.Get_SpacingLineRule()==c_paragraphLinerule.LINERULE_LEAST?e.textAtLeast:s.Get_SpacingLineRule()==c_paragraphLinerule.LINERULE_AUTO?e.textMultiple:e.textExact)+" ",o+=(s.Get_SpacingLineRule()==c_paragraphLinerule.LINERULE_AUTO?s.Get_SpacingLine():Common.Utils.Metric.fnRecalcFromMM(s.Get_SpacingLine()).toFixed(2)+" "+Common.Utils.Metric.getCurrentMetricName())+", "),s.Get_SpacingBeforeAutoSpacing()?o+=e.textSpacingBefore+" "+e.textAuto+", ":void 0!==s.Get_SpacingBefore()&&(o+=e.textSpacingBefore+" "+Common.Utils.Metric.fnRecalcFromMM(s.Get_SpacingBefore()).toFixed(2)+" "+Common.Utils.Metric.getCurrentMetricName()+", "),s.Get_SpacingAfterAutoSpacing()?o+=e.textSpacingAfter+" "+e.textAuto+", ":void 0!==s.Get_SpacingAfter()&&(o+=e.textSpacingAfter+" "+Common.Utils.Metric.fnRecalcFromMM(s.Get_SpacingAfter()).toFixed(2)+" "+Common.Utils.Metric.getCurrentMetricName()+", "),s.Get_WidowControl()&&(o+=(s.Get_WidowControl()?e.textWidow:e.textNoWidow)+", "),void 0!==s.Get_Tabs()&&(o+=e.textTabs+", "),void 0!==s.Get_NumPr()&&(o+=e.textNum+", "),void 0!==s.Get_PStyle()){var l=e.api.asc_GetStyleNameById(s.Get_PStyle());_.isEmpty(l)||(o+=l+", ")}_.isEmpty(o)||(n+=": ",o=o.substring(0,o.length-2)),n+="",n+=o;break;case Asc.c_oAscRevisionsChangeType.TablePr:n=e.textTableChanged;break;case Asc.c_oAscRevisionsChangeType.RowsAdd:n=e.textTableRowsAdd;break;case Asc.c_oAscRevisionsChangeType.RowsRem:n=e.textTableRowsDel}var r=""==t.get_DateTime()?new Date:new Date(t.get_DateTime()),c=e.userCollection.findOriginalUser(t.get_UserId()),d=new Common.Models.ReviewChange({uid:Common.UI.getId(),userid:t.get_UserId(),username:t.get_UserName(),usercolor:c?c.get("color"):null,date:e.dateToLocaleTimeString(r),changetext:n,id:Common.UI.getId(),lock:null!==t.get_LockUserId(),lockuser:e.getUserName(t.get_LockUserId()),type:t.get_Type(),changedata:t,scope:e.view,hint:!e.appConfig.canReview,goto:t.get_MoveType()==Asc.c_oAscRevisionsMove.MoveTo||t.get_MoveType()==Asc.c_oAscRevisionsMove.MoveFrom,editable:e.appConfig.isReviewOnly&&t.get_UserId()==e.currentUserId||!e.appConfig.isReviewOnly&&(!e.appConfig.canUseReviewPermissions||e.checkUserGroups(t.get_UserName()))});i.push(d)}),i},checkUserGroups:function(t){var e=Common.Utils.UserInfoParser.getParsedGroups(t);return this.currentUserGroups&&e&&_.intersection(this.currentUserGroups,e.length>0?e:[""]).length>0},getUserName:function(t){if(this.userCollection&&null!==t){var e=this.userCollection.findUser(t);if(e)return Common.Utils.UserInfoParser.getParsedName(e.get("username"))}return""},dateToLocaleTimeString:function(t){return t.getMonth()+1+"/"+t.getDate()+"/"+t.getFullYear()+" "+function(t){var e=t.getHours(),i=t.getMinutes(),n=e>=12?"pm":"am";return e%=12,e=e||12,i=i<10?"0"+i:i,e+":"+i+" "+n}(t)},onBtnPreviewClick:function(t,e){switch(e){case"prev":this.api.asc_GetPrevRevisionsChange();break;case"next":this.api.asc_GetNextRevisionsChange()}Common.NotificationCenter.trigger("edit:complete",this.view)},onAcceptClick:function(t,e,i){this.api&&(e?"all"===e.value?this.api.asc_AcceptAllChanges():this.api.asc_AcceptChanges():this.api.asc_AcceptChanges(t)),Common.NotificationCenter.trigger("edit:complete",this.view)},onRejectClick:function(t,e,i){this.api&&(e?"all"===e.value?this.api.asc_RejectAllChanges():this.api.asc_RejectChanges():this.api.asc_RejectChanges(t)),Common.NotificationCenter.trigger("edit:complete",this.view)},onDeleteClick:function(t){this.api&&this.api.asc_RejectChanges(t),Common.NotificationCenter.trigger("edit:complete",this.view)},onGotoClick:function(t){this.api&&this.api.asc_FollowRevisionMove(t),Common.NotificationCenter.trigger("edit:complete",this.view)},onTurnPreview:function(t){this.appConfig.isReviewOnly?this.view.turnChanges(!0):this.appConfig.canReview&&(t="on"==t,Common.localStorage.setItem(this.view.appPrefix+"track-changes-"+(this.appConfig.fileKey||""),t?1:0),this.api.asc_SetTrackRevisions(t),this.view.turnChanges(t))},onTurnSpelling:function(t){t="on"==t,this.view.turnSpelling(t),Common.localStorage.setItem(this.view.appPrefix+"settings-spellcheck",t?1:0),this.api.asc_setSpellCheck(t),Common.Utils.InternalSettings.set(this.view.appPrefix+"settings-spellcheck",t)},onReviewViewClick:function(t,e,i){this.turnDisplayMode(e.value),!this.appConfig.canReview&&Common.localStorage.setItem(this.view.appPrefix+"review-mode",e.value),Common.NotificationCenter.trigger("edit:complete",this.view)},onCompareClick:function(t){if(this.api){var e=this;if(this._state.compareSettings||(this._state.compareSettings=new AscCommonWord.ComparisonOptions,this._state.compareSettings.putWords(!Common.localStorage.getBool("de-compare-char"))),"file"===t)this.api&&this.api.asc_CompareDocumentFile(this._state.compareSettings),Common.NotificationCenter.trigger("edit:complete",this.view);else if("url"===t)new Common.Views.ImageFromUrlDialog({title:e.textUrl,handler:function(t,i){if("ok"==t){if(e.api){var n=i.replace(/ /g,"");_.isEmpty(n)||e.api.asc_CompareDocumentUrl(n,e._state.compareSettings)}Common.NotificationCenter.trigger("edit:complete",e.view)}}}).show();else if("storage"===t)this.appConfig.canRequestCompareFile?Common.Gateway.requestCompareFile():new Common.Views.SelectFileDlg({fileChoiceUrl:this.appConfig.fileChoiceUrl.replace("{fileExt}","").replace("{documentType}","DocumentsOnly")}).on("selectfile",function(t,i){e.setRevisedFile(i,e._state.compareSettings)}).show();else if("settings"===t){var i=!e._state.compareSettings||e._state.compareSettings.getWords();new Common.Views.OptionsDialog({title:e.textTitleComparison,items:[{caption:e.textChar,value:!1,checked:!1===i},{caption:e.textWord,value:!0,checked:!1!==i}],label:e.textShow,handler:function(t,i){"ok"==i&&(e._state.compareSettings=new AscCommonWord.ComparisonOptions,e._state.compareSettings.putWords(t.getSettings())), -Common.NotificationCenter.trigger("edit:complete",e.toolbar)}}).show()}}Common.NotificationCenter.trigger("edit:complete",this.view)},setRevisedFile:function(t){this._state.compareSettings||(this._state.compareSettings=new AscCommonWord.ComparisonOptions,this._state.compareSettings.putWords(!Common.localStorage.getBool("de-compare-char"))),t&&t.url&&this.api.asc_CompareDocumentUrl(t.url,this._state.compareSettings,t.token)},onAcceptChangesBeforeCompare:function(t){Common.UI.warning({width:550,msg:this.textAcceptBeforeCompare,buttons:["yes","no"],primary:"yes",callback:function(e){_.defer(function(){t&&t("yes"==e)}),Common.NotificationCenter.trigger("edit:complete",this.view)}})},turnDisplayMode:function(t){this.api&&("final"===t?this.api.asc_BeginViewModeInReview(!0):"original"===t?this.api.asc_BeginViewModeInReview(!1):this.api.asc_EndViewModeInReview()),this.disableEditing("final"==t||"original"==t),this._state.previewMode="final"==t||"original"==t},isPreviewChangesMode:function(){return this._state.previewMode},onCoAuthMode:function(t,e,i){if(Common.localStorage.setItem(this.view.appPrefix+"settings-coauthmode",e.value),Common.Utils.InternalSettings.set(this.view.appPrefix+"settings-coauthmode",e.value),this.api){if(this.api.asc_SetFastCollaborative(1==e.value),this.api.SetCollaborativeMarksShowType){var n=Common.localStorage.getItem(e.value?this.view.appPrefix+"settings-showchanges-fast":this.view.appPrefix+"settings-showchanges-strict");null!==n?this.api.SetCollaborativeMarksShowType("all"==n?Asc.c_oAscCollaborativeMarksShowType.All:"none"==n?Asc.c_oAscCollaborativeMarksShowType.None:Asc.c_oAscCollaborativeMarksShowType.LastChanges):this.api.SetCollaborativeMarksShowType(e.value?Asc.c_oAscCollaborativeMarksShowType.None:Asc.c_oAscCollaborativeMarksShowType.LastChanges)}n=Common.localStorage.getItem(this.view.appPrefix+"settings-autosave"),null===n&&this.appConfig.customization&&!1===this.appConfig.customization.autosave&&(n=0),n=e.value||null===n?1:parseInt(n),Common.localStorage.setItem(this.view.appPrefix+"settings-autosave",n),Common.Utils.InternalSettings.set(this.view.appPrefix+"settings-autosave",n),this.api.asc_setAutoSaveGap(n)}Common.NotificationCenter.trigger("edit:complete",this.view),this.view.fireEvent("settings:apply",[this])},disableEditing:function(t){var e=this.getApplication();e.getController("Toolbar").DisableToolbar(t,!1,!0),e.getController("DocumentHolder").getView().SetDisabled(t),this.appConfig.canReview&&(e.getController("RightMenu").getView("RightMenu").clearSelection(),e.getController("RightMenu").SetDisabled(t,!1),e.getController("Statusbar").getView("Statusbar").SetDisabled(t),e.getController("Navigation")&&e.getController("Navigation").SetDisabled(t),e.getController("Common.Controllers.Plugins").getView("Common.Views.Plugins").disableControls(t));var i=e.getController("Common.Controllers.Comments");i&&i.setPreviewMode(t);var n=e.getController("LeftMenu");n.leftMenu.getMenu("file").getButton("protect").setDisabled(t),n.setPreviewMode(t),this.view&&(this.view.$el.find(".no-group-mask.review").css("opacity",1),this.view.btnsDocLang&&this.view.btnsDocLang.forEach(function(e){e&&e.setDisabled(t||!this.langs||this.langs.length<1)},this))},createToolbarPanel:function(){return this.view.getPanel()},getView:function(t){return!t&&this.view?this.view:Backbone.Controller.prototype.getView.call(this,t)},onAppReady:function(t){var e=this;if(e.view&&Common.localStorage.getBool(e.view.appPrefix+"settings-spellcheck",!(t.customization&&!1===t.customization.spellcheck))&&e.view.turnSpelling(!0),t.canReview)new Promise(function(t){t()}).then(function(){var i="object"==typeof e.appConfig.customization?e.appConfig.customization.trackChanges:void 0,n=t.isReviewOnly||!0===i||!1!==i&&Common.localStorage.getBool(e.view.appPrefix+"track-changes-"+(t.fileKey||""));if(e.api.asc_HaveRevisionsChanges()&&e.view.markChanges(!0),function(t){e.view.turnChanges(t),e.api.asc_SetTrackRevisions(t)}(n),"object"==typeof e.appConfig.customization&&1==e.appConfig.customization.showReviewChanges){e.dlgChanges=new Common.Views.ReviewChangesDialog({popoverChanges:e.popoverChanges,mode:e.appConfig});var o=$("#editor_sdk"),s=o.offset();e.dlgChanges.show(Math.max(10,s.left+o.width()-300),Math.max(10,s.top+o.height()-150))}});else if(t.canViewReview&&(t.canViewReview=t.isEdit||e.api.asc_HaveRevisionsChanges(!0),t.canViewReview)){var i=Common.localStorage.getItem(e.view.appPrefix+"review-mode");null===i&&(i=e.appConfig.customization&&/^(original|final|markup)$/i.test(e.appConfig.customization.reviewDisplay)?e.appConfig.customization.reviewDisplay.toLocaleLowerCase():"original"),e.turnDisplayMode(t.isEdit||t.isRestrictedEdit?"markup":i),e.view.turnDisplayMode(t.isEdit||t.isRestrictedEdit?"markup":i)}e.view&&e.view.btnChat&&e.getApplication().getController("LeftMenu").leftMenu.btnChat.on("toggle",function(t,i){i!==e.view.btnChat.pressed&&e.view.turnChat(i)}),e.view&&e.view.btnCommentRemove&&e.view.btnCommentRemove.setDisabled(!Common.localStorage.getBool(e.view.appPrefix+"settings-livecomment",!0))},applySettings:function(t){this.view&&this.view.turnSpelling(Common.localStorage.getBool(this.view.appPrefix+"settings-spellcheck",!0)),this.view&&this.view.turnCoAuthMode(Common.localStorage.getBool(this.view.appPrefix+"settings-coauthmode",!0))},synchronizeChanges:function(){this.appConfig&&this.appConfig.canReview&&this.view.markChanges(this.api.asc_HaveRevisionsChanges())},setLanguages:function(t){this.langs=t,this.view&&this.view.btnsDocLang&&this.view.btnsDocLang.forEach(function(t){t&&t.setDisabled(this.langs.length<1)},this)},onDocLanguage:function(){var t=this;new Common.Views.LanguageDialog({languages:t.langs,current:t.api.asc_getDefaultLanguage(),handler:function(e,i){if("ok"==e){var n=_.findWhere(t.langs,{value:i});n&&t.api.asc_setDefaultLanguage(n.code)}}}).show()},onLostEditRights:function(){this._readonlyRights=!0,this.view&&this.view.onLostEditRights()},changeAccessRights:function(t,e,i){if(!this._docAccessDlg&&!this._readonlyRights)if(this.appConfig.canRequestSharingSettings)Common.Gateway.requestSharingSettings();else{var n=this;n._docAccessDlg=new Common.Views.DocumentAccessDialog({settingsurl:this.appConfig.sharingSettingsUrl}),n._docAccessDlg.on("accessrights",function(t,e){n.setSharingSettings({sharingSettings:e})}).on("close",function(t){n._docAccessDlg=void 0}),n._docAccessDlg.show()}},setSharingSettings:function(t){t&&(this.document.info.sharingSettings=t.sharingSettings,Common.NotificationCenter.trigger("collaboration:sharingupdate",t.sharingSettings),Common.NotificationCenter.trigger("mentions:clearusers",this))},onCoAuthoringDisconnect:function(){this.SetDisabled(!0)},onUpdateUsers:function(){var t=this.userCollection;this.popoverChanges&&this.popoverChanges.each(function(e){var i=t.findOriginalUser(e.get("userid"));e.set("usercolor",i?i.get("color"):null)})},onAuthParticipantsChanged:function(t){if(this.view&&this.view.btnCompare){var e=0;_.each(t,function(t){t.asc_getView()||e++}),this.view.btnCompare.setDisabled(e>1||this.viewmode)}},commentsShowHide:function(t){if(this.view){var e=Common.Utils.InternalSettings.get(this.view.appPrefix+"settings-livecomment");void 0!==e&&this.view.btnCommentRemove&&this.view.btnCommentRemove.setDisabled("show"!=t&&!e)}},textInserted:"Inserted:",textDeleted:"Deleted:",textParaInserted:"Paragraph Inserted ",textParaDeleted:"Paragraph Deleted ",textFormatted:"Formatted",textParaFormatted:"Paragraph Formatted",textNot:"Not ",textBold:"Bold",textItalic:"Italic",textStrikeout:"Strikeout",textUnderline:"Underline",textColor:"Font color",textBaseline:"Baseline",textSuperScript:"Superscript",textSubScript:"Subscript",textHighlight:"Highlight color",textSpacing:"Spacing",textDStrikeout:"Double strikeout",textCaps:"All caps",textSmallCaps:"Small caps",textPosition:"Position",textFontSize:"Font size",textShd:"Background color",textContextual:"Don't add interval between paragraphs of the same style",textNoContextual:"Add interval between paragraphs of the same style",textIndentLeft:"Indent left",textIndentRight:"Indent right",textFirstLine:"First line",textRight:"Align right",textLeft:"Align left",textCenter:"Align center",textJustify:"Align justify",textBreakBefore:"Page break before",textKeepNext:"Keep with next",textKeepLines:"Keep lines together",textNoBreakBefore:"No page break before",textNoKeepNext:"Don't keep with next",textNoKeepLines:"Don't keep lines together",textLineSpacing:"Line Spacing: ",textMultiple:"multiple",textAtLeast:"at least",textExact:"exactly",textSpacingBefore:"Spacing before",textSpacingAfter:"Spacing after",textAuto:"auto",textWidow:"Widow control",textNoWidow:"No widow control",textTabs:"Change tabs",textNum:"Change numbering",textEquation:"Equation",textImage:"Image",textChart:"Chart",textShape:"Shape",textTableChanged:"Table Settings Changed",textTableRowsAdd:"Table Rows Added",textTableRowsDel:"Table Rows Deleted",textParaMoveTo:"Moved:",textParaMoveFromUp:"Moved Up:",textParaMoveFromDown:"Moved Down:",textUrl:"Paste a document URL",textAcceptBeforeCompare:"In order to compare documents all the tracked changes in them will be considered to have been accepted. Do you want to continue?",textTitleComparison:"Comparison Settings",textShow:"Show changes at",textChar:"Character level",textWord:"Word level"},Common.Controllers.ReviewChanges||{}))}),void 0===Common)var Common={};if(Common.Views=Common.Views||{},define("common/main/lib/view/Protection",["common/main/lib/util/utils","common/main/lib/component/BaseView","common/main/lib/component/Layout","common/main/lib/component/Window"],function(t){"use strict";Common.Views.Protection=Common.UI.BaseView.extend(_.extend(function(){function t(){var t=this;t.appConfig.isPasswordSupport&&(this.btnsAddPwd.concat(this.btnsChangePwd).forEach(function(e){e.on("click",function(e,i){t.fireEvent("protect:password",[e,"add"])})}),this.btnsDelPwd.forEach(function(e){e.on("click",function(e,i){t.fireEvent("protect:password",[e,"delete"])})}),this.btnPwd.menu.on("item:click",function(e,i,n){t.fireEvent("protect:password",[e,i.value])})),t.appConfig.isSignatureSupport&&(this.btnSignature.menu&&this.btnSignature.menu.on("item:click",function(e,i,n){t.fireEvent("protect:signature",[i.value,!1])}),this.btnsInvisibleSignature.forEach(function(e){e.on("click",function(e,i){t.fireEvent("protect:signature",["invisible"])})})),t._isSetEvents=!0}return{options:{},initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t),this.appConfig=t.mode,this.btnsInvisibleSignature=[],this.btnsAddPwd=[],this.btnsDelPwd=[],this.btnsChangePwd=[],this._state={disabled:!1,hasPassword:!1,disabledPassword:!1,invisibleSignDisabled:!1};var e=Common.localStorage.getKeysFilter();this.appPrefix=e&&e.length?e.split(",")[0]:"",this.appConfig.isPasswordSupport&&(this.btnAddPwd=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-ic-protect",caption:this.txtEncrypt}),this.btnsAddPwd.push(this.btnAddPwd),this.btnPwd=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-ic-protect",caption:this.txtEncrypt,menu:!0,visible:!1})),this.appConfig.isSignatureSupport&&(this.btnSignature=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-ic-signature",caption:this.txtSignature,menu:"pe-"!==this.appPrefix}),this.btnSignature.menu||this.btnsInvisibleSignature.push(this.btnSignature)),Common.NotificationCenter.on("app:ready",this.onAppReady.bind(this))},render:function(t){return this.boxSdk=$("#editor_sdk"),t&&t.html(this.getPanel()),this},onAppReady:function(e){var i=this;new Promise(function(t,e){t()}).then(function(){e.canProtect&&(e.isPasswordSupport&&(i.btnAddPwd.updateHint(i.hintAddPwd),i.btnPwd.updateHint(i.hintPwd),i.btnPwd.setMenu(new Common.UI.Menu({items:[{caption:i.txtChangePwd,value:"add"},{caption:i.txtDeletePwd,value:"delete"}]}))),i.btnSignature&&(i.btnSignature.updateHint(i.btnSignature.menu?i.hintSignature:i.txtInvisibleSignature),i.btnSignature.menu&&i.btnSignature.setMenu(new Common.UI.Menu({items:[{caption:i.txtInvisibleSignature,value:"invisible"},{caption:i.txtSignatureLine,value:"visible",disabled:i._state.disabled}]}))),Common.NotificationCenter.trigger("tab:visible","protect",!0)),t.call(i)})},getPanel:function(){return this.$el=$(_.template('
    ')({})),this.appConfig.canProtect&&(this.btnAddPwd&&this.btnAddPwd.render(this.$el.find("#slot-btn-add-password")),this.btnPwd&&this.btnPwd.render(this.$el.find("#slot-btn-change-password")),this.btnSignature&&this.btnSignature.render(this.$el.find("#slot-btn-signature"))),this.$el},show:function(){Common.UI.BaseView.prototype.show.call(this),this.fireEvent("show",this)},getButton:function(t,e){var i=this;if("signature"==t){var n=new Common.UI.Button({cls:"btn-text-default",style:"width: 100%;",caption:this.txtInvisibleSignature,disabled:this._state.invisibleSignDisabled});return this.btnsInvisibleSignature.push(n),this._isSetEvents&&n.on("click",function(t,e){i.fireEvent("protect:signature",["invisible"])}),n}if("add-password"==t){var n=new Common.UI.Button({cls:"btn-text-default",style:"width: 100%;",caption:this.txtAddPwd,disabled:this._state.disabled||this._state.disabledPassword,visible:!this._state.hasPassword});return this.btnsAddPwd.push(n),this._isSetEvents&&n.on("click",function(t,e){i.fireEvent("protect:password",[t,"add"])}),n}if("del-password"==t){var n=new Common.UI.Button({cls:"btn-text-default",style:"width: 100%;",caption:this.txtDeletePwd,disabled:this._state.disabled||this._state.disabledPassword,visible:this._state.hasPassword});return this.btnsDelPwd.push(n),this._isSetEvents&&n.on("click",function(t,e){i.fireEvent("protect:password",[t,"delete"])}),n}if("change-password"==t){var n=new Common.UI.Button({cls:"btn-text-default",style:"width: 100%;",caption:this.txtChangePwd,disabled:this._state.disabled||this._state.disabledPassword,visible:this._state.hasPassword});return this.btnsChangePwd.push(n),this._isSetEvents&&n.on("click",function(t,e){i.fireEvent("protect:password",[t,"add"])}),n}},SetDisabled:function(t,e){this._state.disabled=t,this._state.invisibleSignDisabled=t&&!e,this.btnsInvisibleSignature&&this.btnsInvisibleSignature.forEach(function(i){i&&i.setDisabled(t&&!e)},this),this.btnSignature&&this.btnSignature.menu&&(this.btnSignature.menu.items&&this.btnSignature.menu.items[1].setDisabled(t),this.btnSignature.setDisabled(t&&!e)),this.btnsAddPwd.concat(this.btnsDelPwd,this.btnsChangePwd).forEach(function(e){e&&e.setDisabled(t||this._state.disabledPassword)},this)},onDocumentPassword:function(t,e){this._state.hasPassword=t,this._state.disabledPassword=!!e;var i=this._state.disabledPassword||this._state.disabled;this.btnsAddPwd&&this.btnsAddPwd.forEach(function(e){e&&(e.setVisible(!t),e.setDisabled(i))},this),this.btnsDelPwd.concat(this.btnsChangePwd).forEach(function(e){e&&(e.setVisible(t),e.setDisabled(i))},this),this.btnPwd.setVisible(t)},txtEncrypt:"Encrypt",txtSignature:"Signature",hintAddPwd:"Encrypt with password",hintPwd:"Change or delete password",hintSignature:"Add digital signature or signature line",txtChangePwd:"Change password",txtDeletePwd:"Delete password",txtAddPwd:"Add password",txtInvisibleSignature:"Add digital signature",txtSignatureLine:"Add Signature line"}}(),Common.Views.Protection||{}))}),define("common/main/lib/view/PasswordDialog",["common/main/lib/component/Window"],function(){"use strict";Common.Views.PasswordDialog=Common.UI.Window.extend(_.extend({applyFunction:void 0,initialize:function(t){var e=this,i={};_.extend(i,{width:395,height:270,header:!0,cls:"modal-dlg",contentTemplate:"",title:e.txtTitle,buttons:["ok","cancel"]},t),this.template=t.template||['
    ','
    ',"","
    ",'
    ',"","
    ",'
    ','
    ',"","
    ",'
    ',"","
    "].join(""),this.handler=t.handler,this.settings=t.settings,i.tpl=_.template(this.template)(i),Common.UI.Window.prototype.initialize.call(this,i)},render:function(){if(Common.UI.Window.prototype.render.call(this),this.$window){var t=this;this.$window.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this)),this.inputPwd=new Common.UI.InputField({el:$("#id-password-txt"),type:"password",allowBlank:!1,style:"width: 100%;",validateOnBlur:!1}),this.repeatPwd=new Common.UI.InputField({el:$("#id-repeat-txt"),type:"password",allowBlank:!1,style:"width: 100%;",validateOnBlur:!1,validation:function(e){return t.txtIncorrectPwd}})}},show:function(){Common.UI.Window.prototype.show.apply(this,arguments);var t=this;setTimeout(function(){t.inputPwd.cmpEl.find("input").focus()},500)},onPrimary:function(t){return this._handleInput("ok"),!1},onBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value)},_handleInput:function(t){if(this.handler){if("ok"==t){if(!0!==this.inputPwd.checkValidate())return void this.inputPwd.cmpEl.find("input").focus();if(this.inputPwd.getValue()!==this.repeatPwd.getValue())return this.repeatPwd.checkValidate(),void this.repeatPwd.cmpEl.find("input").focus()}this.handler.call(this,t,this.inputPwd.getValue())}this.close()},txtTitle:"Set Password",txtPassword:"Password",txtDescription:"A Password is required to open this document",txtRepeat:"Repeat password",txtIncorrectPwd:"Confirmation password is not identical",txtWarning:"Warning: If you lose or forget the password, it cannot be recovered. Please keep it in a safe place."},Common.Views.PasswordDialog||{}))}),void 0===Common)var Common={};if(define("common/main/lib/view/SignDialog",["common/main/lib/util/utils","common/main/lib/component/InputField","common/main/lib/component/Window","common/main/lib/component/ComboBoxFonts"],function(){"use strict";Common.Views.SignDialog=Common.UI.Window.extend(_.extend({options:{width:370,style:"min-width: 350px;",cls:"modal-dlg",buttons:["ok","cancel"]},initialize:function(t){_.extend(this.options,{title:this.textTitle},t||{}),this.api=this.options.api,this.signType=this.options.signType||"invisible",this.signSize=this.options.signSize||{width:0,height:0},this.certificateId=null,this.signObject=null,this.fontStore=this.options.fontStore,this.font={size:11,name:"Arial",bold:!1,italic:!1};var e=Common.localStorage.getKeysFilter();this.appPrefix=e&&e.length?e.split(",")[0]:"",this.template=['
    ','
    ','
    ',"","
    ",'
    ',"
    ",'
    ','
    ',"","
    ",'
    ','
    ','
    ','
    ','
    ','
    ',"","
    ",'",'
    ','","
    ",'
    ',"
    ",'',"",'","",'',"
    ","
    "].join(""),this.templateCertificate=_.template(['',''].join("")),this.options.tpl=_.template(this.template)(this.options),Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this);var t=this,e=this.getChild();t.inputPurpose=new Common.UI.InputField({el:$("#id-dlg-sign-purpose"),style:"width: 100%;"}),t.inputName=new Common.UI.InputField({el:$("#id-dlg-sign-name"),style:"width: 100%;",validateOnChange:!0}).on("changing",_.bind(t.onChangeName,t)),t.cmbFonts=new Common.UI.ComboBoxFonts({el:$("#id-dlg-sign-fonts"),cls:"input-group-nr",style:"width: 234px;",menuCls:"scrollable-menu",menuStyle:"min-width: 234px;max-height: 270px;",store:new Common.Collections.Fonts,recent:0,takeFocusOnClose:!0,hint:t.tipFontName}).on("selected",function(e,i){t.signObject&&t.signObject.setText(t.inputName.getValue(),i.name,t.font.size,t.font.italic,t.font.bold),t.font.name=i.name}),this.cmbFontSize=new Common.UI.ComboBox({el:$("#id-dlg-sign-font-size"),cls:"input-group-nr",style:"width: 55px;",menuCls:"scrollable-menu",menuStyle:"min-width: 55px;max-height: 270px;",hint:this.tipFontSize,takeFocusOnClose:!0,data:[{value:8,displayValue:"8"},{value:9,displayValue:"9"},{value:10,displayValue:"10"},{value:11,displayValue:"11"},{value:12,displayValue:"12"},{value:14,displayValue:"14"},{value:16,displayValue:"16"},{value:18,displayValue:"18"},{value:20,displayValue:"20"},{value:22,displayValue:"22"},{value:24,displayValue:"24"},{value:26,displayValue:"26"},{value:28,displayValue:"28"},{value:36,displayValue:"36"},{value:48,displayValue:"48"},{value:72,displayValue:"72"},{value:96,displayValue:"96"}]}).on("selected",function(e,i){t.signObject&&t.signObject.setText(t.inputName.getValue(),t.font.name,i.value,t.font.italic,t.font.bold),t.font.size=i.value}),this.cmbFontSize.setValue(this.font.size),this.cmbFontSize.on("changed:before",_.bind(this.onFontSizeChanged,this,!0)),this.cmbFontSize.on("changed:after",_.bind(this.onFontSizeChanged,this,!1)),t.btnBold=new Common.UI.Button({parentEl:$("#id-dlg-sign-bold"),cls:"btn-toolbar",iconCls:"toolbar__icon btn-bold",enableToggle:!0,hint:t.textBold}),t.btnBold.on("click",function(e,i){t.signObject&&t.signObject.setText(t.inputName.getValue(),t.font.name,t.font.size,t.font.italic,e.pressed),t.font.bold=e.pressed}),t.btnItalic=new Common.UI.Button({parentEl:$("#id-dlg-sign-italic"),cls:"btn-toolbar",iconCls:"toolbar__icon btn-italic",enableToggle:!0,hint:t.textItalic}),t.btnItalic.on("click",function(e,i){t.signObject&&t.signObject.setText(t.inputName.getValue(),t.font.name,t.font.size,e.pressed,t.font.bold),t.font.italic=e.pressed}),t.btnSelectImage=new Common.UI.Button({el:"#id-dlg-sign-image"}),t.btnSelectImage.on("click",_.bind(t.onSelectImage,t)),t.btnChangeCertificate=new Common.UI.Button({el:"#id-dlg-sign-change"}),t.btnChangeCertificate.on("click",_.bind(t.onChangeCertificate,t)),t.btnOk=new Common.UI.Button({el:e.find(".primary"),disabled:!0}),t.cntCertificate=$("#id-dlg-sign-certificate"),t.cntVisibleSign=$("#id-dlg-sign-visible"),t.cntInvisibleSign=$("#id-dlg-sign-invisible"),"visible"==t.signType?t.cntInvisibleSign.addClass("hidden"):t.cntVisibleSign.addClass("hidden"),e.find(".dlg-btn").on("click",_.bind(t.onBtnClick,t)),t.afterRender()},getFocusedComponents:function(){return[this.inputPurpose,this.inputName,this.cmbFonts,this.cmbFontSize]},show:function(){Common.UI.Window.prototype.show.apply(this,arguments);var t=this;_.delay(function(){("visible"==t.signType?t.inputName:t.inputPurpose).cmpEl.find("input").focus()},500)},close:function(){this.api.asc_unregisterCallback("on_signature_defaultcertificate_ret",this.binding.certificateChanged),this.api.asc_unregisterCallback("on_signature_selectsertificate_ret",this.binding.certificateChanged),Common.UI.Window.prototype.close.apply(this,arguments),this.signObject&&this.signObject.destroy()},afterRender:function(){this.api&&(this.binding||(this.binding={}),this.binding.certificateChanged=_.bind(this.onCertificateChanged,this),this.api.asc_registerCallback("on_signature_defaultcertificate_ret",this.binding.certificateChanged),this.api.asc_registerCallback("on_signature_selectsertificate_ret",this.binding.certificateChanged),this.api.asc_GetDefaultCertificate()),"visible"==this.signType&&(this.cmbFonts.fillFonts(this.fontStore),this.cmbFonts.selectRecord(this.fontStore.findWhere({name:this.font.name})||this.fontStore.at(0)),this.signObject=new AscCommon.CSignatureDrawer("signature-preview-img",this.api,this.signSize.width,this.signSize.height))},getSettings:function(){var t={};return t.certificateId=this.certificateId,"invisible"==this.signType?t.purpose=this.inputPurpose.getValue():t.images=this.signObject?this.signObject.getImages():[null,null],t},onBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value)},onPrimary:function(t){return this._handleInput("ok"),!1},_handleInput:function(t){if(this.options.handler){if("ok"==t&&(this.btnOk.isDisabled()||this.signObject&&!this.signObject.isValid()))return void(this.btnOk.isDisabled()||(this.inputName.showError([this.textNameError]),this.inputName.focus()));this.options.handler.call(this,this,t)}this.close()},onChangeCertificate:function(){this.api.asc_SelectCertificate()},onCertificateChanged:function(t){this.certificateId=t.id;var e=t.date,i="string"==typeof e?e.split(" - "):["",""];this.cntCertificate.html(this.templateCertificate({name:t.name,valid:this.textValid.replace("%1",i[0]).replace("%2",i[1])})),this.cntCertificate.toggleClass("hidden",_.isEmpty(this.certificateId)||this.certificateId<0),this.btnChangeCertificate.setCaption(_.isEmpty(this.certificateId)||this.certificateId<0?this.textSelect:this.textChange),this.btnOk.setDisabled(_.isEmpty(this.certificateId)||this.certificateId<0)},onSelectImage:function(){this.signObject&&(this.signObject.selectImage(),this.inputName.setValue(""))},onChangeName:function(t,e){this.signObject&&this.signObject.setText(e,this.font.name,this.font.size,this.font.italic,this.font.bold)},onFontSizeChanged:function(t,e,i,n){var o;if(t){if(!e.store.findWhere({displayValue:i.value})&&!(o=/^\+?(\d*(\.|,)?\d+)$|^\+?(\d+(\.|,)?\d*)$/.exec(i.value)))return o=e.getValue(),e.setRawValue(o),n.preventDefault(),!1}else{var s="sse-"==this.appPrefix?409:300;o=Common.Utils.String.parseFloat(i.value),o=o>s?s:o<1?1:Math.floor(2*(o+.4))/2,e.setRawValue(o),this.signObject&&this.signObject.setText(this.inputName.getValue(),this.font.name,o,this.font.italic,this.font.bold),this.font.size=o}},textTitle:"Sign Document",textPurpose:"Purpose for signing this document",textCertificate:"Certificate",textValid:"Valid from %1 to %2",textChange:"Change",textInputName:"Input signer name",textUseImage:"or click 'Select Image' to use a picture as signature",textSelectImage:"Select Image",textSignature:"Signature looks as",tipFontName:"Font Name",tipFontSize:"Font Size",textBold:"Bold",textItalic:"Italic",textSelect:"Select",textNameError:"Signer name must not be empty."},Common.Views.SignDialog||{}))}),void 0===Common)var Common={};if(define("common/main/lib/view/SignSettingsDialog",["common/main/lib/util/utils","common/main/lib/component/InputField","common/main/lib/component/CheckBox","common/main/lib/component/Window"],function(){"use strict";Common.Views.SignSettingsDialog=Common.UI.Window.extend(_.extend({options:{width:350,style:"min-width: 350px;",cls:"modal-dlg",type:"edit"},initialize:function(t){_.extend(this.options,{title:this.textTitle},t||{}),this.template=['
    ','
    ',"","
    ",'
    ',"","
    ",'
    ','
    ',"","
    ",'
    ','
    ',"","
    ",'
    ','
    ',"","
    ",'','
    ',"
    ",'"].join(""),this.api=this.options.api,this.type=this.options.type||"edit",this.options.tpl=_.template(this.template)(this.options),Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this);var t=this,e=this.getChild();t.inputName=new Common.UI.InputField({el:$("#id-dlg-sign-settings-name"),style:"width: 100%;",disabled:"view"==this.type}),t.inputTitle=new Common.UI.InputField({el:$("#id-dlg-sign-settings-title"),style:"width: 100%;",disabled:"view"==this.type}),t.inputEmail=new Common.UI.InputField({el:$("#id-dlg-sign-settings-email"),style:"width: 100%;",disabled:"view"==this.type}),t.textareaInstructions=this.$window.find("textarea"),t.textareaInstructions.keydown(function(t){t.keyCode==Common.UI.Keys.RETURN&&t.stopPropagation()}),"view"==this.type?this.textareaInstructions.attr("disabled","disabled"):this.textareaInstructions.removeAttr("disabled"),this.textareaInstructions.toggleClass("disabled","view"==this.type),this.chDate=new Common.UI.CheckBox({el:$("#id-dlg-sign-settings-date"),labelText:this.textShowDate,disabled:"view"==this.type}),e.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this))},getFocusedComponents:function(){return[this.inputName,this.inputTitle,this.inputEmail,this.textareaInstructions]},getDefaultFocusableComponent:function(){return this.inputName},setSettings:function(t){if(t){var e=this,i=t.asc_getSigner1();e.inputName.setValue(i||""),i=t.asc_getSigner2(),e.inputTitle.setValue(i||""),i=t.asc_getEmail(),e.inputEmail.setValue(i||""),i=t.asc_getInstructions(),e.textareaInstructions.val(i||""),e.chDate.setValue(t.asc_getShowDate()),e._currentGuid=t.asc_getGuid()}},getSettings:function(){var t=this,e=new AscCommon.asc_CSignatureLine;return e.asc_setSigner1(t.inputName.getValue()),e.asc_setSigner2(t.inputTitle.getValue()),e.asc_setEmail(t.inputEmail.getValue()),e.asc_setInstructions(t.textareaInstructions.val()),e.asc_setShowDate("checked"==t.chDate.getValue()),void 0!==t._currentGuid&&e.asc_setGuid(t._currentGuid),e},onBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value)},onPrimary:function(t){return this._handleInput("ok"),!1},_handleInput:function(t){this.options.handler&&this.options.handler.call(this,this,t),this.close()},textInfo:"Signer Info",textInfoName:"Name",textInfoTitle:"Signer Title",textInfoEmail:"E-mail", -textInstructions:"Instructions for Signer",txtEmpty:"This field is required",textAllowComment:"Allow signer to add comment in the signature dialog",textShowDate:"Show sign date in signature line",textTitle:"Signature Setup"},Common.Views.SignSettingsDialog||{}))}),void 0===Common)var Common={};Common.Controllers=Common.Controllers||{},define("common/main/lib/controller/Protection",["core","common/main/lib/view/Protection","common/main/lib/view/PasswordDialog","common/main/lib/view/SignDialog","common/main/lib/view/SignSettingsDialog"],function(){"use strict";Common.Controllers.Protection=Backbone.Controller.extend(_.extend({models:[],collections:[],views:["Common.Views.Protection"],sdkViewName:"#id_main",initialize:function(){this.addListeners({"Common.Views.Protection":{"protect:password":_.bind(this.onPasswordClick,this),"protect:signature":_.bind(this.onSignatureClick,this)}})},onLaunch:function(){this._state={},Common.NotificationCenter.on("app:ready",this.onAppReady.bind(this)),Common.NotificationCenter.on("api:disconnect",_.bind(this.onCoAuthoringDisconnect,this))},setConfig:function(t,e){this.setApi(e),t&&(this.sdkViewName=t.sdkviewname||this.sdkViewName)},setApi:function(t){t&&(this.api=t,this.appConfig.isPasswordSupport&&this.api.asc_registerCallback("asc_onDocumentPassword",_.bind(this.onDocumentPassword,this)),this.appConfig.isSignatureSupport&&(Common.NotificationCenter.on("protect:sign",_.bind(this.onSignatureRequest,this)),Common.NotificationCenter.on("protect:signature",_.bind(this.onSignatureClick,this)),this.api.asc_registerCallback("asc_onSignatureClick",_.bind(this.onSignatureSign,this)),this.api.asc_registerCallback("asc_onUpdateSignatures",_.bind(this.onApiUpdateSignatures,this))),this.api.asc_registerCallback("asc_onCoAuthoringDisconnect",_.bind(this.onCoAuthoringDisconnect,this)))},setMode:function(t){return this.appConfig=t,this.view=this.createView("Common.Views.Protection",{mode:t}),this},onDocumentPassword:function(t,e){this.view&&this.view.onDocumentPassword(t,e)},SetDisabled:function(t,e){this.view&&this.view.SetDisabled(t,e)},onPasswordClick:function(t,e){switch(e){case"add":this.addPassword();break;case"delete":this.deletePassword()}Common.NotificationCenter.trigger("edit:complete",this.view)},onSignatureRequest:function(t){this.api.asc_RequestSign(t)},onSignatureClick:function(t,e,i){switch(t){case"invisible":this.onSignatureRequest("unvisibleAdd");break;case"visible":this.addVisibleSignature(e,i)}},createToolbarPanel:function(){return this.view.getPanel()},getView:function(t){return!t&&this.view?this.view:Backbone.Controller.prototype.getView.call(this,t)},onAppReady:function(t){},addPassword:function(){var t=this;new Common.Views.PasswordDialog({api:t.api,signType:"invisible",handler:function(e,i){"ok"==e&&t.api.asc_setCurrentPassword(i),Common.NotificationCenter.trigger("edit:complete")}}).show()},deletePassword:function(){this.api.asc_resetPassword()},addInvisibleSignature:function(){var t=this;new Common.Views.SignDialog({api:t.api,signType:"invisible",handler:function(e,i){if("ok"==i){var n=e.getSettings();t.api.asc_Sign(n.certificateId)}Common.NotificationCenter.trigger("edit:complete")}}).show()},addVisibleSignature:function(t,e){var i=this,n=new Common.Views.SignSettingsDialog({type:t?"view":"edit",handler:function(e,n){t||"ok"!=n||i.api.asc_AddSignatureLine2(e.getSettings()),Common.NotificationCenter.trigger("edit:complete")}});n.show(),e&&n.setSettings(this.api.asc_getSignatureSetup(e))},signVisibleSignature:function(t,e,i){var n=this;if(_.isUndefined(n.fontStore)){n.fontStore=new Common.Collections.Fonts;var o=n.getApplication().getController("Toolbar").getView("Toolbar").cmbFontName.store.toJSON(),s=[];_.each(o,function(t,e){t.cloneid||s.push(_.clone(t))}),n.fontStore.add(s)}new Common.Views.SignDialog({api:n.api,signType:"visible",fontStore:n.fontStore,signSize:{width:e||0,height:i||0},handler:function(e,i){if("ok"==i){var o=e.getSettings();n.api.asc_Sign(o.certificateId,t,o.images[0],o.images[1])}Common.NotificationCenter.trigger("edit:complete")}}).show()},onSignatureSign:function(t,e,i,n){n?this.signVisibleSignature(t,e,i):this.addInvisibleSignature()},onApiUpdateSignatures:function(t,e){this.SetDisabled(t&&t.length>0,!0)},onCoAuthoringDisconnect:function(){this.SetDisabled(!0)}},Common.Controllers.Protection||{}))}),define("common/main/lib/controller/Desktop",["core"],function(){"use strict";var t=window.AscDesktopEditor;!!t&&t.execCommand("webapps:features",JSON.stringify({version:"0.0.0",eventloading:!0,titlebuttons:!0}));var e=function(){var e,i={version:"0.0.0"},n=window.DE||window.PE||window.SSE,o={"btn-save":"save","btn-save-coauth":"coauth","btn-synch":"synch"};if(t){if(window.on_native_message=function(o,s){if(/^style:change/.test(o)){var a=JSON.parse(s);if("toolbar"==a.element)"off"==a.action&&"native-color"==a.style&&$(".toolbar").removeClass("editor-native-color");else if("body"==a.element&&"merge"==a.action){var r=document.createElement("style");r.innerHTML=a.style,document.body.appendChild(r)}}else if(/window:features/.test(o)){var a=JSON.parse(s);_.isNumber(a.skiptoparea)&&($(".asc-window.modal").length&&$(".asc-window.modal").position().top
    ',n.id)),t(i.el).append(c)),n.render(c),n.cmpEl.attr({tabindex:"-1"})),c.css({left:r[0],top:r[1]}),n.show(),e.isFunction(n.options.initMenu)&&(n.options.initMenu(o),n.alignPosition()),e.delay(function(){n.cmpEl.focus()},10),i.currentMenu=n}},s=function(t){if(t&&e.isArray(t)){var n={},o=null;return e.each(t,function(t,s){var a=t.get_ObjectType(),l=t.get_ObjectValue();Asc.c_oAscTypeSelectElement.Image==a?(o=i.pictureMenu,n.imgProps={},n.imgProps.value=l,n.imgProps.locked=!!l&&l.get_Locked()):Asc.c_oAscTypeSelectElement.Table==a?(o=i.tableMenu,n.tableProps={},n.tableProps.value=l,n.tableProps.locked=!!l&&l.get_Locked()):Asc.c_oAscTypeSelectElement.Hyperlink==a?(n.hyperProps={},n.hyperProps.value=l):Asc.c_oAscTypeSelectElement.Shape==a?(o=i.pictureMenu,n.shapeProps={},n.shapeProps.value=l,n.shapeProps.locked=!!l&&l.get_Locked(),l.get_FromChart()&&(n.shapeProps.isChart=!0)):Asc.c_oAscTypeSelectElement.Chart==a?(o=i.pictureMenu,n.chartProps={},n.chartProps.value=l,n.chartProps.locked=!!l&&l.get_Locked()):Asc.c_oAscTypeSelectElement.Slide==a?(n.slideProps={},n.slideProps.value=l,n.slideProps.locked=!!l&&l.get_LockDelete()):Asc.c_oAscTypeSelectElement.Paragraph==a?(n.paraProps={},n.paraProps.value=l,n.paraProps.locked=!!l&&l.get_Locked(),(n.shapeProps&&n.shapeProps.value||n.chartProps&&n.chartProps.value)&&e.isUndefined(n.tableProps)&&(o=i.textMenu)):Asc.c_oAscTypeSelectElement.SpellCheck==a?(n.spellProps={},n.spellProps.value=l,i._currentSpellObj=l):Asc.c_oAscTypeSelectElement.Math==a&&(n.mathProps={},n.mathProps.value=l,i._currentMathObj=l)}),null===o&&(e.isUndefined(n.paraProps)?e.isUndefined(n.slideProps)||(o=i.slideMenu):o=i.textMenu),{menu_to_show:o,menu_props:n}}},a=function(t){if(t&&e.isArray(t)){i.viewModeMenu||i.createDelayedElementsViewer();var n={},o=null;return e.each(t,function(t,e){var s=t.get_ObjectType(),a=t.get_ObjectValue();Asc.c_oAscTypeSelectElement.Image==s||Asc.c_oAscTypeSelectElement.Table==s||Asc.c_oAscTypeSelectElement.Shape==s||Asc.c_oAscTypeSelectElement.Chart==s||Asc.c_oAscTypeSelectElement.Paragraph==s?(o=i.viewModeMenu,n.locked=n.locked||!!a&&a.get_Locked(),Asc.c_oAscTypeSelectElement.Chart==s&&(n.isChart=!0)):Asc.c_oAscTypeSelectElement.Slide==s&&(n.locked=n.locked||!!a&&a.get_LockDelete())}),o?{menu_to_show:o,menu_props:n}:null}},l=function(t,e,n){if(i.api){var l=i.mode.isEdit&&!i._isDisabled?s(i.api.getSelectedElements()):a(i.api.getSelectedElements());l&&o(l.menu_to_show,l.menu_props,t)}},r=function(t){e.delay(function(){t.get_Type()==Asc.c_oAscContextMenuTypes.Thumbnails?o.call(i,i.mode.isEdit&&!i._isDisabled?i.slideMenu:i.viewModeMenuSlide,{isSlideSelect:t.get_IsSlideSelect(),isSlideHidden:t.get_IsSlideHidden(),fromThumbs:!0},t):l.call(i,t)},10)},c=function(t){if(i.currentMenu&&i.currentMenu.isVisible())if(0===i.api.asc_getCurrentFocusObject()){if(i.slideMenu===i.currentMenu&&!i._isDisabled){var n=!1;e.each(t,function(t,e){Asc.c_oAscTypeSelectElement.Slide==t.get_ObjectType()&&(n=t.get_ObjectValue().get_IsHidden())}),i.currentMenu.options.initMenu({isSlideSelect:i.slideMenu.items[2].isVisible(),isSlideHidden:n,fromThumbs:!0}),i.currentMenu.alignPosition()}}else{var o=i.mode.isEdit&&!i._isDisabled?s(t):a(t);o&&o.menu_to_show===i.currentMenu&&(i.currentMenu.options.initMenu(o.menu_props),i.currentMenu.alignPosition())}},d=function(t){if(i.api){var n=e.isUndefined(t.originalEvent)?t.wheelDelta:t.originalEvent.wheelDelta;e.isUndefined(n)&&(n=t.deltaY),!t.ctrlKey&&!t.metaKey||t.altKey||(n<0?i.api.zoomOut():n>0&&i.api.zoomIn(),t.preventDefault(),t.stopPropagation())}},h=function(e){if(i.api){var n=e.keyCode;if((e.ctrlKey||e.metaKey)&&!e.shiftKey&&!e.altKey){if(n===Common.UI.Keys.NUM_PLUS||n===Common.UI.Keys.EQUALITY||Common.Utils.isGecko&&n===Common.UI.Keys.EQUALITY_FF||Common.Utils.isOpera&&43==n)return i.api.zoomIn(),e.preventDefault(),e.stopPropagation(),!1;if(n===Common.UI.Keys.NUM_MINUS||n===Common.UI.Keys.MINUS||Common.Utils.isGecko&&n===Common.UI.Keys.MINUS_FF||Common.Utils.isOpera&&45==n)return i.api.zoomOut(),e.preventDefault(),e.stopPropagation(),!1;if(48===n||96===n)return i.api.zoomFitToPage(),e.preventDefault(),e.stopPropagation(),!1}i.currentMenu&&i.currentMenu.isVisible()&&(n!=Common.UI.Keys.UP&&n!=Common.UI.Keys.DOWN||t("ul.dropdown-menu",i.currentMenu.el).focus()),n==Common.UI.Keys.ESC&&(Common.UI.Menu.Manager.hideAll(),Common.NotificationCenter.trigger("leftmenu:change","hide"))}},p=function(){i._Height=i.cmpEl.height(),i._Width=i.cmpEl.width(),i._BodyWidth=t("body").width(),i._XY=void 0,i.slideNumDiv&&(i.slideNumDiv.remove(),i.slideNumDiv=void 0)},u=function(e){var n=i.cmpEl;if(n){n.on("contextmenu",function(t){return t.preventDefault(),t.stopPropagation(),!1}),n.on("click",function(t){"canvas"==t.target.localName&&(i._preventClick?i._preventClick=!1:n.focus())}),n.on("mousedown",function(t){"canvas"==t.target.localName&&Common.UI.Menu.Manager.hideAll()});var o=/Firefox/i.test(navigator.userAgent)?"DOMMouseScroll":"mousewheel";!function(t,e,i){t.addEventListener?t.addEventListener(e,i,!1):t.attachEvent("on"+e,i)}(i.el,o,d)}t(document).on("mousewheel",d),t(document).on("keydown",h),t(window).on("resize",p),PE.getController("Viewport").getView("Viewport").hlayout.on("layout:resizedrag",p)},m=function(t){if(n){var e=n.findUser(t);if(e)return Common.Utils.UserInfoParser.getParsedName(e.get("username"));if("string"==typeof t){var o,s=t.slice(0,-1);if(n.models.some(function(t){if(t.attributes&&t.attributes.idOriginal===s)return o=t,!0}),o&&o.attributes.username)return o.attributes.username}}return i.guestText},g={toolTip:new Common.UI.Tooltip({owner:this,html:!0,title:"
    Press Ctrl and click link"}),strTip:"",isHidden:!0,isVisible:!1},f=!0,b=function(t,e,n){!0===f&&(f=new Common.UI.Tooltip({owner:t.currentTarget,title:i.tipIsLocked}),f.show())},C=function(){if("object"==typeof f){f.hide(),f=void 0;for(var t=0;t0&&("object"==typeof f&&(f.hide(),f=!0),e.each(i.usertips,function(t){t.remove()})),i.usertips=[],i.usertipcount=0},w=function(){g.isHidden&&g.isVisible&&(g.isVisible=!1,g.toolTip.hide())},x=function(n){if(e.isUndefined(i._XY)&&(i._XY=[i.cmpEl.offset().left-t(window).scrollLeft(),i.cmpEl.offset().top-t(window).scrollTop()],i._Width=i.cmpEl.width(),i._Height=i.cmpEl.height(),i._BodyWidth=t("body").width()),n){var o,s;if(1==n.get_Type()){var a=n.get_Hyperlink(),l=!1;a&&(g.isHidden=!1,s=e.isEmpty(a.get_ToolTip())?a.get_Value():a.get_ToolTip(),s=Common.Utils.String.htmlEncode(s),(g.tipLength!==s.length||g.strTip.indexOf(s)<0)&&(g.toolTip.setTitle(s+"
    "+i.txtPressLink+""),g.tipLength=s.length,g.strTip=s,l=!0),o=[n.get_X(),n.get_Y()],o[1]+=i._XY[1]-15,o[0]+=i._XY[0]+5,g.isVisible&&!l||(g.isVisible=!0,g.toolTip.show([-1e4,-1e4])),l&&(g.tipHeight=g.toolTip.getBSTip().$tip.height(),g.tipWidth=g.toolTip.getBSTip().$tip.width()),o[1]-=g.tipHeight,o[0]+g.tipWidth>i._BodyWidth&&(o[0]=i._BodyWidth-g.tipWidth),g.toolTip.getBSTip().$tip.css({top:o[1]+"px",left:o[0]+"px"}))}else if(2==n.get_Type()&&i.mode.isEdit){var r;i.usertipcount>=i.usertips.length&&(r=t(document.createElement("div")),r.addClass("username-tip"),r.css({height:i._TtHeight+"px",position:"absolute",zIndex:"900",visibility:"visible"}),t(document.body).append(r),f&&(r.on("mouseover",b),r.on("mouseout",v)),i.usertips.push(r)),r=i.usertips[i.usertipcount],i.usertipcount++,s=m(n.get_UserId()),o=[n.get_X()+i._XY[0],n.get_Y()+i._XY[1]];var c=o[0];o[0]=i._BodyWidth-o[0],o[1]-=2==n.get_LockedObjectType()?i._TtHeight:0,o[1]>i._XY[1]&&o[1]+i._TtHeight-1&&!t.items[n].checked&&t.setChecked(n,!0)}};var M=function(){var t,n=i.api.getSelectedElements(!0);if(n&&e.isArray(n))for(var o=0;o0?(n.setVisible(l.length>3),n.setDisabled(i._currentParaObjDisabled),e.each(l,function(t,e){var n=new Common.UI.MenuItem({caption:t,spellword:!0,disabled:i._currentParaObjDisabled}).on("click",function(t,e){i.api&&(i.api.asc_replaceMisspelledWord(t.caption,i._currentSpellObj),i.fireEvent("editcomplete",i))});e<3?s.push(n):a.push(n)}),s.length>0&&(t?e.each(s,function(t,e){i.textMenu.insertItem(e,t)}):e.each(s,function(t,e){i.menuSpellCheckTable.menu.insertItem(e,t)})),a.length>0&&e.each(a,function(t,e){n.menu.addItem(t)}),o.setVisible(!1)):(n.setVisible(!1),o.setVisible(!0),o.setCaption(i.noSpellVariantsText,!0))}},this.clearWordVariants=function(t){for(var e=t?i.textMenu:i.menuSpellCheckTable.menu,n=0;n0&&e.each(s,function(t,s){t.menu?e.each(t.menu.items,function(t){t.on("click",e.bind(i.equationCallback,i,t.options.equationProps))}):t.on("click",e.bind(i.equationCallback,i,t.options.equationProps)),o.insertItem(n,t),n++}),s.length},this.clearEquationMenu=function(t,n){for(var o=t?i.textMenu:i.tableMenu,s=n;s0&&i.addComment()};U["command+f5,ctrl+f5"]=function(t){t.preventDefault(),t.stopPropagation(),i.slidesCount>0&&Common.NotificationCenter.trigger("preview:start",0)},Common.util.Shortcuts.delegateShortcuts({shortcuts:U});var D=function(){i.slidesCount>0&&Common.NotificationCenter.trigger("preview:start",0)},L=function(t){i.slidesCount=t},F=function(t){i.currentMenu&&i.currentMenu.isVisible()&&!0!==i._isFromSlideMenu&&i._isFromSlideMenu!==t&&i.currentMenu.hide(),i._isFromSlideMenu=t},V=function(t){i._state.themeId=t},B=function(){i._state.themeLock=!0},R=function(){i._state.themeLock=!1},O=function(n){var o=n.asc_getCellCoord(),s=i.cmpEl.find("#special-paste-container"),a=n.asc_getOptions();if(a){if(s.length<1&&(i._arrSpecialPaste=[],i._arrSpecialPaste[Asc.c_oSpecialPasteProps.paste]=i.textPaste,i._arrSpecialPaste[Asc.c_oSpecialPasteProps.keepTextOnly]=i.txtKeepTextOnly,i._arrSpecialPaste[Asc.c_oSpecialPasteProps.picture]=i.txtPastePicture,i._arrSpecialPaste[Asc.c_oSpecialPasteProps.sourceformatting]=i.txtPasteSourceFormat,i._arrSpecialPaste[Asc.c_oSpecialPasteProps.destinationFormatting]=i.txtPasteDestFormat,s=t('
    '),i.cmpEl.append(s),i.btnSpecialPaste=new Common.UI.Button({parentEl:t("#id-document-holder-btn-special-paste"),cls:"btn-toolbar",iconCls:"toolbar__icon btn-paste",menu:new Common.UI.Menu({items:[]})})),a.length>0){for(var l=i.btnSpecialPaste.menu,r=0;r0&&l.items[0].setChecked(!0,!0)}if(o.asc_getX()<0||o.asc_getY()<0)s.is(":visible")&&s.hide();else{var c=[o.asc_getX()+o.asc_getWidth()+3,o.asc_getY()+o.asc_getHeight()+3];s.css({left:c[0],top:c[1]}),s.show()}}},N=function(){var t=i.cmpEl.find("#special-paste-container");t.is(":visible")&&t.hide()},G=function(t){this.menuImgCrop.menu.items[0].setChecked(t,!0)};this.setApi=function(t){return i.api=t,i.api&&(i.api.asc_registerCallback("asc_onContextMenu",e.bind(r,i)),i.api.asc_registerCallback("asc_onMouseMoveStart",e.bind(y,i)),i.api.asc_registerCallback("asc_onMouseMoveEnd",e.bind(w,i)),i.api.asc_registerCallback("asc_onPaintSlideNum",e.bind(k,i)),i.api.asc_registerCallback("asc_onEndPaintSlideNum",e.bind(I,i)),i.api.asc_registerCallback("asc_onCountPages",e.bind(L,i)),i.api.asc_registerCallback("asc_onCurrentPage",e.bind(F,i)),i.slidesCount=i.api.getCountPages(),i.api.asc_registerCallback("asc_onHyperlinkClick",e.bind(_,i)),i.api.asc_registerCallback("asc_onMouseMove",e.bind(x,i)),!0===i.mode.isEdit&&(i.api.asc_registerCallback("asc_onDialogAddHyperlink",e.bind(T,i)),i.api.asc_registerCallback("asc_doubleClickOnChart",e.bind(i.editChartClick,i)),i.api.asc_registerCallback("asc_onSpellCheckVariantsFound",e.bind(M,i)),i.api.asc_registerCallback("asc_onShowSpecialPasteOptions",e.bind(O,i)),i.api.asc_registerCallback("asc_onHideSpecialPasteOptions",e.bind(N,i)),i.api.asc_registerCallback("asc_ChangeCropState",e.bind(G,i)),i.api.asc_registerCallback("asc_onHidePlaceholderActions",e.bind(i.onHidePlaceholderActions,i)),i.api.asc_registerPlaceholderCallback(AscCommon.PlaceholderButtonType.Image,e.bind(i.onInsertImage,i,!0)),i.api.asc_registerPlaceholderCallback(AscCommon.PlaceholderButtonType.ImageUrl,e.bind(i.onInsertImageUrl,i,!0)),i.api.asc_registerPlaceholderCallback(AscCommon.PlaceholderButtonType.Chart,e.bind(i.onClickPlaceholderChart,i)),i.api.asc_registerPlaceholderCallback(AscCommon.PlaceholderButtonType.Table,e.bind(i.onClickPlaceholderTable,i)),i.api.asc_registerPlaceholderCallback(AscCommon.PlaceholderButtonType.Video,e.bind(i.onClickPlaceholder,i,AscCommon.PlaceholderButtonType.Video)),i.api.asc_registerPlaceholderCallback(AscCommon.PlaceholderButtonType.Audio,e.bind(i.onClickPlaceholder,i,AscCommon.PlaceholderButtonType.Audio))),i.api.asc_registerCallback("asc_onCoAuthoringDisconnect",e.bind(E,i)),Common.NotificationCenter.on("api:disconnect",e.bind(E,i)),i.api.asc_registerCallback("asc_onTextLanguage",e.bind(P,i)),i.api.asc_registerCallback("asc_onShowForeignCursorLabel",e.bind(S,i)),i.api.asc_registerCallback("asc_onHideForeignCursorLabel",e.bind(A,i)),i.api.asc_registerCallback("asc_onFocusObject",e.bind(c,i)),i.api.asc_registerCallback("asc_onUpdateThemeIndex",e.bind(V,i)),i.api.asc_registerCallback("asc_onLockDocumentTheme",e.bind(B,i)),i.api.asc_registerCallback("asc_onUnLockDocumentTheme",e.bind(R,i)),i.api.asc_registerCallback("asc_onStartDemonstration",e.bind(D))),i},this.mode={},this.setMode=function(t){i.mode=t,i.mode.canCoAuthoring&&i.mode.canComments?Common.util.Shortcuts.resumeEvents("alt+h"):Common.util.Shortcuts.suspendEvents("alt+h"),i.editorConfig={user:t.user}},i.on("render:after",u,i)},render:function(){return this.fireEvent("render:before",this),this.cmpEl=t(this.el),this.fireEvent("render:after",this),this},focus:function(){var t=this;e.defer(function(){t.cmpEl.focus()},50)},addHyperlink:function(t){var e,i=this;if(i.api){for(var n=[],o=0;o0){var i=e.dataViewItems,n=t(i[0].el),o=n.outerWidth()+parseInt(n.css("margin-left"))+parseInt(n.css("margin-right")),s=Math.floor(e.options.restoreWidth/o+.5)||1,a=0,l=0;e.cmpEl.width(o*s+11);for(var r=0;rl?l=d:c.css({height:l}),a++,a>s-1&&(a=0,l=0)}e._needRecalcSlideLayout=!1}},addToLayout:function(){this.api&&this.api.asc_AddToLayout()},createDelayedElementsViewer:function(){var t=this,i=new Common.UI.MenuItem({iconCls:"menu__icon btn-copy",caption:t.textCopy,value:"copy"}).on("click",e.bind(t.onCutCopyPaste,t)),n=new Common.UI.MenuItem({iconCls:"menu__icon btn-undo",caption:t.textUndo}).on("click",function(){t.api.Undo()}),o=new Common.UI.MenuItem({caption:"--"}),s=new Common.UI.MenuItem({iconCls:"menu__icon btn-menu-comments",caption:t.addCommentText}).on("click",e.bind(t.addComment,t));this.viewModeMenu=new Common.UI.Menu({cls:"shifted-right",initMenu:function(e){n.setVisible(t.mode.canCoAuthoring&&t.mode.canComments&&!t._isDisabled),n.setDisabled(!t.api.asc_getCanUndo()&&!t._isDisabled),o.setVisible(!e.isChart&&!1!==t.api.can_AddQuotedComment()&&t.mode.canCoAuthoring&&t.mode.canComments&&!t._isDisabled),s.setVisible(!e.isChart&&!1!==t.api.can_AddQuotedComment()&&t.mode.canCoAuthoring&&t.mode.canComments&&!t._isDisabled),s.setDisabled(e.locked)},items:[i,n,o,s]}).on("hide:after",function(e,i,n){if(t.suppressEditComplete)return void(t.suppressEditComplete=!1);n||t.fireEvent("editcomplete",t),t.currentMenu=null});var a=new Common.UI.MenuItem({iconCls:"menu__icon btn-preview",caption:t.txtPreview}).on("click",function(i){var n=t.api.getCurrentPage();Common.NotificationCenter.trigger("preview:start",e.isNumber(n)?n:0)}),l=new Common.UI.MenuItem({caption:t.txtSelectAll}).on("click",function(e){t.api&&(t.api.SelectAllSlides(),t.fireEvent("editcomplete",t),Common.component.Analytics.trackEvent("DocumentHolder","Select All Slides"))}),r=new Common.UI.MenuItem({iconCls:"menu__icon btn-print",caption:t.txtPrintSelection}).on("click",function(e){if(t.api){var i=new Asc.asc_CAdjustPrint;i.asc_setPrintType(Asc.c_oAscPrintType.Selection);var n=new Asc.asc_CDownloadOptions(null,Common.Utils.isChrome||Common.Utils.isSafari||Common.Utils.isOpera);n.asc_setAdvancedOptions(i),t.api.asc_Print(n),t.fireEvent("editcomplete",t),Common.component.Analytics.trackEvent("DocumentHolder","Print Selection")}});this.viewModeMenuSlide=new Common.UI.Menu({cls:"shifted-right",initMenu:function(e){l.setDisabled(t.slidesCount<2),r.setVisible(t.mode.canPrint&&!0===e.fromThumbs),r.setDisabled(t.slidesCount<1),a.setDisabled(t.slidesCount<1)},items:[l,r,{caption:"--"},a]}).on("hide:after",function(e,i,n){if(t.suppressEditComplete)return void(t.suppressEditComplete=!1);n||t.fireEvent("editcomplete",t),t.currentMenu=null})},createDelayedElements:function(){var i=this,n=new Common.UI.MenuItem({caption:i.txtDeleteSlide}).on("click",function(t){i.api&&(i._isFromSlideMenu=!0,i.api.DeleteSlide(),i.fireEvent("editcomplete",i),Common.component.Analytics.trackEvent("DocumentHolder","Delete Slide"))}),o=new Common.UI.MenuItem({iconCls:"menu__icon btn-changeslide",caption:i.txtChangeLayout,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{template:e.template('')}]})}),s=new Common.UI.MenuItem({caption:i.txtResetLayout}).on("click",function(t){i.api&&(i.api.ResetSlide(),i.fireEvent("editcomplete",i),Common.component.Analytics.trackEvent("DocumentHolder","Reset Slide"))}),a=new Common.UI.MenuItem({caption:i.txtChangeTheme,menu:new Common.UI.Menu({menuAlign:"tl-tr",items:[{template:e.template('
    ')}]})}),l=new Common.UI.MenuItem({iconCls:"menu__icon btn-preview",caption:i.txtPreview}).on("click",function(t){var n=i.api.getCurrentPage();Common.NotificationCenter.trigger("preview:start",e.isNumber(n)?n:0)}),r=new Common.UI.MenuItem({caption:i.txtSelectAll}).on("click",function(t){i.api&&(i.api.SelectAllSlides(),i.fireEvent("editcomplete",i),Common.component.Analytics.trackEvent("DocumentHolder","Select All Slides"))}),c=new Common.UI.MenuItem({iconCls:"menu__icon btn-print",caption:i.txtPrintSelection}).on("click",function(t){if(i.api){var e=new Asc.asc_CAdjustPrint;e.asc_setPrintType(Asc.c_oAscPrintType.Selection);var n=new Asc.asc_CDownloadOptions(null,Common.Utils.isChrome||Common.Utils.isSafari||Common.Utils.isOpera);n.asc_setAdvancedOptions(e),i.api.asc_Print(n),i.fireEvent("editcomplete",i),Common.component.Analytics.trackEvent("DocumentHolder","Print Selection")}}),d=new Common.UI.MenuItem({iconCls:"menu__icon btn-paste",caption:i.textPaste,value:"paste"}).on("click",e.bind(i.onCutCopyPaste,i)),h=new Common.UI.MenuItem({iconCls:"menu__icon btn-menu-slide",caption:i.textSlideSettings,value:null}).on("click",function(t){PE.getController("RightMenu").onDoubleClickOnObject(t.options.value)}),p=new Common.UI.MenuItem({caption:i.txtSlideHide,checkable:!0,checked:!1}).on("click",function(t){i.api&&(i.api.asc_HideSlides(t.checked),i.fireEvent("editcomplete",i),Common.component.Analytics.trackEvent("DocumentHolder","Hide Slides"))});i.slideMenu=new Common.UI.Menu({cls:"shifted-right",initMenu:function(t){d.setVisible(!0!==t.fromThumbs),i.slideMenu.items[1].setVisible(!0===t.fromThumbs),i.slideMenu.items[2].setVisible(!0===t.isSlideSelect),n.setVisible(!0===t.isSlideSelect),p.setVisible(!0===t.isSlideSelect),p.setChecked(!0===t.isSlideHidden),i.slideMenu.items[5].setVisible(!0===t.isSlideSelect||!0!==t.fromThumbs),o.setVisible(!0===t.isSlideSelect||!0!==t.fromThumbs),s.setVisible(!0===t.isSlideSelect||!0!==t.fromThumbs),a.setVisible(!0===t.isSlideSelect||!0!==t.fromThumbs),h.setVisible(!0===t.isSlideSelect||!0!==t.fromThumbs),h.options.value=null;for(var u=10;u<15;u++)i.slideMenu.items[u].setVisible(!0===t.fromThumbs);c.setVisible(i.mode.canPrint&&!0===t.fromThumbs);var m=i.api.getSelectedElements(),g=!1,f=!1,b=!1;m&&e.isArray(m)&&e.each(m,function(t,e){if(Asc.c_oAscTypeSelectElement.Slide==t.get_ObjectType()){var n=t.get_ObjectValue();return g=n.get_LockDelete(),f=n.get_LockRemove(),b=n.get_LockLayout(),h.options.value=t,i.slideLayoutMenu.options.layout_index=n.get_LayoutIndex(),!1}});for(var u=0;u<3;u++)i.slideMenu.items[u].setDisabled(g);l.setDisabled(i.slidesCount<1),r.setDisabled(i.slidesCount<2),n.setDisabled(f||g),o.setDisabled(b||g),s.setDisabled(b||g),a.setDisabled(i._state.themeLock||g),p.setDisabled(b||g),c.setDisabled(i.slidesCount<1)},items:[d,new Common.UI.MenuItem({caption:i.txtNewSlide}).on("click",function(t){i.api&&(i._isFromSlideMenu=!0,i.api.AddSlide(),i.fireEvent("editcomplete",i),Common.component.Analytics.trackEvent("DocumentHolder","Add Slide"))}),new Common.UI.MenuItem({caption:i.txtDuplicateSlide}).on("click",function(t){i.api&&(i._isFromSlideMenu=!0,i.api.DublicateSlide(),i.fireEvent("editcomplete",i),Common.component.Analytics.trackEvent("DocumentHolder","Dublicate Hyperlink"))}),n,p,{caption:"--"},o,s,a,h,{caption:"--"},r,c,{caption:"--"},l]}).on("hide:after",function(t,e,n){if(i.suppressEditComplete)return void(i.suppressEditComplete=!1);n||i.fireEvent("editcomplete",i),i.currentMenu=null}).on("render:after",function(n){i.slideLayoutMenu=new Common.UI.DataView({el:t("#id-docholder-menu-changeslide"),parentMenu:o.menu,style:"max-height: 300px;",restoreWidth:302,store:PE.getCollection("SlideLayouts"),itemTemplate:e.template(['
    ','
    ','
    <%= title %>
    ',"
    "].join(""))}).on("item:click",function(t,e,n,o){i.api&&(i.api.ChangeLayout(n.get("data").idx),"click"!==o.type&&i.slideMenu.hide(),i.fireEvent("editcomplete",i),Common.component.Analytics.trackEvent("DocumentHolder","Change Layout"))}),i.slideMenu&&o.menu.on("show:after",function(t){i.onSlidePickerShowAfter(i.slideLayoutMenu),i.slideLayoutMenu.scroller.update({alwaysVisibleY:!0});var e=i.slideLayoutMenu.store.findLayoutByIndex(i.slideLayoutMenu.options.layout_index);e&&(i.slideLayoutMenu.selectRecord(e,!0),i.slideLayoutMenu.scrollToRecord(e))}),i.slideLayoutMenu._needRecalcSlideLayout=!0,i.listenTo(PE.getCollection("SlideLayouts"),"reset",function(){i.slideLayoutMenu._needRecalcSlideLayout=!0}),i.slideThemeMenu=new Common.UI.DataView({el:t("#id-docholder-menu-changetheme"),parentMenu:a.menu,style:"max-height: 300px;",store:PE.getCollection("SlideThemes"),itemTemplate:e.template(['
    ','
    background-image: url(<%= imageUrl %>);<% } %> background-position: 0 -<%= offsety %>px;">
    ',"
    "].join(""))}).on("item:click",function(t,e,n,o){i.api&&(i.api.ChangeTheme(n.get("themeId"),!0),"click"!==o.type&&i.slideMenu.hide(),i.fireEvent("editcomplete",i),Common.component.Analytics.trackEvent("DocumentHolder","Change Theme"))}),i.slideMenu&&a.menu.on("show:after",function(t){var e=i.slideThemeMenu.store.findWhere({themeId:i._state.themeId});i.slideThemeMenu.selectRecord(e,!0),i.slideThemeMenu.scroller.update({alwaysVisibleY:!0}),i.slideThemeMenu.scroller.scrollTop(0)})});var u=new Common.UI.MenuItem({iconCls:"menu__icon btn-merge",caption:i.mergeCellsText}).on("click",function(t){i.api&&i.api.MergeCells()}),m=new Common.UI.MenuItem({caption:i.splitCellsText}).on("click",function(t){i.api&&new Common.Views.InsertTableDialog({split:!0,handler:function(t,e){"ok"==t&&(i.api&&i.api.SplitCell(e.columns,e.rows),Common.component.Analytics.trackEvent("DocumentHolder","Table Split")),i.fireEvent("editcomplete",i)}}).show()}),g=new Common.UI.MenuItem({iconCls:"menu__icon btn-align-top",caption:i.cellAlignText,menu:function(){function t(t,e){if(i.api){var n=new Asc.CTableProp;n.put_CellsVAlign(t.value),i.api.tblApply(n)}i.fireEvent("editcomplete",i),Common.component.Analytics.trackEvent("DocumentHolder","Table Cell Align")}return new Common.UI.Menu({cls:"shifted-right",menuAlign:"tl-tr",items:[i.menuTableCellTop=new Common.UI.MenuItem({iconCls:"menu__icon btn-align-top",caption:i.textShapeAlignTop,checkable:!0,checkmark:!1,toggleGroup:"popuptablecellalign",value:Asc.c_oAscVertAlignJc.Top}).on("click",e.bind(t,i)),i.menuTableCellCenter=new Common.UI.MenuItem({iconCls:"menu__icon btn-align-middle",caption:i.textShapeAlignMiddle,checkable:!0,checkmark:!1,toggleGroup:"popuptablecellalign",value:Asc.c_oAscVertAlignJc.Center}).on("click",e.bind(t,i)),i.menuTableCellBottom=new Common.UI.MenuItem({iconCls:"menu__icon btn-align-bottom",caption:i.textShapeAlignBottom,checkable:!0,checkmark:!1,toggleGroup:"popuptablecellalign",value:Asc.c_oAscVertAlignJc.Bottom}).on("click",e.bind(t,i))]})}()}),f=new Common.UI.MenuItem({caption:i.textDistributeRows}).on("click",e.bind(function(){i.api&&i.api.asc_DistributeTableCells(!1),i.fireEvent("editcomplete",i)},i)),b=new Common.UI.MenuItem({caption:i.textDistributeCols}).on("click",e.bind(function(){i.api&&i.api.asc_DistributeTableCells(!0),i.fireEvent("editcomplete",i)},i));i.menuSpellTable=new Common.UI.MenuItem({caption:i.loadSpellText,disabled:!0}),i.menuSpellMoreTable=new Common.UI.MenuItem({caption:i.moreText,menu:new Common.UI.Menu({cls:"shifted-right",menuAlign:"tl-tr",restoreHeight:!0,items:[]})});var C=e.template(['','',"<%= caption %>",""].join(""));i.langTableMenu=new Common.UI.MenuItem({iconCls:"menu__icon btn-ic-doclang",caption:i.langText,menu:new Common.UI.MenuSimple({cls:"lang-menu",menuAlign:"tl-tr",restoreHeight:285,items:[],itemTemplate:C,search:!0})});var v=new Common.UI.MenuItem({caption:i.ignoreSpellText}).on("click",function(t){i.api&&(i.api.asc_ignoreMisspelledWord(i._currentSpellObj,!1),i.fireEvent("editcomplete",i))}),_=new Common.UI.MenuItem({caption:i.ignoreAllSpellText}).on("click",function(t){i.api&&(i.api.asc_ignoreMisspelledWord(i._currentSpellObj,!0),i.fireEvent("editcomplete",i))}),y=new Common.UI.MenuItem({caption:i.toDictionaryText}).on("click",function(t,e){i.api.asc_spellCheckAddToDictionary(i._currentSpellObj),i.fireEvent("editcomplete",i)}),w=new Common.UI.MenuItem({caption:"--"}),x=new Common.UI.MenuItem({caption:"--"});i.menuSpellCheckTable=new Common.UI.MenuItem({iconCls:"menu__icon btn-ic-docspell",caption:i.spellcheckText,menu:new Common.UI.Menu({cls:"shifted-right",menuAlign:"tl-tr",items:[i.menuSpellTable,i.menuSpellMoreTable,w,v,_,y,{caption:"--"},i.langTableMenu]})}),i.menuSpellPara=new Common.UI.MenuItem({caption:i.loadSpellText,disabled:!0}),i.menuSpellMorePara=new Common.UI.MenuItem({caption:i.moreText,menu:new Common.UI.Menu({cls:"shifted-right",menuAlign:"tl-tr",restoreHeight:!0,items:[]})}),i.langParaMenu=new Common.UI.MenuItem({iconCls:"menu__icon btn-ic-doclang",caption:i.langText,menu:new Common.UI.MenuSimple({cls:"lang-menu",menuAlign:"tl-tr",restoreHeight:285,items:[],itemTemplate:C,search:!0})});var S=new Common.UI.MenuItem({caption:i.ignoreSpellText}).on("click",function(t,e){i.api.asc_ignoreMisspelledWord(i._currentSpellObj,!1),i.fireEvent("editcomplete",i)}),A=new Common.UI.MenuItem({caption:i.ignoreAllSpellText}).on("click",function(t,e){i.api.asc_ignoreMisspelledWord(i._currentSpellObj,!0),i.fireEvent("editcomplete",i)}),T=new Common.UI.MenuItem({caption:i.toDictionaryText}).on("click",function(t,e){i.api.asc_spellCheckAddToDictionary(i._currentSpellObj),i.fireEvent("editcomplete",i)}),k=new Common.UI.MenuItem({caption:"--"}),I=new Common.UI.MenuItem({caption:"--"}),E=new Common.UI.MenuItem({iconCls:"menu__icon btn-menu-table",caption:i.advancedTableText}).on("click",function(t){if(i.api){var e=i.api.getSelectedElements();if(e&&e.length>0)for(var n,o,s=e.length-1;s>=0;s--)if(n=e[s].get_ObjectType(),o=e[s].get_ObjectValue(),Asc.c_oAscTypeSelectElement.Table==n){new PE.Views.TableSettingsAdvanced({ +tableProps:o,handler:function(t,e){"ok"==t&&i.api&&i.api.tblApply(e.tableProps),i.fireEvent("editcomplete",i),Common.component.Analytics.trackEvent("DocumentHolder","Table Settings Advanced")}}).show();break}}}),P=new Common.UI.MenuItem({iconCls:"menu__icon btn-menu-image",caption:i.advancedImageText}).on("click",function(t){if(i.api){var e=i.api.getSelectedElements();if(e&&e.length>0)for(var n,o,s=e.length-1;s>=0;s--)if(n=e[s].get_ObjectType(),o=e[s].get_ObjectValue(),Asc.c_oAscTypeSelectElement.Image==n){var a;Z.isDisabled()||(a=i.api.get_OriginalSizeImage())&&(a={width:a.get_ImageWidth(),height:a.get_ImageHeight()}),new PE.Views.ImageSettingsAdvanced({imageProps:o,sizeOriginal:a,handler:function(t,e){"ok"==t&&i.api&&i.api.ImgApply(e.imageProps),i.fireEvent("editcomplete",i),Common.component.Analytics.trackEvent("DocumentHolder","Image Settings Advanced")}}).show();break}}}),M=new Common.UI.MenuItem({iconCls:"menu__icon btn-menu-shape",caption:i.advancedShapeText}).on("click",function(t){if(i.api){var e=i.api.getSelectedElements();if(e&&e.length>0)for(var n,o,s=e.length-1;s>=0;s--)if(n=e[s].get_ObjectType(),o=e[s].get_ObjectValue(),Asc.c_oAscTypeSelectElement.Shape==n){new PE.Views.ShapeSettingsAdvanced({shapeProps:o,handler:function(t,e){"ok"==t&&i.api&&i.api.ShapeApply(e.shapeProps),i.fireEvent("editcomplete",i),Common.component.Analytics.trackEvent("DocumentHolder","Image Shape Advanced")}}).show();break}}}),U=new Common.UI.MenuItem({iconCls:"menu__icon btn-paragraph",caption:i.advancedParagraphText}).on("click",function(t){if(i.api){var e=i.api.getSelectedElements();if(e&&e.length>0)for(var n,o,s=e.length-1;s>=0;s--)if(n=e[s].get_ObjectType(),o=e[s].get_ObjectValue(),Asc.c_oAscTypeSelectElement.Paragraph==n){new PE.Views.ParagraphSettingsAdvanced({paragraphProps:o,api:i.api,handler:function(t,e){"ok"==t&&i.api&&i.api.paraApply(e.paragraphProps),i.fireEvent("editcomplete",i),Common.component.Analytics.trackEvent("DocumentHolder","Image Paragraph Advanced")}}).show();break}}}),D=new Common.UI.MenuItem({caption:"--"}),L=new Common.UI.MenuItem({iconCls:"menu__icon btn-inserthyperlink",caption:i.hyperlinkText}).on("click",e.bind(i.addHyperlink,i)),F=new Common.UI.MenuItem({caption:i.editHyperlinkText}).on("click",e.bind(i.editHyperlink,i)),V=new Common.UI.MenuItem({caption:i.removeHyperlinkText}).on("click",function(t){i.api&&i.api.remove_Hyperlink(),i.fireEvent("editcomplete",i),Common.component.Analytics.trackEvent("DocumentHolder","Remove Hyperlink")}),B=new Common.UI.MenuItem({iconCls:"menu__icon btn-inserthyperlink",caption:i.hyperlinkText,menu:new Common.UI.Menu({cls:"shifted-right",menuAlign:"tl-tr",items:[F,V]})}),R=new Common.UI.MenuItem({iconCls:"menu__icon btn-inserthyperlink",caption:i.hyperlinkText}).on("click",e.bind(i.addHyperlink,i)),O=new Common.UI.MenuItem({caption:i.editHyperlinkText}).on("click",e.bind(i.editHyperlink,i)),N=new Common.UI.MenuItem({caption:i.removeHyperlinkText}).on("click",function(t){i.api&&i.api.remove_Hyperlink(),i.fireEvent("editcomplete",i),Common.component.Analytics.trackEvent("DocumentHolder","Remove Hyperlink Table")}),G=new Common.UI.MenuItem({iconCls:"menu__icon btn-inserthyperlink",caption:i.hyperlinkText,menu:new Common.UI.Menu({cls:"shifted-right",menuAlign:"tl-tr",items:[O,N]})}),H=new Common.UI.MenuItem({caption:"--"}),z=new Common.UI.MenuItem({caption:this.txtGroup,iconCls:"menu__icon shape-group"}).on("click",function(t){i.api&&i.api.groupShapes(),i.fireEvent("editcomplete",this),Common.component.Analytics.trackEvent("DocumentHolder","Group Image")}),$=new Common.UI.MenuItem({caption:this.txtUngroup,iconCls:"menu__icon shape-ungroup"}).on("click",function(t){i.api&&i.api.unGroupShapes(),i.fireEvent("editcomplete",this),Common.component.Analytics.trackEvent("DocumentHolder","Ungroup Image")}),j=new Common.UI.MenuItem({caption:i.txtArrange,menu:new Common.UI.Menu({cls:"shifted-right",menuAlign:"tl-tr",items:[new Common.UI.MenuItem({caption:this.textArrangeFront,iconCls:"menu__icon arrange-front"}).on("click",function(t){i.api&&i.api.shapes_bringToFront(),i.fireEvent("editcomplete",i),Common.component.Analytics.trackEvent("DocumentHolder","Bring To Front")}),new Common.UI.MenuItem({caption:this.textArrangeBack,iconCls:"menu__icon arrange-back"}).on("click",function(t){i.api&&i.api.shapes_bringToBack(),i.fireEvent("editcomplete",i),Common.component.Analytics.trackEvent("DocumentHolder","Bring To Back")}),new Common.UI.MenuItem({caption:this.textArrangeForward,iconCls:"menu__icon arrange-forward"}).on("click",function(t){i.api&&i.api.shapes_bringForward(),i.fireEvent("editcomplete",i),Common.component.Analytics.trackEvent("DocumentHolder","Send Forward")}),new Common.UI.MenuItem({caption:this.textArrangeBackward,iconCls:"menu__icon arrange-backward"}).on("click",function(t){i.api&&i.api.shapes_bringBackward(),i.fireEvent("editcomplete",i),Common.component.Analytics.trackEvent("DocumentHolder","Send Backward")}),{caption:"--"},z,$]})}),W=new Common.UI.MenuItem({caption:i.txtAlign,menu:function(){function t(t){if(i.api){var e=i.api.asc_getSelectedDrawingObjectsCount()<2||Common.Utils.InternalSettings.get("pe-align-to-slide");e=e?Asc.c_oAscObjectsAlignType.Slide:Asc.c_oAscObjectsAlignType.Selected,t.value<6?(i.api.put_ShapesAlign(t.value,e),Common.component.Analytics.trackEvent("DocumentHolder","Shape Align")):6==t.value?(i.api.DistributeHorizontally(e),Common.component.Analytics.trackEvent("DocumentHolder","Distribute Horizontally")):7==t.value&&(i.api.DistributeVertically(e),Common.component.Analytics.trackEvent("DocumentHolder","Distribute Vertically"))}i.fireEvent("editcomplete",i)}return new Common.UI.Menu({cls:"shifted-right",menuAlign:"tl-tr",items:[new Common.UI.MenuItem({caption:i.textShapeAlignLeft,iconCls:"menu__icon shape-align-left",value:Asc.c_oAscAlignShapeType.ALIGN_LEFT}).on("click",e.bind(t,i)),new Common.UI.MenuItem({caption:i.textShapeAlignCenter,iconCls:"menu__icon shape-align-center",value:Asc.c_oAscAlignShapeType.ALIGN_CENTER}).on("click",e.bind(t,i)),new Common.UI.MenuItem({caption:i.textShapeAlignRight,iconCls:"menu__icon shape-align-right",value:Asc.c_oAscAlignShapeType.ALIGN_RIGHT}).on("click",e.bind(t,i)),new Common.UI.MenuItem({caption:i.textShapeAlignTop,iconCls:"menu__icon shape-align-top",value:Asc.c_oAscAlignShapeType.ALIGN_TOP}).on("click",e.bind(t,i)),new Common.UI.MenuItem({caption:i.textShapeAlignMiddle,iconCls:"menu__icon shape-align-middle",value:Asc.c_oAscAlignShapeType.ALIGN_MIDDLE}).on("click",e.bind(t,i)),new Common.UI.MenuItem({caption:i.textShapeAlignBottom,iconCls:"menu__icon shape-align-bottom",value:Asc.c_oAscAlignShapeType.ALIGN_BOTTOM}).on("click",e.bind(t,i)),{caption:"--"},new Common.UI.MenuItem({caption:i.txtDistribHor,iconCls:"menu__icon shape-distribute-hor",value:6}).on("click",e.bind(t,i)),new Common.UI.MenuItem({caption:i.txtDistribVert,iconCls:"menu__icon shape-distribute-vert",value:7}).on("click",e.bind(t,i))]})}()}),K=new Common.UI.MenuItem({iconCls:"menu__icon btn-menu-chart",caption:i.editChartText}).on("click",e.bind(i.editChartClick,i,void 0)),q=new Common.UI.MenuItem({iconCls:"menu__icon btn-align-top",caption:i.vertAlignText,menu:function(){function t(t){if(i.api){var e=new Asc.asc_CShapeProperty;e.put_VerticalTextAlign(t.value),i.api.ShapeApply(e)}i.fireEvent("editcomplete",i),Common.component.Analytics.trackEvent("DocumentHolder","Text Vertical Align")}return new Common.UI.Menu({cls:"shifted-right",menuAlign:"tl-tr",items:[i.menuParagraphTop=new Common.UI.MenuItem({iconCls:"menu__icon btn-align-top",caption:i.textShapeAlignTop,checkable:!0,checkmark:!1,toggleGroup:"popupparagraphvalign",value:Asc.c_oAscVAlign.Top}).on("click",e.bind(t,i)),i.menuParagraphCenter=new Common.UI.MenuItem({iconCls:"menu__icon btn-align-middle",caption:i.textShapeAlignMiddle,checkable:!0,checkmark:!1,toggleGroup:"popupparagraphvalign",value:Asc.c_oAscVAlign.Center}).on("click",e.bind(t,i)),i.menuParagraphBottom=new Common.UI.MenuItem({iconCls:"menu__icon btn-align-bottom",caption:i.textShapeAlignBottom,checkable:!0,checkmark:!1,toggleGroup:"popupparagraphvalign",value:Asc.c_oAscVAlign.Bottom}).on("click",e.bind(t,i))]})}()}),Y=function(t,e){if(i.api){var n=new Asc.asc_CShapeProperty;n.put_Vert(t.options.direction),i.api.ShapeApply(n)}i.fireEvent("editcomplete",i),Common.component.Analytics.trackEvent("DocumentHolder","Text Direction")},J=new Common.UI.MenuItem({iconCls:"menu__icon text-orient-hor",caption:i.directionText,menu:new Common.UI.Menu({cls:"shifted-right",menuAlign:"tl-tr",items:[i.menuParagraphDirectH=new Common.UI.MenuItem({caption:i.directHText,iconCls:"menu__icon text-orient-hor",checkable:!0,checkmark:!1,checked:!1,toggleGroup:"popupparagraphdirect",direction:Asc.c_oAscVertDrawingText.normal}).on("click",e.bind(Y,i)),i.menuParagraphDirect90=new Common.UI.MenuItem({caption:i.direct90Text,iconCls:"menu__icon text-orient-rdown",checkable:!0,checkmark:!1,checked:!1,toggleGroup:"popupparagraphdirect",direction:Asc.c_oAscVertDrawingText.vert}).on("click",e.bind(Y,i)),i.menuParagraphDirect270=new Common.UI.MenuItem({caption:i.direct270Text,iconCls:"menu__icon text-orient-rup",checkable:!0,checkmark:!1,checked:!1,toggleGroup:"popupparagraphdirect",direction:Asc.c_oAscVertDrawingText.vert270}).on("click",e.bind(Y,i))]})}),X=new Common.UI.MenuItem({caption:"--"}),Z=new Common.UI.MenuItem({caption:i.originalSizeText}).on("click",function(t){if(i.api){var e=i.api.get_OriginalSizeImage();if(e){var n=new Asc.asc_CImgProperty;n.put_Width(e.get_ImageWidth()),n.put_Height(e.get_ImageHeight()),n.put_ResetCrop(!0),i.api.ImgApply(n)}i.fireEvent("editcomplete",i),Common.component.Analytics.trackEvent("DocumentHolder","Set Image Original Size")}}),Q=new Common.UI.MenuItem({caption:i.textReplace,menu:new Common.UI.Menu({cls:"shifted-right",menuAlign:"tl-tr",items:[new Common.UI.MenuItem({caption:this.textFromFile}).on("click",function(t){setTimeout(function(){i.onInsertImage()},10)}),new Common.UI.MenuItem({caption:this.textFromUrl}).on("click",e.bind(i.onInsertImageUrl,i,!1)),new Common.UI.MenuItem({caption:this.textFromStorage}).on("click",function(t){Common.NotificationCenter.trigger("storage:image-load","change")})]})}),tt=function(t){var e=new Asc.asc_CShapeProperty;e.asc_putRotAdd(3.14159265358979*(1==t.value?90:270)/180),i.api.ShapeApply(e),i.fireEvent("editcomplete",i)},et=function(t){var e=new Asc.asc_CShapeProperty;1==t.value?e.asc_putFlipHInvert(!0):e.asc_putFlipVInvert(!0),i.api.ShapeApply(e),i.fireEvent("editcomplete",i)},it=new Common.UI.MenuItem({caption:i.textRotate,menu:new Common.UI.Menu({cls:"shifted-right",menuAlign:"tl-tr",items:[new Common.UI.MenuItem({iconCls:"menu__icon btn-rotate-90",caption:i.textRotate90,value:1}).on("click",e.bind(tt,i)),new Common.UI.MenuItem({iconCls:"menu__icon btn-rotate-270",caption:i.textRotate270,value:0}).on("click",e.bind(tt,i)),{caption:"--"},new Common.UI.MenuItem({iconCls:"menu__icon btn-flip-hor",caption:i.textFlipH,value:1}).on("click",e.bind(et,i)),new Common.UI.MenuItem({iconCls:"menu__icon btn-flip-vert",caption:i.textFlipV,value:0}).on("click",e.bind(et,i))]})}),nt=function(t){1==t.value?i.api.asc_cropFill():2==t.value?i.api.asc_cropFit():t.checked?i.api.asc_startEditCrop():i.api.asc_endEditCrop(),i.fireEvent("editcomplete",i)};i.menuImgCrop=new Common.UI.MenuItem({caption:i.textCrop,menu:new Common.UI.Menu({cls:"shifted-right",menuAlign:"tl-tr",items:[new Common.UI.MenuItem({caption:i.textCrop,checkable:!0,allowDepress:!0,value:0}).on("click",e.bind(nt,i)),new Common.UI.MenuItem({caption:i.textCropFill,value:1}).on("click",e.bind(nt,i)),new Common.UI.MenuItem({caption:i.textCropFit,value:2}).on("click",e.bind(nt,i))]})});var ot=new Common.UI.MenuItem({iconCls:"menu__icon btn-menu-comments",caption:i.addCommentText}).on("click",e.bind(i.addComment,i));ot.hide();var st=new Common.UI.MenuItem({iconCls:"menu__icon btn-menu-comments",caption:i.addCommentText}).on("click",e.bind(i.addComment,i));st.hide();var at=new Common.UI.MenuItem({caption:"--"});at.hide();var lt=new Common.UI.MenuItem({iconCls:"menu__icon btn-menu-comments",caption:i.addCommentText}).on("click",e.bind(i.addComment,i));lt.hide();var rt=new Common.UI.MenuItem({caption:i.addToLayoutText}).on("click",e.bind(i.addToLayout,i)),ct=new Common.UI.MenuItem({iconCls:"menu__icon btn-copy",caption:i.textCopy,value:"copy"}).on("click",e.bind(i.onCutCopyPaste,i)),dt=new Common.UI.MenuItem({iconCls:"menu__icon btn-paste",caption:i.textPaste,value:"paste"}).on("click",e.bind(i.onCutCopyPaste,i)),ht=new Common.UI.MenuItem({iconCls:"menu__icon btn-cut",caption:i.textCut,value:"cut"}).on("click",e.bind(i.onCutCopyPaste,i)),pt=new Common.UI.MenuItem({iconCls:"menu__icon btn-copy",caption:i.textCopy,value:"copy"}).on("click",e.bind(i.onCutCopyPaste,i)),ut=new Common.UI.MenuItem({iconCls:"menu__icon btn-paste",caption:i.textPaste,value:"paste"}).on("click",e.bind(i.onCutCopyPaste,i)),mt=new Common.UI.MenuItem({iconCls:"menu__icon btn-cut",caption:i.textCut,value:"cut"}).on("click",e.bind(i.onCutCopyPaste,i)),gt=new Common.UI.MenuItem({iconCls:"menu__icon btn-copy",caption:i.textCopy,value:"copy"}).on("click",e.bind(i.onCutCopyPaste,i)),ft=new Common.UI.MenuItem({iconCls:"menu__icon btn-paste",caption:i.textPaste,value:"paste"}).on("click",e.bind(i.onCutCopyPaste,i)),bt=new Common.UI.MenuItem({iconCls:"menu__icon btn-cut",caption:i.textCut,value:"cut"}).on("click",e.bind(i.onCutCopyPaste,i)),Ct=new Common.UI.MenuItem({caption:"--"}),vt=(new Common.UI.MenuItem({caption:"--"}),new Common.UI.MenuItem({caption:i.addToLayoutText}).on("click",e.bind(i.addToLayout,i)));i.textMenu=new Common.UI.Menu({cls:"shifted-right",initMenu:function(t){var n=t.shapeProps&&!e.isNull(t.shapeProps.value),o=t.chartProps&&!e.isNull(t.chartProps.value),s=void 0!==t.paraProps&&t.paraProps.locked||void 0!==t.slideProps&&t.slideProps.locked||n&&t.shapeProps.locked,a=t.mathProps&&t.mathProps.value;if(i._currentParaObjDisabled=s,q.setVisible(n&&!o&&!a),J.setVisible(n&&!o&&!a),n||o){var l=t.shapeProps.value.get_VerticalTextAlign(),r="";switch(l){case Asc.c_oAscVAlign.Top:r="menu__icon btn-align-top";break;case Asc.c_oAscVAlign.Center:r="menu__icon btn-align-middle";break;case Asc.c_oAscVAlign.Bottom:r="menu__icon btn-align-bottom"}q.setIconCls(r),i.menuParagraphTop.setChecked(l==Asc.c_oAscVAlign.Top),i.menuParagraphCenter.setChecked(l==Asc.c_oAscVAlign.Center),i.menuParagraphBottom.setChecked(l==Asc.c_oAscVAlign.Bottom);var c=t.shapeProps.value.get_Vert();switch(r="",c){case Asc.c_oAscVertDrawingText.normal:r="menu__icon text-orient-hor";break;case Asc.c_oAscVertDrawingText.vert:r="menu__icon text-orient-rdown";break;case Asc.c_oAscVertDrawingText.vert270:r="menu__icon text-orient-rup"}J.setIconCls(r),i.menuParagraphDirectH.setChecked(c==Asc.c_oAscVertDrawingText.normal),i.menuParagraphDirect90.setChecked(c==Asc.c_oAscVertDrawingText.vert),i.menuParagraphDirect270.setChecked(c==Asc.c_oAscVertDrawingText.vert270)}else q.setIconCls(""),J.setIconCls("");q.setDisabled(s),J.setDisabled(s);var d=null;i.api&&(d=i.api.can_AddHyperlink()),L.setVisible(void 0===t.hyperProps&&!1!==d),B.setVisible(void 0!==t.hyperProps),F.hyperProps=t.hyperProps,!1!==d&&(L.hyperProps={},L.hyperProps.value=new Asc.CHyperlinkProperty,L.hyperProps.value.put_Text(d)),ot.setVisible(!o&&n&&!1!==i.api.can_AddQuotedComment()&&i.mode.canCoAuthoring&&i.mode.canComments),D.setVisible(ot.isVisible()||L.isVisible()||B.isVisible()),L.setDisabled(s),B.setDisabled(s),ot.setDisabled(s),U.setDisabled(s),ht.setDisabled(s),dt.setDisabled(s);var h=void 0!==t.spellProps&&!1===t.spellProps.value.get_Checked();i.menuSpellPara.setVisible(h),I.setVisible(h),S.setVisible(h),A.setVisible(h),T.setVisible(h&&i.mode.isDesktopApp),i.langParaMenu.setVisible(h),i.langParaMenu.setDisabled(s),k.setVisible(h),h&&null!==t.spellProps.value.get_Variants()&&void 0!==t.spellProps.value.get_Variants()?i.addWordVariants(!0):(i.menuSpellPara.setCaption(i.loadSpellText,!0),i.clearWordVariants(!0),i.menuSpellMorePara.setVisible(!1)),i.langParaMenu.isVisible()&&i._currLang.id!==i._currLang.paraid&&(i.changeLanguageMenu(i.langParaMenu.menu),i._currLang.paraid=i._currLang.id);var p=0;a?p=i.addEquationMenu(!0,12):i.clearEquationMenu(!0,12),Ct.setVisible(a&&p>0)},items:[i.menuSpellPara,i.menuSpellMorePara,I,S,A,T,i.langParaMenu,k,ht,ct,dt,Ct,{caption:"--"},q,J,U,D,ot,L,B]}).on("hide:after",function(t,e,n){if(i.suppressEditComplete)return void(i.suppressEditComplete=!1);n||i.fireEvent("editcomplete",i),i.currentMenu=null}),i.tableMenu=new Common.UI.Menu({cls:"shifted-right",initMenu:function(t){if(!e.isUndefined(t.tableProps)){for(var n=t.mathProps&&t.mathProps.value,o=6;o<19;o++)i.tableMenu.items[o].setVisible(!n);var s=void 0!==t.slideProps&&t.slideProps.locked,a=t.tableProps.value.get_CellsVAlign(),l="";switch(a){case Asc.c_oAscVertAlignJc.Top:l="menu__icon btn-align-top";break;case Asc.c_oAscVertAlignJc.Center:l="menu__icon btn-align-middle";break;case Asc.c_oAscVertAlignJc.Bottom:l="menu__icon btn-align-bottom"}g.setIconCls(l),i.menuTableCellTop.setChecked(a==Asc.c_oAscVertAlignJc.Top),i.menuTableCellCenter.setChecked(a==Asc.c_oAscVertAlignJc.Center),i.menuTableCellBottom.setChecked(a==Asc.c_oAscVertAlignJc.Bottom),i.api&&(u.setDisabled(t.tableProps.locked||s||!i.api.CheckBeforeMergeCells()),m.setDisabled(t.tableProps.locked||s||!i.api.CheckBeforeSplitCells())),f.setDisabled(t.tableProps.locked||s),b.setDisabled(t.tableProps.locked||s),i.tableMenu.items[7].setDisabled(t.tableProps.locked||s),i.tableMenu.items[8].setDisabled(t.tableProps.locked||s),g.setDisabled(t.tableProps.locked||s),E.setDisabled(t.tableProps.locked||s),bt.setDisabled(t.tableProps.locked||s),ft.setDisabled(t.tableProps.locked||s);var r=null;i.api&&(r=i.api.can_AddHyperlink()),R.setVisible(!e.isUndefined(t.paraProps)&&e.isUndefined(t.hyperProps)&&!1!==r),G.setVisible(!e.isUndefined(t.paraProps)&&!e.isUndefined(t.hyperProps)),O.hyperProps=t.hyperProps,!1!==r&&(R.hyperProps={},R.hyperProps.value=new Asc.CHyperlinkProperty,R.hyperProps.value.put_Text(r)),e.isUndefined(t.paraProps)||(R.setDisabled(t.paraProps.locked||s),G.setDisabled(t.paraProps.locked||s),i._currentParaObjDisabled=t.paraProps.locked||s),st.setVisible(!1!==i.api.can_AddQuotedComment()&&i.mode.canCoAuthoring&&i.mode.canComments),st.setDisabled(!e.isUndefined(t.paraProps)&&t.paraProps.locked||s),H.setVisible(R.isVisible()||G.isVisible()||st.isVisible()),i.menuSpellCheckTable.setVisible(void 0!==t.spellProps&&!1===t.spellProps.value.get_Checked()),y.setVisible(i.mode.isDesktopApp),x.setVisible(void 0!==t.spellProps&&!1===t.spellProps.value.get_Checked()),i.langTableMenu.setDisabled(s),void 0!==t.spellProps&&!1===t.spellProps.value.get_Checked()&&null!==t.spellProps.value.get_Variants()&&void 0!==t.spellProps.value.get_Variants()?i.addWordVariants(!1):(i.menuSpellTable.setCaption(i.loadSpellText,!0),i.clearWordVariants(!1),i.menuSpellMoreTable.setVisible(!1)),i.menuSpellCheckTable.isVisible()&&i._currLang.id!==i._currLang.tableid&&(i.changeLanguageMenu(i.langTableMenu.menu),i._currLang.tableid=i._currLang.id);var c=0;n?(c=i.addEquationMenu(!1,6),H.setVisible(H.isVisible()&&c>0)):i.clearEquationMenu(!1,6)}},items:[i.menuSpellCheckTable,x,bt,gt,ft,{caption:"--"},new Common.UI.MenuItem({caption:i.selectText,menu:new Common.UI.Menu({cls:"shifted-right",menuAlign:"tl-tr",items:[new Common.UI.MenuItem({caption:i.rowText}).on("click",function(){i.api&&i.api.selectRow()}),new Common.UI.MenuItem({caption:i.columnText}).on("click",function(){i.api&&i.api.selectColumn()}),new Common.UI.MenuItem({caption:i.cellText}).on("click",function(){i.api&&i.api.selectCell()}),new Common.UI.MenuItem({caption:i.tableText}).on("click",function(){i.api&&i.api.selectTable()})]})}),{iconCls:"menu__icon btn-addcell",caption:i.insertText,menu:new Common.UI.Menu({cls:"shifted-right",menuAlign:"tl-tr",style:"width: 100px",items:[new Common.UI.MenuItem({caption:i.insertColumnLeftText}).on("click",function(t){i.api&&i.api.addColumnLeft()}),new Common.UI.MenuItem({caption:i.insertColumnRightText}).on("click",function(t){i.api&&i.api.addColumnRight()}),new Common.UI.MenuItem({caption:i.insertRowAboveText}).on("click",function(t){i.api&&i.api.addRowAbove()}),new Common.UI.MenuItem({caption:i.insertRowBelowText}).on("click",function(t){i.api&&i.api.addRowBelow()})]})},new Common.UI.MenuItem({iconCls:"menu__icon btn-delcell",caption:i.deleteText,menu:new Common.UI.Menu({cls:"shifted-right",menuAlign:"tl-tr",items:[new Common.UI.MenuItem({caption:i.rowText}).on("click",function(){i.api&&i.api.remRow()}),new Common.UI.MenuItem({caption:i.columnText}).on("click",function(){i.api&&i.api.remColumn()}),new Common.UI.MenuItem({caption:i.tableText}).on("click",function(){i.api&&i.api.remTable()})]})}),{caption:"--"},u,m,{caption:"--"},f,b,{caption:"--"},g,{caption:"--"},E,H,st,R,G,{caption:"--"},vt]}).on("hide:after",function(t,e,n){if(i.suppressEditComplete)return void(i.suppressEditComplete=!1);n||i.fireEvent("editcomplete",i),i.currentMenu=null}),i.pictureMenu=new Common.UI.Menu({cls:"shifted-right",initMenu:function(t){i.api&&($.setDisabled(!i.api.canUnGroup()),z.setDisabled(!i.api.canGroup()));var n=(e.isUndefined(t.shapeProps)||t.shapeProps.value.get_FromImage())&&e.isUndefined(t.chartProps),o=void 0!==t.imgProps&&t.imgProps.locked,s=void 0!==t.shapeProps&&t.shapeProps.locked,a=void 0!==t.chartProps&&t.chartProps.locked,l=o||s||a||void 0!==t.slideProps&&t.slideProps.locked,r=t.imgProps?t.imgProps.value.asc_getPluginGuid():null;if(it.setVisible(e.isUndefined(t.chartProps)&&(null===r||void 0===r)),it.isVisible()&&it.setDisabled(l),Z.setVisible(n),Z.isVisible()&&Z.setDisabled(l||e.isNull(t.imgProps.value.get_ImageUrl())||e.isUndefined(t.imgProps.value.get_ImageUrl())),Q.setVisible(n&&(null===r||void 0===r)),Q.isVisible()&&Q.setDisabled(l||null===r),Q.menu.items[2].setVisible(i.mode.canRequestInsertImage||i.mode.fileChoiceUrl&&i.mode.fileChoiceUrl.indexOf("{documentType}")>-1),i.menuImgCrop.setVisible(i.api.asc_canEditCrop()),i.menuImgCrop.isVisible()&&i.menuImgCrop.setDisabled(l),P.setVisible(n),M.setVisible(e.isUndefined(t.imgProps)&&e.isUndefined(t.chartProps)),K.setVisible(e.isUndefined(t.imgProps)&&!e.isUndefined(t.chartProps)&&(e.isUndefined(t.shapeProps)||t.shapeProps.isChart)),X.setVisible(P.isVisible()||M.isVisible()||K.isVisible()),lt.setVisible(!1!==i.api.can_AddQuotedComment()&&i.mode.canCoAuthoring&&i.mode.canComments),at.setVisible(lt.isVisible()),lt.setDisabled(l),W.setDisabled(l),!l){var c=i.api.asc_getSelectedDrawingObjectsCount(),d=Common.Utils.InternalSettings.get("pe-align-to-slide")||!1;W.menu.items[7].setDisabled(2==c&&!d),W.menu.items[8].setDisabled(2==c&&!d)}P.setDisabled(l),M.setDisabled(l),K.isVisible()&&K.setDisabled(l),mt.setDisabled(l),ut.setDisabled(l)},items:[mt,pt,ut,{caption:"--"},j,W,it,X,i.menuImgCrop,Z,Q,P,M,K,at,lt,{caption:"--"},rt]}).on("hide:after",function(t,e,n){if(i.suppressEditComplete)return void(i.suppressEditComplete=!1);n||i.fireEvent("editcomplete",i),i.currentMenu=null});var _t=t("#id_buttonNextPage");_t.attr("data-toggle","tooltip"),_t.tooltip({title:i.textNextPage+Common.Utils.String.platformKey("PgDn"),placement:"top-right"});var yt=t("#id_buttonPrevPage");yt.attr("data-toggle","tooltip"),yt.tooltip({title:i.textPrevPage+Common.Utils.String.platformKey("PgUp"),placement:"top-right"})},setLanguages:function(t){var i=this;if(t&&t.length>0&&i.langParaMenu&&i.langTableMenu){var n=[],o=[];e.each(t,function(t){var i={caption:t.displayValue,value:t.value,checkable:!0,langid:t.code,spellcheck:t.spellcheck};n.push(i),o.push(e.clone(i))}),i.langParaMenu.menu.resetItems(n),i.langTableMenu.menu.resetItems(o),i.langParaMenu.menu.on("item:click",function(t,n){i.api&&(e.isUndefined(n.langid)||i.api.put_TextPrLang(n.langid),i._currLang.paraid=n.langid,i.fireEvent("editcomplete",i))}),i.langTableMenu.menu.on("item:click",function(t,n,o){i.api&&(e.isUndefined(n.langid)||i.api.put_TextPrLang(n.langid),i._currLang.tableid=n.langid,i.fireEvent("editcomplete",i))})}},SetDisabled:function(t){this._isDisabled=t},onInsertImage:function(t,e,i,n){this.api&&(t?this.api.asc_addImage(e):this.api.ChangeImageFromFile()),this.fireEvent("editcomplete",this)},onInsertImageUrl:function(t,i,n,o){var s=this;new Common.Views.ImageFromUrlDialog({handler:function(n,o){if("ok"==n&&s.api){var a=o.replace(/ /g,"");if(!e.isEmpty(a))if(t)s.api.AddImageUrl(a,void 0,void 0,i);else{var l=new Asc.asc_CImgProperty;l.put_ImageUrl(a),s.api.ImgApply(l,i)}}s.fireEvent("editcomplete",s)}}).show()},onClickPlaceholderChart:function(i,n,o){if(this.api){this._state.placeholderObj=i;var s=this.placeholderMenuChart,a=s?this.cmpEl.find(Common.Utils.String.format("#menu-container-{0}",s.id)):null,l=this;if(this._fromShowPlaceholder=!0,Common.UI.Menu.Manager.hideAll(),!s){this.placeholderMenuChart=s=new Common.UI.Menu({style:"width: 364px;padding-top: 12px;",items:[{template:e.template('')}]}),a=t(Common.Utils.String.format('',s.id)),this.cmpEl.append(a),s.render(a),s.cmpEl.attr({tabindex:"-1"}),s.on("hide:after",function(){l._fromShowPlaceholder||l.api.asc_uncheckPlaceholders()});new Common.UI.DataView({el:t("#id-placeholder-menu-chart"),parentMenu:s,showLast:!1,groups:new Common.UI.DataViewGroupStore(Common.define.chartData.getChartGroupData()),store:new Common.UI.DataViewStore(Common.define.chartData.getChartData()),itemTemplate:e.template('
    ')}).on("item:click",function(t,e,i,n){l.editChartClick(i.get("type"),l._state.placeholderObj)})}a.css({left:n,top:o}),a.attr("data-value","prevent-canvas-click"),this._preventClick=!0,s.show(),s.alignPosition(),e.delay(function(){s.cmpEl.find(".dataview").focus()},10),this._fromShowPlaceholder=!1}},onClickPlaceholderTable:function(i,n,o){if(this.api){this._state.placeholderObj=i;var s=this.placeholderMenuTable,a=s?this.cmpEl.find(Common.Utils.String.format("#menu-container-{0}",s.id)):null,l=this;if(this._fromShowPlaceholder=!0,Common.UI.Menu.Manager.hideAll(),!s){this.placeholderMenuTable=s=new Common.UI.Menu({cls:"shifted-left",items:[{template:e.template('
    ')},{caption:l.mniCustomTable,value:"custom"}]}),a=t(Common.Utils.String.format('',s.id)),this.cmpEl.append(a),s.render(a),s.cmpEl.attr({tabindex:"-1"}),s.on("hide:after",function(){l._fromShowPlaceholder||l.api.asc_uncheckPlaceholders()});new Common.UI.DimensionPicker({el:t("#id-placeholder-menu-tablepicker"),minRows:8,minColumns:10,maxRows:8,maxColumns:10}).on("select",function(t,e,i){l.api.put_Table(e,i,l._state.placeholderObj),l.fireEvent("editcomplete",l)}),s.on("item:click",function(t,e,i){"custom"===e.value&&new Common.Views.InsertTableDialog({handler:function(t,e){"ok"==t&&l.api.put_Table(e.columns,e.rows,l._state.placeholderObj),l.fireEvent("editcomplete",l)}}).show()})}a.css({left:n,top:o}),a.attr("data-value","prevent-canvas-click"),this._preventClick=!0,s.show(),s.alignPosition(),e.delay(function(){s.cmpEl.focus()},10),this._fromShowPlaceholder=!1}},onHidePlaceholderActions:function(){this.placeholderMenuChart&&this.placeholderMenuChart.hide(),this.placeholderMenuTable&&this.placeholderMenuTable.hide()},onClickPlaceholder:function(t,e,i,n){this.api&&(t==AscCommon.PlaceholderButtonType.Video?this.api.asc_AddVideo(e):t==AscCommon.PlaceholderButtonType.Audio&&this.api.asc_AddAudio(e),this.fireEvent("editcomplete",this))},insertRowAboveText:"Row Above",insertRowBelowText:"Row Below",insertColumnLeftText:"Column Left",insertColumnRightText:"Column Right",deleteText:"Delete",deleteRowText:"Delete Row",deleteColumnText:"Delete Column",deleteTableText:"Delete Table",mergeCellsText:"Merge Cells",splitCellsText:"Split Cell...",splitCellTitleText:"Split Cell",originalSizeText:"Actual Size",advancedImageText:"Image Advanced Settings",hyperlinkText:"Hyperlink",editHyperlinkText:"Edit Hyperlink",removeHyperlinkText:"Remove Hyperlink",txtPressLink:"Press CTRL and click link",selectText:"Select",insertRowText:"Insert Row",insertColumnText:"Insert Column",rowText:"Row",columnText:"Column",cellText:"Cell",tableText:"Table",aboveText:"Above",belowText:"Below",advancedTableText:"Table Advanced Settings",txtSelectAll:"Select All",txtNewSlide:"New Slide",txtDuplicateSlide:"Duplicate Slide",txtDeleteSlide:"Delete Slide",txtBackground:"Background",txtChangeLayout:"Change Layout",txtPreview:"Start slideshow",textShapeAlignLeft:"Align Left",textShapeAlignRight:"Align Right",textShapeAlignCenter:"Align Center",textShapeAlignTop:"Align Top",textShapeAlignBottom:"Align Bottom",textShapeAlignMiddle:"Align Middle",textArrangeFront:"Bring To Front",textArrangeBack:"Send To Back",textArrangeForward:"Bring Forward",textArrangeBackward:"Send Backward",txtGroup:"Group",txtUngroup:"Ungroup",txtArrange:"Arrange",txtAlign:"Align",txtDistribHor:"Distribute Horizontally",txtDistribVert:"Distribute Vertically",txtSlide:"Slide",cellAlignText:"Cell Vertical Alignment",advancedShapeText:"Shape Advanced Settings",addCommentText:"Add Comment",editChartText:"Edit Data",vertAlignText:"Vertical Alignment",advancedParagraphText:"Text Advanced Settings",tipIsLocked:"This element is currently being edited by another user.",textNextPage:"Next Slide",textPrevPage:"Previous Slide",insertText:"Insert",textCopy:"Copy",textPaste:"Paste",textCut:"Cut",textSlideSettings:"Slide Settings",directionText:"Text Direction",directHText:"Horizontal",direct90Text:"Rotate Text Down",direct270Text:"Rotate Text Up",txtRemoveAccentChar:"Remove accent character",txtBorderProps:"Borders property",txtHideTop:"Hide top border",txtHideBottom:"Hide bottom border",txtHideLeft:"Hide left border",txtHideRight:"Hide right border",txtHideHor:"Hide horizontal line",txtHideVer:"Hide vertical line",txtHideLT:"Hide left top line",txtHideLB:"Hide left bottom line",txtAddTop:"Add top border",txtAddBottom:"Add bottom border",txtAddLeft:"Add left border",txtAddRight:"Add right border",txtAddHor:"Add horizontal line",txtAddVer:"Add vertical line",txtAddLT:"Add left top line",txtAddLB:"Add left bottom line",txtRemoveBar:"Remove bar",txtOverbar:"Bar over text",txtUnderbar:"Bar under text",txtRemScripts:"Remove scripts",txtRemSubscript:"Remove subscript",txtRemSuperscript:"Remove superscript",txtScriptsAfter:"Scripts after text",txtScriptsBefore:"Scripts before text",txtFractionStacked:"Change to stacked fraction",txtFractionSkewed:"Change to skewed fraction",txtFractionLinear:"Change to linear fraction",txtRemFractionBar:"Remove fraction bar",txtAddFractionBar:"Add fraction bar",txtRemLimit:"Remove limit",txtLimitOver:"Limit over text",txtLimitUnder:"Limit under text",txtHidePlaceholder:"Hide placeholder",txtShowPlaceholder:"Show placeholder",txtMatrixAlign:"Matrix alignment",txtColumnAlign:"Column alignment",txtTop:"Top",txtBottom:"Bottom",txtInsertEqBefore:"Insert equation before",txtInsertEqAfter:"Insert equation after",txtDeleteEq:"Delete equation",txtLimitChange:"Change limits location",txtHideTopLimit:"Hide top limit",txtShowTopLimit:"Show top limit",txtHideBottomLimit:"Hide bottom limit",txtShowBottomLimit:"Show bottom limit",txtInsertArgBefore:"Insert argument before",txtInsertArgAfter:"Insert argument after",txtDeleteArg:"Delete argument",txtHideOpenBracket:"Hide opening bracket",txtShowOpenBracket:"Show opening bracket",txtHideCloseBracket:"Hide closing bracket",txtShowCloseBracket:"Show closing bracket",txtStretchBrackets:"Stretch brackets",txtMatchBrackets:"Match brackets to argument height", +txtGroupCharOver:"Char over text",txtGroupCharUnder:"Char under text",txtDeleteGroupChar:"Delete char",txtHideDegree:"Hide degree",txtShowDegree:"Show degree",txtIncreaseArg:"Increase argument size",txtDecreaseArg:"Decrease argument size",txtInsertBreak:"Insert manual break",txtDeleteBreak:"Delete manual break",txtAlignToChar:"Align to character",txtDeleteRadical:"Delete radical",txtDeleteChars:"Delete enclosing characters",txtDeleteCharsAndSeparators:"Delete enclosing characters and separators",alignmentText:"Alignment",leftText:"Left",rightText:"Right",centerText:"Center",loadSpellText:"Loading variants...",ignoreAllSpellText:"Ignore All",ignoreSpellText:"Ignore",noSpellVariantsText:"No variants",moreText:"More variants...",spellcheckText:"Spellcheck",langText:"Select Language",textUndo:"Undo",txtSlideHide:"Hide Slide",txtChangeTheme:"Change Theme",txtKeepTextOnly:"Keep text only",txtPastePicture:"Picture",txtPasteSourceFormat:"Keep source formatting",txtPasteDestFormat:"Use destination theme",textDistributeRows:"Distribute rows",textDistributeCols:"Distribute columns",textReplace:"Replace image",textFromUrl:"From URL",textFromFile:"From File",textRotate270:"Rotate 90° Counterclockwise",textRotate90:"Rotate 90° Clockwise",textFlipV:"Flip Vertically",textFlipH:"Flip Horizontally",textRotate:"Rotate",textCrop:"Crop",textCropFill:"Fill",textCropFit:"Fit",toDictionaryText:"Add to Dictionary",txtPrintSelection:"Print Selection",addToLayoutText:"Add to Layout",txtResetLayout:"Reset Slide",mniCustomTable:"Insert Custom Table",textFromStorage:"From Storage"},PE.Views.DocumentHolder||{}))});var c_paragraphLinerule={LINERULE_LEAST:0,LINERULE_AUTO:1,LINERULE_EXACT:2},c_tableBorder={BORDER_VERTICAL_LEFT:0,BORDER_HORIZONTAL_TOP:1,BORDER_VERTICAL_RIGHT:2,BORDER_HORIZONTAL_BOTTOM:3,BORDER_VERTICAL_CENTER:4,BORDER_HORIZONTAL_CENTER:5,BORDER_INNER:6,BORDER_OUTER:7,BORDER_ALL:8,BORDER_NONE:9,BORDER_ALL_TABLE:10,BORDER_NONE_TABLE:11,BORDER_INNER_TABLE:12,BORDER_OUTER_TABLE:13},c_paragraphTextAlignment={RIGHT:0,LEFT:1,CENTERED:2,JUSTIFIED:3},c_paragraphSpecial={NONE_SPECIAL:0,FIRST_LINE:1,HANGING:2};if(define("presentationeditor/main/app/controller/DocumentHolder",["core","presentationeditor/main/app/view/DocumentHolder"],function(){"use strict";PE.Controllers.DocumentHolder=Backbone.Controller.extend({models:[],collections:[],views:["DocumentHolder"],initialize:function(){},onLaunch:function(){this.documentHolder=this.createView("DocumentHolder").render(),this.documentHolder.el.tabIndex=-1},setApi:function(t){this.api=t},createDelayedElements:function(){var t=this.getApplication().getController("Common.Controllers.ExternalDiagramEditor").getView("Common.Views.ExternalDiagramEditor");t&&(t.on("internalmessage",_.bind(function(e,i){var n=(i.data.command,i.data.data);this.api&&(t.isEditMode()?this.api.asc_editChartDrawingObject(n):this.api.asc_addChartDrawingObject(n,t.getPlaceholder()))},this)),t.on("hide",_.bind(function(t,e){this.api&&(this.api.asc_onCloseChartFrame(),this.api.asc_enableKeyEvents(!0));var i=this;setTimeout(function(){i.documentHolder.fireEvent("editcomplete",i.documentHolder)},10)},this)))}})}),define("common/main/lib/view/ImageFromUrlDialog",["common/main/lib/component/Window"],function(){"use strict";Common.Views.ImageFromUrlDialog=Common.UI.Window.extend(_.extend({options:{width:330,header:!1,cls:"modal-dlg",buttons:["ok","cancel"]},initialize:function(t){_.extend(this.options,t||{}),this.template=['
    ','
    ',"","
    ",'
    ',"
    "].join(""),this.options.tpl=_.template(this.template)(this.options),Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this);var t=this;t.inputUrl=new Common.UI.InputField({el:$("#id-dlg-url"),allowBlank:!1,blankError:t.txtEmpty,style:"width: 100%;",validateOnBlur:!1,validation:function(e){return!!/((^https?)|(^ftp)):\/\/.+/i.test(e)||t.txtNotUrl}}),this.getChild().find(".btn").on("click",_.bind(this.onBtnClick,this))},show:function(){Common.UI.Window.prototype.show.apply(this,arguments);var t=this;_.delay(function(){t.getChild("input").focus()},100)},onPrimary:function(t){return this._handleInput("ok"),!1},onBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value)},_handleInput:function(t){if(this.options.handler){if("ok"==t&&!0!==this.inputUrl.checkValidate())return void this.inputUrl.cmpEl.find("input").focus();this.options.handler.call(this,t,this.inputUrl.getValue())}this.close()},textUrl:"Paste an image URL:",txtEmpty:"This field is required",txtNotUrl:'This field should be a URL in the format "http://www.example.com"'},Common.Views.ImageFromUrlDialog||{}))}),void 0===Common)var Common={};if(define("common/main/lib/view/InsertTableDialog",["common/main/lib/component/Window"],function(){"use strict";Common.Views.InsertTableDialog=Common.UI.Window.extend(_.extend({options:{width:230,height:156,style:"min-width: 230px;",cls:"modal-dlg",split:!1,buttons:["ok","cancel"]},initialize:function(t){_.extend(this.options,{title:t.split?this.txtTitleSplit:this.txtTitle},t||{}),this.template=['
    ','
    ','
    ',"
    ",'
    ','
    ',"
    ","
    "].join(""),this.options.tpl=_.template(this.template)(this.options),Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this);var t=this.getChild();t.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this)),this.udColumns=new Common.UI.MetricSpinner({el:t.find(".columns-val"),step:1,width:64,value:2,defaultUnit:"",maxValue:63,minValue:1,allowDecimal:!1}),this.udRows=new Common.UI.MetricSpinner({el:t.find(".rows-val"),step:1,width:64,value:2,defaultUnit:"",maxValue:100,minValue:1,allowDecimal:!1})},getFocusedComponents:function(){return[this.udColumns,this.udRows]},getDefaultFocusableComponent:function(){return this.udColumns},onBtnClick:function(t){this.options.handler&&this.options.handler.call(this,t.currentTarget.attributes.result.value,{columns:this.udColumns.getNumberValue(),rows:this.udRows.getNumberValue()}),this.close()},onPrimary:function(){return this.options.handler&&this.options.handler.call(this,"ok",{columns:this.udColumns.getNumberValue(),rows:this.udRows.getNumberValue()}),this.close(),!1},txtTitle:"Table Size",txtTitleSplit:"Split Cell",txtColumns:"Number of Columns",txtRows:"Number of Rows",textInvalidRowsCols:"You need to specify valid rows and columns count.",txtMinText:"The minimum value for this field is {0}",txtMaxText:"The maximum value for this field is {0}"},Common.Views.InsertTableDialog||{}))}),void 0===Common)var Common={};if(define("common/main/lib/component/LoadMask",["common/main/lib/component/BaseView"],function(){"use strict";Common.UI.LoadMask=Common.UI.BaseView.extend(function(){return{options:{cls:"",style:"",title:"Loading...",owner:document.body},template:_.template(['"].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t),this.template=this.options.template||this.template,this.title=this.options.title,this.ownerEl=this.options.owner instanceof Common.UI.BaseView?$(this.options.owner.el):$(this.options.owner),this.loaderEl=$(this.template({id:this.id,cls:this.options.cls,style:this.options.style,title:this.title})),this.maskeEl=$('
    '),this.timerId=0},render:function(){return this},show:function(){var t=this.ownerEl,e=this.loaderEl,i=this.maskeEl;if(t.ismasked)return this;t.ismasked=!0;var n=this;return n.title!=n.options.title&&(n.options.title=n.title,$(".asc-loadmask-title",e).html(n.title)),n.timerId=setTimeout(function(){t.append(i),t.append(e),t&&0==t.closest(".asc-window.modal").length&&Common.util.Shortcuts.suspendEvents()},500),this},hide:function(){var t=this.ownerEl;this.timerId&&(clearTimeout(this.timerId),this.timerId=0),t&&t.ismasked&&(0!=t.closest(".asc-window.modal").length||Common.Utils.ModalWindow.isVisible()||Common.util.Shortcuts.resumeEvents(),this.maskeEl&&this.maskeEl.remove(),this.loaderEl&&this.loaderEl.remove()),delete t.ismasked},setTitle:function(t){this.title=t,this.ownerEl&&this.ownerEl.ismasked&&this.loaderEl&&$(".asc-loadmask-title",this.loaderEl).html(t)},isVisible:function(){return!!this.ownerEl.ismasked},updatePosition:function(){var t=this.ownerEl,e=this.loaderEl;t&&t.ismasked&&e&&(e.css({top:Math.round(t.height()/2-(e.height()+parseInt(e.css("padding-top"))+parseInt(e.css("padding-bottom")))/2)+"px",left:Math.round(t.width()/2-(e.width()+parseInt(e.css("padding-left"))+parseInt(e.css("padding-right")))/2)+"px"}),e.css({visibility:"visible"}))}}}())}),define("common/main/lib/view/SelectFileDlg",["common/main/lib/component/Window","common/main/lib/component/LoadMask"],function(){"use strict";Common.Views.SelectFileDlg=Common.UI.Window.extend(_.extend({initialize:function(t){var e={};_.extend(e,{title:this.textTitle,width:1024,height:621,header:!0},t),this.template=['
    '].join(""),e.tpl=_.template(this.template)(e),this.fileChoiceUrl=t.fileChoiceUrl||"",Common.UI.Window.prototype.initialize.call(this,e)},render:function(){Common.UI.Window.prototype.render.call(this),this.$window.find("> .body").css({height:"auto",overflow:"hidden"});var t=document.createElement("iframe");t.width="100%",t.height=585,t.align="top",t.frameBorder=0,t.scrolling="no",t.onload=_.bind(this._onLoad,this),$("#id-select-file-placeholder").append(t),this.loadMask=new Common.UI.LoadMask({owner:$("#id-select-file-placeholder")}),this.loadMask.setTitle(this.textLoading),this.loadMask.show(),t.src=this.fileChoiceUrl;var e=this;this._eventfunc=function(t){e._onWindowMessage(t)},this._bindWindowEvents.call(this),this.on("close",function(t){e._unbindWindowEvents()})},_bindWindowEvents:function(){window.addEventListener?window.addEventListener("message",this._eventfunc,!1):window.attachEvent&&window.attachEvent("onmessage",this._eventfunc)},_unbindWindowEvents:function(){window.removeEventListener?window.removeEventListener("message",this._eventfunc):window.detachEvent&&window.detachEvent("onmessage",this._eventfunc)},_onWindowMessage:function(t){if(t&&window.JSON)try{this._onMessage.call(this,window.JSON.parse(t.data))}catch(t){}},_onMessage:function(t){if(t&&"onlyoffice"==t.Referer&&void 0!==t.file){Common.NotificationCenter.trigger("window:close",this);var e=this;setTimeout(function(){_.isEmpty(t.file)||e.trigger("selectfile",e,t.file)},50)}},_onLoad:function(){this.loadMask&&this.loadMask.hide()},textTitle:"Select Data Source",textLoading:"Loading"},Common.Views.SelectFileDlg||{}))}),define("text!common/main/lib/template/ExtendedColorDialog.template",[],function(){return'
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n \r\n \r\n
    \r\n
    \r\n
    \r\n\r\n'}),void 0===Common)var Common={};if(define("common/main/lib/component/HSBColorPicker",["common/main/lib/component/BaseView","common/main/lib/util/utils"],function(){"use strict";Common.UI.HSBColorPicker=Common.UI.BaseView.extend({template:_.template('
    <% if (this.showCurrentColor) { %>
    <% } %>
    <% if (this.changeSaturation) { %>
    <% } %>
    <% if (this.allowEmptyColor) { %>
    <%= this.textNoColor %>
    <% } %>
    '),color:"#ff0000",options:{allowEmptyColor:!1,changeSaturation:!0,showCurrentColor:!0},initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t);var e,i,n,o,s,a,l,r,c=this,d=(c.$el||$(this.el),0),h=100,p=100;c.allowEmptyColor=c.options.allowEmptyColor,c.changeSaturation=c.options.changeSaturation,c.showCurrentColor=c.options.showCurrentColor;var u=function(t,e){var i=new Common.Utils.RGBColor("hsb("+t.h+","+t.s+","+t.b+")"),n=i.toHex();c.color=e?"transparent":n,m(),c.trigger("changecolor",c,c.color)},m=function(){s.length>0&&a.length>0&&("transparent"==c.color?a.show():(s.css("background-color",c.color),a.hide())),n.length>0&&n.css("background-color",new Common.Utils.RGBColor("hsb("+d+", 100, 100)").toHex()),l.length>0&&(l[0].innerHTML="transparent"==c.color?c.textNoColor:c.color.toUpperCase()),e.length>0&&i.length>0&&(e.css("left",h+"%"),e.css("top",100-p+"%"),i.css("top",parseInt(100*d/360)+"%"))},g=function(t,i,o){if(e.length>0&&n.length>0){var s=[Math.max(0,Math.min(100,parseInt((t.pageX*Common.Utils.zoom()-n.offset().left)/n.width()*100))),Math.max(0,Math.min(100,parseInt((t.pageY*Common.Utils.zoom()-n.offset().top)/n.height()*100)))];e.css("left",s[0]+"%"),e.css("top",s[1]+"%"),h=s[0],p=100-s[1],u({h:d,s:h,b:p})}},f=function(t,e,n){if(i&&o){var s=Math.max(0,Math.min(100,parseInt((t.pageY*Common.Utils.zoom()-o.offset().top)/o.height()*100)));i.css("top",s+"%"),d=parseInt(360*s/100),u({h:d,s:h,b:p})}},b=function(t,e,i){$(document).on("mouseup",C),$(document).on("mousemove",g)},C=function(t,e,i){$(document).off("mouseup",C),$(document).off("mousemove",g),g(t)},v=function(t,e,i){$(document).on("mouseup",_),$(document).on("mousemove",f),f(t)},_=function(t,e,i){$(document).off("mouseup",_),$(document).off("mousemove",f)},y=function(t){var e=new Common.util.RGBColor(c.color).toHSB();u(e,!0)},w=function(t){var u,g=$(c.el);g&&(e=g.find(".cnt-hb-arrow"),i=g.find(".cnt-sat-arrow"),n=g.find(".cnt-hb"),o=g.find(".cnt-sat"),s=g.find(".color-value"),l=g.find(".color-text"),r=g.find(".empty-color"),s.length>0&&(a=s.find(".transparent-color")),n.length>0&&(n.off("mousedown"),n.on("mousedown",b)),o.length>0&&(o.off("mousedown"),o.on("mousedown",v)),r.length>0&&(r.off("click"),r.on("click",y)),u="transparent"==c.color?{h:0,s:100,b:100}:new Common.Utils.RGBColor(c.color).toHSB(),d=u.h,h=u.s,p=u.b,d==h&&d==p&&0==d&&(h=100),m())};c.setColor=function(t){if(c.color!=t){var e;e="transparent"==t?{h:0,s:100,b:100}:new Common.Utils.RGBColor(t).toHSB(),d=e.h,h=e.s,p=e.b,d==h&&d==p&&0==d&&(h=100),c.color=t,m()}},c.getColor=function(){return c.color},c.on("render:after",w),c.render()},render:function(){return(this.$el||$(this.el)).html(this.template()),this.trigger("render:after",this),this},textNoColor:"No Color"})}),void 0===Common)var Common={};if(define("common/main/lib/component/MaskedField",["common/main/lib/component/BaseView"],function(){"use strict";Common.UI.MaskedField=Common.UI.BaseView.extend({options:{maskExp:"",maxLength:999},initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t);var e=this,i=e.$el||$(this.el);i.addClass("masked-field user-select"),i.attr("maxlength",e.options.maxLength),i.on("keypress",function(t){var n=String.fromCharCode(t.which);e.options.maskExp.test(n)||t.ctrlKey||(t.keyCode==Common.UI.Keys.RETURN&&e.trigger("changed",e,i.val()),t.preventDefault(),t.stopPropagation())}),i.on("input",function(t){e.trigger("change",e,i.val())}),i.on("blur",function(t){e.trigger("changed",e,i.val())})},render:function(){return this},setValue:function(t){this.options.maskExp.test(t)&&t.length<=this.options.maxLength&&this.$el.val(t)},getValue:function(){this.$el.val()}})}),void 0===Common)var Common={};if(define("common/main/lib/view/ExtendedColorDialog",["text!common/main/lib/template/ExtendedColorDialog.template","common/main/lib/component/HSBColorPicker","common/main/lib/component/MetricSpinner","common/main/lib/component/MaskedField","common/main/lib/component/Window"],function(t){"use strict";Common.UI.ExtendedColorDialog=Common.UI.Window.extend(_.extend({tpl:_.template(t),options:{},rendered:!1,initialize:function(t){Common.UI.Window.prototype.initialize.call(this,{cls:"extended-color-dlg",tpl:this.tpl({txtNew:this.textNew,txtCurrent:this.textCurrent,txtAdd:this.addButtonText,txtCancel:this.cancelButtonText}),header:!1,width:340,height:272}),this.hexRe=/\s*#?([0-9a-fA-F][0-9a-fA-F]?)([0-9a-fA-F][0-9a-fA-F]?)([0-9a-fA-F][0-9a-fA-F]?)\s*/},render:function(){function t(t){e.trigger("onmodalresult",parseInt(t.currentTarget.attributes.result.value)),e.close(!0)}var e=this;return Common.UI.Window.prototype.render.call(this),this.colorsPicker=new Common.UI.HSBColorPicker({el:$("#id-hsb-colorpicker"),showCurrentColor:!1}),this.colorsPicker.on("changecolor",_.bind(this.onChangeColor,this)),this.colorNew=$("#field-new-color"),this.colorSaved=$("#field-start-color"),this.spinR=new Common.UI.MetricSpinner({el:$("#extended-spin-r"),step:1,width:63,value:"0",defaultUnit:"",maxValue:255,minValue:0,maskExp:/[0-9]/,allowDecimal:!1}),this.spinG=new Common.UI.MetricSpinner({el:$("#extended-spin-g"),step:1,width:63,value:"0",defaultUnit:"",maxValue:255,minValue:0,maskExp:/[0-9]/,allowDecimal:!1}),this.spinB=new Common.UI.MetricSpinner({el:$("#extended-spin-b"),step:1,width:63,value:"0",defaultUnit:"",maxValue:255,minValue:0,maskExp:/[0-9]/,allowDecimal:!1}),this.textColor=new Common.UI.MaskedField({el:$("#extended-text-color"),width:55,maskExp:/[a-fA-F0-9]/,maxLength:6}),this.spinR.on("change",_.bind(this.showColor,this,null,!0)).on("changing",_.bind(this.onChangingRGB,this,1)),this.spinG.on("change",_.bind(this.showColor,this,null,!0)).on("changing",_.bind(this.onChangingRGB,this,2)),this.spinB.on("change",_.bind(this.showColor,this,null,!0)).on("changing",_.bind(this.onChangingRGB,this,3)),this.textColor.on("change",_.bind(this.onChangeMaskedField,this)),this.textColor.on("changed",_.bind(this.onChangedMaskedField,this)),this.spinR.$el.find("input").attr("maxlength",3),this.spinG.$el.find("input").attr("maxlength",3),this.spinB.$el.find("input").attr("maxlength",3),this.on("close",function(){e.trigger("onmodalresult",0)}),$(this)[0].getChild(".footer .dlg-btn").on("click",t),this.rendered=!0,void 0!==this.color&&this.setColor(this.color),this},getFocusedComponents:function(){return[this.spinR,this.spinG,this.spinB,{cmp:this.textColor,selector:"input"}]},getDefaultFocusableComponent:function(){return this.getChild("#extended-text-color")},onChangeColor:function(t,e){this.colorNew.css({"background-color":e}),this.stopevents=!0;var i=e.match(this.hexRe);this.spinR.setValue(parseInt(i[1],16)),this.spinG.setValue(parseInt(i[2],16)),this.spinB.setValue(parseInt(i[3],16)),this.textColor.setValue((i[1]+i[2]+i[3]).toUpperCase()),this.stopevents=!1},showColor:function(t,e){if(!this.stopevents){var i=this.spinR.getNumberValue(),n=null==i||i<0?0:i>255?255:i;e&&this.spinR.setValue(n,!0),n=n.toString(16),i=this.spinG.getNumberValue();var o=null==i||i<0?0:i>255?255:i;e&&this.spinG.setValue(o,!0),o=o.toString(16),i=this.spinB.getNumberValue();var s=null==i||i<0?0:i>255?255:i;e&&this.spinB.setValue(s,!0),s=s.toString(16);var a=(1==n.length?"0"+n:n)+(1==o.length?"0"+o:o)+(1==s.length?"0"+s:s);this.colorsPicker.setColor("#"+a),"hex"!=t&&this.textColor.setValue(a.toUpperCase()),this.colorNew.css("background-color","#"+a)}},onChangingRGB:function(t,e,i,n){if(!this.stopevents){var o,s,a,l;switch(i=_.isEmpty(i)||isNaN(parseInt(i))?parseInt(e.getValue()):parseInt(i),t){case 1:o=(null==i||isNaN(i)||i<0?0:i>255?255:i).toString(16),l=this.spinG.getNumberValue(),s=(null==l||l<0?0:l>255?255:l).toString(16),l=this.spinB.getNumberValue(),a=(null==l||l<0?0:l>255?255:l).toString(16);break;case 2:l=this.spinR.getNumberValue(),o=(null==l||l<0?0:l>255?255:l).toString(16),s=(null==i||isNaN(i)||i<0?0:i>255?255:i).toString(16),l=this.spinB.getNumberValue(),a=(null==l||l<0?0:l>255?255:l).toString(16);break;case 3:l=this.spinR.getNumberValue(),o=(null==l||l<0?0:l>255?255:l).toString(16),l=this.spinG.getNumberValue(),s=(null==l||l<0?0:l>255?255:l).toString(16),a=(null==i||isNaN(i)||i<0?0:i>255?255:i).toString(16)}var r=(1==o.length?"0"+o:o)+(1==s.length?"0"+s:s)+(1==a.length?"0"+a:a);this.colorsPicker.setColor("#"+r),this.textColor.setValue(r.toUpperCase()),this.colorNew.css("background-color","#"+r)}},onChangeMaskedField:function(t,e){e=/^[a-fA-F0-9]{0,6}$/.test(e)?e:"000000",e="000000"+e;var i=e.match(/([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})$/i);this.stopevents=!0,this.spinR.setValue(parseInt(i[1],16)),this.spinG.setValue(parseInt(i[2],16)),this.spinB.setValue(parseInt(i[3],16)),this.stopevents=!1,this.rendered&&this.showColor("hex")},onChangedMaskedField:function(t,e){/^[a-fA-F0-9]{0,6}$/.test(e)&&!_.isEmpty(e)||t.setValue("000000"),this.rendered&&this.showColor("",!0)},getColor:function(){var t=/#?([a-fA-F0-9]{6})/.exec(this.colorsPicker.getColor());return t?t[1]:null},setColor:function(t){var e=this;if(!0!==this.rendered)return void(this.color=t);var i=/#?([a-fA-F0-9]{6})/.test(t)?t:"ff0000";e.colorsPicker.setColor("#"+i),function(){"transparent"==t?e.colorSaved.addClass("color-transparent"):(e.colorSaved.removeClass("color-transparent"),e.colorSaved.css("background-color","#"+t)),e.colorNew.css("background-color","#"+i)}(),e.stopevents=!0;var n=e.hexRe.exec(i);e.spinR.setValue(parseInt(n[1],16)),e.spinG.setValue(parseInt(n[2],16)),e.spinB.setValue(parseInt(n[3],16)),e.textColor.setValue((n[1]+n[2]+n[3]).toUpperCase()),e.stopevents=!1},onPrimary:function(){return this.trigger("onmodalresult",1),this.close(!0),!1},addButtonText:"Add",textNew:"New",textCurrent:"Current",textRGBErr:"The entered value is incorrect.
    Please enter a numeric value between 0 and 255.",textHexErr:"The entered value is incorrect.
    Please enter a value between 000000 and FFFFFF."},Common.UI.ExtendedColorDialog||{}))}),void 0===Common)var Common={};if(define("common/main/lib/component/ThemeColorPalette",["common/main/lib/component/BaseView","common/main/lib/view/ExtendedColorDialog"],function(){"use strict";Common.UI.ThemeColorPalette=Common.UI.BaseView.extend(_.extend({options:{dynamiccolors:10,standardcolors:10,themecolors:10,effects:5,allowReselect:!0,transparent:!1,value:"000000"},template:_.template('
    <% var me = this; %><% $(colors).each(function(num, item) { %><% if (me.isBlankSeparator(item)) { %>
    <% } else if (me.isSeparator(item)) { %>
    <% } else if (me.isColor(item)) { %>  <% } else if (me.isTransparent(item)) { %> <% } else if (me.isEffect(item)) { %> <% } else if (me.isCaption(item)) { %>
    <%=item%>
    <% } %><% }); %>
    <% if (me.options.dynamiccolors!==undefined) { %>
    <% for (var i=0; i <% } %><% } %>
    '),colorRe:/(?:^|\s)color-(.{6})(?:\s|$)/,selectedCls:"selected",initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t);var e=this,i=e.$el||$(this.el);this.colors=e.options.colors||this.generateColorData(e.options.themecolors,e.options.effects,e.options.standardcolors,e.options.transparent),i.addClass("theme-colorpalette"),this.render(),this.options.updateColorsArr&&this.updateColors(this.options.updateColorsArr[0],this.options.updateColorsArr[1]),this.options.value&&this.select(this.options.value,!0),this.updateCustomColors(),i.closest(".btn-group").on("show.bs.dropdown",_.bind(this.updateCustomColors,this)),i.closest(".dropdown-submenu").on("show.bs.dropdown",_.bind(this.updateCustomColors,this)),i.on("click",_.bind(this.handleClick,this))},render:function(){return this.$el.html(this.template({colors:this.colors})),this},isBlankSeparator:function(t){return"string"==typeof t&&"-"==t},isSeparator:function(t){return"string"==typeof t&&"--"==t},isColor:function(t){return"string"==typeof t&&/[0-9A-F]{6}/.test(t)},isTransparent:function(t){return"string"==typeof t&&"transparent"==t},isCaption:function(t){return"string"==typeof t&&"-"!=t&&"--"!=t&&!/[0-9A-F]{6}|transparent/.test(t)},isEffect:function(t){return"object"==typeof t&&void 0!==t.effectId},getColor:function(){return this.value},updateCustomColors:function(){var t=this.$el||$(this.el);if(t){var e=t.find("a."+this.selectedCls),i=e.length>0&&/color-dynamic/.test(e[0].className)?e.attr("color"):void 0;i&&(i=i.toUpperCase(),e.removeClass(this.selectedCls));var n=Common.localStorage.getItem("asc."+Common.localStorage.getId()+".colors.custom");n=n?n.split(","):[];for(var o,s=-1,a=n.lengththis.options.dynamiccolors&&i.shift(),Common.localStorage.setItem(e,i.join().toUpperCase())},addNewColor:function(t){var e=this,i=new Common.UI.ExtendedColorDialog({});i.on("onmodalresult",function(t){e._isdlgopen=!1,1==t&&(e.setCustomColor(i.getColor()),e.fireEvent("select",e,i.getColor()))}),e._isdlgopen=!0,i.setColor(void 0!==e.value&&!1!==e.value?e.value:void 0!==t?t:"000000"),i.show()},isDialogOpen:function(){return 1==this._isdlgopen},select:function(t,e){var i=this.$el||$(this.el);if(i.find("a."+this.selectedCls).removeClass(this.selectedCls),"object"==typeof t){var n;void 0!==t.effectId?(n=i.find('a[effectid="'+t.effectId+'"]').first(),n.length>0?(n.addClass(this.selectedCls),this.value=n[0].className.match(this.colorRe)[1].toUpperCase()):this.value=!1):void 0!==t.effectValue&&(n=i.find('a[effectvalue="'+t.effectValue+'"].color-'+t.color.toUpperCase()).first(),n.length>0?(n.addClass(this.selectedCls),this.value=n[0].className.match(this.colorRe)[1].toUpperCase()):this.value=!1)}else if(/#?[a-fA-F0-9]{6}/.test(t)&&(t=/#?([a-fA-F0-9]{6})/.exec(t)[1].toUpperCase(),this.value=t),/^[a-fA-F0-9]{6}|transparent$/.test(t)&&_.indexOf(this.colors,t)>=0)_.indexOf(this.colors,this.value)<0&&(this.value=!1),(t!=this.value||this.options.allowReselect)&&("transparent"==t?i.find("a.color-transparent").addClass(this.selectedCls):i.find("a.palette-color.color-"+t).first().addClass(this.selectedCls),this.value=t,!0!==e&&this.fireEvent("select",this,t));else{var o=i.find("#"+t).first();0==o.length&&(o=i.find('a[color="'+t+'"]').first()),o.length>0&&(o.addClass(this.selectedCls),this.value=t.toUpperCase())}},selectByRGB:function(t,e){var i=this.$el||$(this.el);i.find("a."+this.selectedCls).removeClass(this.selectedCls);var n="object"==typeof t?t.color:t;if(/#?[a-fA-F0-9]{6}/.test(n)&&(n=/#?([a-fA-F0-9]{6})/.exec(n)[1].toUpperCase()),/^[a-fA-F0-9]{6}|transparent$/.test(n)&&(n!=this.value||this.options.allowReselect)){var o="transparent"==n?i.find("a.color-transparent"):i.find("a.color-"+n).first();0==o.length&&(o=i.find("#"+n).first()),0==o.length&&(o=i.find('a[color="'+n+'"]').first()),o.length>0&&(o.addClass(this.selectedCls),this.value=n),!0!==e&&this.fireEvent("select",this,n)}},updateColors:function(t,e,i){if(void 0!==t&&void 0!==e){var n=this,o=n.$el||$(this.el);void 0===n.aColorElements&&(n.aColorElements=o.find("a.palette-color")),void 0===n.aEffectElements&&(n.aEffectElements=o.find("a.palette-color-effect"));for(var s,a=0,l=0,r=0;r=e.length)continue;s=$(n.aColorElements[a]),s.removeClass("color-"+n.colors[r]),n.colors[r]=e[a].toUpperCase(),s.addClass("color-"+n.colors[r]),s.css({background:"#"+n.colors[r]}),s.find("span").first().css({background:"#"+n.colors[r]}),a++}else if("object"==typeof n.colors[r]&&void 0!==n.colors[r].effectId){ +if(l>=t.length)continue;s=$(n.aEffectElements[l]),t[l].color=t[l].color.toUpperCase(),n.colors[r].color!==t[l].color&&(s.removeClass("color-"+n.colors[r].color),s.addClass("color-"+t[l].color),s.css({background:"#"+t[l].color}),s.find("span").first().css({background:"#"+t[l].color})),n.colors[r].effectId!==t[l].effectId&&s.attr("effectid",""+t[l].effectId),n.colors[r].effectValue!==t[l].effectValue&&s.attr("effectvalue",""+t[l].effectValue),n.colors[r]=t[l],l++}if(i)this.select(i,!0);else{var c=o.find("a."+this.selectedCls);c.length&&c.hasClass("palette-color-effect")&&(this.value=c[0].className.match(this.colorRe)[1].toUpperCase())}this.options.updateColorsArr=void 0}},clearSelection:function(t){this.$el.find("a."+this.selectedCls).removeClass(this.selectedCls),this.value=void 0},generateColorData:function(t,e,i,n){var o=[],s=t>0&&e>0?t*e:0;if(t>0){o=[this.textThemeColors,"-"];for(var a=0;a0&&o.push("-");for(var a=0;a','",""].join("")),initialize:function(t){if(!t.menu&&!1!==t.menu){var e=this;t.menu=e.getMenu(t),e.on("render:after",function(i){e.getPicker(t.color,t.colors)})}Common.UI.Button.prototype.initialize.call(this,t)},render:function(t){Common.UI.Button.prototype.render.call(this,t),void 0!==this.options.color&&this.setColor(this.options.color)},onColorSelect:function(t,e){this.setColor(e),this.trigger("color:select",this,e)},setColor:function(t){var e=$(this.cmpEl).find("button span:nth-child(1)");this.color=t,e.toggleClass("color-transparent","transparent"==t),e.css({"background-color":"transparent"==t?t:"object"==typeof t?"#"+t.color:"#"+t})},getPicker:function(t,e){return this.colorPicker||(this.colorPicker=new Common.UI.ThemeColorPalette({el:this.cmpEl.find("#"+this.menu.id+"-color-menu"),transparent:this.options.transparent,value:t,colors:e}),this.colorPicker.on("select",_.bind(this.onColorSelect,this)),this.cmpEl.find("#"+this.menu.id+"-color-new").on("click",_.bind(this.addNewColor,this))),this.colorPicker},getMenu:function(t){if("object"!=typeof this.menu){t=t||this.options;var e=t.paletteHeight||216,i=Common.UI.getId();return new Common.UI.Menu({id:i,cls:"shifted-left",additionalAlign:t.additionalAlign,items:(t.additionalItems?t.additionalItems:[]).concat([{template:_.template('
    ')},{template:_.template(''+this.textNewColor+"")}])})}return this.menu},setMenu:function(t){t=t||this.getMenu(),Common.UI.Button.prototype.setMenu.call(this,t),this.getPicker(this.options.color,this.options.colors)},addNewColor:function(){this.colorPicker&&this.colorPicker.addNewColor("object"==typeof this.color?this.color.color:this.color)},textNewColor:"Add New Custom Color"},Common.UI.ColorButton||{}))}),function(t,e){function i(t,e,i,n,o){this.Start=t,this.End=e,this.Name=i,this.Lid=n,this.Param=o}function n(t,e){var i=0,n=e.length-1,o=0,s=null;if(i>=n)return null;for(;i>1,s=e[o];if(s.Start>t)n=o-1;else{if(!(s.Endn?null:(s=e[i],s.Start>t||s.End','
    ','",'","
    ",'
    ','',"",'",'","","
    ','",'
    ',"
    ','",'
    ',"
    ",'',"",'","","",'","","
    ','
    ','
    ','
    ',"
    ",'
    ',"
    ","
    ","
    ","
    ","
    ','",'
    ',"
    ",'',"",'",'","","",'",'","","
    ','","',"
    ','
    ',"
    ','
    ',"
    ","
    ",'
    ','',"","","","","","","
    ","",'","
    ",'
    ',"
    ","
    ",""].join(""),this.options.tpl=_.template(this.template)(this.options);var h=e.length<1;h&&this.initFonts(),this.fillRecentSymbols();var p;if(t.font?p=t.font:n.length>0&&(p=n[0].font),p)for(var u=0;u0&&(s=n[0].symbol),h&&this.options.lang&&"en"!=this.options.lang){var m=this;b(this.options.lang,function(){m.updateRangeSelector()})}Common.UI.Window.prototype.initialize.call(this,this.options),this.on("resizing",_.bind(this.onWindowResizing,this)),this.on("resize",_.bind(this.onWindowResize,this)),a=!0},initFonts:function(){var t=this.api.pluginMethod_GetFontList();t.sort(function(t,e){return t.m_wsFontNamee.m_wsFontName?1:0});for(var i,n,s,a=[],l={},r=0;re.displayValue.toLowerCase()?1:-1}),r=0;r31&&t.getRangeBySymbol(i,r)){var c=0===n.find("#c"+r).length;s=r,a=!0,t.updateView(c,void 0,!1)}}).on("change:after",function(e,i,n){t.updateInput()}),this.symbolTablePanel=n.find("#symbol-table-scrollable-div"),this.previewPanel=n.find("#id-preview-data"),this.previewParent=this.previewPanel.parent(),this.previewScrolled=n.find("#id-preview"),this.previewInner=this.previewScrolled.find("div:first-child"),this.recentPanel=n.find("#symbol-table-recent"),this.fontLabel=n.find("#symbol-table-label-font"),this.boxPanel=n.find(".box"),this.updateView(void 0,void 0,void 0,!0);var l=[{symbol:"—",description:this.textEmDash,shortcutKey:"Alt+Ctrl+Num -",code:"2014"},{symbol:"–",description:this.textEnDash,shortcutKey:"",code:"2013"},{symbol:"‑",description:this.textNBHyphen,shortcutKey:"Ctrl+Shift+_",code:"002D",special:{NonBreakingHyphen:!0}},{symbol:"",description:this.textEmSpace,shortcutKey:"",code:"2003"},{symbol:"",description:this.textEnSpace,shortcutKey:"",code:"2002"},{symbol:"",description:this.textQEmSpace,shortcutKey:"",code:"2005"},{symbol:"°",description:this.textNBSpace,shortcutKey:"Ctrl+Shift+Space",code:"00A0"},{symbol:"©",description:this.textCopyright,shortcutKey:"",code:"00A9"},{symbol:"®",description:this.textRegistered,shortcutKey:"",code:"00AE"},{symbol:"™",description:this.textTradeMark,shortcutKey:"",code:"2122"},{symbol:"§",description:this.textSection,shortcutKey:"",code:"00A7"},{symbol:"¶",description:this.textPilcrow,shortcutKey:"",code:"00B6"},{symbol:"…",description:this.textEllipsis,shortcutKey:"",code:"2026"},{symbol:"‛",description:this.textSOQuote,shortcutKey:"",code:"2018"},{symbol:"’",description:this.textSCQuote,shortcutKey:"",code:"2019"},{symbol:"‟",description:this.textDOQuote,shortcutKey:"",code:"201C"},{symbol:"”",description:this.textDCQuote,shortcutKey:"",code:"201D"}];this.specialList=new Common.UI.ListView({el:n.find("#symbol-table-special-list"),store:new Common.UI.DataViewStore(l),simpleAddMode:!0,template:_.template(['
    '].join("")),itemTemplate:_.template(['
    ','
    <%= symbol %>
    ','
    <%= description %>
    ',"<% if ("+this.showShortcutKey+") { %>",'
    <%= shortcutKey %>
    ',"<% } %>","
    "].join(""))}),this.specialList.on("item:dblclick",_.bind(this.onDblClickSpecialItem,this)).on("entervalue",_.bind(this.onDblClickSpecialItem,this)),this.specialList.selectByIndex(0),this.lblShortCut=n.find("#symbol-table-lbl-shortcut"),this.lblShortCut.toggleClass("hidden",!this.showShortcutKey),n.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this)),this.symbolsPanel=n.find("#symbol-table-pnl-symbols"),this.specialPanel=n.find("#symbol-table-pnl-special")},show:function(){Common.UI.Window.prototype.show.apply(this,arguments),this.binding||(this.binding={}),this.binding.keydownSymbols=_.bind(this.onKeyDown,this),this.binding.keypressSymbols=_.bind(this.onKeyPress,this),$(document).on("keydown."+this.cid,"#symbol-table-scrollable-div #id-preview-data, #symbol-table-recent",this.binding.keydownSymbols),$(document).on("keypress."+this.cid,"#symbol-table-scrollable-div #id-preview-data, #symbol-table-recent",this.binding.keypressSymbols);var t=this.special&&!!Common.Utils.InternalSettings.get(this.appPrefix+"symbol-table-special");t?this.btnSpecial.toggle(!0):this.btnSymbols.toggle(!0),this.ShowHideElem(t)},close:function(t){$(document).off("keydown."+this.cid,this.binding.keydownSymbols),$(document).off("keypress."+this.cid,this.binding.keypressSymbols),this.special&&Common.Utils.InternalSettings.set(this.appPrefix+"symbol-table-special",this.btnSpecial.isActive()),Common.UI.Window.prototype.close.apply(this,arguments)},getPasteSymbol:function(t){var i,n=!1;if(t&&t.length>0)if(n="c"===t[0])i=e[o].displayValue;else{var a=parseInt(t.split("_")[2]);i=e[a].displayValue}return{font:i,symbol:this.encodeSurrogateChar(s),code:s,updateRecents:n}},getSpecialSymbol:function(){var t=this.specialList.getSelectedRec();return{font:void 0,symbol:this.encodeSurrogateChar(t.get("code")),code:parseInt(t.get("code"),16),special:t.get("special")}},onBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value,!0)},onPrimary:function(t){return this._handleInput("ok"),!1},_handleInput:function(t,e){if(e||!document.activeElement||"textarea"!=document.activeElement.localName||!/area_id/.test(document.activeElement.id)){var i=this.btnSpecial.isActive(),n="ok"==t?i?this.getSpecialSymbol():this.getPasteSymbol(this.$window.find(".cell-selected").attr("id")):{};this.options.handler&&this.options.handler.call(this,this,t,n),"ok"==t&&(!i&&this.checkRecent(s,n.font),!i&&n.updateRecents&&this.updateRecents(),this.type)||this.close()}},encodeSurrogateChar:function(t){if(t<65536)return String.fromCharCode(t);t-=65536;var e=55296|t>>10,i=56320|1023&t;return String.fromCharCode(e)+String.fromCharCode(i)},fixedCharCodeAt:function(t,e){e=e||0;var i,n,o=t.charCodeAt(e);if(55296<=o&&o<=56319){if(i=o,n=t.charCodeAt(e+1),isNaN(n))throw"Старшая часть суррогатной пары без следующей младшей в fixedCharCodeAt()";return 1024*(i-55296)+(n-56320)+65536}return!(56320<=o&&o<=57343)&&o},getArrRangesByFont:function(t){var i=getSupportedRangesByFont(e[t]);return 0===i.length&&i.push({Start:32,End:255}),i[0].Start<32&&(i[0].Start=32),i},getRangeBySymbol:function(t,e){for(var i=0;i=e)return t[i];return null},getRangeByName:function(t,e){for(var i=0;ie)return-1;if(i.Start<=e&&i.End>=e)return n+(e-i.Start);n+=i.End-i.Start+1}return-1},getCodeByLinearIndex:function(t,e){if(e<0)return-1;for(var i,n=0,o=t[0],s=0;se)return o.Start+e-n;n+=i}return-1},createTable:function(t,e,i){for(var n,o,s=e*i,a=0,l="",r=0;r>0==e-1?"style='border-bottom: none'":"",r&#'+t[r].toString(10)+""):l+='
    ",++a>=i&&(l+='
    ',a=0);this.previewPanel.html(l)},fillRecentSymbols:function(){var t,e=Common.localStorage.getItem(this.appPrefix+"recentSymbols");""!=e&&(t=JSON.parse(e)),_.isArray(t)&&(n=t)},saveRecent:function(){var t=JSON.stringify(n);Common.localStorage.setItem(this.appPrefix+"recentSymbols",t)},checkRecent:function(t,e){if(0===n.length)return void n.push({symbol:t,font:e});for(var i=0;i36&&n.splice(36,n.length-36),this.saveRecent()},createCell:function(t,i){var n="",o="";if(i){for(var s=0,a=0;a'+o+"");return l.addClass("cell"),l.addClass("noselect"),l.mousedown(_.bind(this.cellClickHandler,this)),i&&l.css("font-family","'"+i+"'"),l},cellClickHandler:function(t){var e=$(t.target).attr("id");if(e){var i=(new Date).getTime();if(e===h&&i-p<300)this.cellDblClickHandler(t);else{if("c"===e[0])s=parseInt(e.slice(1,e.length)),a=!0;else{var n=e.split("_");s=parseInt(n[1]),l=parseInt(n[2]),a=!1}this.updateView(!1)}h=t.target.id,p=i}},cellDblClickHandler:function(t){if(this.type){var e=this.getPasteSymbol($(t.target).attr("id"));this.checkRecent(s,e.font),e.updateRecents&&this.updateView(!1,void 0,void 0,!0),this.fireEvent("symbol:dblclick",this,"ok",e)}else this._handleInput("ok")},onDblClickSpecialItem:function(t){if(this.type){var e=this.getSpecialSymbol();this.fireEvent("symbol:dblclick",this,"ok",e)}else this._handleInput("ok")},updateRecents:function(){var t=this.recentPanel;t.empty();var e=this.getColsCount(),i=n.length;t.width(31*e);for(var o=0;o>0},getMaxHeight:function(){return this.symbolTablePanel.innerHeight()},getRowsCount:function(){return Math.max(1,this.getMaxHeight()/33>>0)},getAllSymbolsCount:function(t){for(var e,i=0,n=0;n>0)),h=d*s,p=a*s,u=[],m=0;m>0),f=Math.min(33*Math.floor(this.previewPanel.height()/33)/10,20),this.scrollerY=new Common.UI.Scroller({el:this.previewScrolled,minScrollbarLength:g,alwaysVisibleY:!0,wheelSpeed:f,useKeyboard:!1,onChange:_.bind(function(){this.scrollerY&&(this._preventUpdateScroll=!0,this.onScrollEnd(),this._preventUpdateScroll=!1,this.previewParent.height(u),this.previewParent.css({top:this.scrollerY.getScrollTop()}))},this)})),this._preventUpdateScroll||(this.scrollerY.update({minScrollbarLength:g,wheelSpeed:f}),this.scrollerY.scrollTop(33*b));var w=this.previewPanel.find(".cell");w.off("mousedown"),w.mousedown(_.bind(this.cellClickHandler,this))}d&&this.updateRecents(),this.$window.find(".cell").removeClass("cell-selected"),a?this.$window.find("#c"+s).addClass("cell-selected"):this.$window.find("#r_"+s+"_"+l).addClass("cell-selected"),!1!==c&&this.updateInput()},onScrollEnd:function(){if(this.scrollerY.getScrollTop()!==d){var t=this.getAllSymbolsCount(i),e=this.getColsCount(),n=this.getRowsCount(),o=Math.ceil(t/e),l=33*o,r=Math.max(0,Math.min(o-n,o*this.scrollerY.getScrollTop()/l+.5>>0));if(d=this.scrollerY.getScrollTop(),a){var c=this.previewPanel.children()[0];if(c){var h=c.id;if(h){var p=parseInt(h.slice(1,h.length)),u=this.getLinearIndexByCode(i,p),m=this.getLinearIndexByCode(i,s),g=m-u,f=r*e+g;s=this.getCodeByLinearIndex(i,f);var b=r*e;for(f-=e;-1===s&&f>=b;)s=this.getCodeByLinearIndex(i,f),f-=e;-1===s&&(s=this.getCodeByLinearIndex(i,b))}else s=this.getCodeByLinearIndex(i,r*e)}}else s=this.getCodeByLinearIndex(i,r*e),a=!0;this.updateView(!0,this.getCodeByLinearIndex(i,r*e))}},updateInput:function(){for(var t=s.toString(16).toUpperCase(),e=t.length,i=e;i<5;++i)t="0"+t;this.inputCode.setValue(t)},updateRangeSelector:function(){var e=this.getRangeBySymbol(i,s);if(e&&e.Name){this.cmbRange.setDisabled(!1);var n,o=[];for(n=0;n0&&(o=i[0].Start):e===Common.UI.Keys.END?i.length>0&&(o=i[i.length-1].End):n=!1,o>-1){s=o;var r=0===this.$window.find("#c"+s).length;this.updateView(r)}}else{var c,d;if(e===Common.UI.Keys.LEFT){if((c=this.$window.find(".cell-selected")[0])&&"r"===c.id[0]){var h=this.$window.find(c).prev();h.length>0&&(d=this.$window.find(h).attr("id").split("_"),s=parseInt(d[1]),l=parseInt(d[2]),this.updateView(!1))}}else if(e===Common.UI.Keys.RIGHT){if((c=this.$window.find(".cell-selected")[0])&&"r"===c.id[0]){var p=this.$window.find(c).next();p.length>0&&(d=this.$window.find(p).attr("id").split("_"),s=parseInt(d[1]),l=parseInt(d[2]),this.updateView(!1))}}else if(e===Common.UI.Keys.HOME){var g=this.$window.find("#recent-table").children()[0];g&&(d=g.id.split("_"),s=parseInt(d[1]),l=parseInt(d[2]),this.updateView(!1))}else if(e===Common.UI.Keys.END){var f=this.recentPanel.children(),b=f[f.length-1];b&&(d=b.id.split("_"),s=parseInt(d[1]),l=parseInt(d[2]),this.updateView(!1))}else n=!1}n&&(m=e,u=(new Date).getTime())}},onKeyPress:function(t){if(!document.activeElement||!document.activeElement.nodeName||"span"!==document.activeElement.nodeName.toLowerCase()){var e=t.which||t.charCode||t.keyCode||0;if(!(m===e&&Math.abs(u-(new Date).getTime())<1e3)){if(!isNaN(e)&&e>31){if(this.getRangeBySymbol(i,e)){var n=0===this.$window.find("#c"+e).length;s=e,a=!0,this.updateView(n,void 0,!0)}}t.preventDefault&&t.preventDefault()}}},onWindowResize:function(t){var e=this.getSize();if(t&&"start"==t[1])this._preventUpdateScroll=!0,this.curSize={resize:!1,width:e[0],height:e[1]};else if(this.curSize.resize){this._preventUpdateScroll=!1,this.curSize.height=e[1]-302+38*(this.special?0:1);var i=Math.max(1,this.curSize.height/33>>0),n=33*i;this.symbolTablePanel.css({height:this.curSize.height+"px"}),this.previewPanel.css({height:n+"px"}),this.previewScrolled.css({height:n+"px"}),this.scrollerY=null,this.updateView(void 0,void 0,void 0,!0),this.specialList.cmpEl.height(e[1]-156+38*(this.special?0:1)),!this.special&&(e[1]+=38);var o=JSON.stringify(e);Common.localStorage.setItem(this.appPrefix+"settings-size-symbol-table",o),Common.Utils.InternalSettings.set(this.appPrefix+"settings-size-symbol-table",o)}},onWindowResizing:function(){if(this.curSize){var t=this.getSize();if(t[0]!==this.curSize.width||t[1]!==this.curSize.height){this.curSize.resize||(this.curSize.resize=!0),this.curSize.width=t[0],this.curSize.height=t[1]-302+38*(this.special?0:1);var e=Math.max(1,this.curSize.height/33>>0),i=33*e;this.symbolTablePanel.css({height:this.curSize.height+"px"}),this.previewPanel.css({height:i+"px"}),this.previewScrolled.css({height:i+"px"}),this.specialList.cmpEl.height(t[1]-156+38*(this.special?0:1)),this.updateView(void 0,void 0,void 0,!0)}}},onModeClick:function(t,e,i){this.ShowHideElem(t)},ShowHideElem:function(t){this.symbolsPanel.toggleClass("hidden",t),this.specialPanel.toggleClass("hidden",!t);var e=this;_.delay(function(){t?e.specialList.focus():e.previewPanel.focus()},50)},textTitle:"Symbol",textFont:"Font",textRange:"Range",textRecent:"Recently used symbols",textCode:"Unicode HEX value",textSymbols:"Symbols",textSpecial:"Special characters",textCharacter:"Character",textShortcut:"Shortcut key",textEmDash:"Em Dash",textEnDash:"En Dash",textNBHyphen:"Non-breaking Hyphen",textSHyphen:"Soft Hyphen",textEmSpace:"Em Space",textEnSpace:"En Space",textQEmSpace:"1/4 Em Space",textNBSpace:"No-break Space",textCopyright:"Copyright Sign",textRegistered:"Registered Sign",textTradeMark:"Trade Mark Sign",textSection:"Section Sign",textPilcrow:"Pilcrow Sign",textEllipsis:"Horizontal Ellipsis",textSOQuote:"Single Opening Quote",textSCQuote:"Single Closing Quote",textDOQuote:"Double Opening Quote",textDCQuote:"Double Closing Quote"},Common.Views.SymbolTableDialog||{}))}),void 0===Common)var Common={};if(define("common/main/lib/view/ListSettingsDialog",["common/main/lib/component/Window","common/main/lib/component/MetricSpinner","common/main/lib/component/ThemeColorPalette","common/main/lib/component/ColorButton","common/main/lib/view/SymbolTableDialog"],function(){"use strict";Common.Views.ListSettingsDialog=Common.UI.Window.extend(_.extend({options:{type:0,width:280,height:255,style:"min-width: 240px;",cls:"modal-dlg",split:!1,buttons:["ok","cancel"]},initialize:function(t){this.type=t.type||0,_.extend(this.options,{title:this.txtTitle},t||{}), +this.template=['
    ','
    ','",'","
    ",'
    ','',"",'",'",'',"","",'",'",'","",'','",'",'',"","",'",'",'',"","
    ','","','
    ','
    ',"
    ','","','
    ',"
    ','","
    ','","','
    ',"
    ','","','
    ',"
    ","
    ","
    "].join(""),this.props=t.props,this.options.tpl=_.template(this.template)(this.options),this.color="000000",Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this);var t=this,e=this.getChild();e.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this)),t.btnBullet=new Common.UI.Button({el:$("#id-dlg-list-bullet"),enableToggle:!0,toggleGroup:"list-type",allowDepress:!1,pressed:!0}),t.btnBullet.on("click",_.bind(t.onListTypeClick,t,0)),t.btnNumbering=new Common.UI.Button({el:$("#id-dlg-list-numbering"),enableToggle:!0,toggleGroup:"list-type",allowDepress:!1}),t.btnNumbering.on("click",_.bind(t.onListTypeClick,t,1)),this.cmbNumFormat=new Common.UI.ComboBox({el:$("#id-dlg-list-numbering-format"),menuStyle:"min-width: 100%;max-height: 183px;",editable:!1,takeFocusOnClose:!0,cls:"input-group-nr",data:[{displayValue:this.txtNone,value:-1},{displayValue:"A, B, C,...",value:4},{displayValue:"a), b), c),...",value:5},{displayValue:"a, b, c,...",value:6},{displayValue:"1, 2, 3,...",value:1},{displayValue:"1), 2), 3),...",value:2},{displayValue:"I, II, III,...",value:3},{displayValue:"i, ii, iii,...",value:7}]}),this.cmbNumFormat.on("selected",_.bind(function(t,e){this._changedProps&&this._changedProps.asc_putListType(1,e.value)},this)),this.cmbNumFormat.setValue(1);var i=["<% _.each(items, function(item) { %>",'
  • ','<%= item.displayValue %><% if (item.value === 0) { %><%=item.symbol%><% } %>',"
  • ","<% }); %>"],n=['
    ','
    ','
    ','','","
    "]);this.cmbBulletFormat=new Common.UI.ComboBoxCustom({el:$("#id-dlg-list-bullet-format"),menuStyle:"min-width: 100%;max-height: 183px;",style:"width: 100px;",editable:!1,takeFocusOnClose:!0,template:_.template(n.join("")),itemsTemplate:_.template(i.join("")),data:[{displayValue:this.txtNone,value:-1},{displayValue:this.txtSymbol+": ",value:0,symbol:"•",font:"Arial"},{displayValue:this.txtSymbol+": ",value:0,symbol:"o",font:"Courier New"},{displayValue:this.txtSymbol+": ",value:0,symbol:"§",font:"Wingdings"},{displayValue:this.txtSymbol+": ",value:0,symbol:"v",font:"Wingdings"},{displayValue:this.txtSymbol+": ",value:0,symbol:"Ø",font:"Wingdings"},{displayValue:this.txtSymbol+": ",value:0,symbol:"ü",font:"Wingdings"},{displayValue:this.txtSymbol+": ",value:0,symbol:"w",font:"Wingdings"},{displayValue:this.txtSymbol+": ",value:0,symbol:"–",font:"Arial"},{displayValue:this.txtNewBullet,value:1}],updateFormControl:function(t){var e=$(this.el).find(".form-control");t?0==t.get("value")?e[0].innerHTML=t.get("displayValue")+''+t.get("symbol")+"":e[0].innerHTML=t.get("displayValue"):e[0].innerHTML=""}});var o=this.cmbBulletFormat.store.at(1);this.cmbBulletFormat.selectRecord(o),this.bulletProps={symbol:o.get("symbol"),font:o.get("font")},this.cmbBulletFormat.on("selected",_.bind(function(t,e){if(1===e.value){var i=this,n=i.bulletProps,o=function(e,o,s){"ok"==o&&(n.changed=!0,n.code=s.code,n.font=s.font,n.symbol=s.symbol,i._changedProps&&(i._changedProps.asc_putFont(n.font),i._changedProps.asc_putSymbol(n.symbol)));var a=t.store;a.findWhere({value:0,symbol:n.symbol,font:n.font})||a.add({displayValue:i.txtSymbol+": ",value:0,symbol:n.symbol,font:n.font},{at:a.length-1}),t.setData(a.models),t.selectRecord(t.store.findWhere({value:0,symbol:n.symbol,font:n.font}))},s=new Common.Views.SymbolTableDialog({api:i.options.api,lang:i.options.interfaceLang,modal:!0,type:0,font:n.font,symbol:n.symbol,handler:o});s.show(),s.on("symbol:dblclick",o)}else-1==e.value?this._changedProps&&this._changedProps.asc_putListType(0,e.value):(this.bulletProps.changed=!0,this.bulletProps.code=e.code,this.bulletProps.font=e.font,this.bulletProps.symbol=e.symbol,this._changedProps&&(this._changedProps.asc_putFont(this.bulletProps.font),this._changedProps.asc_putSymbol(this.bulletProps.symbol)))},this)),this.spnSize=new Common.UI.MetricSpinner({el:e.find("#id-dlg-list-size"),step:1,width:100,value:100,defaultUnit:"",maxValue:400,minValue:25,allowDecimal:!1}).on("change",function(e,i,n,o){t._changedProps&&t._changedProps.asc_putSize(e.getNumberValue())}),this.btnColor=new Common.UI.ColorButton({parentEl:e.find("#id-dlg-list-color"),style:"width:45px;",additionalAlign:this.menuAddAlign,color:this.color}),this.btnColor.on("color:select",_.bind(this.onColorsSelect,this)),this.colors=this.btnColor.getPicker(),this.spnStart=new Common.UI.MetricSpinner({el:e.find("#id-dlg-list-start"),step:1,width:100,value:1,defaultUnit:"",maxValue:32767,minValue:1,allowDecimal:!1}).on("change",function(e,i,n,o){t._changedProps&&t._changedProps.asc_putNumStartAt(e.getNumberValue())}),t.numberingControls=e.find(".numbering");var s=e.find("table tr:first() td:first()");s.width(Math.max(e.find(".numbering .text").width(),s.width())),this.afterRender()},getFocusedComponents:function(){return[this.cmbNumFormat,this.cmbBulletFormat,this.spnSize,this.spnStart]},afterRender:function(){this.updateThemeColors(),this._setDefaults(this.props)},updateThemeColors:function(){this.colors.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors())},onColorsSelect:function(t,e){this.color=e,this._changedProps&&this._changedProps.asc_putColor(Common.Utils.ThemeColor.getRgbColor(e))},onListTypeClick:function(t,e,i){this.ShowHideElem(t)},ShowHideElem:function(t){this.numberingControls.toggleClass("hidden",0==t),this.cmbNumFormat.setVisible(1==t),this.cmbBulletFormat.setVisible(0==t);var e=this;_.delay(function(){t?e.cmbNumFormat.focus():e.cmbBulletFormat.focus()},50)},_handleInput:function(t){if(this.options.handler){var e=this.btnBullet.pressed?0:1;this.originalType==AscFormat.BULLET_TYPE_BULLET_NONE&&(this._changedProps=new Asc.asc_CBullet,this._changedProps.asc_putColor(Common.Utils.ThemeColor.getRgbColor(this.color)),this._changedProps.asc_putSize(this.spnSize.getNumberValue())),(this.originalType==AscFormat.BULLET_TYPE_BULLET_NONE||this.originalType==AscFormat.BULLET_TYPE_BULLET_CHAR&&1==e||this.originalType==AscFormat.BULLET_TYPE_BULLET_AUTONUM&&0==e)&&(0==e?-1==this.cmbBulletFormat.getValue()?this._changedProps.asc_putListType(0,-1):(this._changedProps.asc_putFont(this.bulletProps.font),this._changedProps.asc_putSymbol(this.bulletProps.symbol)):(this._changedProps.asc_putListType(1,this.cmbNumFormat.getValue()),this._changedProps.asc_putNumStartAt(this.spnStart.getNumberValue()))),this.options.handler.call(this,t,this._changedProps)}this.close()},onBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value)},onPrimary:function(t){return this._handleInput("ok"),!1},_setDefaults:function(t){if(t){var e=0,i=t.asc_getBullet();if(i){this.originalType=i.asc_getType(),this.spnSize.setValue(i.asc_getSize()||"",!0);var n=i.asc_getColor();if(n=n?n.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?{color:Common.Utils.ThemeColor.getHexColor(n.get_r(),n.get_g(),n.get_b()),effectValue:n.get_value()}:Common.Utils.ThemeColor.getHexColor(n.get_r(),n.get_g(),n.get_b()):"transparent",this.color=Common.Utils.ThemeColor.colorValue2EffectId(n),this.btnColor.setColor(n),"object"==typeof n){for(var o=!1,s=0;s<10;s++)if(Common.Utils.ThemeColor.ThemeValues[s]==n.effectValue){this.colors.select(n,!0),o=!0;break}o||this.colors.clearSelection()}else this.colors.select(n,!0);if(this.originalType==AscFormat.BULLET_TYPE_BULLET_NONE)this.cmbNumFormat.setValue(-1),this.cmbBulletFormat.setValue(-1),e=this.type;else if(this.originalType==AscFormat.BULLET_TYPE_BULLET_CHAR){var a=i.asc_getSymbol();a?(this.bulletProps={symbol:a,font:i.asc_getFont()},this.cmbBulletFormat.store.findWhere({value:0,symbol:this.bulletProps.symbol,font:this.bulletProps.font})||this.cmbBulletFormat.store.add({displayValue:this.txtSymbol+": ",value:0,symbol:this.bulletProps.symbol,font:this.bulletProps.font},{at:this.cmbBulletFormat.store.length-1}),this.cmbBulletFormat.setData(this.cmbBulletFormat.store.models),this.cmbBulletFormat.selectRecord(this.cmbBulletFormat.store.findWhere({value:0,symbol:this.bulletProps.symbol,font:this.bulletProps.font}))):this.cmbBulletFormat.setValue(""),this._changedProps=i,e=0}else if(this.originalType==AscFormat.BULLET_TYPE_BULLET_AUTONUM){var l=i.asc_getAutoNumType();this.cmbNumFormat.setValue(l,"");var r=i.asc_getNumStartAt();this.spnStart.setValue(r||"",!0),this.spnStart.setDisabled(null===r),this._changedProps=i,e=1}}else this.cmbNumFormat.setValue(-1),this.cmbBulletFormat.setValue(-1),this._changedProps=new Asc.asc_CBullet,e=this.type}1==e?this.btnNumbering.toggle(!0):this.btnBullet.toggle(!0),this.ShowHideElem(e)},txtTitle:"List Settings",txtSize:"Size",txtColor:"Color",txtOfText:"% of text",txtStart:"Start at",textBulleted:"Bulleted",textNumbering:"Numbered",txtType:"Type",txtNone:"None",txtNewBullet:"New bullet",txtSymbol:"Symbol"},Common.Views.ListSettingsDialog||{}))}),void 0===Common)var Common={};if(void 0===Common.define&&(Common.define={}),define("common/main/lib/util/define",[],function(){"use strict";Common.define.c_oAscMathMainType={Symbol:0,Fraction:1,Script:2,Radical:3,Integral:4,LargeOperator:5,Bracket:6,Function:7,Accent:8,LimitLog:9,Operator:10,Matrix:11},Common.define.c_oAscMathType={Symbol_pm:0,Symbol_infinity:1,Symbol_equals:2,Symbol_neq:3,Symbol_about:4,Symbol_times:5,Symbol_div:6,Symbol_factorial:7,Symbol_propto:8,Symbol_less:9,Symbol_ll:10,Symbol_greater:11,Symbol_gg:12,Symbol_leq:13,Symbol_geq:14,Symbol_mp:15,Symbol_cong:16,Symbol_approx:17,Symbol_equiv:18,Symbol_forall:19,Symbol_additional:20,Symbol_partial:21,Symbol_sqrt:22,Symbol_cbrt:23,Symbol_qdrt:24,Symbol_cup:25,Symbol_cap:26,Symbol_emptyset:27,Symbol_percent:28,Symbol_degree:29,Symbol_fahrenheit:30,Symbol_celsius:31,Symbol_inc:32,Symbol_nabla:33,Symbol_exists:34,Symbol_notexists:35,Symbol_in:36,Symbol_ni:37,Symbol_leftarrow:38,Symbol_uparrow:39,Symbol_rightarrow:40,Symbol_downarrow:41,Symbol_leftrightarrow:42,Symbol_therefore:43,Symbol_plus:44,Symbol_minus:45,Symbol_not:46,Symbol_ast:47,Symbol_bullet:48,Symbol_vdots:49,Symbol_cdots:50,Symbol_rddots:51,Symbol_ddots:52,Symbol_aleph:53,Symbol_beth:54,Symbol_QED:55,Symbol_alpha:65536,Symbol_beta:65537,Symbol_gamma:65538,Symbol_delta:65539,Symbol_varepsilon:65540,Symbol_epsilon:65541,Symbol_zeta:65542,Symbol_eta:65543,Symbol_theta:65544,Symbol_vartheta:65545,Symbol_iota:65546,Symbol_kappa:65547,Symbol_lambda:65548,Symbol_mu:65549,Symbol_nu:65550,Symbol_xsi:65551,Symbol_o:65552,Symbol_pi:65553,Symbol_varpi:65554,Symbol_rho:65555,Symbol_varrho:65556,Symbol_sigma:65557,Symbol_varsigma:65558,Symbol_tau:65559,Symbol_upsilon:65560,Symbol_varphi:65561,Symbol_phi:65562,Symbol_chi:65563,Symbol_psi:65564,Symbol_omega:65565,Symbol_Alpha:131072,Symbol_Beta:131073,Symbol_Gamma:131074,Symbol_Delta:131075,Symbol_Epsilon:131076,Symbol_Zeta:131077,Symbol_Eta:131078,Symbol_Theta:131079,Symbol_Iota:131080,Symbol_Kappa:131081,Symbol_Lambda:131082,Symbol_Mu:131083,Symbol_Nu:131084,Symbol_Xsi:131085,Symbol_O:131086,Symbol_Pi:131087,Symbol_Rho:131088,Symbol_Sigma:131089,Symbol_Tau:131090,Symbol_Upsilon:131091,Symbol_Phi:131092,Symbol_Chi:131093,Symbol_Psi:131094,Symbol_Omega:131095,FractionVertical:16777216,FractionDiagonal:16777217,FractionHorizontal:16777218,FractionSmall:16777219,FractionDifferential_1:16842752,FractionDifferential_2:16842753,FractionDifferential_3:16842754,FractionDifferential_4:16842755,FractionPi_2:16842756,ScriptSup:33554432,ScriptSub:33554433,ScriptSubSup:33554434,ScriptSubSupLeft:33554435,ScriptCustom_1:33619968,ScriptCustom_2:33619969,ScriptCustom_3:33619970,ScriptCustom_4:33619971,RadicalSqrt:50331648,RadicalRoot_n:50331649,RadicalRoot_2:50331650,RadicalRoot_3:50331651,RadicalCustom_1:50397184,RadicalCustom_2:50397185,Integral:67108864,IntegralSubSup:67108865,IntegralCenterSubSup:67108866,IntegralDouble:67108867,IntegralDoubleSubSup:67108868,IntegralDoubleCenterSubSup:67108869,IntegralTriple:67108870,IntegralTripleSubSup:67108871,IntegralTripleCenterSubSup:67108872,IntegralOriented:67174400,IntegralOrientedSubSup:67174401,IntegralOrientedCenterSubSup:67174402,IntegralOrientedDouble:67174403,IntegralOrientedDoubleSubSup:67174404,IntegralOrientedDoubleCenterSubSup:67174405,IntegralOrientedTriple:67174406,IntegralOrientedTripleSubSup:67174407,IntegralOrientedTripleCenterSubSup:67174408,Integral_dx:67239936,Integral_dy:67239937,Integral_dtheta:67239938,LargeOperator_Sum:83886080,LargeOperator_Sum_CenterSubSup:83886081,LargeOperator_Sum_SubSup:83886082,LargeOperator_Sum_CenterSub:83886083,LargeOperator_Sum_Sub:83886084,LargeOperator_Prod:83951616,LargeOperator_Prod_CenterSubSup:83951617,LargeOperator_Prod_SubSup:83951618,LargeOperator_Prod_CenterSub:83951619,LargeOperator_Prod_Sub:83951620,LargeOperator_CoProd:83951621,LargeOperator_CoProd_CenterSubSup:83951622,LargeOperator_CoProd_SubSup:83951623,LargeOperator_CoProd_CenterSub:83951624,LargeOperator_CoProd_Sub:83951625,LargeOperator_Union:84017152,LargeOperator_Union_CenterSubSup:84017153,LargeOperator_Union_SubSup:84017154,LargeOperator_Union_CenterSub:84017155,LargeOperator_Union_Sub:84017156,LargeOperator_Intersection:84017157,LargeOperator_Intersection_CenterSubSup:84017158,LargeOperator_Intersection_SubSup:84017159,LargeOperator_Intersection_CenterSub:84017160,LargeOperator_Intersection_Sub:84017161,LargeOperator_Disjunction:84082688,LargeOperator_Disjunction_CenterSubSup:84082689,LargeOperator_Disjunction_SubSup:84082690,LargeOperator_Disjunction_CenterSub:84082691,LargeOperator_Disjunction_Sub:84082692,LargeOperator_Conjunction:84082693,LargeOperator_Conjunction_CenterSubSup:84082694,LargeOperator_Conjunction_SubSup:84082695,LargeOperator_Conjunction_CenterSub:84082696,LargeOperator_Conjunction_Sub:84082697,LargeOperator_Custom_1:84148224,LargeOperator_Custom_2:84148225,LargeOperator_Custom_3:84148226,LargeOperator_Custom_4:84148227,LargeOperator_Custom_5:84148228,Bracket_Round:100663296,Bracket_Square:100663297,Bracket_Curve:100663298,Bracket_Angle:100663299,Bracket_LowLim:100663300,Bracket_UppLim:100663301,Bracket_Line:100663302,Bracket_LineDouble:100663303,Bracket_Square_OpenOpen:100663304,Bracket_Square_CloseClose:100663305,Bracket_Square_CloseOpen:100663306,Bracket_SquareDouble:100663307,Bracket_Round_Delimiter_2:100728832,Bracket_Curve_Delimiter_2:100728833,Bracket_Angle_Delimiter_2:100728834,Bracket_Angle_Delimiter_3:100728835,Bracket_Round_OpenNone:100794368,Bracket_Round_NoneOpen:100794369,Bracket_Square_OpenNone:100794370,Bracket_Square_NoneOpen:100794371,Bracket_Curve_OpenNone:100794372,Bracket_Curve_NoneOpen:100794373,Bracket_Angle_OpenNone:100794374,Bracket_Angle_NoneOpen:100794375,Bracket_LowLim_OpenNone:100794376,Bracket_LowLim_NoneNone:100794377,Bracket_UppLim_OpenNone:100794378,Bracket_UppLim_NoneOpen:100794379,Bracket_Line_OpenNone:100794380,Bracket_Line_NoneOpen:100794381,Bracket_LineDouble_OpenNone:100794382,Bracket_LineDouble_NoneOpen:100794383,Bracket_SquareDouble_OpenNone:100794384,Bracket_SquareDouble_NoneOpen:100794385,Bracket_Custom_1:100859904,Bracket_Custom_2:100859905,Bracket_Custom_3:100859906,Bracket_Custom_4:100859907,Bracket_Custom_5:100925440,Bracket_Custom_6:100925441,Bracket_Custom_7:100925442,Function_Sin:117440512,Function_Cos:117440513,Function_Tan:117440514,Function_Csc:117440515,Function_Sec:117440516,Function_Cot:117440517,Function_1_Sin:117506048,Function_1_Cos:117506049,Function_1_Tan:117506050,Function_1_Csc:117506051,Function_1_Sec:117506052,Function_1_Cot:117506053,Function_Sinh:117571584,Function_Cosh:117571585,Function_Tanh:117571586,Function_Csch:117571587,Function_Sech:117571588,Function_Coth:117571589,Function_1_Sinh:117637120,Function_1_Cosh:117637121,Function_1_Tanh:117637122,Function_1_Csch:117637123,Function_1_Sech:117637124,Function_1_Coth:117637125,Function_Custom_1:117702656,Function_Custom_2:117702657,Function_Custom_3:117702658,Accent_Dot:134217728,Accent_DDot:134217729,Accent_DDDot:134217730,Accent_Hat:134217731,Accent_Check:134217732,Accent_Accent:134217733,Accent_Grave:134217734,Accent_Smile:134217735,Accent_Tilde:134217736,Accent_Bar:134217737,Accent_DoubleBar:134217738,Accent_CurveBracketTop:134217739,Accent_CurveBracketBot:134217740,Accent_GroupTop:134217741,Accent_GroupBot:134217742,Accent_ArrowL:134217743,Accent_ArrowR:134217744,Accent_ArrowD:134217745,Accent_HarpoonL:134217746,Accent_HarpoonR:134217747,Accent_BorderBox:134283264,Accent_BorderBoxCustom:134283265,Accent_BarTop:134348800,Accent_BarBot:134348801,Accent_Custom_1:134414336,Accent_Custom_2:134414337,Accent_Custom_3:134414338,LimitLog_LogBase:150994944,LimitLog_Log:150994945,LimitLog_Lim:150994946,LimitLog_Min:150994947,LimitLog_Max:150994948,LimitLog_Ln:150994949,LimitLog_Custom_1:151060480,LimitLog_Custom_2:151060481,Operator_ColonEquals:167772160,Operator_EqualsEquals:167772161,Operator_PlusEquals:167772162,Operator_MinusEquals:167772163,Operator_Definition:167772164,Operator_UnitOfMeasure:167772165,Operator_DeltaEquals:167772166,Operator_ArrowL_Top:167837696,Operator_ArrowR_Top:167837697,Operator_ArrowL_Bot:167837698,Operator_ArrowR_Bot:167837699,Operator_DoubleArrowL_Top:167837700,Operator_DoubleArrowR_Top:167837701,Operator_DoubleArrowL_Bot:167837702,Operator_DoubleArrowR_Bot:167837703,Operator_ArrowD_Top:167837704,Operator_ArrowD_Bot:167837705,Operator_DoubleArrowD_Top:167837706,Operator_DoubleArrowD_Bot:167837707,Operator_Custom_1:167903232,Operator_Custom_2:167903233,Matrix_1_2:184549376,Matrix_2_1:184549377,Matrix_1_3:184549378,Matrix_3_1:184549379,Matrix_2_2:184549380,Matrix_2_3:184549381,Matrix_3_2:184549382,Matrix_3_3:184549383,Matrix_Dots_Center:184614912,Matrix_Dots_Baseline:184614913,Matrix_Dots_Vertical:184614914,Matrix_Dots_Diagonal:184614915,Matrix_Identity_2:184680448,Matrix_Identity_2_NoZeros:184680449,Matrix_Identity_3:184680450,Matrix_Identity_3_NoZeros:184680451,Matrix_2_2_RoundBracket:184745984,Matrix_2_2_SquareBracket:184745985,Matrix_2_2_LineBracket:184745986,Matrix_2_2_DLineBracket:184745987,Matrix_Flat_Round:184811520,Matrix_Flat_Square:184811521},Common.define.chartData=_.extend(new function(){return{textLine:"Line",textColumn:"Column",textBar:"Bar",textArea:"Area",textPie:"Pie",textPoint:"XY (Scatter)",textStock:"Stock",textSurface:"Surface",textCharts:"Charts",textSparks:"Sparklines",textLineSpark:"Line",textColumnSpark:"Column",textWinLossSpark:"Win/Loss",getChartGroupData:function(t){return[{id:"menu-chart-group-bar",caption:this.textColumn,headername:t?this.textCharts:void 0},{id:"menu-chart-group-line",caption:this.textLine},{id:"menu-chart-group-pie",caption:this.textPie},{id:"menu-chart-group-hbar",caption:this.textBar},{id:"menu-chart-group-area",caption:this.textArea,inline:!0},{id:"menu-chart-group-scatter",caption:this.textPoint,inline:!0},{id:"menu-chart-group-stock",caption:this.textStock,inline:!0}]},getChartData:function(){return[{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barNormal,iconCls:"column-normal"},{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barStacked,iconCls:"column-stack"},{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barStackedPer,iconCls:"column-pstack"},{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barNormal3d,iconCls:"column-3d-normal"},{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barStacked3d,iconCls:"column-3d-stack"},{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barStackedPer3d,iconCls:"column-3d-pstack"},{group:"menu-chart-group-bar",type:Asc.c_oAscChartTypeSettings.barNormal3dPerspective,iconCls:"column-3d-normal-per"},{group:"menu-chart-group-line",type:Asc.c_oAscChartTypeSettings.lineNormal,iconCls:"line-normal"},{group:"menu-chart-group-line",type:Asc.c_oAscChartTypeSettings.lineStacked,iconCls:"line-stack"},{group:"menu-chart-group-line",type:Asc.c_oAscChartTypeSettings.lineStackedPer,iconCls:"line-pstack"},{group:"menu-chart-group-line",type:Asc.c_oAscChartTypeSettings.line3d,iconCls:"line-3d"},{group:"menu-chart-group-pie",type:Asc.c_oAscChartTypeSettings.pie,iconCls:"pie-normal"},{group:"menu-chart-group-pie",type:Asc.c_oAscChartTypeSettings.doughnut,iconCls:"pie-doughnut"},{group:"menu-chart-group-pie",type:Asc.c_oAscChartTypeSettings.pie3d,iconCls:"pie-3d-normal"},{group:"menu-chart-group-hbar",type:Asc.c_oAscChartTypeSettings.hBarNormal,iconCls:"bar-normal"},{group:"menu-chart-group-hbar",type:Asc.c_oAscChartTypeSettings.hBarStacked,iconCls:"bar-stack"},{group:"menu-chart-group-hbar",type:Asc.c_oAscChartTypeSettings.hBarStackedPer,iconCls:"bar-pstack"},{group:"menu-chart-group-hbar",type:Asc.c_oAscChartTypeSettings.hBarNormal3d,iconCls:"bar-3d-normal"},{group:"menu-chart-group-hbar",type:Asc.c_oAscChartTypeSettings.hBarStacked3d,iconCls:"bar-3d-stack"},{group:"menu-chart-group-hbar",type:Asc.c_oAscChartTypeSettings.hBarStackedPer3d,iconCls:"bar-3d-pstack"},{group:"menu-chart-group-area",type:Asc.c_oAscChartTypeSettings.areaNormal,iconCls:"area-normal"},{group:"menu-chart-group-area",type:Asc.c_oAscChartTypeSettings.areaStacked,iconCls:"area-stack"},{group:"menu-chart-group-area",type:Asc.c_oAscChartTypeSettings.areaStackedPer,iconCls:"area-pstack"},{group:"menu-chart-group-scatter",type:Asc.c_oAscChartTypeSettings.scatter,iconCls:"point-normal"},{group:"menu-chart-group-stock",type:Asc.c_oAscChartTypeSettings.stock,iconCls:"stock-normal"}]},getSparkGroupData:function(t){return[{id:"menu-chart-group-sparkcolumn",inline:!0,headername:t?this.textSparks:void 0},{id:"menu-chart-group-sparkline",inline:!0},{id:"menu-chart-group-sparkwin",inline:!0}]},getSparkData:function(){return[{group:"menu-chart-group-sparkcolumn",type:Asc.c_oAscSparklineType.Column,allowSelected:!0,iconCls:"spark-column",tip:this.textColumnSpark},{group:"menu-chart-group-sparkline",type:Asc.c_oAscSparklineType.Line,allowSelected:!0,iconCls:"spark-line",tip:this.textLineSpark},{group:"menu-chart-group-sparkwin",type:Asc.c_oAscSparklineType.Stacked,allowSelected:!0,iconCls:"spark-win",tip:this.textWinLossSpark}]}}},Common.define.chartData||{})}),define("presentationeditor/main/app/collection/SlideThemes",["backbone"],function(t){"use strict";PE.Collections=PE.Collections||{},PE.Collections.SlideThemes=t.Collection.extend({})}),define("text!presentationeditor/main/app/template/Toolbar.template",[],function(){ +return'
    \n
    \n
    \n <%= tabsmarkup %>\n
    \n
    \n
    \n
    \n
    \n
    \n \n
    \n
    \n \n
    \n
    \n
    \n
    \n
    \n \n \n
    \n
    \n \n \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n \n
    \n \n
    \n
    \n \n
    \n
    \n \n
    \n
    \n
    \n
    \n
    \n \n \n \n \n
    \n
    \n \n \n \n \n \n \n \n
    \n
    \n
    \n
    \n
    \n \n \n \n \n
    \n
    \n \n \n \n
    \n
    \n
    \n
    \n \n \n \n
    \n
    \n
    \n \n
    \n
    \n \n
    \n
    \n
    \n
    \n
    \n \n \n
    \n
    \n \n \n
    \n
    \n
    \n
    \n
    \n
    \n \n
    \n \n
    \n
    \n \n
    \n
    \n
    \n \n \n \n \n \n
    \n
    \n
    \n \n \n
    \n
    \n
    \n \n \n \n
    \n
    \n
    \n \n \n
    \n
    \n
    \n \n \n
    \n
    \n
    \n
    \n
    '}),define("text!presentationeditor/main/app/template/ToolbarView.template",[],function(){return'
    \n
    \n
    \n <%= tabsmarkup %>\n
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    '}),void 0===Common)var Common={};if(Common.Models=Common.Models||{},define("common/main/lib/model/Font",["backbone"],function(t){"use strict";Common.Models.Font=t.Model.extend({defaults:function(){return{id:Common.UI.getId(),name:null,cloneid:null,imgidx:0,type:0}}})}),void 0===Common)var Common={};if(Common.Collections=Common.Collections||{},define("common/main/lib/collection/Fonts",["backbone","common/main/lib/model/Font"],function(t){"use strict";Common.Collections.Fonts=t.Collection.extend({model:Common.Models.Font,comparator:function(t,e){var i=t.get("name").toLowerCase(),n=e.get("name").toLowerCase();return i==n?0:i',"<% _.each(colors, function(color, index) { %>",'',"<% }) %>",""].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t);var e=this;this.id=e.options.id,this.cls=e.options.cls,this.style=e.options.style,this.colors=e.options.colors||[],this.value=e.options.value,e.options.el&&e.render()},render:function(t){var e=this;return e.rendered?this.cmpEl=e.$el||$(this.el):(this.cmpEl=$(this.template({id:this.id,cls:this.cls,style:this.style,colors:this.colors})),t?(this.setElement(t,!1),t.html(this.cmpEl)):e.$el.html(this.cmpEl)),e.rendered||e.cmpEl.on("click","span.color-item",e.itemClick.bind(e)),e.rendered=!0,this},itemClick:function(t){var e=$(t.target);this.select(e.attr("data-color"))},select:function(t,e){if(this.value!=t){var i=this;$("span.color-item",this.cmpEl).removeClass("selected"),this.value=t,t&&/#?[a-fA-F0-9]{6}/.test(t)&&(t=/#?([a-fA-F0-9]{6})/.exec(t)[1].toUpperCase(),$("span[data-color="+t+"]",this.cmpEl).addClass("selected"),e||i.trigger("select",i,this.value))}}})}),void 0===Common)var Common={};if(define("common/main/lib/component/DimensionPicker",["common/main/lib/component/BaseView"],function(){"use strict";Common.UI.DimensionPicker=Common.UI.BaseView.extend(function(){return{options:{itemSize:18,minRows:5,minColumns:5,maxRows:20,maxColumns:20},template:_.template(['
    ','
    0x0
    ','
    ','
    ','
    ','
    ',"
    ","
    "].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t);var e=this;this.render(),this.cmpEl=e.$el||$(this.el);var i=this.cmpEl;e.itemSize=e.options.itemSize,e.minRows=e.options.minRows,e.minColumns=e.options.minColumns,e.maxRows=e.options.maxRows,e.maxColumns=e.options.maxColumns,e.curColumns=0,e.curRows=0;var n=function(t){e.setTableSize(Math.ceil((void 0===t.offsetX?t.originalEvent.layerX:t.offsetX*Common.Utils.zoom())/e.itemSize),Math.ceil((void 0===t.offsetY?t.originalEvent.layerY:t.offsetY*Common.Utils.zoom())/e.itemSize),t)},o=function(t){e.setTableSize(0,0,t)},s=function(t){e.trigger("select",e,e.curColumns,e.curRows,t)};if(i){var a=i.find(".dimension-picker-mousecatcher");e.areaUnHighLighted=i.find(".dimension-picker-unhighlighted"),e.areaHighLighted=i.find(".dimension-picker-highlighted"),e.areaStatus=i.find(".dimension-picker-status"),i.css({width:e.minColumns+"em"}),a.css("z-index",1),a.width(e.maxColumns+"em").height(e.maxRows+"em"),e.areaUnHighLighted.width(e.minColumns+"em").height(e.minRows+"em"),e.areaStatus.html(e.curColumns+" x "+e.curRows),e.areaStatus.width(e.areaUnHighLighted.width()),a.on("mousemove",n),e.areaHighLighted.on("mousemove",n),e.areaUnHighLighted.on("mousemove",n),a.on("mouseleave",o),e.areaHighLighted.on("mouseleave",o),e.areaUnHighLighted.on("mouseleave",o),a.on("click",s),e.areaHighLighted.on("click",s),e.areaUnHighLighted.on("click",s)}},render:function(){return(this.$el||$(this.el)).html(this.template()),this},setTableSize:function(t,e,i){t>this.maxColumns&&(t=this.maxColumns),e>this.maxRows&&(e=this.maxRows),this.curColumns==t&&this.curRows==e||(this.curColumns=t,this.curRows=e,this.areaHighLighted.width(this.curColumns+"em").height(this.curRows+"em"),this.areaUnHighLighted.width((this.curColumnsthis.maxColumns?this.maxColumns:this.curColumns+1)+"em").height((this.curRowsthis.maxRows?this.maxRows:this.curRows+1)+"em"),this.cmpEl.width(this.areaUnHighLighted.width()),this.areaStatus.html(this.curColumns+" x "+this.curRows),this.areaStatus.width(this.areaUnHighLighted.width()),this.trigger("change",this,this.curColumns,this.curRows,i))},getColumnsCount:function(){return this.curColumns},getRowsCount:function(){return this.curRows}}}())}),void 0===Common)var Common={};var FONT_TYPE_RECENT=4;if(define("common/main/lib/component/ComboBoxFonts",["common/main/lib/component/ComboBox"],function(){"use strict";Common.UI.ComboBoxFonts=Common.UI.ComboBox.extend(function(){var t=Asc.FONT_THUMBNAIL_HEIGHT||26,e=window.devicePixelRatio>1,i=document.createElement("canvas"),n=i.getContext("2d"),o="../../../../sdkjs/common/Images/fonts_thumbnail.png?"+window.CP_urlArgs,s="../../../../sdkjs/common/Images/fonts_thumbnail@2x.png?"+window.CP_urlArgs,a=1;return"object"==typeof window.AscDesktopEditor&&(o=window.AscDesktopEditor.getFontsSprite(),s=window.AscDesktopEditor.getFontsSprite(!0)),i.height=e?2*t:t,i.width=e?604:302,{template:_.template(['
    ',' ','
    ','','","
    "].join("")),initialize:function(t){Common.UI.ComboBox.prototype.initialize.call(this,_.extend(t,{displayField:"name",scroller:{wheelSpeed:20,alwaysVisibleY:!0,onChange:this.updateVisibleFontsTiles.bind(this)}})),this.recent=_.isNumber(t.recent)?t.recent:5;var e=Common.localStorage.getKeysFilter();this.appPrefix=e&&e.length?e.split(",")[0]:"",Common.NotificationCenter.on("fonts:load",_.bind(this.fillFonts,this))},render:function(t){var e=null,i="";return _.isUndefined(this._input)||(e=this._input.val(),i=this._input.attr("tabindex")),Common.UI.ComboBox.prototype.render.call(this,t),this.setRawValue(e),this._input.attr("tabindex",i),this._input.on("keyup",_.bind(this.onInputKeyUp,this)),this._input.on("keydown",_.bind(this.onInputKeyDown,this)),this._input.on("focus",_.bind(function(){this.inFormControl=!0},this)),this._input.on("blur",_.bind(function(){this.inFormControl=!1},this)),this},onAfterKeydownMenu:function(t){var e=this;if(t.keyCode==Common.UI.Keys.RETURN){if($(t.target).closest("input").length){if(this.lastValue===this._input.val())return!0;this._input.trigger("change")}else $(t.target).click(),this.rendered&&(Common.Utils.isIE?this._input.trigger("change",{onkeydown:!0}):this._input.blur());return!1}if(t.keyCode==Common.UI.Keys.ESC&&this.isMenuOpen())return this._input.val(this.lastValue),setTimeout(function(){e.closeMenu(),e.onAfterHideMenu(t)},10),!1;(t.keyCode==Common.UI.Keys.HOME&&!t.shiftKey||t.keyCode==Common.UI.Keys.END&&!t.shiftKey||t.keyCode==Common.UI.Keys.BACKSPACE&&!e._input.is(":focus"))&&this.isMenuOpen()&&(e._input.focus(),setTimeout(function(){e._input[0].selectionStart=e._input[0].selectionEnd=t.keyCode==Common.UI.Keys.HOME?0:e._input[0].value.length},10)),this.updateVisibleFontsTiles()},onInputKeyUp:function(t){if(t.keyCode!=Common.UI.Keys.RETURN&&t.keyCode!==Common.UI.Keys.SHIFT&&t.keyCode!==Common.UI.Keys.CTRL&&t.keyCode!==Common.UI.Keys.ALT&&t.keyCode!==Common.UI.Keys.LEFT&&t.keyCode!==Common.UI.Keys.RIGHT&&t.keyCode!==Common.UI.Keys.HOME&&t.keyCode!==Common.UI.Keys.END&&t.keyCode!==Common.UI.Keys.ESC&&t.keyCode!==Common.UI.Keys.INSERT&&t.keyCode!==Common.UI.Keys.TAB&&(t.stopPropagation(),this.selectCandidate(t.keyCode==Common.UI.Keys.DELETE||t.keyCode==Common.UI.Keys.BACKSPACE),this._selectedItem)){var e=this;void 0===e._timerSelection&&(e._timerSelection=setInterval(function(){if(!(new Date-e._inInputKeyDown<100)&&e._selectedItem){clearInterval(e._timerSelection),e._timerSelection=void 0;var t=e._input[0],i=e._selectedItem.get(e.displayField),n=t.value;e.rendered&&(document.selection?document.selection.createRange().text=i:(t.selectionStart||"0"==t.selectionStart)&&(t.value=i,t.selectionStart=n.length,t.selectionEnd=i.length))}},10))}},onInputKeyDown:function(t){this._inInputKeyDown=new Date;var e=this;t.keyCode==Common.UI.Keys.ESC?(this._input.val(this.lastValue),setTimeout(function(){e.closeMenu(),e.onAfterHideMenu(t)},10)):t.keyCode!=Common.UI.Keys.RETURN&&t.keyCode!=Common.UI.Keys.CTRL&&t.keyCode!=Common.UI.Keys.SHIFT&&t.keyCode!=Common.UI.Keys.ALT&&t.keyCode!=Common.UI.Keys.TAB?(this.isMenuOpen()||t.ctrlKey||this.openMenu(),t.keyCode==Common.UI.Keys.UP||t.keyCode==Common.UI.Keys.DOWN?_.delay(function(){var i=t.keyCode==Common.UI.Keys.DOWN?e.cmpEl.find("ul li.selected").nextAll("li:not(.divider)"):e.cmpEl.find("ul li.selected").prevAll("li:not(.divider)");i=i.length>0?i.eq(0):t.keyCode==Common.UI.Keys.DOWN?e.cmpEl.find("ul li:not(.divider):first"):e.cmpEl.find("ul li:not(.divider):last"),i=i.find("a"),e._skipInputChange=!0,i.focus(),e.updateVisibleFontsTiles()},10):e._skipInputChange=!1):t.keyCode==Common.UI.Keys.RETURN&&this._input.val()===e.lastValue&&this._input.trigger("change",{reapply:!0})},onInputChanged:function(t,e){if(!e||!e.synthetic){if(this._skipInputChange)return void(this._skipInputChange=!1);if(this._isMouseDownMenu)return void(this._isMouseDownMenu=!1);var i=$(t.target).val(),n={};if(!(this.lastValue!==i||e&&e.reapply))return void(e&&e.onkeydown&&this.trigger("combo:blur",this,t));n[this.valueField]=i,n[this.displayField]=i,this.trigger("changed:before",this,n,t),t.isDefaultPrevented()||(this._selectedItem?(n[this.valueField]=this._selectedItem.get(this.displayField),this.setRawValue(n[this.valueField]),this.trigger("selected",this,_.extend({},this._selectedItem.toJSON()),t),this.addItemToRecent(this._selectedItem),this.closeMenu()):(this.setRawValue(n[this.valueField]),n.isNewFont=!0,this.trigger("selected",this,n,t),this.closeMenu()),this.trigger("changed:after",this,n,t))}},getImageUri:function(o){if(o.cloneid){var s=$(this.el).find("ul > li#"+o.cloneid+" img");return null!=s?s[0].src:void 0}return e?(n.clearRect(0,0,604,2*t),n.drawImage(this.spriteThumbs,0,2*-Asc.FONT_THUMBNAIL_HEIGHT*Math.floor(o.imgidx/a))):(n.clearRect(0,0,302,t),n.drawImage(this.spriteThumbs,0,-Asc.FONT_THUMBNAIL_HEIGHT*Math.floor(o.imgidx/a))),i.toDataURL()},getImageWidth:function(){return 302},getImageHeight:function(){return t},getListItemHeight:function(){return 26},loadSprite:function(t){t&&(this.spriteThumbs=new Image,this.spriteThumbs.onload=t,this.spriteThumbs.src=e?s:o)},fillFonts:function(t,i){var n=this;this.loadSprite(function(){if(a=Math.floor(n.spriteThumbs.width/(e?604:302))||1,n.store.set(t.toJSON()),n.rendered=!1,_.isUndefined(n.scroller)||(n.scroller.destroy(),delete n.scroller),n._scrollerIsInited=!1,n.render($(n.el)),n._fontsArray=n.store.toJSON(),n.recent>0){n.store.on("add",n.onInsertItem,n),n.store.on("remove",n.onRemoveItem,n),Common.Utils.InternalSettings.set(n.appPrefix+"-settings-recent-fonts",Common.localStorage.getItem(n.appPrefix+"-settings-recent-fonts"));var i=Common.Utils.InternalSettings.get(n.appPrefix+"-settings-recent-fonts");i=i?i.split(";"):[],i.reverse().forEach(function(t){t&&n.addItemToRecent(n.store.findWhere({name:t}),!0)})}})},onApiChangeFont:function(t){var e=this,i=_.isFunction(t.get_Name)?t.get_Name():t.asc_getFontName();this.__name!==i&&(this.__nameId||(this.__nameId=setTimeout(function(){e.onApiChangeFontInternal(i),e.__nameId=null},100)))},onApiChangeFontInternal:function(t){if(!this.inFormControl&&(this.__name=t,this.getRawValue()!==t)){var e=this.store.findWhere({name:t});if($(".selected",$(this.el)).removeClass("selected"),e){this.setRawValue(e.get(this.displayField));var i=$("#"+e.get("id"),$(this.el)),n=$("ul.dropdown-menu",this.cmpEl);i&&n&&(i.addClass("selected"),this.recent<=0&&n.scrollTop(i.offset().top-n.offset().top))}else this.setRawValue(t)}},itemClicked:function(t){Common.UI.ComboBox.prototype.itemClicked.apply(this,arguments);var e=$(t.target).closest("li"),i=this.store.findWhere({id:e.attr("id")});this.addItemToRecent(i)},onInsertItem:function(t){$(this.el).find("ul").prepend(_.template(['
  • ','',"
  • "].join(""))({item:t.attributes,scope:this}))},onRemoveItem:function(t,e,i){$(this.el).find("ul > li#"+t.id).remove()},onBeforeShowMenu:function(t){if(this.store.length<1)return void t.preventDefault();if(Common.UI.ComboBox.prototype.onBeforeShowMenu.apply(this,arguments),!this.getSelectedRecord()&&this.getRawValue()){var e=this.store.where({name:this.getRawValue()});e&&e.length&&this.selectRecord(e[e.length-1])}},onAfterShowMenu:function(t){this.recent>0?(this.scroller&&!this._scrollerIsInited&&(this.scroller.update(),this._scrollerIsInited=!0),$(this.el).find("ul").scrollTop(0),this.trigger("show:after",this,t),this.flushVisibleFontsTiles(),this.updateVisibleFontsTiles(null,0)):Common.UI.ComboBox.prototype.onAfterShowMenu.apply(this,arguments)},onAfterHideMenu:function(t){this.lastValue!==this._input.val()&&this._input.val(this.lastValue),Common.UI.ComboBox.prototype.onAfterHideMenu.apply(this,arguments)},addItemToRecent:function(t,e){if(t&&!(this.recent<1)){var i=this.store.findWhere({name:t.get("name"),type:FONT_TYPE_RECENT});i&&this.store.remove(i);var n=this.store.where({type:FONT_TYPE_RECENT});n.length0&&s.length>0){o.addClass("selected");var a=o.position().top,l=s.scrollTop();0!=a&&s.scrollTop(l+a)}}},updateVisibleFontsTiles:function(i,n){var o=this,s=0,l=o.store.length,r=0;if(o.tiles||(o.tiles=[]),l!==o.tiles.length)for(s=o.tiles.length;s=0;--t)this.tiles[t]&&(this.tiles[t].parentNode.removeChild(this.tiles[t]),this.tiles[t]=null)}}}())}),void 0===Common)var Common={};if(define("common/main/lib/component/ComboDataView",["common/main/lib/component/BaseView","common/main/lib/component/DataView"],function(){"use strict";Common.UI.ComboDataView=Common.UI.BaseView.extend({options:{id:null,cls:"",style:"",hint:!1,itemWidth:80,itemHeight:40,menuMaxHeight:300,enableKeyEvents:!1,beforeOpenHandler:null,additionalMenuItems:null,showLast:!0,minWidth:-1},template:_.template(['
    ','
    ','
    ',"
    "].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t),this.id=this.options.id||Common.UI.getId(),this.cls=this.options.cls,this.style=this.options.style,this.hint=this.options.hint,this.store=this.options.store||new Common.UI.DataViewStore,this.itemWidth=this.options.itemWidth,this.itemHeight=this.options.itemHeight,this.menuMaxHeight=this.options.menuMaxHeight,this.beforeOpenHandler=this.options.beforeOpenHandler,this.showLast=this.options.showLast,this.rootWidth=0,this.rootHeight=0,this.rendered=!1,this.needFillComboView=!1,this.minWidth=this.options.minWidth,this.fieldPicker=new Common.UI.DataView({cls:"field-picker",allowScrollbar:!1,itemTemplate:_.template(['
    ','','<% if (typeof title !== "undefined") {%>','<%= title %>',"<% } %>","
    "].join(""))}),this.openButton=new Common.UI.Button({cls:"open-menu",menu:new Common.UI.Menu({menuAlign:"tl-tl",offset:[0,3],items:[{template:_.template('')}]})}),null!=this.options.additionalMenuItems&&(this.openButton.menu.items=this.openButton.menu.items.concat(this.options.additionalMenuItems)),this.menuPicker=new Common.UI.DataView({cls:"menu-picker",parentMenu:this.openButton.menu,restoreHeight:this.menuMaxHeight,style:"max-height: "+this.menuMaxHeight+"px;",enableKeyEvents:this.options.enableKeyEvents,store:this.store,itemTemplate:_.template(['
    ','','<% if (typeof title !== "undefined") {%>','<%= title %>',"<% } %>","
    "].join(""))}),setInterval(_.bind(this.checkSize,this),500),this.options.el&&this.render()},render:function(t){if(!this.rendered){var e=this;e.trigger("render:before",e),e.cmpEl=e.$el||$(e.el);var i=e.template({id:e.id,cls:e.cls,style:e.style});t?(e.setElement(t,!1),e.cmpEl=$(i),t.html(e.cmpEl)):e.cmpEl.html(i),e.rootWidth=e.cmpEl.width(),e.rootHeight=e.cmpEl.height(),e.fieldPicker.render($(".view",e.cmpEl)),e.openButton.render($(".button",e.cmpEl)),e.menuPicker.render($(".menu-picker-container",e.cmpEl)),e.openButton.menu.cmpEl&&e.openButton.menu.cmpEl&&(e.openButton.menu.menuAlignEl=e.cmpEl,e.openButton.menu.cmpEl.css("min-width",e.itemWidth),e.openButton.menu.on("show:before",_.bind(e.onBeforeShowMenu,e)),e.openButton.menu.on("show:after",_.bind(e.onAfterShowMenu,e)),e.openButton.cmpEl.on("hide.bs.dropdown",_.bind(e.onBeforeHideMenu,e)),e.openButton.cmpEl.on("hidden.bs.dropdown",_.bind(e.onAfterHideMenu,e))),e.options.hint&&(e.cmpEl.attr("data-toggle","tooltip"),e.cmpEl.tooltip({title:e.options.hint,placement:e.options.hintAnchor||"cursor"})),e.fieldPicker.on("item:select",_.bind(e.onFieldPickerSelect,e)),e.menuPicker.on("item:select",_.bind(e.onMenuPickerSelect,e)),e.fieldPicker.on("item:click",_.bind(e.onFieldPickerClick,e)),e.menuPicker.on("item:click",_.bind(e.onMenuPickerClick,e)),e.fieldPicker.on("item:contextmenu",_.bind(e.onPickerItemContextMenu,e)),e.menuPicker.on("item:contextmenu",_.bind(e.onPickerItemContextMenu,e)),e.fieldPicker.el.addEventListener("contextmenu",_.bind(e.onPickerComboContextMenu,e),!1),e.menuPicker.el.addEventListener("contextmenu",_.bind(e.onPickerComboContextMenu,e),!1),e.onResize(),e.rendered=!0,e.trigger("render:after",e)}return this},checkSize:function(){if(this.cmpEl&&this.cmpEl.is(":visible")){var t=this,e=this.cmpEl.width(),i=this.cmpEl.height();if(e div:not(.grouped-data):not(.ps-scrollbar-x-rail):not(.ps-scrollbar-y-rail)")[0]);a.length>0&&(n.itemMarginLeft=parseInt(a.css("margin-left")),n.itemMarginRight=parseInt(a.css("margin-right")),n.itemPaddingLeft=parseInt(a.css("padding-left")),n.itemPaddingRight=parseInt(a.css("padding-right")),n.itemBorderLeft=parseInt(a.css("border-left-width")),n.itemBorderRight=parseInt(a.css("border-right-width")))}var l=o.indexOf(t);if(l<0)return;var r=o.length,c=Math.floor(Math.max(s.width(),n.minWidth)/(n.itemWidth+(n.itemMarginLeft||0)+(n.itemMarginRight||0)+(n.itemPaddingLeft||0)+(n.itemPaddingRight||0)+(n.itemBorderLeft||0)+(n.itemBorderRight||0))),d=[];s.height()/n.itemHeight>2&&(c*=Math.floor(s.height()/n.itemHeight)),l=Math.floor(l/c)*c,r-l1?t/2:t)},setItemHeight:function(t){this.itemHeight!=t&&(this.itemHeight=window.devicePixelRatio>1?t/2:t)},removeTips:function(){var t=this.menuPicker;_.each(t.dataViewItems,function(t){var e=t.$el.data("bs.tooltip");e&&e.tip().remove()},t)}})}),void 0===Common)var Common={};if(define("common/main/lib/component/SynchronizeTip",["common/main/lib/component/BaseView"],function(){"use strict";Common.UI.SynchronizeTip=Common.UI.BaseView.extend(_.extend(function(){return{options:{target:$(document.body),text:"",placement:"right",showLink:!0},template:_.template(['
    <%= scope.placement %>">','
    ','
    ',"
    ",'
    <%= scope.text %>
    ','
    ',"
    ","<% if ( scope.showLink ) { %>",'',"<% } %>","
    ","
    "].join("")),initialize:function(t){this.textSynchronize+=Common.Utils.String.platformKey("Ctrl+S"),Common.UI.BaseView.prototype.initialize.call(this,t),this.target=this.options.target,this.text=_.isEmpty(this.options.text)?this.textSynchronize:this.options.text,this.textLink=_.isEmpty(this.options.textLink)?this.textDontShow:this.options.textLink,this.placement=this.options.placement,this.showLink=this.options.showLink},render:function(){return this.cmpEl||(this.cmpEl=$(this.template({scope:this})),$(document.body).append(this.cmpEl),this.cmpEl.find(".close").on("click",_.bind(function(){this.trigger("closeclick")},this)),this.cmpEl.find(".show-link label").on("click",_.bind(function(){this.trigger("dontshowclick")},this))),this.applyPlacement(),this},show:function(){this.cmpEl?(this.applyPlacement(),this.cmpEl.show()):this.render()},hide:function(){this.cmpEl&&this.cmpEl.hide()},close:function(){this.cmpEl&&this.cmpEl.remove()},applyPlacement:function(){var t=this.target.offset(),e=Common.Utils.innerHeight();if("document"==this.placement);else if("top"==this.placement)this.cmpEl.css({bottom:e-t.top+"px",right:Common.Utils.innerWidth()-t.left-this.target.width()/2+"px"});else if("target"==this.placement)this.cmpEl.css({top:t.top+5+"px",left:t.left+5+"px"});else{var i=t.top+this.target.height()/2,n=this.cmpEl.height();i+n>e&&(i=e-n),"left"==this.placement?this.cmpEl.css({top:i+"px",right:Common.Utils.innerWidth()-t.left-5+"px"}):this.cmpEl.css({top:i+"px",left:t.left+this.target.width()+"px"})}},isVisible:function(){return this.cmpEl&&this.cmpEl.is(":visible")},textDontShow:"Don't show this message again",textSynchronize:"The document has been changed by another user.
    Please click to save your changes and reload the updates."}}(),Common.UI.SynchronizeTip||{}))}),define("common/main/lib/component/Mixtbar",["backbone","common/main/lib/component/BaseView"],function(t){"use strict";Common.UI.Mixtbar=Common.UI.BaseView.extend(function(){function t(t){var e=$(t.currentTarget).find("> a[data-tab]").data("tab");this.dblclick_el==e&&(this.fireEvent("change:compact",[e]),this.dblclick_el=void 0)}function e(t){this.isFolded&&($(t.target).parents(".toolbar, #file-menu-panel").length||o.$bar&&o.$bar.hasClass("expanded")&&this.collapse())}var i,n,o={timeout:2e3},s={},a=function(t,e){var n=i.scrollLeft();(n||"right"==t)&&i.animate({scrollLeft:"left"==t?n-100:n+100},200)};return{$tabs:void 0,$panels:void 0,isFolded:!1,initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t);this.$layout=$(t.template({tabsmarkup:_.template('
      <% for(var i in items) { %><% if (typeof items[i] == "object") { %>
    • <% if (items[i].extcls) print(\' \' + items[i].extcls) %>"><%= items[i].caption %>
    • <% } %><% } %>
    ')({items:t.tabs})})),s.tabs=t.tabs,$(document.body).on("click",e.bind(this)),Common.NotificationCenter.on("tab:visible",_.bind(function(t,e){this.setVisible(t,e)},this))},afterRender:function(){var e=this;i=e.$(".tabs > ul"),e.$tabs=i.find("> li"),e.$panels=e.$(".box-panels > .panel"),o.$bar=e.$(".toolbar");var s=e.$(".tabs .scroll.right");n=e.$(".tabs .scroll.left"),n.on("click",a.bind(this,"left")),s.on("click",a.bind(this,"right")),i.on("dblclick","> .ribtab",t.bind(this)),i.on("click","> .ribtab",e.onTabClick.bind(this))},isTabActive:function(t){var e=this.$tabs.filter(".active").find("> a");return e.length&&e.data("tab")==t},setFolded:function(t){this.isFolded=t;var e=this;if(this.isFolded)o.$box||(o.$box=e.$el.find(".box-controls")),o.$bar.addClass("folded z-clear").toggleClass("expanded",!1),o.$bar.find(".tabs .ribtab").removeClass("active"),o.$bar.on($.support.transition.end,function(t){o.$bar.hasClass("folded")&&!o.$bar.hasClass("expanded")&&o.$bar.toggleClass("z-clear",!0)}),o.$box.on({mouseleave:function(t){},mouseenter:function(t){}});else{o.$bar.removeClass("folded z-clear"),o.$box.off();var i=o.$box.find(".panel.active");if(i.length){var n=i.data("tab");e.$tabs.find("> a[data-tab="+n+"]").parent().toggleClass("active",!0)}else n=e.$tabs.siblings(":not(.x-lone):visible").first().find("> a[data-tab]").data("tab"),e.setTab(n)}},collapse:function(){Common.UI.Menu.Manager.hideAll(),this.isFolded&&o.$bar&&(o.$bar.removeClass("expanded"),o.$bar.find(".tabs .ribtab").removeClass("active"))},expand:function(){o.$bar.removeClass("z-clear"),o.$bar.addClass("expanded")},onResize:function(t){this.hasTabInvisible()?i.parent().hasClass("short")||i.parent().addClass("short"):i.parent().hasClass("short")&&i.parent().removeClass("short"),this.processPanelVisible()},onTabClick:function(t){var e=this,i=$(t.currentTarget),n=i.find("> a[data-tab]").data("tab");i.hasClass("x-lone")?e.isFolded&&e.collapse():i.hasClass("active")?e._timerSetTab||(e.dblclick_el=n,e.isFolded&&(e.collapse(),setTimeout(function(){e.dblclick_el=void 0},500))):(e._timerSetTab=!0,setTimeout(function(){e._timerSetTab=!1},500),e.setTab(n),e.processPanelVisible(null,!0),e.isFolded?e.dblclick_el=n:(e.dblclick_timer&&clearTimeout(e.dblclick_timer),e.dblclick_timer=setTimeout(function(){e.dblclick_el=n,delete e.dblclick_timer},500)))},setTab:function(t){var e=this;if(t||(this.isFolded?this.collapse():t=this.lastPanel),t){e.$tabs.removeClass("active"),e.$panels.removeClass("active");var i=this.$panels.filter("[data-tab="+t+"]");i.length&&(this.lastPanel=t,i.addClass("active")),i.length?e.isFolded&&e.expand():e.isFolded&&e.collapse();var n=this.$tabs.find("> a[data-tab="+t+"]").parent();n.length&&n.addClass("active"),this.fireEvent("tab:active",[t])}},addTab:function(t,e,n){function o(t){return s.tabs[t]?s.tabs[t].action:o(--t)}var a=_.template('');s.tabs[n+1]=t;var l=o(n),r=this.$tabs||this.$layout.find(".tabs"),c=r.find("a[data-tab="+l+"]");c.length&&(c.parent().after(a(t)),e&&(r=this.$panels||this.$layout.find(".box-panels > .panel"),c=r.filter("[data-tab="+l+"]"),c.length?c.after(e):e.appendTo(this.$layout.find(".box-panels"))),this.$tabs&&(this.$tabs=i.find("> li")),this.$panels&&(this.$panels=this.$el.find(".box-panels > .panel")))},isCompact:function(){return this.isFolded},hasTabInvisible:function(){if(i.length<1)return!1;var t=Math.round(i.offset().left),e=Math.round(t+i.width()),n=this.$tabs.filter(":visible:first").get(0);if(!n)return!1;var o=n.getBoundingClientRect();return Math.round(o.left)e)},processPanelVisible:function(t,e){function i(){var e=t||n.$panels.filter(".active");if(e&&e.length){var i=e.parents(".box-controls").width(),o=e.data(),s=o.rightedge,a=o.buttons,l=o.flex;if(s||(s=e.get(0).getBoundingClientRect().right),a||(a=[],_.each(e.find(".btn-slot .x-huge"),function(t){a.push($(t).closest(".btn-slot"))}),o.buttons=a),l||(l=[],_.each(e.find(".group.flex"),function(t){var e=$(t);l.push({el:e,width:e.attr("data-group-width")||e.attr("max-width")})}),o.flex=l),s>i){if(l.length>0)for(var r=0;rparseInt(c.css("min-width")))return;c.css("width",c.css("min-width"))}for(var r=a.length-1;r>=0;r--){var d=a[r];if(!d.hasClass("compactwidth")&&(d.addClass("compactwidth"),(s=e.get(0).getBoundingClientRect().right)<=i))break}o.rightedge=s}else{for(var r=0;ri)){d.addClass("compactwidth"),s=e.get(0).getBoundingClientRect().right;break}}if(o.rightedge=s,l.length>0&&e.find(".btn-slot.compactwidth").length<1)for(var r=0;r a[data-tab="+t+"]").parent().css("display",e?"":"none"),this.onResize())}}}())}),define("presentationeditor/main/app/view/Toolbar",["backbone","text!presentationeditor/main/app/template/Toolbar.template","text!presentationeditor/main/app/template/ToolbarView.template","common/main/lib/collection/Fonts","common/main/lib/component/Button","common/main/lib/component/ComboBox","common/main/lib/component/DataView","common/main/lib/component/ColorPalette","common/main/lib/component/ThemeColorPalette","common/main/lib/component/Menu","common/main/lib/component/DimensionPicker","common/main/lib/component/Window","common/main/lib/component/ComboBoxFonts","common/main/lib/component/ComboDataView","common/main/lib/component/SynchronizeTip","common/main/lib/component/Mixtbar"],function(t,e,i){"use strict";PE.enumLock={paragraphLock:"para-lock",shapeLock:"shape-lock",slideLock:"slide-lock",slideDeleted:"slide-deleted",noSlides:"no-slides",lostConnect:"disconnect",incIndentLock:"can-inc-indent",decIndentLock:"can-dec-indent",hyperlinkLock:"can-hyperlink",undoLock:"can-undo",redoLock:"can-redo",docPropsLock:"doc-props-lock",themeLock:"theme-lock",menuFileOpen:"menu-file-open",noParagraphSelected:"no-paragraph",noObjectSelected:"no-object",disableOnStart:"on-start",cantPrint:"cant-print",noTextSelected:"no-text",inEquation:"in-equation",commentLock:"can-comment"},PE.Views.Toolbar=Common.UI.Mixtbar.extend(_.extend(function(){return{el:"#toolbar",events:{},initialize:function(){var t=this;return t.paragraphControls=[],t.shapeControls=[],t.slideOnlyControls=[],t.synchTooltip=void 0,t.needShowSynchTip=!1,t.SchemeNames=[t.txtScheme1,t.txtScheme2,t.txtScheme3,t.txtScheme4,t.txtScheme5,t.txtScheme6,t.txtScheme7,t.txtScheme8,t.txtScheme9,t.txtScheme10,t.txtScheme11,t.txtScheme12,t.txtScheme13,t.txtScheme14,t.txtScheme15,t.txtScheme16,t.txtScheme17,t.txtScheme18,t.txtScheme19,t.txtScheme20,t.txtScheme21],t._state={hasCollaborativeChanges:void 0},t.binding={},Common.NotificationCenter.on("app:ready",t.onAppReady.bind(this)),this},applyLayout:function(t){var n=this;if(n.lockControls=[],t.isEdit){Common.UI.Mixtbar.prototype.initialize.call(this,{template:_.template(e),tabs:[{caption:n.textTabFile,action:"file",extcls:"canedit",haspanel:!1},{caption:n.textTabHome,action:"home",extcls:"canedit"},{caption:n.textTabInsert,action:"ins",extcls:"canedit"}]}),n.btnSaveCls="btn-save",n.btnSaveTip=this.tipSave+Common.Utils.String.platformKey("Ctrl+S");var o=PE.enumLock;n.btnChangeSlide=new Common.UI.Button({id:"id-toolbar-button-change-slide",cls:"btn-toolbar",iconCls:"toolbar__icon btn-changeslide",lock:[o.menuFileOpen,o.slideDeleted,o.slideLock,o.lostConnect,o.noSlides,o.disableOnStart],menu:!0}),n.slideOnlyControls.push(n.btnChangeSlide),n.btnPreview=new Common.UI.Button({id:"id-toolbar-button-preview",cls:"btn-toolbar",iconCls:"toolbar__icon btn-preview",lock:[o.menuFileOpen,o.slideDeleted,o.noSlides,o.disableOnStart],split:!0,menu:new Common.UI.Menu({items:[{caption:this.textShowBegin,value:0},{caption:this.textShowCurrent,value:1},{caption:this.textShowPresenterView,value:2},{caption:"--"},n.mnuShowSettings=new Common.UI.MenuItem({caption:this.textShowSettings,value:3,lock:[o.lostConnect]})]})}),n.slideOnlyControls.push(n.btnPreview),n.btnPrint=new Common.UI.Button({id:"id-toolbar-btn-print",cls:"btn-toolbar",iconCls:"toolbar__icon btn-print no-mask",lock:[o.slideDeleted,o.noSlides,o.cantPrint,o.disableOnStart],signals:["disabled"]}),n.slideOnlyControls.push(n.btnPrint),n.btnSave=new Common.UI.Button({id:"id-toolbar-btn-save",cls:"btn-toolbar",iconCls:"toolbar__icon no-mask "+n.btnSaveCls,lock:[o.lostConnect],signals:["disabled"]}),n.btnCollabChanges=n.btnSave,n.btnUndo=new Common.UI.Button({id:"id-toolbar-btn-undo",cls:"btn-toolbar",iconCls:"toolbar__icon btn-undo",lock:[o.undoLock,o.slideDeleted,o.lostConnect,o.disableOnStart],signals:["disabled"]}),n.slideOnlyControls.push(n.btnUndo),n.btnRedo=new Common.UI.Button({id:"id-toolbar-btn-redo",cls:"btn-toolbar",iconCls:"toolbar__icon btn-redo",lock:[o.redoLock,o.slideDeleted,o.lostConnect,o.disableOnStart],signals:["disabled"]}),n.slideOnlyControls.push(n.btnRedo),n.btnCopy=new Common.UI.Button({id:"id-toolbar-btn-copy",cls:"btn-toolbar",iconCls:"toolbar__icon btn-copy",lock:[o.slideDeleted,o.lostConnect,o.noSlides,o.disableOnStart]}),n.slideOnlyControls.push(n.btnCopy),n.btnPaste=new Common.UI.Button({id:"id-toolbar-btn-paste",cls:"btn-toolbar",iconCls:"toolbar__icon btn-paste",lock:[o.slideDeleted,o.paragraphLock,o.lostConnect,o.noSlides]}),n.paragraphControls.push(n.btnPaste),n.cmbFontName=new Common.UI.ComboBoxFonts({cls:"input-group-nr",menuCls:"scrollable-menu",menuStyle:"min-width: 325px;",hint:n.tipFontName,lock:[o.slideDeleted,o.paragraphLock,o.lostConnect,o.noSlides,o.noTextSelected,o.shapeLock],store:new Common.Collections.Fonts}),n.paragraphControls.push(n.cmbFontName),n.cmbFontSize=new Common.UI.ComboBox({cls:"input-group-nr",menuStyle:"min-width: 55px;",hint:n.tipFontSize,lock:[o.slideDeleted,o.paragraphLock,o.lostConnect,o.noSlides,o.noTextSelected,o.shapeLock],data:[{value:8,displayValue:"8"},{value:9,displayValue:"9"},{value:10,displayValue:"10"},{value:11,displayValue:"11"},{value:12,displayValue:"12"},{value:14,displayValue:"14"},{value:16,displayValue:"16"},{value:18,displayValue:"18"},{value:20,displayValue:"20"},{value:22,displayValue:"22"},{value:24,displayValue:"24"},{value:26,displayValue:"26"},{value:28,displayValue:"28"},{value:36,displayValue:"36"},{value:48,displayValue:"48"},{value:72,displayValue:"72"},{value:96,displayValue:"96"}]}),n.paragraphControls.push(n.cmbFontSize),n.btnIncFontSize=new Common.UI.Button({id:"id-toolbar-btn-incfont",cls:"btn-toolbar",iconCls:"toolbar__icon btn-incfont",lock:[o.slideDeleted,o.paragraphLock,o.lostConnect,o.noSlides,o.noTextSelected,o.shapeLock]}),n.paragraphControls.push(n.btnIncFontSize),n.btnDecFontSize=new Common.UI.Button({id:"id-toolbar-btn-decfont",cls:"btn-toolbar",iconCls:"toolbar__icon btn-decfont",lock:[o.slideDeleted,o.paragraphLock,o.lostConnect,o.noSlides,o.noTextSelected,o.shapeLock]}),n.paragraphControls.push(n.btnDecFontSize),n.btnBold=new Common.UI.Button({id:"id-toolbar-btn-bold",cls:"btn-toolbar",iconCls:"toolbar__icon btn-bold",lock:[o.slideDeleted,o.paragraphLock,o.lostConnect,o.noSlides,o.noTextSelected,o.shapeLock],enableToggle:!0}),n.paragraphControls.push(n.btnBold),n.btnItalic=new Common.UI.Button({id:"id-toolbar-btn-italic",cls:"btn-toolbar",iconCls:"toolbar__icon btn-italic",lock:[o.slideDeleted,o.paragraphLock,o.lostConnect,o.noSlides,o.noTextSelected,o.shapeLock],enableToggle:!0}),n.paragraphControls.push(n.btnItalic),n.btnUnderline=new Common.UI.Button({id:"id-toolbar-btn-underline",cls:"btn-toolbar",iconCls:"toolbar__icon btn-underline",lock:[o.slideDeleted,o.paragraphLock,o.lostConnect,o.noSlides,o.noTextSelected,o.shapeLock],enableToggle:!0}),n.paragraphControls.push(n.btnUnderline),n.btnStrikeout=new Common.UI.Button({id:"id-toolbar-btn-strikeout",cls:"btn-toolbar",iconCls:"toolbar__icon btn-strikeout",lock:[o.slideDeleted,o.paragraphLock,o.lostConnect,o.noSlides,o.noTextSelected,o.shapeLock],enableToggle:!0}),n.paragraphControls.push(n.btnStrikeout),n.btnSuperscript=new Common.UI.Button({id:"id-toolbar-btn-superscript",cls:"btn-toolbar",iconCls:"toolbar__icon btn-superscript",lock:[o.slideDeleted,o.paragraphLock,o.lostConnect,o.noSlides,o.noTextSelected,o.shapeLock,o.inEquation],enableToggle:!0,toggleGroup:"superscriptGroup"}),n.paragraphControls.push(n.btnSuperscript),n.btnSubscript=new Common.UI.Button({id:"id-toolbar-btn-subscript",cls:"btn-toolbar",iconCls:"toolbar__icon btn-subscript",lock:[o.slideDeleted,o.paragraphLock,o.lostConnect,o.noSlides,o.noTextSelected,o.shapeLock,o.inEquation],enableToggle:!0,toggleGroup:"superscriptGroup"}),n.paragraphControls.push(n.btnSubscript),n.btnFontColor=new Common.UI.Button({id:"id-toolbar-btn-fontcolor",cls:"btn-toolbar",iconCls:"toolbar__icon btn-fontcolor",lock:[o.slideDeleted,o.paragraphLock,o.lostConnect,o.noSlides,o.noTextSelected,o.shapeLock],split:!0,menu:new Common.UI.Menu({cls:"shifted-left",items:[{template:_.template('
    ')},{template:_.template(''+n.textNewColor+"")}]})}),n.paragraphControls.push(n.btnFontColor),n.btnClearStyle=new Common.UI.Button({id:"id-toolbar-btn-clearstyle",cls:"btn-toolbar",iconCls:"toolbar__icon btn-clearstyle",lock:[o.slideDeleted,o.paragraphLock,o.lostConnect,o.noSlides,o.noParagraphSelected]}),n.paragraphControls.push(n.btnClearStyle),n.btnCopyStyle=new Common.UI.Button({id:"id-toolbar-btn-copystyle",cls:"btn-toolbar",iconCls:"toolbar__icon btn-copystyle",lock:[o.slideDeleted,o.lostConnect,o.noSlides,o.noParagraphSelected,o.disableOnStart],enableToggle:!0}),n.slideOnlyControls.push(n.btnCopyStyle),n.btnMarkers=new Common.UI.Button({id:"id-toolbar-btn-markers",cls:"btn-toolbar",iconCls:"toolbar__icon btn-setmarkers",lock:[o.slideDeleted,o.paragraphLock,o.lostConnect,o.noSlides,o.noParagraphSelected],enableToggle:!0,toggleGroup:"markersGroup",split:!0,menu:!0}),n.paragraphControls.push(n.btnMarkers),n.btnNumbers=new Common.UI.Button({id:"id-toolbar-btn-numbering",cls:"btn-toolbar",iconCls:"toolbar__icon btn-numbering",lock:[o.slideDeleted,o.paragraphLock,o.lostConnect,o.noSlides,o.noParagraphSelected],enableToggle:!0,toggleGroup:"markersGroup",split:!0,menu:!0}),n.paragraphControls.push(n.btnNumbers);var s=function(t){var e={};for(var i in t)e[i]="object"==typeof t[i]?s(t[i]):t[i];return e};this.mnuMarkersPicker={conf:{index:0},selectByIndex:function(t){this.conf.index=t}},this.mnuNumbersPicker=s(this.mnuMarkersPicker),n.btnHorizontalAlign=new Common.UI.Button({id:"id-toolbar-btn-halign",cls:"btn-toolbar",iconCls:"toolbar__icon btn-align-left",icls:"btn-align-left",lock:[o.slideDeleted,o.paragraphLock,o.lostConnect,o.noSlides,o.noParagraphSelected],menu:new Common.UI.Menu({items:[{caption:n.textAlignLeft+Common.Utils.String.platformKey("Ctrl+L"),iconCls:"menu__icon btn-align-left",icls:"btn-align-left",checkable:!0,checkmark:!1,toggleGroup:"halignGroup",checked:!0,value:1},{caption:n.textAlignCenter+Common.Utils.String.platformKey("Ctrl+E"),iconCls:"menu__icon btn-align-center",icls:"btn-align-center",checkable:!0,checkmark:!1,toggleGroup:"halignGroup",value:2},{caption:n.textAlignRight+Common.Utils.String.platformKey("Ctrl+R"),iconCls:"menu__icon btn-align-right",icls:"btn-align-right",checkable:!0,checkmark:!1,toggleGroup:"halignGroup",value:0},{caption:n.textAlignJust+Common.Utils.String.platformKey("Ctrl+J"),iconCls:"menu__icon btn-align-just",icls:"btn-align-just",checkable:!0,checkmark:!1,toggleGroup:"halignGroup",value:3}]})}),n.paragraphControls.push(n.btnHorizontalAlign),n.btnVerticalAlign=new Common.UI.Button({id:"id-toolbar-btn-valign",cls:"btn-toolbar",lock:[o.slideDeleted,o.paragraphLock,o.lostConnect,o.noSlides,o.noParagraphSelected,o.noObjectSelected],iconCls:"toolbar__icon btn-align-middle",icls:"btn-align-middle",menu:new Common.UI.Menu({items:[{caption:n.textAlignTop,iconCls:"menu__icon btn-align-top",icls:"btn-align-top",checkable:!0,checkmark:!1,toggleGroup:"valignGroup",value:Asc.c_oAscVAlign.Top},{caption:n.textAlignMiddle,iconCls:"menu__icon btn-align-middle",icls:"btn-align-middle",checkable:!0,checkmark:!1,toggleGroup:"valignGroup",value:Asc.c_oAscVAlign.Center,checked:!0},{caption:n.textAlignBottom,iconCls:"menu__icon btn-align-bottom",icls:"btn-align-bottom",checkable:!0,checkmark:!1,toggleGroup:"valignGroup",value:Asc.c_oAscVAlign.Bottom}]})}),n.paragraphControls.push(n.btnVerticalAlign),n.btnDecLeftOffset=new Common.UI.Button({id:"id-toolbar-btn-decoffset",cls:"btn-toolbar",iconCls:"toolbar__icon btn-decoffset",lock:[o.decIndentLock,o.slideDeleted,o.paragraphLock,o.lostConnect,o.noSlides,o.noParagraphSelected]}),n.paragraphControls.push(n.btnDecLeftOffset),n.btnIncLeftOffset=new Common.UI.Button({id:"id-toolbar-btn-incoffset",cls:"btn-toolbar",iconCls:"toolbar__icon btn-incoffset",lock:[o.incIndentLock,o.slideDeleted,o.paragraphLock,o.lostConnect,o.noSlides,o.noParagraphSelected]}),n.paragraphControls.push(n.btnIncLeftOffset),n.btnLineSpace=new Common.UI.Button({id:"id-toolbar-btn-linespace",cls:"btn-toolbar",iconCls:"toolbar__icon btn-linespace",lock:[o.slideDeleted,o.paragraphLock,o.lostConnect,o.noSlides,o.noParagraphSelected],menu:new Common.UI.Menu({style:"min-width: 60px;",items:[{caption:"1.0",value:1,checkable:!0,toggleGroup:"linesize"},{caption:"1.15",value:1.15,checkable:!0,toggleGroup:"linesize"},{caption:"1.5",value:1.5,checkable:!0,toggleGroup:"linesize"},{caption:"2.0",value:2,checkable:!0,toggleGroup:"linesize"},{caption:"2.5",value:2.5,checkable:!0,toggleGroup:"linesize"},{caption:"3.0",value:3,checkable:!0,toggleGroup:"linesize"}]})}),n.paragraphControls.push(n.btnLineSpace),n.btnInsertTable=new Common.UI.Button({id:"tlbtn-inserttable",cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-inserttable",caption:n.capInsertTable,lock:[o.slideDeleted,o.lostConnect,o.noSlides,o.disableOnStart],menu:new Common.UI.Menu({cls:"shifted-left",items:[{template:_.template('
    ')},{caption:n.mniCustomTable,value:"custom"}]})}),n.slideOnlyControls.push(n.btnInsertTable),n.btnInsertChart=new Common.UI.Button({id:"tlbtn-insertchart",cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-insertchart",caption:n.capInsertChart,lock:[o.slideDeleted,o.lostConnect,o.noSlides,o.disableOnStart],menu:!0}),n.slideOnlyControls.push(n.btnInsertChart),n.btnInsertEquation=new Common.UI.Button({id:"tlbtn-insertequation",cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-insertequation",caption:n.capInsertEquation,lock:[o.slideDeleted,o.lostConnect,o.noSlides,o.disableOnStart],split:!0,menu:new Common.UI.Menu({cls:"menu-shapes"})}),n.slideOnlyControls.push(this.btnInsertEquation),n.btnInsertSymbol=new Common.UI.Button({id:"tlbtn-insertsymbol",cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-symbol",caption:n.capBtnInsSymbol,lock:[o.slideDeleted,o.paragraphLock,o.lostConnect,o.noSlides,o.noParagraphSelected]}),n.paragraphControls.push(n.btnInsertSymbol),n.btnInsertHyperlink=new Common.UI.Button({id:"tlbtn-insertlink",cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-inserthyperlink",caption:n.capInsertHyperlink,lock:[o.hyperlinkLock,o.slideDeleted,o.paragraphLock,o.lostConnect,o.noSlides,o.noParagraphSelected]}),n.paragraphControls.push(n.btnInsertHyperlink),n.btnInsertTextArt=new Common.UI.Button({id:"tlbtn-inserttextart",cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-textart",caption:n.capInsertTextArt,lock:[o.slideDeleted,o.lostConnect,o.noSlides,o.disableOnStart],menu:new Common.UI.Menu({cls:"menu-shapes",items:[{template:_.template('
    ')}]})}),n.slideOnlyControls.push(n.btnInsertTextArt),n.btnEditHeader=new Common.UI.Button({id:"id-toolbar-btn-editheader",cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-editheader",caption:n.capBtnInsHeader,lock:[o.slideDeleted,o.lostConnect,o.noSlides,o.disableOnStart]}),n.slideOnlyControls.push(n.btnEditHeader),n.btnInsDateTime=new Common.UI.Button({id:"id-toolbar-btn-datetime",cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-datetime",caption:n.capBtnDateTime,lock:[o.slideDeleted,o.lostConnect,o.noSlides,o.paragraphLock,o.disableOnStart]}),n.slideOnlyControls.push(n.btnInsDateTime),n.btnInsSlideNum=new Common.UI.Button({id:"id-toolbar-btn-slidenum",cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-pagenum",caption:n.capBtnSlideNum,lock:[o.slideDeleted,o.lostConnect,o.noSlides,o.paragraphLock,o.disableOnStart]}),n.slideOnlyControls.push(n.btnInsSlideNum),window.AscDesktopEditor&&window.AscDesktopEditor.IsSupportMedia&&window.AscDesktopEditor.IsSupportMedia()&&(n.btnInsAudio=new Common.UI.Button({id:"tlbtn-insaudio",cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-audio",caption:n.capInsertAudio,lock:[o.slideDeleted,o.lostConnect,o.noSlides,o.disableOnStart]}),n.slideOnlyControls.push(n.btnInsAudio),n.btnInsVideo=new Common.UI.Button({id:"tlbtn-insvideo",cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-video",caption:n.capInsertVideo,lock:[o.slideDeleted,o.lostConnect,o.noSlides,o.disableOnStart]}),n.slideOnlyControls.push(n.btnInsVideo)),n.btnColorSchemas=new Common.UI.Button({id:"id-toolbar-btn-colorschemas",cls:"btn-toolbar",iconCls:"toolbar__icon btn-colorschemas",lock:[o.themeLock,o.slideDeleted,o.lostConnect,o.noSlides,o.disableOnStart],menu:new Common.UI.Menu({cls:"shifted-left",items:[],restoreHeight:!0})}),n.slideOnlyControls.push(n.btnColorSchemas),n.mniAlignToSlide=new Common.UI.MenuItem({caption:n.txtSlideAlign,checkable:!0,toggleGroup:"slidealign",value:-1}).on("click",function(t){Common.Utils.InternalSettings.set("pe-align-to-slide",!0)}),n.mniAlignObjects=new Common.UI.MenuItem({caption:n.txtObjectsAlign,checkable:!0,toggleGroup:"slidealign",value:-1}).on("click",function(t){Common.Utils.InternalSettings.set("pe-align-to-slide",!1)}),n.mniDistribHor=new Common.UI.MenuItem({caption:n.txtDistribHor,iconCls:"menu__icon shape-distribute-hor",value:6}),n.mniDistribVert=new Common.UI.MenuItem({caption:n.txtDistribVert,iconCls:"menu__icon shape-distribute-vert",value:7}),n.btnShapeAlign=new Common.UI.Button({id:"id-toolbar-btn-shape-align",cls:"btn-toolbar",iconCls:"toolbar__icon shape-align-left",lock:[o.slideDeleted,o.shapeLock,o.lostConnect,o.noSlides,o.noObjectSelected,o.disableOnStart],menu:new Common.UI.Menu({cls:"shifted-right",items:[{caption:n.textShapeAlignLeft,iconCls:"menu__icon shape-align-left",value:Asc.c_oAscAlignShapeType.ALIGN_LEFT},{caption:n.textShapeAlignCenter,iconCls:"menu__icon shape-align-center",value:Asc.c_oAscAlignShapeType.ALIGN_CENTER},{caption:n.textShapeAlignRight,iconCls:"menu__icon shape-align-right",value:Asc.c_oAscAlignShapeType.ALIGN_RIGHT},{caption:n.textShapeAlignTop,iconCls:"menu__icon shape-align-top",value:Asc.c_oAscAlignShapeType.ALIGN_TOP},{caption:n.textShapeAlignMiddle,iconCls:"menu__icon shape-align-middle",value:Asc.c_oAscAlignShapeType.ALIGN_MIDDLE},{caption:n.textShapeAlignBottom,iconCls:"menu__icon shape-align-bottom",value:Asc.c_oAscAlignShapeType.ALIGN_BOTTOM},{caption:"--"},n.mniDistribHor,n.mniDistribVert,{caption:"--"},n.mniAlignToSlide,n.mniAlignObjects]})}),n.shapeControls.push(n.btnShapeAlign),n.slideOnlyControls.push(n.btnShapeAlign),n.btnShapeArrange=new Common.UI.Button({id:"id-toolbar-btn-shape-arrange",cls:"btn-toolbar",iconCls:"toolbar__icon arrange-front",lock:[o.slideDeleted,o.lostConnect,o.noSlides,o.noObjectSelected,o.disableOnStart],menu:new Common.UI.Menu({items:[{caption:n.textArrangeFront,iconCls:"menu__icon arrange-front",value:1},{caption:n.textArrangeBack,iconCls:"menu__icon arrange-back",value:2},{caption:n.textArrangeForward,iconCls:"menu__icon arrange-forward",value:3},{caption:n.textArrangeBackward,iconCls:"menu__icon arrange-backward",value:4},{caption:"--"},n.mnuGroupShapes=new Common.UI.MenuItem({caption:n.txtGroup,iconCls:"menu__icon shape-group",value:5}),n.mnuUnGroupShapes=new Common.UI.MenuItem({caption:n.txtUngroup,iconCls:"menu__icon shape-ungroup",value:6})]})}),n.slideOnlyControls.push(n.btnShapeArrange),n.btnSlideSize=new Common.UI.Button({id:"id-toolbar-btn-slide-size",cls:"btn-toolbar",iconCls:"toolbar__icon btn-slidesize",lock:[o.docPropsLock,o.slideDeleted,o.lostConnect,o.disableOnStart],menu:new Common.UI.Menu({items:[{caption:n.mniSlideStandard,checkable:!0,toggleGroup:"slidesize",value:0},{caption:n.mniSlideWide,checkable:!0,toggleGroup:"slidesize",value:1},{caption:"--"},{caption:n.mniSlideAdvanced,value:"advanced"}]})}),n.slideOnlyControls.push(n.btnSlideSize),n.listTheme=new Common.UI.ComboDataView({cls:"combo-styles",itemWidth:85,enableKeyEvents:!0,itemHeight:38,lock:[o.themeLock,o.lostConnect,o.noSlides],beforeOpenHandler:function(t){var e=this,i=e.openButton.menu;if(i.cmpEl){var n=$(e.cmpEl.find(".dataview.inner .style").get(0)).parent(),o=n.is(":visible")?parseInt(n.css("width")):e.itemWidth+parseInt(n.css("padding-left"))+parseInt(n.css("padding-right"))+parseInt(n.css("border-left-width"))+parseInt(n.css("border-right-width")),s=e.menuPicker.store.length>=6?6:e.menuPicker.store.length,a=Math.min(e.menuPicker.store.length,Math.round($(".dataview",$(e.fieldPicker.el)).width()/(-1+o)+.5));a=a','
    background-image: url(<%= imageUrl %>);<% } %> background-position: 0 -<%= offsety %>px;">
    ',""].join("")), +n.listTheme.menuPicker.itemTemplate=_.template(['
    ','
    background-image: url(<%= imageUrl %>);<% } %> background-position: 0 -<%= offsety %>px;">
    ',"
    "].join("")),this.lockControls=[this.btnChangeSlide,this.btnSave,this.btnCopy,this.btnPaste,this.btnUndo,this.btnRedo,this.cmbFontName,this.cmbFontSize,this.btnIncFontSize,this.btnDecFontSize,this.btnBold,this.btnItalic,this.btnUnderline,this.btnStrikeout,this.btnSuperscript,this.btnSubscript,this.btnFontColor,this.btnClearStyle,this.btnCopyStyle,this.btnMarkers,this.btnNumbers,this.btnDecLeftOffset,this.btnIncLeftOffset,this.btnLineSpace,this.btnHorizontalAlign,this.btnVerticalAlign,this.btnShapeArrange,this.btnShapeAlign,this.btnInsertTable,this.btnInsertChart,this.btnInsertEquation,this.btnInsertSymbol,this.btnInsertHyperlink,this.btnColorSchemas,this.btnSlideSize,this.listTheme,this.mnuShowSettings],_.each([n.btnSave].concat(n.paragraphControls),function(t){_.isFunction(t.setDisabled)&&t.setDisabled(!0)}),this.lockToolbar(PE.enumLock.disableOnStart,!0,{array:n.slideOnlyControls.concat(n.shapeControls)}),this.on("render:after",_.bind(this.onToolbarAfterRender,this))}else Common.UI.Mixtbar.prototype.initialize.call(this,{template:_.template(i),tabs:[{caption:n.textTabFile,action:"file",haspanel:!1}]});return this},lockToolbar:function(t,e,i){Common.Utils.lockControls(t,e,i,this.lockControls)},render:function(t){var e=this;return this.fireEvent("render:before",[this]),e.isCompactView=t.compactview,t.isEdit?e.$el.html(e.rendererComponents(e.$layout)):(e.$layout.find(".canedit").hide(),e.$layout.addClass("folded"),e.$el.html(e.$layout)),this.fireEvent("render:after",[this]),Common.UI.Mixtbar.prototype.afterRender.call(this),Common.NotificationCenter.on({"window:resize":function(){Common.UI.Mixtbar.prototype.onResize.apply(e,arguments)}}),t.isEdit&&(e.setTab("home"),e.processPanelVisible()),e.isCompactView&&e.setFolded(!0),this},onTabClick:function(t){var e=this,i=$(t.currentTarget).find("> a[data-tab]").data("tab"),n=e.isTabActive("file");Common.UI.Mixtbar.prototype.onTabClick.apply(e,arguments),n?e.fireEvent("file:close"):"file"==i&&(e.fireEvent("file:open"),e.setTab(i))},rendererComponents:function(t){var e=$(t),i=function(t,i){Common.Utils.injectComponent(e.find(t),i)};i("#slot-field-fontname",this.cmbFontName),i("#slot-field-fontsize",this.cmbFontSize),i("#slot-btn-changeslide",this.btnChangeSlide),i("#slot-btn-preview",this.btnPreview),i("#slot-btn-print",this.btnPrint),i("#slot-btn-save",this.btnSave),i("#slot-btn-undo",this.btnUndo),i("#slot-btn-redo",this.btnRedo),i("#slot-btn-copy",this.btnCopy),i("#slot-btn-paste",this.btnPaste),i("#slot-btn-bold",this.btnBold),i("#slot-btn-italic",this.btnItalic),i("#slot-btn-underline",this.btnUnderline),i("#slot-btn-strikeout",this.btnStrikeout),i("#slot-btn-superscript",this.btnSuperscript),i("#slot-btn-subscript",this.btnSubscript),i("#slot-btn-incfont",this.btnIncFontSize),i("#slot-btn-decfont",this.btnDecFontSize),i("#slot-btn-fontcolor",this.btnFontColor),i("#slot-btn-clearstyle",this.btnClearStyle),i("#slot-btn-copystyle",this.btnCopyStyle),i("#slot-btn-markers",this.btnMarkers),i("#slot-btn-numbering",this.btnNumbers),i("#slot-btn-incoffset",this.btnIncLeftOffset),i("#slot-btn-decoffset",this.btnDecLeftOffset),i("#slot-btn-halign",this.btnHorizontalAlign),i("#slot-btn-valign",this.btnVerticalAlign),i("#slot-btn-linespace",this.btnLineSpace),i("#slot-btn-arrange-shape",this.btnShapeArrange),i("#slot-btn-align-shape",this.btnShapeAlign),i("#slot-btn-insertequation",this.btnInsertEquation),i("#slot-btn-inssymbol",this.btnInsertSymbol),i("#slot-btn-insertlink",this.btnInsertHyperlink),i("#slot-btn-inserttable",this.btnInsertTable),i("#slot-btn-insertchart",this.btnInsertChart),i("#slot-btn-instextart",this.btnInsertTextArt),i("#slot-btn-colorschemas",this.btnColorSchemas),i("#slot-btn-slidesize",this.btnSlideSize),i("#slot-field-styles",this.listTheme),i("#slot-btn-editheader",this.btnEditHeader),i("#slot-btn-datetime",this.btnInsDateTime),i("#slot-btn-slidenum",this.btnInsSlideNum),this.btnInsAudio&&i("#slot-btn-insaudio",this.btnInsAudio),this.btnInsVideo&&i("#slot-btn-insvideo",this.btnInsVideo),this.btnInsAudio||this.btnInsVideo||e.find("#slot-btn-insaudio").parents(".group").hide().prev().hide(),this.btnsInsertImage=Common.Utils.injectButtons(e.find(".slot-insertimg"),"tlbtn-insertimage-","toolbar__icon btn-insertimage",this.capInsertImage,[PE.enumLock.slideDeleted,PE.enumLock.lostConnect,PE.enumLock.noSlides,PE.enumLock.disableOnStart],!1,!0),this.btnsInsertText=Common.Utils.injectButtons(e.find(".slot-instext"),"tlbtn-inserttext-","toolbar__icon btn-text",this.capInsertText,[PE.enumLock.slideDeleted,PE.enumLock.lostConnect,PE.enumLock.noSlides,PE.enumLock.disableOnStart],!1,!1,!0),this.btnsInsertShape=Common.Utils.injectButtons(e.find(".slot-insertshape"),"tlbtn-insertshape-","toolbar__icon btn-insertshape",this.capInsertShape,[PE.enumLock.slideDeleted,PE.enumLock.lostConnect,PE.enumLock.noSlides,PE.enumLock.disableOnStart],!1,!0,!0),this.btnsAddSlide=Common.Utils.injectButtons(e.find(".slot-addslide"),"tlbtn-addslide-","toolbar__icon btn-addslide",this.capAddSlide,[PE.enumLock.menuFileOpen,PE.enumLock.lostConnect,PE.enumLock.disableOnStart],!0,!0);var n=this.btnsInsertImage.concat(this.btnsInsertText,this.btnsInsertShape,this.btnsAddSlide);return this.lockToolbar(PE.enumLock.disableOnStart,!0,{array:n}),Array.prototype.push.apply(this.slideOnlyControls,n),Array.prototype.push.apply(this.lockControls,n),e},onAppReady:function(t){var e=this;t.isEdit&&(e.btnsInsertImage.forEach(function(i){i.updateHint(e.tipInsertImage),i.setMenu(new Common.UI.Menu({items:[{caption:e.mniImageFromFile,value:"file"},{caption:e.mniImageFromUrl,value:"url"},{caption:e.mniImageFromStorage,value:"storage"}]}).on("item:click",function(t,i,n){e.fireEvent("insert:image",[i.value])})),i.menu.items[2].setVisible(t.canRequestInsertImage||t.fileChoiceUrl&&t.fileChoiceUrl.indexOf("{documentType}")>-1)}),e.btnsInsertText.forEach(function(t){t.updateHint(e.tipInsertText),t.on("click",function(t,i){e.fireEvent("insert:text",[t.pressed?"begin":"end"])})}),e.btnsInsertShape.forEach(function(t){t.updateHint(e.tipInsertShape),t.setMenu(new Common.UI.Menu({cls:"menu-shapes"}).on("hide:after",function(t){e.fireEvent("insert:shape",["menu:hide"])}))}),e.btnsAddSlide.forEach(function(t,i){t.updateHint(e.tipAddSlide+Common.Utils.String.platformKey("Ctrl+M")),t.setMenu(new Common.UI.Menu({items:[{template:_.template('')}]})),t.on("click",function(t,i){e.fireEvent("add:slide")})}))},createDelayedElements:function(){this.btnChangeSlide.updateHint(this.tipChangeSlide),this.btnPreview.updateHint(this.tipPreview),this.btnPrint.updateHint(this.tipPrint+Common.Utils.String.platformKey("Ctrl+P")),this.btnSave.updateHint(this.btnSaveTip),this.btnUndo.updateHint(this.tipUndo+Common.Utils.String.platformKey("Ctrl+Z")),this.btnRedo.updateHint(this.tipRedo+Common.Utils.String.platformKey("Ctrl+Y")),this.btnCopy.updateHint(this.tipCopy+Common.Utils.String.platformKey("Ctrl+C")),this.btnPaste.updateHint(this.tipPaste+Common.Utils.String.platformKey("Ctrl+V")),this.btnIncFontSize.updateHint(this.tipIncFont+Common.Utils.String.platformKey("Ctrl+]")),this.btnDecFontSize.updateHint(this.tipDecFont+Common.Utils.String.platformKey("Ctrl+[")),this.btnBold.updateHint(this.textBold+Common.Utils.String.platformKey("Ctrl+B")),this.btnItalic.updateHint(this.textItalic+Common.Utils.String.platformKey("Ctrl+I")),this.btnUnderline.updateHint(this.textUnderline+Common.Utils.String.platformKey("Ctrl+U")),this.btnStrikeout.updateHint(this.textStrikeout),this.btnSuperscript.updateHint(this.textSuperscript),this.btnSubscript.updateHint(this.textSubscript),this.btnFontColor.updateHint(this.tipFontColor),this.btnClearStyle.updateHint(this.tipClearStyle),this.btnCopyStyle.updateHint(this.tipCopyStyle+Common.Utils.String.platformKey("Ctrl+Shift+C")),this.btnMarkers.updateHint(this.tipMarkers),this.btnNumbers.updateHint(this.tipNumbers),this.btnHorizontalAlign.updateHint(this.tipHAligh),this.btnVerticalAlign.updateHint(this.tipVAligh),this.btnDecLeftOffset.updateHint(this.tipDecPrLeft+Common.Utils.String.platformKey("Ctrl+Shift+M")),this.btnIncLeftOffset.updateHint(this.tipIncPrLeft),this.btnLineSpace.updateHint(this.tipLineSpace),this.btnInsertTable.updateHint(this.tipInsertTable),this.btnInsertChart.updateHint(this.tipInsertChart),this.btnInsertEquation.updateHint(this.tipInsertEquation),this.btnInsertSymbol.updateHint(this.tipInsertSymbol),this.btnInsertHyperlink.updateHint(this.tipInsertHyperlink+Common.Utils.String.platformKey("Ctrl+K")),this.btnInsertTextArt.updateHint(this.tipInsertTextArt),this.btnInsAudio&&this.btnInsAudio.updateHint(this.tipInsertAudio),this.btnInsVideo&&this.btnInsVideo.updateHint(this.tipInsertVideo),this.btnColorSchemas.updateHint(this.tipColorSchemas),this.btnShapeAlign.updateHint(this.tipShapeAlign),this.btnShapeArrange.updateHint(this.tipShapeArrange),this.btnSlideSize.updateHint(this.tipSlideSize),this.btnEditHeader.updateHint(this.tipEditHeader),this.btnInsDateTime.updateHint(this.tipDateTime),this.btnInsSlideNum.updateHint(this.tipSlideNum);var t=this;this.btnMarkers.setMenu(new Common.UI.Menu({cls:"shifted-left",style:"min-width: 139px",items:[{template:_.template('')},this.mnuMarkerSettings=new Common.UI.MenuItem({caption:this.textListSettings,value:"settings"})]})),this.btnNumbers.setMenu(new Common.UI.Menu({cls:"shifted-left",items:[{template:_.template('')},this.mnuNumberSettings=new Common.UI.MenuItem({caption:this.textListSettings,value:"settings"})]})),this.btnChangeSlide.setMenu(new Common.UI.Menu({items:[{template:_.template('')}]})),this.btnInsertChart.setMenu(new Common.UI.Menu({style:"width: 364px;padding-top: 12px;",items:[{template:_.template('')}]}));var e=function(i){new Common.UI.DataView({el:$("#id-toolbar-menu-insertchart"),parentMenu:i,showLast:!1,restoreHeight:421,groups:new Common.UI.DataViewGroupStore(Common.define.chartData.getChartGroupData()),store:new Common.UI.DataViewStore(Common.define.chartData.getChartData()),itemTemplate:_.template('
    ')}).on("item:click",function(e,i,n,o){n&&t.fireEvent("add:chart",[n.get("type")])}),i.off("show:before",e)};this.btnInsertChart.menu.on("show:before",e);var i=function(e){var n=PE.getCollection("Common.Collections.TextArt");n.length<1&&PE.getController("Main").fillTextArt(t.api.asc_getTextArtPreviews()),new Common.UI.DataView({el:$("#view-insert-art",e.$el),store:n,parentMenu:e,showLast:!1,itemTemplate:_.template('
    ')}).on("item:click",function(i,n,o,s){o&&t.fireEvent("insert:textart",[o.get("data")]),"click"!==s.type&&e.hide()}),e.off("show:before",i)};this.btnInsertTextArt.menu.on("show:before",i);var n=this.mnuMarkersPicker.conf;this.mnuMarkersPicker=new Common.UI.DataView({el:$("#id-toolbar-menu-markers"),parentMenu:this.btnMarkers.menu,restoreHeight:138,allowScrollbar:!1,store:new Common.UI.DataViewStore([{offsety:0,data:{type:0,subtype:-1}},{offsety:38,data:{type:0,subtype:1}},{offsety:76,data:{type:0,subtype:2}},{offsety:114,data:{type:0,subtype:3}},{offsety:152,data:{type:0,subtype:4}},{offsety:190,data:{type:0,subtype:5}},{offsety:228,data:{type:0,subtype:6}},{offsety:266,data:{type:0,subtype:7}},{offsety:684,data:{type:0,subtype:8}}]),itemTemplate:_.template('
    ')}),n&&this.mnuMarkersPicker.selectByIndex(n.index,!0),n=this.mnuNumbersPicker.conf,this.mnuNumbersPicker=new Common.UI.DataView({el:$("#id-toolbar-menu-numbering"),parentMenu:this.btnNumbers.menu,restoreHeight:92,allowScrollbar:!1,store:new Common.UI.DataViewStore([{offsety:0,data:{type:1,subtype:-1}},{offsety:570,data:{type:1,subtype:4}},{offsety:532,data:{type:1,subtype:5}},{offsety:608,data:{type:1,subtype:6}},{offsety:418,data:{type:1,subtype:1}},{offsety:456,data:{type:1,subtype:2}},{offsety:494,data:{type:1,subtype:3}},{offsety:646,data:{type:1,subtype:7}}]),itemTemplate:_.template('
    ')}),n&&this.mnuNumbersPicker.selectByIndex(n.index,!0),this.mnuTablePicker=new Common.UI.DimensionPicker({el:$("#id-toolbar-menu-tablepicker"),minRows:8,minColumns:10,maxRows:8,maxColumns:10}),this.showSynchTip=!Common.localStorage.getBool("pe-hide-synch"),this.needShowSynchTip&&(this.needShowSynchTip=!1,this.onCollaborativeChanges())},onToolbarAfterRender:function(t){if(this.btnFontColor.cmpEl){var e=$('
    ');$("button:first-child",this.btnFontColor.cmpEl).append(e),e.css("background-color",this.btnFontColor.currentColor||"transparent"),this.mnuFontColorPicker=new Common.UI.ThemeColorPalette({el:$("#id-toolbar-menu-fontcolor")})}},setApi:function(t){return this.api=t,this.api&&(this.api.asc_registerCallback("asc_onSendThemeColorSchemes",_.bind(this.onSendThemeColorSchemes,this)),this.api.asc_registerCallback("asc_onCollaborativeChanges",_.bind(this.onCollaborativeChanges,this)),this.api.asc_registerCallback("asc_onAuthParticipantsChanged",_.bind(this.onApiUsersChanged,this)),this.api.asc_registerCallback("asc_onParticipantsChanged",_.bind(this.onApiUsersChanged,this))),this},setMode:function(t){t.isDisconnected?(this.lockToolbar(PE.enumLock.lostConnect,!0),t.enableDownload||this.lockToolbar(PE.enumLock.cantPrint,!0,{array:[this.btnPrint]})):this.lockToolbar(PE.enumLock.cantPrint,!t.canPrint,{array:[this.btnPrint]}),this.mode=t},onSendThemeColorSchemes:function(t){var e=this,i=e.btnColorSchemas.menu;if(i){i&&i.items.length>0&&_.each(i.items,function(t){t.remove()}),null==i&&(i=new Common.UI.Menu({cls:"shifted-left",restoreHeight:!0})),i.items=[];var n=_.template(['','',"<% _.each(options.colors, function(color) { %>",'',"<% }) %>","",'<%= caption %>',""].join(""));_.each(t,function(t,o){for(var s=t.get_colors(),a=[],l=2;l<7;l++){var r="#"+Common.Utils.ThemeColor.getHexColor(s[l].get_r(),s[l].get_g(),s[l].get_b());a.push(r)}21==o&&i.addItem({caption:"--"});var c=t.get_name();i.addItem({template:n,cls:"color-schemas-menu",colors:a,caption:o<21?e.SchemeNames[o]||c:c,value:o,checkable:!0,toggleGroup:"menuSchema"})},this)}},onCollaborativeChanges:function(){if(!this._state.hasCollaborativeChanges){if(!this.btnCollabChanges.rendered)return void(this.needShowSynchTip=!0);var t=PE.getController("Viewport").getView("DocumentPreview");if(t&&t.isVisible())return void(this.needShowSynchTip=!0);this._state.hasCollaborativeChanges=!0,this.btnCollabChanges.cmpEl.addClass("notify"),this.showSynchTip?(this.btnCollabChanges.updateHint(""),void 0===this.synchTooltip&&this.createSynchTip(),this.synchTooltip.show()):this.btnCollabChanges.updateHint(this.tipSynchronize+Common.Utils.String.platformKey("Ctrl+S")),this.btnSave.setDisabled(!1),Common.Gateway.collaborativeChanges()}},createSynchTip:function(){this.synchTooltip=new Common.UI.SynchronizeTip({extCls:this.mode.customization&&this.mode.customization.compactHeader?void 0:"inc-index",target:this.btnCollabChanges.$el}),this.synchTooltip.on("dontshowclick",function(){this.showSynchTip=!1,this.synchTooltip.hide(),this.btnCollabChanges.updateHint(this.tipSynchronize+Common.Utils.String.platformKey("Ctrl+S")),Common.localStorage.setItem("pe-hide-synch",1)},this),this.synchTooltip.on("closeclick",function(){this.synchTooltip.hide(),this.btnCollabChanges.updateHint(this.tipSynchronize+Common.Utils.String.platformKey("Ctrl+S"))},this)},synchronizeChanges:function(){if(this.btnCollabChanges.rendered){var t=this;t.btnCollabChanges.cmpEl.hasClass("notify")&&(t.btnCollabChanges.cmpEl.removeClass("notify"),this.synchTooltip&&this.synchTooltip.hide(),this.btnCollabChanges.updateHint(this.btnSaveTip),this.btnSave.setDisabled(!t.mode.forcesave),this._state.hasCollaborativeChanges=!1)}},onApiUsersChanged:function(t){var e=[];_.each(t,function(t){t.asc_getView()||e.push(t)});var i=_.size(e),n=i>1?"btn-save-coauth":"btn-save";n!==this.btnSaveCls&&this.btnCollabChanges.rendered&&(this.btnSaveTip=(i>1?this.tipSaveCoauth:this.tipSave)+Common.Utils.String.platformKey("Ctrl+S"),this.btnCollabChanges.updateHint(this.btnSaveTip),this.btnCollabChanges.$icon.removeClass(this.btnSaveCls).addClass(n),this.btnSaveCls=n)},onSlidePickerShowAfter:function(t){if(t._needRecalcSlideLayout&&t.cmpEl&&t.dataViewItems.length>0){var e=t.dataViewItems,i=$(e[0].el),n=i.outerWidth()+parseInt(i.css("margin-left"))+parseInt(i.css("margin-right")),o=Math.floor(t.options.restoreWidth/n+.5)||1,s=0,a=0;t.cmpEl.width(n*o+11);for(var l=0;la?a=c:r.css({height:a}),s++,s>o-1&&(s=0,a=0)}t._needRecalcSlideLayout=!1}},updateAutoshapeMenu:function(t,e){var i=this,n=function(t){for(var o=0;o')}).on("item:click",function(t,e,n,o){"click"!==o.type&&Common.UI.Menu.Manager.hideAll(),n&&i.fireEvent("insert:shape",[n.get("data").shapeType])})}t.off("show:after",n)};t.on("show:after",n);for(var o=0;o')}]})});t.addItem(a)}},updateAddSlideMenu:function(t){if(!(t.size()<1)){var e=this;e.binding.onShowBeforeAddSlide?e.btnsAddSlide.concat(e.btnChangeSlide).forEach(function(t,e){t.mnuSlidePicker&&(t.mnuSlidePicker._needRecalcSlideLayout=!0)}):(e.binding.onShowBeforeAddSlide=function(t){var i=this.iconCls.indexOf("btn-changeslide")>-1,n=new Common.UI.DataView({el:$(".menu-layouts",t.$el),parentMenu:t,showLast:i,restoreHeight:300,restoreWidth:302,style:"max-height: 300px;",store:PE.getCollection("SlideLayouts"),itemTemplate:_.template(['
    ','
    ','
    <%= title %>
    ',"
    "].join(""))});n.on("item:click",function(t,n,o,s){"click"!==s.type&&Common.UI.Menu.Manager.hideAll(),o&&e.fireEvent(i?"change:slide":"add:slide",[o.get("data").idx])}),t&&t.on("show:after",function(){if(e.onSlidePickerShowAfter(n),n.scroller.update({alwaysVisibleY:!0}),i){var t=n.store.findLayoutByIndex(n.options.layout_index);t&&(n.selectRecord(t,!0),n.scrollToRecord(t))}else n.scroller.scrollTop(0)}),t.off("show:before",e.binding.onShowBeforeAddSlide),i&&this.mnuSlidePicker&&(n.options.layout_index=this.mnuSlidePicker.options.layout_index),this.mnuSlidePicker=n,this.mnuSlidePicker._needRecalcSlideLayout=!0},e.btnsAddSlide.concat(e.btnChangeSlide).forEach(function(t,i){t.menu.on("show:before",e.binding.onShowBeforeAddSlide,t)}))}},textBold:"Bold",textItalic:"Italic",textUnderline:"Underline",textStrikeout:"Strikeout",textSuperscript:"Superscript",textSubscript:"Subscript",tipFontName:"Font Name",tipFontSize:"Font Size",tipCopy:"Copy",tipPaste:"Paste",tipUndo:"Undo",tipRedo:"Redo",tipPrint:"Print",tipSave:"Save",tipFontColor:"Font color",tipMarkers:"Bullets",tipNumbers:"Numbering",tipBack:"Back",tipClearStyle:"Clear Style",tipCopyStyle:"Copy Style",textTitleError:"Error",tipHAligh:"Horizontal Align",tipVAligh:"Vertical Align",textAlignTop:"Align text to the top",textAlignMiddle:"Align text to the middle",textAlignBottom:"Align text to the bottom",textAlignLeft:"Left align text",textAlignRight:"Right align text",textAlignCenter:"Center text",textAlignJust:"Justify",tipDecPrLeft:"Decrease Indent",tipIncPrLeft:"Increase Indent",tipLineSpace:"Line Spacing",tipInsertTable:"Insert Table",tipInsertImage:"Insert Image",mniImageFromFile:"Image from file",mniImageFromUrl:"Image from url",mniCustomTable:"Insert Custom Table",tipInsertHyperlink:"Add Hyperlink",tipInsertText:"Insert Text",tipInsertTextArt:"Insert Text Art",tipInsertShape:"Insert Autoshape",tipPreview:"Start Slideshow",tipAddSlide:"Add Slide",tipShapeAlign:"Align Shape",tipShapeArrange:"Arrange Shape",textShapeAlignLeft:"Align Left",textShapeAlignRight:"Align Right",textShapeAlignCenter:"Align Center",textShapeAlignTop:"Align Top",textShapeAlignBottom:"Align Bottom",textShapeAlignMiddle:"Align Middle",textArrangeFront:"Bring To Front",textArrangeBack:"Send To Back",textArrangeForward:"Bring Forward",textArrangeBackward:"Send Backward",txtGroup:"Group",txtUngroup:"Ungroup",txtDistribHor:"Distribute Horizontally",txtDistribVert:"Distribute Vertically",tipChangeSlide:"Change Slide Layout",tipColorSchemas:"Change Color Scheme",textNewColor:"Add New Custom Color",mniSlideStandard:"Standard (4:3)",mniSlideWide:"Widescreen (16:9)",mniSlideAdvanced:"Advanced Settings",tipSlideSize:"Select Slide Size",tipInsertChart:"Insert Chart",tipSynchronize:"The document has been changed by another user. Please click to save your changes and reload the updates.",txtScheme1:"Office",txtScheme2:"Grayscale",txtScheme3:"Apex",txtScheme4:"Aspect",txtScheme5:"Civic",txtScheme6:"Concourse",txtScheme7:"Equity",txtScheme8:"Flow",txtScheme9:"Foundry",txtScheme10:"Median",txtScheme11:"Metro",txtScheme12:"Module",txtScheme13:"Opulent",txtScheme14:"Oriel",txtScheme15:"Origin",txtScheme16:"Paper",txtScheme17:"Solstice",txtScheme18:"Technic",txtScheme19:"Trek",txtScheme20:"Urban",txtScheme21:"Verve",tipSlideTheme:"Slide Theme",tipSaveCoauth:"Save your changes for the other users to see them.",textShowBegin:"Show from Beginning",textShowCurrent:"Show from Current slide",textShowSettings:"Show Settings",tipInsertEquation:"Insert Equation",tipChangeChart:"Change Chart Type",capInsertText:"Text",capInsertTextArt:"Text Art",capInsertImage:"Image",capInsertShape:"Shape",capInsertTable:"Table",capInsertChart:"Chart",capInsertHyperlink:"Hyperlink",capInsertEquation:"Equation",capAddSlide:"Add Slide",capTabFile:"File",capTabHome:"Home",capTabInsert:"Insert",capBtnComment:"Comment",textTabFile:"File",textTabHome:"Home",textTabInsert:"Insert",textShowPresenterView:"Show presenter view",textTabCollaboration:"Collaboration",textTabProtect:"Protection",mniImageFromStorage:"Image from Storage",txtSlideAlign:"Align to Slide",txtObjectsAlign:"Align Selected Objects",tipEditHeader:"Edit footer",tipSlideNum:"Insert slide number",tipDateTime:"Insert current date and time",capBtnInsHeader:"Footer",capBtnSlideNum:"Slide Number",capBtnDateTime:"Date & Time",textListSettings:"List Settings",capBtnAddComment:"Add Comment",capBtnInsSymbol:"Symbol",tipInsertSymbol:"Insert symbol",capInsertAudio:"Audio",capInsertVideo:"Video",tipInsertAudio:"Insert audio",tipInsertVideo:"Insert video",tipIncFont:"Increment font size",tipDecFont:"Decrement font size"}}(),PE.Views.Toolbar||{}))}),define("presentationeditor/main/app/view/DateTimeDialog",["common/main/lib/component/Window","common/main/lib/component/ComboBox","common/main/lib/component/ListView"],function(){"use strict";PE.Views.DateTimeDialog=Common.UI.Window.extend(_.extend({options:{width:350,style:"min-width: 230px;",cls:"modal-dlg",buttons:["ok","cancel"]},initialize:function(t){_.extend(this.options,{title:this.txtTitle},t||{}),this.template=['
    ','
    ','","
    ",'
    ','
    ','","
    ",'
    ','
    ','
    ','","
    ","
    "].join(""),this.options.tpl=_.template(this.template)(this.options),this.api=this.options.api,this.lang=this.options.lang,this.handler=this.options.handler,Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this);var t=[{value:1068},{value:1026},{value:1029},{value:1031},{value:2055},{value:1032},{value:3081},{value:2057},{value:1033},{value:3082},{value:2058},{value:1035},{value:1036},{value:1040},{value:1041},{value:1042},{value:1062},{value:1043},{value:1045},{value:1046},{value:2070},{value:1049},{value:1051},{value:1060},{value:2077},{value:1053},{value:1055},{value:1058},{value:1066},{value:2052}];t.forEach(function(t){var e=Common.util.LanguageInfo.getLocalLanguageName(t.value);t.displayValue=e[1],t.langName=e[0]}),this.cmbLang=new Common.UI.ComboBox({el:$("#datetime-dlg-lang"),menuStyle:"min-width: 100%; max-height: 185px;",cls:"input-group-nr",editable:!1,takeFocusOnClose:!0,data:t,search:!0,scrollAlwaysVisible:!0}),this.cmbLang.setValue(1033),this.cmbLang.on("selected",_.bind(function(t,e){this.updateFormats(e.value)},this)),this.chUpdate=new Common.UI.CheckBox({el:$("#datetime-dlg-update"),labelText:this.textUpdate}),this.chUpdate.on("change",_.bind(function(t,e,i,n){this.onSelectFormat(this.listFormats,null,this.listFormats.getSelectedRec())},this)),this.listFormats=new Common.UI.ListView({el:$("#datetime-dlg-format"),store:new Common.UI.DataViewStore,scrollAlwaysVisible:!0,tabindex:1}),this.listFormats.on("item:select",_.bind(this.onSelectFormat,this)),this.listFormats.on("item:dblclick",_.bind(this.onDblClickFormat,this)),this.listFormats.on("entervalue",_.bind(this.onPrimary,this)),this.btnDefault=new Common.UI.Button({el:$("#datetime-dlg-default")}),this.btnDefault.on("click",_.bind(function(t,e){var i=this.listFormats.getSelectedRec();Common.UI.warning({msg:Common.Utils.String.format(this.confirmDefault,Common.util.LanguageInfo.getLocalLanguageName(this.cmbLang.getValue())[1],i?i.get("value"):""),buttons:["yes","no"],primary:"yes",callback:_.bind(function(t){if("yes"==t){this.defaultFormats[this.cmbLang.getValue()]=i?i.get("format"):"",this.api.asc_setDefaultDateTimeFormat(this.defaultFormats);var e=[];for(var n in this.defaultFormats)n&&e.push(n+" "+this.defaultFormats[n]);var o=e.join(";");Common.localStorage.setItem("pe-settings-datetime-default",o),Common.Utils.InternalSettings.set("pe-settings-datetime-default",o)}},this)})},this)),this.$window.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this)),this.afterRender()},afterRender:function(){var t=this,e=Common.Utils.InternalSettings.get("pe-settings-datetime-default"),i=e?e.split(";"):[];this.defaultFormats=[],i.forEach(function(e){var i=e.split(" ");t.defaultFormats[parseInt(i[0])]=i[1]}),this._setDefaults()},getFocusedComponents:function(){return[this.cmbLang,{cmp:this.listFormats,selector:".listview"}]},getDefaultFocusableComponent:function(){return this.cmbLang},_setDefaults:function(){if(this.props=new AscCommonSlide.CAscDateTime,this.lang){var t=this.cmbLang.store.findWhere({value:this.lang});t=t?t.get("value"):1033,this.cmbLang.setValue(t)}this.updateFormats(this.cmbLang.getValue())},getSettings:function(){return this.props},updateFormats:function(t){this.props.put_Lang(t);var e=this.props.get_DateTimeExamples(),i=[],n=this.listFormats.store;for(var o in e)if(e[o]){var s=new Common.UI.DataViewModel;s.set({format:o,value:e[o]}),i.push(s)}n.reset(i);var a=this.defaultFormats[t];a?this.listFormats.selectRecord(n.findWhere({format:a})):this.listFormats.selectByIndex(0);var s=this.listFormats.getSelectedRec();this.listFormats.scrollToRecord(s),this.onSelectFormat(this.listFormats,null,s)},onSelectFormat:function(t,e,i){i&&("checked"==this.chUpdate.getValue()?this.props.put_DateTime(i.get("format")):(this.props.put_DateTime(null),this.props.put_CustomDateTime(i.get("value"))))},onBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value)},onDblClickFormat:function(){this._handleInput("ok")},onPrimary:function(t){return this._handleInput("ok"),!1},_handleInput:function(t){this.options.handler&&this.options.handler.call(this,t,this.getSettings()),this.close()},txtTitle:"Date & Time",textLang:"Language",textFormat:"Formats",textUpdate:"Update automatically",textDefault:"Set as default",confirmDefault:'Set default format for {0}: "{1}"'},PE.Views.DateTimeDialog||{}))}),define("text!presentationeditor/main/app/template/HeaderFooterDialog.template",[],function(){return'\n \n \n \n \n \n \n \n
    \n
    \n
    \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
    \n
    \n
    \n \n
    \n
    \n \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n'}),define("presentationeditor/main/app/view/HeaderFooterDialog",["text!presentationeditor/main/app/template/HeaderFooterDialog.template","common/main/lib/util/utils","common/main/lib/component/RadioBox","common/main/lib/component/InputField","common/main/lib/view/AdvancedSettingsWindow"],function(t){"use strict";PE.Views.HeaderFooterDialog=Common.Views.AdvancedSettingsWindow.extend(_.extend({options:{contentWidth:360,height:380,buttons:null}, +initialize:function(e){var i=this;_.extend(this.options,{title:this.textTitle,template:_.template(['
    ','
    ','
    ',t,"
    ","
    ",'
    ','","
    ",'
    ','"].join(""))({scope:this})},e),this.lang=e.lang,this.handler=e.handler,this.hfProps=e.props,this.api=e.api,this.dateControls=[],Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this,this.options)},render:function(){Common.Views.AdvancedSettingsWindow.prototype.render.call(this);this.chDateTime=new Common.UI.CheckBox({el:$("#hf-dlg-chb-datetime"),labelText:this.textDateTime}),this.chDateTime.on("change",_.bind(this.setType,this,"date")),this.chSlide=new Common.UI.CheckBox({el:$("#hf-dlg-chb-slide"),labelText:this.textSlideNum}),this.chSlide.on("change",_.bind(this.setType,this,"slide")),this.chFooter=new Common.UI.CheckBox({el:$("#hf-dlg-chb-text"),labelText:this.textFooter}),this.chFooter.on("change",_.bind(this.setType,this,"footer")),this.inputFooter=new Common.UI.InputField({el:$("#hf-dlg-text"),validateOnBlur:!1,style:"width: 100%;"});var t=[{value:1068},{value:1026},{value:1029},{value:1031},{value:2055},{value:1032},{value:3081},{value:2057},{value:1033},{value:3082},{value:2058},{value:1035},{value:1036},{value:1040},{value:1041},{value:1042},{value:1062},{value:1043},{value:1045},{value:1046},{value:2070},{value:1049},{value:1051},{value:1060},{value:2077},{value:1053},{value:1055},{value:1058},{value:1066},{value:2052}];t.forEach(function(t){var e=Common.util.LanguageInfo.getLocalLanguageName(t.value);t.displayValue=e[1],t.langName=e[0]}),this.cmbLang=new Common.UI.ComboBox({el:$("#hf-dlg-combo-lang"),menuStyle:"min-width: 100%; max-height: 185px;",cls:"input-group-nr",editable:!1,data:t,search:!0,scrollAlwaysVisible:!0,takeFocusOnClose:!0}),this.cmbLang.setValue(1033),this.cmbLang.on("selected",_.bind(function(t,e){this.updateFormats(e.value)},this)),this.dateControls.push(this.cmbLang),this.cmbFormat=new Common.UI.ComboBox({el:$("#hf-dlg-combo-format"),menuStyle:"min-width: 100%; max-height: 185px;",cls:"input-group-nr",editable:!1,data:[],takeFocusOnClose:!0}),this.dateControls.push(this.cmbFormat),this.radioUpdate=new Common.UI.RadioBox({el:$("#hf-dlg-radio-update"),labelText:this.textUpdate,name:"asc-radio-header-update",checked:!0}).on("change",_.bind(this.setDateTimeType,this,"update")),this.dateControls.push(this.radioUpdate),this.radioFixed=new Common.UI.RadioBox({el:$("#hf-dlg-radio-fixed"),labelText:this.textFixed,name:"asc-radio-header-update"}).on("change",_.bind(this.setDateTimeType,this,"fixed")),this.dateControls.push(this.radioFixed),this.inputFixed=new Common.UI.InputField({el:$("#hf-dlg-input-fixed"),validateOnBlur:!1,style:"width: 100%;"}),this.dateControls.push(this.inputFixed),this.chNotTitle=new Common.UI.CheckBox({el:$("#hf-dlg-chb-not-title"),labelText:this.textNotTitle}),this.afterRender()},getFocusedComponents:function(){return[this.cmbFormat,this.cmbLang,this.inputFixed,this.inputFooter]},getDefaultFocusableComponent:function(){return this.cmbFormat.isDisabled()?this.inputFixed.isDisabled()?this.inputFooter.isDisabled()?void 0:this.inputFooter:this.inputFixed:this.cmbFormat},focusControls:function(){var t=this.getDefaultFocusableComponent();t&&setTimeout(function(){t.focus()},10)},afterRender:function(){var t=this,e=Common.Utils.InternalSettings.get("pe-settings-datetime-default"),i=e?e.split(";"):[];this.defaultFormats=[],i.forEach(function(e){var i=e.split(" ");t.defaultFormats[parseInt(i[0])]=i[1]}),this._setDefaults(this.hfProps)},setType:function(t,e,i){var n=this;i="checked"==i,"date"==t?(_.each(this.dateControls,function(t){t.setDisabled(!i)}),i&&this.setDateTimeType(this.radioFixed.getValue()?"fixed":"update",null,!0),this.props.put_ShowDateTime(i),this.focusControls()):"slide"==t?this.props.put_ShowSlideNum(i):"footer"==t&&(this.inputFooter.setDisabled(!i),this.props.put_ShowFooter(i),i&&setTimeout(function(){n.inputFooter.cmpEl.find("input").focus()},50)),this.props.updateView()},updateFormats:function(t,e){var i=new AscCommonSlide.CAscDateTime;i.put_Lang(t);var n=i.get_DateTimeExamples(),o=[];for(var s in n)n[s]&&o.push({value:s,displayValue:n[s]});this.cmbFormat.setData(o),e=e||this.defaultFormats[t],this.cmbFormat.setValue(e||o[0].value)},setDateTimeType:function(t,e,i){if(i){this.cmbLang.setDisabled("fixed"==t),this.cmbFormat.setDisabled("fixed"==t),this.inputFixed.setDisabled("update"==t),this.focusControls()}},onSelectFormat:function(t){this.radioUpdate.getValue()?(t=t||this.cmbFormat.getValue(),this.props.get_DateTime().put_DateTime(t)):(this.props.get_DateTime().put_DateTime(null),this.props.get_DateTime().put_CustomDateTime(this.inputFixed.getValue()))},_setDefaults:function(t){if(t){var e=t.get_Slide()||new AscCommonSlide.CAscHFProps,i=e.get_ShowDateTime();this.chDateTime.setValue(i,!0),_.each(this.dateControls,function(t){t.setDisabled(!i)});var n,o,s=e.get_DateTime(),a=this.cmbLang.store.findWhere({value:s?s.get_Lang()||this.lang:this.lang});this._originalLang=a?a.get("value"):1033,this.cmbLang.setValue(this._originalLang),i&&(n=s.get_DateTime(),n?this.radioUpdate.setValue(!0):this.radioFixed.setValue(!0),!n&&(o=s.get_CustomDateTime()||""),this.setDateTimeType(n?"update":"fixed",null,!0)),this.updateFormats(this.cmbLang.getValue(),n),this.inputFixed.setValue(void 0!==o?o:this.cmbFormat.getRawValue()),i=e.get_ShowSlideNum(),this.chSlide.setValue(i,!0),i=e.get_ShowFooter(),this.chFooter.setValue(i,!0),this.inputFooter.setDisabled(!i),i&&this.inputFooter.setValue(e.get_Footer()||""),i=e.get_ShowOnTitleSlide(),this.chNotTitle.setValue(!i,!0),this.props=e}else this.props=new AscCommonSlide.CAscHFProps;this.props.put_DivId("hf-dlg-canvas-preview"),this.props.put_Api(this.api),this.props.updateView()},getSettings:function(){var t=this.props;return t.get_ShowDateTime()&&(!t.get_DateTime()&&t.put_DateTime(new AscCommonSlide.CAscDateTime),t.get_DateTime().put_Lang(this.cmbLang.getValue()),this.onSelectFormat()),t.get_ShowFooter()&&t.put_Footer(this.inputFooter.getValue()),t.put_ShowOnTitleSlide("checked"!=this.chNotTitle.getValue()),this.hfProps.put_Slide(this.props),this.hfProps},onDlgBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value)},onPrimary:function(){return this._handleInput("all"),!1},_handleInput:function(t){if(this.handler){if("ok"==t&&this.cmbLang.getValue()!==this._originalLang)return void Common.UI.warning({title:this.notcriticalErrorTitle,maxwidth:600,msg:this.diffLanguage});this.handler.call(this,t,this.getSettings())}this.close()},textTitle:"Footer Settings",applyAllText:"Apply to all",applyText:"Apply",textLang:"Language",textFormat:"Formats",textUpdate:"Update automatically",textDateTime:"Date and time",textSlideNum:"Slide number",textFooter:"Text in footer",textNotTitle:"Don't show on title slide",textPreview:"Preview",diffLanguage:"You can’t use a date format in a different language than the slide master.\nTo change the master, click 'Apply to all' instead of 'Apply'",notcriticalErrorTitle:"Warning",textFixed:"Fixed"},PE.Views.HeaderFooterDialog||{}))}),define("presentationeditor/main/app/view/SlideSizeSettings",["common/main/lib/component/Window","common/main/lib/component/ComboBox"],function(){"use strict";PE.Views.SlideSizeSettings=Common.UI.Window.extend(_.extend({options:{width:250,header:!0,style:"min-width: 250px;",cls:"modal-dlg",id:"window-slide-size-settings",buttons:["ok","cancel"]},initialize:function(t){_.extend(this.options,{title:this.textTitle},t||{}),this.template=['
    ','
    ','","
    ",'
    ','',"",'",'","","
    ','",'
    ',"
    ','",'
    ',"
    ",'
    ','","
    ",'
    ',"
    ",'
    '].join(""),this.options.tpl=_.template(this.template)(this.options),this.spinners=[],this._noApply=!1,Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this),this.cmbSlideSize=new Common.UI.ComboBox({el:$("#slide-size-combo"),cls:"input-group-nr",style:"width: 100%;",menuStyle:"min-width: 218px;",editable:!1,takeFocusOnClose:!0,data:[{value:0,displayValue:this.txtStandard,size:[254,190.5]},{value:1,displayValue:this.txtWidescreen1,size:[254,143]},{value:2,displayValue:this.txtWidescreen2,size:[254,158.7]},{value:3,displayValue:this.txtLetter,size:[254,190.5]},{value:4,displayValue:this.txtLedger,size:[338.3,253.7]},{value:5,displayValue:this.txtA3,size:[355.6,266.7]},{value:6,displayValue:this.txtA4,size:[275,190.5]},{value:7,displayValue:this.txtB4,size:[300.7,225.5]},{value:8,displayValue:this.txtB5,size:[199.1,149.3]},{value:9,displayValue:this.txt35,size:[285.7,190.5]},{value:10,displayValue:this.txtOverhead,size:[254,190.5]},{value:11,displayValue:this.txtBanner,size:[203.2,25.4]},{value:-1,displayValue:this.txtCustom,size:[]}]}),this.cmbSlideSize.setValue(0),this.cmbSlideSize.on("selected",_.bind(function(t,e){if(this._noApply=!0,e.value<0);else{var i=e.size[0],n=e.size[1],o=this.cmbSlideOrientation.getValue(),s=0==o&&i>n||1==o&&n>i;this.spnWidth.setValue(Common.Utils.Metric.fnRecalcFromMM(s?n:i),!0),this.spnHeight.setValue(Common.Utils.Metric.fnRecalcFromMM(s?i:n),!0)}this._noApply=!1},this)),this.spnWidth=new Common.UI.MetricSpinner({el:$("#slide-size-spin-width"),step:.1,width:98,defaultUnit:"cm",value:"25.4 cm",maxValue:142.24,minValue:2.54}),this.spinners.push(this.spnWidth),this.spnWidth.on("change",_.bind(function(t,e,i,n){if(!this._noApply){this.cmbSlideSize.getValue()>-1&&this.cmbSlideSize.setValue(-1);var o=this.spnWidth.getNumberValue(),s=this.spnHeight.getNumberValue();this.cmbSlideOrientation.setValue(s>o?0:1)}},this)),this.spnHeight=new Common.UI.MetricSpinner({el:$("#slide-size-spin-height"),step:.1,width:98,defaultUnit:"cm",value:"19.05 cm",maxValue:142.24,minValue:2.54}),this.spinners.push(this.spnHeight),this.spnHeight.on("change",_.bind(function(t,e,i,n){if(!this._noApply){this.cmbSlideSize.getValue()>-1&&this.cmbSlideSize.setValue(-1);var o=this.spnWidth.getNumberValue(),s=this.spnHeight.getNumberValue();this.cmbSlideOrientation.setValue(s>o?0:1)}},this)),this.cmbSlideOrientation=new Common.UI.ComboBox({el:$("#slide-orientation-combo"),cls:"input-group-nr",style:"width: 100%;",menuStyle:"min-width: 218px;",editable:!1,takeFocusOnClose:!0,data:[{value:0,displayValue:this.strPortrait},{value:1,displayValue:this.strLandscape}]}),this.cmbSlideOrientation.setValue(1),this.cmbSlideOrientation.on("selected",_.bind(function(t,e){this._noApply=!0;var i=this.spnWidth.getNumberValue(),n=this.spnHeight.getNumberValue();(0==e.value&&i>n||1==e.value&&n>i)&&(this.spnWidth.setValue(n,!0),this.spnHeight.setValue(i,!0)),this._noApply=!1},this)),this.getChild().find(".dlg-btn").on("click",_.bind(this.onBtnClick,this)),this.updateMetricUnit()},getFocusedComponents:function(){return[this.cmbSlideSize,this.spnWidth,this.spnHeight,this.cmbSlideOrientation]},getDefaultFocusableComponent:function(){return this.cmbSlideSize},_handleInput:function(t){this.options.handler&&this.options.handler.call(this,this,t),this.close()},onBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value)},onPrimary:function(){return this._handleInput("ok"),!1},setSettings:function(t,e,i){this.spnWidth.setValue(Common.Utils.Metric.fnRecalcFromMM(e),!0),this.spnHeight.setValue(Common.Utils.Metric.fnRecalcFromMM(i),!0),this.cmbSlideSize.setValue(t),this.cmbSlideOrientation.setValue(i>e?0:1)},getSettings:function(){return[this.cmbSlideSize.getValue(),Common.Utils.Metric.fnRecalcToMM(this.spnWidth.getNumberValue()),Common.Utils.Metric.fnRecalcToMM(this.spnHeight.getNumberValue())]},updateMetricUnit:function(){if(this.spinners)for(var t=0;t','
    ',"",'
    '].join(""),this.options.tpl=_.template(this.template)(this.options),this.spinners=[],this._noApply=!1,Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this),this.chLoop=new Common.UI.CheckBox({el:$("#slideshow-checkbox-loop"),labelText:this.textLoop}),this.getChild().find(".dlg-btn").on("click",_.bind(this.onBtnClick,this))},_handleInput:function(t){this.options.handler&&this.options.handler.call(this,this,t),this.close()},onBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value)},onPrimary:function(){return this._handleInput("ok"),!1},setSettings:function(t){this.chLoop.setValue(t)},getSettings:function(){return"checked"==this.chLoop.getValue()},textTitle:"Show Settings",textLoop:"Loop continuously until 'Esc' is pressed"},PE.Views.SlideshowSettings||{}))}),define("presentationeditor/main/app/controller/Toolbar",["core","common/main/lib/component/Window","common/main/lib/view/CopyWarningDialog","common/main/lib/view/ImageFromUrlDialog","common/main/lib/view/InsertTableDialog","common/main/lib/view/SelectFileDlg","common/main/lib/view/ListSettingsDialog","common/main/lib/view/SymbolTableDialog","common/main/lib/util/define","presentationeditor/main/app/collection/SlideThemes","presentationeditor/main/app/view/Toolbar","presentationeditor/main/app/view/DateTimeDialog","presentationeditor/main/app/view/HeaderFooterDialog","presentationeditor/main/app/view/HyperlinkSettingsDialog","presentationeditor/main/app/view/SlideSizeSettings","presentationeditor/main/app/view/SlideshowSettings"],function(){"use strict";PE.Controllers.Toolbar=Backbone.Controller.extend(_.extend({models:[],collections:["SlideThemes"],views:["Toolbar"],initialize:function(){this._state={activated:!1,themeId:void 0,bullets:{type:void 0,subtype:void 0},prcontrolsdisable:void 0,slidecontrolsdisable:void 0,slidelayoutdisable:void 0,shapecontrolsdisable:void 0,no_paragraph:void 0,no_text:void 0,no_object:void 0,clrtext:void 0,linespace:void 0,pralign:void 0,valign:void 0,vtextalign:void 0,can_undo:void 0,can_redo:void 0,bold:void 0,italic:void 0,strike:void 0,underline:void 0,can_group:void 0,can_ungroup:void 0,lock_doc:void 0,changeslide_inited:!1,no_slides:void 0,can_increase:void 0,can_decrease:void 0,can_hyper:void 0,zoom_type:void 0,zoom_percent:void 0,fontsize:void 0,in_equation:void 0,in_chart:!1},this._isAddingShape=!1,this.slideSizeArr=[[254,190.5],[254,143],[254,158.7],[254,190.5],[338.3,253.7],[355.6,266.7],[275,190.5],[300.7,225.5],[199.1,149.3],[285.7,190.5],[254,190.5],[203.2,25.4]],this.currentPageSize={type:-1,width:0,height:0},this.flg={},this.diagramEditor=null,this.editMode=!0,this.addListeners({Toolbar:{"insert:image":this.onInsertImageClick.bind(this),"insert:text":this.onInsertText.bind(this),"insert:textart":this.onInsertTextart.bind(this),"insert:shape":this.onInsertShape.bind(this),"add:slide":this.onAddSlide.bind(this),"change:slide":this.onChangeSlide.bind(this),"change:compact":this.onClickChangeCompact,"add:chart":this.onSelectChart},FileMenu:{"menu:hide":this.onFileMenu.bind(this,"hide"),"menu:show":this.onFileMenu.bind(this,"show")},"Common.Views.Header":{"toolbar:setcompact":this.onChangeCompactView.bind(this),print:function(t){this.getApplication().getController("Main").onPrint()},save:function(t){this.api.asc_Save()},undo:this.onUndo,redo:this.onRedo,downloadas:function(t){var e,i=this.getApplication().getController("Main"),n=i.document.fileType;n&&(e=Asc.c_oAscFileType[n.toUpperCase()]);var o=[Asc.c_oAscFileType.PPTX,Asc.c_oAscFileType.ODP,Asc.c_oAscFileType.PDFA,Asc.c_oAscFileType.POTX,Asc.c_oAscFileType.OTP];(!e||o.indexOf(e)<0)&&(e=Asc.c_oAscFileType.PDF),i.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(e))},"go:editor":function(){Common.Gateway.requestEditRights()}}});var t=this,e=function(e){var i=$(e.target),n=i.closest("#editor_sdk"),o=i.closest("button").attr("id");void 0===o&&(o=i.closest(".btn-group").attr("id")),"editor_sdk"!=i.attr("id")&&n.length<=0&&(t.toolbar.btnsInsertText.pressed()&&!t.toolbar.btnsInsertText.contains(o)||t.toolbar.btnsInsertShape.pressed()&&!t.toolbar.btnsInsertShape.contains(o)?(t._isAddingShape=!1,t._addAutoshape(!1),t.toolbar.btnsInsertShape.toggle(!1,!0),t.toolbar.btnsInsertText.toggle(!1,!0),Common.NotificationCenter.trigger("edit:complete",t.toolbar)):t.toolbar.btnsInsertShape.pressed()&&t.toolbar.btnsInsertShape.contains(o)&&_.defer(function(){t.api.StartAddShape("",!1),Common.NotificationCenter.trigger("edit:complete",t.toolbar)},100))};this.onApiEndAddShape=function(){this.toolbar.fireEvent("insertshape",this.toolbar),this.toolbar.btnsInsertShape.pressed()&&this.toolbar.btnsInsertShape.toggle(!1,!0),this.toolbar.btnsInsertText.pressed()&&this.toolbar.btnsInsertText.toggle(!1,!0),$(document.body).off("mouseup",e)},this._addAutoshape=function(t,i){this.api&&(t?(this.api.StartAddShape(i,!0),$(document.body).on("mouseup",e)):(this.api.StartAddShape("",!1),$(document.body).off("mouseup",e)))}},onLaunch:function(){var t=this;t.toolbar=t.createView("Toolbar"),Common.NotificationCenter.on("app:ready",t.onAppReady.bind(t)),Common.NotificationCenter.on("app:face",t.onAppShowed.bind(t)),PE.getCollection("ShapeGroups").bind({reset:t.onResetAutoshapes.bind(this)}),PE.getCollection("SlideLayouts").bind({reset:t.onResetSlides.bind(this)})},setMode:function(t){this.mode=t,this.toolbar.applyLayout(t)},attachUIEvents:function(t){t.btnPreview.on("click",_.bind(this.onPreviewBtnClick,this)),t.btnPreview.menu.on("item:click",_.bind(this.onPreviewItemClick,this)),t.btnPrint.on("click",_.bind(this.onPrint,this)),t.btnPrint.on("disabled",_.bind(this.onBtnChangeState,this,"print:disabled")),t.btnSave.on("click",_.bind(this.onSave,this)),t.btnUndo.on("click",_.bind(this.onUndo,this)),t.btnUndo.on("disabled",_.bind(this.onBtnChangeState,this,"undo:disabled")),t.btnRedo.on("click",_.bind(this.onRedo,this)),t.btnRedo.on("disabled",_.bind(this.onBtnChangeState,this,"redo:disabled")),t.btnCopy.on("click",_.bind(this.onCopyPaste,this,!0)),t.btnPaste.on("click",_.bind(this.onCopyPaste,this,!1)),t.btnIncFontSize.on("click",_.bind(this.onIncrease,this)),t.btnDecFontSize.on("click",_.bind(this.onDecrease,this)),t.btnBold.on("click",_.bind(this.onBold,this)),t.btnItalic.on("click",_.bind(this.onItalic,this)),t.btnUnderline.on("click",_.bind(this.onUnderline,this)),t.btnStrikeout.on("click",_.bind(this.onStrikeout,this)),t.btnSuperscript.on("click",_.bind(this.onSuperscript,this)),t.btnSubscript.on("click",_.bind(this.onSubscript,this)),t.btnHorizontalAlign.menu.on("item:click",_.bind(this.onMenuHorizontalAlignSelect,this)),t.btnVerticalAlign.menu.on("item:click",_.bind(this.onMenuVerticalAlignSelect,this)),t.btnDecLeftOffset.on("click",_.bind(this.onDecOffset,this)),t.btnIncLeftOffset.on("click",_.bind(this.onIncOffset,this)),t.btnMarkers.on("click",_.bind(this.onMarkers,this)),t.btnNumbers.on("click",_.bind(this.onNumbers,this)),t.mnuMarkerSettings.on("click",_.bind(this.onMarkerSettingsClick,this,0)),t.mnuNumberSettings.on("click",_.bind(this.onMarkerSettingsClick,this,1)),t.cmbFontName.on("selected",_.bind(this.onFontNameSelect,this)),t.cmbFontName.on("show:after",_.bind(this.onComboOpen,this,!0)),t.cmbFontName.on("hide:after",_.bind(this.onHideMenus,this)),t.cmbFontName.on("combo:blur",_.bind(this.onComboBlur,this)),t.cmbFontName.on("combo:focusin",_.bind(this.onComboOpen,this,!1)),t.cmbFontSize.on("selected",_.bind(this.onFontSizeSelect,this)),t.cmbFontSize.on("changed:before",_.bind(this.onFontSizeChanged,this,!0)),t.cmbFontSize.on("changed:after",_.bind(this.onFontSizeChanged,this,!1)),t.cmbFontSize.on("show:after",_.bind(this.onComboOpen,this,!0)),t.cmbFontSize.on("hide:after",_.bind(this.onHideMenus,this)),t.cmbFontSize.on("combo:blur",_.bind(this.onComboBlur,this)),t.cmbFontSize.on("combo:focusin",_.bind(this.onComboOpen,this,!1)),t.mnuMarkersPicker.on("item:click",_.bind(this.onSelectBullets,this,t.btnMarkers)),t.mnuNumbersPicker.on("item:click",_.bind(this.onSelectBullets,this,t.btnNumbers)),t.btnFontColor.on("click",_.bind(this.onBtnFontColor,this)),t.mnuFontColorPicker.on("select",_.bind(this.onSelectFontColor,this)),$("#id-toolbar-menu-new-fontcolor").on("click",_.bind(this.onNewFontColor,this)),t.btnLineSpace.menu.on("item:toggle",_.bind(this.onLineSpaceToggle,this)),t.btnShapeAlign.menu.on("item:click",_.bind(this.onShapeAlign,this)),t.btnShapeAlign.menu.on("show:before",_.bind(this.onBeforeShapeAlign,this)),t.btnShapeArrange.menu.on("item:click",_.bind(this.onShapeArrange,this)),t.btnInsertHyperlink.on("click",_.bind(this.onHyperlinkClick,this)),t.mnuTablePicker.on("select",_.bind(this.onTablePickerSelect,this)),t.btnInsertTable.menu.on("item:click",_.bind(this.onInsertTableClick,this)),t.btnClearStyle.on("click",_.bind(this.onClearStyleClick,this)),t.btnCopyStyle.on("toggle",_.bind(this.onCopyStyleToggle,this)),t.btnColorSchemas.menu.on("item:click",_.bind(this.onColorSchemaClick,this)),t.btnColorSchemas.menu.on("show:after",_.bind(this.onColorSchemaShow,this)),t.btnSlideSize.menu.on("item:click",_.bind(this.onSlideSize,this)),t.listTheme.on("click",_.bind(this.onListThemeSelect,this)),t.btnInsertEquation.on("click",_.bind(this.onInsertEquationClick,this)),t.btnInsertSymbol.on("click",_.bind(this.onInsertSymbolClick,this)),t.btnEditHeader.on("click",_.bind(this.onEditHeaderClick,this,"header")),t.btnInsDateTime.on("click",_.bind(this.onEditHeaderClick,this,"datetime")),t.btnInsSlideNum.on("click",_.bind(this.onEditHeaderClick,this,"slidenum")),Common.Gateway.on("insertimage",_.bind(this.insertImage,this)),t.btnInsAudio&&t.btnInsAudio.on("click",_.bind(this.onAddAudio,this)),t.btnInsVideo&&t.btnInsVideo.on("click",_.bind(this.onAddVideo,this)),this.onSetupCopyStyleButton()},setApi:function(t){this.api=t,this.mode.isEdit?(this.toolbar.setApi(t),this.api.asc_registerCallback("asc_onFontSize",_.bind(this.onApiFontSize,this)),this.api.asc_registerCallback("asc_onBold",_.bind(this.onApiBold,this)),this.api.asc_registerCallback("asc_onItalic",_.bind(this.onApiItalic,this)),this.api.asc_registerCallback("asc_onUnderline",_.bind(this.onApiUnderline,this)),this.api.asc_registerCallback("asc_onStrikeout",_.bind(this.onApiStrikeout,this)),this.api.asc_registerCallback("asc_onVerticalAlign",_.bind(this.onApiVerticalAlign,this)),Common.NotificationCenter.on("fonts:change",_.bind(this.onApiChangeFont,this)),this.api.asc_registerCallback("asc_onCanUndo",_.bind(this.onApiCanRevert,this,"undo")),this.api.asc_registerCallback("asc_onCanRedo",_.bind(this.onApiCanRevert,this,"redo")),this.api.asc_registerCallback("asc_onPaintFormatChanged",_.bind(this.onApiStyleChange,this)),this.api.asc_registerCallback("asc_onListType",_.bind(this.onApiBullets,this)),this.api.asc_registerCallback("asc_canIncreaseIndent",_.bind(this.onApiCanIncreaseIndent,this)),this.api.asc_registerCallback("asc_canDecreaseIndent",_.bind(this.onApiCanDecreaseIndent,this)),this.api.asc_registerCallback("asc_onLineSpacing",_.bind(this.onApiLineSpacing,this)),this.api.asc_registerCallback("asc_onPrAlign",_.bind(this.onApiParagraphAlign,this)),this.api.asc_registerCallback("asc_onVerticalTextAlign",_.bind(this.onApiVerticalTextAlign,this)),this.api.asc_registerCallback("asc_onCanAddHyperlink",_.bind(this.onApiCanAddHyperlink,this)),this.api.asc_registerCallback("asc_onTextColor",_.bind(this.onApiTextColor,this)),this.api.asc_registerCallback("asc_onUpdateThemeIndex",_.bind(this.onApiUpdateThemeIndex,this)),this.api.asc_registerCallback("asc_onEndAddShape",_.bind(this.onApiEndAddShape,this)),this.api.asc_registerCallback("asc_onCanGroup",_.bind(this.onApiCanGroup,this)),this.api.asc_registerCallback("asc_onCanUnGroup",_.bind(this.onApiCanUnGroup,this)),this.api.asc_registerCallback("asc_onPresentationSize",_.bind(this.onApiPageSize,this)),this.api.asc_registerCallback("asc_onCoAuthoringDisconnect",_.bind(this.onApiCoAuthoringDisconnect,this)),Common.NotificationCenter.on("api:disconnect",_.bind(this.onApiCoAuthoringDisconnect,this)),this.api.asc_registerCallback("asc_onZoomChange",_.bind(this.onApiZoomChange,this)),this.api.asc_registerCallback("asc_onFocusObject",_.bind(this.onApiFocusObject,this)),this.api.asc_registerCallback("asc_onLockDocumentProps",_.bind(this.onApiLockDocumentProps,this)),this.api.asc_registerCallback("asc_onUnLockDocumentProps",_.bind(this.onApiUnLockDocumentProps,this)),this.api.asc_registerCallback("asc_onLockDocumentTheme",_.bind(this.onApiLockDocumentTheme,this)),this.api.asc_registerCallback("asc_onUnLockDocumentTheme",_.bind(this.onApiUnLockDocumentTheme,this)),this.api.asc_registerCallback("asc_onInitEditorStyles",_.bind(this.onApiInitEditorStyles,this)),this.api.asc_registerCallback("asc_onCountPages",_.bind(this.onApiCountPages,this)),this.api.asc_registerCallback("asc_onMathTypes",_.bind(this.onApiMathTypes,this)),this.api.asc_registerCallback("asc_onContextMenu",_.bind(this.onContextMenu,this)),this.api.asc_registerCallback("asc_onTextLanguage",_.bind(this.onTextLanguage,this)),Common.NotificationCenter.on("storage:image-load",_.bind(this.openImageFromStorage,this)),Common.NotificationCenter.on("storage:image-insert",_.bind(this.insertImageFromStorage,this))):this.mode.isRestrictedEdit&&this.api.asc_registerCallback("asc_onCountPages",_.bind(this.onApiCountPagesRestricted,this))},onChangeCompactView:function(t,e){this.toolbar.setFolded(e),this.toolbar.fireEvent("view:compact",[this.toolbar,e]),Common.localStorage.setBool("pe-compact-toolbar",e),Common.NotificationCenter.trigger("layout:changed","toolbar"),Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onClickChangeCompact:function(t){if("file"!=t){var e=this;Common.Utils.asyncCall(function(){e.onChangeCompactView(null,!e.toolbar.isCompact())})}},onContextMenu:function(){this.toolbar.collapse()},onApiChangeFont:function(t){!Common.Utils.ModalWindow.isVisible()&&this.toolbar.cmbFontName.onApiChangeFont(t)},onApiFontSize:function(t){this._state.fontsize!==t&&(this.toolbar.cmbFontSize.setValue(t),this._state.fontsize=t)},onApiBold:function(t){this._state.bold!==t&&(this.toolbar.btnBold.toggle(!0===t,!0),this._state.bold=t)},onApiItalic:function(t){this._state.italic!==t&&(this.toolbar.btnItalic.toggle(!0===t,!0),this._state.italic=t)},onApiUnderline:function(t){this._state.underline!==t&&(this.toolbar.btnUnderline.toggle(!0===t,!0),this._state.underline=t)},onApiStrikeout:function(t){this._state.strike!==t&&(this.toolbar.btnStrikeout.toggle(!0===t,!0),this._state.strike=t)},onApiVerticalAlign:function(t){this._state.valign!==t&&(this.toolbar.btnSuperscript.toggle(1==t,!0),this.toolbar.btnSubscript.toggle(2==t,!0),this._state.valign=t)},onApiCanRevert:function(t,e){"undo"==t?this._state.can_undo!==e&&(this.toolbar.lockToolbar(PE.enumLock.undoLock,!e,{array:[this.toolbar.btnUndo]}),this._state.activated&&(this._state.can_undo=e)):this._state.can_redo!==e&&(this.toolbar.lockToolbar(PE.enumLock.redoLock,!e,{array:[this.toolbar.btnRedo]}),this._state.activated&&(this._state.can_redo=e))},onApiCanIncreaseIndent:function(t){this._state.can_increase!==t&&(this.toolbar.lockToolbar(PE.enumLock.incIndentLock,!t,{array:[this.toolbar.btnIncLeftOffset]}),this._state.activated&&(this._state.can_increase=t))},onApiCanDecreaseIndent:function(t){this._state.can_decrease!==t&&(this.toolbar.lockToolbar(PE.enumLock.decIndentLock,!t,{array:[this.toolbar.btnDecLeftOffset]}),this._state.activated&&(this._state.can_decrease=t))},onApiBullets:function(t){if(this._state.bullets.type!=t.get_ListType()||this._state.bullets.subtype!=t.get_ListSubType())switch(this._state.bullets.type=t.get_ListType(),this._state.bullets.subtype=t.get_ListSubType(),this._clearBullets(),this._state.bullets.type){case 0:this.toolbar.btnMarkers.toggle(!0,!0),void 0!==this._state.bullets.subtype?this.toolbar.mnuMarkersPicker.selectByIndex(this._state.bullets.subtype,!0):this.toolbar.mnuMarkersPicker.deselectAll(!0);break;case 1:var e=0;switch(this._state.bullets.subtype){case 1:e=4;break;case 2:e=5;break;case 3:e=6;break;case 4:e=1;break;case 5:e=2;break;case 6:e=3;break;case 7:e=7}this.toolbar.btnNumbers.toggle(!0,!0),this.toolbar.mnuNumbersPicker.selectByIndex(e,!0)}},onApiParagraphAlign:function(t){if(this._state.pralign!==t){this._state.pralign=t;var e,i=-1,n=this.toolbar.btnHorizontalAlign;switch(t){case 0:i=2,e="btn-align-right";break;case 1:i=0,e="btn-align-left";break;case 2:i=1,e="btn-align-center";break;case 3:i=3,e="btn-align-just";break;default:i=-255,e="btn-align-left"}i<0?-255==i&&n.menu.clearAll():n.menu.items[i].setChecked(!0),n.rendered&&n.$icon&&(n.$icon.removeClass(n.options.icls).addClass(e),n.options.icls=e)}},onApiVerticalTextAlign:function(t){if(this._state.vtextalign!==t){this._state.vtextalign=t;var e=-1,i="",n=this.toolbar.btnVerticalAlign;switch(t){case Asc.c_oAscVAlign.Top:e=0,i="btn-align-top";break;case Asc.c_oAscVAlign.Center:e=1,i="btn-align-middle";break;case Asc.c_oAscVAlign.Bottom:e=2,i="btn-align-bottom";break;default:e=-255,i="btn-align-middle"}e<0?-255==e&&n.menu.clearAll():n.menu.items[e].setChecked(!0),n.rendered&&n.$icon&&(n.$icon.removeClass(n.options.icls).addClass(i),n.options.icls=i)}},onApiLineSpacing:function(t){ +var e=null===t.get_Line()||null===t.get_LineRule()||1!=t.get_LineRule()?-1:t.get_Line();if(this._state.linespace!==e){this._state.linespace=e;var i=this.toolbar.btnLineSpace.menu;if(_.each(i.items,function(t){t.setChecked(!1,!0)}),e<0)return;Math.abs(e-1)<1e-4?i.items[0].setChecked(!0,!0):Math.abs(e-1.15)<1e-4?i.items[1].setChecked(!0,!0):Math.abs(e-1.5)<1e-4?i.items[2].setChecked(!0,!0):Math.abs(e-2)<1e-4?i.items[3].setChecked(!0,!0):Math.abs(e-2.5)<1e-4?i.items[4].setChecked(!0,!0):Math.abs(e-3)<1e-4&&i.items[5].setChecked(!0,!0)}},onApiCanAddHyperlink:function(t){this._state.can_hyper!==t&&this.editMode&&(this.toolbar.lockToolbar(PE.enumLock.hyperlinkLock,!t,{array:[this.toolbar.btnInsertHyperlink]}),this._state.activated&&(this._state.can_hyper=t))},onApiPageSize:function(t,e){if(Math.abs(this.currentPageSize.width-t)>.001||Math.abs(this.currentPageSize.height-e)>.001){this.currentPageSize.width=t,this.currentPageSize.height=e,this.currentPageSize.type=-1;for(var i=e>t,n=0;n0?t:void 0,e.menuPicker.selectRecord(i),e.resumeEvents()}}},onApiCanGroup:function(t){this._state.can_group!==t&&(this.toolbar.mnuGroupShapes.setDisabled(!t),this._state.activated&&(this._state.can_group=t))},onApiCanUnGroup:function(t){this._state.can_ungroup!==t&&(this.toolbar.mnuUnGroupShapes.setDisabled(!t),this._state.activated&&(this._state.can_ungroup=t))},onApiLockDocumentProps:function(){!0!==this._state.lock_doc&&(this.toolbar.lockToolbar(PE.enumLock.docPropsLock,!0,{array:[this.toolbar.btnSlideSize]}),this._state.activated&&(this._state.lock_doc=!0))},onApiUnLockDocumentProps:function(){!1!==this._state.lock_doc&&(this.toolbar.lockToolbar(PE.enumLock.docPropsLock,!1,{array:[this.toolbar.btnSlideSize]}),this._state.activated&&(this._state.lock_doc=!1))},onApiLockDocumentTheme:function(){this.toolbar.lockToolbar(PE.enumLock.themeLock,!0,{array:[this.toolbar.btnColorSchemas,this.toolbar.listTheme]})},onApiUnLockDocumentTheme:function(){this.toolbar.lockToolbar(PE.enumLock.themeLock,!1,{array:[this.toolbar.btnColorSchemas,this.toolbar.listTheme]})},onApiCoAuthoringDisconnect:function(t){this.toolbar.setMode({isDisconnected:!0,enableDownload:!!t}),this.editMode=!1},onApiZoomChange:function(t,e){},onApiInitEditorStyles:function(t){t&&this._onInitEditorThemes(t[0],t[1])},onNewDocument:function(t,e){this.api&&this.api.OpenNewDocument(),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","New Document")},onOpenDocument:function(t,e){this.api&&this.api.LoadDocumentFromDisk(),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Open Document")},onAddSlide:function(t){this.api&&(this.api.AddSlide(t),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Add Slide"))},onChangeSlide:function(t){this.api&&(this.api.ChangeLayout(t),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Change Layout"))},onPreview:function(t,e){Common.NotificationCenter.trigger("preview:start",_.isNumber(t)?t:0,e)},onPreviewBtnClick:function(t,e){this.onPreview(this.api.getCurrentPage())},onPreviewItemClick:function(t,e){switch(e.value){case 0:this.onPreview(0);break;case 1:this.onPreview(this.api.getCurrentPage());break;case 2:this.onPreview(0,!0);break;case 3:var i,n=this,o=n.api.getSelectedElements(),s=!1;if(o&&_.isArray(o))for(var a=0;a300?300:o<1?1:Math.floor(2*(o+.4))/2,e.setRawValue(o),this._state.fontsize=void 0,this.api&&this.api.put_TextPrFontSize(o),Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onSelectBullets:function(t,e,i,n){var o={};if(_.isFunction(n.toJSON)){if(!n.get("selected"))return;o=n.toJSON()}else o=n;t&&t.toggle(o.data.subtype>-1,!0),this.api&&this.api.put_ListType(o.data.type,o.data.subtype),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","List Type")},onLineSpaceToggle:function(t,e,i,n){i&&(this._state.linespace=void 0,this.api&&this.api.put_PrLineSpacing(c_paragraphLinerule.LINERULE_AUTO,e.value),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Line Spacing"))},onBeforeShapeAlign:function(){var t=this.api.asc_getSelectedDrawingObjectsCount(),e=Common.Utils.InternalSettings.get("pe-align-to-slide")||!1;this.toolbar.mniAlignObjects.setDisabled(t<2),this.toolbar.mniAlignObjects.setChecked(t>1&&!e,!0),this.toolbar.mniAlignToSlide.setChecked(t<2||e,!0),this.toolbar.mniDistribHor.setDisabled(t<3&&this.toolbar.mniAlignObjects.isChecked()),this.toolbar.mniDistribVert.setDisabled(t<3&&this.toolbar.mniAlignObjects.isChecked())},onShapeAlign:function(t,e){if(this.api){var i=this.toolbar.mniAlignToSlide.isChecked()?Asc.c_oAscObjectsAlignType.Slide:Asc.c_oAscObjectsAlignType.Selected;e.value>-1&&e.value<6?(this.api.put_ShapesAlign(e.value,i),Common.component.Analytics.trackEvent("ToolBar","Shape Align")):6==e.value?(this.api.DistributeHorizontally(i),Common.component.Analytics.trackEvent("ToolBar","Distribute")):7==e.value&&(this.api.DistributeVertically(i),Common.component.Analytics.trackEvent("ToolBar","Distribute")),Common.NotificationCenter.trigger("edit:complete",this.toolbar)}},onShapeArrange:function(t,e){if(this.api){switch(e.value){case 1:this.api.shapes_bringToFront(),Common.component.Analytics.trackEvent("ToolBar","Shape Arrange");break;case 2:this.api.shapes_bringToBack(),Common.component.Analytics.trackEvent("ToolBar","Shape Arrange");break;case 3:this.api.shapes_bringForward(),Common.component.Analytics.trackEvent("ToolBar","Shape Arrange");break;case 4:this.api.shapes_bringBackward(),Common.component.Analytics.trackEvent("ToolBar","Shape Arrange");break;case 5:this.api.groupShapes(),Common.component.Analytics.trackEvent("ToolBar","Shape Group");break;case 6:this.api.unGroupShapes(),Common.component.Analytics.trackEvent("ToolBar","Shape UnGroup")}Common.NotificationCenter.trigger("edit:complete",this.toolbar)}},onHyperlinkClick:function(t){var e,i,n,o=this;if(o.api){var s=function(t,e){"ok"==e&&(i=t.getSettings(),!1!==n?o.api.add_Hyperlink(i):o.api.change_Hyperlink(i)),Common.NotificationCenter.trigger("edit:complete",o.toolbar)};n=o.api.can_AddHyperlink();for(var a=[],l=0;lthis.currentPageSize.width;this.currentPageSize={type:e.value,width:this.slideSizeArr[e.value][i?1:0],height:this.slideSizeArr[e.value][i?0:1]},this.api&&this.api.changeSlideSize(this.slideSizeArr[e.value][i?1:0],this.slideSizeArr[e.value][i?0:1]),Common.NotificationCenter.trigger("edit:complete",this.toolbar),Common.component.Analytics.trackEvent("ToolBar","Slide Size")}else{var n,o,s=this,a=function(t,e){"ok"==e&&(o=t.getSettings(),s.currentPageSize={type:o[0],width:o[1],height:o[2]},s.toolbar.btnSlideSize.menu.items[0].setChecked(0==o[0]),s.toolbar.btnSlideSize.menu.items[1].setChecked(1==o[0]),s.api&&s.api.changeSlideSize(o[1],o[2])),Common.NotificationCenter.trigger("edit:complete",s.toolbar)};n=new PE.Views.SlideSizeSettings({handler:a}),n.show(),n.setSettings(s.currentPageSize.type,s.currentPageSize.width,s.currentPageSize.height),Common.component.Analytics.trackEvent("ToolBar","Slide Size")}},onSelectChart:function(t){var e=this,i=!1,n=e.api.getSelectedElements();if(n&&_.isArray(n))for(var o=0;o0)){var t=this,e=this.getApplication().getCollection("EquationGroups");t.toolbar.btnInsertEquation.menu.removeAll();var i=function(n){for(var o=0;o
    ')}).on("item:click",function(e,i,n,o){t.api&&(n&&t.api.asc_AddMath(n.get("data").equationType),t.toolbar.btnsInsertText.pressed()&&t.toolbar.btnsInsertText.toggle(!1,!0),t.toolbar.btnsInsertShape.pressed()&&t.toolbar.btnsInsertShape.toggle(!1,!0),"click"!==o.type&&t.toolbar.btnInsertEquation.menu.hide(),Common.NotificationCenter.trigger("edit:complete",t.toolbar,t.toolbar.btnInsertEquation),Common.component.Analytics.trackEvent("ToolBar","Add Equation"))})}n.off("show:after",i)};t.toolbar.btnInsertEquation.menu.on("show:after",i);for(var n=0;n')}]})});t.toolbar.btnInsertEquation.menu.addItem(s)}}},onInsertEquationClick:function(){this.api&&(this.api.asc_AddMath(),Common.component.Analytics.trackEvent("ToolBar","Add Equation")),Common.NotificationCenter.trigger("edit:complete",this.toolbar,this.toolbar.btnInsertEquation)},onInsertSymbolClick:function(){if(this.api){var t=this,e=t.api.asc_GetSelectedText(),i=new Common.Views.SymbolTableDialog({api:t.api,lang:t.toolbar.mode.lang,type:1,special:!0,buttons:[{value:"ok",caption:this.textInsert},"close"],font:e&&e.length>0?t.api.get_TextProps().get_TextPr().get_FontFamily().get_Name():void 0,symbol:e&&e.length>0?e.charAt(0):void 0,handler:function(e,i,n){"ok"==i?t.api.asc_insertSymbol(n.font?n.font:t.api.get_TextProps().get_TextPr().get_FontFamily().get_Name(),n.code,n.special):Common.NotificationCenter.trigger("edit:complete",t.toolbar)}});i.show(),i.on("symbol:dblclick",function(e,i,n){t.api.asc_insertSymbol(n.font?n.font:t.api.get_TextProps().get_TextPr().get_FontFamily().get_Name(),n.code,n.special)})}},onApiMathTypes:function(t){this._equationTemp=t;var e=this,i=function(t){e.onMathTypes(e._equationTemp),e.toolbar.btnInsertEquation.menu.off("show:before",i)};e.toolbar.btnInsertEquation.menu.on("show:before",i)},onMathTypes:function(t){var e=[],i=this.getCollection("EquationGroups");i.reset();var n={};n[Common.define.c_oAscMathMainType.Symbol]=[this.textSymbols,11],n[Common.define.c_oAscMathMainType.Fraction]=[this.textFraction,4],n[Common.define.c_oAscMathMainType.Script]=[this.textScript,4],n[Common.define.c_oAscMathMainType.Radical]=[this.textRadical,4],n[Common.define.c_oAscMathMainType.Integral]=[this.textIntegral,3,!0],n[Common.define.c_oAscMathMainType.LargeOperator]=[this.textLargeOperator,5,!0],n[Common.define.c_oAscMathMainType.Bracket]=[this.textBracket,4,!0],n[Common.define.c_oAscMathMainType.Function]=[this.textFunction,3,!0],n[Common.define.c_oAscMathMainType.Accent]=[this.textAccent,4],n[Common.define.c_oAscMathMainType.LimitLog]=[this.textLimitAndLog,3],n[Common.define.c_oAscMathMainType.Operator]=[this.textOperator,4],n[Common.define.c_oAscMathMainType.Matrix]=[this.textMatrix,4,!0];var o={},s="",a="";for(s in Common.define.c_oAscMathType)if(Common.define.c_oAscMathType.hasOwnProperty(s)){var l=s.split("_");a=2==l.length&&"Symbol"==l[0]?"txt"+l[0]+"_"+l[1].toLocaleLowerCase():"txt"+s,o[Common.define.c_oAscMathType[s]]=this[a]}var r,c,d=0,h=0,p=0,u=0,m=0,g=null,f=null,b=null;if(t&&(c=t.get_Data(),h=c.length)){for(var C=0;C0&&i.toolbar.listTheme.rendered&&(i.toolbar.listTheme.fillComboView(i.toolbar.listTheme.menuPicker.store.at(0),!0),Common.NotificationCenter.trigger("edit:complete",this)),window.styles_loaded=!0},onHideMenus:function(t){Common.NotificationCenter.trigger("edit:complete",this.toolbar)},onSetupCopyStyleButton:function(){this.modeAlwaysSetStyle=!1;var t=this;Common.NotificationCenter.on({"edit:complete":function(){t.api&&t.modeAlwaysSetStyle&&(t.api.SetPaintFormat(AscCommon.c_oAscFormatPainterState.kOff),t.toolbar.btnCopyStyle.toggle(!1,!0),t.modeAlwaysSetStyle=!1)}}),$(t.toolbar.btnCopyStyle.cmpEl).dblclick(function(){t.api&&(t.modeAlwaysSetStyle=!0,t.toolbar.btnCopyStyle.toggle(!0,!0),t.api.SetPaintFormat(AscCommon.c_oAscFormatPainterState.kMultiple))})},activateControls:function(){this.onApiPageSize(this.api.get_PresentationWidth(),this.api.get_PresentationHeight()),this.toolbar.lockToolbar(PE.enumLock.disableOnStart,!1,{array:this.toolbar.slideOnlyControls.concat(this.toolbar.shapeControls)}),this._state.activated=!0},DisableToolbar:function(t,e){void 0!==e&&(this.editMode=!e),t=t||!this.editMode;var i=$(".toolbar-mask");if(!(t&&i.length>0||!t&&0==i.length)){var n=this.toolbar;n.$el.find(".toolbar").toggleClass("masked",t),n.btnsAddSlide&&this.toolbar.lockToolbar(PE.enumLock.menuFileOpen,t,{array:n.btnsAddSlide.concat(n.btnChangeSlide,n.btnPreview)}),t?(i=$("
    ").appendTo(n.$el.find(".toolbar")),Common.util.Shortcuts.suspendEvents("command+k, ctrl+k, alt+h, command+f5, ctrl+f5")):(i.remove(),Common.util.Shortcuts.resumeEvents("command+k, ctrl+k, alt+h, command+f5, ctrl+f5"))}},createDelayedElements:function(){this.toolbar.createDelayedElements(),this.attachUIEvents(this.toolbar)},onAppShowed:function(t){var e=this,i=!t.isEdit;t.isEdit&&(Common.localStorage.itemExists("pe-compact-toolbar")?i=Common.localStorage.getBool("pe-compact-toolbar"):t.customization&&t.customization.compactToolbar&&(i=!0)),e.toolbar.render(_.extend({compactview:i},t));var n={action:"review",caption:e.toolbar.textTabCollaboration},o=e.getApplication().getController("Common.Controllers.ReviewChanges").createToolbarPanel();if(o&&e.toolbar.addTab(n,o,3),t.isEdit){if(e.toolbar.setMode(t),e.toolbar.btnSave.on("disabled",_.bind(e.onBtnChangeState,e,"save:disabled")),!t.customization||!t.customization.compactHeader){e.toolbar.btnPrint.$el.parents(".group").hide().next().hide();var s=e.toolbar.btnUndo.$el.hide().next().hide().parent();e.toolbar.btnPaste.$el.detach().appendTo(s),e.toolbar.btnCopy.$el.removeClass("split")}t.isDesktopApp&&t.canProtect&&(n={action:"protect",caption:e.toolbar.textTabProtect},(o=e.getApplication().getController("Common.Controllers.Protection").createToolbarPanel())&&e.toolbar.addTab(n,o,4))}},onAppReady:function(t){var e=this;if(e.appOptions=t,this.btnsComment=[],t.canCoAuthoring&&t.canComments){var i=PE.enumLock;if(this.btnsComment=Common.Utils.injectButtons(this.toolbar.$el.find(".slot-comment"),"tlbtn-addcomment-","toolbar__icon btn-menu-comments",e.toolbar.capBtnComment,[i.lostConnect,i.noSlides]),this.btnsComment.length){var n=PE.getController("Common.Controllers.Comments").getView();Array.prototype.push.apply(e.toolbar.lockControls,this.btnsComment),this.btnsComment.forEach(function(t){t.updateHint(n.textHintAddComment),t.on("click",function(t,e){Common.NotificationCenter.trigger("app:comment:add","toolbar")}),t.cmpEl.closest("#review-changes-panel").length>0&&t.setCaption(e.toolbar.capBtnAddComment)},this),this.toolbar.lockToolbar(PE.enumLock.noSlides,this._state.no_slides,{array:this.btnsComment})}}},onFileMenu:function(t){"show"==t?this.toolbar.isTabActive("file")||this.toolbar.setTab("file"):this.toolbar.isTabActive("file")&&this.toolbar.setTab()},onTextLanguage:function(t){this._state.lang=t},onAddAudio:function(){this.api&&this.api.asc_AddAudio()},onAddVideo:function(){this.api&&this.api.asc_AddVideo()},textEmptyImgUrl:"You need to specify image URL.",textWarning:"Warning",textFontSizeErr:"The entered value is incorrect.
    Please enter a numeric value between 1 and 300",confirmAddFontName:"The font you are going to save is not available on the current device.
    The text style will be displayed using one of the device fonts, the saved font will be used when it is available.
    Do you want to continue?",textSymbols:"Symbols",textFraction:"Fraction",textScript:"Script",textRadical:"Radical",textIntegral:"Integral",textLargeOperator:"Large Operator",textBracket:"Bracket",textFunction:"Function",textAccent:"Accent",textLimitAndLog:"Limit And Log",textOperator:"Operator",textMatrix:"Matrix",txtSymbol_pm:"Plus Minus",txtSymbol_infinity:"Infinity",txtSymbol_equals:"Equal",txtSymbol_neq:"Not Equal To",txtSymbol_about:"Approximately",txtSymbol_times:"Multiplication Sign",txtSymbol_div:"Division Sign",txtSymbol_factorial:"Factorial",txtSymbol_propto:"Proportional To",txtSymbol_less:"Less Than",txtSymbol_ll:"Much Less Than",txtSymbol_greater:"Greater Than",txtSymbol_gg:"Much Greater Than",txtSymbol_leq:"Less Than or Equal To",txtSymbol_geq:"Greater Than or Equal To",txtSymbol_mp:"Minus Plus",txtSymbol_cong:"Approximately Equal To",txtSymbol_approx:"Almost Equal To",txtSymbol_equiv:"Identical To",txtSymbol_forall:"For All",txtSymbol_additional:"Complement",txtSymbol_partial:"Partial Differential",txtSymbol_sqrt:"Radical Sign",txtSymbol_cbrt:"Cube Root",txtSymbol_qdrt:"Fourth Root",txtSymbol_cup:"Union",txtSymbol_cap:"Intersection",txtSymbol_emptyset:"Empty Set",txtSymbol_percent:"Percentage",txtSymbol_degree:"Degrees",txtSymbol_fahrenheit:"Degrees Fahrenheit",txtSymbol_celsius:"Degrees Celsius",txtSymbol_inc:"Increment",txtSymbol_nabla:"Nabla",txtSymbol_exists:"There Exist",txtSymbol_notexists:"There Does Not Exist",txtSymbol_in:"Element Of",txtSymbol_ni:"Contains as Member",txtSymbol_leftarrow:"Left Arrow",txtSymbol_uparrow:"Up Arrow",txtSymbol_rightarrow:"Right Arrow",txtSymbol_downarrow:"Down Arrow",txtSymbol_leftrightarrow:"Left-Right Arrow",txtSymbol_therefore:"Therefore",txtSymbol_plus:"Plus",txtSymbol_minus:"Minus",txtSymbol_not:"Not Sign",txtSymbol_ast:"Asterisk Operator",txtSymbol_bullet:"Bulet Operator",txtSymbol_vdots:"Vertical Ellipsis",txtSymbol_cdots:"Midline Horizontal Ellipsis",txtSymbol_rddots:"Up Right Diagonal Ellipsis",txtSymbol_ddots:"Down Right Diagonal Ellipsis",txtSymbol_aleph:"Alef",txtSymbol_beth:"Bet",txtSymbol_qed:"End of Proof",txtSymbol_alpha:"Alpha",txtSymbol_beta:"Beta",txtSymbol_gamma:"Gamma",txtSymbol_delta:"Delta",txtSymbol_varepsilon:"Epsilon Variant",txtSymbol_epsilon:"Epsilon",txtSymbol_zeta:"Zeta",txtSymbol_eta:"Eta",txtSymbol_theta:"Theta",txtSymbol_vartheta:"Theta Variant",txtSymbol_iota:"Iota",txtSymbol_kappa:"Kappa",txtSymbol_lambda:"Lambda",txtSymbol_mu:"Mu",txtSymbol_nu:"Nu",txtSymbol_xsi:"Xi",txtSymbol_o:"Omicron",txtSymbol_pi:"Pi",txtSymbol_varpi:"Pi Variant",txtSymbol_rho:"Rho",txtSymbol_varrho:"Rho Variant",txtSymbol_sigma:"Sigma",txtSymbol_varsigma:"Sigma Variant",txtSymbol_tau:"Tau",txtSymbol_upsilon:"Upsilon",txtSymbol_varphi:"Phi Variant",txtSymbol_phi:"Phi",txtSymbol_chi:"Chi",txtSymbol_psi:"Psi",txtSymbol_omega:"Omega",txtFractionVertical:"Stacked Fraction",txtFractionDiagonal:"Skewed Fraction",txtFractionHorizontal:"Linear Fraction",txtFractionSmall:"Small Fraction",txtFractionDifferential_1:"Differential",txtFractionDifferential_2:"Differential",txtFractionDifferential_3:"Differential",txtFractionDifferential_4:"Differential",txtFractionPi_2:"Pi Over 2",txtScriptSup:"Superscript",txtScriptSub:"Subscript",txtScriptSubSup:"Subscript-Superscript",txtScriptSubSupLeft:"Left Subscript-Superscript",txtScriptCustom_1:"Script",txtScriptCustom_2:"Script",txtScriptCustom_3:"Script",txtScriptCustom_4:"Script",txtRadicalSqrt:"Square Root",txtRadicalRoot_n:"Radical With Degree",txtRadicalRoot_2:"Square Root With Degree",txtRadicalRoot_3:"Cubic Root",txtRadicalCustom_1:"Radical",txtRadicalCustom_2:"Radical",txtIntegral:"Integral",txtIntegralSubSup:"Integral",txtIntegralCenterSubSup:"Integral",txtIntegralDouble:"Double Integral",txtIntegralDoubleSubSup:"Double Integral",txtIntegralDoubleCenterSubSup:"Double Integral",txtIntegralTriple:"Triple Integral",txtIntegralTripleSubSup:"Triple Integral",txtIntegralTripleCenterSubSup:"Triple Integral",txtIntegralOriented:"Contour Integral",txtIntegralOrientedSubSup:"Contour Integral",txtIntegralOrientedCenterSubSup:"Contour Integral",txtIntegralOrientedDouble:"Surface Integral",txtIntegralOrientedDoubleSubSup:"Surface Integral",txtIntegralOrientedDoubleCenterSubSup:"Surface Integral",txtIntegralOrientedTriple:"Volume Integral",txtIntegralOrientedTripleSubSup:"Volume Integral",txtIntegralOrientedTripleCenterSubSup:"Volume Integral",txtIntegral_dx:"Differential x",txtIntegral_dy:"Differential y",txtIntegral_dtheta:"Differential theta",txtLargeOperator_Sum:"Summation",txtLargeOperator_Sum_CenterSubSup:"Summation",txtLargeOperator_Sum_SubSup:"Summation",txtLargeOperator_Sum_CenterSub:"Summation",txtLargeOperator_Sum_Sub:"Summation",txtLargeOperator_Prod:"Product",txtLargeOperator_Prod_CenterSubSup:"Product",txtLargeOperator_Prod_SubSup:"Product",txtLargeOperator_Prod_CenterSub:"Product",txtLargeOperator_Prod_Sub:"Product",txtLargeOperator_CoProd:"Co-Product",txtLargeOperator_CoProd_CenterSubSup:"Co-Product",txtLargeOperator_CoProd_SubSup:"Co-Product",txtLargeOperator_CoProd_CenterSub:"Co-Product",txtLargeOperator_CoProd_Sub:"Co-Product",txtLargeOperator_Union:"Union",txtLargeOperator_Union_CenterSubSup:"Union",txtLargeOperator_Union_SubSup:"Union",txtLargeOperator_Union_CenterSub:"Union",txtLargeOperator_Union_Sub:"Union",txtLargeOperator_Intersection:"Intersection",txtLargeOperator_Intersection_CenterSubSup:"Intersection",txtLargeOperator_Intersection_SubSup:"Intersection",txtLargeOperator_Intersection_CenterSub:"Intersection",txtLargeOperator_Intersection_Sub:"Intersection",txtLargeOperator_Disjunction:"Vee",txtLargeOperator_Disjunction_CenterSubSup:"Vee",txtLargeOperator_Disjunction_SubSup:"Vee",txtLargeOperator_Disjunction_CenterSub:"Vee",txtLargeOperator_Disjunction_Sub:"Vee",txtLargeOperator_Conjunction:"Wedge",txtLargeOperator_Conjunction_CenterSubSup:"Wedge",txtLargeOperator_Conjunction_SubSup:"Wedge",txtLargeOperator_Conjunction_CenterSub:"Wedge",txtLargeOperator_Conjunction_Sub:"Wedge",txtLargeOperator_Custom_1:"Summation",txtLargeOperator_Custom_2:"Summation",txtLargeOperator_Custom_3:"Summation",txtLargeOperator_Custom_4:"Product",txtLargeOperator_Custom_5:"Union",txtBracket_Round:"Brackets",txtBracket_Square:"Brackets",txtBracket_Curve:"Brackets",txtBracket_Angle:"Brackets",txtBracket_LowLim:"Brackets",txtBracket_UppLim:"Brackets",txtBracket_Line:"Brackets",txtBracket_LineDouble:"Brackets",txtBracket_Square_OpenOpen:"Brackets",txtBracket_Square_CloseClose:"Brackets",txtBracket_Square_CloseOpen:"Brackets",txtBracket_SquareDouble:"Brackets",txtBracket_Round_Delimiter_2:"Brackets with Separators",txtBracket_Curve_Delimiter_2:"Brackets with Separators",txtBracket_Angle_Delimiter_2:"Brackets with Separators",txtBracket_Angle_Delimiter_3:"Brackets with Separators",txtBracket_Round_OpenNone:"Single Bracket",txtBracket_Round_NoneOpen:"Single Bracket",txtBracket_Square_OpenNone:"Single Bracket",txtBracket_Square_NoneOpen:"Single Bracket",txtBracket_Curve_OpenNone:"Single Bracket",txtBracket_Curve_NoneOpen:"Single Bracket",txtBracket_Angle_OpenNone:"Single Bracket",txtBracket_Angle_NoneOpen:"Single Bracket",txtBracket_LowLim_OpenNone:"Single Bracket",txtBracket_LowLim_NoneNone:"Single Bracket",txtBracket_UppLim_OpenNone:"Single Bracket",txtBracket_UppLim_NoneOpen:"Single Bracket",txtBracket_Line_OpenNone:"Single Bracket",txtBracket_Line_NoneOpen:"Single Bracket",txtBracket_LineDouble_OpenNone:"Single Bracket",txtBracket_LineDouble_NoneOpen:"Single Bracket",txtBracket_SquareDouble_OpenNone:"Single Bracket",txtBracket_SquareDouble_NoneOpen:"Single Bracket",txtBracket_Custom_1:"Case (Two Conditions)",txtBracket_Custom_2:"Cases (Three Conditions)",txtBracket_Custom_3:"Stack Object",txtBracket_Custom_4:"Stack Object",txtBracket_Custom_5:"Cases Example",txtBracket_Custom_6:"Binomial Coefficient",txtBracket_Custom_7:"Binomial Coefficient",txtFunction_Sin:"Sine Function",txtFunction_Cos:"Cosine Function",txtFunction_Tan:"Tangent Function",txtFunction_Csc:"Cosecant Function",txtFunction_Sec:"Secant Function",txtFunction_Cot:"Cotangent Function",txtFunction_1_Sin:"Inverse Sine Function",txtFunction_1_Cos:"Inverse Cosine Function",txtFunction_1_Tan:"Inverse Tangent Function",txtFunction_1_Csc:"Inverse Cosecant Function",txtFunction_1_Sec:"Inverse Secant Function",txtFunction_1_Cot:"Inverse Cotangent Function",txtFunction_Sinh:"Hyperbolic Sine Function",txtFunction_Cosh:"Hyperbolic Cosine Function",txtFunction_Tanh:"Hyperbolic Tangent Function",txtFunction_Csch:"Hyperbolic Cosecant Function",txtFunction_Sech:"Hyperbolic Secant Function",txtFunction_Coth:"Hyperbolic Cotangent Function",txtFunction_1_Sinh:"Hyperbolic Inverse Sine Function",txtFunction_1_Cosh:"Hyperbolic Inverse Cosine Function",txtFunction_1_Tanh:"Hyperbolic Inverse Tangent Function",txtFunction_1_Csch:"Hyperbolic Inverse Cosecant Function",txtFunction_1_Sech:"Hyperbolic Inverse Secant Function",txtFunction_1_Coth:"Hyperbolic Inverse Cotangent Function",txtFunction_Custom_1:"Sine theta",txtFunction_Custom_2:"Cos 2x",txtFunction_Custom_3:"Tangent formula",txtAccent_Dot:"Dot",txtAccent_DDot:"Double Dot",txtAccent_DDDot:"Triple Dot",txtAccent_Hat:"Hat",txtAccent_Check:"Check",txtAccent_Accent:"Acute",txtAccent_Grave:"Grave",txtAccent_Smile:"Breve",txtAccent_Tilde:"Tilde",txtAccent_Bar:"Bar",txtAccent_DoubleBar:"Double Overbar",txtAccent_CurveBracketTop:"Overbrace",txtAccent_CurveBracketBot:"Underbrace",txtAccent_GroupTop:"Grouping Character Above",txtAccent_GroupBot:"Grouping Character Below",txtAccent_ArrowL:"Leftwards Arrow Above",txtAccent_ArrowR:"Rightwards Arrow Above",txtAccent_ArrowD:"Right-Left Arrow Above",txtAccent_HarpoonL:"Leftwards Harpoon Above",txtAccent_HarpoonR:"Rightwards Harpoon Above",txtAccent_BorderBox:"Boxed Formula (With Placeholder)",txtAccent_BorderBoxCustom:"Boxed Formula (Example)",txtAccent_BarTop:"Overbar",txtAccent_BarBot:"Underbar",txtAccent_Custom_1:"Vector A",txtAccent_Custom_2:"ABC With Overbar",txtAccent_Custom_3:"x XOR y With Overbar",txtLimitLog_LogBase:"Logarithm",txtLimitLog_Log:"Logarithm",txtLimitLog_Lim:"Limit",txtLimitLog_Min:"Minimum",txtLimitLog_Max:"Maximum",txtLimitLog_Ln:"Natural Logarithm",txtLimitLog_Custom_1:"Limit Example",txtLimitLog_Custom_2:"Maximum Example",txtOperator_ColonEquals:"Colon Equal",txtOperator_EqualsEquals:"Equal Equal",txtOperator_PlusEquals:"Plus Equal",txtOperator_MinusEquals:"Minus Equal",txtOperator_Definition:"Equal to By Definition",txtOperator_UnitOfMeasure:"Measured By",txtOperator_DeltaEquals:"Delta Equal To",txtOperator_ArrowL_Top:"Leftwards Arrow Above",txtOperator_ArrowR_Top:"Rightwards Arrow Above",txtOperator_ArrowL_Bot:"Leftwards Arrow Below",txtOperator_ArrowR_Bot:"Rightwards Arrow Below",txtOperator_DoubleArrowL_Top:"Leftwards Arrow Above",txtOperator_DoubleArrowR_Top:"Rightwards Arrow Above",txtOperator_DoubleArrowL_Bot:"Leftwards Arrow Below",txtOperator_DoubleArrowR_Bot:"Rightwards Arrow Below",txtOperator_ArrowD_Top:"Right-Left Arrow Above",txtOperator_ArrowD_Bot:"Right-Left Arrow Above",txtOperator_DoubleArrowD_Top:"Right-Left Arrow Below",txtOperator_DoubleArrowD_Bot:"Right-Left Arrow Below",txtOperator_Custom_1:"Yileds",txtOperator_Custom_2:"Delta Yields",txtMatrix_1_2:"1x2 Empty Matrix",txtMatrix_2_1:"2x1 Empty Matrix",txtMatrix_1_3:"1x3 Empty Matrix",txtMatrix_3_1:"3x1 Empty Matrix",txtMatrix_2_2:"2x2 Empty Matrix",txtMatrix_2_3:"2x3 Empty Matrix",txtMatrix_3_2:"3x2 Empty Matrix",txtMatrix_3_3:"3x3 Empty Matrix",txtMatrix_Dots_Center:"Midline Dots",txtMatrix_Dots_Baseline:"Baseline Dots",txtMatrix_Dots_Vertical:"Vertical Dots",txtMatrix_Dots_Diagonal:"Diagonal Dots",txtMatrix_Identity_2:"2x2 Identity Matrix",txtMatrix_Identity_2_NoZeros:"3x3 Identity Matrix",txtMatrix_Identity_3:"3x3 Identity Matrix",txtMatrix_Identity_3_NoZeros:"3x3 Identity Matrix",txtMatrix_2_2_RoundBracket:"Empty Matrix with Brackets",txtMatrix_2_2_SquareBracket:"Empty Matrix with Brackets",txtMatrix_2_2_LineBracket:"Empty Matrix with Brackets",txtMatrix_2_2_DLineBracket:"Empty Matrix with Brackets",txtMatrix_Flat_Round:"Sparse Matrix",txtMatrix_Flat_Square:"Sparse Matrix",textInsert:"Insert"},PE.Controllers.Toolbar||{}))}),define("text!presentationeditor/main/app/template/StatusBar.template",[],function(){return'\r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n \r\n
    \r\n \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n \r\n \r\n
    \r\n \r\n \r\n \r\n
    \r\n \r\n
    \r\n \r\n
    \r\n
    \r\n'}),define("presentationeditor/main/app/view/Statusbar",["text!presentationeditor/main/app/template/StatusBar.template","backbone","tip","common/main/lib/component/Menu","common/main/lib/component/Window","presentationeditor/main/app/model/Pages"],function(t,e){"use strict";function i(t){this.pages.get("count")<0&&$("#status-label-pages").css("display","inline-block"),this.pages.set("count",t);var e=t<=0;this.btnPreview.isDisabled()!==e&&this.btnPreview.setDisabled(e)}function n(t){this.pages.set("current",t+1)}function o(t,e,i){$("#status-label-pages").text(Common.Utils.String.format(this.pageIndexText,t.get("current"),t.get("count")))}function s(t,e){t.$el.parent().find("#status-label-lang").text(e.caption),this.langMenu.prevTip=e.value.value,this.fireEvent("langchanged",[this,e.value.code,e.caption])}_.template("Slide <%= current %> of <%= count %>");PE.Views.Statusbar=e.View.extend(_.extend({el:"#statusbar",template:_.template(t),events:{},api:void 0,pages:void 0,initialize:function(t){_.extend(this,t),this.pages=new PE.Models.Pages({current:1,count:-1}),this.pages.on("change",_.bind(o,this)),this._state={no_paragraph:!0}},render:function(){var t=this;$(this.el).html(this.template({scope:this})),this.btnZoomToPage=new Common.UI.Button({el:$("#btn-zoom-topage",this.el),hint:this.tipFitPage,hintAnchor:"top",toggleGroup:"status-zoom",enableToggle:!0}),this.btnZoomToWidth=new Common.UI.Button({el:$("#btn-zoom-towidth",this.el),hint:this.tipFitWidth,hintAnchor:"top",toggleGroup:"status-zoom",enableToggle:!0}),this.btnZoomDown=new Common.UI.Button({el:$("#btn-zoom-down",this.el),hint:this.tipZoomOut+Common.Utils.String.platformKey("Ctrl+-"),hintAnchor:"top"}),this.btnZoomUp=new Common.UI.Button({el:$("#btn-zoom-up",this.el),hint:this.tipZoomIn+Common.Utils.String.platformKey("Ctrl++"),hintAnchor:"top-right"}),this.cntZoom=new Common.UI.Button({el:$(".cnt-zoom",this.el),hint:this.tipZoomFactor,hintAnchor:"top"}),this.cntZoom.cmpEl.on("show.bs.dropdown",function(){_.defer(function(){t.cntZoom.cmpEl.find("ul").focus()},100)}),this.cntZoom.cmpEl.on("hide.bs.dropdown",function(){_.defer(function(){t.api.asc_enableKeyEvents(!0)},100)}),this.zoomMenu=new Common.UI.Menu({style:"margin-top:-5px;",menuAlign:"bl-tl",items:[{caption:"50%",value:50},{caption:"75%",value:75},{caption:"100%",value:100},{caption:"125%",value:125},{caption:"150%",value:150},{caption:"175%",value:175},{caption:"200%",value:200}]}),this.zoomMenu.render($(".cnt-zoom",this.el)),this.zoomMenu.cmpEl.attr({tabindex:-1}),this.txtGoToPage=new Common.UI.InputField({el:$("#status-goto-page"),allowBlank:!0,validateOnChange:!0,style:"width: 60px;",maskExp:/[0-9]/,validation:function(e){return!!(/(^[0-9]+$)/.test(e)&&void 0!==(e=parseInt(e))&&e>0&&e<=t.pages.get("count"))||t.txtPageNumInvalid}}).on("keypress:after",function(e,i){if(i.keyCode===Common.UI.Keys.RETURN){var n=t.$el.find("#status-goto-box"),o=n.find("input[type=text]"),s=parseInt(o.val());return!s||s-- >t.pages.get("count")||s<0?(o.select(),!1):(n.focus(),n.parent().removeClass("open"),t.api.goToPage(s),t.api.asc_enableKeyEvents(!0),!1)}}).on("keyup:after",function(e,i){if(i.keyCode===Common.UI.Keys.ESC){var n=t.$el.find("#status-goto-box");return n.focus(),n.parent().removeClass("open"),t.api.asc_enableKeyEvents(!0),!1}});var e=this.$el.find("#status-goto-box");e.on("click",function(){return!1}),e.parent().on("show.bs.dropdown",function(){t.txtGoToPage.setValue(t.api.getCurrentPage()+1),t.txtGoToPage.checkValidate();var e=t.txtGoToPage.$el.find("input");_.defer(function(){e.focus(),e.select()},100)}),e.parent().on("hide.bs.dropdown",function(){var e=t.$el.find("#status-goto-box");t.api&&e&&(e.focus(),e.parent().removeClass("open"),t.api.asc_enableKeyEvents(!0))}),this.btnPreview=new Common.UI.Button({parentEl:$("#slot-status-btn-preview"),cls:"btn-toolbar",iconCls:"toolbar__icon btn-preview",hint:this.tipPreview,hintAnchor:"top",split:!0,menu:new Common.UI.Menu({menuAlign:"bl-tl",style:"margin-top:-5px;",items:[{caption:this.textShowBegin,value:0},{caption:this.textShowCurrent,value:1},{caption:this.textShowPresenterView,value:2}]})});var i=$(".cnt-lang",this.el);return this.langMenu=new Common.UI.MenuSimple({cls:"lang-menu",style:"margin-top:-5px;",restoreHeight:285,itemTemplate:_.template(['','',"<%= caption %>",""].join("")),menuAlign:"bl-tl",search:!0}),this.btnLanguage=new Common.UI.Button({el:i,hint:this.tipSetLang,hintAnchor:"top-left",disabled:!0}),this.btnLanguage.cmpEl.on({"show.bs.dropdown":function(){_.defer(function(){t.btnLanguage.cmpEl.find("ul").focus()},100)},"hide.bs.dropdown":function(){_.defer(function(){t.api.asc_enableKeyEvents(!0)},100)},click:function(e){if(t.btnLanguage.isDisabled())return!1}}),this.langMenu.render(i),this.langMenu.cmpEl.attr({tabindex:-1}),this.langMenu.prevTip="en",this.langMenu.on("item:click",_.bind(s,this)),this},setApi:function(t){return this.api=t,this.api&&(this.api.asc_registerCallback("asc_onCountPages",_.bind(i,this)),this.api.asc_registerCallback("asc_onCurrentPage",_.bind(n,this)),this.api.asc_registerCallback("asc_onFocusObject",_.bind(this.onApiFocusObject,this)),Common.NotificationCenter.on("api:disconnect",_.bind(this.onApiCoAuthoringDisconnect,this))),this},setMode:function(t){this.mode=t,this.$el.find(".el-edit")[this.mode.isEdit?"show":"hide"]()},setVisible:function(t){t?this.show():this.hide()},showStatusMessage:function(t){$("#status-label-action").text(t)},clearStatusMessage:function(){$("#status-label-action").text("")},reloadLanguages:function(t){var e=[],i=this.langMenu.saved;_.each(t,function(t){e.push({caption:t.displayValue,value:{value:t.value,code:t.code},checkable:!0,checked:i==t.displayValue,spellcheck:t.spellcheck})}),this.langMenu.resetItems(e),this.langMenu.items.length>0&&this.btnLanguage.setDisabled(this._state.no_paragraph)},setLanguage:function(t){if(this.langMenu.prevTip!=t.value&&void 0!==t.code){$(this.langMenu.el.parentNode,this.$el).find("#status-label-lang").text(t.displayValue),this.langMenu.prevTip=t.value;var e=_.find(this.langMenu.items,function(e){return e.caption==t.displayValue});e?this.langMenu.setChecked(this.langMenu.items.indexOf(e),!0):(this.langMenu.saved=t.displayValue,this.langMenu.clearAll())}},SetDisabled:function(t){var e=this.langMenu.items.length>0;this.btnLanguage.setDisabled(t||!e||this._state.no_paragraph),this.mode.isEdit=!t},onApiFocusObject:function(t){if(this.mode&&this.mode.isEdit){this._state.no_paragraph=!0;for(var e=-1;++e
    ',initialize:function(t){_.extend(this.options,t||{},{label:this.labelSelect}),this.options.tpl=_.template(this.template)(this.options),Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this);var t=this.getChild();t.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this)),this.cmbLanguage=new Common.UI.ComboBox({el:t.find("#id-document-language"),cls:"input-group-nr",menuStyle:"min-width: 318px; max-height: 285px;",editable:!1,template:_.template(['','','','','",""].join("")),data:this.options.languages,takeFocusOnClose:!0,search:!0,scrollAlwaysVisible:!0}),this.cmbLanguage.scroller&&this.cmbLanguage.scroller.update({alwaysVisibleY:!0}),this.cmbLanguage.on("selected",_.bind(this.onLangSelect,this));var e=Common.util.LanguageInfo.getLocalLanguageName(this.options.current);this.cmbLanguage.setValue(e[0],e[1]),this.onLangSelect(this.cmbLanguage,this.cmbLanguage.getSelectedRecord());var i=this;setTimeout(function(){i.cmbLanguage.focus()},100)},close:function(t){this.getChild().find(".combobox.open").length||Common.UI.Window.prototype.close.call(this,arguments)},onBtnClick:function(t){this.options.handler&&this.options.handler.call(this,t.currentTarget.attributes.result.value,this.cmbLanguage.getValue()),this.close()},onLangSelect:function(t,e,i){t.$el.find(".input-icon").toggleClass("spellcheck-lang",e&&e.spellcheck),t._input.css("padding-left",e&&e.spellcheck?25:3)},onPrimary:function(){return this.options.handler&&this.options.handler.call(this,"ok",this.cmbLanguage.getValue()),this.close(),!1},labelSelect:"Select document language"},Common.Views.LanguageDialog||{}))}),define("presentationeditor/main/app/controller/Statusbar",["core","presentationeditor/main/app/view/Statusbar","common/main/lib/util/LanguageInfo","common/main/lib/view/LanguageDialog"],function(){"use strict";PE.Controllers.Statusbar=Backbone.Controller.extend(_.extend({models:[],collections:[],views:["Statusbar"],initialize:function(){var t=this;this.addListeners({Statusbar:{langchanged:this.onLangMenu},"Common.Views.Header":{"statusbar:hide":function(e,i){t.statusbar.setVisible(!i),Common.localStorage.setBool("pe-hidden-status",i),Common.NotificationCenter.trigger("layout:changed","status"),Common.NotificationCenter.trigger("edit:complete",this.statusbar)}}}),this._state={zoom_type:void 0,zoom_percent:void 0}},events:function(){return{"click #btn-zoom-down":_.bind(this.zoomDocument,this,"down"),"click #btn-zoom-up":_.bind(this.zoomDocument,this,"up")}},onLaunch:function(){this.statusbar=this.createView("Statusbar",{}).render(),this.statusbar.$el.css("z-index",1),this.bindViewEvents(this.statusbar,this.events),$("#status-label-zoom").css("min-width",80),this.statusbar.btnZoomToPage.on("click",_.bind(this.onBtnZoomTo,this,"topage")),this.statusbar.btnZoomToWidth.on("click",_.bind(this.onBtnZoomTo,this,"towidth")),this.statusbar.zoomMenu.on("item:click",_.bind(this.menuZoomClick,this)),this.statusbar.btnPreview.on("click",_.bind(this.onPreviewBtnClick,this)),this.statusbar.btnPreview.menu.on("item:click",_.bind(this.onPreviewItemClick,this));var t=this;Common.NotificationCenter.on("app:face",function(e){if(e.isEdit){var i=t.getApplication().getController("Common.Controllers.ReviewChanges").getView();t.btnSpelling=i.getButton("spelling","statusbar"),t.btnSpelling.render(t.statusbar.$el.find("#btn-doc-spell")),t.btnDocLang=i.getButton("doclang","statusbar"),t.btnDocLang.render(t.statusbar.$el.find("#btn-doc-lang"))}else t.statusbar.$el.find(".el-edit, .el-review").hide()})},setApi:function(t){this.api=t,this.api.asc_registerCallback("asc_onZoomChange",_.bind(this._onZoomChange,this)),this.api.asc_registerCallback("asc_onTextLanguage",_.bind(this._onTextLanguage,this)),this.statusbar.setApi(t)},onBtnZoomTo:function(t,e,i){this._state.zoom_type=void 0,this._state.zoom_percent=void 0,e.pressed?this.api["topage"==t?"zoomFitToPage":"zoomFitToWidth"]():this.api.zoomCustomMode(),Common.NotificationCenter.trigger("edit:complete",this.statusbar)},zoomDocument:function(t,e){switch(this._state.zoom_type=void 0,this._state.zoom_percent=void 0,t){case"up":this.api.zoomIn();break;case"down":this.api.zoomOut()}Common.NotificationCenter.trigger("edit:complete",this.statusbar)},menuZoomClick:function(t,e){this._state.zoom_type=void 0,this._state.zoom_percent=void 0,this.api.zoom(e.value),Common.NotificationCenter.trigger("edit:complete",this.statusbar)},onPreview:function(t,e){Common.NotificationCenter.trigger("preview:start",_.isNumber(t)?t:0,e)},onPreviewBtnClick:function(t,e){this.onPreview(this.api.getCurrentPage())},onPreviewItemClick:function(t,e){switch(e.value){case 0:this.onPreview(0);break;case 1:this.onPreview(this.api.getCurrentPage());break;case 2:this.onPreview(0,!0)}},_onZoomChange:function(t,e){this._state.zoom_type!==e&&(this.statusbar.btnZoomToPage.toggle(2==e,!0),this.statusbar.btnZoomToWidth.toggle(1==e,!0),this._state.zoom_type=e),this._state.zoom_percent!==t&&($("#status-label-zoom").text(Common.Utils.String.format(this.zoomText,t)),this._state.zoom_percent=t)},_onTextLanguage:function(t){var e=Common.util.LanguageInfo.getLocalLanguageName(t);this.statusbar.setLanguage({value:e[0],displayValue:e[1],code:t})},setLanguages:function(t){this.langs=t,this.statusbar.reloadLanguages(t)},setStatusCaption:function(t,e,i){this.timerCaption&&(new Date0&&(this.timerCaption=(new Date).getTime()+i)):this.statusbar.clearStatusMessage())},createDelayedElements:function(){this.statusbar.$el.css("z-index","")},onLangMenu:function(t,e,i){this.api.put_TextPrLang(e)},zoomText:"Zoom {0}%"},PE.Controllers.Statusbar||{}))}),define("text!presentationeditor/main/app/template/RightMenu.template",[],function(){return'
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n \n \n \n \n \n \n \n \n
    \n
    '}),define("text!presentationeditor/main/app/template/ParagraphSettings.template",[],function(){return'\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    '}),define("presentationeditor/main/app/view/ParagraphSettings",["text!presentationeditor/main/app/template/ParagraphSettings.template","jquery","underscore","backbone","common/main/lib/component/ComboBox","common/main/lib/component/MetricSpinner","presentationeditor/main/app/view/ParagraphSettingsAdvanced"],function(t,e,i,n){"use strict";PE.Views.ParagraphSettings=n.View.extend(i.extend({el:"#id-paragraph-settings",template:i.template(t),events:{},options:{alias:"ParagraphSettings"},initialize:function(){this._initSettings=!0,this._state={LineRule:c_paragraphLinerule.LINERULE_AUTO,LineHeight:1.5,LineSpacingBefore:0,LineSpacingAfter:.35,DisabledControls:!1},this.spinners=[],this.lockedControls=[],this._locked=!1,this.render()},render:function(){e(this.el).html(this.template({scope:this})),this.linkAdvanced=e("#paragraph-advanced-link")},setApi:function(t){return this.api=t,this.api&&this.api.asc_registerCallback("asc_onParaSpacingLine",i.bind(this._onLineSpacing,this)),this},onNumLineHeightChange:function(t,e,i,n){""!==this.cmbLineRule.getRawValue()&&this.api&&this.api.put_PrLineSpacing(this.cmbLineRule.getValue(),this.cmbLineRule.getValue()==c_paragraphLinerule.LINERULE_AUTO?t.getNumberValue():Common.Utils.Metric.fnRecalcToMM(t.getNumberValue()))},onNumSpacingBeforeChange:function(t,e,i,n){if(this.api){t.getNumberValue()<0?this.api.put_LineSpacingBeforeAfter(0,-1):this.api.put_LineSpacingBeforeAfter(0,Common.Utils.Metric.fnRecalcToMM(t.getNumberValue()))}},onNumSpacingAfterChange:function(t,e,i,n){if(this.api){t.getNumberValue()<0?this.api.put_LineSpacingBeforeAfter(1,-1):this.api.put_LineSpacingBeforeAfter(1,Common.Utils.Metric.fnRecalcToMM(t.getNumberValue()))}},onLineRuleSelect:function(t,e){this.api&&this.api.put_PrLineSpacing(e.value,e.defaultValue),this.numLineHeight.setDefaultUnit(e.defaultUnit),this.numLineHeight.setMinValue(e.minValue),this.numLineHeight.setStep(e.step),this.fireEvent("editcomplete",this)},_onLineSpacing:function(t){if(!this._initSettings){var e=t.get_LineRule(),i=t.get_Line();if(this._state.LineRule!==e){var n,o=this.cmbLineRule.store.findWhere((n={},n.value=e,n));o||(o=this.cmbLineRule.store.at(0)),this.cmbLineRule.setValue(null!==e?e:""),this.numLineHeight.setMinValue(o.get("minValue")),this.numLineHeight.setDefaultUnit(o.get("defaultUnit")),this.numLineHeight.setStep(o.get("step")),this._state.LineRule=e}if(Math.abs(this._state.LineHeight-i)>.001||(null===this._state.LineHeight||null===i)&&this._state.LineHeight!==i){var s="";e==c_paragraphLinerule.LINERULE_AUTO?s=i:null!==e&&null!==i&&(s=Common.Utils.Metric.fnRecalcFromMM(i)),this.numLineHeight.setValue(null!==s?s:"",!0),this._state.LineHeight=i}}},ChangeSettings:function(t){if(this._initSettings&&this.createDelayedElements(),this.disableControls(this._locked),t){var e={Line:t.get_Spacing().get_Line(),Before:t.get_Spacing().get_Before(),After:t.get_Spacing().get_After(),LineRule:t.get_Spacing().get_LineRule()};t.get_ContextualSpacing();if(this._state.LineRule!==e.LineRule){var i,n=this.cmbLineRule.store.findWhere((i={},i.value=e.LineRule,i));n||(n=this.cmbLineRule.store.at(0)),this.cmbLineRule.setValue(null!==e.LineRule?e.LineRule:""),this.numLineHeight.setMinValue(n.get("minValue")),this.numLineHeight.setDefaultUnit(n.get("defaultUnit")),this.numLineHeight.setStep(n.get("step")),this._state.LineRule=e.LineRule}if(Math.abs(this._state.LineHeight-e.Line)>.001||(null===this._state.LineHeight||null===e.Line)&&this._state.LineHeight!==e.Line){var o="";e.LineRule==c_paragraphLinerule.LINERULE_AUTO?o=e.Line:null!==e.LineRule&&null!==e.Line&&(o=Common.Utils.Metric.fnRecalcFromMM(e.Line)),this.numLineHeight.setValue(null!==o?o:"",!0),this._state.LineHeight=e.Line} +(Math.abs(this._state.LineSpacingBefore-e.Before)>.001||(null===this._state.LineSpacingBefore||null===e.Before)&&this._state.LineSpacingBefore!==e.Before)&&(this.numSpacingBefore.setValue(null!==e.Before?e.Before<0?e.Before:Common.Utils.Metric.fnRecalcFromMM(e.Before):"",!0),this._state.LineSpacingBefore=e.Before),(Math.abs(this._state.LineSpacingAfter-e.After)>.001||(null===this._state.LineSpacingAfter||null===e.After)&&this._state.LineSpacingAfter!==e.After)&&(this.numSpacingAfter.setValue(null!==e.After?e.After<0?e.After:Common.Utils.Metric.fnRecalcFromMM(e.After):"",!0),this._state.LineSpacingAfter=e.After)}},updateMetricUnit:function(){if(this.spinners){for(var t=0;t0)for(var n,o,s=i.length-1;s>=0;s--)if(n=i[s].get_ObjectType(),o=i[s].get_ObjectValue(),Asc.c_oAscTypeSelectElement.Paragraph==n){new PE.Views.ParagraphSettingsAdvanced({paragraphProps:o,api:e.api,handler:function(t,i){"ok"==t&&e.api&&e.api.paraApply(i.paragraphProps),e.fireEvent("editcomplete",e)}}).show();break}}}},onHideMenus:function(t,e,i){i||this.fireEvent("editcomplete",this)},setLocked:function(t){this._locked=t},disableControls:function(t){this._initSettings||this._state.DisabledControls!==t&&(this._state.DisabledControls=t,i.each(this.lockedControls,function(e){e.setDisabled(t)}),this.linkAdvanced.toggleClass("disabled",t))},strParagraphSpacing:"Paragraph Spacing",strLineHeight:"Line Spacing",strSpacingBefore:"Before",strSpacingAfter:"After",textAuto:"Multiple",textAtLeast:"At least",textExact:"Exactly",textAdvanced:"Show advanced settings",textAt:"At",txtAutoText:"Auto"},PE.Views.ParagraphSettings||{}))}),define("text!presentationeditor/main/app/template/ImageSettings.template",[],function(){return'\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
    \r\n \r\n
    \r\n \r\n \r\n \r\n
    \r\n \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n \r\n
    '}),define("text!presentationeditor/main/app/template/ImageSettingsAdvanced.template",[],function(){return'
    \r\n
    \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
    \r\n \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
    \r\n \r\n
    \r\n \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
    \r\n \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
    \r\n \r\n
    \r\n
    \r\n \r\n \r\n
    \r\n \r\n
    \r\n
    \r\n
    '}),define("presentationeditor/main/app/view/ImageSettingsAdvanced",["text!presentationeditor/main/app/template/ImageSettingsAdvanced.template","common/main/lib/view/AdvancedSettingsWindow","common/main/lib/component/MetricSpinner","common/main/lib/component/CheckBox"],function(t){"use strict";PE.Views.ImageSettingsAdvanced=Common.Views.AdvancedSettingsWindow.extend(_.extend({options:{alias:"ImageSettingsAdvanced",contentWidth:340,height:342,sizeOriginal:{width:0,height:0},sizeMax:{width:55.88,height:55.88},storageName:"pe-img-settings-adv-category"},initialize:function(e){_.extend(this.options,{title:this.textTitle,items:[{panelId:"id-adv-image-size",panelCaption:this.textPlacement},{panelId:"id-adv-image-rotate",panelCaption:this.textRotation},{panelId:"id-adv-image-alttext",panelCaption:this.textAlt}],contentTemplate:_.template(t)({scope:this})},e),Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this,this.options),this.spinners=[],this._nRatio=1,this._isDefaultSize=!1,this._originalProps=this.options.imageProps},render:function(){Common.Views.AdvancedSettingsWindow.prototype.render.call(this);var t=this;this.spnWidth=new Common.UI.MetricSpinner({el:$("#image-advanced-spin-width"),step:.1,width:80,defaultUnit:"cm",value:"3 cm",maxValue:55.88,minValue:0}),this.spnWidth.on("change",_.bind(function(t,e,i,n){if(this.btnRatio.pressed){var o=t.getNumberValue(),s=o/this._nRatio;s>this.sizeMax.height&&(s=this.sizeMax.height,o=s*this._nRatio,this.spnWidth.setValue(o,!0)),this.spnHeight.setValue(s,!0)}this._isDefaultSize=!1},this)),this.spinners.push(this.spnWidth),this.spnHeight=new Common.UI.MetricSpinner({el:$("#image-advanced-spin-height"),step:.1,width:80,defaultUnit:"cm",value:"3 cm",maxValue:55.88,minValue:0}),this.spnHeight.on("change",_.bind(function(t,e,i,n){var o=t.getNumberValue(),s=null;this.btnRatio.pressed&&(s=o*this._nRatio,s>this.sizeMax.width&&(s=this.sizeMax.width,o=s/this._nRatio,this.spnHeight.setValue(o,!0)),this.spnWidth.setValue(s,!0)),this._isDefaultSize=!1},this)),this.spinners.push(this.spnHeight),this.btnOriginalSize=new Common.UI.Button({el:$("#image-advanced-button-original-size")}),this.btnOriginalSize.on("click",_.bind(function(t,e){this.spnWidth.setValue(this.sizeOriginal.width,!0),this.spnHeight.setValue(this.sizeOriginal.height,!0),this._nRatio=this.sizeOriginal.width/this.sizeOriginal.height,this._isDefaultSize=!0},this)),this.btnRatio=new Common.UI.Button({parentEl:$("#image-advanced-button-ratio"),cls:"btn-toolbar",iconCls:"toolbar__icon advanced-btn-ratio",style:"margin-bottom: 1px;",enableToggle:!0,hint:this.textKeepRatio}),this.btnRatio.on("click",_.bind(function(t,e){t.pressed&&this.spnHeight.getNumberValue()>0&&(this._nRatio=this.spnWidth.getNumberValue()/this.spnHeight.getNumberValue())},this)),this.spnX=new Common.UI.MetricSpinner({el:$("#image-advanced-spin-x"),step:.1,width:85,defaultUnit:"cm",defaultValue:0,value:"0 cm",maxValue:55.87,minValue:-55.87}),this.spinners.push(this.spnX),this.spnY=new Common.UI.MetricSpinner({el:$("#image-advanced-spin-y"),step:.1,width:85,defaultUnit:"cm",defaultValue:0,value:"0 cm",maxValue:55.87,minValue:-55.87}),this.spinners.push(this.spnY),this.spnAngle=new Common.UI.MetricSpinner({el:$("#image-advanced-spin-angle"),step:1,width:80,defaultUnit:"°",value:"0 °",maxValue:3600,minValue:-3600}),this.chFlipHor=new Common.UI.CheckBox({el:$("#image-advanced-checkbox-hor"),labelText:this.textHorizontally}),this.chFlipVert=new Common.UI.CheckBox({el:$("#image-advanced-checkbox-vert"),labelText:this.textVertically}),this.inputAltTitle=new Common.UI.InputField({el:$("#image-advanced-alt-title"),allowBlank:!0,validateOnBlur:!1,style:"width: 100%;"}).on("changed:after",function(){t.isAltTitleChanged=!0}),this.textareaAltDescription=this.$window.find("textarea"),this.textareaAltDescription.keydown(function(e){e.keyCode==Common.UI.Keys.RETURN&&e.stopPropagation(),t.isAltDescChanged=!0}),this.afterRender()},getFocusedComponents:function(){return[this.spnWidth,this.spnHeight,this.spnX,this.spnY,this.spnAngle,this.inputAltTitle,this.textareaAltDescription]},onCategoryClick:function(t,e){Common.Views.AdvancedSettingsWindow.prototype.onCategoryClick.call(this,t,e);var i=this;setTimeout(function(){switch(e){case 0:i.spnWidth.focus();break;case 1:i.spnAngle.focus();break;case 2:i.inputAltTitle.focus()}},10)},afterRender:function(){if(this.updateMetricUnit(),this._setDefaults(this._originalProps),this.storageName){var t=Common.localStorage.getItem(this.storageName);this.setActiveCategory(null!==t?parseInt(t):0)}},_setDefaults:function(t){if(t){this.spnWidth.setMaxValue(this.sizeMax.width),this.spnHeight.setMaxValue(this.sizeMax.height),this.spnWidth.setValue(Common.Utils.Metric.fnRecalcFromMM(t.get_Width()).toFixed(2),!0),this.spnHeight.setValue(Common.Utils.Metric.fnRecalcFromMM(t.get_Height()).toFixed(2),!0),this.btnOriginalSize.setDisabled(null===t.get_ImageUrl()||void 0===t.get_ImageUrl());var e=t.asc_getLockAspect();if(this.btnRatio.toggle(e),t.get_Height()>0&&(this._nRatio=t.get_Width()/t.get_Height()),t.get_Position()){var i={X:t.get_Position().get_X(),Y:t.get_Position().get_Y()};this.spnX.setValue(null!==i.X&&void 0!==i.X?Common.Utils.Metric.fnRecalcFromMM(i.X):"",!0),this.spnY.setValue(null!==i.Y&&void 0!==i.Y?Common.Utils.Metric.fnRecalcFromMM(i.Y):"",!0)}else this.spnX.setValue("",!0),this.spnY.setValue("",!0);e=t.asc_getRot(),this.spnAngle.setValue(void 0==e||null===e?"":Math.floor(180*e/3.14159265358979+.5),!0),this.chFlipHor.setValue(t.asc_getFlipH()),this.chFlipVert.setValue(t.asc_getFlipV()),e=t.asc_getTitle(),this.inputAltTitle.setValue(e||""),e=t.asc_getDescription(),this.textareaAltDescription.val(e||"");var n=t.asc_getPluginGuid();this.btnsCategory[1].setVisible(null===n||void 0===n)}},getSettings:function(){var t=new Asc.asc_CImgProperty;""!==this.spnHeight.getValue()&&t.put_Height(Common.Utils.Metric.fnRecalcToMM(this.spnHeight.getNumberValue())),""!==this.spnWidth.getValue()&&t.put_Width(Common.Utils.Metric.fnRecalcToMM(this.spnWidth.getNumberValue())),t.asc_putLockAspect(this.btnRatio.pressed),t.put_ResetCrop(this._isDefaultSize);var e=new Asc.CPosition;return""!==this.spnX.getValue()&&e.put_X(Common.Utils.Metric.fnRecalcToMM(this.spnX.getNumberValue())),""!==this.spnY.getValue()&&e.put_Y(Common.Utils.Metric.fnRecalcToMM(this.spnY.getNumberValue())),t.put_Position(e),this.isAltTitleChanged&&t.asc_putTitle(this.inputAltTitle.getValue()),this.isAltDescChanged&&t.asc_putDescription(this.textareaAltDescription.val()),t.asc_putRot(3.14159265358979*this.spnAngle.getNumberValue()/180),t.asc_putFlipH("checked"==this.chFlipHor.getValue()),t.asc_putFlipV("checked"==this.chFlipVert.getValue()),{imageProps:t}},updateMetricUnit:function(){if(this.spinners)for(var t=0;t-1),this.btnEditObject=new Common.UI.Button({el:e("#image-button-edit-object")}),this.lockedControls.push(this.btnEditObject),this.btnOriginalSize.on("click",i.bind(this.setOriginalSize,this)),this.btnEditObject.on("click",i.bind(function(t){this.api&&this.api.asc_startEditCurrentOleObject(),this.fireEvent("editcomplete",this)},this)),this.btnFitSlide=new Common.UI.Button({el:e("#image-button-fit-slide")}),this.lockedControls.push(this.btnFitSlide),this.btnFitSlide.on("click",i.bind(this.setFitSlide,this));var t=Math.max(this.btnOriginalSize.cmpEl.width(),this.btnFitSlide.cmpEl.width());this.btnOriginalSize.cmpEl.width(t),this.btnFitSlide.cmpEl.width(t),t=this.btnOriginalSize.cmpEl.outerWidth(),this.btnCrop=new Common.UI.Button({parentEl:e("#image-button-crop"),cls:"btn-text-split-default",caption:this.textCrop,split:!0,enableToggle:!0,allowDepress:!0,pressed:this._state.cropMode,width:t,menu:new Common.UI.Menu({style:"min-width:"+t+"px;",items:[{caption:this.textCrop,checkable:!0,allowDepress:!0,checked:this._state.cropMode,value:0},{caption:this.textCropFill,value:1},{caption:this.textCropFit,value:2}]})}),this.btnCrop.on("click",i.bind(this.onCrop,this)),this.btnCrop.menu.on("item:click",i.bind(this.onCropMenu,this)),this.lockedControls.push(this.btnCrop),this.btnRotate270=new Common.UI.Button({parentEl:e("#image-button-270",this.$el),cls:"btn-toolbar",iconCls:"toolbar__icon btn-rotate-270",value:0,hint:this.textHint270}),this.btnRotate270.on("click",i.bind(this.onBtnRotateClick,this)),this.lockedControls.push(this.btnRotate270),this.btnRotate90=new Common.UI.Button({parentEl:e("#image-button-90",this.$el),cls:"btn-toolbar",iconCls:"toolbar__icon btn-rotate-90",value:1,hint:this.textHint90}),this.btnRotate90.on("click",i.bind(this.onBtnRotateClick,this)),this.lockedControls.push(this.btnRotate90),this.btnFlipV=new Common.UI.Button({parentEl:e("#image-button-flipv",this.$el),cls:"btn-toolbar",iconCls:"toolbar__icon btn-flip-vert",value:0,hint:this.textHintFlipV}),this.btnFlipV.on("click",i.bind(this.onBtnFlipClick,this)),this.lockedControls.push(this.btnFlipV),this.btnFlipH=new Common.UI.Button({parentEl:e("#image-button-fliph",this.$el),cls:"btn-toolbar",iconCls:"toolbar__icon btn-flip-hor",value:1,hint:this.textHintFlipH}),this.btnFlipH.on("click",i.bind(this.onBtnFlipClick,this)),this.lockedControls.push(this.btnFlipH),this.linkAdvanced=e("#image-advanced-link"),e(this.el).on("click","#image-advanced-link",i.bind(this.openAdvancedSettings,this))},createDelayedElements:function(){this.createDelayedControls(),this.updateMetricUnit(),this._initSettings=!1},ChangeSettings:function(t){if(this._initSettings&&this.createDelayedElements(),this.disableControls(this._locked),t){this._originalProps=new Asc.asc_CImgProperty(t);var e=t.get_Width();Math.abs(this._state.Width-e)>.001&&(this.labelWidth[0].innerHTML=this.textWidth+": "+Common.Utils.Metric.fnRecalcFromMM(e).toFixed(2)+" "+Common.Utils.Metric.getCurrentMetricName(),this._state.Width=e),e=t.get_Height(),Math.abs(this._state.Height-e)>.001&&(this.labelHeight[0].innerHTML=this.textHeight+": "+Common.Utils.Metric.fnRecalcFromMM(e).toFixed(2)+" "+Common.Utils.Metric.getCurrentMetricName(),this._state.Height=e),this.btnOriginalSize.setDisabled(null===t.get_ImageUrl()||void 0===t.get_ImageUrl()||this._locked);var i=t.asc_getPluginGuid();if(e=null!==i&&void 0!==i,this._state.isOleObject!==e&&(this.btnSelectImage.setVisible(!e),this.btnEditObject.setVisible(e),this.btnRotate270.setDisabled(e),this.btnRotate90.setDisabled(e),this.btnFlipV.setDisabled(e),this.btnFlipH.setDisabled(e),this._state.isOleObject=e),this._state.isOleObject){var n=PE.getCollection("Common.Collections.Plugins").findWhere({guid:i});this.btnEditObject.setDisabled(null===n||void 0===n||this._locked)}else this.btnSelectImage.setDisabled(null===i||this._locked)}},setOriginalSize:function(){if(this.api){var t=this.api.get_OriginalSizeImage(),e=t.get_ImageWidth(),i=t.get_ImageHeight();this.labelWidth[0].innerHTML=this.textWidth+": "+Common.Utils.Metric.fnRecalcFromMM(e).toFixed(2)+" "+Common.Utils.Metric.getCurrentMetricName(),this.labelHeight[0].innerHTML=this.textHeight+": "+Common.Utils.Metric.fnRecalcFromMM(i).toFixed(2)+" "+Common.Utils.Metric.getCurrentMetricName();var n=new Asc.asc_CImgProperty;n.put_Width(e),n.put_Height(i),n.put_ResetCrop(!0),this.api.ImgApply(n),this.fireEvent("editcomplete",this)}},setImageUrl:function(t,e){var i=new Asc.asc_CImgProperty;i.put_ImageUrl(t,e),this.api.ImgApply(i)},insertImageFromStorage:function(t){t&&t.url&&"change"==t.c&&this.setImageUrl(t.url,t.token)},onImageSelect:function(t,e){if(1==e.value){var n=this;new Common.Views.ImageFromUrlDialog({handler:function(t,e){if("ok"==t&&n.api){var o=e.replace(/ /g,"");i.isEmpty(o)||n.setImageUrl(o)}n.fireEvent("editcomplete",n)}}).show()}else if(2==e.value)Common.NotificationCenter.trigger("storage:image-load","change");else{if(this._isFromFile)return;this._isFromFile=!0,this.api&&this.api.ChangeImageFromFile(),this.fireEvent("editcomplete",this),this._isFromFile=!1}},openAdvancedSettings:function(t){if(!this.linkAdvanced.hasClass("disabled")){var e=this;if(e.api&&!this._locked){var i=e.api.getSelectedElements();if(i&&i.length>0)for(var n,o,s=i.length-1;s>=0;s--)if(n=i[s].get_ObjectType(),o=i[s].get_ObjectValue(),Asc.c_oAscTypeSelectElement.Image==n){var a;e.btnOriginalSize.isDisabled()||(a=e.api.get_OriginalSizeImage())&&(a={width:a.get_ImageWidth(),height:a.get_ImageHeight()}),new PE.Views.ImageSettingsAdvanced({imageProps:o,sizeOriginal:a,handler:function(t,i){"ok"==t&&e.api&&e.api.ImgApply(i.imageProps),e.fireEvent("editcomplete",e)}}).show();break}}}},_changeCropState:function(t){this._state.cropMode=t,this.btnCrop&&(this.btnCrop.toggle(t,!0),this.btnCrop.menu.items[0].setChecked(t,!0))},onCrop:function(t,e){this.api&&(t.pressed?this.api.asc_startEditCrop():this.api.asc_endEditCrop()),this.fireEvent("editcomplete",this)},onCropMenu:function(t,e){this.api&&(1==e.value?this.api.asc_cropFill():2==e.value?this.api.asc_cropFit():e.checked?this.api.asc_startEditCrop():this.api.asc_endEditCrop()),this.fireEvent("editcomplete",this)},setFitSlide:function(){this.api&&this.api.asc_FitImagesToSlide(),this.fireEvent("editcomplete",this)},onBtnRotateClick:function(t){var e=new Asc.asc_CImgProperty;e.asc_putRotAdd(3.14159265358979*(1==t.options.value?90:270)/180),this.api.ImgApply(e),this.fireEvent("editcomplete",this)},onBtnFlipClick:function(t){var e=new Asc.asc_CImgProperty;1==t.options.value?e.asc_putFlipHInvert(!0):e.asc_putFlipVInvert(!0),this.api.ImgApply(e),this.fireEvent("editcomplete",this)},setLocked:function(t){this._locked=t},disableControls:function(t){this._initSettings||(this._state.DisabledControls!==t&&(this._state.DisabledControls=t,i.each(this.lockedControls,function(e){e.setDisabled(t)}),this.linkAdvanced.toggleClass("disabled",t)),this.btnCrop.setDisabled(t||!this.api.asc_canEditCrop()))},textSize:"Size",textWidth:"Width",textHeight:"Height",textOriginalSize:"Actual Size",textInsert:"Replace Image",textFromUrl:"From URL",textFromFile:"From File",textAdvanced:"Show advanced settings",textEditObject:"Edit Object",textEdit:"Edit",textRotation:"Rotation",textRotate90:"Rotate 90°",textFlip:"Flip",textHint270:"Rotate 90° Counterclockwise",textHint90:"Rotate 90° Clockwise",textHintFlipV:"Flip Vertically",textHintFlipH:"Flip Horizontally",textCrop:"Crop",textCropFill:"Fill",textCropFit:"Fit",textFitSlide:"Fit to Slide",textFromStorage:"From Storage"},PE.Views.ImageSettings||{}))}),define("text!presentationeditor/main/app/template/ChartSettings.template",[],function(){ +return'\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
    \r\n \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n \r\n
    '}),define("text!presentationeditor/main/app/template/ChartSettingsAdvanced.template",[],function(){return'
    \n
    \n \n \n \n \n \n \n \n \n \n \n
    \n \n
    \n
    \n \n \n
    \n \n
    \n
    \n
    '}),define("presentationeditor/main/app/view/ChartSettingsAdvanced",["text!presentationeditor/main/app/template/ChartSettingsAdvanced.template","common/main/lib/view/AdvancedSettingsWindow","common/main/lib/component/InputField"],function(t){"use strict";PE.Views.ChartSettingsAdvanced=Common.Views.AdvancedSettingsWindow.extend(_.extend({options:{contentWidth:300,height:342,toggleGroup:"chart-adv-settings-group",properties:null,storageName:"pe-chart-settings-adv-category"},initialize:function(e){_.extend(this.options,{title:this.textTitle,items:[{panelId:"id-adv-chart-alttext",panelCaption:this.textAlt}],contentTemplate:_.template(t)({scope:this})},e),Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this,this.options),this._originalProps=this.options.chartProps,this._changedProps=null},render:function(){Common.Views.AdvancedSettingsWindow.prototype.render.call(this);var t=this;this.inputAltTitle=new Common.UI.InputField({el:$("#chart-advanced-alt-title"),allowBlank:!0,validateOnBlur:!1,style:"width: 100%;"}).on("changed:after",function(){t.isAltTitleChanged=!0}),this.textareaAltDescription=this.$window.find("textarea"),this.textareaAltDescription.keydown(function(e){e.keyCode==Common.UI.Keys.RETURN&&e.stopPropagation(),t.isAltDescChanged=!0}),this.afterRender()},afterRender:function(){if(this._setDefaults(this._originalProps),this.storageName){var t=Common.localStorage.getItem(this.storageName);this.setActiveCategory(null!==t?parseInt(t):0)}},getFocusedComponents:function(){return[this.inputAltTitle,this.textareaAltDescription]},onCategoryClick:function(t,e){Common.Views.AdvancedSettingsWindow.prototype.onCategoryClick.call(this,t,e);var i=this;setTimeout(function(){switch(e){case 0:i.inputAltTitle.focus()}},10)},_setDefaults:function(t){if(t){var e=t.asc_getTitle();this.inputAltTitle.setValue(e||""),e=t.asc_getDescription(),this.textareaAltDescription.val(e||""),this._changedProps=new Asc.CAscChartProp}},getSettings:function(){return this.isAltTitleChanged&&this._changedProps.asc_putTitle(this.inputAltTitle.getValue()),this.isAltDescChanged&&this._changedProps.asc_putDescription(this.textareaAltDescription.val()),{chartProps:this._changedProps}},textTitle:"Chart - Advanced Settings",textAlt:"Alternative Text",textAltTitle:"Title",textAltDescription:"Description",textAltTip:"The alternative text-based representation of the visual object information, which will be read to the people with vision or cognitive impairments to help them better understand what information there is in the image, autoshape, chart or table."},PE.Views.ChartSettingsAdvanced||{}))}),define("presentationeditor/main/app/view/ChartSettings",["text!presentationeditor/main/app/template/ChartSettings.template","jquery","underscore","backbone","common/main/lib/component/Button","common/main/lib/component/ComboDataView","presentationeditor/main/app/view/ChartSettingsAdvanced"],function(t,e,i,n){"use strict";PE.Views.ChartSettings=n.View.extend(i.extend({el:"#id-chart-settings",template:i.template(t),events:{},options:{alias:"ChartSettings"},initialize:function(){this._initSettings=!0,this._state={Width:0,Height:0,ChartStyle:1,ChartType:-1,SeveralCharts:!1,DisabledControls:!1,keepRatio:!1},this._nRatio=1,this.spinners=[],this.lockedControls=[],this._locked=!1,this._noApply=!1,this._originalProps=null,this.render()},render:function(){e(this.el).html(this.template({scope:this}))},setApi:function(t){return this.api=t,this.api&&this.api.asc_registerCallback("asc_onUpdateChartStyles",i.bind(this._onUpdateChartStyles,this)),this},ChangeSettings:function(t){if(this._initSettings&&this.createDelayedElements(),this.disableControls(this._locked),t){this._originalProps=new Asc.CAscChartProp(t),this._noApply=!0;var e=t.get_SeveralCharts()||this._locked;if(this._state.SeveralCharts!==e&&(this.btnEditData.setDisabled(e),this._state.SeveralCharts=e),e=t.get_SeveralChartTypes(),this._state.SeveralCharts&&e)this.btnChartType.setIconCls("svgicon"),this._state.ChartType=null;else{var i=t.getType();if(this._state.ChartType!==i){var n=this.mnuChartTypePicker.store.findWhere({type:i});this.mnuChartTypePicker.selectRecord(n,!0),n?this.btnChartType.setIconCls("svgicon chart-"+n.get("iconCls")):this.btnChartType.setIconCls("svgicon"),this.updateChartStyles(this.api.asc_getChartPreviews(i)),this._state.ChartType=i}}if(e=t.get_SeveralChartStyles(),this._state.SeveralCharts&&e)this.cmbChartStyle.fieldPicker.deselectAll(),this.cmbChartStyle.menuPicker.deselectAll(),this._state.ChartStyle=null;else if(e=t.getStyle(),this._state.ChartStyle!==e||this._isChartStylesChanged){this.cmbChartStyle.suspendEvents();var o=this.cmbChartStyle.menuPicker.store.findWhere({data:e});this.cmbChartStyle.menuPicker.selectRecord(o),this.cmbChartStyle.resumeEvents(),this._isChartStylesChanged&&(o?this.cmbChartStyle.fillComboView(this.cmbChartStyle.menuPicker.getSelectedRec(),!0):this.cmbChartStyle.fillComboView(this.cmbChartStyle.menuPicker.store.at(0),!0)),this._state.ChartStyle=e}this._isChartStylesChanged=!1,this._noApply=!1,e=t.get_Width(),(Math.abs(this._state.Width-e)>.001||(null===this._state.Width||null===e)&&this._state.Width!==e)&&(this.spnWidth.setValue(null!==e?Common.Utils.Metric.fnRecalcFromMM(e):"",!0),this._state.Width=e),e=t.get_Height(),(Math.abs(this._state.Height-e)>.001||(null===this._state.Height||null===e)&&this._state.Height!==e)&&(this.spnHeight.setValue(null!==e?Common.Utils.Metric.fnRecalcFromMM(e):"",!0),this._state.Height=e),t.get_Height()>0&&(this._nRatio=t.get_Width()/t.get_Height()),e=t.asc_getLockAspect(),this._state.keepRatio!==e&&(this.btnRatio.toggle(e),this._state.keepRatio=e)}},updateMetricUnit:function(){if(this.spinners){for(var t=0;t')}]})}),this.btnChartType.on("render:after",function(n){t.mnuChartTypePicker=new Common.UI.DataView({el:e("#id-chart-menu-type"),parentMenu:n.menu,restoreHeight:421,groups:new Common.UI.DataViewGroupStore(Common.define.chartData.getChartGroupData()),store:new Common.UI.DataViewStore(Common.define.chartData.getChartData()),itemTemplate:i.template('
    ')})}),this.btnChartType.render(e("#chart-button-type")),this.mnuChartTypePicker.on("item:click",i.bind(this.onSelectType,this,this.btnChartType)),this.lockedControls.push(this.btnChartType),this.btnEditData=new Common.UI.Button({el:e("#chart-button-edit-data")}),this.btnEditData.on("click",i.bind(this.setEditData,this)),this.lockedControls.push(this.btnEditData),this.spnWidth=new Common.UI.MetricSpinner({el:e("#chart-spin-width"),step:.1,width:78,defaultUnit:"cm",value:"3 cm",maxValue:55.88,minValue:0}),this.spinners.push(this.spnWidth),this.lockedControls.push(this.spnWidth),this.spnHeight=new Common.UI.MetricSpinner({el:e("#chart-spin-height"),step:.1,width:78,defaultUnit:"cm",value:"3 cm",maxValue:55.88,minValue:0}),this.spinners.push(this.spnHeight),this.lockedControls.push(this.spnHeight),this.spnWidth.on("change",i.bind(this.onWidthChange,this)),this.spnHeight.on("change",i.bind(this.onHeightChange,this)),this.spnWidth.on("inputleave",function(){t.fireEvent("editcomplete",t)}),this.spnHeight.on("inputleave",function(){t.fireEvent("editcomplete",t)}),this.btnRatio=new Common.UI.Button({parentEl:e("#chart-button-ratio"),cls:"btn-toolbar",iconCls:"toolbar__icon advanced-btn-ratio",style:"margin-bottom: 1px;",enableToggle:!0,hint:this.textKeepRatio}),this.lockedControls.push(this.btnRatio),this.btnRatio.on("click",i.bind(function(t,e){if(t.pressed&&this.spnHeight.getNumberValue()>0&&(this._nRatio=this.spnWidth.getNumberValue()/this.spnHeight.getNumberValue()),this.api){var i=new Asc.CAscChartProp;i.asc_putLockAspect(t.pressed),this.api.ChartApply(i)}this.fireEvent("editcomplete",this)},this)),this.linkAdvanced=e("#chart-advanced-link"),e(this.el).on("click","#chart-advanced-link",i.bind(this.openAdvancedSettings,this))},createDelayedElements:function(){this.createDelayedControls(),this.updateMetricUnit(),this._initSettings=!1},setEditData:function(){var t=PE.getController("Common.Controllers.ExternalDiagramEditor").getView("Common.Views.ExternalDiagramEditor");if(t){t.setEditMode(!0),t.show();var e=this.api.asc_getChartObject();e&&t.setChartData(new Asc.asc_CChartBinary(e))}},onSelectType:function(t,e,n,o){if(!this._noApply){var s={};if(i.isFunction(o.toJSON)){if(!o.get("selected"))return;s=o.toJSON()}else s=o;if(this.btnChartType.setIconCls("svgicon chart-"+s.iconCls),this._state.ChartType=-1,this.api&&!this._noApply){var a=new Asc.CAscChartProp;a.changeType(s.type),this.api.ChartApply(a)}this.fireEvent("editcomplete",this)}},onSelectStyle:function(t,e){if(!this._noApply){if(this.api&&!this._noApply){var i=new Asc.CAscChartProp;i.putStyle(e.get("data")),this.api.ChartApply(i)}this.fireEvent("editcomplete",this)}},_onUpdateChartStyles:function(){this.api&&null!==this._state.ChartType&&this._state.ChartType>-1&&this.updateChartStyles(this.api.asc_getChartPreviews(this._state.ChartType))},updateChartStyles:function(t){var n=this;if(this._isChartStylesChanged=!0,this.cmbChartStyle||(this.cmbChartStyle=new Common.UI.ComboDataView({itemWidth:50,itemHeight:50,menuMaxHeight:270,enableKeyEvents:!0,cls:"combo-chart-style"}),this.cmbChartStyle.render(e("#chart-combo-style")),this.cmbChartStyle.openButton.menu.cmpEl.css({"min-width":178,"max-width":178}),this.cmbChartStyle.on("click",i.bind(this.onSelectStyle,this)),this.cmbChartStyle.openButton.menu.on("show:after",function(){n.cmbChartStyle.menuPicker.scroller.update({alwaysVisibleY:!0})}),this.lockedControls.push(this.cmbChartStyle)),t&&t.length>0){var o=this.cmbChartStyle.menuPicker.store;if(o){var s=o.length;if(s>0&&s==t.length){var a=o.models;i.each(t,function(t,e){a[e].set("imageUrl",t.asc_getImage())})}else{var l=[];i.each(t,function(t,e){l.push({imageUrl:t.asc_getImage(),data:t.asc_getName(),tip:n.textStyle+" "+t.asc_getName()})}),o.reset(l,{silent:!1})}}}else this.cmbChartStyle.menuPicker.store.reset(),this.cmbChartStyle.clearComboView();this.cmbChartStyle.setDisabled(!t||t.length<1||this._locked)},onWidthChange:function(t,e,i,n){var o=t.getNumberValue(),s=this.spnHeight.getNumberValue();if(this.btnRatio.pressed&&(s=o/this._nRatio,s>this.spnHeight.options.maxValue&&(s=this.spnHeight.options.maxValue,o=s*this._nRatio,this.spnWidth.setValue(o,!0)),this.spnHeight.setValue(s,!0)),this.api){var a=new Asc.CAscChartProp;a.put_Width(Common.Utils.Metric.fnRecalcToMM(o)),a.put_Height(Common.Utils.Metric.fnRecalcToMM(s)),this.api.ChartApply(a)}},onHeightChange:function(t,e,i,n){var o=t.getNumberValue(),s=this.spnWidth.getNumberValue();if(this.btnRatio.pressed&&(s=o*this._nRatio,s>this.spnWidth.options.maxValue&&(s=this.spnWidth.options.maxValue,o=s/this._nRatio,this.spnHeight.setValue(o,!0)),this.spnWidth.setValue(s,!0)),this.api){var a=new Asc.CAscChartProp;a.put_Width(Common.Utils.Metric.fnRecalcToMM(s)),a.put_Height(Common.Utils.Metric.fnRecalcToMM(o)),this.api.ChartApply(a)}},openAdvancedSettings:function(t){if(!this.linkAdvanced.hasClass("disabled")){var e=this;if(e.api&&!this._locked){var i=e.api.getSelectedElements();if(i&&i.length>0)for(var n,o,s=i.length-1;s>=0;s--)if(n=i[s].get_ObjectType(),o=i[s].get_ObjectValue(),Asc.c_oAscTypeSelectElement.Chart==n){new PE.Views.ChartSettingsAdvanced({chartProps:o,handler:function(t,i){"ok"==t&&e.api&&e.api.ChartApply(i.chartProps),e.fireEvent("editcomplete",e)}}).show();break}}}},setLocked:function(t){this._locked=t},disableControls:function(t){this._initSettings||this._state.DisabledControls!==t&&(this._state.DisabledControls=t,i.each(this.lockedControls,function(e){e.setDisabled(t)}),this.linkAdvanced.toggleClass("disabled",t))},textKeepRatio:"Constant Proportions",textSize:"Size",textWidth:"Width",textHeight:"Height",textEditData:"Edit Data",textChartType:"Change Chart Type",textStyle:"Style",textAdvanced:"Show advanced settings"},PE.Views.ChartSettings||{}))}),define("text!presentationeditor/main/app/template/TableSettings.template",[],function(){return'\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
    \r\n \r\n \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n \r\n
    '}),void 0===Common)var Common={};if(define("common/main/lib/component/ComboBorderSize",["common/main/lib/component/ComboBox"],function(){"use strict";Common.UI.BordersModel=Backbone.Model.extend({defaults:function(){return{value:null,displayValue:null,pxValue:null,id:Common.UI.getId(),offsety:void 0}}}),Common.UI.BordersStore=Backbone.Collection.extend({model:Common.UI.BordersModel}),Common.UI.ComboBorderSize=Common.UI.ComboBox.extend(_.extend({template:_.template(['
    ','
    ','
    ','','","
    "].join("")),initialize:function(t){var e=Common.Utils.Metric.getMetricName(Common.Utils.Metric.c_MetricUnits.pt),i=[{displayValue:"0.5 "+e,value:.5,pxValue:.5,offsety:0},{displayValue:"1 "+e,value:1,pxValue:1,offsety:20},{displayValue:"1.5 "+e,value:1.5,pxValue:2,offsety:40},{displayValue:"2.25 "+e,value:2.25,pxValue:3,offsety:60},{displayValue:"3 "+e,value:3,pxValue:4,offsety:80},{displayValue:"4.5 "+e,value:4.5,pxValue:5,offsety:100},{displayValue:"6 "+e,value:6,pxValue:6,offsety:120}];!1!==t.allowNoBorders&&i.unshift({displayValue:this.txtNoBorders,value:0,pxValue:0}),Common.UI.ComboBox.prototype.initialize.call(this,_.extend({editable:!1,store:new Common.UI.BordersStore,data:i,menuStyle:"min-width: 160px;"},t))},render:function(t){return Common.UI.ComboBox.prototype.render.call(this,t),this},itemClicked:function(t){var e=$(t.currentTarget).parent();this._selectedItem=this.store.findWhere({id:e.attr("id")}),this._selectedItem&&($(".selected",$(this.el)).removeClass("selected"),e.addClass("selected"),this.updateFormControl(this._selectedItem),this.trigger("selected",this,_.extend({},this._selectedItem.toJSON()),t),t.preventDefault())},updateFormControl:function(t){var e=$(this.el).find(".form-control");t.get("value")>0?(e[0].innerHTML="",e.removeClass("text").addClass("image"),e.css("background-position","10px -"+t.get("offsety")+"px")):(e[0].innerHTML=this.txtNoBorders,e.removeClass("image").addClass("text"))},setValue:function(t){if(this._selectedItem=null===t||void 0===t?void 0:_.find(this.store.models,function(e){if(te.attributes.value-.01)return!0}),$(".selected",$(this.el)).removeClass("selected"),this._selectedItem)this.updateFormControl(this._selectedItem),$("#"+this._selectedItem.get("id"),$(this.el)).addClass("selected");else{var e=$(this.el).find(".form-control");e[0].innerHTML="",e.removeClass("image").addClass("text")}},txtNoBorders:"No Borders"},Common.UI.ComboBorderSize||{})),Common.UI.ComboBorderSizeEditable=Common.UI.ComboBox.extend(_.extend({template:_.template(['','','','",""].join("")),initialize:function(t){this.txtNoBorders=t.txtNoBorders||this.txtNoBorders;var e=Common.Utils.Metric.getMetricName(Common.Utils.Metric.c_MetricUnits.pt),i=[{displayValue:"0.5 "+e,value:.5,pxValue:.5,offsety:0},{displayValue:"1 "+e,value:1,pxValue:1,offsety:20},{displayValue:"1.5 "+e,value:1.5,pxValue:2,offsety:40},{displayValue:"2.25 "+e,value:2.25,pxValue:3,offsety:60},{displayValue:"3 "+e,value:3,pxValue:4,offsety:80},{displayValue:"4.5 "+e,value:4.5,pxValue:5,offsety:100},{displayValue:"6 "+e,value:6,pxValue:6,offsety:120}];!1!==t.allowNoBorders&&i.unshift({displayValue:this.txtNoBorders,value:0,pxValue:0}),Common.UI.ComboBox.prototype.initialize.call(this,_.extend({editable:!0,store:new Common.UI.BordersStore,data:i,menuStyle:"min-width: 160px;"},t))},render:function(t){return Common.UI.ComboBox.prototype.render.call(this,t),this},txtNoBorders:"No Borders"},Common.UI.ComboBorderSizeEditable||{})),Common.UI.ComboBorderType=Common.UI.ComboBorderSize.extend(_.extend({template:_.template(['
    ','
    ','
    ','','","
    "].join("")),initialize:function(t){Common.UI.ComboBorderSize.prototype.initialize.call(this,_.extend({store:new Common.UI.BordersStore,data:[{value:Asc.c_oDashType.solid,offsety:140},{value:Asc.c_oDashType.sysDot,offsety:160},{value:Asc.c_oDashType.sysDash,offsety:180},{value:Asc.c_oDashType.dash,offsety:200},{value:Asc.c_oDashType.dashDot,offsety:220},{value:Asc.c_oDashType.lgDash,offsety:240},{value:Asc.c_oDashType.lgDashDot,offsety:260},{value:Asc.c_oDashType.lgDashDotDot,offsety:280}]},t))},render:function(t){return Common.UI.ComboBorderSize.prototype.render.call(this,t),this},updateFormControl:function(t){var e=$(this.el).find(".form-control");e[0].innerHTML="",e.removeClass("text").addClass("image"),e.css("background-position","10px -"+t.get("offsety")+"px")}},Common.UI.ComboBorderType||{})),Common.UI.ComboBoxColor=Common.UI.ComboBox.extend(_.extend({template:_.template(['
    ','
    ','
    ',"
    ",'','","
    "].join("")),itemClicked:function(t){var e=$(t.currentTarget).parent();this._selectedItem=this.store.findWhere({id:e.attr("id")}),this._selectedItem&&($(".selected",$(this.el)).removeClass("selected"),e.addClass("selected"),this.updateFormControl(this._selectedItem),this.trigger("selected",this,_.extend({},this._selectedItem.toJSON()),t),t.preventDefault())},updateFormControl:function(t){var e=$(this.el).find(".form-control > div");-1!=t.get("value")?(e[0].innerHTML="",e.css({background:"#"+t.get("value"),"margin-top":"0"})):(e[0].innerHTML=t.get("displayValue"),e.css({background:"","margin-top":"1px"}))},setValue:function(t){var e;if(this._selectedItem=this.store.findWhere((e={},e[this.valueField]=t,e)),$(".selected",$(this.el)).removeClass("selected"),this._selectedItem)this.updateFormControl(this._selectedItem),$("#"+this._selectedItem.get("id"),$(this.el)).addClass("selected");else{var i=$(this.el).find(".form-control > div");i[0].innerHTML="",i.css("background","")}},onResetItems:function(){this.itemsTemplate?$(this.el).find("ul").html($(this.itemsTemplate({items:this.store.toJSON(),scope:this}))):$(this.el).find("ul").html(_.template(["<% _.each(items, function(item) { %>","<% if (item.value==-1) { %>",'
  • <%= scope.getDisplayValue(item) %>
  • ',"<% } else { %>",'
  • ','
    ',"
  • ","<% } %>","<% }); %>"].join(""))({items:this.store.toJSON(),scope:this})),_.isUndefined(this.scroller)||(this.scroller.destroy(),delete this.scroller),this.scroller=new Common.UI.Scroller(_.extend({el:$(".dropdown-menu",this.cmpEl),minScrollbarLength:40,includePadding:!0,wheelSpeed:10,alwaysVisibleY:this.scrollAlwaysVisible},this.options.scroller))}},Common.UI.ComboBoxColor||{}))}), +define("presentationeditor/main/app/view/TableSettings",["text!presentationeditor/main/app/template/TableSettings.template","jquery","underscore","backbone","common/main/lib/component/Button","common/main/lib/component/CheckBox","common/main/lib/component/ThemeColorPalette","common/main/lib/component/ColorButton","common/main/lib/component/ComboBorderSize","common/main/lib/component/ComboDataView","common/main/lib/view/InsertTableDialog","presentationeditor/main/app/view/TableSettingsAdvanced"],function(t,e,i,n){"use strict";PE.Views.TableSettings=n.View.extend(i.extend({el:"#id-table-settings",template:i.template(t),events:{},options:{alias:"TableSettings"},initialize:function(){this._initSettings=!0,this._state={TemplateId:0,CheckHeader:!1,CheckTotal:!1,CheckBanded:!1,CheckFirst:!1,CheckLast:!1,CheckColBanded:!1,BackColor:"#000000",DisabledControls:!1,Width:null,Height:null},this.spinners=[],this.lockedControls=[],this._locked=!1,this._originalLook=new Asc.CTablePropLook,this._originalProps=null,this.CellBorders={},this.CellColor={Value:1,Color:"transparent"},this.BorderSize=1,this._noApply=!1,this.render()},onCheckTemplateChange:function(t,e,i,n,o){if(this.api){var s=new Asc.CTableProp,a=this._originalLook?this._originalLook:new Asc.CTablePropLook;switch(t){case 0:a.put_FirstRow("checked"==e.getValue());break;case 1:a.put_LastRow("checked"==e.getValue());break;case 2:a.put_BandHor("checked"==e.getValue());break;case 3:a.put_FirstCol("checked"==e.getValue());break;case 4:a.put_LastCol("checked"==e.getValue());break;case 5:a.put_BandVer("checked"==e.getValue())}s.put_TableLook(a),this.api.tblApply(s)}this.fireEvent("editcomplete",this)},onTableTemplateSelect:function(t,e,i,n){if(this.api&&!this._noApply){var o=new Asc.CTableProp;o.put_TableStyle(n.get("templateId")),this.api.tblApply(o)}this.fireEvent("editcomplete",this)},onColorsBackSelect:function(t,e){if(this.CellColor={Value:1,Color:e},this.api){var i=new Asc.CTableProp,n=new Asc.CBackground;i.put_CellsBackground(n),"transparent"==this.CellColor.Color?n.put_Value(1):(n.put_Value(0),n.put_Color(Common.Utils.ThemeColor.getRgbColor(this.CellColor.Color))),i.put_CellSelect(!0),this.api.tblApply(i)}this.fireEvent("editcomplete",this)},onBtnBordersClick:function(t,e){if(this._UpdateBordersStyle(t.options.strId,!0),this.api){var i=new Asc.CTableProp;i.put_CellBorders(this.CellBorders),i.put_CellSelect(!0),this.api.tblApply(i)}this.fireEvent("editcomplete",this)},onBorderSizeSelect:function(t,e){this.BorderSize=e.value},onEditClick:function(t,e,i){if(this.api)switch(e.value){case 0:this.api.selectRow();break;case 1:this.api.selectColumn();break;case 2:this.api.selectCell();break;case 3:this.api.selectTable();break;case 4:this.api.addRowAbove();break;case 5:this.api.addRowBelow();break;case 6:this.api.addColumnLeft();break;case 7:this.api.addColumnRight();break;case 8:this.api.remRow();break;case 9:this.api.remColumn();break;case 10:this.api.remTable();break;case 11:this.api.MergeCells();break;case 12:this.splitCells(t,e,i)}this.fireEvent("editcomplete",this)},splitCells:function(t,e,i){var n=this;new Common.Views.InsertTableDialog({split:!0,handler:function(t,e){"ok"==t&&n.api&&n.api.SplitCell(e.columns,e.rows),n.fireEvent("editcomplete",n)}}).show()},render:function(){e(this.el).html(this.template({scope:this}))},setApi:function(t){return this.api=t,t&&this.api.asc_registerCallback("asc_onInitTableTemplates",i.bind(this._onInitTemplates,this)),this},createDelayedControls:function(){var t=this;this.chHeader=new Common.UI.CheckBox({el:e("#table-checkbox-header"),labelText:this.textHeader}),this.lockedControls.push(this.chHeader),this.chTotal=new Common.UI.CheckBox({el:e("#table-checkbox-total"),labelText:this.textTotal}),this.lockedControls.push(this.chTotal),this.chBanded=new Common.UI.CheckBox({el:e("#table-checkbox-banded"),labelText:this.textBanded}),this.lockedControls.push(this.chBanded),this.chFirst=new Common.UI.CheckBox({el:e("#table-checkbox-first"),labelText:this.textFirst}),this.lockedControls.push(this.chFirst),this.chLast=new Common.UI.CheckBox({el:e("#table-checkbox-last"),labelText:this.textLast}),this.lockedControls.push(this.chLast),this.chColBanded=new Common.UI.CheckBox({el:e("#table-checkbox-col-banded"),labelText:this.textBanded}),this.lockedControls.push(this.chColBanded),this.chHeader.on("change",i.bind(this.onCheckTemplateChange,this,0)),this.chTotal.on("change",i.bind(this.onCheckTemplateChange,this,1)),this.chBanded.on("change",i.bind(this.onCheckTemplateChange,this,2)),this.chFirst.on("change",i.bind(this.onCheckTemplateChange,this,3)),this.chLast.on("change",i.bind(this.onCheckTemplateChange,this,4)),this.chColBanded.on("change",i.bind(this.onCheckTemplateChange,this,5));var n=[["l","toolbar__icon btn-border-left","table-button-border-left",this.tipLeft],["c","toolbar__icon btn-border-insidevert","table-button-border-inner-vert",this.tipInnerVert],["r","toolbar__icon btn-border-right","table-button-border-right",this.tipRight],["t","toolbar__icon btn-border-top","table-button-border-top",this.tipTop],["m","toolbar__icon btn-border-insidehor","table-button-border-inner-hor",this.tipInnerHor],["b","toolbar__icon btn-border-bottom","table-button-border-bottom",this.tipBottom],["cm","toolbar__icon btn-border-inside","table-button-border-inner",this.tipInner],["lrtb","toolbar__icon btn-border-out","table-button-border-outer",this.tipOuter],["lrtbcm","toolbar__icon btn-border-all","table-button-border-all",this.tipAll],["","toolbar__icon btn-border-no","table-button-border-none",this.tipNone]];this._btnsBorderPosition=[],i.each(n,function(t,n,o){var s=new Common.UI.Button({parentEl:e("#"+t[2]),cls:"btn-toolbar borders--small",iconCls:t[1],strId:t[0],hint:t[3]});s.on("click",i.bind(this.onBtnBordersClick,this)),this._btnsBorderPosition.push(s),this.lockedControls.push(s)},this),this.cmbBorderSize=new Common.UI.ComboBorderSize({el:e("#table-combo-border-size"),style:"width: 93px;"}),this.BorderSize=this.cmbBorderSize.store.at(2).get("value"),this.cmbBorderSize.setValue(this.BorderSize),this.cmbBorderSize.on("selected",i.bind(this.onBorderSizeSelect,this)),this.lockedControls.push(this.cmbBorderSize),this.btnEdit=new Common.UI.Button({parentEl:e("#table-btn-edit"),cls:"btn-icon-default",iconCls:"btn-edit-table",menu:new Common.UI.Menu({menuAlign:"tr-br",items:[{caption:this.selectRowText,value:0},{caption:this.selectColumnText,value:1},{caption:this.selectCellText,value:2},{caption:this.selectTableText,value:3},{caption:"--"},{caption:this.insertRowAboveText,value:4},{caption:this.insertRowBelowText,value:5},{caption:this.insertColumnLeftText,value:6},{caption:this.insertColumnRightText,value:7},{caption:"--"},{caption:this.deleteRowText,value:8},{caption:this.deleteColumnText,value:9},{caption:this.deleteTableText,value:10},{caption:"--"},{caption:this.mergeCellsText,value:11},{caption:this.splitCellsText,value:12}]})}),this.mnuMerge=this.btnEdit.menu.items[this.btnEdit.menu.items.length-2],this.mnuSplit=this.btnEdit.menu.items[this.btnEdit.menu.items.length-1],this.btnEdit.menu.on("show:after",i.bind(function(){this.api&&(this.mnuMerge.setDisabled(!this.api.CheckBeforeMergeCells()),this.mnuSplit.setDisabled(!this.api.CheckBeforeSplitCells()))},this)),this.btnEdit.menu.on("item:click",i.bind(this.onEditClick,this)),this.lockedControls.push(this.btnEdit),this.numHeight=new Common.UI.MetricSpinner({el:e("#table-spin-cell-height"),step:.1,width:115,defaultUnit:"cm",value:"1 cm",maxValue:55.88,minValue:0}),this.numHeight.on("change",i.bind(function(t,e,i,n){var o=new Asc.CTableProp;o.put_RowHeight(Common.Utils.Metric.fnRecalcToMM(t.getNumberValue())),this.api.tblApply(o)},this)),this.numHeight.on("inputleave",function(){t.fireEvent("editcomplete",t)}),this.lockedControls.push(this.numHeight),this.spinners.push(this.numHeight),this.numWidth=new Common.UI.MetricSpinner({el:e("#table-spin-cell-width"),step:.1,width:115,defaultUnit:"cm",value:"1 cm",maxValue:55.88,minValue:0}),this.numWidth.on("change",i.bind(function(t,e,i,n){var o=new Asc.CTableProp;o.put_ColumnWidth(Common.Utils.Metric.fnRecalcToMM(t.getNumberValue())),this.api.tblApply(o)},this)),this.numWidth.on("inputleave",function(){t.fireEvent("editcomplete",t)}),this.lockedControls.push(this.numWidth),this.spinners.push(this.numWidth),this.btnDistributeRows=new Common.UI.Button({el:e("#table-btn-distrub-rows")}),this.lockedControls.push(this.btnDistributeRows),this.btnDistributeRows.on("click",i.bind(function(t){this.api.asc_DistributeTableCells(!1)},this)),this.btnDistributeCols=new Common.UI.Button({el:e("#table-btn-distrub-cols")}),this.lockedControls.push(this.btnDistributeCols),this.btnDistributeCols.on("click",i.bind(function(t){this.api.asc_DistributeTableCells(!0)},this)),this.linkAdvanced=e("#table-advanced-link"),e(this.el).on("click","#table-advanced-link",i.bind(this.openAdvancedSettings,this))},ChangeSettings:function(t){if(this._initSettings&&this.createDelayedElements(),this.disableControls(this._locked),t){this._originalProps=new Asc.CTableProp(t),this._originalProps.put_CellSelect(!0);var e=t.get_ColumnWidth();if(((void 0===this._state.Width||void 0===e)&&this._state.Width!==e||Math.abs(this._state.Width-e)>.001)&&(this.numWidth.setValue(null!==e&&void 0!==e?Common.Utils.Metric.fnRecalcFromMM(e):"",!0),this._state.Width=e),e=t.get_RowHeight(),((void 0===this._state.Height||void 0===e)&&this._state.Height!==e||Math.abs(this._state.Height-e)>.001)&&(this.numHeight.setValue(null!==e&&void 0!==e?Common.Utils.Metric.fnRecalcFromMM(e):"",!0),this._state.Height=e),e=t.get_TableStyle(),this._state.TemplateId!==e||this._isTemplatesChanged){var i=this.mnuTableTemplatePicker.store.findWhere({templateId:e});i||(i=this.mnuTableTemplatePicker.store.at(0)),this.btnTableTemplate.suspendEvents(),this.mnuTableTemplatePicker.selectRecord(i,!0),this.btnTableTemplate.resumeEvents(),this.$el.find(".icon-template-table").css({"background-image":"url("+i.get("imageUrl")+")",height:"52px",width:"72px","background-position":"center","background-size":"cover"}),this._state.TemplateId=e}this._isTemplatesChanged=!1;var n=t.get_TableLook();n&&(e=n.get_FirstRow(),this._state.CheckHeader!==e&&(this.chHeader.setValue(e,!0),this._state.CheckHeader=e,this._originalLook.put_FirstRow(e)),e=n.get_LastRow(),this._state.CheckTotal!==e&&(this.chTotal.setValue(e,!0),this._state.CheckTotal=e,this._originalLook.put_LastRow(e)),e=n.get_BandHor(),this._state.CheckBanded!==e&&(this.chBanded.setValue(e,!0),this._state.CheckBanded=e,this._originalLook.put_BandHor(e)),e=n.get_FirstCol(),this._state.CheckFirst!==e&&(this.chFirst.setValue(e,!0),this._state.CheckFirst=e,this._originalLook.put_FirstCol(e)),e=n.get_LastCol(),this._state.CheckLast!==e&&(this.chLast.setValue(e,!0),this._state.CheckLast=e,this._originalLook.put_LastCol(e)),e=n.get_BandVer(),this._state.CheckColBanded!==e&&(this.chColBanded.setValue(e,!0),this._state.CheckColBanded=e,this._originalLook.put_BandVer(e)));var o=t.get_CellsBackground();if(o)if(0==o.get_Value()){var s=o.get_Color();s?s.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?this.CellColor={Value:1,Color:{color:Common.Utils.ThemeColor.getHexColor(s.get_r(),s.get_g(),s.get_b()),effectValue:s.get_value()}}:this.CellColor={Value:1,Color:Common.Utils.ThemeColor.getHexColor(s.get_r(),s.get_g(),s.get_b())}:this.CellColor={Value:1,Color:"transparent"}}else this.CellColor={Value:1,Color:"transparent"};else this.CellColor={Value:0,Color:"transparent"};var a=typeof this.CellColor.Color;if(a!==typeof this._state.BackColor||"object"==a&&(this.CellColor.Color.effectValue!==this._state.BackColor.effectValue||this._state.BackColor.color.indexOf(this.CellColor.Color.color)<0)||"object"!=a&&this._state.BackColor.indexOf(this.CellColor.Color)<0){if(this.btnBackColor.setColor(this.CellColor.Color),"object"==typeof this.CellColor.Color){for(var l=!1,r=0;r<10;r++)if(Common.Utils.ThemeColor.ThemeValues[r]==this.CellColor.Color.effectValue){this.colorsBack.select(this.CellColor.Color,!0),l=!0;break}l||this.colorsBack.clearSelection()}else this.colorsBack.select(this.CellColor.Color,!0);this._state.BackColor=this.CellColor.Color}}},updateMetricUnit:function(){if(this.spinners){for(var t=0;t-1||!i)&&(null!==e.get_Left()&&void 0!==e.get_Left()||e.put_Left(new Asc.asc_CTextBorder),this._UpdateBorderStyle(e.get_Left(),i)),(t.indexOf("t")>-1||!i)&&(null!==e.get_Top()&&void 0!==e.get_Top()||e.put_Top(new Asc.asc_CTextBorder),this._UpdateBorderStyle(e.get_Top(),i)),(t.indexOf("r")>-1||!i)&&(null!==e.get_Right()&&void 0!==e.get_Right()||e.put_Right(new Asc.asc_CTextBorder),this._UpdateBorderStyle(e.get_Right(),i)),(t.indexOf("b")>-1||!i)&&(null!==e.get_Bottom()&&void 0!==e.get_Bottom()||e.put_Bottom(new Asc.asc_CTextBorder),this._UpdateBorderStyle(e.get_Bottom(),i)),(t.indexOf("c")>-1||!i)&&(null!==e.get_InsideV()&&void 0!==e.get_InsideV()||e.put_InsideV(new Asc.asc_CTextBorder),this._UpdateBorderStyle(e.get_InsideV(),i)),(t.indexOf("m")>-1||!i)&&(null!==e.get_InsideH()&&void 0!==e.get_InsideH()||e.put_InsideH(new Asc.asc_CTextBorder),this._UpdateBorderStyle(e.get_InsideH(),i))},_UpdateBorderStyle:function(t,e){if(null==t&&(t=new Asc.asc_CTextBorder),e&&this.BorderSize>0){var i=parseFloat(this.BorderSize);t.put_Value(1),t.put_Size(25.4*i/72);var n=Common.Utils.ThemeColor.getRgbColor(this.btnBorderColor.color);t.put_Color(n)}else t.put_Value(0)},createDelayedElements:function(){this._initSettings=!1,this.createDelayedControls(),this.UpdateThemeColors(),this.updateMetricUnit()},UpdateThemeColors:function(){this._initSettings||(this.btnBackColor||(this.btnBorderColor=new Common.UI.ColorButton({parentEl:e("#table-border-color-btn"),color:"000000"}),this.lockedControls.push(this.btnBorderColor),this.borderColor=this.btnBorderColor.getPicker(),this.btnBackColor=new Common.UI.ColorButton({parentEl:e("#table-back-color-btn"),transparent:!0}),this.lockedControls.push(this.btnBackColor),this.colorsBack=this.btnBackColor.getPicker(),this.btnBackColor.on("color:select",i.bind(this.onColorsBackSelect,this))),this.colorsBack.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors()),this.borderColor.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors()),this.btnBorderColor.setColor(this.borderColor.getColor()))},_onInitTemplates:function(t){var n=this;this._isTemplatesChanged=!0,this.btnTableTemplate||(this.btnTableTemplate=new Common.UI.Button({cls:"btn-large-dataview template-table",iconCls:"icon-template-table",menu:new Common.UI.Menu({style:"width: 575px;",items:[{template:i.template('')}]})}),this.btnTableTemplate.on("render:after",function(t){n.mnuTableTemplatePicker=new Common.UI.DataView({el:e("#id-table-menu-template"),parentMenu:t.menu,restoreHeight:350,groups:new Common.UI.DataViewGroupStore,store:new Common.UI.DataViewStore,itemTemplate:i.template('
    '),style:"max-height: 350px;"})}),this.btnTableTemplate.render(e("#table-btn-template")),this.lockedControls.push(this.btnTableTemplate),this.mnuTableTemplatePicker.on("item:click",i.bind(this.onTableTemplateSelect,this,this.btnTableTemplate)));var o=n.mnuTableTemplatePicker.store.length;if(o>0&&o==t.length){var s=n.mnuTableTemplatePicker.dataViewItems;s&&i.each(t,function(t,i){var n=t.asc_getImage();s[i].model.set("imageUrl",n,{silent:!0}),e(s[i].el).find("img").attr("src",n)})}else{var a=[];i.each(t,function(t){var e=t.asc_getDisplayName();0==t.asc_getType()&&["No Style","No Grid","Table Grid","Themed Style","Light Style","Medium Style","Dark Style","Accent"].forEach(function(t){var i="txtTable_"+t.replace(" ","");n[i]&&(e=e.replace(new RegExp(t,"g"),n[i]))}),a.push({imageUrl:t.asc_getImage(),id:Common.UI.getId(),templateId:t.asc_getId(),tip:e})}),n.mnuTableTemplatePicker.store.reset(a)}},openAdvancedSettings:function(t){if(!this.linkAdvanced.hasClass("disabled")){var e=this;if(e.api&&!this._locked){var i=e.api.getSelectedElements();if(i&&i.length>0)for(var n,o,s=i.length-1;s>=0;s--)if(n=i[s].get_ObjectType(),o=i[s].get_ObjectValue(),Asc.c_oAscTypeSelectElement.Table==n){new PE.Views.TableSettingsAdvanced({tableProps:o,handler:function(t,i){"ok"==t&&e.api&&e.api.tblApply(i.tableProps),e.fireEvent("editcomplete",e)}}).show();break}}}},setLocked:function(t){this._locked=t},disableControls:function(t){this._initSettings||this._state.DisabledControls!==t&&(this._state.DisabledControls=t,i.each(this.lockedControls,function(e){e.setDisabled(t)}),this.linkAdvanced.toggleClass("disabled",t))},textBorders:"Border's Style",textBorderColor:"Color",textBackColor:"Background color",textEdit:"Rows & Columns",selectRowText:"Select Row",selectColumnText:"Select Column",selectCellText:"Select Cell",selectTableText:"Select Table",insertRowAboveText:"Insert Row Above",insertRowBelowText:"Insert Row Below",insertColumnLeftText:"Insert Column Left",insertColumnRightText:"Insert Column Right",deleteRowText:"Delete Row",deleteColumnText:"Delete Column",deleteTableText:"Delete Table",mergeCellsText:"Merge Cells",splitCellsText:"Split Cell...",splitCellTitleText:"Split Cell",textSelectBorders:"Select borders that you want to change",textAdvanced:"Show advanced settings",txtNoBorders:"No borders",textTemplate:"Select From Template",textRows:"Rows",textColumns:"Columns",textHeader:"Header",textTotal:"Total",textBanded:"Banded",textFirst:"First",textLast:"Last",textEmptyTemplate:"No templates",tipTop:"Set Outer Top Border Only",tipLeft:"Set Outer Left Border Only",tipBottom:"Set Outer Bottom Border Only",tipRight:"Set Outer Right Border Only",tipAll:"Set Outer Border and All Inner Lines",tipNone:"Set No Borders",tipInner:"Set Inner Lines Only",tipInnerVert:"Set Vertical Inner Lines Only",tipInnerHor:"Set Horizontal Inner Lines Only",tipOuter:"Set Outer Border Only",textCellSize:"Cell Size",textHeight:"Height",textWidth:"Width",textDistributeRows:"Distribute rows",textDistributeCols:"Distribute columns",txtTable_NoStyle:"No Style",txtTable_NoGrid:"No Grid",txtTable_TableGrid:"Table Grid",txtTable_ThemedStyle:"Themed Style",txtTable_LightStyle:"Light Style",txtTable_MediumStyle:"Medium Style",txtTable_DarkStyle:"Dark Style",txtTable_Accent:"Accent"},PE.Views.TableSettings||{}))}),define("text!presentationeditor/main/app/template/ShapeSettings.template",[],function(){return'\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n \r\n \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n \r\n \r\n \r\n \r\n \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    '}),void 0===Common)var Common={};if(define("common/main/lib/component/Slider",["common/main/lib/component/BaseView","underscore"],function(t,e){"use strict";Common.UI.SingleSlider=Common.UI.BaseView.extend({options:{width:100,minValue:0,maxValue:100,step:1,value:100,enableKeyEvents:!1},disabled:!1,template:e.template(['
    ','
    ','
    ','
    ','
    ',"
    ",'
    ',"<% if (this.options.enableKeyEvents) { %>",'',"<% } %>","
    "].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t);var e=this;e.width=e.options.width,e.minValue=e.options.minValue,e.maxValue=e.options.maxValue,e.delta=100/(e.maxValue-e.minValue),e.step=e.options.step,e.options.el&&e.render(),this.setValue(e.options.value)},render:function(t){var i=this;i.rendered?this.cmpEl=i.$el:(this.cmpEl=$(this.template({})),t?(this.setElement(t,!1),t.html(this.cmpEl)):i.$el.html(this.cmpEl)),this.cmpEl.find(".track-center").width(i.options.width-14),this.cmpEl.width(i.options.width),this.thumb=this.cmpEl.find(".thumb");var n,o=function(t){t.preventDefault(),t.stopPropagation();var e=Math.max(0,Math.min(100,Math.round((t.pageX*Common.Utils.zoom()-i.cmpEl.offset().left-i._dragstart)/i.width*100)));i.setThumbPosition(e),i.lastValue=i.value,i.value=e/i.delta+i.minValue,i.thumb.removeClass("active"),$(document).off("mouseup",o),$(document).off("mousemove",s),i._dragstart=void 0,i.trigger("changecomplete",i,i.value,i.lastValue)},s=function(t){if(!i.disabled&&void 0!==i._dragstart){t.preventDefault(),t.stopPropagation();var e=Math.max(0,Math.min(100,Math.round((t.pageX*Common.Utils.zoom()-i.cmpEl.offset().left-i._dragstart)/i.width*100)));i.setThumbPosition(e),i.lastValue=i.value,i.value=e/i.delta+i.minValue,Math.abs(i.value-i.lastValue)>.001&&i.trigger("change",i,i.value,i.lastValue)}},a=function(t){i.disabled||(i._dragstart=t.pageX*Common.Utils.zoom()-i.thumb.offset().left-7,i.thumb.addClass("active"),$(document).on("mouseup",o),$(document).on("mousemove",s),i.options.enableKeyEvents&&setTimeout(function(){i.input.focus()},10))},l=function(t){if(!i.disabled){var e=Math.max(0,Math.min(100,Math.round((t.pageX*Common.Utils.zoom()-i.cmpEl.offset().left)/i.width*100)));i.setThumbPosition(e),i.lastValue=i.value,i.value=e/i.delta+i.minValue,i.trigger("change",i,i.value,i.lastValue),i.trigger("changecomplete",i,i.value,i.lastValue)}},r=function(t){i.lastValue=i.value,i.value=Math.max(i.minValue,Math.min(i.maxValue,i.value+(t?i.step:-i.step))), +i.setThumbPosition(Math.round((i.value-i.minValue)*i.delta)),i.trigger("change",i,i.value,i.lastValue)},c=function(t){i.disabled||t.keyCode!=Common.UI.Keys.UP&&t.keyCode!=Common.UI.Keys.DOWN&&t.keyCode!=Common.UI.Keys.LEFT&&t.keyCode!=Common.UI.Keys.RIGHT||(t.preventDefault(),t.stopPropagation(),h.off("keydown","input",c),n=setInterval(e.bind(r,i,t.keyCode==Common.UI.Keys.UP||t.keyCode==Common.UI.Keys.RIGHT),100))},d=function(t){i.disabled||(t.keyCode==Common.UI.Keys.UP||t.keyCode==Common.UI.Keys.DOWN||Common.UI.Keys.LEFT||Common.UI.Keys.RIGHT)&&(t.stopPropagation(),t.preventDefault(),clearInterval(n),r(t.keyCode==Common.UI.Keys.UP||t.keyCode==Common.UI.Keys.RIGHT),h.on("keydown","input",c),i.trigger("changecomplete",i,i.value,i.lastValue))};if(!i.rendered){var h=i.cmpEl;h.on("mousedown",".thumb",a),h.on("mousedown",".track",l),this.options.enableKeyEvents&&(h.on("keydown","input",c),h.on("keyup","input",d))}return i.rendered=!0,this},setThumbPosition:function(t){this.thumb.css({left:t+"%"})},setValue:function(t){this.lastValue=this.value,this.value=Math.max(this.minValue,Math.min(this.maxValue,t)),this.setThumbPosition(Math.round((t-this.minValue)*this.delta))},getValue:function(){return this.value},setDisabled:function(t){t!==this.disabled&&this.cmpEl.toggleClass("disabled",t),this.disabled=t}}),Common.UI.MultiSlider=Common.UI.BaseView.extend({options:{width:100,minValue:0,maxValue:100,values:[0,100],thumbTemplate:'
    '},disabled:!1,template:e.template(['
    ','
    ','
    ','
    ','
    ',"
    ","<% _.each(items, function(item) { %>","<%= thumbTemplate %>","<% }); %>","
    "].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t);var e=this;e.width=e.options.width,e.minValue=e.options.minValue,e.maxValue=e.options.maxValue,e.delta=100/(e.maxValue-e.minValue),e.thumbs=[],e.options.el&&e.render()},render:function(t){var i=this;i.rendered?this.cmpEl=this.$el:(this.cmpEl=$(this.template({items:this.options.values,thumbTemplate:this.options.thumbTemplate})),t?(this.setElement(t,!1),t.html(this.cmpEl)):this.$el.html(this.cmpEl));var n=this.cmpEl;n.find(".track-center").width(i.options.width-14),n.width(i.options.width);var o=function(t){t.preventDefault(),t.stopPropagation();var n=t.data.index,o=i.thumbs[n].value,s=n-1<0?0:i.thumbs[n-1].position,a=n+1a,c=Math.max(0,Math.min(100,l)),d=c/i.delta+i.minValue;if(i.isRemoveThumb){if(i.thumbs.length<3)return $(document).off("mouseup",i.binding.onMouseUp),$(document).off("mousemove",i.binding.onMouseMove),void(i._dragstart=void 0);i.trigger("removethumb",i,e.findIndex(i.thumbs,{index:n})),i.trigger("change",i,d,o),i.trigger("changecomplete",i,d,o)}else i.setThumbPosition(n,c),i.thumbs[n].value=d,r&&i.sortThumbs();$(document).off("mouseup",i.binding.onMouseUp),$(document).off("mousemove",i.binding.onMouseMove),i._dragstart=void 0,!i.isRemoveThumb&&i.trigger("changecomplete",i,d,o),i.isRemoveThumb=void 0},s=function(t){if(!i.disabled&&void 0!==i._dragstart){t.preventDefault(),t.stopPropagation();var e=t.data.index,n=i.thumbs[e].value,o=e-1<0?0:i.thumbs[e-1].position,s=e+1s,r=Math.max(0,Math.min(100,a)),c=r/i.delta+i.minValue;i.setThumbPosition(e,r),i.thumbs[e].value=c,l&&i.sortThumbs();var d=t.pageY*Common.Utils.zoom()-i.cmpEl.offset().top;i.isRemoveThumb=d>i.cmpEl.height()||d<0,i.setRemoveThumb(e,i.isRemoveThumb),Math.abs(c-n)>.001&&i.trigger("change",i,c,n)}},a=function(t){if(!i.disabled){var n=t.data.index,o=i.thumbs[n].thumb;i._dragstart=t.pageX*Common.Utils.zoom()-o.offset().left-o.width()/2,i.setActiveThumb(n),e.each(i.thumbs,function(t,e){n==e?t.thumb.css("z-index",500):t.thumb.css("z-index","")}),$(document).on("mouseup",null,t.data,i.binding.onMouseUp),$(document).on("mousemove",null,t.data,i.binding.onMouseMove)}},l=function(t){if(!(i.disabled||!e.isUndefined(i._dragstart)||i.thumbs.length>9)){var n=Math.max(0,Math.min(100,Math.round((t.pageX*Common.Utils.zoom()-i.cmpEl.offset().left)/i.width*100))),o=r(n),s=(i.thumbs[o].colorValue,i.thumbs[o].value,n/i.delta+i.minValue);i.addThumb();var a=i.thumbs.length-1;i.setThumbPosition(a,n),i.thumbs[a].value=s,i.trigger("addthumb",i,a,n),i.trigger("change",i),i.trigger("changecomplete",i)}},r=function(t){for(var e,n=100,o=0,s=i.thumbs.length,a=0;al.position)continue;o=a,n=e}return o};return this.binding={onMouseUp:e.bind(o,this),onMouseMove:e.bind(s,this),onMouseDown:e.bind(a,this)},this.$thumbs=n.find(".thumb"),e.each(this.$thumbs,function(t,e){var n=$(t);i.thumbs.push({thumb:n,index:e}),i.setValue(e,i.options.values[e]),n.on("mousedown",null,i.thumbs[e],i.binding.onMouseDown)}),i.setActiveThumb(0,!0),i.rendered||n.on("mouseup",".track",l),i.rendered=!0,this},setActiveThumb:function(t,e){this.currentThumb=t,this.$thumbs=this.cmpEl.find(".thumb"),this.$thumbs.removeClass("active"),this.thumbs[t].thumb.addClass("active"),!0!==e&&this.trigger("thumbclick",this,t)},setRemoveThumb:function(t,i){-1!==e.findIndex(this.thumbs,{index:t})&&(i&&this.thumbs.length>2?this.$el.find(".active").addClass("remove"):this.$el.find(".remove").removeClass("remove"))},setThumbPosition:function(t,e){this.thumbs[t].position=e,this.thumbs[t].thumb.css({left:e+"%"})},setValue:function(t,e){this.thumbs[t].value=Math.max(this.minValue,Math.min(this.maxValue,e)),this.setThumbPosition(t,Math.round((e-this.minValue)*this.delta))},getValue:function(t){return this.thumbs[t].value},getValues:function(){var t=[];return e.each(this.thumbs,function(e){t.push(e.value)}),t},setDisabled:function(t){t!==this.disabled&&this.cmpEl.toggleClass("disabled",t),this.disabled=t},sortThumbs:function(){this.thumbs.sort(function(t,e){return t.position-e.position});var t=[];return e.each(this.thumbs,function(e,i){t.push(e.index),e.index=i}),t},setThumbs:function(t){var e=this.thumbs.length;if(e!=t)for(var i=0;i0&&this.setValue(i,this.getValue(i-1)),e.on("mousedown",null,this.thumbs[i],this.binding.onMouseDown)},removeThumb:function(t){void 0===t&&(t=this.thumbs.length-1),t>0&&(this.thumbs[t].thumb.remove(),this.thumbs.splice(t,1))}})}),void 0===Common)var Common={};define("common/main/lib/component/MultiSliderGradient",["common/main/lib/component/Slider","underscore"],function(t,e){"use strict";Common.UI.MultiSliderGradient=Common.UI.MultiSlider.extend({options:{width:100,minValue:0,maxValue:100,values:[0,100],colorValues:["#000000","#ffffff"],currentThumb:0,thumbTemplate:'
    '},disabled:!1,template:e.template(['
    ','
    ',"<% _.each(items, function(item) { %>","<%= thumbTemplate %>","<% }); %>","
    "].join("")),initialize:function(t){this.styleStr={},Common.UI.MultiSlider.prototype.initialize.call(this,t)},render:function(t){Common.UI.MultiSlider.prototype.render.call(this,t);var i=this;i.trackEl=i.cmpEl.find(".track");for(var n=0;n div"),i.setColorValue(i.options.colorValues[n],n);i.changeSliderStyle(),i.changeGradientStyle(),i.on("change",e.bind(i.changeGradientStyle,i))},setColorValue:function(t,e){var i=void 0!==e?e:this.currentThumb;this.thumbs[i].colorValue=t,this.thumbs[i].thumbcolor.css("background-color",t),this.changeGradientStyle()},getColorValue:function(t){var e=void 0!==t?t:this.currentThumb;return this.thumbs[e].colorValue},setValue:function(t,e){Common.UI.MultiSlider.prototype.setValue.call(this,t,e),this.changeGradientStyle()},getColorValues:function(){var t=[];return e.each(this.thumbs,function(e){t.push(e.colorValue)}),t},changeGradientStyle:function(){if(this.rendered){var t;this.styleStr.specific&&(t=Common.Utils.String.format(this.styleStr.specific,this.getColorValues().concat(this.getValues())),this.trackEl.css("background",t)),Common.Utils.isIE&&(t=Common.Utils.String.format("progid:DXImageTransform.Microsoft.gradient( startColorstr={0}, endColorstr={1},GradientType=1 )",this.getColorValue(0),this.getColorValue(this.thumbs.length-1)),this.trackEl.css("filter",t)),this.styleStr.common&&(t=Common.Utils.String.format(this.styleStr.common,this.getColorValues().concat(this.getValues())),this.trackEl.css("background",t))}},sortThumbs:function(){var t=Common.UI.MultiSlider.prototype.sortThumbs.call(this);return this.trigger("sortthumbs",this,t),t},findLeftThumb:function(t){for(var e,i=this,n=100,o=0,s=this.thumbs.length,a=0;a0&&e<=n){var l=i.thumbs[a+1],r=i.thumbs[a-1];if(void 0!==r&&tl.position)continue;o=a,n=e}return o},calculationNewColor:function(t,e,i){var n=i?i/100:.5,o=1-n,s=Common.Utils.ThemeColor.getRgbColor(t),a=Common.Utils.ThemeColor.getRgbColor(e),l=[Math.round(s.get_r()*o+a.get_r()*n),Math.round(s.get_g()*o+a.get_g()*n),Math.round(s.get_b()*o+a.get_b()*n)];return Common.Utils.ThemeColor.getHexColor(l[0],l[1],l[2])},addThumb:function(){Common.UI.MultiSlider.prototype.addThumb.call(this);var t=this,e=t.thumbs.length-1;t.thumbs[e].thumb.on("dblclick",null,function(){t.trigger("thumbdblclick",t)}),t.thumbs[e].thumbcolor=t.thumbs[e].thumb.find("> div"),e>0&&this.setColorValue(this.getColorValue(e-1),e),t.changeSliderStyle()},addNewThumb:function(t,i,n){var o,s=this,a=this.findLeftThumb(i),t=t;if(e.isUndefined(n)){var l=100*(i-this.thumbs[a].value)/(this.thumbs[a+1].value-this.thumbs[a].value);o=l<0?this.thumbs[a].colorValue:this.calculationNewColor(this.thumbs[a].colorValue,this.thumbs[a===t-1?a:a+1].colorValue,l)}else{this.addThumb(),t=this.thumbs.length-1,o=this.calculationNewColor(this.thumbs[a].colorValue,this.thumbs[a===t-1?a:a+1].colorValue),this.setThumbPosition(t,i);var r=i/this.delta+this.minValue;this.thumbs[t].value=r}return s.thumbs[t].thumbcolor=s.thumbs[t].thumb.find("> div"),t>0&&this.setColorValue("#"+o,t),s.sortThumbs(),s.changeSliderStyle(),s.changeGradientStyle(),o},removeThumb:function(t){void 0===t&&(t=this.thumbs.length-1),this.thumbs.length>2&&(this.thumbs[t].thumb.remove(),this.thumbs.splice(t,1),this.sortThumbs(),this.changeSliderStyle())},changeSliderStyle:function(){this.styleStr={specific:"",common:"linear-gradient(to right"},Common.Utils.isChrome&&Common.Utils.chromeVersion<10||Common.Utils.isSafari&&Common.Utils.safariVersion<5.1?this.styleStr.specific="-webkit-gradient(linear, left top, right top":Common.Utils.isChrome||Common.Utils.isSafari?this.styleStr.specific="-webkit-linear-gradient(left":Common.Utils.isGecko?this.styleStr.specific="-moz-linear-gradient(left":Common.Utils.isOpera&&Common.Utils.operaVersion>11?this.styleStr.specific="-o-linear-gradient(left":Common.Utils.isIE&&(this.styleStr.specific="-ms-linear-gradient(left");for(var t=0;t=0?this.btnDirection.setIconCls("item-gradient "+this._viewDataRadial[this.GradRadialDirectionIdx].iconcls):this.btnDirection.setIconCls(""),this.numGradientAngle.setValue(0,!0),this.numGradientAngle.setDisabled(!0));if(this.api&&!this._noApply){var i=new Asc.asc_CShapeProperty,n=new Asc.asc_CShapeFill;n.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD),n.put_fill(new Asc.asc_CFillGrad),n.get_fill().put_grad_type(this.GradFillType),this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR&&(n.get_fill().put_linear_angle(6e4*this.GradLinearDirectionType),n.get_fill().put_linear_scale(!0)),i.put_fill(n),this.api.ShapeApply(i)}this.fireEvent("editcomplete",this)},onSelectGradient:function(t,e,n,o){if(!this._noApply){var s={};if(i.isFunction(o.toJSON)){if(!o.get("selected"))return;s=o.toJSON()}else s=o;if(this.btnDirection.setIconCls("item-gradient "+s.iconcls),this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR?this.GradLinearDirectionType=s.type:this.GradRadialDirectionIdx=0,this.api&&this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR){this.numGradientAngle.setValue(s.type,!0);var a=new Asc.asc_CShapeProperty,l=new Asc.asc_CShapeFill;l.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD),l.put_fill(new Asc.asc_CFillGrad),l.get_fill().put_grad_type(this.GradFillType),l.get_fill().put_linear_angle(6e4*s.type),l.get_fill().put_linear_scale(!0),a.put_fill(l),this.api.ShapeApply(a)}this.fireEvent("editcomplete",this)}},onColorsGradientSelect:function(t,e){if(this.GradColor.colors[this.GradColor.currentIdx]=e,this.sldrGradient.setColorValue(Common.Utils.String.format("#{0}","object"==typeof e?e.color:e)),this.api&&!this._noApply){var i=new Asc.asc_CShapeProperty,n=new Asc.asc_CShapeFill;n.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD),n.put_fill(new Asc.asc_CFillGrad),n.get_fill().put_grad_type(this.GradFillType);var o=[];this.GradColor.colors.forEach(function(t){o.push(Common.Utils.ThemeColor.getRgbColor(t))}),n.get_fill().put_colors(o),this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_GRAD&&(this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR&&(n.get_fill().put_linear_angle(6e4*this.GradLinearDirectionType),n.get_fill().put_linear_scale(!0)),o=[],this.GradColor.values.forEach(function(t){o.push(1e3*t)}),n.get_fill().put_positions(o)),i.put_fill(n),this.api.ShapeApply(i)}this.fireEvent("editcomplete",this)},onGradientChange:function(t,e,n){this.GradColor.values=t.getValues(),this.spnGradPosition.setValue(this.GradColor.values[this.GradColor.currentIdx],!0),this._sliderChanged=!0,this.api&&!this._noApply&&this._sendUndoPoint&&(this.api.setStartPointHistory(),this._sendUndoPoint=!1,this.updateslider=setInterval(i.bind(this._gradientApplyFunc,this),100))},onGradientChangeComplete:function(t,e,i){clearInterval(this.updateslider),this._sliderChanged=!0,this._sendUndoPoint||(this.api.setEndPointHistory(),this._gradientApplyFunc()),this._sendUndoPoint=!0},_gradientApplyFunc:function(){if(this._sliderChanged){var t=new Asc.asc_CShapeProperty,e=new Asc.asc_CShapeFill;e.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD),e.put_fill(new Asc.asc_CFillGrad),e.get_fill().put_grad_type(this.GradFillType);var i=[];this.GradColor.values.forEach(function(t){i.push(1e3*t)}),e.get_fill().put_positions(i),this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR&&(e.get_fill().put_linear_angle(6e4*this.GradLinearDirectionType),e.get_fill().put_linear_scale(!0)),i=[],this.GradColor.colors.forEach(function(t){i.push(Common.Utils.ThemeColor.getRgbColor(t))}),e.get_fill().put_colors(i),t.put_fill(e),this.api.ShapeApply(t),this._sliderChanged=!1}},applyBorderSize:function(t){if(t=Common.Utils.String.parseFloat(t),t=isNaN(t)?0:Math.max(0,Math.min(1584,t)),this.BorderSize=t,this.api&&!this._noApply){var e=new Asc.asc_CShapeProperty,i=new Asc.asc_CStroke;this.BorderSize<1e-5?(i.put_type(Asc.c_oAscStrokeType.STROKE_NONE),this._state.StrokeType=this._state.StrokeWidth=-1):(i.put_type(Asc.c_oAscStrokeType.STROKE_COLOR),"transparent"==this.BorderColor.Color||"transparent"==this.BorderColor.Color.color?i.put_color(Common.Utils.ThemeColor.getRgbColor({color:"000000",effectId:29})):this._state.StrokeType!=Asc.c_oAscStrokeType.STROKE_NONE&&null!==this._state.StrokeType||i.put_color(Common.Utils.ThemeColor.getRgbColor(Common.Utils.ThemeColor.colorValue2EffectId(this.BorderColor.Color))),i.asc_putPrstDash(this.BorderType),i.put_width(this._pt2mm(this.BorderSize))),e.put_stroke(i),this.api.ShapeApply(e)}this.fireEvent("editcomplete",this)},onComboBlur:function(){this.fireEvent("editcomplete",this)},onBorderSizeChanged:function(t,e,n,o){var s=this;if(t){var a=parseFloat(n.value);(!new RegExp("^\\s*(\\d*(\\.|,)?\\d+)\\s*("+s.txtPt+")?\\s*$").exec(n.value)||a<0||a>1584)&&(this._state.StrokeType=this._state.StrokeWidth=-1,Common.UI.error({msg:this.textBorderSizeErr,callback:function(){i.defer(function(t){s.fireEvent("editcomplete",s)})}}))}else this.applyBorderSize(n.value)},onBorderSizeSelect:function(t,e){this.applyBorderSize(e.value)},onBorderTypeSelect:function(t,e){if(this.BorderType=e.value,this.api&&!this._noApply){var i=new Asc.asc_CShapeProperty,n=new Asc.asc_CStroke;this.BorderSize<1e-5?n.put_type(Asc.c_oAscStrokeType.STROKE_NONE):(n.put_type(Asc.c_oAscStrokeType.STROKE_COLOR),n.put_color(Common.Utils.ThemeColor.getRgbColor(this.BorderColor.Color)),n.put_width(this._pt2mm(this.BorderSize)),n.asc_putPrstDash(this.BorderType)),i.put_stroke(n),this.api.ShapeApply(i)}this.fireEvent("editcomplete",this)},onColorsBorderSelect:function(t,e){if(this.BorderColor={Value:1,Color:e},this.api&&this.BorderSize>0&&!this._noApply){var i=new Asc.asc_CShapeProperty,n=new Asc.asc_CStroke;this.BorderSize<1e-5?n.put_type(Asc.c_oAscStrokeType.STROKE_NONE):(n.put_type(Asc.c_oAscStrokeType.STROKE_COLOR),n.put_color(Common.Utils.ThemeColor.getRgbColor(this.BorderColor.Color)),n.put_width(this._pt2mm(this.BorderSize)),n.asc_putPrstDash(this.BorderType)),i.put_stroke(n),this.api.ShapeApply(i)}this.fireEvent("editcomplete",this)},setImageUrl:function(t,e){if(null!==this.BlipFillType){var i=new Asc.asc_CShapeProperty,n=new Asc.asc_CShapeFill;n.put_type(Asc.c_oAscFill.FILL_TYPE_BLIP),n.put_fill(new Asc.asc_CFillBlip),n.get_fill().put_type(this.BlipFillType),n.get_fill().put_url(t,e),i.put_fill(n),this.api.ShapeApply(i)}},insertImageFromStorage:function(t){t&&t.url&&"fill"==t.c&&this.setImageUrl(t.url,t.token)},onImageSelect:function(t,e){if(1==e.value){var n=this;new Common.Views.ImageFromUrlDialog({handler:function(t,e){if("ok"==t&&n.api){var o=e.replace(/ /g,"");i.isEmpty(o)||n.setImageUrl(o)}n.fireEvent("editcomplete",n)}}).show()}else 2==e.value?Common.NotificationCenter.trigger("storage:image-load","fill"):(this.api&&this.api.ChangeShapeImageFromFile(this.BlipFillType),this.fireEvent("editcomplete",this))},openAdvancedSettings:function(t){if(!this.linkAdvanced.hasClass("disabled")){var e=this;if(e.api&&!this._locked){var i=e.api.getSelectedElements();if(i&&i.length>0)for(var n,o,s=i.length-1;s>=0;s--)if(n=i[s].get_ObjectType(),o=i[s].get_ObjectValue(),Asc.c_oAscTypeSelectElement.Shape==n){new PE.Views.ShapeSettingsAdvanced({shapeProps:o,handler:function(t,i){"ok"==t&&e.api&&e.api.ShapeApply(i.shapeProps),e.fireEvent("editcomplete",e)}}).show();break}}}},ChangeSettings:function(t){if(this._initSettings&&this.createDelayedElements(),t){this._originalProps=t,this._noApply=!0;var n=t.asc_getType();this.disableControls(1==this._locked,!0!==t.get_CanFill()),this.hideShapeOnlySettings(t.get_FromChart()||t.get_FromImage());var o=t.get_FromChart()||"line"==n||"bentConnector2"==n||"bentConnector3"==n||"bentConnector4"==n||"bentConnector5"==n||"curvedConnector2"==n||"curvedConnector3"==n||"curvedConnector4"==n||"curvedConnector5"==n||"straightConnector1"==n;this.hideChangeTypeSettings(o),this._state.isFromImage=!!t.get_FromImage(),!o&&this.btnChangeShape.menu.items.length&&(this.btnChangeShape.menu.items[0].setVisible(t.get_FromImage()),this.btnChangeShape.menu.items[1].setVisible(!t.get_FromImage()));var s=null,a=t.get_fill(),l=a.get_type(),r=null,c=a.get_transparent();if((Math.abs(this._state.Transparency-c)>.001||Math.abs(this.numTransparency.getNumberValue()-c)>.001||(null===this._state.Transparency||null===c)&&(this._state.Transparency!==c||this.numTransparency.getNumberValue()!==c))&&(void 0!==c&&(this.sldrTransparency.setValue(null===c?100:c/255*100,!0),this.numTransparency.setValue(this.sldrTransparency.getValue(),!0)),this._state.Transparency=c),null===a||null===l)this.OriginalFillType=null;else if(l==Asc.c_oAscFill.FILL_TYPE_NOFILL)this.OriginalFillType=Asc.c_oAscFill.FILL_TYPE_NOFILL;else if(l==Asc.c_oAscFill.FILL_TYPE_SOLID)a=a.get_fill(),r=a.get_color(),r?r.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?this.ShapeColor={Value:1,Color:{color:Common.Utils.ThemeColor.getHexColor(r.get_r(),r.get_g(),r.get_b()),effectValue:r.get_value()}}:this.ShapeColor={Value:1,Color:Common.Utils.ThemeColor.getHexColor(r.get_r(),r.get_g(),r.get_b())}:this.ShapeColor={Value:0,Color:"transparent"},this.OriginalFillType=Asc.c_oAscFill.FILL_TYPE_SOLID,this.FGColor="transparent"!==this.ShapeColor.Color?{Value:1,Color:Common.Utils.ThemeColor.colorValue2EffectId(this.ShapeColor.Color)}:{Value:1,Color:"000000"},this.BGColor={Value:1,Color:"ffffff"},this.GradColor.colors[0]="transparent"!==this.ShapeColor.Color?Common.Utils.ThemeColor.colorValue2EffectId(this.ShapeColor.Color):"000000",this.GradColor.colors[this.GradColor.colors.length-1]="ffffff";else if(l==Asc.c_oAscFill.FILL_TYPE_BLIP)a=a.get_fill(),this.BlipFillType=a.get_type(), +this._state.BlipFillType!==this.BlipFillType&&(this.BlipFillType==Asc.c_oAscFillBlipType.STRETCH||this.BlipFillType==Asc.c_oAscFillBlipType.TILE?this.cmbFillType.setValue(this.BlipFillType):this.cmbFillType.setValue(""),this._state.BlipFillType=this.BlipFillType),this.OriginalFillType=Asc.c_oAscFill.FILL_TYPE_BLIP;else if(l==Asc.c_oAscFill.FILL_TYPE_PATT){if(a=a.get_fill(),this.PatternFillType=a.get_pattern_type(),this._state.PatternFillType!==this.PatternFillType){this.cmbPattern.suspendEvents();var s=this.cmbPattern.menuPicker.store.findWhere({type:this.PatternFillType});this.cmbPattern.menuPicker.selectRecord(s),this.cmbPattern.resumeEvents(),this._state.PatternFillType=this.PatternFillType}r=a.get_color_fg(),r?r.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?this.FGColor={Value:1,Color:{color:Common.Utils.ThemeColor.getHexColor(r.get_r(),r.get_g(),r.get_b()),effectValue:r.get_value()}}:this.FGColor={Value:1,Color:Common.Utils.ThemeColor.getHexColor(r.get_r(),r.get_g(),r.get_b())}:this.FGColor={Value:1,Color:"000000"},r=a.get_color_bg(),r?r.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?this.BGColor={Value:1,Color:{color:Common.Utils.ThemeColor.getHexColor(r.get_r(),r.get_g(),r.get_b()),effectValue:r.get_value()}}:this.BGColor={Value:1,Color:Common.Utils.ThemeColor.getHexColor(r.get_r(),r.get_g(),r.get_b())}:this.BGColor={Value:1,Color:"ffffff"},this.OriginalFillType=Asc.c_oAscFill.FILL_TYPE_PATT,this.ShapeColor={Value:1,Color:Common.Utils.ThemeColor.colorValue2EffectId(this.FGColor.Color)},this.GradColor.colors[0]=Common.Utils.ThemeColor.colorValue2EffectId(this.FGColor.Color),this.GradColor.colors[this.GradColor.colors.length-1]="ffffff"}else if(l==Asc.c_oAscFill.FILL_TYPE_GRAD){a=a.get_fill();var d=a.get_grad_type();if(this._state.GradFillType===d&&this.GradFillType===d||(this.GradFillType=d,s=void 0,this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR||this.GradFillType==Asc.c_oAscFillGradType.GRAD_PATH?(this.cmbGradType.setValue(this.GradFillType),s=this.cmbGradType.store.findWhere({value:this.GradFillType}),this.onGradTypeSelect(this.cmbGradType,s.attributes)):(this.cmbGradType.setValue(""),this.btnDirection.setIconCls("")),this._state.GradFillType=this.GradFillType),this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR){var h=Math.floor(a.get_linear_angle()/6e4);if(Math.abs(this.GradLinearDirectionType-h)>.001){this.GradLinearDirectionType=h;var p=this.mnuDirectionPicker.store.findWhere({type:h});this.mnuDirectionPicker.selectRecord(p,!0),p?this.btnDirection.setIconCls("item-gradient "+p.get("iconcls")):this.btnDirection.setIconCls(""),this.numGradientAngle.setValue(h,!0)}}else this.numGradientAngle.setValue(0,!0);var u=this,m=a.get_colors(),g=a.get_positions(),f=m?m.length:this.GradColor.colors.length;this.sldrGradient.setThumbs(f),this.GradColor.colors.length>f&&(this.GradColor.colors.splice(f,this.GradColor.colors.length-f),this.GradColor.values.splice(f,this.GradColor.colors.length-f),this.GradColor.currentIdx=0),m&&m.forEach(function(t,e){t?t.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?(u.GradColor.colors[e]={color:Common.Utils.ThemeColor.getHexColor(t.get_r(),t.get_g(),t.get_b()),effectValue:t.get_value()},Common.Utils.ThemeColor.colorValue2EffectId(u.GradColor.colors[e])):u.GradColor.colors[e]=Common.Utils.ThemeColor.getHexColor(t.get_r(),t.get_g(),t.get_b()):u.GradColor.colors[e]="000000";var i=g[e];null!==i&&(i/=1e3,u.GradColor.values[e]=i)});for(var b=0;b=this.GradColor.colors.length)&&(u.GradColor.currentIdx=0),this.sldrGradient.setActiveThumb(u.GradColor.currentIdx),this.spnGradPosition.setValue(this.GradColor.values[this.GradColor.currentIdx]),this.OriginalFillType=Asc.c_oAscFill.FILL_TYPE_GRAD,this.FGColor={Value:1,Color:this.GradColor.colors[0]},this.BGColor={Value:1,Color:"ffffff"},this.ShapeColor={Value:1,Color:this.GradColor.colors[0]}}this._state.FillType!==this.OriginalFillType&&(this.cmbFillSrc.setValue(null===this.OriginalFillType?"":this.OriginalFillType),this._state.FillType=this.OriginalFillType,this.ShowHideElem(this.OriginalFillType)),e(this.btnTexture.el).find(".form-control").prop("innerHTML",this.textSelectTexture);var C=typeof this.ShapeColor.Color,v=typeof this._state.ShapeColor;if(C!==v||"object"==C&&(this.ShapeColor.Color.effectValue!==this._state.ShapeColor.effectValue||this._state.ShapeColor.color.indexOf(this.ShapeColor.Color.color)<0)||"object"!=C&&this._state.ShapeColor.indexOf(this.ShapeColor.Color)<0){if(this.btnBackColor.setColor(this.ShapeColor.Color),"object"==typeof this.ShapeColor.Color){for(var _=!1,y=0;y<10;y++)if(Common.Utils.ThemeColor.ThemeValues[y]==this.ShapeColor.Color.effectValue){this.colorsBack.select(this.ShapeColor.Color,!0),_=!0;break}_||this.colorsBack.clearSelection()}else this.colorsBack.select(this.ShapeColor.Color,!0);this._state.ShapeColor=this.ShapeColor.Color}var w,x=t.get_stroke(),S=x.get_type(),A="transparent"==this._state.StrokeColor&&"transparent"!==this.BorderColor.Color;if(x?(S==Asc.c_oAscStrokeType.STROKE_COLOR?(r=x.get_color(),r?r.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?this.BorderColor={Value:1,Color:{color:Common.Utils.ThemeColor.getHexColor(r.get_r(),r.get_g(),r.get_b()),effectValue:r.get_value()}}:this.BorderColor={Value:1,Color:Common.Utils.ThemeColor.getHexColor(r.get_r(),r.get_g(),r.get_b())}:this.BorderColor={Value:1,Color:"transparent"}):this.BorderColor={Value:1,Color:"transparent"},w=x.asc_getPrstDash()):(S=null,this.BorderColor={Value:0,Color:"transparent"}),C=typeof this.BorderColor.Color,v=typeof this._state.StrokeColor,A||C!==v||"object"==C&&(this.BorderColor.Color.effectValue!==this._state.StrokeColor.effectValue||this._state.StrokeColor.color.indexOf(this.BorderColor.Color.color)<0)||"object"!=C&&(this._state.StrokeColor.indexOf(this.BorderColor.Color)<0||"object"==typeof this.btnBorderColor.color)){if(this.btnBorderColor.setColor(this.BorderColor.Color),"object"==typeof this.BorderColor.Color){for(var _=!1,y=0;y<10;y++)if(Common.Utils.ThemeColor.ThemeValues[y]==this.BorderColor.Color.effectValue){this.colorsBorder.select(this.BorderColor.Color,!0),_=!0;break}_||this.colorsBorder.clearSelection()}else this.colorsBorder.select(this.BorderColor.Color,!0);this._state.StrokeColor=this.BorderColor.Color}if(this._state.StrokeType!==S||S==Asc.c_oAscStrokeType.STROKE_COLOR){if(S==Asc.c_oAscStrokeType.STROKE_COLOR){var T=x.get_width(),k=Math.abs(this._state.StrokeWidth-T)<1e-5&&!new RegExp(this.txtPt+"\\s*$").test(this.cmbBorderSize.getRawValue());if(Math.abs(this._state.StrokeWidth-T)>1e-5||k||(null===this._state.StrokeWidth||null===T)&&this._state.StrokeWidth!==T){this._state.StrokeWidth=T,null!==T&&(T=this._mm2pt(T));var I=null===T?T:i.find(this.cmbBorderSize.store.models,function(t){if(Tt.attributes.value-1e-5)return!0});I?this.cmbBorderSize.selectRecord(I):this.cmbBorderSize.setValue(null!==T?parseFloat(T.toFixed(2))+" "+this.txtPt:""),this.BorderSize=T}}else S==Asc.c_oAscStrokeType.STROKE_NONE?(this._state.StrokeWidth=0,this.BorderSize=this.cmbBorderSize.store.at(0).get("value"),this.cmbBorderSize.setValue(this.BorderSize)):(this._state.StrokeWidth=null,this.BorderSize=-1,this.cmbBorderSize.setValue(null));this._state.StrokeType=S}if(this._state.StrokeBorderType!==w&&(this.BorderType=this._state.StrokeBorderType=w,this.cmbBorderType.setValue(w)),C=typeof this.FGColor.Color,v=typeof this._state.FGColor,C!==v||"object"==C&&(this.FGColor.Color.effectValue!==this._state.FGColor.effectValue||this._state.FGColor.color.indexOf(this.FGColor.Color.color)<0)||"object"!=C&&this._state.FGColor.indexOf(this.FGColor.Color)<0){if(this.btnFGColor.setColor(this.FGColor.Color),"object"==typeof this.FGColor.Color){for(var _=!1,y=0;y<10;y++)if(Common.Utils.ThemeColor.ThemeValues[y]==this.FGColor.Color.effectValue){this.colorsFG.select(this.FGColor.Color,!0),_=!0;break}_||this.colorsFG.clearSelection()}else this.colorsFG.select(this.FGColor.Color,!0);this._state.FGColor=this.FGColor.Color}if(C=typeof this.BGColor.Color,v=typeof this._state.BGColor,C!==v||"object"==C&&(this.BGColor.Color.effectValue!==this._state.BGColor.effectValue||this._state.BGColor.color.indexOf(this.BGColor.Color.color)<0)||"object"!=C&&this._state.BGColor.indexOf(this.BGColor.Color)<0){if(this.btnBGColor.setColor(this.BGColor.Color),"object"==typeof this.BGColor.Color){for(var _=!1,y=0;y<10;y++)if(Common.Utils.ThemeColor.ThemeValues[y]==this.BGColor.Color.effectValue){this.colorsBG.select(this.BGColor.Color,!0),_=!0;break}_||this.colorsBG.clearSelection()}else this.colorsBG.select(this.BGColor.Color,!0);this._state.BGColor=this.BGColor.Color}if(r=this.GradColor.colors[this.GradColor.currentIdx],C=typeof r,v=typeof this._state.GradColor,C!==v||"object"==C&&(r.effectValue!==this._state.GradColor.effectValue||this._state.GradColor.color.indexOf(r.color)<0)||"object"!=C&&this._state.GradColor.indexOf(r)<0){if(this.btnGradColor.setColor(r),"object"==typeof r){for(var _=!1,y=0;y<10;y++)if(Common.Utils.ThemeColor.ThemeValues[y]==r.effectValue){this.colorsGrad.select(r,!0),_=!0;break}_||this.colorsGrad.clearSelection()}else this.colorsGrad.select(r,!0);this._state.GradColor=r}this.chShadow.setValue(!!t.asc_getShadow(),!0),this._noApply=!1}},createDelayedControls:function(){var t=this;this._arrFillSrc=[{displayValue:this.textColor,value:Asc.c_oAscFill.FILL_TYPE_SOLID},{displayValue:this.textGradientFill,value:Asc.c_oAscFill.FILL_TYPE_GRAD},{displayValue:this.textImageTexture,value:Asc.c_oAscFill.FILL_TYPE_BLIP},{displayValue:this.textPatternFill,value:Asc.c_oAscFill.FILL_TYPE_PATT},{displayValue:this.textNoFill,value:Asc.c_oAscFill.FILL_TYPE_NOFILL}],this.cmbFillSrc=new Common.UI.ComboBox({el:e("#shape-combo-fill-src"),cls:"input-group-nr",style:"width: 100%;",menuStyle:"min-width: 100%;",editable:!1,data:this._arrFillSrc}),this.cmbFillSrc.setValue(this._arrFillSrc[0].value),this.cmbFillSrc.on("selected",i.bind(this.onFillSrcSelect,this)),this.fillControls.push(this.cmbFillSrc),this.cmbPattern=new Common.UI.ComboDataView({itemWidth:28,itemHeight:28,menuMaxHeight:300,enableKeyEvents:!0,cls:"combo-pattern"}),this.cmbPattern.menuPicker.itemTemplate=this.cmbPattern.fieldPicker.itemTemplate=i.template(['
    ','',"
    "].join("")),this.cmbPattern.render(e("#shape-combo-pattern")),this.cmbPattern.openButton.menu.cmpEl.css({"min-width":178,"max-width":178}),this.cmbPattern.on("click",i.bind(this.onPatternSelect,this)),this.cmbPattern.openButton.menu.on("show:after",function(){t.cmbPattern.menuPicker.scroller.update({alwaysVisibleY:!0})}),this.fillControls.push(this.cmbPattern),this.btnSelectImage=new Common.UI.Button({parentEl:e("#shape-button-replace"),cls:"btn-text-menu-default",caption:this.textSelectImage,style:"width:100%;",menu:new Common.UI.Menu({style:"min-width: 194px;",maxHeight:200,items:[{caption:this.textFromFile,value:0},{caption:this.textFromUrl,value:1},{caption:this.textFromStorage,value:2}]})}),this.fillControls.push(this.btnSelectImage),this.btnSelectImage.menu.on("item:click",i.bind(this.onImageSelect,this)),this.btnSelectImage.menu.items[2].setVisible(this.mode.canRequestInsertImage||this.mode.fileChoiceUrl&&this.mode.fileChoiceUrl.indexOf("{documentType}")>-1),this._arrFillType=[{displayValue:this.textStretch,value:Asc.c_oAscFillBlipType.STRETCH},{displayValue:this.textTile,value:Asc.c_oAscFillBlipType.TILE}],this.cmbFillType=new Common.UI.ComboBox({el:e("#shape-combo-fill-type"),cls:"input-group-nr",menuStyle:"min-width: 90px;",editable:!1,data:this._arrFillType}),this.cmbFillType.setValue(this._arrFillType[0].value),this.cmbFillType.on("selected",i.bind(this.onFillTypeSelect,this)),this.fillControls.push(this.cmbFillType),this.numTransparency=new Common.UI.MetricSpinner({el:e("#shape-spin-transparency"),step:1,width:62,value:"100 %",defaultUnit:"%",maxValue:100,minValue:0}),this.numTransparency.on("change",i.bind(this.onNumTransparencyChange,this)),this.numTransparency.on("inputleave",function(){t.fireEvent("editcomplete",t)}),this.fillControls.push(this.numTransparency),this.sldrTransparency=new Common.UI.SingleSlider({el:e("#shape-slider-transparency"),width:75,minValue:0,maxValue:100,value:100}),this.sldrTransparency.on("change",i.bind(this.onTransparencyChange,this)),this.sldrTransparency.on("changecomplete",i.bind(this.onTransparencyChangeComplete,this)),this.fillControls.push(this.sldrTransparency),this.lblTransparencyStart=e(this.el).find("#shape-lbl-transparency-start"),this.lblTransparencyEnd=e(this.el).find("#shape-lbl-transparency-end"),this._arrGradType=[{displayValue:this.textLinear,value:Asc.c_oAscFillGradType.GRAD_LINEAR},{displayValue:this.textRadial,value:Asc.c_oAscFillGradType.GRAD_PATH}],this.cmbGradType=new Common.UI.ComboBox({el:e("#shape-combo-grad-type"),cls:"input-group-nr",menuStyle:"min-width: 90px;",editable:!1,data:this._arrGradType}),this.cmbGradType.setValue(this._arrGradType[0].value),this.cmbGradType.on("selected",i.bind(this.onGradTypeSelect,this)),this.fillControls.push(this.cmbGradType),this._viewDataLinear=[{offsetx:0,offsety:0,type:45,subtype:-1,iconcls:"gradient-left-top"},{offsetx:50,offsety:0,type:90,subtype:4,iconcls:"gradient-top"},{offsetx:100,offsety:0,type:135,subtype:5,iconcls:"gradient-right-top"},{offsetx:0,offsety:50,type:0,subtype:6,iconcls:"gradient-left",cls:"item-gradient-separator",selected:!0},{offsetx:100,offsety:50,type:180,subtype:1,iconcls:"gradient-right"},{offsetx:0,offsety:100,type:315,subtype:2,iconcls:"gradient-left-bottom"},{offsetx:50,offsety:100,type:270,subtype:3,iconcls:"gradient-bottom"},{offsetx:100,offsety:100,type:225,subtype:7,iconcls:"gradient-right-bottom"}],this._viewDataRadial=[{offsetx:100,offsety:150,type:2,subtype:5,iconcls:"gradient-radial-center"}],this.btnDirection=new Common.UI.Button({cls:"btn-large-dataview",iconCls:"item-gradient gradient-left",menu:new Common.UI.Menu({style:"min-width: 60px;",menuAlign:"tr-br",items:[{template:i.template('
    ')}]})}),this.btnDirection.on("render:after",function(n){t.mnuDirectionPicker=new Common.UI.DataView({el:e("#id-shape-menu-direction"),parentMenu:n.menu,restoreHeight:174,store:new Common.UI.DataViewStore(t._viewDataLinear),itemTemplate:i.template('
    ')})}),this.btnDirection.render(e("#shape-button-direction")),this.mnuDirectionPicker.on("item:click",i.bind(this.onSelectGradient,this,this.btnDirection)),this.fillControls.push(this.btnDirection),this.sldrGradient=new Common.UI.MultiSliderGradient({el:e("#shape-slider-gradient"),width:192,minValue:0,maxValue:100,values:[0,100]}),this.sldrGradient.on("change",i.bind(this.onGradientChange,this)),this.sldrGradient.on("changecomplete",i.bind(this.onGradientChangeComplete,this)),this.sldrGradient.on("thumbclick",function(e,i){t.GradColor.currentIdx=i;var n=t.GradColor.colors[t.GradColor.currentIdx];t.btnGradColor.setColor(n),t.colorsGrad.select(n,!1);var o=t.GradColor.values[t.GradColor.currentIdx];t.spnGradPosition.setValue(o,!0)}),this.sldrGradient.on("thumbdblclick",function(e){t.btnGradColor.cmpEl.find("button").dropdown("toggle")}),this.sldrGradient.on("sortthumbs",function(e,n){var o,s=[];i.each(n,function(e,i){s.push(t.GradColor.colors[e]),t.GradColor.currentIdx==e&&(o=i)}),t.OriginalFillType=null,t.GradColor.colors=s,t.GradColor.currentIdx=o}),this.sldrGradient.on("addthumb",function(e,i,n){t.GradColor.colors[i]=t.GradColor.colors[t.GradColor.currentIdx],t.GradColor.currentIdx=i;var o=t.sldrGradient.addNewThumb(i,n);t.GradColor.colors[t.GradColor.currentIdx]=o}),this.sldrGradient.on("removethumb",function(e,n){if(t.sldrGradient.removeThumb(n),t.GradColor.values.splice(n,1),t.sldrGradient.changeGradientStyle(),i.isUndefined(t.GradColor.currentIdx)||t.GradColor.currentIdx>=t.GradColor.colors.length){var o=n>0?n-1:n;o=0===o&&t.GradColor.values.length>2?t.GradColor.values.length-2:o,t.GradColor.currentIdx=o}t.sldrGradient.setActiveThumb(t.GradColor.currentIdx)}),this.fillControls.push(this.sldrGradient),this.spnGradPosition=new Common.UI.MetricSpinner({el:e("#shape-gradient-position"),step:1,width:60,defaultUnit:"%",value:"50 %",allowDecimal:!1,maxValue:100,minValue:0,disabled:this._locked}),this.fillControls.push(this.spnGradPosition),this.spnGradPosition.on("change",i.bind(this.onPositionChange,this)),this.spnGradPosition.on("inputleave",function(){t.fireEvent("editcomplete",t)}),this.btnAddGradientStep=new Common.UI.Button({parentEl:e("#shape-gradient-add-step"),cls:"btn-toolbar",iconCls:"toolbar__icon btn-add-breakpoint",disabled:this._locked,hint:this.tipAddGradientPoint}),this.btnAddGradientStep.on("click",i.bind(this.onAddGradientStep,this)),this.fillControls.push(this.btnAddGradientStep),this.btnRemoveGradientStep=new Common.UI.Button({parentEl:e("#shape-gradient-remove-step"),cls:"btn-toolbar",iconCls:"toolbar__icon btn-remove-breakpoint",disabled:this._locked,hint:this.tipRemoveGradientPoint}),this.btnRemoveGradientStep.on("click",i.bind(this.onRemoveGradientStep,this)),this.fillControls.push(this.btnRemoveGradientStep),this.numGradientAngle=new Common.UI.MetricSpinner({el:e("#shape-spin-gradient-angle"),step:10,width:60,defaultUnit:"°",value:"0 °",allowDecimal:!0,maxValue:359.9,minValue:0,disabled:this._locked}),this.fillControls.push(this.numGradientAngle),this.numGradientAngle.on("change",i.bind(this.onGradientAngleChange,this)),this.numGradientAngle.on("inputleave",function(){t.fireEvent("editcomplete",t)}),this.cmbBorderSize=new Common.UI.ComboBorderSizeEditable({el:e("#shape-combo-border-size"),style:"width: 93px;",txtNoBorders:this.txtNoBorders}).on("selected",i.bind(this.onBorderSizeSelect,this)).on("changed:before",i.bind(this.onBorderSizeChanged,this,!0)).on("changed:after",i.bind(this.onBorderSizeChanged,this,!1)).on("combo:blur",i.bind(this.onComboBlur,this,!1)),this.BorderSize=this.cmbBorderSize.store.at(2).get("value"),this.cmbBorderSize.setValue(this.BorderSize),this.lockedControls.push(this.cmbBorderSize),this.cmbBorderType=new Common.UI.ComboBorderType({el:e("#shape-combo-border-type"),style:"width: 93px;",menuStyle:"min-width: 93px;"}).on("selected",i.bind(this.onBorderTypeSelect,this)).on("combo:blur",i.bind(this.onComboBlur,this,!1)),this.BorderType=Asc.c_oDashType.solid,this.cmbBorderType.setValue(this.BorderType),this.lockedControls.push(this.cmbBorderType),this.btnChangeShape=new Common.UI.Button({parentEl:e("#shape-btn-change"),cls:"btn-icon-default",iconCls:"btn-change-shape",menu:new Common.UI.Menu({menuAlign:"tr-br",cls:"menu-shapes",items:[]})}),this.lockedControls.push(this.btnChangeShape),this.btnRotate270=new Common.UI.Button({parentEl:e("#shape-button-270",t.$el),cls:"btn-toolbar",iconCls:"toolbar__icon btn-rotate-270",value:0,hint:this.textHint270}),this.btnRotate270.on("click",i.bind(this.onBtnRotateClick,this)),this.lockedControls.push(this.btnRotate270),this.btnRotate90=new Common.UI.Button({parentEl:e("#shape-button-90",t.$el),cls:"btn-toolbar",iconCls:"toolbar__icon btn-rotate-90",value:1,hint:this.textHint90}),this.btnRotate90.on("click",i.bind(this.onBtnRotateClick,this)),this.lockedControls.push(this.btnRotate90),this.btnFlipV=new Common.UI.Button({parentEl:e("#shape-button-flipv",t.$el),cls:"btn-toolbar",iconCls:"toolbar__icon btn-flip-vert",value:0,hint:this.textHintFlipV}),this.btnFlipV.on("click",i.bind(this.onBtnFlipClick,this)),this.lockedControls.push(this.btnFlipV),this.btnFlipH=new Common.UI.Button({parentEl:e("#shape-button-fliph",t.$el),cls:"btn-toolbar",iconCls:"toolbar__icon btn-flip-hor",value:1,hint:this.textHintFlipH}),this.btnFlipH.on("click",i.bind(this.onBtnFlipClick,this)),this.lockedControls.push(this.btnFlipH),this.chShadow=new Common.UI.CheckBox({el:e("#shape-checkbox-shadow"),labelText:this.strShadow}),this.chShadow.on("change",i.bind(this.onCheckShadow,this)),this.lockedControls.push(this.chShadow),this.linkAdvanced=e("#shape-advanced-link"),e(this.el).on("click","#shape-advanced-link",i.bind(this.openAdvancedSettings,this))},createDelayedElements:function(){this._initSettings=!1,this.createDelayedControls();var t=[0,1,3,2,4,53,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,22,23,24,25,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,49,50,51,52];this.patternViewData=[];for(var e=0;e<13;e++)for(var i=0;i<4;i++){var n=4*e+i;this.patternViewData[n]={offsetx:28*i,offsety:28*e,type:t[n]}}this.patternViewData.splice(this.patternViewData.length-2,2);for(var e=0;e0&&(this.cmbPattern.fillComboView(this.cmbPattern.menuPicker.store.at(0),!0),this.PatternFillType=this.patternViewData[0].type),this.onInitStandartTextures(),this.onApiAutoShapes(),this.UpdateThemeColors()},onInitStandartTextures:function(t){var n=this;if(t&&t.length>0&&(n._texturearray=[],i.each(t,function(t){n._texturearray.push({imageUrl:t.get_image(),name:n.textureNames[t.get_id()],type:t.get_id(),selected:!1})})),n._texturearray&&!(n._texturearray.length<1)&&!this._initSettings&&!this.btnTexture){this.btnTexture=new Common.UI.ComboBox({el:e("#shape-combo-fill-texture"),template:i.template(['"].join(""))}),this.textureMenu=new Common.UI.Menu({items:[{template:i.template('
    ')}]}),this.textureMenu.render(e("#shape-combo-fill-texture")),this.fillControls.push(this.btnTexture);var o=function(t){new Common.UI.DataView({el:e("#id-shape-menu-texture"),restoreHeight:174,parentMenu:t,showLast:!1,store:new Common.UI.DataViewStore(n._texturearray||[]),itemTemplate:i.template('
    ')}).on("item:click",i.bind(n.onSelectTexture,n)),t.off("show:before",o)};this.textureMenu.on("show:before",o)}},onSelectTexture:function(t,i,n){if(this._fromTextureCmb=!0,this.cmbFillType.setValue(this._arrFillType[1].value),this._fromTextureCmb=!1,this.api){var o=new Asc.asc_CShapeProperty,s=new Asc.asc_CShapeFill;s.put_type(Asc.c_oAscFill.FILL_TYPE_BLIP),s.put_fill(new Asc.asc_CFillBlip),s.get_fill().put_type(Asc.c_oAscFillBlipType.TILE),s.get_fill().put_texture_id(n.get("type")),o.put_fill(s),this.api.ShapeApply(o)}e(this.btnTexture.el).find(".form-control").prop("innerHTML",n.get("name")),this.fireEvent("editcomplete",this)},onCheckShadow:function(t,e,i,n){if(this.api){var o=new Asc.asc_CShapeProperty;o.asc_putShadow("checked"==t.getValue()?new Asc.asc_CShadowProperty:null),this.api.ShapeApply(o)}this.fireEvent("editcomplete",this)},onApiAutoShapes:function(){var t=this,e=function(i){t.fillAutoShapes(),i.off("show:before",e)};t.btnChangeShape.menu.on("show:before",e)},fillAutoShapes:function(){var t=this,n=this.application.getCollection("ShapeGroups"),o=n.length,s=function(a){for(var l=-1;l0;l++){var r=n.at(l>-1?l:0).get("groupStore");l<0&&(r=r.clone(),r.shift());new Common.UI.DataViewSimple({el:e("#id-shape-menu-shapegroup"+(l+1),a.items[l+1].$el),store:r,parentMenu:a.items[l+1].menu,itemTemplate:i.template('
    ')}).on("item:click",function(e,i,n,o){t.api&&(t.api.ChangeShapeType(n.get("data").shapeType),t.fireEvent("editcomplete",t)),"click"!==o.type&&t.btnChangeShape.menu.hide()})}a.off("show:after",s)};t.btnChangeShape.menu.on("show:after",s);for(var a=-1;a0;a++){var l=n.at(a>-1?a:a+1),r=new Common.UI.MenuItem({caption:l.get("groupName"),menu:new Common.UI.Menu({menuAlign:"tr-tl",items:[{template:i.template('')}]})});t.btnChangeShape.menu.addItem(r)}t.btnChangeShape.menu.items[0].setVisible(t._state.isFromImage),t.btnChangeShape.menu.items[1].setVisible(!t._state.isFromImage)},UpdateThemeColors:function(){this._initSettings||(this.btnBackColor||(this.btnBackColor=new Common.UI.ColorButton({parentEl:e("#shape-back-color-btn"),transparent:!0,color:"transparent"}),this.fillControls.push(this.btnBackColor),this.colorsBack=this.btnBackColor.getPicker(),this.btnBackColor.on("color:select",i.bind(this.onColorsBackSelect,this)),this.btnFGColor=new Common.UI.ColorButton({parentEl:e("#shape-foreground-color-btn"),color:"000000"}),this.fillControls.push(this.btnFGColor),this.colorsFG=this.btnFGColor.getPicker(),this.btnFGColor.on("color:select",i.bind(this.onColorsFGSelect,this)),this.btnBGColor=new Common.UI.ColorButton({parentEl:e("#shape-background-color-btn"),color:"ffffff"}),this.fillControls.push(this.btnBGColor),this.colorsBG=this.btnBGColor.getPicker(),this.btnBGColor.on("color:select",i.bind(this.onColorsBGSelect,this)),this.btnGradColor=new Common.UI.ColorButton({parentEl:e("#shape-gradient-color-btn"),color:"000000"}),this.fillControls.push(this.btnGradColor),this.colorsGrad=this.btnGradColor.getPicker(),this.btnGradColor.on("color:select",i.bind(this.onColorsGradientSelect,this)),this.btnBorderColor=new Common.UI.ColorButton({parentEl:e("#shape-border-color-btn"),color:"000000"}),this.lockedControls.push(this.btnBorderColor),this.colorsBorder=this.btnBorderColor.getPicker(),this.btnBorderColor.on("color:select",i.bind(this.onColorsBorderSelect,this))),this.colorsBorder.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors()),this.colorsBack.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors()),this.colorsFG.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors()),this.colorsBG.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors()),this.colorsGrad.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors()))},onBtnRotateClick:function(t){var e=new Asc.asc_CShapeProperty;e.asc_putRotAdd(3.14159265358979*(1==t.options.value?90:270)/180),this.api.ShapeApply(e),this.fireEvent("editcomplete",this)},onBtnFlipClick:function(t){var e=new Asc.asc_CShapeProperty;1==t.options.value?e.asc_putFlipHInvert(!0):e.asc_putFlipVInvert(!0),this.api.ShapeApply(e),this.fireEvent("editcomplete",this)},_pt2mm:function(t){return 25.4*t/72},_mm2pt:function(t){return 72*t/25.4},disableFillPanels:function(t){this._state.DisabledFillPanels!==t&&(this._state.DisabledFillPanels=t,i.each(this.fillControls,function(e){e.setDisabled(t)}),this.lblTransparencyStart.toggleClass("disabled",t),this.lblTransparencyEnd.toggleClass("disabled",t),this.numGradientAngle.setDisabled(t||this.GradFillType!==Asc.c_oAscFillGradType.GRAD_LINEAR))},ShowHideElem:function(t){this.FillColorContainer.toggleClass("settings-hidden",t!==Asc.c_oAscFill.FILL_TYPE_SOLID),this.FillImageContainer.toggleClass("settings-hidden",t!==Asc.c_oAscFill.FILL_TYPE_BLIP),this.FillPatternContainer.toggleClass("settings-hidden",t!==Asc.c_oAscFill.FILL_TYPE_PATT),this.FillGradientContainer.toggleClass("settings-hidden",t!==Asc.c_oAscFill.FILL_TYPE_GRAD),this.TransparencyContainer.toggleClass("settings-hidden",t===Asc.c_oAscFill.FILL_TYPE_NOFILL||null===t)},setLocked:function(t){this._locked=t},disableControls:function(t,e){this._initSettings||(this.disableFillPanels(t||e),this._state.DisabledControls!==t&&(this._state.DisabledControls=t,i.each(this.lockedControls,function(e){e.setDisabled(t)}),this.linkAdvanced.toggleClass("disabled",t)))},hideShapeOnlySettings:function(t){this._state.HideShapeOnlySettings!==t&&(this._state.HideShapeOnlySettings=t,this.ShapeOnlySettings.toggleClass("hidden",1==t))},hideChangeTypeSettings:function(t){this._state.HideChangeTypeSettings!==t&&(this._state.HideChangeTypeSettings=t,this.CanChangeType.toggleClass("hidden",1==t))},onPositionChange:function(t){var e=t.getNumberValue(),i=this.GradColor.currentIdx-1<0?0:this.GradColor.values[this.GradColor.currentIdx-1],n=this.GradColor.currentIdx+1n;if(this.api){this.GradColor.values[this.GradColor.currentIdx]=e;var s=new Asc.asc_CShapeProperty,a=new Asc.asc_CShapeFill;a.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD),a.put_fill(new Asc.asc_CFillGrad),a.get_fill().put_grad_type(this.GradFillType);var l=[];this.GradColor.values.forEach(function(t){l.push(1e3*t)}),a.get_fill().put_positions(l),s.put_fill(a),this.api.ShapeApply(s),o&&(this.sldrGradient.sortThumbs(),this.sldrGradient.trigger("change",this.sldrGradient),this.sldrGradient.trigger("changecomplete",this.sldrGradient))}},onAddGradientStep:function(){if(!(this.GradColor.colors.length>9)){var t=this.GradColor.currentIdx,e=(this.GradColor.values[t]+this.GradColor.values[t=this.GradColor.colors.length){var e=t>0?t-1:t;e=0===e&&this.GradColor.values.length>2?this.GradColor.values.length-2:e,this.GradColor.currentIdx=e}this.sldrGradient.setActiveThumb(this.GradColor.currentIdx),this.sldrGradient.trigger("change",this.sldrGradient),this.sldrGradient.trigger("changecomplete",this.sldrGradient)}},onGradientAngleChange:function(t,e,i,n){if(this.api&&!this._noApply){var o=new Asc.asc_CShapeProperty,s=new Asc.asc_CShapeFill;s.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD),s.put_fill(new Asc.asc_CFillGrad),s.get_fill().put_grad_type(this.GradFillType),s.get_fill().put_linear_angle(6e4*t.getNumberValue()),s.get_fill().put_linear_scale(!0),o.put_fill(s),this.api.ShapeApply(o)}},txtNoBorders:"No Line",strStroke:"Stroke",strColor:"Color",strSize:"Size",strChange:"Change Autoshape",strFill:"Fill",textColor:"Color Fill",textImageTexture:"Picture or Texture",textTexture:"From Texture",textFromUrl:"From URL",textFromFile:"From File",textStretch:"Stretch",textTile:"Tile",txtCanvas:"Canvas",txtCarton:"Carton",txtDarkFabric:"Dark Fabric",txtGrain:"Grain",txtGranite:"Granite",txtGreyPaper:"Grey Paper",txtKnit:"Knit",txtLeather:"Leather",txtBrownPaper:"Brown Paper",txtPapyrus:"Papyrus",txtWood:"Wood",textAdvanced:"Show advanced settings",strTransparency:"Opacity",textNoFill:"No Fill",textSelectTexture:"Select",textGradientFill:"Gradient Fill",textPatternFill:"Pattern",strBackground:"Background color",strForeground:"Foreground color",strPattern:"Pattern",textEmptyPattern:"No Pattern",textLinear:"Linear", +textRadial:"Radial",textDirection:"Direction",textStyle:"Style",textGradient:"Gradient Points",textBorderSizeErr:"The entered value is incorrect.
    Please enter a value between 0 pt and 1584 pt.",strType:"Type",textRotation:"Rotation",textRotate90:"Rotate 90°",textFlip:"Flip",textHint270:"Rotate 90° Counterclockwise",textHint90:"Rotate 90° Clockwise",textHintFlipV:"Flip Vertically",textHintFlipH:"Flip Horizontally",strShadow:"Show shadow",textFromStorage:"From Storage",textSelectImage:"Select Picture",textPosition:"Position",tipAddGradientPoint:"Add gradient point",tipRemoveGradientPoint:"Remove gradient point",textAngle:"Angle"},PE.Views.ShapeSettings||{}))}),define("text!presentationeditor/main/app/template/SlideSettings.template",[],function(){return'\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n \r\n \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    '}),define("presentationeditor/main/app/view/SlideSettings",["text!presentationeditor/main/app/template/SlideSettings.template","jquery","underscore","backbone","common/main/lib/component/ComboBox","common/main/lib/component/MetricSpinner","common/main/lib/component/ThemeColorPalette","common/main/lib/component/ColorButton","common/main/lib/component/ComboDataView","common/main/lib/component/MultiSliderGradient","common/main/lib/view/ImageFromUrlDialog"],function(t,e,i,n){"use strict";PE.Views.SlideSettings=n.View.extend(i.extend({el:"#id-slide-settings",template:i.template(t),events:{},options:{alias:"SlideSettings"},initialize:function(){this._initSettings=!0,this._originalProps=null,this._noApply=!0,this._sendUndoPoint=!0,this._sliderChanged=!1,this._texturearray=null,this.FillItems=[],this._locked={background:!1,effects:!1,timing:!1,header:!1},this._stateDisabled={},this._state={FillType:void 0,SlideColor:"ffffff",BlipFillType:Asc.c_oAscFillBlipType.STRETCH,FGColor:"000000",BGColor:"ffffff",GradColor:"000000",GradFillType:Asc.c_oAscFillGradType.GRAD_LINEAR},this.OriginalFillType=void 0,this.SlideColor={Value:1,Color:"ffffff"},this.BlipFillType=Asc.c_oAscFillBlipType.STRETCH,this.Effect=Asc.c_oAscSlideTransitionTypes.None,this.EffectType=void 0,this.GradFillType=Asc.c_oAscFillGradType.GRAD_LINEAR,this.GradColor={values:[0,100],colors:["000000","ffffff"],currentIdx:0},this.GradRadialDirectionIdx=0,this.GradLinearDirectionType=0,this.PatternFillType=0,this.FGColor={Value:1,Color:"000000"},this.BGColor={Value:1,Color:"ffffff"},this.textureNames=[this.txtCanvas,this.txtCarton,this.txtDarkFabric,this.txtGrain,this.txtGranite,this.txtGreyPaper,this.txtKnit,this.txtLeather,this.txtBrownPaper,this.txtPapyrus,this.txtWood],this.render();var t=this;this._arrFillSrc=[{displayValue:this.textColor,value:Asc.c_oAscFill.FILL_TYPE_SOLID},{displayValue:this.textGradientFill,value:Asc.c_oAscFill.FILL_TYPE_GRAD},{displayValue:this.textImageTexture,value:Asc.c_oAscFill.FILL_TYPE_BLIP},{displayValue:this.textPatternFill,value:Asc.c_oAscFill.FILL_TYPE_PATT},{displayValue:this.textNoFill,value:Asc.c_oAscFill.FILL_TYPE_NOFILL}],this.cmbFillSrc=new Common.UI.ComboBox({el:e("#slide-combo-fill-src"),cls:"input-group-nr",style:"width: 100%;",menuStyle:"min-width: 100%;",editable:!1,data:this._arrFillSrc,disabled:!0}),this.cmbFillSrc.setValue(Asc.c_oAscFill.FILL_TYPE_SOLID),this.cmbFillSrc.on("selected",i.bind(this.onFillSrcSelect,this)),this.btnBackColor=new Common.UI.ColorButton({parentEl:e("#slide-back-color-btn"),disabled:!0,transparent:!0,menu:!0,color:"ffffff"}),this.FillItems.push(this.btnBackColor),this.FillColorContainer=e("#slide-panel-color-fill"),this.FillImageContainer=e("#slide-panel-image-fill"),this.FillPatternContainer=e("#slide-panel-pattern-fill"),this.FillGradientContainer=e("#slide-panel-gradient-fill"),this._arrEffectName=[{displayValue:this.textNone,value:Asc.c_oAscSlideTransitionTypes.None},{displayValue:this.textFade,value:Asc.c_oAscSlideTransitionTypes.Fade},{displayValue:this.textPush,value:Asc.c_oAscSlideTransitionTypes.Push},{displayValue:this.textWipe,value:Asc.c_oAscSlideTransitionTypes.Wipe},{displayValue:this.textSplit,value:Asc.c_oAscSlideTransitionTypes.Split},{displayValue:this.textUnCover,value:Asc.c_oAscSlideTransitionTypes.UnCover},{displayValue:this.textCover,value:Asc.c_oAscSlideTransitionTypes.Cover},{displayValue:this.textClock,value:Asc.c_oAscSlideTransitionTypes.Clock},{displayValue:this.textZoom,value:Asc.c_oAscSlideTransitionTypes.Zoom}],this.cmbEffectName=new Common.UI.ComboBox({el:e("#slide-combo-effect-name"),cls:"input-group-nr",style:"width: 100%;",menuStyle:"min-width: 100%;",editable:!1,data:this._arrEffectName,disabled:!0}),this.cmbEffectName.setValue(""),this.cmbEffectName.on("selected",i.bind(this.onEffectNameSelect,this)),this._arrEffectType=[{displayValue:this.textSmoothly,value:Asc.c_oAscSlideTransitionParams.Fade_Smoothly},{displayValue:this.textBlack,value:Asc.c_oAscSlideTransitionParams.Fade_Through_Black},{displayValue:this.textLeft,value:Asc.c_oAscSlideTransitionParams.Param_Left},{displayValue:this.textTop,value:Asc.c_oAscSlideTransitionParams.Param_Top},{displayValue:this.textRight,value:Asc.c_oAscSlideTransitionParams.Param_Right},{displayValue:this.textBottom,value:Asc.c_oAscSlideTransitionParams.Param_Bottom},{displayValue:this.textTopLeft,value:Asc.c_oAscSlideTransitionParams.Param_TopLeft},{displayValue:this.textTopRight,value:Asc.c_oAscSlideTransitionParams.Param_TopRight},{displayValue:this.textBottomLeft,value:Asc.c_oAscSlideTransitionParams.Param_BottomLeft},{displayValue:this.textBottomRight,value:Asc.c_oAscSlideTransitionParams.Param_BottomRight},{displayValue:this.textVerticalIn,value:Asc.c_oAscSlideTransitionParams.Split_VerticalIn},{displayValue:this.textVerticalOut,value:Asc.c_oAscSlideTransitionParams.Split_VerticalOut},{displayValue:this.textHorizontalIn,value:Asc.c_oAscSlideTransitionParams.Split_HorizontalIn},{displayValue:this.textHorizontalOut,value:Asc.c_oAscSlideTransitionParams.Split_HorizontalOut},{displayValue:this.textClockwise,value:Asc.c_oAscSlideTransitionParams.Clock_Clockwise},{displayValue:this.textCounterclockwise,value:Asc.c_oAscSlideTransitionParams.Clock_Counterclockwise},{displayValue:this.textWedge,value:Asc.c_oAscSlideTransitionParams.Clock_Wedge},{displayValue:this.textZoomIn,value:Asc.c_oAscSlideTransitionParams.Zoom_In},{displayValue:this.textZoomOut,value:Asc.c_oAscSlideTransitionParams.Zoom_Out},{displayValue:this.textZoomRotate,value:Asc.c_oAscSlideTransitionParams.Zoom_AndRotate}],this.cmbEffectType=new Common.UI.ComboBox({el:e("#slide-combo-effect-type"),cls:"input-group-nr",style:"width: 100%;",menuStyle:"min-width: 100%;",editable:!1,data:this._arrEffectType,disabled:!0}),this.cmbEffectType.setValue(""),this.cmbEffectType.on("selected",i.bind(this.onEffectTypeSelect,this)),this.numDuration=new Common.UI.MetricSpinner({el:e("#slide-spin-duration"),step:1,width:70,value:"",defaultUnit:this.textSec,maxValue:300,minValue:0,disabled:!0}),this.numDuration.on("change",i.bind(this.onDurationChange,this)),this.numDuration.on("inputleave",function(){t.fireEvent("editcomplete",t)}),this.numDelay=new Common.UI.MetricSpinner({el:e("#slide-spin-delay"),step:1,width:70,value:"",defaultUnit:this.textSec,maxValue:300,minValue:0,disabled:!0}),this.numDelay.on("change",i.bind(this.onDelayChange,this)),this.numDelay.on("inputleave",function(){t.fireEvent("editcomplete",t)}),this.chStartOnClick=new Common.UI.CheckBox({el:e("#slide-checkbox-start-click"),labelText:this.strStartOnClick,disabled:!0}),this.chStartOnClick.on("change",i.bind(this.onStartOnClickChange,this)),this.chDelay=new Common.UI.CheckBox({el:e("#slide-checkbox-delay"),labelText:this.strDelay,disabled:!0}),this.chDelay.on("change",i.bind(this.onCheckDelayChange,this)),this.btnPreview=new Common.UI.Button({el:e("#slide-button-preview"),disabled:!0}),this.btnPreview.on("click",i.bind(function(t){this.api&&this.api.SlideTransitionPlay(),this.fireEvent("editcomplete",this)},this)),this.btnApplyToAll=new Common.UI.Button({el:e("#slide-button-apply-all"),disabled:!0}),this.btnApplyToAll.on("click",i.bind(function(t){this.api&&this.api.SlideTimingApplyToAll(),this.fireEvent("editcomplete",this)},this)),this.chSlideNum=new Common.UI.CheckBox({el:e("#slide-checkbox-slidenum"),labelText:this.strSlideNum,disabled:!0}),this.chSlideNum.on("change",i.bind(this.onHeaderChange,this,"slidenum")),this.chDateTime=new Common.UI.CheckBox({el:e("#slide-checkbox-datetime"),labelText:this.strDateTime,disabled:!0}),this.chDateTime.on("change",i.bind(this.onHeaderChange,this,"datetime"))},render:function(){e(this.el).html(this.template({scope:this}))},setApi:function(t){return this.api=t,this.api&&(this.api.SetInterfaceDrawImagePlaceSlide("slide-texture-img"),this.api.asc_registerCallback("asc_onInitStandartTextures",i.bind(this.onInitStandartTextures,this))),Common.NotificationCenter.on("storage:image-insert",i.bind(this.insertImageFromStorage,this)),this},setMode:function(t){this.mode=t},onFillSrcSelect:function(t,e){switch(this.ShowHideElem(e.value),e.value){case Asc.c_oAscFill.FILL_TYPE_SOLID:if(this._state.FillType=Asc.c_oAscFill.FILL_TYPE_SOLID,!this._noApply){var i=new Asc.CAscSlideProps,n=new Asc.asc_CShapeFill;n.put_type(Asc.c_oAscFill.FILL_TYPE_SOLID),n.put_fill(new Asc.asc_CFillSolid),n.get_fill().put_color(Common.Utils.ThemeColor.getRgbColor("transparent"==this.SlideColor.Color?{color:"4f81bd",effectId:24}:this.SlideColor.Color)),i.put_background(n),this.api.SetSlideProps(i)}break;case Asc.c_oAscFill.FILL_TYPE_GRAD:if(this._state.FillType=Asc.c_oAscFill.FILL_TYPE_GRAD,!this._noApply){var i=new Asc.CAscSlideProps,n=new Asc.asc_CShapeFill;if(n.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD),n.put_fill(new Asc.asc_CFillGrad),n.get_fill().put_grad_type(this.GradFillType),this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR&&(n.get_fill().put_linear_angle(6e4*this.GradLinearDirectionType),n.get_fill().put_linear_scale(!0)),this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_GRAD){this.GradColor.values=[0,100],this.GradColor.colors=[this.GradColor.colors[0],this.GradColor.colors[this.GradColor.colors.length-1]],this.GradColor.currentIdx=0;var o=Common.Utils.ThemeColor.getRgbColor(this.GradColor.colors[0]).get_color().get_hex(),s=Common.Utils.ThemeColor.getRgbColor(this.GradColor.colors[1]).get_color().get_hex();o="ffffff"===o&&"ffffff"===s?{color:"4f81bd",effectId:24}:this.GradColor.colors[0],n.get_fill().put_positions([1e3*this.GradColor.values[0],1e3*this.GradColor.values[1]]),n.get_fill().put_colors([Common.Utils.ThemeColor.getRgbColor(o),Common.Utils.ThemeColor.getRgbColor(this.GradColor.colors[1])])}i.put_background(n),this.api.SetSlideProps(i)}break;case Asc.c_oAscFill.FILL_TYPE_BLIP:this._state.FillType=Asc.c_oAscFill.FILL_TYPE_BLIP;break;case Asc.c_oAscFill.FILL_TYPE_PATT:if(this._state.FillType=Asc.c_oAscFill.FILL_TYPE_PATT,!this._noApply){var i=new Asc.CAscSlideProps,n=new Asc.asc_CShapeFill;n.put_type(Asc.c_oAscFill.FILL_TYPE_PATT),n.put_fill(new Asc.asc_CFillHatch),n.get_fill().put_pattern_type(this.PatternFillType);var a=Common.Utils.ThemeColor.getRgbColor(this.FGColor.Color).get_color().get_hex();a="ffffff"===Common.Utils.ThemeColor.getRgbColor(this.BGColor.Color).get_color().get_hex()&&"ffffff"===a?{color:"4f81bd",effectId:24}:this.FGColor.Color,n.get_fill().put_color_fg(Common.Utils.ThemeColor.getRgbColor(a)),n.get_fill().put_color_bg(Common.Utils.ThemeColor.getRgbColor(this.BGColor.Color)),i.put_background(n),this.api.SetSlideProps(i)}break;case Asc.c_oAscFill.FILL_TYPE_NOFILL:if(this._state.FillType=Asc.c_oAscFill.FILL_TYPE_NOFILL,!this._noApply){var i=new Asc.CAscSlideProps,n=new Asc.asc_CShapeFill;n.put_type(Asc.c_oAscFill.FILL_TYPE_NOFILL),n.put_fill(null),i.put_background(n),this.api.SetSlideProps(i)}}this.fireEvent("editcomplete",this)},onColorsBackSelect:function(t,e){if(this.SlideColor={Value:1,Color:e},this.api&&!this._noApply){var i=new Asc.CAscSlideProps,n=new Asc.asc_CShapeFill;"transparent"==this.SlideColor.Color?(n.put_type(Asc.c_oAscFill.FILL_TYPE_NOFILL),n.put_fill(null)):(n.put_type(Asc.c_oAscFill.FILL_TYPE_SOLID),n.put_fill(new Asc.asc_CFillSolid),n.get_fill().put_color(Common.Utils.ThemeColor.getRgbColor(this.SlideColor.Color))),i.put_background(n),this.api.SetSlideProps(i)}this.fireEvent("editcomplete",this)},onPatternSelect:function(t,e){if(this.api&&!this._noApply){this.PatternFillType=e.get("type");var i=new Asc.CAscSlideProps,n=new Asc.asc_CShapeFill;n.put_type(Asc.c_oAscFill.FILL_TYPE_PATT),n.put_fill(new Asc.asc_CFillHatch),n.get_fill().put_pattern_type(this.PatternFillType),this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_PATT&&(n.get_fill().put_color_fg(Common.Utils.ThemeColor.getRgbColor(this.FGColor.Color)),n.get_fill().put_color_bg(Common.Utils.ThemeColor.getRgbColor(this.BGColor.Color))),i.put_background(n),this.api.SetSlideProps(i)}this.fireEvent("editcomplete",this)},onColorsFGSelect:function(t,e){if(this.FGColor={Value:1,Color:e},this.api&&!this._noApply){var i=new Asc.CAscSlideProps,n=new Asc.asc_CShapeFill;n.put_type(Asc.c_oAscFill.FILL_TYPE_PATT),n.put_fill(new Asc.asc_CFillHatch),n.get_fill().put_color_fg(Common.Utils.ThemeColor.getRgbColor(this.FGColor.Color)),this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_PATT&&(n.get_fill().put_pattern_type(this.PatternFillType),n.get_fill().put_color_bg(Common.Utils.ThemeColor.getRgbColor(this.BGColor.Color))),i.put_background(n),this.api.SetSlideProps(i)}this.fireEvent("editcomplete",this)},onColorsBGSelect:function(t,e){if(this.BGColor={Value:1,Color:e},this.api&&!this._noApply){var i=new Asc.CAscSlideProps,n=new Asc.asc_CShapeFill;n.put_type(Asc.c_oAscFill.FILL_TYPE_PATT),n.put_fill(new Asc.asc_CFillHatch),this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_PATT&&(n.get_fill().put_pattern_type(this.PatternFillType),n.get_fill().put_color_fg(Common.Utils.ThemeColor.getRgbColor(this.FGColor.Color))),n.get_fill().put_color_bg(Common.Utils.ThemeColor.getRgbColor(this.BGColor.Color)),i.put_background(n),this.api.SetSlideProps(i)}this.fireEvent("editcomplete",this)},onFillTypeSelect:function(t,e){if(this.BlipFillType=e.value,this.api&&!0!==this._fromTextureCmb&&this.OriginalFillType==Asc.c_oAscFill.FILL_TYPE_BLIP){var i=new Asc.CAscSlideProps,n=new Asc.asc_CShapeFill;n.put_type(Asc.c_oAscFill.FILL_TYPE_BLIP),n.put_fill(new Asc.asc_CFillBlip),n.get_fill().put_type(this.BlipFillType),i.put_background(n),this.api.SetSlideProps(i)}this.fireEvent("editcomplete",this)},onGradTypeSelect:function(t,e){if(this.GradFillType=e.value,this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR){this.mnuDirectionPicker.store.reset(this._viewDataLinear),this.mnuDirectionPicker.cmpEl.width(175),this.mnuDirectionPicker.restoreHeight=174;var e=this.mnuDirectionPicker.store.findWhere({type:this.GradLinearDirectionType});this.mnuDirectionPicker.selectRecord(e,!0),e?this.btnDirection.setIconCls("item-gradient "+e.get("iconcls")):this.btnDirection.setIconCls(""),this.numGradientAngle.setValue(this.GradLinearDirectionType,!0),this.numGradientAngle.setDisabled(this._locked.background)}else this.GradFillType==Asc.c_oAscFillGradType.GRAD_PATH&&(this.mnuDirectionPicker.store.reset(this._viewDataRadial),this.mnuDirectionPicker.cmpEl.width(60),this.mnuDirectionPicker.restoreHeight=58,this.mnuDirectionPicker.selectByIndex(this.GradRadialDirectionIdx,!0),this.GradRadialDirectionIdx>=0?this.btnDirection.setIconCls("item-gradient "+this._viewDataRadial[this.GradRadialDirectionIdx].iconcls):this.btnDirection.setIconCls(""),this.numGradientAngle.setValue(0,!0),this.numGradientAngle.setDisabled(!0));if(this.api&&!this._noApply){var i=new Asc.CAscSlideProps,n=new Asc.asc_CShapeFill;n.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD),n.put_fill(new Asc.asc_CFillGrad),n.get_fill().put_grad_type(this.GradFillType),this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR&&(n.get_fill().put_linear_angle(6e4*this.GradLinearDirectionType),n.get_fill().put_linear_scale(!0)),i.put_background(n),this.api.SetSlideProps(i)}this.fireEvent("editcomplete",this)},onSelectGradient:function(t,e,n,o){if(!this._noApply){var s={};if(i.isFunction(o.toJSON)){if(!o.get("selected"))return;s=o.toJSON()}else s=o;if(this.btnDirection.setIconCls("item-gradient "+s.iconcls),this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR?this.GradLinearDirectionType=s.type:this.GradRadialDirectionIdx=0,this.api&&this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR){this.numGradientAngle.setValue(s.type,!0);var a=new Asc.CAscSlideProps,l=new Asc.asc_CShapeFill;l.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD),l.put_fill(new Asc.asc_CFillGrad),l.get_fill().put_grad_type(this.GradFillType),l.get_fill().put_linear_angle(6e4*s.type),l.get_fill().put_linear_scale(!0),a.put_background(l),this.api.SetSlideProps(a)}this.fireEvent("editcomplete",this)}},onColorsGradientSelect:function(t,e){if(this.GradColor.colors[this.GradColor.currentIdx]=e,this.sldrGradient.setColorValue(Common.Utils.String.format("#{0}","object"==typeof e?e.color:e)),this.api&&!this._noApply){var i=new Asc.CAscSlideProps,n=new Asc.asc_CShapeFill;n.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD),n.put_fill(new Asc.asc_CFillGrad),n.get_fill().put_grad_type(this.GradFillType);var o=[];this.GradColor.colors.forEach(function(t){o.push(Common.Utils.ThemeColor.getRgbColor(t))}),n.get_fill().put_colors(o),this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_GRAD&&(this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR&&(n.get_fill().put_linear_angle(6e4*this.GradLinearDirectionType),n.get_fill().put_linear_scale(!0)),o=[],this.GradColor.values.forEach(function(t){o.push(1e3*t)}),n.get_fill().put_positions(o)),i.put_background(n),this.api.SetSlideProps(i)}this.fireEvent("editcomplete",this)},onGradientChange:function(t,e,n){this.GradColor.values=t.getValues(),this.spnGradPosition.setValue(this.GradColor.values[this.GradColor.currentIdx],!0),this._sliderChanged=!0,this.api&&!this._noApply&&this._sendUndoPoint&&(this.api.setStartPointHistory(),this._sendUndoPoint=!1,this.updateslider=setInterval(i.bind(this._gradientApplyFunc,this),100))},onGradientChangeComplete:function(t,e,i){clearInterval(this.updateslider),this._sliderChanged=!0,this._sendUndoPoint||(this.api.setEndPointHistory(),this._gradientApplyFunc()),this._sendUndoPoint=!0},_gradientApplyFunc:function(){if(this._sliderChanged){var t=new Asc.CAscSlideProps,e=new Asc.asc_CShapeFill;e.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD),e.put_fill(new Asc.asc_CFillGrad),e.get_fill().put_grad_type(this.GradFillType);var i=[];this.GradColor.values.forEach(function(t){i.push(1e3*t)}),e.get_fill().put_positions(i),this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_GRAD&&(this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR&&(e.get_fill().put_linear_angle(6e4*this.GradLinearDirectionType),e.get_fill().put_linear_scale(!0)),i=[],this.GradColor.colors.forEach(function(t){i.push(Common.Utils.ThemeColor.getRgbColor(t))}),e.get_fill().put_colors(i)),t.put_background(e),this.api.SetSlideProps(t),this._sliderChanged=!1}},setImageUrl:function(t,e){if(null!==this.BlipFillType){var i=new Asc.CAscSlideProps,n=new Asc.asc_CShapeFill;n.put_type(Asc.c_oAscFill.FILL_TYPE_BLIP),n.put_fill(new Asc.asc_CFillBlip),n.get_fill().put_type(this.BlipFillType),n.get_fill().put_url(t,e),i.put_background(n),this.api.SetSlideProps(i)}},insertImageFromStorage:function(t){t&&t.url&&"slide"==t.c&&this.setImageUrl(t.url,t.token)},onImageSelect:function(t,e){if(1==e.value){var n=this;new Common.Views.ImageFromUrlDialog({handler:function(t,e){if("ok"==t&&n.api){var o=e.replace(/ /g,"");i.isEmpty(o)||n.setImageUrl(o)}n.fireEvent("editcomplete",n)}}).show()}else 2==e.value?Common.NotificationCenter.trigger("storage:image-load","slide"):(this.api&&this.api.ChangeSlideImageFromFile(this.BlipFillType),this.fireEvent("editcomplete",this))},createDelayedControls:function(){var t=this;this.cmbPattern=new Common.UI.ComboDataView({itemWidth:28,itemHeight:28,menuMaxHeight:300,enableKeyEvents:!0,cls:"combo-pattern"}),this.cmbPattern.menuPicker.itemTemplate=this.cmbPattern.fieldPicker.itemTemplate=i.template(['
    ','',"
    "].join("")),this.cmbPattern.render(e("#slide-combo-pattern")),this.cmbPattern.openButton.menu.cmpEl.css({"min-width":178,"max-width":178}),this.cmbPattern.on("click",i.bind(this.onPatternSelect,this)),this.FillItems.push(this.cmbPattern),this.btnSelectImage=new Common.UI.Button({parentEl:e("#slide-button-replace"),cls:"btn-text-menu-default",caption:this.textSelectImage,style:"width:100%;",menu:new Common.UI.Menu({style:"min-width: 194px;",maxHeight:200,items:[{caption:this.textFromFile,value:0},{caption:this.textFromUrl,value:1},{caption:this.textFromStorage,value:2}]})}),this.FillItems.push(this.btnSelectImage),this.btnSelectImage.menu.on("item:click",i.bind(this.onImageSelect,this)),this.btnSelectImage.menu.items[2].setVisible(this.mode.canRequestInsertImage||this.mode.fileChoiceUrl&&this.mode.fileChoiceUrl.indexOf("{documentType}")>-1),this._arrFillType=[{displayValue:this.textStretch,value:Asc.c_oAscFillBlipType.STRETCH},{displayValue:this.textTile,value:Asc.c_oAscFillBlipType.TILE}],this.cmbFillType=new Common.UI.ComboBox({el:e("#slide-combo-fill-type"),cls:"input-group-nr",menuStyle:"min-width: 90px;",editable:!1,data:this._arrFillType}),this.cmbFillType.setValue(this._arrFillType[0].value),this.cmbFillType.on("selected",i.bind(this.onFillTypeSelect,this)),this.FillItems.push(this.cmbFillType),this._arrGradType=[{displayValue:this.textLinear,value:Asc.c_oAscFillGradType.GRAD_LINEAR},{displayValue:this.textRadial,value:Asc.c_oAscFillGradType.GRAD_PATH}],this.cmbGradType=new Common.UI.ComboBox({el:e("#slide-combo-grad-type"),cls:"input-group-nr",menuStyle:"min-width: 90px;",editable:!1,data:this._arrGradType}),this.cmbGradType.setValue(this._arrGradType[0].value),this.cmbGradType.on("selected",i.bind(this.onGradTypeSelect,this)),this.FillItems.push(this.cmbGradType),this._viewDataLinear=[{offsetx:0,offsety:0,type:45,subtype:-1,iconcls:"gradient-left-top"},{offsetx:50,offsety:0,type:90,subtype:4,iconcls:"gradient-top"},{offsetx:100,offsety:0,type:135,subtype:5,iconcls:"gradient-right-top"},{offsetx:0,offsety:50,type:0,subtype:6,iconcls:"gradient-left",cls:"item-gradient-separator",selected:!0},{offsetx:100,offsety:50,type:180,subtype:1,iconcls:"gradient-right"},{offsetx:0,offsety:100,type:315,subtype:2,iconcls:"gradient-left-bottom"},{offsetx:50,offsety:100,type:270,subtype:3,iconcls:"gradient-bottom"},{offsetx:100,offsety:100,type:225,subtype:7,iconcls:"gradient-right-bottom"}],this._viewDataRadial=[{offsetx:100,offsety:150,type:2,subtype:5,iconcls:"gradient-radial-center"}],this.btnDirection=new Common.UI.Button({cls:"btn-large-dataview",iconCls:"item-gradient gradient-left",menu:new Common.UI.Menu({style:"min-width: 60px;",menuAlign:"tr-br",items:[{template:i.template('
    ')}]})}),this.btnDirection.on("render:after",function(n){t.mnuDirectionPicker=new Common.UI.DataView({el:e("#id-slide-menu-direction"),parentMenu:n.menu,restoreHeight:174,store:new Common.UI.DataViewStore(t._viewDataLinear),itemTemplate:i.template('
    ')})}),this.btnDirection.render(e("#slide-button-direction")),this.mnuDirectionPicker.on("item:click",i.bind(this.onSelectGradient,this,this.btnDirection)),this.FillItems.push(this.btnDirection),this.sldrGradient=new Common.UI.MultiSliderGradient({el:e("#slide-slider-gradient"),width:192,minValue:0,maxValue:100,values:[0,100]}),this.sldrGradient.on("change",i.bind(this.onGradientChange,this)),this.sldrGradient.on("changecomplete",i.bind(this.onGradientChangeComplete,this)),this.sldrGradient.on("thumbclick",function(e,i){t.GradColor.currentIdx=i;var n=t.GradColor.colors[t.GradColor.currentIdx];t.btnGradColor.setColor(n), +t.colorsGrad.select(n,!1);var o=t.GradColor.values[t.GradColor.currentIdx];t.spnGradPosition.setValue(o,!0)}),this.sldrGradient.on("thumbdblclick",function(e){t.btnGradColor.cmpEl.find("button").dropdown("toggle")}),this.sldrGradient.on("sortthumbs",function(e,n){var o,s=[];i.each(n,function(e,i){s.push(t.GradColor.colors[e]),t.GradColor.currentIdx==e&&(o=i)}),t.OriginalFillType=null,t.GradColor.colors=s,t.GradColor.currentIdx=o}),this.sldrGradient.on("addthumb",function(e,i,n){t.GradColor.colors[i]=t.GradColor.colors[t.GradColor.currentIdx],t.GradColor.currentIdx=i;var o=t.sldrGradient.addNewThumb(i,n);t.GradColor.colors[t.GradColor.currentIdx]=o}),this.sldrGradient.on("removethumb",function(e,n){if(t.sldrGradient.removeThumb(n),t.GradColor.values.splice(n,1),t.sldrGradient.changeGradientStyle(),i.isUndefined(t.GradColor.currentIdx)||t.GradColor.currentIdx>=t.GradColor.colors.length){var o=n>0?n-1:n;o=0===o&&t.GradColor.values.length>2?t.GradColor.values.length-2:o,t.GradColor.currentIdx=o}t.sldrGradient.setActiveThumb(t.GradColor.currentIdx)}),this.FillItems.push(this.sldrGradient),this.spnGradPosition=new Common.UI.MetricSpinner({el:e("#slide-gradient-position"),step:1,width:60,defaultUnit:"%",value:"50 %",allowDecimal:!1,maxValue:100,minValue:0,disabled:this._locked.background}),this.FillItems.push(this.spnGradPosition),this.spnGradPosition.on("change",i.bind(this.onPositionChange,this)),this.spnGradPosition.on("inputleave",function(){t.fireEvent("editcomplete",t)}),this.btnAddGradientStep=new Common.UI.Button({parentEl:e("#slide-gradient-add-step"),cls:"btn-toolbar",iconCls:"toolbar__icon btn-add-breakpoint",disabled:this._locked.background,hint:this.tipAddGradientPoint}),this.btnAddGradientStep.on("click",i.bind(this.onAddGradientStep,this)),this.FillItems.push(this.btnAddGradientStep),this.btnRemoveGradientStep=new Common.UI.Button({parentEl:e("#slide-gradient-remove-step"),cls:"btn-toolbar",iconCls:"toolbar__icon btn-remove-breakpoint",disabled:this._locked.background,hint:this.tipRemoveGradientPoint}),this.btnRemoveGradientStep.on("click",i.bind(this.onRemoveGradientStep,this)),this.FillItems.push(this.btnRemoveGradientStep),this.numGradientAngle=new Common.UI.MetricSpinner({el:e("#slide-spin-gradient-angle"),step:10,width:60,defaultUnit:"°",value:"0 °",allowDecimal:!0,maxValue:359.9,minValue:0,disabled:this._locked.background}),this.FillItems.push(this.numGradientAngle),this.numGradientAngle.on("change",i.bind(this.onGradientAngleChange,this)),this.numGradientAngle.on("inputleave",function(){t.fireEvent("editcomplete",t)})},createDelayedElements:function(){this._initSettings=!1,this.createDelayedControls();var t=[0,1,3,2,4,53,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,22,23,24,25,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,49,50,51,52];this.patternViewData=[];for(var e=0;e<13;e++)for(var i=0;i<4;i++){var n=4*e+i;this.patternViewData[n]={offsetx:28*i,offsety:28*e,type:t[n]}}this.patternViewData.splice(this.patternViewData.length-2,2);for(var e=0;e0&&(this.cmbPattern.fillComboView(this.cmbPattern.menuPicker.store.at(0),!0),this.PatternFillType=this.patternViewData[0].type),this.onInitStandartTextures(),this.UpdateThemeColors()},onInitStandartTextures:function(t){var n=this;if(t&&t.length>0&&(n._texturearray=[],i.each(t,function(t){n._texturearray.push({imageUrl:t.get_image(),name:n.textureNames[t.get_id()],type:t.get_id(),selected:!1})})),n._texturearray&&!(n._texturearray.length<1)&&!this._initSettings&&!this.btnTexture){this.btnTexture=new Common.UI.ComboBox({el:e("#slide-combo-fill-texture"),template:i.template(['"].join(""))}),this.textureMenu=new Common.UI.Menu({items:[{template:i.template('
    ')}]}),this.textureMenu.render(e("#slide-combo-fill-texture")),this.FillItems.push(this.btnTexture);var o=function(t){new Common.UI.DataView({el:e("#id-slide-menu-texture"),restoreHeight:174,parentMenu:t,showLast:!1,store:new Common.UI.DataViewStore(n._texturearray||[]),itemTemplate:i.template('
    ')}).on("item:click",i.bind(n.onSelectTexture,n)),t.off("show:before",o)};this.textureMenu.on("show:before",o)}},onSelectTexture:function(t,i,n){if(this._fromTextureCmb=!0,this.cmbFillType.setValue(this._arrFillType[1].value),this._fromTextureCmb=!1,this.api){var o=new Asc.CAscSlideProps,s=new Asc.asc_CShapeFill;s.put_type(Asc.c_oAscFill.FILL_TYPE_BLIP),s.put_fill(new Asc.asc_CFillBlip),s.get_fill().put_type(Asc.c_oAscFillBlipType.TILE),s.get_fill().put_texture_id(n.get("type")),o.put_background(s),this.api.SetSlideProps(o)}e(this.btnTexture.el).find(".form-control").prop("innerHTML",n.get("name")),this.fireEvent("editcomplete",this)},fillEffectTypeCombo:function(t){var e=[];switch(t){case Asc.c_oAscSlideTransitionTypes.Fade:e.push(this._arrEffectType[0],this._arrEffectType[1]);break;case Asc.c_oAscSlideTransitionTypes.Push:e=this._arrEffectType.slice(2,6);break;case Asc.c_oAscSlideTransitionTypes.Wipe:e=this._arrEffectType.slice(2,10);break;case Asc.c_oAscSlideTransitionTypes.Split:e=this._arrEffectType.slice(10,14);break;case Asc.c_oAscSlideTransitionTypes.UnCover:case Asc.c_oAscSlideTransitionTypes.Cover:e=this._arrEffectType.slice(2,10);break;case Asc.c_oAscSlideTransitionTypes.Clock:e=this._arrEffectType.slice(14,17);break;case Asc.c_oAscSlideTransitionTypes.Zoom:e=this._arrEffectType.slice(17)}e.length>0?(this.cmbEffectType.store.reset(e),this.cmbEffectType.setValue(e[0].value),this.EffectType=e[0].value):(this.cmbEffectType.store.reset(),this.EffectType=void 0),this.cmbEffectType.setDisabled(e.length<1||this._locked.effects),this.numDuration.setDisabled(e.length<1||this._locked.effects),this.btnPreview.setDisabled(e.length<1||this._locked.effects)},onEffectNameSelect:function(t,e){var i=e.value;if(this.Effect!==i&&(this.Effect!==Asc.c_oAscSlideTransitionTypes.Wipe&&this.Effect!==Asc.c_oAscSlideTransitionTypes.UnCover&&this.Effect!==Asc.c_oAscSlideTransitionTypes.Cover||i!==Asc.c_oAscSlideTransitionTypes.Wipe&&i!==Asc.c_oAscSlideTransitionTypes.UnCover&&i!==Asc.c_oAscSlideTransitionTypes.Cover)&&this.fillEffectTypeCombo(i),this.Effect=i,this.api&&!this._noApply){var n=new Asc.CAscSlideProps,o=new Asc.CAscSlideTiming;o.put_TransitionType(i),o.put_TransitionOption(this.EffectType),n.put_timing(o),this.api.SetSlideProps(n)}this.fireEvent("editcomplete",this)},onEffectTypeSelect:function(t,e){if(this.EffectType=e.value,this.api&&!this._noApply){var i=new Asc.CAscSlideProps,n=new Asc.CAscSlideTiming;n.put_TransitionType(this.Effect),n.put_TransitionOption(this.EffectType),i.put_timing(n),this.api.SetSlideProps(i)}this.fireEvent("editcomplete",this)},onDurationChange:function(t,e,i,n){if(this.api&&!this._noApply){var o=new Asc.CAscSlideProps,s=new Asc.CAscSlideTiming;s.put_TransitionDuration(1e3*t.getNumberValue()),o.put_timing(s),this.api.SetSlideProps(o)}},onDelayChange:function(t,e,i,n){if(this.api&&!this._noApply){var o=new Asc.CAscSlideProps,s=new Asc.CAscSlideTiming;s.put_SlideAdvanceDuration(1e3*t.getNumberValue()),o.put_timing(s),this.api.SetSlideProps(o)}},onStartOnClickChange:function(t,e,i,n){if(this.api&&!this._noApply){var o=new Asc.CAscSlideProps,s=new Asc.CAscSlideTiming;s.put_SlideAdvanceOnMouseClick("checked"==t.getValue()),o.put_timing(s),this.api.SetSlideProps(o)}this.fireEvent("editcomplete",this)},onCheckDelayChange:function(t,e,i,n){if(this.numDelay.setDisabled("checked"!==t.getValue()),this.api&&!this._noApply){var o=new Asc.CAscSlideProps,s=new Asc.CAscSlideTiming;s.put_SlideAdvanceAfter("checked"==t.getValue()),o.put_timing(s),this.api.SetSlideProps(o)}this.fireEvent("editcomplete",this)},onHeaderChange:function(t,e,i,n,o){if(this.api&&!this._noApply){var s=this.api.asc_getHeaderFooterProperties();s.get_Slide()["slidenum"==t?"put_ShowSlideNum":"put_ShowDateTime"]("checked"==e.getValue()),this.api.asc_setHeaderFooterProperties(s)}this.fireEvent("editcomplete",this)},UpdateThemeColors:function(){this._initSettings||(this.colorsBack||(this.btnBackColor.setMenu(),this.btnBackColor.on("color:select",i.bind(this.onColorsBackSelect,this)),this.colorsBack=this.btnBackColor.getPicker(),this.btnFGColor=new Common.UI.ColorButton({parentEl:e("#slide-foreground-color-btn"),color:"000000"}),this.FillItems.push(this.btnFGColor),this.colorsFG=this.btnFGColor.getPicker(),this.btnFGColor.on("color:select",i.bind(this.onColorsFGSelect,this)),this.btnBGColor=new Common.UI.ColorButton({parentEl:e("#slide-background-color-btn"),color:"ffffff"}),this.FillItems.push(this.btnBGColor),this.colorsBG=this.btnBGColor.getPicker(),this.btnBGColor.on("color:select",i.bind(this.onColorsBGSelect,this)),this.btnGradColor=new Common.UI.ColorButton({parentEl:e("#slide-gradient-color-btn"),color:"000000"}),this.FillItems.push(this.btnGradColor),this.colorsGrad=this.btnGradColor.getPicker(),this.btnGradColor.on("color:select",i.bind(this.onColorsGradientSelect,this))),this.colorsBack.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors()),this.colorsFG.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors()),this.colorsBG.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors()),this.colorsGrad.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors()))},ShowHideElem:function(t){this.FillColorContainer.toggleClass("settings-hidden",t!==Asc.c_oAscFill.FILL_TYPE_SOLID),this.FillImageContainer.toggleClass("settings-hidden",t!==Asc.c_oAscFill.FILL_TYPE_BLIP),this.FillPatternContainer.toggleClass("settings-hidden",t!==Asc.c_oAscFill.FILL_TYPE_PATT),this.FillGradientContainer.toggleClass("settings-hidden",t!==Asc.c_oAscFill.FILL_TYPE_GRAD)},ChangeSettings:function(t){if(this._initSettings&&this.createDelayedElements(),this.SetSlideDisabled(this._locked.background,this._locked.effects,this._locked.timing,this._locked.header),t){this._originalProps=t,this._noApply=!0;var n=null,o=t.get_background(),s=o.get_type(),a=null;if(null===o||null===s||s==Asc.c_oAscFill.FILL_TYPE_NOFILL)this.OriginalFillType=Asc.c_oAscFill.FILL_TYPE_NOFILL;else if(s==Asc.c_oAscFill.FILL_TYPE_SOLID)o=o.get_fill(),a=o.get_color(),a?a.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?this.SlideColor={Value:1,Color:{color:Common.Utils.ThemeColor.getHexColor(a.get_r(),a.get_g(),a.get_b()),effectValue:a.get_value()}}:this.SlideColor={Value:1,Color:Common.Utils.ThemeColor.getHexColor(a.get_r(),a.get_g(),a.get_b())}:this.SlideColor={Value:0,Color:"transparent"},this.OriginalFillType=Asc.c_oAscFill.FILL_TYPE_SOLID,this.FGColor="transparent"!==this.SlideColor.Color?{Value:1,Color:Common.Utils.ThemeColor.colorValue2EffectId(this.SlideColor.Color)}:{Value:1,Color:"000000"},this.BGColor={Value:1,Color:"ffffff"},this.GradColor.colors[0]="transparent"!==this.SlideColor.Color?Common.Utils.ThemeColor.colorValue2EffectId(this.SlideColor.Color):"000000",this.GradColor.colors[this.GradColor.colors.length-1]="ffffff";else if(s==Asc.c_oAscFill.FILL_TYPE_BLIP)o=o.get_fill(),this.BlipFillType=o.get_type(),this._state.BlipFillType!==this.BlipFillType&&(this.BlipFillType==Asc.c_oAscFillBlipType.STRETCH||this.BlipFillType==Asc.c_oAscFillBlipType.TILE?this.cmbFillType.setValue(this.BlipFillType):this.cmbFillType.setValue(""),this._state.BlipFillType=this.BlipFillType),this.OriginalFillType=Asc.c_oAscFill.FILL_TYPE_BLIP;else if(s==Asc.c_oAscFill.FILL_TYPE_PATT){if(o=o.get_fill(),this.PatternFillType=o.get_pattern_type(),this._state.PatternFillType!==this.PatternFillType){this.cmbPattern.suspendEvents();var n=this.cmbPattern.menuPicker.store.findWhere({type:this.PatternFillType});this.cmbPattern.menuPicker.selectRecord(n),this.cmbPattern.resumeEvents(),this._state.PatternFillType=this.PatternFillType}a=o.get_color_fg(),a?a.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?this.FGColor={Value:1,Color:{color:Common.Utils.ThemeColor.getHexColor(a.get_r(),a.get_g(),a.get_b()),effectValue:a.get_value()}}:this.FGColor={Value:1,Color:Common.Utils.ThemeColor.getHexColor(a.get_r(),a.get_g(),a.get_b())}:this.FGColor={Value:1,Color:"000000"},a=o.get_color_bg(),a?a.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?this.BGColor={Value:1,Color:{color:Common.Utils.ThemeColor.getHexColor(a.get_r(),a.get_g(),a.get_b()),effectValue:a.get_value()}}:this.BGColor={Value:1,Color:Common.Utils.ThemeColor.getHexColor(a.get_r(),a.get_g(),a.get_b())}:this.BGColor={Value:1,Color:"ffffff"},this.OriginalFillType=Asc.c_oAscFill.FILL_TYPE_PATT,this.SlideColor={Value:1,Color:Common.Utils.ThemeColor.colorValue2EffectId(this.FGColor.Color)},this.GradColor.colors[0]=Common.Utils.ThemeColor.colorValue2EffectId(this.FGColor.Color),this.GradColor.colors[this.GradColor.colors.length-1]="ffffff"}else if(s==Asc.c_oAscFill.FILL_TYPE_GRAD){o=o.get_fill();var l=o.get_grad_type();if(this._state.GradFillType===l&&this.GradFillType===l||(this.GradFillType=l,n=void 0,this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR||this.GradFillType==Asc.c_oAscFillGradType.GRAD_PATH?(this.cmbGradType.setValue(this.GradFillType),n=this.cmbGradType.store.findWhere({value:this.GradFillType}),this.onGradTypeSelect(this.cmbGradType,n.attributes)):(this.cmbGradType.setValue(""),this.btnDirection.setIconCls("")),this._state.GradFillType=this.GradFillType),this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR){var r=Math.floor(o.get_linear_angle()/6e4);if(Math.abs(this.GradLinearDirectionType-r)>.001){this.GradLinearDirectionType=r;var c=this.mnuDirectionPicker.store.findWhere({type:r});this.mnuDirectionPicker.selectRecord(c,!0),c?this.btnDirection.setIconCls("item-gradient "+c.get("iconcls")):this.btnDirection.setIconCls(""),this.numGradientAngle.setValue(r,!0)}}else this.numGradientAngle.setValue(0,!0);var d=this,h=o.get_colors(),p=o.get_positions(),u=h?h.length:this.GradColor.colors.length;this.sldrGradient.setThumbs(u),this.GradColor.colors.length>u&&(this.GradColor.colors.splice(u,this.GradColor.colors.length-u),this.GradColor.values.splice(u,this.GradColor.colors.length-u),this.GradColor.currentIdx=0),h&&h.forEach(function(t,e){t?t.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?(d.GradColor.colors[e]={color:Common.Utils.ThemeColor.getHexColor(t.get_r(),t.get_g(),t.get_b()),effectValue:t.get_value()},Common.Utils.ThemeColor.colorValue2EffectId(d.GradColor.colors[e])):d.GradColor.colors[e]=Common.Utils.ThemeColor.getHexColor(t.get_r(),t.get_g(),t.get_b()):d.GradColor.colors[e]="000000";var i=p[e];null!==i&&(i/=1e3,d.GradColor.values[e]=i)});for(var m=0;m=this.GradColor.colors.length)&&(d.GradColor.currentIdx=0),d.sldrGradient.setActiveThumb(d.GradColor.currentIdx),this.spnGradPosition.setValue(this.GradColor.values[this.GradColor.currentIdx]),this.OriginalFillType=Asc.c_oAscFill.FILL_TYPE_GRAD,this.FGColor={Value:1,Color:this.GradColor.colors[0]},this.BGColor={Value:1,Color:"ffffff"},this.SlideColor={Value:1,Color:this.GradColor.colors[0]}}this._state.FillType!==this.OriginalFillType&&(this.cmbFillSrc.setValue(this.OriginalFillType),this._state.FillType=this.OriginalFillType,this.ShowHideElem(this.OriginalFillType)),e(this.btnTexture.el).find(".form-control").prop("innerHTML",this.textSelectTexture);var g=typeof this.SlideColor.Color,f=typeof this._state.SlideColor;if(g!==f||"object"==g&&(this.SlideColor.Color.effectValue!==this._state.SlideColor.effectValue||this._state.SlideColor.color.indexOf(this.SlideColor.Color.color)<0)||"object"!=g&&this._state.SlideColor.indexOf(this.SlideColor.Color)<0){if(this.btnBackColor.setColor(this.SlideColor.Color),"object"==typeof this.SlideColor.Color){for(var b=!1,C=0;C<10;C++)if(Common.Utils.ThemeColor.ThemeValues[C]==this.SlideColor.Color.effectValue){this.colorsBack.select(this.SlideColor.Color,!0),b=!0;break}b||this.colorsBack.clearSelection()}else this.colorsBack.select(this.SlideColor.Color,!0);this._state.SlideColor=this.SlideColor.Color}var v=t.get_timing();if(v){var r=v.get_TransitionType(),_=!1;if(this._state.Effect!==r){var y=this.cmbEffectName.store.findWhere({value:r});y?(_=!0,this.cmbEffectName.setValue(y.get("value"))):this.cmbEffectName.setValue(""),this.fillEffectTypeCombo(_?r:void 0),this.Effect=r,this._state.Effect=r}r=v.get_TransitionOption(),(this._state.EffectType!==r||_)&&(_=!1,y=this.cmbEffectType.store.findWhere({value:r}),y?(_=!0,this.cmbEffectType.setValue(y.get("value"))):this.cmbEffectType.setValue(""),this._state.EffectType=r),r=v.get_TransitionDuration(),(Math.abs(this._state.Duration-r)>.001||(null===this._state.Duration||null===r)&&this._state.Duration!==r||(void 0===this._state.Duration||void 0===r)&&this._state.Duration!==r)&&(this.numDuration.setValue(null!==r&&void 0!==r?r/1e3:"",!0),this._state.Duration=r),r=v.get_SlideAdvanceDuration(),(Math.abs(this._state.Delay-r)>.001||(null===this._state.Delay||null===r)&&this._state.Delay!==r||(void 0===this._state.Delay||void 0===r)&&this._state.Delay!==r)&&(this.numDelay.setValue(null!==r&&void 0!==r?r/1e3:"",!0),this._state.Delay=r),r=v.get_SlideAdvanceOnMouseClick(),this._state.OnMouseClick!==r&&(this.chStartOnClick.setValue(null!==r&&void 0!==r?r:"indeterminate",!0),this._state.OnMouseClick=r),r=v.get_SlideAdvanceAfter(),this._state.AdvanceAfter!==r&&(this.chDelay.setValue(null!==r&&void 0!==r?r:"indeterminate",!0),this.numDelay.setDisabled("checked"!==this.chDelay.getValue()),this._state.AdvanceAfter=r)}if(g=typeof this.FGColor.Color,f=typeof this._state.FGColor,g!==f||"object"==g&&(this.FGColor.Color.effectValue!==this._state.FGColor.effectValue||this._state.FGColor.color.indexOf(this.FGColor.Color.color)<0)||"object"!=g&&this._state.FGColor.indexOf(this.FGColor.Color)<0){if(this.btnFGColor.setColor(this.FGColor.Color),"object"==typeof this.FGColor.Color){for(var b=!1,C=0;C<10;C++)if(Common.Utils.ThemeColor.ThemeValues[C]==this.FGColor.Color.effectValue){this.colorsFG.select(this.FGColor.Color,!0),b=!0;break}b||this.colorsFG.clearSelection()}else this.colorsFG.select(this.FGColor.Color,!0);this._state.FGColor=this.FGColor.Color}if(g=typeof this.BGColor.Color,f=typeof this._state.BGColor,g!==f||"object"==g&&(this.BGColor.Color.effectValue!==this._state.BGColor.effectValue||this._state.BGColor.color.indexOf(this.BGColor.Color.color)<0)||"object"!=g&&this._state.BGColor.indexOf(this.BGColor.Color)<0){if(this.btnBGColor.setColor(this.BGColor.Color),"object"==typeof this.BGColor.Color){for(var b=!1,C=0;C<10;C++)if(Common.Utils.ThemeColor.ThemeValues[C]==this.BGColor.Color.effectValue){this.colorsBG.select(this.BGColor.Color,!0),b=!0;break}b||this.colorsBG.clearSelection()}else this.colorsBG.select(this.BGColor.Color,!0);this._state.BGColor=this.BGColor.Color}if(a=this.GradColor.colors[this.GradColor.currentIdx],g=typeof a,f=typeof this._state.GradColor,g!==f||"object"==g&&(a.effectValue!==this._state.GradColor.effectValue||this._state.GradColor.color.indexOf(a.color)<0)||"object"!=g&&this._state.GradColor.indexOf(a)<0){if(this.btnGradColor.setColor(a),"object"==typeof a){for(var b=!1,C=0;C<10;C++)if(Common.Utils.ThemeColor.ThemeValues[C]==a.effectValue){this.colorsGrad.select(a,!0),b=!0;break}b||this.colorsGrad.clearSelection()}else this.colorsGrad.select(a,!0);this._state.GradColor=a}if(r=this.api.asc_getHeaderFooterProperties()){var w=r.get_Slide()||new AscCommonSlide.CAscHFProps;this.chSlideNum.setValue(!!w.get_ShowSlideNum(),!0),this.chDateTime.setValue(!!w.get_ShowDateTime(),!0)}this._noApply=!1}},setLocked:function(t,e,i,n){this._locked={background:t,effects:e,timing:i,header:n}},SetSlideDisabled:function(t,e,i,n){if(this._locked={background:t,effects:e,timing:i,header:n},!this._initSettings){if(t!==this._stateDisabled.background){this.cmbFillSrc.setDisabled(t);for(var o=0;on;if(this.api){this.GradColor.values[this.GradColor.currentIdx]=e;var s=new Asc.CAscSlideProps,a=new Asc.asc_CShapeFill;a.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD),a.put_fill(new Asc.asc_CFillGrad),a.get_fill().put_grad_type(this.GradFillType);var l=[];this.GradColor.values.forEach(function(t){l.push(1e3*t)}),a.get_fill().put_positions(l),s.put_background(a),this.api.SetSlideProps(s),o&&(this.sldrGradient.sortThumbs(),this.sldrGradient.trigger("change",this.sldrGradient),this.sldrGradient.trigger("changecomplete",this.sldrGradient))}},onAddGradientStep:function(){if(!(this.GradColor.colors.length>9)){var t=this.GradColor.currentIdx,e=(this.GradColor.values[t]+this.GradColor.values[t=this.GradColor.colors.length){var e=t>0?t-1:t;e=0===e&&this.GradColor.values.length>2?this.GradColor.values.length-2:e,this.GradColor.currentIdx=e}this.sldrGradient.setActiveThumb(this.GradColor.currentIdx),this.sldrGradient.trigger("change",this.sldrGradient),this.sldrGradient.trigger("changecomplete",this.sldrGradient)}},onGradientAngleChange:function(t,e,i,n){if(this.api&&!this._noApply){var o=new Asc.CAscSlideProps,s=new Asc.asc_CShapeFill;s.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD),s.put_fill(new Asc.asc_CFillGrad),s.get_fill().put_grad_type(this.GradFillType),s.get_fill().put_linear_angle(6e4*t.getNumberValue()),s.get_fill().put_linear_scale(!0),o.put_background(s),this.api.SetSlideProps(o)}},strColor:"Color",strFill:"Background",textColor:"Color Fill",textImageTexture:"Picture or Texture",textTexture:"From Texture",textFromUrl:"From URL",textFromFile:"From File",textStretch:"Stretch",textTile:"Tile",txtCanvas:"Canvas",txtCarton:"Carton",txtDarkFabric:"Dark Fabric",txtGrain:"Grain",txtGranite:"Granite",txtGreyPaper:"Grey Paper",txtKnit:"Knit",txtLeather:"Leather",txtBrownPaper:"Brown Paper",txtPapyrus:"Papyrus",txtWood:"Wood",textAdvanced:"Show advanced settings",textNoFill:"No Fill",textSelectTexture:"Select",textNone:"None",textFade:"Fade",textPush:"Push",textWipe:"Wipe",textSplit:"Split",textUnCover:"UnCover",textCover:"Cover",textClock:"Clock",textZoom:"Zoom",textSmoothly:"Smoothly",textBlack:"Through Black",textLeft:"Left",textTop:"Top",textRight:"Right",textBottom:"Bottom",textTopLeft:"Top-Left",textTopRight:"Top-Right",textBottomLeft:"Bottom-Left",textBottomRight:"Bottom-Right",textVerticalIn:"Vertical In",textVerticalOut:"Vertical Out",textHorizontalIn:"Horizontal In",textHorizontalOut:"Horizontal Out",textClockwise:"Clockwise",textCounterclockwise:"Counterclockwise",textWedge:"Wedge",textZoomIn:"Zoom In",textZoomOut:"Zoom Out",textZoomRotate:"Zoom and Rotate",strStartOnClick:"Start On Click",strDelay:"Delay",textApplyAll:"Apply to All Slides",textPreview:"Preview",strEffect:"Effect",strDuration:"Duration",textGradientFill:"Gradient Fill",textPatternFill:"Pattern",strBackground:"Background color",strForeground:"Foreground color",strPattern:"Pattern",textEmptyPattern:"No Pattern",textLinear:"Linear",textRadial:"Radial",textDirection:"Direction",textStyle:"Style",textGradient:"Gradient Points",textSec:"s",strSlideNum:"Show Slide Number",strDateTime:"Show Date and Time",textFromStorage:"From Storage",textSelectImage:"Select Picture",textPosition:"Position",tipAddGradientPoint:"Add gradient point",tipRemoveGradientPoint:"Remove gradient point",textAngle:"Angle"},PE.Views.SlideSettings||{}))}),define("text!presentationeditor/main/app/template/TextArtSettings.template",[],function(){ +return'\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
    \r\n \r\n \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n \r\n \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n
    \r\n
    \r\n
    '}),define("presentationeditor/main/app/view/TextArtSettings",["text!presentationeditor/main/app/template/TextArtSettings.template","jquery","underscore","backbone","common/main/lib/component/ComboBox","common/main/lib/component/ComboBorderSize","common/main/lib/component/MetricSpinner","common/main/lib/component/ThemeColorPalette","common/main/lib/component/ColorButton","common/main/lib/component/ComboDataView","common/main/lib/component/Slider","common/main/lib/component/MultiSliderGradient","common/main/lib/view/ImageFromUrlDialog"],function(t,e,i,n){"use strict";PE.Views.TextArtSettings=n.View.extend(i.extend({el:"#id-textart-settings",template:i.template(t),events:{},options:{alias:"TextArtSettings"},initialize:function(){this._initSettings=!0,this._noApply=!0,this.shapeprops=null,this._sendUndoPoint=!0,this._sliderChanged=!1,this._texturearray=null,this.txtPt=Common.Utils.Metric.getMetricName(Common.Utils.Metric.c_MetricUnits.pt),this._state={Transparency:null,FillType:Asc.c_oAscFill.FILL_TYPE_SOLID,ShapeColor:"transparent",BlipFillType:Asc.c_oAscFillBlipType.STRETCH,StrokeType:Asc.c_oAscStrokeType.STROKE_COLOR,StrokeWidth:this._pt2mm(1),StrokeColor:"000000",StrokeBorderType:Asc.c_oDashType.solid,FGColor:"000000",BGColor:"ffffff",GradColor:"000000",GradFillType:Asc.c_oAscFillGradType.GRAD_LINEAR,FormId:null,DisabledControls:!1},this.lockedControls=[],this._locked=!1,this.OriginalFillType=Asc.c_oAscFill.FILL_TYPE_SOLID,this.ShapeColor={Value:1,Color:"transparent"},this.BlipFillType=Asc.c_oAscFillBlipType.STRETCH,this.GradFillType=Asc.c_oAscFillGradType.GRAD_LINEAR,this.GradColor={values:[0,100],colors:["000000","ffffff"],currentIdx:0},this.GradRadialDirectionIdx=0,this.GradLinearDirectionType=0,this.PatternFillType=0,this.FGColor={Value:1,Color:"000000"},this.BGColor={Value:1,Color:"ffffff"},this.BorderColor={Value:1,Color:"transparent"},this.BorderSize=0,this.BorderType=Asc.c_oDashType.solid,this.textureNames=[this.txtCanvas,this.txtCarton,this.txtDarkFabric,this.txtGrain,this.txtGranite,this.txtGreyPaper,this.txtKnit,this.txtLeather,this.txtBrownPaper,this.txtPapyrus,this.txtWood],this.render(),this.FillColorContainer=e("#textart-panel-color-fill"),this.FillImageContainer=e("#textart-panel-image-fill"),this.FillPatternContainer=e("#textart-panel-pattern-fill"),this.FillGradientContainer=e("#textart-panel-gradient-fill"),this.TransparencyContainer=e("#textart-panel-transparent-fill"),PE.getCollection("Common.Collections.TextArt").bind({reset:this.fillTextArt.bind(this)})},render:function(){e(this.el).html(this.template({scope:this}))},setApi:function(t){return this.api=t,this.api&&(this.api.SetInterfaceDrawImagePlaceTextArt("textart-texture-img"),this.api.asc_registerCallback("asc_onInitStandartTextures",i.bind(this.onInitStandartTextures,this))),this},onFillSrcSelect:function(t,e){switch(this.ShowHideElem(e.value),e.value){case Asc.c_oAscFill.FILL_TYPE_SOLID:if(this._state.FillType=Asc.c_oAscFill.FILL_TYPE_SOLID,!this._noApply){var i=new Asc.asc_TextArtProperties,n=new Asc.asc_CShapeFill;n.put_type(Asc.c_oAscFill.FILL_TYPE_SOLID),n.put_fill(new Asc.asc_CFillSolid),n.get_fill().put_color(Common.Utils.ThemeColor.getRgbColor("transparent"==this.ShapeColor.Color?{color:"4f81bd",effectId:24}:this.ShapeColor.Color)),i.asc_putFill(n),this.shapeprops.put_TextArtProperties(i),this.api.ShapeApply(this.shapeprops)}break;case Asc.c_oAscFill.FILL_TYPE_GRAD:if(this._state.FillType=Asc.c_oAscFill.FILL_TYPE_GRAD,!this._noApply){var i=new Asc.asc_TextArtProperties,n=new Asc.asc_CShapeFill;if(n.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD),n.put_fill(new Asc.asc_CFillGrad),n.get_fill().put_grad_type(this.GradFillType),this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR&&(n.get_fill().put_linear_angle(6e4*this.GradLinearDirectionType),n.get_fill().put_linear_scale(!0)),this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_GRAD){this.GradColor.values=[0,100],this.GradColor.colors=[this.GradColor.colors[0],this.GradColor.colors[this.GradColor.colors.length-1]],this.GradColor.currentIdx=0;var o=Common.Utils.ThemeColor.getRgbColor(this.GradColor.colors[0]).get_color().get_hex(),s=Common.Utils.ThemeColor.getRgbColor(this.GradColor.colors[1]).get_color().get_hex();o="ffffff"===o&&"ffffff"===s?{color:"4f81bd",effectId:24}:this.GradColor.colors[0],n.get_fill().put_positions([1e3*this.GradColor.values[0],1e3*this.GradColor.values[1]]),n.get_fill().put_colors([Common.Utils.ThemeColor.getRgbColor(o),Common.Utils.ThemeColor.getRgbColor(this.GradColor.colors[1])])}i.asc_putFill(n),this.shapeprops.put_TextArtProperties(i),this.api.ShapeApply(this.shapeprops)}break;case Asc.c_oAscFill.FILL_TYPE_BLIP:this._state.FillType=Asc.c_oAscFill.FILL_TYPE_BLIP;break;case Asc.c_oAscFill.FILL_TYPE_PATT:if(this._state.FillType=Asc.c_oAscFill.FILL_TYPE_PATT,!this._noApply){var i=new Asc.asc_TextArtProperties,n=new Asc.asc_CShapeFill;n.put_type(Asc.c_oAscFill.FILL_TYPE_PATT),n.put_fill(new Asc.asc_CFillHatch),n.get_fill().put_pattern_type(this.PatternFillType);var a=Common.Utils.ThemeColor.getRgbColor(this.FGColor.Color).get_color().get_hex();a="ffffff"===Common.Utils.ThemeColor.getRgbColor(this.BGColor.Color).get_color().get_hex()&&"ffffff"===a?{color:"4f81bd",effectId:24}:this.FGColor.Color,n.get_fill().put_color_fg(Common.Utils.ThemeColor.getRgbColor(a)),n.get_fill().put_color_bg(Common.Utils.ThemeColor.getRgbColor(this.BGColor.Color)),i.asc_putFill(n),this.shapeprops.put_TextArtProperties(i),this.api.ShapeApply(this.shapeprops)}break;case Asc.c_oAscFill.FILL_TYPE_NOFILL:if(this._state.FillType=Asc.c_oAscFill.FILL_TYPE_NOFILL,!this._noApply){var i=new Asc.asc_TextArtProperties,n=new Asc.asc_CShapeFill;n.put_type(Asc.c_oAscFill.FILL_TYPE_NOFILL),n.put_fill(null),i.asc_putFill(n),this.shapeprops.put_TextArtProperties(i),this.api.ShapeApply(this.shapeprops)}}this.fireEvent("editcomplete",this)},onColorsBackSelect:function(t,e){if(this.ShapeColor={Value:1,Color:e},this.api&&!this._noApply){var i=new Asc.asc_TextArtProperties,n=new Asc.asc_CShapeFill;"transparent"==this.ShapeColor.Color?(n.put_type(Asc.c_oAscFill.FILL_TYPE_NOFILL),n.put_fill(null)):(n.put_type(Asc.c_oAscFill.FILL_TYPE_SOLID),n.put_fill(new Asc.asc_CFillSolid),n.get_fill().put_color(Common.Utils.ThemeColor.getRgbColor(this.ShapeColor.Color))),i.asc_putFill(n),this.shapeprops.put_TextArtProperties(i),this.api.ShapeApply(this.shapeprops)}this.fireEvent("editcomplete",this)},onPatternSelect:function(t,e){if(this.api&&!this._noApply){this.PatternFillType=e.get("type");var i=new Asc.asc_TextArtProperties,n=new Asc.asc_CShapeFill;n.put_type(Asc.c_oAscFill.FILL_TYPE_PATT),n.put_fill(new Asc.asc_CFillHatch),n.get_fill().put_pattern_type(this.PatternFillType),this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_PATT&&(n.get_fill().put_color_fg(Common.Utils.ThemeColor.getRgbColor(this.FGColor.Color)),n.get_fill().put_color_bg(Common.Utils.ThemeColor.getRgbColor(this.BGColor.Color))),i.asc_putFill(n),this.shapeprops.put_TextArtProperties(i),this.api.ShapeApply(this.shapeprops)}this.fireEvent("editcomplete",this)},onColorsFGSelect:function(t,e){if(this.FGColor={Value:1,Color:e},this.api&&!this._noApply){var i=new Asc.asc_TextArtProperties,n=new Asc.asc_CShapeFill;n.put_type(Asc.c_oAscFill.FILL_TYPE_PATT),n.put_fill(new Asc.asc_CFillHatch),n.get_fill().put_color_fg(Common.Utils.ThemeColor.getRgbColor(this.FGColor.Color)),this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_PATT&&(n.get_fill().put_pattern_type(this.PatternFillType),n.get_fill().put_color_bg(Common.Utils.ThemeColor.getRgbColor(this.BGColor.Color))),i.asc_putFill(n),this.shapeprops.put_TextArtProperties(i),this.api.ShapeApply(this.shapeprops)}this.fireEvent("editcomplete",this)},onColorsBGSelect:function(t,e){if(this.BGColor={Value:1,Color:e},this.api&&!this._noApply){var i=new Asc.asc_TextArtProperties,n=new Asc.asc_CShapeFill;n.put_type(Asc.c_oAscFill.FILL_TYPE_PATT),n.put_fill(new Asc.asc_CFillHatch),this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_PATT&&(n.get_fill().put_pattern_type(this.PatternFillType),n.get_fill().put_color_fg(Common.Utils.ThemeColor.getRgbColor(this.FGColor.Color))),n.get_fill().put_color_bg(Common.Utils.ThemeColor.getRgbColor(this.BGColor.Color)),i.asc_putFill(n),this.shapeprops.put_TextArtProperties(i),this.api.ShapeApply(this.shapeprops)}this.fireEvent("editcomplete",this)},onFillTypeSelect:function(t,e){if(this.BlipFillType=e.value,this.api&&!0!==this._fromTextureCmb&&this.OriginalFillType==Asc.c_oAscFill.FILL_TYPE_BLIP){var i=new Asc.asc_TextArtProperties,n=new Asc.asc_CShapeFill;n.put_type(Asc.c_oAscFill.FILL_TYPE_BLIP),n.put_fill(new Asc.asc_CFillBlip),n.get_fill().put_type(this.BlipFillType),i.asc_putFill(n),this.shapeprops.put_TextArtProperties(i),this.api.ShapeApply(this.shapeprops)}this.fireEvent("editcomplete",this)},onNumTransparencyChange:function(t,e,i,n){if(this.sldrTransparency.setValue(t.getNumberValue(),!0),this.api){var o=t.getNumberValue(),s=new Asc.asc_TextArtProperties,a=new Asc.asc_CShapeFill;a.put_transparent(2.55*o),s.asc_putFill(a),this.shapeprops.put_TextArtProperties(s),this.api.ShapeApply(this.shapeprops)}},onTransparencyChange:function(t,e,n){this._sliderChanged=e,this.numTransparency.setValue(e,!0),this._sendUndoPoint&&(this.api.setStartPointHistory(),this._sendUndoPoint=!1,this.updateslider=setInterval(i.bind(this._transparencyApplyFunc,this),100))},onTransparencyChangeComplete:function(t,e,i){clearInterval(this.updateslider),this._sliderChanged=e,this._sendUndoPoint||(this.api.setEndPointHistory(),this._transparencyApplyFunc()),this._sendUndoPoint=!0},_transparencyApplyFunc:function(){if(void 0!==this._sliderChanged){var t=new Asc.asc_TextArtProperties,e=new Asc.asc_CShapeFill;e.put_transparent(2.55*this._sliderChanged),t.asc_putFill(e),this.shapeprops.put_TextArtProperties(t),this.api.ShapeApply(this.shapeprops),this._sliderChanged=void 0}},onGradTypeSelect:function(t,e){if(this.GradFillType=e.value,this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR){this.mnuDirectionPicker.store.reset(this._viewDataLinear),this.mnuDirectionPicker.cmpEl.width(175),this.mnuDirectionPicker.restoreHeight=174;var e=this.mnuDirectionPicker.store.findWhere({type:this.GradLinearDirectionType});this.mnuDirectionPicker.selectRecord(e,!0),e?this.btnDirection.setIconCls("item-gradient "+e.get("iconcls")):this.btnDirection.setIconCls(""),this.numGradientAngle.setValue(this.GradLinearDirectionType,!0),this.numGradientAngle.setDisabled(this._locked)}else this.GradFillType==Asc.c_oAscFillGradType.GRAD_PATH&&(this.mnuDirectionPicker.store.reset(this._viewDataRadial),this.mnuDirectionPicker.cmpEl.width(60),this.mnuDirectionPicker.restoreHeight=58,this.mnuDirectionPicker.selectByIndex(this.GradRadialDirectionIdx,!0),this.GradRadialDirectionIdx>=0?this.btnDirection.setIconCls("item-gradient "+this._viewDataRadial[this.GradRadialDirectionIdx].iconcls):this.btnDirection.setIconCls(""),this.numGradientAngle.setValue(0,!0),this.numGradientAngle.setDisabled(!0));if(this.api&&!this._noApply){var i=new Asc.asc_TextArtProperties,n=new Asc.asc_CShapeFill;n.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD),n.put_fill(new Asc.asc_CFillGrad),n.get_fill().put_grad_type(this.GradFillType),this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR&&(n.get_fill().put_linear_angle(6e4*this.GradLinearDirectionType),n.get_fill().put_linear_scale(!0)),i.asc_putFill(n),this.shapeprops.put_TextArtProperties(i),this.api.ShapeApply(this.shapeprops)}this.fireEvent("editcomplete",this)},onSelectGradient:function(t,e,n,o){if(!this._noApply){var s={};if(i.isFunction(o.toJSON)){if(!o.get("selected"))return;s=o.toJSON()}else s=o;if(this.btnDirection.setIconCls("item-gradient "+s.iconcls),this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR?this.GradLinearDirectionType=s.type:this.GradRadialDirectionIdx=0,this.api&&this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR){this.numGradientAngle.setValue(s.type,!0);var a=new Asc.asc_TextArtProperties,l=new Asc.asc_CShapeFill;l.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD),l.put_fill(new Asc.asc_CFillGrad),l.get_fill().put_grad_type(this.GradFillType),l.get_fill().put_linear_angle(6e4*s.type),l.get_fill().put_linear_scale(!0),a.asc_putFill(l),this.shapeprops.put_TextArtProperties(a),this.api.ShapeApply(this.shapeprops)}this.fireEvent("editcomplete",this)}},onColorsGradientSelect:function(t,e){if(this.GradColor.colors[this.GradColor.currentIdx]=e,this.sldrGradient.setColorValue(Common.Utils.String.format("#{0}","object"==typeof e?e.color:e)),this.api&&!this._noApply){var i=new Asc.asc_TextArtProperties,n=new Asc.asc_CShapeFill;n.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD),n.put_fill(new Asc.asc_CFillGrad),n.get_fill().put_grad_type(this.GradFillType);var o=[];this.GradColor.colors.forEach(function(t){o.push(Common.Utils.ThemeColor.getRgbColor(t))}),n.get_fill().put_colors(o),this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_GRAD&&(this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR&&(n.get_fill().put_linear_angle(6e4*this.GradLinearDirectionType),n.get_fill().put_linear_scale(!0)),o=[],this.GradColor.values.forEach(function(t){o.push(1e3*t)}),n.get_fill().put_positions(o)),i.asc_putFill(n),this.shapeprops.put_TextArtProperties(i),this.api.ShapeApply(this.shapeprops)}this.fireEvent("editcomplete",this)},onGradientChange:function(t,e,n){this.GradColor.values=t.getValues(),this.spnGradPosition.setValue(this.GradColor.values[this.GradColor.currentIdx],!0),this._sliderChanged=!0,this.api&&!this._noApply&&this._sendUndoPoint&&(this.api.setStartPointHistory(),this._sendUndoPoint=!1,this.updateslider=setInterval(i.bind(this._gradientApplyFunc,this),100))},onGradientChangeComplete:function(t,e,i){clearInterval(this.updateslider),this._sliderChanged=!0,this._sendUndoPoint||(this.api.setEndPointHistory(),this._gradientApplyFunc()),this._sendUndoPoint=!0},_gradientApplyFunc:function(){if(this._sliderChanged){var t=new Asc.asc_TextArtProperties,e=new Asc.asc_CShapeFill;e.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD),e.put_fill(new Asc.asc_CFillGrad),e.get_fill().put_grad_type(this.GradFillType);var i=[];this.GradColor.values.forEach(function(t){i.push(1e3*t)}),e.get_fill().put_positions(i),this.OriginalFillType!==Asc.c_oAscFill.FILL_TYPE_GRAD&&(this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR&&(e.get_fill().put_linear_angle(6e4*this.GradLinearDirectionType),e.get_fill().put_linear_scale(!0)),i=[],this.GradColor.colors.forEach(function(t){i.push(Common.Utils.ThemeColor.getRgbColor(t))}),e.get_fill().put_colors(i)),t.asc_putFill(e),this.shapeprops.put_TextArtProperties(t),this.api.ShapeApply(this.shapeprops),this._sliderChanged=!1}},applyBorderSize:function(t){if(t=Common.Utils.String.parseFloat(t),t=isNaN(t)?0:Math.max(0,Math.min(1584,t)),this.BorderSize=t,this.api&&!this._noApply){var e=new Asc.asc_TextArtProperties,i=new Asc.asc_CStroke;this.BorderSize<1e-5?(i.put_type(Asc.c_oAscStrokeType.STROKE_NONE),this._state.StrokeType=this._state.StrokeWidth=-1):(i.put_type(Asc.c_oAscStrokeType.STROKE_COLOR),"transparent"==this.BorderColor.Color||"transparent"==this.BorderColor.Color.color?i.put_color(Common.Utils.ThemeColor.getRgbColor({color:"000000",effectId:29})):this._state.StrokeType!=Asc.c_oAscStrokeType.STROKE_NONE&&null!==this._state.StrokeType||i.put_color(Common.Utils.ThemeColor.getRgbColor(Common.Utils.ThemeColor.colorValue2EffectId(this.BorderColor.Color))),i.asc_putPrstDash(this.BorderType),i.put_width(this._pt2mm(this.BorderSize))),e.asc_putLine(i),this.shapeprops.put_TextArtProperties(e),this.api.ShapeApply(this.shapeprops)}this.fireEvent("editcomplete",this)},onComboBlur:function(){this.fireEvent("editcomplete",this)},onBorderSizeChanged:function(t,e,n,o){var s=this;if(t){var a=parseFloat(n.value);(!new RegExp("^\\s*(\\d*(\\.|,)?\\d+)\\s*("+s.txtPt+")?\\s*$").exec(n.value)||a<0||a>1584)&&(this._state.StrokeType=this._state.StrokeWidth=-1,Common.UI.error({msg:this.textBorderSizeErr,callback:function(){i.defer(function(t){s.fireEvent("editcomplete",s)})}}))}else this.applyBorderSize(n.value)},onBorderSizeSelect:function(t,e){this.applyBorderSize(e.value)},onBorderTypeSelect:function(t,e){if(this.BorderType=e.value,this.api&&!this._noApply){var i=new Asc.asc_TextArtProperties,n=new Asc.asc_CStroke;this.BorderSize<1e-5?n.put_type(Asc.c_oAscStrokeType.STROKE_NONE):(n.put_type(Asc.c_oAscStrokeType.STROKE_COLOR),n.put_color(Common.Utils.ThemeColor.getRgbColor(this.BorderColor.Color)),n.put_width(this._pt2mm(this.BorderSize)),n.asc_putPrstDash(this.BorderType)),i.asc_putLine(n),this.shapeprops.put_TextArtProperties(i),this.api.ShapeApply(this.shapeprops)}this.fireEvent("editcomplete",this)},onColorsBorderSelect:function(t,e){if(this.BorderColor={Value:1,Color:e},this.api&&this.BorderSize>0&&!this._noApply){var i=new Asc.asc_TextArtProperties,n=new Asc.asc_CStroke;this.BorderSize<1e-5?n.put_type(Asc.c_oAscStrokeType.STROKE_NONE):(n.put_type(Asc.c_oAscStrokeType.STROKE_COLOR),n.put_color(Common.Utils.ThemeColor.getRgbColor(this.BorderColor.Color)),n.put_width(this._pt2mm(this.BorderSize)),n.asc_putPrstDash(this.BorderType)),i.asc_putLine(n),this.shapeprops.put_TextArtProperties(i),this.api.ShapeApply(this.shapeprops)}this.fireEvent("editcomplete",this)},insertFromUrl:function(){var t=this;new Common.Views.ImageFromUrlDialog({handler:function(e,n){if("ok"==e&&t.api){var o=n.replace(/ /g,"");if(!i.isEmpty(o)&&null!==t.BlipFillType){var s=new Asc.asc_TextArtProperties,a=new Asc.asc_CShapeFill;a.put_type(Asc.c_oAscFill.FILL_TYPE_BLIP),a.put_fill(new Asc.asc_CFillBlip),a.get_fill().put_type(t.BlipFillType),a.get_fill().put_url(o),s.asc_putFill(a),t.shapeprops.put_TextArtProperties(s),t.api.ShapeApply(t.shapeprops)}}t.fireEvent("editcomplete",t)}}).show()},ChangeSettings:function(t){if(null==this.shapeprops&&(this.shapeprops=new Asc.asc_CShapeProperty),this._initSettings&&this.createDelayedElements(),t&&t.get_TextArtProperties()){var n=t.get_TextArtProperties();this._noApply=!0,this.disableControls(this._locked);var o=null,s=n.asc_getFill(),a=s?s.get_type():null,l=null;if(s){var r=s.get_transparent();(Math.abs(this._state.Transparency-r)>.001||Math.abs(this.numTransparency.getNumberValue()-r)>.001||(null===this._state.Transparency||null===r)&&(this._state.Transparency!==r||this.numTransparency.getNumberValue()!==r))&&(void 0!==r&&(this.sldrTransparency.setValue(null===r?100:r/255*100,!0),this.numTransparency.setValue(this.sldrTransparency.getValue(),!0)),this._state.Transparency=r)}if(null===s||void 0===s||null===a)this.OriginalFillType=null;else if(a==Asc.c_oAscFill.FILL_TYPE_NOFILL)this.OriginalFillType=Asc.c_oAscFill.FILL_TYPE_NOFILL;else if(a==Asc.c_oAscFill.FILL_TYPE_SOLID)s=s.get_fill(),l=s.get_color(),l?l.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?this.ShapeColor={Value:1,Color:{color:Common.Utils.ThemeColor.getHexColor(l.get_r(),l.get_g(),l.get_b()),effectValue:l.get_value()}}:this.ShapeColor={Value:1,Color:Common.Utils.ThemeColor.getHexColor(l.get_r(),l.get_g(),l.get_b())}:this.ShapeColor={Value:0,Color:"transparent"},this.OriginalFillType=Asc.c_oAscFill.FILL_TYPE_SOLID,this.FGColor="transparent"!==this.ShapeColor.Color?{Value:1,Color:Common.Utils.ThemeColor.colorValue2EffectId(this.ShapeColor.Color)}:{Value:1,Color:"000000"},this.BGColor={Value:1,Color:"ffffff"},this.GradColor.colors[0]="transparent"!==this.ShapeColor.Color?Common.Utils.ThemeColor.colorValue2EffectId(this.ShapeColor.Color):"000000",this.GradColor.colors[this.GradColor.colors.length-1]="ffffff";else if(a==Asc.c_oAscFill.FILL_TYPE_BLIP)s=s.get_fill(),this.BlipFillType=s.get_type(),this._state.BlipFillType!==this.BlipFillType&&(this.BlipFillType==Asc.c_oAscFillBlipType.STRETCH||this.BlipFillType==Asc.c_oAscFillBlipType.TILE?this.cmbFillType.setValue(this.BlipFillType):this.cmbFillType.setValue(""),this._state.BlipFillType=this.BlipFillType),this.OriginalFillType=Asc.c_oAscFill.FILL_TYPE_BLIP;else if(a==Asc.c_oAscFill.FILL_TYPE_PATT){if(s=s.get_fill(),this.PatternFillType=s.get_pattern_type(),this._state.PatternFillType!==this.PatternFillType){this.cmbPattern.suspendEvents();var o=this.cmbPattern.menuPicker.store.findWhere({type:this.PatternFillType});this.cmbPattern.menuPicker.selectRecord(o),this.cmbPattern.resumeEvents(),this._state.PatternFillType=this.PatternFillType}l=s.get_color_fg(),l?l.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?this.FGColor={Value:1,Color:{color:Common.Utils.ThemeColor.getHexColor(l.get_r(),l.get_g(),l.get_b()),effectValue:l.get_value()}}:this.FGColor={Value:1,Color:Common.Utils.ThemeColor.getHexColor(l.get_r(),l.get_g(),l.get_b())}:this.FGColor={Value:1,Color:"000000"},l=s.get_color_bg(),l?l.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?this.BGColor={Value:1,Color:{color:Common.Utils.ThemeColor.getHexColor(l.get_r(),l.get_g(),l.get_b()),effectValue:l.get_value()}}:this.BGColor={Value:1,Color:Common.Utils.ThemeColor.getHexColor(l.get_r(),l.get_g(),l.get_b())}:this.BGColor={Value:1,Color:"ffffff"},this.OriginalFillType=Asc.c_oAscFill.FILL_TYPE_PATT,this.ShapeColor={Value:1,Color:Common.Utils.ThemeColor.colorValue2EffectId(this.FGColor.Color)},this.GradColor.colors[0]=Common.Utils.ThemeColor.colorValue2EffectId(this.FGColor.Color),this.GradColor.colors[this.GradColor.colors.length-1]="ffffff"}else if(a==Asc.c_oAscFill.FILL_TYPE_GRAD){s=s.get_fill();var c=s.get_grad_type();if(this._state.GradFillType===c&&this.GradFillType===c||(this.GradFillType=c,o=void 0,this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR||this.GradFillType==Asc.c_oAscFillGradType.GRAD_PATH?(this.cmbGradType.setValue(this.GradFillType),o=this.cmbGradType.store.findWhere({value:this.GradFillType}),this.onGradTypeSelect(this.cmbGradType,o.attributes)):(this.cmbGradType.setValue(""),this.btnDirection.setIconCls("")),this._state.GradFillType=this.GradFillType),this.GradFillType==Asc.c_oAscFillGradType.GRAD_LINEAR){var d=Math.floor(s.get_linear_angle()/6e4);if(Math.abs(this.GradLinearDirectionType-d)>.001){this.GradLinearDirectionType=d;var h=this.mnuDirectionPicker.store.findWhere({type:d});this.mnuDirectionPicker.selectRecord(h,!0),h?this.btnDirection.setIconCls("item-gradient "+h.get("iconcls")):this.btnDirection.setIconCls(""),this.numGradientAngle.setValue(d,!0)}}else this.numGradientAngle.setValue(0,!0);var p=this,u=s.get_colors(),m=s.get_positions(),g=u?u.length:this.GradColor.colors.length;this.sldrGradient.setThumbs(g),this.GradColor.colors.length>g&&(this.GradColor.colors.splice(g,this.GradColor.colors.length-g),this.GradColor.values.splice(g,this.GradColor.colors.length-g),this.GradColor.currentIdx=0),u&&u.forEach(function(t,e){t?t.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?(p.GradColor.colors[e]={color:Common.Utils.ThemeColor.getHexColor(t.get_r(),t.get_g(),t.get_b()),effectValue:t.get_value()},Common.Utils.ThemeColor.colorValue2EffectId(p.GradColor.colors[e])):p.GradColor.colors[e]=Common.Utils.ThemeColor.getHexColor(t.get_r(),t.get_g(),t.get_b()):p.GradColor.colors[e]="000000";var i=m[e];null!==i&&(i/=1e3,p.GradColor.values[e]=i)});for(var f=0;f=this.GradColor.colors.length)&&(p.GradColor.currentIdx=0),p.sldrGradient.setActiveThumb(p.GradColor.currentIdx),this.spnGradPosition.setValue(this.GradColor.values[this.GradColor.currentIdx]),this.OriginalFillType=Asc.c_oAscFill.FILL_TYPE_GRAD,this.FGColor={Value:1,Color:this.GradColor.colors[0]},this.BGColor={Value:1,Color:"ffffff"},this.ShapeColor={Value:1,Color:this.GradColor.colors[0]}}this._state.FillType!==this.OriginalFillType&&(this.cmbFillSrc.setValue(null===this.OriginalFillType?"":this.OriginalFillType),this._state.FillType=this.OriginalFillType,this.ShowHideElem(this.OriginalFillType)),e(this.btnTexture.el).find(".form-control").prop("innerHTML",this.textSelectTexture);var b=typeof this.ShapeColor.Color,C=typeof this._state.ShapeColor;if(b!==C||"object"==b&&(this.ShapeColor.Color.effectValue!==this._state.ShapeColor.effectValue||this._state.ShapeColor.color.indexOf(this.ShapeColor.Color.color)<0)||"object"!=b&&this._state.ShapeColor.indexOf(this.ShapeColor.Color)<0){if(this.btnBackColor.setColor(this.ShapeColor.Color),"object"==typeof this.ShapeColor.Color){for(var v=!1,_=0;_<10;_++)if(Common.Utils.ThemeColor.ThemeValues[_]==this.ShapeColor.Color.effectValue){this.colorsBack.select(this.ShapeColor.Color,!0),v=!0;break}v||this.colorsBack.clearSelection()}else this.colorsBack.select(this.ShapeColor.Color,!0);this._state.ShapeColor=this.ShapeColor.Color}var y,w=n.asc_getLine(),x=w?w.get_type():null,S="transparent"==this._state.StrokeColor&&"transparent"!==this.BorderColor.Color;if(w?(x==Asc.c_oAscStrokeType.STROKE_COLOR?(l=w.get_color(),l?l.get_type()==Asc.c_oAscColor.COLOR_TYPE_SCHEME?this.BorderColor={Value:1,Color:{color:Common.Utils.ThemeColor.getHexColor(l.get_r(),l.get_g(),l.get_b()),effectValue:l.get_value()}}:this.BorderColor={Value:1,Color:Common.Utils.ThemeColor.getHexColor(l.get_r(),l.get_g(),l.get_b())}:this.BorderColor={Value:1,Color:"transparent"}):this.BorderColor={Value:1,Color:"transparent"},y=w.asc_getPrstDash()):this.BorderColor={Value:0,Color:"transparent"},b=typeof this.BorderColor.Color,C=typeof this._state.StrokeColor,S||b!==C||"object"==b&&(this.BorderColor.Color.effectValue!==this._state.StrokeColor.effectValue||this._state.StrokeColor.color.indexOf(this.BorderColor.Color.color)<0)||"object"!=b&&(this._state.StrokeColor.indexOf(this.BorderColor.Color)<0||"object"==typeof this.btnBorderColor.color)){if(this.btnBorderColor.setColor(this.BorderColor.Color),"object"==typeof this.BorderColor.Color){for(var v=!1,_=0;_<10;_++)if(Common.Utils.ThemeColor.ThemeValues[_]==this.BorderColor.Color.effectValue){this.colorsBorder.select(this.BorderColor.Color,!0),v=!0;break}v||this.colorsBorder.clearSelection()}else this.colorsBorder.select(this.BorderColor.Color,!0);this._state.StrokeColor=this.BorderColor.Color}if(this._state.StrokeType!==x||x==Asc.c_oAscStrokeType.STROKE_COLOR){if(x==Asc.c_oAscStrokeType.STROKE_COLOR){var A=w.get_width(),T=Math.abs(this._state.StrokeWidth-A)<1e-5&&!new RegExp(this.txtPt+"\\s*$").test(this.cmbBorderSize.getRawValue());if(Math.abs(this._state.StrokeWidth-A)>1e-5||T||(null===this._state.StrokeWidth||null===A)&&this._state.StrokeWidth!==A){this._state.StrokeWidth=A,null!==A&&(A=this._mm2pt(A));var k=null===A?A:i.find(this.cmbBorderSize.store.models,function(t){if(At.attributes.value-1e-5)return!0});k?this.cmbBorderSize.selectRecord(k):this.cmbBorderSize.setValue(null!==A?parseFloat(A.toFixed(2))+" "+this.txtPt:""),this.BorderSize=A}}else x==Asc.c_oAscStrokeType.STROKE_NONE?(this._state.StrokeWidth=0,this.BorderSize=this.cmbBorderSize.store.at(0).get("value"),this.cmbBorderSize.setValue(this.BorderSize)):(this._state.StrokeWidth=null,this.BorderSize=-1,this.cmbBorderSize.setValue(null));this._state.StrokeType=x}if(this._state.StrokeBorderType!==y&&(this.BorderType=this._state.StrokeBorderType=y,this.cmbBorderType.setValue(y)),b=typeof this.FGColor.Color,C=typeof this._state.FGColor,b!==C||"object"==b&&(this.FGColor.Color.effectValue!==this._state.FGColor.effectValue||this._state.FGColor.color.indexOf(this.FGColor.Color.color)<0)||"object"!=b&&this._state.FGColor.indexOf(this.FGColor.Color)<0){if(this.btnFGColor.setColor(this.FGColor.Color),"object"==typeof this.FGColor.Color){for(var v=!1,_=0;_<10;_++)if(Common.Utils.ThemeColor.ThemeValues[_]==this.FGColor.Color.effectValue){this.colorsFG.select(this.FGColor.Color,!0),v=!0;break}v||this.colorsFG.clearSelection()}else this.colorsFG.select(this.FGColor.Color,!0);this._state.FGColor=this.FGColor.Color}if(b=typeof this.BGColor.Color,C=typeof this._state.BGColor,b!==C||"object"==b&&(this.BGColor.Color.effectValue!==this._state.BGColor.effectValue||this._state.BGColor.color.indexOf(this.BGColor.Color.color)<0)||"object"!=b&&this._state.BGColor.indexOf(this.BGColor.Color)<0){if(this.btnBGColor.setColor(this.BGColor.Color),"object"==typeof this.BGColor.Color){for(var v=!1,_=0;_<10;_++)if(Common.Utils.ThemeColor.ThemeValues[_]==this.BGColor.Color.effectValue){this.colorsBG.select(this.BGColor.Color,!0),v=!0;break}v||this.colorsBG.clearSelection()}else this.colorsBG.select(this.BGColor.Color,!0);this._state.BGColor=this.BGColor.Color}if(l=this.GradColor.colors[this.GradColor.currentIdx],b=typeof l,C=typeof this._state.GradColor,b!==C||"object"==b&&(l.effectValue!==this._state.GradColor.effectValue||this._state.GradColor.color.indexOf(l.color)<0)||"object"!=b&&this._state.GradColor.indexOf(l)<0){if(this.btnGradColor.setColor(l),"object"==typeof l){for(var v=!1,_=0;_<10;_++)if(Common.Utils.ThemeColor.ThemeValues[_]==l.effectValue){this.colorsGrad.select(l,!0),v=!0;break}v||this.colorsGrad.clearSelection()}else this.colorsGrad.select(l,!0);this._state.GradColor=l}var I=n.asc_getForm();if(this._state.FormId!==I){this.cmbTransform.suspendEvents();var o=this.cmbTransform.menuPicker.store.findWhere({type:I});this.cmbTransform.menuPicker.selectRecord(o),this.cmbTransform.resumeEvents(),this._state.FormId=I}this._noApply=!1}},createDelayedControls:function(){var t=this;this._arrFillSrc=[{displayValue:this.textColor,value:Asc.c_oAscFill.FILL_TYPE_SOLID},{displayValue:this.textGradientFill,value:Asc.c_oAscFill.FILL_TYPE_GRAD},{displayValue:this.textImageTexture,value:Asc.c_oAscFill.FILL_TYPE_BLIP},{displayValue:this.textPatternFill,value:Asc.c_oAscFill.FILL_TYPE_PATT},{displayValue:this.textNoFill,value:Asc.c_oAscFill.FILL_TYPE_NOFILL}],this.cmbFillSrc=new Common.UI.ComboBox({el:e("#textart-combo-fill-src"),cls:"input-group-nr",style:"width: 100%;",menuStyle:"min-width: 100%;",editable:!1,data:this._arrFillSrc}),this.cmbFillSrc.setValue(this._arrFillSrc[0].value),this.cmbFillSrc.on("selected",i.bind(this.onFillSrcSelect,this)),this.lockedControls.push(this.cmbFillSrc),this.cmbPattern=new Common.UI.ComboDataView({itemWidth:28,itemHeight:28,menuMaxHeight:300,enableKeyEvents:!0,cls:"combo-pattern"}),this.cmbPattern.menuPicker.itemTemplate=this.cmbPattern.fieldPicker.itemTemplate=i.template(['
    ','',"
    "].join("")),this.cmbPattern.render(e("#textart-combo-pattern")),this.cmbPattern.openButton.menu.cmpEl.css({"min-width":178,"max-width":178}),this.cmbPattern.on("click",i.bind(this.onPatternSelect,this)),this.cmbPattern.openButton.menu.on("show:after",function(){t.cmbPattern.menuPicker.scroller.update({alwaysVisibleY:!0})}),this.lockedControls.push(this.cmbPattern),this.btnInsertFromFile=new Common.UI.Button({el:e("#textart-button-from-file")}),this.lockedControls.push(this.btnInsertFromFile),this.btnInsertFromUrl=new Common.UI.Button({el:e("#textart-button-from-url")}),this.lockedControls.push(this.btnInsertFromUrl),this.btnInsertFromFile.on("click",i.bind(function(t){this.api&&this.api.ChangeArtImageFromFile(this.BlipFillType),this.fireEvent("editcomplete",this)},this)),this.btnInsertFromUrl.on("click",i.bind(this.insertFromUrl,this)),this._arrFillType=[{displayValue:this.textStretch,value:Asc.c_oAscFillBlipType.STRETCH},{displayValue:this.textTile,value:Asc.c_oAscFillBlipType.TILE}],this.cmbFillType=new Common.UI.ComboBox({el:e("#textart-combo-fill-type"),cls:"input-group-nr",menuStyle:"min-width: 90px;",editable:!1,data:this._arrFillType}),this.cmbFillType.setValue(this._arrFillType[0].value),this.cmbFillType.on("selected",i.bind(this.onFillTypeSelect,this)),this.lockedControls.push(this.cmbFillType),this.numTransparency=new Common.UI.MetricSpinner({el:e("#textart-spin-transparency"),step:1,width:62,value:"100 %",defaultUnit:"%",maxValue:100,minValue:0}),this.numTransparency.on("change",i.bind(this.onNumTransparencyChange,this)),this.numTransparency.on("inputleave",function(){t.fireEvent("editcomplete",t)}),this.lockedControls.push(this.numTransparency),this.sldrTransparency=new Common.UI.SingleSlider({el:e("#textart-slider-transparency"),width:75,minValue:0,maxValue:100,value:100}),this.sldrTransparency.on("change",i.bind(this.onTransparencyChange,this)),this.sldrTransparency.on("changecomplete",i.bind(this.onTransparencyChangeComplete,this)),this.lockedControls.push(this.sldrTransparency),this.lblTransparencyStart=e(this.el).find("#textart-lbl-transparency-start"),this.lblTransparencyEnd=e(this.el).find("#textart-lbl-transparency-end"),this._arrGradType=[{displayValue:this.textLinear,value:Asc.c_oAscFillGradType.GRAD_LINEAR},{displayValue:this.textRadial,value:Asc.c_oAscFillGradType.GRAD_PATH}],this.cmbGradType=new Common.UI.ComboBox({el:e("#textart-combo-grad-type"),cls:"input-group-nr",menuStyle:"min-width: 90px;",editable:!1,data:this._arrGradType}),this.cmbGradType.setValue(this._arrGradType[0].value),this.cmbGradType.on("selected",i.bind(this.onGradTypeSelect,this)),this.lockedControls.push(this.cmbGradType),this._viewDataLinear=[{offsetx:0,offsety:0,type:45,subtype:-1,iconcls:"gradient-left-top"},{offsetx:50,offsety:0,type:90,subtype:4,iconcls:"gradient-top"},{offsetx:100,offsety:0,type:135,subtype:5,iconcls:"gradient-right-top"},{offsetx:0,offsety:50,type:0,subtype:6,iconcls:"gradient-left",cls:"item-gradient-separator",selected:!0},{offsetx:100,offsety:50,type:180,subtype:1,iconcls:"gradient-right"},{offsetx:0,offsety:100,type:315,subtype:2,iconcls:"gradient-left-bottom"},{offsetx:50,offsety:100,type:270,subtype:3,iconcls:"gradient-bottom"},{offsetx:100,offsety:100,type:225,subtype:7,iconcls:"gradient-right-bottom"}],this._viewDataRadial=[{offsetx:100,offsety:150,type:2,subtype:5,iconcls:"gradient-radial-center"}],this.btnDirection=new Common.UI.Button({cls:"btn-large-dataview",iconCls:"item-gradient gradient-left",menu:new Common.UI.Menu({style:"min-width: 60px;",menuAlign:"tr-br",items:[{template:i.template('
    ')}]})}),this.btnDirection.on("render:after",function(n){t.mnuDirectionPicker=new Common.UI.DataView({el:e("#id-textart-menu-direction"),parentMenu:n.menu,restoreHeight:174,store:new Common.UI.DataViewStore(t._viewDataLinear),itemTemplate:i.template('
    ')})}),this.btnDirection.render(e("#textart-button-direction")),this.mnuDirectionPicker.on("item:click",i.bind(this.onSelectGradient,this,this.btnDirection)),this.lockedControls.push(this.btnDirection),this.sldrGradient=new Common.UI.MultiSliderGradient({el:e("#textart-slider-gradient"),width:192,minValue:0,maxValue:100,values:[0,100]}),this.sldrGradient.on("change",i.bind(this.onGradientChange,this)),this.sldrGradient.on("changecomplete",i.bind(this.onGradientChangeComplete,this)),this.sldrGradient.on("thumbclick",function(e,i){t.GradColor.currentIdx=i;var n=t.GradColor.colors[t.GradColor.currentIdx];t.btnGradColor.setColor(n),t.colorsGrad.select(n,!1);var o=t.GradColor.values[t.GradColor.currentIdx];t.spnGradPosition.setValue(o,!0)}),this.sldrGradient.on("thumbdblclick",function(e){t.btnGradColor.cmpEl.find("button").dropdown("toggle")}),this.sldrGradient.on("sortthumbs",function(e,n){var o,s=[];i.each(n,function(e,i){s.push(t.GradColor.colors[e]),t.GradColor.currentIdx==e&&(o=i)}),t.OriginalFillType=null,t.GradColor.colors=s,t.GradColor.currentIdx=o}),this.sldrGradient.on("addthumb",function(e,i,n){t.GradColor.colors[i]=t.GradColor.colors[t.GradColor.currentIdx],t.GradColor.currentIdx=i;var o=t.sldrGradient.addNewThumb(i,n);t.GradColor.colors[t.GradColor.currentIdx]=o}),this.sldrGradient.on("removethumb",function(e,n){if(t.sldrGradient.removeThumb(n),t.GradColor.values.splice(n,1),t.sldrGradient.changeGradientStyle(),i.isUndefined(t.GradColor.currentIdx)||t.GradColor.currentIdx>=t.GradColor.colors.length){var o=n>0?n-1:n;o=0===o&&t.GradColor.values.length>2?t.GradColor.values.length-2:o,t.GradColor.currentIdx=o}t.sldrGradient.setActiveThumb(t.GradColor.currentIdx)}),this.lockedControls.push(this.sldrGradient),this.spnGradPosition=new Common.UI.MetricSpinner({el:e("#textart-gradient-position"),step:1,width:60,defaultUnit:"%",value:"50 %",allowDecimal:!1,maxValue:100,minValue:0,disabled:this._locked}),this.lockedControls.push(this.spnGradPosition),this.spnGradPosition.on("change",i.bind(this.onPositionChange,this)),this.spnGradPosition.on("inputleave",function(){t.fireEvent("editcomplete",t)}),this.btnAddGradientStep=new Common.UI.Button({parentEl:e("#textart-gradient-add-step"),cls:"btn-toolbar",iconCls:"toolbar__icon btn-add-breakpoint",disabled:this._locked,hint:this.tipAddGradientPoint}),this.btnAddGradientStep.on("click",i.bind(this.onAddGradientStep,this)),this.lockedControls.push(this.btnAddGradientStep),this.btnRemoveGradientStep=new Common.UI.Button({parentEl:e("#textart-gradient-remove-step"),cls:"btn-toolbar",iconCls:"toolbar__icon btn-remove-breakpoint",disabled:this._locked,hint:this.tipRemoveGradientPoint}),this.btnRemoveGradientStep.on("click",i.bind(this.onRemoveGradientStep,this)),this.lockedControls.push(this.btnRemoveGradientStep),this.numGradientAngle=new Common.UI.MetricSpinner({el:e("#textart-spin-gradient-angle"),step:10,width:60,defaultUnit:"°",value:"0 °",allowDecimal:!0,maxValue:359.9,minValue:0,disabled:this._locked}),this.lockedControls.push(this.numGradientAngle),this.numGradientAngle.on("change",i.bind(this.onGradientAngleChange,this)),this.numGradientAngle.on("inputleave",function(){t.fireEvent("editcomplete",t)}),this.cmbBorderSize=new Common.UI.ComboBorderSizeEditable({el:e("#textart-combo-border-size"),style:"width: 93px;",txtNoBorders:this.txtNoBorders}).on("selected",i.bind(this.onBorderSizeSelect,this)).on("changed:before",i.bind(this.onBorderSizeChanged,this,!0)).on("changed:after",i.bind(this.onBorderSizeChanged,this,!1)).on("combo:blur",i.bind(this.onComboBlur,this,!1)),this.BorderSize=this.cmbBorderSize.store.at(2).get("value"),this.cmbBorderSize.setValue(this.BorderSize),this.lockedControls.push(this.cmbBorderSize),this.cmbBorderType=new Common.UI.ComboBorderType({el:e("#textart-combo-border-type"),style:"width: 93px;",menuStyle:"min-width: 93px;"}).on("selected",i.bind(this.onBorderTypeSelect,this)).on("combo:blur",i.bind(this.onComboBlur,this,!1)),this.BorderType=Asc.c_oDashType.solid,this.cmbBorderType.setValue(this.BorderType),this.lockedControls.push(this.cmbBorderType),this.cmbTransform=new Common.UI.ComboDataView({itemWidth:50,itemHeight:50,menuMaxHeight:300,enableKeyEvents:!0,cls:"combo-textart"}),this.cmbTransform.render(e("#textart-combo-transform")),this.cmbTransform.openButton.menu.cmpEl.css({"min-width":178,"max-width":178}),this.cmbTransform.on("click",i.bind(this.onTransformSelect,this)),this.cmbTransform.openButton.menu.on("show:after",function(){t.cmbTransform.menuPicker.scroller.update({alwaysVisibleY:!0})}),this.lockedControls.push(this.cmbTransform)},createDelayedElements:function(){this._initSettings=!1,this.createDelayedControls();var t=[0,1,3,2,4,53,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,22,23,24,25,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,49,50,51,52];this.patternViewData=[];for(var e=0;e<13;e++)for(var i=0;i<4;i++){var n=4*e+i;this.patternViewData[n]={offsetx:28*i,offsety:28*e,type:t[n]}}this.patternViewData.splice(this.patternViewData.length-2,2);for(var e=0;e0&&(this.cmbPattern.fillComboView(this.cmbPattern.menuPicker.store.at(0),!0),this.PatternFillType=this.patternViewData[0].type),this.UpdateThemeColors(),this.onInitStandartTextures(),this.fillTextArt(),this.fillTransform(this.api.asc_getPropertyEditorTextArts())},onInitStandartTextures:function(t){var n=this;if(t&&t.length>0&&(n._texturearray=[],i.each(t,function(t){n._texturearray.push({imageUrl:t.get_image(),name:n.textureNames[t.get_id()],type:t.get_id(),selected:!1})})),n._texturearray&&!(n._texturearray.length<1)&&!this._initSettings&&!this.btnTexture){this.btnTexture=new Common.UI.ComboBox({el:e("#textart-combo-fill-texture"),template:i.template(['"].join(""))}),this.textureMenu=new Common.UI.Menu({items:[{template:i.template('
    ')}]}),this.textureMenu.render(e("#textart-combo-fill-texture")),this.lockedControls.push(this.btnTexture);var o=function(t){new Common.UI.DataView({el:e("#id-textart-menu-texture"),restoreHeight:174,parentMenu:t,showLast:!1,store:new Common.UI.DataViewStore(n._texturearray||[]),itemTemplate:i.template('
    ')}).on("item:click",i.bind(n.onSelectTexture,n)),t.off("show:before",o)};this.textureMenu.on("show:before",o)}},onSelectTexture:function(t,i,n){if(this._fromTextureCmb=!0,this.cmbFillType.setValue(this._arrFillType[1].value),this._fromTextureCmb=!1,this.api){var o=new Asc.asc_TextArtProperties,s=new Asc.asc_CShapeFill;s.put_type(Asc.c_oAscFill.FILL_TYPE_BLIP),s.put_fill(new Asc.asc_CFillBlip),s.get_fill().put_type(Asc.c_oAscFillBlipType.TILE),s.get_fill().put_texture_id(n.get("type")),o.asc_putFill(s),this.shapeprops.put_TextArtProperties(o),this.api.ShapeApply(this.shapeprops)}e(this.btnTexture.el).find(".form-control").prop("innerHTML",n.get("name")),this.fireEvent("editcomplete",this)},fillTextArt:function(){if(!this._initSettings){var t=this;this.cmbTextArt||(this.cmbTextArt=new Common.UI.ComboDataView({itemWidth:50,itemHeight:50,menuMaxHeight:300,enableKeyEvents:!0,showLast:!1,cls:"combo-textart"}),this.cmbTextArt.render(e("#textart-combo-template")),this.cmbTextArt.openButton.menu.cmpEl.css({"min-width":178,"max-width":178}),this.cmbTextArt.on("click",i.bind(this.onTextArtSelect,this)),this.cmbTextArt.openButton.menu.on("show:after",function(){t.cmbTextArt.menuPicker.scroller.update({alwaysVisibleY:!0})}),this.lockedControls.push(this.cmbTextArt));var n=this.application.getCollection("Common.Collections.TextArt").models,o=this.cmbTextArt.menuPicker.store.length;if(n.length<1)return void PE.getController("Main").fillTextArt(this.api.asc_getTextArtPreviews());if(o>0&&o==n.length){var s=this.cmbTextArt.menuPicker.store.models;i.each(n,function(t,e){s[e].set("imageUrl",t.get("imageUrl"))})}else this.cmbTextArt.menuPicker.store.reset(n),this.cmbTextArt.menuPicker.store.length>0&&this.cmbTextArt.fillComboView(this.cmbTextArt.menuPicker.store.at(0))}},onTextArtSelect:function(t,e){if(this.api&&!this._noApply){var i=new Asc.asc_TextArtProperties;i.asc_putStyle(e.get("data")),this.shapeprops.put_TextArtProperties(i),this.api.ShapeApply(this.shapeprops)}this.fireEvent("editcomplete",this)},fillTransform:function(t){if(t&&t.length>1&&t[1]){for(var e=[],n=t[1],o=0;o0&&i.each(s,function(t){e.push({imageUrl:t.Image,type:t.Type,selected:!1})})}this.cmbTransform.menuPicker.store.add(e),this.cmbTransform.menuPicker.store.length>0&&this.cmbTransform.fillComboView(this.cmbTransform.menuPicker.store.at(0),!0)}},onTransformSelect:function(t,e){if(this.api&&!this._noApply){var i=new Asc.asc_TextArtProperties;i.asc_putForm(e.get("type")),this.shapeprops.put_TextArtProperties(i),this.api.ShapeApply(this.shapeprops)}this.fireEvent("editcomplete",this)},UpdateThemeColors:function(){this._initSettings||(this.btnBackColor||(this.btnBackColor=new Common.UI.ColorButton({parentEl:e("#textart-back-color-btn"),transparent:!0,color:"transparent"}),this.lockedControls.push(this.btnBackColor),this.colorsBack=this.btnBackColor.getPicker(),this.btnBackColor.on("color:select",i.bind(this.onColorsBackSelect,this)),this.btnFGColor=new Common.UI.ColorButton({parentEl:e("#textart-foreground-color-btn"),color:"000000"}),this.lockedControls.push(this.btnFGColor),this.colorsFG=this.btnFGColor.getPicker(),this.btnFGColor.on("color:select",i.bind(this.onColorsFGSelect,this)),this.btnBGColor=new Common.UI.ColorButton({parentEl:e("#textart-background-color-btn"),color:"ffffff"}),this.lockedControls.push(this.btnBGColor),this.colorsBG=this.btnBGColor.getPicker(),this.btnBGColor.on("color:select",i.bind(this.onColorsBGSelect,this)),this.btnGradColor=new Common.UI.ColorButton({parentEl:e("#textart-gradient-color-btn"),color:"000000"}),this.lockedControls.push(this.btnGradColor),this.colorsGrad=this.btnGradColor.getPicker(),this.btnGradColor.on("color:select",i.bind(this.onColorsGradientSelect,this)),this.btnBorderColor=new Common.UI.ColorButton({parentEl:e("#textart-border-color-btn"),color:"000000"}),this.lockedControls.push(this.btnBorderColor),this.colorsBorder=this.btnBorderColor.getPicker(),this.btnBorderColor.on("color:select",i.bind(this.onColorsBorderSelect,this))),this.colorsBorder.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors()),this.colorsBack.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors()),this.colorsFG.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors()),this.colorsBG.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors()),this.colorsGrad.updateColors(Common.Utils.ThemeColor.getEffectColors(),Common.Utils.ThemeColor.getStandartColors()))},_pt2mm:function(t){return 25.4*t/72},_mm2pt:function(t){return 72*t/25.4},ShowHideElem:function(t){this.FillColorContainer.toggleClass("settings-hidden",t!==Asc.c_oAscFill.FILL_TYPE_SOLID),this.FillImageContainer.toggleClass("settings-hidden",t!==Asc.c_oAscFill.FILL_TYPE_BLIP),this.FillPatternContainer.toggleClass("settings-hidden",t!==Asc.c_oAscFill.FILL_TYPE_PATT),this.FillGradientContainer.toggleClass("settings-hidden",t!==Asc.c_oAscFill.FILL_TYPE_GRAD),this.TransparencyContainer.toggleClass("settings-hidden",t===Asc.c_oAscFill.FILL_TYPE_NOFILL||null===t)},setLocked:function(t){this._locked=t},disableControls:function(t){this._initSettings||this._state.DisabledControls!==t&&(this._state.DisabledControls=t,i.each(this.lockedControls,function(e){e.setDisabled(t)}),this.numGradientAngle.setDisabled(t||this.GradFillType!==Asc.c_oAscFillGradType.GRAD_LINEAR))},onPositionChange:function(t){var e=t.getNumberValue(),i=this.GradColor.currentIdx-1<0?0:this.GradColor.values[this.GradColor.currentIdx-1],n=this.GradColor.currentIdx+1n;if(this.api){this.GradColor.values[this.GradColor.currentIdx]=e;var s=new Asc.asc_TextArtProperties,a=new Asc.asc_CShapeFill;a.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD),a.put_fill(new Asc.asc_CFillGrad),a.get_fill().put_grad_type(this.GradFillType);var l=[];this.GradColor.values.forEach(function(t){l.push(1e3*t)}),a.get_fill().put_positions(l),s.asc_putFill(a),this.shapeprops.put_TextArtProperties(s),this.api.ShapeApply(this.shapeprops),o&&(this.sldrGradient.sortThumbs(),this.sldrGradient.trigger("change",this.sldrGradient),this.sldrGradient.trigger("changecomplete",this.sldrGradient))}},onAddGradientStep:function(){if(!(this.GradColor.colors.length>9)){var t=this.GradColor.currentIdx,e=(this.GradColor.values[t]+this.GradColor.values[t=this.GradColor.colors.length){var e=t>0?t-1:t;e=0===e&&this.GradColor.values.length>2?this.GradColor.values.length-2:e,this.GradColor.currentIdx=e}this.sldrGradient.setActiveThumb(this.GradColor.currentIdx),this.sldrGradient.trigger("change",this.sldrGradient),this.sldrGradient.trigger("changecomplete",this.sldrGradient)}},onGradientAngleChange:function(t,e,i,n){if(this.api&&!this._noApply){var o=new Asc.asc_TextArtProperties,s=new Asc.asc_CShapeFill;s.put_type(Asc.c_oAscFill.FILL_TYPE_GRAD),s.put_fill(new Asc.asc_CFillGrad),s.get_fill().put_grad_type(this.GradFillType),s.get_fill().put_linear_angle(6e4*t.getNumberValue()),s.get_fill().put_linear_scale(!0),o.asc_putFill(s),this.shapeprops.put_TextArtProperties(o),this.api.ShapeApply(this.shapeprops)}},txtNoBorders:"No Line",strStroke:"Stroke",strColor:"Color",strSize:"Size",strFill:"Fill",textColor:"Color Fill",textImageTexture:"Picture or Texture",textTexture:"From Texture",textFromUrl:"From URL",textFromFile:"From File",textStretch:"Stretch",textTile:"Tile",txtCanvas:"Canvas",txtCarton:"Carton",txtDarkFabric:"Dark Fabric",txtGrain:"Grain",txtGranite:"Granite",txtGreyPaper:"Grey Paper",txtKnit:"Knit",txtLeather:"Leather",txtBrownPaper:"Brown Paper",txtPapyrus:"Papyrus",txtWood:"Wood",strTransparency:"Opacity",textNoFill:"No Fill",textSelectTexture:"Select",textGradientFill:"Gradient Fill",textPatternFill:"Pattern",strBackground:"Background color",strForeground:"Foreground color",strPattern:"Pattern",textEmptyPattern:"No Pattern",textLinear:"Linear",textRadial:"Radial",textDirection:"Direction",textStyle:"Style",textGradient:"Gradient Points",textBorderSizeErr:"The entered value is incorrect.
    Please enter a value between 0 pt and 1584 pt.",textTransform:"Transform",textTemplate:"Template",strType:"Type",textPosition:"Position",tipAddGradientPoint:"Add gradient point",tipRemoveGradientPoint:"Remove gradient point",textAngle:"Angle"},PE.Views.TextArtSettings||{}))}),define("text!presentationeditor/main/app/template/SignatureSettings.template",[],function(){return'\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
    \n \n
    \n
    \n
    \n \n
    \n
    \n
    \n \n
    '}),define("presentationeditor/main/app/view/SignatureSettings",["text!presentationeditor/main/app/template/SignatureSettings.template","jquery","underscore","backbone","common/main/lib/component/Button"],function(t,e,i,n){"use strict";PE.Views.SignatureSettings=n.View.extend(i.extend({el:"#id-signature-settings",template:i.template(t),events:{},options:{alias:"SignatureSettings"},initialize:function(){this._state={DisabledEditing:!1,ready:!1,hasValid:!1,hasInvalid:!1,tip:void 0},this._locked=!1,this.render()},render:function(){this.$el.html(this.template({scope:this}));var t=PE.getController("Common.Controllers.Protection").getView();this.btnAddInvisibleSign=t.getButton("signature"),this.btnAddInvisibleSign.render(this.$el.find("#signature-invisible-sign")),this.viewValidList=new Common.UI.DataView({el:e("#signature-valid-sign"),enableKeyEvents:!1,itemTemplate:i.template(['
    ','
    nomargin<% } %>">
    ','
    <%= Common.Utils.String.htmlEncode(name) %>
    ','
    <%= Common.Utils.String.htmlEncode(date) %>
    ',"
    "].join(""))}),this.viewInvalidList=new Common.UI.DataView({el:e("#signature-invalid-sign"),enableKeyEvents:!1,itemTemplate:i.template(['
    ','
    nomargin<% } %>">
    ','
    <%= Common.Utils.String.htmlEncode(name) %>
    ','
    <%= Common.Utils.String.htmlEncode(date) %>
    ',"
    "].join(""))}),this.viewValidList.on("item:click",i.bind(this.onSelectSignature,this)),this.viewInvalidList.on("item:click",i.bind(this.onSelectSignature,this)),this.viewValidList.on("item:contextmenu",i.bind(this.onItemContextMenu,this)),this.viewInvalidList.on("item:contextmenu",i.bind(this.onItemContextMenu,this)),this.signatureMenu=new Common.UI.Menu({menuAlign:"tr-br",items:[{caption:this.strDetails,value:1},{caption:this.strDelete,value:3}]}),this.signatureMenu.on("item:click",i.bind(this.onMenuSignatureClick,this))},setApi:function(t){return this.api=t,this.api&&this.api.asc_registerCallback("asc_onUpdateSignatures",i.bind(this.onApiUpdateSignatures,this)),Common.NotificationCenter.on("document:ready",i.bind(this.onDocumentReady,this)),this},ChangeSettings:function(t){this._state.hasValid||this._state.hasInvalid||this.updateSignatures(this.api.asc_getSignatures())},setLocked:function(t){this._locked=t},setMode:function(t){this.mode=t},onApiUpdateSignatures:function(t){this._state.ready&&(this.updateSignatures(t),this.showSignatureTooltip(this._state.hasValid,this._state.hasInvalid))},updateSignatures:function(t){var e=this,n=[],o=[];i.each(t,function(t,e){var s=t.asc_getDate(),a={name:t.asc_getSigner1(),certificateId:t.asc_getId(),guid:t.asc_getGuid(),date:i.isEmpty(s)?"":new Date(s).toLocaleString(),invisible:!t.asc_getVisible()};0==t.asc_getValid()?n.push(a):o.push(a)}),e._state.hasValid=n.length>0,e._state.hasInvalid=o.length>0,this.viewValidList.store.reset(n),this.viewInvalidList.store.reset(o),this.$el.find(".valid").toggleClass("hidden",!e._state.hasValid),this.$el.find(".invalid").toggleClass("hidden",!e._state.hasInvalid),e.disableEditing(e._state.hasValid||e._state.hasInvalid)},onItemContextMenu:function(t,n,o,s){var a=this.signatureMenu;a.isVisible()&&a.hide();var l=e(this.el).offset(),r=[s.clientX*Common.Utils.zoom()-l.left+5,s.clientY*Common.Utils.zoom()-l.top+5];this.showSignatureMenu(o,r),a.menuAlign="tl-bl",a.menuAlignEl=null,a.setOffset(15,5),a.show(),i.delay(function(){a.cmpEl.focus()},10)},onSelectSignature:function(t,n,o,s){if(o){ +var a=e(s.target);if(a&&a.hasClass("caret")){var l=this.signatureMenu;if(l.isVisible())return void l.hide();var r=e(s.currentTarget),c=r.offset(),d=e(this.el).offset(),h=[c.left-d.left+r.width(),c.top-d.top+r.height()/2];this.showSignatureMenu(o,h),l.menuAlign="tr-br",l.menuAlignEl=r,l.setOffset(-20,-r.height()/2+3),l.show(),i.delay(function(){l.cmpEl.focus()},10),s.stopPropagation(),s.preventDefault()}}},showSignatureMenu:function(t,i){this.api.asc_gotoSignature(t.get("guid"));var n=this.signatureMenu,o=e(this.el),s=o.find("#menu-signature-container");n.rendered||(s.length<1&&(s=e('',n.id),o.append(s)),n.render(s),n.cmpEl.attr({tabindex:"-1"}),n.on({"show:after":function(t){t&&t.menuAlignEl&&t.menuAlignEl.toggleClass("over",!0)},"hide:after":function(t){t&&t.menuAlignEl&&t.menuAlignEl.toggleClass("over",!1)}})),n.items[1].setDisabled(this._locked),n.items[0].cmpEl.attr("data-value",t.get("certificateId")),n.cmpEl.attr("data-value",t.get("guid")),s.css({left:i[0],top:i[1]})},onMenuSignatureClick:function(t,e){var i=t.cmpEl.attr("data-value");switch(e.value){case 1:this.api.asc_ViewCertificate(e.cmpEl.attr("data-value"));break;case 3:this.api.asc_RemoveSignature(i)}},onDocumentReady:function(){this._state.ready=!0,this.updateSignatures(this.api.asc_getSignatures(),this.api.asc_getRequestSignatures()),this.showSignatureTooltip(this._state.hasValid,this._state.hasInvalid)},showSignatureTooltip:function(t,e){var i=this,n=i._state.tip;if(!t&&!e)return void(n&&n.isVisible()&&(n.close(),i._state.tip=void 0));var o=t||e,s=e?i.txtSignedInvalid:t?i.txtSigned:"";n&&n.isVisible()&&(s!==n.text||o!==n.showLink)&&(n.close(),i._state.tip=void 0),i._state.tip||(n=new Common.UI.SynchronizeTip({target:PE.getController("RightMenu").getView("RightMenu").btnSignature.btnEl,text:s,showLink:o,textLink:this.txtContinueEditing,placement:"left"}),n.on({dontshowclick:function(){Common.UI.warning({title:i.notcriticalErrorTitle,msg:i.txtEditWarning,buttons:["ok","cancel"],primary:"ok",callback:function(t){"ok"==t&&(n.close(),i._state.tip=void 0,i.api.asc_RemoveAllSignatures())}})},closeclick:function(){n.close(),i._state.tip=void 0}}),i._state.tip=n,n.show())},disableEditing:function(t){if(this._state.DisabledEditing!=t){this._state.DisabledEditing=t;var e=PE.getController("RightMenu");t&&"id-signature-settings"!==e.rightmenu.GetActivePane()&&e.rightmenu.clearSelection(),e.SetDisabled(t,!0),PE.getController("Toolbar").DisableToolbar(t,t),PE.getController("Statusbar").getView("Statusbar").SetDisabled(t),PE.getController("Common.Controllers.ReviewChanges").SetDisabled(t),PE.getController("DocumentHolder").getView("DocumentHolder").SetDisabled(t),PE.getController("LeftMenu").setPreviewMode(t);var i=PE.getController("Common.Controllers.Comments");i&&i.setPreviewMode(t)}},strSignature:"Signature",strValid:"Valid signatures",strInvalid:"Invalid signatures",strDetails:"Signature Details",txtSigned:"Valid signatures has been added to the presentation. The presentation is protected from editing.",txtSignedInvalid:"Some of the digital signatures in presentation are invalid or could not be verified. The presentation is protected from editing.",txtContinueEditing:"Edit anyway",notcriticalErrorTitle:"Warning",txtEditWarning:"Editing will remove the signatures from the presentation.
    Are you sure you want to continue?",strDelete:"Remove Signature"},PE.Views.SignatureSettings||{}))});var SCALE_MIN=40,MENU_SCALE_PART=260;if(define("presentationeditor/main/app/view/RightMenu",["text!presentationeditor/main/app/template/RightMenu.template","jquery","underscore","backbone","common/main/lib/component/Button","common/main/lib/component/MetricSpinner","common/main/lib/component/CheckBox","presentationeditor/main/app/view/ParagraphSettings","presentationeditor/main/app/view/ImageSettings","presentationeditor/main/app/view/ChartSettings","presentationeditor/main/app/view/TableSettings","presentationeditor/main/app/view/ShapeSettings","presentationeditor/main/app/view/SlideSettings","presentationeditor/main/app/view/TextArtSettings","presentationeditor/main/app/view/SignatureSettings","common/main/lib/component/Scroller"],function(t,e,i,n){"use strict";PE.Views.RightMenu=n.View.extend(i.extend({el:"#right-menu",template:i.template(t),events:{},initialize:function(){return this.minimizedMode=!0,this.btnText=new Common.UI.Button({hint:this.txtParagraphSettings,asctype:Common.Utils.documentSettingsType.Paragraph,enableToggle:!0,disabled:!0,toggleGroup:"tabpanelbtnsGroup",allowMouseEventsOnDisabled:!0}),this.btnTable=new Common.UI.Button({hint:this.txtTableSettings,asctype:Common.Utils.documentSettingsType.Table,enableToggle:!0,disabled:!0,toggleGroup:"tabpanelbtnsGroup",allowMouseEventsOnDisabled:!0}),this.btnImage=new Common.UI.Button({hint:this.txtImageSettings,asctype:Common.Utils.documentSettingsType.Image,enableToggle:!0,disabled:!0,toggleGroup:"tabpanelbtnsGroup",allowMouseEventsOnDisabled:!0}),this.btnSlide=new Common.UI.Button({hint:this.txtSlideSettings,asctype:Common.Utils.documentSettingsType.Slide,enableToggle:!0,disabled:!0,toggleGroup:"tabpanelbtnsGroup",allowMouseEventsOnDisabled:!0}),this.btnChart=new Common.UI.Button({hint:this.txtChartSettings,asctype:Common.Utils.documentSettingsType.Chart,enableToggle:!0,disabled:!0,toggleGroup:"tabpanelbtnsGroup",allowMouseEventsOnDisabled:!0}),this.btnShape=new Common.UI.Button({hint:this.txtShapeSettings,asctype:Common.Utils.documentSettingsType.Shape,enableToggle:!0,disabled:!0,toggleGroup:"tabpanelbtnsGroup",allowMouseEventsOnDisabled:!0}),this.btnTextArt=new Common.UI.Button({hint:this.txtTextArtSettings,asctype:Common.Utils.documentSettingsType.TextArt,enableToggle:!0,disabled:!0,toggleGroup:"tabpanelbtnsGroup",allowMouseEventsOnDisabled:!0}),this._settings=[],this._settings[Common.Utils.documentSettingsType.Paragraph]={panel:"id-paragraph-settings",btn:this.btnText},this._settings[Common.Utils.documentSettingsType.Table]={panel:"id-table-settings",btn:this.btnTable},this._settings[Common.Utils.documentSettingsType.Image]={panel:"id-image-settings",btn:this.btnImage},this._settings[Common.Utils.documentSettingsType.Slide]={panel:"id-slide-settings",btn:this.btnSlide},this._settings[Common.Utils.documentSettingsType.Shape]={panel:"id-shape-settings",btn:this.btnShape},this._settings[Common.Utils.documentSettingsType.Chart]={panel:"id-chart-settings",btn:this.btnChart},this._settings[Common.Utils.documentSettingsType.TextArt]={panel:"id-textart-settings",btn:this.btnTextArt},this},render:function(t){var n=e(this.el);this.trigger("render:before",this),this.defaultHideRightMenu=t.customization&&!!t.customization.hideRightMenu;var o=!Common.localStorage.getBool("pe-hide-right-settings",this.defaultHideRightMenu);return n.css("width",(o?MENU_SCALE_PART:SCALE_MIN)+"px"),n.show(),n.html(this.template({})),this.btnText.setElement(e("#id-right-menu-text"),!1),this.btnText.render(),this.btnTable.setElement(e("#id-right-menu-table"),!1),this.btnTable.render(),this.btnImage.setElement(e("#id-right-menu-image"),!1),this.btnImage.render(),this.btnSlide.setElement(e("#id-right-menu-slide"),!1),this.btnSlide.render(),this.btnChart.setElement(e("#id-right-menu-chart"),!1),this.btnChart.render(),this.btnShape.setElement(e("#id-right-menu-shape"),!1),this.btnShape.render(),this.btnTextArt.setElement(e("#id-right-menu-textart"),!1),this.btnTextArt.render(),this.btnText.on("click",i.bind(this.onBtnMenuClick,this)),this.btnTable.on("click",i.bind(this.onBtnMenuClick,this)),this.btnImage.on("click",i.bind(this.onBtnMenuClick,this)),this.btnSlide.on("click",i.bind(this.onBtnMenuClick,this)),this.btnChart.on("click",i.bind(this.onBtnMenuClick,this)),this.btnShape.on("click",i.bind(this.onBtnMenuClick,this)),this.btnTextArt.on("click",i.bind(this.onBtnMenuClick,this)),this.paragraphSettings=new PE.Views.ParagraphSettings,this.slideSettings=new PE.Views.SlideSettings,this.imageSettings=new PE.Views.ImageSettings,this.chartSettings=new PE.Views.ChartSettings,this.tableSettings=new PE.Views.TableSettings,this.shapeSettings=new PE.Views.ShapeSettings,this.textartSettings=new PE.Views.TextArtSettings,t&&t.isSignatureSupport&&(this.btnSignature=new Common.UI.Button({hint:this.txtSignatureSettings,asctype:Common.Utils.documentSettingsType.Signature,enableToggle:!0,disabled:!0,toggleGroup:"tabpanelbtnsGroup",allowMouseEventsOnDisabled:!0}),this._settings[Common.Utils.documentSettingsType.Signature]={panel:"id-signature-settings",btn:this.btnSignature},this.btnSignature.setElement(e("#id-right-menu-signature"),!1),this.btnSignature.render().setVisible(!0),this.btnSignature.on("click",i.bind(this.onBtnMenuClick,this)),this.signatureSettings=new PE.Views.SignatureSettings),i.isUndefined(this.scroller)&&(this.scroller=new Common.UI.Scroller({el:e(this.el).find(".right-panel"),suppressScrollX:!0,useKeyboard:!1})),o&&(e("#id-slide-settings").parent().css("display","inline-block"),e("#id-slide-settings").addClass("active")),this.trigger("render:after",this),this},setApi:function(t){this.api=t;var e=function(){this.fireEvent("editcomplete",this)};this.paragraphSettings.setApi(t).on("editcomplete",i.bind(e,this)),this.slideSettings.setApi(t).on("editcomplete",i.bind(e,this)),this.imageSettings.setApi(t).on("editcomplete",i.bind(e,this)),this.chartSettings.setApi(t).on("editcomplete",i.bind(e,this)),this.tableSettings.setApi(t).on("editcomplete",i.bind(e,this)),this.shapeSettings.setApi(t).on("editcomplete",i.bind(e,this)),this.textartSettings.setApi(t).on("editcomplete",i.bind(e,this)),this.signatureSettings&&this.signatureSettings.setApi(t).on("editcomplete",i.bind(e,this))},setMode:function(t){this.imageSettings&&this.imageSettings.setMode(t),this.shapeSettings&&this.shapeSettings.setMode(t),this.slideSettings&&this.slideSettings.setMode(t)},onBtnMenuClick:function(t,i){var n=e("#"+this._settings[t.options.asctype].panel),o=n.parent();t.pressed?(this.minimizedMode&&(e(this.el).width(MENU_SCALE_PART),o.css("display","inline-block"),this.minimizedMode=!1,Common.localStorage.setItem("pe-hide-right-settings",0)),o.find("> .active").removeClass("active"),n.addClass("active"),this.scroller&&this.scroller.scrollTop(0),this._settings[Common.Utils.documentSettingsType.Slide].isCurrent=t.options.asctype==Common.Utils.documentSettingsType.Slide):(o.css("display","none"),e(this.el).width(SCALE_MIN),this.minimizedMode=!0,Common.localStorage.setItem("pe-hide-right-settings",1)),this.fireEvent("rightmenuclick",[this,t.options.asctype,this.minimizedMode])},SetActivePane:function(t,i){if(!(this.minimizedMode&&!0!==i||void 0===this._settings[t]))if(this.minimizedMode)this._settings[t].btn.toggle(!0,!1),this._settings[t].btn.trigger("click",this._settings[t].btn);else{var n=e("#"+this._settings[t].panel);n.hasClass("active")||(n.parent().find("> .active").removeClass("active"),n.addClass("active"),this.scroller&&(this.scroller.update(),this.scroller.scrollTop(0))),this._settings[t].btn.isActive()||this._settings[t].btn.toggle(!0,!1)}},GetActivePane:function(){return this.minimizedMode?null:this.$el.find(".settings-panel.active")[0].id},clearSelection:function(){var t=e(".right-panel");t.find("> .active").removeClass("active"),this._settings.forEach(function(t){t.btn.isActive()&&t.btn.toggle(!1,!0)}),t.css("display","none"),e(this.el).width(SCALE_MIN),this.minimizedMode=!0,Common.NotificationCenter.trigger("layout:changed","rightmenu")},txtParagraphSettings:"Text Settings",txtImageSettings:"Image Settings",txtTableSettings:"Table Settings",txtShapeSettings:"Shape Settings",txtTextArtSettings:"Text Art Settings",txtSlideSettings:"Slide Settings",txtChartSettings:"Chart Settings",txtSignatureSettings:"Signature Settings"},PE.Views.RightMenu||{}))}),define("presentationeditor/main/app/controller/RightMenu",["core","presentationeditor/main/app/view/RightMenu"],function(){"use strict";PE.Controllers.RightMenu=Backbone.Controller.extend({models:[],collections:[],views:["RightMenu"],initialize:function(){this.editMode=!0,this._state={no_slides:void 0},this._initSettings=!0,this.addListeners({RightMenu:{rightmenuclick:this.onRightMenuClick}})},onLaunch:function(){this.rightmenu=this.createView("RightMenu"),this.rightmenu.on("render:after",_.bind(this.onRightMenuAfterRender,this))},onRightMenuAfterRender:function(t){t.shapeSettings.application=t.textartSettings.application=this.getApplication(),this._settings=[],this._settings[Common.Utils.documentSettingsType.Paragraph]={panelId:"id-paragraph-settings",panel:t.paragraphSettings,btn:t.btnText,hidden:1,locked:!1},this._settings[Common.Utils.documentSettingsType.Table]={panelId:"id-table-settings",panel:t.tableSettings,btn:t.btnTable,hidden:1,locked:!1},this._settings[Common.Utils.documentSettingsType.Image]={panelId:"id-image-settings",panel:t.imageSettings,btn:t.btnImage,hidden:1,locked:!1},this._settings[Common.Utils.documentSettingsType.Slide]={panelId:"id-slide-settings",panel:t.slideSettings,btn:t.btnSlide,hidden:1,locked:!1},this._settings[Common.Utils.documentSettingsType.Shape]={panelId:"id-shape-settings",panel:t.shapeSettings,btn:t.btnShape,hidden:1,locked:!1},this._settings[Common.Utils.documentSettingsType.TextArt]={panelId:"id-textart-settings",panel:t.textartSettings,btn:t.btnTextArt,hidden:1,locked:!1},this._settings[Common.Utils.documentSettingsType.Chart]={panelId:"id-chart-settings",panel:t.chartSettings,btn:t.btnChart,hidden:1,locked:!1},this._settings[Common.Utils.documentSettingsType.Signature]={panelId:"id-signature-settings",panel:t.signatureSettings,btn:t.btnSignature,hidden:1,props:{},locked:!1}},setApi:function(t){this.api=t,this.api.asc_registerCallback("asc_onUpdateSignatures",_.bind(this.onApiUpdateSignatures,this)),this.api.asc_registerCallback("asc_onCountPages",_.bind(this.onApiCountPages,this)),this.api.asc_registerCallback("asc_onCoAuthoringDisconnect",_.bind(this.onCoAuthoringDisconnect,this)),Common.NotificationCenter.on("api:disconnect",_.bind(this.onCoAuthoringDisconnect,this))},setMode:function(t){this.editMode=t.isEdit},onRightMenuClick:function(t,e,i){if(!i&&this.editMode){var n=this._settings[e].panel,o=this._settings[e].props;o&&n&&n.ChangeSettings.call(n,e==Common.Utils.documentSettingsType.Signature?void 0:o)}Common.NotificationCenter.trigger("layout:changed","rightmenu"),this.rightmenu.fireEvent("editcomplete",this.rightmenu)},onFocusObject:function(t){if(this.editMode){var e=!!this._initSettings&&!Common.localStorage.getBool("pe-hide-right-settings",this.rightmenu.defaultHideRightMenu);this._initSettings=!1;for(var i=0;i0?0:1,this._settings[Common.Utils.documentSettingsType.Signature].locked=!1,i=0;i=this._settings.length||void 0===this._settings[o])){var s=t[i].get_ObjectValue();this._settings[o].props=s,this._settings[o].hidden=0,o==Common.Utils.documentSettingsType.Slide?(this._settings[o].locked=s.get_LockDelete(),this._settings[o].lockedBackground=s.get_LockBackground(),this._settings[o].lockedEffects=s.get_LockTranzition(),this._settings[o].lockedTiming=s.get_LockTiming(),this._settings[o].lockedHeader=!!s.get_LockHeader&&s.get_LockHeader()):(this._settings[o].locked=s.get_Locked(),o==Common.Utils.documentSettingsType.Shape&&s.asc_getTextArtProperties()&&(this._settings[Common.Utils.documentSettingsType.TextArt].props=s,this._settings[Common.Utils.documentSettingsType.TextArt].hidden=0,this._settings[Common.Utils.documentSettingsType.TextArt].locked=s.get_Locked()))}}if(this._settings[Common.Utils.documentSettingsType.Slide].locked)for(i=0;i-1?r:a>=0?a:l>=0?l:Common.Utils.documentSettingsType.Slide,void 0!==h&&(this.rightmenu.SetActivePane(h,e),h!=Common.Utils.documentSettingsType.Signature?this._settings[h].panel.ChangeSettings.call(this._settings[h].panel,this._settings[h].props):this._settings[h].panel.ChangeSettings.call(this._settings[h].panel))}this._settings[Common.Utils.documentSettingsType.Image].needShow=!1,this._settings[Common.Utils.documentSettingsType.Chart].needShow=!1,this._settings[Common.Utils.documentSettingsType.Shape].needShow=!1}},onCoAuthoringDisconnect:function(){this.SetDisabled(!0),this.setMode({isEdit:!1})},SetDisabled:function(t,e){if(this.setMode({isEdit:!t}),this.rightmenu&&this.rightmenu.paragraphSettings)if(this.rightmenu.slideSettings.SetSlideDisabled(t,t,t,t),this.rightmenu.paragraphSettings.disableControls(t),this.rightmenu.shapeSettings.disableControls(t),this.rightmenu.textartSettings.disableControls(t),this.rightmenu.tableSettings.disableControls(t),this.rightmenu.imageSettings.disableControls(t),this.rightmenu.chartSettings.disableControls(t),!e&&this.rightmenu.signatureSettings&&this.rightmenu.btnSignature.setDisabled(t),t)this.rightmenu.btnSlide.setDisabled(t),this.rightmenu.btnText.setDisabled(t),this.rightmenu.btnTable.setDisabled(t),this.rightmenu.btnImage.setDisabled(t),this.rightmenu.btnShape.setDisabled(t),this.rightmenu.btnTextArt.setDisabled(t),this.rightmenu.btnChart.setDisabled(t);else{var i=this.api.getSelectedElements();i.length>0&&this.onFocusObject(i)}},onInsertTable:function(){this._settings[Common.Utils.documentSettingsType.Table].needShow=!0},onInsertImage:function(){this._settings[Common.Utils.documentSettingsType.Image].needShow=!0},onInsertChart:function(){this._settings[Common.Utils.documentSettingsType.Chart].needShow=!0},onInsertShape:function(){this._settings[Common.Utils.documentSettingsType.Shape].needShow=!0},onInsertTextArt:function(){this._settings[Common.Utils.documentSettingsType.TextArt].needShow=!0},UpdateThemeColors:function(){this.rightmenu.slideSettings.UpdateThemeColors(),this.rightmenu.tableSettings.UpdateThemeColors(),this.rightmenu.shapeSettings.UpdateThemeColors(),this.rightmenu.textartSettings.UpdateThemeColors()},updateMetricUnit:function(){this.rightmenu.paragraphSettings.updateMetricUnit(),this.rightmenu.chartSettings.updateMetricUnit(),this.rightmenu.imageSettings.updateMetricUnit(),this.rightmenu.tableSettings.updateMetricUnit()},createDelayedElements:function(){if(this.editMode&&this.api){this.api.asc_registerCallback("asc_doubleClickOnObject",_.bind(this.onDoubleClickOnObject,this));var t=this.api.getSelectedElements();t.length>0&&this.onFocusObject(t)}},onDoubleClickOnObject:function(t){if(this.editMode){var e=t.get_ObjectType(),i=this.getDocumentSettingsType(e);void 0===i||i>=this._settings.length||void 0===this._settings[i]||i!==Common.Utils.documentSettingsType.Paragraph&&(this.rightmenu.SetActivePane(i,!0),this._settings[i].panel.ChangeSettings.call(this._settings[i].panel,this._settings[i].props))}},onApiUpdateSignatures:function(t){if(this.rightmenu.signatureSettings){var e=!t||t.length<1,i=Common.Utils.documentSettingsType.Signature;this._settings[i].hidden=e?1:0,this._settings[i].btn.setDisabled(e),this._settings[i].panel.setLocked(this._settings[i].locked)}},onApiCountPages:function(t){this._state.no_slides!==t<=0&&this.editMode&&(this._state.no_slides=t<=0,this._state.no_slides&&!this.rightmenu.minimizedMode&&this.rightmenu.clearSelection(),this._settings[Common.Utils.documentSettingsType.Slide].btn.setDisabled(this._state.no_slides))},getDocumentSettingsType:function(t){switch(t){case Asc.c_oAscTypeSelectElement.Paragraph:return Common.Utils.documentSettingsType.Paragraph;case Asc.c_oAscTypeSelectElement.Table:return Common.Utils.documentSettingsType.Table;case Asc.c_oAscTypeSelectElement.Image:return Common.Utils.documentSettingsType.Image;case Asc.c_oAscTypeSelectElement.Shape:return Common.Utils.documentSettingsType.Shape;case Asc.c_oAscTypeSelectElement.Slide:return Common.Utils.documentSettingsType.Slide;case Asc.c_oAscTypeSelectElement.Chart:return Common.Utils.documentSettingsType.Chart}}})}),function(t){function e(t,e){for(var i=t.length;i--;)if(t[i]===e)return i;return-1}function i(t,e){if(t.length!=e.length)return!1;for(var i=0;i0;for(s in A)(!A[s]&&e(o.mods,+s)>-1||A[s]&&-1==e(o.mods,+s))&&(r=!1);(0!=o.mods.length||A[16]||A[18]||A[17]||A[91])&&!r||(!0===x||o.locked||!1===o.method(t,o))&&(t.preventDefault?t.preventDefault():t.returnValue=!1,t.stopPropagation&&t.stopPropagation(),t.cancelBubble&&(t.cancelBubble=!0))}}function s(t){var i,n=t.keyCode,o=e(P,n);if(o>=0&&P.splice(o,1),93!=n&&224!=n||(n=91),n in A){A[n]=!1;for(i in k)k[i]==n&&(l[i]=!1)}}function a(){for(w in A)A[w]=!1;for(w in k)l[w]=!1}function l(t,e,i){var n,o;n=g(t),void 0===i&&(i=e,e="all");for(var s=0;s1&&(o=f(t),t=[t[t.length-1]]),t=t[0],t=E(t),t in S||(S[t]=[]),S[t].push({shortcut:n[s],scope:e,method:i,key:n[s],mods:o})}function r(t,e){var n,o,s,a,l,r=[];for(n=g(t),a=0;a1&&(r=f(o),t=o[o.length-1]),t=E(t),void 0===e&&(e=u()),!S[t])return;for(s in S[t])l=S[t][s],l.scope===e&&i(l.mods,r)&&(S[t][s]={})}}function c(t){return"string"==typeof t&&(t=E(t)),-1!=e(P,t)}function d(){return P.slice(0)}function h(t){var e=(t.target||t.srcElement).tagName;return!("INPUT"==e||"SELECT"==e||"TEXTAREA"==e)}function p(t){T=t||"all"}function u(){return T||"all"}function m(t){var e,i,n;for(e in S)for(i=S[e],n=0;n1&&(r=f(s),t=s[s.length-1]),t=E(t),void 0===e&&(e=u()),S[t])for(a in S[t])l=S[t][a],l.scope===e&&i(l.mods,r)&&(S[t][a][n]=o)}function _(t,e){t?v(t,e,"locked",!0):x=!0}function y(t,e){t?v(t,e,"locked",!1):x=!1}var w,x,S={},A={16:!1,18:!1,17:!1,91:!1},T="all",k={"⇧":16,shift:16,"⌥":18,alt:18,option:18,"⌃":17,ctrl:17,control:17,"⌘":91,command:91},I={backspace:8,tab:9,clear:12,enter:13,return:13,esc:27,escape:27,space:32,left:37,up:38,right:39,down:40,del:46,delete:46,home:36,end:35,pageup:33,pagedown:34,",":188,".":190,"/":191,"`":192,"-":189,"=":187,";":186,"'":222,"[":219,"]":221,"\\":220,"ff-":173,"ff=":61},E=function(t){return I[t]||t.toUpperCase().charCodeAt(0)},P=[];for(w=1;w<20;w++)I["f"+w]=111+w;var M={16:"shiftKey",18:"altKey",17:"ctrlKey",91:"metaKey"};for(w in k)l[w]=!1;b(document,"keydown",function(t){o(t)}),b(document,"keyup",s),b(window,"focus",a);var U=t.key;t.key=l,t.key.setScope=p,t.key.getScope=u,t.key.deleteScope=m,t.key.filter=h,t.key.isPressed=c,t.key.getPressedKeyCodes=d,t.key.noConflict=C,t.key.unbind=r,t.key.suspend=_,t.key.resume=y,"undefined"!=typeof module&&(module.exports=key)}(this),define("keymaster",function(){}),void 0===Common)var Common={};if(Common.util=Common.util||{},define("common/main/lib/util/Shortcuts",["backbone","keymaster"],function(t){"use strict";var e=function(t){return this.cid=_.uniqueId("shortcuts"),this.initialize.apply(this,arguments),this};_.extend(e.prototype,t.Events,{initialize:function(){window.key.filter=function(t){return!0},Common.NotificationCenter.on({"modal:show":function(t){window.key.suspend()},"modal:close":function(t,e){e&&window.key.resume()},"modal:hide":function(t,e){e&&window.key.resume()}})},delegateShortcuts:function(t){if(t&&t.shortcuts){this.removeShortcuts(t);var e,i,n,o,s,a,l=[];for(s in t.shortcuts){if(e=t.shortcuts[s],_.isFunction(e))n=e;else if(!(n=t[e]))throw new Error("Method "+e+" does not exist");i=s.match(/^(\S+)\s*(.*)$/),a=i[1],o=i[2].length?i[2]:"all",n=_.bind(n,this),l.push(window.key(a,o,n))}}},removeShortcuts:function(t){if(t&&t.shortcuts){var e,i,n,o;for(n in t.shortcuts)e=n.match(/^(\S+)\s*(.*)$/),o=e[1],i=e[2].length?e[2]:"all",window.key.unbind(o,i)}},suspendEvents:function(t,e){window.key.suspend(t,e)},resumeEvents:function(t,e){window.key.resume(t,e)}}),e.extend=t.View.extend,Common.util.Shortcuts=new e}),define("common/main/lib/view/SaveAsDlg",["common/main/lib/component/Window","common/main/lib/component/LoadMask"],function(){"use strict";Common.Views.SaveAsDlg=Common.UI.Window.extend(_.extend({initialize:function(t){var e={};_.extend(e,{title:this.textTitle,width:420,height:681,header:!0},t),this.template=['
    '].join(""),e.tpl=_.template(this.template)(e),this.saveFolderUrl=t.saveFolderUrl||"",this.saveFileUrl=t.saveFileUrl||"",this.defFileName=t.defFileName||"",this.saveFolderUrl=this.saveFolderUrl.replace("{title}",encodeURIComponent(this.defFileName)).replace("{fileuri}",encodeURIComponent(this.saveFileUrl)),Common.UI.Window.prototype.initialize.call(this,e)},render:function(){Common.UI.Window.prototype.render.call(this),this.$window.find("> .body").css({height:"auto",overflow:"hidden"});var t=document.createElement("iframe");t.width="100%",t.height=645,t.align="top",t.frameBorder=0,t.scrolling="no",t.onload=_.bind(this._onLoad,this),$("#id-saveas-folder-placeholder").append(t),this.loadMask=new Common.UI.LoadMask({owner:$("#id-saveas-folder-placeholder")}),this.loadMask.setTitle(this.textLoading),this.loadMask.show(),t.src=this.saveFolderUrl;var e=this;this._eventfunc=function(t){e._onWindowMessage(t)},this._bindWindowEvents.call(this),this.on("close",function(t){e._unbindWindowEvents()})},_bindWindowEvents:function(){window.addEventListener?window.addEventListener("message",this._eventfunc,!1):window.attachEvent&&window.attachEvent("onmessage",this._eventfunc)},_unbindWindowEvents:function(){window.removeEventListener?window.removeEventListener("message",this._eventfunc):window.detachEvent&&window.detachEvent("onmessage",this._eventfunc)},_onWindowMessage:function(t){if(t&&window.JSON)try{this._onMessage.call(this,window.JSON.parse(t.data))}catch(t){}},_onMessage:function(t){t&&"onlyoffice"==t.Referer&&(_.isEmpty(t.error)?_.isEmpty(t.message)||Common.NotificationCenter.trigger("showmessage",{msg:t.message}):this.trigger("saveaserror",this,t.error),Common.NotificationCenter.trigger("window:close",this))},_onLoad:function(){this.loadMask&&this.loadMask.hide()},textTitle:"Folder for save",textLoading:"Loading"},Common.Views.SaveAsDlg||{}))}),define("text!presentationeditor/main/app/template/LeftMenu.template",[],function(){return'
    \r\n
    \r\n \r\n \r\n \x3c!-- /** coauthoring begin **/ --\x3e\r\n \r\n \r\n \x3c!-- /** coauthoring end **/ --\x3e\r\n \r\n \r\n \r\n
    \r\n
    \r\n \x3c!-- /** coauthoring begin **/ --\x3e\r\n \r\n \r\n \x3c!-- /** coauthoring end **/ --\x3e\r\n \r\n
    \r\n
    '}),define("common/main/lib/view/About",["common/main/lib/component/BaseView","common/main/lib/component/Scroller"],function(){"use strict";Common.Views.About=Common.UI.BaseView.extend(_.extend({menu:void 0,rendered:!1,options:{alias:"Common.Views.About"},initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,arguments),this.txtVersionNum="0.0.0", +this.template=_.template(['',"",'',"","",'","","",'","","",'',"",'',"","",'","","",'","","",'","","",'","","
    ','",'',"
    ','",'<%= supportemail %>',"
    ','",'',"
    ','<% print(publisherurl.replace(/https?:\\/{2}/, "").replace(/\\/$/,"")) %>',"
    ",'',"",'',"","",'","","",'","","",'","","",'","","",'","","",'","","",'","","",'',"",'','",'',"","",'',"","",'","",""].join("")),this.menu=t.menu},render:function(){if(!this.rendered){this.rendered=!0;var t=$(this.template({publishername:"Ascensio System SIA",publisheraddr:"20A-12 Ernesta Birznieka-Upisha street, Riga, Latvia, EU, LV-1050",publisherurl:"https://www.onlyoffice.com/",supportemail:"support@onlyoffice.com",phonenum:"+371 633-99867",scope:this}));this.cntLicenseeInfo=t.findById("#id-about-licensee-info"),this.cntLicensorInfo=t.findById("#id-about-licensor-info"),this.divCompanyLogo=t.findById("#id-about-company-logo"),this.lblCompanyName=t.findById("#id-about-company-name"),this.lblCompanyAddress=t.findById("#id-about-company-address"),this.lblCompanyMail=t.findById("#id-about-company-mail"),this.lblCompanyUrl=t.findById("#id-about-company-url"),this.lblCompanyLic=t.findById("#id-about-company-lic"),this.$el.html(t),this.$el.addClass("about-dlg"),this.licData&&this.setLicInfo(this.licData),_.isUndefined(this.scroller)&&(this.scroller=new Common.UI.Scroller({el:this.$el,suppressScrollX:!0}))}return this},setLicInfo:function(t){if(this.rendered)if(t&&"object"==typeof t&&"object"==typeof t.customer){var e=t.customer;$("#id-about-licensor-logo").addClass("hidden"),$("#id-about-licensor-short").removeClass("hidden"),this.cntLicensorInfo.addClass("hidden"),this.cntLicenseeInfo.removeClass("hidden"),this.cntLicensorInfo.removeClass("margin-bottom");var i=e.name;if(i&&i.length?this.lblCompanyName.text(i):this.lblCompanyName.parents("tr").addClass("hidden"),i=e.address,i&&i.length?this.lblCompanyAddress.text(i):this.lblCompanyAddress.parents("tr").addClass("hidden"),(i=e.mail)&&i.length?this.lblCompanyMail.attr("href","mailto:"+i).text(i):this.lblCompanyMail.parents("tr").addClass("hidden"),(i=e.www)&&i.length){var n=/^https?:\/{2}/i.test(i)?"":"http://";this.lblCompanyUrl.attr("href",n+i).text(i)}else this.lblCompanyUrl.parents("tr").addClass("hidden");(i=e.info)&&i.length?this.lblCompanyLic.text(i):this.lblCompanyLic.parents("tr").addClass("hidden"),(i=e.logo)&&i.length?this.divCompanyLogo.html(''):this.divCompanyLogo.parents("tr").addClass("hidden")}else this.cntLicenseeInfo.addClass("hidden"),this.cntLicensorInfo.addClass("margin-bottom");else this.licData=t||!0},show:function(){this.rendered||this.render(),Common.UI.BaseView.prototype.show.call(this,arguments),this.fireEvent("show",this)},hide:function(){Common.UI.BaseView.prototype.hide.call(this,arguments),this.fireEvent("hide",this)},setMode:function(t){t.isLightVersion&&($("#id-about-licensor-version-name").text(this.txtEdition+this.txtVersion+this.txtVersionNum),$("#id-about-licensee-version-name").text(this.txtEdition+this.txtVersion+this.txtVersionNum))},txtPoweredBy:"Powered by",txtVersion:"Version ",txtLicensor:"LICENSOR",txtLicensee:"LICENSEE",txtAddress:"address: ",txtMail:"email: ",txtTel:"tel.: ",txtEdition:"Integration Edition "},Common.Views.About||{}))}),define("text!common/main/lib/template/Comments.template",[],function(){return'<% if (!hide) { %>\r\n
    \r\n\r\n \x3c!-- comment block --\x3e\r\n\r\n
    \r\n
    <%= scope.getUserName(username) %>\r\n
    \r\n
    <%=date%>
    \r\n <% if (quote!==null && quote!==\'\') { %>\r\n
    <%=scope.getFixedQuote(quote)%>
    \r\n <% } %>\r\n <% if (!editText || scope.viewmode) { %>\r\n
    <%=scope.pickLink(comment)%>
    \r\n <% } else { %>\r\n
    \r\n \r\n \r\n \r\n
    \r\n <% } %>\r\n\r\n \x3c!-- replys elements --\x3e\r\n\r\n <% if (replys.length) { %>\r\n
    \r\n <% _.each(replys, function (item, index) { %>\r\n
    style="padding-bottom: 0;" <% } %>;>\r\n
    \r\n
    <%=item.get("usercolor")%><% } else { %> #cfcfcf <% } %>; " >
    <%= scope.getUserName(item.get("username")) %>\r\n
    \r\n
    <%=item.get("date")%>
    \r\n <% if (!item.get("editText")) { %>\r\n
    <%=scope.pickLink(item.get("reply"))%>
    \r\n <% if (!scope.viewmode) { %>\r\n
    \r\n <% if (item.get("editable")) { %>\r\n
    ">
    \r\n
    ">
    \r\n <% } %>\r\n
    \r\n <%}%>\r\n <% } else { %>\r\n
    \r\n \r\n \r\n \r\n
    \r\n <% } %>\r\n
    \r\n <% }); %>\r\n <% } %>\r\n\r\n \x3c!-- add reply button --\x3e\r\n\r\n <% if (!showReply && !scope.viewmode) { %>\r\n <% if (replys.length) { %>\r\n \r\n <% } else { %>\r\n \r\n <% } %>\r\n <% } %>\r\n\r\n \x3c!-- edit buttons --\x3e\r\n\r\n <% if (!editText && !lock && !scope.viewmode) { %>\r\n
    \r\n <% if (editable) { %>\r\n
    \r\n
    \r\n <% } %>\r\n <% if (resolved) { %>\r\n
    \r\n <% } else { %>\r\n
    \r\n <% } %>\r\n
    \r\n <% } %>\r\n\r\n \x3c!-- reply --\x3e\r\n\r\n <% if (showReply) { %>\r\n
    \r\n \r\n \r\n \r\n
    \r\n <% } %>\r\n <% if (lock) { %>\r\n
    \r\n
    <%=lockuserid%>
    \r\n <% } %>\r\n <% if (!last) { %>\r\n
    \r\n <% } %>\r\n
    \r\n<% } %>\r\n'}),define("text!common/main/lib/template/CommentsPanel.template",[],function(){return'
    \r\n
    \r\n \r\n \r\n
    \r\n'}),void 0===Common)var Common={};if(Common.Views=Common.Views||{},define("common/main/lib/view/Comments",["text!common/main/lib/template/Comments.template","text!common/main/lib/template/CommentsPanel.template","common/main/lib/util/utils","common/main/lib/component/Button","common/main/lib/component/ComboBox","common/main/lib/component/DataView","common/main/lib/component/Layout","common/main/lib/component/Window"],function(t,e){"use strict";function i(t,e){var i,n,o=t;for(i in e)void 0!==i&&(n=e[i],o=o.replace(new RegExp(i,"g"),n));return o}var n=Common.UI.DataView.extend(function(){return{options:{handleSelect:!1,scrollable:!0,listenStoreEvents:!1,template:_.template('
    ')},getTextBox:function(){var t=$(this.el).find("textarea");return t&&t.length?t:void 0},setFocusToTextBox:function(){var t=$(this.el).find("textarea");if(t&&t.length){var e=t.val();t.focus(),t.val(""),t.val(e)}},getActiveTextBoxVal:function(){var t=$(this.el).find("textarea");return t&&t.length?t.val().trim():""},autoHeightTextBox:function(){function t(){n.scrollHeight>n.clientHeight?i.css({height:n.scrollHeight+s+"px"}):(a=n.clientHeight)>=o&&(i.css({height:o+"px"}),n.scrollHeight>n.clientHeight&&(l=Math.max(n.scrollHeight+s,o),i.css({height:l+"px"}))),e.autoScrollToEditButtons()}var e=this,i=$(this.el).find("textarea"),n=null,o=50,s=0,a=0,l=0;i&&i.length&&(n=i.get(0))&&(s=.25*parseInt(i.css("lineHeight"),10),t(),i.bind("input propertychange",t)),this.textBox=i},clearTextBoxBind:function(){this.textBox&&(this.textBox.unbind("input propertychange"),this.textBox=void 0)},autoScrollToEditButtons:function(){var t=$("#id-comments-change"),e=null,i=this.el.getBoundingClientRect(),n=0;t.length&&(e=t.get(0).getBoundingClientRect())&&i&&(n=i.bottom-(e.bottom+7))<0&&this.scroller.scrollTop(this.scroller.getScrollTop()-n)}}}());Common.Views.Comments=Common.UI.BaseView.extend(_.extend({el:"#left-panel-comments",template:_.template(e),addCommentHeight:45,newCommentHeight:110,textBoxAutoSizeLocked:void 0,viewmode:!1,_commentsViewOnItemClick:function(t,e,i,n){function o(){d.update()}var s,a,l,r,c,d=this;if(s=$(n.target))if(a=i.get("editText"),l=i.get("showReply"),r=i.get("uid"),c=s.attr("data-value"),s.hasClass("btn-edit"))_.isUndefined(c)?a||(d.fireEvent("comment:closeEditing"),i.set("editText",!0),t.autoHeightTextBox(),o(),t.setFocusToTextBox(),d.hookTextBox()):(d.fireEvent("comment:closeEditing",[r]),d.fireEvent("comment:editReply",[r,c]),d.commentsView.reply=c,t.autoHeightTextBox(),o(),d.hookTextBox(),t.autoScrollToEditButtons(),t.setFocusToTextBox());else if(s.hasClass("btn-delete"))_.isUndefined(c)?(d.fireEvent("comment:remove",[r]),Common.NotificationCenter.trigger("edit:complete",d)):d.fireEvent("comment:removeReply",[r,c]),d.fireEvent("comment:closeEditing"),o();else if(s.hasClass("user-reply"))d.fireEvent("comment:closeEditing"),i.set("showReply",!0),o(),t.autoHeightTextBox(),d.hookTextBox(),t.autoScrollToEditButtons(),t.setFocusToTextBox();else if(s.hasClass("btn-reply",!1))l&&(d.fireEvent("comment:addReply",[r,t.getActiveTextBoxVal()]),d.fireEvent("comment:closeEditing"),o());else if(s.hasClass("btn-close",!1))d.fireEvent("comment:closeEditing",[r]);else if(s.hasClass("btn-inner-edit",!1))_.isUndefined(d.commentsView.reply)?a&&d.fireEvent("comment:change",[r,t.getActiveTextBoxVal()]):(d.fireEvent("comment:changeReply",[r,d.commentsView.reply,t.getActiveTextBoxVal()]),d.commentsView.reply=void 0),d.fireEvent("comment:closeEditing"),o();else if(s.hasClass("btn-inner-close",!1))d.fireEvent("comment:closeEditing"),d.commentsView.reply=void 0,o();else if(s.hasClass("btn-resolve",!1)){var h=s.data("bs.tooltip");h&&(h.dontShow=!0),d.fireEvent("comment:resolve",[r]),o()}else if(s.hasClass("btn-resolve-check",!1)){var h=s.data("bs.tooltip");h&&(h.dontShow=!0),d.fireEvent("comment:resolve",[r]),o()}else if(!s.hasClass("msg-reply")&&!s.hasClass("btn-resolve-check")&&!s.hasClass("btn-resolve")){var p=!1;if(s.hasClass("user-message"))if(window.getSelection){var u=window.getSelection();p=""!==u.toString()}else document.selection&&(p=document.selection);d.fireEvent("comment:show",[r,!1,p])}},initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t),this.store=this.options.store},render:function(){var e=this;if(this.rendered||(this.$el.html(this.template({textAddCommentToDoc:e.textAddCommentToDoc,textAddComment:e.textAddComment,textCancel:e.textCancel,textEnterCommentHint:e.textEnterCommentHint,maxCommLength:Asc.c_oAscMaxCellOrCommentLength})),this.buttonAddCommentToDoc=new Common.UI.Button({el:$(".btn.new",this.$el),enableToggle:!1}),this.buttonAdd=new Common.UI.Button({action:"add",el:$(".btn.add",this.$el),enableToggle:!1}),this.buttonCancel=new Common.UI.Button({el:$(".btn.cancel",this.$el),enableToggle:!1}),this.buttonAddCommentToDoc.on("click",_.bind(this.onClickShowBoxDocumentComment,this)),this.buttonAdd.on("click",_.bind(this.onClickAddDocumentComment,this)),this.buttonCancel.on("click",_.bind(this.onClickCancelDocumentComment,this)),this.txtComment=$("#comment-msg-new",this.el),this.txtComment.keydown(function(t){if(!t.ctrlKey&&!t.metaKey||t.altKey||t.keyCode!=Common.UI.Keys.RETURN){if(t.keyCode===Common.UI.Keys.TAB){var i,n,o;o=this.selectionStart,n=this.selectionEnd,i=$(this),i.val(i.val().substring(0,o)+"\t"+i.val().substring(n)),this.selectionStart=this.selectionEnd=o+1,t.stopImmediatePropagation(),t.preventDefault()}}else e.onClickAddDocumentComment(),t.stopImmediatePropagation()})),this.commentsView)this.commentsView.onResetItems();else{this.commentsView=new n({el:$(".messages-ct",e.el),store:e.store,itemTemplate:_.template(i(t,{textAddReply:e.textAddReply,textAdd:e.textAdd,textCancel:e.textCancel,textEdit:e.textEdit,textReply:e.textReply,textClose:e.textClose,maxCommLength:Asc.c_oAscMaxCellOrCommentLength}))});var o=function(t,i,n){i.tipsArray&&i.tipsArray.forEach(function(t){t.remove()});var o=[],s=$(i.el).find(".btn-resolve");s.tooltip({title:e.textResolve,placement:"cursor"}),s.each(function(t,e){o.push($(e).data("bs.tooltip").tip())}),s=$(i.el).find(".btn-resolve-check"),s.tooltip({title:e.textOpenAgain,placement:"cursor"}),s.each(function(t,e){o.push($(e).data("bs.tooltip").tip())}),i.tipsArray=o};this.commentsView.on({"item:add":o,"item:remove":o,"item:change":o,"item:click":this._commentsViewOnItemClick.bind(this)})}return this.rendered||this.setupLayout(),this.update(),this.rendered=!0,this},update:function(){this.updateLayout(),this.updateScrolls()},updateScrolls:function(){this.commentsView&&this.commentsView.scroller&&this.commentsView.scroller.update({minScrollbarLength:40,alwaysVisibleY:!0})},showEditContainer:function(t){var e=$(".add-link-ct",this.el),i=$(".new-comment-ct",this.el);$(".messages-ct",this.el),$("#comments-box",this.el);this.layout.freezePanels(!t),t?(e.css({display:"none"}),i.css({display:"table-row"}),this.txtComment.val(""),this.txtComment.focus(),this.textBoxAutoSizeLocked=void 0):(e.css({display:"table-row"}),i.css({display:"none"})),this.updateLayout(),this.updateScrolls()},onClickShowBoxDocumentComment:function(){this.fireEvent("comment:closeEditing"),this.showEditContainer(!0)},onClickAddDocumentComment:function(){this.fireEvent("comment:add",[this,this.txtComment.val().trim(),void 0,!1,!0]),this.txtComment.val("")},onClickCancelDocumentComment:function(){this.showEditContainer(!1)},saveText:function(t){this.commentsView&&this.commentsView.cmpEl.find(".lock-area").length<1&&(this.textVal=void 0,t?this.commentsView.clearTextBoxBind():this.textVal=this.commentsView.getActiveTextBoxVal())},loadText:function(){if(this.textVal&&this.commentsView){var t=this.commentsView.getTextBox();t&&t.val(this.textVal)}},hookTextBox:function(){var t=this.commentsView.getTextBox();t&&t.keydown(function(t){if(!t.ctrlKey&&!t.metaKey||t.altKey||t.keyCode!=Common.UI.Keys.RETURN){if(t.keyCode===Common.UI.Keys.TAB){var e,i,n;n=this.selectionStart,i=this.selectionEnd,e=$(this),e.val(e.val().substring(0,n)+"\t"+e.val().substring(i)),this.selectionStart=this.selectionEnd=n+1,t.stopImmediatePropagation(),t.preventDefault()}}else{var o=$("#id-comments-change");o&&o.length&&o.click(),t.stopImmediatePropagation()}})},setupLayout:function(){var t=this,e=t.$el,i=$(".new-comment-ct",t.el),n=($(".add-link-ct",t.el),$("#comments-box",t.el)),o=n.find(" > .layout-item");t.layout=new Common.UI.VBoxLayout({box:n,freeze:!0,items:[{el:o[0],rely:!0,resize:{hidden:!1,autohide:!1,fmin:function(){var e=n.height();return"none"!==i.css("display")&&.5*e .layout-item");n.show(),this.layout.changeLayout([{el:a[0],rely:!0,resize:{hidden:!1,autohide:!1,fmin:function(){var t=s.height();return"none"!==i.css("display")&&.5*t'+t+""}),""}),(t.length<1e3||t.search(/\S{255,}/)<0)&&t.replace(Common.Utils.hostnameStrongRe,function(t){var o=/[\.,\?\+;:=!\(\)]+$/.exec(t);o&&(t=t.substring(0,o.index));var s=/(((^https?)|(^ftp)):\/\/)/i.test(t)?t:"http://"+t;return e=arguments[arguments.length-2],i=t.length,_.find(n,function(t){return e>=t.start&&et.start})||n.push({start:e,end:i+e,str:''+t+""}),""}),t.replace(Common.Utils.emailStrongRe,function(t){var o=/((^mailto:)\/\/)/i.test(t)?t:"mailto:"+t;return e=arguments[arguments.length-2],i=t.length,_.find(n,function(t){return e>=t.start&&et.start})||n.push({start:e,end:i+e,str:''+t+""}),""}),n=_.sortBy(n,function(t){return t.start});for(var o=n.length>0?Common.Utils.String.htmlEncode(t.substring(0,n[0].start))+n[0].str:Common.Utils.String.htmlEncode(t),s=1;s0&&(o+=Common.Utils.String.htmlEncode(t.substring(n[s-1].end,t.length))),o},pickEMail:function(t,e){var i=Common.Utils.String.htmlEncode(e).match(/\B[@+][A-Z0-9._%+-]+@[A-Z0-9._]+\.[A-Z]+\b/gi);i=_.map(i,function(t){return t.slice(1,t.length)}),i.length>0&&Common.Gateway.requestSendNotify({emails:i,actionId:t,actionLink:{action:{type:"comment",data:t}},message:e})},textComments:"Comments",textAnonym:"Guest",textAddCommentToDoc:"Add Comment to Document",textAddComment:"Add Comment",textCancel:"Cancel",textAddReply:"Add Reply",textReply:"Reply",textClose:"Close",textResolved:"Resolved",textResolve:"Resolve",textEnterCommentHint:"Enter your comment here",textEdit:"Edit",textAdd:"Add",textOpenAgain:"Open Again",textHintAddComment:"Add Comment"},Common.Views.Comments||{}))}),define("text!common/main/lib/template/Chat.template",[],function(){return'
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n
    \r\n \r\n \r\n
    \r\n
    \r\n
    '}),void 0===Common)var Common={};if(Common.Views=Common.Views||{},define("common/main/lib/view/Chat",["text!common/main/lib/template/Chat.template","common/main/lib/util/utils","common/main/lib/component/BaseView","common/main/lib/component/Layout"],function(t){"use strict";Common.Views.Chat=Common.UI.BaseView.extend(_.extend({el:"#left-panel-chat",template:_.template(t),storeUsers:void 0,storeMessages:void 0,tplUser:['
  • "<% if (!user.get("online")) { %> class="offline"<% } %>>','
    ;" >
    <%= scope.getUserName(user.get("username")) %>',"
    ","
  • "].join(""),templateUserList:_.template("
      <% for (originalId in users) { %><%= _.template(usertpl)({user: users[originalId][0], scope: scope}) %><% } %>
    "),tplMsg:["
  • ",'<% if (msg.get("type")==1) { %>','
    <%= msg.get("message") %>
    ',"<% } else { %>",'
    ','
    <%=msg.get("usercolor")%><% } else { %> #cfcfcf <% } %>; " >
    <%= scope.getUserName(msg.get("username")) %>',"
    ",'',"<% } %>","
  • "].join(""),templateMsgList:_.template("
      <% _.each(messages, function(item) { %><%= _.template(msgtpl)({msg: item, scope: scope}) %><% }); %>
    "),events:{},usersBoxHeight:72,messageBoxHeight:70,addMessageBoxHeight:110,initialize:function(t){_.extend(this,t),Common.UI.BaseView.prototype.initialize.call(this,arguments),this.storeUsers.bind({add:_.bind(this._onResetUsers,this),change:_.bind(this._onResetUsers,this),reset:_.bind(this._onResetUsers,this)}),this.storeMessages.bind({add:_.bind(this._onAddMessage,this),reset:_.bind(this._onResetMessages,this)})},render:function(t){return t=t||this.el,$(t).html(this.template({scope:this,maxMsgLength:Asc.c_oAscMaxCellOrCommentLength})),this.panelBox=$("#chat-box",this.el),this.panelUsers=$("#chat-users",this.el),this.panelMessages=$("#chat-messages",this.el),this.txtMessage=$("#chat-msg-text",this.el),this.panelOptions=$("#chat-options",this.el),this.panelUsers.scroller=new Common.UI.Scroller({el:$("#chat-users"),useKeyboard:!0,minScrollbarLength:25}),this.panelMessages.scroller=new Common.UI.Scroller({el:$("#chat-messages"),includePadding:!0,useKeyboard:!0,minScrollbarLength:40}),$("#chat-msg-btn-add",this.el).on("click",_.bind(this._onBtnAddMessage,this)),this.txtMessage.on("keydown",_.bind(this._onKeyDown,this)),this.setupLayout(),this},focus:function(){var t=this;_.defer(function(){t.txtMessage.focus()},100),this.updateLayout(!0),this.setupAutoSizingTextBox()},_onKeyDown:function(t){t.keyCode==Common.UI.Keys.RETURN?!t.ctrlKey&&!t.metaKey||t.altKey||this._onBtnAddMessage(t):t.keyCode==Common.UI.Keys.ESC&&this.hide()},_onResetUsers:function(t,e){this.panelUsers&&(this.panelUsers.html(this.templateUserList({users:this.storeUsers.chain().filter(function(t){return t.get("online")}).groupBy(function(t){return t.get("idOriginal")}).value(),usertpl:this.tplUser,scope:this})),this.panelUsers.scroller.update({minScrollbarLength:25,alwaysVisibleY:!0}))},_onAddMessage:function(t,e,i){if(this.panelMessages){var n=this.panelMessages.find("ul");n&&n.length&&(this._prepareMessage(t),n.append(_.template(this.tplMsg)({msg:t,scope:this})),this.panelMessages.scroller.update({minScrollbarLength:40,alwaysVisibleY:!0}),this.panelMessages.scroller.scrollTop(n.get(0).getBoundingClientRect().height))}},_onResetMessages:function(t,e){if(this.panelMessages){t.each(function(t){this._prepareMessage(t)},this),this.panelMessages.html(this.templateMsgList({messages:t.models,msgtpl:this.tplMsg,scope:this})),this.panelMessages.scroller.update({minScrollbarLength:40,alwaysVisibleY:!0})}},_onBtnAddMessage:function(t){this.txtMessage&&(this.fireEvent("message:add",[this,this.txtMessage.val().trim()]),this.txtMessage.val(""),this.focus())},_prepareMessage:function(t){var e=this.storeUsers.findOriginalUser(t.get("userid"));t.set({usercolor:e?e.get("color"):null,message:this._pickLink(t.get("message"))},{silent:!0})},_pickLink:function(t){var e,i,n=[];t.replace(Common.Utils.ipStrongRe,function(t){var i=/[\.,\?\+;:=!\(\)]+$/.exec(t);return i&&(t=t.substring(0,i.index)),e=arguments[arguments.length-2],n.push({start:e,end:t.length+e,str:''+t+""}),""}),(t.length<1e3||t.search(/\S{255,}/)<0)&&t.replace(Common.Utils.hostnameStrongRe,function(t){var o=/[\.,\?\+;:=!\(\)]+$/.exec(t);o&&(t=t.substring(0,o.index));var s=/(((^https?)|(^ftp)):\/\/)/i.test(t)?t:"http://"+t;return e=arguments[arguments.length-2],i=t.length,_.find(n,function(t){return e>=t.start&&et.start})||n.push({start:e,end:i+e,str:''+t+""}),""}),t.replace(Common.Utils.emailStrongRe,function(t){var o=/((^mailto:)\/\/)/i.test(t)?t:"mailto:"+t;return e=arguments[arguments.length-2],i=t.length,_.find(n,function(t){return e>=t.start&&et.start})||n.push({start:e,end:i+e,str:''+t+""}),""}),n=_.sortBy(n,function(t){return t.start});for(var o=n.length>0?Common.Utils.String.htmlEncode(t.substring(0,n[0].start))+n[0].str:Common.Utils.String.htmlEncode(t),s=1;s0&&(o+=Common.Utils.String.htmlEncode(t.substring(n[s-1].end,t.length))),o},getUserName:function(t){return Common.Utils.String.htmlEncode(Common.Utils.UserInfoParser.getParsedName(t))},hide:function(){Common.UI.BaseView.prototype.hide.call(this,arguments),this.fireEvent("hide",this),this.textBoxAutoSizeLocked=void 0},setupLayout:function(){var t=this,e=$(t.el),i=this.panelBox.find(" > .layout-item");t.layout=new Common.UI.VBoxLayout({box:this.panelBox,items:[{el:i[0],rely:!0,behaviour:"splitter",resize:{hidden:!1,autohide:!1,fmin:function(){return t.usersBoxHeight},fmax:function(){return.5*t.panelBox.height()-t.messageBoxHeight}}},{el:i[1],rely:!0,behaviour:"splitter",resize:{hidden:!1,autohide:!1,fmin:function(){return Math.max(t.messageBoxHeight+t.usersBoxHeight,.5*t.panelBox.height())},fmax:function(){return t.panelBox.height()-t.addMessageBoxHeight}}},{el:i[2],stretch:!0}]}),t.layout.on("layout:resizedrag",function(e){t.updateScrolls(),t.usersCachedHeigt=t.panelUsers.height()+8+1,e.index||(t.textBoxAutoSizeLocked=!0)},this),$(window).on("resize",function(){"none"!==e.css("display")&&t.updateLayout()}),this.updateLayout();var n=this.panelBox.height();this.layout.setResizeValue(0,this.usersBoxHeight),this.layout.setResizeValue(1,Math.max(this.addMessageBoxHeight,Math.max(.5*n,n-t.panelOptions.height()-4))),this.setupAutoSizingTextBox(),this.txtMessage.bind("input propertychange",_.bind(this.updateHeightTextBox,this))},updateLayout:function(t){var e=this,i=this.panelBox.height();if(e.layout.setResizeValue(1,Math.max(e.addMessageBoxHeight,Math.max(.5*i,i-e.panelOptions.height()-4))),t){this.panelUsers.css("height");this.panelUsers.css("height","1px");var n=this.panelUsers.get(0).scrollHeight;e.layout.setResizeValue(0,Math.max(e.usersBoxHeight,Math.min(n+2,Math.floor(.5*i)-e.messageBoxHeight)))}else e.layout.setResizeValue(0,Math.max(e.usersBoxHeight,Math.min(e.usersCachedHeigt+2,Math.floor(.5*i)-e.messageBoxHeight)));e.updateScrolls(),e.updateHeightTextBox(null)},setupAutoSizingTextBox:function(){this.lineHeight=0,this.minHeight=44,this.lineHeight=1.25*parseInt(this.txtMessage.css("lineHeight"),10),this.updateHeightTextBox(!0)},updateHeightTextBox:function(t){var e,i,n=this.txtMessage;if(i=this.panelBox.height(),t&&0==n.val().length)return this.layout.setResizeValue(1,Math.max(this.addMessageBoxHeight,i-this.addMessageBoxHeight)),this.textBoxAutoSizeLocked=void 0,void this.updateScrolls();_.isUndefined(this.textBoxAutoSizeLocked)&&(n.height(),e=n.get(0).scrollHeight,n.css({height:this.minHeight+"px"}),n.height(),e=Math.max(n.get(0).scrollHeight+this.lineHeight,1),n.css({height:"100%"}),i=this.panelBox.height(),this.layout.setResizeValue(1,Math.max(this.addMessageBoxHeight,Math.min(i-e-40,i-this.addMessageBoxHeight)))&&this.updateScrolls())},updateScrolls:function(){this.panelUsers&&this.panelUsers.scroller&&this.panelMessages&&this.panelMessages.scroller&&(this.panelUsers.scroller.update({minScrollbarLength:25,alwaysVisibleY:!0}),this.panelMessages.scroller.update({minScrollbarLength:40,alwaysVisibleY:!0}))},textSend:"Send"},Common.Views.Chat||{}))}),void 0===Common)var Common={};if(Common.Views=Common.Views||{},define("common/main/lib/view/Plugins",["common/main/lib/util/utils","common/main/lib/component/BaseView","common/main/lib/component/Layout","common/main/lib/component/Window"],function(t){"use strict";Common.Views.Plugins=Common.UI.BaseView.extend(_.extend({el:"#left-panel-plugins",storePlugins:void 0,template:_.template(['
    ','','
    ',"
    ","
    ",'",'",'"].join(""),this.handler=o.handler,this.type=o.type,this.preview=o.preview,this.previewData=o.previewData,this.warning=o.warning||!1,this.closable=o.closable,this.codepages=o.codepages,this.settings=o.settings,this.api=o.api,this.validatePwd=o.validatePwd||!1,o.tpl=_.template(this.template)(o),Common.UI.Window.prototype.initialize.call(this,o)},render:function(){if(Common.UI.Window.prototype.render.call(this),this.$window){var t=this;this.closable||this.$window.find(".tool").hide(),this.$window.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this)),this.previewPanel=this.$window.find("#id-preview-data"),this.previewParent=this.previewPanel.parent(),this.previewScrolled=this.$window.find("#id-preview"),this.previewInner=this.previewScrolled.find("div:first-child"),this.type==Common.Utils.importTextType.DRM?(this.inputPwd=new Common.UI.InputField({el:$("#id-password-txt"),type:"text",validateOnBlur:!1,validation:function(e){return t.txtIncorrectPwd}}),this.$window.find("input").on("input",function(){""!==$(this).val()?"password"!==$(this).attr("type")&&$(this).attr("type","password"):$(this).attr("type","text")})):(this.initCodePages(),this.preview&&(this.previewData?this.previewCallback(this.previewData):this.updatePreview())),this.onPrimary=function(){return t._handleInput("ok"),!1}}},show:function(){if(Common.UI.Window.prototype.show.apply(this,arguments),this.type==Common.Utils.importTextType.DRM){var t=this;setTimeout(function(){t.inputPwd.cmpEl.find("input").focus(),t.validatePwd&&t.inputPwd.checkValidate()},500)}},onBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value)},onToolClose:function(){this._handleInput("cancel")},_handleInput:function(t){if(this.handler)if(this.type==Common.Utils.importTextType.DRM)this.handler.call(this,t,this.inputPwd.getValue());else{var e=this.cmbEncoding&&!this.cmbEncoding.isDisabled()?this.cmbEncoding.getValue():this.settings&&this.settings.asc_getCodePage()?this.settings.asc_getCodePage():0,i=this.cmbDelimiter?this.cmbDelimiter.getValue():null,n=-1==i?this.inputDelimiter.getValue():null;-1==i&&(i=null),this.closable||this.type!=Common.Utils.importTextType.TXT||Common.localStorage.setItem("de-settings-open-encoding",e);var o=this.separatorOptions?this.separatorOptions.decimal:void 0,s=this.separatorOptions?this.separatorOptions.thousands:void 0;this.handler.call(this,t,e,i,n,o,s)}this.close()},initCodePages:function(){var t,e,i,n=[],o=[],s=0,a=0;if(this.codepages){for(n=[], +t=0;t",'
  • ','
    <%= item.displayValue %>
    ','',"
  • ","<% }); %>"].join(""));this.cmbEncoding=new Common.UI.ComboBox({el:$("#id-codepages-combo",this.$window),style:"width: 100%;",menuStyle:"min-width: 100%; max-height: 200px;",cls:"input-group-nr",menuCls:"scrollable-menu",data:o,editable:!1,disabled:!0,search:!0,itemsTemplate:l}),this.cmbEncoding.setDisabled(!1);var r=this.settings&&this.settings.asc_getCodePage()?this.settings.asc_getCodePage():n[0][0];if(!this.closable&&this.type==Common.Utils.importTextType.TXT){var c=Common.localStorage.getItem("de-settings-open-encoding");c&&(r=parseInt(c))}this.cmbEncoding.setValue(r),this.preview&&this.cmbEncoding.on("selected",_.bind(this.onCmbEncodingSelect,this));var d=this.cmbEncoding.cmpEl.find("ul"),h=d.find("li:nth(0) a"),p=d.width()-parseInt(h.css("padding-left"))-parseInt(h.css("padding-right"))-50;d.find("li div").width(p)}this.type!=Common.Utils.importTextType.CSV&&this.type!=Common.Utils.importTextType.Paste&&this.type!=Common.Utils.importTextType.Columns||(this.cmbDelimiter=new Common.UI.ComboBox({el:$("#id-delimiters-combo",this.$window),style:"width: 100px;",menuStyle:"min-width: 100px;",cls:"input-group-nr",data:[{value:4,displayValue:this.txtComma},{value:2,displayValue:this.txtSemicolon},{value:3,displayValue:this.txtColon},{value:1,displayValue:this.txtTab},{value:5,displayValue:this.txtSpace},{value:-1,displayValue:this.txtOther}],editable:!1}),this.cmbDelimiter.setValue(this.settings&&this.settings.asc_getDelimiter()?this.settings.asc_getDelimiter():4),this.cmbDelimiter.on("selected",_.bind(this.onCmbDelimiterSelect,this)),this.inputDelimiter=new Common.UI.InputField({el:$("#id-delimiter-other"),style:"width: 30px;",maxLength:1,validateOnChange:!0,validateOnBlur:!1,value:this.settings&&this.settings.asc_getDelimiterChar()?this.settings.asc_getDelimiterChar():""}),this.inputDelimiter.setVisible(!1),this.preview&&this.inputDelimiter.on("changing",_.bind(this.updatePreview,this)),this.type!=Common.Utils.importTextType.Paste&&this.type!=Common.Utils.importTextType.Columns||(this.btnAdvanced=new Common.UI.Button({el:$("#id-delimiters-advanced")}),this.btnAdvanced.on("click",_.bind(this.onAdvancedClick,this))))},updatePreview:function(){var t=this.cmbEncoding&&!this.cmbEncoding.isDisabled()?this.cmbEncoding.getValue():this.settings&&this.settings.asc_getCodePage()?this.settings.asc_getCodePage():0,e=this.cmbDelimiter?this.cmbDelimiter.getValue():null,i=-1==e?this.inputDelimiter.getValue():null;switch(-1==e&&(e=null),this.type){case Common.Utils.importTextType.CSV:this.api.asc_decodeBuffer(this.preview,new Asc.asc_CTextOptions(t,e,i),_.bind(this.previewCallback,this));break;case Common.Utils.importTextType.TXT:this.api.asc_decodeBuffer(this.preview,new Asc.asc_CTextOptions(t),_.bind(this.previewCallback,this));break;case Common.Utils.importTextType.Paste:case Common.Utils.importTextType.Columns:var n=new Asc.asc_CTextOptions(t,e,i);this.separatorOptions&&(n.asc_setNumberDecimalSeparator(this.separatorOptions.decimal),n.asc_setNumberGroupSeparator(this.separatorOptions.thousands)),this.api.asc_TextImport(n,_.bind(this.previewCallback,this),this.type==Common.Utils.importTextType.Paste)}},previewCallback:function(t){t&&t.length&&(this.data=t,this.previewInner.height(17*t.length),this.scrollerY||(this.scrollerY=new Common.UI.Scroller({el:this.previewScrolled,minScrollbarLength:20,alwaysVisibleY:!0,alwaysVisibleX:!0,onChange:_.bind(function(){if(this.scrollerY){var t=this.scrollerY.getScrollTop(),e=Math.floor(t/17+.5),i=e+Math.min(6,this.data.length);i>this.data.length&&(i=this.data.length,e=this.data.length-6,t=17*e),this.previewParent.height(108),this.previewParent.css({top:t}),this.previewDataBlock(this.data.slice(e,i))}},this)})),this.scrollerY.update(),this.scrollerY.scrollTop(0))},previewDataBlock:function(t){if(_.isUndefined(this.scrollerX)||(this.scrollerX.destroy(),delete this.scrollerX),this.type==Common.Utils.importTextType.CSV||this.type==Common.Utils.importTextType.Paste||this.type==Common.Utils.importTextType.Columns){for(var e=0,i=0;ie&&(e=t[i].length);for(var n="",i=0;i';for(var o=0;o"+Common.Utils.String.htmlEncode(t[i][o])+"";for(o=t[i].length;o";n+=""}n+="
    "}else{for(var n="",i=0;i";n+="
    '+Common.Utils.String.htmlEncode(t[i])+"
    "}this.previewPanel.html(n),this.scrollerX=new Common.UI.Scroller({el:this.previewPanel,suppressScrollY:!0,alwaysVisibleX:!0,minScrollbarLength:20})},onCmbDelimiterSelect:function(t,e){this.inputDelimiter.setVisible(-1==e.value),-1==e.value&&this.inputDelimiter.cmpEl.find("input").focus(),this.preview&&this.updatePreview()},onCmbEncodingSelect:function(t,e){this.updatePreview()},onAdvancedClick:function(){if(SSE){var t=this,e=this.api.asc_getDecimalSeparator(),i=this.api.asc_getGroupSeparator();new SSE.Views.AdvancedSeparatorDialog({props:{decimal:e,thousands:i},handler:function(n,o){"ok"==n&&(t.separatorOptions={decimal:o.decimal.length>0?o.decimal:e,thousands:o.thousands.length>0?o.thousands:i})}}).show()}},txtDelimiter:"Delimiter",txtEncoding:"Encoding ",txtSpace:"Space",txtTab:"Tab",txtTitle:"Choose %1 options",txtPassword:"Password",txtTitleProtected:"Protected File",txtOther:"Other",txtIncorrectPwd:"Password is incorrect.",closeButtonText:"Close File",txtPreview:"Preview",txtComma:"Comma",txtColon:"Colon",txtSemicolon:"Semicolon",txtProtected:"Once you enter the password and open the file, the current password to the file will be reset.",txtAdvanced:"Advanced",txtOpenFile:"Enter a password to open the file"},Common.Views.OpenDialog||{}))}),define("common/main/lib/util/LocalStorage",["gateway"],function(){Common.localStorage=new function(){var t,e,i={},n=function(t){"localstorage"==t.type&&(i=t.keys)};Common.Gateway.on("internalcommand",n);var o=function(){h||Common.Gateway.internalMessage("localstorage",{cmd:"get",keys:e})},s=function(){h||Common.Gateway.internalMessage("localstorage",{cmd:"set",keys:i})},a=function(t,e,n){if(h)try{localStorage.setItem(t,e)}catch(t){}else i[t]=e,!0===n&&Common.Gateway.internalMessage("localstorage",{cmd:"set",keys:{name:e}})},l=function(t,e,i){a(t,e?1:0,i)},r=function(t){return h?localStorage.getItem(t):void 0===i[t]?null:i[t]},c=function(t,e){var i=r(t);return e=e||!1,null!==i?0!=parseInt(i):e},d=function(t){return null!==r(t)};try{var h=!!window.localStorage}catch(t){h=!1}return{getId:function(){return t},setId:function(e){t=e},getItem:r,getBool:c,setBool:l,setItem:a,setKeysFilter:function(t){e=t},getKeysFilter:function(){return e},itemExists:d,sync:o,save:s}}}),define("presentationeditor/main/app/model/ShapeGroup",["backbone"],function(t){"use strict";PE.Models=PE.Models||{},PE.Models.ShapeModel=t.Model.extend({defaults:function(){return{id:Common.UI.getId(),imageUrl:null,data:null}}}),PE.Models.ShapeGroup=t.Model.extend({defaults:function(){return{id:Common.UI.getId(),groupName:null,groupId:null,groupStore:null}}})}),define("presentationeditor/main/app/collection/ShapeGroups",["backbone","presentationeditor/main/app/model/ShapeGroup"],function(t){"use strict";if(void 0===e)var e={};e.Collections=e.Collections||{},PE.Collections.ShapeGroups=t.Collection.extend({model:PE.Models.ShapeGroup})}),define("presentationeditor/main/app/model/SlideLayout",["backbone"],function(t){"use strict";PE.Models=PE.Models||{},PE.Models.SlideLayout=t.Model.extend({defaults:function(){return{id:Common.UI.getId(),imageUrl:null,title:null,data:null}}})}),define("presentationeditor/main/app/collection/SlideLayouts",["backbone","presentationeditor/main/app/model/SlideLayout"],function(t){"use strict";PE.Collections=PE.Collections||{},PE.Collections.SlideLayouts=t.Collection.extend({model:PE.Models.SlideLayout,findLayoutByIndex:function(t){return this.find(function(e){return e.get("data").idx==t})}})}),define("presentationeditor/main/app/model/EquationGroup",["backbone"],function(t){"use strict";PE.Models=PE.Models||{},PE.Models.EquationModel=t.Model.extend({defaults:function(){return{id:Common.UI.getId(),data:null,width:0,height:0,posX:0,posY:0}}}),PE.Models.EquationGroup=t.Model.extend({defaults:function(){return{id:Common.UI.getId(),groupName:null,groupId:null,groupStore:null}}})}),define("presentationeditor/main/app/collection/EquationGroups",["backbone","presentationeditor/main/app/model/EquationGroup"],function(t){"use strict";if(void 0===e)var e={};e.Collections=e.Collections||{},PE.Collections.EquationGroups=t.Collection.extend({model:PE.Models.EquationGroup})}),define("presentationeditor/main/app/controller/Main",["core","irregularstack","common/main/lib/component/Window","common/main/lib/component/LoadMask","common/main/lib/component/Tooltip","common/main/lib/controller/Fonts","common/main/lib/collection/TextArt","common/main/lib/view/OpenDialog","common/main/lib/util/LocalStorage","presentationeditor/main/app/collection/ShapeGroups","presentationeditor/main/app/collection/SlideLayouts","presentationeditor/main/app/collection/EquationGroups"],function(){"use strict";PE.Controllers.Main=Backbone.Controller.extend(_.extend(function(){var t,e={about:"button#left-btn-about",feedback:"button#left-btn-support",goback:"#fm-btn-back > a, #header-back > div"},i={toolbar:"#viewport #toolbar",leftMenu:"#viewport #left-menu, #viewport #id-toolbar-full-placeholder-btn-settings, #viewport #id-toolbar-short-placeholder-btn-settings",rightMenu:"#viewport #right-menu",statusBar:"#statusbar"};return Common.localStorage.setId("presentation"),Common.localStorage.setKeysFilter("pe-,asc.presentation"),Common.localStorage.sync(),{models:[],collections:["ShapeGroups","SlideLayouts","EquationGroups","Common.Collections.TextArt"],views:[],initialize:function(){this.addListeners({FileMenu:{"settings:apply":_.bind(this.applySettings,this)},"Common.Views.ReviewChanges":{"settings:apply":_.bind(this.applySettings,this)}});var t=this,e=["blank","pixel","classic","official","green","lines","office","safari","dotted","corner","turtle","basic","office theme","green leaf"],i={Series:this.txtSeries,"Diagram Title":this.txtDiagramTitle,"X Axis":this.txtXAxis,"Y Axis":this.txtYAxis,"Your text here":this.txtArt,"Slide text":this.txtSlideText,Chart:this.txtSldLtTChart,ClipArt:this.txtClipArt,Diagram:this.txtDiagram,"Date and time":this.txtDateTime,Footer:this.txtFooter,Header:this.txtHeader,Media:this.txtMedia,Picture:this.txtPicture,Image:this.txtImage,"Slide number":this.txtSlideNumber,"Slide subtitle":this.txtSlideSubtitle,Table:this.txtSldLtTTbl,"Slide title":this.txtSlideTitle,Loading:this.txtLoading,"Click to add notes":this.txtAddNotes,"Click to add first slide":this.txtAddFirstSlide};e.forEach(function(e){i[e]=t["txtTheme_"+e.replace(/ /g,"_")]||e}),t.translationTable=i},onLaunch:function(){var t=this;if(this._state={isDisconnected:!1,usersCount:1,fastCoauth:!0,lostEditingRights:!1,licenseType:!1},this.languages=null,window.storagename="presentation",this.stackLongActions=new Common.IrregularStack({strongCompare:function(t,e){return t.id===e.id&&t.type===e.type},weakCompare:function(t,e){return t.type===e.type}}),!Common.Utils.isBrowserSupported())return Common.Utils.showBrowserRestriction(),void Common.Gateway.reportError(void 0,this.unsupportedBrowserErrorText);if(window.flat_desine=!0,this.api=this.getApplication().getController("Viewport").getApi(),Common.UI.FocusManager.init(),this.api){this.api.SetDrawingFreeze(!0),this.api.SetThemesPath("../../../../sdkjs/slide/themes/");var e=Common.localStorage.getBool("pe-settings-cachemode",!0);Common.Utils.InternalSettings.set("pe-settings-cachemode",e),this.api.asc_setDefaultBlitMode(!!e),e=Common.localStorage.getItem("pe-settings-fontrender"),null===e&&(e="3"),Common.Utils.InternalSettings.set("pe-settings-fontrender",e),this.api.SetFontRenderingMode(parseInt(e)),this.api.asc_registerCallback("asc_onError",_.bind(this.onError,this)),this.api.asc_registerCallback("asc_onDocumentContentReady",_.bind(this.onDocumentContentReady,this)),this.api.asc_registerCallback("asc_onOpenDocumentProgress",_.bind(this.onOpenDocument,this)),this.api.asc_registerCallback("asc_onThumbnailsShow",_.bind(this.onThumbnailsShow,this)),this.api.asc_registerCallback("asc_onDocumentUpdateVersion",_.bind(this.onUpdateVersion,this)),this.api.asc_registerCallback("asc_onServerVersion",_.bind(this.onServerVersion,this)),this.api.asc_registerCallback("asc_onDocumentName",_.bind(this.onDocumentName,this)),this.api.asc_registerCallback("asc_onPrintUrl",_.bind(this.onPrintUrl,this)),this.api.asc_registerCallback("asc_onMeta",_.bind(this.onMeta,this)),this.api.asc_registerCallback("asc_onAdvancedOptions",_.bind(this.onAdvancedOptions,this)),this.api.asc_registerCallback("asc_onSpellCheckInit",_.bind(this.loadLanguages,this)),Common.NotificationCenter.on("api:disconnect",_.bind(this.onCoAuthoringDisconnect,this)),Common.NotificationCenter.on("goback",_.bind(this.goBack,this)),Common.NotificationCenter.on("showmessage",_.bind(this.onExternalMessage,this)),this.isShowOpenDialog=!1,this.editorConfig={},this.appOptions={},Common.Gateway.on("init",_.bind(this.loadConfig,this)),Common.Gateway.on("showmessage",_.bind(this.onExternalMessage,this)),Common.Gateway.on("opendocument",_.bind(this.loadDocument,this)),Common.Gateway.appReady(),this.getApplication().getController("Viewport").setApi(this.api),this.getApplication().getController("Statusbar").setApi(t.api),$(document.body).on("focus","input, textarea",function(e){/area_id/.test(e.target.id)||(/msg-reply/.test(e.target.className)?t.dontCloseDummyComment=!0:/textarea-control/.test(e.target.className)?t.inTextareaControl=!0:!Common.Utils.ModalWindow.isVisible()&&/form-control/.test(e.target.className)&&(t.inFormControl=!0))}),$(document.body).on("blur","input, textarea",function(e){if(!Common.Utils.ModalWindow.isVisible()){if(/form-control/.test(e.target.className)&&(t.inFormControl=!1),t.getApplication().getController("LeftMenu").getView("LeftMenu").getMenu("file").isVisible())return;if(!e.relatedTarget||!/area_id/.test(e.target.id)&&!("input"==e.target.localName&&$(e.target).parent().find(e.relatedTarget).length>0)&&!("textarea"==e.target.localName&&$(e.target).closest(".asc-window").find(".dropdown-menu").find(e.relatedTarget).length>0)&&("input"!=e.relatedTarget.localName||!/form-control/.test(e.relatedTarget.className))&&("textarea"!=e.relatedTarget.localName||/area_id/.test(e.relatedTarget.id))){if(Common.Utils.isIE&&e.originalEvent&&e.originalEvent.target&&/area_id/.test(e.originalEvent.target.id)&&e.originalEvent.target===e.originalEvent.srcElement)return;t.api.asc_enableKeyEvents(!0),/msg-reply/.test(e.target.className)?t.dontCloseDummyComment=!1:/textarea-control/.test(e.target.className)&&(t.inTextareaControl=!1)}}}).on("dragover",function(t){var e=t.originalEvent;if(e.target&&$(e.target).closest("#editor_sdk").length<1)return e.preventDefault(),e.dataTransfer.dropEffect="none",!1}).on("dragstart",function(t){var e=t.originalEvent;if(e.target){var i=$(e.target);(i.closest(".combobox").length>0||i.closest(".dropdown-menu").length>0||i.closest(".ribtab").length>0||i.closest(".combo-dataview").length>0)&&e.preventDefault()}}),Common.NotificationCenter.on({"modal:show":function(e){Common.Utils.ModalWindow.show(),t.api.asc_enableKeyEvents(!1)},"modal:close":function(e){Common.Utils.ModalWindow.close(),Common.Utils.ModalWindow.isVisible()||t.api.asc_enableKeyEvents(!0)},"modal:hide":function(e){Common.Utils.ModalWindow.close(),Common.Utils.ModalWindow.isVisible()||t.api.asc_enableKeyEvents(!0)},"settings:unitschanged":_.bind(this.unitsChanged,this),"dataview:focus":function(t){},"dataview:blur":function(e){Common.Utils.ModalWindow.isVisible()||t.api.asc_enableKeyEvents(!0)},"menu:show":function(t){},"menu:hide":function(e,i){Common.Utils.ModalWindow.isVisible()||i||t.api.asc_enableKeyEvents(!0)},"edit:complete":_.bind(t.onEditComplete,t)}),this.initNames(),Common.util.Shortcuts.delegateShortcuts({shortcuts:{"command+s,ctrl+s,command+p,ctrl+p,command+k,ctrl+k,command+d,ctrl+d":_.bind(function(t){t.preventDefault(),t.stopPropagation()},this)}})}t.defaultTitleText="ONLYOFFICE",t.warnNoLicense=t.warnNoLicense.replace(/%1/g,"ONLYOFFICE"),t.warnNoLicenseUsers=t.warnNoLicenseUsers.replace(/%1/g,"ONLYOFFICE"),t.textNoLicenseTitle=t.textNoLicenseTitle.replace(/%1/g,"ONLYOFFICE"),t.warnLicenseExceeded=t.warnLicenseExceeded.replace(/%1/g,"ONLYOFFICE"),t.warnLicenseUsersExceeded=t.warnLicenseUsersExceeded.replace(/%1/g,"ONLYOFFICE")},loadConfig:function(e){this.editorConfig=$.extend(this.editorConfig,e.config),this.editorConfig.user=this.appOptions.user=Common.Utils.fillUserInfo(e.config.user,this.editorConfig.lang,this.textAnonymous),this.appOptions.isDesktopApp="desktop"==this.editorConfig.targetApp,this.appOptions.canCreateNew=this.editorConfig.canRequestCreateNew||!_.isEmpty(this.editorConfig.createUrl),this.appOptions.canOpenRecent=void 0!==this.editorConfig.recent&&!this.appOptions.isDesktopApp,this.appOptions.templates=this.editorConfig.templates,this.appOptions.recent=this.editorConfig.recent,this.appOptions.createUrl=this.editorConfig.createUrl,this.appOptions.canRequestCreateNew=this.editorConfig.canRequestCreateNew,this.appOptions.lang=this.editorConfig.lang,this.appOptions.location="string"==typeof this.editorConfig.location?this.editorConfig.location.toLowerCase():"",this.appOptions.sharingSettingsUrl=this.editorConfig.sharingSettingsUrl,this.appOptions.saveAsUrl=this.editorConfig.saveAsUrl,this.appOptions.fileChoiceUrl=this.editorConfig.fileChoiceUrl,this.appOptions.canAnalytics=!1,this.appOptions.canRequestClose=this.editorConfig.canRequestClose,this.appOptions.customization=this.editorConfig.customization,this.appOptions.canBackToFolder=!1!==this.editorConfig.canBackToFolder&&"object"==typeof this.editorConfig.customization&&"object"==typeof this.editorConfig.customization.goback&&(!_.isEmpty(this.editorConfig.customization.goback.url)||this.editorConfig.customization.goback.requestClose&&this.appOptions.canRequestClose),this.appOptions.canBack=!0===this.appOptions.canBackToFolder,this.appOptions.canPlugins=!1,this.appOptions.canRequestUsers=this.editorConfig.canRequestUsers,this.appOptions.canRequestSendNotify=this.editorConfig.canRequestSendNotify,this.appOptions.canRequestSaveAs=this.editorConfig.canRequestSaveAs,this.appOptions.canRequestInsertImage=this.editorConfig.canRequestInsertImage,this.appOptions.compatibleFeatures="object"==typeof this.appOptions.customization&&!!this.appOptions.customization.compatibleFeatures,this.appOptions.canRequestSharingSettings=this.editorConfig.canRequestSharingSettings,this.appOptions.mentionShare=!("object"==typeof this.appOptions.customization&&0==this.appOptions.customization.mentionShare),t=this.getApplication().getController("Viewport").getView("Common.Views.Header"),t.setCanBack(!0===this.appOptions.canBackToFolder,this.appOptions.canBackToFolder?this.editorConfig.customization.goback.text:""),this.editorConfig.lang&&this.api.asc_setLocale(this.editorConfig.lang),"us"!=this.appOptions.location&&"ca"!=this.appOptions.location||Common.Utils.Metric.setDefaultMetric(Common.Utils.Metric.c_MetricUnits.inch),this.editorConfig.customization&&(this.editorConfig.customization.toolbarNoTabs||"desktop"!==this.editorConfig.targetApp&&(this.editorConfig.customization.loaderName||this.editorConfig.customization.loaderLogo))||$("#editor-container").append('
    ');var i=Common.localStorage.getItem("pe-macros-mode");null===i?(i=this.editorConfig.customization?this.editorConfig.customization.macrosMode:"warn",i="enable"==i?1:"disable"==i?2:0):i=parseInt(i),Common.Utils.InternalSettings.set("pe-macros-mode",i),Common.Controllers.Desktop.init(this.appOptions)},loadDocument:function(e){this.permissions={},this.document=e.doc;var i={};if(e.doc){this.permissions=$.extend(this.permissions,e.doc.permissions);var n=$.extend({},e.doc.permissions),o=$.extend({},e.doc.options,this.editorConfig.actionLink||{}),s=new Asc.asc_CUserInfo;s.put_Id(this.appOptions.user.id),s.put_FullName(this.appOptions.user.fullname),i=new Asc.asc_CDocInfo,i.put_Id(e.doc.key),i.put_Url(e.doc.url),i.put_Title(e.doc.title),i.put_Format(e.doc.fileType),i.put_VKey(e.doc.vkey),i.put_Options(o),i.put_UserInfo(s),i.put_CallbackUrl(this.editorConfig.callbackUrl),i.put_Token(e.doc.token),i.put_Permissions(n),i.put_EncryptedInfo(this.editorConfig.encryptionKeys);var a=!this.editorConfig.customization||!1!==this.editorConfig.customization.macros;i.asc_putIsEnabledMacroses(!!a),a=!this.editorConfig.customization||!1!==this.editorConfig.customization.plugins,i.asc_putIsEnabledPlugins(!!a)}this.api.asc_registerCallback("asc_onGetEditorPermissions",_.bind(this.onEditorPermissions,this)),this.api.asc_registerCallback("asc_onLicenseChanged",_.bind(this.onLicenseChanged,this)),this.api.asc_registerCallback("asc_onRunAutostartMacroses",_.bind(this.onRunAutostartMacroses,this)),this.api.asc_setDocInfo(i),this.api.asc_getEditorPermissions(this.editorConfig.licenseUrl,this.editorConfig.customerId),e.doc&&t.setDocumentCaption(e.doc.title)},onProcessSaveResult:function(t){this.api.asc_OnSaveEnd(t.result),t&&!1===t.result&&Common.UI.error({title:this.criticalErrorTitle,msg:_.isEmpty(t.message)?this.errorProcessSaveResult:t.message})},onProcessRightsChange:function(t){if(t&&!1===t.enabled){var e=this,i=this._state.lostEditingRights;this._state.lostEditingRights=!this._state.lostEditingRights,this.api.asc_coAuthoringDisconnect(),Common.NotificationCenter.trigger("collaboration:sharingdeny"),Common.NotificationCenter.trigger("api:disconnect"),i||Common.UI.warning({title:this.notcriticalErrorTitle,maxwidth:600,msg:_.isEmpty(t.message)?this.warnProcessRightsChange:t.message,callback:function(){e._state.lostEditingRights=!1,e.onEditComplete()}})}},onDownloadAs:function(t){if(!this.appOptions.canDownload)return void Common.Gateway.reportError(Asc.c_oAscError.ID.AccessDeny,this.errorAccessDeny);this._state.isFromGatewayDownloadAs=!0;var e=t&&"string"==typeof t?Asc.c_oAscFileType[t.toUpperCase()]:null,i=[Asc.c_oAscFileType.PPTX,Asc.c_oAscFileType.ODP,Asc.c_oAscFileType.PDF,Asc.c_oAscFileType.PDFA,Asc.c_oAscFileType.POTX,Asc.c_oAscFileType.OTP];(!e||i.indexOf(e)<0)&&(e=Asc.c_oAscFileType.PPTX),this.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(e,!0))},onProcessMouse:function(t){if("mouseup"==t.type){var e=document.getElementById("editor_sdk");if(e){var i=e.getBoundingClientRect();this.api.OnMouseUp(t.x-i.left,t.y-i.top)}}},goBack:function(t){var e=this;if(!Common.Controllers.Desktop.process("goback"))if(e.appOptions.customization.goback.requestClose&&e.appOptions.canRequestClose)Common.Gateway.requestClose();else{var i=e.appOptions.customization.goback.url;t||!1===e.appOptions.customization.goback.blank?parent.location.href=i:window.open(i,"_blank")}},onEditComplete:function(t){var e=this.getApplication(),i=e.getController("Toolbar").getView("Toolbar");if(e.getController("DocumentHolder").getView("DocumentHolder").focus(),this.api&&this.appOptions.isEdit&&this.api.asc_isDocumentCanSave){var n=this.api.asc_isDocumentCanSave(),o=this.appOptions.forcesave,s=!!i.btnCollabChanges.rendered&&i.btnCollabChanges.cmpEl.hasClass("notify"),a=!n&&!s&&!o||this._state.isDisconnected||this._state.fastCoauth&&this._state.usersCount>1&&!o;i.btnSave.setDisabled(a)}},onLongActionBegin:function(t,e){var i={id:e,type:t};this.stackLongActions.push(i),this.setLongActionView(i)},onLongActionEnd:function(e,i){var n={id:i,type:e};if(this.stackLongActions.pop(n),t&&t.setDocumentCaption(this.api.asc_getDocumentName()),this.updateWindowTitle(!0),n=this.stackLongActions.get({type:Asc.c_oAscAsyncActionType.Information}))this.setLongActionView(n);else{var o=this;i!=Asc.c_oAscAsyncAction.Save&&i!=Asc.c_oAscAsyncAction.ForceSaveButton||this.appOptions.isOffline?o.getApplication().getController("Statusbar").setStatusCaption(""):this._state.fastCoauth&&this._state.usersCount>1?o._state.timerSave=setTimeout(function(){o.getApplication().getController("Statusbar").setStatusCaption(o.textChangesSaved,!1,3e3)},500):o.getApplication().getController("Statusbar").setStatusCaption(o.textChangesSaved,!1,3e3)}n=this.stackLongActions.get({type:Asc.c_oAscAsyncActionType.BlockInteraction}),n?this.setLongActionView(n):this.loadMask&&this.loadMask.hide(),!this.appOptions.isEdit||i!=Asc.c_oAscAsyncAction.Save&&i!=Asc.c_oAscAsyncAction.ForceSaveButton||this._state.fastCoauth&&!(this._state.usersCount<2)||this.synchronizeChanges(),e!=Asc.c_oAscAsyncActionType.BlockInteraction||(i==Asc.c_oAscAsyncAction.LoadDocumentFonts||i==Asc.c_oAscAsyncAction.ApplyChanges)&&(this.dontCloseDummyComment||this.inTextareaControl||Common.Utils.ModalWindow.isVisible()||this.inFormControl)||(this.onEditComplete(this.loadMask),this.api.asc_enableKeyEvents(!0))},setLongActionView:function(t){var e="",i="",n=!1;switch(t.id){case Asc.c_oAscAsyncAction.Open:e=this.openTitleText,i=this.openTextText;break;case Asc.c_oAscAsyncAction.Save:case Asc.c_oAscAsyncAction.ForceSaveButton:clearTimeout(this._state.timerSave),n=!0,e=this.saveTitleText,i=this.appOptions.isOffline?"":this.saveTextText;break;case Asc.c_oAscAsyncAction.ForceSaveTimeout:break;case Asc.c_oAscAsyncAction.LoadDocumentFonts:e=this.loadFontsTitleText,i=this.loadFontsTextText;break;case Asc.c_oAscAsyncAction.LoadDocumentImages:e=this.loadImagesTitleText,i=this.loadImagesTextText;break;case Asc.c_oAscAsyncAction.LoadFont:e=this.loadFontTitleText,i=this.loadFontTextText;break;case Asc.c_oAscAsyncAction.LoadImage:e=this.loadImageTitleText,i=this.loadImageTextText;break;case Asc.c_oAscAsyncAction.DownloadAs:e=this.downloadTitleText,i=this.downloadTextText;break;case Asc.c_oAscAsyncAction.Print:e=this.printTitleText,i=this.printTextText;break;case Asc.c_oAscAsyncAction.UploadImage:e=this.uploadImageTitleText,i=this.uploadImageTextText;break;case Asc.c_oAscAsyncAction.LoadTheme:e=this.loadThemeTitleText,i=this.loadThemeTextText;break;case Asc.c_oAscAsyncAction.ApplyChanges:e=this.applyChangesTitleText,i=this.applyChangesTextText;break;case Asc.c_oAscAsyncAction.PrepareToSave:e=this.savePreparingText,i=this.savePreparingTitle;break;case Asc.c_oAscAsyncAction.Waiting:e=this.waitText,i=this.waitText;break;case-255:e=this.txtEditingMode,i=this.txtEditingMode;break;case-256:e=this.loadingDocumentTitleText,i=this.loadingDocumentTextText;break;default:"string"==typeof t.id&&(e=t.id,i=t.id)}t.type==Asc.c_oAscAsyncActionType.BlockInteraction?(this.loadMask||(this.loadMask=new Common.UI.LoadMask({owner:$("#viewport")})),this.loadMask.setTitle(e),this.isShowOpenDialog||this.loadMask.show()):this.getApplication().getController("Statusbar").setStatusCaption(i,n)},onApplyEditRights:function(t){this.getApplication().getController("Statusbar").setStatusCaption(""),t&&!t.allowed&&Common.UI.info({title:this.requestEditFailedTitleText,msg:t.message||this.requestEditFailedMessageText})},onDocumentContentReady:function(){function e(){if(!window.AscDesktopEditor){var t=[];Common.Utils.isIE9m&&t.push(n.warnBrowserIE9),t.length&&n.showTips(t)}document.removeEventListener("visibilitychange",e)}if(!this._isDocReady){this._state.openDlg&&this._state.openDlg.close();var i,n=this;n._isDocReady=!0,Common.NotificationCenter.trigger("app:ready",n.appOptions),n.api.SetDrawingFreeze(!1),n.hidePreloader(),n.onLongActionEnd(Asc.c_oAscAsyncActionType.BlockInteraction,-256),Common.Utils.InternalSettings.set("pe-settings-datetime-default",Common.localStorage.getItem("pe-settings-datetime-default")),i=Common.localStorage.getItem("pe-settings-zoom"),Common.Utils.InternalSettings.set("pe-settings-zoom",i);var o=null!==i?parseInt(i):this.appOptions.customization&&this.appOptions.customization.zoom?parseInt(this.appOptions.customization.zoom):-1;-1==o?this.api.zoomFitToPage():-2==o?this.api.zoomFitToWidth():this.api.zoom(o>0?o:100),i=Common.localStorage.getBool("pe-settings-spellcheck",!(this.appOptions.customization&&!1===this.appOptions.customization.spellcheck)),Common.Utils.InternalSettings.set("pe-settings-spellcheck",i),n.api.asc_setSpellCheck(i),void 0!==document.hidden&&document.hidden?document.addEventListener("visibilitychange",e):e(),n.api.asc_registerCallback("asc_onStartAction",_.bind(n.onLongActionBegin,n)),n.api.asc_registerCallback("asc_onEndAction",_.bind(n.onLongActionEnd,n)),n.api.asc_registerCallback("asc_onCoAuthoringDisconnect",_.bind(n.onCoAuthoringDisconnect,n)),n.api.asc_registerCallback("asc_onPrint",_.bind(n.onPrint,n)),t.setDocumentCaption(n.api.asc_getDocumentName()),n.updateWindowTitle(!0),i=Common.localStorage.getBool("pe-settings-inputmode"),Common.Utils.InternalSettings.set("pe-settings-inputmode",i),n.api.SetTextBoxInputMode(i),n.appOptions.isEdit&&!n.appOptions.isOffline&&n.appOptions.canCoAuthoring?(i=Common.localStorage.getItem("pe-settings-coauthmode"),null===i&&!Common.localStorage.itemExists("pe-settings-autosave")&&n.appOptions.customization&&!1===n.appOptions.customization.autosave&&(i=0),n._state.fastCoauth=null===i||1==parseInt(i)):(n._state.fastCoauth=!n.appOptions.isEdit&&n.appOptions.isRestrictedEdit,n._state.fastCoauth&&(n.api.asc_setAutoSaveGap(1),Common.Utils.InternalSettings.set("pe-settings-autosave",1))),n.api.asc_SetFastCollaborative(n._state.fastCoauth),Common.Utils.InternalSettings.set("pe-settings-coauthmode",n._state.fastCoauth),Common.Utils.InternalSettings.set("pe-settings-showsnaplines",n.api.get_ShowSnapLines());var s=n.getApplication(),a=s.getController("Toolbar"),l=s.getController("Statusbar"),r=s.getController("DocumentHolder"),c=(s.getController("Common.Controllers.Fonts"),s.getController("RightMenu")),d=s.getController("LeftMenu"),h=s.getController("Common.Controllers.Chat"),p=s.getController("Common.Controllers.Plugins");if(d.getView("LeftMenu").getMenu("file").loadDocument({doc:n.document}),d.setMode(n.appOptions).setApi(n.api).createDelayedElements(),h.setApi(this.api).setMode(this.appOptions),s.getController("Common.Controllers.ExternalDiagramEditor").setApi(this.api).loadConfig({config:this.editorConfig,customization:this.editorConfig.customization}),p.setApi(n.api),r.setApi(n.api),r.createDelayedElements(),l.createDelayedElements(),d.getView("LeftMenu").disableMenu("all",!1),n.appOptions.canBranding&&n.getApplication().getController("LeftMenu").leftMenu.getMenu("about").setLicInfo(n.editorConfig.customization),r.getView("DocumentHolder").setApi(n.api).on("editcomplete",_.bind(n.onEditComplete,n)),s.getController("Viewport").getView("DocumentPreview").setApi(n.api).setMode(n.appOptions).on("editcomplete",_.bind(n.onEditComplete,n)),n.appOptions.isEdit){i=Common.localStorage.getItem("pe-settings-autosave"),null===i&&n.appOptions.customization&&!1===n.appOptions.customization.autosave&&(i=0),i=n._state.fastCoauth||null===i?n.appOptions.canCoAuthoring?1:0:parseInt(i),n.api.asc_setAutoSaveGap(i),Common.Utils.InternalSettings.set("pe-settings-autosave",i),n.appOptions.canForcesave&&(n.appOptions.forcesave=Common.localStorage.getBool("pe-settings-forcesave",n.appOptions.canForcesave),Common.Utils.InternalSettings.set("pe-settings-forcesave",n.appOptions.forcesave), +n.api.asc_setIsForceSaveOnUserSave(n.appOptions.forcesave)),i=Common.localStorage.getItem("pe-settings-paste-button"),null===i&&(i="1"),Common.Utils.InternalSettings.set("pe-settings-paste-button",parseInt(i)),n.api.asc_setVisiblePasteButton(!!parseInt(i)),n.loadAutoCorrectSettings(),n.needToUpdateVersion&&Common.NotificationCenter.trigger("api:disconnect");var u=setInterval(function(){if(window.styles_loaded){clearInterval(u),a.createDelayedElements(),r.getView("DocumentHolder").createDelayedElements(),n.setLanguages(),n.api.asc_registerCallback("asc_onUpdateLayout",_.bind(n.fillLayoutsStore,n)),n.updateThemeColors();var t=n.api.asc_getPropertyEditorShapes();t&&n.fillAutoShapes(t[0],t[1]),c.createDelayedElements(),n.api.asc_registerCallback("asc_onFocusObject",_.bind(n.onFocusObject,n)),a.activateControls(),n.needToUpdateVersion&&a.onApiCoAuthoringDisconnect(),n.api.UpdateInterfaceState(),Common.NotificationCenter.trigger("document:ready","main"),n.applyLicense()}},50)}else r.getView("DocumentHolder").createDelayedElementsViewer(),Common.NotificationCenter.trigger("document:ready","main"),"view"!==n.editorConfig.mode&&n.applyLicense();var m=~~(1e6*Math.random());$(".toolbar").prepend(Common.Utils.String.format('
    ',m)),setTimeout(function(){$(Common.Utils.String.format(".toolbar .lazy-{0}",m)).remove()},10),this.appOptions.canAnalytics,Common.Gateway.on("applyeditrights",_.bind(n.onApplyEditRights,n)),Common.Gateway.on("processsaveresult",_.bind(n.onProcessSaveResult,n)),Common.Gateway.on("processrightschange",_.bind(n.onProcessRightsChange,n)),Common.Gateway.on("processmouse",_.bind(n.onProcessMouse,n)),Common.Gateway.on("downloadas",_.bind(n.onDownloadAs,n)),Common.Gateway.sendInfo({mode:n.appOptions.isEdit?"edit":"view"}),$(document).on("contextmenu",_.bind(n.onContextMenu,n)),Common.Gateway.documentReady(),$(".doc-placeholder").remove()}},onLicenseChanged:function(t){var e=t.asc_getLicenseType();void 0!==e&&this.appOptions.canEdit&&"view"!==this.editorConfig.mode&&(e===Asc.c_oLicenseResult.Connections||e===Asc.c_oLicenseResult.UsersCount||e===Asc.c_oLicenseResult.ConnectionsOS||e===Asc.c_oLicenseResult.UsersCountOS||e===Asc.c_oLicenseResult.SuccessLimit&&0!=(this.appOptions.trialMode&Asc.c_oLicenseMode.Limited))&&(this._state.licenseType=e),this._isDocReady&&this.applyLicense()},applyLicense:function(){},disableEditing:function(t){var e=this.getApplication();this.appOptions.canEdit&&"view"!==this.editorConfig.mode&&(e.getController("RightMenu").getView("RightMenu").clearSelection(),e.getController("Toolbar").DisableToolbar(t),e.getController("Statusbar").getView("Statusbar").SetDisabled(t))},onOpenDocument:function(t){var e=document.getElementById("loadmask-text"),i=(t.asc_getCurrentFont()+t.asc_getCurrentImage())/(t.asc_getFontsCount()+t.asc_getImagesCount());i=this.textLoadingDocument+": "+Math.min(Math.round(100*i),100)+"%",e?e.innerHTML=i:this.loadMask&&this.loadMask.setTitle(i)},onEditorPermissions:function(e){var i=e.asc_getLicenseType();this.onServerVersion(e.asc_getBuildVersion())||(e.asc_getRights()!==Asc.c_oRights.Edit&&(this.permissions.edit=!1),this.appOptions.permissionsLicense=i,this.appOptions.isOffline=this.api.asc_isOffline(),this.appOptions.isCrypted=this.api.asc_isCrypto(),this.appOptions.canLicense=i===Asc.c_oLicenseResult.Success||i===Asc.c_oLicenseResult.SuccessLimit,this.appOptions.isLightVersion=e.asc_getIsLight(),this.appOptions.canCoAuthoring=!this.appOptions.isLightVersion,this.appOptions.canRequestEditRights=this.editorConfig.canRequestEditRights,this.appOptions.canEdit=!1!==this.permissions.edit&&(this.editorConfig.canRequestEditRights||"view"!==this.editorConfig.mode),this.appOptions.isEdit=this.appOptions.canLicense&&this.appOptions.canEdit&&"view"!==this.editorConfig.mode,this.appOptions.canDownload=!1!==this.permissions.download,this.appOptions.canAnalytics=e.asc_getIsAnalyticsEnable(),this.appOptions.canComments=this.appOptions.canLicense&&(void 0===this.permissions.comment?this.appOptions.isEdit:this.permissions.comment)&&"view"!==this.editorConfig.mode,this.appOptions.canComments=this.appOptions.canComments&&!("object"==typeof this.editorConfig.customization&&!1===this.editorConfig.customization.comments),this.appOptions.canViewComments=this.appOptions.canComments||!("object"==typeof this.editorConfig.customization&&!1===this.editorConfig.customization.comments),this.appOptions.canChat=this.appOptions.canLicense&&!this.appOptions.isOffline&&!("object"==typeof this.editorConfig.customization&&!1===this.editorConfig.customization.chat),this.appOptions.canPrint=!1!==this.permissions.print,this.appOptions.canRename=this.editorConfig.canRename,this.appOptions.canForcesave=this.appOptions.isEdit&&!this.appOptions.isOffline&&"object"==typeof this.editorConfig.customization&&!!this.editorConfig.customization.forcesave,this.appOptions.forcesave=this.appOptions.canForcesave,this.appOptions.canEditComments=this.appOptions.isOffline||!("object"==typeof this.editorConfig.customization&&this.editorConfig.customization.commentAuthorOnly),this.appOptions.buildVersion=e.asc_getBuildVersion(),this.appOptions.trialMode=e.asc_getLicenseMode(),this.appOptions.isBeta=e.asc_getIsBeta(),this.appOptions.isSignatureSupport=this.appOptions.isEdit&&this.appOptions.isDesktopApp&&this.appOptions.isOffline&&this.api.asc_isSignaturesSupport(),this.appOptions.isPasswordSupport=this.appOptions.isEdit&&this.appOptions.isDesktopApp&&this.appOptions.isOffline&&this.api.asc_isProtectionSupport(),this.appOptions.canProtect=this.appOptions.isSignatureSupport||this.appOptions.isPasswordSupport,this.appOptions.canHelp=!("object"==typeof this.editorConfig.customization&&!1===this.editorConfig.customization.help),this.appOptions.isRestrictedEdit=!this.appOptions.isEdit&&this.appOptions.canComments,this.appOptions.canBranding=e.asc_getCustomization(),this.appOptions.canBranding&&t.setBranding(this.editorConfig.customization),this.appOptions.canUseReviewPermissions=this.appOptions.canLicense&&this.editorConfig.customization&&this.editorConfig.customization.reviewPermissions&&"object"==typeof this.editorConfig.customization.reviewPermissions,Common.Utils.UserInfoParser.setParser(this.appOptions.canUseReviewPermissions),t.setUserName(Common.Utils.UserInfoParser.getParsedName(this.appOptions.user.fullname)),this.appOptions.canRename&&t.setCanRename(!0),this.appOptions.canBrandingExt=e.asc_getCanBranding()&&("object"==typeof this.editorConfig.customization||this.editorConfig.plugins),this.getApplication().getController("Common.Controllers.Plugins").setMode(this.appOptions),this.applyModeCommonElements(),this.applyModeEditorElements(),this.appOptions.isEdit||(Common.NotificationCenter.trigger("app:face",this.appOptions),this.hidePreloader(),this.onLongActionBegin(Asc.c_oAscAsyncActionType.BlockInteraction,-256)),this.api.asc_setViewMode(!this.appOptions.isEdit&&!this.appOptions.isRestrictedEdit),this.appOptions.isRestrictedEdit&&this.appOptions.canComments&&this.api.asc_setRestriction(Asc.c_oAscRestrictionType.OnlyComments),this.api.asc_LoadDocument())},applyModeCommonElements:function(){window.editor_elements_prepared=!0;var t=this.getApplication(),e=t.getController("Viewport").getView("Viewport"),i=t.getController("Statusbar").getView("Statusbar"),n=t.getController("DocumentHolder").getView("DocumentHolder"),o=t.getController("Toolbar");e&&e.setMode(this.appOptions,!0),i&&i.setMode(this.appOptions),o.setMode(this.appOptions),n.setMode(this.appOptions),this.api.asc_registerCallback("asc_onSendThemeColors",_.bind(this.onSendThemeColors,this)),this.api.asc_registerCallback("asc_onDownloadUrl",_.bind(this.onDownloadUrl,this)),this.api.asc_registerCallback("asc_onDocumentModifiedChanged",_.bind(this.onDocumentModifiedChanged,this))},applyModeEditorElements:function(t){var e=this.getApplication().getController("Common.Controllers.Comments");e&&(e.setMode(this.appOptions),e.setConfig({config:this.editorConfig,sdkviewname:"#id_main_parent"},this.api));var i=this,n=this.getApplication();if(n.getController("Common.Controllers.ReviewChanges").setMode(i.appOptions).setConfig({config:i.editorConfig},i.api).loadDocument({doc:i.document}),this.appOptions.isEdit||this.appOptions.isRestrictedEdit){var o=n.getController("Toolbar");if(o&&o.setApi(i.api),!this.appOptions.isEdit)return;var s=n.getController("RightMenu"),a=n.getController("Common.Controllers.Fonts");a&&a.setApi(i.api),s&&s.setApi(i.api),i.appOptions.canProtect&&n.getController("Common.Controllers.Protection").setMode(i.appOptions).setConfig({config:i.editorConfig},i.api),this.getApplication().getController("Viewport").getView("Viewport").applyEditorMode();var l=s.getView("RightMenu");l&&(l.setApi(i.api),l.on("editcomplete",_.bind(i.onEditComplete,i)),l.setMode(i.appOptions));var r=o?o.getView("Toolbar"):null;r&&(r.setApi(i.api),r.on("editcomplete",_.bind(i.onEditComplete,i)),r.on("insertimage",_.bind(i.onInsertImage,i)),r.on("inserttable",_.bind(i.onInsertTable,i)),r.on("insertshape",_.bind(i.onInsertShape,i)),r.on("insertchart",_.bind(i.onInsertChart,i)),r.on("inserttextart",_.bind(i.onInsertTextArt,i)));var c=Common.localStorage.getItem("pe-settings-unit");c=null!==c?parseInt(c):i.appOptions.customization&&i.appOptions.customization.unit?Common.Utils.Metric.c_MetricUnits[i.appOptions.customization.unit.toLocaleLowerCase()]:Common.Utils.Metric.getDefaultMetric(),void 0===c&&(c=Common.Utils.Metric.getDefaultMetric()),Common.Utils.Metric.setCurrentMetric(c),Common.Utils.InternalSettings.set("pe-settings-unit",c),i.api.asc_SetDocumentUnits(c==Common.Utils.Metric.c_MetricUnits.inch?Asc.c_oAscDocumentUnits.Inch:c==Common.Utils.Metric.c_MetricUnits.pt?Asc.c_oAscDocumentUnits.Point:Asc.c_oAscDocumentUnits.Millimeter),i.api.asc_SetViewRulers&&i.api.asc_SetViewRulers(!Common.localStorage.getBool("pe-hidden-rulers",!0)),i.api.asc_registerCallback("asc_onChangeObjectLock",_.bind(i._onChangeObjectLock,i)),i.api.asc_registerCallback("asc_onDocumentCanSaveChanged",_.bind(i.onDocumentCanSaveChanged,i)),i.api.asc_registerCallback("asc_onCollaborativeChanges",_.bind(i.onCollaborativeChanges,i)),i.api.asc_registerCallback("asc_OnTryUndoInFastCollaborative",_.bind(i.onTryUndoInFastCollaborative,i)),i.api.asc_registerCallback("asc_onAuthParticipantsChanged",_.bind(i.onAuthParticipantsChanged,i)),i.api.asc_registerCallback("asc_onParticipantsChanged",_.bind(i.onAuthParticipantsChanged,i)),i.stackLongActions.exist({id:-255,type:Asc.c_oAscAsyncActionType.BlockInteraction})?i.onLongActionEnd(Asc.c_oAscAsyncActionType.BlockInteraction,-255):this._isDocReady||(Common.NotificationCenter.trigger("app:face",i.appOptions),i.hidePreloader(),i.onLongActionBegin(Asc.c_oAscAsyncActionType.BlockInteraction,-256)),window.onbeforeunload=_.bind(i.onBeforeUnload,i),window.onunload=_.bind(i.onUnload,i)}},onExternalMessage:function(t){t&&t.msg&&(t.msg=t.msg.toString(),this.showTips([t.msg.charAt(0).toUpperCase()+t.msg.substring(1)]),Common.component.Analytics.trackEvent("External Error"))},onError:function(t,e,i){if(t==Asc.c_oAscError.ID.LoadingScriptError)return this.showTips([this.scriptLoadError]),void(this.tooltip&&this.tooltip.getBSTip().$tip.css("z-index",1e4));this.hidePreloader(),this.onLongActionEnd(Asc.c_oAscAsyncActionType.BlockInteraction,-256);var n={closable:!0};switch(t){case Asc.c_oAscError.ID.Unknown:n.msg=this.unknownErrorText;break;case Asc.c_oAscError.ID.ConvertationTimeout:n.msg=this.convertationTimeoutText;break;case Asc.c_oAscError.ID.ConvertationOpenError:n.msg=this.openErrorText;break;case Asc.c_oAscError.ID.ConvertationSaveError:n.msg=this.appOptions.isDesktopApp&&this.appOptions.isOffline?this.saveErrorTextDesktop:this.saveErrorText;break;case Asc.c_oAscError.ID.DownloadError:n.msg=this.downloadErrorText;break;case Asc.c_oAscError.ID.UplImageSize:n.msg=this.uploadImageSizeMessage;break;case Asc.c_oAscError.ID.UplImageExt:n.msg=this.uploadImageExtMessage;break;case Asc.c_oAscError.ID.UplImageFileCount:n.msg=this.uploadImageFileCountMessage;break;case Asc.c_oAscError.ID.SplitCellMaxRows:n.msg=this.splitMaxRowsErrorText.replace("%1",i.get_Value());break;case Asc.c_oAscError.ID.SplitCellMaxCols:n.msg=this.splitMaxColsErrorText.replace("%1",i.get_Value());break;case Asc.c_oAscError.ID.SplitCellRowsDivider:n.msg=this.splitDividerErrorText.replace("%1",i.get_Value());break;case Asc.c_oAscError.ID.VKeyEncrypt:n.msg=this.errorToken;break;case Asc.c_oAscError.ID.KeyExpire:n.msg=this.errorTokenExpire;break;case Asc.c_oAscError.ID.UserCountExceed:n.msg=this.errorUsersExceed;break;case Asc.c_oAscError.ID.CoAuthoringDisconnect:n.msg=this.errorViewerDisconnect;break;case Asc.c_oAscError.ID.ConvertationPassword:n.msg=this.errorFilePassProtect;break;case Asc.c_oAscError.ID.StockChartError:n.msg=this.errorStockChart;break;case Asc.c_oAscError.ID.DataRangeError:n.msg=this.errorDataRange;break;case Asc.c_oAscError.ID.Database:n.msg=this.errorDatabaseConnection;break;case Asc.c_oAscError.ID.UserDrop:if(this._state.lostEditingRights)return void(this._state.lostEditingRights=!1);this._state.lostEditingRights=!0,n.msg=this.errorUserDrop,Common.NotificationCenter.trigger("collaboration:sharingdeny");break;case Asc.c_oAscError.ID.Warning:n.msg=this.errorConnectToServer,n.closable=!1;break;case Asc.c_oAscError.ID.SessionAbsolute:n.msg=this.errorSessionAbsolute;break;case Asc.c_oAscError.ID.SessionIdle:n.msg=this.errorSessionIdle;break;case Asc.c_oAscError.ID.SessionToken:n.msg=this.errorSessionToken;break;case Asc.c_oAscError.ID.AccessDeny:n.msg=this.errorAccessDeny;break;case Asc.c_oAscError.ID.UplImageUrl:n.msg=this.errorBadImageUrl;break;case Asc.c_oAscError.ID.ForceSaveButton:n.msg=this.errorForceSave;break;case Asc.c_oAscError.ID.ForceSaveTimeout:n.msg=this.errorForceSave,console.warn(n.msg);break;case Asc.c_oAscError.ID.DataEncrypted:n.msg=this.errorDataEncrypted;break;case Asc.c_oAscError.ID.EditingError:n.msg=this.appOptions.isDesktopApp&&this.appOptions.isOffline?this.errorEditingSaveas:this.errorEditingDownloadas;break;case Asc.c_oAscError.ID.MailToClientMissing:n.msg=this.errorEmailClient;break;case Asc.c_oAscError.ID.ConvertationOpenLimitError:n.msg=this.errorFileSizeExceed;break;case Asc.c_oAscError.ID.UpdateVersion:n.msg=this.errorUpdateVersionOnDisconnect,n.maxwidth=600;break;default:n.msg="string"==typeof t?t:this.errorDefaultMessage.replace("%1",t)}e==Asc.c_oAscError.Level.Critical?(Common.Gateway.reportError(t,n.msg),n.title=this.criticalErrorTitle,n.iconCls="error",n.closable=!1,this.appOptions.canBackToFolder&&!this.appOptions.isDesktopApp&&"string"!=typeof t&&(n.msg+="

    "+this.criticalErrorExtText,n.callback=function(t){"ok"==t&&Common.NotificationCenter.trigger("goback",!0)}),t==Asc.c_oAscError.ID.DataEncrypted&&(this.api.asc_coAuthoringDisconnect(),Common.NotificationCenter.trigger("api:disconnect"))):(Common.Gateway.reportWarning(t,n.msg),n.title=this.notcriticalErrorTitle,n.iconCls="warn",n.buttons=["ok"],n.callback=_.bind(function(e){if(t==Asc.c_oAscError.ID.Warning&&"ok"==e&&this.appOptions.canDownload)Common.UI.Menu.Manager.hideAll(),this.appOptions.isDesktopApp&&this.appOptions.isOffline?this.api.asc_DownloadAs():this.getApplication().getController("LeftMenu").leftMenu.showMenu("file:saveas");else if(t==Asc.c_oAscError.ID.SplitCellMaxRows||t==Asc.c_oAscError.ID.SplitCellMaxCols||t==Asc.c_oAscError.ID.SplitCellRowsDivider){var i=this;setTimeout(function(){new Common.Views.InsertTableDialog({split:!0,handler:function(t,e){"ok"==t&&i.api&&i.api.SplitCell(e.columns,e.rows),i.onEditComplete()}}).show()},10)}else t==Asc.c_oAscError.ID.EditingError&&(this.disableEditing(!0),Common.NotificationCenter.trigger("api:disconnect",!0));this._state.lostEditingRights=!1,this.onEditComplete()},this)),t!==Asc.c_oAscError.ID.ForceSaveTimeout&&(!Common.Utils.ModalWindow.isVisible()||$(".asc-window.modal.alert[data-value="+t+"]").length<1)&&Common.UI.alert(n).$window.attr("data-value",t),void 0!==t&&Common.component.Analytics.trackEvent("Internal Error",t.toString())},onCoAuthoringDisconnect:function(){this.getApplication().getController("Viewport").getView("Viewport").setMode({isDisconnected:!0}),t.setCanRename(!1),this.appOptions.canRename=!1,this._state.isDisconnected=!0},showTips:function(t){function e(){var e=t.shift();e&&(e+="\n"+i.textCloseTip,n.setTitle(e),n.show())}var i=this;if(t.length){"object"!=typeof t&&(t=[t]),this.tooltip||(this.tooltip=new Common.UI.Tooltip({owner:this.getApplication().getController("Toolbar").getView("Toolbar"),hideonclick:!0,placement:"bottom",cls:"main-info",offset:30}));var n=this.tooltip;n.on("tooltip:hide",function(){setTimeout(e,300)}),e()}},updateWindowTitle:function(e){var i=this.api.isDocumentModified();if(this._state.isDocModified!==i||e){var n=this.defaultTitleText;t&&!_.isEmpty(t.getDocumentCaption())&&(n=t.getDocumentCaption()+" - "+n),i&&(clearTimeout(this._state.timerCaption),_.isUndefined(n)||(n="* "+n)),window.document.title!=n&&(window.document.title=n),Common.Gateway.setDocumentModified(i),i&&(!this._state.fastCoauth||this._state.usersCount<2)&&this.getApplication().getController("Statusbar").setStatusCaption("",!0),this._state.isDocModified=i}},onDocumentChanged:function(){},onDocumentModifiedChanged:function(){var t=this.api.asc_isDocumentCanSave();this._state.isDocModified!==t&&Common.Gateway.setDocumentModified(this.api.isDocumentModified()),this.updateWindowTitle();var e=this.getApplication().getController("Toolbar").getView("Toolbar");if(e&&e.btnCollabChanges){var i=e.btnCollabChanges.cmpEl.hasClass("notify"),n=this.appOptions.forcesave,o=!t&&!i&&!n||this._state.isDisconnected||this._state.fastCoauth&&this._state.usersCount>1&&!n;e.btnSave.setDisabled(o)}},onDocumentCanSaveChanged:function(t){var e=this.getApplication().getController("Toolbar").getView("Toolbar");if(e){var i=e.btnCollabChanges.cmpEl.hasClass("notify"),n=this.appOptions.forcesave,o=!t&&!i&&!n||this._state.isDisconnected||this._state.fastCoauth&&this._state.usersCount>1&&!n;e.btnSave.setDisabled(o)}},onContextMenu:function(t){var e=t.target.getAttribute("data-can-copy"),i=t.target instanceof HTMLInputElement||t.target instanceof HTMLTextAreaElement;if(i&&"false"===e||!i&&"true"!==e)return t.stopPropagation(),t.preventDefault(),!1},onBeforeUnload:function(){if(Common.localStorage.save(),this.api.isDocumentModified()){var t=this;return this.api.asc_stopSaving(),this.continueSavingTimer=window.setTimeout(function(){t.api.asc_continueSaving()},500),this.leavePageText}},onUnload:function(){this.continueSavingTimer&&clearTimeout(this.continueSavingTimer)},hidePreloader:function(){var t;this._state.customizationDone||(this._state.customizationDone=!0,this.appOptions.customization&&(this.appOptions.isDesktopApp?this.appOptions.customization.about=!1:this.appOptions.canBrandingExt||(this.appOptions.customization.about=!0)),Common.Utils.applyCustomization(this.appOptions.customization,e),this.appOptions.canBrandingExt&&(Common.Utils.applyCustomization(this.appOptions.customization,i),t=this.getApplication().getController("Common.Controllers.Plugins").applyUICustomization())),Common.NotificationCenter.trigger("layout:changed","main"),(t||new Promise(function(t,e){t()})).then(function(){$("#loading-mask").hide().remove(),Common.Controllers.Desktop.process("preloader:hide")})},onDownloadUrl:function(t){this._state.isFromGatewayDownloadAs&&Common.Gateway.downloadAs(t),this._state.isFromGatewayDownloadAs=!1},onUpdateVersion:function(t){var e=this;e.needToUpdateVersion=!0,e.onLongActionEnd(Asc.c_oAscAsyncActionType.BlockInteraction,-256),Common.UI.error({msg:this.errorUpdateVersion,callback:function(){_.defer(function(){Common.Gateway.updateVersion(),t&&t.call(e),e.onLongActionBegin(Asc.c_oAscAsyncActionType.BlockInteraction,-256)})}})},onServerVersion:function(t){return!1},fillUserStore:function(t){if(!_.isEmpty(t)){var e=this.getCommonStoreUsersStore();e&&e.add(t)}},onCollaborativeChanges:function(){this._state.hasCollaborativeChanges||(this._state.hasCollaborativeChanges=!0,this.appOptions.isEdit&&this.getApplication().getController("Statusbar").setStatusCaption(this.txtNeedSynchronize,!0))},synchronizeChanges:function(){this.getApplication().getController("Statusbar").setStatusCaption(""),this.getApplication().getController("DocumentHolder").getView("DocumentHolder").hideTips(),this.getApplication().getController("Toolbar").getView("Toolbar").synchronizeChanges(),this._state.hasCollaborativeChanges=!1},initNames:function(){this.shapeGroupNames=[this.txtBasicShapes,this.txtFiguredArrows,this.txtMath,this.txtCharts,this.txtStarsRibbons,this.txtCallouts,this.txtButtons,this.txtRectangles,this.txtLines],this.layoutNames=[this.txtSldLtTBlank,this.txtSldLtTChart,this.txtSldLtTChartAndTx,this.txtSldLtTClipArtAndTx,this.txtSldLtTClipArtAndVertTx,this.txtSldLtTCust,this.txtSldLtTDgm,this.txtSldLtTFourObj,this.txtSldLtTMediaAndTx,this.txtSldLtTObj,this.txtSldLtTObjAndTwoObj,this.txtSldLtTObjAndTx,this.txtSldLtTObjOnly,this.txtSldLtTObjOverTx,this.txtSldLtTObjTx,this.txtSldLtTPicTx,this.txtSldLtTSecHead,this.txtSldLtTTbl,this.txtSldLtTTitle,this.txtSldLtTTitleOnly,this.txtSldLtTTwoColTx,this.txtSldLtTTwoObj,this.txtSldLtTTwoObjAndObj,this.txtSldLtTTwoObjAndTx,this.txtSldLtTTwoObjOverTx,this.txtSldLtTTwoTxTwoObj,this.txtSldLtTTx,this.txtSldLtTTxAndChart,this.txtSldLtTTxAndClipArt,this.txtSldLtTTxAndMedia,this.txtSldLtTTxAndObj,this.txtSldLtTTxAndTwoObj,this.txtSldLtTTxOverObj,this.txtSldLtTVertTitleAndTx,this.txtSldLtTVertTitleAndTxOverChart,this.txtSldLtTVertTx]},onInsertTable:function(){this.getApplication().getController("RightMenu").onInsertTable()},onInsertImage:function(){this.getApplication().getController("RightMenu").onInsertImage()},onInsertChart:function(){this.getApplication().getController("RightMenu").onInsertChart()},onInsertShape:function(){this.getApplication().getController("RightMenu").onInsertShape()},onInsertTextArt:function(){this.getApplication().getController("RightMenu").onInsertTextArt()},unitsChanged:function(t){var e=Common.localStorage.getItem("pe-settings-unit");e=null!==e?parseInt(e):Common.Utils.Metric.getDefaultMetric(),Common.Utils.Metric.setCurrentMetric(e),Common.Utils.InternalSettings.set("pe-settings-unit",e),this.api.asc_SetDocumentUnits(e==Common.Utils.Metric.c_MetricUnits.inch?Asc.c_oAscDocumentUnits.Inch:e==Common.Utils.Metric.c_MetricUnits.pt?Asc.c_oAscDocumentUnits.Point:Asc.c_oAscDocumentUnits.Millimeter),this.getApplication().getController("RightMenu").updateMetricUnit()},updateThemeColors:function(){var t=this;setTimeout(function(){t.getApplication().getController("RightMenu").UpdateThemeColors()},50),setTimeout(function(){t.getApplication().getController("Toolbar").updateThemeColors()},50)},onSendThemeColors:function(t,e){if(Common.Utils.ThemeColor.setColors(t,e),window.styles_loaded){this.updateThemeColors();var i=this;setTimeout(function(){i.fillTextArt()},1)}},onFocusObject:function(t){var e=this.getApplication().getController("RightMenu");e&&e.onFocusObject.call(e,t)},_onChangeObjectLock:function(){var t=this.api.getSelectedElements();this.onFocusObject(t),this.getApplication().getController("Toolbar")._onFocusObject(t)},onThumbnailsShow:function(t){this.isThumbnailsShow=t},fillAutoShapes:function(t,e){if(!_.isEmpty(e)&&!_.isEmpty(t)&&e.length==t.length){var i=this,n=[];_.each(t,function(t,o){var s=new Backbone.Collection([],{model:PE.Models.ShapeModel}),a=[],l=e[o].length>18?7:6,r=35*Math.ceil(e[o].length/l)+3,c=30*l;_.each(e[o],function(t,e){a.push({data:{shapeType:t.Type},tip:i["txtShape_"+t.Type]||i.textShape+" "+(e+1),allowSelected:!0,selected:!1})}),s.add(a),n.push({groupName:i.shapeGroupNames[o],groupStore:s,groupWidth:c,groupHeight:r})}),this.getCollection("ShapeGroups").reset(n)}},fillLayoutsStore:function(t){var e=this;if(!_.isEmpty(t)){var i=this.getCollection("SlideLayouts");if(i){var n=[];_.each(t,function(t){var i=t.get_Name();n.push({imageUrl:t.get_Image(),title:""!==i?i:e.layoutNames[t.getType()],itemWidth:t.get_Width(),itemHeight:t.get_Height(),data:{type:t.getType(),idx:t.getIndex()},allowSelected:!0,selected:!1})}),i.reset(n)}}},fillTextArt:function(t){var e=[],i=this.getCollection("Common.Collections.TextArt");!t&&i.length>0&&(t=this.api.asc_getTextArtPreviews()),_.isEmpty(t)||(_.each(t,function(t,i){e.push({imageUrl:t,data:i,allowSelected:!0,selected:!1})}),i.reset(e))},loadLanguages:function(t){var e,i=[],n=Common.util.LanguageInfo.getLanguages();for(var o in n)n.hasOwnProperty(o)&&(e=n[o],e[2]&&i.push({displayValue:e[1],value:e[0],code:parseInt(o),spellcheck:_.indexOf(t,o)>-1}));i.sort(function(t,e){return t.valuee.value?1:0}),this.languages=i,window.styles_loaded&&this.setLanguages()},setLanguages:function(){(!this.languages||this.languages.length<1)&&this.loadLanguages([]),this.languages&&this.languages.length>0&&(this.getApplication().getController("DocumentHolder").getView("DocumentHolder").setLanguages(this.languages),this.getApplication().getController("Statusbar").setLanguages(this.languages),this.getApplication().getController("Common.Controllers.ReviewChanges").setLanguages(this.languages))},onTryUndoInFastCollaborative:function(){Common.localStorage.getBool("pe-hide-try-undoredo")||Common.UI.info({width:500,msg:this.textTryUndoRedo,iconCls:"info",buttons:["custom","cancel"],primary:"custom",customButtonText:this.textStrict,dontshow:!0,callback:_.bind(function(t,e){e&&Common.localStorage.setItem("pe-hide-try-undoredo",1),"custom"==t&&(Common.localStorage.setItem("pe-settings-coauthmode",0),this.api.asc_SetFastCollaborative(!1),Common.Utils.InternalSettings.set("pe-settings-coauthmode",!1),this.getApplication().getController("Common.Controllers.ReviewChanges").applySettings(),this._state.fastCoauth=!1),this.onEditComplete()},this)})},onAuthParticipantsChanged:function(t){var e=0;_.each(t,function(t){t.asc_getView()||e++}),this._state.usersCount=e},applySettings:function(){if(this.appOptions.isEdit&&!this.appOptions.isOffline&&this.appOptions.canCoAuthoring){var t=this._state.fastCoauth;this._state.fastCoauth=Common.localStorage.getBool("pe-settings-coauthmode",!0),this._state.fastCoauth&&!t&&this.synchronizeChanges()}this.appOptions.canForcesave&&(this.appOptions.forcesave=Common.localStorage.getBool("pe-settings-forcesave",this.appOptions.canForcesave),Common.Utils.InternalSettings.set("pe-settings-forcesave",this.appOptions.forcesave),this.api.asc_setIsForceSaveOnUserSave(this.appOptions.forcesave))},onDocumentName:function(e){t.setDocumentCaption(e),this.updateWindowTitle(!0)},onMeta:function(e){t.setDocumentCaption(e.title),this.updateWindowTitle(!0),this.document.title=e.title;var i=this.getApplication().getController("LeftMenu").getView("LeftMenu").getMenu("file");i.loadDocument({doc:this.document}),i.panels&&i.panels.info&&i.panels.info.updateInfo(this.document),this.getApplication().getController("Common.Controllers.ReviewChanges").loadDocument({doc:this.document}),Common.Gateway.metaChange(e)},onPrint:function(){this.appOptions.canPrint&&!Common.Utils.ModalWindow.isVisible()&&(this.api&&this.api.asc_Print(new Asc.asc_CDownloadOptions(null,Common.Utils.isChrome||Common.Utils.isSafari||Common.Utils.isOpera)),Common.component.Analytics.trackEvent("Print"))},onPrintUrl:function(t){if(this.iframePrint&&(this.iframePrint.parentNode.removeChild(this.iframePrint),this.iframePrint=null),!this.iframePrint){var e=this;this.iframePrint=document.createElement("iframe"),this.iframePrint.id="id-print-frame",this.iframePrint.style.display="none",this.iframePrint.style.visibility="hidden",this.iframePrint.style.position="fixed",this.iframePrint.style.right="0",this.iframePrint.style.bottom="0",document.body.appendChild(this.iframePrint),this.iframePrint.onload=function(){try{e.iframePrint.contentWindow.focus(),e.iframePrint.contentWindow.print(),e.iframePrint.contentWindow.blur(),window.focus()}catch(t){e.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(Asc.c_oAscFileType.PDF))}}}t&&(this.iframePrint.src=t)},onAdvancedOptions:function(t,e){if(!this._state.openDlg){var i=this;t==Asc.c_oAscAdvancedOptionsID.DRM&&(i._state.openDlg=new Common.Views.OpenDialog({title:Common.Views.OpenDialog.prototype.txtTitleProtected,closeFile:i.appOptions.canRequestClose,type:Common.Utils.importTextType.DRM,warning:!(i.appOptions.isDesktopApp&&i.appOptions.isOffline),warningMsg:e,validatePwd:!!i._state.isDRM,handler:function(e,n){i.isShowOpenDialog=!1,"ok"==e?i.api&&(i.api.asc_setAdvancedOptions(t,new Asc.asc_CDRMAdvancedOptions(n)),i.loadMask&&i.loadMask.show()):(Common.Gateway.requestClose(),Common.Controllers.Desktop.requestClose()),i._state.openDlg=null}}),i._state.isDRM=!0),i._state.openDlg&&(this.isShowOpenDialog=!0,this.loadMask&&this.loadMask.hide(),this.onLongActionEnd(Asc.c_oAscAsyncActionType.BlockInteraction,-256),i._state.openDlg.show())}},warningDocumentIsLocked:function(){var t=this;Common.Utils.warningDocumentIsLocked({disablefunc:function(e){var i=t.getApplication();t.disableEditing(e),i.getController("RightMenu").SetDisabled(e,!0),i.getController("Common.Controllers.ReviewChanges").SetDisabled(e),i.getController("DocumentHolder").getView("DocumentHolder").SetDisabled(e);var n=i.getController("LeftMenu");n.leftMenu.getMenu("file").getButton("protect").setDisabled(e),n.setPreviewMode(e);var o=i.getController("Common.Controllers.Comments");o&&o.setPreviewMode(e)}})},onRunAutostartMacroses:function(){var t=this;if(!this.editorConfig.customization||!1!==this.editorConfig.customization.macros){var e=Common.Utils.InternalSettings.get("pe-macros-mode");1==e?this.api.asc_runAutostartMacroses():0===e&&Common.UI.warning({msg:this.textHasMacros+"
    ",buttons:["yes","no"],primary:"yes",dontshow:!0,textDontShow:this.textRemember,callback:function(e,i){i&&(Common.Utils.InternalSettings.set("pe-macros-mode","yes"==e?1:2),Common.localStorage.setItem("pe-macros-mode","yes"==e?1:2)),"yes"==e&&setTimeout(function(){t.api.asc_runAutostartMacroses()},1)}})}},loadAutoCorrectSettings:function(){var t=this,e=Common.localStorage.getItem("pe-settings-math-correct-add");Common.Utils.InternalSettings.set("pe-settings-math-correct-add",e);var i=e?JSON.parse(e):[];e=Common.localStorage.getItem("pe-settings-math-correct-rem"),Common.Utils.InternalSettings.set("pe-settings-math-correct-rem",e);var n=e?JSON.parse(e):[];e=Common.localStorage.getBool("pe-settings-math-correct-replace-type",!0),Common.Utils.InternalSettings.set("pe-settings-math-correct-replace-type",e),t.api.asc_refreshOnStartAutoCorrectMathSymbols(n,i,e),e=Common.localStorage.getItem("pe-settings-rec-functions-add"),Common.Utils.InternalSettings.set("pe-settings-rec-functions-add",e),i=e?JSON.parse(e):[],e=Common.localStorage.getItem("pe-settings-rec-functions-rem"),Common.Utils.InternalSettings.set("pe-settings-rec-functions-rem",e),n=e?JSON.parse(e):[],t.api.asc_refreshOnStartAutoCorrectMathFunctions(n,i),e=Common.localStorage.getBool("pe-settings-autoformat-bulleted",!0),Common.Utils.InternalSettings.set("pe-settings-autoformat-bulleted",e),t.api.asc_SetAutomaticBulletedLists(e),e=Common.localStorage.getBool("pe-settings-autoformat-numbered",!0),Common.Utils.InternalSettings.set("pe-settings-autoformat-numbered",e),t.api.asc_SetAutomaticNumberedLists(e),e=Common.localStorage.getBool("pe-settings-autoformat-smart-quotes",!0),Common.Utils.InternalSettings.set("pe-settings-autoformat-smart-quotes",e),t.api.asc_SetAutoCorrectSmartQuotes(e),e=Common.localStorage.getBool("pe-settings-autoformat-hyphens",!0),Common.Utils.InternalSettings.set("pe-settings-autoformat-hyphens",e),t.api.asc_SetAutoCorrectHyphensWithDash(e)},leavePageText:"You have unsaved changes in this document. Click 'Stay on this Page' then 'Save' to save them. Click 'Leave this Page' to discard all the unsaved changes.",criticalErrorTitle:"Error",notcriticalErrorTitle:"Warning",errorDefaultMessage:"Error code: %1", +criticalErrorExtText:'Press "OK" to to back to document list.',openTitleText:"Opening Document",openTextText:"Opening document...",loadFontsTitleText:"Loading Data",loadFontsTextText:"Loading data...",loadImagesTitleText:"Loading Images",loadImagesTextText:"Loading images...",loadFontTitleText:"Loading Data",loadFontTextText:"Loading data...",loadImageTitleText:"Loading Image",loadImageTextText:"Loading image...",downloadTitleText:"Downloading Document",downloadTextText:"Downloading document...",printTitleText:"Printing Document",printTextText:"Printing document...",uploadImageTitleText:"Uploading Image",uploadImageTextText:"Uploading image...",uploadImageSizeMessage:"Maximium image size limit exceeded.",uploadImageExtMessage:"Unknown image format.",uploadImageFileCountMessage:"No images uploaded.",reloadButtonText:"Reload Page",unknownErrorText:"Unknown error.",convertationTimeoutText:"Convertation timeout exceeded.",downloadErrorText:"Download failed.",unsupportedBrowserErrorText:"Your browser is not supported.",splitMaxRowsErrorText:"The number of rows must be less than %1",splitMaxColsErrorText:"The number of columns must be less than %1",splitDividerErrorText:"The number of rows must be a divisor of %1",requestEditFailedTitleText:"Access denied",requestEditFailedMessageText:"Someone is editing this document right now. Please try again later.",txtSldLtTBlank:"Blank",txtSldLtTChart:"Chart",txtSldLtTChartAndTx:"Chart and Text",txtSldLtTClipArtAndTx:"Clip Art and Text",txtSldLtTClipArtAndVertTx:"Clip Art and Vertical Text",txtSldLtTCust:"Custom",txtSldLtTDgm:"Diagram",txtSldLtTFourObj:"Four Objects",txtSldLtTMediaAndTx:"Media and Text",txtSldLtTObj:"Title and Object",txtSldLtTObjAndTwoObj:"Object and Two Object",txtSldLtTObjAndTx:"Object and Text",txtSldLtTObjOnly:"Object",txtSldLtTObjOverTx:"Object over Text",txtSldLtTObjTx:"Title, Object, and Caption",txtSldLtTPicTx:"Picture and Caption",txtSldLtTSecHead:"Section Header",txtSldLtTTbl:"Table",txtSldLtTTitle:"Title",txtSldLtTTitleOnly:"Title Only",txtSldLtTTwoColTx:"Two Column Text",txtSldLtTTwoObj:"Two Objects",txtSldLtTTwoObjAndObj:"Two Objects and Object",txtSldLtTTwoObjAndTx:"Two Objects and Text",txtSldLtTTwoObjOverTx:"Two Objects over Text",txtSldLtTTwoTxTwoObj:"Two Text and Two Objects",txtSldLtTTx:"Text",txtSldLtTTxAndChart:"Text and Chart",txtSldLtTTxAndClipArt:"Text and Clip Art",txtSldLtTTxAndMedia:"Text and Media",txtSldLtTTxAndObj:"Text and Object",txtSldLtTTxAndTwoObj:"Text and Two Objects",txtSldLtTTxOverObj:"Text over Object",txtSldLtTVertTitleAndTx:"Vertical Title and Text",txtSldLtTVertTitleAndTxOverChart:"Vertical Title and Text Over Chart",txtSldLtTVertTx:"Vertical Text",textLoadingDocument:"Loading presentation",warnBrowserZoom:"Your browser's current zoom setting is not fully supported. Please reset to the default zoom by pressing Ctrl+0.",warnBrowserIE9:"The application has low capabilities on IE9. Use IE10 or higher",loadThemeTitleText:"Loading Theme",loadThemeTextText:"Loading theme...",txtBasicShapes:"Basic Shapes",txtFiguredArrows:"Figured Arrows",txtMath:"Math",txtCharts:"Charts",txtStarsRibbons:"Stars & Ribbons",txtCallouts:"Callouts",txtButtons:"Buttons",txtRectangles:"Rectangles",txtLines:"Lines",errorKeyEncrypt:"Unknown key descriptor",errorKeyExpire:"Key descriptor expired",errorUsersExceed:"Count of users was exceed",txtEditingMode:"Set editing mode...",errorCoAuthoringDisconnect:"Server connection lost. You can't edit anymore.",errorFilePassProtect:"The file is password protected and cannot be opened.",textAnonymous:"Anonymous",txtNeedSynchronize:"You have an updates",applyChangesTitleText:"Loading Data",applyChangesTextText:"Loading data...",savePreparingText:"Preparing to save",savePreparingTitle:"Preparing to save. Please wait...",loadingDocumentTitleText:"Loading presentation",loadingDocumentTextText:"Loading presentation...",warnProcessRightsChange:"You have been denied the right to edit the file.",errorProcessSaveResult:"Saving is failed.",textCloseTip:"Click to close the tip.",textShape:"Shape",errorStockChart:"Incorrect row order. To build a stock chart place the data on the sheet in the following order:
    opening price, max price, min price, closing price.",errorDataRange:"Incorrect data range.",errorDatabaseConnection:"External error.
    Database connection error. Please, contact support.",errorUpdateVersion:"The file version has been changed. The page will be reloaded.",errorUserDrop:"The file cannot be accessed right now.",txtDiagramTitle:"Chart Title",txtXAxis:"X Axis",txtYAxis:"Y Axis",txtSeries:"Seria",txtArt:"Your text here",errorConnectToServer:" The document could not be saved. Please check connection settings or contact your administrator.
    When you click the 'OK' button, you will be prompted to download the document.",textTryUndoRedo:"The Undo/Redo functions are disabled for the Fast co-editing mode.
    Click the 'Strict mode' button to switch to the Strict co-editing mode to edit the file without other users interference and send your changes only after you save them. You can switch between the co-editing modes using the editor Advanced settings.",textStrict:"Strict mode",textBuyNow:"Visit website",textNoLicenseTitle:"License limit reached",textContactUs:"Contact sales",errorViewerDisconnect:"Connection is lost. You can still view the document,
    but will not be able to download or print until the connection is restored and page is reloaded.",warnLicenseExp:"Your license has expired.
    Please update your license and refresh the page.",titleLicenseExp:"License expired",openErrorText:"An error has occurred while opening the file",saveErrorText:"An error has occurred while saving the file",errorToken:"The document security token is not correctly formed.
    Please contact your Document Server administrator.",errorTokenExpire:"The document security token has expired.
    Please contact your Document Server administrator.",errorSessionAbsolute:"The document editing session has expired. Please reload the page.",errorSessionIdle:"The document has not been edited for quite a long time. Please reload the page.",errorSessionToken:"The connection to the server has been interrupted. Please reload the page.",errorAccessDeny:"You are trying to perform an action you do not have rights for.
    Please contact your Document Server administrator.",titleServerVersion:"Editor updated",errorServerVersion:"The editor version has been updated. The page will be reloaded to apply the changes.",errorBadImageUrl:"Image url is incorrect",txtSlideText:"Slide text",txtClipArt:"Clip Art",txtDiagram:"SmartArt",txtDateTime:"Date and time",txtFooter:"Footer",txtHeader:"Header",txtMedia:"Media",txtPicture:"Picture",txtImage:"Image",txtSlideNumber:"Slide number",txtSlideSubtitle:"Slide subtitle",txtSlideTitle:"Slide title",textChangesSaved:"All changes saved",saveTitleText:"Saving Document",saveTextText:"Saving document...",txtLoading:"Loading...",txtAddNotes:"Click to add notes",errorForceSave:"An error occurred while saving the file. Please use the 'Download as' option to save the file to your computer hard drive or try again later.",txtAddFirstSlide:"Click to add first slide",txtTheme_blank:"Blank",txtTheme_pixel:"Pixel",txtTheme_classic:"Classic",txtTheme_official:"Official",txtTheme_green:"Green",txtTheme_lines:"Lines",txtTheme_office:"Office",txtTheme_safari:"Safari",txtTheme_dotted:"Dotted",txtTheme_corner:"Corner",txtTheme_turtle:"Turtle",txtTheme_basic:"Basic",txtTheme_green_leaf:"Green leaf",txtTheme_office_theme:"Office Theme",warnNoLicense:"You've reached the limit for simultaneous connections to %1 editors. This document will be opened for viewing only.
    Contact %1 sales team for personal upgrade terms.",warnNoLicenseUsers:"You've reached the user limit for %1 editors. Contact %1 sales team for personal upgrade terms.",warnLicenseExceeded:"You've reached the limit for simultaneous connections to %1 editors. This document will be opened for viewing only.
    Contact your administrator to learn more.",warnLicenseUsersExceeded:"You've reached the user limit for %1 editors. Contact your administrator to learn more.",errorDataEncrypted:"Encrypted changes have been received, they cannot be deciphered.",textClose:"Close",textPaidFeature:"Paid feature",scriptLoadError:"The connection is too slow, some of the components could not be loaded. Please reload the page.",errorEditingSaveas:"An error occurred during the work with the document.
    Use the 'Save as...' option to save the file backup copy to your computer hard drive.",errorEditingDownloadas:"An error occurred during the work with the document.
    Use the 'Download as...' option to save the file backup copy to your computer hard drive.",txtShape_textRect:"Text Box",txtShape_rect:"Rectangle",txtShape_ellipse:"Ellipse",txtShape_triangle:"Triangle",txtShape_rtTriangle:"Right Triangle",txtShape_parallelogram:"Parallelogram",txtShape_trapezoid:"Trapezoid",txtShape_diamond:"Diamond",txtShape_pentagon:"Pentagon",txtShape_hexagon:"Hexagon",txtShape_heptagon:"Heptagon",txtShape_octagon:"Octagon",txtShape_decagon:"Decagon",txtShape_dodecagon:"Dodecagon",txtShape_pie:"Pie",txtShape_chord:"Chord",txtShape_teardrop:"Teardrop",txtShape_frame:"Frame",txtShape_halfFrame:"Half Frame",txtShape_corner:"Corner",txtShape_diagStripe:"Diagonal Stripe",txtShape_plus:"Plus",txtShape_plaque:"Sign",txtShape_can:"Can",txtShape_cube:"Cube",txtShape_bevel:"Bevel",txtShape_donut:"Donut",txtShape_noSmoking:'"No" Symbol',txtShape_blockArc:"Block Arc",txtShape_foldedCorner:"Folded Corner",txtShape_smileyFace:"Smiley Face",txtShape_heart:"Heart",txtShape_lightningBolt:"Lightning Bolt",txtShape_sun:"Sun",txtShape_moon:"Moon",txtShape_cloud:"Cloud",txtShape_arc:"Arc",txtShape_bracePair:"Double Brace",txtShape_leftBracket:"Left Bracket",txtShape_rightBracket:"Right Bracket",txtShape_leftBrace:"Left Brace",txtShape_rightBrace:"Right Brace",txtShape_rightArrow:"Right Arrow",txtShape_leftArrow:"Left Arrow",txtShape_upArrow:"Up Arrow",txtShape_downArrow:"Down Arrow",txtShape_leftRightArrow:"Left Right Arrow",txtShape_upDownArrow:"Up Down Arrow",txtShape_quadArrow:"Quad Arrow",txtShape_leftRightUpArrow:"Left Right Up Arrow",txtShape_bentArrow:"Bent Arrow",txtShape_uturnArrow:"U-Turn Arrow",txtShape_leftUpArrow:"Left Up Arrow",txtShape_bentUpArrow:"Bent Up Arrow",txtShape_curvedRightArrow:"Curved Right Arrow",txtShape_curvedLeftArrow:"Curved Left Arrow",txtShape_curvedUpArrow:"Curved Up Arrow",txtShape_curvedDownArrow:"Curved Down Arrow",txtShape_stripedRightArrow:"Striped Right Arrow",txtShape_notchedRightArrow:"Notched Right Arrow",txtShape_homePlate:"Pentagon",txtShape_chevron:"Chevron",txtShape_rightArrowCallout:"Right Arrow Callout",txtShape_downArrowCallout:"Down Arrow Callout",txtShape_leftArrowCallout:"Left Arrow Callout",txtShape_upArrowCallout:"Up Arrow Callout",txtShape_leftRightArrowCallout:"Left Right Arrow Callout",txtShape_quadArrowCallout:"Quad Arrow Callout",txtShape_circularArrow:"Circular Arrow",txtShape_mathPlus:"Plus",txtShape_mathMinus:"Minus",txtShape_mathMultiply:"Multiply",txtShape_mathDivide:"Division",txtShape_mathEqual:"Equal",txtShape_mathNotEqual:"Not Equal",txtShape_flowChartProcess:"Flowchart: Process",txtShape_flowChartAlternateProcess:"Flowchart: Alternate Process",txtShape_flowChartDecision:"Flowchart: Decision",txtShape_flowChartInputOutput:"Flowchart: Data",txtShape_flowChartPredefinedProcess:"Flowchart: Predefined Process",txtShape_flowChartInternalStorage:"Flowchart: Internal Storage",txtShape_flowChartDocument:"Flowchart: Document",txtShape_flowChartMultidocument:"Flowchart: Multidocument ",txtShape_flowChartTerminator:"Flowchart: Terminator",txtShape_flowChartPreparation:"Flowchart: Preparation",txtShape_flowChartManualInput:"Flowchart: Manual Input",txtShape_flowChartManualOperation:"Flowchart: Manual Operation",txtShape_flowChartConnector:"Flowchart: Connector",txtShape_flowChartOffpageConnector:"Flowchart: Off-page Connector",txtShape_flowChartPunchedCard:"Flowchart: Card",txtShape_flowChartPunchedTape:"Flowchart: Punched Tape",txtShape_flowChartSummingJunction:"Flowchart: Summing Junction",txtShape_flowChartOr:"Flowchart: Or",txtShape_flowChartCollate:"Flowchart: Collate",txtShape_flowChartSort:"Flowchart: Sort",txtShape_flowChartExtract:"Flowchart: Extract",txtShape_flowChartMerge:"Flowchart: Merge",txtShape_flowChartOnlineStorage:"Flowchart: Stored Data",txtShape_flowChartDelay:"Flowchart: Delay",txtShape_flowChartMagneticTape:"Flowchart: Sequential Access Storage",txtShape_flowChartMagneticDisk:"Flowchart: Magnetic Disk",txtShape_flowChartMagneticDrum:"Flowchart: Direct Access Storage",txtShape_flowChartDisplay:"Flowchart: Display",txtShape_irregularSeal1:"Explosion 1",txtShape_irregularSeal2:"Explosion 2",txtShape_star4:"4-Point Star",txtShape_star5:"5-Point Star",txtShape_star6:"6-Point Star",txtShape_star7:"7-Point Star",txtShape_star8:"8-Point Star",txtShape_star10:"10-Point Star",txtShape_star12:"12-Point Star",txtShape_star16:"16-Point Star",txtShape_star24:"24-Point Star",txtShape_star32:"32-Point Star",txtShape_ribbon2:"Up Ribbon",txtShape_ribbon:"Down Ribbon",txtShape_ellipseRibbon2:"Curved Up Ribbon",txtShape_ellipseRibbon:"Curved Down Ribbon",txtShape_verticalScroll:"Vertical Scroll",txtShape_horizontalScroll:"Horizontal Scroll",txtShape_wave:"Wave",txtShape_doubleWave:"Double Wave",txtShape_wedgeRectCallout:"Rectangular Callout",txtShape_wedgeRoundRectCallout:"Rounded Rectangular Callout",txtShape_wedgeEllipseCallout:"Oval Callout",txtShape_cloudCallout:"Cloud Callout",txtShape_borderCallout1:"Line Callout 1",txtShape_borderCallout2:"Line Callout 2",txtShape_borderCallout3:"Line Callout 3",txtShape_accentCallout1:"Line Callout 1 (Accent Bar)",txtShape_accentCallout2:"Line Callout 2 (Accent Bar)",txtShape_accentCallout3:"Line Callout 3 (Accent Bar)",txtShape_callout1:"Line Callout 1 (No Border)",txtShape_callout2:"Line Callout 2 (No Border)",txtShape_callout3:"Line Callout 3 (No Border)",txtShape_accentBorderCallout1:"Line Callout 1 (Border and Accent Bar)",txtShape_accentBorderCallout2:"Line Callout 2 (Border and Accent Bar)",txtShape_accentBorderCallout3:"Line Callout 3 (Border and Accent Bar)",txtShape_actionButtonBackPrevious:"Back or Previous Button",txtShape_actionButtonForwardNext:"Forward or Next Button",txtShape_actionButtonBeginning:"Beginning Button",txtShape_actionButtonEnd:"End Button",txtShape_actionButtonHome:"Home Button",txtShape_actionButtonInformation:"Information Button",txtShape_actionButtonReturn:"Return Button",txtShape_actionButtonMovie:"Movie Button",txtShape_actionButtonDocument:"Document Button",txtShape_actionButtonSound:"Sound Button",txtShape_actionButtonHelp:"Help Button",txtShape_actionButtonBlank:"Blank Button",txtShape_roundRect:"Round Corner Rectangle",txtShape_snip1Rect:"Snip Single Corner Rectangle",txtShape_snip2SameRect:"Snip Same Side Corner Rectangle",txtShape_snip2DiagRect:"Snip Diagonal Corner Rectangle",txtShape_snipRoundRect:"Snip and Round Single Corner Rectangle",txtShape_round1Rect:"Round Single Corner Rectangle",txtShape_round2SameRect:"Round Same Side Corner Rectangle",txtShape_round2DiagRect:"Round Diagonal Corner Rectangle",txtShape_line:"Line",txtShape_lineWithArrow:"Arrow",txtShape_lineWithTwoArrows:"Double Arrow",txtShape_bentConnector5:"Elbow Connector",txtShape_bentConnector5WithArrow:"Elbow Arrow Connector",txtShape_bentConnector5WithTwoArrows:"Elbow Double-Arrow Connector",txtShape_curvedConnector3:"Curved Connector",txtShape_curvedConnector3WithArrow:"Curved Arrow Connector",txtShape_curvedConnector3WithTwoArrows:"Curved Double-Arrow Connector",txtShape_spline:"Curve",txtShape_polyline1:"Scribble",txtShape_polyline2:"Freeform",errorEmailClient:"No email client could be found",textCustomLoader:"Please note that according to the terms of the license you are not entitled to change the loader.
    Please contact our Sales Department to get a quote.",waitText:"Please, wait...",errorFileSizeExceed:"The file size exceeds the limitation set for your server.
    Please contact your Document Server administrator for details.",errorUpdateVersionOnDisconnect:"Internet connection has been restored, and the file version has been changed.
    Before you can continue working, you need to download the file or copy its content to make sure nothing is lost, and then reload this page.",textHasMacros:"The file contains automatic macros.
    Do you want to run macros?",textRemember:"Remember my choice",warnLicenseLimitedRenewed:"License needs to be renewed.
    You have a limited access to document editing functionality.
    Please contact your administrator to get full access",warnLicenseLimitedNoAccess:"License expired.
    You have no access to document editing functionality.
    Please contact your administrator.",saveErrorTextDesktop:"This file cannot be saved or created.
    Possible reasons are:
    1. The file is read-only.
    2. The file is being edited by other users.
    3. The disk is full or corrupted."}}(),PE.Controllers.Main||{}))}),define("common/main/lib/view/DocumentAccessDialog",["common/main/lib/component/Window","common/main/lib/component/LoadMask"],function(){"use strict";Common.Views.DocumentAccessDialog=Common.UI.Window.extend(_.extend({initialize:function(t){var e={};_.extend(e,{title:this.textTitle,width:600,height:536,header:!0},t),this.template=['
    '].join(""),e.tpl=_.template(this.template)(e),this.settingsurl=t.settingsurl||"",Common.UI.Window.prototype.initialize.call(this,e)},render:function(){Common.UI.Window.prototype.render.call(this),this.$window.find("> .body").css({height:"auto",overflow:"hidden"});var t=document.createElement("iframe");t.width="100%",t.height=500,t.align="top",t.frameBorder=0,t.scrolling="no",t.onload=_.bind(this._onLoad,this),$("#id-sharing-placeholder").append(t),this.loadMask=new Common.UI.LoadMask({owner:$("#id-sharing-placeholder")}),this.loadMask.setTitle(this.textLoading),this.loadMask.show(),t.src=this.settingsurl;var e=this;this._eventfunc=function(t){e._onWindowMessage(t)},this._bindWindowEvents.call(this),this.on("close",function(t){e._unbindWindowEvents()})},_bindWindowEvents:function(){window.addEventListener?window.addEventListener("message",this._eventfunc,!1):window.attachEvent&&window.attachEvent("onmessage",this._eventfunc)},_unbindWindowEvents:function(){window.removeEventListener?window.removeEventListener("message",this._eventfunc):window.detachEvent&&window.detachEvent("onmessage",this._eventfunc)},_onWindowMessage:function(t){if(t&&window.JSON)try{this._onMessage.call(this,window.JSON.parse(t.data))}catch(t){}},_onMessage:function(t){t&&"onlyoffice"==t.Referer&&(t.needUpdate&&this.trigger("accessrights",this,t.sharingSettings),Common.NotificationCenter.trigger("window:close",this))},_onLoad:function(){this.loadMask&&this.loadMask.hide()},textTitle:"Sharing Settings",textLoading:"Loading"},Common.Views.DocumentAccessDialog||{}))}),define("text!common/main/lib/template/AutoCorrectDialog.template",[],function(){return'
    \n
    \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
    \n
    \n
    \n \n \n
    \n
    \n
    \n
    \n
    \n
    \n \n \n \n
    \n
    \n
    \n
    \n
    \n \n \n \n \n \n \n \n \n \n \n \n \n \n
    \n \n
    \n
    \n
    \n
    \n
    \n \n \n \n
    \n
    \n
    \n
    \n
    \n
    \n \n
    \n
    \n
    \n
    \n
    \n
    \n \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n
    \n \n
    \n
    \n
    \n
    \n
    \n
    \n'}),void 0===Common)var Common={};if(define("common/main/lib/view/AutoCorrectDialog",["text!common/main/lib/template/AutoCorrectDialog.template","common/main/lib/component/ListView","common/main/lib/component/Window","common/main/lib/component/CheckBox"],function(t){"use strict";var e=new Common.UI.DataViewStore,i=new Common.UI.DataViewStore;Common.Views.AutoCorrectDialog=Common.Views.AdvancedSettingsWindow.extend(_.extend({options:{contentWidth:375,height:430,buttons:null,toggleGroup:"autocorrect-dialog-group"},initialize:function(e){var i=Common.localStorage.getKeysFilter();this.appPrefix=i&&i.length?i.split(",")[0]:"";var n=[{panelId:"id-autocorrect-dialog-settings-math",panelCaption:this.textMathCorrect},{panelId:"id-autocorrect-dialog-settings-recognized",panelCaption:this.textRecognized}];"de-"==this.appPrefix||"pe-"==this.appPrefix?n.push({panelId:"id-autocorrect-dialog-settings-de-autoformat",panelCaption:this.textAutoFormat}):"sse-"==this.appPrefix&&n.push({panelId:"id-autocorrect-dialog-settings-sse-autoformat",panelCaption:this.textAutoFormat}),_.extend(this.options,{title:this.textTitle,storageName:this.appPrefix+"autocorrect-dialog-category",items:n,template:['
    ','",'
    ','
    '+_.template(t)({scope:this})+"
    ","
    ",'
    ','"].join("")},e||{}),this.api=this.options.api;var o=this.appPrefix+"settings-math-correct",s=Common.Utils.InternalSettings.get(o+"-add");this.arrAdd=s?JSON.parse(s):[],s=Common.Utils.InternalSettings.get(o+"-rem"),this.arrRem=s?JSON.parse(s):[],o=this.appPrefix+"settings-rec-functions",s=Common.Utils.InternalSettings.get(o+"-add"),this.arrAddRec=s?JSON.parse(s):[],s=Common.Utils.InternalSettings.get(o+"-rem"),this.arrRemRec=s?JSON.parse(s):[],Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this,this.options)},render:function(){Common.Views.AdvancedSettingsWindow.prototype.render.call(this);var t=this.getChild(),n=this;this.chReplaceType=new Common.UI.CheckBox({el:t.findById("#auto-correct-chb-replace-type"),labelText:this.textReplaceType,value:Common.Utils.InternalSettings.get(this.appPrefix+"settings-math-correct-replace-type")}).on("change",function(t,e,i,o){var s="checked"===t.getValue();Common.localStorage.setBool(n.appPrefix+"settings-math-correct-replace-type",s),Common.Utils.InternalSettings.set(n.appPrefix+"settings-math-correct-replace-type",s),n.api.asc_updateFlagAutoCorrectMathSymbols(s)}),this.onInitList(),this.mathList=new Common.UI.ListView({el:t.find("#auto-correct-math-list"),store:new Common.UI.DataViewStore(e.slice(0,9)),simpleAddMode:!1,template:_.template(['
    '].join("")),itemTemplate:_.template(['
    ','
    <%= replaced %>
    ','
    <%= by %>
    ',"
    "].join("")),scrollAlwaysVisible:!0,tabindex:1}),this.mathList.on("item:select",_.bind(this.onSelectMathItem,this)),this.inputReplace=new Common.UI.InputField({el:t.find("#auto-correct-replace"),allowBlank:!0,validateOnChange:!0,maxLength:31,validation:function(){return!0}}).on("changing",function(t,e){var i;if(e.length){i=n.mathList.store.find(function(t){if(0==t.get("replaced").indexOf(e))return!0}),i&&(n.mathList.scrollToRecord(i,!0),i.get("replaced")==e?n.mathList.selectRecord(i,!0):i=null)}!i&&n.mathList.deselectAll(),n.updateControls(i)}),this.inputReplace.cmpEl.find("input").on("keydown",function(t){if("ArrowDown"==t.key){var e=n.mathList.getSelectedRec()||n.mathList.store.at(0);e&&(n.mathList.selectRecord(e),n.mathList.scrollToRecord(e)),_.delay(function(){n.mathList.focus()},10)}}),this.inputBy=new Common.UI.InputField({el:t.find("#auto-correct-by"),allowBlank:!0,validateOnChange:!0,maxLength:255,validation:function(){return!0}}).on("changing",function(t,e){n.updateControls()}),this.btnReset=new Common.UI.Button({el:$("#auto-correct-btn-reset")}),this.btnReset.on("click",_.bind(this.onResetToDefault,this)),this.btnEdit=new Common.UI.Button({el:$("#auto-correct-btn-edit")}),this.btnEdit.on("click",_.bind(this.onEdit,this,!1)),this.btnDelete=new Common.UI.Button({el:$("#auto-correct-btn-delete")}),this.btnDelete.on("click",_.bind(this.onDelete,this,!1)),this.onInitRecList(),this.mathRecList=new Common.UI.ListView({el:t.find("#auto-correct-recognized-list"),store:new Common.UI.DataViewStore(i.slice(0,9)),simpleAddMode:!1,template:_.template(['
    '].join("")),itemTemplate:_.template(['
    <%= value %>
    '].join("")),scrollAlwaysVisible:!0,tabindex:1}),this.mathRecList.on("item:select",_.bind(this.onSelectRecItem,this)),this.inputRecFind=new Common.UI.InputField({el:t.find("#auto-correct-rec-find"),allowBlank:!0,validateOnChange:!0,maxLength:255,validation:function(){return!0}}).on("changing",function(t,e){var i;if(e.length){i=n.mathRecList.store.find(function(t){if(0==t.get("value").indexOf(e))return!0}),i&&(n.mathRecList.scrollToRecord(i,!0),i.get("value")==e?n.mathRecList.selectRecord(i,!0):i=null)}!i&&n.mathRecList.deselectAll(),n.updateRecControls(i)}),this.inputRecFind.cmpEl.find("input").on("keydown",function(t){if("ArrowDown"==t.key){var e=n.mathRecList.getSelectedRec()||n.mathRecList.store.at(0);e&&(n.mathRecList.selectRecord(e),n.mathRecList.scrollToRecord(e)),_.delay(function(){n.mathRecList.focus()},10)}}),this.btnResetRec=new Common.UI.Button({el:$("#auto-correct-btn-rec-reset")}),this.btnResetRec.on("click",_.bind(this.onResetRecToDefault,this)),this.btnAddRec=new Common.UI.Button({el:$("#auto-correct-btn-rec-edit")}),this.btnAddRec.on("click",_.bind(this.onAddRec,this,!1)),this.btnDeleteRec=new Common.UI.Button({el:$("#auto-correct-btn-rec-delete")}),this.btnDeleteRec.on("click",_.bind(this.onDeleteRec,this,!1)),"de-"==this.appPrefix||"pe-"==this.appPrefix?(this.chQuotes=new Common.UI.CheckBox({el:$("#id-autocorrect-dialog-chk-quotes"),labelText:this.textQuotes,value:Common.Utils.InternalSettings.get(this.appPrefix+"settings-autoformat-smart-quotes")}).on("change",function(t,e,i,o){var s="checked"===t.getValue();Common.localStorage.setBool(n.appPrefix+"settings-autoformat-smart-quotes",s),Common.Utils.InternalSettings.set(n.appPrefix+"settings-autoformat-smart-quotes",s),n.api.asc_SetAutoCorrectSmartQuotes(s)}),this.chHyphens=new Common.UI.CheckBox({el:$("#id-autocorrect-dialog-chk-hyphens"),labelText:this.textHyphens,value:Common.Utils.InternalSettings.get(this.appPrefix+"settings-autoformat-hyphens")}).on("change",function(t,e,i,o){var s="checked"===t.getValue();Common.localStorage.setBool(n.appPrefix+"settings-autoformat-hyphens",s),Common.Utils.InternalSettings.set(n.appPrefix+"settings-autoformat-hyphens",s),n.api.asc_SetAutoCorrectHyphensWithDash(s)}),this.chBulleted=new Common.UI.CheckBox({el:$("#id-autocorrect-dialog-chk-bulleted"),labelText:this.textBulleted,value:Common.Utils.InternalSettings.get(this.appPrefix+"settings-autoformat-bulleted")}).on("change",function(t,e,i,o){var s="checked"===t.getValue();Common.localStorage.setBool(n.appPrefix+"settings-autoformat-bulleted",s),Common.Utils.InternalSettings.set(n.appPrefix+"settings-autoformat-bulleted",s),n.api.asc_SetAutomaticBulletedLists(s)}),this.chNumbered=new Common.UI.CheckBox({el:$("#id-autocorrect-dialog-chk-numbered"),labelText:this.textNumbered,value:Common.Utils.InternalSettings.get(this.appPrefix+"settings-autoformat-numbered")}).on("change",function(t,e,i,o){var s="checked"===t.getValue();Common.localStorage.setBool(n.appPrefix+"settings-autoformat-numbered",s), +Common.Utils.InternalSettings.set(n.appPrefix+"settings-autoformat-numbered",s),n.api.asc_SetAutomaticNumberedLists(s)})):"sse-"==this.appPrefix&&(this.chNewRows=new Common.UI.CheckBox({el:$("#id-autocorrect-dialog-chk-new-rows"),labelText:this.textNewRowCol,value:Common.Utils.InternalSettings.get(this.appPrefix+"settings-autoformat-new-rows")}).on("change",function(t,e,i,o){var s="checked"===t.getValue();Common.localStorage.setBool(n.appPrefix+"settings-autoformat-new-rows",s),Common.Utils.InternalSettings.set(n.appPrefix+"settings-autoformat-new-rows",s),n.api.asc_setIncludeNewRowColTable(s)})),this.btnsCategory[0].on("click",_.bind(this.onMathCategoryClick,this,!1)),this.btnsCategory[1].on("click",_.bind(this.onRecCategoryClick,this,!1)),this.afterRender()},afterRender:function(){if(this.updateControls(),this.updateRecControls(),this.storageName){var t=Common.localStorage.getItem(this.storageName);this.setActiveCategory(null!==t?parseInt(t):0)}},getFocusedComponents:function(){return[this.inputReplace,this.inputBy,{cmp:this.mathList,selector:".listview"},this.inputRecFind,{cmp:this.mathRecList,selector:".listview"}]},getSettings:function(){},onSelectMathItem:function(t,e,i){i&&(this.inputReplace.setValue(i.get("replaced")),this.inputBy.setValue(i.get("by"))),this.updateControls(i)},updateControls:function(t){if(this.mathList){t=t||this.mathList.getSelectedRec();var e=this.inputBy.getValue(),i=this.inputReplace.getValue();if(t){var n=t.get("defaultDisabled"),o=t.get("defaultValue")&&t.get("defaultValueStr")!==t.get("by");this.btnDelete.setCaption(n?this.textRestore:this.textDelete),this.btnEdit.setDisabled(n||e===t.get("by")&&!o||!e||!i),this.btnEdit.setCaption(o&&e===t.get("by")?this.textReset:this.textReplace)}else this.btnDelete.setCaption(this.textDelete),this.btnEdit.setDisabled(!e||!i),this.btnEdit.setCaption(this.textAdd);this.btnDelete.setDisabled(!t)}},show:function(){Common.Views.AdvancedSettingsWindow.prototype.show.apply(this,arguments);var t=this.getActiveCategory();0==t?this.onMathCategoryClick(!0):1==t&&this.onRecCategoryClick(!0)},close:function(){Common.Views.AdvancedSettingsWindow.prototype.close.apply(this,arguments),this.mathList&&this.mathList.deselectAll(),this.mathRecList&&this.mathRecList.deselectAll()},onMathCategoryClick:function(t){var i=this;_.delay(function(){$("input",i.inputReplace.cmpEl).select().focus()},t?50:0),i.mathList.store.length=0&&this.arrAdd.splice(s,1)):(i=this.inputBy.getValue(),t.set("by",i),s<0?this.arrAdd.push([t.get("replaced"),i]):this.arrAdd[s][1]=i),o(t,i))},this)})}else t=e.add({replaced:this.inputReplace.getValue(),by:this.inputBy.getValue(),defaultDisabled:!1}),i=t.get("by"),this.arrAdd.push([t.get("replaced"),i]),o(t,i)},onResetToDefault:function(){Common.UI.warning({maxwidth:500,msg:this.warnReset,buttons:["yes","no"],primary:"yes",callback:_.bind(function(t,e){"yes"==t&&(this.api.asc_resetToDefaultAutoCorrectMathSymbols(),this.onResetList())},this)})},onResetList:function(){var t=this.appPrefix+"settings-math-correct",i=JSON.stringify([]);Common.Utils.InternalSettings.set(t+"-add",i),Common.localStorage.setItem(t+"-add",i),Common.Utils.InternalSettings.set(t+"-rem",i),Common.localStorage.setItem(t+"-rem",i),this.arrAdd=[],this.arrRem=[],e.remove(e.where({defaultValue:void 0})),e.each(function(t,e){t.set("by",t.get("defaultValueStr")),t.set("defaultDisabled",!1)}),this.mathList.deselectAll(),this.mathList.scroller&&(this.mathList.scroller.update(),this.mathList.scroller.scrollTop(0)),this.updateControls()},onInitList:function(){if(!(e.length>0)){e.comparator=function(t,e){var i=t.get("replaced").toLowerCase(),n=e.get("replaced").toLowerCase();return i==n?0:i-1};"object"==typeof t[1]?(n.defaultValueStr="",_.each(t[1],function(t){n.defaultValueStr+=Common.Utils.String.encodeSurrogateChar(t)}),n.by=n.defaultValueStr):n.by=n.defaultValueStr=Common.Utils.String.encodeSurrogateChar(t[1]),o.push(n)});var s=[];_.each(t,function(t,e){var i=_.findIndex(o,{replaced:t[0]});if(i<0)s.push({replaced:t[0],by:t[1],defaultDisabled:!1});else{o[i].by=t[1]}}),e.reset(o.concat(s)),this.updateControls()}},onInitRecList:function(){if(!(i.length>0)){i.comparator=function(t,e){var i=t.get("value").toLowerCase(),n=e.get("value").toLowerCase();return i==n?0:i-1})});var s=[];_.each(t,function(t,e){_.findIndex(o,{value:t})<0&&s.push({value:t,defaultValue:!1,defaultDisabled:!1})}),i.reset(o.concat(s)),this.updateRecControls()}},onResetRecToDefault:function(){Common.UI.warning({maxwidth:500,msg:this.textWarnResetRec,buttons:["yes","no"],primary:"yes",callback:_.bind(function(t,e){"yes"==t&&(this.api.asc_resetToDefaultAutoCorrectMathFunctions(),this.onResetRecList())},this)})},onResetRecList:function(){var t=this.appPrefix+"settings-rec-functions",e=JSON.stringify([]);Common.Utils.InternalSettings.set(t+"-add",e),Common.localStorage.setItem(t+"-add",e),Common.Utils.InternalSettings.set(t+"-rem",e),Common.localStorage.setItem(t+"-rem",e),this.arrAddRec=[],this.arrRemRec=[],i.remove(i.where({defaultValue:!1})),i.each(function(t,e){t.set("defaultDisabled",!1)}),this.mathRecList.deselectAll(),this.mathRecList.scroller&&(this.mathRecList.scroller.update(),this.mathRecList.scroller.scrollTop(0)),this.updateRecControls()},onRecCategoryClick:function(t){var e=this;_.delay(function(){$("input",e.inputRecFind.cmpEl).select().focus()},t?50:0),e.mathRecList.store.length","<% _.each(rows, function(row) { %>","","<% _.each(row, function(item) { %>",'
    ','',"
    ","<% }) %>","","<% }) %>",""].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,arguments),this.menu=t.menu},render:function(){return this.$el.html(this.template({rows:this.formats})),$(".btn-doc-format",this.el).on("click",_.bind(this.onFormatClick,this)),_.isUndefined(this.scroller)&&(this.scroller=new Common.UI.Scroller({el:this.$el,suppressScrollX:!0,alwaysVisibleY:!0})),this},show:function(){Common.UI.BaseView.prototype.show.call(this,arguments),this.scroller&&this.scroller.update()},onFormatClick:function(t){var e=t.currentTarget.attributes.format;!_.isUndefined(e)&&this.menu&&this.menu.fireEvent("saveas:format",[this.menu,parseInt(e.value)])}}),PE.Views.FileMenuPanels.ViewSaveCopy=Common.UI.BaseView.extend({el:"#panel-savecopy",menu:void 0,formats:[[{name:"PPTX",imgCls:"pptx",type:Asc.c_oAscFileType.PPTX,ext:".pptx"},{name:"PDF",imgCls:"pdf",type:Asc.c_oAscFileType.PDF,ext:".pdf"},{name:"ODP",imgCls:"odp",type:Asc.c_oAscFileType.ODP,ext:".odp"}],[{name:"POTX",imgCls:"potx",type:Asc.c_oAscFileType.POTX,ext:".potx"},{name:"PDFA",imgCls:"pdfa",type:Asc.c_oAscFileType.PDFA,ext:".pdf"},{name:"OTP",imgCls:"otp",type:Asc.c_oAscFileType.OTP,ext:".otp"}]],template:_.template(["","<% _.each(rows, function(row) { %>","","<% _.each(row, function(item) { %>",'","<% }) %>","","<% }) %>","
    ','',"
    "].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,arguments),this.menu=t.menu},render:function(){return this.$el.html(this.template({rows:this.formats})),$(".btn-doc-format",this.el).on("click",_.bind(this.onFormatClick,this)),_.isUndefined(this.scroller)&&(this.scroller=new Common.UI.Scroller({el:this.$el,suppressScrollX:!0,alwaysVisibleY:!0})),this},show:function(){Common.UI.BaseView.prototype.show.call(this,arguments),this.scroller&&this.scroller.update()},onFormatClick:function(t){var e=t.currentTarget.attributes.format,i=t.currentTarget.attributes["format-ext"];_.isUndefined(e)||_.isUndefined(i)||!this.menu||this.menu.fireEvent("savecopy:format",[this.menu,parseInt(e.value),i.value])}}),PE.Views.FileMenuPanels.Settings=Common.UI.BaseView.extend(_.extend({el:"#panel-settings",menu:void 0,template:_.template(['
    ','','','','',"",'','','','',"",'','','','',"",'','','','',"",'','','','',"",'','','','',"",'','','','',"",'',"",'','',"",'',"",'','',"",'','','','',"",'','','','',"",'','','','',"",'','','','',"","
    ','
    ','
    ','
    ','
    ","
    ",'"].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,arguments),this.menu=t.menu},render:function(t){var e=this,i=$(this.template({scope:this}));this.chSpell=new Common.UI.CheckBox({el:i.findById("#fms-chb-spell-check"),labelText:this.strSpellCheckMode}),this.chInputMode=new Common.UI.CheckBox({el:i.findById("#fms-chb-input-mode"),labelText:this.strInputMode}),this.cmbZoom=new Common.UI.ComboBox({el:i.findById("#fms-cmb-zoom"),style:"width: 160px;",editable:!1,cls:"input-group-nr",menuStyle:"max-height: 157px;",data:[{value:-1,displayValue:this.txtFitSlide},{value:-2,displayValue:this.txtFitWidth},{value:50,displayValue:"50%"},{value:60,displayValue:"60%"},{value:70,displayValue:"70%"},{value:80,displayValue:"80%"},{value:90,displayValue:"90%"},{value:100,displayValue:"100%"},{value:110,displayValue:"110%"},{value:120,displayValue:"120%"},{value:150,displayValue:"150%"},{value:175,displayValue:"175%"},{value:200,displayValue:"200%"}]}),this.cmbCoAuthMode=new Common.UI.ComboBox({el:i.findById("#fms-cmb-coauth-mode"),style:"width: 160px;",editable:!1,cls:"input-group-nr",data:[{value:1,displayValue:this.strFast,descValue:this.strCoAuthModeDescFast},{value:0,displayValue:this.strStrict,descValue:this.strCoAuthModeDescStrict}]}).on("selected",function(t,i){1==i.value&&"checked"!==e.chAutosave.getValue()&&e.chAutosave.setValue(1),e.lblCoAuthMode.text(i.descValue)}),this.lblCoAuthMode=i.findById("#fms-lbl-coauth-mode"),this.chAutosave=new Common.UI.CheckBox({el:i.findById("#fms-chb-autosave"),labelText:this.strAutosave}).on("change",function(t,i,n,o){"checked"!==t.getValue()&&e.cmbCoAuthMode.getValue()&&(e.cmbCoAuthMode.setValue(0),e.lblCoAuthMode.text(e.strCoAuthModeDescStrict))}),this.lblAutosave=i.findById("#fms-lbl-autosave"),this.chForcesave=new Common.UI.CheckBox({el:i.findById("#fms-chb-forcesave"),labelText:this.strForcesave}),this.chAlignGuides=new Common.UI.CheckBox({el:i.findById("#fms-chb-align-guides"),labelText:this.strAlignGuides});var n=_.template(["<% _.each(items, function(item) { %>",'
  • style="border-top: 1px solid #e5e5e5;margin-top: 5px;" <% } %> > class="checked" <% } %> ><%= scope.getDisplayValue(item) %>
  • ',"<% }); %>"].join(""));return this.cmbFontRender=new Common.UI.ComboBox({el:i.findById("#fms-cmb-font-render"),style:"width: 160px;",editable:!1,cls:"input-group-nr",itemsTemplate:n,data:[{value:Asc.c_oAscFontRenderingModeType.hintingAndSubpixeling,displayValue:this.txtWin},{value:Asc.c_oAscFontRenderingModeType.noHinting,displayValue:this.txtMac},{value:Asc.c_oAscFontRenderingModeType.hinting,displayValue:this.txtNative},{value:"custom",displayValue:this.txtCacheMode}]}),this.cmbFontRender.on("selected",_.bind(this.onFontRenderSelected,this)),this.cmbUnit=new Common.UI.ComboBox({el:i.findById("#fms-cmb-unit"),style:"width: 160px;",editable:!1,cls:"input-group-nr",data:[{value:Common.Utils.Metric.c_MetricUnits.cm,displayValue:this.txtCm},{value:Common.Utils.Metric.c_MetricUnits.pt,displayValue:this.txtPt},{value:Common.Utils.Metric.c_MetricUnits.inch,displayValue:this.txtInch}]}),this.cmbMacros=new Common.UI.ComboBox({el:i.findById("#fms-cmb-macros"),style:"width: 160px;",editable:!1,menuCls:"menu-aligned",cls:"input-group-nr",data:[{value:2,displayValue:this.txtStopMacros,descValue:this.txtStopMacrosDesc},{value:0,displayValue:this.txtWarnMacros,descValue:this.txtWarnMacrosDesc},{value:1,displayValue:this.txtRunMacros,descValue:this.txtRunMacrosDesc}]}).on("selected",function(t,i){e.lblMacrosDesc.text(i.descValue)}),this.lblMacrosDesc=i.findById("#fms-lbl-macros"),this.chPaste=new Common.UI.CheckBox({el:i.findById("#fms-chb-paste-settings"),labelText:this.strPasteButton}),this.btnAutoCorrect=new Common.UI.Button({el:i.findById("#fms-btn-auto-correct")}),this.btnAutoCorrect.on("click",_.bind(this.autoCorrect,this)),i.find(".btn.primary").each(function(t,i){new Common.UI.Button({el:$(i)}).on("click",_.bind(e.applySettings,e))}),this.pnlSettings=i.find(".flex-settings").addBack().filter(".flex-settings"),this.pnlApply=i.find(".fms-flex-apply").addBack().filter(".fms-flex-apply"),this.pnlTable=this.pnlSettings.find("table"),this.trApply=i.find(".fms-btn-apply"),this.$el=$(t).html(i),_.isUndefined(this.scroller)&&(this.scroller=new Common.UI.Scroller({el:this.pnlSettings,suppressScrollX:!0,alwaysVisibleY:!0})),Common.NotificationCenter.on({"window:resize":function(){e.isVisible()&&e.updateScroller()}}),this},show:function(){Common.UI.BaseView.prototype.show.call(this,arguments),this.updateSettings(),this.updateScroller()},updateScroller:function(){if(this.scroller){Common.UI.Menu.Manager.hideAll();var t=this.$el.height()0?t+"%":100);var i=Common.Utils.InternalSettings.get("pe-settings-coauthmode");e=this.cmbCoAuthMode.store.findWhere({value:i?1:0}),this.cmbCoAuthMode.setValue(e?e.get("value"):1),this.lblCoAuthMode.text(e?e.get("descValue"):this.strCoAuthModeDescFast),t=Common.Utils.InternalSettings.get("pe-settings-fontrender"),e=this.cmbFontRender.store.findWhere({value:parseInt(t)}),this.cmbFontRender.setValue(e?e.get("value"):Asc.c_oAscFontRenderingModeType.hintingAndSubpixeling),this._fontRender=this.cmbFontRender.getValue(),t=Common.Utils.InternalSettings.get("pe-settings-cachemode"),e=this.cmbFontRender.store.findWhere({value:"custom"}),e&&t&&e.set("checked",!!t),e&&t&&this.cmbFontRender.cmpEl.find("#"+e.get("id")+" a").addClass("checked"),t=Common.Utils.InternalSettings.get("pe-settings-unit"),e=this.cmbUnit.store.findWhere({value:t}),this.cmbUnit.setValue(e?parseInt(e.get("value")):Common.Utils.Metric.getDefaultMetric()),this._oldUnits=this.cmbUnit.getValue(),t=Common.Utils.InternalSettings.get("pe-settings-autosave"),this.chAutosave.setValue(1==t),this.mode.canForcesave&&this.chForcesave.setValue(Common.Utils.InternalSettings.get("pe-settings-forcesave")),this.chAlignGuides.setValue(Common.Utils.InternalSettings.get("pe-settings-showsnaplines")),e=this.cmbMacros.store.findWhere({value:Common.Utils.InternalSettings.get("pe-macros-mode")}),this.cmbMacros.setValue(e?e.get("value"):0),this.lblMacrosDesc.text(e?e.get("descValue"):this.txtWarnMacrosDesc),this.chPaste.setValue(Common.Utils.InternalSettings.get("pe-settings-paste-button"))},applySettings:function(){Common.localStorage.setItem("pe-settings-spellcheck",this.chSpell.isChecked()?1:0),Common.localStorage.setItem("pe-settings-inputmode",this.chInputMode.isChecked()?1:0),Common.localStorage.setItem("pe-settings-zoom",this.cmbZoom.getValue()),Common.Utils.InternalSettings.set("pe-settings-zoom",Common.localStorage.getItem("pe-settings-zoom")),this.mode.isEdit&&!this.mode.isOffline&&this.mode.canCoAuthoring&&Common.localStorage.setItem("pe-settings-coauthmode",this.cmbCoAuthMode.getValue()),Common.localStorage.setItem("pe-settings-fontrender",this.cmbFontRender.getValue());var t=this.cmbFontRender.store.findWhere({value:"custom"});Common.localStorage.setItem("pe-settings-cachemode",t&&!t.get("checked")?0:1),Common.localStorage.setItem("pe-settings-unit",this.cmbUnit.getValue()),Common.localStorage.setItem("pe-settings-autosave",this.chAutosave.isChecked()?1:0),this.mode.canForcesave&&Common.localStorage.setItem("pe-settings-forcesave",this.chForcesave.isChecked()?1:0),Common.Utils.InternalSettings.set("pe-settings-showsnaplines",this.chAlignGuides.isChecked()),Common.localStorage.setItem("pe-macros-mode",this.cmbMacros.getValue()),Common.Utils.InternalSettings.set("pe-macros-mode",this.cmbMacros.getValue()),Common.localStorage.setItem("pe-settings-paste-button",this.chPaste.isChecked()?1:0),Common.localStorage.save(),this.menu&&(this.menu.fireEvent("settings:apply",[this.menu]),this._oldUnits!==this.cmbUnit.getValue()&&Common.NotificationCenter.trigger("settings:unitschanged",this))},onFontRenderSelected:function(t,e){if("custom"==e.value){var i=t.store.findWhere({value:"custom"});i&&i.set("checked",!e.checked),t.cmpEl.find("#"+e.id+" a").toggleClass("checked",!e.checked),t.setValue(this._fontRender)}this._fontRender=t.getValue()},autoCorrect:function(){this.dlgAutoCorrect&&this.dlgAutoCorrect.isVisible()||(this.dlgAutoCorrect=new Common.Views.AutoCorrectDialog({api:this.api}),this.dlgAutoCorrect.show())},strInputMode:"Turn on hieroglyphs",strZoom:"Default Zoom Value",okButtonText:"Apply",txtFitSlide:"Fit to Slide",txtInput:"Alternate Input",txtWin:"as Windows",txtMac:"as OS X",txtNative:"Native",strFontRender:"Font Hinting",strUnit:"Unit of Measurement",txtCm:"Centimeter",txtPt:"Point",textAutoSave:"Autosave",strAutosave:"Turn on autosave",strShowChanges:"Realtime Collaboration Changes",txtAll:"View All",txtLast:"View Last",textAlignGuides:"Alignment Guides",strAlignGuides:"Turn on alignment guides",strCoAuthMode:"Co-editing mode",strCoAuthModeDescFast:"Other users will see your changes at once",strCoAuthModeDescStrict:"You will need to accept changes before you can see them",strFast:"Fast",strStrict:"Strict",textAutoRecover:"Autorecover",strAutoRecover:"Turn on autorecover",txtInch:"Inch",txtFitWidth:"Fit to Width",textForceSave:"Save to Server",strForcesave:"Always save to server (otherwise save to server on document close)",txtSpellCheck:"Spell Checking",strSpellCheckMode:"Turn on spell checking option",txtCacheMode:"Default cache mode",strMacrosSettings:"Macros Settings",txtWarnMacros:"Show Notification",txtRunMacros:"Enable All",txtStopMacros:"Disable All",txtWarnMacrosDesc:"Disable all macros with notification",txtRunMacrosDesc:"Enable all macros without notification",txtStopMacrosDesc:"Disable all macros without notification",strPaste:"Cut, copy and paste",strPasteButton:"Show Paste Options button when content is pasted",txtProofing:"Proofing",txtAutoCorrect:"AutoCorrect options..."},PE.Views.FileMenuPanels.Settings||{})),PE.Views.FileMenuPanels.RecentFiles=Common.UI.BaseView.extend({el:"#panel-recentfiles",menu:void 0,template:_.template(['
    '].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,arguments),this.menu=t.menu,this.recent=t.recent},render:function(){return this.$el.html(this.template()),this.viewRecentPicker=new Common.UI.DataView({el:$("#id-recent-view"),store:new Common.UI.DataViewStore(this.recent),itemTemplate:_.template(['
    ','
    ',"",'',"","
    ",'
    <% if (typeof title !== "undefined") {%><%= Common.Utils.String.htmlEncode(title || "") %><% } %>
    ','
    <% if (typeof folder !== "undefined") {%><%= Common.Utils.String.htmlEncode(folder || "") %><% } %>
    ',"
    "].join(""))}),this.viewRecentPicker.on("item:click",_.bind(this.onRecentFileClick,this)),_.isUndefined(this.scroller)&&(this.scroller=new Common.UI.Scroller({el:this.$el,suppressScrollX:!0,alwaysVisibleY:!0})),this},show:function(){Common.UI.BaseView.prototype.show.call(this,arguments),this.scroller&&this.scroller.update()},onRecentFileClick:function(t,e,i){this.menu&&this.menu.fireEvent("recent:open",[this.menu,i.get("url")])}}),PE.Views.FileMenuPanels.CreateNew=Common.UI.BaseView.extend(_.extend({el:"#panel-createnew",menu:void 0,events:function(){return{"click .blank-document-btn":_.bind(this._onBlankDocument,this),"click .thumb-list .thumb-wrap":_.bind(this._onDocumentTemplate,this)}},template:_.template(['

    <%= scope.fromBlankText %>


    ','
    ','
    ','','',"","
    ",'
    ',"

    <%= scope.newDocumentText %>

    ","<%= scope.newDescriptionText %>","
    ","
    ","

    <%= scope.fromTemplateText %>


    ",'
    ',"<% _.each(docs, function(item) { %>",'
    ','
    ",' style="background-image: url(<%= item.image %>);">',"<% } else { print(\">\") } %>","
    ",'
    <%= Common.Utils.String.htmlEncode(item.title || item.name || "") %>
    ',"
    ","<% }) %>","
    "].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,arguments),this.menu=t.menu},render:function(){return this.$el.html(this.template({scope:this,docs:this.options[0].docs})),_.isUndefined(this.scroller)&&(this.scroller=new Common.UI.Scroller({el:this.$el,suppressScrollX:!0,alwaysVisibleY:!0})),this},show:function(){Common.UI.BaseView.prototype.show.call(this,arguments),this.scroller&&this.scroller.update()},_onBlankDocument:function(){this.menu&&this.menu.fireEvent("create:new",[this.menu,"blank"])},_onDocumentTemplate:function(t){ +this.menu&&this.menu.fireEvent("create:new",[this.menu,t.currentTarget.attributes.template.value])},fromBlankText:"From Blank",newDocumentText:"New Presentation",newDescriptionText:"Create a new blank presentation which you will be able to style and format after it is created during the editing. Or choose one of the templates to start a document of a certain type or purpose where some styles have already been pre-applied.",fromTemplateText:"From Template",noTemplatesText:"There are no templates"},PE.Views.FileMenuPanels.CreateNew||{})),PE.Views.FileMenuPanels.DocumentInfo=Common.UI.BaseView.extend(_.extend({el:"#panel-info",menu:void 0,initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,arguments),this.rendered=!1,this.template=_.template(['
    ','',"",'",'',"","",'",'',"","",'",'',"",'','',"",'",'',"","",'",'',"","",'",'',"",'','',"",'",'',"","",'",'',"",'','',"",'",'',"","",'",'',"","",'",'","",'',"
    ',"","",'',"","
    ","
    ","
    ",'
    ','',"",'','',"","
    ","
    "].join("")),this.menu=t.menu,this.coreProps=null,this.authors=[],this._locked=!1},render:function(t){var e=this,i=$(e.template({scope:e}));this.lblPlacement=i.findById("#id-info-placement"),this.lblOwner=i.findById("#id-info-owner"),this.lblUploaded=i.findById("#id-info-uploaded");var n=function(t,e){if(e.keyCode===Common.UI.Keys.ESC){var i=t._input.val(),n=t.getValue();i!==n&&(t.setValue(n),e.stopPropagation())}};return this.inputTitle=new Common.UI.InputField({el:i.findById("#id-info-title"),style:"width: 200px;",placeHolder:this.txtAddText,validateOnBlur:!1}).on("keydown:before",n),this.inputSubject=new Common.UI.InputField({el:i.findById("#id-info-subject"),style:"width: 200px;",placeHolder:this.txtAddText,validateOnBlur:!1}).on("keydown:before",n),this.inputComment=new Common.UI.InputField({el:i.findById("#id-info-comment"),style:"width: 200px;",placeHolder:this.txtAddText,validateOnBlur:!1}).on("keydown:before",n),this.lblModifyDate=i.findById("#id-info-modify-date"),this.lblModifyBy=i.findById("#id-info-modify-by"),this.lblDate=i.findById("#id-info-date"),this.lblApplication=i.findById("#id-info-appname"),this.tblAuthor=i.findById("#id-info-author table"),this.trAuthor=i.findById("#id-info-add-author").closest("tr"),this.authorTpl='
    ',this.tblAuthor.on("click",function(t){var n=i.find(t.target);if(n.hasClass("close")&&!n.hasClass("disabled")){var o=n.closest("tr"),s=e.tblAuthor.find("tr").index(o);o.remove(),e.authors.splice(s,1),e.updateScroller(!0)}}),this.inputAuthor=new Common.UI.InputField({el:i.findById("#id-info-add-author"),style:"width: 200px;",validateOnBlur:!1,placeHolder:this.txtAddAuthor}).on("changed:after",function(t,i,n,o){if(i!=n){var s=i.trim();if(s&&s!==n.trim()){var a=o&&o.relatedTarget&&"fminfo-btn-apply"==o.relatedTarget.id;s.split(/\s*[,;]\s*/).forEach(function(t){var i=t.trim();if(i&&(e.authors.push(t),!a)){var n=$(Common.Utils.String.format(e.authorTpl,Common.Utils.String.htmlEncode(i)));e.trAuthor.before(n),e.updateScroller()}}),!a&&e.inputAuthor.setValue("")}}}).on("keydown:before",n),this.btnApply=new Common.UI.Button({el:i.findById("#fminfo-btn-apply")}),this.btnApply.on("click",_.bind(this.applySettings,this)),this.pnlInfo=i.find(".flex-settings").addBack().filter(".flex-settings"),this.pnlApply=i.findById("#fms-flex-apply"),this.rendered=!0,this.updateInfo(this.doc),this.$el=$(t).html(i),_.isUndefined(this.scroller)&&(this.scroller=new Common.UI.Scroller({el:this.pnlInfo,suppressScrollX:!0,alwaysVisibleY:!0})),Common.NotificationCenter.on({"window:resize":function(){e.isVisible()&&e.updateScroller()}}),this},show:function(){Common.UI.BaseView.prototype.show.call(this,arguments),this.updateFileInfo(),this.scroller&&this.scroller.scrollTop(0),this.updateScroller()},hide:function(){Common.UI.BaseView.prototype.hide.call(this,arguments)},updateScroller:function(t){this.scroller&&(this.scroller.update(t?{}:void 0),this.pnlInfo.toggleClass("bordered",this.scroller.isVisible()))},updateInfo:function(t){if(!this.doc&&t&&t.info&&(t.info.author&&console.log("Obsolete: The 'author' parameter of the document 'info' section is deprecated. Please use 'owner' instead."),t.info.created&&console.log("Obsolete: The 'created' parameter of the document 'info' section is deprecated. Please use 'uploaded' instead.")),this.doc=t,this.rendered){var e=!1;if(t=t||{},t.info){t.info.folder&&this.lblPlacement.text(t.info.folder),e=this._ShowHideInfoItem(this.lblPlacement,void 0!==t.info.folder&&null!==t.info.folder)||e;var i=t.info.owner||t.info.author;i&&this.lblOwner.text(i),e=this._ShowHideInfoItem(this.lblOwner,!!i)||e,i=t.info.uploaded||t.info.created,i&&this.lblUploaded.text(i),e=this._ShowHideInfoItem(this.lblUploaded,!!i)||e}else this._ShowHideDocInfo(!1);$("tr.divider.general",this.el)[e?"show":"hide"]();var n=this.api?this.api.asc_getAppProps():null;if(n&&(n=(n.asc_getApplication()||"")+(n.asc_getAppVersion()?" ":"")+(n.asc_getAppVersion()||""),this.lblApplication.text(n)),this._ShowHideInfoItem(this.lblApplication,!!n),this.coreProps=this.api?this.api.asc_getCoreProps():null,this.coreProps){var i=this.coreProps.asc_getCreated();i&&this.lblDate.text(i.toLocaleString(this.mode.lang,{year:"numeric",month:"2-digit",day:"2-digit"})+" "+i.toLocaleString(this.mode.lang,{timeStyle:"short"})),this._ShowHideInfoItem(this.lblDate,!!i)}}},updateFileInfo:function(){if(this.rendered){var t,e=this,i=this.api?this.api.asc_getCoreProps():null;if(this.coreProps=i,i){var n=!1;t=i.asc_getModified(),t&&this.lblModifyDate.text(t.toLocaleString(this.mode.lang,{year:"numeric",month:"2-digit",day:"2-digit"})+" "+t.toLocaleString(this.mode.lang,{timeStyle:"short"})),n=this._ShowHideInfoItem(this.lblModifyDate,!!t)||n,t=i.asc_getLastModifiedBy(),t&&this.lblModifyBy.text(Common.Utils.UserInfoParser.getParsedName(t)),n=this._ShowHideInfoItem(this.lblModifyBy,!!t)||n,$("tr.divider.modify",this.el)[n?"show":"hide"](),t=i.asc_getTitle(),this.inputTitle.setValue(t||""),t=i.asc_getSubject(),this.inputSubject.setValue(t||""),t=i.asc_getDescription(),this.inputComment.setValue(t||""),this.inputAuthor.setValue(""),this.tblAuthor.find("tr:not(:last-of-type)").remove(),this.authors=[],t=i.asc_getCreator(),t&&t.split(/\s*[,;]\s*/).forEach(function(t){var i=$(Common.Utils.String.format(e.authorTpl,Common.Utils.String.htmlEncode(t)));e.trAuthor.before(i),e.authors.push(t)}),this.tblAuthor.find(".close").toggleClass("hidden",!this.mode.isEdit),!this.mode.isEdit&&this._ShowHideInfoItem(this.tblAuthor,!!this.authors.length)}this.SetDisabled()}},_ShowHideInfoItem:function(t,e){return t.closest("tr")[e?"show":"hide"](),e},_ShowHideDocInfo:function(t){this._ShowHideInfoItem(this.lblPlacement,t),this._ShowHideInfoItem(this.lblOwner,t),this._ShowHideInfoItem(this.lblUploaded,t)},setMode:function(t){return this.mode=t,this.inputAuthor.setVisible(t.isEdit),this.pnlApply.toggleClass("hidden",!t.isEdit),this.tblAuthor.find(".close").toggleClass("hidden",!t.isEdit),t.isEdit||(this.inputTitle._input.attr("placeholder",""),this.inputSubject._input.attr("placeholder",""),this.inputComment._input.attr("placeholder",""),this.inputAuthor._input.attr("placeholder","")),this.SetDisabled(),this},setApi:function(t){return this.api=t,this.api.asc_registerCallback("asc_onLockCore",_.bind(this.onLockCore,this)),this.updateInfo(this.doc),this},onLockCore:function(t){this._locked=t,this.updateFileInfo()},SetDisabled:function(){var t=!this.mode.isEdit||this._locked;this.inputTitle.setDisabled(t),this.inputSubject.setDisabled(t),this.inputComment.setDisabled(t),this.inputAuthor.setDisabled(t),this.tblAuthor.find(".close").toggleClass("disabled",this._locked),this.tblAuthor.toggleClass("disabled",t),this.btnApply.setDisabled(this._locked)},applySettings:function(){this.coreProps&&this.api&&(this.coreProps.asc_putTitle(this.inputTitle.getValue()),this.coreProps.asc_putSubject(this.inputSubject.getValue()),this.coreProps.asc_putDescription(this.inputComment.getValue()),this.coreProps.asc_putCreator(this.authors.join(";")),this.api.asc_setCoreProps(this.coreProps)),this.menu.hide()},txtPlacement:"Location",txtOwner:"Owner",txtUploaded:"Uploaded",txtAppName:"Application",txtEditTime:"Total Editing time",txtTitle:"Title",txtSubject:"Subject",txtComment:"Comment",txtModifyDate:"Last Modified",txtModifyBy:"Last Modified By",txtCreated:"Created",txtAuthor:"Author",txtAddAuthor:"Add Author",txtAddText:"Add Text",txtMinutes:"min",okButtonText:"Apply"},PE.Views.FileMenuPanels.DocumentInfo||{})),PE.Views.FileMenuPanels.DocumentRights=Common.UI.BaseView.extend(_.extend({el:"#panel-rights",menu:void 0,initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,arguments),this.rendered=!1,this.template=_.template(['','','",'',"",'','","","
    "].join("")),this.templateRights=_.template(["","<% _.each(users, function(item) { %>","",'',"","","<% }); %>","
    <%= Common.Utils.String.htmlEncode(item.user) %><%= Common.Utils.String.htmlEncode(item.permissions) %>
    "].join("")),this.menu=t.menu},render:function(t){var e=$(this.template());return this.cntRights=e.findById("#id-info-rights"),this.btnEditRights=new Common.UI.Button({el:e.findById("#id-info-btn-edit")}),this.btnEditRights.on("click",_.bind(this.changeAccessRights,this)),this.rendered=!0,this.updateInfo(this.doc),this.$el=$(t).html(e),_.isUndefined(this.scroller)&&(this.scroller=new Common.UI.Scroller({el:this.$el,suppressScrollX:!0,alwaysVisibleY:!0})),Common.NotificationCenter.on("collaboration:sharingupdate",this.updateSharingSettings.bind(this)),Common.NotificationCenter.on("collaboration:sharingdeny",this.onLostEditRights.bind(this)),this},show:function(){Common.UI.BaseView.prototype.show.call(this,arguments),this.scroller&&this.scroller.update()},hide:function(){Common.UI.BaseView.prototype.hide.call(this,arguments)},updateInfo:function(t){this.doc=t,this.rendered&&(t=t||{},t.info?(t.info.sharingSettings&&this.cntRights.html(this.templateRights({users:t.info.sharingSettings})),this._ShowHideInfoItem("rights",void 0!==t.info.sharingSettings&&null!==t.info.sharingSettings&&t.info.sharingSettings.length>0),this._ShowHideInfoItem("edit-rights",(!!this.sharingSettingsUrl&&this.sharingSettingsUrl.length||this.mode.canRequestSharingSettings)&&!0!==this._readonlyRights)):this._ShowHideDocInfo(!1))},_ShowHideInfoItem:function(t,e){$("tr."+t,this.el)[e?"show":"hide"]()},_ShowHideDocInfo:function(t){this._ShowHideInfoItem("rights",t),this._ShowHideInfoItem("edit-rights",t)},setMode:function(t){return this.mode=t,this.sharingSettingsUrl=t.sharingSettingsUrl,this},changeAccessRights:function(t,e,i){Common.NotificationCenter.trigger("collaboration:sharing")},updateSharingSettings:function(t){this._ShowHideInfoItem("rights",void 0!==this.doc.info.sharingSettings&&null!==this.doc.info.sharingSettings&&this.doc.info.sharingSettings.length>0),this.cntRights.html(this.templateRights({users:this.doc.info.sharingSettings}))},onLostEditRights:function(){this._readonlyRights=!0,this.rendered&&this._ShowHideInfoItem("edit-rights",!1)},txtRights:"Persons who have rights",txtBtnAccessRights:"Change access rights"},PE.Views.FileMenuPanels.DocumentRights||{})),PE.Views.FileMenuPanels.Help=Common.UI.BaseView.extend({el:"#panel-help",menu:void 0,template:_.template(['
    ','
    ','
    ',"
    "].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,arguments),this.menu=t.menu,this.urlPref="resources/help/en/",this.en_data=[{src:"ProgramInterface/ProgramInterface.htm",name:"Introducing Presentation Editor user interface",headername:"Program Interface"},{src:"ProgramInterface/FileTab.htm",name:"File tab"},{src:"ProgramInterface/HomeTab.htm",name:"Home Tab"},{src:"ProgramInterface/InsertTab.htm",name:"Insert tab"},{src:"ProgramInterface/PluginsTab.htm",name:"Plugins tab"},{src:"UsageInstructions/OpenCreateNew.htm",name:"Create a new presentation or open an existing one",headername:"Basic operations"},{src:"UsageInstructions/CopyPasteUndoRedo.htm",name:"Copy/paste data, undo/redo your actions"},{src:"UsageInstructions/ManageSlides.htm",name:"Manage slides",headername:"Working with slides"},{src:"UsageInstructions/SetSlideParameters.htm",name:"Set slide parameters"},{src:"UsageInstructions/ApplyTransitions.htm",name:"Apply transitions"},{src:"UsageInstructions/PreviewPresentation.htm",name:"Preview your presentation"},{src:"UsageInstructions/InsertText.htm",name:"Insert and format your text",headername:"Text formatting"},{src:"UsageInstructions/AddHyperlinks.htm",name:"Add hyperlinks"},{src:"UsageInstructions/CreateLists.htm",name:"Create lists"},{src:"UsageInstructions/CopyClearFormatting.htm",name:"Copy/clear formatting"},{src:"UsageInstructions/InsertAutoshapes.htm",name:"Insert and format autoshapes",headername:"Operations on objects"},{src:"UsageInstructions/InsertImages.htm",name:"Insert and adjust images"},{src:"UsageInstructions/InsertCharts.htm",name:"Insert and edit charts"},{src:"UsageInstructions/InsertTables.htm",name:"Insert and format tables"},{src:"UsageInstructions/FillObjectsSelectColor.htm",name:"Fill objects and select colors"},{src:"UsageInstructions/ManipulateObjects.htm",name:"Manipulate objects on a slide"},{src:"UsageInstructions/AlignArrangeObjects.htm",name:"Align and arrange objects on a slide"},{src:"UsageInstructions/InsertEquation.htm",name:"Insert equations",headername:"Math equations"},{src:"HelpfulHints/CollaborativeEditing.htm",name:"Collaborative presentation editing",headername:"Presentation co-editing"},{src:"UsageInstructions/ViewPresentationInfo.htm",name:"View presentation information",headername:"Tools and settings"},{src:"UsageInstructions/SavePrintDownload.htm",name:"Save/print/download your presentation"},{src:"HelpfulHints/AdvancedSettings.htm",name:"Advanced settings of Presentation Editor"},{src:"HelpfulHints/Navigation.htm",name:"View settings and navigation tools"},{src:"HelpfulHints/Search.htm",name:"Search function"},{src:"HelpfulHints/SpellChecking.htm",name:"Spell-checking"},{src:"HelpfulHints/About.htm",name:"About Presentation Editor",headername:"Helpful hints"},{src:"HelpfulHints/SupportedFormats.htm",name:"Supported formats of electronic presentations"},{src:"HelpfulHints/KeyboardShortcuts.htm",name:"Keyboard shortcuts"}],Common.Utils.isIE&&(window.onhelp=function(){return!1})},render:function(){var t=this;return this.$el.html(this.template()),this.viewHelpPicker=new Common.UI.DataView({el:$("#id-help-contents"),store:new Common.UI.DataViewStore([]),keyMoveDirection:"vertical",itemTemplate:_.template(['
    ','
    <%= name %>
    ',"
    "].join(""))}),this.viewHelpPicker.on("item:add",function(t,e,i){i.has("headername")&&$(e.el).before('
    '+i.get("headername")+"
    ")}),this.viewHelpPicker.on("item:select",function(e,i,n){t.iFrame.src=t.urlPref+n.get("src")}),this.iFrame=document.createElement("iframe"),this.iFrame.src="",this.iFrame.align="top",this.iFrame.frameBorder="0",this.iFrame.width="100%",this.iFrame.height="100%",Common.Gateway.on("internalcommand",function(e){if("help:hyperlink"==e.type){var i=e.data,n=t.viewHelpPicker.store.find(function(t){return i.indexOf(t.get("src"))>0});n&&(t.viewHelpPicker.selectRecord(n,!0),t.viewHelpPicker.scrollToRecord(n))}}),$("#id-help-frame").append(this.iFrame),this},setLangConfig:function(t){var e=this,i=this.viewHelpPicker.store;if(t){t=t.split(/[\-\_]/)[0];var n={dataType:"json",error:function(){e.urlPref.indexOf("resources/help/en/")<0?(e.urlPref="resources/help/en/",i.url="resources/help/en/Contents.json",i.fetch(n)):(e.urlPref="resources/help/en/",i.reset(e.en_data))},success:function(){var t=i.at(0);e.viewHelpPicker.selectRecord(t),e.iFrame.src=e.urlPref+t.get("src")}};i.url="resources/help/"+t+"/Contents.json",i.fetch(n),this.urlPref="resources/help/"+t+"/"}},show:function(){Common.UI.BaseView.prototype.show.call(this),this._scrollerInited||(this.viewHelpPicker.scroller.update(),this._scrollerInited=!0)}}),PE.Views.FileMenuPanels.ProtectDoc=Common.UI.BaseView.extend(_.extend({el:"#panel-protect",menu:void 0,template:_.template(['','
    ','','
    ','',"",'',"","",'','',"","
    ","
    ",'
    ','','
    ','
    ',"
    "].join("")),initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,arguments),this.menu=t.menu;var e=this;this.templateSignature=_.template(['',"",'',"","",'",'","","
    "].join(""))},render:function(){this.$el.html(this.template({scope:this}));var t=PE.getController("Common.Controllers.Protection").getView();return this.btnAddPwd=t.getButton("add-password"),this.btnAddPwd.render(this.$el.find("#fms-btn-add-pwd")),this.btnAddPwd.on("click",_.bind(this.closeMenu,this)),this.btnChangePwd=t.getButton("change-password"),this.btnChangePwd.render(this.$el.find("#fms-btn-change-pwd")),this.btnChangePwd.on("click",_.bind(this.closeMenu,this)),this.btnDeletePwd=t.getButton("del-password"),this.btnDeletePwd.render(this.$el.find("#fms-btn-delete-pwd")),this.btnDeletePwd.on("click",_.bind(this.closeMenu,this)),this.cntPassword=$("#id-fms-password"),this.cntPasswordView=$("#id-fms-view-pwd"),this.btnAddInvisibleSign=t.getButton("signature"),this.btnAddInvisibleSign.render(this.$el.find("#fms-btn-invisible-sign")),this.btnAddInvisibleSign.on("click",_.bind(this.closeMenu,this)),this.cntSignature=$("#id-fms-signature"),this.cntSignatureView=$("#id-fms-signature-view"),_.isUndefined(this.scroller)&&(this.scroller=new Common.UI.Scroller({el:this.$el,suppressScrollX:!0,alwaysVisibleY:!0})),this.$el.on("click",".signature-edit-link",_.bind(this.onEdit,this)),this.$el.on("click",".signature-view-link",_.bind(this.onView,this)),this},show:function(){Common.UI.BaseView.prototype.show.call(this,arguments),this.updateSignatures(),this.updateEncrypt(),this.scroller&&this.scroller.update()},setMode:function(t){this.mode=t,this.cntSignature.toggleClass("hidden",!this.mode.isSignatureSupport),this.cntPassword.toggleClass("hidden",!this.mode.isPasswordSupport)},setApi:function(t){return this.api=t,this},closeMenu:function(){this.menu&&this.menu.hide()},onEdit:function(){this.menu&&this.menu.hide();var t=this;Common.UI.warning({title:this.notcriticalErrorTitle,msg:this.txtEditWarning,buttons:["ok","cancel"],primary:"ok",callback:function(e){"ok"==e&&t.api.asc_RemoveAllSignatures()}})},onView:function(){this.menu&&this.menu.hide(),PE.getController("RightMenu").rightmenu.SetActivePane(Common.Utils.documentSettingsType.Signature,!0)},updateSignatures:function(){var t=this.api.asc_getSignatures(),e=!1,i=!1;_.each(t,function(t,n){0==t.asc_getValid()?e=!0:i=!0});var n=i?this.txtSignedInvalid:e?this.txtSigned:"";this.cntSignatureView.html(this.templateSignature({tipText:n,hasSigned:e||i}))},updateEncrypt:function(){this.cntPasswordView.toggleClass("hidden",this.btnAddPwd.isVisible())},strProtect:"Protect Presentation",strSignature:"With Signature",txtView:"View signatures",txtEdit:"Edit presentation",txtSigned:"Valid signatures has been added to the presentation. The presentation is protected from editing.",txtSignedInvalid:"Some of the digital signatures in presentation are invalid or could not be verified. The presentation is protected from editing.",notcriticalErrorTitle:"Warning",txtEditWarning:"Editing will remove the signatures from the presentation.
    Are you sure you want to continue?",strEncrypt:"With Password",txtEncrypted:"This presentation has been protected by password"},PE.Views.FileMenuPanels.ProtectDoc||{}))}),void 0===Common)var Common={};if(Common.Models=Common.Models||{},define("common/main/lib/model/Comment",["underscore","backbone","common/main/lib/component/BaseView"],function(t,e){"use strict";Common.Models.Comment=e.Model.extend({defaults:{uid:0,guid:"",userid:0,username:"Guest",usercolor:null,date:void 0,quote:"",comment:"",resolved:!1,lock:!1,lockuserid:"",unattached:!1,userdata:"",id:Common.UI.getId(),time:0,showReply:!1,showReplyInPopover:!1,editText:!1,editTextInPopover:!1,last:void 0,replys:[],hideAddReply:!1,scope:null,hide:!1,hint:!1,dummy:void 0,editable:!0}}),Common.Models.Reply=e.Model.extend({defaults:{time:0,userid:0,username:"Guest",usercolor:null,reply:"",date:void 0,userdata:"",id:Common.UI.getId(),editText:!1,editTextInPopover:!1,scope:null,editable:!0}})}),void 0===Common)var Common={};if(Common.Collections=Common.Collections||{},define("common/main/lib/collection/Comments",["underscore","backbone","common/main/lib/model/Comment"],function(t,e){"use strict";Common.Collections.Comments=e.Collection.extend({model:Common.Models.Comment,groups:null,clearEditing:function(){this.each(function(t){t.set("editText",!1),t.set("editTextInPopover",!1),t.set("showReply",!1),t.set("showReplyInPopover",!1),t.set("hideAddReply",!1)})},getCommentsReplysCount:function(t){var e=0;return this.each(function(i){i.get("userid")==t&&e++;var n=i.get("replys");n&&n.length>0&&n.forEach(function(i){i.get("userid")==t&&e++})}),e}})}),define("text!common/main/lib/template/CommentsPopover.template",[],function(){return'
    \r\n\r\n \x3c!-- comment block --\x3e\r\n\r\n
    \r\n
    <%= scope.getUserName(username) %>\r\n
    \r\n
    <%=date%>
    \r\n <% if (!editTextInPopover || hint) { %>\r\n
    <%=scope.pickLink(comment)%>
    \r\n <% } else { %>\r\n
    \r\n \r\n <% if (hideAddReply) { %>\r\n \r\n <% } else { %>\r\n \r\n <% } %>\r\n \r\n
    \r\n <% } %>\r\n\r\n \x3c!-- replys elements --\x3e\r\n\r\n <% if (replys.length) { %>\r\n
    \r\n <% _.each(replys, function (item) { %>\r\n
    \r\n
    \r\n
    <%=item.get("usercolor")%><% } else { %> #cfcfcf <% } %>; " >
    <%= scope.getUserName(item.get("username")) %>\r\n
    \r\n
    <%=item.get("date")%>
    \r\n <% if (!item.get("editTextInPopover")) { %>\r\n
    <%=scope.pickLink(item.get("reply"))%>
    \r\n <% if (!hint) { %>\r\n
    \r\n <% if (item.get("editable")) { %>\r\n
    ">
    \r\n
    ">
    \r\n <%}%>\r\n
    \r\n <%}%>\r\n <% } else { %>\r\n
    \r\n \r\n \r\n \r\n
    \r\n <% } %>\r\n
    \r\n <% }); %>\r\n\r\n <% } %>\r\n\r\n \x3c!-- add reply button --\x3e\r\n\r\n <% if (!showReplyInPopover && !hideAddReply && !hint) { %>\r\n <% if (replys.length) { %>\r\n \r\n <% } else { %>\r\n \r\n <% } %>\r\n <% } %>\r\n\r\n \x3c!-- edit buttons --\x3e\r\n\r\n <% if (!editTextInPopover && !lock && !hint) { %>\r\n
    \r\n <% if (editable) { %>\r\n
    \r\n
    \r\n <% } %>\r\n <% if (resolved) { %>\r\n
    \r\n <% } else { %>\r\n
    \r\n <% } %>\r\n
    \r\n <% } %>\r\n\r\n \x3c!-- reply --\x3e\r\n\r\n <% if (showReplyInPopover) { %>\r\n
    \r\n \r\n \r\n \r\n
    \r\n <% } %>\r\n\r\n \x3c!-- locked user --\x3e\r\n\r\n <% if (lock) { %>\r\n
    \r\n
    <%=lockuserid%>
    \r\n <% } %>\r\n\r\n
    '}),define("text!common/main/lib/template/ReviewChangesPopover.template",[],function(){return'
    \r\n
    \r\n
    <%= scope.getUserName(username) %>\r\n
    \r\n
    <%=date%>
    \r\n
    <%=changetext%>
    \r\n
    \r\n <% if (goto) { %>\r\n
    \r\n <% } %>\r\n <% if (!hint) { %>\r\n <% if (scope.appConfig.isReviewOnly) { %>\r\n <% if (editable) { %>\r\n
    \r\n <% } %>\r\n <% } else if (editable) { %>\r\n
    \r\n
    \r\n <% } %>\r\n <% } %>\r\n
    \r\n <% if (!hint && lock) { %>\r\n
    \r\n
    <%=lockuser%>
    \r\n <% } %>\r\n
    '}),void 0===Common)var Common={};if(Common.Views=Common.Views||{},define("common/main/lib/view/ReviewPopover",["text!common/main/lib/template/CommentsPopover.template","text!common/main/lib/template/ReviewChangesPopover.template","common/main/lib/util/utils","common/main/lib/component/Button","common/main/lib/component/ComboBox","common/main/lib/component/DataView","common/main/lib/component/Layout","common/main/lib/component/Window"],function(t,e){"use strict";function i(t,e){var i,n,o=t;for(i in e)void 0!==i&&(n=e[i],o=o.replace(new RegExp(i,"g"),n));return o} +Common.Views.ReviewPopover=Common.UI.Window.extend(_.extend({initialize:function(t){var e={};return _.extend(e,{closable:!1,width:265,height:120,header:!1,modal:!1,alias:"Common.Views.ReviewPopover"},t),this.template=t.template||['
    ','
    ','
    ','
    ',"
    ",'
    ',"
    "].join(""),this.commentsStore=t.commentsStore,this.reviewStore=t.reviewStore,this.canRequestUsers=t.canRequestUsers,this.canRequestSendNotify=t.canRequestSendNotify,this.mentionShare=t.mentionShare,this.externalUsers=[],this._state={commentsVisible:!1,reviewVisible:!1},e.tpl=_.template(this.template)(e),this.arrow={margin:20,width:10,height:30},this.sdkBounds={width:0,height:0,padding:10,paddingTop:20},Common.UI.Window.prototype.initialize.call(this,e),this.canRequestUsers&&(Common.Gateway.on("setusers",_.bind(this.setUsers,this)),Common.NotificationCenter.on("mentions:clearusers",_.bind(this.clearUsers,this))),this},render:function(n,o){Common.UI.Window.prototype.render.call(this);var s=this,a=this.$window;a.css({height:"",minHeight:"",overflow:"hidden",position:"absolute",zIndex:"990"});var l=a.find(".body");l&&l.css("position","relative");var r=Common.UI.DataView.extend(function(){var t=s;return{options:{handleSelect:!1,allowScrollbar:!1,template:_.template('
    ')},getTextBox:function(){var t=$(this.el).find("textarea");return t&&t.length?t:void 0},setFocusToTextBox:function(t){var e=$(this.el).find("textarea");if(t)e.blur();else if(e&&e.length){var i=e.val();e.focus(),e.val(""),e.val(i)}},getActiveTextBoxVal:function(){var t=$(this.el).find("textarea");return t&&t.length?t.val().trim():""},autoHeightTextBox:function(){function e(){l=t.scroller.getScrollTop(),n.scrollHeight>n.clientHeight?(i.css({height:n.scrollHeight+a+"px"}),t.calculateSizeOfContent()):(r=n.clientHeight)>=o&&(i.css({height:o+"px"}),n.scrollHeight>n.clientHeight&&(c=Math.max(n.scrollHeight+a,o),i.css({height:c+"px"})),t.calculateSizeOfContent(),t.setLeftTop(s.arrowPosX,s.arrowPosY,s.leftX),t.calculateSizeOfContent()),t.scroller.scrollTop(l),t.autoScrollToEditButtons()}var i=this.$el.find("textarea"),n=null,o=50,a=0,l=0,r=0,c=0;i&&i.length&&(n=i.get(0))&&(a=.25*parseInt(i.css("lineHeight"),10),e(),i.bind("input propertychange",e)),this.textBox=i},clearTextBoxBind:function(){this.textBox&&(this.textBox.unbind("input propertychange"),this.textBox=void 0)}}}());if(r)if(this.commentsView)this.commentsView.render($("#id-comments-popover")),this.commentsView.onResetItems();else{this.commentsView=new r({el:$("#id-comments-popover"),store:s.commentsStore,itemTemplate:_.template(i(t,{textAddReply:s.textAddReply,textAdd:s.textAdd,textCancel:s.textCancel,textEdit:s.textEdit,textReply:s.textReply,textClose:s.textClose,maxCommLength:Asc.c_oAscMaxCellOrCommentLength,textMention:s.canRequestSendNotify?s.mentionShare?s.textMention:s.textMentionNotify:""}))});var c=function(t,e,i){e.tipsArray&&e.tipsArray.forEach(function(t){t.remove()});var n=[],o=$(e.el).find(".btn-resolve");o.tooltip({title:s.textResolve,placement:"cursor"}),o.each(function(t,e){n.push($(e).data("bs.tooltip").tip())}),o=$(e.el).find(".btn-resolve-check"),o.tooltip({title:s.textOpenAgain,placement:"cursor"}),o.each(function(t,e){n.push($(e).data("bs.tooltip").tip())}),e.tipsArray=n,this.autoHeightTextBox()},d=function(){s._isMouseOver=!0},h=function(){s._isMouseOver=!1};this.commentsView.on("item:add",c),this.commentsView.on("item:remove",c),this.commentsView.on("item:change",c),this.commentsView.cmpEl.on("mouseover",d).on("mouseout",h),this.commentsView.on("item:click",function(t,e,i,n){function o(){s.update()}var a,l,r,c,d,h;if(a=$(n.target)){if(l=i.get("editTextInPopover"),r=i.get("showReplyInPopover"),h=i.get("hideAddReply"),c=i.get("uid"),d=a.attr("data-value"),i.get("hint"))return void s.fireEvent("comment:disableHint",[i]);if(a.hasClass("btn-edit"))_.isUndefined(d)?l||(s.fireEvent("comment:closeEditing"),i.set("editTextInPopover",!0),s.fireEvent("comment:show",[c]),this.autoHeightTextBox(),s.calculateSizeOfContent(),s.setLeftTop(s.arrowPosX,s.arrowPosY,s.leftX),s.calculateSizeOfContent(),o(),s.hookTextBox(),s.autoScrollToEditButtons(),this.setFocusToTextBox()):(s.fireEvent("comment:closeEditing",[c]),s.fireEvent("comment:editReply",[c,d,!0]),this.replyId=d,this.autoHeightTextBox(),s.calculateSizeOfContent(),s.setLeftTop(s.arrowPosX,s.arrowPosY,s.leftX),s.calculateSizeOfContent(),o(),s.hookTextBox(),s.autoScrollToEditButtons(),this.setFocusToTextBox());else if(a.hasClass("btn-delete"))_.isUndefined(d)?s.fireEvent("comment:remove",[c]):(s.fireEvent("comment:removeReply",[c,d]),s.calculateSizeOfContent(),s.setLeftTop(s.arrowPosX,s.arrowPosY,s.leftX),s.calculateSizeOfContent()),s.fireEvent("comment:closeEditing"),o();else if(a.hasClass("user-reply"))s.fireEvent("comment:closeEditing"),i.set("showReplyInPopover",!0),s.calculateSizeOfContent(),s.setLeftTop(s.arrowPosX,s.arrowPosY,s.leftX),s.calculateSizeOfContent(),o(),this.autoHeightTextBox(),s.hookTextBox(),s.autoScrollToEditButtons(),this.setFocusToTextBox();else if(a.hasClass("btn-reply",!1))r&&(this.clearTextBoxBind(),s.fireEvent("comment:addReply",[c,this.getActiveTextBoxVal()]),s.fireEvent("comment:closeEditing"),s.calculateSizeOfContent(),o());else if(a.hasClass("btn-close",!1))s.fireEvent("comment:closeEditing",[c]),s.calculateSizeOfContent(),s.fireEvent("comment:show",[c]),o();else if(a.hasClass("btn-inner-edit",!1)){if(i.get("dummy")){var p=this.getActiveTextBoxVal();if(s.clearDummyText(),p.length>0)s.fireEvent("comment:addDummyComment",[p]);else{var u=s.$window.find("textarea:not(.user-message)");u&&u.length&&setTimeout(function(){u.focus()},10)}return}this.clearTextBoxBind(),_.isUndefined(this.replyId)?l&&(s.fireEvent("comment:change",[c,this.getActiveTextBoxVal()]),s.fireEvent("comment:closeEditing"),s.calculateSizeOfContent()):(s.fireEvent("comment:changeReply",[c,this.replyId,this.getActiveTextBoxVal()]),this.replyId=void 0,s.fireEvent("comment:closeEditing")),o()}else if(a.hasClass("btn-inner-close",!1)){if(i.get("dummy"))return s.clearDummyText(),void s.hide();h&&this.getActiveTextBoxVal().length>0?(s.saveText(),i.set("hideAddReply",!1),this.getTextBox().val(s.textVal),this.autoHeightTextBox()):(this.clearTextBoxBind(),s.fireEvent("comment:closeEditing",[c])),this.replyId=void 0,s.calculateSizeOfContent(),s.setLeftTop(s.arrowPosX,s.arrowPosY,s.leftX),s.calculateSizeOfContent(),o()}else if(a.hasClass("btn-resolve",!1)){var m=a.data("bs.tooltip");m&&(m.dontShow=!0),s.fireEvent("comment:resolve",[c]),o()}else if(a.hasClass("btn-resolve-check",!1)){var m=a.data("bs.tooltip");m&&(m.dontShow=!0),s.fireEvent("comment:resolve",[c]),o()}}}),this.emailMenu=new Common.UI.Menu({maxHeight:200,cyclic:!1,items:[]}).on("render:after",function(t){this.scroller=new Common.UI.Scroller({el:$(this.el).find(".dropdown-menu "),useKeyboard:this.enableKeyEvents&&!this.handleSelect,minScrollbarLength:40,alwaysVisibleY:!0})}).on("show:after",function(){this.scroller.update({alwaysVisibleY:!0}),s.$window.css({zIndex:"1001"})}).on("hide:after",function(){s.$window.css({zIndex:"990"})}),s.on({show:function(){s.commentsView.autoHeightTextBox(),s.$window.find("textarea").keydown(function(t){t.keyCode==Common.UI.Keys.ESC&&s.hide(!0)})},"animate:before":function(){var t=s.$window.find("textarea");t&&t.length&&t.focus()}})}var p=Common.UI.DataView.extend(function(){return{options:{handleSelect:!1,scrollable:!0,template:_.template('
    ')}}}());if(p)if(this.reviewChangesView)this.reviewChangesView.render($("#id-review-popover")),this.reviewChangesView.onResetItems();else{this.reviewChangesView=new p({el:$("#id-review-popover"),store:s.reviewStore,itemTemplate:_.template(e)});var c=function(t,e,i){e.tipsArray&&e.tipsArray.forEach(function(t){t.remove()});var n=[],o=$(e.el).find(".btn-goto");o.tooltip({title:s.textFollowMove,placement:"cursor"}),o.each(function(t,e){n.push($(e).data("bs.tooltip").tip())}),e.tipsArray=n};this.reviewChangesView.on("item:add",c),this.reviewChangesView.on("item:remove",c),this.reviewChangesView.on("item:change",c),this.reviewChangesView.on("item:click",function(t,e,i,n){var o=$(n.target);if(o)if(o.hasClass("btn-accept"))s.fireEvent("reviewchange:accept",[i.get("changedata")]);else if(o.hasClass("btn-reject"))s.fireEvent("reviewchange:reject",[i.get("changedata")]);else if(o.hasClass("btn-delete"))s.fireEvent("reviewchange:delete",[i.get("changedata")]);else if(o.hasClass("btn-goto")){var a=o.data("bs.tooltip");a&&(a.dontShow=!0),s.fireEvent("reviewchange:goto",[i.get("changedata")])}})}_.isUndefined(this.scroller)&&(this.scroller=new Common.UI.Scroller({el:a.find("#id-popover"),minScrollbarLength:40,wheelSpeed:10,alwaysVisibleY:!0}))},showComments:function(t,e,i,n){this.options.animate=t;var o=this.commentsView.getTextBox();e&&this.textVal&&o&&o.val(this.textVal),n&&n.length&&o&&o.val(n),this.show(t),this.hookTextBox(),this._state.commentsVisible=!0},showReview:function(t,e,i){this.show(t),this._state.reviewVisible=!0},show:function(t,e,i,n){this.options.animate=t,Common.UI.Window.prototype.show.call(this),this.scroller&&this.scroller.update({minScrollbarLength:40,alwaysVisibleY:!0})},hideComments:function(){this.handlerHide&&this.handlerHide(),this.hideTips(),this._state.commentsVisible=!1,this._state.reviewVisible?this.calculateSizeOfContent():this.hide()},hideReview:function(){this.handlerHide&&this.handlerHide(),this.hideTips(),this._state.reviewVisible=!1,this._state.commentsVisible?this.calculateSizeOfContent():this.hide()},hide:function(){this.handlerHide&&this.handlerHide.apply(this,arguments),this.hideTips(),Common.UI.Window.prototype.hide.call(this),_.isUndefined(this.e)||this.e.keyCode!=Common.UI.Keys.ESC||(this.e.preventDefault(),this.e.stopImmediatePropagation(),this.e=void 0)},update:function(t){this.commentsView&&t&&this.commentsView.onResetItems(),this.scroller&&this.scroller.update({minScrollbarLength:40,alwaysVisibleY:!0})},isVisible:function(){return this.$window&&this.$window.is(":visible")},setLeftTop:function(t,e,i,n,o){if(this.$window||this.render(),n&&(t=this.arrowPosX,e=this.arrowPosY,i=this.leftX),!_.isUndefined(t)||!_.isUndefined(e)){this.arrowPosX=t,this.arrowPosY=e,this.leftX=i;var s=$("#id-popover"),a=$("#id-comments-arrow"),l=$("#editor_sdk"),r=null,c=0,d="",h=0,p="",u=0,m="",g=0,f="",b=0,C=0,v=0,y=0,w=0,x=0;s&&a&&l&&l.get(0)&&(r=l.get(0).getBoundingClientRect())&&(c=r.height-2*this.sdkBounds.padding,this.$window.css({maxHeight:c+"px"}),this.sdkBounds.width=r.width,this.sdkBounds.height=r.height,_.isUndefined(t)||(d=$("#id_vertical_scroll"),d.length?h="none"!==d.css("display")?d.width():0:(d=$("#ws-v-scrollbar"),d.length&&(h="none"!==d.css("display")?d.width():0)),this.sdkBounds.width-=h,p=$("#id_panel_left"),p.length&&(u="none"!==p.css("display")?p.width():0),m=$("#id_panel_thumbnails"),m.length&&(g="none"!==m.css("display")?m.width():0,this.sdkBounds.width-=g),C=Math.min(0+t+this.arrow.width,0+this.sdkBounds.width-this.$window.outerWidth()-25),C=Math.max(0+u+this.arrow.width,C),a.removeClass("right").addClass("left"),_.isUndefined(i)||(v=this.$window.outerWidth())&&(t+v>this.sdkBounds.width-this.arrow.width+5&&this.leftX>v?(C=this.leftX-v+0-this.arrow.width,a.removeClass("left").addClass("right")):C=0+t+this.arrow.width),this.$window.css("left",C+"px")),_.isUndefined(e)||(f=$("#id_panel_top"),x=0,f.length?(b="none"!==f.css("display")?f.height():0,x+=this.sdkBounds.paddingTop):(f=$("#ws-h-scrollbar"),f.length&&(b="none"!==f.css("display")?f.height():0)),this.sdkBounds.height-=b,y=this.$window.outerHeight(),w=Math.min(0+c-y,this.arrowPosY+0-this.arrow.height),w=Math.max(w,x),parseInt(a.css("top"))+this.arrow.height>y&&a.css({top:y-this.arrow.height+"px"}),this.$window.css("top",w+"px"))),o||this.calculateSizeOfContent()}},calculateSizeOfContent:function(t){if(!t||this.$window.is(":visible")){this.$window.css({overflow:"hidden"});var e=$("#id-comments-arrow"),i=$("#id-popover"),n=null,o=null,s=null,a=0,l="",r=0,c=0,d=0,h=0,p=0,u=0;if(i&&e&&i.get(0)){var m=this.scroller.getScrollTop();i.css({height:"100%"}),n=i.get(0).getBoundingClientRect(),n&&(o=$("#editor_sdk"))&&o.get(0)&&(s=o.get(0).getBoundingClientRect())&&(a=s.height-2*this.sdkBounds.padding,u=0,d=this.$window.outerHeight(),l=$("#id_panel_top"),l.length?(r="none"!==l.css("display")?l.height():0,u+=this.sdkBounds.paddingTop):(l=$("#ws-h-scrollbar"),l.length&&(r="none"!==l.css("display")?l.height():0)),h=Math.max(i.outerHeight(),this.$window.outerHeight()),a<=h?(this.$window.css({maxHeight:a-r+"px",top:0+r+"px"}),i.css({height:a-r-3+"px"}),c=Math.min(c,a-(r+this.arrow.margin+this.arrow.height)),e.css({top:c+"px"}),this.scroller.scrollTop(m)):(h=d,h>0&&(n.top+h>a+0||0===n.height)&&(p=Math.min(0+a-h,this.arrowPosY+0-this.arrow.height),p=Math.max(p,u),this.$window.css({top:p+"px"})),c=Math.max(this.arrow.margin,this.arrowPosY-(a-h)-this.arrow.height),c=Math.min(c,h-this.arrow.margin-this.arrow.height),e.css({top:c+"px"})))}this.$window.css({overflow:""}),this.scroller&&this.scroller.update({minScrollbarLength:40,alwaysVisibleY:!0})}},saveText:function(t){this.commentsView&&this.commentsView.cmpEl.find(".lock-area").length<1&&(this.textVal=void 0,t?this.commentsView.clearTextBoxBind():this.textVal=this.commentsView.getActiveTextBoxVal())},loadText:function(){if(this.textVal&&this.commentsView){var t=this.commentsView.getTextBox();t&&t.val(this.textVal)}},getEditText:function(){if(this.commentsView)return this.commentsView.getActiveTextBoxVal()},saveDummyText:function(){this.commentsView&&this.commentsView.cmpEl.find(".lock-area").length<1&&(this.textDummyVal=this.commentsView.getActiveTextBoxVal())},clearDummyText:function(){if(this.commentsView&&this.commentsView.cmpEl.find(".lock-area").length<1){this.textDummyVal=void 0;var t=this.commentsView.getTextBox();t&&t.val(""),this.commentsView.clearTextBoxBind()}},getDummyText:function(){return this.textDummyVal||""},hookTextBox:function(){var t=this,e=this.commentsView.getTextBox();e&&e.keydown(function(e){if(!e.ctrlKey&&!e.metaKey||e.altKey||e.keyCode!==Common.UI.Keys.RETURN){if(e.keyCode===Common.UI.Keys.TAB){var i,n,o;o=this.selectionStart,n=this.selectionEnd,i=$(this),i.val(i.val().substring(0,o)+"\t"+i.val().substring(n)),this.selectionStart=this.selectionEnd=o+1,e.preventDefault()}}else{var s=$("#id-comments-change-popover");s&&s.length&&s.click(),e.stopImmediatePropagation()}t.e=e}),this.canRequestUsers&&(e&&e.keydown(function(e){e.keyCode==Common.UI.Keys.SPACE||e.keyCode===Common.UI.Keys.TAB||e.keyCode==Common.UI.Keys.HOME||e.keyCode==Common.UI.Keys.END||e.keyCode==Common.UI.Keys.RIGHT||e.keyCode==Common.UI.Keys.LEFT||e.keyCode==Common.UI.Keys.UP?t.onEmailListMenu():e.keyCode==Common.UI.Keys.DOWN&&t.emailMenu&&t.emailMenu.rendered&&t.emailMenu.isVisible()&&(_.delay(function(){var e=t.emailMenu.cmpEl.find("li:not(.divider):first");e=e.find("a"),e.focus()},10),e.preventDefault()),t.e=e}),e&&e.on("input",function(e){for(var i=$(this),n=this.selectionStart,o=i.val(),s=0,a=o.length-1,l=n-1;l>=0;l--)if(32==o.charCodeAt(l)||13==o.charCodeAt(l)||10==o.charCodeAt(l)||9==o.charCodeAt(l)){s=l+1;break}for(var l=n;l<=a;l++)if(32==o.charCodeAt(l)||13==o.charCodeAt(l)||10==o.charCodeAt(l)||9==o.charCodeAt(l)){a=l-1;break}var r=o.substring(s,a+1),c=r.match(/^(?:[@]|[+](?!1))(\S*)/);c&&c.length>1?(r=c[1],t.onEmailListMenu(r,s,a)):t.onEmailListMenu()}))},hideTips:function(){this.commentsView&&_.each(this.commentsView.dataViewItems,function(t){t.tipsArray&&t.tipsArray.forEach(function(t){t.hide()})},this),this.reviewChangesView&&_.each(this.reviewChangesView.dataViewItems,function(t){t.tipsArray&&t.tipsArray.forEach(function(t){t.hide()})},this),this.emailMenu&&this.emailMenu.rendered&&this.emailMenu.cmpEl.css("display","none")},isCommentsViewMouseOver:function(){return this._isMouseOver},setReviewStore:function(t){this.reviewStore=t,this.reviewChangesView&&this.reviewChangesView.setStore(this.reviewStore)},setCommentsStore:function(t){this.commentsStore=t,this.commentsView&&this.commentsView.setStore(this.commentsStore)},setUsers:function(t){this.externalUsers=t.users||[],this.isUsersLoading=!1,this._state.emailSearch&&this.onEmailListMenu(this._state.emailSearch.str,this._state.emailSearch.left,this._state.emailSearch.right),this._state.emailSearch=null},clearUsers:function(){this.externalUsers=[]},getPopover:function(t){return this.popover||(this.popover=new Common.Views.ReviewPopover(t)),this.popover},autoScrollToEditButtons:function(){var t=$("#id-comments-change-popover"),e=null,i=this.$window[0].getBoundingClientRect(),n=0;t.length&&(e=t.get(0).getBoundingClientRect())&&i&&(n=i.bottom-(e.bottom+7))<0&&this.scroller.scrollTop(this.scroller.getScrollTop()-n)},onEmailListMenu:function(t,e,i,n){var o=this,s=o.externalUsers,a=o.emailMenu;if(s.length<1){if(this._state.emailSearch={str:t,left:e,right:i},this.isUsersLoading)return;return this.isUsersLoading=!0,void Common.Gateway.requestUsers()}if("string"==typeof t){var l=o.$window.find(Common.Utils.String.format("#menu-container-{0}",a.id)),r=this.commentsView.getTextBox(),c=r?r[0]:null,d=c?[c.offsetLeft,c.offsetTop+c.clientHeight+3]:[0,0];a.rendered||(l.length<1&&(l=$(Common.Utils.String.format('',a.id)),o.$window.append(l)),a.render(l),a.cmpEl.css("min-width",c?c.clientWidth:220),a.cmpEl.attr({tabindex:"-1"}),a.on("hide:after",function(){setTimeout(function(){var t=o.commentsView.getTextBox();t&&t.focus()},10)}));for(var h=0;h0){t=t.toLowerCase(),t.length>0&&(s=_.filter(s,function(e){return e.email&&0===e.email.toLowerCase().indexOf(t)||e.name&&0===e.name.toLowerCase().indexOf(t)}));var p=_.template('
    <%= Common.Utils.String.htmlEncode(caption) %>
    <%= Common.Utils.String.htmlEncode(options.value) %>
    '),u=!1;_.each(s,function(t,n){if(u&&!t.hasAccess&&(u=!1,a.addItem(new Common.UI.MenuItem({caption:"--"}))),t.email&&t.name){var s=new Common.UI.MenuItem({caption:t.name,value:t.email,template:p}).on("click",function(t,n){o.insertEmailToTextbox(t.options.value,e,i)});a.addItem(s),t.hasAccess&&(u=!0)}})}a.items.length>0?(l.css({left:d[0],top:d[1]}),a.menuAlignEl=r,a.show(),a.cmpEl.css("display",""),a.alignPosition("bl-tl",-5),a.scroller.update({alwaysVisibleY:!0})):a.rendered&&a.cmpEl.css("display","none")}else a.rendered&&a.cmpEl.css("display","none")},insertEmailToTextbox:function(t,e,i){var n=this.commentsView.getTextBox();if(n){var o=n.val();n.val(o.substring(0,e)+"+"+t+" "+o.substring(i+1,o.length)),setTimeout(function(){n[0].selectionStart=n[0].selectionEnd=e+t.length+2},10)}},textAddReply:"Add Reply",textAdd:"Add",textCancel:"Cancel",textEdit:"Edit",textReply:"Reply",textClose:"Close",textResolve:"Resolve",textOpenAgain:"Open Again",textFollowMove:"Follow Move",textMention:"+mention will provide access to the document and send an email",textMentionNotify:"+mention will notify the user via email"},Common.Views.ReviewPopover||{}))}),void 0===Common)var Common={};if(Common.Controllers=Common.Controllers||{},define("common/main/lib/controller/Comments",["core","common/main/lib/model/Comment","common/main/lib/collection/Comments","common/main/lib/view/Comments","common/main/lib/view/ReviewPopover"],function(){"use strict";function t(){return void 0!==Asc.asc_CCommentDataWord?new Asc.asc_CCommentDataWord(null):new Asc.asc_CCommentData(null)}Common.Controllers.Comments=Backbone.Controller.extend(_.extend({models:[],collections:["Common.Collections.Comments"],views:["Common.Views.Comments","Common.Views.ReviewPopover"],sdkViewName:"#id_main",subEditStrings:{},filter:void 0,hintmode:!1,viewmode:!1,isSelectedComment:!1,uids:[],oldUids:[],isDummyComment:!1,initialize:function(){this.addListeners({"Common.Views.Comments":{"comment:add":_.bind(this.onCreateComment,this),"comment:change":_.bind(this.onChangeComment,this),"comment:remove":_.bind(this.onRemoveComment,this),"comment:resolve":_.bind(this.onResolveComment,this),"comment:show":_.bind(this.onShowComment,this),"comment:addReply":_.bind(this.onAddReplyComment,this),"comment:changeReply":_.bind(this.onChangeReplyComment,this),"comment:removeReply":_.bind(this.onRemoveReplyComment,this),"comment:editReply":_.bind(this.onShowEditReplyComment,this),"comment:closeEditing":_.bind(this.closeEditing,this)},"Common.Views.ReviewPopover":{"comment:change":_.bind(this.onChangeComment,this),"comment:remove":_.bind(this.onRemoveComment,this),"comment:resolve":_.bind(this.onResolveComment,this),"comment:show":_.bind(this.onShowComment,this),"comment:addReply":_.bind(this.onAddReplyComment,this),"comment:changeReply":_.bind(this.onChangeReplyComment,this),"comment:removeReply":_.bind(this.onRemoveReplyComment,this),"comment:editReply":_.bind(this.onShowEditReplyComment,this),"comment:closeEditing":_.bind(this.closeEditing,this),"comment:disableHint":_.bind(this.disableHint,this),"comment:addDummyComment":_.bind(this.onAddDummyComment,this)},"Common.Views.ReviewChanges":{"comment:removeComments":_.bind(this.onRemoveComments,this)}}),Common.NotificationCenter.on("comments:updatefilter",_.bind(this.onUpdateFilter,this)),Common.NotificationCenter.on("app:comment:add",_.bind(this.onAppAddComment,this)),Common.NotificationCenter.on("layout:changed",function(t){Common.Utils.asyncCall(function(t){"toolbar"!=t&&"status"!=t||!this.view.$el.is(":visible")||this.onAfterShow()},this,t)}.bind(this))},onLaunch:function(){this.collection=this.getApplication().getCollection("Common.Collections.Comments"),this.collection&&(this.collection.comparator=function(t){return-t.get("time")}),this.popoverComments=new Common.Collections.Comments,this.popoverComments&&(this.popoverComments.comparator=function(t){return t.get("time")}),this.groupCollection=[],this.view=this.createView("Common.Views.Comments",{store:this.collection}),this.view.render(),this.userCollection=this.getApplication().getCollection("Common.Collections.Users"),this.userCollection.on("reset",_.bind(this.onUpdateUsers,this)),this.userCollection.on("add",_.bind(this.onUpdateUsers,this)),this.bindViewEvents(this.view,this.events)},setConfig:function(t,e){this.setApi(e),t&&(this.currentUserId=t.config.user.id,this.currentUserName=t.config.user.fullname,this.sdkViewName=t.sdkviewname||this.sdkViewName,this.hintmode=t.hintmode||!1,this.viewmode=t.viewmode||!1)},setApi:function(t){t&&(this.api=t,this.api.asc_registerCallback("asc_onAddComment",_.bind(this.onApiAddComment,this)),this.api.asc_registerCallback("asc_onAddComments",_.bind(this.onApiAddComments,this)),this.api.asc_registerCallback("asc_onRemoveComment",_.bind(this.onApiRemoveComment,this)),this.api.asc_registerCallback("asc_onChangeComments",_.bind(this.onChangeComments,this)),this.api.asc_registerCallback("asc_onRemoveComments",_.bind(this.onApiRemoveComments,this)),this.api.asc_registerCallback("asc_onChangeCommentData",_.bind(this.onApiChangeCommentData,this)),this.api.asc_registerCallback("asc_onLockComment",_.bind(this.onApiLockComment,this)),this.api.asc_registerCallback("asc_onUnLockComment",_.bind(this.onApiUnLockComment,this)),this.api.asc_registerCallback("asc_onShowComment",_.bind(this.onApiShowComment,this)),this.api.asc_registerCallback("asc_onHideComment",_.bind(this.onApiHideComment,this)),this.api.asc_registerCallback("asc_onUpdateCommentPosition",_.bind(this.onApiUpdateCommentPosition,this)),this.api.asc_registerCallback("asc_onDocumentPlaceChanged",_.bind(this.onDocumentPlaceChanged,this)))},setMode:function(t){return this.mode=t,this.isModeChanged=!0,this.view.viewmode=!this.mode.canComments,this.view.changeLayout(t),this},onCreateComment:function(e,i,n,o,s){if(this.api&&i&&i.length>0){var a=t();a&&(this.showPopover=!0,this.editPopover=!!n,this.hidereply=o,this.isSelectedComment=!1,this.uids=[],a.asc_putText(i),a.asc_putTime(this.utcDateToString(new Date)),a.asc_putOnlyOfficeTime(this.ooDateToString(new Date)),a.asc_putUserId(this.currentUserId),a.asc_putUserName(this.currentUserName),a.asc_putSolved(!1),_.isUndefined(a.asc_putDocumentFlag)||a.asc_putDocumentFlag(s),this.api.asc_addComment(a),this.view.showEditContainer(!1))}this.view.txtComment.focus()},onRemoveComment:function(t){this.api&&t&&this.api.asc_removeComment(t)},onRemoveComments:function(t){this.api&&this.api.asc_RemoveAllComments("my"==t||!this.mode.canEditComments,"current"==t)},onResolveComment:function(e){var i=this,n=null,o=null,s=t(),a=i.findComment(e);return _.isUndefined(e)&&(e=a.get("uid")),!(!s||!a)&&(s.asc_putText(a.get("comment")),s.asc_putQuoteText(a.get("quote")),s.asc_putTime(i.utcDateToString(new Date(a.get("time")))),s.asc_putOnlyOfficeTime(i.ooDateToString(new Date(a.get("time")))),s.asc_putUserId(a.get("userid")),s.asc_putUserName(a.get("username")),s.asc_putSolved(!a.get("resolved")),s.asc_putGuid(a.get("guid")),s.asc_putUserData(a.get("userdata")),_.isUndefined(s.asc_putDocumentFlag)||s.asc_putDocumentFlag(a.get("unattached")),n=a.get("replys"),n&&n.length&&n.forEach(function(e){(o=t())&&(o.asc_putText(e.get("reply")),o.asc_putTime(i.utcDateToString(new Date(e.get("time")))),o.asc_putOnlyOfficeTime(i.ooDateToString(new Date(e.get("time")))),o.asc_putUserId(e.get("userid")),o.asc_putUserName(e.get("username")),o.asc_putUserData(e.get("userdata")),s.asc_addReply(o))}),i.api.asc_changeComment(e,s),!0)},onShowComment:function(t,e,i){var n=this.findComment(t);if(n)if(null!==n.get("quote")){if(this.api){if(this.hintmode){if(this.animate=!0,n.get("unattached")&&this.getPopover())return void this.getPopover().hideComments()}else{var o=this.popoverComments.findWhere({uid:t});if(o&&!this.getPopover().isVisible())return this.getPopover().showComments(!0),void this.api.asc_selectComment(t)}!_.isUndefined(e)&&this.hintmode&&(this.isSelectedComment=e),i&&0===_.difference(this.uids,[t]).length&&0===_.difference([t],this.uids).length||(this.api.asc_selectComment(t),this._dontScrollToComment=!0,this.api.asc_showComment(t,!1))}}else this.hintmode&&this.api.asc_selectComment(t),this.getPopover()&&this.getPopover().hideComments(),this.isSelectedComment=!1,this.uids=[]},onChangeComment:function(e,i){if(i&&i.length>0){var n=this,o=null,s=null,a=null,l=t(),r=n.findComment(e);if(r&&l)return l.asc_putText(i),l.asc_putQuoteText(r.get("quote")),l.asc_putTime(n.utcDateToString(new Date(r.get("time")))),l.asc_putOnlyOfficeTime(n.ooDateToString(new Date(r.get("time")))),l.asc_putUserId(n.currentUserId),l.asc_putUserName(n.currentUserName),l.asc_putSolved(r.get("resolved")),l.asc_putGuid(r.get("guid")),l.asc_putUserData(r.get("userdata")),_.isUndefined(l.asc_putDocumentFlag)||l.asc_putDocumentFlag(r.get("unattached")),r.set("editTextInPopover",!1),o=n.findPopupComment(e),o&&o.set("editTextInPopover",!1),n.subEditStrings[e]&&delete n.subEditStrings[e],n.subEditStrings[e+"-R"]&&delete n.subEditStrings[e+"-R"],s=r.get("replys"),s&&s.length&&s.forEach(function(e){(a=t())&&(a.asc_putText(e.get("reply")),a.asc_putTime(n.utcDateToString(new Date(e.get("time")))),a.asc_putOnlyOfficeTime(n.ooDateToString(new Date(e.get("time")))),a.asc_putUserId(e.get("userid")),a.asc_putUserName(e.get("username")),a.asc_putUserData(e.get("userdata")),l.asc_addReply(a))}),n.api.asc_changeComment(e,l),!0}return!1},onChangeReplyComment:function(e,i,n){if(n&&n.length>0){var o=this,s=null,a=null,l=t(),r=o.findComment(e);if(l&&r)return l.asc_putText(r.get("comment")),l.asc_putQuoteText(r.get("quote")),l.asc_putTime(o.utcDateToString(new Date(r.get("time")))),l.asc_putOnlyOfficeTime(o.ooDateToString(new Date(r.get("time")))),l.asc_putUserId(r.get("userid")),l.asc_putUserName(r.get("username")),l.asc_putSolved(r.get("resolved")),l.asc_putGuid(r.get("guid")),l.asc_putUserData(r.get("userdata")),_.isUndefined(l.asc_putDocumentFlag)||l.asc_putDocumentFlag(r.get("unattached")),s=r.get("replys"),s&&s.length&&s.forEach(function(e){(a=t())&&(e.get("id")!==i||_.isUndefined(n)?(a.asc_putText(e.get("reply")),a.asc_putUserId(e.get("userid")),a.asc_putUserName(e.get("username"))):(a.asc_putText(n),a.asc_putUserId(o.currentUserId),a.asc_putUserName(o.currentUserName)),a.asc_putTime(o.utcDateToString(new Date(e.get("time")))),a.asc_putOnlyOfficeTime(o.ooDateToString(new Date(e.get("time")))),a.asc_putUserData(e.get("userdata")),l.asc_addReply(a))}),o.api.asc_changeComment(e,l),!0}return!1},onAddReplyComment:function(e,i){if(i.length>0){var n=this,o=null,s=null,a=null,l=t(),r=n.findComment(e);if(l&&r&&(o=r.get("uid"),o&&(n.subEditStrings[o]&&delete n.subEditStrings[o],n.subEditStrings[o+"-R"]&&delete n.subEditStrings[o+"-R"],r.set("showReplyInPopover",!1)),l.asc_putText(r.get("comment")),l.asc_putQuoteText(r.get("quote")),l.asc_putTime(n.utcDateToString(new Date(r.get("time")))),l.asc_putOnlyOfficeTime(n.ooDateToString(new Date(r.get("time")))),l.asc_putUserId(r.get("userid")),l.asc_putUserName(r.get("username")),l.asc_putSolved(r.get("resolved")),l.asc_putGuid(r.get("guid")),l.asc_putUserData(r.get("userdata")),_.isUndefined(l.asc_putDocumentFlag)||l.asc_putDocumentFlag(r.get("unattached")),s=r.get("replys"),s&&s.length&&s.forEach(function(e){(a=t())&&(a.asc_putText(e.get("reply")),a.asc_putTime(n.utcDateToString(new Date(e.get("time")))),a.asc_putOnlyOfficeTime(n.ooDateToString(new Date(e.get("time")))),a.asc_putUserId(e.get("userid")),a.asc_putUserName(e.get("username")),a.asc_putUserData(e.get("userdata")),l.asc_addReply(a))}),a=t()))return a.asc_putText(i),a.asc_putTime(n.utcDateToString(new Date)),a.asc_putOnlyOfficeTime(n.ooDateToString(new Date)),a.asc_putUserId(n.currentUserId),a.asc_putUserName(n.currentUserName),l.asc_addReply(a),n.api.asc_changeComment(e,l),n.mode&&n.mode.canRequestSendNotify&&n.view.pickEMail(l.asc_getGuid(),i),!0}return!1},onRemoveReplyComment:function(e,i){if(!_.isUndefined(e)&&!_.isUndefined(i)){var n=this,o=null,s=null,a=t(),l=n.findComment(e);if(a&&l)return a.asc_putText(l.get("comment")),a.asc_putQuoteText(l.get("quote")),a.asc_putTime(n.utcDateToString(new Date(l.get("time")))),a.asc_putOnlyOfficeTime(n.ooDateToString(new Date(l.get("time")))),a.asc_putUserId(l.get("userid")),a.asc_putUserName(l.get("username")),a.asc_putSolved(l.get("resolved")),a.asc_putGuid(l.get("guid")),a.asc_putUserData(l.get("userdata")),_.isUndefined(a.asc_putDocumentFlag)||a.asc_putDocumentFlag(l.get("unattached")),o=l.get("replys"),o&&o.length&&o.forEach(function(e){e.get("id")!==i&&(s=t())&&(s.asc_putText(e.get("reply")),s.asc_putTime(n.utcDateToString(new Date(e.get("time")))),s.asc_putOnlyOfficeTime(n.ooDateToString(new Date(e.get("time")))),s.asc_putUserId(e.get("userid")),s.asc_putUserName(e.get("username")),s.asc_putUserData(e.get("userdata")),a.asc_addReply(s))}),n.api.asc_changeComment(e,a),!0}return!1},onShowEditReplyComment:function(t,e,i){var n,o,s,a;if(!_.isUndefined(t)&&!_.isUndefined(e))if(i){if((o=this.popoverComments.findWhere({uid:t}))&&(s=o.get("replys"),a=_.clone(o.get("replys"))))for(n=0;n=0;--s)o?this.collection.at(s).set("last",!0,{silent:!0}):this.collection.at(s).get("last")&&this.collection.at(s).set("last",!1,{silent:!0}),o=!1;this.view.render(),this.view.update()}}},onAppAddComment:function(t,e){this.api.can_AddQuotedComment&&!1===this.api.can_AddQuotedComment()||e||this.addDummyComment()},addCommentToGroupCollection:function(t){var e=t.get("groupName");this.groupCollection[e]||(this.groupCollection[e]=new Backbone.Collection([],{model:Common.Models.Comment})),this.groupCollection[e].push(t)},onApiAddComment:function(t,e){var i=this.readSDKComment(t,e);i&&(i.get("groupName")?(this.addCommentToGroupCollection(i),_.indexOf(this.collection.groups,i.get("groupName"))>-1&&this.collection.push(i)):this.collection.push(i),this.updateComments(!0),this.showPopover&&(null!==e.asc_getQuoteText()&&(this.api.asc_selectComment(t),this._dontScrollToComment=!0,this.api.asc_showComment(t,!0)),this.showPopover=void 0,this.editPopover=!1))},onApiAddComments:function(t){for(var e=0;e100&&(clearInterval(n.timerUpdateComments),n.timerUpdateComments=void 0,n.updateCommentsView(t,e,i))},25))},updateCommentsView:function(t,e,i){if(t&&!this.view.isVisible())return this.view.needRender=t,void this.onUpdateFilter(this.filter,!0);var n,o=!0;if(_.isUndefined(e)&&this.collection.sort(),t){for(this.onUpdateFilter(this.filter,!0),n=this.collection.length-1;n>=0;--n)o?this.collection.at(n).set("last",!0,{silent:!0}):this.collection.at(n).get("last")&&this.collection.at(n).set("last",!1,{silent:!0}),o=!1;this.view.render(),this.view.needRender=!1}this.view.update(),i&&this.view.loadText()},findComment:function(t){return this.collection.findWhere({uid:t})},findPopupComment:function(t){return this.popoverComments.findWhere({id:t})},findCommentInGroup:function(t){for(var e in this.groupCollection){var i=this.groupCollection[e],n=i.findWhere({uid:t});if(n)return n}},closeEditing:function(t){if(!_.isUndefined(t)){var e=this.findPopupComment(t);e&&(e.set("editTextInPopover",!1),e.set("showReplyInPopover",!1)),this.subEditStrings[t]&&delete this.subEditStrings[t],this.subEditStrings[t+"-R"]&&delete this.subEditStrings[t+"-R"]}this.collection.clearEditing(),this.collection.each(function(t){var e=_.clone(t.get("replys"));t.get("replys").length=0,e.forEach(function(t){t.get("editText")&&t.set("editText",!1),t.get("editTextInPopover")&&t.set("editTextInPopover",!1)}),t.set("replys",e)}),this.view.showEditContainer(!1),this.view.update()},disableHint:function(t){t&&this.mode.canComments&&(t.set("hint",!1),this.api.asc_showComment(t.get("uid"),!1),this.isSelectedComment=!0)},blockPopover:function(t){this.isSelectedComment=t,t&&this.getPopover().isVisible()&&this.getPopover().hide()},getPopover:function(){return _.isUndefined(this.popover)&&(this.popover=Common.Views.ReviewPopover.prototype.getPopover({commentsStore:this.popoverComments,renderTo:this.sdkViewName,canRequestUsers:this.mode?this.mode.canRequestUsers:void 0,canRequestSendNotify:this.mode?this.mode.canRequestSendNotify:void 0,mentionShare:!this.mode||this.mode.mentionShare}),this.popover.setCommentsStore(this.popoverComments)),this.popover},onUpdateUsers:function(){var t=this.userCollection,e=!1;for(var i in this.groupCollection)e=!0,this.groupCollection[i].each(function(e){var i=t.findOriginalUser(e.get("userid")),n=i?i.get("color"):null,o=!1;n!==e.get("usercolor")&&(o=!0,e.set("usercolor",n,{silent:!0})),e.get("replys").forEach(function(e){i=t.findOriginalUser(e.get("userid")),(n=i?i.get("color"):null)!==e.get("usercolor")&&(o=!0,e.set("usercolor",n,{silent:!0}))}),o&&e.trigger("change")});!e&&this.collection.each(function(e){var i=t.findOriginalUser(e.get("userid")),n=i?i.get("color"):null,o=!1;n!==e.get("usercolor")&&(o=!0,e.set("usercolor",n,{silent:!0})),e.get("replys").forEach(function(e){i=t.findOriginalUser(e.get("userid")),(n=i?i.get("color"):null)!==e.get("usercolor")&&(o=!0,e.set("usercolor",n,{silent:!0}))}),o&&e.trigger("change")})},readSDKComment:function(t,e){var i=e.asc_getOnlyOfficeTime()?new Date(this.stringOOToLocalDate(e.asc_getOnlyOfficeTime())):""==e.asc_getTime()?new Date:new Date(this.stringUtcToLocalDate(e.asc_getTime())),n=this.userCollection.findOriginalUser(e.asc_getUserId()),o=t.substr(0,t.lastIndexOf("_")+1).match(/^(doc|sheet[0-9_]+)_/),s=new Common.Models.Comment({uid:t,guid:e.asc_getGuid(),userid:e.asc_getUserId(),username:e.asc_getUserName(),usercolor:n?n.get("color"):null,date:this.dateToLocaleTimeString(i),quote:e.asc_getQuoteText(),comment:e.asc_getText(),resolved:e.asc_getSolved(),unattached:!_.isUndefined(e.asc_getDocumentFlag)&&e.asc_getDocumentFlag(),userdata:e.asc_getUserData(),id:Common.UI.getId(),time:i.getTime(),showReply:!1,editText:!1,last:void 0,editTextInPopover:!!this.editPopover,showReplyInPopover:!1,hideAddReply:_.isUndefined(this.hidereply)?!!this.showPopover:this.hidereply,scope:this.view,editable:this.mode.canEditComments||e.asc_getUserId()==this.currentUserId,hint:!this.mode.canComments,groupName:o&&o.length>1?o[1]:null});if(s){var a=this.readSDKReplies(e);a.length&&s.set("replys",a)}return s},readSDKReplies:function(t){var e=0,i=[],n=null,o=t.asc_getRepliesCount();if(o)for(e=0;e0){var i=t();i&&(this.showPopover=!0,this.editPopover=!1,this.hidereply=!1,this.isSelectedComment=!1,this.uids=[],this.popoverComments.reset(),this.getPopover().isVisible()&&this.getPopover().hideComments(),this.isDummyComment=!1,i.asc_putText(e),i.asc_putTime(this.utcDateToString(new Date)),i.asc_putOnlyOfficeTime(this.ooDateToString(new Date)),i.asc_putUserId(this.currentUserId),i.asc_putUserName(this.currentUserName),i.asc_putSolved(!1),_.isUndefined(i.asc_putDocumentFlag)||i.asc_putDocumentFlag(!1),this.api.asc_addComment(i),this.view.showEditContainer(!1),this.mode&&this.mode.canRequestSendNotify&&this.view.pickEMail(i.asc_getGuid(),e),_.isUndefined(this.api.asc_SetDocumentPlaceChangedEnabled)||this.api.asc_SetDocumentPlaceChangedEnabled(!1))}},clearDummyComment:function(t){if(this.isDummyComment){this.isDummyComment=!1,this.showPopover=!0,this.editPopover=!1,this.hidereply=!1,this.isSelectedComment=!1,this.uids=[];var e=this.getPopover();e&&(t&&e.clearDummyText(),e.saveDummyText(),e.handlerHide=function(){},e.isVisible()&&e.hideComments()),this.popoverComments.reset(),_.isUndefined(this.api.asc_SetDocumentPlaceChangedEnabled)||this.api.asc_SetDocumentPlaceChangedEnabled(!1),Common.NotificationCenter.trigger("comments:cleardummy")}},onEditComments:function(t){if(this.api){var e=0,i=this,n=null,o=this.api.asc_getAnchorPosition();if(o){for(this.isSelectedComment=!0,this.popoverComments.reset(),e=0;e0&&(this.getPopover().isVisible()&&this.getPopover().hide(),this.getPopover().setLeftTop(o.asc_getX()+o.asc_getWidth(),o.asc_getY(),this.hintmode?o.asc_getX():void 0),this.getPopover().showComments(!0,!1,!0))}}},onAfterShow:function(){if(this.view&&this.api){var t=$(".new-comment-ct",this.view.el);t&&t.length&&"none"!==t.css("display")&&this.view.txtComment.focus(),this.view.needRender?this.updateComments(!0):this.view.needUpdateFilter&&this.onUpdateFilter(this.view.needUpdateFilter),this.view.update()}},onBeforeHide:function(){this.view&&this.view.showEditContainer(!1)},timeZoneOffsetInMs:6e4*(new Date).getTimezoneOffset(),stringOOToLocalDate:function(t){return"string"==typeof t?parseInt(t):0},ooDateToString:function(t){return"[object Date]"===Object.prototype.toString.call(t)?t.getTime().toString():""},stringUtcToLocalDate:function(t){return"string"==typeof t?parseInt(t)+this.timeZoneOffsetInMs:0},utcDateToString:function(t){return"[object Date]"===Object.prototype.toString.call(t)?(t.getTime()-this.timeZoneOffsetInMs).toString():""},dateToLocaleTimeString:function(t){return t.getMonth()+1+"/"+t.getDate()+"/"+t.getFullYear()+" "+function(t){var e=t.getHours(),i=t.getMinutes(),n=e>=12?"pm":"am";return e%=12,e=e||12,i=i<10?"0"+i:i,e+":"+i+" "+n}(t)},getView:function(t){return!t&&this.view?this.view:Backbone.Controller.prototype.getView.call(this,t)},setPreviewMode:function(t){this.viewmode!==t&&(this.viewmode=t,t&&(this.prevcanComments=this.mode.canComments),this.mode.canComments=!t&&this.prevcanComments,this.closeEditing(),this.setMode(this.mode),this.updateComments(!0),this.getPopover()&&(t?this.getPopover().hide():this.getPopover().update(!0)))},clearCollections:function(){this.collection.reset(),this.groupCollection=[]}},Common.Controllers.Comments||{}))}),void 0===Common)var Common={};if(Common.Models=Common.Models||{},define("common/main/lib/model/User",["underscore","backbone","common/main/lib/component/BaseView"],function(t,e){"use strict";Common.Models.User=e.Model.extend({defaults:function(){return{iid:Common.UI.getId(),id:void 0,idOriginal:void 0,username:"Guest",color:"#fff",colorval:null,online:!1,view:!1}}})}),define("common/main/lib/collection/Users",["backbone","common/main/lib/model/User"],function(t){"use strict";Common.Collections=Common.Collections||{},Common.Collections.Users=t.Collection.extend({model:Common.Models.User,getOnlineCount:function(){var t=0;return this.each(function(e){e.get("online")&&++t}),t},getEditingCount:function(){return this.filter(function(t){return t.get("online")&&!t.get("view")}).length},getEditingOriginalCount:function(){return this.chain().filter(function(t){return t.get("online")&&!t.get("view")}).groupBy(function(t){return t.get("idOriginal")}).size().value()},findUser:function(t){return this.find(function(e){return e.get("id")==t})},findOriginalUser:function(t){return this.find(function(e){return e.get("idOriginal")==t})}}),Common.Collections.HistoryUsers=t.Collection.extend({model:Common.Models.User,findUser:function(t){return this.find(function(e){return e.get("id")==t})}})}),define("common/main/lib/model/ChatMessage",["backbone"],function(t){"use strict";Common.Models=Common.Models||{},Common.Models.ChatMessage=t.Model.extend({defaults:{type:0,userid:null,username:"",message:""}})}),define("common/main/lib/collection/ChatMessages",["backbone","common/main/lib/model/ChatMessage"],function(t){"use strict";!Common.Collections&&(Common.Collections={}),Common.Collections.ChatMessages=t.Collection.extend({model:Common.Models.ChatMessage})}),define("common/main/lib/controller/Chat",["core","common/main/lib/collection/Users","common/main/lib/collection/ChatMessages","common/main/lib/view/Chat"],function(){"use strict";Common.Controllers.Chat=Backbone.Controller.extend(_.extend({models:[],collections:["Common.Collections.Users","Common.Collections.ChatMessages"],views:["Common.Views.Chat"],initialize:function(){this.addListeners({"Common.Views.Chat":{"message:add":_.bind(this.onSendMessage,this)}});var t=this;Common.NotificationCenter.on("layout:changed",function(e){Common.Utils.asyncCall(function(e){"toolbar"!=e&&"status"!=e||!t.panelChat.$el.is(":visible")||(t.panelChat.updateLayout(!0),t.panelChat.setupAutoSizingTextBox())},this,e)})},events:{},onLaunch:function(){this.panelChat=this.createView("Common.Views.Chat",{storeUsers:this.getApplication().getCollection("Common.Collections.Users"),storeMessages:this.getApplication().getCollection("Common.Collections.ChatMessages")})},setMode:function(t){return this.mode=t,this.api&&(this.mode.canCoAuthoring&&this.mode.canChat&&this.api.asc_registerCallback("asc_onCoAuthoringChatReceiveMessage",_.bind(this.onReceiveMessage,this)),this.mode.isEditDiagram||this.mode.isEditMailMerge||(this.api.asc_registerCallback("asc_onAuthParticipantsChanged",_.bind(this.onUsersChanged,this)),this.api.asc_registerCallback("asc_onConnectionStateChanged",_.bind(this.onUserConnection,this)),this.api.asc_coAuthoringGetUsers()),this.mode.canCoAuthoring&&this.mode.canChat&&this.api.asc_coAuthoringChatGetMessages()),this},setApi:function(t){return this.api=t,this},onUsersChanged:function(t,e){if(!this.mode.canLicense||!this.mode.canCoAuthoring){var i=0;for(o in t)void 0!==o&&i++;if(i>1&&void 0==this._isCoAuthoringStopped)return this._isCoAuthoringStopped=!0,this.api.asc_coAuthoringDisconnect(),void Common.NotificationCenter.trigger("api:disconnect")}var n=this.getApplication().getCollection("Common.Collections.Users");if(n){var o,s,a=[];for(o in t)if(void 0!==o&&(s=t[o])){var l=new Common.Models.User({id:s.asc_getId(),idOriginal:s.asc_getIdOriginal(),username:s.asc_getUserName(),online:!0,color:s.asc_getColor(),view:s.asc_getView()});a[s.asc_getId()==e?"unshift":"push"](l)}n[n.size()>0?"add":"reset"](a)}},onUserConnection:function(t){var e=this.getApplication().getCollection("Common.Collections.Users");if(e){var i=e.findUser(t.asc_getId());i?i.set({online:t.asc_getState()}):e.add(new Common.Models.User({id:t.asc_getId(),idOriginal:t.asc_getIdOriginal(),username:t.asc_getUserName(),online:t.asc_getState(),color:t.asc_getColor(),view:t.asc_getView()}))}},onReceiveMessage:function(t,e){var i=this.getApplication().getCollection("Common.Collections.ChatMessages");if(i){var n=[];t.forEach(function(t){n.push(new Common.Models.ChatMessage({userid:t.useridoriginal,message:t.message,username:t.username}))}),i[i.size()<1||e?"reset":"add"](n)}},onSendMessage:function(t,e){if(e.length>0){var i=this;(function(t,e){for(var i=[];t;){if(t.length .group",e.$toolbarPanelPlugins),o=$('').appendTo(n);i.render(o)}},onResetPlugins:function(t){var e=this;if(e.appOptions.canPlugins=!t.isEmpty(),e.$toolbarPanelPlugins){e.$toolbarPanelPlugins.empty();var i=$('
    '),n=-1,o=0;t.each(function(t){var s=t.get("groupRank");s!==n&&n>-1&&o>0&&(i.appendTo(e.$toolbarPanelPlugins),$('
    ').appendTo(e.$toolbarPanelPlugins),i=$('
    '),o=0);var a=e.panelPlugins.createPluginButton(t);if(a){var l=$('').appendTo(i);a.render(l),o++}n=s}),i.appendTo(e.$toolbarPanelPlugins)}else console.error("toolbar panel isnot created")},onSelectPlugin:function(t,e,i,n){var o=$(n.target);if(o&&o.hasClass("plugin-caret")){var s=this.panelPlugins.pluginMenu;if(s.isVisible())return void s.hide();var a,l=this,r=$(n.currentTarget),c=$(this.panelPlugins.el),d=r.offset(),h=c.offset();if(a=[d.left-h.left+r.width(),d.top-h.top+r.height()/2],void 0!=i){for(var p=0;p0?m.get("description"):l.panelPlugins.textStart,value:parseInt(m.get("index"))}).on("click",function(t,e){l.api&&l.api.asc_pluginRun(i.get("guid"),t.value,"")});s.addItem(g)}}var f=c.find("#menu-plugin-container");s.rendered||(f.length<1&&(f=$('',s.id),c.append(f)),s.render(f),s.cmpEl.attr({tabindex:"-1"}),s.on({"show:after":function(t){t&&t.menuAlignEl&&t.menuAlignEl.toggleClass("over",!0)},"hide:after":function(t){t&&t.menuAlignEl&&t.menuAlignEl.toggleClass("over",!1)}})),f.css({left:a[0],top:a[1]}),s.menuAlignEl=r,s.setOffset(-20,-r.height()/2-3),s.show(),_.delay(function(){s.cmpEl.focus()},10),n.stopPropagation(),n.preventDefault()}else this.api.asc_pluginRun(i.get("guid"),0,"")},onPluginShow:function(t,e,i,n){var o=t.get_Variations()[e];if(o.get_Visual()){var s=o.get_Url();if(s=(0==t.get_BaseUrl().length?s:t.get_BaseUrl())+s,n&&(s+=n),o.get_InsideMode())this.panelPlugins.openInsideMode(t.get_Name(),s,i)||this.api.asc_pluginButtonClick(-1);else{var a=this,l=o.get_CustomWindow(),r=o.get_Buttons(),c=[],d=o.get_Size();(!d||d.length<2)&&(d=[800,600]),_.isArray(r)&&_.each(r,function(t,e){t.visible&&(c[e]={caption:t.text,value:e,primary:t.primary})});var h=o.get_Help();a.pluginDlg=new Common.Views.PluginDlg({cls:l?"plain":"",header:!l,title:t.get_Name(),width:d[0],height:d[1],url:s,frameId:i,buttons:l?void 0:c,toolcallback:_.bind(this.onToolClose,this),help:!!h}),a.pluginDlg.on({"render:after":function(t){t.getChild(".footer .dlg-btn").on("click",_.bind(a.onDlgBtnClick,a)),a.pluginContainer=a.pluginDlg.$window.find("#id-plugin-container")},close:function(t){a.pluginDlg=void 0},drag:function(t){a.api.asc_pluginEnableMouseEvents("start"==t[1])},resize:function(t){a.api.asc_pluginEnableMouseEvents("start"==t[1])},help:function(){h&&window.open(h,"_blank")}}),a.pluginDlg.show()}}this.panelPlugins.openedPluginMode(t.get_Guid())},onPluginClose:function(t){this.pluginDlg?this.pluginDlg.close():this.panelPlugins.iframePlugin&&this.panelPlugins.closeInsideMode(),this.panelPlugins.closedPluginMode(t.get_Guid()),this.runAutoStartPlugins()},onPluginResize:function(t,e,i,n){if(this.pluginDlg){var o=e&&e.length>1&&i&&i.length>1&&(i[0]>e[0]||i[1]>e[1]||0==i[0]||0==i[1]);this.pluginDlg.setResizable(o,e,i),this.pluginDlg.setInnerSize(t[0],t[1]),n&&n.call()}},onDlgBtnClick:function(t){var e=t.currentTarget.attributes.result.value;this.api.asc_pluginButtonClick(parseInt(e))},onToolClose:function(){this.api.asc_pluginButtonClick(-1)},onPluginMouseUp:function(t,e){this.pluginDlg?(this.pluginDlg.binding.dragStop&&this.pluginDlg.binding.dragStop(), +this.pluginDlg.binding.resizeStop&&this.pluginDlg.binding.resizeStop()):Common.NotificationCenter.trigger("frame:mouseup",{pageX:t*Common.Utils.zoom()+this._moveOffset.x,pageY:e*Common.Utils.zoom()+this._moveOffset.y})},onPluginMouseMove:function(t,e){if(this.pluginDlg){var i=this.pluginContainer.offset();this.pluginDlg.binding.drag&&this.pluginDlg.binding.drag({pageX:t*Common.Utils.zoom()+i.left,pageY:e*Common.Utils.zoom()+i.top}),this.pluginDlg.binding.resize&&this.pluginDlg.binding.resize({pageX:t*Common.Utils.zoom()+i.left,pageY:e*Common.Utils.zoom()+i.top})}else Common.NotificationCenter.trigger("frame:mousemove",{pageX:t*Common.Utils.zoom()+this._moveOffset.x,pageY:e*Common.Utils.zoom()+this._moveOffset.y})},onPluginsInit:function(t){!(t instanceof Array)&&(t=t.pluginsData),this.parsePlugins(t)},runAutoStartPlugins:function(){this.autostart&&this.autostart.length>0&&this.api.asc_pluginRun(this.autostart.shift(),0,"")},resetPluginsList:function(){this.getApplication().getCollection("Common.Collections.Plugins").reset()},applyUICustomization:function(){var me=this;return new Promise(function(resolve,reject){var timer_sl=setInterval(function(){if(me.customPluginsComplete){clearInterval(timer_sl);try{me.configPlugins.UIplugins&&me.configPlugins.UIplugins.forEach(function(c){c.code&&eval(c.code)})}catch(t){}resolve()}},10)})},parsePlugins:function(t,e){var i=this,n=this.getApplication().getCollection("Common.Collections.Plugins"),o=i.appOptions.isEdit,s=i.editor;if(t instanceof Array){var a=[],l=[],r=i.appOptions.lang.split(/[\-_]/)[0];t.forEach(function(t){if(!(a.some(function(e){return e.get("baseUrl")==t.baseUrl||e.get("guid")==t.guid})||n.findWhere({baseUrl:t.baseUrl})||n.findWhere({guid:t.guid}))){var e=[],i=!1;if(t.variations.forEach(function(n){var a=(o||n.isViewer&&!1!==n.isDisplayedInViewer)&&_.contains(n.EditorsSupport,s)&&!n.isSystem;if(a&&(i=!0),t.isUICustomizer)a&&l.push({url:t.baseUrl+n.url});else{var c=new Common.Models.PluginVariation(n),d=n.description;"object"==typeof n.descriptionLocale&&(d=n.descriptionLocale[r]||n.descriptionLocale.en||d||""),_.each(n.buttons,function(t,e){"object"==typeof t.textLocale&&(t.text=t.textLocale[r]||t.textLocale.en||t.text||""),t.visible=o||!1!==t.isViewer}),c.set({description:d,index:e.length,url:n.url,icons:n.icons,buttons:n.buttons,visible:a,help:n.help}),e.push(c)}}),e.length>0&&!t.isUICustomizer){var c=t.name;"object"==typeof t.nameLocale&&(c=t.nameLocale[r]||t.nameLocale.en||c||""),a.push(new Common.Models.Plugin({name:c,guid:t.guid,baseUrl:t.baseUrl,variations:e,currentVariation:0,visible:i,groupName:t.group?t.group.name:"",groupRank:t.group?t.group.rank:0}))}}}),!1!==e&&(i.configPlugins.UIplugins=l),!e&&n&&(a=n.models.concat(a),a.sort(function(t,e){var i=t.get("groupRank"),n=e.get("groupRank");return in?0==n?-1:1:0}),n.reset(a),this.appOptions.canPlugins=!n.isEmpty())}else e||(this.appOptions.canPlugins=!1);e||this.getApplication().getController("LeftMenu").enablePlugins(),this.appOptions.canPlugins&&(this.refreshPluginsList(),this.runAutoStartPlugins())},getPlugins:function(t,e){if(!t||t.length<1)return Promise.resolve([]);e=e||function(t){return fetch(t).then(function(e){return e.ok?e.json():Promise.reject(t)}).then(function(e){return e.baseUrl=t.substring(0,t.lastIndexOf("config.json")),e})};var i=[];return t.map(e).reduce(function(t,e){return t.then(function(){return e}).then(function(t){return i.push(t),Promise.resolve(t)}).catch(function(t){return Promise.resolve(t)})},Promise.resolve()).then(function(){return Promise.resolve(i)})},mergePlugins:function(){if(void 0!==this.serverPlugins.plugins&&void 0!==this.configPlugins.plugins){var t=[],e=[],i=this.configPlugins,n=!1;i.plugins&&i.plugins.length>0&&(e=i.plugins);var o=i.config.autostart||i.config.autoStartGuid;"string"==typeof o&&(o=[o]),n=!!i.config.autoStartGuid,t=o||[],i=this.serverPlugins,i.plugins&&i.plugins.length>0&&(e=e.concat(i.plugins)),o=i.config.autostart||i.config.autoStartGuid,"string"==typeof o&&(o=[o]),(n||i.config.autoStartGuid)&&console.warn("Obsolete: The autoStartGuid parameter is deprecated. Please check the documentation for new plugin connection configuration."),t=t.concat(o||[]),this.autostart=t,this.parsePlugins(e,!1)}},getAppCustomPlugins:function(t){var e=this,i=function(){e.customPluginsComplete=!0};t.config?this.getPlugins(t.config.UIpluginsData).then(function(n){e.parsePlugins(n,!0),e.getPlugins(t.UIplugins,function(t){return fetch(t.url).then(function(t){return t.ok?t.text():Promise.reject()}).then(function(e){return t.code=e,e})}).then(i,i)},i):i()}},Common.Controllers.Plugins||{}))}),define("common/main/lib/view/ExternalDiagramEditor",["common/main/lib/component/Window"],function(){"use strict";Common.Views.ExternalDiagramEditor=Common.UI.Window.extend(_.extend({initialize:function(t){var e={},i=Common.Utils.innerHeight()-Common.Utils.InternalSettings.get("window-inactive-area-top");_.extend(e,{title:this.textTitle,width:910,height:i-700<0?i:700,cls:"advanced-settings-dlg",header:!0,toolclose:"hide",toolcallback:_.bind(this.onToolClose,this)},t),this.template=['
    ','
    ',"
    ",'
    ','"].join(""),e.tpl=_.template(this.template)(e),this.handler=e.handler,this._chartData=null,this._isNewChart=!0,Common.UI.Window.prototype.initialize.call(this,e)},render:function(){Common.UI.Window.prototype.render.call(this),this.btnSave=new Common.UI.Button({el:$("#id-btn-diagram-editor-apply"),disabled:!0}),this.btnCancel=new Common.UI.Button({el:$("#id-btn-diagram-editor-cancel")}),this.$window.find(".dlg-btn").on("click",_.bind(this.onDlgBtnClick,this))},show:function(){this.setPlaceholder(),Common.UI.Window.prototype.show.apply(this,arguments)},setChartData:function(t){this._chartData=t,this._isExternalDocReady&&this.fireEvent("setchartdata",this)},setEditMode:function(t){this._isNewChart=!t},isEditMode:function(){return!this._isNewChart},setControlsDisabled:function(t){this.btnSave.setDisabled(t),this.btnCancel.setDisabled(t),t?this.$window.find(".tool.close").addClass("disabled"):this.$window.find(".tool.close").removeClass("disabled")},onDlgBtnClick:function(t){if(this.handler)return void this.handler.call(this,t.currentTarget.attributes.result.value);this.hide()},onToolClose:function(){if(this.handler)return void this.handler.call(this,"cancel");this.hide()},setHeight:function(t){if(t>=0){var e=parseInt(this.$window.css("min-height"));t .header").css("height")):0;this.$window.find("> .body").css("height",t-i),this.$window.find("> .body > .box").css("height",t-85);var n=(Common.Utils.innerHeight()-Common.Utils.InternalSettings.get("window-inactive-area-top")-parseInt(t))/2,o=(Common.Utils.innerWidth()-parseInt(this.initConfig.width))/2;this.$window.css("left",o),this.$window.css("top",Common.Utils.InternalSettings.get("window-inactive-area-top")+n)}},setPlaceholder:function(t){this._placeholder=t},getPlaceholder:function(){return this._placeholder},textSave:"Save & Exit",textClose:"Close",textTitle:"Chart Editor"},Common.Views.ExternalDiagramEditor||{}))}),void 0===Common)var Common={};if(Common.Controllers=Common.Controllers||{},define("common/main/lib/controller/ExternalDiagramEditor",["core","common/main/lib/view/ExternalDiagramEditor"],function(){"use strict";Common.Controllers.ExternalDiagramEditor=Backbone.Controller.extend(_.extend(function(){var t="en",e=void 0,i="",n=null,o=!0,s=function(){n=new DocsAPI.DocEditor("id-diagram-editor-placeholder",{width:"100%",height:"100%",documentType:"cell",document:{url:"_chart_",permissions:{edit:!0,download:!1}},editorConfig:{mode:"editdiagram",targetApp:i,lang:t,canCoAuthoring:!1,canBackToFolder:!1,canCreateNew:!1,customization:e,user:{id:"uid-"+Date.now()}},events:{onAppReady:function(){},onDocumentStateChange:function(){},onError:function(){},onInternalMessage:_.bind(this.onInternalMessage,this)}}),Common.Gateway.on("processmouse",_.bind(this.onProcessMouse,this))};return{views:["Common.Views.ExternalDiagramEditor"],initialize:function(){this.addListeners({"Common.Views.ExternalDiagramEditor":{setchartdata:_.bind(this.setChartData,this),drag:_.bind(function(t,e){n&&n.serviceCommand("window:drag","start"==e)},this),show:_.bind(function(t){var e=this.diagramEditorView.getHeight(),i=Common.Utils.innerHeight()-Common.Utils.InternalSettings.get("window-inactive-area-top");(i>e&&e<700||i
    <%= caption %>
    <% if (options.description !== null) { %><% } %>');this.btnReviewView=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-ic-reviewview",caption:this.txtView,menu:new Common.UI.Menu({cls:"ppm-toolbar",items:[{caption:this.txtMarkupCap,checkable:!0,toggleGroup:"menuReviewView",checked:!0,value:"markup",template:e,description:this.txtMarkup},{caption:this.txtFinalCap,checkable:!0,toggleGroup:"menuReviewView",checked:!1,template:e,description:this.txtFinal,value:"final"},{caption:this.txtOriginalCap,checkable:!0,toggleGroup:"menuReviewView",checked:!1,template:e,description:this.txtOriginal,value:"original"}]})})}(this.appConfig.sharingSettingsUrl&&this.appConfig.sharingSettingsUrl.length||this.appConfig.canRequestSharingSettings)&&!0!==this._readonlyRights&&(this.btnSharing=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-ic-sharing",caption:this.txtSharing})),this.appConfig.isEdit&&!this.appConfig.isOffline&&this.appConfig.canCoAuthoring&&(this.btnCoAuthMode=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-ic-coedit",caption:this.txtCoAuthMode,menu:!0})),this.btnsSpelling=[],this.btnsDocLang=[],this.appConfig.canUseHistory&&!this.appConfig.isDisconnected&&(this.btnHistory=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-ic-history",caption:this.txtHistory})),this.appConfig.canCoAuthoring&&this.appConfig.canChat&&(this.btnChat=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-ic-chat",caption:this.txtChat,enableToggle:!0})),this.appConfig.canCoAuthoring&&this.appConfig.canComments&&(this.btnCommentRemove=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",caption:this.txtCommentRemove,split:!0,iconCls:"toolbar__icon btn-rem-comment"}));var i=Common.localStorage.getKeysFilter();this.appPrefix=i&&i.length?i.split(",")[0]:"",Common.NotificationCenter.on("app:ready",this.onAppReady.bind(this))},render:function(t){return this.boxSdk=$("#editor_sdk"),t&&t.html(this.getPanel()),this},onAppReady:function(t){var i=this;new Promise(function(t,e){t()}).then(function(){var n=_.template('
    <%= caption %>
    <% if (options.description !== null) { %><% } %>
    ');if(t.canReview&&(i.btnTurnOn.updateHint(i.tipReview),i.appConfig.canUseReviewPermissions||(i.btnAccept.setMenu(new Common.UI.Menu({items:[{caption:i.txtAcceptCurrent,value:"current"},{caption:i.txtAcceptAll,value:"all"}]})),i.btnReject.setMenu(new Common.UI.Menu({items:[{caption:i.txtRejectCurrent,value:"current"},{caption:i.txtRejectAll,value:"all"}]}))),i.btnAccept.updateHint([i.tipAcceptCurrent,i.txtAcceptChanges]),i.btnReject.updateHint([i.tipRejectCurrent,i.txtRejectChanges]),t.canFeatureComparison&&(i.btnCompare.setMenu(new Common.UI.Menu({items:[{caption:i.mniFromFile,value:"file"},{caption:i.mniFromUrl,value:"url"},{caption:i.mniFromStorage,value:"storage"}]})),i.btnCompare.menu.items[2].setVisible(i.appConfig.canRequestCompareFile||i.appConfig.fileChoiceUrl&&i.appConfig.fileChoiceUrl.indexOf("{documentType}")>-1),i.btnCompare.updateHint(i.tipCompare)),i.btnAccept.setDisabled(t.isReviewOnly),i.btnReject.setDisabled(t.isReviewOnly)),i.appConfig.canViewReview&&(i.btnPrev.updateHint(i.hintPrev),i.btnNext.updateHint(i.hintNext),i.btnReviewView&&i.btnReviewView.updateHint(i.tipReviewView)),i.btnSharing&&i.btnSharing.updateHint(i.tipSharing),i.btnHistory&&i.btnHistory.updateHint(i.tipHistory),i.btnChat&&i.btnChat.updateHint(i.txtChat+Common.Utils.String.platformKey("Alt+Q")),i.btnCoAuthMode){i.btnCoAuthMode.setMenu(new Common.UI.Menu({cls:"ppm-toolbar",style:"max-width: 220px;",items:[{caption:i.strFast,checkable:!0,toggleGroup:"menuCoauthMode",checked:!0,template:n,description:i.strFastDesc,value:1},{caption:i.strStrict,checkable:!0,toggleGroup:"menuCoauthMode",checked:!1,template:n,description:i.strStrictDesc,value:0}]})),i.btnCoAuthMode.updateHint(i.tipCoAuthMode);var o=Common.localStorage.getItem(i.appPrefix+"settings-coauthmode");null===o&&!Common.localStorage.itemExists(i.appPrefix+"settings-autosave")&&t.customization&&!1===t.customization.autosave&&(o=0),i.turnCoAuthMode((null===o||1==parseInt(o))&&!(t.isDesktopApp&&t.isOffline)&&t.canCoAuthoring)}if(i.btnCommentRemove){var s=[{caption:t.canEditComments?i.txtCommentRemCurrent:i.txtCommentRemMyCurrent,value:"current"},{caption:i.txtCommentRemMy,value:"my"}];t.canEditComments&&s.push({caption:i.txtCommentRemAll,value:"all"}),i.btnCommentRemove.setMenu(new Common.UI.Menu({items:s})),i.btnCommentRemove.updateHint([i.tipCommentRemCurrent,i.tipCommentRem])}var a,l=i.btnSharing||i.btnCoAuthMode?".separator.sharing":i.$el.find(".separator.sharing"),r=t.canComments&&t.canCoAuthoring?".separator.comments":i.$el.find(".separator.comments"),c=t.canReview||t.canViewReview?".separator.review":i.$el.find(".separator.review"),d=t.canReview&&t.canFeatureComparison?".separator.compare":i.$el.find(".separator.compare"),h=i.btnChat?".separator.chat":i.$el.find(".separator.chat");"object"==typeof l?l.hide().prev(".group").hide():a=l,"object"==typeof r?r.hide().prev(".group").hide():a=r,"object"==typeof c?c.hide().prevUntil(".separator.comments").hide():a=c,"object"==typeof d?d.hide().prev(".group").hide():a=d,"object"==typeof h?h.hide().prev(".group").hide():a=h,!i.btnHistory&&a&&i.$el.find(a).hide(),Common.NotificationCenter.trigger("tab:visible","review",t.isEdit||t.canViewReview||t.canCoAuthoring&&t.canComments),e.call(i)})},getPanel:function(){return this.$el=$(_.template('
    ')({})),this.appConfig.canReview&&(this.btnAccept.render(this.$el.find("#btn-change-accept")),this.btnReject.render(this.$el.find("#btn-change-reject")),this.appConfig.canFeatureComparison&&this.btnCompare.render(this.$el.find("#btn-compare")),this.btnTurnOn.render(this.$el.find("#btn-review-on"))),this.btnPrev&&this.btnPrev.render(this.$el.find("#btn-change-prev")),this.btnNext&&this.btnNext.render(this.$el.find("#btn-change-next")),this.btnReviewView&&this.btnReviewView.render(this.$el.find("#btn-review-view")),this.btnSharing&&this.btnSharing.render(this.$el.find("#slot-btn-sharing")),this.btnCoAuthMode&&this.btnCoAuthMode.render(this.$el.find("#slot-btn-coauthmode")),this.btnHistory&&this.btnHistory.render(this.$el.find("#slot-btn-history")),this.btnChat&&this.btnChat.render(this.$el.find("#slot-btn-chat")),this.btnCommentRemove&&this.btnCommentRemove.render(this.$el.find("#slot-comment-remove")),this.$el},show:function(){Common.UI.BaseView.prototype.show.call(this),this.fireEvent("show",this)},getButton:function(t,e){if("turn"==t&&"statusbar"==e){var i=new Common.UI.Button({cls:"btn-toolbar",iconCls:"toolbar__icon btn-ic-review",hintAnchor:"top",hint:this.tipReview,enableToggle:!0});return this.btnsTurnReview.push(i),i}return"spelling"==t?(i=new Common.UI.Button({cls:"btn-toolbar",iconCls:"toolbar__icon btn-ic-docspell",hintAnchor:"top",hint:this.tipSetSpelling,enableToggle:!0}),this.btnsSpelling.push(i),i):"doclang"==t&&"statusbar"==e?(i=new Common.UI.Button({cls:"btn-toolbar",iconCls:"toolbar__icon btn-ic-doclang",hintAnchor:"top",hint:this.tipSetDocLang,disabled:!0}),this.btnsDocLang.push(i),i):void 0},getUserName:function(t){return Common.Utils.String.htmlEncode(Common.Utils.UserInfoParser.getParsedName(t))},turnChanges:function(t){this.btnsTurnReview.forEach(function(e){e&&e.pressed!=t&&e.toggle(t,!0)},this)},markChanges:function(t){this.btnsTurnReview.forEach(function(e){if(e){$(".icon",e.cmpEl)[t?"addClass":"removeClass"]("btn-ic-changes")}},this)},turnSpelling:function(t){this.btnsSpelling.forEach(function(e){e&&e.pressed!=t&&e.toggle(t,!0)},this)},turnCoAuthMode:function(t){this.btnCoAuthMode&&(this.btnCoAuthMode.menu.items[0].setChecked(t,!0),this.btnCoAuthMode.menu.items[1].setChecked(!t,!0))},turnChat:function(t){this.btnChat&&this.btnChat.toggle(t,!0)},turnDisplayMode:function(t){this.btnReviewView&&(this.btnReviewView.menu.items[0].setChecked("markup"==t,!0),this.btnReviewView.menu.items[1].setChecked("final"==t,!0),this.btnReviewView.menu.items[2].setChecked("original"==t,!0))},SetDisabled:function(t,e){this.btnsSpelling&&this.btnsSpelling.forEach(function(e){e&&e.setDisabled(t)},this),this.btnsDocLang&&this.btnsDocLang.forEach(function(i){i&&i.setDisabled(t||e&&e.length<1)},this),this.btnsTurnReview&&this.btnsTurnReview.forEach(function(e){e&&e.setDisabled(t)},this),this.btnCommentRemove&&this.btnCommentRemove.setDisabled(t||!Common.Utils.InternalSettings.get(this.appPrefix+"settings-livecomment"))},onLostEditRights:function(){this._readonlyRights=!0,this.rendered&&this.btnSharing&&this.btnSharing.setDisabled(!0)},txtAccept:"Accept",txtAcceptCurrent:"Accept current Changes",txtAcceptAll:"Accept all Changes",txtReject:"Reject",txtRejectCurrent:"Reject current Changes",txtRejectAll:"Reject all Changes",hintNext:"To Next Change",hintPrev:"To Previous Change",txtPrev:"Previous",txtNext:"Next",txtTurnon:"Turn On",txtSpelling:"Spell checking",txtDocLang:"Language",tipSetDocLang:"Set Document Language",tipSetSpelling:"Spell checking",tipReview:"Review",txtAcceptChanges:"Accept Changes",txtRejectChanges:"Reject Changes",txtView:"Display Mode",txtMarkup:"Text with changes (Editing)",txtFinal:"All changes like accept (Preview)",txtOriginal:"Text without changes (Preview)",tipReviewView:"Select the way you want the changes to be displayed",tipAcceptCurrent:"Accept current changes",tipRejectCurrent:"Reject current changes",txtSharing:"Sharing",tipSharing:"Manage document access rights",txtCoAuthMode:"Co-editing Mode",tipCoAuthMode:"Set co-editing mode",strFast:"Fast",strStrict:"Strict",txtHistory:"Version History",tipHistory:"Show version history",txtChat:"Chat",txtMarkupCap:"Markup",txtFinalCap:"Final",txtOriginalCap:"Original",strFastDesc:"Real-time co-editing. All changes are saved automatically.",strStrictDesc:"Use the 'Save' button to sync the changes you and others make.",txtCompare:"Compare",tipCompare:"Compare current document with another one",mniFromFile:"Document from File",mniFromUrl:"Document from URL",mniFromStorage:"Document from Storage",mniSettings:"Comparison Settings",txtCommentRemove:"Remove",tipCommentRemCurrent:"Remove current comments",tipCommentRem:"Remove comments",txtCommentRemCurrent:"Remove Current Comments",txtCommentRemMyCurrent:"Remove My Current Comments",txtCommentRemMy:"Remove My Comments",txtCommentRemAll:"Remove All Comments"}}(),Common.Views.ReviewChanges||{})),Common.Views.ReviewChangesDialog=Common.UI.Window.extend(_.extend({options:{width:330,height:90,title:"Review Changes",modal:!1,cls:"review-changes modal-dlg",alias:"Common.Views.ReviewChangesDialog"},initialize:function(t){_.extend(this.options,{title:this.textTitle},t||{}),this.template=['
    ','
    ','
    ','
    ','
    ','
    ',"
    ","
    "].join(""),this.options.tpl=_.template(this.template)(this.options),this.popoverChanges=this.options.popoverChanges,this.mode=this.options.mode,Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this),this.btnPrev=new Common.UI.Button({cls:"dlg-btn iconic",iconCls:"img-commonctrl prev",hint:this.txtPrev,hintAnchor:"top"}),this.btnPrev.render(this.$window.find("#id-review-button-prev")),this.btnNext=new Common.UI.Button({cls:" dlg-btn iconic",iconCls:"img-commonctrl next",hint:this.txtNext,hintAnchor:"top"}),this.btnNext.render(this.$window.find("#id-review-button-next")),this.btnAccept=new Common.UI.Button({cls:"btn-toolbar",caption:this.txtAccept,split:!0,disabled:this.mode.isReviewOnly,menu:!this.mode.canUseReviewPermissions&&new Common.UI.Menu({items:[this.mnuAcceptCurrent=new Common.UI.MenuItem({caption:this.txtAcceptCurrent,value:"current"}),this.mnuAcceptAll=new Common.UI.MenuItem({caption:this.txtAcceptAll,value:"all"})]})}),this.btnAccept.render(this.$window.find("#id-review-button-accept")),this.btnReject=new Common.UI.Button({cls:"btn-toolbar",caption:this.txtReject,split:!0,disabled:this.mode.isReviewOnly,menu:!this.mode.canUseReviewPermissions&&new Common.UI.Menu({items:[this.mnuRejectCurrent=new Common.UI.MenuItem({caption:this.txtRejectCurrent,value:"current"}),this.mnuRejectAll=new Common.UI.MenuItem({caption:this.txtRejectAll,value:"all"})]})}),this.btnReject.render(this.$window.find("#id-review-button-reject"));var t=this;return this.btnPrev.on("click",function(e){t.fireEvent("reviewchange:preview",[t.btnPrev,"prev"])}),this.btnNext.on("click",function(e){t.fireEvent("reviewchange:preview",[t.btnNext,"next"])}),this.btnAccept.on("click",function(e){t.fireEvent("reviewchange:accept",[t.btnAccept,"current"])}),this.btnAccept.menu&&this.btnAccept.menu.on("item:click",function(e,i,n){t.fireEvent("reviewchange:accept",[e,i])}),this.btnReject.on("click",function(e){t.fireEvent("reviewchange:reject",[t.btnReject,"current"])}),this.btnReject.menu&&this.btnReject.menu.on("item:click",function(e,i,n){t.fireEvent("reviewchange:reject",[e,i])}),this},textTitle:"Review Changes",txtPrev:"To previous change",txtNext:"To next change",txtAccept:"Accept",txtAcceptCurrent:"Accept Current Change",txtAcceptAll:"Accept All Changes",txtReject:"Reject",txtRejectCurrent:"Reject Current Change",txtRejectAll:"Reject All Changes"},Common.Views.ReviewChangesDialog||{}))}), +define("common/main/lib/view/OptionsDialog",["common/main/lib/component/Window","common/main/lib/component/RadioBox"],function(){"use strict";Common.Views.OptionsDialog=Common.UI.Window.extend(_.extend({options:{width:214,header:!0,style:"min-width: 214px;",cls:"modal-dlg",items:[],buttons:["ok","cancel"]},initialize:function(t){_.extend(this.options,t||{}),this.template=['
    ','<% if (typeof label !== "undefined" && label !=="") { %>','',"<% } %>","<% _.each(items, function(item, index) { %>","<% if (!item.id) item.id = Common.UI.getId(); %>",'
    ',"<% }) %>","
    "].join(""),this.options.tpl=_.template(this.template)(this.options),this.radio=[],Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this);var t=this,e=t.getChild(),i=this.options.items,n=!0,o=-1;if(i){for(var s=0;s=0&&this.radio[o].setValue(!0)}e.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this))},_handleInput:function(t){this.options.handler&&this.options.handler.call(this,this,t),this.close()},onBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value)},getSettings:function(){return this.currentCell},onPrimary:function(){return this._handleInput("ok"),!1}},Common.Views.OptionsDialog||{}))}),void 0===Common)var Common={};if(Common.Controllers=Common.Controllers||{},define("common/main/lib/controller/ReviewChanges",["core","common/main/lib/model/ReviewChange","common/main/lib/collection/ReviewChanges","common/main/lib/view/ReviewChanges","common/main/lib/view/ReviewPopover","common/main/lib/view/LanguageDialog","common/main/lib/view/OptionsDialog"],function(){"use strict";Common.Controllers.ReviewChanges=Backbone.Controller.extend(_.extend({models:[],collections:["Common.Collections.ReviewChanges"],views:["Common.Views.ReviewChanges","Common.Views.ReviewPopover"],sdkViewName:"#id_main",initialize:function(){this.addListeners({FileMenu:{"settings:apply":this.applySettings.bind(this)},LeftMenu:{"comments:show":_.bind(this.commentsShowHide,this,"show"),"comments:hide":_.bind(this.commentsShowHide,this,"hide")},"Common.Views.ReviewChanges":{"reviewchange:accept":_.bind(this.onAcceptClick,this),"reviewchange:reject":_.bind(this.onRejectClick,this),"reviewchange:delete":_.bind(this.onDeleteClick,this),"reviewchange:preview":_.bind(this.onBtnPreviewClick,this),"reviewchange:view":_.bind(this.onReviewViewClick,this),"reviewchange:compare":_.bind(this.onCompareClick,this),"lang:document":_.bind(this.onDocLanguage,this),"collaboration:coauthmode":_.bind(this.onCoAuthMode,this)},"Common.Views.ReviewChangesDialog":{"reviewchange:accept":_.bind(this.onAcceptClick,this),"reviewchange:reject":_.bind(this.onRejectClick,this),"reviewchange:preview":_.bind(this.onBtnPreviewClick,this)},"Common.Views.ReviewPopover":{"reviewchange:accept":_.bind(this.onAcceptClick,this),"reviewchange:reject":_.bind(this.onRejectClick,this),"reviewchange:delete":_.bind(this.onDeleteClick,this),"reviewchange:goto":_.bind(this.onGotoClick,this)}})},onLaunch:function(){this.collection=this.getApplication().getCollection("Common.Collections.ReviewChanges"),this.userCollection=this.getApplication().getCollection("Common.Collections.Users"),this._state={posx:-1e3,posy:-1e3,popoverVisible:!1,previewMode:!1,compareSettings:null},Common.NotificationCenter.on("reviewchanges:turn",this.onTurnPreview.bind(this)),Common.NotificationCenter.on("spelling:turn",this.onTurnSpelling.bind(this)),Common.NotificationCenter.on("app:ready",this.onAppReady.bind(this)),Common.NotificationCenter.on("api:disconnect",_.bind(this.onCoAuthoringDisconnect,this)),Common.NotificationCenter.on("collaboration:sharing",this.changeAccessRights.bind(this)),Common.NotificationCenter.on("collaboration:sharingdeny",this.onLostEditRights.bind(this)),this.userCollection.on("reset",_.bind(this.onUpdateUsers,this)),this.userCollection.on("add",_.bind(this.onUpdateUsers,this))},setConfig:function(t,e){if(this.setApi(e),t){if(this.currentUserId=t.config.user.id,this.appConfig&&this.appConfig.canUseReviewPermissions){var i=this.appConfig.customization.reviewPermissions,n=[],o=Common.Utils.UserInfoParser.getParsedGroups(t.config.user.fullname);o&&o.forEach(function(t){var e=i[t.trim()];e&&(n=n.concat(e))}),this.currentUserGroups=n}this.sdkViewName=t.sdkviewname||this.sdkViewName}return this},setApi:function(t){t&&(this.api=t,(this.appConfig.canReview||this.appConfig.canViewReview)&&(this.api.asc_registerCallback("asc_onShowRevisionsChange",_.bind(this.onApiShowChange,this)),this.api.asc_registerCallback("asc_onUpdateRevisionsChangesPosition",_.bind(this.onApiUpdateChangePosition,this)),this.api.asc_registerCallback("asc_onAuthParticipantsChanged",_.bind(this.onAuthParticipantsChanged,this)),this.api.asc_registerCallback("asc_onParticipantsChanged",_.bind(this.onAuthParticipantsChanged,this))),this.api.asc_registerCallback("asc_onAcceptChangesBeforeCompare",_.bind(this.onAcceptChangesBeforeCompare,this)),this.api.asc_registerCallback("asc_onCoAuthoringDisconnect",_.bind(this.onCoAuthoringDisconnect,this)),Common.Gateway.on("setrevisedfile",_.bind(this.setRevisedFile,this)))},setMode:function(t){return this.appConfig=t,this.popoverChanges=new Common.Collections.ReviewChanges,this.view=this.createView("Common.Views.ReviewChanges",{mode:t}),(this.appConfig.sharingSettingsUrl&&this.appConfig.sharingSettingsUrl.length||this.appConfig.canRequestSharingSettings)&&(Common.Gateway.on("showsharingsettings",_.bind(this.changeAccessRights,this)),Common.Gateway.on("setsharingsettings",_.bind(this.setSharingSettings,this))),this},loadDocument:function(t){this.document=t.doc},SetDisabled:function(t){this.dlgChanges&&this.dlgChanges.close(),this.view&&this.view.SetDisabled(t,this.langs),this.setPreviewMode(t)},setPreviewMode:function(t){if(this.viewmode!==t){this.viewmode=t,t&&(this.prevcanReview=this.appConfig.canReview),this.appConfig.canReview=!t&&this.prevcanReview;var e=this;this.popoverChanges&&this.popoverChanges.each(function(t){t.set("hint",!e.appConfig.canReview)})}},onApiShowChange:function(t){if(this.getPopover())if(t&&t.length>0){var e=this.readSDKChange(t),i=t[0].get_X(),n=t[0].get_Y(),o=Math.abs(this._state.posx-i)>.001||Math.abs(this._state.posy-n)>.001||t.length!==this._state.changes_length,s=null!==t[0].get_LockUserId(),a=this.getUserName(t[0].get_LockUserId()),l=e[0].get("editable");this.getPopover().hideTips(),this.popoverChanges.reset(e),o&&(this.getPopover().isVisible()&&this.getPopover().hide(),this.getPopover().setLeftTop(i,n)),this.getPopover().showReview(o,s,a);var r=s||!l;this.appConfig.canReview&&!this.appConfig.isReviewOnly&&this._state.lock!==r&&(this.view.btnAccept.setDisabled(r),this.view.btnReject.setDisabled(r),this.dlgChanges&&(this.dlgChanges.btnAccept.setDisabled(r),this.dlgChanges.btnReject.setDisabled(r)),this._state.lock=r),this._state.posx=i,this._state.posy=n,this._state.changes_length=t.length,this._state.popoverVisible=!0}else this._state.popoverVisible&&(this._state.posx=this._state.posy=-1e3,this._state.changes_length=0,this._state.popoverVisible=!1,this.getPopover().hideTips(),this.popoverChanges.reset(),this.getPopover().hideReview())},onApiUpdateChangePosition:function(t,e){this.getPopover()&&(e<0||this.getPopover().sdkBounds.height0&&(this.getPopover().isVisible()||this.getPopover().show(!1),this.getPopover().setLeftTop(t,e)))},findChange:function(t,e){return _.isUndefined(t)?this.collection.findWhere({id:e}):this.collection.findWhere({uid:t})},getPopover:function(){return(this.appConfig.canReview||this.appConfig.canViewReview)&&_.isUndefined(this.popover)&&(this.popover=Common.Views.ReviewPopover.prototype.getPopover({reviewStore:this.popoverChanges,renderTo:this.sdkViewName}),this.popover.setReviewStore(this.popoverChanges)),this.popover},readSDKChange:function(t){var e=this,i=[];return _.each(t,function(t){var n="",o="",s=t.get_Value(),a=t.get_MoveType();switch(t.get_Type()){case Asc.c_oAscRevisionsChangeType.TextAdd:n=a==Asc.c_oAscRevisionsMove.NoMove?e.textInserted:e.textParaMoveTo,"object"==typeof s?_.each(s,function(t){if("string"==typeof t)n+=" "+Common.Utils.String.htmlEncode(t);else switch(t){case 0:n+=" <"+e.textImage+">";break;case 1:n+=" <"+e.textShape+">";break;case 2:n+=" <"+e.textChart+">";break;case 3:n+=" <"+e.textEquation+">"}}):"string"==typeof s&&(n+=" "+Common.Utils.String.htmlEncode(s));break;case Asc.c_oAscRevisionsChangeType.TextRem:n=a==Asc.c_oAscRevisionsMove.NoMove?e.textDeleted:t.is_MovedDown()?e.textParaMoveFromDown:e.textParaMoveFromUp,"object"==typeof s?_.each(s,function(t){if("string"==typeof t)n+=" "+Common.Utils.String.htmlEncode(t);else switch(t){case 0:n+=" <"+e.textImage+">";break;case 1:n+=" <"+e.textShape+">";break;case 2:n+=" <"+e.textChart+">";break;case 3:n+=" <"+e.textEquation+">"}}):"string"==typeof s&&(n+=" "+Common.Utils.String.htmlEncode(s));break;case Asc.c_oAscRevisionsChangeType.ParaAdd:n=e.textParaInserted;break;case Asc.c_oAscRevisionsChangeType.ParaRem:n=e.textParaDeleted;break;case Asc.c_oAscRevisionsChangeType.TextPr:n=""+e.textFormatted,void 0!==s.Get_Bold()&&(o+=(s.Get_Bold()?"":e.textNot)+e.textBold+", "),void 0!==s.Get_Italic()&&(o+=(s.Get_Italic()?"":e.textNot)+e.textItalic+", "),void 0!==s.Get_Underline()&&(o+=(s.Get_Underline()?"":e.textNot)+e.textUnderline+", "),void 0!==s.Get_Strikeout()&&(o+=(s.Get_Strikeout()?"":e.textNot)+e.textStrikeout+", "),void 0!==s.Get_DStrikeout()&&(o+=(s.Get_DStrikeout()?"":e.textNot)+e.textDStrikeout+", "),void 0!==s.Get_Caps()&&(o+=(s.Get_Caps()?"":e.textNot)+e.textCaps+", "),void 0!==s.Get_SmallCaps()&&(o+=(s.Get_SmallCaps()?"":e.textNot)+e.textSmallCaps+", "),void 0!==s.Get_VertAlign()&&(o+=(1==s.Get_VertAlign()?e.textSuperScript:2==s.Get_VertAlign()?e.textSubScript:e.textBaseline)+", "),void 0!==s.Get_Color()&&(o+=e.textColor+", "),void 0!==s.Get_Highlight()&&(o+=e.textHighlight+", "),void 0!==s.Get_Shd()&&(o+=e.textShd+", "),void 0!==s.Get_FontFamily()&&(o+=s.Get_FontFamily()+", "),void 0!==s.Get_FontSize()&&(o+=s.Get_FontSize()+", "),void 0!==s.Get_Spacing()&&(o+=e.textSpacing+" "+Common.Utils.Metric.fnRecalcFromMM(s.Get_Spacing()).toFixed(2)+" "+Common.Utils.Metric.getCurrentMetricName()+", "),void 0!==s.Get_Position()&&(o+=e.textPosition+" "+Common.Utils.Metric.fnRecalcFromMM(s.Get_Position()).toFixed(2)+" "+Common.Utils.Metric.getCurrentMetricName()+", "),void 0!==s.Get_Lang()&&(o+=Common.util.LanguageInfo.getLocalLanguageName(s.Get_Lang())[1]+", "),_.isEmpty(o)||(n+=": ",o=o.substring(0,o.length-2)),n+="",n+=o;break;case Asc.c_oAscRevisionsChangeType.ParaPr:if(n=""+e.textParaFormatted,s.Get_ContextualSpacing()&&(o+=(s.Get_ContextualSpacing()?e.textContextual:e.textNoContextual)+", "),void 0!==s.Get_IndLeft()&&(o+=e.textIndentLeft+" "+Common.Utils.Metric.fnRecalcFromMM(s.Get_IndLeft()).toFixed(2)+" "+Common.Utils.Metric.getCurrentMetricName()+", "),void 0!==s.Get_IndRight()&&(o+=e.textIndentRight+" "+Common.Utils.Metric.fnRecalcFromMM(s.Get_IndRight()).toFixed(2)+" "+Common.Utils.Metric.getCurrentMetricName()+", "),void 0!==s.Get_IndFirstLine()&&(o+=e.textFirstLine+" "+Common.Utils.Metric.fnRecalcFromMM(s.Get_IndFirstLine()).toFixed(2)+" "+Common.Utils.Metric.getCurrentMetricName()+", "),void 0!==s.Get_Jc())switch(s.Get_Jc()){case 0:o+=e.textRight+", ";break;case 1:o+=e.textLeft+", ";break;case 2:o+=e.textCenter+", ";break;case 3:o+=e.textJustify+", "}if(void 0!==s.Get_KeepLines()&&(o+=(s.Get_KeepLines()?e.textKeepLines:e.textNoKeepLines)+", "),s.Get_KeepNext()&&(o+=(s.Get_KeepNext()?e.textKeepNext:e.textNoKeepNext)+", "),s.Get_PageBreakBefore()&&(o+=(s.Get_PageBreakBefore()?e.textBreakBefore:e.textNoBreakBefore)+", "),void 0!==s.Get_SpacingLineRule()&&void 0!==s.Get_SpacingLine()&&(o+=e.textLineSpacing,o+=(s.Get_SpacingLineRule()==c_paragraphLinerule.LINERULE_LEAST?e.textAtLeast:s.Get_SpacingLineRule()==c_paragraphLinerule.LINERULE_AUTO?e.textMultiple:e.textExact)+" ",o+=(s.Get_SpacingLineRule()==c_paragraphLinerule.LINERULE_AUTO?s.Get_SpacingLine():Common.Utils.Metric.fnRecalcFromMM(s.Get_SpacingLine()).toFixed(2)+" "+Common.Utils.Metric.getCurrentMetricName())+", "),s.Get_SpacingBeforeAutoSpacing()?o+=e.textSpacingBefore+" "+e.textAuto+", ":void 0!==s.Get_SpacingBefore()&&(o+=e.textSpacingBefore+" "+Common.Utils.Metric.fnRecalcFromMM(s.Get_SpacingBefore()).toFixed(2)+" "+Common.Utils.Metric.getCurrentMetricName()+", "),s.Get_SpacingAfterAutoSpacing()?o+=e.textSpacingAfter+" "+e.textAuto+", ":void 0!==s.Get_SpacingAfter()&&(o+=e.textSpacingAfter+" "+Common.Utils.Metric.fnRecalcFromMM(s.Get_SpacingAfter()).toFixed(2)+" "+Common.Utils.Metric.getCurrentMetricName()+", "),s.Get_WidowControl()&&(o+=(s.Get_WidowControl()?e.textWidow:e.textNoWidow)+", "),void 0!==s.Get_Tabs()&&(o+=e.textTabs+", "),void 0!==s.Get_NumPr()&&(o+=e.textNum+", "),void 0!==s.Get_PStyle()){var l=e.api.asc_GetStyleNameById(s.Get_PStyle());_.isEmpty(l)||(o+=l+", ")}_.isEmpty(o)||(n+=": ",o=o.substring(0,o.length-2)),n+="",n+=o;break;case Asc.c_oAscRevisionsChangeType.TablePr:n=e.textTableChanged;break;case Asc.c_oAscRevisionsChangeType.RowsAdd:n=e.textTableRowsAdd;break;case Asc.c_oAscRevisionsChangeType.RowsRem:n=e.textTableRowsDel}var r=""==t.get_DateTime()?new Date:new Date(t.get_DateTime()),c=e.userCollection.findOriginalUser(t.get_UserId()),d=new Common.Models.ReviewChange({uid:Common.UI.getId(),userid:t.get_UserId(),username:t.get_UserName(),usercolor:c?c.get("color"):null,date:e.dateToLocaleTimeString(r),changetext:n,id:Common.UI.getId(),lock:null!==t.get_LockUserId(),lockuser:e.getUserName(t.get_LockUserId()),type:t.get_Type(),changedata:t,scope:e.view,hint:!e.appConfig.canReview,goto:t.get_MoveType()==Asc.c_oAscRevisionsMove.MoveTo||t.get_MoveType()==Asc.c_oAscRevisionsMove.MoveFrom,editable:e.appConfig.isReviewOnly&&t.get_UserId()==e.currentUserId||!e.appConfig.isReviewOnly&&(!e.appConfig.canUseReviewPermissions||e.checkUserGroups(t.get_UserName()))});i.push(d)}),i},checkUserGroups:function(t){var e=Common.Utils.UserInfoParser.getParsedGroups(t);return this.currentUserGroups&&e&&_.intersection(this.currentUserGroups,e.length>0?e:[""]).length>0},getUserName:function(t){if(this.userCollection&&null!==t){var e=this.userCollection.findUser(t);if(e)return Common.Utils.UserInfoParser.getParsedName(e.get("username"))}return""},dateToLocaleTimeString:function(t){return t.getMonth()+1+"/"+t.getDate()+"/"+t.getFullYear()+" "+function(t){var e=t.getHours(),i=t.getMinutes(),n=e>=12?"pm":"am";return e%=12,e=e||12,i=i<10?"0"+i:i,e+":"+i+" "+n}(t)},onBtnPreviewClick:function(t,e){switch(e){case"prev":this.api.asc_GetPrevRevisionsChange();break;case"next":this.api.asc_GetNextRevisionsChange()}Common.NotificationCenter.trigger("edit:complete",this.view)},onAcceptClick:function(t,e,i){this.api&&(e?"all"===e.value?this.api.asc_AcceptAllChanges():this.api.asc_AcceptChanges():this.api.asc_AcceptChanges(t)),Common.NotificationCenter.trigger("edit:complete",this.view)},onRejectClick:function(t,e,i){this.api&&(e?"all"===e.value?this.api.asc_RejectAllChanges():this.api.asc_RejectChanges():this.api.asc_RejectChanges(t)),Common.NotificationCenter.trigger("edit:complete",this.view)},onDeleteClick:function(t){this.api&&this.api.asc_RejectChanges(t),Common.NotificationCenter.trigger("edit:complete",this.view)},onGotoClick:function(t){this.api&&this.api.asc_FollowRevisionMove(t),Common.NotificationCenter.trigger("edit:complete",this.view)},onTurnPreview:function(t){this.appConfig.isReviewOnly?this.view.turnChanges(!0):this.appConfig.canReview&&(t="on"==t,Common.localStorage.setItem(this.view.appPrefix+"track-changes-"+(this.appConfig.fileKey||""),t?1:0),this.api.asc_SetTrackRevisions(t),this.view.turnChanges(t))},onTurnSpelling:function(t){t="on"==t,this.view.turnSpelling(t),Common.localStorage.setItem(this.view.appPrefix+"settings-spellcheck",t?1:0),this.api.asc_setSpellCheck(t),Common.Utils.InternalSettings.set(this.view.appPrefix+"settings-spellcheck",t)},onReviewViewClick:function(t,e,i){this.turnDisplayMode(e.value),!this.appConfig.canReview&&Common.localStorage.setItem(this.view.appPrefix+"review-mode",e.value),Common.NotificationCenter.trigger("edit:complete",this.view)},onCompareClick:function(t){if(this.api){var e=this;if(this._state.compareSettings||(this._state.compareSettings=new AscCommonWord.ComparisonOptions,this._state.compareSettings.putWords(!Common.localStorage.getBool("de-compare-char"))),"file"===t)this.api&&this.api.asc_CompareDocumentFile(this._state.compareSettings),Common.NotificationCenter.trigger("edit:complete",this.view);else if("url"===t)new Common.Views.ImageFromUrlDialog({title:e.textUrl,handler:function(t,i){if("ok"==t){if(e.api){var n=i.replace(/ /g,"");_.isEmpty(n)||e.api.asc_CompareDocumentUrl(n,e._state.compareSettings)}Common.NotificationCenter.trigger("edit:complete",e.view)}}}).show();else if("storage"===t)this.appConfig.canRequestCompareFile?Common.Gateway.requestCompareFile():new Common.Views.SelectFileDlg({fileChoiceUrl:this.appConfig.fileChoiceUrl.replace("{fileExt}","").replace("{documentType}","DocumentsOnly")}).on("selectfile",function(t,i){e.setRevisedFile(i,e._state.compareSettings)}).show();else if("settings"===t){var i=!e._state.compareSettings||e._state.compareSettings.getWords();new Common.Views.OptionsDialog({title:e.textTitleComparison,items:[{caption:e.textChar,value:!1,checked:!1===i},{caption:e.textWord,value:!0,checked:!1!==i}],label:e.textShow,handler:function(t,i){"ok"==i&&(e._state.compareSettings=new AscCommonWord.ComparisonOptions,e._state.compareSettings.putWords(t.getSettings())),Common.NotificationCenter.trigger("edit:complete",e.toolbar)}}).show()}}Common.NotificationCenter.trigger("edit:complete",this.view)},setRevisedFile:function(t){this._state.compareSettings||(this._state.compareSettings=new AscCommonWord.ComparisonOptions,this._state.compareSettings.putWords(!Common.localStorage.getBool("de-compare-char"))),t&&t.url&&this.api.asc_CompareDocumentUrl(t.url,this._state.compareSettings,t.token)},onAcceptChangesBeforeCompare:function(t){Common.UI.warning({width:550,msg:this.textAcceptBeforeCompare,buttons:["yes","no"],primary:"yes",callback:function(e){_.defer(function(){t&&t("yes"==e)}),Common.NotificationCenter.trigger("edit:complete",this.view)}})},turnDisplayMode:function(t){this.api&&("final"===t?this.api.asc_BeginViewModeInReview(!0):"original"===t?this.api.asc_BeginViewModeInReview(!1):this.api.asc_EndViewModeInReview()),this.disableEditing("final"==t||"original"==t),this._state.previewMode="final"==t||"original"==t},isPreviewChangesMode:function(){return this._state.previewMode},onCoAuthMode:function(t,e,i){if(Common.localStorage.setItem(this.view.appPrefix+"settings-coauthmode",e.value),Common.Utils.InternalSettings.set(this.view.appPrefix+"settings-coauthmode",e.value),this.api){if(this.api.asc_SetFastCollaborative(1==e.value),this.api.SetCollaborativeMarksShowType){var n=Common.localStorage.getItem(e.value?this.view.appPrefix+"settings-showchanges-fast":this.view.appPrefix+"settings-showchanges-strict");null!==n?this.api.SetCollaborativeMarksShowType("all"==n?Asc.c_oAscCollaborativeMarksShowType.All:"none"==n?Asc.c_oAscCollaborativeMarksShowType.None:Asc.c_oAscCollaborativeMarksShowType.LastChanges):this.api.SetCollaborativeMarksShowType(e.value?Asc.c_oAscCollaborativeMarksShowType.None:Asc.c_oAscCollaborativeMarksShowType.LastChanges)}n=Common.localStorage.getItem(this.view.appPrefix+"settings-autosave"),null===n&&this.appConfig.customization&&!1===this.appConfig.customization.autosave&&(n=0),n=e.value||null===n?1:parseInt(n),Common.localStorage.setItem(this.view.appPrefix+"settings-autosave",n),Common.Utils.InternalSettings.set(this.view.appPrefix+"settings-autosave",n),this.api.asc_setAutoSaveGap(n)}Common.NotificationCenter.trigger("edit:complete",this.view),this.view.fireEvent("settings:apply",[this])},disableEditing:function(t){var e=this.getApplication();e.getController("Toolbar").DisableToolbar(t,!1,!0),e.getController("DocumentHolder").getView().SetDisabled(t),this.appConfig.canReview&&(e.getController("RightMenu").getView("RightMenu").clearSelection(),e.getController("RightMenu").SetDisabled(t,!1),e.getController("Statusbar").getView("Statusbar").SetDisabled(t),e.getController("Navigation")&&e.getController("Navigation").SetDisabled(t),e.getController("Common.Controllers.Plugins").getView("Common.Views.Plugins").disableControls(t));var i=e.getController("Common.Controllers.Comments");i&&i.setPreviewMode(t);var n=e.getController("LeftMenu");n.leftMenu.getMenu("file").getButton("protect").setDisabled(t),n.setPreviewMode(t),this.view&&(this.view.$el.find(".no-group-mask.review").css("opacity",1),this.view.btnsDocLang&&this.view.btnsDocLang.forEach(function(e){e&&e.setDisabled(t||!this.langs||this.langs.length<1)},this))},createToolbarPanel:function(){return this.view.getPanel()},getView:function(t){return!t&&this.view?this.view:Backbone.Controller.prototype.getView.call(this,t)},onAppReady:function(t){var e=this;if(e.view&&Common.localStorage.getBool(e.view.appPrefix+"settings-spellcheck",!(t.customization&&!1===t.customization.spellcheck))&&e.view.turnSpelling(!0),t.canReview)new Promise(function(t){t()}).then(function(){var i="object"==typeof e.appConfig.customization?e.appConfig.customization.trackChanges:void 0,n=t.isReviewOnly||!0===i||!1!==i&&Common.localStorage.getBool(e.view.appPrefix+"track-changes-"+(t.fileKey||""));if(e.api.asc_HaveRevisionsChanges()&&e.view.markChanges(!0),function(t){e.view.turnChanges(t),e.api.asc_SetTrackRevisions(t)}(n),"object"==typeof e.appConfig.customization&&1==e.appConfig.customization.showReviewChanges){e.dlgChanges=new Common.Views.ReviewChangesDialog({popoverChanges:e.popoverChanges,mode:e.appConfig});var o=$("#editor_sdk"),s=o.offset();e.dlgChanges.show(Math.max(10,s.left+o.width()-300),Math.max(10,s.top+o.height()-150))}});else if(t.canViewReview&&(t.canViewReview=t.isEdit||e.api.asc_HaveRevisionsChanges(!0),t.canViewReview)){var i=Common.localStorage.getItem(e.view.appPrefix+"review-mode");null===i&&(i=e.appConfig.customization&&/^(original|final|markup)$/i.test(e.appConfig.customization.reviewDisplay)?e.appConfig.customization.reviewDisplay.toLocaleLowerCase():"original"),e.turnDisplayMode(t.isEdit||t.isRestrictedEdit?"markup":i),e.view.turnDisplayMode(t.isEdit||t.isRestrictedEdit?"markup":i)}e.view&&e.view.btnChat&&e.getApplication().getController("LeftMenu").leftMenu.btnChat.on("toggle",function(t,i){i!==e.view.btnChat.pressed&&e.view.turnChat(i)}),e.view&&e.view.btnCommentRemove&&e.view.btnCommentRemove.setDisabled(!Common.localStorage.getBool(e.view.appPrefix+"settings-livecomment",!0))},applySettings:function(t){this.view&&this.view.turnSpelling(Common.localStorage.getBool(this.view.appPrefix+"settings-spellcheck",!0)),this.view&&this.view.turnCoAuthMode(Common.localStorage.getBool(this.view.appPrefix+"settings-coauthmode",!0))},synchronizeChanges:function(){this.appConfig&&this.appConfig.canReview&&this.view.markChanges(this.api.asc_HaveRevisionsChanges())},setLanguages:function(t){this.langs=t,this.view&&this.view.btnsDocLang&&this.view.btnsDocLang.forEach(function(t){t&&t.setDisabled(this.langs.length<1)},this)},onDocLanguage:function(){var t=this;new Common.Views.LanguageDialog({languages:t.langs,current:t.api.asc_getDefaultLanguage(),handler:function(e,i){if("ok"==e){var n=_.findWhere(t.langs,{value:i});n&&t.api.asc_setDefaultLanguage(n.code)}}}).show()},onLostEditRights:function(){this._readonlyRights=!0,this.view&&this.view.onLostEditRights()},changeAccessRights:function(t,e,i){if(!this._docAccessDlg&&!this._readonlyRights)if(this.appConfig.canRequestSharingSettings)Common.Gateway.requestSharingSettings();else{var n=this;n._docAccessDlg=new Common.Views.DocumentAccessDialog({settingsurl:this.appConfig.sharingSettingsUrl}),n._docAccessDlg.on("accessrights",function(t,e){n.setSharingSettings({sharingSettings:e})}).on("close",function(t){n._docAccessDlg=void 0}),n._docAccessDlg.show()}},setSharingSettings:function(t){t&&(this.document.info.sharingSettings=t.sharingSettings,Common.NotificationCenter.trigger("collaboration:sharingupdate",t.sharingSettings),Common.NotificationCenter.trigger("mentions:clearusers",this))},onCoAuthoringDisconnect:function(){this.SetDisabled(!0)},onUpdateUsers:function(){var t=this.userCollection;this.popoverChanges&&this.popoverChanges.each(function(e){var i=t.findOriginalUser(e.get("userid"));e.set("usercolor",i?i.get("color"):null)})},onAuthParticipantsChanged:function(t){if(this.view&&this.view.btnCompare){var e=0;_.each(t,function(t){t.asc_getView()||e++}),this.view.btnCompare.setDisabled(e>1||this.viewmode)}},commentsShowHide:function(t){if(this.view){var e=Common.Utils.InternalSettings.get(this.view.appPrefix+"settings-livecomment");void 0!==e&&this.view.btnCommentRemove&&this.view.btnCommentRemove.setDisabled("show"!=t&&!e)}},textInserted:"Inserted:",textDeleted:"Deleted:",textParaInserted:"Paragraph Inserted ",textParaDeleted:"Paragraph Deleted ",textFormatted:"Formatted",textParaFormatted:"Paragraph Formatted",textNot:"Not ",textBold:"Bold",textItalic:"Italic",textStrikeout:"Strikeout",textUnderline:"Underline",textColor:"Font color",textBaseline:"Baseline",textSuperScript:"Superscript",textSubScript:"Subscript",textHighlight:"Highlight color",textSpacing:"Spacing",textDStrikeout:"Double strikeout",textCaps:"All caps",textSmallCaps:"Small caps",textPosition:"Position",textFontSize:"Font size",textShd:"Background color",textContextual:"Don't add interval between paragraphs of the same style",textNoContextual:"Add interval between paragraphs of the same style",textIndentLeft:"Indent left",textIndentRight:"Indent right",textFirstLine:"First line",textRight:"Align right",textLeft:"Align left",textCenter:"Align center",textJustify:"Align justify",textBreakBefore:"Page break before",textKeepNext:"Keep with next",textKeepLines:"Keep lines together",textNoBreakBefore:"No page break before",textNoKeepNext:"Don't keep with next",textNoKeepLines:"Don't keep lines together",textLineSpacing:"Line Spacing: ",textMultiple:"multiple",textAtLeast:"at least",textExact:"exactly",textSpacingBefore:"Spacing before",textSpacingAfter:"Spacing after",textAuto:"auto",textWidow:"Widow control",textNoWidow:"No widow control",textTabs:"Change tabs",textNum:"Change numbering",textEquation:"Equation",textImage:"Image",textChart:"Chart",textShape:"Shape",textTableChanged:"Table Settings Changed",textTableRowsAdd:"Table Rows Added",textTableRowsDel:"Table Rows Deleted",textParaMoveTo:"Moved:",textParaMoveFromUp:"Moved Up:",textParaMoveFromDown:"Moved Down:",textUrl:"Paste a document URL",textAcceptBeforeCompare:"In order to compare documents all the tracked changes in them will be considered to have been accepted. Do you want to continue?",textTitleComparison:"Comparison Settings",textShow:"Show changes at",textChar:"Character level",textWord:"Word level"},Common.Controllers.ReviewChanges||{}))}),void 0===Common)var Common={};if(Common.Views=Common.Views||{},define("common/main/lib/view/Protection",["common/main/lib/util/utils","common/main/lib/component/BaseView","common/main/lib/component/Layout","common/main/lib/component/Window"],function(t){"use strict";Common.Views.Protection=Common.UI.BaseView.extend(_.extend(function(){function t(){var t=this;t.appConfig.isPasswordSupport&&(this.btnsAddPwd.concat(this.btnsChangePwd).forEach(function(e){e.on("click",function(e,i){t.fireEvent("protect:password",[e,"add"])})}),this.btnsDelPwd.forEach(function(e){e.on("click",function(e,i){t.fireEvent("protect:password",[e,"delete"])})}),this.btnPwd.menu.on("item:click",function(e,i,n){t.fireEvent("protect:password",[e,i.value])})),t.appConfig.isSignatureSupport&&(this.btnSignature.menu&&this.btnSignature.menu.on("item:click",function(e,i,n){t.fireEvent("protect:signature",[i.value,!1])}),this.btnsInvisibleSignature.forEach(function(e){e.on("click",function(e,i){t.fireEvent("protect:signature",["invisible"])})})),t._isSetEvents=!0}return{options:{},initialize:function(t){Common.UI.BaseView.prototype.initialize.call(this,t),this.appConfig=t.mode,this.btnsInvisibleSignature=[],this.btnsAddPwd=[],this.btnsDelPwd=[],this.btnsChangePwd=[],this._state={disabled:!1,hasPassword:!1,disabledPassword:!1,invisibleSignDisabled:!1};var e=Common.localStorage.getKeysFilter();this.appPrefix=e&&e.length?e.split(",")[0]:"",this.appConfig.isPasswordSupport&&(this.btnAddPwd=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-ic-protect",caption:this.txtEncrypt}),this.btnsAddPwd.push(this.btnAddPwd),this.btnPwd=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-ic-protect",caption:this.txtEncrypt,menu:!0,visible:!1})),this.appConfig.isSignatureSupport&&(this.btnSignature=new Common.UI.Button({cls:"btn-toolbar x-huge icon-top",iconCls:"toolbar__icon btn-ic-signature",caption:this.txtSignature,menu:"pe-"!==this.appPrefix}),this.btnSignature.menu||this.btnsInvisibleSignature.push(this.btnSignature)),Common.NotificationCenter.on("app:ready",this.onAppReady.bind(this))},render:function(t){return this.boxSdk=$("#editor_sdk"),t&&t.html(this.getPanel()),this},onAppReady:function(e){var i=this;new Promise(function(t,e){t()}).then(function(){e.canProtect&&(e.isPasswordSupport&&(i.btnAddPwd.updateHint(i.hintAddPwd),i.btnPwd.updateHint(i.hintPwd),i.btnPwd.setMenu(new Common.UI.Menu({items:[{caption:i.txtChangePwd,value:"add"},{caption:i.txtDeletePwd,value:"delete"}]}))),i.btnSignature&&(i.btnSignature.updateHint(i.btnSignature.menu?i.hintSignature:i.txtInvisibleSignature),i.btnSignature.menu&&i.btnSignature.setMenu(new Common.UI.Menu({items:[{caption:i.txtInvisibleSignature,value:"invisible"},{caption:i.txtSignatureLine,value:"visible",disabled:i._state.disabled}]}))),Common.NotificationCenter.trigger("tab:visible","protect",!0)),t.call(i)})},getPanel:function(){return this.$el=$(_.template('
    ')({})),this.appConfig.canProtect&&(this.btnAddPwd&&this.btnAddPwd.render(this.$el.find("#slot-btn-add-password")),this.btnPwd&&this.btnPwd.render(this.$el.find("#slot-btn-change-password")),this.btnSignature&&this.btnSignature.render(this.$el.find("#slot-btn-signature"))),this.$el},show:function(){Common.UI.BaseView.prototype.show.call(this),this.fireEvent("show",this)},getButton:function(t,e){var i=this;if("signature"==t){var n=new Common.UI.Button({cls:"btn-text-default",style:"width: 100%;",caption:this.txtInvisibleSignature,disabled:this._state.invisibleSignDisabled});return this.btnsInvisibleSignature.push(n),this._isSetEvents&&n.on("click",function(t,e){i.fireEvent("protect:signature",["invisible"])}),n}if("add-password"==t){var n=new Common.UI.Button({cls:"btn-text-default",style:"width: 100%;",caption:this.txtAddPwd,disabled:this._state.disabled||this._state.disabledPassword,visible:!this._state.hasPassword});return this.btnsAddPwd.push(n),this._isSetEvents&&n.on("click",function(t,e){i.fireEvent("protect:password",[t,"add"])}),n}if("del-password"==t){var n=new Common.UI.Button({cls:"btn-text-default",style:"width: 100%;",caption:this.txtDeletePwd, +disabled:this._state.disabled||this._state.disabledPassword,visible:this._state.hasPassword});return this.btnsDelPwd.push(n),this._isSetEvents&&n.on("click",function(t,e){i.fireEvent("protect:password",[t,"delete"])}),n}if("change-password"==t){var n=new Common.UI.Button({cls:"btn-text-default",style:"width: 100%;",caption:this.txtChangePwd,disabled:this._state.disabled||this._state.disabledPassword,visible:this._state.hasPassword});return this.btnsChangePwd.push(n),this._isSetEvents&&n.on("click",function(t,e){i.fireEvent("protect:password",[t,"add"])}),n}},SetDisabled:function(t,e){this._state.disabled=t,this._state.invisibleSignDisabled=t&&!e,this.btnsInvisibleSignature&&this.btnsInvisibleSignature.forEach(function(i){i&&i.setDisabled(t&&!e)},this),this.btnSignature&&this.btnSignature.menu&&(this.btnSignature.menu.items&&this.btnSignature.menu.items[1].setDisabled(t),this.btnSignature.setDisabled(t&&!e)),this.btnsAddPwd.concat(this.btnsDelPwd,this.btnsChangePwd).forEach(function(e){e&&e.setDisabled(t||this._state.disabledPassword)},this)},onDocumentPassword:function(t,e){this._state.hasPassword=t,this._state.disabledPassword=!!e;var i=this._state.disabledPassword||this._state.disabled;this.btnsAddPwd&&this.btnsAddPwd.forEach(function(e){e&&(e.setVisible(!t),e.setDisabled(i))},this),this.btnsDelPwd.concat(this.btnsChangePwd).forEach(function(e){e&&(e.setVisible(t),e.setDisabled(i))},this),this.btnPwd.setVisible(t)},txtEncrypt:"Encrypt",txtSignature:"Signature",hintAddPwd:"Encrypt with password",hintPwd:"Change or delete password",hintSignature:"Add digital signature or signature line",txtChangePwd:"Change password",txtDeletePwd:"Delete password",txtAddPwd:"Add password",txtInvisibleSignature:"Add digital signature",txtSignatureLine:"Add Signature line"}}(),Common.Views.Protection||{}))}),define("common/main/lib/view/PasswordDialog",["common/main/lib/component/Window"],function(){"use strict";Common.Views.PasswordDialog=Common.UI.Window.extend(_.extend({applyFunction:void 0,initialize:function(t){var e=this,i={};_.extend(i,{width:395,height:270,header:!0,cls:"modal-dlg",contentTemplate:"",title:e.txtTitle,buttons:["ok","cancel"]},t),this.template=t.template||['
    ','
    ',"","
    ",'
    ',"","
    ",'
    ','
    ',"","
    ",'
    ',"","
    "].join(""),this.handler=t.handler,this.settings=t.settings,i.tpl=_.template(this.template)(i),Common.UI.Window.prototype.initialize.call(this,i)},render:function(){if(Common.UI.Window.prototype.render.call(this),this.$window){var t=this;this.$window.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this)),this.inputPwd=new Common.UI.InputField({el:$("#id-password-txt"),type:"password",allowBlank:!1,style:"width: 100%;",validateOnBlur:!1}),this.repeatPwd=new Common.UI.InputField({el:$("#id-repeat-txt"),type:"password",allowBlank:!1,style:"width: 100%;",validateOnBlur:!1,validation:function(e){return t.txtIncorrectPwd}})}},show:function(){Common.UI.Window.prototype.show.apply(this,arguments);var t=this;setTimeout(function(){t.inputPwd.cmpEl.find("input").focus()},500)},onPrimary:function(t){return this._handleInput("ok"),!1},onBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value)},_handleInput:function(t){if(this.handler){if("ok"==t){if(!0!==this.inputPwd.checkValidate())return void this.inputPwd.cmpEl.find("input").focus();if(this.inputPwd.getValue()!==this.repeatPwd.getValue())return this.repeatPwd.checkValidate(),void this.repeatPwd.cmpEl.find("input").focus()}this.handler.call(this,t,this.inputPwd.getValue())}this.close()},txtTitle:"Set Password",txtPassword:"Password",txtDescription:"A Password is required to open this document",txtRepeat:"Repeat password",txtIncorrectPwd:"Confirmation password is not identical",txtWarning:"Warning: If you lose or forget the password, it cannot be recovered. Please keep it in a safe place."},Common.Views.PasswordDialog||{}))}),void 0===Common)var Common={};if(define("common/main/lib/view/SignDialog",["common/main/lib/util/utils","common/main/lib/component/InputField","common/main/lib/component/Window","common/main/lib/component/ComboBoxFonts"],function(){"use strict";Common.Views.SignDialog=Common.UI.Window.extend(_.extend({options:{width:370,style:"min-width: 350px;",cls:"modal-dlg",buttons:["ok","cancel"]},initialize:function(t){_.extend(this.options,{title:this.textTitle},t||{}),this.api=this.options.api,this.signType=this.options.signType||"invisible",this.signSize=this.options.signSize||{width:0,height:0},this.certificateId=null,this.signObject=null,this.fontStore=this.options.fontStore,this.font={size:11,name:"Arial",bold:!1,italic:!1};var e=Common.localStorage.getKeysFilter();this.appPrefix=e&&e.length?e.split(",")[0]:"",this.template=['
    ','
    ','
    ',"","
    ",'
    ',"
    ",'
    ','
    ',"","
    ",'
    ','
    ','
    ','
    ','
    ','
    ',"","
    ",'",'
    ','","
    ",'
    ',"
    ",'',"",'","",'',"
    ","
    "].join(""),this.templateCertificate=_.template(['',''].join("")),this.options.tpl=_.template(this.template)(this.options),Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this);var t=this,e=this.getChild();t.inputPurpose=new Common.UI.InputField({el:$("#id-dlg-sign-purpose"),style:"width: 100%;"}),t.inputName=new Common.UI.InputField({el:$("#id-dlg-sign-name"),style:"width: 100%;",validateOnChange:!0}).on("changing",_.bind(t.onChangeName,t)),t.cmbFonts=new Common.UI.ComboBoxFonts({el:$("#id-dlg-sign-fonts"),cls:"input-group-nr",style:"width: 234px;",menuCls:"scrollable-menu",menuStyle:"min-width: 234px;max-height: 270px;",store:new Common.Collections.Fonts,recent:0,takeFocusOnClose:!0,hint:t.tipFontName}).on("selected",function(e,i){t.signObject&&t.signObject.setText(t.inputName.getValue(),i.name,t.font.size,t.font.italic,t.font.bold),t.font.name=i.name}),this.cmbFontSize=new Common.UI.ComboBox({el:$("#id-dlg-sign-font-size"),cls:"input-group-nr",style:"width: 55px;",menuCls:"scrollable-menu",menuStyle:"min-width: 55px;max-height: 270px;",hint:this.tipFontSize,takeFocusOnClose:!0,data:[{value:8,displayValue:"8"},{value:9,displayValue:"9"},{value:10,displayValue:"10"},{value:11,displayValue:"11"},{value:12,displayValue:"12"},{value:14,displayValue:"14"},{value:16,displayValue:"16"},{value:18,displayValue:"18"},{value:20,displayValue:"20"},{value:22,displayValue:"22"},{value:24,displayValue:"24"},{value:26,displayValue:"26"},{value:28,displayValue:"28"},{value:36,displayValue:"36"},{value:48,displayValue:"48"},{value:72,displayValue:"72"},{value:96,displayValue:"96"}]}).on("selected",function(e,i){t.signObject&&t.signObject.setText(t.inputName.getValue(),t.font.name,i.value,t.font.italic,t.font.bold),t.font.size=i.value}),this.cmbFontSize.setValue(this.font.size),this.cmbFontSize.on("changed:before",_.bind(this.onFontSizeChanged,this,!0)),this.cmbFontSize.on("changed:after",_.bind(this.onFontSizeChanged,this,!1)),t.btnBold=new Common.UI.Button({parentEl:$("#id-dlg-sign-bold"),cls:"btn-toolbar",iconCls:"toolbar__icon btn-bold",enableToggle:!0,hint:t.textBold}),t.btnBold.on("click",function(e,i){t.signObject&&t.signObject.setText(t.inputName.getValue(),t.font.name,t.font.size,t.font.italic,e.pressed),t.font.bold=e.pressed}),t.btnItalic=new Common.UI.Button({parentEl:$("#id-dlg-sign-italic"),cls:"btn-toolbar",iconCls:"toolbar__icon btn-italic",enableToggle:!0,hint:t.textItalic}),t.btnItalic.on("click",function(e,i){t.signObject&&t.signObject.setText(t.inputName.getValue(),t.font.name,t.font.size,e.pressed,t.font.bold),t.font.italic=e.pressed}),t.btnSelectImage=new Common.UI.Button({el:"#id-dlg-sign-image"}),t.btnSelectImage.on("click",_.bind(t.onSelectImage,t)),t.btnChangeCertificate=new Common.UI.Button({el:"#id-dlg-sign-change"}),t.btnChangeCertificate.on("click",_.bind(t.onChangeCertificate,t)),t.btnOk=new Common.UI.Button({el:e.find(".primary"),disabled:!0}),t.cntCertificate=$("#id-dlg-sign-certificate"),t.cntVisibleSign=$("#id-dlg-sign-visible"),t.cntInvisibleSign=$("#id-dlg-sign-invisible"),"visible"==t.signType?t.cntInvisibleSign.addClass("hidden"):t.cntVisibleSign.addClass("hidden"),e.find(".dlg-btn").on("click",_.bind(t.onBtnClick,t)),t.afterRender()},getFocusedComponents:function(){return[this.inputPurpose,this.inputName,this.cmbFonts,this.cmbFontSize]},show:function(){Common.UI.Window.prototype.show.apply(this,arguments);var t=this;_.delay(function(){("visible"==t.signType?t.inputName:t.inputPurpose).cmpEl.find("input").focus()},500)},close:function(){this.api.asc_unregisterCallback("on_signature_defaultcertificate_ret",this.binding.certificateChanged),this.api.asc_unregisterCallback("on_signature_selectsertificate_ret",this.binding.certificateChanged),Common.UI.Window.prototype.close.apply(this,arguments),this.signObject&&this.signObject.destroy()},afterRender:function(){this.api&&(this.binding||(this.binding={}),this.binding.certificateChanged=_.bind(this.onCertificateChanged,this),this.api.asc_registerCallback("on_signature_defaultcertificate_ret",this.binding.certificateChanged),this.api.asc_registerCallback("on_signature_selectsertificate_ret",this.binding.certificateChanged),this.api.asc_GetDefaultCertificate()),"visible"==this.signType&&(this.cmbFonts.fillFonts(this.fontStore),this.cmbFonts.selectRecord(this.fontStore.findWhere({name:this.font.name})||this.fontStore.at(0)),this.signObject=new AscCommon.CSignatureDrawer("signature-preview-img",this.api,this.signSize.width,this.signSize.height))},getSettings:function(){var t={};return t.certificateId=this.certificateId,"invisible"==this.signType?t.purpose=this.inputPurpose.getValue():t.images=this.signObject?this.signObject.getImages():[null,null],t},onBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value)},onPrimary:function(t){return this._handleInput("ok"),!1},_handleInput:function(t){if(this.options.handler){if("ok"==t&&(this.btnOk.isDisabled()||this.signObject&&!this.signObject.isValid()))return void(this.btnOk.isDisabled()||(this.inputName.showError([this.textNameError]),this.inputName.focus()));this.options.handler.call(this,this,t)}this.close()},onChangeCertificate:function(){this.api.asc_SelectCertificate()},onCertificateChanged:function(t){this.certificateId=t.id;var e=t.date,i="string"==typeof e?e.split(" - "):["",""];this.cntCertificate.html(this.templateCertificate({name:t.name,valid:this.textValid.replace("%1",i[0]).replace("%2",i[1])})),this.cntCertificate.toggleClass("hidden",_.isEmpty(this.certificateId)||this.certificateId<0),this.btnChangeCertificate.setCaption(_.isEmpty(this.certificateId)||this.certificateId<0?this.textSelect:this.textChange),this.btnOk.setDisabled(_.isEmpty(this.certificateId)||this.certificateId<0)},onSelectImage:function(){this.signObject&&(this.signObject.selectImage(),this.inputName.setValue(""))},onChangeName:function(t,e){this.signObject&&this.signObject.setText(e,this.font.name,this.font.size,this.font.italic,this.font.bold)},onFontSizeChanged:function(t,e,i,n){var o;if(t){if(!e.store.findWhere({displayValue:i.value})&&!(o=/^\+?(\d*(\.|,)?\d+)$|^\+?(\d+(\.|,)?\d*)$/.exec(i.value)))return o=e.getValue(),e.setRawValue(o),n.preventDefault(),!1}else{var s="sse-"==this.appPrefix?409:300;o=Common.Utils.String.parseFloat(i.value),o=o>s?s:o<1?1:Math.floor(2*(o+.4))/2,e.setRawValue(o),this.signObject&&this.signObject.setText(this.inputName.getValue(),this.font.name,o,this.font.italic,this.font.bold),this.font.size=o}},textTitle:"Sign Document",textPurpose:"Purpose for signing this document",textCertificate:"Certificate",textValid:"Valid from %1 to %2",textChange:"Change",textInputName:"Input signer name",textUseImage:"or click 'Select Image' to use a picture as signature",textSelectImage:"Select Image",textSignature:"Signature looks as",tipFontName:"Font Name",tipFontSize:"Font Size",textBold:"Bold",textItalic:"Italic",textSelect:"Select",textNameError:"Signer name must not be empty."},Common.Views.SignDialog||{}))}),void 0===Common)var Common={};if(define("common/main/lib/view/SignSettingsDialog",["common/main/lib/util/utils","common/main/lib/component/InputField","common/main/lib/component/CheckBox","common/main/lib/component/Window"],function(){"use strict";Common.Views.SignSettingsDialog=Common.UI.Window.extend(_.extend({options:{width:350,style:"min-width: 350px;",cls:"modal-dlg",type:"edit"},initialize:function(t){_.extend(this.options,{title:this.textTitle},t||{}),this.template=['
    ','
    ',"","
    ",'
    ',"","
    ",'
    ','
    ',"","
    ",'
    ','
    ',"","
    ",'
    ','
    ',"","
    ",'','
    ',"
    ",'"].join(""),this.api=this.options.api,this.type=this.options.type||"edit",this.options.tpl=_.template(this.template)(this.options),Common.UI.Window.prototype.initialize.call(this,this.options)},render:function(){Common.UI.Window.prototype.render.call(this);var t=this,e=this.getChild();t.inputName=new Common.UI.InputField({el:$("#id-dlg-sign-settings-name"),style:"width: 100%;",disabled:"view"==this.type}),t.inputTitle=new Common.UI.InputField({el:$("#id-dlg-sign-settings-title"),style:"width: 100%;",disabled:"view"==this.type}),t.inputEmail=new Common.UI.InputField({el:$("#id-dlg-sign-settings-email"),style:"width: 100%;",disabled:"view"==this.type}),t.textareaInstructions=this.$window.find("textarea"),t.textareaInstructions.keydown(function(t){t.keyCode==Common.UI.Keys.RETURN&&t.stopPropagation()}),"view"==this.type?this.textareaInstructions.attr("disabled","disabled"):this.textareaInstructions.removeAttr("disabled"),this.textareaInstructions.toggleClass("disabled","view"==this.type),this.chDate=new Common.UI.CheckBox({el:$("#id-dlg-sign-settings-date"),labelText:this.textShowDate,disabled:"view"==this.type}),e.find(".dlg-btn").on("click",_.bind(this.onBtnClick,this))},getFocusedComponents:function(){return[this.inputName,this.inputTitle,this.inputEmail,this.textareaInstructions]},getDefaultFocusableComponent:function(){return this.inputName},setSettings:function(t){if(t){var e=this,i=t.asc_getSigner1();e.inputName.setValue(i||""),i=t.asc_getSigner2(),e.inputTitle.setValue(i||""),i=t.asc_getEmail(),e.inputEmail.setValue(i||""),i=t.asc_getInstructions(),e.textareaInstructions.val(i||""),e.chDate.setValue(t.asc_getShowDate()),e._currentGuid=t.asc_getGuid()}},getSettings:function(){var t=this,e=new AscCommon.asc_CSignatureLine;return e.asc_setSigner1(t.inputName.getValue()),e.asc_setSigner2(t.inputTitle.getValue()),e.asc_setEmail(t.inputEmail.getValue()),e.asc_setInstructions(t.textareaInstructions.val()),e.asc_setShowDate("checked"==t.chDate.getValue()),void 0!==t._currentGuid&&e.asc_setGuid(t._currentGuid),e},onBtnClick:function(t){this._handleInput(t.currentTarget.attributes.result.value)},onPrimary:function(t){return this._handleInput("ok"),!1},_handleInput:function(t){this.options.handler&&this.options.handler.call(this,this,t),this.close()},textInfo:"Signer Info",textInfoName:"Name",textInfoTitle:"Signer Title",textInfoEmail:"E-mail",textInstructions:"Instructions for Signer",txtEmpty:"This field is required",textAllowComment:"Allow signer to add comment in the signature dialog",textShowDate:"Show sign date in signature line",textTitle:"Signature Setup"},Common.Views.SignSettingsDialog||{}))}),void 0===Common)var Common={};Common.Controllers=Common.Controllers||{},define("common/main/lib/controller/Protection",["core","common/main/lib/view/Protection","common/main/lib/view/PasswordDialog","common/main/lib/view/SignDialog","common/main/lib/view/SignSettingsDialog"],function(){"use strict";Common.Controllers.Protection=Backbone.Controller.extend(_.extend({models:[],collections:[],views:["Common.Views.Protection"],sdkViewName:"#id_main",initialize:function(){this.addListeners({"Common.Views.Protection":{"protect:password":_.bind(this.onPasswordClick,this),"protect:signature":_.bind(this.onSignatureClick,this)}})},onLaunch:function(){this._state={},Common.NotificationCenter.on("app:ready",this.onAppReady.bind(this)),Common.NotificationCenter.on("api:disconnect",_.bind(this.onCoAuthoringDisconnect,this))},setConfig:function(t,e){this.setApi(e),t&&(this.sdkViewName=t.sdkviewname||this.sdkViewName)},setApi:function(t){t&&(this.api=t,this.appConfig.isPasswordSupport&&this.api.asc_registerCallback("asc_onDocumentPassword",_.bind(this.onDocumentPassword,this)),this.appConfig.isSignatureSupport&&(Common.NotificationCenter.on("protect:sign",_.bind(this.onSignatureRequest,this)),Common.NotificationCenter.on("protect:signature",_.bind(this.onSignatureClick,this)),this.api.asc_registerCallback("asc_onSignatureClick",_.bind(this.onSignatureSign,this)),this.api.asc_registerCallback("asc_onUpdateSignatures",_.bind(this.onApiUpdateSignatures,this))),this.api.asc_registerCallback("asc_onCoAuthoringDisconnect",_.bind(this.onCoAuthoringDisconnect,this)))},setMode:function(t){return this.appConfig=t,this.view=this.createView("Common.Views.Protection",{mode:t}),this},onDocumentPassword:function(t,e){this.view&&this.view.onDocumentPassword(t,e)},SetDisabled:function(t,e){this.view&&this.view.SetDisabled(t,e)},onPasswordClick:function(t,e){switch(e){case"add":this.addPassword();break;case"delete":this.deletePassword()}Common.NotificationCenter.trigger("edit:complete",this.view)},onSignatureRequest:function(t){this.api.asc_RequestSign(t)},onSignatureClick:function(t,e,i){switch(t){case"invisible":this.onSignatureRequest("unvisibleAdd");break;case"visible":this.addVisibleSignature(e,i)}},createToolbarPanel:function(){return this.view.getPanel()},getView:function(t){return!t&&this.view?this.view:Backbone.Controller.prototype.getView.call(this,t)},onAppReady:function(t){},addPassword:function(){var t=this;new Common.Views.PasswordDialog({api:t.api,signType:"invisible",handler:function(e,i){"ok"==e&&t.api.asc_setCurrentPassword(i),Common.NotificationCenter.trigger("edit:complete")}}).show()},deletePassword:function(){this.api.asc_resetPassword()},addInvisibleSignature:function(){var t=this;new Common.Views.SignDialog({api:t.api,signType:"invisible",handler:function(e,i){if("ok"==i){var n=e.getSettings();t.api.asc_Sign(n.certificateId)}Common.NotificationCenter.trigger("edit:complete")}}).show()},addVisibleSignature:function(t,e){var i=this,n=new Common.Views.SignSettingsDialog({type:t?"view":"edit",handler:function(e,n){t||"ok"!=n||i.api.asc_AddSignatureLine2(e.getSettings()),Common.NotificationCenter.trigger("edit:complete")}});n.show(),e&&n.setSettings(this.api.asc_getSignatureSetup(e))},signVisibleSignature:function(t,e,i){var n=this;if(_.isUndefined(n.fontStore)){n.fontStore=new Common.Collections.Fonts;var o=n.getApplication().getController("Toolbar").getView("Toolbar").cmbFontName.store.toJSON(),s=[];_.each(o,function(t,e){t.cloneid||s.push(_.clone(t))}),n.fontStore.add(s)}new Common.Views.SignDialog({api:n.api,signType:"visible",fontStore:n.fontStore,signSize:{width:e||0,height:i||0},handler:function(e,i){if("ok"==i){var o=e.getSettings();n.api.asc_Sign(o.certificateId,t,o.images[0],o.images[1])}Common.NotificationCenter.trigger("edit:complete")}}).show()},onSignatureSign:function(t,e,i,n){n?this.signVisibleSignature(t,e,i):this.addInvisibleSignature()},onApiUpdateSignatures:function(t,e){this.SetDisabled(t&&t.length>0,!0)},onCoAuthoringDisconnect:function(){this.SetDisabled(!0)}},Common.Controllers.Protection||{}))}),define("common/main/lib/controller/Desktop",["core"],function(){"use strict";var t=window.AscDesktopEditor;!!t&&t.execCommand("webapps:features",JSON.stringify({version:"0.0.0",eventloading:!0,titlebuttons:!0}));var e=function(){var e,i={version:"0.0.0"},n=window.DE||window.PE||window.SSE,o={"btn-save":"save","btn-save-coauth":"coauth","btn-synch":"synch"};if(t){if(window.on_native_message=function(o,s){if(/^style:change/.test(o)){var a=JSON.parse(s);if("toolbar"==a.element)"off"==a.action&&"native-color"==a.style&&$(".toolbar").removeClass("editor-native-color");else if("body"==a.element&&"merge"==a.action){var r=document.createElement("style");r.innerHTML=a.style,document.body.appendChild(r)}}else if(/window:features/.test(o)){var a=JSON.parse(s);_.isNumber(a.skiptoparea)&&($(".asc-window.modal").length&&$(".asc-window.modal").position().top