11 строки
965 KiB
JavaScript
11 строки
965 KiB
JavaScript
/*!
|
||
* filename: ej.documenteditor.min.js
|
||
* version : 20.4.0.38
|
||
* Copyright Syncfusion Inc. 2001 - 2022. All rights reserved.
|
||
* Use of this code is subject to the terms of our license.
|
||
* A copy of the current license can be obtained at any time by e-mailing
|
||
* licensing@syncfusion.com. Any infringement will be prosecuted under
|
||
* applicable laws.
|
||
*/
|
||
(function(n){typeof define=="function"&&define.amd?define(["./../common/ej.core.min","./../common/ej.data.min","./../common/ej.draggable.min","./../common/ej.scroller.min","./../common/ej.globalize.min","./ej.button.min","./ej.checkbox.min","./ej.dialog.min","./ej.dropdownlist.min","./ej.listbox.min","./ej.editor.min","./ej.menu.min","./ej.splitbutton.min","./ej.togglebutton.min","./ej.tab.min","./ej.colorpicker.min"],n):n()})(function(){"use strict";var n=this&&this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);n.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)},t=ej.browserInfo().name=="msie"&&parseInt(ej.browserInfo().version)<9,i;(function(r){var u=function(u){function f(){u.apply(this,arguments);this.rootCSS="e-documenteditor";this.PluginName="ejDocumentEditor";this._id="null";this.defaults={importExportSettings:{importUrl:"",importHtmlUrl:"",exportUrl:""},isReadOnly:!1,layoutType:0,selection:{characterFormat:{bold:undefined,italic:undefined,fontSize:undefined,underline:undefined,strikeThrough:undefined,baselineAlignment:undefined,highlightColor:undefined,fontColor:undefined,fontFamily:undefined},paragraphFormat:{leftIndent:undefined,rightIndent:undefined,firstLineIndent:undefined,afterSpacing:undefined,beforeSpacing:undefined,lineSpacing:undefined,lineSpacingType:undefined,textAlignment:undefined},tableFormat:{leftIndent:undefined,background:undefined,tableAlignment:undefined,cellSpacing:undefined,leftMargin:undefined,rightMargin:undefined,topMargin:undefined,bottomMargin:undefined,preferredWidth:undefined,preferredWidthType:undefined},cellFormat:{verticalAlignment:undefined,leftMargin:undefined,rightMargin:undefined,topMargin:undefined,bottomMargin:undefined,background:undefined,preferredWidth:undefined,preferredWidthType:undefined},rowFormat:{height:undefined,heightType:undefined,isHeader:undefined,allowRowBreakAcrossPages:undefined},sectionFormat:{headerDistance:undefined,footerDistance:undefined,differentFirstPage:undefined,differentOddAndEvenPages:undefined,pageWidth:undefined,pageHeight:undefined,leftMargin:undefined,topMargin:undefined,rightMargin:undefined,bottomMargin:undefined}},documentChange:null,zoomFactorChange:null,requestNavigate:null,selectionChange:null,contentChange:null};this._documentEditorHelper=null;this.model=this.defaults}return n(f,u),f.prototype._init=function(){t||ej.isNullOrUndefined(this.element)||(this._documentEditorHelper=new i.DocumentEditorHelper(this,ej),this._documentEditorHelper.Document=this._createEmptyDocument(),this._documentEditorHelper.IsReadOnly=this.model.isReadOnly)},f.prototype._destroy=function(){t||(window.removeEventListener("resize",this._documentEditorHelper.Viewer.windowResizeHandler),window.removeEventListener("mousedown",this._documentEditorHelper.Viewer.windowMouseDownHandler),window.removeEventListener("keyup",this._documentEditorHelper.Viewer.windowKeyUpHandler))},f.prototype._setModel=function(n){if(t||this._documentEditorHelper!=undefined||this._documentEditorHelper!=null){var r,i;for(r in n){i=n[r];switch(r){case"isReadOnly":this._documentEditorHelper.IsReadOnly=i;break;case"layoutType":this._documentEditorHelper.LayoutType=i;break;case"selection":this._setSelection(i)}}}},f.prototype._setSelection=function(n){if(!this._documentEditorHelper.IsReadOnlyMode&&this._documentEditorHelper.IsDocumentLoaded){var i,t;for(i in n){t=n[i];switch(i){case"characterFormat":this._setCharacterFormat(t);break;case"paragraphFormat":this._setParagraphFormat(t);break;case"tableFormat":this._setTableFormat(t);break;case"cellFormat":this._setCellFormat(t);break;case"rowFormat":this._setRowFormat(t);break;case"sectionFormat":this._setSectionFormat(t)}}}},f.prototype._setCharacterFormat=function(n){var i,t;for(i in n){t=n[i];switch(i){case"bold":t!=null&&t!=undefined&&(t==!0||t==!1)&&(this._documentEditorHelper.Selection.CharacterFormat.Bold=t);break;case"italic":t!=null&&t!=undefined&&(t==!0||t==!1)&&(this._documentEditorHelper.Selection.CharacterFormat.Italic=t);break;case"fontSize":t!=null&&t!=undefined&&(this._documentEditorHelper.Selection.CharacterFormat.FontSize=t);break;case"underline":t!=null&&t!=undefined&&(this._documentEditorHelper.Selection.CharacterFormat.Underline=t);break;case"strikeThrough":t!=null&&t!=undefined&&(this._documentEditorHelper.Selection.CharacterFormat.StrikeThrough=t);break;case"baselineAlignment":t!=null&&t!=undefined&&(this._documentEditorHelper.Selection.CharacterFormat.BaselineAlignment=t);break;case"highlightColor":t!=null&&t!=undefined&&(this._documentEditorHelper.Selection.CharacterFormat.HighlightColor=t);break;case"fontColor":t!=null&&t!=undefined&&(this._documentEditorHelper.Selection.CharacterFormat.FontColor=t);break;case"fontFamily":t!=null&&t!=undefined&&(this._documentEditorHelper.Selection.CharacterFormat.FontFamily=t)}}},f.prototype._setParagraphFormat=function(n){var i,t;for(i in n){t=n[i];switch(i){case"firstLineIndent":t!=null&&t!=undefined&&(this._documentEditorHelper.Selection.ParagraphFormat.FirstLineIndent=t);break;case"afterSpacing":t!=null&&t!=undefined&&(this._documentEditorHelper.Selection.ParagraphFormat.AfterSpacing=t);break;case"beforeSpacing":t!=null&&t!=undefined&&(this._documentEditorHelper.Selection.ParagraphFormat.BeforeSpacing=t);break;case"lineSpacing":t!=null&&t!=undefined&&(this._documentEditorHelper.Selection.ParagraphFormat.LineSpacing=t);break;case"lineSpacingType":t!=null&&t!=undefined&&(this._documentEditorHelper.Selection.ParagraphFormat.LineSpacingType=t);break;case"textAlignment":t!=null&&t!=undefined&&(this._documentEditorHelper.Selection.ParagraphFormat.TextAlignment=t)}}},f.prototype._setTableFormat=function(n){if(this._documentEditorHelper.Selection.EditingContext.Type==ej.DocumentEditor.EditingContextType.Table){var i,t;for(i in n){t=n[i];switch(i){case"background":this._documentEditorHelper.Selection.TableFormat.Background=t;break;case"bottomMargin":this._documentEditorHelper.Selection.TableFormat.BottomMargin=t;break;case"cellSpacing":this._documentEditorHelper.Selection.TableFormat.CellSpacing=t;break;case"leftIndent":this._documentEditorHelper.Selection.TableFormat.LeftIndent=t;break;case"leftMargin":this._documentEditorHelper.Selection.TableFormat.LeftMargin=t;break;case"preferredWidth":this._documentEditorHelper.Selection.TableFormat.PreferredWidth=t;break;case"preferredWidthType":this._documentEditorHelper.Selection.TableFormat.PreferredWidthType=t;break;case"rightMargin":this._documentEditorHelper.Selection.TableFormat.RightMargin=t;break;case"tableAlignment":this._documentEditorHelper.Selection.TableFormat.TableAlignment=t;break;case"topMargin":this._documentEditorHelper.Selection.TableFormat.TopMargin=t}}}},f.prototype._setCellFormat=function(n){if(this._documentEditorHelper.Selection.EditingContext.Type==ej.DocumentEditor.EditingContextType.Table){var i,t;for(i in n){t=n[i];switch(i){case"background":this._documentEditorHelper.Selection.CellFormat.Background=t;break;case"bottomMargin":this._documentEditorHelper.Selection.CellFormat.BottomMargin=t;break;case"leftMargin":this._documentEditorHelper.Selection.CellFormat.LeftMargin=t;break;case"preferredWidth":this._documentEditorHelper.Selection.CellFormat.PreferredWidth=t;break;case"preferredWidthType":this._documentEditorHelper.Selection.CellFormat.PreferredWidthType=t;break;case"rightMargin":this._documentEditorHelper.Selection.CellFormat.RightMargin=t;break;case"topMargin":this._documentEditorHelper.Selection.CellFormat.TopMargin=t;break;case"verticalAlignment":this._documentEditorHelper.Selection.CellFormat.VerticalAlignment=t}}}},f.prototype._setRowFormat=function(n){if(this._documentEditorHelper.Selection.EditingContext.Type==ej.DocumentEditor.EditingContextType.Table){var i,t;for(i in n){t=n[i];switch(i){case"allowRowBreakAcrossPages":this._documentEditorHelper.Selection.RowFormat.AllowBreakAcrossPages=t;break;case"height":this._documentEditorHelper.Selection.RowFormat.Height=t;break;case"heightType":this._documentEditorHelper.Selection.RowFormat.HeightType=t;break;case"isHeader":this._documentEditorHelper.Selection.RowFormat.IsHeader=t}}}},f.prototype._setSectionFormat=function(n){var i,t;for(i in n){t=n[i];switch(i){case"bottomMargin":this._documentEditorHelper.Selection.SectionFormat.BottomMargin=t;break;case"differentFirstPage":this._documentEditorHelper.Selection.SectionFormat.DifferentFirstPage=t;break;case"footerDistance":this._documentEditorHelper.Selection.SectionFormat.FooterDistance=t;break;case"headerDistance":this._documentEditorHelper.Selection.SectionFormat.HeaderDistance=t;break;case"leftMargin":this._documentEditorHelper.Selection.SectionFormat.LeftMargin=t;break;case"pageHeight":this._documentEditorHelper.Selection.SectionFormat.PageHeight=t;break;case"pageWidth":this._documentEditorHelper.Selection.SectionFormat.PageWidth=t;break;case"rightMargin":this._documentEditorHelper.Selection.SectionFormat.RightMargin=t;break;case"topMargin":this._documentEditorHelper.Selection.SectionFormat.TopMargin=t;break;case"differentOddAndEvenPages":this._documentEditorHelper.Selection.SectionFormat.DifferentOddAndEvenPages=t}}},f.prototype._createEmptyDocument=function(){var n=new i.DocumentAdv(null),t=new i.SectionAdv(null),r=new i.ParagraphAdv(null);return t.Blocks.push(r),n.Sections.push(t),n},f.prototype._loadDocument=function(n){this._documentEditorHelper._ParseDocument(n)},f.prototype._raiseClientEvent=function(n,t){var f=null,r,u,e;if(t===null||(f=t),n=="documentChange")r="";else if(n=="selectionChange")r="",this._copySelectionFormats();else if(n=="zoomFactorChange")r="";else if(n=="requestNavigate"){u="";switch(f.Hyperlink.LinkType){case i.HyperlinkType.Bookmark:u="bookmark";break;case i.HyperlinkType.Email:u="email";break;case i.HyperlinkType.File:u="file";break;default:u="webpage"}e={navigationLink:f.Hyperlink.navigationLink,linkType:u};r={hyperlink:e}}else n=="contentChange"&&(r="");this._trigger(n,r)},f.prototype._copySelectionFormats=function(){this.model.selection.characterFormat.bold=this._documentEditorHelper.Selection.CharacterFormat.Bold;this.model.selection.characterFormat.italic=this._documentEditorHelper.Selection.CharacterFormat.Italic;this.model.selection.characterFormat.fontSize=this._documentEditorHelper.Selection.CharacterFormat.FontSize;this.model.selection.characterFormat.underline=this._documentEditorHelper.Selection.CharacterFormat.Underline;this.model.selection.characterFormat.baselineAlignment=this._documentEditorHelper.Selection.CharacterFormat.BaselineAlignment;this.model.selection.characterFormat.strikeThrough=this._documentEditorHelper.Selection.CharacterFormat.StrikeThrough;this.model.selection.characterFormat.highlightColor=this._documentEditorHelper.Selection.CharacterFormat.HighlightColor;this.model.selection.characterFormat.fontFamily=this._documentEditorHelper.Selection.CharacterFormat.FontFamily;this.model.selection.characterFormat.fontColor=this._documentEditorHelper.Selection.CharacterFormat.FontColor;this.model.selection.paragraphFormat.afterSpacing=this._documentEditorHelper.Selection.ParagraphFormat.AfterSpacing;this.model.selection.paragraphFormat.beforeSpacing=this._documentEditorHelper.Selection.ParagraphFormat.BeforeSpacing;this.model.selection.paragraphFormat.leftIndent=this._documentEditorHelper.Selection.ParagraphFormat.LeftIndent;this.model.selection.paragraphFormat.rightIndent=this._documentEditorHelper.Selection.ParagraphFormat.RightIndent;this.model.selection.paragraphFormat.firstLineIndent=this._documentEditorHelper.Selection.ParagraphFormat.FirstLineIndent;this.model.selection.paragraphFormat.lineSpacing=this._documentEditorHelper.Selection.ParagraphFormat.LineSpacing;this.model.selection.paragraphFormat.lineSpacingType=this._documentEditorHelper.Selection.ParagraphFormat.LineSpacingType;this.model.selection.paragraphFormat.textAlignment=this._documentEditorHelper.Selection.ParagraphFormat.TextAlignment;this.model.selection.tableFormat.background=this._documentEditorHelper.Selection.TableFormat.Background;this.model.selection.tableFormat.bottomMargin=this._documentEditorHelper.Selection.TableFormat.BottomMargin;this.model.selection.tableFormat.cellSpacing=this._documentEditorHelper.Selection.TableFormat.CellSpacing;this.model.selection.tableFormat.leftIndent=this._documentEditorHelper.Selection.TableFormat.LeftIndent;this.model.selection.tableFormat.leftMargin=this._documentEditorHelper.Selection.TableFormat.LeftMargin;this.model.selection.tableFormat.preferredWidth=this._documentEditorHelper.Selection.TableFormat.PreferredWidth;this.model.selection.tableFormat.preferredWidthType=this._documentEditorHelper.Selection.TableFormat.PreferredWidthType;this.model.selection.tableFormat.rightMargin=this._documentEditorHelper.Selection.TableFormat.RightMargin;this.model.selection.tableFormat.tableAlignment=this._documentEditorHelper.Selection.TableFormat.TableAlignment;this.model.selection.tableFormat.topMargin=this._documentEditorHelper.Selection.TableFormat.TopMargin;this.model.selection.cellFormat.background=this._documentEditorHelper.Selection.CellFormat.Background;this.model.selection.cellFormat.bottomMargin=this._documentEditorHelper.Selection.CellFormat.BottomMargin;this.model.selection.cellFormat.leftMargin=this._documentEditorHelper.Selection.CellFormat.LeftMargin;this.model.selection.cellFormat.preferredWidth=this._documentEditorHelper.Selection.CellFormat.PreferredWidth;this.model.selection.cellFormat.preferredWidthType=this._documentEditorHelper.Selection.CellFormat.PreferredWidthType;this.model.selection.cellFormat.rightMargin=this._documentEditorHelper.Selection.CellFormat.RightMargin;this.model.selection.cellFormat.topMargin=this._documentEditorHelper.Selection.CellFormat.TopMargin;this.model.selection.cellFormat.verticalAlignment=this._documentEditorHelper.Selection.CellFormat.VerticalAlignment;this.model.selection.rowFormat.allowRowBreakAcrossPages=this._documentEditorHelper.Selection.RowFormat.AllowBreakAcrossPages;this.model.selection.rowFormat.height=this._documentEditorHelper.Selection.RowFormat.Height;this.model.selection.rowFormat.heightType=this._documentEditorHelper.Selection.RowFormat.HeightType;this.model.selection.rowFormat.isHeader=this._documentEditorHelper.Selection.RowFormat.IsHeader;this.model.selection.sectionFormat.bottomMargin=this._documentEditorHelper.Selection.SectionFormat.BottomMargin;this.model.selection.sectionFormat.differentFirstPage=this._documentEditorHelper.Selection.SectionFormat.DifferentFirstPage;this.model.selection.sectionFormat.differentOddAndEvenPages=this._documentEditorHelper.Selection.SectionFormat.DifferentOddAndEvenPages;this.model.selection.sectionFormat.footerDistance=this._documentEditorHelper.Selection.SectionFormat.FooterDistance;this.model.selection.sectionFormat.headerDistance=this._documentEditorHelper.Selection.SectionFormat.HeaderDistance;this.model.selection.sectionFormat.leftMargin=this._documentEditorHelper.Selection.SectionFormat.LeftMargin;this.model.selection.sectionFormat.pageHeight=this._documentEditorHelper.Selection.SectionFormat.PageHeight;this.model.selection.sectionFormat.pageWidth=this._documentEditorHelper.Selection.SectionFormat.PageWidth;this.model.selection.sectionFormat.rightMargin=this._documentEditorHelper.Selection.SectionFormat.RightMargin;this.model.selection.sectionFormat.topMargin=this._documentEditorHelper.Selection.SectionFormat.TopMargin},f.prototype._getExportProperties=function(){var t=this._documentEditorHelper.Document,n={BackgroundColor:[],CharacterFormat:[],ParagraphFormat:[],Sections:[],AbstractLists:[],Lists:[]},i,r,u;return n.BackgroundColor=t._SerializeBackgroundColor(),n.CharacterFormat=t.CharacterFormat._SerializeCharacterFormat(),n.ParagraphFormat=t.ParagraphFormat._SerializeParagraphFormat(),i=t._SerializeDocument(),n.Sections=i.Sections,r=t._SerializeAbstractList(),n.AbstractLists=r,u=t._SerializeList(),n.Lists=u,{data:JSON.stringify(n)}},f.prototype._getExtension=function(n){switch(n){case ej.DocumentEditor.FormatType.Docx:return"docx";case ej.DocumentEditor.FormatType.Doc:return"doc";case ej.DocumentEditor.FormatType.Rtf:return"rtf";case ej.DocumentEditor.FormatType.Txt:return"txt";case ej.DocumentEditor.FormatType.Html:return"html";case ej.DocumentEditor.FormatType.WordML:return"xml"}return"docx"},f.prototype.newDocument=function(){t||this._documentEditorHelper==null||this._documentEditorHelper==undefined||(this._documentEditorHelper.Document=this._createEmptyDocument())},f.prototype.load=function(n){var u,i;t||(u=this,this._documentEditorHelper._InitDocumentLoad(),i=null,ej.browserInfo().name=="msie"&&parseInt(ej.browserInfo().version)==9?i="":(i=new FormData,i.append("files",n)),r.ajax({type:"POST",async:!0,processData:!1,contentType:!1,crossDomain:!0,data:i,url:this.model.importExportSettings.importUrl,dataType:"JSON",success:function(n){u._loadDocument(n)}}))},f.prototype.save=function(n,i){if(!t&&this._documentEditorHelper!=null&&this._documentEditorHelper!=undefined){var c=this.model.importExportSettings,o,u,f,e,s,h;s=this.model.importExportSettings.exportUrl;o={action:s,method:"post"};u=ej.buildTag("form","",null,o);h=this._getExportProperties();f={name:"DocumentData",type:"hidden",value:h.data};e=ej.buildTag("input","",null,f);u.append(e);f={name:"FileName",type:"hidden",value:n};e=ej.buildTag("input","",null,f);u.append(e);f={name:"Format",type:"hidden",value:this._getExtension(i)};e=ej.buildTag("input","",null,f);u.append(e);r("body").append(u);u.submit()}},f.prototype.print=function(){t||this._documentEditorHelper==null||this._documentEditorHelper==undefined||this._documentEditorHelper._Print()},f.prototype.cut=function(){t||this._documentEditorHelper==null||this._documentEditorHelper==undefined||this._documentEditorHelper.IsReadOnlyMode||!this._documentEditorHelper.IsDocumentLoaded||this._documentEditorHelper.Selection==null||this._documentEditorHelper.Selection.IsCleared||this._documentEditorHelper.Selection.IsEmpty||this._documentEditorHelper.Selection._Cut()},f.prototype.copy=function(){t||this._documentEditorHelper==null||this._documentEditorHelper==undefined||this._documentEditorHelper.Selection==null||this._documentEditorHelper.Selection.IsCleared||this._documentEditorHelper.Selection.IsEmpty||this._documentEditorHelper.Selection._Copy()},f.prototype.paste=function(){t||this._documentEditorHelper==null||this._documentEditorHelper==undefined||this._documentEditorHelper.Selection==null||this._documentEditorHelper.isReadOnly||!this._documentEditorHelper.Selection.CanPaste||this._documentEditorHelper.Selection._PasteInternal()},f.prototype.canPaste=function(){return t||this._documentEditorHelper==null||this._documentEditorHelper==undefined||this._documentEditorHelper.Selection==null||this._documentEditorHelper.isReadOnly?!1:this._documentEditorHelper.Selection.CanPaste},f.prototype.setTimeoutForClipboardPaste=function(n){!t&&typeof n=="number"&&n>0&&this._documentEditorHelper!=null&&this._documentEditorHelper!=undefined&&(this._documentEditorHelper._pasteTimeOut=n*1e3)},f.prototype.canUndo=function(){return t||this._documentEditorHelper==null||this._documentEditorHelper==undefined||this._documentEditorHelper.History==null||this._documentEditorHelper.History==undefined?!1:this._documentEditorHelper.History.CanUndo},f.prototype.canRedo=function(){return t||this._documentEditorHelper==null||this._documentEditorHelper==undefined||this._documentEditorHelper.History==null||this._documentEditorHelper.History==undefined?!1:this._documentEditorHelper.History.CanRedo},f.prototype.undo=function(){this.canUndo()&&this._documentEditorHelper.history._Undo()},f.prototype.redo=function(){this.canRedo()&&this._documentEditorHelper.History._Redo()},f.prototype.toggleBold=function(){t||this._documentEditorHelper==null||this._documentEditorHelper==undefined||this._documentEditorHelper.isReadOnly||!this._documentEditorHelper.IsDocumentLoaded||this._documentEditorHelper.Selection._OnBold()},f.prototype.toggleItalic=function(){t||this._documentEditorHelper==null||this._documentEditorHelper==undefined||this._documentEditorHelper.isReadOnly||!this._documentEditorHelper.IsDocumentLoaded||this._documentEditorHelper.Selection._OnItalic()},f.prototype.toggleUnderline=function(n){t||this._documentEditorHelper==null||this._documentEditorHelper==undefined||this._documentEditorHelper.isReadOnly||!this._documentEditorHelper.IsDocumentLoaded||this._documentEditorHelper.Selection._ToggleUnderline(n)},f.prototype.increaseIndent=function(){t||this._documentEditorHelper==null||this._documentEditorHelper==undefined||this._documentEditorHelper.isReadOnly||!this._documentEditorHelper.IsDocumentLoaded||this._documentEditorHelper.Selection._OnLeftIndentInternal(this._documentEditorHelper.Document.DefaultTabWidth,!0)},f.prototype.decreaseIndent=function(){t||this._documentEditorHelper==null||this._documentEditorHelper==undefined||this._documentEditorHelper.isReadOnly||!this._documentEditorHelper.IsDocumentLoaded||this._documentEditorHelper.Selection._OnLeftIndentInternal(-this._documentEditorHelper.Document.DefaultTabWidth,!0)},f.prototype.applyBullet=function(n,i){t||this._documentEditorHelper==null||this._documentEditorHelper==undefined||this._documentEditorHelper.IsReadOnly||!this._documentEditorHelper.IsDocumentLoaded||this._documentEditorHelper.Selection._ApplyBullet(n,i)},f.prototype.applyNumbering=function(n,i){t||this._documentEditorHelper==null||this._documentEditorHelper==undefined||this._documentEditorHelper.IsReadOnly||!this._documentEditorHelper.IsDocumentLoaded||this._documentEditorHelper.Selection._ApplyNumbering(n,i)},f.prototype.getEditingContextType=function(){return t||this._documentEditorHelper==null||this._documentEditorHelper==undefined?ej.DocumentEditor.EditingContextType.Text:this._documentEditorHelper.Selection.EditingContext.Type},f.prototype.getStart=function(){return t||this._documentEditorHelper==null||this._documentEditorHelper==undefined?"0;0;0":this._documentEditorHelper.Selection._GetStart()},f.prototype.getEnd=function(){return t||this._documentEditorHelper==null||this._documentEditorHelper==undefined?"0;0;0":this._documentEditorHelper.Selection._GetEnd()},f.prototype.getDocumentStart=function(){return t||this._documentEditorHelper==null||this._documentEditorHelper==undefined?"0;0;0":this._documentEditorHelper._GetDocumentStart()},f.prototype.getDocumentEnd=function(){return t||this._documentEditorHelper==null||this._documentEditorHelper==undefined?"0;0;1":this._documentEditorHelper._GetDocumentEnd()},f.prototype.select=function(n,i){t||this._documentEditorHelper==null||this._documentEditorHelper==undefined||this._documentEditorHelper.Selection._SelectPositionBy(n,i)},f.prototype.insertText=function(n){t||this._documentEditorHelper==null||this._documentEditorHelper==undefined||this._documentEditorHelper.isReadOnly||!this._documentEditorHelper.IsDocumentLoaded||this._documentEditorHelper._InsertText(n)},f.prototype.insertImage=function(n,i,r){t||this._documentEditorHelper==null||this._documentEditorHelper==undefined||this._documentEditorHelper.isReadOnly||!this._documentEditorHelper.IsDocumentLoaded||this._documentEditorHelper._InsertPicture(n,i,r)},f.prototype.insertTable=function(n,i){t||this._documentEditorHelper==null||this._documentEditorHelper==undefined||this._documentEditorHelper.isReadOnly||!this._documentEditorHelper.IsDocumentLoaded||this._documentEditorHelper.Selection==null||this._documentEditorHelper.Selection.IsCleared||this._documentEditorHelper._InsertTableInBlocks(n,i)},f.prototype.insertRow=function(n){t||this._documentEditorHelper==null||this._documentEditorHelper==undefined||this._documentEditorHelper.isReadOnly||!this._documentEditorHelper.IsDocumentLoaded||this._documentEditorHelper.Selection==null||this._documentEditorHelper.Selection.IsCleared||this._documentEditorHelper.Selection.EditingContext.Type!=ej.DocumentEditor.EditingContextType.Table||this._documentEditorHelper._InsertRowInTable(n)},f.prototype.insertColumn=function(n){t||this._documentEditorHelper==null||this._documentEditorHelper==undefined||this._documentEditorHelper.isReadOnly||!this._documentEditorHelper.IsDocumentLoaded||this._documentEditorHelper.Selection==null||this._documentEditorHelper.Selection.IsCleared||this._documentEditorHelper.Selection.EditingContext.Type!=ej.DocumentEditor.EditingContextType.Table||this._documentEditorHelper._InsertColumnInTable(n)},f.prototype.deleteTable=function(){t||this._documentEditorHelper==null||this._documentEditorHelper==undefined||this._documentEditorHelper.isReadOnly||!this._documentEditorHelper.IsDocumentLoaded||this._documentEditorHelper.Selection!=null&&!this._documentEditorHelper.Selection.IsCleared&&this._documentEditorHelper.Selection.Start!=null&&this._documentEditorHelper.Selection.Start.Paragraph!=null&&this._documentEditorHelper.Selection.Start.Paragraph.IsInsideTable&&this._documentEditorHelper._DeleteTableFromBlocks()},f.prototype.deleteRow=function(){t||this._documentEditorHelper==null||this._documentEditorHelper==undefined||this._documentEditorHelper.isReadOnly||!this._documentEditorHelper.IsDocumentLoaded||this._documentEditorHelper.Selection!=null&&!this._documentEditorHelper.Selection.IsCleared&&this._documentEditorHelper.Selection.Start!=null&&this._documentEditorHelper.Selection.Start.Paragraph!=null&&this._documentEditorHelper.Selection.Start.Paragraph.IsInsideTable&&this._documentEditorHelper._DeleteRowFromTable()},f.prototype.deleteColumn=function(){t||this._documentEditorHelper==null||this._documentEditorHelper==undefined||this._documentEditorHelper.isReadOnly||!this._documentEditorHelper.IsDocumentLoaded||this._documentEditorHelper.Selection==null||this._documentEditorHelper.Selection.IsCleared||this._documentEditorHelper._DeleteColumnFromTable()},f.prototype.isSelectionInComment=function(){return t||this._documentEditorHelper==null||this._documentEditorHelper==undefined?!1:this._documentEditorHelper.Selection._IsInComment()},f.prototype.getCommentsCount=function(){return t||this._documentEditorHelper==null||this._documentEditorHelper==undefined?0:this._documentEditorHelper.Document.Comments.Count},f.prototype.addComment=function(){t||this._documentEditorHelper==null||this._documentEditorHelper==undefined||this._documentEditorHelper.IsReadOnly||!this._documentEditorHelper.IsDocumentLoaded||this._documentEditorHelper.isReadOnly||this._documentEditorHelper.LayoutType!=ej.DocumentEditor.LayoutType.Pages||this._documentEditorHelper.Selection==null||this._documentEditorHelper.Selection.IsCleared||this._documentEditorHelper.Selection._IsInComment()||this._documentEditorHelper._InsertComment()},f.prototype.deleteComment=function(){t||this._documentEditorHelper==null||this._documentEditorHelper==undefined||this._documentEditorHelper.IsReadOnly||!this._documentEditorHelper.IsDocumentLoaded||this._documentEditorHelper.isReadOnly||this._documentEditorHelper.Selection==null||this._documentEditorHelper.Selection.IsCleared||!this._documentEditorHelper.Selection._IsInComment()||this._documentEditorHelper._DeleteComment()},f.prototype.deleteAllComments=function(){t||this._documentEditorHelper==null||this._documentEditorHelper==undefined||this._documentEditorHelper.IsReadOnly||!this._documentEditorHelper.IsDocumentLoaded||!this._documentEditorHelper.isReadOnly&&this._documentEditorHelper.Selection!=null&&!this._documentEditorHelper.Selection.IsCleared&&this._documentEditorHelper.Document!=null&&this._documentEditorHelper.Document.Comments.Count>0&&this._documentEditorHelper._DeleteAllComments()},f.prototype.navigateToNextComment=function(){t||this._documentEditorHelper==null||this._documentEditorHelper==undefined||this._documentEditorHelper.IsReadOnly||!this._documentEditorHelper.IsDocumentLoaded||this._documentEditorHelper.Selection!=null&&!this._documentEditorHelper.Selection.IsCleared&&this._documentEditorHelper.Selection._IsInComment()&&this._documentEditorHelper._NavigateNextComment()},f.prototype.navigateToPreviousComment=function(){t||this._documentEditorHelper==null||this._documentEditorHelper==undefined||this._documentEditorHelper.IsReadOnly||!this._documentEditorHelper.IsDocumentLoaded||this._documentEditorHelper.Selection!=null&&!this._documentEditorHelper.Selection.IsCleared&&this._documentEditorHelper.Selection._IsInComment()&&this._documentEditorHelper._NavigatePreviousComment()},f.prototype.getSelectedText=function(){if(!t&&this._documentEditorHelper!=null&&this._documentEditorHelper!=undefined)return this._documentEditorHelper.Selection.Text},f.prototype.find=function(n,i){return t||this._documentEditorHelper==null||this._documentEditorHelper==undefined||!this._documentEditorHelper.IsDocumentLoaded?!1:((i==null||i==undefined)&&(i=ej.DocumentEditor.FindOptions.None),n!=undefined&&n!=null&&n!="")?this._documentEditorHelper._Find(n.toString(),i):!1},f.prototype.findAll=function(n,i){if(!t&&this._documentEditorHelper!=null&&this._documentEditorHelper!=undefined&&this._documentEditorHelper.IsDocumentLoaded)return(i==null||i==undefined)&&(i=ej.DocumentEditor.FindOptions.None),this._documentEditorHelper.Viewer._ClearSearchHighlight(),n!=undefined&&n!=null&&n!=""?this._documentEditorHelper._FindAll(n.toString(),i):this._documentEditorHelper.textSearchResults!=null&&this._documentEditorHelper.textSearchResults.Count>0&&this._documentEditorHelper.textSearchResults._ClearResults(),this._documentEditorHelper.textSearchResults!=null&&this._documentEditorHelper.textSearchResults.Count>0?this._documentEditorHelper.textSearchResults.Count:0},f.prototype.replace=function(n,i,r){return t||this._documentEditorHelper==null||this._documentEditorHelper==undefined||this._documentEditorHelper.IsReadOnly||!this._documentEditorHelper.IsDocumentLoaded?!1:((i==null||i==undefined)&&(i=ej.DocumentEditor.FindOptions.None),this._documentEditorHelper._Replace(n,i,r))},f.prototype.replaceAll=function(n,i,r){return t||this._documentEditorHelper==null||this._documentEditorHelper==undefined||this._documentEditorHelper.IsReadOnly||!this._documentEditorHelper.IsDocumentLoaded?0:((i==null||i==undefined)&&(i=ej.DocumentEditor.FindOptions.None),this._documentEditorHelper._ReplaceAll(n,i,r))},f.prototype._navigateNextTextSearchResult=function(){if(!t&&this._documentEditorHelper!=null&&this._documentEditorHelper!=undefined&&this._documentEditorHelper.IsDocumentLoaded)return this._documentEditorHelper.textSearchResults!=null&&this._documentEditorHelper.textSearchResults.Count>0?(this._documentEditorHelper.textSearchResults.CurrentIndex<this._documentEditorHelper.textSearchResults.Count-1?this._documentEditorHelper.textSearchResults.CurrentIndex++:this._documentEditorHelper.textSearchResults.CurrentIndex=0,this._documentEditorHelper.textSearchResults.CurrentSearchResult._Navigate(),{count:this._documentEditorHelper.textSearchResults.Count,currentIndex:this._documentEditorHelper.textSearchResults.CurrentIndex+1}):{count:0,currentIndex:-1}},f.prototype._navigatePreviousTextSearchResult=function(){if(!t&&this._documentEditorHelper!=null&&this._documentEditorHelper!=undefined&&this._documentEditorHelper.IsDocumentLoaded)return this._documentEditorHelper.textSearchResults!=null&&this._documentEditorHelper.textSearchResults.Count>0?(this._documentEditorHelper.textSearchResults.CurrentIndex>0?this._documentEditorHelper.textSearchResults.CurrentIndex--:this._documentEditorHelper.textSearchResults.CurrentIndex=this._documentEditorHelper.textSearchResults.Count-1,this._documentEditorHelper.textSearchResults.CurrentSearchResult._Navigate(),{count:this._documentEditorHelper.textSearchResults.Count,currentIndex:this._documentEditorHelper.textSearchResults.CurrentIndex+1}):{count:0,currentIndex:-1}},f.prototype.showOptionsPane=function(){!t&&this._documentEditorHelper!=null&&this._documentEditorHelper!=undefined&&this._documentEditorHelper.IsDocumentLoaded&&this._documentEditorHelper.Viewer!=null&&this._documentEditorHelper.Viewer!=undefined&&this._documentEditorHelper.Viewer._ShowHideOptionsPane(!0)},f.prototype.showHyperlinkDialog=function(){t||this._documentEditorHelper==null||this._documentEditorHelper==undefined||this._documentEditorHelper.IsReadOnlyMode||!this._documentEditorHelper.IsDocumentLoaded||this._documentEditorHelper.Selection==null||this._documentEditorHelper.Selection.IsCleared||this._documentEditorHelper.Selection.Start.Paragraph==null||this._documentEditorHelper.Selection.End.Paragraph==null||this._documentEditorHelper.Selection.Start.Paragraph.AssociatedCell!=this._documentEditorHelper.Selection.End.Paragraph.AssociatedCell||this._documentEditorHelper.Selection.SelectionRanges.Count!=1||this._documentEditorHelper.Viewer._ShowHyperlinkDialog()},f.prototype.showFindAndReplaceDialog=function(n){!t&&this._documentEditorHelper!=null&&this._documentEditorHelper!=undefined&&this._documentEditorHelper.IsDocumentLoaded&&(n&&this._documentEditorHelper.IsReadOnlyMode||this._documentEditorHelper.Viewer._ShowFindAndReplaceDialog(n))},f.prototype.showFontDialog=function(){t||this._documentEditorHelper==null||this._documentEditorHelper==undefined||this._documentEditorHelper.IsReadOnlyMode||!this._documentEditorHelper.IsDocumentLoaded||this._documentEditorHelper.Viewer._ShowFontDialog()},f.prototype.showParagraphDialog=function(){t||this._documentEditorHelper==null||this._documentEditorHelper==undefined||this._documentEditorHelper.IsReadOnlyMode||!this._documentEditorHelper.IsDocumentLoaded||this._documentEditorHelper.Viewer._ShowParagraphDialog()},f.prototype.showInsertTableDialog=function(){t||this._documentEditorHelper==null||this._documentEditorHelper==undefined||this._documentEditorHelper.IsReadOnlyMode||!this._documentEditorHelper.IsDocumentLoaded||this._documentEditorHelper.Selection==null||this._documentEditorHelper.Selection.IsCleared||this._documentEditorHelper.Viewer._ShowTableDialog()},f.prototype.showTablePropertiesDialog=function(){t||this._documentEditorHelper==null||this._documentEditorHelper==undefined||this._documentEditorHelper.IsReadOnlyMode||!this._documentEditorHelper.IsDocumentLoaded||this._documentEditorHelper.Selection==null||this._documentEditorHelper.Selection.IsCleared||this._documentEditorHelper.Selection.EditingContext.Type!=ej.DocumentEditor.EditingContextType.Table||this._documentEditorHelper.Viewer._ShowTablePropertiesDialog()},f.prototype.showCellMarginsDialog=function(){t||this._documentEditorHelper==null||this._documentEditorHelper==undefined||this._documentEditorHelper.IsReadOnlyMode||!this._documentEditorHelper.IsDocumentLoaded||this._documentEditorHelper.Selection==null||this._documentEditorHelper.Selection.IsCleared||this._documentEditorHelper.Selection.EditingContext.Type!=ej.DocumentEditor.EditingContextType.Table||this._documentEditorHelper.Viewer._ShowCellMarginsDialog()},f.prototype.getCurrentPageNumber=function(){return t||!this._documentEditorHelper.IsDocumentLoaded?1:this._documentEditorHelper.CurrentPageNumber},f.prototype.getPageCount=function(){return t||!this._documentEditorHelper.IsDocumentLoaded?1:this._documentEditorHelper.PageCount},f.prototype.getZoomFactor=function(){return t?1:this._documentEditorHelper.ZoomFactor},f.prototype.setZoomFactor=function(n){t||(this._documentEditorHelper.ZoomFactor=n)},f.prototype.fitPage=function(n){t||this._documentEditorHelper==null||this._documentEditorHelper==undefined||this._documentEditorHelper._FitPage(n)},f}(ej.WidgetBase);ej.widget("ejDocumentEditor","ej.DocumentEditor",new u)})(jQuery);ej.DocumentEditor.LayoutType={Pages:0,Continuous:1};ej.DocumentEditor.FormatType={Doc:0,Docx:1,Html:2,Rtf:3,Txt:4,WordML:5};ej.DocumentEditor.EditingContextType={Text:0,Table:1};ej.DocumentEditor.PageFitType={None:0,FitFullPage:1,FitMultiplePages:2,FitPageWidth:3};ej.DocumentEditor.StrikeThrough={None:0,SingleStrike:1,DoubleStrike:2};ej.DocumentEditor.BaselineAlignment={Normal:0,Superscript:1,Subscript:2};ej.DocumentEditor.Underline={None:0,Single:1,Words:2,Double:3,Dotted:4,Thick:6,Dash:7,DashLong:39,DotDash:9,DotDotDash:10,Wavy:11,DottedHeavy:20,DashHeavy:23,DashLongHeavy:55,DotDashHeavy:25,DotDotDashHeavy:26,WavyHeavy:27,WavyDouble:43};ej.DocumentEditor.HighlightColor={NoColor:0,Yellow:1,BrightGreen:2,Turquoise:3,Pink:4,Blue:5,Red:6,DarkBlue:7,Teal:8,Green:9,Violet:10,DarkRed:11,DarkYellow:12,Gray50:13,Gray25:14,Black:15};ej.DocumentEditor.LineSpacingType={AtLeast:0,Exactly:1,Multiple:2};ej.DocumentEditor.TextAlignment={Center:0,Left:1,Right:2,Justify:3};ej.DocumentEditor.FindOptions={None:0,WholeWord:1,CaseSensitive:2,CaseSensitiveWholeWord:3};ej.DocumentEditor.RowPlacement={Above:0,Below:1};ej.DocumentEditor.ColumnPlacement={Left:0,Right:1};ej.DocumentEditor.TableAlignment={Left:0,Center:1,Right:2};ej.DocumentEditor.WidthType={Auto:0,Percent:1,Pixel:2};ej.DocumentEditor.CellVerticalAlignment={Top:0,Center:1,Bottom:2};ej.DocumentEditor.HeightType={Auto:0,Atleast:1,Exactly:2};ej.DocumentEditor.ListLevelPattern={Arabic:0,UpRoman:1,LowRoman:2,UpLetter:3,LowLetter:4,Ordinal:5,Number:6,OrdinalText:7,LeadingZero:22,Bullet:23,FarEast:20,Special:58,None:255};t=ej.browserInfo().name=="msie"&&ej.browserInfo().version<9;t||(n=this&&this.__extends||function(n,t){function r(){this.constructor=n}for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i]);n.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)},function(t){var kr=function(){function n(){}return n.DocumentChange="documentChange",n.SelectionChange="selectionChange",n.ZoomFactorChange="zoomFactorChange",n.RequestNavigate="requestNavigate",n.ContentChange="contentChange",n}(),f,di,v,ft,kt,wi,ui,eo,re,ue,uf,h,ni,fe,fi,sr,yt,ff,nu,lu,au,vu,yu,pr,pu,wu,ur,bu,ee,ku,du,ti,ct,d,gu,hi,e,bt,ef,ot,oe,se,he,of,u,k,s,pt,sf,y,l,yi,b,ce,nf,nt,lr,wr,p,tt,le,hf,ae,ve,cf,lf,tu,af,vf,ye,pe,we,be,iu,ke,de,ge,no,yf,w,st,to,pf,oi,wt,wf,ci,li,ii,ri,ru,ar,bf,io,uu,it,dt,gi,br,fr,nr,lt,dr,kf,fu,o,a,bi,df,vr,er,ut,at,tr,ai,vi,g,ir,hr,eu,gf,ro,uo,ne,ou,te,ie,fo,i,r,oo,so,si,yr,su,hu,tf,ho,pi,co,rf,cu,cr,vt,ki,gt,ei,rt,gr,rr,ht,or,et,c;t.DocumentEditorEvents=kr;f=function(){function n(){}return n.DocumentEditor="e-documenteditor",n.ContextMenuItem="e-documenteditor-contextmenuitem",n.DisabledContextMenuItem="e-documenteditor-disabledcontextmenuitem",n.OptionsPane="e-documenteditor-optionspane",n.HiddenContextMenuItem="e-documenteditor-hiddencontextmenuitem",n.ContextMenuCut="e-documenteditor-contextmenu-cut",n.ContextMenuCopy="e-documenteditor-contextmenu-copy",n.ContextMenuPaste="e-documenteditor-contextmenu-paste",n.ContextMenuCopyHyperlink="e-documenteditor-contextmenu-copyheperlink",n.ContextMenuOpenHyperlink="e-documenteditor-contextmenu-openhyperlink",n.ContextMenuEditHyperlink="e-documenteditor-contextmenu-edithyperlink",n.ContextMenuHyperlink="e-documenteditor-contextmenu-hyperlink",n.ContextMenuRemoveHyperlink="e-documenteditor-contextmenu-removehyperlink",n.ContextMenuFont="e-documenteditor-contextmenu-font",n.ContextMenuParagraph="e-documenteditor-contextmenu-paragraph",n.ContextMenuTableProperties="e-documenteditor-contextmenu-tableproperties",n}();t.DocumentEditorThemeHelper=f;di=function(){function n(n,t){this.isDocumentLoaded=!0;this.currentPageNumber=1;this.pageCount=1;this.ej=null;this.isShiftingEnabled=!1;this.isLayoutEnabled=!0;this.isPastingContent=!1;this.disableHistory=!1;this.ShowComments=!0;this.isReviewPanelShown=!1;this.layoutType=pi.Pages;this.isReadOnly=!1;this.isReadOnlyInternal=!1;this.SelectedResizeElement=null;this.ResizerPosition=-1;this.CurrentResizingTable=null;this.IsRowOrCellResizing=!1;this.findResultsList=null;this._pasteTimeOut=12e3;this.DocumentEditor=n;this.ej=t;this.LayoutType=this.DocumentEditor.model.layoutType;this.viewer=this.LayoutType==pi.Pages?new w(this):new st(this);this.selection=new cf(this);this.textSearchResults=new ue(this);this.history=new fo(this);this.stackSize=500;this.ImageResizerPoints=new no;this.TableDialog=new he(this);this.TableBoderShadingDialog=new of(this);this.InitialPoint=new p(0,0);this.findResultsList=new h}return Object.defineProperty(n.prototype,"DocumentEditorElement",{get:function(){return this.DocumentEditor.element[0]},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"ContainerId",{get:function(){return this.DocumentEditor._id},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"CurrentPageNumber",{get:function(){return this.Viewer==null||this.Viewer.SelectionEndPage==null?1:this.Viewer.Pages.indexOf(this.Viewer.SelectionEndPage)+1},set:function(n){this.currentPageNumber=n;this._RaiseClientEvent(kr.SelectionChange,null)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"PageCount",{get:function(){if(this.Viewer!=null)return this.Viewer.Pages.Count},set:function(n){this.pageCount=n},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"ZoomFactor",{get:function(){return this.Viewer.ZoomFactor},set:function(n){this.Viewer.ZoomFactor=n},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"Document",{get:function(){return this.document},set:function(n){this._onDocumentChanged(n)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"IsDocumentLoaded",{get:function(){return this.isDocumentLoaded},set:function(n){n&&this.Document!=null&&this.Document._ClearUnlinkedFields();this.isDocumentLoaded=n},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"Selection",{get:function(){return this.selection},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"Viewer",{get:function(){return this.viewer},set:function(n){this.viewer=n;this._OnViewerChanged(this.viewer)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"IsShiftingEnabled",{get:function(){return this.isShiftingEnabled},set:function(n){this.isShiftingEnabled=n},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"IsLayoutEnabled",{get:function(){return this.isLayoutEnabled},set:function(n){this.isLayoutEnabled=n},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"IsPastingContent",{get:function(){return this.isPastingContent},set:function(n){this.isPastingContent=n},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"History",{get:function(){return this.history},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"StackSize",{get:function(){return this.stackSize},set:function(n){this.stackSize=n},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"DisableHistory",{get:function(){return this.disableHistory},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"LayoutType",{get:function(){return this.layoutType},set:function(n){this.layoutType=n},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"IsReadOnly",{get:function(){return this.isReadOnly},set:function(n){this.isReadOnly=n;this.Viewer._ShowCaret(!1);this.Selection._UpdateFocus()},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"IsReadOnlyMode",{get:function(){return this.isReadOnly||this.isReadOnlyInternal},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"IsReadOnlyInternal",{get:function(){return this.isReadOnlyInternal},set:function(n){this.isReadOnlyInternal=n},enumerable:!0,configurable:!0}),n.prototype._AddSearchResultItems=function(n){n!=null&&n!=""&&(this.findResultsList==null&&(this.findResultsList=new h),this.findResultsList._Add(n))},n.prototype._ClearSearchResultItems=function(){this.findResultsList!=null&&this.findResultsList._Clear()},n.prototype._OnViewerChanged=function(){this.Selection.Start!=null&&(this.Selection._UpdatePhysicalPosition(),this.Selection._FireSelectionChanged(!0))},n.prototype._RaiseClientEvent=function(n,t){this.DocumentEditor._raiseClientEvent(n,t)},n.prototype._InsertComment=function(){this.Selection._InsertComment()},n.prototype._DeleteAllComments=function(){this.Selection._DeleteAllComments()},n.prototype._DeleteComment=function(){var n=this.Selection;n._DeleteComment(n.Start.Paragraph._GetOwnerComment())},n.prototype._NavigateNextComment=function(){this.Selection._NavigateNextComment()},n.prototype._NavigatePreviousComment=function(){this.Selection._NavigatePreviousComment()},n.prototype._CanAddNewComment=function(){return!this.IsReadOnlyMode&&this.LayoutType==pi.Pages&&this.Selection!=null&&!this.Selection.IsCleared&&!this.Selection._IsInComment()?!0:!1},n.prototype._CanDeleteComment=function(){return!this.IsReadOnlyMode&&this.Selection!=null&&!this.Selection.IsCleared&&this.Selection._IsInComment()||this.Document!=null&&this.Document.Comments.Count>0?!0:!1},n.prototype._CanNavigateToPrevComment=function(){if(this.Selection!=null&&this.Document!=null&&!this.Selection.IsCleared&&this.Selection._IsInComment()){var n=this.Selection.Start.Paragraph._GetOwnerComment(),t=null,i=this.Document.Comments._IndexOf(n);if(i>0&&(n=this.Document.Comments[i-1],t=n._GetFirstParagraph(),t!=null))return!0}return!1},n.prototype._CanNavigateToNextComment=function(){if(this.Selection!=null&&!this.Selection.IsCleared&&this.Document!=null&&this.Selection._IsInComment()){var n=this.Selection.Start.Paragraph._GetOwnerComment(),t=null,i=this.Document.Comments._IndexOf(n);if(i<this.Document.Comments.Count-1&&(n=this.Document.Comments[i+1],t=n._GetFirstParagraph(),t!=null))return!0}return!1},n.prototype._CanInsertHyperlink=function(){return this.Document!=null&&this.IsDocumentLoaded&&!this.Selection._CanMergeSelectedCells()&&this.Selection!=null?!0:!1},n.prototype._GetDocumentStart=function(){var n=this.Document.DocumentStart;return n==null?"0;0;0":n._GetHierarchicalIndexInternal()},n.prototype._GetDocumentEnd=function(){var n=this.Document.DocumentEnd;return n==null?"0;0;1":n._GetHierarchicalIndexInternal()},n.prototype._Paste=function(){this.viewer._OnPasteMenuClick()},n.prototype._Print=function(){this.viewer._Print()},n.prototype._FitPage=function(n){this.viewer.PageFitType=n},n.prototype._FireRequestNavigate=function(n){var t=new nf(n),i=new ce(t);this._RaiseClientEvent(kr.RequestNavigate,i)},n.prototype._onDocumentChanged=function(n){this.document!=null&&this.document._Dispose();this.history!=null&&this.history._Dispose();this.document=n;this.IsDocumentLoaded=!0;this.document!=null&&(this.document.OwnerControl=this,this.document._LayoutItems(this.viewer));this.PageCount=this.Viewer.Pages.Count>0?this.viewer.Pages.Count:1;this.Selection!=null&&(this.Selection.EditingContext.Type=rf.Text);this._RaiseClientEvent(kr.DocumentChange,null);this.viewer._ShowHideOptionsPane(!1)},n.prototype._InitDocumentLoad=function(){this.IsDocumentLoaded=!1;this.viewer._ClearContainer()},n.prototype._parseDocumentInternal=function(n){var t=new ti(null),i,r;return n.BackgroundColor!=null&&n.BackgroundColor!=undefined&&(t.BackgroundColor=n.BackgroundColor),n.hasOwnProperty("CharacterFormat")&&n.CharacterFormat!=undefined&&n.CharacterFormat!=null&&this._parseCharacterFormat(n.CharacterFormat,t.CharacterFormat),i=new ni,r=new ni,this._parseSections(n.Sections,t,i,r),this._parseAbstractList(n,t),this._parseList(n,t),t},n.prototype._ParseDocument=function(n){this.Document=this._parseDocumentInternal(n);this.Selection._SelectRange(this.Document.DocumentStart,this.Document.DocumentStart,!0)},n.prototype._parseSections=function(n,t,i,r){for(var f,u=0;u<n.length;u++)f=new ct(null),this._parseSectionFormat(n[u].SectionFormat,f.SectionFormat),this._parseHeaderFooter(n[u].HeaderFooters,f.HeaderFooters,i,r),this._parseTextBody(n[u].Blocks,f.Blocks,i,r),t.Sections._Push(f)},n.prototype._parseSectionFormat=function(n,t){t.PageWidth=n.PageWidth;t.PageHeight=n.PageHeight;t.LeftMargin=n.LeftMargin;t.TopMargin=n.TopMargin;t.RightMargin=n.RightMargin;t.BottomMargin=n.BottomMargin;t.HeaderDistance=n.HeaderDistance;t.FooterDistance=n.FooterDistance;t.DifferentFirstPage=n.DifferentFirstPage;t.DifferentOddAndEvenPages=n.DifferentOddAndEvenPages},n.prototype._parseHeaderFooter=function(n,t,i,r){this._parseTextBody(n.Header.Blocks,t.Header.Blocks,i,r);this._parseTextBody(n.Footer.Blocks,t.Footer.Blocks,i,r);this._parseTextBody(n.EvenHeader.Blocks,t.EvenHeader.Blocks,i,r);this._parseTextBody(n.EvenFooter.Blocks,t.EvenFooter.Blocks,i,r);this._parseTextBody(n.FirstPageHeader.Blocks,t.FirstPageHeader.Blocks,i,r);this._parseTextBody(n.FirstPageFooter.Blocks,t.FirstPageFooter.Blocks,i,r)},n.prototype._parseTextBody=function(n,t,i,r){for(var f,e,o=0;o<n.length;o++)f=n[o],f.hasOwnProperty("Inlines")?(e=new u(null),f.hasOwnProperty("ParagraphFormat")&&this._parseParagraphFormat(f.ParagraphFormat,e.ParagraphFormat),f.hasOwnProperty("CharacterFormat")&&this._parseCharacterFormat(f.CharacterFormat,e.CharacterFormat),f.Inlines.length>0&&this._parseParagraph(f.Inlines,e,i,r),t._Push(e)):f.hasOwnProperty("Rows")&&this._parseTable(f,t,i,r)},n.prototype._parseTable=function(n,t,i,r){var o=new e(null),u,f,s,h;for(this._parseTableFormat(n.TableFormat,o.TableFormat),o.Title=n.Title,o.Description=n.Description,u=0;u<n.Rows.length;u++){if(f=new bt(null),n.Rows[u].hasOwnProperty("RowFormat"))for(this._parseRowFormat(n.Rows[u].RowFormat,f.RowFormat),f.GridBefore=n.Rows[u].GridBefore,f.GridBeforeWidth=n.Rows[u].GridBeforeWidth,f.GridAfter=n.Rows[u].GridAfter,f.GridAfterWidth=n.Rows[u].GridAfterWidth,s=0;s<n.Rows[u].Cells.length;s++)h=new ot(null),f.Cells._Push(h),n.Rows[u].Cells[s].hasOwnProperty("CellFormat")&&this._parseCellFormat(n.Rows[u].Cells[s].CellFormat,h.CellFormat),this._parseTextBody(n.Rows[u].Cells[s].Blocks,h.Blocks,i,r);o.Rows._Push(f)}o!=null&&t._Push(o)},n.prototype._parseParagraph=function(n,t,i,r){for(var u,p,h,f,v,o,c,a,e,k,w,y=0;y<n.length;y++)u=n[y],u.hasOwnProperty("Text")?(p=new s(null),u.hasOwnProperty("CharacterFormat")&&this._parseCharacterFormat(u.CharacterFormat,p.CharacterFormat),p.Text=u.Text,t.Inlines._Push(p)):u.hasOwnProperty("ImageString")?(h=new pt(null,u.IsInlineImage,u.IsMetaFile),t.Inlines._Push(h),h.ImageString=u.ImageString,h.Width=u.Width,h.Height=u.Height,u.hasOwnProperty("CharacterFormat")&&this._parseCharacterFormat(u.CharacterFormat,h.CharacterFormat)):u.hasOwnProperty("CommentId")?(f=u.CommentId,v=null,i._ContainsKey(f)&&(v=i._Get(f)),o=null,r._ContainsKey(f)&&(o=r._Get(f)),u.hasOwnProperty("CommentCharacterType")?u.CommentCharacterType==0?(c=new ir(t),o instanceof g?(c.Comment=o,o.CommentStart=c,c.Comment.CommentEnd instanceof hr&&r._Remove(f)):i._Add(f,c),t.Inlines._Push(c)):(a=new hr(t),o instanceof g?(a.Comment=o,o.CommentEnd=a,a.Comment.CommentStart instanceof ir&&r._Remove(f)):r._Add(f,a),t.Inlines._Push(a)):(e=new g(null,u.CreatedDate),e.Author=u.Author,e.Initial=u.Initial,u.hasOwnProperty("Blocks")&&this._parseTextBody(u.Blocks,e.Blocks,i,r),v instanceof ir&&(e.CommentStart=v,v.Comment=e),o instanceof hr?(e.CommentEnd=o,o.Comment=e,e.CommentStart instanceof ir?i._Remove(f):(r._Remove(f),r._Add(f,e))):r._Add(f,e),t.Inlines._Push(e))):u.hasOwnProperty("HasFieldEnd")?(k=new l(null),k.HasFieldEnd=u.HasFieldEnd,t.Inlines._Push(k)):u.hasOwnProperty("FieldCharacterType")&&(w=null,u.FieldCharacterType==1?w=new yi(null):u.FieldCharacterType==2&&(w=new b(null)),t.Inlines._Push(w))},n.prototype._parseCharacterFormat=function(n,t){n.BaselineAlignment!=undefined&&n.BaselineAlignment!=null&&(t.BaselineAlignment=n.BaselineAlignment);n.Underline!=undefined&&n.Underline!=null&&(t.Underline=n.Underline);n.StrikeThrough!=undefined&&n.StrikeThrough!=null&&(t.StrikeThrough=n.StrikeThrough);n.FontSize!=undefined&&n.FontSize!=null&&(t.FontSize=n.FontSize);n.FontFamily!=undefined&&n.FontFamily!=null&&(t.FontFamily=n.FontFamily);n.Bold!=undefined&&n.Bold!=null&&(t.Bold=n.Bold);n.Italic!=undefined&&n.Italic!=null&&(t.Italic=n.Italic);n.HighlightColor!=undefined&&n.HighlightColor!=null&&(t.HighlightColor=n.HighlightColor);n.FontColor!=undefined&&n.FontColor!=null&&(t.FontColor=n.FontColor)},n.prototype._parseListCharacterFormat=function(n,t){n!=null&&(n.BaselineAlignment!=undefined&&n.BaselineAlignment!=null&&(t.BaselineAlignment=n.BaselineAlignment),n.Underline!=undefined&&n.Underline!=null&&(t.Underline=n.Underline),n.StrikeThrough!=undefined&&n.StrikeThrough!=null&&(t.StrikeThrough=n.StrikeThrough),n.FontSize!=undefined&&n.FontSize!=null&&(t.FontSize=n.FontSize),n.FontFamily!=undefined&&n.FontFamily!=null&&(t.FontFamily=n.FontFamily),n.Bold!=undefined&&n.Bold!=null&&(t.Bold=n.Bold),n.Italic!=undefined&&n.Italic!=null&&(t.Italic=n.Italic),n.HighlightColor!=undefined&&n.HighlightColor!=null&&(t.HighlightColor=n.HighlightColor),n.FontColor!=undefined&&n.FontColor!=null&&(t.FontColor=n.FontColor))},n.prototype._parseParagraphFormat=function(n,t){n.hasOwnProperty("ListFormat")&&this._parseListFormat(n,t.ListFormat);n.LeftIndent!=undefined&&n.LeftIndent!=null&&(t.LeftIndent=n.LeftIndent);n.RightIndent!=undefined&&n.RightIndent!=null&&(t.RightIndent=n.RightIndent);n.FirstLineIndent!=undefined&&n.FirstLineIndent!=null&&(t.FirstLineIndent=n.FirstLineIndent);n.LineSpacingType!=undefined&&n.LineSpacingType!=null&&(t.LineSpacingType=n.LineSpacingType);n.LineSpacing!=undefined&&n.LineSpacing!=null&&(t.LineSpacing=n.LineSpacing);n.BeforeSpacing!=undefined&&n.BeforeSpacing!=null&&(t.BeforeSpacing=n.BeforeSpacing);n.AfterSpacing!=undefined&&n.AfterSpacing!=null&&(t.AfterSpacing=n.AfterSpacing);n.TextAlignment!=undefined&&n.TextAlignment!=null&&(t.TextAlignment=n.TextAlignment)},n.prototype._parseListFormat=function(n,t){n.ListFormat!=null&&n.ListFormat!=undefined&&n.ListFormat.ListId!=null&&n.ListFormat.ListId!=undefined&&n.ListFormat.ListLevelNumber!=null&&n.ListFormat.ListLevelNumber!=undefined&&(t.ListId=n.ListFormat.ListId,t.ListLevelNumber=n.ListFormat.ListLevelNumber)},n.prototype._parseTableFormat=function(n,t){n.Borders!=undefined&&n.Borders!=null&&this._parseBorders(n.Borders,t.Borders);n.CellSpacing!=undefined&&n.CellSpacing!=null&&(t.CellSpacing=n.CellSpacing);n.LeftMargin!=undefined&&n.LeftMargin!=null&&(t.LeftMargin=n.LeftMargin);n.TopMargin!=undefined&&n.TopMargin!=null&&(t.TopMargin=n.TopMargin);n.RightMargin!=undefined&&n.RightMargin!=null&&(t.RightMargin=n.RightMargin);n.BottomMargin!=undefined&&n.BottomMargin!=null&&(t.BottomMargin=n.BottomMargin);n.LeftIndent!=undefined&&n.LeftIndent!=null&&(t.LeftIndent=n.LeftIndent);n.Shading!=undefined&&n.Shading!=null&&this._parseShading(n.Shading,t.Shading);n.TableAlignment!=undefined&&n.TableAlignment!=null&&(t.TableAlignment=n.TableAlignment);n.PreferredWidth!=undefined&&n.PreferredWidth!=null&&(t.PreferredWidth=n.PreferredWidth);n.PreferredWidthType!=undefined&&n.PreferredWidthType!=null&&(t.PreferredWidthType=n.PreferredWidthType)},n.prototype._parseShading=function(n,t){n.BackgroundColor!=null&&n.BackgroundColor!=undefined&&(t.BackgroundColor=n.BackgroundColor);n.ForegroundColor!=null&&n.ForegroundColor!=undefined&&(t.ForegroundColor=n.ForegroundColor);n.TextureStyle!=null&&n.TextureStyle!=undefined&&(t.TextureStyle=n.TextureStyle)},n.prototype._parseBorder=function(n,t){n.Color!=null&&n.Color!=undefined&&(t.Color=n.Color);n.LineStyle!=null&&n.LineStyle!=undefined&&(t.LineStyle=n.LineStyle);n.LineWidth!=null&&n.LineWidth!=undefined&&(t.LineWidth=n.LineWidth);n.HasNoneStyle!=null&&n.HasNoneStyle!=undefined&&(t.HasNoneStyle=n.HasNoneStyle)},n.prototype._parseBorders=function(n,t){this._parseBorder(n.Left,t.Left);this._parseBorder(n.Right,t.Right);this._parseBorder(n.Top,t.Top);this._parseBorder(n.Bottom,t.Bottom);this._parseBorder(n.Vertical,t.Vertical);this._parseBorder(n.Horizontal,t.Horizontal);this._parseBorder(n.DiagonalDown,t.DiagonalDown);this._parseBorder(n.DiagonalUp,t.DiagonalUp)},n.prototype._parseCellFormat=function(n,t){n.Borders!=undefined&&n.Borders!=null&&this._parseBorders(n.Borders,t.Borders);n.IsSamePaddingAsTable||this._parseCellMargin(n,t);n.CellWidth!=undefined&&n.CellWidth!=null&&(t.CellWidth=n.CellWidth);n.ColumnSpan!=undefined&&n.ColumnSpan!=null&&(t.ColumnSpan=n.ColumnSpan);n.RowSpan!=undefined&&n.RowSpan!=null&&(t.RowSpan=n.RowSpan);n.Shading!=undefined&&n.Shading!=null&&this._parseShading(n.Shading,t.Shading);n.VerticalAlignment!=undefined&&n.VerticalAlignment!=null&&(t.VerticalAlignment=n.VerticalAlignment);n.PreferredWidthType!=undefined&&n.PreferredWidthType!=null&&(t.PrefferedWidthType=n.PreferredWidthType);n.PreferredWidth!=undefined&&n.PreferredWidth!=null&&(t.PrefferedWidth=n.PreferredWidth)},n.prototype._parseCellMargin=function(n,t){n.LeftMargin!=undefined&&n.LeftMargin!=null&&(t.LeftMargin=n.LeftMargin);n.RightMargin!=undefined&&n.RightMargin!=null&&(t.RightMargin=n.RightMargin);n.TopMargin!=undefined&&n.TopMargin!=null&&(t.TopMargin=n.TopMargin);n.BottomMargin!=undefined&&n.BottomMargin!=null&&(t.BottomMargin=n.BottomMargin)},n.prototype._parseRowFormat=function(n,t){n.AllowBreakAcrossPages!=undefined&&n.AllowBreakAcrossPages!=null&&(t.AllowBreakAcrossPages=n.AllowBreakAcrossPages);n.IsHeader!=undefined&&n.IsHeader!=null&&(t.IsHeader=n.IsHeader);n.Height!=undefined&&n.Height!=null&&(t.Height=n.Height);n.HeightType!=undefined&&n.HeightType!=null&&(t.HeightType=n.HeightType);n.Borders!=undefined&&n.Borders!=null&&this._parseBorders(n.Borders,t.Borders)},n.prototype._parseAbstractList=function(n,t){for(var r,u,f,i=0;i<n.AbstractLists.length;i++)for(r=new nr(null),t.AbstractLists._Push(r),r.AbstractListId=n.AbstractLists[i].AbstractListId,r.Name=n.AbstractLists[i].Name,r.ListType=n.AbstractLists[i].ListType,u=0;u<n.AbstractLists[i].Levels.length;u++)f=this._parseListLevel(n.AbstractLists[i].Levels[u]),r.Levels._Push(f)},n.prototype._parseList=function(n,t){for(var r,i=0;i<n.Lists.length;i++)r=new fr(null),r.AbstractListId=n.Lists[i].AbstractListId,t.Lists._Push(r),r.ListId=t.Lists.length-1,n.Lists[i].hasOwnProperty("LevelOverrides")&&this._parseLevelOverride(n.Lists[i].LevelOverrides,r)},n.prototype._parseLevelOverride=function(n,t){var i,r,u;if(n!=null&&n!=undefined)for(i=0;i<n.length;i++)r=new dr(null),u=n[i],r.StartAt=u.StartAt,r.LevelNumber=u.LevelNumber,n[i].OverrideListLevel!=null&&(r.OverrideListLevel=this._parseListLevel(u.OverrideListLevel)),t.LevelOverrides._Push(r)},n.prototype._parseListLevel=function(n){var t=new lt(null);return n.ListLevelPattern==c.Bullet?(t.ListLevelPattern=c.Bullet,t.NumberFormat=n.NumberFormat):(t.ListLevelPattern=n.ListLevelPattern,t.StartAt=n.StartAt,t.NumberFormat=n.NumberFormat,t.RestartLevel=n.RestartLevel>=0?n.RestartLevel:n.LevelNumber),t.FollowCharacter=n.FollowCharacter,this._parseListCharacterFormat(n.CharacterFormat,t.CharacterFormat),this._parseParagraphFormat(n.ParagraphFormat,t.ParagraphFormat),t},n.prototype._OnShowCommentsChanged=function(){this.Document!=null&&this.IsDocumentLoaded&&this.viewer._ShowHideComments()},n.prototype._InsertText=function(n){this.Selection._InsertText(n,!1)},n.prototype._InsertPicture=function(n,t,i){var r=new pt(null,!0,!1);r.ImageString=n;r.Width=t;r.Height=i;this.Selection._InsertImage(r)},n.prototype._Find=function(n,t){this.textSearchResults._ClearResults();var i=kt._StringToRegex(n,t);return this.Document==null||!this.isDocumentLoaded?!1:(this.Document._Find(i,t,!0,this.textSearchResults),this.textSearchResults.CurrentSearchResult!=null)?(this.textSearchResults.CurrentSearchResult._Navigate(),!0):!1},n.prototype._FindAll=function(n,t){this.textSearchResults._ClearResults();var i=kt._StringToRegex(n,t);if(this.Document!=null&&this.IsDocumentLoaded)return(this.Document._Find(i,t,!1,this.textSearchResults),this.textSearchResults.CurrentIndex<0&&this.textSearchResults.Count>0&&(this.textSearchResults.CurrentIndex=0),this.textSearchResults.CurrentSearchResult!=null)?(this.textSearchResults.CurrentSearchResult._Navigate(),this.textSearchResults):null},n.prototype._Replace=function(n,t,i){var r=0;return n==""&&n==undefined&&n==null||i==""&&i==undefined&&i==null?!1:(this._Find(n,t),this.textSearchResults.Count>0&&this.textSearchResults.CurrentSearchResult!=null)?(r=this.textSearchResults.CurrentSearchResult._Replace(i),r==1?!0:!1):!1},n.prototype._ReplaceAll=function(n,t,i){return n==""&&n==undefined&&n==null||i==""&&i==undefined&&i==null?0:(this._FindAll(n,t),this.textSearchResults.Count>0)?this.textSearchResults._ReplaceAll(i):0},n.prototype._InsertTableInBlocks=function(n,t){if(n!=0&&t!=0){var i=new e(null);i._CreateTable(n,t);this.Selection._InsertTable(i)}},n.prototype._InsertRowInTable=function(n){this.Selection._InsertRow(n)},n.prototype._InsertColumnInTable=function(n){this.Selection._InsertColumn(n)},n.prototype._DeleteTableFromBlocks=function(){this.Selection._DeleteTable()},n.prototype._DeleteColumnFromTable=function(){this.Selection._DeleteColumn()},n.prototype._DeleteRowFromTable=function(){this.Selection._DeleteRow()},n.PropertyUnsetValue="UnsetValue",n}();t.DocumentEditorHelper=di;v=function(){function n(){}return n._Round=function(n,t){for(var i=n,r=0;r<t;r++)i=i*10;for(i=Math.round(i),r=0;r<t;r++)i=i/10;return i},n}();t.MathHelper=v;ft=function(){function n(){}return Object.defineProperty(n,"ParagraphMark",{get:function(){return"¶"},enumerable:!0,configurable:!0}),n._GetParagraphMarkSize=function(t){var r=n._GetWidth(this.ParagraphMark,t),i=n._GetHeight(t);return{Width:r,Height:i.Height,BaselineOffset:i.BaselineOffset}},n._GetTextSize=function(t,i){t.Width=n._GetWidth(t.Text,i);var r=n._GetHeight(i);t.Height=r.Height;t.BaselineOffset=r.BaselineOffset},n._UpdateTextSize=function(t){var i=t.ListLevel.CharacterFormat,u=t.Paragraph.CharacterFormat,r;i.FontSize=i.FontSize==11?u.FontSize:i.FontSize;i.FontFamily=i.FontFamily=="verdana"?u.FontFamily:i.FontFamily;t.Width=n._GetWidth(t.Text,i);r=n._GetHeight(i);t.Height=r.Height;t.BaselineOffset=r.BaselineOffset},n._MeasureText=function(t,i){var u=n._GetWidth(t,i),r=n._GetHeight(i);return{Width:u,Height:r.Height,BaselineOffset:r.BaselineOffset}},n._MeasureTextExcludIngSpaceAtEnd=function(t,i){var u=n._GetWidth(t.replace(/\s\s*$/,""),i),r=n._GetHeight(i);return{Width:u,Height:r.Height,BaselineOffset:r.BaselineOffset}},n._GetHeight=function(t){var e=0,o=0,i=document.createElement("span"),f,r,u,s,h;return i.id="tempSpan",i.style.whiteSpace="nowrap",i.innerText="m",n._ApplyStyle(i,t),f=document.getElementsByTagName("body"),f!=null&&f.length>0&&(r=document.createElement("div"),r.style.display="inline-block",u=document.createElement("div"),u.setAttribute("style","display:inline-block;width: 1px; height: 0px;vertical-align: baseline;"),r.appendChild(i),r.appendChild(u),document.body.appendChild(r),e=i.getBoundingClientRect().height,s=i.getBoundingClientRect().top,h=u.getBoundingClientRect().top,o=h-s,document.body.removeChild(r)),{Height:e,BaselineOffset:o}},n._GetWidth=function(n,t){var o=document.createElement("canvas"),i=o.getContext("2d"),r="",u="",f="",e=11;return r=t.Bold?"bold":"",u=t.Italic?"italic":"",f=t.FontFamily,e=t.FontSize==0?.5:t.FontSize/(t.BaselineAlignment==vt.Normal?1:1.5),i.font=r+" "+u+" "+e+"px "+f,i.measureText(n).width},n._ApplyStyle=function(n,t){if(n!=undefined&&n!=null&&t!=undefined&&t!=null){t.Bold&&(n.style.fontWeight="bold");t.Italic&&(n.style.fontStyle="italic");t.FontFamily!=""&&(n.style.fontFamily=t.FontFamily);var i=t.FontSize;i<=.5&&(i=.5);n.style.fontSize=i.toString()+"px"}},n}();t.TextHelper=ft;kt=function(){function n(){}return n._StringToRegex=function(n,t){return(t==gr.WholeWord||t==gr.CaseSensitiveWholeWord)&&(n=this.WORD_BEFORE+n+this.WORD_AFTER),new RegExp(n,t==gr.CaseSensitive||t==gr.CaseSensitiveWholeWord?"g":"ig")},n._IsPatternEmpty=function(n){var i=this.WORD_BEFORE+this.WORD_AFTER,t=n.toString();return t.length==0||t==i},n._AddCssStyle=function(n){var t=document.createElement("style");t.style.cssText?t.style.cssText=n:t.appendChild(document.createTextNode(n));document.getElementsByTagName("head")[0].appendChild(t)},n._IsVeryDark=function(n){n=n.substring(1);var t=parseInt(n.substr(0,2),16),i=parseInt(n.substr(2,2),16),r=parseInt(n.substr(4,2),16),u=(t*299+i*587+r*114)/1e3;return u<=60},n._GetHighlightColorCode=function(n){var t="#ffffff";switch(n){case gt.Yellow:t="#ffff00";break;case gt.BrightGreen:t="#00ff00";break;case gt.Turquoise:t="#00ffff";break;case gt.Pink:t="#ff00ff";break;case gt.Blue:t="#0000ff";break;case gt.Red:t="#ff0000";break;case gt.DarkBlue:t="#000080";break;case gt.Teal:t="#008080";break;case gt.Green:t="#008000";break;case gt.Violet:t="#800080";break;case gt.DarkRed:t="#800000";break;case gt.DarkYellow:t="#808000";break;case gt.Gray50:t="#808080";break;case gt.Gray25:t="#c0c0c0";break;case gt.Black:t="#000000"}return t},n._IndexOfAny=function(n,t){for(var r,i=undefined,u=0;u<t.length;u++)r=n.indexOf(t[u]),r!=-1&&i==undefined?i=r:r!=-1&&r<i&&(i=r);return i==undefined?-1:i},n._LastIndexOfAny=function(n,t){for(var r,i=n.length-1;i>=0;i--)for(r=0;r<=t.length-1;r++)if(n[i]==t[r])return i;return-1},n._GetHtmlTextAlign=function(n){switch(n){case rt.Center:return"center";case rt.Right:return"right";case rt.Justify:return"justify";default:return"left"}},n._Insert=function(n,t,i){return t>=0?[n.slice(0,t)+i+n.slice(t)].join(""):i+this},n._Remove=function(n,t){return t==0?n.substring(t+1,n.length):n.substring(0,t)+n.substring(t+1,n.length)},n._GetText=function(n,t){return this._GetTextInternal(n,t,!1)},n._GetTextInternal=function(n,t,i){var a,u,c,h,r,f;if(n!=null&&t!=null&&n.Paragraph!=null&&t.Paragraph!=null){if(n._IsAtSamePosition(t))return"";n._IsExistAfter(t)&&(a=t,t=n,n=a);var e=0,o=0,v=n.Paragraph._GetInline(n.Offset,e);if(e=v.index,u=v.inline,u instanceof l&&u.fieldEnd!=null&&(u=u.fieldSeparator!=null?u.fieldSeparator:u.fieldEnd,e=0),c=t.Paragraph._GetInline(t.Offset,o),h=c.inline,o=c.index,r="",u instanceof pt&&i&&e==0?r=k.OBJECT_CHARACTER.toString():u instanceof s&&(r=u.Text==null&&u.Text==""||u.Text.length<e?r:u.Text.substring(e)),n.Paragraph==t.Paragraph)u instanceof k&&(u==h&&u instanceof s?r=r.length<o-e?r:r.substring(0,o-e):u.NextNode instanceof k&&(r=r+u.NextNode._GetText(t.Paragraph,h,o,i)));else if(u instanceof k&&u.NextNode instanceof k)r=r+u.NextNode._GetText(t.Paragraph,null,0,i);else{for(f=n.Paragraph._GetNextParagraph(),r=r+"\r";f!=null&&f._IsEmpty();){if(r=r+"\r",f==t.Paragraph)return r;f=f._GetNextParagraph()}f==null||f._IsEmpty()||(r=r+f.Inlines[0]._GetText(t.Paragraph,h,o,i))}return t.Offset==t.Paragraph._GetEndOffset()+1&&(r=r+"\r"),r}return null},n._GetDefaultImageString=function(){return"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAIAAAADnC86AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAADQSURBVFhH7ZbRDYQgDIYZ5UZhFEdxlBuFUUhY4N7vwWtTURJz5tem8GAbTYS0/eGjWsN7hJVSAuku3c2FuyF31BvqBNu90/mLmnSRjKDbMZULt2csz/kV8hRbVjSkSZkxRC0yKcbl+6FLhttSDIV5W6vYnKeZVWkR1WyFGbhIHrAbCzPhEcL1XCvqptYMd7xXExUXM4+pT3ENe53OP5yGqJ8kDDZGpIld6E730uFR/uuDs1J6OmolQDzcUeOslJ6OWgkQD3fUOCulJ6Ome4j9AGEu0k90WN54AAAAAElFTkSuQmCC"},n.WORD_BEFORE="\\b",n.WORD_AFTER="\\b",n}();t.HelperMethods=kt;wi=function(){function n(){}return Object.defineProperty(n,"Maroon",{get:function(){return"maroon"},enumerable:!0,configurable:!0}),Object.defineProperty(n,"Red",{get:function(){return"red"},enumerable:!0,configurable:!0}),Object.defineProperty(n,"Orange",{get:function(){return"orange"},enumerable:!0,configurable:!0}),Object.defineProperty(n,"Yellow",{get:function(){return"yellow"},enumerable:!0,configurable:!0}),Object.defineProperty(n,"Olive",{get:function(){return"olive"},enumerable:!0,configurable:!0}),Object.defineProperty(n,"Fuchsia",{get:function(){return"fuchsia"},enumerable:!0,configurable:!0}),Object.defineProperty(n,"Lime",{get:function(){return"lime"},enumerable:!0,configurable:!0}),Object.defineProperty(n,"White",{get:function(){return"white"},enumerable:!0,configurable:!0}),Object.defineProperty(n,"Green",{get:function(){return"green"},enumerable:!0,configurable:!0}),Object.defineProperty(n,"Navy",{get:function(){return"navy"},enumerable:!0,configurable:!0}),Object.defineProperty(n,"Blue",{get:function(){return"blue"},enumerable:!0,configurable:!0}),Object.defineProperty(n,"Aqua",{get:function(){return"aqua"},enumerable:!0,configurable:!0}),Object.defineProperty(n,"Teal",{get:function(){return"teal"},enumerable:!0,configurable:!0}),Object.defineProperty(n,"Black",{get:function(){return"black"},enumerable:!0,configurable:!0}),Object.defineProperty(n,"Silver",{get:function(){return"silver"},enumerable:!0,configurable:!0}),Object.defineProperty(n,"Gray",{get:function(){return"gray"},enumerable:!0,configurable:!0}),Object.defineProperty(n,"Purple",{get:function(){return"purple"},enumerable:!0,configurable:!0}),Object.defineProperty(n,"XXSmall",{get:function(){return"xx-small"},enumerable:!0,configurable:!0}),Object.defineProperty(n,"XSmall",{get:function(){return"x-small"},enumerable:!0,configurable:!0}),Object.defineProperty(n,"Medium",{get:function(){return"medium"},enumerable:!0,configurable:!0}),Object.defineProperty(n,"XLarge",{get:function(){return"x-large"},enumerable:!0,configurable:!0}),Object.defineProperty(n,"XXLarge",{get:function(){return"xx-large"},enumerable:!0,configurable:!0}),Object.defineProperty(n,"Small",{get:function(){return"small"},enumerable:!0,configurable:!0}),Object.defineProperty(n,"Smaller",{get:function(){return"smaller"},enumerable:!0,configurable:!0}),Object.defineProperty(n,"Larger",{get:function(){return"bigger"},enumerable:!0,configurable:!0}),Object.defineProperty(n,"Large",{get:function(){return"large"},enumerable:!0,configurable:!0}),Object.defineProperty(n,"Underline",{get:function(){return"underline"},enumerable:!0,configurable:!0}),Object.defineProperty(n,"LineThrough",{get:function(){return"line-through"},enumerable:!0,configurable:!0}),Object.defineProperty(n,"LineHeight",{get:function(){return"line-height"},enumerable:!0,configurable:!0}),Object.defineProperty(n,"SubScript",{get:function(){return"sub"},enumerable:!0,configurable:!0}),Object.defineProperty(n,"SuperScript",{get:function(){return"super"},enumerable:!0,configurable:!0}),Object.defineProperty(n,"Font",{get:function(){return"font"},enumerable:!0,configurable:!0}),Object.defineProperty(n,"LeftIndent",{get:function(){return"left-indent"},enumerable:!0,configurable:!0}),Object.defineProperty(n,"TextIndent",{get:function(){return"text-indent"},enumerable:!0,configurable:!0}),Object.defineProperty(n,"FontFamily",{get:function(){return"font-family"},enumerable:!0,configurable:!0}),Object.defineProperty(n,"FontSize",{get:function(){return"font-size"},enumerable:!0,configurable:!0}),Object.defineProperty(n,"FontStyle",{get:function(){return"font-style"},enumerable:!0,configurable:!0}),Object.defineProperty(n,"FontWeight",{get:function(){return"font-weight"},enumerable:!0,configurable:!0}),Object.defineProperty(n,"TextDecoration",{get:function(){return"text-decoration"},enumerable:!0,configurable:!0}),Object.defineProperty(n,"TextAlign",{get:function(){return"text-align"},enumerable:!0,configurable:!0}),Object.defineProperty(n,"SubSuperScripts",{get:function(){return"vertical-align"},enumerable:!0,configurable:!0}),Object.defineProperty(n,"Background",{get:function(){return"background-color"},enumerable:!0,configurable:!0}),Object.defineProperty(n,"Color",{get:function(){return"color"},enumerable:!0,configurable:!0}),Object.defineProperty(n,"HyperlinkColor",{get:function(){return"hyperlinkcolor"},enumerable:!0,configurable:!0}),Object.defineProperty(n,"Baseline",{get:function(){return"baseline"},enumerable:!0,configurable:!0}),Object.defineProperty(n,"ListType",{get:function(){return"listType"},enumerable:!0,configurable:!0}),Object.defineProperty(n,"Margin",{get:function(){return"margin"},enumerable:!0,configurable:!0}),Object.defineProperty(n,"Border",{get:function(){return"border"},enumerable:!0,configurable:!0}),Object.defineProperty(n,"BgColor",{get:function(){return"bgcolor"},enumerable:!0,configurable:!0}),Object.defineProperty(n,"Align",{get:function(){return"align"},enumerable:!0,configurable:!0}),Object.defineProperty(n,"Cm",{get:function(){return"cm"},enumerable:!0,configurable:!0}),Object.defineProperty(n,"Mm",{get:function(){return"mm"},enumerable:!0,configurable:!0}),Object.defineProperty(n,"Px",{get:function(){return"px"},enumerable:!0,configurable:!0}),Object.defineProperty(n,"In",{get:function(){return"in"},enumerable:!0,configurable:!0}),Object.defineProperty(n,"Ex",{get:function(){return"ex"},enumerable:!0,configurable:!0}),Object.defineProperty(n,"Em",{get:function(){return"em"},enumerable:!0,configurable:!0}),Object.defineProperty(n,"Pt",{get:function(){return"pt"},enumerable:!0,configurable:!0}),Object.defineProperty(n,"Pc",{get:function(){return"pc"},enumerable:!0,configurable:!0}),Object.defineProperty(n,"Percentage",{get:function(){return"%"},enumerable:!0,configurable:!0}),n}();t.CssConstants=wi;ui=function(){function n(){}return Object.defineProperty(n,"Dot",{get:function(){return"."},enumerable:!0,configurable:!0}),Object.defineProperty(n,"OpenBrace",{get:function(){return"{"},enumerable:!0,configurable:!0}),Object.defineProperty(n,"CloseBrace",{get:function(){return"}"},enumerable:!0,configurable:!0}),Object.defineProperty(n,"Colon",{get:function(){return":"},enumerable:!0,configurable:!0}),Object.defineProperty(n,"SemiColon",{get:function(){return";"},enumerable:!0,configurable:!0}),Object.defineProperty(n,"Equal",{get:function(){return"="},enumerable:!0,configurable:!0}),Object.defineProperty(n,"Quotes",{get:function(){return'"'},enumerable:!0,configurable:!0}),Object.defineProperty(n,"LessthanSymbol",{get:function(){return"<"},enumerable:!0,configurable:!0}),Object.defineProperty(n,"GreaterthanSymbol",{get:function(){return">"},enumerable:!0,configurable:!0}),Object.defineProperty(n,"Endslash",{get:function(){return"/"},enumerable:!0,configurable:!0}),n}();t.HTMLOperators=ui;eo=function(){function n(){}return Object.defineProperty(n,"HtmlAsciiCodeTable",{get:function(){return n.htmlAsciiCodeTable==null&&(n.htmlAsciiCodeTable=new ni,n.htmlNameTable=new ni,n._AddHtmlAsciiSymbols(),n._AddHtmlNames()),n.htmlAsciiCodeTable},enumerable:!0,configurable:!0}),Object.defineProperty(n,"HtmlNameTable",{get:function(){return n.htmlNameTable==null&&(n.htmlAsciiCodeTable=new ni,n.htmlNameTable=new ni,n._AddHtmlAsciiSymbols(),n._AddHtmlNames()),n.htmlNameTable},enumerable:!0,configurable:!0}),n._AddHtmlAsciiSymbols=function(){var r=[],i,t;for(r=[" ",'""',"!","#","$","%","&","'","(",")","*"," +",", "," - ",".","/ ","0","1","2","3","4","5","6","7","8","9",":",";"," < ","="," > "," ? ","@","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","[",'"',"]","^","_","`","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","{","|","}","~"," ","¡","¢","£","¤","¥","¦","§","¨","©","ª","«","¬","","®","¯","°","±","²","³","´","µ","¶","•","¸","¹","º","»","¼","½","¾","¿","À","Á","Â","Ã","Ä","Å","Æ","Ç","È","É","Ê","Ë","Ì","Í","Î","Ï","Ð","Ñ","Ò","Ó","Ô","Õ","Ö","×","Ø","Ù","Ú","Û","Ü","Ý","Þ","ß","à","á","â","ã","ä","å","æ","ç","è","é","ê","ë","ì","í","î","ï","ð","ñ","ò","ó","ô","õ","ö","÷","ø","ù","ú","û","ü","ý","þ","ÿ","Œ","œ","Š","š","Ÿ","ƒ","–","—","‘","’","‚","“","”","„","†","‡","•","…","‰","€","™"],i=-1,t=32;t<=8482;t++)if(t>126&&t<160||t>255&&t<338||t>339&&t<352||t>353&&t<376||t>376&&t<402||t>402&&t<8211||t>8212&&t<8216||t==8219||t==8223||t>8226&&t<8230||t>8230&&t<8240||t>8240&&t<8364||t>8364&&t<8482)continue;else i++,i<r.length&&n.HtmlAsciiCodeTable._Add("&#"+t+";",r[i])},n._AddHtmlNames=function(){n.HtmlNameTable._Add(" "," ");n.HtmlNameTable._Add(" ","\t");n.HtmlNameTable._Add(" "," ");n.HtmlNameTable._Add("<","<");n.HtmlNameTable._Add(">",">");n.HtmlNameTable._Add("&","&");n.HtmlNameTable._Add(""",'"');n.HtmlNameTable._Add("¡","¡");n.HtmlNameTable._Add("¢","¢");n.HtmlNameTable._Add("£","£");n.HtmlNameTable._Add("¤","¤");n.HtmlNameTable._Add("¥","¥");n.HtmlNameTable._Add("¦","¦");n.HtmlNameTable._Add("§","§");n.HtmlNameTable._Add("¨","¨");n.HtmlNameTable._Add("©","©");n.HtmlNameTable._Add("ª","ª");n.HtmlNameTable._Add("«","«");n.HtmlNameTable._Add("¬","¬");n.HtmlNameTable._Add("®","®");n.HtmlNameTable._Add("¯","¯");n.HtmlNameTable._Add("°","°");n.HtmlNameTable._Add("±","±");n.HtmlNameTable._Add("²","²");n.HtmlNameTable._Add("³","³");n.HtmlNameTable._Add("´","´");n.HtmlNameTable._Add("µ","µ");n.HtmlNameTable._Add("¶","¶");n.HtmlNameTable._Add("·","·");n.HtmlNameTable._Add("¸","¸");n.HtmlNameTable._Add("¹","¹");n.HtmlNameTable._Add("º","º");n.HtmlNameTable._Add("»","»");n.HtmlNameTable._Add("¼","¼");n.HtmlNameTable._Add("½","½");n.HtmlNameTable._Add("¾","¾");n.HtmlNameTable._Add("¿","¿");n.HtmlNameTable._Add("À","À");n.HtmlNameTable._Add("Á","Á");n.HtmlNameTable._Add("Â","Â");n.HtmlNameTable._Add("Ã","Ã");n.HtmlNameTable._Add("Ä","Ä");n.HtmlNameTable._Add("Å","Å");n.HtmlNameTable._Add("Æ","Æ");n.HtmlNameTable._Add("Ç","Ç");n.HtmlNameTable._Add("È","È");n.HtmlNameTable._Add("É","É");n.HtmlNameTable._Add("Ê","Ê");n.HtmlNameTable._Add("Ë","Ë");n.HtmlNameTable._Add("Ì","Ì");n.HtmlNameTable._Add("Í","Í");n.HtmlNameTable._Add("Î","Î");n.HtmlNameTable._Add("Ï","Ï");n.HtmlNameTable._Add("Ð","Ð");n.HtmlNameTable._Add("Ñ","Ñ");n.HtmlNameTable._Add("Ò","Ò");n.HtmlNameTable._Add("Ó","Ó");n.HtmlNameTable._Add("Ô","Ô");n.HtmlNameTable._Add("Õ","Õ");n.HtmlNameTable._Add("Ö","Ö");n.HtmlNameTable._Add("×","×");n.HtmlNameTable._Add("Ø","Ø");n.HtmlNameTable._Add("Ù","Ù");n.HtmlNameTable._Add("Ú","Ú");n.HtmlNameTable._Add("Û","Û");n.HtmlNameTable._Add("Ü","Ü");n.HtmlNameTable._Add("Ý","Ý");n.HtmlNameTable._Add("Þ","Þ");n.HtmlNameTable._Add("ß","ß");n.HtmlNameTable._Add("à","à");n.HtmlNameTable._Add("á","á");n.HtmlNameTable._Add("â","â");n.HtmlNameTable._Add("ã","ã");n.HtmlNameTable._Add("ä","ä");n.HtmlNameTable._Add("å","å");n.HtmlNameTable._Add("æ","æ");n.HtmlNameTable._Add("ç","ç");n.HtmlNameTable._Add("è","è");n.HtmlNameTable._Add("é","é");n.HtmlNameTable._Add("ê","ê");n.HtmlNameTable._Add("ë","ë");n.HtmlNameTable._Add("ì","ì");n.HtmlNameTable._Add("í","í");n.HtmlNameTable._Add("î","î");n.HtmlNameTable._Add("ï","ï");n.HtmlNameTable._Add("ð","ð");n.HtmlNameTable._Add("ñ","ñ");n.HtmlNameTable._Add("ò","ò");n.HtmlNameTable._Add("ó","ó");n.HtmlNameTable._Add("ô","ô");n.HtmlNameTable._Add("õ","õ");n.HtmlNameTable._Add("ö","ö");n.HtmlNameTable._Add("÷","÷");n.HtmlNameTable._Add("ø","ø");n.HtmlNameTable._Add("ù","ù");n.HtmlNameTable._Add("ú","ú");n.HtmlNameTable._Add("û","û");n.HtmlNameTable._Add("ü","ü");n.HtmlNameTable._Add("ý","ý");n.HtmlNameTable._Add("þ","þ");n.HtmlNameTable._Add("ÿ","ÿ");n.HtmlNameTable._Add("Œ","Œ");n.HtmlNameTable._Add("œ","œ");n.HtmlNameTable._Add("Š","Š");n.HtmlNameTable._Add("š","š");n.HtmlNameTable._Add("Ÿ","Ÿ");n.HtmlNameTable._Add("ƒ","ƒ");n.HtmlNameTable._Add("–","–");n.HtmlNameTable._Add("—","—");n.HtmlNameTable._Add("‘","‘");n.HtmlNameTable._Add("’","’");n.HtmlNameTable._Add("“","“");n.HtmlNameTable._Add("”","”");n.HtmlNameTable._Add("„","„");n.HtmlNameTable._Add("†","†");n.HtmlNameTable._Add("‡","‡");n.HtmlNameTable._Add("•","•");n.HtmlNameTable._Add("…","…");n.HtmlNameTable._Add("‰","‰");n.HtmlNameTable._Add("™","™");n.HtmlNameTable._Add("€","€")},n.htmlAsciiCodeTable=null,n.htmlNameTable=null,n}();t.HtmlAsciiCodesInfo=eo;re=function(){function n(n){this.start=null;this.end=null;this.ownerControl=null;this.ownerControl=n;this.start=new tt(this.ownerControl);this.end=new tt(this.ownerControl)}return Object.defineProperty(n.prototype,"Start",{get:function(){return this.start},set:function(n){this.start=n},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"End",{get:function(){return this.end},set:function(n){this.end=n},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"OwnerControl",{get:function(){return this.ownerControl},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"Text",{get:function(){return kt._GetText(this.Start,this.End)},enumerable:!0,configurable:!0}),n.prototype._Navigate=function(){this.OwnerControl!=null&&this.OwnerControl.Selection!=null&&this.Start!=null&&this.End!=null&&this.Start.Paragraph!=null&&this.End.Paragraph!=null&&this.OwnerControl.Selection._SelectRange(this.Start,this.End,!0)},n.prototype._Highlight=function(){this.Start.Paragraph._HighlightSearchResult(this,this.Start,this.End)},n.prototype._CreateHighlightBorder=function(n,t,i,r){var u=null,f,s,h,e,o;this.start.Paragraph._IsInComment()&&(u=this.start.Paragraph._GetOwnerComment());f=this.OwnerControl.Viewer._AddSearchHighlightBorder(n);s=this instanceof st?this.OwnerControl.Viewer.CurrentPage:n.CurrentParagraphWidget._GetPage();u!=null&&u.LayoutedWidget!=null&&u.LayoutedWidget.RenderedElement!=null?(f.Left=Math.ceil(i)+u.LayoutedWidget.X,r=Math.ceil(r)+u.LayoutedWidget.Y):(f.Left=Math.ceil(i),r=Math.ceil(r));f.Width=Math.floor(t);h=Math.floor(n.Height);e=document.getElementById(s.Id+"_background");e!=null&&(o=e.getContext("2d"),o.fillStyle="#ffe97f",o.fillRect(f.Left,r,f.Width,h))},n.prototype._AddFindResultView=function(){var t,c;if(this.start!=null&&this.end!=null&&this.start.Paragraph!=null&&this.end.Paragraph!=null){var l=void 0,r=void 0,a=void 0,u=0,s=this.start.Paragraph._GetInline(this.start.Offset,u),v=s.inline;u=s.index;var i="",o=0,f=v._GetElementBoxInternal(u),n=f.element;if(u=f.index,n!=null)for(n instanceof it&&u>0&&(i=n.Text.substring(0,u)),t=n.CurrentLineWidget.Children._IndexOf(n);(o=i.lastIndexOf(" "))<0&&t>0&&n.CurrentLineWidget.Children[t-1]instanceof it;)i=n.CurrentLineWidget.Children[t-1].Text+i,t--;o=i.lastIndexOf(" ");l=o<0?i:i.substring(o+1);a=this.Text;var e=0,h=this.end.Paragraph._GetInline(this.end.Offset,e),y=h.inline;if(e=h.index,r="",f!=null&&(f=y._GetElementBoxInternal(e),n=f.element,e=f.index),n!=null)for(n instanceof it&&e<n.Length&&(r=n.Text.substring(e)),t=n.CurrentLineWidget.Children._IndexOf(n);t+1<n.CurrentLineWidget.Children.Count&&n.CurrentLineWidget.Children[t+1]instanceof it;)r=r+n.CurrentLineWidget.Children[t+1].Text,t++;o=r.lastIndexOf(" ");c="<li>"+i+"<b>"+this.Text+"<\/b>"+r+"<\/li>";this.ownerControl._AddSearchResultItems(c)}},n.prototype._Dispose=function(){this.Start!=null&&(this.start._Dispose(),this.Start=null);this.end!=null&&(this.end._Dispose(),this.end=null);this.ownerControl=null},n.prototype._Replace=function(n){var i,u,f,r,t,e;if(this.OwnerControl.Viewer!=null&&this.OwnerControl.Viewer._ClearSearchHighlight(),this._Navigate(),i=this.OwnerControl.Selection.Start,u=this.OwnerControl.textSearchResults._IndexOf(this),u<0)return 0;for(this.OwnerControl.Selection._InsertText(n,!0),f=this.End.Offset-(this.Start.Offset+n.length),r=u+1;r<this.OwnerControl.textSearchResults.Count;r++)if(t=this.OwnerControl.textSearchResults[r],this.end.Paragraph==t.Start.Paragraph)if(t.Start._SetPositionParagraph(t.Start.Paragraph,t.Start.Offset-f),t.Start.Paragraph==t.End.Paragraph)t.End._SetPositionParagraph(t.End.Paragraph,t.End.Offset-f);else break;else break;return e=new tt(this.OwnerControl),e._SetPositionParagraph(i.Paragraph,i.Offset-n.length),this.OwnerControl.Selection._SelectRange(i,e,!0),this.OwnerControl.textSearchResults._Remove(this),1},n}();t.TextSearchResult=re;ue=function(){function n(n){this.ownerControl=null;this.CurrentIndex=-1;this.ownerControl=n;this.innerList==new h}return Object.defineProperty(n.prototype,"OwnerControl",{get:function(){return this.ownerControl},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"Count",{get:function(){return this.innerList==null?0:this.innerList.Count},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"CurrentSearchResult",{get:function(){return this.innerList==null||this.CurrentIndex<0||this.CurrentIndex>=this.Count?null:this.innerList[this.CurrentIndex]},enumerable:!0,configurable:!0}),n.prototype._GetResult=function(n){return this.innerList==null?null:this.innerList[n]},n.prototype._AddResult=function(){var n=new re(this.ownerControl);return this.innerList==null&&(this.innerList=new h),this.innerList._Add(n),n},n.prototype._IndexOf=function(n){return this.innerList==null?-1:this.innerList._IndexOf(n)},n.prototype._ClearResults=function(){if(this.ownerControl.Viewer!=null&&(this.CurrentIndex=-1),this.innerList!=null)for(var n=this.innerList.Count-1;n>=0;n--)this.innerList[n]._Dispose(),this.innerList._RemoveAt(n)},n.prototype._Highlight=function(){this.ownerControl.Viewer.SearchHighlighters=new ni;for(var n=0;n<this.innerList.Count;n++)this.innerList[n]._Highlight()},n.prototype._AddFindResultView=function(){for(var n=0;n<this.innerList.Count;n++)this.innerList[n]._AddFindResultView()},n.prototype._Dispose=function(){this.innerList!=null&&(this._ClearResults(),this.innerList=null);this.ownerControl=null},n.prototype._RemoveAt=function(n){this.OwnerControl.Viewer!=null&&this.OwnerControl.Viewer._ClearSearchHighlight();this.Count>n&&(this.innerList[n]._Dispose(),this.innerList._RemoveAt(n))},n.prototype._Remove=function(n){this.OwnerControl.Viewer!=null&&this.OwnerControl.Viewer._ClearSearchHighlight();var t=this._IndexOf(n);n._Dispose();t>=0&&this.innerList._Remove(n)},n.prototype._ReplaceAll=function(n){return this.OwnerControl==null?0:this.OwnerControl.Selection._ReplaceAll(n)},n}();t.TextSearchResults=ue;uf=function(t){function i(n){t.call(this);this.arrayCount=n}return n(i,t),Object.defineProperty(i.prototype,"Count",{get:function(){return this.length!=undefined&&this.length!=null?this.length:0},enumerable:!0,configurable:!0}),i.prototype._Push=function(n){if(1)return this.length<this.arrayCount&&t.prototype.push.call(this,n),n},i.prototype._Pop=function(){if(1)return t.prototype.pop.call(this)},i.prototype._Clear=function(){for(var n=0;n<this.length;n++)this._Pop()},i}(Array);t.Stack=uf;h=function(t){function i(){t.apply(this,arguments)}return n(i,t),Object.defineProperty(i.prototype,"Count",{get:function(){return this.length!=undefined&&this.length!=null?this.length:0},enumerable:!0,configurable:!0}),i.prototype._Add=function(n){if(1)return t.prototype.push.call(this,n),1},i.prototype._Insert=function(n,t){if(n==this.length){this._Add(t);return}n>-1&&n<this.length&&(this._shiftItems(n,!0),this[n]=t,this.length=this.length+1)},i.prototype._Remove=function(n){var i=this.indexOf(n);return i>-1&&i<this.length?(this._shiftItems(i,!1),t.prototype.pop.call(this),!0):!1},i.prototype._RemoveAt=function(n){if(n>-1&&n<this.length){var i=this[n];return this._shiftItems(n,!1),t.prototype.pop.call(this),!0}return!1},i.prototype._Contains=function(n){var t=this.indexOf(n);return t>-1&&t<this.length},i.prototype._Clear=function(){for(var n=this.length;n>0;n--)this._RemoveAt(n-1)},i.prototype._ToList=function(){for(var t=new i,n=0;n<this.length;n++)t._Add(this[n]);return t},i.prototype._IndexOf=function(n){return this.indexOf(n)},i.prototype._First=function(){return this.length>0?this[0]:null},i.prototype._Last=function(){return this.length>0?this[this.length-1]:null},i.prototype._shiftItems=function(n,t){var i;if(t)for(i=this.length;i>n;i--)this[i]=this[i-1];else for(i=n;i<this.length-1;i++)this[i]=this[i+1]},i.prototype._Sort=function(){t.prototype.sort.call(this,function(n,t){return n-t})},i}(Array);t.List=h;ni=function(){function n(){this.keys=new h;this.values=new h}return Object.defineProperty(n.prototype,"Count",{get:function(){return this.keys.length},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"Keys",{get:function(){return this.keys._ToList()},enumerable:!0,configurable:!0}),n.prototype._Add=function(n,t){if(n==undefined||n==null||t==undefined||t==null)throw new ReferenceError("Provided key or value is not valid.");var i=this.keys.indexOf(n);if(i<0||i>this.keys.length-1)return this.keys._Add(n),this.values._Add(t),1;throw new RangeError("An item with the same key has already been added.");},n.prototype._Get=function(n){if(n==undefined||n==null)throw new ReferenceError("Provided key is not valid.");var t=this.keys.indexOf(n);if(t<0||t>this.keys.length-1)throw new RangeError("No item with the specified key has been added.");else return this.values[t]},n.prototype._Set=function(n,t){if(n==undefined||n==null)throw new ReferenceError("Provided key is not valid.");var i=this.keys.indexOf(n);if(i<0||i>this.keys.length-1)throw new RangeError("No item with the specified key has been added.");else this.values[i]=t},n.prototype._Remove=function(n){if(n==undefined||n==null)throw new ReferenceError("Provided key is not valid.");var t=this.keys.indexOf(n);if(t<0||t>this.keys.length-1)throw new RangeError("No item with the specified key has been added.");else return this.keys._RemoveAt(t),this.values._RemoveAt(t),!0},n.prototype._ContainsKey=function(n){if(n==undefined||n==null)throw new ReferenceError("Provided key is not valid.");var t=this.keys.indexOf(n);return t<0||t>this.keys.length-1?!1:!0},n.prototype._Clear=function(){this.keys._Clear();this.values._Clear()},n}();t.Dictionary=ni;fe=function(t){function i(){t.apply(this,arguments);this.maxBaseLineOffset=0;this.maxTextElementHeight=Number.NaN;this.maxTextElementBaselineOffset=0;this.SkipClipImage=!1}return n(i,t),Object.defineProperty(i.prototype,"MaxBaselineOffset",{get:function(){return this.maxBaseLineOffset},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"MaxTextElementHeight",{get:function(){return this.maxTextElementHeight},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"MaxTextElementBaselineOffset",{get:function(){return this.maxTextElementBaselineOffset},enumerable:!0,configurable:!0}),i.prototype.push=function(n){return this._Add(n)},i.prototype._Add=function(n){if(n!=undefined&&n!=null)return t.prototype.push.call(this,n),this._UpdateMaxElementHeight(n),1},i.prototype._Insert=function(n,t){if(n==this.length){this._Add(t);return}n>-1&&n<this.length&&(this._shiftItems(n,!0),this[n]=t,this.length=this.length+1,this._UpdateMaxElementHeight(t))},i.prototype._Remove=function(n){var i=this.indexOf(n);return i>-1&&i<this.length?(this._shiftItems(i,!1),t.prototype.pop.call(this),!0):!1},i.prototype._RemoveAt=function(n){if(n>-1&&n<this.length){var i=this[n];return this._shiftItems(n,!1),t.prototype.pop.call(this),!0}return!1},i.prototype._Contains=function(n){var t=this.indexOf(n);return t>-1&&t<this.length},i.prototype._ToList=function(){for(var t=new h,n=0;n<this.length;n++)t._Add(this[n]);return t},i.prototype._Clear=function(){t.prototype._Clear.call(this);this.maxBaseLineOffset=0;this.maxTextElementHeight=Number.NaN;this.maxTextElementBaselineOffset=0;this.SkipClipImage=!1},i.prototype._UpdateMaxElement=function(){this.maxBaseLineOffset=0;this.maxTextElementHeight=Number.NaN;this.maxTextElementBaselineOffset=0;for(var n=0;n<this.Count;n++)this._UpdateMaxElementHeight(this[n])},i.prototype._UpdateMaxElementHeight=function(n){n instanceof it||n instanceof dt?(isNaN(this.maxTextElementHeight)&&(this.maxTextElementHeight=0),this.maxTextElementHeight<n.Height&&(this.maxTextElementHeight=n.Height,this.maxTextElementBaselineOffset=n instanceof it?n.BaselineOffset:n.BaselineOffset),this.maxBaseLineOffset<this.maxTextElementBaselineOffset&&(this.maxBaseLineOffset=this.maxTextElementBaselineOffset)):this.maxBaseLineOffset<n.Height&&(this.maxBaseLineOffset=n.Height)},i}(h);t.ElementCollection=fe;fi=function(){function n(n){this.ownerBase=n;this._UpdateListId()}return Object.defineProperty(n.prototype,"OwnerBase",{get:function(){return this.ownerBase},enumerable:!0,configurable:!0}),n.prototype._SetOwner=function(n){this.ownerBase=n;this._UpdateListId()},n.prototype._SetOwnerBase=function(n){this.ownerBase=n;this._UpdateListId()},n.prototype._UpdateListId=function(){var i,t,r,n;if(this instanceof fr&&this.ownerBase instanceof ti){if(t=this,t.ListId<0){for(i=this.ownerBase,n=i.Lists.Count+1;i._GetListByID(n)!=null;)n+=1;t.ListId=n}}else if(this instanceof nr&&this.ownerBase instanceof ti&&(t=this,t.AbstractListId<0)){for(r=this.ownerBase,n=r.AbstractLists.Count+1;r._GetAbstractListAdvByID(n)!=null;)n+=1;t.AbstractListId=n}},n}();t.BaseNode=fi;sr=function(t){function i(n){t.call(this,n)}return n(i,t),Object.defineProperty(i.prototype,"Owner",{get:function(){return this.OwnerBase},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"NextNode",{get:function(){return this.Owner instanceof g&&this.Owner.Blocks!=null?this.Owner.Blocks._GetNextNode(this):this.Owner instanceof yt?this.Owner.ChildNodes._GetNextNode(this):null},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"PreviousNode",{get:function(){return this.Owner instanceof g&&this.Owner.Blocks!=null?this.Owner.Blocks._GetPreviousNode(this):this.Owner instanceof yt?this.Owner.ChildNodes._GetPreviousNode(this):null},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"IsComposite",{get:function(){return this instanceof yt},enumerable:!0,configurable:!0}),i.prototype._SetOwner=function(n){var t,i;this.OwnerBase!=n&&this.OwnerBase instanceof yt&&(this instanceof y&&(t=this,t._IsLinkedFieldCharacter()&&t._UnlinkFieldCharacter("",!1),this.OwnerBase._RemoveFieldCharacter(t),t._CheckUnlinkFieldCharacter("",!1)),this instanceof g&&(i=this,this.OwnerBase._RemoveCommentAdv(i)),this.OwnerBase.ChildNodes._Contains(this)&&this.OwnerBase.ChildNodes._Remove(this));this._SetOwnerBase(n);n instanceof yt&&(this instanceof y&&n._AttachFieldCharacter(this),this instanceof g&&(i=this,n._AddCommentAdv(i)))},i.prototype._IsInComment=function(){for(var n=this;n.Owner instanceof i;){if(n=n.Owner,n instanceof g)return!0;if(n instanceof ct||n instanceof d)return!1}return!1},i.prototype._GetOwnerComment=function(){for(var n=this;n.Owner instanceof i;)if(n=n.Owner,n instanceof g)return n;return null},i.prototype._GetIndexInOwnerCollection=function(){if(this.Owner instanceof g)return this.Owner.Blocks._IndexOf(this);var n=this.Owner;return n!=null?n.ChildNodes.indexOf(this):-1},i.prototype._GetTopLevelOwner=function(){for(var n=this;n.Owner instanceof i;)if(n=n.Owner,n instanceof ti)break;return n},i.prototype._GetOwnerDocument=function(){return this._GetTopLevelOwner()},i}(fi);t.Node=sr;yt=function(t){function i(n){t.call(this,n);this.Fields=new h;this.FieldCharacter=new h;this.Comments=new h}return n(i,t),i.prototype._SetOwner=function(n){this.OwnerBase!=n&&this.OwnerBase instanceof i&&(this.Fields.Count>0&&this.OwnerBase._RemoveFields(this),this.Comments.Count>0&&this.OwnerBase._RemoveComment(this),this.FieldCharacter.Count>0&&this.OwnerBase._RemoveFieldCharacter(this),this.OwnerBase.ChildNodes._Contains(this)&&this.OwnerBase.ChildNodes._Remove(this));this._SetOwnerBase(n);n instanceof i&&(this.FieldCharacter.Count>0&&this.Owner._AttachFieldCharacter(this),this.Fields.Count>0&&n._AddFields(this),this.Comments.Count>0&&n._AddComment(this))},i.prototype._AddComment=function(n){var i,t;if(!(n instanceof d))for(i=n._GetIndexInOwnerCollection(),t=0;t<n.Comments.Count;t++)this._AddCommentAdv(n.Comments[t])},i.prototype._AddCommentAdv=function(n){var e=this,u,r,t,f;if(!this.Comments._Contains(n))if(this.Comments.Count==0)this.Comments._Add(n);else{for(u=n.OwnerParagraph._GetHierarchicalIndex(""),r=!1,t=0;t<this.Comments.Count;t++)if(f=this.Comments[t].OwnerParagraph._GetHierarchicalIndex(""),f.localeCompare(u)>0){r=!0;this.Comments._Insert(t,n);break}r||this.Comments._Add(n)}this.Owner instanceof i&&!(this instanceof d)&&this.Owner._AddCommentAdv(n);this instanceof ti&&e.OwnerControl!=null&&this._CommentCollectionChanged()},i.prototype._CommentCollectionChanged=function(){var n=this;n.OwnerControl.ShowComments&&n.OwnerControl._OnShowCommentsChanged()},i.prototype._RemoveComment=function(n){var u,t,r,i;if(!(n instanceof d))for(u=n._GetHierarchicalIndex(""),t=0;t<n.Comments.Count;t++)r=n.Comments[t],i=n.Comments.Count,this._RemoveCommentAdv(r),i>n.Comments.Count&&(t-=i-n.Comments.Count),t<-1&&(t=-1)},i.prototype._RemoveCommentAdv=function(n){var t=this;t.Comments._Remove(n);t.Owner instanceof i&&!(t instanceof d)&&t.Owner._RemoveCommentAdv(n);t instanceof ti&&t.OwnerControl!=null&&this._CommentCollectionChanged()},i.prototype._RemoveField=function(n){this.Fields._Remove(n);this.Owner instanceof i&&!(this instanceof d)&&this.Owner._RemoveField(n)},i.prototype._RemoveFields=function(n){var r,t,i,u;if(!(n instanceof d))for(r=n._GetHierarchicalIndex(""),t=0;t<n.Fields.Count;t++)i=n.Fields[t],u=n.Fields.Count,i._IsUnlinkFieldCharacters(r)&&i._UnlinkFieldCharacter(r,!0),this._RemoveField(i),u>n.Fields.Count&&(t-=u-n.Fields.Count),t<-1&&(t=-1)},i.prototype._ClearUnlinkedFields=function(){var i=this._GetOwnerDocument(),t,n;if(i!=null)for(t=0;t<this.FieldCharacter.Count;t++)n=this.FieldCharacter[t],n.OwnerParagraph!=null&&n.OwnerParagraph.Inlines!=null&&n.OwnerParagraph.Inlines._Contains(n)&&n.OwnerParagraph.Inlines._Remove(n),this.FieldCharacter._Remove(n),t--},i.prototype._AttachFieldCharacter=function(n){var t,r,u;if(n instanceof y)this._LinkFieldCharacters(n,n)||this._AddFieldCharacter(n);else if(n instanceof i){if(n instanceof d)return;for(t=0;t<n.FieldCharacter.Count;t++)r=n.FieldCharacter.Count,u=n.FieldCharacter[t],this._LinkFieldCharacters(u,n)?(r>n.FieldCharacter.Count&&(t-=r-n.FieldCharacter.Count),t<-1&&(t=-1)):this._AddFieldCharacter(u)}},i.prototype._LinkFieldCharacters=function(n,t){var f={nestingLevel:0},r,i,u;if(n instanceof l){if(r=n,r.fieldEnd==null&&this._LinkFieldTraversingForward(r,f,t),r.fieldEnd!=null)return r._AddToLinkedFields(),!0}else if(n instanceof yi){if(i=n,i.fieldBegin==null&&this._LinkFieldTraversingBackward(i,f,t),i.fieldBegin!=null&&(i.fieldEnd==null&&this._LinkFieldTraversingForward(i.fieldBegin,f,t)&&(i.fieldEnd=i.fieldBegin.fieldEnd),i.fieldEnd!=null))return i.fieldBegin._AddToLinkedFields(),!0}else if(n instanceof b&&(u=n,u.fieldBegin==null&&this._LinkFieldTraversingBackward(u,f,t),u.fieldBegin!=null))return u.fieldBegin._AddToLinkedFields(),!0;return!1},i.prototype._LinkFieldTraversingForward=function(n,t,r){var e=0,f,u,o;for(this.ChildNodes.indexOf(r)!=-1&&(e=this.ChildNodes.indexOf(r)+1),f=e;f<this.ChildNodes.length;f++)if(u=this.ChildNodes[f],u instanceof i){if(o=u._LinkFieldTraversingForward(n,t,null),n.fieldEnd!=null||o)return!0}else if(u instanceof y)if(u instanceof l&&n!=u&&t.nestingLevel++,u instanceof b){if(t.nestingLevel==0)return u.fieldBegin==null&&(n.fieldEnd=u),n.fieldEnd!=null;t.nestingLevel--}else if(t.nestingLevel==0&&n.fieldSeparator==null&&u instanceof yi)if(u.fieldBegin==null){if(n.fieldSeparator=u,u.fieldEnd!=null)return n.fieldEnd=u.fieldEnd,!0}else return!1;return this.Owner instanceof i&&!(this instanceof d)?this.Owner._LinkFieldTraversingForward(n,t,this):!0},i.prototype._LinkFieldTraversingBackward=function(n,t,r){var f,s,o,e,u,h;if(n instanceof b){for(f=n,o=this.ChildNodes.length-1,this.ChildNodes.indexOf(r)!=-1&&(o=this.ChildNodes.indexOf(r)-1),e=o;e>=0;e--)if(u=this.ChildNodes[e],u instanceof i){if(h=u._LinkFieldTraversingBackward(f,t,null),f.fieldBegin!=null||h)return!0}else if(u instanceof y)if(u instanceof b&&f!=u&&t.nestingLevel++,u instanceof l){if(t.nestingLevel==0)return u.fieldEnd==null&&(f.fieldBegin=u),f.fieldBegin!=null;t.nestingLevel--}else if(t.nestingLevel==0)if(u.fieldEnd==null){if(f.fieldSeparator=u,u.fieldBegin!=null)return f.fieldBegin=u.fieldBegin,!0}else return!1;return this.Owner instanceof i&&!(this instanceof d)?this.Owner._LinkFieldTraversingBackward(f,t,this):!0}if(n instanceof yi){for(s=n,o=this.ChildNodes.length-1,this.ChildNodes.indexOf(r)!=-1&&(o=this.ChildNodes.indexOf(r)-1),e=o;e>=0;e--)if(u=this.ChildNodes[e],u instanceof i){if(h=u._LinkFieldTraversingBackward(s,t,null),s.fieldBegin!=null||h)return!0}else if(u instanceof y)if(u instanceof b&&t.nestingLevel++,u instanceof l){if(t.nestingLevel==0)return u.fieldSeparator==null&&(s.fieldBegin=u),s.fieldBegin!=null;t.nestingLevel--}else if(t.nestingLevel==0)return!1;return this.Owner instanceof i&&!(this instanceof d)?this.Owner._LinkFieldTraversingBackward(s,t,this):!0}},i.prototype._AddFields=function(n){if(n instanceof l)this.Fields._Add(n),this.Owner instanceof i&&!(this instanceof d)&&this.Owner._AddFields(n);else if(n instanceof i){if(n instanceof d)return;for(var t=0;t<n.Fields.Count;t++)this._AddFields(n.Fields[t])}},i.prototype._AddFieldCharacter=function(n){if(n instanceof y)this.FieldCharacter._Add(n),this.Owner instanceof i&&!(this instanceof d)&&this.Owner._AddFieldCharacter(n);else if(n instanceof i){if(n instanceof d)return;for(var t=0;t<n.FieldCharacter.Count;t++)this._AddFieldCharacter(n.FieldCharacter[t])}},i.prototype._RemoveFieldCharacter=function(n){var f,t,r,u;if(n instanceof y)this.FieldCharacter._Contains(n)&&(this.FieldCharacter._Remove(n),this.Owner instanceof i&&!(this instanceof d)&&this.Owner._RemoveFieldCharacter(n));else if(n instanceof i){if(n instanceof d)return;for(f=n._GetHierarchicalIndex(""),t=0;t<n.FieldCharacter.Count;t++)r=n.FieldCharacter[t],u=n.FieldCharacter.Count,r._CheckUnlinkFieldCharacter(f,!0),this._RemoveFieldCharacter(r),u>n.FieldCharacter.Count&&(t-=u-n.FieldCharacter.Count),t<-1&&(t=-1)}},i.prototype._GetHierarchicalIndex=function(n){if(this.Owner instanceof i&&(n=this instanceof gu?"HF;"+n:this._GetIndexInOwnerCollection()+";"+n,!(this.Owner instanceof ti)))return this.Owner._GetHierarchicalIndex(n);if(this.Owner instanceof g){var t=this;n=this.Owner._GetHierarchialIndex(t instanceof hi?t:null)+n}return n},i.prototype._GetFieldCode=function(n,t,r,u){var e="",h=0,o,f;for(this.ChildNodes._Contains(u)&&(h=this.ChildNodes._IndexOf(u)+1),o=h;o<this.ChildNodes.Count;o++)if(f=this.ChildNodes[o],f instanceof i){if(e+=f._GetFieldCode(n,t,r,null),r)return e}else if(f instanceof y){if(f instanceof l&&(t=n.fieldEnd!=null&&n!=f),f instanceof b){if(n.fieldEnd==f)return r=!0,e;t=!1}else if(f instanceof yi){if(n.fieldSeparator==f)return r=!0,e;t=!1}}else f instanceof s&&!t&&(e+=f.Text);return this.Owner instanceof i&&!(this instanceof d)&&(e+=this.Owner._GetFieldCode(n,t,r,this)),e},i.prototype._GetHyperlinkField=function(n,t){for(var u,r=0;r<this.Fields.length;r++){if(t._Contains(this.Fields[r])||this.Fields[r].fieldSeparator==null)continue;else t._Add(this.Fields[r]);if(u=this.Fields[r]._GetFieldCode(),u=u.trim().toLowerCase(),u.match("hyperlink ")&&this.Fields[r]._InlineIsInFieldResult(n))return this.Fields[r]}return this.Owner instanceof i&&!(this instanceof d)?this.Owner._GetHyperlinkField(n,t):null},i.prototype._GetHyperlinkFields=function(n,t){for(var u,r=0;r<this.Fields.length;r++){if(t._Contains(this.Fields[r])||this.Fields[r].fieldSeparator==null)continue;else t._Add(this.Fields[r]);if(u=this.Fields[r]._GetFieldCode(),u=u.trim().toLowerCase(),u.match("hyperlink ")&&this.Fields[r]._ParagraphIsInFieldResult(n))return this.Fields[r]}return this.Owner instanceof i&&!(this instanceof d)?this.Owner._GetHyperlinkFields(n,t):null},i.prototype._GetBlock=function(n){var r,f,s,c,e,l,t;if(n==""||n==undefined)return null;if(r=n.indexOf(";"),f=n.substring(0,r),n=n.substring(r).replace(";",""),s=this,s instanceof ti&&f.lastIndexOf("C",0)>0)return f=f.substring(1),c=parseInt(f),t=s.Comments[c].Blocks._GetBlock(n),{node:t!=null?t.node:null,position:t!=null?t.position:null};if(s instanceof ct&&f=="HF")return t=s.HeaderFooters._GetBlock(n),{node:t!=null?t.node:null,position:t!=null?t.position:null};if(r=parseInt(f),r>=0&&r<this.ChildNodes.Count)if(e=this.ChildNodes[r],n.indexOf(";")>=0){if(e instanceof u){if(n.indexOf("C;")>=0){l=e;r=n.indexOf(";");f=n.substring(0,r);n=n.substring(r+2).replace(";","");var h=0,a=l._GetInline(parseInt(f),h),o=a.inline;return h=a.index,h==o.Length&&(o=o.NextNode instanceof k?o.NextNode:null),o!=null&&(t=o.Blocks._GetBlock(n)),{node:t!=null?t.node:null,position:t!=null?t.position:null}}return n.indexOf(";")>=0&&(n="0"),{node:e,position:n}}if(e instanceof i)return t=e._GetBlock(n),{node:t!=null?t.node:null,position:t!=null?t.position:null}}else return{node:e,position:n}},i.prototype._GetParagraph=function(n){var r,h;if(n.Index==null||n.Index==undefined)return null;var l=this,t=n.Index.indexOf(";"),f="0";if(t>=0&&(f=n.Index.substring(0,t),n.Index=n.Index.substring(t).replace(";","")),this instanceof ct&&f=="HF")return l.HeaderFooters._GetParagraph(n);if(t=parseInt(f),this instanceof bt&&t>=this.ChildNodes.Count&&(n.Index="0;0",t=this.ChildNodes.Count-1),t>=0&&t<this.ChildNodes.Count){if(r=this.ChildNodes[t],r instanceof u){if(n.Index.indexOf("C;")>0){h=r;t=n.Index.indexOf(";");f=n.Index.substring(0,t);n.Index=n.Index.substring(t+2).replace(";","");var s=0,c=h._GetInline(parseFloat(f),s),o=c.inline;return s=c.index,s==o.Length&&(o=o.NextNode),o.Blocks._GetParagraph(n)}return n.Index.indexOf(";")>0&&(n.Index="0"),r}if(r instanceof i)return n.Index.indexOf(";")>0?r._GetParagraph(n):r instanceof e?r._GetFirstParagraphInFirstCell():null}else if(this.NextNode instanceof i)return(n.Index="0",this.NextNode instanceof e)?this.NextNode._GetFirstParagraphInFirstCell():this.NextNode;return null},i}(sr);t.CompositeNode=yt;ff=function(t){function i(){t.apply(this,arguments);this.notifyCollectionChanged=!1}return n(i,t),Object.defineProperty(i.prototype,"NotifyCollectionChanged",{get:function(){return this.notifyCollectionChanged},set:function(n){this.notifyCollectionChanged=n},enumerable:!0,configurable:!0}),i.prototype.push=function(n){if(n!=null&&n!=undefined){t.prototype.push.call(this,n);var i=this.indexOf(n);return this.NotifyCollectionChanged&&this._CollectionChanged(n,!0,i),1}return 0},i.prototype._Add=function(n){n!=null&&n!=undefined&&t.prototype.push.call(this,n);var i=this.indexOf(n);return this.NotifyCollectionChanged&&this._CollectionChanged(n,!0,i),1},i.prototype._Insert=function(n,t){if(n==this.length){this._Add(t);return}n>-1&&n<this.length&&(this._shiftItems(n,!0),this[n]=t,this.length=this.length+1,this._CollectionChanged&&this._CollectionChanged(t,!0,n))},i.prototype._Remove=function(n){var i=this.indexOf(n);return i>-1&&i<this.length?(this._shiftItems(i,!1),t.prototype.pop.call(this),this._CollectionChanged&&this._CollectionChanged(n,!1,i),!0):!1},i.prototype._RemoveAt=function(n){if(n>-1&&n<this.length){var i=this[n];return this._shiftItems(n,!1),t.prototype.pop.call(this),this._CollectionChanged&&this._CollectionChanged(i,!1,n),!0}return!1},i}(h);t.ObservableCollection=ff;nu=function(t){function i(n){t.call(this);this.ownerBase=n;this.NotifyCollectionChanged=!0}return n(i,t),Object.defineProperty(i.prototype,"OwnerBase",{get:function(){return this.ownerBase},enumerable:!0,configurable:!0}),i.prototype._Push=function(n){return this instanceof lu&&n instanceof fr||this instanceof au&&n instanceof nr||this instanceof vu&&n instanceof lt||this instanceof yu&&n instanceof dr?(t.prototype.push.call(this,n),1):0},i.prototype._Add=function(n){return this instanceof lu&&n instanceof fr||this instanceof au&&n instanceof nr||this instanceof vu&&n instanceof lt||this instanceof yu&&n instanceof dr?(t.prototype.push.call(this,n),1):0},i.prototype._CollectionChanged=function(n,t){t?n._SetOwnerBase(this.ownerBase):n instanceof fi&&n._SetOwnerBase(null)},i.prototype._Dispose=function(){this.ownerBase=null;this.NotifyCollectionChanged=!1},i}(ff);t.BaseNodeCollection=nu;lu=function(t){function i(){t.apply(this,arguments)}return n(i,t),i}(nu);t.ListAdvCollection=lu;au=function(t){function i(){t.apply(this,arguments)}return n(i,t),i}(nu);t.AbstractListAdvCollection=au;vu=function(t){function i(){t.apply(this,arguments)}return n(i,t),i}(nu);t.ListLevelAdvCollection=vu;yu=function(t){function i(){t.apply(this,arguments)}return n(i,t),i.prototype._Get=function(n){for(var i,t=0;t<this.length;t++)if(this[t]instanceof dr&&(i=this[t],i.LevelNumber==n))return i;return null},i}(nu);t.LevelOverrideAdvCollection=yu;pr=function(t){function i(n){t.call(this);this.ownerNode=n;this.NotifyCollectionChanged=!0}return n(i,t),Object.defineProperty(i.prototype,"OwnerNode",{get:function(){return this.ownerNode},enumerable:!0,configurable:!0}),i.prototype._Push=function(n){if(this instanceof pu&&n instanceof d||this instanceof wu&&n instanceof ct||this instanceof ur&&n instanceof hi||this instanceof bu&&n instanceof k||this instanceof ku&&n instanceof bt||this instanceof du&&n instanceof ot)return t.prototype.push.call(this,n),1},i.prototype._Add=function(n){return this instanceof pu&&n instanceof d||this instanceof wu&&n instanceof ct||this instanceof ur&&n instanceof hi||this instanceof bu&&n instanceof k||this instanceof ku&&n instanceof bt||this instanceof du&&n instanceof ot?(t.prototype.push.call(this,n),1):0},i.prototype._SetOwnerToNode=function(n,t){if(n.Owner instanceof yt){var i=n.Owner;this.indexOf(n)>-1?(this.NotifyCollectionChanged=!1,this._RemoveAt(t),i==this.OwnerNode&&(this.NotifyCollectionChanged=!0),i.ChildNodes._Remove(n),i==this.OwnerNode&&(this.NotifyCollectionChanged=!1),this._Insert(t,n),this.NotifyCollectionChanged=!0):i.ChildNodes._Remove(n)}n._SetOwner(this.OwnerNode)},i.prototype._GetNextNode=function(n){var t=this.indexOf(n);return t<0||t>this.length-2?null:this[t+1]},i.prototype._GetPreviousNode=function(n){var t=this.indexOf(n);return t<1||t>this.length-1?null:this[t-1]},i.prototype._Dispose=function(){this.ownerNode=null;this.NotifyCollectionChanged=!1},i}(ff);t.NodeCollection=pr;pu=function(t){function i(){t.apply(this,arguments)}return n(i,t),i.prototype._CollectionChanged=function(n,t){if(t){var i=this.indexOf(n);this._SetOwnerToNode(n,i)}else n instanceof sr&&n._SetOwner(null)},i}(pr);t.HeaderFooterCollection=pu;wu=function(t){function i(){t.apply(this,arguments)}return n(i,t),i.prototype._CollectionChanged=function(n,t){if(t){var i=this.indexOf(n);this._SetOwnerToNode(n,i)}else n instanceof sr&&n._SetOwner(null)},i}(pr);t.SectionAdvCollection=wu;ur=function(t){function i(){t.apply(this,arguments)}return n(i,t),i.prototype._GetBlock=function(n){var t,e,i,o,f;if(n==""||n==undefined||n==null)return null;if(t=n.indexOf(";"),e="0",t>=0&&(e=n.substring(0,t),n=n.substring(t).replace(";",""),t=parseInt(e),i=this[t],n.indexOf(";")>=0)){if(i instanceof u){if(n.indexOf("C;")>=0){o=i;t=n.indexOf(";");e=n.substring(0,t);n=n.substring(t+2).replace(";","");var s=0,h=o._GetInline(parseFloat(e),s),r=h.inline;return t=h.index,s==r.Length&&(r=r.NextNode instanceof k?r.NextNode:null),r!=null&&(f=r.Blocks._GetBlock(n)),{node:f.node,position:f.position}}return n.indexOf(";")>=0&&(n="0"),{node:i,position:n}}return i instanceof yt?(f=i._GetBlock(n),{node:f.node,position:f.position}):{node:i,position:n}}},i.prototype._CollectionChanged=function(n,t,i){var o,h,e,r,f,c;if(t){if(o=i,this._SetOwnerToNode(n,o),n instanceof u&&n.Owner!=null)for(h=n,e=0;e<h.Inlines.Count;e++)r=h.Inlines[e],r!=null&&r instanceof s&&r.Text!=""&&r!=null&&r!=undefined&&(f=r.Text,f=f.replace("\r\n","\r"),f=f.replace("\n","\r"),c=f.indexOf("\r"),c>-1&&r._SplitByBreakCharacter(c));o++;this._Layout(i)}else n instanceof sr&&n._SetOwner(null),n instanceof hi&&n._ClearWidgets(),i<this.Count&&this._Layout(i)},i.prototype._Layout=function(n){var i,r,f,t,u,e;if(!(n>=this.Count))if(i=null,this.OwnerNode instanceof ct)i=this.OwnerNode,i.BaseParent!=null&&i.BaseParent.IsLayoutEnabled&&i._Layout(n);else if(this.OwnerNode instanceof g)this.OwnerNode._Relayout();else if(this.OwnerNode instanceof ot){if(this.OwnerNode._IsInComment()){this.OwnerNode._GetOwnerComment()._Relayout();return}if(r=this.OwnerNode,r=r._GetContainerCell(),i=r.Section,i!=null){if(f=i.Document,t=f.OwnerControl.Viewer,t.FieldEndParagraph!=null&&t.FieldEndParagraph.BaseParent==null&&(t.FieldEndParagraph=r._GetFirstParagraph()),t.FieldToLayout!=null&&(u=t.FieldToLayout.OwnerParagraph,e=t.FieldToLayout,t.FieldToLayout=null,u!=null&&u.BaseParent!=null)){u._RelayoutParagraph(e._GetIndexInOwnerCollection());return}f.OwnerControl.IsLayoutEnabled&&r.OwnerRow._Layout(t,!1)}}},i.prototype._GetParagraph=function(n){var t,i,r;return n.Index==null&&n.Index==""&&n.Index==undefined?null:(t=n.Index.indexOf(";"),i="0",t>=0)?(i=n.Index.substring(0,t),n.Index=n.Index.substring(t).replace(";",""),t=parseInt(i),this[t]instanceof u?this[t]:(r=this[t],n.Index.indexOf(";")!=-1?(t=n.Index.indexOf(";"),i=n.Index.substring(0,t),n.Index=n.Index.substring(t).replace(";",""),t=parseInt(i),r.Rows[t]._GetParagraph(n)):r._GetFirstParagraphInFirstCell())):null},i}(pr);t.BlockAdvCollection=ur;bu=function(t){function i(){t.apply(this,arguments)}return n(i,t),i.prototype._CollectionChanged=function(n,t,i){var u,f,r,e;t?(u=i,this._SetOwnerToNode(n,u),n instanceof s&&n.OwnerParagraph!=null&&n.OwnerParagraph.Owner!=null&&(f=n,f.Text!=""&&f.Text!=null&&(r=f.Text,r=r.replace("\r\n","\r"),r=r.replace("\n","\r"),e=r.indexOf("\r"),e>-1&&f._SplitByBreakCharacter(u))),u++,i<u&&this._Layout(i)):(n instanceof sr&&n._SetOwner(null),n instanceof k&&n._ClearElements(!1),i-1<this.Count&&this._Layout(i-1))},i.prototype._Layout=function(n){this.OwnerNode instanceof u&&this.OwnerNode._IsInComment()&&this.OwnerNode._RelayoutParagraph(0);this.OwnerNode instanceof u&&this.OwnerNode.BaseParent!=null&&this.OwnerNode._RelayoutParagraph(n)},i}(pr);t.InlineCollection=bu;ee=function(t){function i(){t.apply(this,arguments)}return n(i,t),i}(h);t.TableColumnAdvCollection=ee;ku=function(t){function i(){t.apply(this,arguments)}return n(i,t),i.prototype._CollectionChanged=function(n,t,i){if(t){var r=i;this._SetOwnerToNode(n,r);this._Layout()}else n instanceof sr&&n._SetOwner(null),this._Layout()},i.prototype._Layout=function(){var n,t;if(this.OwnerNode instanceof e){for(n=this.OwnerNode;n.IsInsideTable;)n=n.AssociatedCell.OwnerTable;if(n!=null&&(t=n.Section,n.TableHolder!=null&&(n._CalculateGridOnly(),n.IsTableGridUpdated=!1,n._CheckTableGrid()),t!=null)){var r=t.Document,u=r.OwnerControl.Viewer,i=t.Blocks._IndexOf(n);i>=0&&t.BaseParent!=null&&t.BaseParent.IsLayoutEnabled&&t._Layout(i)}}},i}(pr);t.TableRowAdvCollection=ku;du=function(t){function i(){t.apply(this,arguments)}return n(i,t),i.prototype._CollectionChanged=function(n,t,i){if(t){var r=i;this._SetOwnerToNode(n,r);r++;this._Layout()}else n instanceof sr&&n._SetOwner(null)},i.prototype._Layout=function(){var n,t;if(this.OwnerNode instanceof bt&&this.OwnerNode.OwnerTable!=null){for(n=this.OwnerNode.OwnerTable;n.IsInsideTable;)n=n.AssociatedCell.OwnerTable;if(n!=null&&(t=n.Section,n.TableHolder!=null&&(n._CalculateGridOnly(),n.IsTableGridUpdated=!1,n._CheckTableGrid()),t!=null)){var r=t.Document,u=r.OwnerControl.Viewer,i=t.Blocks._IndexOf(n);i>=0&&t.BaseParent!=null&&t.BaseParent.IsLayoutEnabled&&t._Layout(i)}}},i}(pr);t.TableCellAdvCollection=du;ti=function(t){function i(n){t.call(this,n);this.defaultTabWidth=48;this.backgroundColor="#FFFFFF";this.ChildNodes=new wu(this);this.lists=new lu(this);this.abstractLists=new au(this);this.renderedListLevels=new h;this.renderedLevelOverrides=new h;this.renderedLists=new ni;this.characterFormat=new o(this);this.paragraphFormat=new a(this);this.listParagraphs=new h}return n(i,t),Object.defineProperty(i.prototype,"Sections",{get:function(){return this.ChildNodes},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Lists",{get:function(){return this.lists},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"AbstractLists",{get:function(){return this.abstractLists},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"OwnerControl",{get:function(){return this.ownerControl},set:function(n){this.ownerControl=n},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"DefaultTabWidth",{get:function(){return this.defaultTabWidth},set:function(n){this.defaultTabWidth=n},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"DocumentStart",{get:function(){return this._GetDocumentStart()},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"DocumentEnd",{get:function(){return this._GetDocumentEnd()},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"BackgroundColor",{get:function(){return this.backgroundColor},set:function(n){this.backgroundColor=n},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"CharacterFormat",{get:function(){return this.characterFormat},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"ParagraphFormat",{get:function(){return this.paragraphFormat},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"ListParagraphs",{get:function(){return this.listParagraphs},set:function(n){this.listParagraphs=n},enumerable:!0,configurable:!0}),i.prototype._SerializeDocument=function(){for(var i,t={Sections:[]},n=0;n<this.Sections.Count;n++)i=this.Sections[n],t.Sections[n]=i._SerializeSection();return t},i.prototype._SerializeAbstractList=function(){for(var r,t={AbstractLists:[]},i=this.AbstractLists,n=0;n<i.Count;n++)r=i[n],t.AbstractLists[n]=r._SerializeListLevelAdvCollection();return t.AbstractLists},i.prototype._SerializeList=function(){for(var i,t,r={Lists:[]},u=this.Lists,n=0;n<u.length;n++)i=u[n],r.Lists[n]={AbstractList:[],ListId:[],AbstractListId:[],LevelOverrides:[]},t=r.Lists[n],t.AbstractList=null,t.ListId=i.ListId,t.AbstractListId=i.AbstractListId,t.LevelOverrides=i._SerializeLevelOverrides();return r.Lists},i.prototype._SerializeBackgroundColor=function(){return this.BackgroundColor},i.prototype._SerializeDefaultWidth=function(){return this.DefaultTabWidth},i.prototype._LayoutItems=function(n){var t,i;if(this.OwnerControl!=null&&this.OwnerControl.IsLayoutEnabled){for(this._ClearWidgets(),this.OwnerControl.Viewer._ClearContainer(),n=this.ownerControl.Viewer,t=0;t<this.Sections.length;t++)i=this.Sections[t],i._LayoutItems(n);n._UpdateScrollBars()}},i.prototype._ClearWidgets=function(){this.renderedListLevels._Clear();this.renderedLevelOverrides._Clear();this.renderedLists._Clear();for(var n=0;n<this.Sections.Count;n++)this.Sections[n]._ClearWidgets()},i.prototype._UpdateListItems=function(n){var t,i;if(this.renderedLists._Clear(),this.renderedListLevels._Clear(),this.renderedLevelOverrides._Clear(),!n._IsInComment())for(t=0;t<this.Sections.Count;t++)if(i=this.Sections[t]._UpdateListItems(n),i)break},i.prototype._Dispose=function(){var t,i,n,r;if(this.ownerControl!=null&&(this.ownerControl=null),this.ChildNodes!=null)for(this.ChildNodes._Dispose(),n=0;n<this.Sections.Count;n++)t=this.Sections[n],t._Dispose(),this.Sections._Remove(t),n--;if(this.renderedListLevels!=null&&(this.renderedListLevels._Clear(),this.renderedListLevels=null),this.renderedLists!=null&&(this.renderedLists._Clear(),this.renderedLists=null),this.Lists!=null){for(n=0;n<this.Lists.Count;n++)i=this.Lists[n],i._Dispose(),this.lists._Remove(i),n--;this.lists._Dispose();this.lists=null}if(this.AbstractLists!=null){for(n=0;n<this.AbstractLists.Count;n++)r=this.AbstractLists[n],r._Dispose(),this.abstractLists._Remove(r),n--;this.abstractLists._Dispose();this.abstractLists=null}this.Fields=null;this.FieldCharacter=null},i.prototype._GetListByID=function(n){if(this.Lists==null)return null;for(var t=0;t<this.Lists.length;t++)if(this.Lists[t]!=null&&this.Lists[t].ListId==n)return this.Lists[t];return null},i.prototype._GetAbstractListAdvByID=function(n){if(this.AbstractLists==null)return null;for(var t=0;t<this.AbstractLists.length;t++)if(this.AbstractLists[t]!=null&&this.AbstractLists[t].AbstractListId==n)return this.AbstractLists[t];return null},i.prototype._AddListLevel=function(n){for(var t,r,i=n.Levels.Count;i<9;i++)t=new lt(n),r=i%3,n.Levels[0].ListLevelPattern==c.Bullet?(t.ListLevelPattern=c.Bullet,t.NumberFormat=r==0?lt.DOTBULLET:r==1?lt.SQUAREBULLET:lt.ARROWBULLET,t.CharacterFormat.FontFamily=t.NumberFormat==lt.SQUAREBULLET?"Wingdings":"Symbol"):(t.ListLevelPattern=r,t.NumberFormat="%"+(i+1).toString()+".",t.StartAt=1,t.RestartLevel=i),t.ParagraphFormat=new a(t),t.ParagraphFormat.LeftIndent=48*(i+1),t.ParagraphFormat.FirstLineIndent=-24,n.Levels._Add(t)},i.prototype._GetListNumber=function(n){var t=n.List,i=n.ListLevelNumber,r=n.ListLevel,u=t.LevelOverrides!=null?t.LevelOverrides._Get(i):null,f;return u==null||this.renderedLevelOverrides._Contains(u)||u.OverrideListLevel!=null||(this.renderedLevelOverrides._Add(t.LevelOverrides[i]),this.renderedListLevels._Contains(r)&&this.renderedListLevels._Remove(r),this.renderedLists._ContainsKey(t.AbstractList)&&(f=this.renderedLists._Get(t.AbstractList),f._ContainsKey(i)&&f._Remove(i))),this._UpdateListValues(t,i),this._GetListText(t,i,r)},i.prototype._UpdateListValues=function(n,t){var o,f,u,i,r,e;if(this.renderedLists._ContainsKey(n.AbstractList))if(u=this.renderedLists._Get(n.AbstractList),u._ContainsKey(t))for(e=u._Get(t),u._Set(t,e+1),i=t+1;i<n.AbstractList.Levels.Count;)r=n._GetListLevel(i),r!=null&&u._ContainsKey(i)&&r.RestartLevel>t&&(u._Remove(i),this.renderedListLevels._Contains(r)&&this.renderedListLevels._Remove(r)),i++;else{for(i=t;!u._ContainsKey(i-1)&&i>0;)r=n._GetListLevel(i-1),r!=null&&(u._Add(i-1,n._GetListStartValue(i-1)),this.renderedListLevels._Contains(r)||this.renderedListLevels._Add(r)),i--;e=n._GetListStartValue(t);u._Add(t,e)}else for(o=new ni,this.renderedLists._Add(n.AbstractList,o),r=n._GetListLevel(t),f=0;f<=t;f++)o._Add(f,n._GetListStartValue(f))},i.prototype._GetListText=function(n,t,i){var r=i.NumberFormat,f,o,e;if(this.renderedLists._ContainsKey(n.AbstractList))for(f=this.renderedLists._Get(n.AbstractList),o=f.Keys,e=0;e<o.length;e++){var u=o[e],s="%"+(u+1).toString(),h=n._GetListLevel(u);if(r.match(s)){if(u>t)return"";r=f._ContainsKey(u)&&h!=null?r.replace(s,h._GetListText(f._Get(u))):r.replace(s,"0")}}return r},i.prototype._GetDocumentStart=function(){if(this.Sections.length==0||this.Sections[0].Blocks.length==0)return null;var t=null,n=this.Sections[0].Blocks[0];return n=n instanceof e?n._GetFirstParagraphInFirstCell():this.Sections[0].Blocks[0],n instanceof u&&(t=new tt(this.OwnerControl),t._SetPosition(n,!0)),t},i.prototype._GetDocumentEnd=function(){var r=null,f=this.DocumentStart,n,i,t,o;return f!=null&&this.Sections.Count>0&&(n=null,i=this.Sections._Last().Blocks._Last(),i instanceof hi&&(n=i),t=n,this.OwnerControl.IsDocumentLoaded||(t!=null&&(t=n.PreviousBlock),t==null&&this.Sections.Count>1&&(i=this.Sections[this.Sections.Count-2].Blocks._Last(),t=i instanceof hi?i:null)),t!=null&&(n=t),n instanceof e&&(n=n._GetLastParagraphInLastCell()),n instanceof u?(o=t==null?0:n._GetEndOffset(),r=new tt(this.OwnerControl),r._SetPositionParagraph(n,o)):(r=new tt(this.OwnerControl),r._SetPositionParagraph(f.Paragraph,f.Paragraph._GetEndOffset()))),r},i.prototype._Find=function(n,t,i,r){var a,v,y,p,w,e,l,f,b,s;if(this.Sections.Count!=0&&!kt._IsPatternEmpty(n)){var h=null,o=null,c=0;if(this.OwnerControl.Selection!=null&&this.OwnerControl.Selection.End!=null&&(o=this.OwnerControl.Selection.End),i&&o!=null&&o.Paragraph!=null&&(a=0,v=o.Paragraph._GetInline(this.OwnerControl.Selection.End.Offset,a),h=v.inline,a=v.index,h!=null)){if(h._Find(n,t,a,i,o,r),r.Count>0)return;for(y=h.OwnerParagraph._GetOwnerComment(),y!=null&&(c=this.Comments._IndexOf(y),c=c+1),s=c;s<this.Comments.Count;s++)if(p=this.Comments[s].Blocks[0],w=p._GetFirstParagraph(),h=w.Inlines[0],h._Find(n,t,0,i,o,r),r.Count>0)return}for(e=this.Sections[0];e!=null&&e.Blocks.Count==0;)e=e.NextNode instanceof ct?e.NextNode:null;if(e!=null&&e.Blocks.Count!=0){for(l=e.Blocks[0],f=null,l instanceof u&&(f=l._GetFirstParagraph());f!=null&&f.Inlines.Count==0;)f=f._GetNextParagraph();if(f!=null&&f.Inlines.Count!=0&&(b=f.Inlines[0],b._Find(n,t,0,i,o,r),this.Comments.Count>0))for(i||(c=this.Comments.Count),s=0;s<c;s++)if(l=this.Comments[s].Blocks[0],f=l._GetFirstParagraph(),f.Inlines[0]._Find(n,t,0,i,o,r),i&&r.Count>0)return}}},i.prototype._ApplyListChanges=function(n,t){var f,r,u,o;for(this.modifiedParaFormats==null&&(this.modifiedParaFormats=new ni),f=new ro,r=0;r<this.ListParagraphs.Count;r++){var s=this.ListParagraphs[r],i=s.ParagraphFormat,e=i.ListFormat.ListLevel;t.ModifiedLevels._ContainsKey(i.ListFormat.ListLevelNumber)&&t.ModifiedLevels._Get(i.ListFormat.ListLevelNumber).OwnerListLevel==e&&(u=new a(null),u.LeftIndent=i.LeftIndent,u.FirstLineIndent=i.FirstLineIndent,o=new uo(i,u),f.ModifiedFormats._Add(o),i._CopyFromListLevelParagrahFormat(e.ParagraphFormat))}this.modifiedParaFormats._Add(n,f)},i.prototype._RevertListChanges=function(n){var i,t,r;if(this.modifiedParaFormats._ContainsKey(n))for(i=this.modifiedParaFormats._Get(n),t=0;t<i.ModifiedFormats.Count;t++)r=new a(null),r.LeftIndent=i.ModifiedFormats[t].OwnerFormat.LeftIndent,r.FirstLineIndent=i.ModifiedFormats[t].OwnerFormat.FirstLineIndent,i.ModifiedFormats[t].OwnerFormat._CopyFormat(i.ModifiedFormats[t].ModifiedFormat),i.ModifiedFormats[t].ModifiedFormat.LeftIndent=r.LeftIndent,i.ModifiedFormats[t].ModifiedFormat.FirstLineIndent=r.FirstLineIndent},i.prototype._UpdateListParagraphs=function(){this.ListParagraphs._Clear();for(var n=0;n<this.Sections.Count;n++)this.Sections[n]._UpdateListParagraphs()},i}(yt);t.DocumentAdv=ti;ct=function(t){function i(n){t.call(this,n);this.BodyWidgets=new h;this.ChildNodes=new ur(this);this.headerFooters=new gu(this);this.sectionformat=new fu(this)}return n(i,t),Object.defineProperty(i.prototype,"Blocks",{get:function(){return this.ChildNodes},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"HeaderFooters",{get:function(){return this.headerFooters},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"SectionFormat",{get:function(){return this.sectionformat},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Document",{get:function(){return this.Owner},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"BaseParent",{get:function(){return this.Document!=null?this.Document.OwnerControl:null},enumerable:!0,configurable:!0}),i.prototype._SerializeSection=function(){var t={Blocks:[],SectionFormat:[],HeaderFooters:[]},n,i;for(t.SectionFormat=this.SectionFormat._SerializeSectionFormat(),t.HeaderFooters=this._SerializeHeaderFooters(),n=0;n<this.Blocks.Count;n++)i=this.Blocks[n],i instanceof u?t.Blocks[n]=i._SerializeBlock():i instanceof e&&(t.Blocks[n]=i._SerializeBlock());return t},i.prototype._Clone=function(){var n=new i(null),t,r;for(n.SectionFormat._CopyFormat(this.SectionFormat),this.HeaderFooters._CloneItemsTo(n.HeaderFooters),t=0;t<this.Blocks.Count;t++)r=this.Blocks[t],n.Blocks._Add(r._Clone());return n},i.prototype._AddBodyWidget=function(n){var t=new wt(this);return t.Width=n.Width,t.X=n.X,t.Y=n.Y,this.BodyWidgets._Add(t),t},i.prototype._LayoutItems=function(n){var t,i;for(n._CreateNewPage(this),t=0;t<this.Blocks.length;t++)i=this.Blocks[t],n._UpdateClientAreaForBlock(i,!0),i._LayoutItems(n),n._UpdateClientAreaForBlock(i,!1)},i.prototype._GetCurrentHeaderFooter=function(n){return this.HeaderFooters.ChildNodes[n].Blocks.length==0&&this.PreviousNode!=null?this.PreviousNode._GetCurrentHeaderFooter(n):this.HeaderFooters.ChildNodes[n]},i.prototype._GetPreviousParagraph=function(){if(this.PreviousNode instanceof i){var n=this.PreviousNode.Blocks[this.PreviousNode.Blocks.Count-1];return n instanceof u?n:n._GetLastParagraphInLastCell()}return null},i.prototype._GetNextParagraph=function(){if(this.NextNode instanceof i){var n=this.NextNode.Blocks[0];return n instanceof u?n:n._GetFirstParagraphInFirstCell()}return null},i.prototype._GetPreviousBlock=function(){return this.PreviousNode instanceof i?this.PreviousNode.Blocks[this.PreviousNode.Blocks.Count-1]:null},i.prototype._GetNextSelection=function(n){if(this.NextNode instanceof i){var t=this.NextNode.Blocks[0];return t instanceof u?t:n.IsEmpty||n.IsForward?t._GetLastParagraphInFirstRow():t.Rows[0]._GetNextParagraphSelection(n)}return null},i.prototype._GetPreviousSelection=function(n){if(this.PreviousNode instanceof i){var t=this.PreviousNode.Blocks[this.PreviousNode.Blocks.Count-1];return t instanceof u?t:n.IsForward?t.Rows[t.Rows.Count-1]._GetPreviousParagraphSelection(n):t._GetFirstParagraphInLastRow()}return null},i.prototype._UpdateListItems=function(n){for(var i,t=0;t<this.Blocks.Count;t++)if(i=this.Blocks[t]._UpdateListItems(n),i)return!0;return!1},i.prototype._UpdateListParagraphs=function(){for(var n=0;n<this.Blocks.Count;n++)this.Blocks[n]._UpdateListParagraphs()},i.prototype._CombineSection=function(n,t){var r,i,u;for(this.Document.Sections._Remove(this),r=0,i=0;i<this.Blocks.Count;i++,r++)u=this.Blocks[i],t.Blocks._Insert(r,u),i--},i.prototype._Layout=function(n){this._LayoutItem(n,!1)},i.prototype._LayoutItem=function(n,t){var f=this.Document,i=f.OwnerControl.Viewer,e,s,o,r;if(i.FieldEndParagraph!=null&&i.FieldEndParagraph.BaseParent==null&&n<this.Blocks.Count&&(i.FieldEndParagraph=this.Blocks[n]instanceof u?this.Blocks[n]:this.Blocks[n]._GetFirstParagraphInFirstCell()),i.FieldToLayout!=null&&(e=i.FieldToLayout.OwnerParagraph,s=i.FieldToLayout,i.FieldToLayout=null,e!=null&&e.BaseParent!=null)){e._RelayoutParagraph(s._GetIndexInOwnerCollection());return}i.Pages.Count==0&&i._CreateNewPage(this);i._UpdateClientArea(this.SectionFormat);n>0&&(o=void 0,o=this.Blocks[n-1]instanceof u?this.Blocks[n-1].ParagraphWidgets[this.Blocks[n-1].ParagraphWidgets.Count-1]:this.Blocks[n-1].TableWidgets[this.Blocks[n-1].TableWidgets.Count-1],i._CutFromTop(o.Y+o.Height));n<0&&(n=0);n<this.Blocks.Count&&(r=this.Blocks[n],f.OwnerControl.IsDocumentLoaded&&!f.OwnerControl.IsPastingContent&&f._UpdateListItems(r),r._ClearWidgets(),i.Pages.Count==0&&i._CreateNewPage(this),i._UpdateClientAreaForBlock(r,!0),r._LayoutItems(i),i._UpdateClientAreaForBlock(r,!1),t?r._ShiftNextWidgets():r._LayoutNextItems(i))},i.prototype._SplitSection=function(n,t){for(var r,u,i=0;i<this.Blocks.Count;i++){if(r=this.Blocks[i],r==t)break;r._RemoveBlock();n.Blocks._Add(r);i--}u=this._GetIndexInOwnerCollection();this.Document.Sections._Insert(u,n)},i.prototype._ClearWidgets=function(){var n,t;if(this.HeaderFooters!=null)for(n=0;n<this.HeaderFooters.ChildNodes.Count;n++)this.HeaderFooters.ChildNodes[n]._ClearWidgets();for(n=0;n<this.BodyWidgets.Count;n++)t=this.BodyWidgets[n],t._Dispose(),this.BodyWidgets._Remove(t),n--},i.prototype._Dispose=function(){var t,n,i;if(this.SectionFormat._Dispose(),this.HeaderFooters._Dispose(),this._SetOwner(null),this.BodyWidgets!=null){for(n=0;n<this.BodyWidgets.Count;n++)t=this.BodyWidgets[n],t._Dispose(),this.BodyWidgets._Remove(t),n--;this.BodyWidgets=null}if(this.Blocks!=null){for(this.Blocks._Dispose(),n=0;n<this.Blocks.Count;n++)i=this.Blocks[n],i._Dispose(),this.Blocks._Remove(i),n--;this.ChildNodes=null}this.Fields=null;this.FieldCharacter=null},i.prototype._SerializeHeaderFooters=function(){var n=this.HeaderFooters;return n._SerializeHeaderFooter()},i}(yt);t.SectionAdv=ct;d=function(t){function i(n){t.call(this,n);this.ChildNodes=new ur(this);this.LayoutedWidgets=new h}return n(i,t),Object.defineProperty(i.prototype,"Blocks",{get:function(){return this.ChildNodes},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Type",{get:function(){return this.type},set:function(n){this.type=n},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Document",{get:function(){return this.Section==null?null:this.Section.Document},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Section",{get:function(){return this.Owner instanceof gu?this.Owner.Section:null},enumerable:!0,configurable:!0}),i.prototype._CloneItemsTo=function(n){for(var i,t=0;t<this.Blocks.Count;t++)i=this.Blocks[t],n.Blocks._Add(i._Clone())},i.prototype._LayoutItems=function(n){var t=new wf(this),r,i;for(t.Page=n.CurrentRenderingPage,this.LayoutedWidgets._Add(t),t._UpdateClientAreaLocation(n.ClientActiveArea),r=0;r<this.Blocks.length;r++)i=this.Blocks[r],i instanceof e&&i.TableWidgets._Clear(),n._UpdateClientAreaForBlock(i,!0),i._LayoutItems(n),n._UpdateClientAreaForBlock(i,!1);return t.Height=n.ClientActiveArea.Top-n.ClientArea.Top,(this.type==si.OddFooter||this.type==si.EvenFooter||this.type==si.FirstPageFooter)&&t._ShiftChildLocation(n.ClientArea.Top-n.ClientActiveArea.Top),t},i.prototype._ClearWidgets=function(){for(var t,n=0;n<this.LayoutedWidgets.Count;n++)t=this.LayoutedWidgets[n],t._Dispose(),this.LayoutedWidgets._Remove(t),n--},i.prototype._Dispose=function(){var n,t;if(this._SetOwner(null),this.Blocks!=null){for(this.Blocks._Dispose(),n=0;n<this.Blocks.Count;n++)t=this.Blocks[n],t._Dispose(),this.Blocks._Remove(t),n--;this.ChildNodes=null}this.Fields=null;this.FieldCharacter=null;this.LayoutedWidgets!=null&&(this._ClearWidgets(),this.LayoutedWidgets=null)},i}(yt);t.HeaderFooter=d;gu=function(t){function i(n){var i,r,u,f,e,o;t.call(this,n);this.ChildNodes=new pu(this);i=new d(null);i.Type=si.EvenHeader;this.ChildNodes._Add(i);r=new d(null);r.Type=si.OddHeader;this.ChildNodes._Add(r);u=new d(null);u.Type=si.EvenFooter;this.ChildNodes._Add(u);f=new d(null);f.Type=si.OddFooter;this.ChildNodes._Add(f);e=new d(null);e.Type=si.FirstPageHeader;this.ChildNodes._Add(e);o=new d(null);o.Type=si.FirstPageFooter;this.ChildNodes._Add(o)}return n(i,t),Object.defineProperty(i.prototype,"EvenHeader",{get:function(){return this.ChildNodes[0]},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Header",{get:function(){return this.ChildNodes[1]},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"EvenFooter",{get:function(){return this.ChildNodes[2]},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Footer",{get:function(){return this.ChildNodes[3]},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"FirstPageHeader",{get:function(){return this.ChildNodes[4]},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"FirstPageFooter",{get:function(){return this.ChildNodes[5]},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Document",{get:function(){return this.Section==null?null:this.Section.Document},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Section",{get:function(){return this.Owner},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"BaseParent",{get:function(){return this.Document!=null?this.Document.OwnerControl:null},enumerable:!0,configurable:!0}),i.prototype._Dispose=function(){var n,t;if(this._SetOwner(null),this.ChildNodes!=null){for(this.ChildNodes._Dispose(),n=0;n<this.ChildNodes.Count;n++)t=this.ChildNodes[n],t._Dispose(),this.ChildNodes._Remove(t),n--;this.ChildNodes=null}this.Fields=null;this.FieldCharacter=null},i.prototype._CloneItemsTo=function(n){this.FirstPageHeader._CloneItemsTo(n.FirstPageHeader);this.FirstPageFooter._CloneItemsTo(n.FirstPageFooter);this.Header._CloneItemsTo(n.Header);this.Footer._CloneItemsTo(n.Footer);this.EvenHeader._CloneItemsTo(n.EvenHeader);this.EvenFooter._CloneItemsTo(n.EvenFooter)},i.prototype._SerializeHeaderFooter=function(){var n={EvenHeader:[],EvenFooter:[],FirstPageFooter:[],FirstPageHeader:[],Footer:[],Header:[]};return n.EvenHeader=this._ParseHeaderFooter(this.EvenHeader,n.EvenHeader),n.EvenFooter=this._ParseHeaderFooter(this.EvenFooter,n.EvenFooter),n.FirstPageFooter=this._ParseHeaderFooter(this.FirstPageFooter,n.FirstPageFooter),n.FirstPageHeader=this._ParseHeaderFooter(this.FirstPageHeader,n.FirstPageHeader),n.Footer=this._ParseHeaderFooter(this.Footer,n.Footer),n.Header=this._ParseHeaderFooter(this.Header,n.Header),n},i.prototype._ParseHeaderFooter=function(n,t){var f,i,r;if(n.Blocks.Count>0){for(t={Blocks:[],Type:[]},f=n.Blocks,t.Type=n.Type,i=0;i<f.Count;i++)r=f[i],r instanceof u?t.Blocks[i]=r._SerializeBlock():r instanceof e&&(t.Blocks[i]=r._SerializeBlock());return t}return null},i}(yt);t.HeaderFooters=gu;hi=function(t){function i(){t.apply(this,arguments)}return n(i,t),Object.defineProperty(i.prototype,"PreviousBlock",{get:function(){return this.PreviousNode},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"NextBlock",{get:function(){return this.NextNode},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Section",{get:function(){return this.Owner instanceof ot?this.Owner.Section:this.Owner instanceof d?this.Owner.Section:this.Owner instanceof g&&this.Owner.Owner instanceof u?this.Owner.Owner.Section:this.Owner},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"IsInsideTable",{get:function(){return this.Owner instanceof ot},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"AssociatedCell",{get:function(){return this.Owner instanceof ot?this.Owner:null},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Document",{get:function(){return this.Section!=null?this.Section.Document:this._IsInComment()?this._GetOwnerDocument():null},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"IsInHeaderFooter",{get:function(){return this.Owner instanceof ot?this.Owner.IsInHeaderFooter:this.Owner instanceof d},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"LeftIndent",{get:function(){var n=this;return n instanceof u&&n.ParagraphFormat instanceof a?n.ParagraphFormat.LeftIndent:n instanceof e&&n.TableFormat instanceof at?n.TableFormat.LeftIndent:0},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"RightIndent",{get:function(){var n=this;return n instanceof u&&n.ParagraphFormat instanceof a?n.ParagraphFormat.RightIndent:0},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"BaseParent",{get:function(){return this.Section!=null?this.Section.BaseParent:null},enumerable:!0,configurable:!0}),i.prototype._UpdateWidgetsToBody=function(n,t){var p=this,o=null,f,i,l,r,h,s,w;if(n.CurrentHeaderFooter==null)if(t.ContainerWidget!=null&&t.ContainerWidget.ChildWidgets._Contains(t)&&(t.ContainerWidget.ChildWidgets._Remove(t),t.ContainerWidget.Height-=t.Height),f=null,i=null,n.CurrentComment==null?i=n instanceof st&&n.CurrentPage!=null?n.CurrentPage.BodyWidgets:this.Section.BodyWidgets:f=n.CurrentComment.LayoutedWidget,l=void 0,l=p instanceof u?p.ParagraphWidgets:p.TableWidgets,l.Count>1&&n.CurrentComment==null)r=null,o=l[l.Count-2].ContainerWidget,o instanceof wt&&(r=o),h=i._IndexOf(r),f=h+1<i.Count?i[h+1]:i[i.Count-1],f.ChildWidgets._Insert(0,t),t.ContainerWidget=f,f.Height+=t.Height;else{var r=null,a=0,c=null,b=0;if(t instanceof ci&&(b=t.TopBorderWidth),this.PreviousBlock instanceof u?(c=this.PreviousBlock.ParagraphWidgets[this.PreviousBlock.ParagraphWidgets.Count-1],o=c.ContainerWidget,r=o instanceof wt?o:null,a=r.ChildWidgets._IndexOf(c)):this.PreviousBlock instanceof e&&(c=this.PreviousBlock.TableWidgets[this.PreviousBlock.TableWidgets.Count-1],o=c.ContainerWidget,r=o instanceof wt?o:null,a=r.ChildWidgets._IndexOf(c)),r!=null&&v._Round(t.Y-b,2)==v._Round(r.ChildWidgets[a].Y+r.ChildWidgets[a].Height,2))r.ChildWidgets._Insert(a+1,t),t.ContainerWidget=r,r.Height+=t.Height;else{if(n.CurrentComment==null){var h=0,y=this.Document.DocumentStart,k=this;(y==null||k==y.Paragraph||y.Paragraph.IsInsideTable&&this instanceof e&&k._Contains(y.Paragraph.AssociatedCell))&&(h=-1);r!=null&&(h=i._IndexOf(r));n instanceof st&&this.Section!=null?(s=this.Section._GetIndexInOwnerCollection(),(s>i.Count-1||i[s].CurrentNode!=this.Section)&&(s==0?n.CurrentPage.BodyWidgets._Insert(s,this.Section._AddBodyWidget(new nt(n.ClientArea.X,n.ClientArea.Y,n.ClientArea.Width,0))):n.CurrentPage.BodyWidgets._Insert(s,this.Section._AddBodyWidget(new nt(i[s-1].X,i[s-1].Y,i[s-1].Width,0)))),f=this.Section.BodyWidgets[0]):f=h+1<i.Count?i[h+1]:i[i.Count-1]}f.ChildWidgets._Insert(0,t);t.ContainerWidget=f;f.Height+=t.Height}}else w=n.CurrentHeaderFooter.LayoutedWidgets[n.CurrentHeaderFooter.LayoutedWidgets.Count-1],w.ChildWidgets._Add(t),t.ContainerWidget=w},i.prototype._GetContainerTable=function(){var n=this;return(this.IsInsideTable&&(n=this.AssociatedCell.OwnerTable.IsInsideTable?this.AssociatedCell.OwnerTable._GetContainerTable():this.AssociatedCell.OwnerTable),n instanceof e)?n:null},i.prototype._GetContainerWidth=function(){return this.IsInsideTable?this.AssociatedCell.CellFormat.CellWidth-(this.AssociatedCell.CellFormat.LeftMargin+this.AssociatedCell.CellFormat.RightMargin):this._IsInComment()?this._GetOwnerComment().LayoutedWidget.ContentWidth:this.Section.SectionFormat.PageWidth-(this.Section.SectionFormat.LeftMargin+this.Section.SectionFormat.RightMargin)},i.prototype._IsExistBefore=function(n){var i,t,r,u;return this.IsInsideTable?(i=this.AssociatedCell,n.IsInsideTable?(t=n.AssociatedCell,i==t)?i.Blocks._IndexOf(this)<i.Blocks._IndexOf(n):i.OwnerRow==t.OwnerRow?i.CellIndex<t.CellIndex:i.OwnerTable==t.OwnerTable?i.OwnerRow.RowIndex<t.OwnerRow.RowIndex:(r=i._GetContainerCellOf(t),r.OwnerTable._Contains(t))?(i=i._GetSelectedCell(r),t=t._GetSelectedCell(r),i==r)?this._IsExistBefore(t.OwnerTable):t==r?i.OwnerTable._IsExistBefore(n):r.OwnerRow==t.OwnerRow?r.CellIndex<t.CellIndex:r.OwnerTable==t.OwnerTable?r.OwnerRow.RowIndex<t.OwnerRow.RowIndex:i.OwnerTable._IsExistBefore(t.OwnerTable):r.OwnerTable._IsExistBefore(t.OwnerTable._GetContainerTable()):(u=this._GetContainerTable(),u._IsExistBefore(n))):n.IsInsideTable?(u=n._GetContainerTable(),this._IsExistBefore(u)):this.Owner instanceof d?this.Owner.Blocks.indexOf(this)<n.Owner.Blocks.indexOf(n):this.Section==n.Section?this.Section.Blocks.indexOf(this)<this.Section.Blocks.indexOf(n):this.Document!=null?this.Document.Sections.indexOf(this.Section)<this.Document.Sections.indexOf(n.Section):void 0},i.prototype._IsExistAfter=function(n){var i,t,r,u;return this.IsInsideTable?(i=this.AssociatedCell,n.IsInsideTable?(t=n.AssociatedCell,i==t)?i.Blocks._IndexOf(this)>i.Blocks._IndexOf(n):i.OwnerRow==t.OwnerRow?i.CellIndex>t.CellIndex:i.OwnerTable==t.OwnerTable?i.OwnerRow.RowIndex>t.OwnerRow.RowIndex:(r=i._GetContainerCellOf(t),r.OwnerTable._Contains(t))?(i=i._GetSelectedCell(r),t=t._GetSelectedCell(r),i==r)?this._IsExistAfter(t.OwnerTable):t==r?i.OwnerTable._IsExistAfter(n):r.OwnerRow==t.OwnerRow?r.CellIndex>t.CellIndex:r.OwnerTable==t.OwnerTable?r.OwnerRow.RowIndex>t.OwnerRow.RowIndex:i.OwnerTable._IsExistAfter(t.OwnerTable):r.OwnerTable._IsExistAfter(t.OwnerTable._GetContainerTable()):(u=this._GetContainerTable(),u._IsExistAfter(n))):n.IsInsideTable?(u=n._GetContainerTable(),this._IsExistAfter(u)):this.Owner instanceof d?this.Owner.Blocks._IndexOf(this)>n.Owner.Blocks._IndexOf(n):this.Section==n.Section?this.Section.Blocks._IndexOf(this)>this.Section.Blocks._IndexOf(n):this.Document.Sections._IndexOf(this.Section)>this.Document.Sections._IndexOf(n.Section)},i.prototype._GetNextParagraph=function(){return this.NextBlock instanceof u?this.NextBlock:this.NextBlock instanceof e?this.NextBlock._GetFirstParagraphInFirstCell():this.Owner instanceof ot?this.Owner._GetNextParagraph():this.Owner instanceof ct?this.Owner._GetNextParagraph():this.Owner instanceof g?this.Owner._GetNextParagraph(this):null},i.prototype._GetFirstParagraph=function(){var n=this;return n instanceof u?n:n instanceof e?n._GetFirstParagraphInFirstCell():null},i.prototype._GetLastParagraph=function(){var n=this;return n instanceof u?n:n instanceof e?n._GetLastParagraphInLastCell():null},i.prototype._GetPreviousParagraph=function(){return this.PreviousBlock instanceof u?this.PreviousBlock:this.PreviousBlock instanceof e?this.PreviousBlock._GetLastParagraphInLastCell():this.Owner instanceof ot?this.Owner._GetPreviousParagraph():this.Owner instanceof ct?this.Owner._GetPreviousParagraph():this.Owner instanceof g?this.Owner._GetPreviousParagraph(this):null},i.prototype._GetPreviousBlock=function(){if(this.PreviousBlock==null){if(this.Owner instanceof ot)return this.Owner.OwnerTable._GetPreviousBlock();if(this.Owner instanceof ct)return this.Owner._GetPreviousBlock()}return this.PreviousBlock},i.prototype._GetNextRenderedBlock=function(){return this.NextBlock==null&&this.Owner instanceof ct&&this.Owner.NextNode!=null?this.Owner.NextNode.Blocks[0]:this.NextBlock},i.prototype._GetPreviousSelection=function(n){return this.PreviousBlock instanceof u?this.PreviousBlock:this.PreviousBlock instanceof e?n.IsForward?this.PreviousBlock.Rows[this.PreviousBlock.Rows.Count-1]._GetPreviousParagraphSelection(n):this.PreviousBlock._GetFirstParagraphInLastRow():this.Owner instanceof ot?this.Owner._GetPreviousSelection(n):this.Owner instanceof ct?this.Owner._GetPreviousSelection(n):null},i.prototype._GetNextSelection=function(n){return this.NextBlock instanceof u?this.NextBlock:this.NextBlock instanceof e?n.IsEmpty||n.IsForward?this.NextBlock._GetLastParagraphInFirstRow():this.NextBlock.Rows[0]._GetNextParagraphSelection(n):this.Owner instanceof ot?this.Owner._GetNextSelection(n):this.Owner instanceof ct?this.Owner._GetNextSelection(n):null},i.prototype._GetBodyWidgetOfPreviousBlock=function(n){n=0;var t=null;return this.PreviousBlock instanceof u?(t=this.PreviousBlock.ParagraphWidgets[this.PreviousBlock.ParagraphWidgets.Count-1].ContainerWidget,n=t.ChildWidgets._IndexOf(this.PreviousBlock.ParagraphWidgets[this.PreviousBlock.ParagraphWidgets.Count-1])):this.PreviousBlock instanceof e&&(t=this.PreviousBlock.TableWidgets[this.PreviousBlock.TableWidgets.Count-1].ContainerWidget,n=t.ChildWidgets._IndexOf(this.PreviousBlock.TableWidgets[this.PreviousBlock.TableWidgets.Count-1])),{prevBodyWidget:t,index:n}},i.prototype._Layout=function(){this._LayoutItem(!1)},i.prototype._LayoutItem=function(n){var t=null,u,i,r,f;this.Owner instanceof ct?(t=this.Owner,u=t.Blocks._IndexOf(this),t.BaseParent!=null&&t.BaseParent.IsLayoutEnabled&&t._LayoutItem(u,n)):this.Owner instanceof ot?(i=this.Owner,i=i._GetContainerCell(),t=i.Section,t!=null&&t.BaseParent!=null&&(r=t.Document,f=r.OwnerControl.Viewer,r.OwnerControl.IsLayoutEnabled&&i.OwnerRow._Layout(f,n))):this._IsInComment()&&this._GetOwnerComment()._Relayout()},i.prototype._LayoutNextItems=function(n){var t=this,o,f,s,r;for((t.NextNode==null||n.BlockToShift==t)&&(n.BlockToShift=null),o=!0;t.NextNode instanceof i||n instanceof st&&t._GetNextRenderedBlock()!=null;){if(f=null,f=t instanceof u?t.ParagraphWidgets[t.ParagraphWidgets.Count-1]:t.TableWidgets[t.TableWidgets.Count-1],n.FieldEndParagraph==t&&(n.FieldEndParagraph=null),t=n instanceof st?this._GetNextRenderedBlock():t.NextNode,n.BlockToShift==t&&(n.BlockToShift=null),s=!1,r=null,t instanceof u&&t.ParagraphWidgets.Count>0?r=t.ParagraphWidgets[0]:t instanceof e&&t.TableWidgets.Count>0&&(r=t.TableWidgets[0]),n.FieldEndParagraph==null&&n.FieldStack.Count==0&&r!=null&&f.ContainerWidget==r.ContainerWidget&&v._Round(r.Y,2)==v._Round(n.ClientActiveArea.Y,2)){n.BlockToShift!=null&&(n.BlockToShift=t);break}if(s=!0,n.OwnerControl.IsShiftingEnabled&&n.FieldEndParagraph==null&&n.FieldStack.Count==0){n.BlockToShift=t;break}else t._ClearWidgets(),n._UpdateClientAreaForBlock(t,!0),t._LayoutItems(n),n._UpdateClientAreaForBlock(t,!1)}n.OwnerControl.IsShiftingEnabled&&n.BlockToShift==t||t._UpdateListItemsTillEnd(o);(n instanceof st||n instanceof w)&&n._UpdateScrollBars()},i.prototype._UpdateListItemsTillEnd=function(n){for(var t=n?this._GetNextRenderedBlock():this;t!=null;)t._UpdateRenderedListItems(),t=t._GetNextRenderedBlock()},i.prototype._RelayoutOrShiftWidgets=function(n){var i=!1,t=this;i=t instanceof u?t.ParagraphWidgets.Count==0:t.TableWidgets.Count==0;i?(n._UpdateClientAreaForBlock(this,!0),this._LayoutItems(n),n._UpdateClientAreaForBlock(this,!1)):(this._ShiftWidgets(n),t._UpdateRenderedListItems())},i.prototype._ShiftNextWidgets=function(){for(var n=this;n.NextNode instanceof i||this.Document.OwnerControl.Viewer instanceof st&&n._GetNextRenderedBlock()!=null;)n=this.Document.OwnerControl.Viewer instanceof st?n._GetNextRenderedBlock():n.NextNode,n._RelayoutOrShiftWidgets(this.Document.OwnerControl.Viewer)},i.prototype._RemoveBlock=function(){this.IsInsideTable?this.AssociatedCell.Blocks._Remove(this):this.Owner instanceof d?this.Owner.Blocks._Remove(this):this.Owner instanceof g?this.Owner.Blocks._Remove(this):this.Owner.Blocks._Remove(this);this._ClearWidgets()},i}(yt);t.BlockAdv=hi;e=function(t){function r(n){t.call(this,n);this.flags=0;this.headerHeight=0;this.tableholder=null;this.tableGrid=new h;this.ChildNodes=new ku(this);this.TableFormat=new at(this);this.TableHolder=new df;this.SpannedRowCollection=new ni;this.TableWidgets=new h}return n(r,t),Object.defineProperty(r.prototype,"TableHolder",{get:function(){return this.tableholder},set:function(n){this.tableholder=n},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"Rows",{get:function(){return this.ChildNodes},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"Title",{get:function(){return this.title},set:function(n){this.title=n},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"Description",{get:function(){return this.description},set:function(n){this.description=n},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"TableWidth",{get:function(){return this.Rows==null?0:this._GetTableWidth()},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"ContinueHeader",{get:function(){return(this.flags&2)>>1!=0},set:function(n){this.flags=this.flags&253|(n?1:0)<<1},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"Header",{get:function(){return(this.flags&1)!=0},set:function(n){this.flags=this.flags&254|(n?1:0)},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"HeaderHeight",{get:function(){return this.headerHeight},set:function(n){this.headerHeight=n},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"IsTableGridUpdated",{get:function(){return(this.flags&4)>>2!=0},set:function(n){this.flags=this.flags&251|(n?1:0)<<2},enumerable:!0,configurable:!0}),r.prototype._SerializeBlock=function(){var n={Rows:[],TableFormat:[],Title:[],Description:[],ColumnsCount:[]},t,i;for(n.Title=this.Title,n.Description=this.Description,n.ColumnsCount=this.TableHolder.Columns.Count,t=0;t<this.Rows.length;t++)i=this.Rows[t],n.Rows[t]=i._SerializeRows();return n.TableFormat=this.TableFormat._SerializeTableFormat(),n},r.prototype._CanMergeSelectedCells=function(n,t,i){var c=this.Rows._IndexOf(i.OwnerRow),l=this.Rows._IndexOf(t.OwnerRow),y,p,u,e,o;if(l==c)return!0;var r=t.OwnerRow._GetCellLeft(t),f=r+t.CellFormat.CellWidth,a=i.OwnerRow._GetCellLeft(i),b=a+i.CellFormat.CellWidth;for(r>a&&(r=a),f<b&&(f=b),r>n.UpDownSelectionLength&&(r=n.UpDownSelectionLength),f<n.UpDownSelectionLength&&(f=n.UpDownSelectionLength),y=0,p=0,u=l;u<=c;u++){var s=this.Rows[u],w=0,h=0,k=!1;for(e=0;e<s.Cells.Count;e++)o=s._GetCellLeft(s.Cells[e]),v._Round(r,2)<=v._Round(o,2)&&v._Round(o,2)<v._Round(f,2)&&(k||(w=o,h=o,k=!0),h+=s.Cells[e].CellFormat.CellWidth);if(u==l)y=w,p=h;else{if(!(Math.round(y)==Math.round(w)&&Math.round(p)==Math.round(h)))return!1;if(u==c)return!0}}return!1},r.prototype._Clone=function(){var t=new r(null),n;for(t.TableFormat._CopyFormat(this.TableFormat),n=0;n<this.Rows.Count;n++)t.Rows._Add(this.Rows[n]._Clone());return t},r.prototype._CloneTableToHistoryInfo=function(n){var t=this._Clone();return n.RemovedNodes._Add(t),n.InsertPosition=this._GetHierarchicalIndex("0"),t},r.prototype._LayoutItems=function(n){var t,i,r;for(this.TableWidgets!=null&&this.TableWidgets.length>0&&this.TableWidgets._Clear(),(n instanceof st||n.CurrentComment!=null)&&!this.IsInsideTable&&(t=0,t=this._GetTableWidth(),Math.round(n.ClientArea.Width)<Math.round(t)&&(n.CurrentComment==null&&n.HorizontalWidth<n.ClientActiveArea.X+t+n.ClientArea.X||n.CurrentComment!=null&&n.HorizontalWidth<n.ClientActiveArea.X+t)&&(n instanceof st?n.HorizontalWidth=n.ClientActiveArea.X+t+n.ClientArea.X:n.CurrentComment.LayoutedWidget.ContentWidth=n.ClientActiveArea.X+t)),this._AddTableWidget(n.ClientActiveArea),n._UpdateClientAreaTopOrLeft(this.TableWidgets[this.TableWidgets.Count-1],!0),this.Rows.Count>0&&this.Rows[0].RowFormat.IsHeader?(this.Header=!0,this.ContinueHeader=!0,this.HeaderHeight=0):(this.Header=!1,this.ContinueHeader=!1,this.HeaderHeight=0),i=0;i<this.Rows.length;i++)r=this.Rows[i],r._LayoutItems(n);this._UpdateWidgetsToPage(n)},r.prototype._RelayoutSelection=function(n,t,i){var u=!1,r;return(this._Layout(),i.Paragraph.AssociatedCell!=null&&this._Contains(i.Paragraph.AssociatedCell))?!0:(r=this._GetNextRenderedBlock(),r!=null&&(u=r._RelayoutSelection(n,t,i)),u)},r.prototype._GetHeader=function(){for(var t,i=null,r=!0,n=0;n<this.Rows.length;n++)if(t=this.Rows[n],t.RowFormat.IsHeader?i=t:r=!1,!r)break;return i},r.prototype._GetTableWidth=function(){for(var u,n,t,f,i=0,r=0;r<this.Rows.length;r++){for(u=this.Rows[r],n=0,t=0;t<u.Cells.length;t++)f=u.Cells[t],n+=f.CellFormat.CellWidth;i<n&&(i=n)}return i},r.prototype._ApplyCharacterFormat=function(n,t,i,r,u,f){for(var o,s,h,e=0;e<this.Rows.Count;e++){for(o=this.Rows[e],s=0;s<o.Cells.Count;s++)o.Cells[s]._ApplyCharacterFormatForSel(n,r,u,f);if(i.Paragraph.IsInsideTable&&o._Contains(i.Paragraph.AssociatedCell))return}h=this._GetNextRenderedBlock();h._ApplyCharacterFormat(n,t,i,r,u,f)},r.prototype._ApplyCharacterFormatForSel=function(n,t,i,r){for(var e,f,u=0;u<this.Rows.Count;u++)for(e=this.Rows[u],f=0;f<e.Cells.Count;f++)e.Cells[f]._ApplyCharacterFormatForSel(n,t,i,r)},r.prototype._ApplyCharacterFormatForCell=function(n,t,i,r,u,f){var e=t.OwnerRow._GetCellLeft(t),h=e+t.CellFormat.CellWidth,l=i.OwnerRow._GetCellLeft(i),p=l+i.CellFormat.CellWidth,w,a,c,o,s,y;for(e>l&&(e=l),h<p&&(h=p),e>n.UpDownSelectionLength&&(e=n.UpDownSelectionLength),h<n.UpDownSelectionLength&&(h=n.UpDownSelectionLength),w=this.Rows._IndexOf(i.OwnerRow),a=!1,c=this.Rows._IndexOf(t.OwnerRow);c<=w;c++)for(o=this.Rows[c],s=0;s<o.Cells.Count;s++)y=o._GetCellLeft(o.Cells[s]),v._Round(e,2)<=v._Round(y,2)&&v._Round(y,2)<v._Round(h,2)&&(a||(u=o.Cells[s]._GetCharacterFormatValue(r,u),a=!0),o.Cells[s]._ApplyCharacterFormatForSel(n,r,u,f))},r.prototype._ApplyParagraphFormatTable=function(n,t,i,r,u,f){var e=t.OwnerRow._GetCellLeft(t),h=e+t.CellFormat.CellWidth,l=i.OwnerRow._GetCellLeft(i),y=l+i.CellFormat.CellWidth,p,a,c,o,s,v;for(e>l&&(e=l),h<y&&(h=y),e>n.UpDownSelectionLength&&(e=n.UpDownSelectionLength),h<n.UpDownSelectionLength&&(h=n.UpDownSelectionLength),p=this.Rows._IndexOf(i.OwnerRow),a=!1,c=this.Rows._IndexOf(t.OwnerRow);c<=p;c++)for(o=this.Rows[c],s=0;s<o.Cells.Count;s++)v=o._GetCellLeft(o.Cells[s]),Math.round(e)<=Math.round(v)&&Math.round(v)<Math.round(h)&&(a||(u=o.Cells[s]._GetParagraphFormatValue(r,u),a=!0),o.Cells[s]._ApplyParagraphFormatTableCell(n,r,u,f))},r.prototype._ApplyParagraphFormat=function(n,t,i,r,u,f){for(var o,s,h,e=0;e<this.Rows.Count;e++){for(o=this.Rows[e],s=0;s<o.Cells.Count;s++)o.Cells[s]._ApplyParagraphFormatTableCell(n,r,u,f);if(i.Paragraph.IsInsideTable&&o._Contains(i.Paragraph.AssociatedCell))return}h=this._GetNextRenderedBlock();h._ApplyParagraphFormat(n,t,i,r,u,f)},r.prototype._ApplyParagraphFormatInternal=function(n,t,i,r){for(var e,f,u=0;u<this.Rows.Count;u++)for(e=this.Rows[u],f=0;f<e.Cells.Count;f++)e.Cells[f]._ApplyParagraphFormatTableCell(n,t,i,r)},r.prototype._AddTableWidget=function(n){var t=new ci(this);t.Width=n.Width;t.X=n.X;t.Y=n.Y;this.TableWidgets._Add(t);this.TableFormat!=null&&this.TableFormat.CellSpacing>0&&(t.Height=t.Height+this.TableFormat.CellSpacing,t.LeftBorderWidth=this.TableFormat.Borders._GetTableLeftBorder()._GetLineWidth(),t.RightBorderWidth=this.TableFormat.Borders._GetTableRightBorder()._GetLineWidth(),t.TopBorderWidth=this.TableFormat.Borders._GetTableTopBorder()._GetLineWidth(),t.BottomBorderWidth=this.TableFormat.Borders._GetTableBottomBorder()._GetLineWidth(),t.X+=t.LeftBorderWidth,t.Y+=t.TopBorderWidth,t.Width-=t.LeftBorderWidth,t.Width-=t.RightBorderWidth,t.Height+=t.BottomBorderWidth)},r.prototype._CreateTable=function(n,t){for(var f,r=null,i=null,e=0;e<n;e++){for(r=new bt(null),f=0;f<t;f++)i=new ot(null),i.CellFormat.CellWidth=100,i.Blocks._Add(new u(null)),r.Cells._Add(i);this.Rows._Add(r)}this.TableFormat._InitializeTableBorders()},r.prototype._BuildColumns=function(){var a,n,v,o,e,i,y,c,l,p,r,s;if(this.tableGrid!=null&&df!=null&&!this.IsTableGridUpdated){for(this.TableHolder.Columns._Clear(),this.tableGrid._Clear(),a=0,n=new h,r=0;r<this.Rows.length;r++){var u=this.Rows[r],t=u.GridBefore,f=0;for(this.tableGrid._Contains(f)||this.tableGrid._Add(f),f+=u.GridBeforeWidth*15,v=Math.round(f),this.tableGrid._Contains(v)||this.tableGrid._Add(v),o=0;o<u.Cells.length;o++){for(e=u.Cells[o],n.length==0&&(e.ColumnIndex=t),i=0;i<n.length;i++){if(n[i].ColumnIndex<t){e.ColumnIndex=t;continue}y=1;c=!0;y=n[i].CellFormat.RowSpan;n[i].ColumnIndex>t?(e.ColumnIndex=t,c=!1,o==u.Cells.length-1&&u.GridAfter>0&&(f+=n[i].CellFormat.CellWidth*15)):(e.ColumnIndex=t=this.TableHolder.Columns.indexOf(n[i].OwnerColumn)+n[i].CellFormat.ColumnSpan,f+=n[i].CellFormat.CellWidth*15);c||o!=u.Cells.length-1||(c=!0);c&&r-n[i].OwnerRow.RowIndex==y-1&&(n._RemoveAt(i),i--)}if(e.CellFormat.RowSpan>1)if(n.length==0||n[n.length-1].ColumnIndex<=t)n._Add(e);else for(l=n.length;l>0;l--)n[l-1].ColumnIndex>t&&n._Insert(l-1,e);if(t+=e.CellFormat.ColumnSpan,f+=e.CellFormat.CellWidth*15,p=Math.round(f),this.tableGrid._Contains(p)||this.tableGrid._Add(p),o==u.Cells.length-1&&u.GridAfterWidth>0&&(f+=u.GridAfterWidth*15,this.tableGrid._Contains(Math.round(f))||this.tableGrid._Add(Math.round(f)),t+=u.GridAfter),a=Math.max(a,t-1),this.TableHolder.Columns.length<t)for(s=new ef,this.TableHolder.Columns._Add(s);this.TableHolder.Columns.length<t;)s=new ef,this.TableHolder.Columns._Add(s)}}for(this.tableGrid._Sort(),r=0;r<this.tableGrid.length-1;r++)s=this.TableHolder.Columns[r],s.PreferredWidth=(this.tableGrid[r+1]-this.tableGrid[r])/15;for(this.tableGrid._Clear();a+1<this.TableHolder.Columns.length;)this.TableHolder.Columns._RemoveAt(this.TableHolder.Columns.length-1)}},r.prototype._UpdateWidgetsToPage=function(n){var t=this.TableWidgets[this.TableWidgets.length-1];this.IsInsideTable?(this.AssociatedCell.TableCellWidgets[this.AssociatedCell.TableCellWidgets.length-1].ChildWidgets._Add(t),t.ContainerWidget=this.AssociatedCell.TableCellWidgets[this.AssociatedCell.TableCellWidgets.length-1],this.AssociatedCell.TableCellWidgets[this.AssociatedCell.TableCellWidgets.Count-1].Height=this.AssociatedCell.TableCellWidgets[this.AssociatedCell.TableCellWidgets.Count-1].Height+t.Height):(this._UpdateWidgetsToBody(n,t),t._UpdateHeight(n),t.ChildWidgets.Count>0&&t.Y!=t.ChildWidgets[0].Y&&(t.Y=t.ChildWidgets[0].Y));this.TableFormat.CellSpacing>0&&(t.Y+t.Height+this.TableFormat.CellSpacing>n.ClientArea.Bottom&&n instanceof w&&(t.Height=t.Height-this.TableFormat.CellSpacing/2),n._CutFromTop(t.Y+t.Height))},r.prototype._GetLastBlockInLastCell=function(){var n=this,t,i;return n.Rows.Count>0?(t=n.Rows[n.Rows.Count-1],i=t.Cells[t.Cells.Count-1],i.Blocks[i.Blocks.Count-1]):null},r.prototype._GetLastParagraphInFirstRow=function(){var t=this;if(t.Rows.Count>0){var i=t.Rows[0],r=i.Cells[i.Cells.Count-1],n=r.Blocks[r.Blocks.Count-1];return n instanceof u?n:n._GetLastParagraphInLastCell()}return null},r.prototype._GetLastParagraphInLastCell=function(){var n=this;if(n.Rows.Count>0){var i=n.Rows[n.Rows.Count-1],r=i.Cells[i.Cells.Count-1],t=r.Blocks[r.Blocks.Count-1];return t instanceof u?t:t._GetLastParagraphInLastCell()}return null},r.prototype._GetFirstParagraphInFirstCell=function(){var r=this,t,i,n;return r.Rows.length>0&&(t=r.Rows[0],t.Cells.length>0&&(i=t.Cells[0],i.Blocks.length>0))?(n=i.Blocks[0],n instanceof u?n:n._GetFirstParagraphInFirstCell()):null},r.prototype._GetFirstBlockInFirstCell=function(){var i=this,n,t;return i.Rows.length>0&&(n=i.Rows[0],n.Cells.Count>0)?(t=n.Cells[0],t.Blocks.Count==0)?null:t.Blocks[0]:null},r.prototype._Contains=function(n){if(this==n.OwnerTable)return!0;while(n.OwnerTable.IsInsideTable){if(this==n.OwnerTable)return!0;n=n.OwnerTable.AssociatedCell}return this==n.OwnerTable},r.prototype._HighlightCells=function(n,t,i,r){var u=i.OwnerRow._GetCellLeft(i),f=u+i.CellFormat.CellWidth,o=r.OwnerRow._GetCellLeft(r),s=o+r.CellFormat.CellWidth,h,e;for(u>o&&(u=o),f<s&&(f=s),u>n.UpDownSelectionLength&&(u=n.UpDownSelectionLength),f<n.UpDownSelectionLength&&(f=n.UpDownSelectionLength),h=this.Rows._IndexOf(r.OwnerRow),e=this.Rows._IndexOf(i.OwnerRow);e<=h;e++)this.Rows[e]._Highlight(n,t,u,f)},r.prototype._Highlight=function(n,t,i,r){if(this.Rows[0]._HighlightInternal(n,t,i,r),!r.Paragraph.IsInsideTable||!this._Contains(r.Paragraph.AssociatedCell)){var u=this._GetNextRenderedBlock();u._Highlight(n,t,i,r)}},r.prototype._GetSelectedContentAsHtml=function(n,t,i){var r="<table ",u;return r+=this.TableFormat._GetAsHtmlStyle(),r+=">",r+=this.Rows[0]._GetSelectedContentAsHtml(n,t,i),r+="<\/table>",i.Paragraph.IsInsideTable&&this._Contains(i.Paragraph.AssociatedCell)||(u=this._GetNextRenderedBlock(),r+=u._GetSelectedContentAsHtml(n,t,i)),r},r.prototype._GetSelectedContentAsHtmlInternal=function(n,t,i){var r=t.OwnerRow._GetCellLeft(t),u=r+t.CellFormat.CellWidth,e=i.OwnerRow._GetCellLeft(i),s=e+i.CellFormat.CellWidth,h,o,f;for(r>e&&(r=e),u<s&&(u=s),r>n.UpDownSelectionLength&&(r=n.UpDownSelectionLength),u<n.UpDownSelectionLength&&(u=n.UpDownSelectionLength),h=this.Rows._IndexOf(i.OwnerRow),o="",f=this.Rows._IndexOf(t.OwnerRow);f<=h;f++)o+=this.Rows[f]._GetSelectedContentAsHtmlInternal(n,r,u);return o},r.prototype._GetContentAsHtml=function(){var n="<table ",t;for(n+=this.TableFormat._GetAsHtmlStyle(),n+=">",t=0;t<this.Rows.length;t++)n+=this.Rows[t]._GetContentAsHtml();return n+"<\/table>"},r.prototype._GetFirstParagraphInLastRow=function(){if(this.Rows.Count>0){var t=this.Rows[this.Rows.Count-1],i=t.Cells[0],n=i.Blocks[0];return n instanceof u?n:n._GetFirstParagraphInFirstCell()}return null},r.prototype._GetCellInTable=function(n){while(n.OwnerTable.IsInsideTable){if(this==n.OwnerTable)return n;n=n.OwnerTable.AssociatedCell}return n},r.prototype._GetCharacterFormat=function(n,t,i){for(var u,f,e,r=0;r<this.Rows.Count;r++){for(u=this.Rows[r],f=0;f<u.Cells.Count;f++)u.Cells[f]._GetCharacterFormatForSelection(n,t,i);if(i.Paragraph.IsInsideTable&&u._Contains(i.Paragraph.AssociatedCell))return}e=this._GetNextRenderedBlock();e._GetCharacterFormat(n,t,i)},r.prototype._GetCharacterFormatInternal=function(n,t,i,r,u){var f=t.OwnerRow._GetCellLeft(t),e=f+t.CellFormat.CellWidth,c=i.OwnerRow._GetCellLeft(i),a=c+i.CellFormat.CellWidth,y,h,o,s,l;for(f>c&&(f=c),e<a&&(e=a),f>n.UpDownSelectionLength&&(f=n.UpDownSelectionLength),e<n.UpDownSelectionLength&&(e=n.UpDownSelectionLength),y=this.Rows._IndexOf(i.OwnerRow),h=this.Rows._IndexOf(t.OwnerRow);h<=y;h++)for(o=this.Rows[h],s=0;s<o.Cells.Count;s++)l=o._GetCellLeft(o.Cells[s]),v._Round(f,2)<=v._Round(l,2)&&v._Round(l,2)<v._Round(e,2)&&o.Cells[s]._GetCharacterFormatForSelection(n,r,u)},r.prototype._GetParagraphFormatInternal=function(n,t,i){for(var u,f,e,r=0;r<this.Rows.Count;r++){for(u=this.Rows[r],f=0;f<u.Cells.Count;f++)u.Cells[f]._GetParagraphFormat(n);if(i.Paragraph.IsInsideTable&&u._Contains(i.Paragraph.AssociatedCell))return}e=this._GetNextRenderedBlock();e._GetParagraphFormatInternal(n,t,i)},r.prototype._GetParagraphFormat=function(n){for(var r,i,t=0;t<this.Rows.Count;t++)for(r=this.Rows[t],i=0;i<r.Cells.Count;i++)r.Cells[i]._GetParagraphFormat(n)},r.prototype._GetParagraphFormatForTableCell=function(n,t,i){var r=t.OwnerRow._GetCellLeft(t),u=r+t.CellFormat.CellWidth,s=i.OwnerRow._GetCellLeft(i),c=s+i.CellFormat.CellWidth,l,o,f,e,h;for(r>s&&(r=s),u<c&&(u=c),r>n.UpDownSelectionLength&&(r=n.UpDownSelectionLength),u<n.UpDownSelectionLength&&(u=n.UpDownSelectionLength),l=this.Rows._IndexOf(i.OwnerRow),o=this.Rows._IndexOf(t.OwnerRow);o<=l;o++)for(f=this.Rows[o],e=0;e<f.Cells.Count;e++)h=f._GetCellLeft(f.Cells[e]),v._Round(r,2)<=v._Round(h,2)&&v._Round(h,2)<v._Round(u,2)&&f.Cells[e]._GetParagraphFormat(n)},r.prototype._GetCellFormat=function(n,t,i){for(var u,f,r,o=!1,e=0;e<this.Rows.Count;e++)if(u=this.Rows[e],u==t.Paragraph.AssociatedCell.OwnerRow&&(o=!0),o)for(f=0;f<u.Cells.Count;f++)if(r=u.Cells[f],r._IsCellSelected(t,i)&&n.CellFormat._CombineFormat(r.CellFormat),r==i.Paragraph.AssociatedCell){n.CellFormat._CombineFormat(r.CellFormat);return}},r.prototype._GetRowFormat=function(n,t,i){var f=t.Paragraph.AssociatedCell.OwnerRow,r,u;if(f!=i.Paragraph.AssociatedCell.OwnerRow)for(r=this.Rows._IndexOf(f)+1;r<this.Rows.Count;r++)if(u=this.Rows[r],n.RowFormat._CombineFormat(u.RowFormat),u==i.Paragraph.AssociatedCell.OwnerRow)return},r.prototype._ClearWidgets=function(){var n,t;if(this.TableWidgets!=null&&this.TableWidgets.Count>0)for(n=0;n<this.TableWidgets.Count;n++)t=this.TableWidgets[n],t._Dispose(),this.TableWidgets._Remove(t),n--},r.prototype._ShiftWidgets=function(n){var e=0,s=this._GetBodyWidgetOfPreviousBlock(e),o=s.prevBodyWidget,f,t,i,u,r;for(e=s.index,this._UpdateVerticalPositionToTop(!0),n instanceof w&&n.CurrentComment==null&&this._CombineTableWidgets(null),f=0;f<this.TableWidgets.Count;f++)t=this.TableWidgets[f],i=null,n instanceof w&&n.ClientActiveArea.Height<t.Height&&t._IsFirstLineFit(t.Y+n.ClientActiveArea.Height)&&(i=t._GetSplittedWidget(t.Y+n.ClientActiveArea.Height),i._UpdateChildLocation(t.Y)),n instanceof st||n.CurrentComment!=null?(u=new p(t.X,n.ClientActiveArea.Y),t.X=u.X,t.Y=u.Y,t._UpdateChildLocation(t.Y),n._CutFromTop(t.Y+t.Height)):n.ClientActiveArea.Height>=t.Height?(u=new p(t.X,n.ClientActiveArea.Y),t.X=u.X,t.Y=u.Y,t._UpdateChildLocation(t.Y),o!=t.ContainerWidget&&(e++,t._UpdateContainerWidget(o,e)),n instanceof w&&t._UpdateHeight(n),n._CutFromTop(t.Y+t.Height)):i==null&&(i=t,f--),i!=null&&(this.TableWidgets._Contains(i)||this.TableWidgets._Add(i),r=o._CreateOrGetNextBodyWiget(n),(r.ChildWidgets.Count>0||i.ContainerWidget==r)&&n._UpdateClientArea(r.CurrentNode.SectionFormat),i.ContainerWidget!=r&&i._UpdateContainerWidget(r,0),o=r);this._UpdateVerticalPositionToTop(!1)},r.prototype._UpdateVerticalPositionToTop=function(n){for(var u,i,f,r,e,t=0;t<this.TableWidgets.Count;t++)for(u=this.TableWidgets[t],i=0;i<u.ChildWidgets.Count;i++)for(f=u.ChildWidgets[i],r=0;r<f.ChildWidgets.Count;r++)e=f.ChildWidgets[r],e._UpdateCellVerticalPosition(n,!1)},r.prototype._CombineTableWidgets=function(n){var i,r,u,t,e;if(this.TableWidgets.Count!=0){if(i=this.TableWidgets[0],n==null||n.ChildWidgets._Contains(i)||i._UpdateContainerWidgetForCell(n),this.TableWidgets.Count==1){for(t=0;t<this.TableWidgets[0].ChildWidgets.Count;t++)for(r=this.TableWidgets[0].ChildWidgets[t],u=0;u<r.ChildWidgets.Count;u++)r.ChildWidgets[u]._UpdateWidgetHeight();return}for(i.Height=0,t=0;t<this.Rows.Count;t++){var f=this.Rows[t],r=f.TableRowWidgets[0],o=i.ChildWidgets._Contains(r);f._CombineTableRowWidgets(i);f._UpdateRowHeightBySpannedCell(i,r,i.ChildWidgets.Count);o&&(i.Height+=r.Height)}for(i._UpdateChildLocation(i.Y),t=1;t<this.TableWidgets.Count;t++)e=this.TableWidgets[t],e._Dispose(),t--}},r.prototype._UpdateListItems=function(n){for(var i,t=0;t<this.Rows.Count;t++)if(this==n||(i=this.Rows[t]._UpdateListItems(n),i))return!0;return!1},r.prototype._UpdateListParagraphs=function(){for(var t,i,n=0;n<this.Rows.Count;n++)for(t=0;t<this.Rows[n].Cells.Count;t++)for(i=0;i<this.Rows[n].Cells[t].Blocks.Count;i++)this.Rows[n].Cells[t].Blocks[i]._UpdateListParagraphs()},r.prototype._UpdateRenderedListItems=function(){for(var n=0;n<this.Rows.Count;n++)this.Rows[n]._UpdateRenderedListItems()},r.prototype._Delete=function(n,t,i,r){var u,f,e,o,s;if(i.Paragraph.IsInsideTable&&this._Contains(i.Paragraph.AssociatedCell)){if(this.Rows[this.Rows.Count-1]._Contains(i.Paragraph.AssociatedCell))this._DeleteContent(n,r);else for(u=0;u<this.Rows.Count;u++)if(f=this.Rows[u],r<4&&(this.Rows._Remove(f),n.CurrentBaseHistoryInfo.RemovedNodes._Add(f),u--),f._Contains(i.Paragraph.AssociatedCell))return}else e=this._GetNextRenderedBlock(),o=this.Section,this._DeleteContent(n,r),e!=null&&(s=e.Section,o!=s&&(r<4&&o._CombineSection(n,s),r>2&&n._CopySectionFormat(o)),e._Delete(n,t,i,r))},r.prototype._DeleteContent=function(n,t){t<4&&(this._RemoveBlock(),n.CurrentBaseHistoryInfo.RemovedNodes._Add(this))},r.prototype._DeleteCells=function(n,t,r,u){var d=null,c=!1,y=i.Delete,o,f,e,a;n.CurrentBaseHistoryInfo!=null&&(y=n.CurrentBaseHistoryInfo.Action,c=n.CurrentBaseHistoryInfo.Action==i.BackSpace||n.CurrentBaseHistoryInfo.Action==i.DeleteCells||n.CurrentBaseHistoryInfo.Action==i.InsertTable||t.OwnerRow.PreviousNode==null&&r.OwnerRow.NextNode==null&&n.CurrentBaseHistoryInfo.Action==i.Cut,n.CurrentBaseHistoryInfo.Action=c?i.DeleteCells:i.ClearCells,d=this._CloneTableToHistoryInfo(n.CurrentBaseHistoryInfo),n.OwnerControl.IsLayoutEnabled=!1);var s=t.OwnerRow._GetCellLeft(t),h=s+t.CellFormat.CellWidth,l=r.OwnerRow._GetCellLeft(r),p=l+r.CellFormat.CellWidth;s>l&&(s=l);h<p&&(h=p);s>n.UpDownSelectionLength&&(s=n.UpDownSelectionLength);h<n.UpDownSelectionLength&&(h=n.UpDownSelectionLength);var w=this.Rows._IndexOf(r.OwnerRow),b=!1,k=!1;for(o=this.Rows._IndexOf(t.OwnerRow);o<=w&&o<this.Rows.Count;o++){for(f=this.Rows[o],e=0;e<f.Cells.Count;e++)a=f._GetCellLeft(f.Cells[e]),v._Round(s,2)<=v._Round(a,2)&&v._Round(a,2)<v._Round(h,2)&&(b||(f.Cells[e]._UpdateEditPosition(n),b=!0),c?(f.Cells._RemoveAt(e),e--):u<4&&(k=f.Cells[e]._DeleteCell(n,u,!1)));f.Cells.Count==0&&(this.Rows._RemoveAt(o),o--,w--)}n.OwnerControl.IsLayoutEnabled=!0;this.Rows.Count==0?(n.EditPosition=this._GetHierarchicalIndex("0"),n.CurrentBaseHistoryInfo.Action=y,this._RemoveBlock()):c||k?this._Layout():n.CurrentBaseHistoryInfo=null},r.prototype._CalculateGridOnly=function(){for(var a,o,e,t,v,s,c,y,i=new h,n=new h,l=0;l<this.Rows.Count;l++){var r=this.Rows[l],f=r.GridBefore,u=0;for(i._Contains(u)||i._Add(u),u+=r.GridBeforeWidth*15,a=Math.round(u),i._Contains(a)||i._Add(a),o=0;o<r.Cells.Count;o++){for(e=r.Cells[o],n.Count==0&&(e.ColumnIndex=f),t=0;t<n.Count;t++){if(n[t].ColumnIndex<f){e.ColumnIndex=f;continue}v=1;s=!0;v=n[t].CellFormat.RowSpan;n[t].ColumnIndex>f?(e.ColumnIndex=f,s=!1,o==r.Cells.Count-1&&r.GridAfter>0&&(u+=n[t].CellFormat.CellWidth*15)):(e.ColumnIndex=f=this.TableHolder.Columns._IndexOf(n[t].OwnerColumn)+n[t].CellFormat.ColumnSpan,u+=n[t].CellFormat.CellWidth*15);s||o!=r.Cells.Count-1||(s=!0);s&&l-n[t].OwnerRow.RowIndex==v-1&&(n._RemoveAt(t),t--)}if(e.CellFormat.RowSpan>1)if(n.Count==0||n[n.Count-1].ColumnIndex<=f)n._Add(e);else for(c=n.Count;c>0;c--)n[c-1].ColumnIndex>f&&n._Insert(c-1,e);f+=e.CellFormat.ColumnSpan;u+=e.CellFormat.CellWidth*15;y=Math.round(u);i._Contains(y)||i._Add(y);o==r.Cells.Count-1&&r.GridAfterWidth>0&&(u+=r.GridAfterWidth*15,i._Contains(Math.round(u))||i._Add(Math.round(u)),f+=r.GridAfter)}}i._Sort();i.Count-1!=this.TableHolder.Columns.Count&&this._UpdateColumnSpans(i)},r.prototype._UpdateColumnSpans=function(n){for(var t,r,u,f,i=0;i<this.Rows.length;i++){for(t=this.Rows[i],t.GridBeforeWidth>=0&&(t.GridBefore=t._GetGridCount(n,-1)),r=0;r<t.Cells.length;r++)u=t.Cells[r],f=t._GetGridCount(n,u._GetIndexInOwnerCollection()),f>0&&u.CellFormat.ColumnSpan!=f&&(this.IsTableGridUpdated=!1,u.CellFormat.ColumnSpan=f);t.GridAfterWidth>=0&&(t.GridAfter=t._GetGridCount(n,t.Cells.Count))}},r.prototype._CheckTableGrid=function(){this.tableGrid!=null&&this.tableGrid.Count>1?this._BuildColumns():(this.tableGrid=new h,this._BuildColumns())},r.prototype._FitChildsToClientArea=function(){var o=this._GetContainerWidth(),n,u,t,f,i,e;for(Math.round(o)<Math.round(this.TableWidth)&&this._FitCellsToClientArea(o),n=0;n<this.Rows.length;n++)for(u=this.Rows[n],t=0;t<u.Cells.length;t++)for(f=u.Cells[t],i=0;i<f.Blocks.length;i++)e=f.Blocks[i],e instanceof r&&e._FitChildsToClientArea()},r.prototype._GetParentTable=function(){for(var n=this;!(n.Owner instanceof ct)&&n.Owner instanceof ot;)n=n.Owner.OwnerTable;return n},r.prototype._FitCellsToClientArea=function(n){for(var t,i,f,e=this._GetTableWidth(),r=n/e,u=0;u<this.Rows.length;u++)for(t=this.Rows[u],t.GridAfterWidth*=r,t.GridBeforeWidth*=r,i=0;i<t.Cells.length;i++)f=t.Cells[i],f.CellFormat.CellWidth*=r},r.prototype._GetColumnCellsForSelection=function(n,t){for(var u=new h,e=n.ColumnIndex,f=e+1,l,c,f=t.ColumnIndex+t.CellFormat.ColumnSpan,s=0;s<this.Rows.length;s++)for(l=this.Rows[s],c=0;c<l.Cells.length;c++){var r=l.Cells[c],i=r.ColumnIndex,o=1;o=r.CellFormat.ColumnSpan;i+o>e&&i+o<f||i>e&&i<f?u._Contains(r)||u._Add(r):i>e&&i<f&&i+o<f||i<e&&i+o>f?u._Contains(r)||u._Add(r):(i==e||i+o==f)&&(u._Contains(r)||u._Add(r))}return u},r.prototype._InsertTable=function(n,t){var f=this._GetIndexInOwnerCollection(),e=this.Owner instanceof yt?this.Owner:null,r=null,o=this.Owner instanceof g?this.Owner:null,i,u,s;if(this._RemoveBlock(),t)for(i=0,u=0;i<this.Rows.Count;i++,u++)s=this.Rows[i],n.Rows._Insert(u,s),i--;if(o!=null){o.Blocks._Insert(f,n);return}e!=null&&(r=e.ChildNodes);r!=null&&r instanceof ur&&r._Insert(f,n)},r.prototype._GetColumnCells=function(n,t){for(var e,r,i,u=new h,f=0;f<this.Rows.length;f++)for(e=this.Rows[f],r=0;r<e.Cells.length;r++)i=e.Cells[r],t?i.ColumnIndex+i.CellFormat.ColumnSpan==n&&u._Add(i):i.ColumnIndex==n&&u._Add(i);return u},r.prototype._GetLeastGridBefore=function(n){for(var t,i=0,u=0,r=0;r<this.Rows.length;r++)t=this.Rows[r],t!=n&&(u==0&&(i=t.GridBeforeWidth,u++),t.GridBeforeWidth<=i&&(i=t.GridBeforeWidth));return i},r.prototype._GetOwnerWidth=function(){var n=0;if(this.AssociatedCell!=null)n=this.AssociatedCell.CellFormat.CellWidth-this.AssociatedCell.LeftMargin-this.AssociatedCell.RightMargin;else{if(this.Section==null)return n;n=this.Section.SectionFormat.PageWidth}return n},r.prototype._GetTableClientWidth=function(n){var t=0;return this.TableFormat.PreferredWidthType==ht.Pixel&&this.TableFormat.PreferredWidth>0?t=this.TableFormat.PreferredWidth:(t=n,this.TableFormat.PreferredWidthType==ht.Percent&&this.TableFormat.PreferredWidth>0&&(t=t*this.TableFormat.PreferredWidth/100)),t},r.prototype._IsColumnSelected=function(n,t){var i,u;if(Document==null)return!1;var f=t._GetSelectedCells(),e=this._GetColumnCells(n,!0),o=this._GetColumnCells(n,!1),r=!1;for(i=0;i<e.length;i++)u=e[i],r=f._Contains(u)?!0:!1;if(!r)for(i=0;i<o.length;i++)u=o[i],r=f._Contains(u)?!0:!1;return r},r.prototype._UpdateWidth=function(){if(this.TableFormat.PreferredWidthType==ht.Auto&&(this.TableFormat.PreferredWidthType=ht.Pixel),this.TableFormat.PreferredWidthType==ht.Pixel)this.TableFormat.PreferredWidth=this._GetMaxRowWidth(!0);else{var n=this._ConvertPixelToPercent(this._GetMaxRowWidth(!0));this.TableFormat.PreferredWidth=n}},r.prototype._GetMaxRowWidth=function(n){for(var i,t,r,e,u=0,f=0;f<this.Rows.length;f++){for(i=this.Rows[f],t=0,n&&(t=t+i.GridBeforeWidth),r=0;r<i.Cells.length;r++)e=i.Cells[r],t+=e.CellFormat.CellWidth;u<t&&(u=t)}return u},r.prototype._ConvertPixelToPercent=function(n){var t=0,i=this._GetOwnerWidth();return t=n/i*100,t=v._Round(t,1),t<100?t:100},r.prototype._ConvertPercentToPixel=function(n){var t=0,i=this._GetOwnerWidth();return t=n*i/100,t=v._Round(t,2),t<2112?t:2112},r.prototype._UpdateRowsGridAfterWidth=function(){for(var n,t,i=this._GetMaxRowWidth(!0),r=0;r<this.Rows.length;r++)n=this.Rows[r],t=n._GetRowWidth(!0),i>=t&&n.GridAfterWidth!=i-t&&(n.GridAfterWidth=i-t)},r.prototype._Dispose=function(){var n,t;if(this.SpannedRowCollection!=null&&(this.SpannedRowCollection._Clear(),this.SpannedRowCollection=null),this._SetOwner(null),this.TableFormat._Dispose(),this.tableholder!=null&&(this.tableholder._Dispose(),this.tableholder=null),this.TableWidgets!=null&&(this._ClearWidgets(),this.TableWidgets=null),this.Rows!=null){for(this.Rows._Dispose(),n=0;n<this.Rows.Count;n++)t=this.Rows[n],t._Dispose(),this.Rows._Remove(t),n--;this.ChildNodes=null}this.Fields=null;this.FieldCharacter=null},r}(hi);t.TableAdv=e;bt=function(t){function i(n){t.call(this,n);this.gridBefore=0;this.gridBeforeWidth=0;this.gridAfter=0;this.gridAfterWidth=0;this.ChildNodes=new du(this);this.RowFormat=new tr(this);this.TableRowWidgets=new h}return n(i,t),Object.defineProperty(i.prototype,"OwnerTable",{get:function(){return this.Owner},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"RowIndex",{get:function(){return this.OwnerTable!=null?this.OwnerTable.Rows.indexOf(this):-1},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"GridBefore",{get:function(){return this.gridBefore},set:function(n){this.gridBefore=n},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"GridBeforeWidth",{get:function(){return this.gridBeforeWidth},set:function(n){this.gridBeforeWidth=n},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"GridAfter",{get:function(){return this.gridAfter},set:function(n){this.gridAfter=n},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"GridAfterWidth",{get:function(){return this.gridAfterWidth},set:function(n){this.gridAfterWidth=n},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Cells",{get:function(){return this.ChildNodes},enumerable:!0,configurable:!0}),i.prototype._ApplyCharacterFormat=function(n,t,i,r,u,f){var e,o,s,h;for(u=this.Cells[0]._GetCharacterFormatValue(r,u),e=this.RowIndex;e<this.OwnerTable.Rows.Count;e++){for(o=this.OwnerTable.Rows[e],s=0;s<o.Cells.Count;s++)o.Cells[s]._ApplyCharacterFormatForSel(n,r,u,f);if(i.Paragraph.IsInsideTable&&o._Contains(i.Paragraph.AssociatedCell))return}h=this.OwnerTable._GetNextRenderedBlock();h._ApplyCharacterFormat(n,t,i,r,u,f)},i.prototype._LayoutItems=function(n){var t,i;for(this.TableRowWidgets!=null&&this.TableRowWidgets.length>0&&this.TableRowWidgets._Clear(),this._AddTableRowWidget(n.ClientActiveArea),n._UpdateClientAreaForRow(this,!0),t=0;t<this.Cells.length;t++)i=this.Cells[t],i._LayoutItems(n,this._GetMaxTopOrBottomCellMargin(0)+this.TableRowWidgets[this.TableRowWidgets.Count-1].TopBorderWidth,this._GetMaxTopOrBottomCellMargin(1)+this.TableRowWidgets[this.TableRowWidgets.Count-1].BottomBorderWidth);n._UpdateClientAreaForRow(this,!1);this._UpdateWidgetsToTable(n)},i.prototype._AddTableRowWidget=function(n){var u=new li(this),i,f,t,r;if(u.X=n.X+this.GridBeforeWidth,u.Y=n.Y,u.Width=n.Width,this.TableRowWidgets._Add(u),i=0,this.OwnerTable!=null&&this.OwnerTable.TableFormat!=null&&this.OwnerTable.TableFormat.CellSpacing>0){for(u.Height=u.Height+this.OwnerTable.TableFormat.CellSpacing,t=0;t<this.Cells.Count;t++)this.Cells[t].CellFormat!=null&&this.Cells[t].CellFormat.Borders!=null&&(r=this.Cells[t].CellFormat.Borders._GetCellBottomBorder(this.Cells[t])._GetLineWidth(),r>i&&(i=r));if(u.BottomBorderWidth=i,this.RowIndex>0&&this.PreviousNode!=null){for(f=this.PreviousNode,i=0,t=0;t<f.Cells.Count;t++)f.Cells[t].CellFormat!=null&&f.Cells[t].CellFormat.Borders!=null&&(r=f.Cells[t].CellFormat.Borders._GetCellBottomBorder(f.Cells[t])._GetLineWidth(),r>i&&(i=r));u.TopBorderWidth=i}}if(this.Cells!=null)for(t=0;t<this.Cells.Count;t++)this.Cells[t].CellFormat!=null&&this.Cells[t].CellFormat.Borders!=null&&(r=this.Cells[t].CellFormat.Borders._GetCellTopBorder(this.Cells[t])._GetLineWidth(),r>i&&(i=r));if(u.TopBorderWidth=i,this.OwnerTable!=null&&this.OwnerTable.TableFormat!=null&&this.OwnerTable.TableFormat.CellSpacing<=0&&this.RowIndex==this.OwnerTable.Rows.Count-1){for(t=0;t<this.Cells.Count;t++)this.Cells[t].CellFormat!=null&&this.Cells[t].CellFormat.Borders!=null&&(r=this.Cells[t].CellFormat.Borders._GetCellBottomBorder(this.Cells[t])._GetLineWidth(),r>i&&(i=r));u.BottomBorderWidth=i}},i.prototype._GetHeaderHeight=function(n){var i=0,t,r;if(this.OwnerTable.Rows.Count>0&&n.Rows[0].RowFormat.IsHeader)for(t=0;t<n.Rows.Count;t++)if(r=n.Rows[t],r.RowFormat.IsHeader)i=i+r._GetRowHeight();else break;return i},i.prototype._GetRowHeight=function(){var n=0,t;if(this.RowFormat.HeightType==et.Exactly)n=this.RowFormat.Height;else if(this.TableRowWidgets!=null&&this.TableRowWidgets.Count>0){for(t=0;t<this.TableRowWidgets.Count;t++)n=this.TableRowWidgets[t].Height+n;n=Math.max(n,this.RowFormat.Height)}return n},i.prototype._IsVerticalMergedCellContinue=function(){for(var i,n=0,t=0;t<this.Cells.Count;t++){if(i=this.Cells[t],n<i.ColumnIndex)return!0;n+=i.CellFormat.ColumnSpan}return n<this.OwnerTable.TableHolder.Columns.Count},i.prototype._UpdateWidgetsToTable=function(n){var it=this._GetRowHeight(),c=!1,l=!0,h=et.Auto,p=0,b=this.TableRowWidgets.length-1,t=this.TableRowWidgets[b],rt,r,a,ut,d,ft,k,y,f,ot,g,tt,o,s;for(c=this.RowFormat.IsHeader,l=this.RowFormat.AllowBreakAcrossPages,h=this.RowFormat.HeightType,this.OwnerTable!=null&&this.OwnerTable.ContinueHeader&&!c&&(this.OwnerTable.ContinueHeader=!1),p=this.OwnerTable!=null&&this.OwnerTable.TableFormat!=null?this.OwnerTable.TableFormat.CellSpacing:0;b<this.TableRowWidgets.length;){if(b=this.TableRowWidgets.length,n instanceof st||this.OwnerTable.IsInsideTable||n.CurrentComment!=null||n.SplittedCellWidgets.length==0&&t.Y+t.Height+p<=n.ClientArea.Bottom)this._AddWidgetToTable(n,t);else{if(n.SplittedCellWidgets.length>0&&t.Y+t.Height<=n.ClientArea.Bottom&&(rt=this._IsRowSpanEnd(n),!rt)){this._IsVerticalMergedCellContinue()&&t._InsertSplittedCellWidgets(n);this._AddWidgetToTable(n,t);continue}if(r=t,a=this.OwnerTable.TableWidgets[this.OwnerTable.TableWidgets.Count-1],it+t.Y>n.ClientArea.Bottom)if(!l||c&&this.OwnerTable.ContinueHeader||h==et.Atleast&&this.RowFormat.Height<n.ClientArea.Bottom)if(it+t.Y>n.ClientArea.Bottom){if((h==et.Atleast&&this.RowFormat.Height<n.ClientActiveArea.Height&&l||h!=et.Exactly&&t.Y==n.ClientArea.Y||h==et.Auto&&l)&&(r=this._SplitWidgets(t,n,r)),h==et.Exactly&&t.Y==n.ClientArea.Y&&(this._AddWidgetToTable(n,t),b++),c&&this.OwnerTable.ContinueHeader&&(this.OwnerTable.Header=!1,this.OwnerTable.ContinueHeader=!1,this.OwnerTable.HeaderHeight=0,o=null,n instanceof w&&(o=n.Pages),o!=null))for(s=0;s<o.Count;s++)o[s].RepeatHeaderRowTableWidget&&(o[s].RepeatHeaderRowTableWidget=!1)}else c&&this.OwnerTable.ContinueHeader?(this._AddWidgetToTable(n,t),this.OwnerTable.Header=!0):l||(this._AddWidgetToTable(n,t),this.OwnerTable.Header&&t.Height+this.OwnerTable.HeaderHeight<n.ClientArea.Bottom&&this.RowFormat.Height<n.ClientActiveArea.Bottom&&(t.X=t.X,t.Y=a.Y+this.OwnerTable.HeaderHeight,t._UpdateChildLocation(t.Y+this.OwnerTable.HeaderHeight)));else(h==et.Auto||h==et.Atleast)&&l?this.RowFormat.Height>n.ClientArea.Bottom&&t.Y!=n.ClientArea.Y||(r=this._SplitWidgets(t,n,r)):h==et.Exactly&&t.Y==n.ClientArea.Y&&(this._AddWidgetToTable(n,t),b++);else this._IsVerticalMergedCellContinue()&&l&&(r=this._SplitWidgets(t,n,r));r!=null&&(r!=t?(this._AddWidgetToTable(n,t),this.OwnerTable._UpdateWidgetsToPage(n),ut=this.OwnerTable.TableWidgets._IndexOf(t.ContainerWidget),ut+1>=this.OwnerTable.TableWidgets.length&&this.OwnerTable._AddTableWidget(n.ClientActiveArea),t=r):(this.RowIndex>0&&(this.OwnerTable._UpdateWidgetsToPage(n),this.PreviousNode instanceof i&&this.PreviousNode.TableRowWidgets.length>0?(d=this.PreviousNode.TableRowWidgets[this.PreviousNode.TableRowWidgets.length-1],v._Round(t.Y,2)==v._Round(d.Y+d.Height,2)?(ft=this.OwnerTable.TableWidgets._IndexOf(d.ContainerWidget),ft+1>=this.OwnerTable.TableWidgets.length&&this.OwnerTable._AddTableWidget(n.ClientActiveArea)):this.OwnerTable._AddTableWidget(n.ClientActiveArea)):this.OwnerTable._AddTableWidget(n.ClientActiveArea)),b--),a=this.OwnerTable.TableWidgets[this.OwnerTable.TableWidgets.Count-1],k=null,this.OwnerTable.TableWidgets.length>1?k=this.OwnerTable.TableWidgets[this.OwnerTable.TableWidgets.length-2].ContainerWidget:(y=this.OwnerTable.PreviousBlock,y instanceof u?k=y.ParagraphWidgets[y.ParagraphWidgets.length-1].ContainerWidget:y instanceof e&&(k=y.TableWidgets[y.TableWidgets.length-1].ContainerWidget)),f=0,k!=null&&(f=n.Pages.indexOf(k.Page)),f==n.Pages.length-1||n.Pages[f+1].Section!=this.OwnerTable.Section?(ot=n._CreateNewPage(this.OwnerTable.Section),n.Pages[f+1].Section!=this.OwnerTable.Section&&n._InsertPage(f+1,ot)):(n.Pages[f+1].BoundingRectangle=new nt(n.Pages[f+1].BoundingRectangle.X,n.Pages[f].BoundingRectangle.Bottom+20,n.Pages[f+1].BoundingRectangle.Width,n.Pages[f+1].BoundingRectangle.Height),n._UpdateClientArea(this.OwnerTable.Section.SectionFormat)),this.OwnerTable.Header&&t.Height<n.ClientArea.Bottom?(n instanceof w&&(n.CurrentRenderingPage.RepeatHeaderRowTableWidget=!0),n._UpdateClientAreaForBlock(this.OwnerTable,!0),r.X=r.X,r.Y=a.Y+this.OwnerTable.HeaderHeight,g=n instanceof w?p/2:p,r._UpdateChildLocation(a.Y+this.OwnerTable.HeaderHeight-g)):(n._UpdateClientAreaForBlock(this.OwnerTable,!0),r.X=r.X,r.Y=a.Y,g=n instanceof w?p/2:p,r._UpdateChildLocation(a.Y-g)))}if(c&&this.OwnerTable.ContinueHeader&&(this.OwnerTable.Header=!0,this.OwnerTable.HeaderHeight=it+this.OwnerTable.HeaderHeight),c&&this.OwnerTable._GetHeader()!=null&&this.RowIndex==this.OwnerTable._GetHeader().RowIndex&&(tt=this._GetHeaderHeight(this.OwnerTable),(tt>this.OwnerTable.HeaderHeight||tt>this.OwnerTable.HeaderHeight)&&(this.OwnerTable.HeaderHeight=tt),this.OwnerTable.HeaderHeight>n.ClientArea.Height))for(this.OwnerTable.Header=!1,this.OwnerTable.ContinueHeader=!1,this.OwnerTable.HeaderHeight=0,o=n.Pages,s=0;s<o.Count;s++)o[s].RepeatHeaderRowTableWidget&&(o[s].RepeatHeaderRowTableWidget=!1);this.OwnerTable.TableWidgets.Count>2&&this.OwnerTable.Header&&t.Height<n.ClientActiveArea.Bottom&&!n.CurrentRenderingPage.RepeatHeaderRowTableWidget&&n instanceof w&&(n.CurrentRenderingPage.RepeatHeaderRowTableWidget=!0)}},i.prototype._SplitWidgets=function(n,t,i){return n._IsFirstLineFit(t.ClientArea.Bottom)&&n.ChildWidgets.Count>0?(i=n._GetSplittedWidget(t.ClientArea.Bottom),(t.SplittedCellWidgets.length>0||i!=n)&&i._InsertSplittedCellWidgets(t)):i._InsertSplittedCellWidgets(t),i},i.prototype._Clone=function(){var n=new i(null),t;for(n.RowFormat._CopyFormat(this.RowFormat),n.GridBefore=this.GridBefore,n.GridAfter=this.GridAfter,n.GridBeforeWidth=this.GridBeforeWidth,n.GridAfterWidth=this.GridAfterWidth,t=0;t<this.Cells.Count;t++)n.Cells._Add(this.Cells[t]._Clone());return n},i.prototype._AddWidgetToTable=function(n,t){var r=this.OwnerTable.TableWidgets[0],u=r.ChildWidgets.length,f=null,o=this.TableRowWidgets.indexOf(t),e,h,s;if(o>0?f=this.TableRowWidgets[o-1]:this.PreviousNode instanceof i&&this.PreviousNode.TableRowWidgets.length>0&&(f=this.PreviousNode.TableRowWidgets[this.PreviousNode.TableRowWidgets.length-1]),f==null){if(u>0){for(e=r.ChildWidgets.length-1;e>=0;e--)if(h=r.ChildWidgets[e],h.TableRow.RowIndex<t.TableRow.RowIndex){u=e+1;break}else u=e;u==0&&r._UpdateWidgetLocation(t)}}else r=f.ContainerWidget,u=r.ChildWidgets.length,r.ChildWidgets._IndexOf(f)>=0&&(u=r.ChildWidgets._IndexOf(f)+1),Math.round(t.Y)!=Math.round(f.Y+f.Height)&&(s=this.OwnerTable.TableWidgets._IndexOf(r),s+1>=this.OwnerTable.TableWidgets.length&&this.OwnerTable._AddTableWidget(n.ClientActiveArea),r=this.OwnerTable.TableWidgets[s+1],u=r.ChildWidgets.length),o>0&&(u=0);this._UpdateRowHeightBySpannedCell(r,t,u);this._UpdateRowHeightByCellSpacing(t,n);r.ChildWidgets._Insert(u,t);t.ContainerWidget=r;r.Height=r.Height+t.Height;r.ContainerWidget!=null&&r.ContainerWidget.ChildWidgets._IndexOf(r)>=0&&(r.ContainerWidget.Height+=t.Height);t._UpdateHeight(n,!1);n._CutFromTop(t.Y+t.Height)},i.prototype._UpdateRowHeightBySpannedCell=function(n,t,i){var u=1,f,r,e,o;if(n.ChildWidgets.length==0||i==0){this._UpdateRowHeight(t,t);return}for(r=0;r<t.ChildWidgets.length;r++)f=t.ChildWidgets[r],u=f==null||f.TableCell==null||f.TableCell.CellFormat==null?u:f.TableCell.CellFormat.RowSpan,u>1&&this.OwnerTable!=null&&(this.OwnerTable.SpannedRowCollection._ContainsKey(this.RowIndex+u-1)||this.OwnerTable.SpannedRowCollection._Add(this.RowIndex+u-1,this.RowIndex));if(this.OwnerTable!=null)for(r=0;r<this.OwnerTable.SpannedRowCollection.Count;r++)if(this.OwnerTable.SpannedRowCollection.Keys[r]==this.RowIndex){for(e=0;e<i;e++)o=n.ChildWidgets[e],this._UpdateRowHeight(o,t);this.OwnerTable.SpannedRowCollection._Remove(this.OwnerTable.SpannedRowCollection.Keys[r]);break}},i.prototype._UpdateRowHeight=function(n,t){for(var i,f,e=this.RowIndex,r=1,u=0;u<n.ChildWidgets.length;u++)i=n.ChildWidgets[u],r=i==null||i.TableCell==null||i.TableCell.CellFormat==null?r:i.TableCell.CellFormat.RowSpan,e-i.TableCell.OwnerRow.RowIndex==r-1&&(f=i.Y+i.Height+i.Margin.Bottom-t.Y,t.Height<f&&(t.Height=f))},i.prototype._UpdateRowHeightByCellSpacing=function(n,t){this.OwnerTable.TableFormat.CellSpacing>0&&this.OwnerTable.TableWidgets.Count>1&&n.Y==this.OwnerTable.Document.OwnerControl.Viewer.ClientArea.Top&&t instanceof w&&(n.Height=n.Height-this.OwnerTable.TableFormat.CellSpacing/2)},i.prototype._IsRowSpanEnd=function(n){for(var t,u=this.RowIndex,i=1,r=0;r<n.SplittedCellWidgets.length;r++)if(t=n.SplittedCellWidgets[r],i=i=t==null||t.TableCell==null||t.TableCell.CellFormat==null?i:t.TableCell.CellFormat.RowSpan,u-t.TableCell.OwnerRow.RowIndex==i-1)return!0;return!1},i.prototype._GetMaxTopOrBottomCellMargin=function(n){var t,r,i,u;if(this.Cells!=null){for(t=0,r=0;r<this.Cells.Count;r++)this.Cells!=null&&this.Cells.Count>0&&(i=this.Cells[r].CellFormat,i._ContainsMargins()?n==0&&i.TopMargin>t?t=i.TopMargin:n==1&&i.BottomMargin>t&&(t=i.BottomMargin):(u=this.Cells[r].OwnerTable.TableFormat,n==0&&u.TopMargin>t?t=u.TopMargin:n==1&&u.BottomMargin>t&&(t=u.BottomMargin)));return t}},i.prototype._GetNextParagraph=function(){var t=this,i,n;return t.NextNode!=null?(i=t.NextNode.Cells[0],n=i.Blocks[0],n instanceof u?n:n._GetFirstParagraphInFirstCell()):this.OwnerTable._GetNextParagraph()},i.prototype._GetPreviousParagraph=function(){var t=this,i,n;return t.PreviousNode!=null?(i=t.PreviousNode.Cells[t.PreviousNode.Cells.Count-1],n=i.Blocks[i.Blocks.Count-1],n instanceof u?n:n._GetLastParagraphInLastCell()):this.OwnerTable._GetPreviousParagraph()},i.prototype._Contains=function(n){if(this.Cells._Contains(n))return!0;while(n.OwnerTable.IsInsideTable){if(this.Cells._Contains(n))return!0;n=n.OwnerTable.AssociatedCell}return this.Cells._Contains(n)},i.prototype._Highlight=function(n,t,i,r){for(var f,u=0;u<this.Cells.Count;u++)f=this._GetCellLeft(this.Cells[u]),v._Round(i,2)<=v._Round(f,2)&&v._Round(f,2)<v._Round(r,2)&&this.Cells[u]._HighlightInternal(n,t)},i.prototype._HighlightInternal=function(n,t,r,u){for(var f=0;f<this.Cells.Count;f++)this.Cells[f]._HighlightInternal(n,t);u.Paragraph.IsInsideTable&&this._Contains(u.Paragraph.AssociatedCell)||this.NextNode instanceof i&&this.NextNode._HighlightInternal(n,t,r,u)},i.prototype._GetCellLeft=function(n){var t=0;return n.TableCellWidgets.Count>0&&(t+=n.TableCellWidgets[0].X-n.TableCellWidgets[0].Margin.Left),t},i.prototype._GetSelectedContentAsHtmlInternal=function(n,t,i){var u="<tr ",r,f;for(u+=this.RowFormat._GetAsHtmlStyle(),u+=">",r=0;r<this.Cells.Count;r++)f=this._GetCellLeft(this.Cells[r]),v._Round(t,2)<=v._Round(f,2)&&v._Round(f,2)<v._Round(i,2)&&(u+=this.Cells[r]._GetContentAsHtml());return u+"<\/tr>"},i.prototype._GetSelectedContentAsHtml=function(n,t,r){var u="<tr ",f;for(u+=this.RowFormat._GetAsHtmlStyle(),u+=">",f=0;f<this.Cells.Count;f++)u+=this.Cells[f]._GetContentAsHtml();return(u+="<\/tr>",r.Paragraph.IsInsideTable&&this._Contains(r.Paragraph.AssociatedCell))?u:this.NextNode instanceof i?u+this.NextNode._GetSelectedContentAsHtml(n,t,r):u},i.prototype._GetContentAsHtml=function(){var n="<tr ",t;for(n+=this.RowFormat._GetAsHtmlStyle(),n+=">",t=0;t<this.Cells.Count;t++)n+=this.Cells[t]._GetContentAsHtml();return n+"<\/tr>"},i.prototype._GetPreviousParagraphSelection=function(n){var i=this.Cells[this.Cells.Count-1],r,t;return n.Start.Paragraph.IsInsideTable&&this.OwnerTable._Contains(n.Start.Paragraph.AssociatedCell)&&(r=this.OwnerTable._GetCellInTable(n.Start.Paragraph.AssociatedCell),i=this._GetLastCellInRegion(r,n.UpDownSelectionLength,!0)),t=i.Blocks[i.Blocks.Count-1],t instanceof u?t:t._GetLastParagraphInLastCell()},i.prototype._GetNextParagraphSelection=function(n){var i=this.Cells[0],r,t;return n.Start.Paragraph.IsInsideTable&&this.OwnerTable._Contains(n.Start.Paragraph.AssociatedCell)&&(r=this.OwnerTable._GetCellInTable(n.Start.Paragraph.AssociatedCell),i=this._GetFirstCellInRegion(r,n.UpDownSelectionLength,!1)),t=i.Blocks[0],t instanceof u?t:t._GetFirstParagraphInFirstCell()},i.prototype._GetFirstCellInRegion=function(n,t,i){var f=n.OwnerRow._GetCellLeft(n),o=f+n.CellFormat.CellWidth,e=!0,r,u;if(f<=t&&t<o){for(r=0;r<this.Cells.Count;r++)if(u=this._GetCellLeft(this.Cells[r]),v._Round(f,2)<=v._Round(u,2)&&v._Round(u,2)<v._Round(o,2))return e=!1,this.Cells[r]}else for(r=0;r<this.Cells.Count;r++)if(u=this._GetCellLeft(this.Cells[r]),u<=t&&u+this.Cells[r].CellFormat.CellWidth>t)return e=!1,this.Cells[r];if(e){if(this.PreviousNode!=null&&i)return this.PreviousNode._GetFirstCellInRegion(n,t,i);if(this.NextNode!=null&&!i)return this.NextNode._GetFirstCellInRegion(n,t,i)}return this.Cells[0]},i.prototype._GetLastCellInRegion=function(n,t,i){var f=n.OwnerRow._GetCellLeft(n),o=f+n.CellFormat.CellWidth,e=!0,r,u;if(f<=t&&t<o){for(r=this.Cells.Count-1;r>=0;r--)if(u=this._GetCellLeft(this.Cells[r]),v._Round(f,2)<=v._Round(u,2)&&v._Round(u,2)<v._Round(o,2))return e=!1,this.Cells[r]}else for(r=this.Cells.Count-1;r>=0;r--)if(u=this._GetCellLeft(this.Cells[r]),u<=t&&u+this.Cells[r].CellFormat.CellWidth>t)return e=!1,this.Cells[r];if(e){if(this.PreviousNode!=null&&i)return this.PreviousNode._GetLastCellInRegion(n,t,i);if(this.NextNode!=null&&!i)return this.NextNode._GetLastCellInRegion(n,t,i)}return this.Cells[this.Cells.Count-1]},i.prototype._GetNextSelection=function(n){var r,i,t;return this.NextNode!=null?(r=n.IsEmpty||n.IsForward,r?(i=this.NextNode.Cells[this.NextNode.Cells.Count-1],t=i.Blocks[i.Blocks.Count-1],t instanceof u?t:t._GetLastParagraphInLastCell()):this.NextNode._GetNextParagraphSelection(n)):this.OwnerTable._GetNextSelection(n)},i.prototype._GetPreviousSelection=function(n){if(this.PreviousNode!=null){if(n.IsForward)return this.PreviousNode._GetPreviousParagraphSelection(n);var i=this.PreviousNode.Cells[0],t=i.Blocks[0];return t instanceof u?t:t._GetFirstParagraphInFirstCell()}return this.OwnerTable._GetPreviousSelection(n)},i.prototype._UpdateListItems=function(n){if(n.IsInsideTable&&this.Cells._Contains(n.AssociatedCell._GetContainerCell()))return!0;for(var t=0;t<this.Cells.Count;t++)this.Cells[t]._UpdateListItems(n);return!1},i.prototype._UpdateRenderedListItems=function(){for(var n=0;n<this.Cells.Count;n++)this.Cells[n]._UpdateRenderedListItems()},i.prototype._ClearWidgets=function(){var n,t;if(this.TableRowWidgets!=null&&this.TableRowWidgets.Count>0)for(n=0;n<this.TableRowWidgets.Count;n++)t=this.TableRowWidgets[n],t._Dispose(),this.TableRowWidgets._Remove(t),n--},i.prototype._GetCharacterFormat=function(n,t,i){for(var u,f,e,r=this.RowIndex;r<this.OwnerTable.Rows.Count;r++){for(u=this.OwnerTable.Rows[r],f=0;f<u.Cells.Count;f++)u.Cells[f]._GetCharacterFormatForSelection(n,t,i);if(i.Paragraph.IsInsideTable&&u._Contains(i.Paragraph.AssociatedCell))return}e=this.OwnerTable._GetNextRenderedBlock();e._GetCharacterFormat(n,t,i)},i.prototype._GetParagraphFormat=function(n,t,i){for(var u,f,e,r=this.RowIndex;r<this.OwnerTable.Rows.Count;r++){for(u=this.OwnerTable.Rows[r],f=0;f<u.Cells.Count;f++)u.Cells[f]._GetParagraphFormat(n);if(i.Paragraph.IsInsideTable&&u._Contains(i.Paragraph.AssociatedCell))return}e=this.OwnerTable._GetNextRenderedBlock();e._GetParagraphFormatInternal(n,t,i)},i.prototype._ApplyParagraphFormatTableRow=function(n,t,i,r,u,f){var e,o,s,h;for(u=this.Cells[0]._GetParagraphFormatValue(r,u),e=this.RowIndex;e<this.OwnerTable.Rows.Count;e++){for(o=this.OwnerTable.Rows[e],s=0;s<o.Cells.Count;s++)o.Cells[s]._ApplyParagraphFormatTableCell(n,r,u,f);if(i.Paragraph.IsInsideTable&&o._Contains(i.Paragraph.AssociatedCell))return}h=this.OwnerTable._GetNextRenderedBlock();h._ApplyParagraphFormat(n,t,i,r,u,f)},i.prototype._LayoutInternal=function(n){this._Layout(n,!1)},i.prototype._Layout=function(n,t){var r,f,o,s;if(this._IsVerticalMergedCellContinue()&&this.PreviousNode instanceof i){this.PreviousNode._LayoutInternal(n);return}n._UpdateClientArea(this.OwnerTable.Section.SectionFormat);r=null;this.RowIndex>0?r=this.OwnerTable.Rows[this.RowIndex-1].TableRowWidgets[this.OwnerTable.Rows[this.RowIndex-1].TableRowWidgets.Count-1]:(f=this.OwnerTable.PreviousBlock,f instanceof u?r=f.ParagraphWidgets[f.ParagraphWidgets.Count-1]:f instanceof e&&(r=f.TableWidgets[f.TableWidgets.Count-1]));r!=null&&n._CutFromTop(r.Y+r.Height);o=this.TableRowWidgets[0].ContainerWidget;this._ClearWidgets();this.OwnerTable.TableWidgets.Count==0&&(n._UpdateClientAreaForBlock(this.OwnerTable,!0),this.OwnerTable._AddTableWidget(n.ClientActiveArea),o=this.OwnerTable.TableWidgets[0]);n._UpdateClientAreaForTable(o);s=this.Cells.Count>0?this.Cells[0]._GetFirstBlock():null;s!=null&&n.OwnerControl.IsDocumentLoaded&&!n.OwnerControl.IsPastingContent&&n.OwnerControl.Document._UpdateListItems(s);this._LayoutItems(n);o.Table!=null&&o.Table.TableFormat.CellSpacing>0&&o._RenderTableOutlines(n);t&&s!=null?s._ShiftNextWidgets():this._LayoutNextItems(n)},i.prototype._LayoutNextItems=function(n){for(var t=this,u=this.TableRowWidgets[this.TableRowWidgets.Count-1],f,r;t.NextNode instanceof i;){if(t=t.NextNode,t instanceof i&&t.TableRowWidgets.Count>0&&(f=t._IsVerticalMergedCellContinue(),n.SplittedCellWidgets.Count==0&&!f&&t.TableRowWidgets[0].ContainerWidget==u.ContainerWidget&&v._Round(t.TableRowWidgets[0].Y,2)==v._Round(n.ClientActiveArea.Y,2))){r=this.OwnerTable.TableWidgets[this.OwnerTable.TableWidgets.Count-1];n._CutFromTop(t.OwnerTable.TableWidgets[t.OwnerTable.TableWidgets.Count-1].Y+t.OwnerTable.TableWidgets[t.OwnerTable.TableWidgets.Count-1].Height);return}t._ClearWidgets();t._LayoutItems(n);u=t.TableRowWidgets[t.TableRowWidgets.Count-1]}this.OwnerTable.TableWidgets[this.OwnerTable.TableWidgets.Count-1].ContainerWidget instanceof oi&&(r=this.OwnerTable.TableWidgets[this.OwnerTable.TableWidgets.Count-1],r.ContainerWidget.ChildWidgets._Remove(r),r.ContainerWidget instanceof ii||(r.ContainerWidget.Height-=r.Height));this.OwnerTable._UpdateWidgetsToPage(n);n._UpdateClientAreaForBlock(this.OwnerTable,!1);this.OwnerTable._LayoutNextItems(n)},i.prototype._CombineTableRowWidgets=function(n){var i,r,u,f,t,e;if(this.TableRowWidgets.Count!=0){for(i=this.TableRowWidgets[0],n.ChildWidgets._Contains(i)||i._UpdateTableWidget(n,n.ChildWidgets.Count),i.Height=0,t=0;t<this.Cells.Count;t++)r=this.Cells[t],r._CombineTableCellWidgets(i),u=r.TableCellWidgets[0],r.CellFormat.RowSpan==1&&(f=u.Height+u.Margin.Top+u.Margin.Bottom,i.Height<f&&(i.Height=f));for(t=1;t<this.TableRowWidgets.Count;t++)e=this.TableRowWidgets[t],e._Dispose(),t--}},i.prototype._GetBlankRow=function(){var n=new i(null),t,r,u;for(n.GridBefore=this.GridBefore,n.GridAfter=this.GridAfter,n.GridBeforeWidth=this.GridBeforeWidth,n.GridAfterWidth=this.GridAfterWidth,t=0;t<this.Cells.length;t++)r=this.Cells[t],u=r._GetBlankCell(),n.Cells._Add(u);return n},i.prototype._GetGridCount=function(n,t){var i=0,r=0,u,f;return t==-1?r=this.GridBeforeWidth*15:(i+=this.GridBeforeWidth*15,t>0&&(i+=this._GetCellOffset(t)),r=t<this.Cells.Count?this.Cells[t].CellFormat.CellWidth*15:this.GridAfterWidth*15),u=this._GetOffsetIndex(n,i),f=this._GetOffsetIndex(n,i+r),f-u},i.prototype._GetOffsetIndex=function(n,t){var r,i;if(t=Math.round(t),r=0,n._Contains(t))r=n._IndexOf(t);else{for(i=0;i<n.Count;i++)if(n[i]>t)return i;r=n.Count-1}return r},i.prototype._GetCellOffset=function(n){for(var i=0,t=0;t<this.Cells.Count;t++){if(t==n)break;i+=this.Cells[t].CellFormat.CellWidth*15}return i},i.prototype._UpdateHeight=function(n){if(this.RowFormat.HeightType==et.Auto){this.RowFormat.HeightType=et.Atleast;var t=this._GetRowHeight();t+n>=3.6&&this.RowFormat.Height!=t+n&&(this.RowFormat.Height=t+n)}else this.RowFormat.Height+n>=3.6&&this.RowFormat.Height!=this.RowFormat.Height+n&&(this.RowFormat.Height=this.RowFormat.Height+n)},i.prototype._UpdateGridBefore=function(n){this.GridBeforeWidth+n!=this.GridBeforeWidth&&(this.GridBeforeWidth=this.GridBeforeWidth+n,this._LayoutInternal(this.OwnerTable._GetOwnerDocument().OwnerControl.Viewer))},i.prototype._GetRowWidth=function(n){var t=0,i,r;for(n&&(t=t+this.GridBeforeWidth),i=0;i<this.Cells.length;i++)r=this.Cells[i],t+=r.CellFormat.CellWidth;return t},i.prototype._ApplyRowFormat=function(n,t,i,r,u){if(this.RowFormat._ApplyPropertyValue(n.CurrentBaseHistoryInfo,r,u),i.Paragraph.AssociatedCell.OwnerRow!=this){var f=this.NextNode;f!=null&&f._ApplyRowFormat(n,t,i,r,u)}},i.prototype._Dispose=function(){var n,t;if(this._SetOwner(null),this.TableRowWidgets!=null&&(this._ClearWidgets(),this.TableRowWidgets=null),this.Cells!=null){for(this.Cells._Dispose(),n=0;n<this.Cells.Count;n++)t=this.Cells[n],t._Dispose(),this.Cells._Remove(t),n--;this.ChildNodes=null}this.Fields=null;this.FieldCharacter=null},i.prototype._SerializeRows=function(){var n={Cells:[],GridAfter:[],GridAfterWidth:[],GridBefore:[],GridBeforeWidth:[],RowFormat:[]},t,i;for(n.GridAfter=this.GridAfter,n.GridAfterWidth=this.GridAfterWidth,n.GridBefore=this.GridBefore,n.GridBeforeWidth=this.GridBeforeWidth,t=0;t<this.Cells.length;t++)i=this.Cells[t],n.Cells[t]=i._SerializeCells();return n.RowFormat=this.RowFormat._SerializeRowFormat(),n},i}(yt);t.TableRowAdv=bt;ef=function(){function n(){this.preferredwidth=0;this.minwidth=0;this.maxwidth=0}return Object.defineProperty(n.prototype,"PreferredWidth",{get:function(){return this.preferredwidth},set:function(n){this.preferredwidth=n},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"MinWidth",{get:function(){return this.minwidth},set:function(n){this.minwidth=n},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"MaxWidth",{get:function(){return this.maxwidth},set:function(n){this.maxwidth=n},enumerable:!0,configurable:!0}),n}();t.TableColumnAdv=ef;ot=function(t){function r(n){t.call(this,n);this.colIndex=0;this.ChildNodes=new ur(this);this.CellFormat=new ai(this);this.TableCellWidgets=new h}return n(r,t),Object.defineProperty(r.prototype,"Blocks",{get:function(){return this.ChildNodes},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"LeftMargin",{get:function(){return this.CellFormat._ContainsMargins()?this.CellFormat.LeftMargin:this.OwnerTable!=null&&this.OwnerTable.TableFormat!=null?this.OwnerTable.TableFormat.LeftMargin:0},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"TopMargin",{get:function(){return this.CellFormat._ContainsMargins()?this.CellFormat.TopMargin:this.OwnerTable!=null&&this.OwnerTable.TableFormat!=null?this.OwnerTable.TableFormat.TopMargin:0},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"RightMargin",{get:function(){return this.CellFormat._ContainsMargins()?this.CellFormat.RightMargin:this.OwnerTable!=null&&this.OwnerTable.TableFormat!=null?this.OwnerTable.TableFormat.RightMargin:0},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"BottomMargin",{get:function(){return this.CellFormat._ContainsMargins()?this.CellFormat.BottomMargin:this.OwnerTable!=null&&this.OwnerTable.TableFormat!=null?this.OwnerTable.TableFormat.BottomMargin:0},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"OwnerRow",{get:function(){return this.Owner},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"OwnerTable",{get:function(){return this.OwnerRow!=null?this.OwnerRow.OwnerTable:null},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"ColumnIndex",{get:function(){return this.colIndex},set:function(n){this.colIndex=n},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"OwnerColumn",{get:function(){return this.OwnerTable.TableHolder.Columns[this.ColumnIndex]},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"Section",{get:function(){return this.OwnerTable!=null?this.OwnerTable.Section:null},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"CellIndex",{get:function(){return this.OwnerRow!=null?this.OwnerRow.Cells._IndexOf(this):-1},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"IsInHeaderFooter",{get:function(){return this.OwnerTable!=null?this.OwnerTable.IsInHeaderFooter:!1},enumerable:!0,configurable:!0}),r.prototype._Clone=function(){var t=new r(null),n;for(t.CellFormat._CopyFormat(this.CellFormat),n=0;n<this.Blocks.Count;n++)t.Blocks._Add(this.Blocks[n]._Clone());return t},r.prototype._GetCharacterFormatValue=function(n,t){var i,r;return typeof t=="boolean"&&(i=this._GetFirstParagraph(),r=i.CharacterFormat,i.Inlines.Count>0&&(r=i.Inlines[0].CharacterFormat),t=!r._GetCharacterPropertyValue(n,r)),t==null&&(n==o.BoldProperty||n==o.ItalicProperty)&&(i=this._GetFirstParagraph(),r=i.CharacterFormat,i.Inlines.Count>0&&(r=i.Inlines[0].CharacterFormat),t=!r._GetCharacterPropertyValue(n,r)),t},r.prototype._ApplyCharacterFormatForSel=function(n,t,i,r){for(var u=0;u<this.Blocks.Count;u++)this.Blocks[u]._ApplyCharacterFormatForSel(n,t,i,r)},r.prototype._ApplyCharacterFormat=function(n,t,i,r,u,f){var e,o,s,h;i.Paragraph.IsInsideTable?(e=this._GetContainerCellOf(i.Paragraph.AssociatedCell),e.OwnerTable._Contains(i.Paragraph.AssociatedCell)?(o=this._GetSelectedCell(e),s=i.Paragraph.AssociatedCell._GetSelectedCell(e),e._Contains(i.Paragraph.AssociatedCell)?e._IsCellSelected(t,i)?(u=e._GetCharacterFormatValue(r,u),e._ApplyCharacterFormatForSel(n,r,u,f)):o==e?t.Paragraph._ApplyCharacterFormat(n,t,i,r,u,f):o.OwnerRow._ApplyCharacterFormat(n,t,i,r,u,f):e.OwnerTable._ApplyCharacterFormatForCell(n,e,s,r,u,f)):e.OwnerRow._ApplyCharacterFormat(n,t,i,r,u,f)):(h=this._GetContainerCell(),h.OwnerRow._ApplyCharacterFormat(n,t,i,r,u,f))},r.prototype._ApplyParagraphFormat=function(n,t,i,r,u,f){var e,o,s,h;i.Paragraph.IsInsideTable?(e=this._GetContainerCell(),e.OwnerTable._Contains(i.Paragraph.AssociatedCell)?(o=this._GetSelectedCell(e),s=i.Paragraph.AssociatedCell._GetSelectedCell(e),e._Contains(i.Paragraph.AssociatedCell)?e._IsCellSelected(t,i)?(u=e._GetParagraphFormatValue(r,u),e._ApplyParagraphFormatTableCell(n,r,u,f)):o==e?t.Paragraph._ApplyParagraphFormat(n,t,i,r,u,f):o.OwnerRow._ApplyParagraphFormatTableRow(n,t,i,r,u,f):e.OwnerTable._ApplyParagraphFormatTable(n,e,s,r,u,f)):e.OwnerRow._ApplyParagraphFormatTableRow(n,t,i,r,u,f)):(h=this._GetContainerCell(),h.OwnerRow._ApplyParagraphFormatTableRow(n,t,i,r,u,f))},r.prototype._ApplyParagraphFormatTableCell=function(n,t,i,r){for(var u=0;u<this.Blocks.Count;u++)this.Blocks[u]._ApplyParagraphFormatInternal(n,t,i,r)},r.prototype._GetParagraphFormatValue=function(n,t){if(t instanceof Boolean)var i=this._GetFirstParagraph();return t},r.prototype._LayoutItems=function(n,t,i){var e,r,f;for(this.TableCellWidgets!=null&&this.TableCellWidgets.length>0&&this.TableCellWidgets._Clear(),this._AddTableCellWidget(n.ClientActiveArea,t,i),n._UpdateClientAreaForCell(this,!0),this.Blocks.length==0&&(e=null,e=new u(this),this.Blocks._Add(e)),r=0;r<this.Blocks.length;r++)f=this.Blocks[r],n._UpdateClientAreaForBlock(f,!0),f._LayoutItems(n),n._UpdateClientAreaForBlock(f,!1);this._UpdateWidgetToRow(n);n._UpdateClientAreaForCell(this,!1)},r.prototype._AddTableCellWidget=function(n,t,i){var r=new ii(this),e=0,u=0,o=0,h=t,s=0,c=i,f;this.CellFormat!=null&&(this.CellFormat._ContainsMargins()?(o=this.CellFormat.LeftMargin,s=this.CellFormat.RightMargin):(o=this.OwnerTable.TableFormat.LeftMargin,s=this.OwnerTable.TableFormat.RightMargin));r.Margin=new wr(o,h,s,c);r.Width=this.CellFormat!=null?this.CellFormat.CellWidth:0;this.PreviousNode!=null&&(e=this.PreviousNode.ColumnIndex+(this.PreviousNode.CellFormat!=null?this.PreviousNode.CellFormat.ColumnSpan:1));u=this.OwnerTable!=null&&this.OwnerTable.TableFormat!=null?this.OwnerTable.TableFormat.CellSpacing:0;this.TableCellWidgets._Add(r);f=0;e<this.ColumnIndex&&(f=this.OwnerTable.TableHolder._GetPreviousSpannedCellWidth(e,this.ColumnIndex),e==0&&(f=f-u/2));r.X=n.X+f+r.Margin.Left;r.Y=n.Y+r.Margin.Top+u;r.Width=r.Width-r.Margin.Left-r.Margin.Right;u>0&&(r.X+=u,r.Width-=this.OwnerTable.TableHolder.Columns.Count==1?u*2:this.ColumnIndex==0||this.ColumnIndex==this.OwnerTable.TableHolder.Columns.Count-1?u*2-u/2:u,r.RightBorderWidth=this.CellFormat.Borders._GetCellRightBorder(this)._GetLineWidth(),r.Width-=r.RightBorderWidth);r.LeftBorderWidth=this.CellFormat.Borders._GetCellLeftBorder(this)._GetLineWidth();r.X+=r.LeftBorderWidth;r.Width-=r.LeftBorderWidth;(u>0||this.CellIndex==this.OwnerRow.Cells.Count-1)&&(r.RightBorderWidth=this.CellFormat.Borders._GetCellRightBorder(this)._GetLineWidth(),r.Width-=r.RightBorderWidth);r.Margin.Left=r.Margin.Left+r.LeftBorderWidth;r.Margin.Right=r.Margin.Right+r.RightBorderWidth},r.prototype._UpdateWidgetToRow=function(){var t=this.TableCellWidgets[this.TableCellWidgets.length-1],n=this.OwnerRow.TableRowWidgets[this.OwnerRow.TableRowWidgets.length-1],u=n.X,i,r;n.ChildWidgets.length>0&&(i=n.ChildWidgets[n.ChildWidgets.length-1],u=i.X+i.Width+i.Margin.Right);n.ChildWidgets._Add(t);t.ContainerWidget=n;this.OwnerRow!=null&&this.OwnerRow.RowFormat.HeightType!=et.Exactly&&this.OwnerRow.RowFormat.Height>0&&this.CellIndex==0&&(n.Height=n.Height+this.OwnerRow.RowFormat.Height);this.CellFormat.RowSpan==1&&(r=t.Height+t.Margin.Top+t.Margin.Bottom,n.Height-this.OwnerTable.TableFormat.CellSpacing<r&&(n.Height=r+this.OwnerTable.TableFormat.CellSpacing))},r.prototype._GetNextParagraph=function(){if(this.NextNode!=null){var n=this.NextNode.Blocks[0];return n instanceof u?n:n._GetFirstParagraphInFirstCell()}return this.OwnerRow._GetNextParagraph()},r.prototype._GetPreviousParagraph=function(){if(this.PreviousNode!=null){var n=this.PreviousNode.Blocks[this.PreviousNode.Blocks.Count-1];return n instanceof u?n:n._GetLastParagraphInLastCell()}return this.OwnerRow._GetPreviousParagraph()},r.prototype._GetFirstParagraph=function(){var n=this.Blocks[0];return n instanceof u?n:n._GetFirstParagraphInFirstCell()},r.prototype._GetFirstBlock=function(){return this.Blocks.Count>0?this.Blocks[0]:null},r.prototype._GetLastParagraph=function(){var n=this.Blocks[this.Blocks.Count-1];return n instanceof u?n:n._GetLastParagraphInLastCell()},r.prototype._Contains=function(n){if(this==n)return!0;while(n.OwnerTable.IsInsideTable){if(this==n.OwnerTable.AssociatedCell)return!0;n=n.OwnerTable.AssociatedCell}return!1},r.prototype._GetContainerCell=function(){for(var n=this;n.OwnerTable!=null&&n.OwnerTable.IsInsideTable;)n=n.OwnerTable.AssociatedCell;return n},r.prototype._GetContainerCellOf=function(n){for(var t=this;t.OwnerTable.IsInsideTable;){if(t.OwnerTable._Contains(n))return t;t=t.OwnerTable.AssociatedCell}return t},r.prototype._GetSelectedCell=function(n){var t=this;if(t.OwnerTable==n.OwnerTable)return t;while(t.OwnerTable.IsInsideTable){if(t.OwnerTable.AssociatedCell==n)return t;t=t.OwnerTable.AssociatedCell}return t},r.prototype._IsCellSelected=function(n,t){var i=this._GetLastParagraph(),r=i==t.Paragraph&&t.Offset==i._GetLength()+1;return r||!this._Contains(n.Paragraph.AssociatedCell)||!this._Contains(t.Paragraph.AssociatedCell)},r.prototype._Highlight=function(n,t,i,r){var u,f,e,o;if(r.Paragraph.IsInsideTable)if(u=this._GetContainerCellOf(r.Paragraph.AssociatedCell),u.OwnerTable._Contains(r.Paragraph.AssociatedCell))if(f=this._GetSelectedCell(u),e=r.Paragraph.AssociatedCell._GetSelectedCell(u),u._Contains(r.Paragraph.AssociatedCell))u._IsCellSelected(i,r)?u._HighlightInternal(n,t):f==u?i.Paragraph._Highlight(n,t,i,r):f._HighlightContainer(n,t,i,r);else if(u._HighlightInternal(n,t),u.OwnerRow==e.OwnerRow){for(f=u;f.NextNode!=null;)if(f=f.NextNode,f._HighlightInternal(n,t),f==e)break}else u.OwnerTable._HighlightCells(n,t,u,e);else u._HighlightContainer(n,t,i,r);else o=this._GetContainerCell(),o._HighlightContainer(n,t,i,r)},r.prototype._HighlightInternal=function(n,t){for(var i=0;i<this.TableCellWidgets.Count;i++)this.TableCellWidgets[i]._Highlight(n,t)},r.prototype._HighlightContainer=function(n,t,i,r){this.OwnerRow._HighlightInternal(n,t,i,r);var u=this.OwnerTable._GetNextRenderedBlock();u._Highlight(n,t,i,r)},r.prototype._GetCellLeft=function(n){var t=0;return n.TableCellWidgets.Count>0&&(t+=n.TableCellWidgets[0].X-n.TableCellWidgets[0].Margin.Left),t},r.prototype._GetSelectedContentAsHtmlInternal=function(n,t,i){var r="",u,f,e,o;if(i.Paragraph.IsInsideTable)if(u=this._GetContainerCellOf(i.Paragraph.AssociatedCell),u.OwnerTable._Contains(i.Paragraph.AssociatedCell)){if(r+="<table ",r+=u.OwnerTable.TableFormat._GetAsHtmlStyle(),r+=">",f=this._GetSelectedCell(u),e=i.Paragraph.AssociatedCell._GetSelectedCell(u),u._Contains(i.Paragraph.AssociatedCell))u._IsCellSelected(t,i)?(r+="<tr ",r+=u.OwnerRow.RowFormat._GetAsHtmlStyle(),r+=">",r+=u._GetContentAsHtml(),r+="<\/tr>"):r=f==u?t.Paragraph._GetSelectedContentAsHtml(n,t,i):f._GetSelectedContentAsHtml(n,t,i);else if(u.OwnerRow==e.OwnerRow){for(r+="<tr ",r+=u.OwnerRow.RowFormat._GetAsHtmlStyle(),r+=">",r+=u._GetContentAsHtml(),f=u;f.NextNode!=null;)if(f=f.NextNode,r+=f._GetContentAsHtml(),f==e)break;r+="<\/tr>"}else r+=u.OwnerTable._GetSelectedContentAsHtmlInternal(n,u,e);r+="<\/table>"}else r+=u._GetSelectedContentAsHtml(n,t,i);else o=this._GetContainerCell(),r+=o._GetSelectedContentAsHtml(n,t,i);return r},r.prototype._GetSelectedContentAsHtml=function(n,t,i){var r="",u;return r+="<table ",r+=this.OwnerTable.TableFormat._GetAsHtmlStyle(),r+=">",r+=this.OwnerRow._GetSelectedContentAsHtml(n,t,i),r+="<\/table>",u=this.OwnerTable._GetNextRenderedBlock(),r+u._GetSelectedContentAsHtml(n,t,i)},r.prototype._GetContentAsHtml=function(){var n="<td ",t;for(n+=this.CellFormat._GetAsHtmlStyle(),n+=">",t=0;t<this.Blocks.Count;t++)n+=this.Blocks[t]._GetContentAsHtml();return n+"<\/td>"},r.prototype._GetNextSelection=function(n){var t;return this.NextNode!=null?n.IsEmpty||n.IsForward?(t=this.NextNode.Blocks[this.NextNode.Blocks.Count-1],t instanceof u?t:t._GetLastParagraphInLastCell()):(t=this.NextNode.Blocks[0],t instanceof u?t:t.Rows[0]._GetNextParagraphSelection(n)):this.OwnerRow._GetNextSelection(n)},r.prototype._GetPreviousSelection=function(n){var t;return this.PreviousNode!=null?n.IsForward?(t=this.PreviousNode.Blocks[this.PreviousNode.Blocks.Count-1],t instanceof u?t:t.Rows[t.Rows.Count-1]._GetPreviousParagraphSelection(n)):(t=this.PreviousNode.Blocks[0],t instanceof u?t:t._GetFirstParagraphInLastRow()):this.OwnerRow._GetPreviousSelection(n)},r.prototype._UpdateListItems=function(n){for(var t=0;t<this.Blocks.Count;t++)this.Blocks[t]._UpdateListItems(n)},r.prototype._UpdateRenderedListItems=function(){for(var n=0;n<this.Blocks.Count;n++)this.Blocks[n]._UpdateRenderedListItems()},r.prototype._GetCharacterFormat=function(n,t,i){var r,u,f,e;i.Paragraph.IsInsideTable?(r=this._GetContainerCellOf(i.Paragraph.AssociatedCell),r.OwnerTable._Contains(i.Paragraph.AssociatedCell)?(u=this._GetSelectedCell(r),f=i.Paragraph.AssociatedCell._GetSelectedCell(r),r._Contains(i.Paragraph.AssociatedCell)?r._IsCellSelected(t,i)?r._GetCharacterFormatForSelection(n,t,i):u==r?t.Paragraph._GetCharacterFormat(n,t,i):u.OwnerRow._GetCharacterFormat(n,t,i):r.OwnerTable._GetCharacterFormatInternal(n,r,f,t,i)):r.OwnerRow._GetCharacterFormat(n,t,i)):(e=this._GetContainerCell(),e.OwnerRow._GetCharacterFormat(n,t,i))},r.prototype._GetCharacterFormatForSelection=function(n,t,i){for(var r=0;r<this.Blocks.Count;r++)this.Blocks[r]._GetCharacterFormat(n,t,i)},r.prototype._GetParagraphFormat=function(n){for(var t=0;t<this.Blocks.Count;t++)this.Blocks[t]._GetParagraphFormat(n)},r.prototype._GetParagraphFormatInternal=function(n,t,i){var r,u,f,e;i.Paragraph.IsInsideTable?(r=this._GetContainerCellOf(i.Paragraph.AssociatedCell),r.OwnerTable._Contains(i.Paragraph.AssociatedCell)?(u=this._GetSelectedCell(r),f=i.Paragraph.AssociatedCell._GetSelectedCell(r),r._Contains(i.Paragraph.AssociatedCell)?r._IsCellSelected(t,i)?r._GetParagraphFormat(n):u==r?t.Paragraph._GetParagraphFormatInternal(n,t,i):u.OwnerRow._GetParagraphFormat(n,t,i):r.OwnerTable._GetParagraphFormatForTableCell(n,r,f)):r.OwnerRow._GetParagraphFormat(n,t,i)):(e=this._GetContainerCell(),e.OwnerRow._GetParagraphFormat(n,t,i))},r.prototype._ClearWidgets=function(){var n,t;if(this.TableCellWidgets!=null&&this.TableCellWidgets.Count>0)for(n=0;n<this.TableCellWidgets.Count;n++)t=this.TableCellWidgets[n],t._Dispose(),this.TableCellWidgets._Remove(t),n--},r.prototype._UpdateCellVerticalPosition=function(n){for(var r=this.TableCellWidgets[0],t=r.ContainerWidget,i;t.ContainerWidget instanceof oi;)t=t.ContainerWidget;i=null;t instanceof wt&&(i=t.Page);r._UpdateCellVerticalPosition(!1,!1);n instanceof w&&n.VisiblePages._Contains(i)?n.CommentWidgets.Count>0&&n._MoveCommentsToPage(i):n instanceof st&&n.CurrentPage==i&&r._Render(n)},r.prototype._Delete=function(n,t,i,r){var u,f,e,o,s;i.Paragraph.IsInsideTable?(u=this._GetContainerCellOf(i.Paragraph.AssociatedCell),u.OwnerTable._Contains(i.Paragraph.AssociatedCell)?(f=this._GetSelectedCell(u),e=i.Paragraph.AssociatedCell._GetSelectedCell(u),u._Contains(i.Paragraph.AssociatedCell)?u._IsCellSelected(t,i)?(u._UpdateEditPosition(n),r==1?this.OwnerRow.OwnerTable._DeleteCells(n,u,u,r):(o=u._DeleteCell(n,r,!0),o||r==2||(n.CurrentBaseHistoryInfo=null))):f==u?t.Paragraph._Delete(n,t,i,r):f._DeleteContainer(n,t,i,r):r==2?this._DeleteCell(n,2,!1):u.OwnerTable._DeleteCells(n,u,e,r)):u._DeleteContainer(n,t,i,r)):(s=this._GetContainerCell(),s._DeleteContainer(n,t,i,r))},r.prototype._DeleteCell=function(n,t){for(var f,e,s,r=this.Blocks[0],o=0;o<this.Blocks.Count;o++)if(r=this.Blocks[o],t<4){if(r instanceof u&&this.Blocks.Count==1){for(f=r,e=0;e<f.Inlines.Count;e++)s=f.Inlines[e],f.Inlines._Remove(s),e--,n.CurrentBaseHistoryInfo.Action!=i.ClearCells&&n.CurrentBaseHistoryInfo.RemovedNodes._Add(s);n.CurrentBaseHistoryInfo.Action!=i.ClearCells&&(n.EditPosition=f._GetHierarchicalIndex("0"),n.CurrentBaseHistoryInfo.InsertPosition=n.EditPosition);break}r._RemoveBlock();o--;n.CurrentBaseHistoryInfo.Action!=i.ClearCells&&n.CurrentBaseHistoryInfo.RemovedNodes._Add(r)}return!0},r.prototype._DeleteContainer=function(n,t,i,r){var l,u,f,s,h;this.OwnerRow.Cells[0]._UpdateEditPosition(n);var c=!(i.Paragraph.IsInsideTable&&this.OwnerTable._Contains(i.Paragraph.AssociatedCell)),e=this.OwnerTable._GetNextRenderedBlock(),o=this.Section;if(this.OwnerRow.RowIndex!=0||i.Paragraph.IsInsideTable&&this.OwnerTable._Contains(i.Paragraph.AssociatedCell)&&!this.OwnerTable.Rows[this.OwnerTable.Rows.Count-1]._Contains(i.Paragraph.AssociatedCell)){if(l=null,u=this.OwnerTable,c||i.Paragraph.IsInsideTable&&u.Rows[u.Rows.Count-1]._Contains(i.Paragraph.AssociatedCell))u._DeleteContent(n,r);else for(f=this.OwnerRow.RowIndex;f<u.Rows.Count;f++)if(s=u.Rows[f],r<4&&(u.Rows._Remove(s),f--),i.Paragraph.IsInsideTable&&s._Contains(i.Paragraph.AssociatedCell))return}else this.OwnerTable._DeleteContent(n,r);c&&e!=null&&(h=e.Section,o!=h&&(r<4&&o._CombineSection(n,h),r>2&&n._CopySectionFormat(o)),e._Delete(n,t,i,r))},r.prototype._UpdateEditPosition=function(n){var t=this._GetFirstParagraph();n.EditPosition=t._GetHierarchicalIndex("0")},r.prototype._CombineTableCellWidgets=function(n){var i,r,t,f;if(this.TableCellWidgets.Count!=0){for(i=this.TableCellWidgets[0],n.ChildWidgets._Contains(i)||i._UpdateTableRowWidget(n,n.ChildWidgets.Count),i._UpdateWidgetHeight(),t=0;t<this.Blocks.Count;t++)r=this.Blocks[t],r instanceof u?r._CombineParagraphWidgets(i):r._CombineTableWidgets(i);for(t=1;t<this.TableCellWidgets.Count;t++)f=this.TableCellWidgets[t],f._Dispose(),t--}},r.prototype._GetBlankCell=function(){var t=new r(null),i,n;return t.CellFormat._CopyFormat(this.CellFormat),i=this._GetLastParagraph(),n=new u(null),n.ParagraphFormat._CopyFormat(i.ParagraphFormat),n.CharacterFormat._CopyFormat(i.CharacterFormat),t.Blocks._Add(n),t},r.prototype._DecreaseWidth=function(n){if(this.CellFormat.CellWidth=this.CellFormat.CellWidth-n>1.06+this.OwnerTable.TableFormat.CellSpacing+this.LeftMargin+this.RightMargin?this.CellFormat.CellWidth-n:1.06+this.OwnerTable.TableFormat.CellSpacing+this.LeftMargin+this.RightMargin,this.CellFormat.PrefferedWidthType==ht.Auto&&(this.CellFormat.PrefferedWidthType=ht.Pixel),this.CellFormat.PrefferedWidthType==ht.Pixel)this.CellFormat.PrefferedWidthType=this.CellFormat.CellWidth;else{var t=this._ConvertPixelToPercent(this.CellFormat.CellWidth);this.CellFormat.PrefferedWidth=t}},r.prototype._IncreaseWidth=function(n){if(this.CellFormat.CellWidth=this.CellFormat.CellWidth+n>1.06+this.OwnerTable.TableFormat.CellSpacing+this.LeftMargin+this.RightMargin?this.CellFormat.CellWidth+n:1.06+this.OwnerTable.TableFormat.CellSpacing+this.LeftMargin+this.RightMargin,this.CellFormat.PrefferedWidthType==ht.Auto&&(this.CellFormat.PrefferedWidthType=ht.Pixel),this.CellFormat.PrefferedWidthType==ht.Pixel)this.CellFormat.PrefferedWidth=this.CellFormat.CellWidth;else{var t=this._ConvertPixelToPercent(this.CellFormat.CellWidth);this.CellFormat.PrefferedWidth=t}},r.prototype._ConvertPixelToPercent=function(n){var t=0,i=this.OwnerTable._GetOwnerWidth(),r=this.OwnerTable._GetTableClientWidth(i);return t=n/r*100,t=v._Round(t,1),t<100?t:100},r.prototype._ApplyCellFormat=function(n,t,i,r,u){if(this.CellFormat._ApplyPropertyValue(n.CurrentBaseHistoryInfo,r,u),i.Paragraph.AssociatedCell!=this){var f=this._GetNextCell();f!=null&&f._ApplyCellFormat(n,t,i,r,u)}},r.prototype._GetNextCell=function(){return this.NextNode==null&&this.Owner instanceof bt&&this.Owner.NextNode!=null?this.Owner.NextNode.Cells[0]:this.NextNode==null?null:this.NextNode},r.prototype._ConvertPercentToPixel=function(n){var t=0,i=this.OwnerTable._GetOwnerWidth(),r=this.OwnerTable._GetTableClientWidth(i);return t=n*r/100,t=v._Round(t,2),t<2112?t:2112},r.prototype._Dispose=function(){var n,t;if(this._SetOwner(null),this.CellFormat._Dispose(),this.TableCellWidgets!=null&&(this._ClearWidgets(),this.TableCellWidgets=null),this.Blocks!=null){for(this.Blocks._Dispose(),n=0;n<this.Blocks.Count;n++)t=this.Blocks[n],t._Dispose(),this.Blocks._Remove(t),n--;this.ChildNodes=null}this.Fields=null;this.FieldCharacter=null},r.prototype._SerializeCells=function(){for(var i,r,n={Blocks:[],CellFormat:[],ColumnIndex:[]},t=0;t<this.Blocks.Count;t++)i=this.Blocks[t],i instanceof u?n.Blocks[t]=i._SerializeBlock():i instanceof e&&(n.Blocks[t]=i._SerializeBlock());return r=this.CellFormat,n.CellFormat=r._SerializeCellFormat(),n.ColumnIndex=this.ColumnIndex,n},r}(yt);t.TableCellAdv=ot;oe=function(){function n(n){this.layoutViewer=null;this.InsertHyperlinkDialog=null;this.NavigationUrl=null;this.DisplayText="";this.displayTextbox=null;this.urlTextbox=null;this.layoutViewer=n;this._InitHyperlinkDialog()}return n.prototype._InitHyperlinkDialog=function(){var t=this.layoutViewer,i,r,n,u,f;this.InsertHyperlinkDialog=t.OwnerControl.ej.buildTag("div","",{display:"none",width:"auto"},{id:"documentEditor_"+t.OwnerControl.ContainerId+"_insertHyperlinkDialog",title:"Insert Hyperlink"});t.OwnerControl.DocumentEditorElement.appendChild(this.InsertHyperlinkDialog[0]);i=document.createElement("div");r=document.createElement("TABLE");r.innerHTML+="<tr style='height: 50px;'><td style= 'width:40%'>Text to Display<\/td><td><input type='text' id= '"+this.InsertHyperlinkDialog[0].id+"_displayText' style= 'width:100%' /><\/td><\/tr><tr style='height:50px;'><td style='width:35%'>Address<\/td><td><input type='text' id= '"+this.InsertHyperlinkDialog[0].id+"_address' style= 'width:100%' / ><\/td><\/tr>";i.appendChild(r);n=this;u=t.OwnerControl.ej.buildTag("input","",{"margin-left":"0px",width:"55px",left:"145px",position:"relative"},{type:"button",id:this.InsertHyperlinkDialog[0].id+"_ok",value:"Ok"});u.ejButton({click:t.OwnerControl.ej.proxy(n._OnInsertHyperlink,n)});f=t.OwnerControl.ej.buildTag("input","",{"margin-left":"0px",width:"55px",left:"165px",position:"relative"},{id:this.InsertHyperlinkDialog[0].id+"_cancel",type:"button",value:"Cancel"});f.ejButton({click:function(t){t.cancel||n.InsertHyperlinkDialog.ejDialog("close")}});i.appendChild(u[0]);i.appendChild(f[0]);this.InsertHyperlinkDialog[0].appendChild(i);this.displayTextbox=this.InsertHyperlinkDialog.find("#"+this.InsertHyperlinkDialog[0].id+"_displayText")[0];this.urlTextbox=this.InsertHyperlinkDialog.find("#"+this.InsertHyperlinkDialog[0].id+"_address")[0];this.displayTextbox.addEventListener("keyup",function(){n.DisplayText=n.displayTextbox.value});this.urlTextbox.addEventListener("keyup",function(){var r=t.OwnerControl.Selection.Text,i=n.urlTextbox.value;i.substring(0,4).toLowerCase()=="www."&&(n.urlTextbox.value="http://"+i);n.DisplayText==""&&i!=""&&(n.displayTextbox.value=i)});this.InsertHyperlinkDialog.keyup(function(t){t.keyCode==13&&n.displayTextbox.value!=""&&n.urlTextbox.value!=""&&n._OnInsertHyperlink()})},n.prototype._loadHyperlinkFieldOnDialog=function(){var n=this.layoutViewer.OwnerControl.Selection._GetHyperlinkField(),t,i;if(n!=null){if(n.fieldSeparator!=null){var r=n.fieldSeparator.OwnerParagraph._GetHyperlinkDisplayText(n.fieldSeparator,n.fieldEnd,!1,null);this.DisplayText=r.displayText}this.displayTextbox.value=this.DisplayText;t=new nf(n);this.urlTextbox.value=this.NavigationUrl=t.NavigationLink}else this.DisplayText=this.layoutViewer.OwnerControl.Selection._GetText(!0),this.DisplayText!=""&&this.DisplayText!=undefined&&(this.DisplayText.indexOf("\r")>0&&this.DisplayText.lastIndexOf("\r")>0&&this.DisplayText.slice(0,-1).indexOf("\r")>0?(this.displayTextbox.value="<<Selection in document>>",this.displayTextbox.disabled=!0):this.displayTextbox.value=this.DisplayText);i=this;setTimeout(function(){i.urlTextbox.focus()},405)},n.prototype._OnInsertHyperlink=function(){var n=this.layoutViewer.OwnerControl.Selection,t=this.displayTextbox.value,i=this.urlTextbox.value;this.NavigationUrl!=null?n._EditHyperlink(i,t):n._InsertHyperlink(i,t,n.Text!=t&&!this.displayTextbox.disabled);this.InsertHyperlinkDialog.ejDialog("close");this.NavigationUrl=null},n.prototype._ClearValues=function(){this.displayTextbox.value="";this.urlTextbox.value="";this.DisplayText="";this.displayTextbox.disabled=!1},n}();t.HyperlinkDialog=oe;se=function(){function n(n){this.layoutViewer=null;this.Alignment=null;this.LeftIndent=null;this.Special=null;this.RightIndent=null;this.By=null;this.BeforeSpacing=null;this.LineSpacing=null;this.AfterSpacing=null;this.LineSpacingAt=null;this.currentalign=null;this.InsertParagraphDialog=null;this.layoutViewer=n;this._InitParagraphDialog()}return n.prototype._InitParagraphDialog=function(){var n=this.layoutViewer,i,t;this.InsertParagraphDialog=n.OwnerControl.ej.buildTag("div","",{display:"none"},{id:"documentEditor_"+n.OwnerControl.ContainerId+"_insertParagraphDialog",title:"Paragraph"});n.OwnerControl.DocumentEditorElement.appendChild(this.InsertParagraphDialog[0]);i=document.createElement("div");i.style.width="475px";i.style.height="520px";t=document.createElement("TABLE");t.style.width="500px";t.style.height="auto";t.style.padding="20px";t.style.margin="10px";t.innerHTML+="<tr style='height:10px;'><td><label style='font-size:12px;color:blue;'>General<\/label><\/td><\/tr><tr><td><label>Alignment<\/label><\/br><input type= 'text' class='nodetext' id= '"+this.InsertParagraphDialog[0].id+"_Alignment'><\/td><\/tr>";t.innerHTML+="<tr><td><label style='font-size:12px;color:blue;'>Indentation<\/label><\/td><\/tr><\/br><tr><td><label>Left<\/label><\/br><input type='text' class='nodetext' id='"+this.InsertParagraphDialog[0].id+"_leftIndent'><\/br><label>Special<\/label><\/br><input type='text' class='nodetext' id='"+this.InsertParagraphDialog[0].id+"_special'><\/td><\/br><td><label>Right<\/label><\/br><input type='text' class='nodetext' id='"+this.InsertParagraphDialog[0].id+"_rightIndent'><\/br><label>By<\/label><\/br><input type='text' class='nodetext' id='"+this.InsertParagraphDialog[0].id+"_By'><\/td><\/tr>";t.innerHTML+="<tr><td><label style='font-size:12px;color:blue;'>Spacing<\/label><\/td><\/tr><\/br><tr><td><label>Before<\/label><\/br><input type='text' class='nodetext' id= '"+this.InsertParagraphDialog[0].id+"_beforeSpacing'><\/br><label>Line Spacing<\/label><\/br><input type='text' class='nodetext' id='"+this.InsertParagraphDialog[0].id+"_lineSpacing'><\/td><\/br><td><label>After<\/label><\/br><input type='text' class='nodetext' id='"+this.InsertParagraphDialog[0].id+"_afterSpacing'><\/br><label>At<\/label><\/br><input type='text' class='nodetext' id='"+this.InsertParagraphDialog[0].id+"_lineSpacingAt'><\/td><\/tr>";i.appendChild(t);var r=n.OwnerControl.ej.buildTag("input","",{"margin-left":"0px",left:"250px",position:"relative"},{type:"button",id:this.InsertParagraphDialog[0].id+"_ok",value:"Ok"}),u=n.OwnerControl.ej.buildTag("input","",{"margin-left":"0px",left:"280px",position:"relative"},{type:"button",id:this.InsertParagraphDialog[0].id+"_cancel",value:"Cancel"}),f=this;u.ejButton({width:"90px",height:"23px",click:function(n){n.cancel||f.InsertParagraphDialog.ejDialog("close")}});r.ejButton({width:"90px",height:"23px",click:n.OwnerControl.ej.proxy(this._OnInsertParagraphFormat,this)});i.appendChild(r[0]);i.appendChild(u[0]);this.InsertParagraphDialog[0].appendChild(i);this.Alignment=this.InsertParagraphDialog.find("#"+this.InsertParagraphDialog[0].id+"_Alignment");this.LeftIndent=this.InsertParagraphDialog.find("#"+this.InsertParagraphDialog[0].id+"_leftIndent");this.Special=this.InsertParagraphDialog.find("#"+this.InsertParagraphDialog[0].id+"_special");this.RightIndent=this.InsertParagraphDialog.find("#"+this.InsertParagraphDialog[0].id+"_rightIndent");this.By=this.InsertParagraphDialog.find("#"+this.InsertParagraphDialog[0].id+"_By");this.BeforeSpacing=this.InsertParagraphDialog.find("#"+this.InsertParagraphDialog[0].id+"_beforeSpacing");this.LineSpacing=this.InsertParagraphDialog.find("#"+this.InsertParagraphDialog[0].id+"_lineSpacing");this.AfterSpacing=this.InsertParagraphDialog.find("#"+this.InsertParagraphDialog[0].id+"_afterSpacing");this.LineSpacingAt=this.InsertParagraphDialog.find("#"+this.InsertParagraphDialog[0].id+"_lineSpacingAt");n._CreateEjDropDownList(this.Alignment);n._CreateEjNumericTextbox(this.LeftIndent);n._CreateEjDropDownList(this.Special);n._CreateEjNumericTextbox(this.RightIndent);n._CreateEjNumericTextbox(this.BeforeSpacing);n._CreateEjDropDownList(this.LineSpacing);n._CreateEjNumericTextbox(this.AfterSpacing);n._CreateEjNumericTextbox(this.LineSpacingAt);this.Alignment.ejDropDownList({select:"Alignment",dataSource:["Center","Left","Right","Justify"],width:"200px",selectedItemIndex:0});this.LeftIndent.ejNumericTextbox({minValue:-2112,maxValue:2112,width:200,change:""});this.Special.ejDropDownList({select:"Special",dataSource:["(None)","First line","Hanging"],width:"200px",selectedItemIndex:0});this.RightIndent.ejNumericTextbox({minValue:-2112,maxValue:2112,width:200,change:""});this.By.ejNumericTextbox({minValue:0,maxValue:2112,width:200,change:""});this.BeforeSpacing.ejNumericTextbox({minValue:0,maxValue:2112,width:200,incrementStep:6,change:""});this.LineSpacing.ejDropDownList({select:"LineSpacing",dataSource:["Atleast","Exactly","Multiple"],width:"200px",selectedItemIndex:2});this.AfterSpacing.ejNumericTextbox({minValue:0,maxValue:2112,width:200,incrementStep:6,change:""});this.LineSpacingAt.ejNumericTextbox({minValue:0,maxValue:2112,width:200,incrementStep:.5,decimalPlaces:2,change:""})},n.prototype._OnInsertParagraphFormat=function(){var t=this.layoutViewer.OwnerControl.Selection,n;this.ParagraphFormat._IsEqualFormat(t.ParagraphFormat)||(n=new a(null),this.ParagraphFormat._CopyToFormat(n),t._OnParagraphFormat(n));this.InsertParagraphDialog.ejDialog("close")},n.prototype._WireEventsAndBindings=function(){this.ParagraphFormat=new vf(null);var n=this,t=this.Special.data("ejDropDownList"),i=t.model.value;this.Alignment.ejDropDownList({change:function(t){n.ParagraphFormat.TextAlignment=t.text=="Left"?1:t.text=="Right"?2:t.text=="Center"?0:3}});this.LineSpacing.ejDropDownList({change:function(t){n.ParagraphFormat.LineSpacingType=t.itemId}});this.LeftIndent.ejNumericTextbox({change:function(t){n.ParagraphFormat.LeftIndent=t.value}});this.Special.ejDropDownList({change:function(t){var i=n.ParagraphFormat.FirstLineIndent;t.text=="Hanging"?n.ParagraphFormat.FirstLineIndent=i>0?-i:i:t.text=="First line"&&(n.ParagraphFormat.FirstLineIndent=i<0?-i:i)}});this.RightIndent.ejNumericTextbox({change:function(t){n.ParagraphFormat.RightIndent=t.value}});this.By.ejNumericTextbox({change:function(t){var r=t.value;n.ParagraphFormat.FirstLineIndent=i=="Hanging"?r>0?-r:r:r<0?-r:r}});this.AfterSpacing.ejNumericTextbox({change:function(t){n.ParagraphFormat.AfterSpacing=t.value}});this.BeforeSpacing.ejNumericTextbox({change:function(t){n.ParagraphFormat.BeforeSpacing=t.value}});this.LineSpacingAt.ejNumericTextbox({change:function(t){n.ParagraphFormat.LineSpacing=t.value}})},n.prototype.UnWireEventsAndBindings=function(){this.Alignment.ejDropDownList({change:""});this.LineSpacing.ejDropDownList({change:""});this.LeftIndent.ejNumericTextbox({change:""});this.RightIndent.ejNumericTextbox({change:""});this.By.ejNumericTextbox({change:""});this.AfterSpacing.ejNumericTextbox({change:""});this.BeforeSpacing.ejNumericTextbox({change:""});this.LineSpacingAt.ejNumericTextbox({change:""});this.ParagraphFormat=null},n.prototype._LoadParagraphDialog=function(){var i,r,u,f,n,t,e,o;this._WireEventsAndBindings();this.ParagraphFormat._CloneFormat(this.layoutViewer.OwnerControl.Selection.ParagraphFormat);this.currentalign=this.Alignment.data("ejDropDownList");this.ParagraphFormat.TextAlignment==0?this.Alignment[0].value=this.currentalign.selectItemByIndex(0):this.ParagraphFormat.TextAlignment==1?this.Alignment[0].value=this.currentalign.selectItemByIndex(1):this.ParagraphFormat.TextAlignment==2?this.Alignment[0].value=this.currentalign.selectItemByIndex(2):this.ParagraphFormat.TextAlignment==3&&(this.Alignment[0].value=this.currentalign.selectItemByIndex(3));i=this.InsertParagraphDialog.find("#"+this.InsertParagraphDialog[0].id+"_leftIndent").data("ejNumericTextbox");i.setModel({value:this.ParagraphFormat.LeftIndent});r=this.InsertParagraphDialog.find("#"+this.InsertParagraphDialog[0].id+"_rightIndent").data("ejNumericTextbox");r.setModel({value:this.ParagraphFormat.RightIndent});u=this.InsertParagraphDialog.find("#"+this.InsertParagraphDialog[0].id+"_beforeSpacing").data("ejNumericTextbox");u.setModel({value:this.ParagraphFormat.BeforeSpacing});f=this.InsertParagraphDialog.find("#"+this.InsertParagraphDialog[0].id+"_afterSpacing").data("ejNumericTextbox");f.setModel({value:this.ParagraphFormat.AfterSpacing});n=this.InsertParagraphDialog.find("#"+this.InsertParagraphDialog[0].id+"_special").data("ejDropDownList");t=this.InsertParagraphDialog.find("#"+this.InsertParagraphDialog[0].id+"_By").data("ejNumericTextbox");this.ParagraphFormat.FirstLineIndent>0?(this.Special.value=n.selectItemByIndex(1),t.setModel({value:this.ParagraphFormat.FirstLineIndent})):this.ParagraphFormat.FirstLineIndent<0?(this.Special.value=n.selectItemByIndex(2),t.setModel({value:-this.ParagraphFormat.FirstLineIndent})):(this.Special.value=n.selectItemByIndex(0),t.setModel({value:""}));e=this.InsertParagraphDialog.find("#"+this.InsertParagraphDialog[0].id+"_lineSpacing").data("ejDropDownList");e.selectItemByIndex(this.ParagraphFormat.LineSpacingType);o=this.InsertParagraphDialog.find("#"+this.InsertParagraphDialog[0].id+"_lineSpacingAt").data("ejNumericTextbox");o.setModel({value:this.ParagraphFormat.LineSpacing})},n}();t.ParagraphDialog=se;he=function(){function n(n){this.skipUpdating=!1;this.IsTableBordersAndShadingUpdated=!1;this.IsCellBordersAndShadingUpdated=!1;this.tableFormat=null;this.ownerControl=n}return Object.defineProperty(n.prototype,"TableFormat",{get:function(){return this.tableFormat==null&&(this.tableFormat=new at(null)),this.tableFormat},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"CellFormat",{get:function(){return this.cellFormat==null&&(this.cellFormat=new ai(null)),this.cellFormat},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"TablePreferredWidth",{get:function(){return this.tablePreferredWidth},set:function(n){this.tablePreferredWidth=n;this._NotifyPropertyChanged("TablePreferredWidth")},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"TablePreferredWidthType",{get:function(){return this.tablePreferredWidthType},set:function(n){this.tablePreferredWidthType=n;this._NotifyPropertyChanged("TablePreferredWidthType")},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"TableAlignment",{get:function(){return this.tableAlignment},set:function(n){this.tableAlignment=n;this._NotifyPropertyChanged("TableAlignment")},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"LeftIndent",{get:function(){return this.leftIndent},set:function(n){this.leftIndent=n;this._NotifyPropertyChanged("LeftIndent")},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"HasTableWidth",{get:function(){return this.hasTableWidth},set:function(n){this.hasTableWidth=n;this._NotifyPropertyChanged("HasTableWidth")},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"RowHeight",{get:function(){return this.rowHeight},set:function(n){this.rowHeight=n;this._NotifyPropertyChanged("RowHeight")},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"RowHeightType",{get:function(){return this.rowHeightType},set:function(n){this.rowHeightType=n;this._NotifyPropertyChanged("RowHeightType")},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"AllowBreakAcrossPages",{get:function(){return this.allowRowBreakAcrossPages},set:function(n){this.allowRowBreakAcrossPages=n;this._NotifyPropertyChanged("AllowBreakAcrossPages")},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"IsHeader",{get:function(){return this.isHeader},set:function(n){this.isHeader=n;this._NotifyPropertyChanged("IsHeader")},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"HasRowHeight",{get:function(){return this.hasRowHeight},set:function(n){this.hasRowHeight=n;this._NotifyPropertyChanged("HasRowHeight")},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"CellPreferredWidth",{get:function(){return this.cellPreferredWidth},set:function(n){this.cellPreferredWidth=n;this._NotifyPropertyChanged("CellPreferredWidth")},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"CellPreferredWidthType",{get:function(){return this.cellPreferredWidthType},set:function(n){this.cellPreferredWidthType=n;this._NotifyPropertyChanged("CellPreferredWidthType")},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"CellContentAlignment",{get:function(){return this.cellContentAlignment},set:function(n){this.cellContentAlignment=n;this._NotifyPropertyChanged("CellContentAlignment")},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"HasCellWidth",{get:function(){return this.hasCellWidth},set:function(n){this.hasCellWidth=n;this._NotifyPropertyChanged("HasCellWidth")},enumerable:!0,configurable:!0}),n.prototype._NotifyPropertyChanged=function(n){if(!this.skipUpdating)switch(n){case"TablePreferredWidthType":this.skipUpdating=!0;this.TablePreferredWidth=this.TablePreferredWidthType==ht.Percent?this.SelectedCell.OwnerTable._ConvertPixelToPercent(this.TablePreferredWidth):this.SelectedCell.OwnerTable._ConvertPercentToPixel(this.TablePreferredWidth);this.skipUpdating=!1;break;case"CellPreferredWidthType":this.skipUpdating=!0;this.CellPreferredWidth=this.CellPreferredWidthType==ht.Percent?this.SelectedCell._ConvertPixelToPercent(this.CellPreferredWidth):this.SelectedCell._ConvertPercentToPixel(this.CellPreferredWidth);this.skipUpdating=!1;break;case"HasRowHeight":this.skipUpdating=!0;this.RowHeightType=et.Atleast;this.skipUpdating=!1}},n.prototype._CloneTableFormat=function(n){n!=null&&(this.HasTableWidth=n._HasValue(at.PreferredWidthProperty),this.HasTableWidth&&(this.TablePreferredWidth=n.PreferredWidth,this.TablePreferredWidthType=n.PreferredWidthType),this.LeftIndent=n.LeftIndent)},n.prototype._CloneRowFormat=function(n){n!=null&&(this.AllowBreakAcrossPages=n.AllowBreakAcrossPages,this.IsHeader=n.IsHeader,this.HasRowHeight=n.HeightType!=et.Auto,this.HasRowHeight&&(this.RowHeight=n.Height,this.RowHeightType=n.HeightType))},n.prototype._CloneCellFormat=function(n){n!=null&&(this.CellContentAlignment=n.VerticalAlignment,this.HasCellWidth=n._HasValue(ai.PreferredWidthProperty),this.HasCellWidth&&(this.CellPreferredWidth=n.PrefferedWidth,this.CellPreferredWidthType=n.PrefferedWidthType))},n.prototype._WireUpEventsAndBindings=function(){if(this.ownerControl!=null){this._CloneTableFormat(this.ownerControl.Selection.TableFormat.Table.TableFormat);var n=this.ownerControl.Selection.Start;for(this.ownerControl.Selection.IsForward||(n=this.ownerControl.Selection.End),this.SelectedCell=n.Paragraph.AssociatedCell;this.SelectedCell.OwnerTable!=this.ownerControl.Selection.TableFormat.Table;)this.SelectedCell=this.SelectedCell.OwnerTable.AssociatedCell;this._CloneCellFormat(this.SelectedCell.CellFormat);this._CloneRowFormat(this.SelectedCell.OwnerRow.RowFormat)}},n.prototype._UnwireEventsAndBindings=function(){this.IsCellBordersAndShadingUpdated=!1;this.IsTableBordersAndShadingUpdated=!1;this.cellFormat=null;this.tableFormat=null;this.SelectedCell=null},n.prototype._ApplyTablePropertiesButton_Click=function(){var t,r,n,i;this.ownerControl!=null&&(t=this.SelectedCell.OwnerTable.TableFormat._HasValue(at.PreferredWidthProperty),this.tableFormat==null&&((t?this.SelectedCell.OwnerTable.TableFormat.PreferredWidth!=this.TablePreferredWidth||this.SelectedCell.OwnerTable.TableFormat.PreferredWidthType!=this.TablePreferredWidthType:this.HasTableWidth!=t)||this.SelectedCell.OwnerTable.TableFormat.TableAlignment!=this.TableAlignment||this.SelectedCell.OwnerTable.TableFormat.LeftIndent!=this.LeftIndent)&&(this.tableFormat=new at(null)),this.tableFormat!=null&&(this.tableFormat.TableAlignment=this.TableAlignment,this.HasTableWidth?(this.tableFormat.PreferredWidth=this.TablePreferredWidth,this.tableFormat.PreferredWidthType=this.TablePreferredWidthType):this.tableFormat.PreferredWidthType=ht.Auto,this.tableFormat.LeftIndent=this.LeftIndent),r=this.SelectedCell.CellFormat._HasValue(ai.PreferredWidthProperty),this.cellFormat==null&&((r?this.SelectedCell.CellFormat.PrefferedWidth!=this.CellPreferredWidth||this.SelectedCell.CellFormat.PrefferedWidthType!=this.CellPreferredWidthType:this.HasTableWidth!=t)||this.SelectedCell.CellFormat.VerticalAlignment!=this.CellContentAlignment)&&(this.cellFormat=new ai(null)),this.cellFormat!=null&&(this.cellFormat.VerticalAlignment=this.CellContentAlignment,this.HasCellWidth&&this.HasCellWidth?(this.cellFormat.PrefferedWidth=this.CellPreferredWidth,this.cellFormat.PrefferedWidthType=this.CellPreferredWidthType):this.cellFormat.PrefferedWidthType=ht.Auto),n=null,i=this.SelectedCell.OwnerRow.RowFormat._HasValue(tr.HeightProperty),((i?this.SelectedCell.OwnerRow.RowFormat.Height!=this.RowHeight||this.SelectedCell.OwnerRow.RowFormat.HeightType!=this.RowHeightType||this.HasRowHeight!=i:this.HasRowHeight!=i)||this.SelectedCell.OwnerRow.RowFormat.AllowBreakAcrossPages!=this.allowRowBreakAcrossPages||this.SelectedCell.OwnerRow.RowFormat.IsHeader!=this.IsHeader)&&(n=new tr(null),this.AllowBreakAcrossPages&&(n.AllowBreakAcrossPages=this.AllowBreakAcrossPages),this.IsHeader&&(n.IsHeader=this.IsHeader),this.HasRowHeight&&this.RowHeight>=1.33?(n.HeightType=this.RowHeightType,n.Height=this.RowHeight):n.HeightType=et.Auto),this.tableFormat==null||this.IsTableBordersAndShadingUpdated||(this.ownerControl.Selection.TableFormat.Table.TableFormat.Shading!=null&&(this.TableFormat.Shading=this.ownerControl.Selection.TableFormat.Table.TableFormat.Shading._Clone()),this.ownerControl.Selection.TableFormat.Table.TableFormat.Borders!=null&&(this.tableFormat.Borders=this.ownerControl.Selection.TableFormat.Table.TableFormat.Borders._Clone())),this.cellFormat==null||this.IsCellBordersAndShadingUpdated||(this.SelectedCell.CellFormat.Borders!=null&&(this.CellFormat.Borders=this.SelectedCell.CellFormat.Borders._Clone()),this.SelectedCell.CellFormat.Shading!=null&&(this.CellFormat.Shading=this.SelectedCell.CellFormat.Shading._Clone())),this.tableFormat!=null&&this.ownerControl.Selection._OnTableFormat(this.tableFormat),n!=null&&this.ownerControl.Selection._OnRowFormat(n,this.SelectedCell.OwnerRow),this.cellFormat!=null&&this.ownerControl.Selection._OnCellFormat(this.cellFormat,this.SelectedCell))},n}();t.TableDialog=he;of=function(){function n(n){this.skipUpdating=!1;this.ownerControl=n}return Object.defineProperty(n.prototype,"ApplyTo",{get:function(){return this.applyTo},set:function(n){this.applyTo=n},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"LineWidth",{get:function(){return this.lineWidth},set:function(n){this.lineWidth=n},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"LineStyle",{get:function(){return this.lineStyle},set:function(n){this.lineStyle=n},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"BorderColor",{get:function(){return this.borderColor},set:function(n){this.borderColor=n},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"ShadingFill",{get:function(){return this.shadingFill},set:function(n){this.shadingFill=n},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"TopBorder",{get:function(){return this.topBorder},set:function(n){this.topBorder=n},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"BottomBorder",{get:function(){return this.bottomBorder},set:function(n){this.bottomBorder=n},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"LeftBorder",{get:function(){return this.leftBorder},set:function(n){this.leftBorder=n},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"RightBorder",{get:function(){return this.rightBorder},set:function(n){this.rightBorder=n},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"VerticalBorder",{get:function(){return this.verticalBorder},set:function(n){this.verticalBorder=n},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"HorizontalBorder",{get:function(){return this.horizontalBorder},set:function(n){this.horizontalBorder=n},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"DiagonalRightBorder",{get:function(){return this.diagonalRightBorder},set:function(n){this.diagonalRightBorder=n},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"DiagonalLeftBorder",{get:function(){return this.diagonalLeftBorder},set:function(n){this.diagonalLeftBorder=n},enumerable:!0,configurable:!0}),n.prototype._GetLineStyle=function(n){switch(n){case r.Single:return 1;case r.Dot:return 2;case r.DashSmallGap:return 3;case r.DashLargeGap:return 4;case r.DashDot:return 5;case r.DashDotDot:return 6;case r.Double:return 7;case r.Triple:return 8;case r.ThinThickSmallGap:return 9;case r.ThickThinSmallGap:return 10;case r.ThinThickThinSmallGap:return 11;case r.ThinThickMediumGap:return 12;case r.ThickThinMediumGap:return 13;case r.ThinThickThinMediumGap:return 14;case r.ThinThickLargeGap:return 15;case r.ThickThinLargeGap:return 16;case r.ThinThickThinLargeGap:return 17;case r.SingleWavy:return 18;case r.DoubleWavy:return 19;case r.DashDotStroked:return 20;case r.Emboss3D:return 21;case r.Engrave3D:return 22;case r.Outset:return 23;case r.Inset:return 24;case r.Thick:return 25}return 0},n.prototype._GetBorder=function(){var n=new ut(null);return n.Color=this.borderColor,n.LineStyle=this.lineStyle,n.LineWidth=this.lineWidth,n},n.prototype._ApplyBordersAndShadingButton_Click=function(){var n,t,i;this.ownerControl!=null&&(n=null,(this.TopBorder||this.BottomBorder||this.LeftBorder||this.RightBorder||this.HorizontalBorder||this.VerticalBorder||this.DiagonalRightBorder||this.DiagonalLeftBorder)&&(n=new er(null),this.TopBorder&&(n.Top=this._GetBorder()),this.BottomBorder&&(n.Bottom=this._GetBorder()),this.LeftBorder&&(n.Left=this._GetBorder()),this.RightBorder&&(n.Right=this._GetBorder()),this.HorizontalBorder&&(n.Horizontal=this._GetBorder()),this.VerticalBorder&&(n.Vertical=this._GetBorder()),this.DiagonalLeftBorder&&(n.DiagonalDown=this._GetBorder()),this.DiagonalRightBorder&&(n.DiagonalUp=this._GetBorder())),t=new vr(null),t.BackgroundColor=this.ShadingFill,this.IsOpenedOnTableProperties?this.ApplyTo==0?(this.ownerControl.TableDialog.IsCellBordersAndShadingUpdated=!0,this.ownerControl.TableDialog.CellFormat.Borders=n,this.ownerControl.TableDialog.SelectedCell.CellFormat.Shading!=null&&(t.ForegroundColor=this.ownerControl.TableDialog.SelectedCell.CellFormat.Shading.ForegroundColor,t.TextureStyle=this.ownerControl.TableDialog.SelectedCell.CellFormat.Shading.TextureStyle),this.ownerControl.TableDialog.CellFormat.Shading=t):(this.ownerControl.TableDialog.IsTableBordersAndShadingUpdated=!0,this.ownerControl.TableDialog.TableFormat.Borders=n,this.ownerControl.Selection.TableFormat.Table.TableFormat.Shading!=null&&(t.ForegroundColor=this.ownerControl.Selection.TableFormat.Table.TableFormat.Shading.ForegroundColor,t.TextureStyle=this.ownerControl.Selection.TableFormat.Table.TableFormat.Shading.TextureStyle),this.ownerControl.TableDialog.TableFormat.Shading=t):this.ApplyTo==0?(i=this.ownerControl.Selection.Start,this.ownerControl.Selection.IsForward||(i=this.ownerControl.Selection.End),i.Paragraph.AssociatedCell.CellFormat.Borders=n,i.Paragraph.AssociatedCell.CellFormat.Shading!=null&&(t.ForegroundColor=i.Paragraph.AssociatedCell.CellFormat.Shading.ForegroundColor,t.TextureStyle=i.Paragraph.AssociatedCell.CellFormat.Shading.TextureStyle),i.Paragraph.AssociatedCell.CellFormat.Shading=t):(this.ownerControl.Selection.TableFormat.Table.TableFormat.Borders=n,this.ownerControl.Selection.TableFormat.Table.TableFormat.Shading!=null&&(t.ForegroundColor=this.ownerControl.Selection.TableFormat.Table.TableFormat.Shading.ForegroundColor,t.TextureStyle=this.ownerControl.Selection.TableFormat.Table.TableFormat.Shading.TextureStyle),this.ownerControl.Selection.TableFormat.Table.TableFormat.Shading=t))},n}();t.BordersAndShadingsDialog=of;u=function(t){function r(n){t.call(this,n);this.ChildNodes=new bu(this);this.CharacterFormat=new o(this);this.ParagraphFormat=new a(this);this.paragraphWidgets=new h}return n(r,t),Object.defineProperty(r.prototype,"Inlines",{get:function(){return this.ChildNodes},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"ParagraphWidgets",{get:function(){return this.paragraphWidgets},enumerable:!0,configurable:!0}),r.prototype._GetClonedFieldResultWithSel=function(n,t){for(var r,u=this.Inlines._IndexOf(t),i=u;i<this.Inlines.Count;i++)r=this.Inlines[i],n._InsertInlineInternal(r._Clone())},r.prototype._GetClonedFieldResult=function(n){var t=new r(null),u,i,f;for(t.CharacterFormat._CopyFormat(this.CharacterFormat),t.ParagraphFormat._CopyFormat(this.ParagraphFormat),u=this.Inlines._IndexOf(n),i=u;i<this.Inlines.Count;i++)f=this.Inlines[i],t.Inlines._Add(f._Clone());return t},r.prototype._GetHyperlinkDisplayText=function(n,t,i,r){var f=this,o,h,e,u;if(f!=t.OwnerParagraph)return i=!0,{displayText:"<<Selection in Document>>",isNestedField:i,format:r};for(o="",h=f.Inlines._IndexOf(n),e=h+1;e<f.Inlines.Count;e++){if(u=f.Inlines[e],u==t)break;if(u instanceof s)o+=u.Text,r=u.CharacterFormat;else if(u instanceof y)u instanceof l&&u.fieldEnd!=null&&(h=u.fieldSeparator==null?f.Inlines._IndexOf(u.fieldEnd):f.Inlines._IndexOf(u.fieldSeparator));else return i=!0,{displayText:"<<Selection in Document>>",isNestedField:i,format:r}}return{displayText:o,isNestedField:i,format:r}},r.prototype._SerializeBlock=function(){var i={Inlines:[],CharacterFormat:[],ParagraphFormat:[]},t,n;for(i.CharacterFormat=this.CharacterFormat._SerializeCharacterFormat(),i.ParagraphFormat=this.ParagraphFormat._SerializeParagraphFormat(),t=0;t<this.Inlines.Count;t++)n=this.Inlines[t],n instanceof s?i.Inlines[t]=n._SerializeInline():n instanceof pt?i.Inlines[t]=n._SerializeInline():n instanceof l?i.Inlines[t]=n._SerializeInline():n instanceof b?i.Inlines[t]=n._SerializeInline():n instanceof yi?i.Inlines[t]=n._SerializeInline():n instanceof ir?i.Inlines[t]=n._SerializeInline():n instanceof hr?i.Inlines[t]=n._SerializeInline():n instanceof g&&(i.Inlines[t]=n._SerializeInline());return i},r.prototype._IsEmpty=function(){var t,n;if(this.Inlines.length==0)return!0;for(t=0;t<this.Inlines.Count;t++)if((n=this.Inlines[t],n.Length!=0)&&(n instanceof s||n instanceof vi||n instanceof pt||n instanceof y&&n._IsLinkedFieldCharacter()))return!1;return!0},r.prototype._Clone=function(){var n=new r(null),t;for(n.ParagraphFormat._CopyFormat(this.ParagraphFormat),n.CharacterFormat._CopyFormat(this.CharacterFormat),t=0;t<this.Inlines.Count;t++)n.Inlines._Add(this.Inlines[t]._Clone());return n},r.prototype._GetTabWidth=function(n){var i,t;if(n.ClientActiveArea.X<n.ClientArea.X)return n.ClientArea.X-n.ClientActiveArea.X;if(i=n.ClientActiveArea.X-(n.ClientArea.X-this.LeftIndent),t=this.Document.DefaultTabWidth,i==0||t==0)return t;var u=Math.round(i)*100%(Math.round(t)*100)/100,f=(Math.round(i)-u)/Math.round(t),r=(f+1)*t;return r-i>0?r-i:t},r.prototype._AddParagraphWidget=function(n){var t=new ri(this);if(this._IsEmpty()&&this.ParagraphFormat!=null&&(this.ParagraphFormat.TextAlignment==rt.Center||this.ParagraphFormat.TextAlignment==rt.Right)){var i=this._GetParagraphMarkSize(0,0),f=i.TopMargin,e=i.BottomMargin,r=i.Width,u=n.Left;u+=this.ParagraphFormat.TextAlignment==rt.Center?(n.Width-r)/2:n.Width-r;t.Width=r;t.X=n.X;t.Y=n.Y}else t.Width=n.Width,t.X=n.X,t.Y=n.Y;this.ParagraphWidgets._Add(t)},r.prototype._LayoutItems=function(n){var t,i;if(this.paragraphWidgets!=null&&this.paragraphWidgets.Count>0&&this.paragraphWidgets._Clear(),this._AddParagraphWidget(n.ClientActiveArea),n.IsFieldCode||this.ParagraphFormat!=null&&this.ParagraphFormat.ListFormat!=null&&this.ParagraphFormat.ListFormat.List!=null&&this.ParagraphFormat.ListFormat.ListLevelNumber>=0&&this.ParagraphFormat.ListFormat.ListLevelNumber<9&&this._LayoutList(n),this._IsEmpty())this._LayoutEmptyLineWidget(n);else for(t=0;t<this.Inlines.length;t++)t==0&&this.ParagraphFormat!=null&&n._UpdateClientWidth(-this.ParagraphFormat.FirstLineIndent),i=this.Inlines[t],i._LayoutItems(n);this._UpdateWidgetToPage(n)},r.prototype._LayoutList=function(n){var r,i,t;(n._UpdateClientWidth(-this.ParagraphFormat.FirstLineIndent),r=this.Document,i=this.ParagraphFormat.ListFormat.ListLevel,i!=null)&&(t=new dt(this,i,!1),t.Text=i.ListLevelPattern==c.Bullet?i.NumberFormat:r._GetListNumber(this.ParagraphFormat.ListFormat),ft._UpdateTextSize(t),n._CutFromLeft(n.ClientActiveArea.X+t.Width),n.LineElements._Add(t),i.FollowCharacter!=yr.None)&&(t=new dt(this,i,!0),i.FollowCharacter==yr.Tab?(t.Text="\t",t.Width=this._GetTabWidth(n)):(t.Text=" ",ft._UpdateTextSize(t)),n._CutFromLeft(n.ClientActiveArea.X+t.Width),n.LineElements._Add(t),n._UpdateClientWidth(this.ParagraphFormat.FirstLineIndent))},r.prototype._LayoutEmptyLineWidget=function(n){var y=ft._GetParagraphMarkSize(this.CharacterFormat),r=y.Height,p=r-y.BaselineOffset,c,a,v,h;!isNaN(n.LineElements.MaxTextElementHeight)&&r<n.LineElements.MaxTextElementHeight&&(r=n.LineElements.MaxTextElementHeight,p=r-n.LineElements.MaxTextElementBaselineOffset);c=this._GetBeforeSpacing();n.CurrentComment==null&&n.CurrentHeaderFooter==null&&n instanceof w&&n.ClientActiveArea.Height<c+r&&n.ClientActiveArea.Y!=n.ClientArea.Y&&this._MoveToNextPage(n);var o=this._GetLineSpacing(r),f=this._AddLineWidget(),i=0,u=0,s=0,e=r,l=0,t=null;n.LineElements.Count>0&&(t=n.LineElements[0]);t!=null&&(a=t.BaselineOffset,i=n.LineElements.MaxBaselineOffset-a,t.Height<r?l=r-p-(t.Height-(t.Height-a)):e=t.Height);v=this.ParagraphFormat!=null?this.ParagraphFormat.LineSpacingType:ei.Multiple;v==ei.Multiple?o>r?u+=o-r:i+=o-r:v==ei.Exactly?i+=o-(i+e+u):o>i+e+u&&(i+=o-(i+e+u));i+=c;u+=this.ParagraphFormat!=null?this.ParagraphFormat.AfterSpacing:0;t!=null&&(h=this.ParagraphFormat.TextAlignment,h==rt.Right?s=n.ClientArea.Width-t.Width:h==rt.Center&&(s=(n.ClientArea.Width-t.Width)/2),t.Margin=new wr(s,l+i,0,u),t.CurrentLineWidget=f,f.Height=i+e+u,f.Children._Add(t));n.LineElements.Count>1&&n.LineElements[1]instanceof dt&&(t=n.LineElements[1],h=this.ParagraphFormat.TextAlignment,h==rt.Right?s=n.ClientArea.Width-t.Width:h==rt.Center&&(s=(n.ClientArea.Width-t.Width)/2),t.Margin=new wr(s,l+i,0,u),t.CurrentLineWidget=f,f.Height=i+e+u,f.Children._Add(t));f.Height=i+e+u;n._CutFromTop(n.ClientActiveArea.Y+f.Height);n.LineElements._Clear()},r.prototype._MoveToNextPage=function(n){var u=this.ParagraphWidgets[this.ParagraphWidgets.length-1],f=null,i,t,c,s,o,h;if(n.LineElements.length>0&&(f=n.LineElements._ToList(),n.LineElements._Clear()),i=null,u.ChildWidgets.Count>0?(this._UpdateWidgetToPage(n),i=u.ContainerWidget instanceof wt?u.ContainerWidget:null):this.PreviousBlock instanceof r?i=this.PreviousBlock.ParagraphWidgets[this.PreviousBlock.ParagraphWidgets.Count-1].ContainerWidget:this.PreviousBlock instanceof e&&(i=this.PreviousBlock.TableWidgets[this.PreviousBlock.TableWidgets.Count-1].ContainerWidget),t=0,i!=null&&i.Page!=null&&(t=n.Pages._IndexOf(i.Page)),t==n.Pages.Count-1||n.Pages[t+1].Section!=this.Section?(c=n._CreateNewPage(this.Section),n.Pages[t+1].Section!=this.Section&&n._InsertPage(t+1,c)):(n.Pages[t+1].BoundingRectangle=new nt(n.Pages[t+1].BoundingRectangle.X,n.Pages[t].BoundingRectangle.Bottom+20,n.Pages[t+1].BoundingRectangle.Width,n.Pages[t+1].BoundingRectangle.Height),n._UpdateClientArea(this.Section.SectionFormat)),n._UpdateClientAreaForBlock(this,!0),u.ChildWidgets.Count>0?this._AddParagraphWidget(n.ClientActiveArea):u._UpdateClientAreaLocation(n.ClientActiveArea),f!=null&&n.LineElements.Count==0){for(s=n.ClientActiveArea.X,o=0;o<f.Count;o++)h=f[o],s+=h.Width,n.LineElements._Add(h);n._CutFromLeft(s)}},r.prototype._UpdateWidgetToPage=function(n){var t=this.ParagraphWidgets[this.ParagraphWidgets.length-1],i;if(this.IsInsideTable){if(i=this.AssociatedCell.TableCellWidgets[this.AssociatedCell.TableCellWidgets.length-1],t.Height=n.ClientActiveArea.Y-t.Y,n instanceof w){if(this.AssociatedCell==null||this.AssociatedCell.OwnerRow==null||this.AssociatedCell.OwnerRow.RowFormat==null)return;i.Height=this.AssociatedCell.OwnerRow.RowFormat.HeightType==et.Exactly?this.AssociatedCell.OwnerRow.RowFormat.Height:this.AssociatedCell.TableCellWidgets.Count<=1&&this.AssociatedCell.OwnerRow.RowFormat.HeightType==et.Atleast?Math.max(this.AssociatedCell.OwnerRow.RowFormat.Height,i._GetCellContentHeight()+t.Height):i.Height+t.Height}else i.Height=i.Height+t.Height;i.ChildWidgets._Add(t);t.ContainerWidget=i}else t.Height=n.ClientActiveArea.Y-t.Y,this._UpdateWidgetsToBody(n,t),n.CurrentComment==null&&(n.CommentWidgets&&n.CommentWidgets.Count>0&&n._MoveCommentsToPage(t.ContainerWidget.Page),n instanceof w&&n.Pages._Contains(t.ContainerWidget.Page)?t._render(t.ContainerWidget.Page):n instanceof st&&t._Render(n))},r.prototype._GetBeforeSpacing=function(){var n=0;return this.PreviousBlock instanceof r?this.PreviousBlock.ParagraphFormat.AfterSpacing<this.ParagraphFormat.BeforeSpacing&&(n=this.ParagraphFormat.BeforeSpacing-this.PreviousBlock.ParagraphFormat.AfterSpacing):n=this.ParagraphFormat.BeforeSpacing,n},r.prototype._GetLineSpacing=function(n){if(this.ParagraphFormat==null)return 0;var t=0;switch(this.ParagraphFormat.LineSpacingType){case ei.AtLeast:case ei.Exactly:t=this.ParagraphFormat.LineSpacing;break;default:t=this.ParagraphFormat.LineSpacing*n}return t},r.prototype._GetParagraphMarkSize=function(n,t){var i=ft._GetParagraphMarkSize(this.CharacterFormat),e=i.BaselineOffset,r=i.Height,o=e,f,u,h,s;return this.paragraphWidgets.Count>0&&this.paragraphWidgets[0].ChildWidgets.Count>0&&(f=this.paragraphWidgets[0].ChildWidgets[0],f.Children.Count>0&&f.Children[0]instanceof dt&&r<f.Children[0].Height&&(r=f.Children[0].Height,o=f.Children[0].BaselineOffset)),u=this._GetLineSpacing(r),h=this._GetBeforeSpacing(),n=o-e,t=r-o-(i.Height-e),s=this.ParagraphFormat.LineSpacingType,s==ei.Multiple?u>r?t+=u-r:n+=u-r:s==ei.Exactly?n+=u-(n+i.Height+t):u>n+i.Height+t&&(n+=u-(n+i.Height+t)),n+=h,t+=this.ParagraphFormat.AfterSpacing,{Width:i.Width,Height:i.Height,TopMargin:n,BottomMargin:t}},r.prototype._AddLineWidget=function(){var t=null,n;return this.paragraphWidgets!=null&&this.paragraphWidgets.Count>0&&(n=void 0,n=this.ParagraphWidgets[this.ParagraphWidgets.length-1],t=new ru(n),t.Width=n.Width,n.ChildWidgets._Add(t),t.CurrentParagraphWidget=n),t},r.prototype._GetStartOffset=function(){for(var n,t=0,i=0;i<this.Inlines.length;i++)if(n=this.Inlines[i],n.Length!=0){if(n instanceof s||n instanceof pt||n instanceof vi||n instanceof y&&n._IsLinkedFieldCharacter())return t;t+=n.Length}return t},r.prototype._GetLength=function(){for(var t=0,n=0;n<this.Inlines.length;n++)t+=this.Inlines[n].Length;return t},r.prototype._GetOffset=function(n,t){var r,i;if(n==null)return t;for(r=t,i=0;i<this.Inlines.length;i++){if(n==this.Inlines[i])break;r+=this.Inlines[i].Length}return r},r.prototype._GetLineWidget=function(n){var t=null;if(this._IsEmpty())this.paragraphWidgets.Count>0&&this.paragraphWidgets[0].ChildWidgets.Count>0&&(t=this.paragraphWidgets[0].ChildWidgets[0]);else{var i=0,r=this._GetInline(n,i),u=r.inline;i=r.index;t=u._GetLineWidget(i)}return t},r.prototype._GetLineWidgetInternal=function(n,t){var i=null;if(this._IsEmpty())this.paragraphWidgets.Count>0&&this.paragraphWidgets[0].ChildWidgets.Count>0&&(i=this.paragraphWidgets[0].ChildWidgets[0]);else{var r=0,u=this._GetInline(n,r),f=u.inline;r=u.index;i=f._GetLineWidgetInternal(r,t)}return i},r.prototype._GetPhysicalPosition=function(n){return this._GetPhysicalPositionInternal(n,!0)},r.prototype._GetPhysicalPositionInternal=function(n,t){var u,f;if(this._IsEmpty()){u=this.paragraphWidgets[0].X;this.paragraphWidgets[0].ChildWidgets.length>0&&(f=this.paragraphWidgets[0].ChildWidgets[0],u=f._GetLeft());var e=0,s=this._GetParagraphMarkSize(e,0);return n>0&&(u+=s.Width),new p(u,this.paragraphWidgets[0].Y+e)}var r=0,o=this._GetInline(n,r),i=o.inline;return r=o.index,i.Length==r&&i.NextNode!=null&&i.Elements.Count>0&&i.NextNode.Elements.Count>0&&i.Elements[i.Elements.Count-1].CurrentLineWidget!=i.NextNode.Elements[0].CurrentLineWidget&&(i=i.NextNode,r=0),i._GetPhysicalPosition(r,t)},r.prototype._GetEndPosition=function(){var n=this.paragraphWidgets[this.paragraphWidgets.Count-1],i=n.X,r=n.Y,t=null;n.ChildWidgets.Count>0&&(t=n.ChildWidgets[n.ChildWidgets.Count-1],i+=t._GetWidth(!1));t!=null&&(r=t._GetTop());var u=this._GetParagraphMarkSize(0,0);return new p(i,r+u.TopMargin)},r.prototype._GetInline=function(n,t){for(var i=null,r=0,u=!1,f=0;f<this.Inlines.length;f++){if(i=this.Inlines[f],!u&&(i instanceof s||i instanceof pt||i instanceof vi||i instanceof y&&i._IsLinkedFieldCharacter())&&(u=!0),u&&n<=r+i.Length)return t=n-r,t<0&&(t=0),{inline:i,index:t};r+=i.Length}return n>r&&(t=i==null?n:i.Length),{inline:i,index:t}},r.prototype._HighlightSelectedContent=function(n,t,i,r){var u,o,h,y,c,a,s,v,w;if(i.Paragraph.IsInsideTable&&(!r.Paragraph.IsInsideTable||i.Paragraph.AssociatedCell!=r.Paragraph.AssociatedCell||i.Paragraph.AssociatedCell._IsCellSelected(i,r)))i.Paragraph.AssociatedCell._Highlight(n,t,i,r);else{if(u=null,o=0,this==r.Paragraph)if(i.Offset+1==r.Offset)h=this._GetInline(r.Offset,o),u=h.inline,o=h.index,u instanceof pt&&(y=this._GetOffset(u,0),y!=i.Offset&&(u=null));else{var f=0,p=i.Paragraph._GetInline(i.Offset,f),e=p.inline;f=p.index;f==e.Length&&(e=e._GetNextRenderedInline(f));c=r.Paragraph._GetInline(r.Offset,f);a=c.inline;f=c.index;e instanceof l&&a instanceof b&&e.fieldSeparator!=null&&(s=e.fieldSeparator.NextNode,s instanceof pt&&s.NextNode==a&&(u=s))}u instanceof pt&&n.OwnerControl.IsDocumentLoaded?(v=u._GetElementBoxInternal(o),w=v.element,o=v.index,n.OwnerControl.Viewer._PositionImageResizer(w),n.OwnerControl.Viewer._ShowImageResizer()):this._Highlight(n,t,i,r)}},r.prototype._Highlight=function(n,t,i,r){var y=0,h=0,p=null,c=null,w=this._GetStartLineWidget(i,p,y),u=w.lineWidget,l,s,a,e,d,f,v,b,o,k;if(p=w.startElement,y=w.lineIndex,l=this._GetEndLineWidget(r,c,h),s=l.lineWidget,c=l.endElement,h=l.lineIndex,a=0,e=0,u!=null&&(a=u._GetTop(),e=u._GetLeftInternal(p,y)),u!=null&&u==s)d=s._GetLeftInternal(c,h),n._CreateHighlightBorder(t,u,d-e,e,a);else{if(f=this,u!=null)for(f!=u.CurrentParagraphWidget.CurrentNode&&(f=u.CurrentParagraphWidget.CurrentNode),n._CreateHighlightBorder(t,u,u._GetWidth(!0)-(e-u.CurrentParagraphWidget.X),e,a),v=u.CurrentParagraphWidget.ChildWidgets._IndexOf(u),b=f.ParagraphWidgets._IndexOf(u.CurrentParagraphWidget),o=b;o<f.ParagraphWidgets.Count;o++){if(o==b&&(v+=1),f.ParagraphWidgets[o]._Highlight(n,t,v,s,c,h),f.ParagraphWidgets[o]==s.CurrentParagraphWidget)return;v=0}k=f._GetNextRenderedBlock();k!=null&&k._Highlight(n,t,i,r)}},r.prototype._HighlightSearchResult=function(n,t,i){var a=0,s=0,v=null,h=null,y=this._GetStartLineWidget(t,v,a),r=y.lineWidget,c,e,p,o,b,u,l,w,f;if(a=y.lineIndex,v=y.startElement,c=this._GetEndLineWidget(i,h,s),e=c.lineWidget,s=c.lineIndex,h=c.endElement,p=r._GetTop(),o=r._GetLeftInternal(v,a),r!=null&&r==e)b=e._GetLeftInternal(h,s),n._CreateHighlightBorder(r,b-o,o,p);else if(u=this,r!=null)for(u!=r.CurrentParagraphWidget.CurrentNode&&(u=r.CurrentParagraphWidget.CurrentNode),n._CreateHighlightBorder(r,r._GetWidth(!0)-(o-r.CurrentParagraphWidget.X),o,p),l=r.CurrentParagraphWidget.ChildWidgets._IndexOf(r),w=u.ParagraphWidgets._IndexOf(r.CurrentParagraphWidget),f=w;f<u.ParagraphWidgets.Count;f++){if(f==w&&(l+=1),u.ParagraphWidgets[f]._HighlightSearchResult(n,l,e,h,s),u.ParagraphWidgets[f]==e.CurrentParagraphWidget)return;l=0}},r.prototype._GetStartLineWidget=function(n,t,i){var s=this==n.Paragraph?n.Offset:this._GetStartOffset(),h=this._GetInline(s,i),r=h.inline,u,f,e,o;return i=h.index,r!=null&&n.OwnerControl.Selection.IsHighlightingCommentRange&&r.Length==i&&r.NextNode!=null&&(r=r.NextNode,i=0),r instanceof y&&(u=r._GetRenderedInline(i),r=u.Inline,i=u.InlineIndex),s==this._GetLength()+1&&i++,r==null?this.ParagraphWidgets.Count>0?(f=this.ParagraphWidgets[0],{lineWidget:f.ChildWidgets.Count>0?f.ChildWidgets[0]:null,lineIndex:i,startElement:t}):null:(e=r._GetElementBoxInternal(i),t=e.element,i=e.index,o=void 0,o=t==null?r._GetLineWidget(i):t.CurrentLineWidget,{lineWidget:o,lineIndex:i,startElement:t})},r.prototype._GetEndLineWidget=function(n,t,i){var o=n.Paragraph._GetInline(n.Offset,i),r=o.inline,f,u,e;return i=o.index,r instanceof y&&(f=r._GetRenderedInline(i),r=f.Inline,i=f.InlineIndex),r==null?(n.Offset==n.Paragraph._GetLength()+1&&(i=1),n.Paragraph.ParagraphWidgets.Count>0?(u=n.Paragraph.ParagraphWidgets[n.Paragraph.ParagraphWidgets.Count-1],{lineWidget:u.ChildWidgets.Count>0?u.ChildWidgets[u.ChildWidgets.Count-1]:null,lineIndex:i,endElement:t}):null):(n.Offset==n.Paragraph._GetLength()+1&&(i=r.Length+1),e=r._GetElementBoxInternal(i),t=e.element,i=e.index,t==null)?{lineWidget:r._GetLineWidget(i),lineIndex:i,endElement:t}:{lineWidget:t.CurrentLineWidget,lineIndex:i,endElement:t}},r.prototype._HasValidInline=function(n,t){for(var i,r=this.Inlines._IndexOf(n);r<this.Inlines.Count;r++)if(i=this.Inlines[r],i.Length!=0){if(i==t)return!1;if(i instanceof s||i instanceof pt||i instanceof y&&i._IsLinkedFieldCharacter())return!0}return!1},r.prototype._GetPreviousValidOffset=function(n){var r,i,u,t;if(n==0)return 0;for(r=0,i=0,u=0;u<this.Inlines.Count;u++)if(t=this.Inlines[u],t.Length!=0){if(n<=i+t.Length)return n-1==i?r:n-1;(t instanceof s||t instanceof pt||t instanceof y&&t._IsLinkedFieldCharacter())&&(r=i+t.Length);i+=t.Length}return n-1==i?r:n-1},r.prototype._GetEndOffset=function(){for(var n,i=0,r=0,t=0;t<this.Inlines.Count;t++)(n=this.Inlines[t],this.Inlines.length!=0)&&((n instanceof s||n instanceof pt||n instanceof vi||n instanceof y&&n._IsLinkedFieldCharacter())&&(i=r+n.Length),r+=n.Length);return i},r.prototype._GetNextStartInline=function(n){var i=0,u=this._GetInline(n,i),t=u.inline,r;return i=u.index,t!=null&&i==t.Length&&t.NextNode instanceof y&&(r=t.NextNode._GetNextValidInline(),r instanceof l&&(t=r)),t},r.prototype._GetNextValidOffset=function(n){for(var t,i=0,r=0;r<this.Inlines.Count;r++)if(t=this.Inlines[r],t.Length!=0){if(n<i+t.Length&&(t instanceof s||t instanceof pt||t instanceof y&&t._IsLinkedFieldCharacter()))return(n>i?n:i)+1;i+=t.Length}return n},r.prototype._GetSelectedContent=function(n,t,i){return t.Paragraph.IsInsideTable&&(!i.Paragraph.IsInsideTable||t.Paragraph.AssociatedCell!=i.Paragraph.AssociatedCell||t.Paragraph.AssociatedCell._IsCellSelected(t,i))?t.Paragraph.AssociatedCell._GetSelectedContentAsHtmlInternal(n,t,i):this._GetSelectedContentAsHtml(n,t,i)},r.prototype._GetSelectedContentAsHtml=function(n,t,i){var r="",u=null,h=null,c=null,a=0,v=0,f=null,e,y,w;if(this.ParagraphFormat.ListFormat!=null&&(f=this.ParagraphFormat.ListFormat.ListLevel),i.Paragraph==this){if(i.Paragraph._IsEmpty())return(i.Offset=this._GetStartOffset())?"":(f!=null?(r+=this._GetHtmlList(f,t),r+="<li "):r+="<p ",r+=this.ParagraphFormat._GetAsHtmlStyle()+"/>",r.indexOf("<ul")>-1?r+="<\/ul>":r.indexOf("<ol")>-1&&(r+="<\/ol>"),r);e=this._GetInline(i.Offset,0);c=e.inline;v=e.index}for(t.Paragraph==this?t.Offset==this._GetLength()+1||(f!=null?(r+=this._GetHtmlList(f,t),r+="<li "):r+="<p ",r+=this.ParagraphFormat._GetAsHtmlStyle()+">",this._IsEmpty()||(e=this._GetInline(t.Offset,0),u=h=e.inline,a=e.index)):(f!=null?(r+=this._GetHtmlList(f,t),r+="<li "):r+="<p ",r+=this.ParagraphFormat._GetAsHtmlStyle()+">",this.Inlines.Count>0&&(u=this.Inlines[0])),y=this,u==null&&r!=null&&(r+=" ");u!=null;){if(u instanceof s)r+="<span ",r+=u.CharacterFormat._GetAsHtmlStyle(),r+=">",r+=c==u?c==h?this._DecodeHtmlNames(u.Text.substring(a,v)):this._DecodeHtmlNames(u.Text.substring(0,v)):h==u?this._DecodeHtmlNames(u.Text.substring(a,h.Length)):this._DecodeHtmlNames(u.Text),r+="<\/span>";else if(u instanceof pt)r+="<img ",r+='width="'+u.Width+'" ',r+='height="'+u.Height+'" ',r+='src="'+u.ImageString+'" ',r+=u.CharacterFormat._GetAsHtmlStyle(),r+="/>";else if(u instanceof l&&u._IsLinkedFieldCharacter()){var o=u._GetFieldCode(),k=o.toLowerCase(),p=k.indexOf("hyperlink");p>-1&&(o=o.substr(p+9).trim(),r+="<a href="+o+">");u=u.fieldSeparator}else if(u instanceof b&&u._IsLinkedFieldCharacter()){var o=u.FieldBegin._GetFieldCode(),k=o.toLowerCase(),p=k.indexOf("hyperlink");p>-1&&(r+="<\/a>")}if(y=u.OwnerParagraph,u==c)break;u=u.NextNode}return r!=""&&(f!=null?(r+="<\/li>",r.indexOf("<ul")>-1?r+="<\/ul>":r.indexOf("<ol")>-1&&(r+="<\/ol>")):r+="<\/p>"),i.Paragraph!=y&&(w=this._GetNextRenderedBlock(),w!=null&&(r+=w._GetSelectedContentAsHtml(n,t,i))),r},r.prototype._GetContentAsHtml=function(){var i=null,n,r,t;for(this.ParagraphFormat.ListFormat!=null&&(i=this.ParagraphFormat.ListFormat.ListLevel),n="",i!=null?(n+=this._GetHtmlList(i,null),n+="<li "):n+="<p ",n+=this.ParagraphFormat._GetAsHtmlStyle(),n+=">",this.Inlines.length==0&&(n+=" "),r=0;r<this.Inlines.length;r++)t=this.Inlines[r],t instanceof s?(n+="<span ",n+=t.CharacterFormat._GetAsHtmlStyle(),n+=">",n+=this._DecodeHtmlNames(t.Text),n+="<\/span>"):t instanceof pt&&(n+="<img ",n+='width="'+t.Width+'" ',n+='height="'+t.Height+'" ',n+='src="'+t.ImageString+'" ',n+=t.CharacterFormat._GetAsHtmlStyle(),n+="/>");return i!=null?(n+="<\/li>",n.indexOf("<ul")>-1?n+="<\/ul>":n.indexOf("<ol")>-1&&(n+="<\/ol>")):n+="<\/p>",n},r.prototype._GetHtmlList=function(n){var t="";if(n.ListLevelPattern==c.Bullet){t+='<ul type="';switch(n.NumberFormat){case lt.SQUAREBULLET:n.CharacterFormat.FontFamily!=null&&n.CharacterFormat.FontFamily=="Wingdings"&&(t+="square");break;case lt.DOTBULLET:n.CharacterFormat.FontFamily!=null&&n.CharacterFormat.FontFamily=="Symbol"&&(t+="disc");break;case lt.CIRCLEBULLET:n.CharacterFormat.FontFamily!=null&&n.CharacterFormat.FontFamily=="Symbol"&&(t+="circle")}t+='">'}else{t+='<ol type="';switch(n.ListLevelPattern){case c.Number:case c.Arabic:case c.Ordinal:t+="1";break;case c.LowLetter:t+="a";break;case c.UpLetter:t+="A";break;case c.LowRoman:t+="i";break;case c.UpRoman:t+="I"}t+='" start="'+n.StartAt.toString()+'">'}return t},r.prototype._GetBodyWidgetOfPreviousBlock=function(n){n=0;var i=null,t=null;return this.PreviousBlock instanceof r?(t=this.PreviousBlock.ParagraphWidgets[this.PreviousBlock.ParagraphWidgets.Count-1],i=t.ContainerWidget instanceof wt?t.ContainerWidget:null,n=i.ChildWidgets._IndexOf(t)):this.PreviousBlock instanceof e&&(t=this.PreviousBlock.TableWidgets[this.PreviousBlock.TableWidgets.Count-1],i=t.ContainerWidget instanceof wt?t.ContainerWidget:null,n=i.ChildWidgets._IndexOf(t)),{prevBodyWidget:i,index:n}},r.prototype._GetLineWidgetToClear=function(n,t,i){var u=this.Inlines._IndexOf(t),r=null,f;return u>0&&(f=this.Inlines[u-1],i=f._GetPreviousElementBox(),i!=null&&(r=i.CurrentLineWidget)),r==null&&this.paragraphWidgets[0].ChildWidgets.Count>0&&(r=this.paragraphWidgets[0].ChildWidgets[0]),{prevElement:i,startLineWidget:r}},r.prototype._UpdateListItems=function(n){var r;if(this==n)return!0;var u=this.Document,t=null,i=0;return this.ParagraphFormat!=null&&this.ParagraphFormat.ListFormat!=null&&(t=this.ParagraphFormat.ListFormat.List,i=this.ParagraphFormat.ListFormat.ListLevelNumber),t!=null&&t.AbstractList!=null&&t.AbstractList.Levels[i]!=null&&(r=t._GetListLevel(i),r.ListLevelPattern!=c.Bullet&&u._GetListNumber(this.ParagraphFormat.ListFormat)),!1},r.prototype._UpdateListParagraphs=function(){this.Document!=null&&this.ParagraphFormat!=null&&this.ParagraphFormat.ListFormat!=null&&this.ParagraphFormat.ListFormat.List!=null&&this.Document.ListParagraphs._Add(this)},r.prototype._UpdateRenderedListItems=function(){var r,t,i;if(this.ParagraphFormat.ListFormat.List!=null){var u=this.Document,n=this.ParagraphFormat.ListFormat.List,f=this.ParagraphFormat.ListFormat.ListLevelNumber;n!=null&&n.AbstractList!=null&&n.AbstractList.Levels[this.ParagraphFormat.ListFormat.ListLevelNumber]!=null&&(r=n._GetListLevel(f),r.ListLevelPattern!=c.Bullet&&(t=null,this.paragraphWidgets.Count>0&&this.paragraphWidgets[0].ChildWidgets.Count>0&&(i=this.paragraphWidgets[0].ChildWidgets[0],i.Children.Count>0&&(t=i.Children[0])),t!=null&&(t.Text=u._GetListNumber(this.ParagraphFormat.ListFormat))))}},r.prototype._SplitParagraph=function(n,t){var i=new r(null),u,f;return(i.ParagraphFormat._CopyFormat(this.ParagraphFormat),i.CharacterFormat._CopyFormat(this.CharacterFormat),this._MoveInlines(i,0,n,t),this.Owner instanceof g)?(u=this.Owner.Blocks.indexOf(this),this.Owner.Blocks._Insert(u,i),i):(f=this._GetIndexInOwnerCollection(),this.Owner.ChildNodes._Insert(f,i),i)},r.prototype._SplitParagraphInternal=function(n){var i=0,t=new r(null),u;if(n==this._GetLength()?(t.ParagraphFormat._CopyFormat(this.ParagraphFormat),t.CharacterFormat._CopyFormat(this.CharacterFormat),i++):(t.ParagraphFormat._CopyFormat(this.ParagraphFormat),t.CharacterFormat._CopyFormat(this.CharacterFormat),n>0&&this._MoveInlines(t,0,0,n)),this.Owner instanceof g){i+=this.Owner.Blocks._IndexOf(this);this.Owner.Blocks._Insert(i,t);return}i+=this._GetIndexInOwnerCollection();u=null;this.Owner instanceof yt&&(u=this.Owner);u!=null&&u.ChildNodes._Insert(i,t)},r.prototype._MoveInlines=function(n,t,i,r){for(var u,f,o,c,e=0,h=0;h<this.Inlines.Count;h++){if(u=this.Inlines[h],i>=e+u.Length){e+=u.Length;continue}if(f=0,i>e&&(f=i-e),o=r-e,o>u.Length&&(o=u.Length),f>0&&(e+=f),f==0&&o==u.Length?(n.Inlines._Insert(t,u),t++,h--):u instanceof s&&(c=new s(null),c.CharacterFormat._CopyFormat(u.CharacterFormat),c.Text=u.Text.substring(f,o-f),n.Inlines._Insert(t,c),t++,u.Text=u.Text.slice(o-f)),r<=e+o-f)break;e+=o-f}},r.prototype._DeleteSelectedContent=function(n,t,i,r){var f=0,e=t.Paragraph._GetInline(t.Offset,f),u=e.inline,o;if(f=e.index,u!=null&&(u=u._GetNextRenderedInline(f)),u instanceof l&&u.fieldEnd!=null){var s=u.fieldEnd.OwnerParagraph._GetOffset(u.fieldEnd,1),h=u.fieldEnd.OwnerParagraph._GetHierarchicalIndex(s.toString()),c=i._GetHierarchicalIndexInternal();tt._IsForwardSelection(h,c)||(t._MoveToInline(u.fieldSeparator,1),n.EditPosition=t._GetHierarchicalIndexInternal(),n.CurrentBaseHistoryInfo!=null&&(n.CurrentBaseHistoryInfo.InsertPosition=n.EditPosition))}if(f=0,e=i.Paragraph._GetInline(i.Offset,f),u=e.inline,f=e.index,u!=null&&(u=u._GetNextRenderedInline(f)),u instanceof b&&u.FieldBegin!=null){var a=u.FieldBegin.OwnerParagraph._GetOffset(u.FieldBegin,0),v=u.FieldBegin.OwnerParagraph._GetHierarchicalIndex(a.toString()),y=t._GetHierarchicalIndexInternal();tt._IsForwardSelection(y,v)||(o=u._GetPreviousTextInline(),o==null?i._MoveBackward():i._MoveToInline(o,o.Length))}if(t.Paragraph!=this){t.Paragraph._DeleteSelectedContent(n,t,i,r);return}t.Paragraph.IsInsideTable&&(!i.Paragraph.IsInsideTable||t.Paragraph.AssociatedCell!=i.Paragraph.AssociatedCell||t.Paragraph.AssociatedCell._IsCellSelected(t,i))?t.Paragraph.AssociatedCell._Delete(n,t,i,r):this._Delete(n,t,i,r)},r.prototype._Delete=function(n,t,u,f){var w=this._GetStartOffset(),tt=u.Paragraph._GetStartOffset(),h=w,b=!1,d=this._GetLength(),a=this,v=this.Section,o,y,k,nt,p,rt,l;if(this==t.Paragraph&&(h=t.Offset,u.Paragraph.IsInsideTable&&(b=this._IsEndInAdjacentTable(u.Paragraph))),this!=t.Paragraph&&n.IsSkipLayouting&&(n.IsSkipLayouting=!1),o=this._GetNextRenderedBlock(),h>w&&h==d&&(this==u.Paragraph&&u.Offset==h+1||o==u.Paragraph&&u.Offset==tt)&&(b=!0),h>w&&(u.Paragraph!=this||u.Offset>d)){if(f==4)return;a=this._SplitParagraph(0,h);this._RemoveBlock();n.CurrentBaseHistoryInfo.RemovedNodes._Add(this);o==null||u.Paragraph==this||o==u.Paragraph&&u.Offset==tt||(y=o.Section,v!=y&&(f<4&&v._CombineSection(n,y),f>2&&n._CopySectionFormat(v)),o._Delete(n,t,u,f))}else if(u.Paragraph==this&&u.Offset<=d)u.Offset>w&&this._RemoveInlines(n,h,u.Offset,f);else{var s=null,it=this.PreviousBlock,c=it instanceof r?it:null;f<4&&(this==u.Paragraph&&this.NextBlock==null&&c==null&&(s=new r(null),f==1&&(s.CharacterFormat._CopyFormat(this.CharacterFormat),s.ParagraphFormat._CopyFormat(this.ParagraphFormat)),this.Owner instanceof g?this.Owner.Blocks._Add(s):this.Owner instanceof yt&&this.Owner.ChildNodes instanceof ur&&this.Owner.ChildNodes._Add(s)),this._RemoveBlock(),n.CurrentBaseHistoryInfo.RemovedNodes._Add(this),s!=null?(n.EditPosition=s._GetHierarchicalIndex("0"),l=s._GetLength()+1,n.CurrentBaseHistoryInfo.EndPosition=s._GetHierarchicalIndex(l.toString())):this==u.Paragraph&&this.NextBlock==null&&c!=null&&(o==null?(l=c._GetLength(),n.EditPosition=c._GetHierarchicalIndex(l.toString()),n.CurrentBaseHistoryInfo.InsertPosition=n.EditPosition,n.CurrentBaseHistoryInfo.EndPosition=n.EditPosition):(l=this._GetLength()+1,o instanceof r&&(c=o),o instanceof e&&(c=o._GetFirstParagraphInFirstCell()),n.EditPosition=c._GetHierarchicalIndex("0"))));u.Paragraph!=this&&o!=null&&(y=o.Section,v!=y&&(f<4&&v._CombineSection(n,y),f>2&&n._CopySectionFormat(v)),o._Delete(n,t,u,f))}if((n.OwnerControl.History.IsUndoing||n.OwnerControl.History.IsRedoing)&&(k=a._GetNextParagraph(),k==u.Paragraph&&this==t.Paragraph&&n.CurrentBaseHistoryInfo.Action==i.Paste)){for(nt=0,p=0;p<a.Inlines.Count;p++)rt=a.Inlines[p],p--,k.Inlines._Insert(nt,rt),nt++;a._RemoveBlock();b=!1;l=n.EditPosition.substring(n.EditPosition.lastIndexOf(";")+1);n.EditPosition=k._GetHierarchicalIndex(l)}b&&a._DeleteParagraphMark(n,f)},r.prototype._DeleteParagraphMark=function(n,t){var i=this._GetNextParagraph(),f,o,h,u,r,s;if((!this.IsInsideTable||this.NextBlock!=null)&&i!=null)if(f=this.Section,o=null,o=this._GetNextRenderedBlock()instanceof e?this._GetNextRenderedBlock():null,i.IsInsideTable&&o!=null&&o._Contains(i.AssociatedCell)){if(t<4){for(u=o.Section,f!=u&&f._CombineSection(n,u),h=0,r=this.Inlines.Count-1;r>=0;r--)s=this.Inlines[r],h+=s.Length,i.Inlines._Insert(0,s);this._RemoveBlock();h>0&&(n.EditPosition=i._GetHierarchicalIndex(h.toString()))}}else if(t<4){for(u=i.Section,f!=u&&f._CombineSection(n,u),r=0;r<i.Inlines.Count;r++)s=i.Inlines[r],r--,this.Inlines._Add(s);i._RemoveBlock();n.CurrentBaseHistoryInfo.RemovedNodes._Add(i)}},r.prototype._IsEndInAdjacentTable=function(n){var t=this._GetHierarchicalIndex(""),i=n._GetHierarchicalIndex(""),r=t.split(";"),u=i.split(";");return r.length<u.length},r.prototype._InsertParagraph=function(n,t,i){var f,r,u;if(i?(f=this._GetLength(),this._MoveInlines(n,n.Inlines.Count,t,f)):t>0&&this._MoveInlines(n,0,0,t),this.Owner instanceof g){r=this.Owner.Blocks._IndexOf(this);i&&r++;this.Owner.Blocks._Insert(r,n);return}u=this._GetIndexInOwnerCollection();i&&u++;this.Owner.ChildNodes._Insert(u,n)},r.prototype._RemoveInlines=function(n,t,i,r){for(var u,f,o,c,e=0,h=0;h<this.Inlines.Count;h++){if(u=this.Inlines[h],t>=e+u.Length){e+=u.Length;continue}if(f=0,t>e&&(f=t-e),o=i-e,o>u.Length&&(o=u.Length),f>0&&(e+=f),f==0&&o==u.Length?r<4&&(u instanceof vi&&!(n.OwnerControl.History.IsUndoing||n.OwnerControl.History.IsRedoing)&&n.RemovedCommentCharacters._Add(u),this.Inlines._Remove(u),h--,n.CurrentBaseHistoryInfo.RemovedNodes._Add(u)):u instanceof s&&r<4&&(c=new s(null),c.CharacterFormat._CopyFormat(u.CharacterFormat),c.Text=u.Text.substr(f,o-f),n.CurrentBaseHistoryInfo.RemovedNodes._Add(c),u.Text=u.Text.slice(0,f)+u.Text.slice(o)),i<=e+o-f)break;e+=o-f}},r.prototype._RemoveAtOffset=function(n,t){for(var i,e,u,r=0,f=0;f<this.Inlines.Count;f++){if(i=this.Inlines[f],t<r+i.Length){e=t-r;t==r&&i.Length==1?(this.Inlines._Remove(i),n.RemovedNodes._Add(i)):(u=new s(this),u.CharacterFormat._CopyFormat(i.CharacterFormat),u.Text=i.Text.substr(e,1),i.Text=kt._Remove(i.Text,e,1),n.RemovedNodes._Add(u));break}r+=i.Length}},r.prototype._ClearLineWidgets=function(n,t,i){var u,r,o,f,e;if(this.paragraphWidgets[0].ChildWidgets==null||this.paragraphWidgets[0].ChildWidgets.Count==0){this.paragraphWidgets[0].ContainerWidget!=null&&this.paragraphWidgets[0].ContainerWidget.ChildWidgets._Contains(this.paragraphWidgets[0])&&(this.paragraphWidgets[0].ContainerWidget.ChildWidgets._Remove(this.paragraphWidgets[0]),this.paragraphWidgets[0].ContainerWidget.Height-=this.paragraphWidgets[0].Height);n._CutFromTop(this.paragraphWidgets[0].Y);return}var h=t.CurrentParagraphWidget.Y,c=n.ClientActiveArea.X,s=this.paragraphWidgets._IndexOf(t.CurrentParagraphWidget);for(u=s;u<this.paragraphWidgets.Count;u++)if(r=this.paragraphWidgets[u],r.ContainerWidget!=null&&r.ContainerWidget.ChildWidgets._Contains(r)&&(r.ContainerWidget.ChildWidgets._Remove(r),r.ContainerWidget.Height-=r.Height),u==s){for(s=-1,o=r.ChildWidgets._IndexOf(t),f=o;f<r.ChildWidgets.Count;f++){if(e=r.ChildWidgets[f],f==o?(o=-1,c+=e._ClearChildWidgets(n,i)):e._Dispose(),r.ChildWidgets==null)break;r.ChildWidgets._Contains(e)&&(r.ChildWidgets._Remove(e),r.Height-=r.ChildWidgets.Count==0?r.Height:e.Height);f--}h+=r.Height}else r._Dispose(),this.paragraphWidgets._Remove(r),u--;n._CutFromTop(h);n._CutFromLeft(c)},r.prototype._ShiftWidgets=function(n){var u=0,o=this._GetBodyWidgetOfPreviousBlock(u),i=o.prevBodyWidget,f,r,t,e,s;for(u=o.index,f=null,r=0;r<this.paragraphWidgets.Count;r++){if(t=this.paragraphWidgets[r],f!=null){if(t._ShiftToPreviousWidget(n,f),t.ChildWidgets==null||t.ChildWidgets.Count==0){r--;continue}f=null;i!=t.ContainerWidget&&(i=t.ContainerWidget)}n instanceof st||n.CurrentComment!=null?(e=new p(t.X,n.ClientActiveArea.Y),t.X=e.X,t.Y=e.Y,n._CutFromTop(n.ClientActiveArea.Y+t.Height)):t._IsFitInClientArea(n)?(f=t,t.Y=n.ClientActiveArea.Y,n._CutFromTop(n.ClientActiveArea.Y+t.Height),i!=t.ContainerWidget&&(u++,t._UpdateContainerWidget(i,u))):(s=t._SplitWidget(n,i,u+1),f=null,i!=t.ContainerWidget&&(i=t.ContainerWidget,r--),u=i.ChildWidgets._IndexOf(t),s&&(i=this.paragraphWidgets[r+1].ContainerWidget))}},r.prototype._RelayoutParagraph=function(n){var y=this.BaseParent,s=this.Document,u,c,l,o;if(s==null||s.OwnerControl==null||!s.OwnerControl.Selection.IsSkipLayouting)if(this._IsInComment())this._GetOwnerComment()._Relayout();else if(y!=null){var f=this.Section,i=f.Document,t=i.OwnerControl.Viewer;if(t.FieldEndParagraph!=null&&t.FieldEndParagraph.BaseParent==null&&(t.FieldEndParagraph=this),t.FieldToLayout!=null&&(u=t.FieldToLayout.OwnerParagraph,c=t.FieldToLayout,t.FieldToLayout=null,u!=null&&u.BaseParent!=null)){if(n=c._GetIndexInOwnerCollection(),u!=this){u._RelayoutParagraph(n);return}if(n==0&&this.ParagraphWidgets.Count==0){this._Layout();return}}if(t.BlockToShift==this&&this._Layout(),i.OwnerControl.IsLayoutEnabled)if(t.Pages.Count==0&&t._CreateNewPage(f),this.IsInsideTable)l=this.AssociatedCell._GetContainerCell(),l.OwnerRow._Layout(t,!1);else{if(t._UpdateClientArea(f.SectionFormat),i.OwnerControl.IsDocumentLoaded&&!i.OwnerControl.IsPastingContent&&i._UpdateListItems(this),t._UpdateClientAreaForBlock(this,!0),!this._IsEmpty()&&n>0){var a=this.Inlines[n],h=null,v=this._GetLineWidgetToClear(t,a,h),e=v.startLineWidget;if(h=v.prevElement,e!=null){this._UpdateListItems(null);o=null;e.CurrentParagraphWidget.CurrentNode instanceof r&&(o=e.CurrentParagraphWidget.CurrentNode);o!=null&&o._ClearLineWidgets(t,e,h);a._RelayoutItems(t);return}}this._Relayout(t,f)}}},r.prototype._GetNextValidCharacterFormat=function(n){var t=n._GetNextTextInline(),i;return t==null?n.OwnerParagraph.CharacterFormat:(i=null,t instanceof l&&(i=t),i==null?t.CharacterFormat:this._GetNextValidCharacterFormatofField(i))},r.prototype._GetNextValidCharacterFormatofField=function(n){var t=n,i;return(n._IsLinkedFieldCharacter()&&(t=n.fieldSeparator==null?n.fieldEnd:n.fieldSeparator),i=null,t.NextNode!=null&&(i=t.NextNode._GetNextValidInline()),i==null)?t.OwnerParagraph.CharacterFormat:i.CharacterFormat},r.prototype._GetCharacterFormatForSelection=function(n,t,i){t.Paragraph.IsInsideTable&&(!i.Paragraph.IsInsideTable||t.Paragraph.AssociatedCell!=i.Paragraph.AssociatedCell||t.Paragraph.AssociatedCell._IsCellSelected(t,i))?t.Paragraph.AssociatedCell._GetCharacterFormat(n,t,i):this._GetCharacterFormat(n,t,i)},r.prototype._GetCharacterFormat=function(n,t,i){var f,h,c,a,v,u,y,e,r,w,o,p;if(this!=t.Paragraph&&this!=i.Paragraph){this._GetCharacterFormatInternal(n);return}if(i.Paragraph!=this||t.Paragraph==this||i.Offset!=0){if(f=0,h=this._GetLength(),this==t.Paragraph)if(f=t.Offset,c=0,a=this._GetInline(f,c),c=a.index,r=a.inline,f<h){if(n.IsEmpty){r instanceof s||r instanceof l||r instanceof b?n.CharacterFormat._CopyFormat(r.CharacterFormat):r._GetPreviousTextInline()!=null?n.CharacterFormat._CopyFormat(r._GetPreviousTextInline().CharacterFormat):r._GetNextTextInline()!=null?n.CharacterFormat._CopyFormat(r._GetNextTextInline().CharacterFormat):n.CharacterFormat._CopyFormat(this.CharacterFormat);return}c==r.Length&&r.NextNode!=null?n.CharacterFormat._CopyFormat(this._GetNextValidCharacterFormat(r)):r instanceof s?n.CharacterFormat._CopyFormat(r.CharacterFormat):r instanceof l&&n.CharacterFormat._CopyFormat(this._GetNextValidCharacterFormatofField(r))}else if(h==i.Offset){r instanceof s||r instanceof b?n.CharacterFormat._CopyFormat(r.CharacterFormat):(r=r._GetPreviousTextInline())!=null?n.CharacterFormat._CopyFormat(r.CharacterFormat):n.CharacterFormat._CopyFormat(this.CharacterFormat);return}for(v=i.Offset,this!=i.Paragraph&&(v=h),u=0,y=!1,e=0;e<this.Inlines.Count;e++){if(r=this.Inlines[e],f>=u+r.Length){u+=r.Length;continue}if(r instanceof l&&r._IsLinkedFieldCharacter()){w=r.fieldSeparator==null?r.fieldEnd:r.fieldSeparator;do u+=r.Length,r=r.NextNode,e++;while(r!=w);y=!0}if(r instanceof b&&r._IsLinkedFieldCharacter()&&y){o=r.FieldBegin;do n.CharacterFormat._CombineFormat(o.CharacterFormat),o=o.NextNode;while(!(o instanceof b))}if(r instanceof s&&n.CharacterFormat._CombineFormat(r.CharacterFormat),v<=u+r.Length)break;u+=r.Length}i.Paragraph!=this&&(p=this._GetNextRenderedBlock(),p!=null&&p._GetCharacterFormat(n,t,i))}},r.prototype._GetCharacterFormatInternal=function(n){for(var i,t=0;t<this.Inlines.Count;t++)this.Inlines[t]instanceof pt||(i=this.Inlines[t],n.CharacterFormat._CombineFormat(i.CharacterFormat))},r.prototype._GetCharacterFormatofTextPostion=function(n){var u=n.Offset,i=0,r=this._GetInline(u,i),t=r.inline;return(i=r.index,t!=null&&i==t.Length&&t.NextNode!=null)?this._GetNextValidCharacterFormat(t):t!=null&&t instanceof l?this._GetNextValidCharacterFormat(t):t!=null?t.CharacterFormat:null},r.prototype._GetParagraphFormat=function(n){n.ParagraphFormat._CombineFormat(this.ParagraphFormat)},r.prototype._GetParagraphFormatInternal=function(n,t,i){if(t.Paragraph==this?n.ParagraphFormat._CopyFormat(this.ParagraphFormat):n.ParagraphFormat._CombineFormat(this.ParagraphFormat),i.Paragraph!=this){var r=this._GetNextRenderedBlock();r!=null&&r._GetParagraphFormatInternal(n,t,i)}},r.prototype._GetParagraphFormatForSelection=function(n,t,i){t.Paragraph.IsInsideTable&&(!i.Paragraph.IsInsideTable||t.Paragraph.AssociatedCell!=i.Paragraph.AssociatedCell||t.Paragraph.AssociatedCell._IsCellSelected(t,i))?t.Paragraph.AssociatedCell._GetParagraphFormatInternal(n,t,i):this._GetParagraphFormatInternal(n,t,i)},r.prototype._Relayout=function(n,t){var i,r,o,u,f,e;this.ParagraphWidgets!=null&&(i=null,r=this.paragraphWidgets[0].ContainerWidget,r instanceof wt&&(i=r),this._PreservePreviousElements(n),i==null?n._CutFromTop(this.ParagraphWidgets.Count>0?this.ParagraphWidgets[0].Y:n.ClientArea.Top):(o=i.ChildWidgets._IndexOf(this.ParagraphWidgets[0]),o>0?n._CutFromTop(this.ParagraphWidgets[0].Y):(u=this.Section.BodyWidgets,f=u._IndexOf(i),f>0&&(i=u[f-1],e=i.ChildWidgets[i.ChildWidgets.Count-1],n._CutFromTop(e.Y+e.Height)))),this._ClearWidgets(),n.Pages.Count==0&&(n._CreateNewPage(t),n._UpdateClientAreaForBlock(this,!0)),this._LayoutItems(n),n._UpdateClientAreaForBlock(this,!1),this._LayoutNextItems(n))},r.prototype._PreservePreviousElements=function(n){var t,u,i,r;this.paragraphWidgets.Count>0&&(t=this.paragraphWidgets[0],t.ChildWidgets.Count>0&&(u=t.ChildWidgets[0],i=n.ClientActiveArea.X,i+=u._PreservePreviousElements(n),r=0,r=t.CurrentNode.ParagraphFormat.FirstLineIndent,i-r!=n.ClientActiveArea.X&&(this._UpdateListItems(null),n._CutFromLeft(i))))},r.prototype._CombineParagraphWidgets=function(n){var i,t,r;if(this.paragraphWidgets.Count!=0&&(i=this.ParagraphWidgets[0],n.ChildWidgets._Contains(i)||i._UpdateContainerWidgetForCell(n),this.paragraphWidgets.Count!=1))for(t=1;t<this.paragraphWidgets.Count;t++)r=this.paragraphWidgets[t],r._ShiftChildsToWidget(i),t--},r.prototype._RemoveSelectedContent=function(n,t,i){return i.Paragraph.IsInsideTable&&i.Paragraph!=i.Paragraph.AssociatedCell.OwnerTable._GetLastParagraphInLastCell()&&(!t.Paragraph.IsInsideTable||t.Paragraph.AssociatedCell.OwnerTable!=i.Paragraph.AssociatedCell.OwnerTable)?!1:(n.OwnerControl.IsShiftingEnabled=!0,this._DeleteSelectedContent(n,t,i,2),!0)},r.prototype._ApplyCharacterFormatForSelection=function(n,t,i,r,u,f){n.OwnerControl.IsLayoutEnabled=!1;t.Paragraph.IsInsideTable&&(!i.Paragraph.IsInsideTable||t.Paragraph.AssociatedCell!=i.Paragraph.AssociatedCell||t.Paragraph.AssociatedCell._IsCellSelected(t,i))?t.Paragraph.AssociatedCell._ApplyCharacterFormat(n,t,i,r,u,f):this._ApplyCharacterFormat(n,t,i,r,u,f)},r.prototype._GetCurrentSelectionValue=function(n,t,i){var u;if(t==o.BoldProperty||t==o.ItalicProperty){var f=n.CurrentSelectionRange,e=0,s=f.Start;f.IsForward||(s=f.End);var c=s.Paragraph,h=c._GetInline(s.Offset,e),r=h.inline;e=h.index;u=this.CharacterFormat;r!=null&&(u=e==r.Length?r.NextNode==null?this.CharacterFormat:r.NextNode.CharacterFormat:r.CharacterFormat);t==o.BoldProperty&&(i=!u.Bold);t==o.ItalicProperty&&(i=!u.Italic)}return i},r.prototype._ApplyCharacterFormatForCell=function(){},r.prototype._ApplyCharacterFormatForSel=function(n,t,i,r){for(var u=0;u<this.Inlines.Count;u++)this.Inlines[u].CharacterFormat._ApplyPropertyValue(n.CurrentBaseHistoryInfo,t,i,r);this.CharacterFormat._ApplyPropertyValue(n.CurrentBaseHistoryInfo,t,i,r)},r.prototype._StartSelectionRelayouting=function(n,t,i){if(n.OwnerControl.IsLayoutEnabled=!0,t.Paragraph.IsInsideTable){for(var r=t.Paragraph.AssociatedCell.OwnerTable;r.IsInsideTable;)r=r.AssociatedCell.OwnerTable;r._RelayoutSelection(n,t,i)}else this._RelayoutSelection(n,t,i)},r.prototype._RelayoutWithIndex=function(n){var v=this.BaseParent,s=this.Document,i,c,y,o;if(s==null||s.OwnerControl==null||!s.OwnerControl.Selection.IsSkipLayouting)if(this._IsInComment())this._GetOwnerComment()._Relayout();else if(v!=null){var u=this.Section,f=u.Document,t=f.OwnerControl.Viewer;if(t.FieldEndParagraph!=null&&t.FieldEndParagraph.BaseParent==null&&(t.FieldEndParagraph=this),t.FieldToLayout!=null&&(i=t.FieldToLayout.OwnerParagraph,c=t.FieldToLayout,t.FieldToLayout=null,i!=null&&i.BaseParent!=null)){if(n=c._GetIndexInOwnerCollection(),i!=this){i._RelayoutWithIndex(n);return}if(n==0&&this.ParagraphWidgets.Count==0){this._Layout();return}}if(t.BlockToShift==this)this._Layout();else if(f.OwnerControl.IsLayoutEnabled)if(t.Pages.Count==0&&t._CreateNewPage(u),this.IsInsideTable)y=this.AssociatedCell._GetContainerCell();else{if(t._UpdateClientArea(u.SectionFormat),f.OwnerControl.IsDocumentLoaded&&f._UpdateListItems(this),t._UpdateClientAreaForBlock(this,!0),!this._IsEmpty()&&n>0){var l=this.Inlines[n],h=null,a=this._GetLineWidgetToClear(t,l,h),e=a.startLineWidget;if(h=a.prevElement,e!=null){this._UpdateListItems(null);o=null;e.CurrentParagraphWidget.CurrentNode instanceof r&&(o=e.CurrentParagraphWidget.CurrentNode);o!=null&&o._ClearLineWidgets(t,e,h);l._RelayoutItems(t);return}}this._Relayout(t,u)}}},r.prototype._RelayoutSelection=function(n,t,i){var e;if(t.Paragraph==this){var h=t.Offset,c=this._GetLength(),f=0,u=0,o=this._GetInline(t.Offset,f),r=o.inline;f=o.index;r!=null&&(f==r.Length&&r.NextNode!=null&&(r=r.NextNode),u=r._GetIndexInOwnerCollection());r instanceof s&&r.Elements.Count==0&&u>0?this._RelayoutWithIndex(u-1):this._RelayoutWithIndex(u)}else this._RelayoutWithIndex(0);return i.Paragraph==this?!0:(e=this._GetNextRenderedBlock(),e!=null)?e._RelayoutSelection(n,t,i):!1},r.prototype._ApplyCharacterFormat=function(n,t,i,r,u,f){var l=0,p=this._GetLength(),o,e,s,h,a,v,c,y;for(n!=null&&n.SelectionRanges.Count>0&&this==t.Paragraph&&(l=t.Offset,u=this._GetCurrentSelectionValue(n,r,u)),o=i.Offset,this!=i.Paragraph&&(this.CharacterFormat._ApplyPropertyValue(n.CurrentBaseHistoryInfo,r,u,f),o=p),e=0,s=0;s<this.Inlines.Count;s++){if(h=this.Inlines[s],l>=e+h.Length){e+=h.Length;continue}if(a=0,l>e&&(a=l-e),v=o-e,c=h.Length,v>c&&(v=c),h._ApplyCharacterFormat(n,a,v,r,u,f),o<=e+c)break;e+=c;a>0&&s++}if(i.Paragraph==this){o==p+1&&this.CharacterFormat._ApplyPropertyValue(n.CurrentBaseHistoryInfo,r,u,f);return}y=this._GetNextRenderedBlock();y!=null&&y._ApplyCharacterFormat(n,t,i,r,u,f)},r.prototype._ApplyParagraphFormatForSelection=function(n,t,i,r,u,f){t.Paragraph.IsInsideTable&&(!i.Paragraph.IsInsideTable||t.Paragraph.AssociatedCell!=i.Paragraph.AssociatedCell||t.Paragraph.AssociatedCell._IsCellSelected(t,i))?t.Paragraph.AssociatedCell._ApplyParagraphFormat(n,t,i,r,u,f):this._ApplyParagraphFormat(n,t,i,r,u,f)},r.prototype._ApplyParagraphFormat=function(n,t,i,r,u,f){if(this.ParagraphFormat._ApplyPropertyValue(n.CurrentBaseHistoryInfo,r,u,f),i.Paragraph!=this){var e=this._GetNextRenderedBlock();e!=null&&e._ApplyParagraphFormat(n,t,i,r,u,f)}},r.prototype._ApplyParagraphFormatInternal=function(n,t,i,r){this.ParagraphFormat._ApplyPropertyValue(n.CurrentBaseHistoryInfo,t,i,r)},r.prototype._ClearWidgets=function(){var n,t;if(this.paragraphWidgets!=null&&this.paragraphWidgets.Count>0)for(n=0;n<this.paragraphWidgets.Count;n++)t=this.paragraphWidgets[n],t._Dispose(),this.paragraphWidgets._Remove(t),n--},r.prototype._Dispose=function(){var n,t;if(this.CharacterFormat._Dispose(),this.ParagraphFormat._Dispose(),this._SetOwner(null),this.paragraphWidgets!=null&&(this._ClearWidgets(),this.paragraphWidgets=null),this.Inlines!=null){for(this.Inlines._Dispose(),n=0;n<this.Inlines.Count;n++)t=this.Inlines[n],t._Dispose(),this.Inlines._Remove(t),n--;this.ChildNodes=null}this.Fields=null;this.FieldCharacter=null},r.prototype._DecodeHtmlNames=function(n){var t,i,r;if(n=="\t")return" ";if(t=n.split(" "),i="",t.length>0)for(i=t[0],r=0;r<t.length-1;r++)i+=" "+t[r+1];return i},r}(hi);t.ParagraphAdv=u;k=function(t){function i(n){t.call(this,n);this.WordSplitCharacters=[" ",",",".",":",";","<",">","=","+","-","_","{","}","[","]","`","~","!","@","#","$","%","^","&","*","(",")",'"',"?","/","|","\\","”"];this.characterFormat=new o(this);this.Elements=new h}return n(i,t),Object.defineProperty(i.prototype,"CharacterFormat",{get:function(){return this.characterFormat},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"OwnerParagraph",{get:function(){return this.Owner instanceof u?this.Owner:null},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Length",{get:function(){return 1},enumerable:!0,configurable:!0}),i.prototype._RelayoutItems=function(n){this._LayoutItems(n);for(var t=this;t.NextNode instanceof i;)t=t.NextNode,t._LayoutItems(n);this.OwnerParagraph._UpdateWidgetToPage(n);n._UpdateClientAreaForBlock(this.OwnerParagraph,!1);this.OwnerParagraph._LayoutNextItems(n)},i.prototype._LayoutFieldCharacter=function(n){var i,t,r;this instanceof l?(t=this,!n.IsFieldCode&&(t.fieldEnd!=null||t.HasFieldEnd)&&(n.FieldStack._Add(t),n.IsFieldCode=!0)):n.FieldStack.Count>0&&(this instanceof yi?(t=n.FieldStack._Last(),i=this,t.fieldSeparator==i&&(t.fieldEnd!=null||t.HasFieldEnd)&&(n.IsFieldCode=!1)):(t=n.FieldStack._Last(),r=this,t.fieldEnd==r&&(n.FieldStack._RemoveAt(n.FieldStack.length-1),n.IsFieldCode=!1,t.HasFieldEnd&&(t.HasFieldEnd=!1))))},i.prototype._LayoutItems=function(n){var f,o,u;if(this instanceof y){this._LayoutFieldCharacter(n);this.NextNode!=null||n.IsFieldCode||(n.LineElements.length==0?this.OwnerParagraph._LayoutEmptyLineWidget(n):this._MoveToNextLine(n));return}if(!n.IsFieldCode&&this.Elements!=null){if(this.Elements.Count>0&&this.Elements._Clear(),this._AddElementBox(n),this instanceof vi){this.Elements!=null&&this.Elements.Count>0&&n.LineElements._Add(this.Elements[0]);this.NextNode!=null||n.IsFieldCode||(n.LineElements.Count==0?this.OwnerParagraph._LayoutEmptyLineWidget(n):this._MoveToNextLine(n));this instanceof g&&n instanceof w&&(f=this,f._LayoutCommentItems(n));return}var t=this.Elements[0],e="",r=0;for(this instanceof s&&(o=this,e=o.Text);r<this.Elements.Count;){if(this.Elements==null)return;t=this.Elements[r];t instanceof it&&t==this.Elements[0]&&(ft._GetTextSize(t,this.CharacterFormat),e=="\t"&&(t.Width=this.OwnerParagraph._GetTabWidth(n)));n.CurrentComment==null&&n.CurrentHeaderFooter==null&&n instanceof w&&n.ClientActiveArea.Height<t.Height&&n.ClientActiveArea.Y!=n.ClientArea.Y&&this.OwnerParagraph._MoveToNextPage(n);u=this.PreviousNode instanceof i?this.PreviousNode:null;u!=null&&u instanceof s&&u.Text=="\v"&&(this._MoveToNextLine(n),t.Width=t.Width);t.Width<n.ClientActiveArea.Width||!n.TextWrap?this._AddElementToline(n,t):t instanceof it?t.Text=="\t"?(this._MoveToNextLine(n),t.Width=this.OwnerParagraph._GetTabWidth(n),this._AddElementToline(n,t)):this._SplitTextForClientArea(n,t,t.Text,t.Width,this.CharacterFormat):this._SplitElementForClientArea(t,n);r=this.Elements._IndexOf(t)+1;r>=this.Elements.Count&&this.NextNode==null&&this._MoveToNextLine(n)}}},i.prototype._GetSubWidth=function(n,t,i,r){for(var e,s,l,o,f=0,h=!0,u="",c=n.LineElements.length-1;c>=0;c--){if(e=n.LineElements[c],e instanceof it)s=e.Text,u=s+u,h&&s.trim()!=""?(/ $/.test(s)?(l=s.replace(/\s\s*$/,""),f+=ft._MeasureTextExcludIngSpaceAtEnd(l,this.CharacterFormat).Width):f+=e.Width,h=!1):h||(f+=e.Width);else if(e instanceof gi)continue;else u="a"+u,h=!1,f+=e.Width;t||(f=Math.round(f))}return u=u.trim(),i=u.length-u.replace(/\s/g,"").length,o=n.ClientArea.Width-r-f,o<=0||i==0&&t?(i=0,o=0):t&&(o=o/i),{subWidth:o,spaceCount:i}},i.prototype._IsParagraphFirstLine=function(n){if(n.ParagraphWidgets.length==1){var t=n.ParagraphWidgets[0];return t.ChildWidgets==null||t.ChildWidgets.length==0}return!1},i.prototype._IsParagraphLastLine=function(n,t){var i=t.Inlines[t.Inlines.length-1];return this==i?i.Elements.Count==0||n.LineElements._Contains(i.Elements[i.Elements.Count-1]):!1},i.prototype._AlignLineElements=function(n,t,i,r,u,f,e,o,s,h){var a,v,y,c,l;return t instanceof it||t instanceof dt?(a=t instanceof it?t:null,v=t instanceof it?a.BaselineOffset:t.BaselineOffset,i+=n.LineElements.MaxBaselineOffset-v,r+=u-(t.Height-v),a!=null&&o==rt.Justify&&s>0&&(y=a.Width,c=a.Text,f||(c=c.replace(/^\s\s*/,""),f=c.length>0),f&&(l=c.length-c.replace(/\s/g,"").length,h&&(l-=c.length-c.replace(/\s\s*$/,"").length),s<l&&(y=ft._MeasureTextExcludIngSpaceAtEnd(c,this.CharacterFormat).Width,l=s),l>0&&(a.Width=y+e*l,s-=l)))):t instanceof gi?(t.Height=n.LineElements.MaxTextElementBaselineOffset,i+=n.LineElements.MaxBaselineOffset-t.Height,r+=u):(f=!0,i+=n.LineElements.MaxBaselineOffset-t.Height,r+=u),{topMargin:i,bottomMargin:r,addSubWidth:f,whiteSpaceCount:s}},i.prototype._MoveToNextLine=function(n){var e=this.Owner,c=e.ParagraphFormat,et=this._IsParagraphFirstLine(e),g=this._IsParagraphLastLine(n,e),o=0,nt=0,p=0,i=0,tt=0,r,b,k,h;et&&(p=e._GetBeforeSpacing(),tt=c.FirstLineIndent);g&&(nt=c.AfterSpacing);r=0;isNaN(n.LineElements.MaxTextElementHeight)?(b=ft._MeasureText("a",e.CharacterFormat),r=b.Height,o=r-b.BaselineOffset):(r=n.LineElements.MaxTextElementHeight,o=r-n.LineElements.MaxTextElementBaselineOffset);n.CurrentComment==null&&n.CurrentHeaderFooter==null&&n instanceof w&&n.ClientActiveArea.Height<p+n.LineElements.MaxBaselineOffset+o&&n.ClientActiveArea.Y!=n.ClientArea.Y&&e._MoveToNextPage(n);i=e._GetLineSpacing(r);c.LineSpacingType==ei.Exactly&&i<o+n.LineElements.MaxBaselineOffset&&(i=o+n.LineElements.MaxBaselineOffset);var l=0,a=0,s=c.TextAlignment;s==rt.Left||!n.TextWrap||s==rt.Justify&&g||(k=this._GetSubWidth(n,s==rt.Justify,a,tt),l=k.subWidth,a=k.spaceCount);var v=this.OwnerParagraph._AddLineWidget(),it=!1,ut=c.LineSpacingType;for(h=0;h<n.LineElements.length;h++){var t=0,u=0,d=0,f=n.LineElements[h],y=this._AlignLineElements(n,f,t,u,o,it,l,s,a,h==n.LineElements.length-1);t=y.topMargin;u=y.bottomMargin;it=y.addSubWidth;a=y.whiteSpaceCount;ut==ei.Multiple?i>r?u+=i-r:t+=i-r:ut==ei.Exactly?t+=i-(t+f.Height+u):i>t+f.Height+u&&(t+=i-(t+f.Height+u));t+=p;u+=nt;h==0&&(v.Height=t+f.Height+u,s==rt.Right?d=l:s==rt.Center&&(d=l/2));f.Margin=new wr(d,t,0,u);f.CurrentLineWidget=v;v.Children._Add(f)}n._CutFromTop(n.ClientActiveArea.Y+v.Height);n.LineElements._Clear()},i.prototype._AddElementToline=function(n,t){var i=this;(n instanceof st||n.CurrentComment!=null)&&!(t instanceof it)&&n.ClientActiveArea.Width<t.Width&&(n instanceof st?n.HorizontalWidth=n.ClientActiveArea.X+t.Width+n.ClientArea.X:n.CurrentComment.LayoutedWidget.ContentWidth=n.ClientActiveArea.X+t.Width);n._CutFromLeft(n.ClientActiveArea.X+t.Width);this.OwnerParagraph.ParagraphFormat.TextAlignment==rt.Justify&&t instanceof it&&this._SplitTextElementWordByWord(t,n);this instanceof pt&&(n.LineElements.SkipClipImage=!i.IsInlineImage);n.LineElements.push(t)},i.prototype._CheckPreviousElement=function(n,t){for(var e,s,c,r,u,l,o=!1,f=0,i=n.LineElements.length-1;i>=0;i--)if(n.LineElements[i]instanceof it){if(e=n.LineElements[i],s=e.Text,f=i,/ $/.test(s)){if(i==n.LineElements.length-1)return this._MoveToNextLine(n),!0;o=!0;break}else if(s.indexOf(" ")>=0){o=!0;c=s.lastIndexOf(" ")+1;r=new it(e.Inline);r.Index=e.Index+c;r.Length=e.Length-c;e.Length-=r.Length;this.Elements._Add(r);ft._GetTextSize(r,t);e.Width-=r.Width;e.Height=r.Height;n.LineElements.splice(i+1,0,r);break}}else if(n.LineElements[i]instanceof gi)continue;else{f=i;o=!0;break}if(o){while(f<n.LineElements.length-1&&n.LineElements[f+1].Inline instanceof vi)f++;if(f++,u=new h,f<n.LineElements.Count){for(l=0,i=f;i<n.LineElements.Count;i++)l+=n.LineElements[i].Width,u._Add(n.LineElements[i]),n.LineElements.splice(i,1),i--;n._UpdateClientWidth(l)}for(this._MoveToNextLine(n),u.length>0&&u[0]instanceof it&&u[0].Text=="\t"&&(u[0].Width=this.OwnerParagraph._GetTabWidth(n)),i=0;i<u.length;i++)this._AddElementToline(n,u[i]);u._Clear()}return o},i.prototype._SplitTextForClientArea=function(n,t,i,r,u){var f=!0,e=-1;if(i.substring(0,1)==" ")e=1;else{var o=r,h=0,s=i.match(/.+?\s+/);h=s!=null&&s.length>0?s[0].length:i.replace(/\s\s*$/,"").indexOf(" ")+1;(e=h)>0&&(o=ft._MeasureTextExcludIngSpaceAtEnd(i.slice(0,e),u).Width);n.ClientActiveArea.Width<o&&(f=this._CheckPreviousElement(n,u),f&&(f=o<=n.ClientActiveArea.Width))}r<=n.ClientActiveArea.Width?this._AddElementToline(n,t):f&&(e>0||i.indexOf(" ")>0)?this._SplitByWord(n,t,i,r,u):this._SplitByCharacter(n,t,i,r,u)},i.prototype._SplitByWord=function(n,t,i,r,u){var e=this._GetSplitIndexByWord(n.ClientActiveArea.Width,i,r,u),f,o;e>0&&e<t.Length&&(f=new it(t.Inline),i=i.substring(e),i[0]==" "&&(o=i.length,i=i.replace(/^\s\s*/,""),e+=o-i.Length),f.Index=t.Index+e,f.Length=t.Length-e,t.Length-=f.Length,this.Elements._Add(f),ft._GetTextSize(f,u),t.Width-=f.Width,t.Height=f.Height,this._AddElementToline(n,t),this._MoveToNextLine(n))},i.prototype._GetSplitIndexByWord=function(n,t,i,r){for(var f=0,e=t.length,u,o;f<e;)if(u=this._GetTextIndexAfterSpace(t,f),(u==0||u==e)&&(u=e-1),o=i,(u<e-1||u==e-1&&t[u-1]==" ")&&f!=u&&(o=ft._MeasureTextExcludIngSpaceAtEnd(t.slice(0,u),r).Width),o<=n)f=u;else{f==0&&t[0]==" "&&(f=this._GetTextIndexAfterSpace(t,0));break}return f},i.prototype._GetTextIndexAfterSpace=function(n,t){var u=n.length,f=0,r=n.substring(t).match(/.+?\s+/),i;if(f=r!=null&&r.length>0?t+r[0].length:n.indexOf(" ",t)+1,i=f,i==0||i==u)return i;while(n[i]==" ")if(i++,i==u)break;return i},i.prototype._SplitByCharacter=function(n,t,i,r,u){var e=this._GetTextSplitIndexByCharacter(n.ClientArea.Width,n.ClientActiveArea.Width,i,r,u),o=0,f;e<t.Length&&(o=ft._MeasureTextExcludIngSpaceAtEnd(i.substring(0,e),u).Width,i=i.substring(e));o>n.ClientActiveArea.Width&&n.LineElements.length>0&&this._MoveToNextLine(n);e<t.Length?(f=new it(t.Inline),f.Index=t.Index+e,f.Length=t.Length-e,t.Length-=f.Length,this.Elements._Add(f),ft._GetTextSize(f,u),t.Width-=f.Width,t.Height=f.Height,this._AddElementToline(n,t),this._MoveToNextLine(n)):this._AddElementToline(n,t)},i.prototype._GetTextSplitIndexByCharacter=function(n,t,i,r,u){for(var e,o=i.length,f=0;f<o;f++)if(e=r,f+1<o&&(e=ft._MeasureTextExcludIngSpaceAtEnd(i.substring(0,f+1),u).Width),e>t)return f==0&&e>n?o>1&&i[1]==" "?this._GetTextIndexAfterSpace(i,1):1:f;return 0},i.prototype._SplitTextElementWordByWord=function(n,t){var r=n.Text,f,o=r.trim().indexOf(" "),e,u,s;if(o<=0&&(e=r.match(/.+?\s+/),e!=null&&e.length>0&&(o=e[0].length)),o>=0){f=this.CharacterFormat;for(var h=f.FontSize,c=f.BaselineAlignment,l=f.Bold,a=f.Italic,i=n.Length-r.replace(/^\s\s*/,"").length;i<n.Length;){if(i=this._GetTextIndexAfterSpace(r,i),i==0||i==n.Length)break;i<n.Length&&(u=new it(n.Inline),s=r.substring(0,i),r=r.substring(i),r.substring(0,1)==" "&&(i+=r.length-r.replace(/^\s\s*/,"").length),u.Index=n.Index,u.Length=i,this.Elements.splice(this.Elements.indexOf(n),0,u),ft._GetTextSize(u,f),t.LineElements.push(u),n.Index+=i,n.Length-=i,n.Width-=u.Width,i=0)}}},i.prototype._SplitElementForClientArea=function(n,t){t.LineElements.length>0&&this._MoveToNextLine(t);t.LineElements.length==0&&this._AddElementToline(t,n)},i.prototype._GetPhysicalPosition=function(n,t){var f,i,r,e,u,o,s,c,h;return this instanceof vi?this._GetCommentCharacterPosition():(f=this._GetElementBox(n,t),i=f.element,n=f.index,i==null||i.CurrentLineWidget==null)?this instanceof y?this._GetFieldCharacterPosition():new p(0,0):(r=0,e=0,r=i.CurrentLineWidget._GetTop(),i instanceof br?(u=this.OwnerParagraph.CharacterFormat,o=this._GetPreviousTextInline(),o!=null?u=o.CharacterFormat:(s=this._GetNextTextInline(),s!=null&&(u=s.CharacterFormat)),c=ft._MeasureText("a",u),h=c.BaselineOffset,i.Margin.Top+i.Height-h>0&&(r+=i.Margin.Top+i.Height-h)):r+=i.Margin.Top>0?i.Margin.Top:0,e=i==null||i.CurrentLineWidget==null?0:i.CurrentLineWidget._GetLeftInternal(i,n),new p(e,r))},i.prototype._GetCommentCharacterPosition=function(){var n=this,t=null,i;return n.NextNode!=null&&(t=n.NextNode._GetNextValidInline()),t==null?(i=n.OwnerParagraph,i._GetEndPosition()):t._GetPhysicalPosition(0,!0)},i.prototype._GetFieldCharacterPosition=function(){var n=this,t,i;return this instanceof l&&n._IsLinkedFieldCharacter()&&(n=n.fieldSeparator==null?n.fieldEnd:n.fieldSeparator),t=null,n.NextNode!=null&&(t=n.NextNode._GetNextValidInline()),t==null?(i=n.OwnerParagraph,i._GetEndPosition()):t._GetPhysicalPosition(0,!0)},i.prototype._GetText=function(n,t,r,u){var f="",e=this,h,o;do{if(e==t)return e instanceof s?(h=e,h.Text==null||h.Text==""||(f=h.Text.length<r?f+h.Text:f+h.Text.substring(0,r))):e instanceof pt&&u&&r==e.Length&&(f=f+i.OBJECT_CHARACTER),f;if(e instanceof s?f=f+e.Text:e instanceof pt&&u?f=f+i.OBJECT_CHARACTER:e instanceof l&&e.fieldEnd!=null&&(e=e.fieldSeparator!=null?e.fieldSeparator:e.fieldEnd),e.NextNode==null)break;e=e.NextNode}while(1);if(n==this.OwnerParagraph)return f;for(o=this.OwnerParagraph._GetNextParagraph();o!=null&&o._IsEmpty();){if(f=f+"\r",o==n)return f;o=o._GetNextParagraph()}return o==null||o._IsEmpty()||(f=f+"\r"+o.Inlines[0]._GetText(n,t,r,u)),f},i.prototype._GetElementBox=function(n,t){var r=null,i,u;if(this.Elements.Count>0&&(r=this.Elements[this.Elements.Count-1]),r instanceof it)for(i=0;i<this.Elements.Count;i++){if(u=this.Elements[i]instanceof it?this.Elements[i].Length:1,u>=n||u+1==n&&i==this.Elements.Count-1){r=this.Elements[i];t&&n==u&&i<this.Elements.Count-1&&r.CurrentLineWidget!=this.Elements[i+1].CurrentLineWidget&&(r=this.Elements[i+1],n=0);break}n-=u}return{index:n,element:r}},i.prototype._GetElementBoxInternal=function(n){var i=null,t,r;if(this.Elements.Count>0&&(i=this.Elements[this.Elements.Count-1]),i instanceof it)for(t=0;t<this.Elements.Count;t++){if(r=this.Elements[t]instanceof it?this.Elements[t].Length:1,r>=n||r+1==n&&t==this.Elements.Count-1){i=this.Elements[t];break}n-=r}return{element:i,index:n}},i.prototype._GetPreviousTextInline=function(){return this.PreviousNode instanceof s?this.PreviousNode:this.PreviousNode!=null?this.PreviousNode._GetPreviousTextInline():null},i.prototype._GetNextTextInline=function(){return this.NextNode instanceof s?this.NextNode:this.NextNode instanceof y&&this.NextNode._IsLinkedFieldCharacter()?this.NextNode instanceof b||this.NextNode instanceof l?this.NextNode:this.NextNode.fieldEnd:this.NextNode!=null?this.NextNode._GetNextTextInline():null},i.prototype._GetLineWidget=function(n){return this._GetLineWidgetInternal(n,!0)},i.prototype._GetLineWidgetInternal=function(n,t){var o=this._GetElementBox(n,t),s=o.element,i,r,u,e,f;return(n=o.index,s!=null)?s.CurrentLineWidget:(i=this,this instanceof l&&i._IsLinkedFieldCharacter()&&(i=i.fieldSeparator==null?i.fieldEnd:i.fieldSeparator),r=null,i.NextNode!=null&&(r=i.NextNode._GetNextValidInline()),r==null?(u=i.OwnerParagraph,e=null,u.ParagraphWidgets.Count>0&&(f=u.ParagraphWidgets[u.ParagraphWidgets.Count-1],f.ChildWidgets.Count>0&&(e=f.ChildWidgets[f.ChildWidgets.Count-1])),e):r._GetLineWidget(0))},i.prototype._GetCaretHeight=function(n,t,i,r,u){var p=this._GetElementBox(n,!1),f,l,e,o,s,v,h,c;if(n=p.index,f=p.element,l=this,f==null)return l instanceof y?l._GetFieldCharacterHeight(t,i,r,u):{Height:ft._MeasureText("a",t).Height,TopMargin:r,IsItalic:u};if(e=0,f instanceof br||f instanceof gi)if(o=this._GetPreviousTextInline(),s=this._GetNextTextInline(),o==null&&s==null){var w=0,b=0,a=this.OwnerParagraph._GetParagraphMarkSize(w,b);w=a.TopMargin;b=a.BottomMargin;e=a.Height;u=this.OwnerParagraph.CharacterFormat.Italic;i||(e+=this.OwnerParagraph.ParagraphFormat.AfterSpacing)}else{if(o==null)return u=s.CharacterFormat.Italic,s._GetCaretHeight(0,s.CharacterFormat,i,r,u);if(s!=null&&f instanceof br){var k=ft._MeasureText("a",f.Inline.CharacterFormat),d=k.Height,g=k.BaselineOffset;e=f.Margin.Top<0&&g>f.Margin.Top+f.Height?f.Margin.Top+f.Height+d-g:d;i||(e+=f.Margin.Bottom)}else return u=o.CharacterFormat.Italic,o._GetCaretHeight(o.Length,o.CharacterFormat,i,r,u)}else v=t.BaselineAlignment,h=f.Height,v!=vt.Normal&&i&&(h=h/1.5,v==vt.Subscript&&(r=f.Height-h)),e=(f.Margin.Top<0?f.Margin.Top:0)+h,i||(e+=f.Margin.Bottom);return i?(c=ft._MeasureText("a",t).Height,c>e&&(c=e),{Height:c,TopMargin:r,IsItalic:u}):{Height:e,TopMargin:r,IsItalic:u}},i.prototype._GetFieldCharacterHeight=function(n,t,i,r){var u=this,f;if(u instanceof l&&u._IsLinkedFieldCharacter()&&(u=u.fieldSeparator==null?u.fieldEnd:u.fieldSeparator),f=null,u.NextNode!=null&&(f=u.NextNode._GetNextValidInline()),f==null){var a=u.OwnerParagraph,o=ft._GetParagraphMarkSize(n).Height,c=0,s=0,h=a._GetParagraphMarkSize(c,s),e=h.Height;return(c=h.TopMargin,s=h.BottomMargin,!t)?(e+=s,{Height:e,TopMargin:i,IsItalic:r}):(o>e&&(o=e),{Height:o,TopMargin:i,IsItalic:r})}return f._GetCaretHeight(0,n,t,i,r)},i.prototype._GetPreviousValidInline=function(){for(var n=this,t=null;n instanceof y;)n._IsLinkedFieldCharacter()&&(n instanceof l?t=n:n instanceof b?(t=n,n.FieldSeparator==null&&(n=n.FieldBegin,t=n)):(n=n.fieldBegin,t=n)),n=n.PreviousNode;return t==null?n:t},i.prototype._ValidateTextPosition=function(n){var t=this,i,r;return t.Length==n&&t.NextNode instanceof y?(i=t.NextNode._GetNextValidInline(),i instanceof b&&(t=i,n=1)):n==0&&t.PreviousNode instanceof y&&(r=t.PreviousNode._GetPreviousValidInline(),t=r,n=t instanceof y?0:t.Length,t instanceof b&&n++),{inline:t,index:n}},i.prototype._GetNextValidInline=function(){for(var n=this,t=null;n instanceof y;){if(n instanceof l&&n.fieldEnd!=null)return t==null?n:t;n instanceof b&&n.FieldBegin!=null&&(t=n);n=n.NextNode}return t==null?n:t},i.prototype._InsertInline=function(n,t){var r,i,u;t==this.Length?(i=this.OwnerParagraph.Inlines._IndexOf(this),i++,this.OwnerParagraph.Inlines._Insert(i,n)):t==0?this.PreviousNode==null?this.OwnerParagraph.Inlines._Insert(0,n):(i=this.OwnerParagraph.Inlines._IndexOf(this),this.OwnerParagraph.Inlines._Insert(i,n)):(r=this,i=r.OwnerParagraph.Inlines.indexOf(this),i++,u=new s(null),u.CharacterFormat._CopyFormat(r.CharacterFormat),u.Text=r.Text.substring(t),r.Text=r.Text.substr(0,t),this.OwnerParagraph.Inlines._Insert(i,u),this.OwnerParagraph.Inlines._Insert(i,n))},i.prototype._IsLastRenderedInline=function(n){for(var t=this,r,i,u;n==t.Length&&t.NextNode instanceof y;)if(r=t.NextNode._GetNextValidInline(),n=0,r instanceof l&&(t=r),t instanceof l&&t.fieldEnd!=null)if(i=t,i.fieldSeparator==null)t=i.fieldEnd,n=1;else if(t=i.fieldSeparator,u=t.OwnerParagraph,n=1,u!=i.fieldEnd.OwnerParagraph||u._HasValidInline(t,i.fieldEnd))break;else t=i.fieldEnd;return n==t.Length&&t.NextNode==null},i.prototype._GetNextRenderedInline=function(n){var t=this,r,i;if(t instanceof l){if(i=t,t=i._GetRenderedField(),i==t)return i;n=1}while(t!=null&&n==t.Length&&t.NextNode instanceof y)if(r=t.NextNode._GetNextValidInline(),r instanceof l){if(i=null,r instanceof l&&(i=r),i!=null&&(t=i._GetRenderedField()),t!=null&&i==t)return i;n=1}else t=r;return t},i.prototype._GetPreviousElementBox=function(){for(var n=this;n!=null&&n.Elements.Count==0;)n instanceof yi&&n._IsLinkedFieldCharacter()&&(n=n.fieldBegin),n=n.PreviousNode;return n==null?null:n.Elements.Count>0?n.Elements[n.Elements.Count-1]:null},i.prototype._IsExistAfter=function(n){return this.OwnerParagraph==n.OwnerParagraph?this.OwnerParagraph.Inlines._IndexOf(this)>this.OwnerParagraph.Inlines._IndexOf(n):this.OwnerParagraph.Owner==n.OwnerParagraph.Owner?this.OwnerParagraph.IsInsideTable?this.OwnerParagraph.AssociatedCell.Blocks._IndexOf(this.OwnerParagraph)>n.OwnerParagraph.AssociatedCell.Blocks._IndexOf(n.OwnerParagraph):this.OwnerParagraph.Owner instanceof d?this.OwnerParagraph.Owner.Blocks._IndexOf(this.OwnerParagraph)>n.OwnerParagraph.Owner.Blocks._IndexOf(n.OwnerParagraph):this.OwnerParagraph.Section.Blocks._IndexOf(this.OwnerParagraph)>n.OwnerParagraph.Section.Blocks._IndexOf(n.OwnerParagraph):this.OwnerParagraph._IsExistAfter(n.OwnerParagraph)},i.prototype._IsExistBefore=function(n){return this.OwnerParagraph==n.OwnerParagraph?this.OwnerParagraph.Inlines._IndexOf(this)<this.OwnerParagraph.Inlines._IndexOf(n):this.OwnerParagraph.Owner==n.OwnerParagraph.Owner?this.OwnerParagraph.IsInsideTable?this.OwnerParagraph.AssociatedCell.Blocks._IndexOf(this.OwnerParagraph)<n.OwnerParagraph.AssociatedCell.Blocks._IndexOf(n.OwnerParagraph):this.OwnerParagraph.Owner instanceof d?this.OwnerParagraph.Owner.Blocks._IndexOf(this.OwnerParagraph)<n.OwnerParagraph.Owner.Blocks._IndexOf(n.OwnerParagraph):this.OwnerParagraph.Section.Blocks._IndexOf(this.OwnerParagraph)<n.OwnerParagraph.Section.Blocks._IndexOf(n.OwnerParagraph):this.OwnerParagraph._IsExistBefore(n.OwnerParagraph)},i.prototype._Find=function(n,t,i,r,u,f){var e=this,y=new String,nt=new ni,p,it,w,rt,b,k,v,g,c,ft;do{if(e instanceof s&&e.Text!=null&&e.Text!=""?(nt._Add(e,y.length),y=e==this?y+e.Text.substring(i):y+e.Text):e instanceof l&&(p=e,p.fieldEnd!=null&&(e=p.fieldSeparator==null?p.fieldEnd:p.fieldSeparator)),e.NextNode==null)break;e=e.NextNode}while(1);for(it=y.toString(),w=[];(rt=n.exec(it))!=null;)w.push(rt);for(b=0;b<w.length;b++){var a=w[b],h=f._AddResult(),ut=nt.Keys;for(k=0;k<ut.Count;k++){var o=ut[k],d=nt._Get(o),tt=o.Length;if(o==this&&(tt-=i),h.Start.Paragraph==null&&a.index<=d+tt&&(v=a.index-d,o==this&&(v+=i),g=o.OwnerParagraph._GetOffset(o,v),h.Start._SetPositionParagraph(o.OwnerParagraph,g)),a.index+a[0].length<=d+tt){v=a.index+a[0].length-d;o==this&&(v+=i);g=o.OwnerParagraph._GetOffset(o,v);h.End._SetPositionParagraph(o.OwnerParagraph,g);break}}if(h.End._UpdateTextPositionOnFieldCharacter(h.Start),r)return f.CurrentIndex=0,!0;f.CurrentIndex<0&&h.Start.Paragraph._GetOwnerComment()==u.Paragraph._GetOwnerComment()&&u!=null&&u._IsExistBefore(h.Start)&&(f.CurrentIndex=f._IndexOf(h))}for(c=e.OwnerParagraph._GetNextParagraph();c!=null&&c.Inlines.Count==0;)c=c._GetNextParagraph();return c!=null&&c.Inlines.Count>0?(ft=c.Inlines[0],ft._Find(n,t,0,r,u,f)):!1},i.prototype._ApplyCharacterFormat=function(n,t,i,r,u,f){t==0&&i==this.Length?this.CharacterFormat._ApplyPropertyValue(n.CurrentBaseHistoryInfo,r,u,f):this instanceof s&&this._FormatInline(n,t,i,r,u,f)},i.prototype._FormatInline=function(n,t,i,r,u,f){var e=this,h=e.OwnerParagraph.Inlines._IndexOf(e),o;t>0&&(o=new s(null),o.CharacterFormat._CopyFormat(e.CharacterFormat),o.Text=e.Text.substr(t,i-t),o.CharacterFormat._ApplyPropertyValue(n.CurrentBaseHistoryInfo,r,u,f),h++,e.OwnerParagraph.Inlines._Insert(h,o));i<e.Length&&(o=new s(null),o.CharacterFormat._CopyFormat(this.CharacterFormat),o.Text=e.Text.substring(i),h++,e.OwnerParagraph.Inlines._Insert(h,o));t==0?(e.Text=e.Text.substr(0,i),this.CharacterFormat._ApplyPropertyValue(n.CurrentBaseHistoryInfo,r,u,f)):e.Text=e.Text.substr(0,t)},i.prototype._ClearElements=function(n){var t,i;if(this.Elements!=null)for(t=0;t<this.Elements.Count;t++)i=this.Elements[t],i._Dispose(),this.Elements._Remove(i),t--;n&&this.Elements._Clear()},i.OBJECT_CHARACTER="",i.WordSplitCharacters=[],i}(sr);t.Inline=k;s=function(t){function i(n){t.call(this,n);this.text=""}return n(i,t),Object.defineProperty(i.prototype,"Text",{get:function(){return this.text},set:function(n){if(this.text=n,this.text!=null&&this.text!=""&&this.OwnerParagraph instanceof u){n=n.replace("\r\n","\r");n=n.replace("\n","\r");var t=n.indexOf("\r");t>-1&&this._SplitByBreakCharacter(t)}this._OnTextChanged()},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Length",{get:function(){return this.text.length},enumerable:!0,configurable:!0}),i.prototype._SerializeInline=function(){var n={Text:[],CharacterFormat:[]};return n.Text=this.Text,n.CharacterFormat=this.CharacterFormat._SerializeCharacterFormat(),n},i.prototype._OnTextChanged=function(){this._ClearElements(!1);this.OwnerParagraph!=null&&this.OwnerParagraph._RelayoutParagraph(this.OwnerParagraph.Inlines._IndexOf(this))},i.prototype._AddElementBox=function(n){var t=this.Text,f,i,u,r;t!=null&&t!=""&&(t=t.toLocaleLowerCase(),f=["\t",'\v'],i=kt._IndexOfAny(t,f),i>-1&&(u=t[i],u=="\t"&&t!="\t"?this._SplitByTab(n,i):u=='\v'&&t!="\v"&&this._SplitByLineBreakCharacter(n,i)));r=new it(this);r.Index=0;r.Length=this.Text!=null?this.Text.length:0;this.Elements._Add(r)},i.prototype._SplitByLineBreakCharacter=function(n,t){var e=n.OwnerControl.IsLayoutEnabled;n.OwnerControl.IsLayoutEnabled=!1;var o=this.OwnerParagraph.Inlines._IndexOf(this),u=this.Text,f=u.substring(t+1),r=new i(null);r.CharacterFormat._CopyFormat(this.CharacterFormat);this.OwnerParagraph.Inlines._Insert(o+1,r);t>0?(r.Text=u.substring(t),this.text=u.substring(0,t)):f!=""&&(r.Text=f,this.text="\v");e&&(n.OwnerControl.IsLayoutEnabled=!0)},i.prototype._SplitByTab=function(n,t){var e=n.OwnerControl.IsLayoutEnabled;n.OwnerControl.IsLayoutEnabled=!1;var o=this.OwnerParagraph.Inlines._IndexOf(this),u=this.Text,f=u.substring(t+1),r=new i(null);r.CharacterFormat._CopyFormat(this.CharacterFormat);this.OwnerParagraph.Inlines._Insert(o+1,r);t>0?(r.Text=u.substring(t),this.text=u.substring(0,t)):f!=""&&(r.Text=f,this.text="\t");e&&(n.OwnerControl.IsLayoutEnabled=!0)},i.prototype._SplitByBreakCharacter=function(n){var t=this.OwnerParagraph,o,a,s,r,e,c;if(t!=null&&t.Owner!=null){o=t.BaseParent;a=!1;o!=null&&o.IsLayoutEnabled&&(a=!0,o.IsLayoutEnabled=!1);var p=t.Inlines._IndexOf(this),h=this.Text,v=h.substring(n+1),f=null;for(f=new u(null),f.CharacterFormat._CopyFormat(t.CharacterFormat),f.ParagraphFormat._CopyFormat(t.ParagraphFormat),s=p+1;s<t.Inlines.Count;s++)r=t.Inlines[s],t.Inlines._Remove(r),f.Inlines._Add(r),r._SetOwnerBase(f),r instanceof l?(t.Fields._Remove(r),f.Fields._Add(r)):r instanceof y?(t.FieldCharacter._Remove(r),f.FieldCharacter._Add(r)):r instanceof g&&(t.Comments._Remove(r),f.Comments._Add(r)),s--;n>0?this.text=h.substring(0,n):v!=""&&(this.text="");n<h.length-1&&(e=null,e=new i(null),e.CharacterFormat._CopyFormat(this.CharacterFormat),n>0?e.Text=h.substring(n+1):v!=""&&(e.Text=v),f.Inlines._Insert(0,e));c=null;c=t.Owner instanceof ct?t.Owner.Blocks:t.Owner instanceof ot?t.Owner.Blocks:t.Owner instanceof g?t.Owner.Blocks:t.Owner instanceof d?t.Owner.Blocks:null;c!=null&&c._Insert(t._GetIndexInOwnerCollection()+1,f);a&&(o.IsLayoutEnabled=!0)}},i.prototype._GetNextWordOffset=function(n,t,r,u,f,e){var h,o,s,c;if(this.Text=="\t"){if(r){f._SetPositionParagraph(this.OwnerParagraph,this.OwnerParagraph._GetOffset(this,n));u=!1;return}n==0?(u=!0,h=this.OwnerParagraph._GetOffset(this,0),f.Offset==h?f._SetPositionParagraph(this.OwnerParagraph,h+this.Length):f._SetPositionParagraph(this.OwnerParagraph,h)):this.NextNode!=null&&this.NextNode instanceof i&&this.NextNode._GetNextWordOffset(0,t,r,u,f,e)}else if(o=0,n==0&&u&&this.WordSplitCharacters.indexOf(this.Text[0])==-1){if(f._SetPositionParagraph(this.OwnerParagraph,this.OwnerParagraph._GetOffset(this,n)),r)return}else if(n<this.Length)if(s=n>0&&this.Text.length-1>=n?this.Text.slice(n,this.Length):this.Text,o=kt._IndexOfAny(s,this.WordSplitCharacters),o!=-1){if(r){u=!1;return}if(c=this.OwnerParagraph._GetOffset(this,o+n),(e||s[o]!=" ")&&!u&&this.OwnerParagraph==f.Paragraph&&c!=f.Offset){u=!0;f._SetPositionParagraph(this.OwnerParagraph,c);return}for(o++;o<s.length&&this.WordSplitCharacters.indexOf(s[o])!=-1;){if(s[o]!=" "&&s[o-1]==" ")break;o++}if(u=!0,o<s.length)f._SetPositionParagraph(this.OwnerParagraph,this.OwnerParagraph._GetOffset(this,o+n));else if(this.NextNode!=null&&this.NextNode instanceof k)this.NextNode._GetNextWordOffset(0,t,r,u,f,e);else{if(r){u=!1;return}f._SetPositionParagraph(this.OwnerParagraph,this.OwnerParagraph._GetOffset(this,o+n))}}else if(this.NextNode!=null&&this.NextNode instanceof k)this.NextNode._GetNextWordOffset(0,t,r,u,f,e);else{if(r){u=!1;return}f._SetPositionParagraph(this.OwnerParagraph,this.OwnerParagraph._GetEndOffset())}else this.NextNode!=null&&this.NextNode instanceof k&&this.NextNode._GetNextWordOffset(0,t,r,u,f,e)},i.prototype._GetPreviousWordOffset=function(n,t,i,r,u,f){var s,e,o,h;if(this.Text=="\t"){if(i){u=!1;return}n==0?(u=!0,s=this.OwnerParagraph._GetOffset(this,this.Length),s==f.Offset?f._SetPositionParagraph(this.OwnerParagraph,s-this.Length):f._SetPositionParagraph(this.OwnerParagraph,s)):this.PreviousNode!=null&&this.PreviousNode instanceof k&&this.PreviousNode._GetPreviousWordOffset(this.PreviousNode.Length,t,i,r,u,f)}else{if(e=0,!r){while(n>0&&this.Text[n-1]==" ")n--;f._SetPositionParagraph(this.OwnerParagraph,this.OwnerParagraph._GetOffset(this,n))}if(n>0){if(r=!0,n==0&&u&&this.WordSplitCharacters.indexOf(this.Text[0])==-1){f._SetPositionParagraph(this.OwnerParagraph,this.OwnerParagraph._GetOffset(this,n));u=!0;return}if(o=this.Text.length>n?this.Text.slice(0,n):this.Text,e=kt._LastIndexOfAny(o,this.WordSplitCharacters),e!=-1){if(i){u=!1;return}while(e>0&&u&&o[e]!=" "&&this.WordSplitCharacters.indexOf(o[e-1])!=-1)e--;o[e]!=" "&&u||e++;u=!0;e>0?(h=this.OwnerParagraph._GetOffset(this,e),this.OwnerParagraph==f.Paragraph&&h==f.Offset?this._GetPreviousWordOffset(n,t,i,r,u,f):f._SetPositionParagraph(this.OwnerParagraph,h)):this.PreviousNode!=null&&this.PreviousNode instanceof k?this.PreviousNode._GetPreviousWordOffset(this.PreviousNode.Length,t,i,r,u,f):f._SetPositionParagraph(this.OwnerParagraph,this.OwnerParagraph._GetOffset(this,0))}else this.PreviousNode!=null&&this.PreviousNode instanceof k?this.PreviousNode._GetPreviousWordOffset(this.PreviousNode.Length,t,i,r,u,f):f._SetPositionParagraph(this.OwnerParagraph,this.OwnerParagraph._GetStartOffset())}else this.PreviousNode!=null&&this.PreviousNode instanceof k?this.PreviousNode._GetPreviousWordOffset(this.PreviousNode.Length,t,i,r,u,f):f._SetPositionParagraph(this.OwnerParagraph,this.OwnerParagraph._GetStartOffset())}},i.prototype._InsertText=function(n,t,r){var u,e,f;r>=0?this.Text=kt._Insert(this.Text,r,t):(u=null,e=this._GetPreviousTextInline(),u instanceof k&&(u=e),u==null?this.Text=kt._Insert(this.Text,r,t):(r=this.OwnerParagraph.Inlines._IndexOf(this),f=new i(this),f.CharacterFormat._CopyFormat(u.CharacterFormat),f.Text=t,this.OwnerParagraph.Inlines._Insert(r,f)))},i.prototype._Clone=function(){var n=new i(null);return n.CharacterFormat._CopyFormat(this.CharacterFormat),n.Text=this.Text,n},i.prototype._Dispose=function(){this.CharacterFormat._Dispose();this.text="";this._SetOwner(null)},i}(k);t.SpanAdv=s;pt=function(t){function i(n,i,r){t.call(this,n);this.imageString="";this.width=0;this.height=0;this.isInlineImage=!0;this.isMetaFile=!1;this.isInlineImage=i;this.isMetaFile=r}return n(i,t),Object.defineProperty(i.prototype,"ImageString",{get:function(){return this.imageString},set:function(n){this.imageString=n},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Width",{get:function(){return this.width},set:function(n){this.width=n},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Height",{get:function(){return this.height},set:function(n){this.height=n},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"IsInlineImage",{get:function(){return this.isInlineImage},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"IsMetaFile",{get:function(){return this.isMetaFile},enumerable:!0,configurable:!0}),i.prototype._SerializeInline=function(){var n={IsInlineImage:[],IsMetaFile:[],Length:[],Width:[],ImageString:[],Height:[],CharacterFormat:[]};return n.CharacterFormat=this.CharacterFormat._SerializeCharacterFormat(),n.IsInlineImage=this.IsInlineImage,n.IsMetaFile=this.IsMetaFile,n.Length=this.Length,n.Width=this.Width,n.Height=this.Height,n.ImageString=this.ImageString,n},i.prototype._AddElementBox=function(){var n=new br(this);n.Height=this.Height;n.Width=this.Width;this.Elements._Add(n)},i.prototype._GetNextWordOffset=function(n,t,i,r,u,f){if(i){u._SetPositionParagraph(this.OwnerParagraph,this.OwnerParagraph._GetOffset(this,n));r=!1;return}if(n==0){var e=this.OwnerParagraph._GetOffset(this,0);r=!0;u.Offset==e?this.NextNode==null?u._SetPositionParagraph(this.OwnerParagraph,e+this.Length):this.NextNode._GetNextWordOffset(0,t,i,r,u,f):u._SetPositionParagraph(this.OwnerParagraph,e)}else this.NextNode!=null&&this.NextNode instanceof k&&this.NextNode._GetNextWordOffset(0,t,i,r,u,f)},i.prototype._GetPreviousWordOffset=function(n,t,i,r,u,f){if(i){f._SetPositionParagraph(this.OwnerParagraph,this.OwnerParagraph._GetOffset(this,n));u=!1;return}if(n==this.Length){var e=this.OwnerParagraph._GetOffset(this,this.Length);e==f.Offset?f._SetPositionParagraph(this.OwnerParagraph,e-this.Length):f._SetPositionParagraph(this.OwnerParagraph,e)}else this.PreviousNode!=null&&this.PreviousNode instanceof k&&this.PreviousNode._GetPreviousWordOffset(this.PreviousNode.Length,t,i,r,u,f)},i.prototype._InsertText=function(n,t,i){var u=this._GetPreviousTextInline(),e=this._GetNextTextInline(),r=new s(this),f;r.Text=t;f=this.OwnerParagraph.Inlines._IndexOf(this);i==this.Length&&f++;u==null&&e==null?r.CharacterFormat._CopyFormat(this.OwnerParagraph.CharacterFormat):u==null?r.CharacterFormat._CopyFormat(e.CharacterFormat):r.CharacterFormat._CopyFormat(u.CharacterFormat);this.OwnerParagraph.Inlines._Insert(f,r)},i.prototype._Clone=function(){var n=new i(null,this.IsInlineImage,this.IsMetaFile);return n.CharacterFormat._CopyFormat(this.CharacterFormat),n.ImageString=this.ImageString,n.Width=this.Width,n.Height=this.Height,n},i.prototype._Dispose=function(){this.CharacterFormat._Dispose();this.imageString="";this._SetOwner(null);this._ClearElements(!0)},i}(k);t.ImageAdv=pt;sf=function(){function n(n){this.Width=0;this.Height=0;this.Width=n.Width;this.Height=n.Height}return n}();t.ImageFormat=sf;y=function(t){function i(){t.apply(this,arguments)}return n(i,t),i.prototype._AddElementBox=function(){},i.prototype._GetRenderedInline=function(n){for(var r=this._GetPreviousValidInline(),t;r instanceof i;)r=r._GetPreviousTextInline(),r instanceof i&&(r=r.PreviousNode);if(r!=null)return n=r.Length,{Inline:r,InlineIndex:n};if(n=0,t=this._GetNextRenderedInline(0),t instanceof l)for(t=t.fieldSeparator,t=t.NextNode;t instanceof i;)t instanceof l&&t._IsLinkedFieldCharacter()&&(t=t.fieldSeparator==null?t.fieldEnd:t.fieldSeparator),t=t.NextNode;return{Inline:r,InlineIndex:n}},i.prototype._Dispose=function(){this.CharacterFormat._Dispose();this._SetOwner(null);this._ClearElements(!0)},i.prototype._GetLayoutViewer=function(){if(this.OwnerParagraph!=null){var n=this.OwnerParagraph.BaseParent;if(n!=null&&this.OwnerParagraph.ParagraphWidgets.Count>0)return n.Viewer}return null},i}(k);t.FieldCharacterAdv=y;l=function(t){function i(n){t.call(this,n);this.FieldSeparator=null;this.FieldEnd=null}return n(i,t),Object.defineProperty(i.prototype,"fieldSeparator",{get:function(){return this.FieldSeparator},set:function(n){if(this.FieldSeparator!=n){var t=this.fieldSeparator;this.FieldSeparator=n;t!=null&&(t.fieldBegin=null,t=null);this.fieldSeparator!=null&&(this.fieldSeparator.fieldBegin=this)}},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"fieldEnd",{get:function(){return this.FieldEnd},set:function(n){if(this.FieldEnd!=n){var t=this.fieldEnd;this.FieldEnd=n;t!=null&&(t.fieldBegin=null,t=null);this.fieldEnd!=null&&(this.fieldEnd.fieldBegin=this)}},enumerable:!0,configurable:!0}),i.prototype._SerializeInline=function(){var n={CharacterFormat:[],HasFieldEnd:[],FieldBegin:[]};return n.CharacterFormat=this.CharacterFormat._SerializeCharacterFormat(),n.HasFieldEnd=this.HasFieldEnd,n.FieldBegin=!0,n},i.prototype._IsLinkedFieldCharacter=function(){return this.fieldEnd!=null},i.prototype._CheckUnlinkFieldCharacter=function(n,t){if(this.fieldSeparator!=null){if(t){var i=this.fieldSeparator.OwnerParagraph._GetHierarchicalIndex("");if(i.indexOf(n)>=0)return}this.fieldSeparator.fieldBegin=null;this.fieldSeparator=null}},i.prototype._AddToLinkedFields=function(){var t=this,u,n,i,r,f,e;t._RemoveAfterLinking(t);t.FieldSeparator!=null&&t._RemoveAfterLinking(t.FieldSeparator);t._RemoveAfterLinking(t.FieldEnd);this.Owner._AddFields(this);this.OwnerParagraph==null||this.HasFieldEnd||(u=this.OwnerParagraph.BaseParent,u!=null&&(n=u.Viewer,n!=null&&this.OwnerParagraph.ParagraphWidgets.Count>0&&(n.FieldToLayout!=null&&n.FieldToLayout.OwnerParagraph!=null?(i=n.FieldToLayout._GetIndexInOwnerCollection().toString(),i=n.FieldToLayout.OwnerParagraph._GetHierarchicalIndex(i),r=this._GetIndexInOwnerCollection().toString(),r=this.OwnerParagraph._GetHierarchicalIndex(r),tt._IsForwardSelection(r,i)&&(n.FieldToLayout=this)):n.FieldToLayout=this,n.FieldEndParagraph!=null?(f=n.FieldEndParagraph._GetHierarchicalIndex(""),e=this.fieldEnd.OwnerParagraph._GetHierarchicalIndex(""),tt._IsForwardSelection(f,e)&&(n.FieldEndParagraph=this.fieldEnd.OwnerParagraph)):n.FieldEndParagraph=this.fieldEnd.OwnerParagraph)))},i.prototype._IsUnlinkFieldCharacters=function(){if(this.fieldEnd==null)return!1;var n=this.fieldEnd.OwnerParagraph._GetHierarchicalIndex("");return!(n.indexOf(n)>=0)},i.prototype._UnlinkFieldCharacter=function(n,t){var i=this._GetLayoutViewer(),r,u;this.fieldSeparator!=null&&(r=!0,t&&(u=this.fieldSeparator.OwnerParagraph._GetHierarchicalIndex(""),u.indexOf(n)>=0&&(r=!1)),r?(this.fieldSeparator.Owner._AddFieldCharacter(this.fieldSeparator),this.fieldSeparator.fieldBegin=null,this.fieldSeparator=null):this.fieldSeparator.Owner._AddFieldCharacter(this.fieldSeparator));this.fieldEnd!=null&&(i!=null&&(i.FieldToLayout=this,i.FieldEndParagraph=this.fieldEnd.OwnerParagraph),this.fieldEnd.Owner._AddFieldCharacter(this.fieldEnd),this.fieldEnd.fieldBegin=null,this.fieldEnd=null);this.Owner.Fields._Contains(this)&&this.Owner.Fields._Remove(this);t&&this.Owner._AddFieldCharacter(this)},i.prototype._RemoveAfterLinking=function(n){var t=this.Owner instanceof yt?this.Owner:null;t!=null&&t._RemoveFieldCharacter(n)},i.prototype._GetRenderedField=function(){var n=this,t;if(this.FieldSeparator==null)n=this.FieldEnd;else{if(n=this.FieldSeparator,t=n.OwnerParagraph,t!=this.FieldEnd.OwnerParagraph||t._HasValidInline(n,this.FieldEnd))return this;n=this.FieldEnd}return n},i.prototype._GetFieldCode=function(){if(this.fieldEnd==null||this.OwnerParagraph==null)return"";return this.OwnerParagraph._GetFieldCode(this,!1,!1,this)},i.prototype._InlineIsInFieldResult=function(n){return this.fieldEnd!=null&&this.fieldSeparator!=null&&this.fieldSeparator._IsExistBefore(n)?this.fieldEnd._IsExistAfter(n):!1},i.prototype._ParagraphIsInFieldResult=function(n){return this.fieldEnd!=null&&this.fieldSeparator!=null&&(this.fieldSeparator.Owner==n||this.fieldSeparator.OwnerParagraph._IsExistBefore(n))?this.fieldEnd.Owner!=n&&this.fieldEnd.OwnerParagraph._IsExistAfter(n):!1},i.prototype._GetNextWordOffset=function(n,t,i,r,u,f){var o=this.OwnerParagraph._GetOffset(this,0),s=o+this.Length,e;if(this.FieldSeparator==null)this.fieldEnd._GetNextWordOffset(0,t,i,r,u,f);else if(this.fieldEnd!=null&&t!=0){if(e=this.FieldSeparator,e.OwnerParagraph!=this.FieldEnd.OwnerParagraph||e.OwnerParagraph._HasValidInline(e,this.FieldEnd)||(e=this.FieldEnd),e._GetNextWordOffset(0,t,!(u.Paragraph==this.OwnerParagraph&&u.Offset==o),r,u,f),r&&this.fieldSeparator!=null&&u.Paragraph==this.OwnerParagraph&&u.Offset==this.fieldSeparator.OwnerParagraph._GetOffset(this.fieldSeparator,this.fieldSeparator.Length)){u._SetPositionParagraph(this.OwnerParagraph,o);return}r||u._SetPositionParagraph(this.fieldEnd.OwnerParagraph,this.fieldEnd.OwnerParagraph._GetOffset(this.fieldEnd,this.fieldEnd.Length))}},i.prototype._GetPreviousWordOffset=function(n,t,i,r,u,f){var e=this.OwnerParagraph._GetOffset(this,0),o=e+this.Length;f.Offset==o&&f._SetPositionParagraph(this.OwnerParagraph,e);this.PreviousNode!=null&&this.PreviousNode instanceof k?(this.PreviousNode._GetPreviousWordOffset(this.PreviousNode.Length,t,!1,r,u,f),f.Offset==e&&t!=0&&this.fieldSeparator!=null&&f._SetPositionParagraph(this.OwnerParagraph,o)):f._SetPositionParagraph(this.OwnerParagraph,this.OwnerParagraph._GetStartOffset())},i.prototype._InsertText=function(n,t){var i=new s(this),r;i.Text=t;r=this.OwnerParagraph.Inlines._IndexOf(this);i.CharacterFormat._CopyFormat(this.CharacterFormat);this.OwnerParagraph.Inlines._Insert(r,i)},i.prototype._Clone=function(){var n=new i(this);return n.CharacterFormat._CopyFormat(this.CharacterFormat),n},i}(y);t.FieldBeginAdv=l;yi=function(t){function i(n){t.call(this,n);this.FieldBegin=null;this.FieldEnd=null}return n(i,t),Object.defineProperty(i.prototype,"fieldBegin",{get:function(){return this.FieldBegin},set:function(n){if(this.FieldBegin!=n){var t=this.FieldBegin;this.FieldBegin=n;t!=null&&(t.fieldSeparator=null,t=null);this.fieldBegin!=null&&(this.fieldBegin.fieldSeparator=this)}},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"fieldEnd",{get:function(){return this.FieldEnd},set:function(n){if(this.FieldEnd!=n){var t=this.FieldEnd;this.FieldEnd=n;t!=null&&(t.fieldSeparator=null,t=null);this.fieldEnd!=null&&(this.fieldEnd.fieldSeparator=this)}},enumerable:!0,configurable:!0}),i.prototype._SerializeInline=function(){var n={CharacterFormat:[],FieldSeparator:[]};return n.CharacterFormat=this.CharacterFormat._SerializeCharacterFormat(),n.FieldSeparator=!0,n},i.prototype._IsLinkedFieldCharacter=function(){return this.fieldBegin!=null&&this.fieldEnd!=null},i.prototype._GetNextWordOffset=function(n,t,i,r,u,f){this.NextNode!=null&&this.NextNode instanceof k&&this.NextNode._GetNextWordOffset(0,t,i,r,u,f)},i.prototype._GetPreviousWordOffset=function(n,t,i,r,u,f){this.FieldBegin._GetPreviousWordOffset(this.FieldBegin.Length,t,i,r,u,f)},i.prototype._UnlinkFieldCharacter=function(n,t){var u,i,r;this.fieldBegin!=null&&this.fieldBegin.Owner instanceof yt&&(i=!0,t&&(r=this.fieldBegin.OwnerParagraph._GetHierarchicalIndex(""),r.indexOf(n)>=0&&(i=!1)),this.fieldEnd!=null&&(u=this._GetLayoutViewer(),u!=null&&(u.FieldToLayout=this.fieldBegin,u.FieldEndParagraph=this.fieldEnd.OwnerParagraph)),i?(this.fieldBegin.Owner._AddFieldCharacter(this.fieldBegin),this.fieldBegin.fieldSeparator=null,this.fieldBegin=null):this.fieldBegin.Owner._AddFieldCharacter(this.fieldBegin));this.fieldEnd!=null&&this.fieldEnd.Owner instanceof yt&&(i=!0,t&&(r=this.fieldEnd.OwnerParagraph._GetHierarchicalIndex(""),r.indexOf(n)>0&&(i=!1)),i?(this.fieldEnd.Owner._AddFieldCharacter(this.fieldEnd),this.fieldEnd.fieldSeparator=null,this.fieldEnd=null):this.fieldEnd.Owner._AddFieldCharacter(this.fieldEnd));t&&this.Owner._AddFieldCharacter(this)},i.prototype._CheckUnlinkFieldCharacter=function(n,t){var i;if(this.fieldBegin!=null){if(t&&(i=this.fieldBegin.OwnerParagraph._GetHierarchicalIndex(""),i.indexOf(n)>=0))return;this.fieldBegin.fieldSeparator=null;this.fieldBegin=null}if(this.fieldEnd!=null){if(t&&(i=this.fieldEnd.OwnerParagraph._GetHierarchicalIndex(""),i.indexOf(n)>=0))return;this.fieldEnd.fieldSeparator=null;this.fieldEnd=null}},i.prototype._InsertText=function(n,t,i){var u=this._GetPreviousTextInline(),e=this._GetNextTextInline(),r=new s(this),f;r.Text=t;f=this.OwnerParagraph.Inlines._IndexOf(this);i==this.Length&&f++;u==null&&e==null?r.CharacterFormat._CopyFormat(this.OwnerParagraph.CharacterFormat):u==null?r.CharacterFormat._CopyFormat(e.CharacterFormat):r.CharacterFormat._CopyFormat(u.CharacterFormat);this.OwnerParagraph.Inlines._Insert(f,r)},i.prototype._Clone=function(){var n=new i(this);return n.CharacterFormat._CopyFormat(this.CharacterFormat),n},i}(y);t.FieldSeparatorAdv=yi;b=function(t){function i(n){t.call(this,n);this.FieldBegin=null;this.FieldSeparator=null}return n(i,t),Object.defineProperty(i.prototype,"fieldBegin",{get:function(){return this.FieldBegin},set:function(n){if(this.FieldBegin!=n){var t=this.FieldBegin;this.FieldBegin=n;t!=null&&(t.fieldEnd=null,t=null);this.fieldBegin!=null&&(this.fieldBegin.fieldEnd=this)}},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"fieldSeparator",{get:function(){return this.FieldSeparator},set:function(n){if(this.FieldSeparator!=n){var t=this.FieldSeparator;this.FieldSeparator=n;t!=null&&(t.fieldEnd=null,t=null);this.fieldSeparator!=null&&(this.fieldSeparator.fieldEnd=this)}},enumerable:!0,configurable:!0}),i.prototype._SerializeInline=function(){var n={CharacterFormat:[],FieldEnd:[]};return n.CharacterFormat=this.CharacterFormat._SerializeCharacterFormat(),n.FieldEnd=!0,n},i.prototype._IsLinkedFieldCharacter=function(){return this.fieldBegin!=null},i.prototype._CheckUnlinkFieldCharacter=function(n,t){if(this.fieldSeparator!=null){if(t){var i=this.fieldSeparator.OwnerParagraph._GetHierarchicalIndex("");if(i.indexOf(n)>=0)return}this.fieldSeparator.fieldEnd=null;this.fieldSeparator=null}},i.prototype._UnlinkFieldCharacter=function(n,t){var i,r,u;this.fieldBegin!=null&&(i=this._GetLayoutViewer(),i!=null&&(i.FieldToLayout=this.fieldBegin,i.FieldEndParagraph=this.OwnerParagraph),this.fieldBegin.Owner.Fields._Contains(this.fieldBegin)&&this.fieldBegin.Owner.Fields._Remove(this.fieldBegin),this.fieldBegin.Owner._AddFieldCharacter(this.fieldBegin),this.fieldBegin.fieldEnd=null,this.fieldBegin=null);this.fieldSeparator!=null&&(r=!0,t&&(u=this.fieldSeparator.OwnerParagraph._GetHierarchicalIndex(""),u.indexOf(n)>0&&(r=!1)),r?(this.fieldSeparator.Owner._AddFieldCharacter(this.fieldSeparator),this.fieldSeparator.fieldEnd=null,this.fieldSeparator=null):this.fieldSeparator.Owner._AddFieldCharacter(this.fieldSeparator));t&&this.Owner._AddFieldCharacter(this)},i.prototype._GetNextWordOffset=function(n,t,i,r,u,f){var e=this.OwnerParagraph._GetOffset(this,0),o=e+this.Length;(u.Offset!=e||(u._SetPositionParagraph(this.OwnerParagraph,o),this.NextNode!=null))&&(this.NextNode!=null&&this.NextNode instanceof k?(this.NextNode._GetNextWordOffset(0,t,!1,r,u,f),u.Offset==o&&u._SetPositionParagraph(this.OwnerParagraph,e)):u._SetPositionParagraph(this.OwnerParagraph,e),r=!0)},i.prototype._GetPreviousWordOffset=function(n,t,i,r,u,f){var o=this.OwnerParagraph._GetOffset(this,0),s=o+this.Length,e;if(this.FieldSeparator==null)this.fieldBegin._GetPreviousWordOffset(0,t,i,r,u,f);else if(this.fieldBegin!=null&&t!=0){if(e=this.PreviousNode,e!=null&&(e.OwnerParagraph!=this.fieldBegin.OwnerParagraph||e.OwnerParagraph._HasValidInline(e,this.fieldBegin))||(e=this.fieldBegin),e._GetPreviousWordOffset(e.Length,t,!(f.Paragraph==this.OwnerParagraph&&f.Offset==s),r,u,f),u&&f.Paragraph==this.OwnerParagraph&&f.Offset==o){f._SetPositionParagraph(this.OwnerParagraph,s);return}u||f._SetPositionParagraph(this.fieldBegin.OwnerParagraph,this.fieldBegin.OwnerParagraph._GetOffset(this.fieldBegin,0))}},i.prototype._InsertText=function(n,t){var i=new s(this),r;i.Text=t;r=this.OwnerParagraph.Inlines._IndexOf(this);i.CharacterFormat._CopyFormat(this.CharacterFormat);this.OwnerParagraph.Inlines._Insert(r+1,i)},i.prototype._Clone=function(){var n=new i(this);return n.CharacterFormat._CopyFormat(this.CharacterFormat),n},i}(y);t.FieldEndAdv=b;ce=function(){function n(n){this.hyperLink=n}return Object.defineProperty(n.prototype,"Hyperlink",{get:function(){return this.hyperLink},enumerable:!0,configurable:!0}),n}();t.RequestNavigateEventArgs=ce;nf=function(){function n(n){var t=n._GetFieldCode(),i=t.toLowerCase();t=t.substring(i.indexOf("hyperlink")+9);this._ParseFieldValues(t.trim())}return Object.defineProperty(n.prototype,"NavigationLink",{get:function(){return this.navigationLink},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"LinkType",{get:function(){return this.linkType},enumerable:!0,configurable:!0}),n.prototype._ParseFieldValue=function(n,t,i){n.string=n.string.substring(1);var r=n.string.indexOf(i);r==-1?r=n.string.length:this.navigationLink==null&&(this.navigationLink=n.string.substring(0,r));n.string=n.string.substring(r+1).trim()},n.prototype._ParseFieldValues=function(n){for(var t={string:n},i=0,r;t.string.length>0;){r=t.string.substring(0,1);switch(r){case'"':this._ParseFieldValue(t,i,'"');i=0;break;case"\\l":case"\\t":n=n.substring(2);default:this._ParseFieldValue(t,i," ");i=0}t.string=t.string.trim()}this.navigationLink=this.navigationLink.trim();this.navigationLink.match("http://")||this.navigationLink.match("https://")?this.linkType=su.Webpage:this.navigationLink.match("mailto:")?this.linkType=su.Email:this.navigationLink.match("www.")?(this.navigationLink="http://"+this.navigationLink,this.linkType=su.Webpage):this.navigationLink.match("@")?(this.navigationLink="mailto:"+this.navigationLink,this.linkType=su.Email):this.linkType=su.File},n}();t.HyperLink=nf;nt=function(){function n(n,t,i,r){this.X=this._left=n;this.Y=this._top=t;this._right=n+i;this._bottom=t+r;this.Width=i;this.Height=r}return Object.defineProperty(n.prototype,"Left",{get:function(){return this.X},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"Right",{get:function(){return this._right},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"Top",{get:function(){return this.Y},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"Bottom",{get:function(){return this._bottom},enumerable:!0,configurable:!0}),n}();t.Rect=nt;lr=function(){function n(n,t,i,r){this.X1=0;this.Y1=0;this.X2=0;this.Y2=0;this.X1=n;this.Y1=t;this.X2=i;this.Y2=r}return n}();t.Line=lr;wr=function(){function n(n,t,i,r){this.left=n;this.top=t;this.right=i;this.bottom=r}return Object.defineProperty(n.prototype,"Left",{get:function(){return this.left},set:function(n){this.left=n},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"Top",{get:function(){return this.top},set:function(n){this.top=n},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"Right",{get:function(){return this.right},set:function(n){this.right=n},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"Bottom",{get:function(){return this.bottom},set:function(n){this.bottom=n},enumerable:!0,configurable:!0}),n}();t.Margin=wr;p=function(){function n(n,t){this.x=0;this.y=0;this.x=n;this.y=t}return Object.defineProperty(n.prototype,"X",{get:function(){return this.x},set:function(n){this.x=n},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"Y",{get:function(){return this.y},set:function(n){this.y=n},enumerable:!0,configurable:!0}),n}();t.Point=p;tt=function(){function n(n){this.currentParagraph=null;this.offset=0;this.location=new p(0,0);this.isUpdateLocation=!0;this.ownerControl=n}return Object.defineProperty(n.prototype,"OwnerControl",{get:function(){return this.ownerControl},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"Document",{get:function(){return this.OwnerControl.Document},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"Paragraph",{get:function(){return this.currentParagraph},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"Offset",{get:function(){return this.offset},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"Location",{get:function(){return this.location},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"IsAtParagraphStart",{get:function(){return this.offset==this.Paragraph._GetStartOffset()},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"IsUpdateLocation",{get:function(){return this.isUpdateLocation},set:function(n){this.isUpdateLocation=n},enumerable:!0,configurable:!0}),n.prototype._SetPosition=function(n,t){this.currentParagraph=n;this.offset=t?n._GetStartOffset():n._GetLength()+1;this._UpdatePhysicalPosition()},n.prototype._SetPositionInternal=function(n){this.currentParagraph=n.currentParagraph;this.offset=n.offset;this.location=n.location},n.prototype._SetPositionForCurrentIndex=function(n){var t={Index:n},i=this.OwnerControl.Document._GetParagraph(t);this.offset=parseFloat(t.Index);this._SetPositionParagraph(i,this.offset)},n.prototype._SetPositionParagraph=function(n,t){this.currentParagraph=n;this.offset=t;this._UpdatePhysicalPosition()},n.prototype._SetPositionPhysicalLocation=function(n,t,i,r){var u=!1;t==null?this.currentParagraph=n:(this.currentParagraph=t.OwnerParagraph,t.NextNode instanceof y&&i>t.Length&&(u=t._IsLastRenderedInline(t.Length)));this.location=r;this.offset=u?this.currentParagraph._GetLength()+1:this.currentParagraph._GetOffset(t,i)},n.prototype._UpdatePhysicalPosition=function(){this.currentParagraph.ParagraphWidgets.Count>0&&this.ownerControl.IsLayoutEnabled&&this.IsUpdateLocation&&(this.location=this.currentParagraph._GetPhysicalPosition(this.offset))},n.prototype._UpdatePhysicalPositionInternal=function(n){this.currentParagraph.ParagraphWidgets.Count>0&&this.ownerControl.IsLayoutEnabled&&this.IsUpdateLocation&&(this.location=this.currentParagraph._GetPhysicalPositionInternal(this.offset,n))},n.prototype._SetPositionForSelection=function(n,t,i,r){var u=!1;t==null?this.currentParagraph=n:(this.currentParagraph=t.OwnerParagraph,t.NextNode instanceof y&&i>t.Length&&(u=t._IsLastRenderedInline(t.Length)));this.location=r;this.offset=u?this.currentParagraph._GetLength()+1:this.currentParagraph._GetOffset(t,i)},n.prototype._ValidateBackwardFieldSelection=function(t,i){var u=new n(this.OwnerControl),e,f,s,h,a,v;for(u._SetPositionForCurrentIndex(t),u.IsUpdateLocation=!1,e=this.OwnerControl.Selection.Start._GetHierarchicalIndexInternal();t!=i&&n._IsForwardSelection(i,t);){var o=0,c=u.Paragraph._GetInline(u.Offset,o),r=c.inline;if(o=c.index,r!=null&&(f=r._GetNextRenderedInline(o),f instanceof l&&(s=f.fieldEnd.OwnerParagraph._GetOffset(f.fieldEnd,1),h=f.fieldEnd.OwnerParagraph._GetHierarchicalIndex(s.toString()),n._IsForwardSelection(h,e)||(this.OwnerControl.Selection.Start._SetPositionParagraph(f.fieldEnd.OwnerParagraph,s),e=h))),r instanceof b&&r.FieldBegin!=null){if(a=r.FieldBegin.OwnerParagraph._GetOffset(r.FieldBegin,0),v=r.FieldBegin.OwnerParagraph._GetHierarchicalIndex(a.toString()),!n._IsForwardSelection(i,v)){this._MoveToInline(r.FieldBegin,0);return}u._MoveToInline(r.FieldBegin,0)}else u._MovePreviousPosition();t=u._GetHierarchicalIndexInternal()}},n.prototype._ValidateForwardFieldSelection=function(t,i){var u=new n(this.OwnerControl),o,h,a,s,v,e,y,p;for(u._SetPositionForCurrentIndex(t),u.IsUpdateLocation=!1,o=!1;t!=i&&n._IsForwardSelection(t,i);){if(!o&&(u._MoveNextPosition(),h=u._GetHierarchicalIndexInternal(),t==h))break;var f=0,c=u.Paragraph._GetInline(u.Offset,f),r=c.inline;if(f=c.index,r!=null){if(a=this.OwnerControl.Selection.Start._GetHierarchicalIndexInternal(),f==r.Length&&r instanceof b){if(r.OwnerParagraph._GetOffset(r,0)==this.offset)return;s=r.FieldBegin.OwnerParagraph._GetOffset(r.FieldBegin,0);v=r.FieldBegin.OwnerParagraph._GetHierarchicalIndex(s.toString());n._IsForwardSelection(a,v)||this.OwnerControl.Selection.Start._SetPositionParagraph(r.FieldBegin.OwnerParagraph,s)}e=r._GetNextRenderedInline(f);e!=null&&e instanceof k&&(r=e)}if(o=r instanceof l&&r.fieldEnd!=null){if(r.OwnerParagraph._GetOffset(r,0)==this.offset)return;if(y=r.fieldEnd.OwnerParagraph._GetOffset(r.fieldEnd,1),p=r.fieldEnd.OwnerParagraph._GetHierarchicalIndex(y.toString()),!n._IsForwardSelection(p,i)){this._MoveToInline(r.fieldEnd,1);return}u._MoveToInline(r.fieldEnd,1)}t=u._GetHierarchicalIndexInternal()}},n.prototype._MoveToInline=function(n,t){this.currentParagraph=n.OwnerParagraph;this.offset=this.currentParagraph._GetOffset(n,t);this._UpdatePhysicalPosition()},n.prototype._MovePreviousPosition=function(){var t=0,i=this.currentParagraph._GetInline(this.offset,t),n=i.inline,u,r,f;t=i.index;n instanceof b&&n.FieldBegin!=null&&this._MovePreviousPositionInternal(n);u=this.currentParagraph._GetPreviousValidOffset(this.offset);this.offset>u?this.offset=u:(r=this.currentParagraph._GetPreviousParagraph(),r!=null&&(this.currentParagraph=r,this.offset=r._GetEndOffset()));t=0;i=this.currentParagraph._GetInline(this.offset,t);n=i.inline;t=i.index;n instanceof y&&(f=n._GetPreviousValidInline(),f!=null&&(n=f,this.currentParagraph=n.OwnerParagraph,this.offset=this.currentParagraph._GetOffset(n,n.Length),n instanceof l&&this.offset--));this._UpdatePhysicalPosition()},n.prototype._MoveNextPosition=function(){var n=this.currentParagraph._GetNextStartInline(this.offset),r,t,u,f,i;if(n instanceof l&&n.fieldEnd!=null){this._MoveNextPositionInternal(n);this._MoveNextPosition();return}r=this.currentParagraph._GetNextValidOffset(this.offset);t=0;r>this.offset?(this.offset=r,i=this.currentParagraph._GetInline(this.offset,t),n=i.inline,t=i.index,n!=null&&t==n.Length&&n.NextNode instanceof y&&(u=n.NextNode._GetNextValidInline(),u instanceof b&&(n=u,this.offset=this.currentParagraph._GetOffset(n,1)))):(f=this.currentParagraph._GetNextParagraph(),f!=null&&(this.currentParagraph=f,this.offset=this.currentParagraph._GetStartOffset()),i=this.currentParagraph._GetInline(this.offset,t),n=i.inline,t=i.index,n instanceof b&&this.offset++);this._UpdatePhysicalPosition()},n.prototype._MoveNextPositionInternal=function(n){var t;n.fieldSeparator==null?t=n.fieldEnd:(t=n.fieldSeparator,this.currentParagraph=t.OwnerParagraph,this.currentParagraph!=n.fieldEnd.OwnerParagraph||this.currentParagraph._HasValidInline(t,n.fieldEnd)||(t=n.fieldEnd));this.currentParagraph=t.OwnerParagraph;this.offset=this.currentParagraph._GetOffset(t,1)},n.prototype._MovePreviousPositionInternal=function(n){var t;t=n.FieldSeparator==null?n.FieldBegin._GetPreviousValidInline():n._GetPreviousValidInline();this.currentParagraph=t.OwnerParagraph;this.offset=this.currentParagraph._GetOffset(t,t instanceof y?0:t.Length)},n.prototype._UpdateTextPositionOnFieldCharacter=function(t){var r=new n(this.OwnerControl),c,o,v,s,y,p,w;r._SetPositionInternal(t);for(var u=t._GetHierarchicalIndexInternal(),e=this._GetHierarchicalIndexInternal(),h=!1;u!=e&&n._IsForwardSelection(u,e);){if(!h&&(r._MoveNextPosition(),c=r._GetHierarchicalIndexInternal(),u==c))break;var f=0,a=r.Paragraph._GetInline(r.Offset,f),i=a.inline;if(f=a.index,i!=null){if(o=t,o==null)return;if(v=o._GetHierarchicalIndexInternal(),f==i.Length&&i instanceof b&&i.FieldBegin!=null){if(i.OwnerParagraph._GetOffset(i,0)==this.offset)return;s=i.FieldBegin.OwnerParagraph._GetOffset(i.FieldBegin,0);y=i.FieldBegin.OwnerParagraph._GetHierarchicalIndex(s.toString());n._IsForwardSelection(v,y)||t._SetPositionParagraph(i.FieldBegin.OwnerParagraph,s)}i=i._GetNextRenderedInline(f)}if(h=i instanceof l&&i.fieldEnd!=null){if(i.OwnerParagraph._GetOffset(i,0)==this.offset)return;if(p=i.fieldEnd.OwnerParagraph._GetOffset(i.fieldEnd,1),w=i.fieldEnd.OwnerParagraph._GetHierarchicalIndex(p.toString()),!n._IsForwardSelection(w,e)){this._MoveToInline(i.fieldEnd,1);return}r._MoveToInline(i.fieldEnd,1)}u=r._GetHierarchicalIndexInternal()}},n.prototype._MoveForward=function(){var i=0,a=this.currentParagraph._GetInline(this.offset,i),t=a.inline,w,u,o,s,h,r,f,k,c;if(i=a.index,t!=null){if(!this.OwnerControl.Selection.IsEmpty&&i==t.Length&&t instanceof b){var d=this.OwnerControl.Selection.Start._GetHierarchicalIndexInternal(),v=t.FieldBegin.OwnerParagraph._GetOffset(t.FieldBegin,0),g=t.FieldBegin.OwnerParagraph._GetHierarchicalIndex(v.toString());if(!n._IsForwardSelection(d,g)){this.OwnerControl.Selection.Start._SetPositionParagraph(t.FieldBegin.OwnerParagraph,v);return}}t=t._GetNextRenderedInline(i)}if(t instanceof l&&t.fieldEnd!=null){var nt=this.OwnerControl.Selection.Start.Paragraph,e=0,p=nt._GetInline(this.OwnerControl.Selection.Start.Offset,e),tt=p.inline;if(e=p.index,w=tt._GetNextRenderedInline(e),w==t)this._MoveNextPositionInternal(t);else{t=t.fieldEnd;this.currentParagraph=t.OwnerParagraph;this.offset=this.currentParagraph._GetOffset(t,1);this._UpdatePhysicalPosition();return}}else(t instanceof l||t instanceof b)&&(this.currentParagraph=t.OwnerParagraph,this.offset=this.currentParagraph._GetOffset(t,1));i=0;u=this.currentParagraph._GetNextValidOffset(this.offset);o=this.currentParagraph._GetLength()-1;this.offset<=u&&this.offset<o+1?this.offset==u?this.offset=o+1:(this.offset=u,s=this.currentParagraph._GetInline(this.offset,i),t=s.inline,i=s.index,t!=null&&i==t.Length&&t.NextNode instanceof y&&(h=t.NextNode._GetNextValidInline(),h instanceof b&&(t=h,this.offset=this.currentParagraph._GetOffset(t,1)))):(r=this.currentParagraph._GetNextSelection(this.OwnerControl.Selection),r!=null&&(f=!1,r.Owner instanceof ot&&(this.OwnerControl.Selection.Start.Paragraph.IsInsideTable?(k=this.OwnerControl.Selection.Start.Paragraph.AssociatedCell._GetContainerCellOf(r.AssociatedCell),f=!k._Contains(r.AssociatedCell)):f=!0),this.currentParagraph=r,this.offset=f?this.currentParagraph._GetLength()+1:1),c=this.currentParagraph._GetInline(this.offset,i),t=c.inline,i=c.index,t instanceof b&&this.offset++);this._UpdatePhysicalPosition()},n.prototype._MoveBackward=function(){var i=0,f=this.currentParagraph._GetInline(this.offset,i),t=f.inline,r,v,s,u,e,p,h;if(i=f.index,!this.OwnerControl.Selection.IsEmpty&&t!=null&&(r=t._GetNextRenderedInline(i),r instanceof l)){var c=this.OwnerControl.Selection.Start._GetHierarchicalIndexInternal(),o=r.fieldEnd.OwnerParagraph._GetOffset(r.fieldEnd,1),a=r.fieldEnd.OwnerParagraph._GetHierarchicalIndex(o.toString());if(!n._IsForwardSelection(a,c)){this.OwnerControl.Selection.Start._SetPositionParagraph(r.fieldEnd.OwnerParagraph,o);return}}if(t instanceof b&&t.FieldBegin!=null){var c=this.OwnerControl.Selection.Start._GetHierarchicalIndexInternal(),o=t.OwnerParagraph._GetOffset(t,1),a=t.OwnerParagraph._GetHierarchicalIndex(o.toString());if(!n._IsForwardSelection(c,a)){v=t.FieldBegin.OwnerParagraph._GetOffset(t.FieldBegin,0);this.currentParagraph=t.FieldBegin.OwnerParagraph;this.offset=v;this._UpdatePhysicalPosition();return}this._MovePreviousPositionInternal(t)}s=this.currentParagraph._GetPreviousValidOffset(this.offset);this.offset>s?this.offset=s:(u=this.currentParagraph._GetPreviousSelection(this.OwnerControl.Selection),u!=null&&(e=!1,u.Owner instanceof ot&&(this.OwnerControl.Selection.Start.Paragraph.IsInsideTable?(p=this.OwnerControl.Selection.Start.Paragraph.AssociatedCell._GetContainerCellOf(u.AssociatedCell),e=!p._Contains(u.AssociatedCell)):e=!0),this.currentParagraph=u,this.offset=e?this.currentParagraph._GetStartOffset():this.currentParagraph._GetEndOffset()));i=0;f=this.currentParagraph._GetInline(this.offset,i);t=f.inline;i=f.index;t instanceof y&&(h=t._GetPreviousValidInline(),h!=null&&(t=h,this.currentParagraph=t.OwnerParagraph,this.offset=this.currentParagraph._GetOffset(t,t instanceof l?0:t.Length)));this._UpdatePhysicalPosition()},n.prototype._MoveToWordEnd=function(n,t){var i=this.currentParagraph._GetEndOffset(),r,f,e;if(this.offset==i||this.offset==i+1)if(this.offset==i&&n!=0)this._SetPositionParagraph(this.currentParagraph,i+1);else{if(r=this.currentParagraph._GetNextParagraph(),r==null)return;this.currentParagraph=r;this.offset=this.currentParagraph._GetStartOffset();n==1&&((this.OwnerControl.Selection.Start.Paragraph.IsInsideTable||this.Paragraph.IsInsideTable)&&(this.OwnerControl.Selection.Start.Paragraph.AssociatedCell!=this.Paragraph.AssociatedCell||this.OwnerControl.Selection.Start.Paragraph.AssociatedCell._IsCellSelected(this.OwnerControl.Selection.Start,this))?this._MoveToNextParagraphInTable():this._MoveToWordEnd(n,t))}else{var u=0,o=this.currentParagraph._GetInline(this.Offset,u),s=o.inline;u=o.index;s._GetNextWordOffset(u,n,!1,{endSelection:!1}.endSelection,this,t)}n!=0&&(f=this.OwnerControl.Selection.Start._GetHierarchicalIndexInternal(),e=this._GetHierarchicalIndexInternal(),f!=e&&this._ValidateForwardFieldSelection(f,e));this._UpdatePhysicalPosition()},n.prototype._MoveToWordStart=function(n){var t=this.currentParagraph._GetEndOffset(),i,u,f;if(n!=2||this.offset!=t&&this.offset!=t+1){if(this.offset==t+1)this.offset=t;else if(this.offset==this.currentParagraph._GetStartOffset()){if(i=this.currentParagraph._GetPreviousParagraph(),i==null)return;this.currentParagraph=i;this.offset=this.currentParagraph._GetEndOffset()}else{var r=0,e=this.currentParagraph._GetInline(this.offset,r),o=e.inline;r=e.index;o._GetPreviousWordOffset(r,n,o instanceof b,!1,!1,this)}n==1&&(u=this.OwnerControl.Selection.Start._GetHierarchicalIndexInternal(),f=this._GetHierarchicalIndexInternal(),u!=f&&this._ValidateBackwardFieldSelection(u,f));this._UpdatePhysicalPosition()}},n.prototype._MoveToLineStart=function(n){var r,u,t,f;this.Location.X>this.OwnerControl.Viewer.ClientActiveArea.Right&&(this.offset=this.offset-1);var o=this.currentParagraph._GetLineWidgetInternal(this.offset,n),i=o._GetFirstElementInternal(),e=this.currentParagraph._GetStartOffset();i==null&&this.offset>e?this.offset=e:i!=null&&(r=i._GetIndexInInline(),this.currentParagraph=i.Inline.OwnerParagraph,this.offset=this.currentParagraph._GetOffset(i.Inline,r),r=0,u=this.currentParagraph._GetInline(this.offset,r),t=u.inline,r=u.index,t instanceof y&&(f=t._GetPreviousValidInline(),f!=null&&(t=f,this.currentParagraph=t.OwnerParagraph,this.offset=this.currentParagraph._GetOffset(t,t.Length),t instanceof l&&this.offset--)));this._UpdatePhysicalPosition()},n.prototype._MoveToLineEnd=function(n){var f,e,r,i,t,o,u;if(this.Location.X>this.OwnerControl.Viewer.ClientActiveArea.Right&&(this.offset=this.offset-1),f=this.currentParagraph._GetLineWidget(this.offset),e=f._GetFirstElementInternal(),e==null&&this.offset==this.Paragraph._GetStartOffset())this.offset=this.Paragraph._GetLength()+1,this._UpdatePhysicalPosition();else if(e!=null){if(r=f.Children[f.Children.Count-1],i=r._GetIndexInInline(),i+=r instanceof it?r.Length:1,this.currentParagraph=r.Inline.OwnerParagraph,i==r.Inline.Length&&r.Inline.NextNode==null)this.offset=this.currentParagraph._GetLength()+1;else{for(t=r.Inline;t!=null&&t.Length==i&&t.NextNode instanceof y;)o=t.NextNode._GetNextValidInline(),t!=o&&(t=o,i=0),t instanceof l&&t.fieldEnd!=null&&(u=t,u.fieldSeparator==null?t=u.fieldEnd:(t=u.fieldSeparator,this.currentParagraph=t.OwnerParagraph,this.currentParagraph!=u.fieldEnd.OwnerParagraph||this.currentParagraph._HasValidInline(t,u.fieldEnd)||(t=u.fieldEnd)),this.currentParagraph=t.OwnerParagraph),t instanceof y&&(i=1);i==t.Length&&t.NextNode==null&&i++;this.offset=this.currentParagraph._GetOffset(t,i)}this._UpdatePhysicalPositionInternal(n)}},n.prototype._MoveToNextLine=function(t){var r=new n(this.OwnerControl),e,a,f,s,h,c,l;r._SetPositionInternal(this);e=this._GetHierarchicalIndexInternal();a=this.currentParagraph._GetLineWidget(this.offset);this._MoveToLineEnd(!0);f=!r._IsAtSamePosition(this);r._SetPositionInternal(this);this.currentParagraph.IsInsideTable?this._MoveDownInTable():this._MoveForward();var i=this.currentParagraph._GetLineWidget(this.offset),u=i._GetLeft(),o=i._GetFirstElementInternal(),v=o==null?i._GetWidth(!0):i._GetLeftInternal(o,1)-u;u<t&&v/2<t-u?(s=i._GetTop(),h=new p(t,s),i._UpdateTextPositionWidget(this.OwnerControl,h,this,!0),c=i._GetWidth(!0),c<t-u&&this._MoveToLineEnd(!0)):f&&this.currentParagraph.IsInsideTable&&this.currentParagraph.Owner==this.OwnerControl.Selection.Start.currentParagraph.Owner?this._SetPositionInternal(r):f||this._MoveToLineEnd(!0);l=this._GetHierarchicalIndexInternal();this._ValidateForwardFieldSelection(e,l)},n.prototype._MoveDownInTable=function(){var u=!1,o=this.OwnerControl.Selection.IsEmpty||this.OwnerControl.Selection.IsForward,r,e,s,t;if(u=this.OwnerControl.Selection.Start.Paragraph.IsInsideTable){var f=this.OwnerControl.Selection.Start.Paragraph.AssociatedCell,n=this.currentParagraph.AssociatedCell,i=f._GetContainerCellOf(n);if(u=i.OwnerTable._Contains(n)){if(f=f._GetSelectedCell(i),n=n._GetSelectedCell(i),r=i._Contains(this.currentParagraph.AssociatedCell),e=i._IsCellSelected(this.OwnerControl.Selection.Start,this),(r&&e||!r)&&n.OwnerRow.NextNode!=null){s=n.OwnerRow.NextNode;t=s._GetLastCellInRegion(i,this.OwnerControl.Selection.UpDownSelectionLength,!1);this._SetPosition(t._GetLastParagraph(),!1);return}(r&&e&&n.OwnerRow.NextNode==null||!r)&&(o?(n=n.OwnerRow.Cells[n.OwnerRow.Cells.Count-1],this._SetPosition(n._GetLastParagraph(),!1)):(n=n.OwnerRow.Cells[0],this._SetPosition(n._GetFirstParagraph(),!0)))}}u||(t=this.currentParagraph.AssociatedCell._GetContainerCell(),o?(t=t.OwnerRow.Cells[t.OwnerRow.Cells.Count-1],this._SetPosition(t._GetLastParagraph(),!1)):(t=t.OwnerRow.Cells[0],this._SetPosition(t._GetFirstParagraph(),!0)));this._MoveForward()},n.prototype._MoveToPreviousLine=function(n){var f=this._GetHierarchicalIndexInternal(),e=this.currentParagraph._GetLineWidget(this.offset),i,r,u;this._MoveToLineStart(!0);this.currentParagraph.IsInsideTable?this._MoveUpInTable():this._MoveBackward();var t=this.currentParagraph._GetLineWidget(this.offset),o=t._GetLeft(),s=t._GetWidth(!0);s+o>=n&&e!=t&&(i=t._GetTop(),r=new p(n,i),t._UpdateTextPositionWidget(this.OwnerControl,r,this,!0));u=this._GetHierarchicalIndexInternal();this._ValidateBackwardFieldSelection(f,u)},n.prototype._MoveUpInTable=function(){var f=!1,e=this.OwnerControl.Selection.End,s=!this.OwnerControl.Selection.IsEmpty,r,u,h,t;if(f=e.Paragraph.IsInsideTable){var n=this.currentParagraph.AssociatedCell,o=e.Paragraph.AssociatedCell,i=o._GetContainerCellOf(n);if(f=i.OwnerTable._Contains(n)){if(o=o._GetSelectedCell(i),n=n._GetSelectedCell(i),r=i._Contains(this.currentParagraph.AssociatedCell),u=i._IsCellSelected(this,e),u||(u=this.currentParagraph==i._GetFirstParagraph()&&this.IsAtParagraphStart),(r&&u||!r)&&n.OwnerRow.PreviousNode!=null){h=n.OwnerRow.PreviousNode;t=h._GetFirstCellInRegion(i,this.OwnerControl.Selection.UpDownSelectionLength,!0);this._SetPosition(t._GetFirstParagraph(),!0);return}(r&&u&&n.OwnerRow.PreviousNode==null||!r)&&(s?(n=n.OwnerRow.Cells[0],this._SetPosition(n._GetFirstParagraph(),!0)):(n=n.OwnerRow.Cells[n.OwnerRow.Cells.Count-1],this._SetPosition(n._GetLastParagraph(),!1)))}}f||(t=this.currentParagraph.AssociatedCell._GetContainerCell(),s?(t=t.OwnerRow.Cells[0],this._SetPosition(t._GetFirstParagraph(),!0)):(t=t.OwnerRow.Cells[t.OwnerRow.Cells.Count-1],this._SetPosition(t._GetLastParagraph(),!1)));this._MoveBackward()},n.prototype._MoveToParagraphStart=function(n){var r=this.currentParagraph._GetStartOffset(),t,i;this.offset==r&&n?(this.OwnerControl.Selection.Start.Paragraph.IsInsideTable||this.Paragraph.IsInsideTable)&&(this.OwnerControl.Selection.Start.Paragraph.AssociatedCell!=this.Paragraph.AssociatedCell||this.OwnerControl.Selection.Start.Paragraph.AssociatedCell._IsCellSelected(this.OwnerControl.Selection.Start,this))?this._MoveToPreviousParagraphInTable():this.currentParagraph._GetPreviousParagraph()!=null&&(this.currentParagraph=this.currentParagraph._GetPreviousParagraph(),this.offset=this.currentParagraph._GetStartOffset()):this.offset=this.currentParagraph._GetStartOffset();t=this.OwnerControl.Selection.Start._GetHierarchicalIndexInternal();i=this._GetHierarchicalIndexInternal();t!=i&&this._ValidateBackwardFieldSelection(t,i);this._UpdatePhysicalPosition()},n.prototype._MoveToParagraphEnd=function(n){var u=this.OwnerControl.Selection.Start.Paragraph,r=this.currentParagraph._GetEndOffset()+1,t,i;this.offset==r&&n?(this.OwnerControl.Selection.Start.Paragraph.IsInsideTable||this.Paragraph.IsInsideTable)&&(this.OwnerControl.Selection.Start.Paragraph.AssociatedCell!=this.Paragraph.AssociatedCell||this.OwnerControl.Selection.Start.Paragraph.AssociatedCell._IsCellSelected(this.OwnerControl.Selection.Start,this))?this._MoveToNextParagraphInTable():this.currentParagraph._GetNextParagraph()!=null&&(this.currentParagraph=this.currentParagraph._GetNextParagraph(),this.offset=this.currentParagraph._GetEndOffset()+1):this.offset=this.currentParagraph._GetEndOffset()+1;t=this.OwnerControl.Selection.Start._GetHierarchicalIndexInternal();i=this._GetHierarchicalIndexInternal();t!=i&&this._ValidateForwardFieldSelection(t,i);this._UpdatePhysicalPosition()},n.prototype._MoveToPreviousParagraphInTable=function(){var n;(n=this.currentParagraph.IsInsideTable?this.currentParagraph.AssociatedCell._GetPreviousSelection(this.OwnerControl.Selection):this.currentParagraph._GetPreviousParagraph(),n!=null)&&(this.currentParagraph=n,this.offset=this.currentParagraph._GetStartOffset())},n.prototype._MoveToNextParagraphInTable=function(){var n;(n=this.currentParagraph.IsInsideTable?this.currentParagraph.AssociatedCell._GetNextSelection(this.OwnerControl.Selection):this.currentParagraph._GetNextParagraph(),n!=null)&&(this.currentParagraph=n,this.offset=this.currentParagraph._GetEndOffset()+1)},n.prototype._MoveToPreviousParagraph=function(){var n=this.currentParagraph._GetStartOffset();this.offset==n&&this.currentParagraph._GetPreviousParagraph()!=null?(this.currentParagraph=this.currentParagraph._GetPreviousParagraph(),this.offset=this.currentParagraph._GetStartOffset()):this.offset=this.currentParagraph._GetStartOffset();this._UpdatePhysicalPosition()},n.prototype._MoveToNextParagraph=function(){this.currentParagraph._GetNextParagraph()!=null&&(this.currentParagraph=this.currentParagraph._GetNextParagraph(),this.offset=this.currentParagraph._GetStartOffset(),this._UpdatePhysicalPosition())},n.prototype._MoveDown=function(n){var t=this.currentParagraph,c=this.offset,s,r,f,i,o,h;if(this._MoveToLineEnd(!0),s=this.currentParagraph._GetLength(),this.offset>s&&(this.offset=s),this._MoveNextPosition(),r=null,t.IsInsideTable&&t!=this.currentParagraph&&t.AssociatedCell!=this.currentParagraph.AssociatedCell){if(f=this.currentParagraph.AssociatedCell.OwnerRow,t.IsInsideTable&&t.AssociatedCell.CellFormat.RowSpan>1&&t.AssociatedCell.CellFormat.RowSpan+t.AssociatedCell.OwnerRow.RowIndex==t.AssociatedCell.OwnerTable.Rows.Count&&(f=this.currentParagraph.AssociatedCell.OwnerTable.Rows[this.currentParagraph.AssociatedCell.OwnerTable.Rows.Count-1]),f.NextNode instanceof bt)o=f.NextNode._GetLastCellInRegion(this.currentParagraph.AssociatedCell,n,!1),this._SetPosition(o._GetFirstParagraph(),!0);else{i=f.OwnerTable._GetNextRenderedBlock();do i instanceof e&&(i=i._GetFirstBlockInFirstCell());while(i instanceof e);i instanceof u&&this._SetPosition(i,!0)}r=this.currentParagraph._GetLineWidget(this.offset)}else!t.IsInsideTable&&this.currentParagraph.IsInsideTable&&(o=this.currentParagraph.AssociatedCell.OwnerRow._GetLastCellInRegion(this.currentParagraph.AssociatedCell,this.OwnerControl.Selection.UpDownSelectionLength,!1),this._SetPosition(o._GetFirstParagraph(),!0)),r=this.currentParagraph._GetLineWidget(this.offset);h=r._GetTop();r._UpdateTextPositionWidget(this.OwnerControl,new p(n,h),this,!1)},n.prototype._MoveUp=function(n){var t=this.currentParagraph,f,o,i,r,s;if(this._MoveToLineStart(!0),this._MovePreviousPosition(),f=null,t.IsInsideTable&&t!=this.currentParagraph&&t.AssociatedCell!=this.currentParagraph.AssociatedCell&&this.currentParagraph.AssociatedCell!=null&&t.AssociatedCell.OwnerRow==this.currentParagraph.AssociatedCell.OwnerRow){if(o=this.currentParagraph.AssociatedCell.OwnerRow,o.PreviousNode instanceof bt)r=o.PreviousNode._GetFirstCellInRegion(this.currentParagraph.AssociatedCell,n,!0),this._SetPosition(r._GetLastParagraph(),!1);else{i=o.OwnerTable._GetPreviousBlock();do i instanceof e&&(i=i._GetLastBlockInLastCell());while(i instanceof e);i instanceof u&&this._SetPosition(i,!1)}f=this.currentParagraph._GetLineWidget(this.offset)}else!t.IsInsideTable&&this.currentParagraph.IsInsideTable?(r=this.currentParagraph.AssociatedCell.OwnerRow._GetFirstCellInRegion(this.currentParagraph.AssociatedCell,this.OwnerControl.Selection.UpDownSelectionLength,!0),this._SetPosition(r._GetLastParagraph(),!1)):t.IsInsideTable&&this.currentParagraph.AssociatedCell!=null&&t.AssociatedCell.OwnerRow.PreviousNode==this.currentParagraph.AssociatedCell.OwnerRow&&(r=this.currentParagraph.AssociatedCell.OwnerRow._GetLastCellInRegion(this.currentParagraph.AssociatedCell,this.OwnerControl.Selection.UpDownSelectionLength,!0),this._SetPosition(r._GetLastParagraph(),!1)),f=this.currentParagraph._GetLineWidget(this.offset);s=f._GetTop();f._UpdateTextPositionWidget(this.OwnerControl,new p(n,s),this,!1)},n.prototype._IsInSameDocument=function(n){if(n==null)throw new RangeError("The textPosition cannot be null.");return this.Document==n.Document},n.prototype._IsAtSamePosition=function(n){return this.currentParagraph==n.currentParagraph&&this.offset==n.offset},n.prototype._IsExistBefore=function(n){if(n==null)throw new Error("textPosition is null.");if(!this._IsInSameDocument(n))throw new Error("textPosition is not in the same document.");return this.currentParagraph==n.currentParagraph?this.offset<n.offset:this.currentParagraph.Owner==n.currentParagraph.Owner?this.currentParagraph.IsInsideTable?this.currentParagraph.AssociatedCell.Blocks._IndexOf(this.currentParagraph)<n.currentParagraph.AssociatedCell.Blocks._IndexOf(n.currentParagraph):this.currentParagraph.Owner instanceof d?this.currentParagraph.Owner.Blocks.indexOf(this.currentParagraph)<n.currentParagraph.Owner.Blocks.indexOf(n.currentParagraph):this.currentParagraph.Owner instanceof g?this.currentParagraph.Owner.Blocks._IndexOf(this.currentParagraph)<n.currentParagraph.Owner.Blocks._IndexOf(n.currentParagraph):this.currentParagraph.Section.Blocks.indexOf(this.currentParagraph)<n.currentParagraph.Section.Blocks.indexOf(n.currentParagraph):this.currentParagraph._IsExistBefore(n.currentParagraph)},n.prototype._IsExistAfter=function(n){if(n==null)throw new Error("textPosition is null.");if(!this._IsInSameDocument(n))throw new Error("textPosition is not in the same document.");return this.currentParagraph==n.currentParagraph?this.offset>n.offset:this.currentParagraph.Owner==n.currentParagraph.Owner?this.currentParagraph.IsInsideTable?this.currentParagraph.AssociatedCell.Blocks._IndexOf(this.currentParagraph)>n.currentParagraph.AssociatedCell.Blocks._IndexOf(n.currentParagraph):this.currentParagraph.Owner instanceof d?this.currentParagraph.Owner.Blocks._IndexOf(this.currentParagraph)>n.currentParagraph.Owner.Blocks._IndexOf(n.currentParagraph):this.currentParagraph.Owner instanceof g?this.currentParagraph.Owner.Blocks._IndexOf(this.currentParagraph)>n.currentParagraph.Owner.Blocks._IndexOf(n.currentParagraph):this.currentParagraph.Section.Blocks._IndexOf(this.currentParagraph)>n.currentParagraph.Section.Blocks._IndexOf(n.currentParagraph):this.currentParagraph._IsExistAfter(n.currentParagraph)},n.prototype._IsInSameParagraph=function(n){if(n==null)throw new Error("textPosition is null.");return this.Paragraph==n.Paragraph},n.prototype._Clone=function(){var t=new n(this.OwnerControl);return t.currentParagraph=this.currentParagraph,t.offset=this.offset,t.location=this.location,t},n.prototype._GetHierarchicalIndexInternal=function(){return this.Paragraph._GetHierarchicalIndex(this.Offset.toString())},n.prototype._Dispose=function(){this.currentParagraph=null;this.location=null},n._IsForwardSelection=function(n,t){var i,f,e;if(n==t)return!0;n=n.replace(/C;/g,"");t=t.replace(/C;/g,"");var o=n.split(";"),r=t.split(";"),u=o.length;for(u>r.length&&(u=r.length-1),i=0;i<u;i++)if(f=parseFloat(o[i]),e=parseFloat(r[i]),f!=e)return f<e;return!1},n}();t.TextPosition=tt;le=function(){function n(n){this.SelectedWidgets=null;this.ownerControl=n;this.SelectedWidgets=new ni}return Object.defineProperty(n.prototype,"Start",{get:function(){return this.start==null&&this.ownerControl!=null&&this.ownerControl.Document!=null&&(this.start=this.ownerControl.Document.DocumentStart),this.start},set:function(n){this.start=n},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"End",{get:function(){return this.end==null&&this.Start!=null&&(this.end=this.Start._Clone()),this.end},set:function(n){this.end=n},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"IsEmpty",{get:function(){return this.Start==null?!0:this.Start._IsAtSamePosition(this.End)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"IsForward",{get:function(){return this.Start._IsExistBefore(this.End)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"OwnerControl",{get:function(){return this.ownerControl},enumerable:!0,configurable:!0}),n.prototype._ClearSelectionHighlight=function(){for(var t=this.SelectedWidgets.Keys,n=0;n<t.Count;n++)this._RemoveSelectionHighlight(t[n]);this.SelectedWidgets._Clear()},n.prototype._ClearSelectionHighlightInternal=function(n){this._RemoveSelectionHighlight(n);this.SelectedWidgets._Remove(n)},n.prototype._RemoveSelectionHighlight=function(n){var u=0,f=0,e=0,o=0,t=null,r,s,c,i,h,l;if(n instanceof ru){if(r=n,s=r.CurrentParagraphWidget,t=s!=undefined||s!=null?r.CurrentParagraphWidget._GetPage():null,t==null)return;i=this.SelectedWidgets._Get(n);e=i.Width;u=i.Left;f=r._GetTop();o=r.Height}if(n instanceof ii){if(c=n,t=c._GetPage(),t==null)return;i=this.SelectedWidgets._Get(n);e=i.Width;u=i.Left;f=n.Y;o=n.Height}t!=null&&(h=document.getElementById(t.Id+"_selection"),h!=null)&&(l=h.getContext("2d"),l.clearRect(u,f,e,o))},n.prototype._AddSelectionHighlight=function(n,t,i){var f;if(this.SelectedWidgets._ContainsKey(t)){var e=t.Height,u=this.SelectedWidgets._Get(t),o=u.Width,r=u.Left;t.CurrentParagraphWidget.CurrentNode._IsInComment()&&(f=this.Start.Paragraph._GetOwnerComment(),r=r+f.LayoutedWidget.X);n.fillStyle="gray";n.globalAlpha=.4;n.fillRect(r,i,o,e)}},n.prototype._AddSelectionHighlightTable=function(n,t){var u;if(this.SelectedWidgets._ContainsKey(t)){var r=this.SelectedWidgets._Get(t),i=r.Left,f=t.Y,e=r.Width,o=t.Height;t.ContainerWidget.CurrentNode._IsInComment()&&(u=this.Start.Paragraph._GetOwnerComment(),i=i+u.LayoutedWidget.X);n.fillStyle="gray";n.globalAlpha=.4;n.fillRect(i,f,e,o)}},n.prototype._GetSelectedContentAsHTML=function(){return this.IsForward?this.Start.Paragraph._GetSelectedContent(this.OwnerControl.Selection,this.Start,this.End):this.End.Paragraph._GetSelectedContent(this.OwnerControl.Selection,this.End,this.Start)},n.prototype._Dispose=function(){this.start!=null&&(this.start._Dispose(),this.start=null);this.end!=null&&(this.end._Dispose(),this.end=null);this._ClearSelectionHighlight();this.ownerControl=null},n}();t.SelectionRange=le;hf=function(){function n(n){this.ranges=new h;this.ownerControl=n}return Object.defineProperty(n.prototype,"Count",{get:function(){return this.ranges!=null?this.ranges.length:0},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"OwnerControl",{get:function(){return this.ownerControl},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"First",{get:function(){return this.ranges!=null&&this.ranges.Count>0?this.ranges[0]:null},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"Last",{get:function(){return this.ranges!=null&&this.ranges.Count>0?this.ranges[this.ranges.length-1]:null},enumerable:!0,configurable:!0}),n.prototype._Get=function(n){return n>-1&&n<this.ranges.length?this.ranges[n]:null},n.prototype._Clear=function(){this.ranges!=null&&this.ranges.Count>0&&(this.ownerControl.Viewer._ClearSelectionHighlight(),this.ranges._Clear())},n.prototype._Contains=function(n){if(n==null)throw new ReferenceError("SelectionRange cannot be null.");return this.ranges==null?!1:this.ranges._Contains(n)},n.prototype._Remove=function(n){if(n==null)throw new ReferenceError("SelectionRange cannot be null.");return this.ranges!=null&&this.ranges._Contains(n)?(n._ClearSelectionHighlight(),this.ranges._Remove(n),this.ownerControl.Viewer._UpdateVisiblePages(!0),!0):!1},n.prototype._AddSelection=function(n,t){this.ranges==null&&(this.ranges=new h);var i=new le(this.ownerControl);i.Start._SetPositionInternal(n);i.End._SetPositionInternal(t);i.IsEmpty||(i.IsForward?i.End._UpdateTextPositionOnFieldCharacter(i.Start):i.Start._UpdateTextPositionOnFieldCharacter(i.End),this._CheckSelectionRangesIsExist(i.Start,i.End));this.ranges._Add(i)},n.prototype._CheckSelectionRangesIsExist=function(n,t){var r=n,u=t,f;if(!r._IsAtSamePosition(u))for(n._IsExistBefore(t)||(r=t,u=n),f=0;f<this.ranges.Count-1;f++){var i=this.ranges[f],e=i.Start,o=i.End;i.Start._IsExistBefore(i.End)||(e=i.End,o=i.Start);(r._IsAtSamePosition(e)||u._IsAtSamePosition(o)||r._IsExistBefore(e)&&u._IsExistAfter(e)||r._IsExistBefore(o)&&u._IsExistAfter(o)||r._IsExistAfter(e)&&u._IsExistBefore(o))&&(this._Remove(i),f--)}},n.prototype._UpdateSelectionRange=function(){var i=this.Last,r=i.Start,u=i.End,o,n;for(i.Start._IsExistBefore(i.End)||(r=i.End,u=i.Start),o=!r._IsAtSamePosition(u),n=0;n<this.ranges.Count-1;n++){var t=this.ranges[n],f=t.Start,e=t.End;f._IsAtSamePosition(e)?(this.ranges._RemoveAt(n),n--):o&&(t.Start._IsExistBefore(t.End)||(f=t.End,e=t.Start),(r._IsAtSamePosition(f)||u._IsAtSamePosition(e)||r._IsExistBefore(f)&&u._IsExistAfter(f)||r._IsExistBefore(e)&&u._IsExistAfter(e)||r._IsExistAfter(f)&&u._IsExistBefore(e))&&(this._Remove(t),n--))}o||this.ranges._RemoveAt(this.ranges.Count-1)},n.prototype._ClearSelection=function(){if(this.ranges!=null&&this.ranges.Count>0){this.ownerControl.Viewer._ClearSelectionHighlight();for(var n=0;n<this.ranges.Count-1;n++)this.ranges[n]._Dispose(),this.ranges._RemoveAt(n),n--;this.OwnerControl.Selection._RetrieveCurrentFormatProperties()}},n.prototype._ClearMultiSelection=function(){if(this.ranges!=null&&this.ranges.length>1){this.ownerControl.Viewer._ClearSelectionHighlight();for(var n=0;n<this.ranges.Count-1;n++)this.ranges[n]._Dispose(),this.ranges._RemoveAt(n),n--}},n.prototype._Dispose=function(){if(this.ranges!=null&&this.ranges.Count>0){for(var n=0;n<this.ranges.Count-1;n++)this.ranges[n]._Dispose(),n--;this.ranges._Clear();this.ranges=null}this.ownerControl=null},n.prototype._RemoveSelectionHighlight=function(n){if(this.ranges!=null)for(var t=0;t<this.ranges.Count;t++)this.ranges[t].SelectedWidgets._ContainsKey(n)&&this.ranges[t]._RemoveSelectionHighlight(n)},n.prototype._ClearSelectionHighlightInternal=function(n){if(this.ranges!=null)for(var t=0;t<this.ranges.Count;t++)this.ranges[t].SelectedWidgets._ContainsKey(n)&&this.ranges[t]._ClearSelectionHighlightInternal(n)},n.prototype._ClearSelectionHighlight=function(){if(this.ranges!=null)for(var n=0;n<this.ranges.Count;n++)this.ranges[n]._ClearSelectionHighlight()},n.prototype._AddSelectionHighlight=function(n,t,i){if(this.ranges!=null)for(var r=0;r<this.ranges.Count;r++)this.ranges[r]._AddSelectionHighlight(n,t,i)},n.prototype._AddSelectionHighlightTable=function(n,t){if(this.ranges!=null)for(var i=0;i<this.ranges.Count;i++)this.ranges[i]._AddSelectionHighlightTable(n,t)},n}();t.SelectionRangeCollection=hf;ae=function(){function n(){this.type=rf.Text}return Object.defineProperty(n.prototype,"Type",{get:function(){return this.type},set:function(n){this.type=n},enumerable:!0,configurable:!0}),n}();t.EditingContext=ae;ve=function(){function n(){}return n._ParseHTMLtoLogicalDom=function(n){var t=document.createElement("div"),i,r;return t.innerHTML=n,this.document=new ti(null),i=this._ParseHTMLDomElement(t),this.document.Sections._Add(i),t.innerHTML="",r=this.document,this.document=null,r},n._ParseHTMLDomElement=function(n){for(var r,t=new ct(null),u=n,i=0;i<u.children.length;i++)r=this._ParseHTMLBlockElement(u.children[i],t.Blocks),r!=null&&t.Blocks._Add(r);return t},n._ParseHTMLBlockElement=function(n,t){if(n instanceof HTMLParagraphElement)return this._ParseParagraphLogicalDom(n,null,!1);if(n instanceof HTMLTableElement)return this._ParseTableLogicalDom(n);(n instanceof HTMLUListElement||n instanceof HTMLOListElement)&&(this._ParseListElement(n,t),this.listLevelCount--)},n._ParseListElement=function(n,t){var r,i,u;for(this.listLevelCount++,n instanceof HTMLUListElement?this.listName=n.getAttribute("type")!=""&&n.getAttribute("type")!=""?n.getAttribute("type")=="square"?"_Bullet_Square":n.getAttribute("type")=="circle"?"_Bullet_Circle":n.getAttribute("type")=="none"?"_Bullet_None":"_Bullet_Dot":"_Bullet_Dot":n instanceof HTMLOListElement&&(this.listName=n.getAttribute("type")!=""&&n.getAttribute("type")!=""?n.getAttribute("type")=="a"?"_Numbered_LowerLetter":n.getAttribute("type")=="A"?"_Numbered_UpperLetter":n.getAttribute("type")=="i"?"_Numbered_LowerRoman":n.getAttribute("type")=="I"?"_Numbered_UpperRoman":"_Numbered_Normal":"_Numbered_Normal"),r=this._GetAbstractListAdv(this.listName),this.listLevelCount%9==0?r==null&&this.GetOrCreateList(this.listName):r.Levels._Add(this.CreateListLevel(this.listName,parseInt(n.getAttribute("start")))),i=0;i<n.children.length;i++)u=this._ParseParagraphLogicalDom(n.children[i],i,!0),t._Add(u)},n.CreateListLevel=function(n,t){var i=new lt(null);return n.split("_")[1]=="Bullet"?(i.ListLevelPattern=c.Bullet,i.NumberFormat=n.split("_")[2]=="Dot"?lt.DOTBULLET:n.split("_")[2]=="Square"?lt.SQUAREBULLET:lt.ARROWBULLET,i.CharacterFormat.FontFamily=n.split("_")[2]=="Square"?"Wingdings":"Symbol"):(i.ListLevelPattern=n.split("_")[2]=="LowerRoman"?c.LowRoman:n.split("_")[2]=="LowerLetter"?c.LowLetter:n.split("_")[2]=="UpperRoman"?c.UpRoman:n.split("_")[2]=="UpperLetter"?c.UpLetter:c.Arabic,i.NumberFormat="%"+(this.listLevelCount%9+1)+".",i.StartAt=t),i.ParagraphFormat=new a(null),i.ParagraphFormat.LeftIndent=48*this.listLevelCount%9,i.ParagraphFormat.FirstLineIndent=-24,i},n._GetAbstractListAdv=function(n){var i=this.document.AbstractLists,t;if(i==null)return null;for(t=0;t<i.length;t++)if(i[t]!=null&&i[t].Name==n)return i[t];return null},n.GetOrCreateList=function(n){var i=this._GetAbstractListAdv(n),r,u,t;i==null&&(r=this.document,i=new nr(null),u=new fr(null),i.AbstractListId=r.AbstractLists.Count,u.ListId=r.Lists.Count,r.AbstractLists._Add(i),r.Lists._Add(u),u.AbstractListId=i.AbstractListId,i.Name=n,t=i.AddListLevel(),n.split("_")[1]=="Bullet"?(t.ListLevelPattern=c.Bullet,t.NumberFormat=n.split("_")[2]=="Dot"?lt.DOTBULLET:n.split("_")[2]=="Square"?lt.SQUAREBULLET:lt.ARROWBULLET,t.CharacterFormat.FontFamily=n.split("_")[2]=="Square"?"Wingdings":"Symbol"):(t.ListLevelPattern=n.split("_")[2]=="LowerRoman"?c.LowRoman:n.split("_")[2]=="LowerLetter"?c.LowLetter:n.split("_")[2]=="UpperRoman"?c.UpRoman:n.split("_")[2]=="UpperLetter"?c.UpLetter:c.Arabic,t.NumberFormat="%"+(this.listLevelCount%9+1)+".",t.StartAt=1),t.ParagraphFormat=new a(null),t.ParagraphFormat.LeftIndent=48,t.ParagraphFormat.FirstLineIndent=-24)},n._ParseParagraphLogicalDom=function(n,t,i){for(var e,c,l,r,s=new u(null),f=s.ParagraphFormat,o=n.style,h=0;h<n.children.length;h++)e=n.children[h],e instanceof HTMLSpanElement?(c=this._ParseSpanLogicalDom(e),s.Inlines._Add(c)):e instanceof HTMLImageElement?(l=this._ParseImageDom(e),s.Inlines._Add(l)):e instanceof HTMLAnchorElement&&this._AddHyperlink(e,s);return i&&(f.ListFormat.ListId=this._GetListAdv(this.listName).ListId,f.ListFormat.ListLevelNumber=t%9),o.margin!=null&&o.margin!=""&&(r=o.margin.split(" "),r[0]!=null&&r[0]!=""&&(f.BeforeSpacing=parseFloat(r[0])),r[1]!=null&&r[1]!=""&&(f.RightIndent=parseFloat(r[1])),r[2]!=null&&r[2]!=""&&(f.AfterSpacing=parseFloat(r[2])),r[3]!=null&&r[3]!=""&&(f.LeftIndent=parseFloat(r[3]))),o.textIndent!=null&&o.textIndent!=""&&(f.FirstLineIndent=parseFloat(o.textIndent)),f.TextAlignment=this._GetTextAlignment(n.style.textAlign),s},n._GetTextAlignment=function(n){switch(n){case"right":return rt.Right;case"left":return rt.Left;case"center":return rt.Center;case"justify":return rt.Justify}},n._ParseSpanLogicalDom=function(n){var t=new s(null),i=n.style,r=n.getAttribute("style").split(";"),u=t.CharacterFormat;return this._ParseCharacterFormat(i,r,u),n.textContent!=null&&n.textContent!=""&&(t.Text=n.textContent),t},n._ParseCharacterFormat=function(n,t,i){i.Bold=n.fontWeight=="bold"?!0:!1;i.Italic=n.fontStyle=="italic"?!0:!1;t!=null&&(t.indexOf(" text-decoration:underline")>-1&&(i.Underline=ki.Single),t.indexOf(" text-decoration:line-through")>-1&&(i.StrikeThrough=cr.SingleStrike));n.verticalAlign=="sub"?i.BaselineAlignment=vt.Subscript:n.verticalAlign=="super"&&(i.BaselineAlignment=vt.Superscript);n.color!=null&&n.color!=""&&n.color!=undefined&&(i.FontColor=n.color);n.fontFamily!=null&&n.fontFamily!=""&&n.fontFamily!=undefined&&(i.FontFamily=n.fontFamily);n.fontSize!=null&&n.fontSize!=""&&n.fontSize!=undefined&&(i.FontSize=parseFloat(n.fontSize))},n._AddHyperlink=function(n,t){var i=new l(null),r,u;this._ParseCharacterFormat(n.style,null,i.CharacterFormat);t.Inlines._Add(i);t.Inlines._Add(this._AddFieldCode(n,i.CharacterFormat));r=new yi(null);r.CharacterFormat._CopyFormat(i.CharacterFormat);t.Inlines._Add(r);this._ParseSpanNodes(n,t);u=new b(null);u.CharacterFormat._CopyFormat(i.CharacterFormat);t.Inlines._Add(u)},n._AddFieldCode=function(n,t){var i=null;return i=new s(null),i.Text=' HYPERLINK "'+n.getAttribute("href")+'" ',i.CharacterFormat._CopyFormat(t),i},n._ParseSpanNodes=function(n,t){var i,r;if(n.children!=null)for(i=0;i<n.children.length;i++)r=this._ParseSpanLogicalDom(n.children[i]),t.Inlines._Add(r)},n._ParseImageDom=function(n){var t=new pt(null,null,null);return t.Width=parseFloat(n.getAttribute("width")),t.Height=parseFloat(n.getAttribute("height")),t.ImageString=n.getAttribute("src"),t},n._ParseTableLogicalDom=function(n){for(var u,t=new e(null),f=t.TableFormat,r=n.tBodies[0],i=0;i<r.rows.length;i++)u=this._ParseTableRowsLogicalDom(r.rows[i]),t.Rows._Add(u);return n.getAttribute("bgcolor")!=null&&n.getAttribute("bgcolor")!=""&&(f.Shading.BackgroundColor=n.getAttribute("bgcolor")),t},n._ParseTableRowsLogicalDom=function(n){for(var r,i=new bt(null),t=0;t<n.cells.length;t++)r=this._ParseTableCellsLogicalDom(n.cells[t]),i.Cells._Add(r);return i},n._ParseTableCellsLogicalDom=function(n){for(var u,t,f,i=new ot(null),r=0;r<n.children.length;r++)u=this._ParseHTMLBlockElement(n.children[r],i.Blocks),u!=null&&i.Blocks._Add(u);return t=i.CellFormat,f=n.style,t.RowSpan=parseInt(n.getAttribute("rowspan")),t.ColumnSpan=parseInt(n.getAttribute("colspan")),n.getAttribute("bgcolor")!=null&&n.getAttribute("bgcolor")!=""&&(t.Shading.BackgroundColor=n.getAttribute("bgcolor")),t.CellWidth=parseFloat(n.getAttribute("width")),i},n._GetListAdv=function(n){var r=this._GetAbstractListAdv(n),t,i;if(r!=null)for(t=0;t<this.document.Lists.length;t++)if(i=this.document.Lists[t],i.AbstractListId==r.AbstractListId)return i;return null},n.listLevelCount=-1,n.listName=null,n}();t.HTMLParser=ve;cf=function(){function n(n){this.ownerControl=null;this.UpDownSelectionLength=0;this.IsRetrieveFormatting=!1;this.SkipFormatRetrieval=!1;this.IsSkipLayouting=!1;this.editPosition="";this.IsHighlightingCommentRange=!1;this.NeedToRenderMarker=!0;this.IsSelectingComment=!1;this.preservedFontCol=null;this.removedCommentCharacters=null;this.editingContext=null;this.ownerControl=n;this.selectionRanges=new hf(n);this.characterFormat=new af(this);this.paragraphFormat=new vf(this);this.sectionFormat=new ye(this);this.rowFormat=new be(this);this.cellFormat=new we(this);this.tableFormat=new pe(this);this.removedCommentCharacters=new h;this.editingContext=new ae}return Object.defineProperty(n.prototype,"CanPaste",{get:function(){return di.htmlString!=null&&di.htmlString!=""&&di.htmlString!=undefined},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"SelectionRanges",{get:function(){return this.selectionRanges},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"OwnerControl",{get:function(){return this.ownerControl},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"Text",{get:function(){return this._GetText(!1)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"EditingContext",{get:function(){return this.editingContext},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"IsCleared",{get:function(){return this.End==null},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"Start",{get:function(){var n=null;return this.OwnerControl!=null&&this.OwnerControl.Document!=null&&(this.SelectionRanges==null&&(this.SelectionRanges=new hf(this.OwnerControl)),this.OwnerControl.Selection.SelectionRanges.Count!=0||this.OwnerControl.History.IsUndoing||this.OwnerControl.History.IsRedoing||(n=this.ownerControl.Document.DocumentStart,n!=null&&(this.OwnerControl.Selection.SelectionRanges._AddSelection(n,n),this._FireSelectionChanged(!1))),this.OwnerControl.Selection.SelectionRanges.Count>0)?this.OwnerControl.Selection.SelectionRanges._Get(this.OwnerControl.Selection.SelectionRanges.Count-1).Start:null},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"End",{get:function(){return this.OwnerControl.IsDocumentLoaded&&this.OwnerControl.Selection.SelectionRanges.Count>0||this.OwnerControl.Selection.SelectionRanges.Count>0&&this.Start!=null?this.OwnerControl.Selection.SelectionRanges._Get(this.OwnerControl.Selection.SelectionRanges.Count-1).End:null},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"IsEmpty",{get:function(){return this.Start==null?!0:this.Start._IsAtSamePosition(this.End)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"IsForward",{get:function(){return this.Start._IsExistBefore(this.End)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"CurrentSelectionRange",{get:function(){return this.OwnerControl.IsDocumentLoaded&&this.OwnerControl.Selection.SelectionRanges!=null&&this.OwnerControl.Selection.SelectionRanges.Count>0?this.OwnerControl.Selection.SelectionRanges._Get(this.OwnerControl.Selection.SelectionRanges.Count-1):null},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"CharacterFormat",{get:function(){return this.characterFormat},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"ParagraphFormat",{get:function(){return this.paragraphFormat},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"SectionFormat",{get:function(){return this.sectionFormat},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"TableFormat",{get:function(){return this.tableFormat},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"CellFormat",{get:function(){return this.cellFormat},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"RowFormat",{get:function(){return this.rowFormat},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"CurrentHistoryInfo",{get:function(){return this.currentHistoryInfo},set:function(n){this.currentHistoryInfo=n},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"CurrentBaseHistoryInfo",{get:function(){return this.currentBaseHistoryInfo},set:function(n){this.currentBaseHistoryInfo=n},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"EditPosition",{get:function(){return this.editPosition},set:function(n){this.editPosition=n},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"RemovedCommentCharacters",{get:function(){return this.removedCommentCharacters==null&&(this.removedCommentCharacters=new h),this.removedCommentCharacters},enumerable:!0,configurable:!0}),n.prototype._ApplyBullet=function(n,t){var i=this.ParagraphFormat._GetList(),f=this.Start,u,r;this.IsForward||(f=this.End);u=null;i!=null&&(u=f.Paragraph.ParagraphFormat.ListFormat.ListLevel);i==null||i!=null&&(u.ListLevelPattern!=c.Bullet||u.NumberFormat!=n||u.CharacterFormat.FontFamily!=t)?(i=new fr(null),i.AbstractList=new nr(null),r=new lt(i.AbstractList),r.ListLevelPattern=c.Bullet,r.NumberFormat=n,r.CharacterFormat.FontFamily=t,r.ParagraphFormat.LeftIndent=48,r.ParagraphFormat.FirstLineIndent=-24,i.AbstractList.Levels._Add(r),this.ParagraphFormat._SetList(i),this.ParagraphFormat.ListLevelNumber=0):this.ParagraphFormat.ListLevelNumber=-1},n.prototype._ApplyNumbering=function(n,t){var i=this.ParagraphFormat._GetList(),f=this.Start,u,r;this.IsForward||(f=this.End);u=null;i!=null&&(u=f.Paragraph.ParagraphFormat.ListFormat.ListLevel);i==null||i!=null&&(u.ListLevelPattern!=t||u.NumberFormat!=n)?(i=new fr(null),i.AbstractList=new nr(null),r=new lt(i.AbstractList),r.ListLevelPattern=t,r.NumberFormat=n,r.StartAt=1,r.CharacterFormat.FontFamily="Verdana",r.ParagraphFormat.LeftIndent=48,r.ParagraphFormat.FirstLineIndent=-24,i.AbstractList.Levels._Add(r),this.ParagraphFormat._SetList(i),this.ParagraphFormat.ListLevelNumber=0):this.ParagraphFormat.ListLevelNumber=-1},n.prototype._GetStart=function(){return this.Start==null?"0;0;0":this.Start._GetHierarchicalIndexInternal()},n.prototype._GetEnd=function(){return this.End==null?"0;0;0":this.End._GetHierarchicalIndexInternal()},n.prototype._SelectPositionBy=function(n,t){var i,r;n!=""&&t!=""&&(i=new tt(this.OwnerControl),i._SetPositionForCurrentIndex(n),r=new tt(this.OwnerControl),r._SetPositionForCurrentIndex(t),this._SelectPosition(i,r))},n.prototype._CanMergeSelectedCells=function(){var i,n,t,r,u;return this.IsEmpty||!this.Start.Paragraph.IsInsideTable||!this.End.Paragraph.IsInsideTable?!1:(i=this.Start,n=this.End,this.IsForward||(i=this.End,n=this.Start),t=i.Paragraph.AssociatedCell._GetContainerCellOf(n.Paragraph.AssociatedCell),t.OwnerTable._Contains(n.Paragraph.AssociatedCell)&&!t._Contains(n.Paragraph.AssociatedCell))?(r=i.Paragraph.AssociatedCell._GetSelectedCell(t),u=n.Paragraph.AssociatedCell._GetSelectedCell(t),r.OwnerRow==u.OwnerRow)?!0:r.OwnerTable._CanMergeSelectedCells(this,r,u):!1},n.prototype._UpdateFocus=function(){this.OwnerControl.Viewer.EditableDiv.focus()},n.prototype._ExtendBackward=function(n){this.Start!=null&&(n&&this.SelectionRanges._ClearMultiSelection(),this.End._MoveBackward(),this.UpDownSelectionLength=this.End.Location.X,this._FireSelectionChanged(!0))},n.prototype._ExtendForward=function(n){this.Start!=null&&(n&&this.SelectionRanges._ClearMultiSelection(),this.End._MoveForward(),this.UpDownSelectionLength=this.End.Location.X,this._FireSelectionChanged(!0))},n.prototype._SelectCurrentWord=function(n){var t=this.Start._Clone(),i=this.End._Clone();this._SelectCurrentWordRange(t,i,!1);this._SelectRange(t,i,n)},n.prototype._SelectCurrentWordRange=function(n,t,i){if(n!=null){if(n.Offset>0){var r=n._Clone(),f=0,e=n.Paragraph._GetInline(n.Offset,f),u=e.inline;f=e.index;u!=null&&u instanceof b?n.Offset>2&&(u.FieldSeparator!=null||u.FieldBegin==null)?(r._SetPositionParagraph(r.Paragraph,n.Offset-2),r._MoveToWordEnd(0,!1),r.Paragraph==n.Paragraph&&r.Offset==n.Offset-1||n._MoveToWordStart(2)):n.Offset>3&&u.FieldSeparator==null&&(r._SetPositionParagraph(r.Paragraph,n.Offset-3),r._MoveToWordEnd(0,!1),r.Paragraph==n.Paragraph&&r.Offset==n.Offset||n._MoveToWordStart(2)):(r._SetPositionParagraph(r.Paragraph,n.Offset-1),r._MoveToWordEnd(0,!1),r.Paragraph==n.Paragraph&&r.Offset==n.Offset||n._MoveToWordStart(2))}t._MoveToWordEnd(2,i)}},n.prototype._SelectCurrentParagraph=function(n){this.Start!=null&&(n&&this.SelectionRanges._ClearMultiSelection(),this.Start._MoveToParagraphStart(!1),this.End._MoveToParagraphEnd(!1),this.UpDownSelectionLength=this.End.Location.X,this._FireSelectionChanged(!0))},n.prototype._Select=function(n,t,i,r,u){u&&this.SelectionRanges._ClearMultiSelection();this.Start._SetPositionForSelection(n,t,i,r);this.End._SetPositionInternal(this.Start);this.UpDownSelectionLength=r.X;this._FireSelectionChanged(!0)},n.prototype._SelectRange=function(n,t,i){i&&this.SelectionRanges._ClearMultiSelection();this.Start._SetPositionInternal(n);this.End._SetPositionInternal(t);this.UpDownSelectionLength=this.End.Location.X;this._FireSelectionChanged(!0)},n.prototype._SelectContent=function(n,t){if(n==null)throw new Error("textPosition is null.");t&&this.SelectionRanges._ClearMultiSelection();this.Start._SetPositionInternal(n);this.End._SetPositionInternal(n);this.UpDownSelectionLength=this.End.Location.X;this._FireSelectionChanged(!0)},n.prototype._SelectPosition=function(n,t){if(n==null||t==null)throw new Error("TextPosition cannot be null");if(n.Paragraph==null||n.Paragraph.Document!=this.ownerControl.Document||n.Offset>n.Paragraph._GetLength()+1||n.Paragraph.IsInHeaderFooter)throw new Error("Start TextPosition is not valid.");if(t.Paragraph==null||t.Paragraph.Document!=this.ownerControl.Document||t.Offset>t.Paragraph._GetLength()+1||t.Paragraph.IsInHeaderFooter)throw new Error("End TextPosition is not valid.");var i=n.Paragraph._GetOwnerComment(),r=t.Paragraph._GetOwnerComment();if((i!=null||r!=null)&&i!=r)throw new Error("A text position within comment can be selected with another text position within the same comment only.");n._IsAtSamePosition(t)?this._SelectRange(n,n,!0):(n._IsExistBefore(t)?t._UpdateTextPositionOnFieldCharacter(n):n._UpdateTextPositionOnFieldCharacter(t),this._SelectRange(n,t,!0))},n.prototype._Selects=function(n,t,i){i&&this.SelectionRanges._ClearMultiSelection();this.Start._SetPositionParagraph(n,t);this.End._SetPositionInternal(this.Start);this.UpDownSelectionLength=this.Start.Location.X;this._FireSelectionChanged(!0)},n.prototype._SelectAll=function(){var n,i;if(this.SelectionRanges._ClearMultiSelection(),this._IsInComment()&&this.ownerControl.Viewer instanceof w){var t=this.Start.Paragraph._GetOwnerComment(),r=t._GetFirstParagraph(),u=t.Blocks[t.Blocks.Count-1]._GetLastParagraph();this.Start._SetPositionParagraph(r,r._GetStartOffset());this.End._SetPositionParagraph(u,u._GetEndOffset()+1);this.UpDownSelectionLength=this.End.Location.X;this._FireSelectionChanged(!0);return}n=null;this.OwnerControl.Document!=null&&(n=this.OwnerControl.Document.DocumentStart);n!=null&&(this.Start._SetPositionInternal(n),i=this.OwnerControl.Document.DocumentEnd,this.End._SetPositionParagraph(i.Paragraph,i.Offset+1),this.UpDownSelectionLength=this.End.Location.X,this._FireSelectionChanged(!0))},n.prototype._OnLeftIndent=function(n){this._OnLeftIndentInternal(n,!1)},n.prototype._OnRightIndent=function(n){if(!this.OwnerControl.IsReadOnlyMode&&this.OwnerControl.IsDocumentLoaded){if(this.ownerControl.IsShiftingEnabled=!0,this._InitHistory(i.RightIndent),this.IsEmpty)this._InitHistory(i.RightIndent),this.Start.Paragraph.ParagraphFormat._ApplyPropertyValueInternal(this.CurrentBaseHistoryInfo,"RightIndentProperty",n);else if(this.OwnerControl.Selection.SelectionRanges.Count>0){this._UpdateMultipleSelectionParagraphFormatting(i.RightIndent,n,!1);return}this._Relayout(!1)}},n.prototype._OnFirstLineIndent=function(n){if(this.ownerControl.IsShiftingEnabled=!0,this.IsEmpty)this._InitHistory(i.FirstLineIndent),this.Start.Paragraph.ParagraphFormat._ApplyPropertyValueInternal(this.CurrentBaseHistoryInfo,"FirstLineIndentProperty",n);else if(this.OwnerControl.Selection.SelectionRanges.Count>0){this._UpdateMultipleSelectionParagraphFormatting(i.FirstLineIndent,n,!1);return}this._Relayout(!1)},n.prototype._OnBeforeSpacing=function(n){if(this.ownerControl.IsShiftingEnabled=!0,this.IsEmpty)this._InitHistory(i.BeforeSpacing),this.Start.Paragraph.ParagraphFormat._ApplyPropertyValueInternal(this.CurrentBaseHistoryInfo,"BeforeSpacingProperty",n);else if(this.OwnerControl.Selection.SelectionRanges.Count>0){this._UpdateMultipleSelectionParagraphFormatting(i.BeforeSpacing,n,!1);return}this._Relayout(!1)},n.prototype._OnAfterSpacing=function(n){if(this.ownerControl.IsShiftingEnabled=!0,this.IsEmpty&&(this._InitHistory(i.AfterSpacing),this.Start.Paragraph.ParagraphFormat._ApplyPropertyValueInternal(this.CurrentBaseHistoryInfo,"AfterSpacingProperty",n)),this.OwnerControl.Selection.SelectionRanges.Count>0){this._UpdateMultipleSelectionParagraphFormatting(i.AfterSpacing,n,!1);return}this._Relayout(!1)},n.prototype._OnTextAlignment=function(n){if(!this.OwnerControl.IsReadOnlyMode&&this.OwnerControl.IsDocumentLoaded){if(this.ownerControl.IsShiftingEnabled=!0,this.IsEmpty)this._InitHistory(i.TextAlignment),this.Start.Paragraph.ParagraphFormat._ApplyPropertyValueInternal(this.CurrentBaseHistoryInfo,a.TextAlignmentProperty,n);else if(this.OwnerControl.Selection.SelectionRanges.Count>0){this._UpdateMultipleSelectionParagraphFormatting(i.TextAlignment,n,!1);return}this._Relayout(!1)}},n.prototype._OnLineSpacing=function(n){if(!this.OwnerControl.IsReadOnlyMode&&this.OwnerControl.IsDocumentLoaded){if(this.ownerControl.IsShiftingEnabled=!0,this._InitHistory(i.LineSpacing),this.IsEmpty)this._InitHistory(i.LineSpacing),this.Start.Paragraph.ParagraphFormat._ApplyPropertyValueInternal(this.CurrentBaseHistoryInfo,a.LineSpacingProperty,n);else if(this.OwnerControl.Selection.SelectionRanges.Count>0){this._UpdateMultipleSelectionParagraphFormatting(i.LineSpacing,n,!1);return}this._Relayout(!1)}},n.prototype._OnLineSpacingType=function(n){if(!this.OwnerControl.IsReadOnlyMode&&this.OwnerControl.IsDocumentLoaded){if(this.ownerControl.IsShiftingEnabled=!0,this._InitHistory(i.LineSpacingType),this.IsEmpty)this._InitHistory(i.LineSpacingType),this.Start.Paragraph.ParagraphFormat._ApplyPropertyValueInternal(this.CurrentBaseHistoryInfo,a.LineSpacingTypeProperty,n);else if(this.OwnerControl.Selection.SelectionRanges.Count>0){this._UpdateMultipleSelectionParagraphFormatting(i.LineSpacingType,n,!1);return}this._Relayout(!1)}},n.prototype._OnLeftIndentInternal=function(n,t){if(!this.OwnerControl.IsReadOnlyMode&&this.OwnerControl.IsDocumentLoaded){if(this.ownerControl.IsShiftingEnabled=!0,this.IsEmpty)t&&(n=this._GetIndentIncrementValue(this.Start.Paragraph,n)),this._InitHistory(i.LeftIndent),this.Start.Paragraph.ParagraphFormat._ApplyPropertyValue(this.CurrentBaseHistoryInfo,a.LeftIndentProperty,n,t);else if(this.OwnerControl.Selection.SelectionRanges.Count>0){this._UpdateMultipleSelectionParagraphFormatting(i.LeftIndent,n,t);return}this._Relayout(!1)}},n.prototype._OnApplyListInternal=function(n){var t=new bi(null);if(n!=null&&(t.List=n),t.ListId=n.ListId,this.OwnerControl.IsShiftingEnabled=!0,this.IsEmpty)this._InitHistory(i.ListFormat),this.Start.Paragraph.ParagraphFormat._ApplyPropertyValueInternal(this.CurrentBaseHistoryInfo,a.ListFormatProperty,t);else if(this.OwnerControl.Selection.SelectionRanges.Count>0){this._UpdateMultipleSelectionParagraphFormatting(i.ListFormat,t,!1);return}this._Relayout(!1)},n.prototype._OnCharacterFormat=function(n){if(this.IsEmpty){this.Start.Offset==this.Start.Paragraph._GetLength()&&(this._InitHistory(i.CharacterFormat),this.Start.Paragraph.CharacterFormat._ApplyPropertyValueInternal(this.CurrentBaseHistoryInfo,null,n),this._UpdateHistory(),this._FireContentChanged());this._UpdateFocus();return}this.OwnerControl.Selection.SelectionRanges.Count>0&&this._UpdateMultipleSelectionCharacterFormatting(i.CharacterFormat,n,!1)},n.prototype._UpdateMultipleSelectionParagraphFormatting=function(n,t,r){var f,u;for(this._InitComplexHistory(i.MultiSelection),f=0;f<this.OwnerControl.Selection.SelectionRanges.Count;f++)u=this.OwnerControl.Selection.SelectionRanges._Get(f),n==i.LeftIndent&&r&&(t=u.Start!=null&&u.Start._IsExistBefore(u.End)?this._GetIndentIncrementValue(u.Start.Paragraph,t):this._GetIndentIncrementValue(u.End.Paragraph,t)),this._UpdateParagraphFormat(u,n,t,r),this.OwnerControl.Viewer.BlockToShift!=null&&this.OwnerControl.Viewer.BlockToShift._Layout(),this._Relayout(!1);this._UpdateComplexHistory()},n.prototype._UpdateMultipleSelectionTableFormatting=function(n,t){var r,u;for(this._InitComplexHistory(i.MultiSelection),r=0;r<this.OwnerControl.Selection.SelectionRanges.Count;r++)u=this.OwnerControl.Selection.SelectionRanges[r],this._GetTable(u.Start,u.End)!=null&&(this._UpdateTableFormat(u,n,t),this.OwnerControl.Viewer.BlockToShift!=null&&this.OwnerControl.Viewer.BlockToShift._Layout(),this._Relayout(!1));this._UpdateComplexHistory()},n.prototype._UpdateParagraphFormat=function(n,t,r,u){switch(t){case i.AfterSpacing:this._InitializeHistory(i.AfterSpacing,n);this._UpdateParagraphFormats(n,a.AfterSpacingProperty,r);break;case i.BeforeSpacing:this._InitializeHistory(i.BeforeSpacing,n);this._UpdateParagraphFormats(n,a.BeforeSpacingProperty,r);break;case i.RightIndent:this._InitializeHistory(i.RightIndent,n);this._UpdateParagraphFormats(n,a.RightIndentProperty,r);break;case i.LeftIndent:this._InitializeHistory(i.LeftIndent,n);this._UpdateParagraphFormatInternal(n,a.LeftIndentProperty,r,u);break;case i.FirstLineIndent:this._InitializeHistory(i.FirstLineIndent,n);this._UpdateParagraphFormats(n,a.FirstLineIndentProperty,r);break;case i.LineSpacing:this._InitializeHistory(i.LineSpacing,n);this._UpdateParagraphFormats(n,a.LineSpacingProperty,r);break;case i.LineSpacingType:this._InitializeHistory(i.LineSpacingType,n);this._UpdateParagraphFormats(n,a.LineSpacingTypeProperty,r);break;case i.TextAlignment:this._InitializeHistory(i.TextAlignment,n);this._UpdateParagraphFormats(n,a.TextAlignmentProperty,r);break;case i.ListFormat:this._InitializeHistory(i.ListFormat,n);this._UpdateParagraphFormats(n,a.ListFormatProperty,r);break;case i.ParagraphFormat:this._InitializeHistory(i.ParagraphFormat,n);this._UpdateParagraphFormats(n,null,r)}},n.prototype._UpdateParagraphFormats=function(n,t,i){this._UpdateParagraphFormatInternal(n,t,i,!1)},n.prototype._UpdateParagraphFormatInternal=function(n,t,i,r){var u=n.Start,f=n.End;n.IsForward||(u=n.End,f=n.Start);this.CurrentBaseHistoryInfo.InsertPosition==null&&(this.CurrentBaseHistoryInfo.InsertPosition=u._GetHierarchicalIndexInternal());u.Paragraph._ApplyParagraphFormatForSelection(this,u,f,t,i,r)},n.prototype._GetIndentIncrementValue=function(n,t){var i=n.ParagraphFormat.LeftIndent,r;return i<0?t<0||i+t>=0?-i:(r=-this._GetIndentIncrementValueInternal(-i,-t),r%t==0?r:r+t):this._GetIndentIncrementValueInternal(i,t)},n.prototype._GetIndentIncrementValueInternal=function(n,t){var i=Math.abs(t);if(n==0||i==0)return t>0?i:0;var u=Math.round(n)*100%(Math.round(i)*100)/100,f=(Math.round(n)-u)/Math.round(i),r=f*i;return t>0&&(r+=i),r-n==0?t:r-n},n.prototype._SelectParagraph=function(n,t,i){if(i&&this.SelectionRanges._ClearMultiSelection(),t)this.Start._SetPosition(n,t);else{var r=n._GetEndOffset();this.Start._SetPositionParagraph(n,r)}this.End._SetPositionInternal(this.Start);this.UpDownSelectionLength=this.Start.Location.X;this._FireSelectionChanged(!0)},n.prototype._OnPageSizeChanged=function(n){this._InitHistory(i.PageSize);this._UpdateSectionFormat("PageSizeProperty",n)},n.prototype._OnPageMarginChanged=function(n){this._InitHistory(i.PageMargin);this._UpdateSectionFormat("PageMarginProperty",n)},n.prototype._OnTableAlignment=function(n){if(this.ownerControl.IsShiftingEnabled=!0,this.IsEmpty)this._InitHistory(i.TableAlignment),this.Start.Paragraph.AssociatedCell.OwnerTable.TableFormat._ApplyPropertyValue(this.CurrentBaseHistoryInfo,at.TableAlignmentProperty,n);else if(this.OwnerControl.Selection.SelectionRanges.Count>0){this._UpdateMultipleSelectionTableFormatting(i.TableAlignment,n);return}this._Relayout(!1)},n.prototype._OnTableLeftIndent=function(n){if(this.ownerControl.IsShiftingEnabled=!0,this.IsEmpty)this._InitHistory(i.TableLeftIndent),this.Start.Paragraph.AssociatedCell.OwnerTable.TableFormat._ApplyPropertyValue(this.CurrentBaseHistoryInfo,at.LeftIndentProperty,n);else if(this.OwnerControl.Selection.SelectionRanges.Count>0){this._UpdateMultipleSelectionTableFormatting(i.TableLeftIndent,n);return}this._Relayout(!1)},n.prototype._OnCellSpacing=function(n){if(this.ownerControl.IsShiftingEnabled=!0,this.IsEmpty)this._InitHistory(i.CellSpacing),this.Start.Paragraph.AssociatedCell.OwnerTable.TableFormat._ApplyPropertyValue(this.CurrentBaseHistoryInfo,at.CellSpacingProperty,n);else if(this.OwnerControl.Selection.SelectionRanges.Count>0){this._UpdateMultipleSelectionTableFormatting(i.CellSpacing,n);return}this._Relayout(!1)},n.prototype._OnDefaultCellLeftMargin=function(n){if(this.ownerControl.IsShiftingEnabled=!0,this.IsEmpty)this._InitHistory(i.DefaultCellLeftMargin),this.Start.Paragraph.AssociatedCell.OwnerTable.TableFormat._ApplyPropertyValue(this.CurrentBaseHistoryInfo,at.LeftMarginProperty,n);else if(this.OwnerControl.Selection.SelectionRanges.Count>0){this._UpdateMultipleSelectionTableFormatting(i.DefaultCellLeftMargin,n);return}this._Relayout(!1)},n.prototype._OnDefaultCellRightMargin=function(n){if(this.ownerControl.IsShiftingEnabled=!0,this.IsEmpty)this._InitHistory(i.DefaultCellRightMargin),this.Start.Paragraph.AssociatedCell.OwnerTable.TableFormat._ApplyPropertyValue(this.CurrentBaseHistoryInfo,at.RightMarginProperty,n);else if(this.OwnerControl.Selection.SelectionRanges.Count>0){this._UpdateMultipleSelectionTableFormatting(i.DefaultCellRightMargin,n);return}this._Relayout(!1)},n.prototype._OnDefaultCellTopMargin=function(n){if(this.ownerControl.IsShiftingEnabled=!0,this.IsEmpty)this._InitHistory(i.DefaultCellTopMargin),this.Start.Paragraph.AssociatedCell.OwnerTable.TableFormat._ApplyPropertyValue(this.CurrentBaseHistoryInfo,at.TopMarginProperty,n);else if(this.OwnerControl.Selection.SelectionRanges.Count>0){this._UpdateMultipleSelectionTableFormatting(i.DefaultCellTopMargin,n);return}this._Relayout(!1)},n.prototype._OnDefaultCellBottomMargin=function(n){if(this.ownerControl.IsShiftingEnabled=!0,this.IsEmpty)this._InitHistory(i.DefaultCellBottomMargin),this.Start.Paragraph.AssociatedCell.OwnerTable.TableFormat._ApplyPropertyValue(this.CurrentBaseHistoryInfo,at.BottomMarginProperty,n);else if(this.OwnerControl.Selection.SelectionRanges.Count>0){this._UpdateMultipleSelectionTableFormatting(i.DefaultCellBottomMargin,n);return}this._Relayout(!1)},n.prototype._OnCellContentVerticalAlignment=function(n){if(this.ownerControl.IsShiftingEnabled=!0,this.IsEmpty)this._InitHistory(i.CellContentVerticalAlignment),this.Start.Paragraph.AssociatedCell.CellFormat._ApplyPropertyValue(this.CurrentBaseHistoryInfo,ai.VerticalAlignmentProperty,n);else if(this.OwnerControl.Selection.SelectionRanges.Count>0){this._UpdateMultipleSelectionTableFormatting(i.CellContentVerticalAlignment,n);return}this._Relayout(!1)},n.prototype._OnCellLeftMargin=function(n){if(this.ownerControl.IsShiftingEnabled=!0,this.IsEmpty)this._InitHistory(i.CellLeftMargin),this.Start.Paragraph.AssociatedCell.CellFormat._ApplyPropertyValue(this.CurrentBaseHistoryInfo,ai.LeftMarginProperty,n);else if(this.OwnerControl.Selection.SelectionRanges.Count>0){this._UpdateMultipleSelectionTableFormatting(i.CellLeftMargin,n);return}this._Relayout(!1)},n.prototype._OnCellRightMargin=function(n){if(this.ownerControl.IsShiftingEnabled=!0,this.IsEmpty)this._InitHistory(i.CellRightMargin),this.Start.Paragraph.AssociatedCell.CellFormat._ApplyPropertyValue(this.CurrentBaseHistoryInfo,ai.RightMarginProperty,n);else if(this.OwnerControl.Selection.SelectionRanges.Count>0){this._UpdateMultipleSelectionTableFormatting(i.CellRightMargin,n);return}this._Relayout(!1)},n.prototype._OnCellTopMargin=function(n){if(this.ownerControl.IsShiftingEnabled=!0,this.IsEmpty)this._InitHistory(i.CellTopMargin),this.Start.Paragraph.AssociatedCell.CellFormat._ApplyPropertyValue(this.CurrentBaseHistoryInfo,ai.TopMarginProperty,n);else if(this.OwnerControl.Selection.SelectionRanges.Count>0){this._UpdateMultipleSelectionTableFormatting(i.CellTopMargin,n);return}this._Relayout(!1)},n.prototype._OnCellBottomMargin=function(n){if(this.ownerControl.IsShiftingEnabled=!0,this.IsEmpty)this._InitHistory(i.CellTopMargin),this.Start.Paragraph.AssociatedCell.CellFormat._ApplyPropertyValue(this.CurrentBaseHistoryInfo,ai.BottomMarginProperty,n);else if(this.OwnerControl.Selection.SelectionRanges.Count>0){this._UpdateMultipleSelectionTableFormatting(i.CellBottomtMargin,n);return}this._Relayout(!1)},n.prototype._OnRowHeight=function(n){if(this.ownerControl.IsShiftingEnabled=!0,this.IsEmpty)this._InitHistory(i.CellTopMargin),this.Start.Paragraph.AssociatedCell.OwnerRow.RowFormat._ApplyPropertyValue(this.CurrentBaseHistoryInfo,tr.HeightProperty,n);else if(this.OwnerControl.Selection.SelectionRanges.Count>0){this._UpdateMultipleSelectionTableFormatting(i.RowHeight,n);return}this._Relayout(!1)},n.prototype._OnRowHeightType=function(n){if(this.ownerControl.IsShiftingEnabled=!0,this.IsEmpty)this._InitHistory(i.CellTopMargin),this.Start.Paragraph.AssociatedCell.OwnerRow.RowFormat._ApplyPropertyValue(this.CurrentBaseHistoryInfo,tr.HeightTypeProperty,n);else if(this.OwnerControl.Selection.SelectionRanges.Count>0){this._UpdateMultipleSelectionTableFormatting(i.RowHeightType,n);return}this._Relayout(!1)},n.prototype._OnHeader=function(n){if(this.ownerControl.IsShiftingEnabled=!0,this.IsEmpty)this._InitHistory(i.CellTopMargin),this.Start.Paragraph.AssociatedCell.OwnerRow.RowFormat._ApplyPropertyValue(this.CurrentBaseHistoryInfo,tr.IsHeaderProperty,n);else if(this.OwnerControl.Selection.SelectionRanges.Count>0){this._UpdateMultipleSelectionTableFormatting(i.RowHeader,n);return}this._Relayout(!1)},n.prototype._OnAllowBreakAcrossPages=function(n){if(this.ownerControl.IsShiftingEnabled=!0,this.IsEmpty)this._InitHistory(i.CellTopMargin),this.Start.Paragraph.AssociatedCell.OwnerRow.RowFormat._ApplyPropertyValue(this.CurrentBaseHistoryInfo,tr.AllowBreakAcrossPagesProperty,n);else if(this.OwnerControl.Selection.SelectionRanges.Count>0){this._UpdateMultipleSelectionTableFormatting(i.AllowBreakAcrossPages,n);return}this._Relayout(!1)},n.prototype._UpdateSectionFormat=function(n,t){var r,u,f,e,i;for(this.OwnerControl.IsShiftingEnabled=!0,r=this.Start,u=this.End,this.IsForward||(r=this.End,u=this.Start),this.CurrentBaseHistoryInfo.InsertPosition==null&&(this.CurrentBaseHistoryInfo.InsertPosition=r._GetHierarchicalIndexInternal()),f=this.ownerControl.Document.Sections._IndexOf(this.Start.Paragraph.Section),e=this.ownerControl.Document.Sections._IndexOf(this.End.Paragraph.Section),i=f;i<=e;i++)this.ownerControl.Document.Sections[i].SectionFormat._ApplyPropertyValue(this.CurrentBaseHistoryInfo,n,t);this._UpdateHistory()},n.prototype._UpdatePhysicalPosition=function(){this.Start!=null&&this.Start._UpdatePhysicalPosition();this.End!=null&&this.End._UpdatePhysicalPosition()},n.prototype._FireSelectionChanged=function(n){this.IsEmpty||(this.IsForward?(this.Start._UpdatePhysicalPositionInternal(!0),this.End._UpdatePhysicalPositionInternal(!1)):(this.Start._UpdatePhysicalPositionInternal(!1),this.End._UpdatePhysicalPositionInternal(!0)));this.SkipFormatRetrieval||this._RetrieveCurrentFormatProperties();this.ownerControl.Viewer._ClearSelectionHighlight();this.OwnerControl.IsLayoutEnabled&&!this.OwnerControl.IsShiftingEnabled&&this._HighlightSelection(n);n&&this.OwnerControl._RaiseClientEvent(kr.SelectionChange,null)},n.prototype._FireContentChanged=function(){this.OwnerControl.IsLayoutEnabled&&!this.OwnerControl.IsShiftingEnabled&&this.OwnerControl._RaiseClientEvent(kr.ContentChange,null)},n.prototype._HighlightSelection=function(n){var r,u,i,t;if(this._HighlightSelectedComment(),this.OwnerControl.Viewer._HideImageResizer(),this._IsInComment()&&(this.IsSelectingComment=!0),this.IsEmpty)this.OwnerControl.Viewer._UpdateCaretPosition();else{if(r=!1,r=this.OwnerControl.Viewer.isControlPressed,u=!0,u=!r||!this.ownerControl.Viewer.isMousedown,this.SelectionRanges.Count>0&&u)for(i=0;i<this.SelectionRanges.Count;i++)t=this.SelectionRanges._Get(i),t.IsForward?t.Start.Paragraph._HighlightSelectedContent(this,t,t.Start,t.End):t.End.Paragraph._HighlightSelectedContent(this,t,t.End,t.Start);else this.IsForward?this.Start.Paragraph._HighlightSelectedContent(this,this.CurrentSelectionRange,this.Start,this.End):this.End.Paragraph._HighlightSelectedContent(this,this.CurrentSelectionRange,this.End,this.Start);this.OwnerControl.Viewer._UpdateTouchMarkPosition()}n&&this.OwnerControl.Viewer._ScrollToPosition(this.Start,this.End);this.IsSelectingComment=!1},n.prototype._HighlightSelectedComment=function(){var n,t,i,r;if(this._IsInComment()&&(n=this.Start.Paragraph._GetOwnerComment(),n.LayoutedWidget!=null&&n.LayoutedWidget.Page!=null)){if(t=new tt(this.OwnerControl),i=new tt(this.OwnerControl),t._SetPositionParagraph(n.OwnerParagraph,n.OwnerParagraph._GetOffset(n,0)),i._SetPositionParagraph(n.OwnerParagraph,n.OwnerParagraph._GetOffset(n,n.Length)),n.CommentStart!=null&&n.CommentEnd!=null&&n.CommentStart.OwnerParagraph!=null&&n.CommentEnd.OwnerParagraph!=null&&(t._SetPositionParagraph(n.CommentStart.OwnerParagraph,n.CommentStart.OwnerParagraph._GetOffset(n.CommentStart,0)),i._SetPositionParagraph(n.CommentEnd.OwnerParagraph,n.CommentEnd.OwnerParagraph._GetOffset(n.CommentEnd,1))),this.IsHighlightingCommentRange=!0,this.OwnerControl.Selection.SelectionRanges.Count>0)for(r=0;r<this.OwnerControl.Selection.SelectionRanges.Count;r++){var e=this.OwnerControl.Selection.SelectionRanges._Get(r),o=0,s=null,u=null,f=t.Paragraph._GetStartLineWidget(t,s,o);s=f.startElement;o=f.lineIndex;u=f.lineWidget;e.SelectedWidgets._ContainsKey(u)&&e.SelectedWidgets._Remove(u)}t.Paragraph._HighlightSelectedContent(this,this.CurrentSelectionRange,t,i);this.NeedToRenderMarker=!0;this.IsHighlightingCommentRange=!1}},n.prototype._IsInComment=function(){return this.Start!=null&&this.Start.Paragraph._IsInComment()&&this.End.Paragraph._IsInComment()},n.prototype._CreateHighlightBorder=function(n,t,i,r,u){var e=null,o,f;this._IsInComment()&&(e=this.Start.Paragraph._GetOwnerComment());i<0&&(i=0);var s=this.OwnerControl.Viewer instanceof st?this.OwnerControl.Viewer.CurrentRenderingPage:t.CurrentParagraphWidget._GetPage(),l=t.Height,h=null,c=document.getElementById(s.Id+"_selection");n.SelectedWidgets._ContainsKey(t)||this.IsHighlightingCommentRange?!this.OwnerControl.Viewer.SelectedCommentRangeWidget._ContainsKey(t)&&this.IsHighlightingCommentRange&&(h=new iu(r,i),this.OwnerControl.Viewer.SelectedCommentRangeWidget._Add(t,h)):(h=new iu(r,i),n.SelectedWidgets._Add(t,h));this.IsHighlightingCommentRange&&this.NeedToRenderMarker&&(s==e.LayoutedWidget.Page&&this.ownerControl.Viewer.CommentRangeWidget==null||t.Children._Contains(e.Elements[0]))&&(this.NeedToRenderMarker=!1,o=s.BoundingRectangle.Right-s.ReviewPanelWidth-s.BoundingRectangle.Left-40,this.OwnerControl.Viewer.CommentRangeWidget=new bf(t),this.OwnerControl.Viewer.CommentRangeWidget.CommentRangeMarker=new lr(r,u,o,u),this.OwnerControl.Viewer.CommentRangeWidget.CommentRangeLinker=new lr(o,u,o+40,e.LayoutedWidget.Y+12),c!=null&&(f=c.getContext("2d"),f.beginPath(),f.moveTo(r,u+.5),f.lineTo(o,u+.5),f.moveTo(o,u+.5),f.lineTo(o+40,e.LayoutedWidget.Y+12.5),f.lineWidth=.5,f.strokeStyle="#19c7ff",f.globalAlpha=1,f.stroke()));this.IsSelectingComment&&!this.IsEmpty&&(r=r+e.LayoutedWidget.X,u=u+e.LayoutedWidget.Y);c!=null&&(f=c.getContext("2d"),f.fillStyle=this.IsHighlightingCommentRange?"#67CCEC":"gray",f.globalAlpha=.4,f.fillRect(r,u,i,l))},n.prototype._CreateHighlightBorderInsideTable=function(n,t,i){var f=null,s,r;this._IsInComment()&&(f=this.Start.Paragraph._GetOwnerComment());var h=this.ownerControl.Viewer instanceof st?this.OwnerControl.Viewer.CurrentRenderingPage:n._GetPage(),c=document.getElementById(h.Id+"_selection"),e=null,o=n.X-n.Margin.Left+n.LeftBorderWidth,l=n.Width+n.Margin.Left+n.Margin.Right-n.LeftBorderWidth-n.RightBorderWidth,u=n.Y,a=n.Height;i.SelectedWidgets._ContainsKey(n)&&!this.IsHighlightingCommentRange?(e=i.SelectedWidgets._Get(n),c!=null&&(r=c.getContext("2d"),r.clearRect(e.Left,u,e.Width,a))):this.IsHighlightingCommentRange?!this.OwnerControl.Viewer.SelectedCommentRangeWidget._ContainsKey(n)&&this.IsHighlightingCommentRange&&(e=new iu(o,l),this.OwnerControl.Viewer.SelectedCommentRangeWidget._Add(n,e)):(e=new iu(o,l),i.SelectedWidgets._Add(n,e));this.IsHighlightingCommentRange&&this.NeedToRenderMarker&&(h==f.LayoutedWidget.Page&&this.ownerControl.Viewer.CommentRangeWidget==null||n.ChildWidgets._Contains(f.Elements[0]))&&(this.NeedToRenderMarker=!1,s=h.BoundingRectangle.Right-h.ReviewPanelWidth-h.BoundingRectangle.Left-40,this.OwnerControl.Viewer.CommentRangeWidget=new bf(n),this.OwnerControl.Viewer.CommentRangeWidget.CommentRangeMarker=new lr(o,u,s,u),this.OwnerControl.Viewer.CommentRangeWidget.CommentRangeLinker=new lr(s,u,s+40,f.LayoutedWidget.Y+12),r=c.getContext("2d"),r.beginPath(),r.moveTo(o,u+.5),r.lineTo(s,u+.5),r.moveTo(s,u+.5),r.lineTo(s+40,f.LayoutedWidget.Y+12.5),r.lineWidth=.5,r.strokeStyle="#19c7ff",r.globalAlpha=1,r.stroke());this.IsSelectingComment&&!this.IsEmpty&&(o=o+f.LayoutedWidget.X,u=u+f.LayoutedWidget.Y);c!=null&&(r=c.getContext("2d"),r.fillStyle="gray",r.globalAlpha=.4,r.fillRect(o,u,l,a))},n.prototype._MoveTextPosition=function(n,t,i){var o,s,h,c,f,e;if(this.Start!=null){if(t&&this.selectionRanges._ClearMultiSelection(),o=this.OwnerControl.Viewer._GetLineWidgetInternal(n,!0),o!=null&&o._UpdateTextPositionWidget(this.OwnerControl,n,i,!0),this.UpDownSelectionLength=i.Location.X,s=i.Paragraph._GetLength(),!this.IsEmpty&&!this.IsForward&&i.Offset>s){var u=0,l=i.Paragraph._GetInline(s,u),r=l.inline;u=l.index;h=i.Paragraph;c=0;r!=null&&(r=r._GetPreviousValidInline(),u=r instanceof y?0:r.Length,r instanceof b&&u++,c=r.OwnerParagraph._GetOffset(r,u),h=r.OwnerParagraph);i._SetPositionParagraph(h,c)}f=this.Start._GetHierarchicalIndexInternal();e=this.End._GetHierarchicalIndexInternal();f!=e&&(tt._IsForwardSelection(f,e)?i._ValidateForwardFieldSelection(f,e):i._ValidateBackwardFieldSelection(f,e));this._FireSelectionChanged(!0)}},n.prototype._ExtendToWordStart=function(n,t){this.Start!=null&&(t&&this.SelectionRanges._ClearMultiSelection(),(this.Start.Paragraph.IsInsideTable||this.End.Paragraph.IsInsideTable)&&(this.Start.Paragraph.AssociatedCell!=this.End.Paragraph.AssociatedCell||this.Start.Paragraph.AssociatedCell._IsCellSelected(this.Start,this.End))?this.End._MoveToPreviousParagraphInTable():this.End._MoveToWordStart(n?0:1),n&&this.Start._SetPositionInternal(this.End),this.UpDownSelectionLength=this.End.Location.X,this._FireSelectionChanged(!0))},n.prototype._ExtendToWordEnd=function(n,t){this.Start!=null&&(t&&this.SelectionRanges._ClearMultiSelection(),(this.Start.Paragraph.IsInsideTable||this.End.Paragraph.IsInsideTable)&&(this.Start.Paragraph.AssociatedCell!=this.End.Paragraph.AssociatedCell||this.Start.Paragraph.AssociatedCell._IsCellSelected(this.Start,this.End))?this.End._MoveToNextParagraphInTable():this.End._MoveToWordEnd(n?0:1,!1),n&&this.Start._SetPositionInternal(this.End),this.UpDownSelectionLength=this.End.Location.X,this._FireSelectionChanged(!0))},n.prototype._ExtendToLineStart=function(n){this.Start!=null&&(n&&this.SelectionRanges._ClearMultiSelection(),this.End._MoveToLineStart(!0),this.UpDownSelectionLength=this.End.Location.X,this._FireSelectionChanged(!0))},n.prototype._ExtendToLineEnd=function(n){this.Start!=null&&(n&&this.SelectionRanges._ClearMultiSelection(),this.End._MoveToLineEnd(!0),this.UpDownSelectionLength=this.End.Location.X,this._FireSelectionChanged(!0))},n.prototype._ExtendToParagraphStart=function(n){this.Start!=null&&(n&&this.SelectionRanges._ClearMultiSelection(),this.End._MoveToParagraphStart(!0),this.UpDownSelectionLength=this.End.Location.X,this._FireSelectionChanged(!0))},n.prototype._ExtendToParagraphEnd=function(n){this.Start!=null&&(n&&this.SelectionRanges._ClearMultiSelection(),this.End._MoveToParagraphEnd(!0),this.UpDownSelectionLength=this.End.Location.X,this._FireSelectionChanged(!0))},n.prototype._ExtendToPreviousLine=function(n){this.Start!=null&&(n&&this.SelectionRanges._ClearMultiSelection(),this.End._MoveToPreviousLine(this.UpDownSelectionLength),this._FireSelectionChanged(!0))},n.prototype._ExtendToNextLine=function(n){this.Start!=null&&(n&&this.SelectionRanges._ClearMultiSelection(),this.End._MoveToNextLine(this.UpDownSelectionLength),this._FireSelectionChanged(!0))},n.prototype._MoveToPreviousParagraph=function(n){this.Start!=null&&(n&&this.SelectionRanges._ClearMultiSelection(),this.End._MoveToPreviousParagraph(),this.Start._SetPositionInternal(this.End),this.UpDownSelectionLength=this.End.Location.X,this._FireSelectionChanged(!0))},n.prototype._MoveToNextParagraph=function(n){this.Start!=null&&(n&&this.SelectionRanges._ClearMultiSelection(),this.End._MoveToNextParagraph(),this.Start._SetPositionInternal(this.End),this.UpDownSelectionLength=this.End.Location.X,this._FireSelectionChanged(!0))},n.prototype._MoveUp=function(n){this.Start!=null&&(n&&this.SelectionRanges._ClearMultiSelection(),this.IsEmpty||(this.IsForward?this.End._SetPositionInternal(this.Start):this.Start._SetPositionInternal(this.End),this.UpDownSelectionLength=this.Start.Location.X),this.Start._MoveUp(this.UpDownSelectionLength),this.End._SetPositionInternal(this.Start),this._FireSelectionChanged(!0))},n.prototype._MoveDown=function(n){this.Start!=null&&(n&&this.SelectionRanges._ClearMultiSelection(),this.IsEmpty||(this.IsForward?this.Start._SetPositionInternal(this.End):this.End._SetPositionInternal(this.Start),this.UpDownSelectionLength=this.Start.Location.X),this.Start._MoveDown(this.UpDownSelectionLength),this.End._SetPositionInternal(this.Start),this._FireSelectionChanged(!0))},n.prototype._MoveNextPosition=function(n){this.Start!=null&&(n&&this.SelectionRanges._ClearMultiSelection(),this.IsEmpty?(this.Start._MoveNextPosition(),this.End._SetPositionInternal(this.Start)):this.IsForward?this.Start._SetPositionInternal(this.End):this.End._SetPositionInternal(this.Start),this.UpDownSelectionLength=this.Start.Location.X,this._FireSelectionChanged(!0))},n.prototype._MovePreviousPosition=function(n){this.Start!=null&&(n&&this.SelectionRanges._ClearMultiSelection(),this.IsEmpty?(this.Start._MovePreviousPosition(),this.End._SetPositionInternal(this.Start)):this.IsForward?this.End._SetPositionInternal(this.Start):this.Start._SetPositionInternal(this.End),this.UpDownSelectionLength=this.Start.Location.X,this._FireSelectionChanged(!0))},n.prototype._MoveToLineStart=function(n){this.Start!=null&&(n&&this.SelectionRanges._ClearMultiSelection(),this.IsEmpty||(this.IsForward?this.End._SetPositionInternal(this.Start):this.Start._SetPositionInternal(this.End)),this.Start._MoveToLineStart(!1),this.End._SetPositionInternal(this.Start),this.UpDownSelectionLength=this.Start.Location.X,this._FireSelectionChanged(!0))},n.prototype._MoveToLineEnd=function(n){this.Start!=null&&(n&&this.SelectionRanges._ClearMultiSelection(),this.IsEmpty||(this.IsForward?this.Start._SetPositionInternal(this.End):this.End._SetPositionInternal(this.Start)),this.Start._MoveToLineEnd(!1),this.End._SetPositionInternal(this.Start),this.UpDownSelectionLength=this.Start.Location.X,this._FireSelectionChanged(!0))},n.prototype._Cut=function(){this.OwnerControl.IsReadOnlyMode||this.IsEmpty||(this._CopySelectedContent(!0),this._Relayout(!0),this._UpdateFocus())},n.prototype._Copy=function(){this.IsEmpty||(this._CopySelectedContent(!1),this._UpdateFocus())},n.prototype._PasteDocContent=function(n){var t=this,i={};i.HtmlString=n;$.ajax({type:"POST",timeout:t.OwnerControl._pasteTimeOut,url:t.OwnerControl.DocumentEditor.model.importExportSettings.importHtmlUrl,crossDomain:!0,contentType:"application/json; charset=utf-8",data:JSON.stringify(i),traditional:!0,async:!0,success:function(n){var i=t.OwnerControl._parseDocumentInternal(JSON.parse(n));t.OwnerControl.IsReadOnlyInternal=!1;t.OwnerControl.Viewer.ViewerContatiner.focus();t._PasteContents(i);t.OwnerControl.Viewer.EditableDiv.innerHTML="";t.OwnerControl.Viewer.ViewerContatiner.style.cursor="default"},error:function(){t.OwnerControl.IsReadOnlyInternal=!1;t.OwnerControl.Viewer.ViewerContatiner.style.cursor="default";alert("Paste Operation Timed out")}})},n.prototype._Paste=function(n){var i;this.OwnerControl.Viewer.ViewerContatiner.style.cursor="wait";i=window;this.OwnerControl.IsReadOnlyInternal=!0;var r="",t="",u=i.clipboardData?i.clipboardData:n.clipboardData;r=u.getData("Text");this.OwnerControl.ej.browserInfo().name!="msie"&&(t=u.getData("Text/Html"),(t.substring(5,48)==' xmlns:o="urn:schemas-microsoft-com:office:'||t.substring(0,5)!="<html")&&(t=""));t!=""?(t=t.replace(/<!--StartFragment-->/gi,""),t=t.replace(/<!--EndFragment-->/gi,""),t=t.replace(/<div>/gi,""),t=t.replace(/<\/div>/gi,""),this._PasteDocContent(t)):r!=""&&(this.OwnerControl.IsReadOnlyInternal=!1,this.OwnerControl.Viewer.ViewerContatiner.focus(),this._PasteContents(r),this.OwnerControl.Viewer.ViewerContatiner.style.cursor="default",this.OwnerControl.Viewer.EditableDiv.innerHTML="");this._UpdateFocus()},n.prototype._PasteInternal=function(){var t=this.OwnerControl,n;di.htmlString!=""&&di.htmlString!=null&&(n=ve._ParseHTMLtoLogicalDom(di.htmlString),this._PasteContents(n))},n.prototype._PasteContents=function(n){var u,r,t;if(!this.OwnerControl.IsReadOnlyMode&&this.OwnerControl.IsDocumentLoaded&&(u=!0,this.OwnerControl.Selection.SelectionRanges.Count>0)){for(this._InitComplexHistory(i.Paste),r=this.OwnerControl.Selection.SelectionRanges.Count-1;r>=0;r--)t=this.SelectionRanges._Get(r),this._InitializeHistory(i.Paste,t),t.IsEmpty||(u=this._RemoveSelectedContentInternal(t.Start,t.End)),u?this._PasteContent(n):this.CurrentBaseHistoryInfo=null,this._Relayout(this.IsEmpty);this._UpdateComplexHistory()}},n.prototype._PasteSectionChilds=function(n){for(var t,r,f,o,i=0;i<n.ChildNodes.Count;i++)if(t=n.Blocks[i],n.NextNode==null&&n.Blocks[i+1]==null&&t instanceof u)for(r=0;r<t.Inlines.Count;r++)f=t.Inlines[0],this._IsInComment()&&(f instanceof g||f instanceof ir||f instanceof hr)||this._InsertInlineInternal(t.Inlines[0]),r--;else t instanceof hi&&(t instanceof e&&this.Start.Paragraph.IsInsideTable&&(o=this.Start.Paragraph._GetContainerWidth(),t._FitCellsToClientArea(o)),this._InsertBlock(t),i--)},n.prototype._PasteContent=function(n){var e,h,i,r,t,f;if(this.OwnerControl.IsShiftingEnabled=!0,this.CurrentBaseHistoryInfo.InsertPosition==null&&(this.CurrentBaseHistoryInfo.InsertPosition=this.Start._GetHierarchicalIndexInternal()),this.OwnerControl.IsLayoutEnabled=!0,n instanceof ti)for(e=n,t=0;t<e.Sections.Count;t++)h=e.Sections[t],this._PasteSectionChilds(h),this.ownerControl.IsPastingContent=!0;if(typeof n=="string")for(i=[],r=n,r=r.replace(/\n/g,"\r"),i=r.split("\r"),t=0;t<i.length;t++){var c=this._CopySelectionCharacterFormat(),l=this._CopySelectionParagraphFormat(),o=new u(null);o.ParagraphFormat._CopyFormat(l);i[t].length>0&&(f=new s(null),f.Text=i[t],f.CharacterFormat._CopyFormat(c),o.Inlines._Add(f),this._InsertBlock(o),this.ownerControl.IsPastingContent=!0)}this.CurrentBaseHistoryInfo.EndPosition=this.Start._GetHierarchicalIndexInternal();this.ownerControl.IsPastingContent=!1},n.prototype._CopySelectedContent=function(n){for(var t,r,s,f,e,o="",u=0;u<this.SelectionRanges.Count;u++)o+=this.SelectionRanges._Get(u)._GetSelectedContentAsHTML();if(n){if(t=this.Start,r=this.End,this.IsForward||(t=this.End,r=this.Start),this.OwnerControl.IsShiftingEnabled=!0,this.EditPosition=t._GetHierarchicalIndexInternal(),s=null,t.Paragraph==r.Paragraph&&t.Offset+1==r.Offset){var h=t.Paragraph._GetInline(r.Offset,0),c=h.inline;s=c}if(this.OwnerControl.Selection.SelectionRanges.Count>0){for(this._InitComplexHistory(i.MultiSelection),u=0;u<this.OwnerControl.Selection.SelectionRanges.Count;u++)f=this.OwnerControl.Selection.SelectionRanges._Get(u),t=f.Start,r=f.End,f.IsForward||(t=f.End,r=f.Start),this._InitializeHistory(i.Cut,f),this.CurrentBaseHistoryInfo.InsertPosition=t._GetHierarchicalIndexInternal(),t.Paragraph._DeleteSelectedContent(this,t,r,3),this._Relayout(!0),this._UpdateSelectionRangeOffSet(u,t,r);e=new tt(this.OwnerControl);e._SetPositionForCurrentIndex(this.EditPosition);this._SelectContent(e,!0);this._UpdateComplexHistory()}}this._CopyToClipboard(o)},n.prototype._CopyToClipboard=function(n){var i=window.getSelection(),t,r,u;i.removeAllRanges();t=document.createElement("div");t.innerHTML=n;di.htmlString=n;document.body.appendChild(t);r=document.createRange();r.selectNodeContents(t);i.addRange(r);u=!1;try{u=document.execCommand("copy")}catch(f){}finally{i.removeAllRanges();t.parentNode.removeChild(t)}return u},n.prototype._GetHyperlinkField=function(){var t,i;if(this.End==null)return null;t=0;i=this.End.Paragraph._GetInline(this.End.Offset,t);t=i.index;var r=i.inline,n=new h,u=null;return u=r==null?this.End.Paragraph._GetHyperlinkFields(this.End.Paragraph,n):r.OwnerParagraph._GetHyperlinkField(r,n),n._Clear(),n=null,u},n.prototype._GetText=function(n){if(this.Start==null||this.End==null||this.Start.Paragraph==null||this.End.Paragraph==null)return null;var t=this.Start,i=this.End;return t==null||t._IsAtSamePosition(i)?"":kt._GetTextInternal(t,i,n)},n.prototype._GetTable=function(n,t){if(n.Paragraph.AssociatedCell!=null&&t.Paragraph.AssociatedCell!=null){var i=n.Paragraph.AssociatedCell.OwnerTable,r=t.Paragraph.AssociatedCell.OwnerTable;if(i==r||i._Contains(t.Paragraph.AssociatedCell))return i;if(r._Contains(n.Paragraph.AssociatedCell))return r;if(i.IsInsideTable&&r.IsInsideTable){do{if(i=i.AssociatedCell.OwnerTable,i==r||i._Contains(r.AssociatedCell))return i;if(r._Contains(i.AssociatedCell))return r}while(i.AssociatedCell!=null)}else return null}return null},n.prototype._InsertInlineInternal=function(n){if(this.Start.Paragraph._IsEmpty())this.Start.Paragraph.Inlines._Add(n);else{var t=0,i=this.Start.Paragraph._GetInline(this.Start.Offset,t),r=i.inline;t=i.index;r._InsertInline(n,t)}this._Selects(n.OwnerParagraph,this.Start.Offset+n.Length,!0)},n.prototype._InsertInline=function(n){this.ownerControl.History.IsRedoing||(this.ownerControl.IsShiftingEnabled=!0);this.IsEmpty||this._RemoveSelectedContent();this.CurrentBaseHistoryInfo.InsertPosition==null&&(this.CurrentBaseHistoryInfo.InsertPosition=this.Start._GetHierarchicalIndexInternal());this._InsertInlineInternal(n);this.CurrentBaseHistoryInfo.EndPosition==null&&(this.CurrentBaseHistoryInfo.EndPosition=this.Start._GetHierarchicalIndexInternal());this._FireContentChanged()},n.prototype._InsertText=function(n,t){var f,h,e,u,c;if(this.Start!=null){if(h=!0,e=this._CopySelectionCharacterFormat(),this.OwnerControl.Selection.SelectionRanges.Count>1?(this._SelectTextRanges(),this._InitHistory(i.Insert),this.CurrentHistoryInfo._AddModifiedAction(this.CurrentBaseHistoryInfo)):this._InitHistory(i.Insert),this.IsEmpty||(this.IsSkipLayouting=!0,h=this._RemoveSelectedContent(),this.IsSkipLayouting=!1),h)if(this.OwnerControl.IsShiftingEnabled=!0,this.CurrentBaseHistoryInfo.InsertPosition==null&&(this.CurrentBaseHistoryInfo.InsertPosition=this.Start._GetHierarchicalIndexInternal()),f=this.Start,f.Paragraph._IsEmpty())u=new s(null),u.CharacterFormat._CopyFormat(e),u.Text=n,f.Paragraph.Inlines._Add(u);else{var o=0,l=f.Paragraph._GetInline(f.Offset,o),r=l.inline;o=l.index;e._IsEqualFormat(r.CharacterFormat)?r._InsertText(this,n,o):(this._CopyInlineCharacterFormat(e,r.CharacterFormat),o==r.Length?(u=new s(null),u.Text=n,u.CharacterFormat._CopyFormat(e),r.OwnerParagraph.Inlines._Insert(r.OwnerParagraph.Inlines._IndexOf(r)+1,u)):o==0?(u=new s(null),u.Text=n,u.CharacterFormat._CopyFormat(e),r.OwnerParagraph.Inlines._Insert(r.OwnerParagraph.Inlines._IndexOf(r),u)):(u=new s(null),u.Text=n,u.CharacterFormat._CopyFormat(e),r.OwnerParagraph.Inlines._Insert(r.OwnerParagraph.Inlines._IndexOf(r)+1,u),r instanceof s&&(c=r._Clone(),c.Text=r.Text.substring(o),r.Text=r.Text.slice(0,o),r.OwnerParagraph.Inlines._Insert(u.OwnerParagraph.Inlines._IndexOf(u)+1,c))))}this._Selects(f.Paragraph,f.Offset+n.length,!0);this.CurrentBaseHistoryInfo.EndPosition==null&&(this.CurrentBaseHistoryInfo.EndPosition=this.Start._GetHierarchicalIndexInternal());this.CurrentHistoryInfo!=null&&this.CurrentHistoryInfo.Action==i.MultiSelection?this._UpdateComplexHistory():this._Relayout(!0);!t&&h&&(n==" "||n=="\t"||n=="\v")&&this._CheckAndConvertToHyperlink()}},n.prototype._CheckAndConvertToHyperlink=function(){var u=0,a=this.Start.Paragraph._GetInline(this.Start.Offset-1,u),r=a.inline,y,t,e,o,h,c,l;if(u=a.index,u==0){if(r.PreviousNode==null)return;r=r.PreviousNode;u=r.Length}if(r instanceof s){for(var i=r,n=i.Text.substring(0,u),f=0,v=n.lastIndexOf("\t"),f=v>=0?v+1:n.lastIndexOf(" ")+1;f>0&&i.PreviousNode instanceof s;)i=i.PreviousNode,y=i.Text,f=y.lastIndexOf("\t"),n=i.Text+n;n=n.substring(f);t=n.toLowerCase();e=!1;t.substring(0,8)=="file:///"||t.substring(0,7)=="http://"&&t.length>7||t.substring(0,8)=="https://"&&t.length>8||t.substring(0,4)=="www."&&t.length>4||t.substring(0,3)=="\\"&&t.length>3||t.substring(0,7)=="mailto:"&&t.length>7?(e=!0,t.substring(0,4)=="www."&&t.length>4&&(n="http://"+n)):(o=n.indexOf("@"),h=n.indexOf("."),o>0&&o<h&&h<n.length-1&&(e=!0,n="mailto:"+n));e&&(c=new tt(this.OwnerControl),c._SetPositionParagraph(i.OwnerParagraph,i.OwnerParagraph._GetOffset(i,f)),l=new tt(this.OwnerControl),l._SetPositionParagraph(this.End.Paragraph,this.End.Offset-1),this._AutoFormatHyperlink(n,c,l))}},n.prototype._AutoFormatHyperlink=function(n,t,r){var f,u,h,e,c;this.preservedFontCol=this._GetFontColor();this._InitComplexHistory(i.AutoFormatHyperlink);this.CurrentHistoryInfo.InsertPosition=t._GetHierarchicalIndexInternal();this.Start._SetPositionInternal(t);this.End._SetPositionInternal(r);f=this._GetCharacterFormat()._CloneFormat();this._InitHistory(i.Underline);this._UpdateCharacterFormatForSelRange(this.CurrentSelectionRange,o.UnderlineProperty,ki.Single);this._Relayout(!1);this._InitHistory(i.FontColor);this._UpdateCharacterFormatForSelRange(this.CurrentSelectionRange,o.FontColorProperty,"#0563c1");this._Relayout(!1);u=new b(null);u.CharacterFormat._CopyFormat(f);this.Start._SetPositionInternal(this.End);this._InitInsertInline(u);this.Start._SetPositionInternal(t);this.End._SetPositionInternal(t);h=new l(null);h.CharacterFormat._CopyFormat(f);this._InitInsertInline(h);e=new s(null);e.CharacterFormat._CopyFormat(f);e.Text=' HYPERLINK "'+n+'" ';this._InitInsertInline(e);c=new yi(null);c.CharacterFormat._CopyFormat(f);this._InitInsertInline(c);this.Start._SetPositionParagraph(u.OwnerParagraph,u.OwnerParagraph._GetOffset(u,1));this.Start._MoveNextPosition();this.End._SetPositionInternal(this.Start);this.CurrentHistoryInfo.EndPosition=this.End._GetHierarchicalIndexInternal();this._UpdateComplexHistory()},n.prototype._InsertTable=function(n){var r,t,u;this.OwnerControl.IsShiftingEnabled=!0;this._InitHistory(i.InsertTable);r=this.Start.Paragraph._GetContainerWidth();n._FitCellsToClientArea(r);this._InsertBlock(n);this.Start._SetPosition(n._GetFirstParagraphInFirstCell(),!0);this.End._SetPositionInternal(this.Start);t=n._GetLastParagraphInLastCell();u=t._GetLength()+1;this.CurrentBaseHistoryInfo.EndPosition=t._GetHierarchicalIndex(u.toString());this._Relayout(!0)},n.prototype._InsertRow=function(n){var e,u;if(this.Start.Paragraph.IsInsideTable){this.OwnerControl.History.IsRedoing||this._InitHistory(n==hu.Above?i.InsertRowAbove:i.InsertRowBelow);this.OwnerControl.IsShiftingEnabled=!0;var t=this.IsForward?this.Start.Paragraph.AssociatedCell.OwnerRow:this.End.Paragraph.AssociatedCell.OwnerRow,o=t.OwnerTable._CloneTableToHistoryInfo(this.CurrentBaseHistoryInfo),f=void 0,r=t.RowIndex;for(n==hu.Below&&(r=this.IsForward?this.End.Paragraph.AssociatedCell.OwnerRow.RowIndex:this.Start.Paragraph.AssociatedCell.OwnerRow.RowIndex,r++),e=this._GetRowCountToInsert(),u=0;u<e;u++)f=t._GetBlankRow(),t.OwnerTable.Rows._Insert(r,f);this.Start._SetPosition(t.OwnerTable.Rows[r].Cells[0]._GetFirstParagraph(),!0);this.OwnerControl.History.IsRedoing||this._Relayout(!0)}},n.prototype._InsertColumn=function(n){var o,s,r,l,f,e,a;if(this.Start.Paragraph.IsInsideTable){this.OwnerControl.History.IsRedoing||this._InitHistory(n==tf.Left?i.InsertColumnLeft:i.InsertColumnRight);this.OwnerControl.IsShiftingEnabled=!0;o=this.CurrentSelectionRange.Start;s=this.CurrentSelectionRange.End;this.CurrentSelectionRange.IsForward||(o=this.CurrentSelectionRange.End,s=this.CurrentSelectionRange.Start);var h=o.Paragraph.AssociatedCell,t=h.OwnerRow.OwnerTable,y=t._CloneTableToHistoryInfo(this.CurrentBaseHistoryInfo);this.OwnerControl.IsLayoutEnabled=!1;r=h.CellIndex;n==tf.Right&&(r=s.Paragraph.AssociatedCell.CellIndex,r++);var c=null,u=null,v=this._GetColumnCountToInsert();for(l=0;l<v;l++)for(f=0;f<t.Rows.length;f++)e=t.Rows[f],u=h._GetBlankCell(),c==null&&(c=u._GetFirstParagraph()),r>e.Cells.Count?e.Cells._Add(u):e.Cells._Insert(r,u);a=t._GetParentTable();a!=null?a._FitChildsToClientArea():t._FitChildsToClientArea();this.OwnerControl.IsLayoutEnabled=!0;t._Layout();this.Start._SetPosition(c,!0);this.End._SetPosition(u._GetLastParagraph(),!1);this.OwnerControl.History.IsRedoing||this._Relayout(!0)}},n.prototype._InsertBlock=function(n){var i=!0,t;this.IsEmpty||(i=this._RemoveSelectedContent());i||this._SelectContent(this.Start,!1);this._InsertBlockInternal(n);this.CurrentBaseHistoryInfo.InsertPosition==null&&(t=null,n instanceof u&&(t=n),n instanceof e&&(t=n._GetFirstParagraphInFirstCell()),this.CurrentBaseHistoryInfo.InsertPosition=t._GetHierarchicalIndex("0"));this._FireContentChanged()},n.prototype._InsertBlockInternal=function(n){var t;if(!this.Start.IsAtParagraphStart){if(n instanceof u){this._InsertParagraph(n,!1);return}this.CurrentBaseHistoryInfo.InsertPosition==null&&(this.CurrentBaseHistoryInfo.InsertPosition=this.Start._GetHierarchicalIndexInternal());this.Start.Paragraph._SplitParagraph(0,this.Start.Offset);this._SelectParagraph(this.Start.Paragraph,!0,!1)}if(this.Start.Paragraph.Owner instanceof g){t=this.Start.Paragraph.Owner.Blocks.indexOf(this.Start.Paragraph);this.Start.Paragraph.Owner.Blocks._Insert(t,n);return}var f=this.Start.Paragraph._GetIndexInOwnerCollection(),i=this.Start.Paragraph.Owner.ChildNodes,r=i instanceof ur?i:null;r!=null&&r._Insert(f,n)},n.prototype._InsertSection=function(n){this.CurrentBaseHistoryInfo.InsertPosition==null&&(this.CurrentBaseHistoryInfo.InsertPosition=this.Start._GetHierarchicalIndexInternal());var t=this.Start.Paragraph.Section;t._SplitSection(n,this.Start.Paragraph)},n.prototype._InsertSectionInternal=function(n,t){this.CurrentBaseHistoryInfo.InsertPosition==null&&(this.CurrentBaseHistoryInfo.InsertPosition=this.Start._GetHierarchicalIndexInternal());var i=t.Section;i._SplitSection(n,t)},n.prototype._InsertBlockTable=function(n,t){var i=this.Start.Offset,f,o,r;if(n instanceof u&&i>0&&(this.Start.Paragraph._MoveInlines(n,0,0,i),this._SelectParagraph(this.Start.Paragraph,!0,!1),this.CurrentBaseHistoryInfo.InsertPosition==null&&(this.CurrentBaseHistoryInfo.InsertPosition=n._GetHierarchicalIndex(i.toString()))),i>0&&this.CurrentBaseHistoryInfo.InsertPosition==null&&(this.CurrentBaseHistoryInfo.InsertPosition=this.Start._GetHierarchicalIndexInternal()),this.Start.Paragraph.Owner instanceof g){f=t.Owner.Blocks.indexOf(t);t.Owner.Blocks._Insert(f,n);return}o=t._GetIndexInOwnerCollection();t.Owner.ChildNodes._Insert(o,n);this.CurrentBaseHistoryInfo.InsertPosition==null&&(r=null,n instanceof u&&(r=n),n instanceof e&&(r=n._GetFirstParagraphInFirstCell()),this.CurrentBaseHistoryInfo.InsertPosition=r._GetHierarchicalIndex("0"))},n.prototype._InsertImage=function(n){this.OwnerControl.Selection.SelectionRanges.Count>0&&(this._SelectTextRanges(),this._InitHistory(i.InsertInline),this.CurrentHistoryInfo._AddModifiedAction(this.CurrentBaseHistoryInfo));this._FitImageToPage(n);this._InsertInline(n);this.CurrentHistoryInfo!=null&&this._UpdateComplexHistory()},n.prototype._GetCharacterFormat=function(){if(this.Start.Paragraph._IsEmpty())return this.Start.Paragraph.CharacterFormat;var n=0,t=this.Start.Paragraph._GetInline(this.Start.Offset,n),i=t.inline;return n=t.index,i.CharacterFormat},n.prototype._GetFontColor=function(){var r=this.CharacterFormat.FontColor,t,i,u,n;return r==null&&(t=0,i=this.Start,this.IsForward||(i=this.End),u=i.Paragraph._GetInline(i.Offset,t),n=u.inline,t=u.index,n!=null&&t==n.Length&&n.NextNode!=null&&(n=n.NextNode,t=0),n!=null&&(r=n.CharacterFormat.FontColor)),r},n.prototype._InitInsertInline=function(n){this._InitHistory(i.InsertInline);this._InsertInline(n);this._UpdateHistory()},n.prototype._InsertHyperlinkByFormat=function(n,t,i){var f,r,e,u,o;this.CurrentBaseHistoryInfo.InsertPosition==null&&(this.CurrentBaseHistoryInfo.InsertPosition=this.Start._GetHierarchicalIndexInternal());this.OwnerControl.IsShiftingEnabled=!0;this.preservedFontCol=this._GetFontColor();f=new l(null);f.CharacterFormat._CopyFormat(i);this._InsertInlineInternal(f);r=new s(null);r.CharacterFormat._CopyFormat(i);r.Text=' HYPERLINK "'+n+'" ';this._InsertInlineInternal(r);e=new yi(null);e.CharacterFormat._CopyFormat(i);this._InsertInlineInternal(e);(t!=null||t!=""||t!=undefined)&&(r=new s(null),r.CharacterFormat._CopyFormat(i),r.CharacterFormat.Underline=ki.Single,r.CharacterFormat.FontColor="#0563c1",r.Text=t,this._InsertInlineInternal(r));u=new b(null);u.CharacterFormat._CopyFormat(i);this._InsertInlineInternal(u);o=u.OwnerParagraph._GetOffset(u,1);this._Selects(u.OwnerParagraph,o,!0);this.CurrentBaseHistoryInfo.EndPosition=this.Start._GetHierarchicalIndexInternal();this._Relayout(!0)},n.prototype._InserthyperlinkInternal=function(n,t){var r,u;this.Start!=null&&(this._EditHyperlink(n,t)||(this._InitHistory(i.InsertHyperlink),r=!0,this.IsEmpty||(r=this._RemoveSelectedContent()),r&&(u=this._GetCharacterFormat(),this._InsertHyperlinkByFormat(n,t,u))))},n.prototype._EditHyperlink=function(n,t){var r=this._GetHyperlinkField(),f,v,u,e,o;if(r==null)return!1;this._InitHistory(i.InsertHyperlink);var h=!1,c=this._GetCharacterFormat(),a=null;return r.fieldSeparator!=null&&(a=r.fieldSeparator,f=r.fieldSeparator.OwnerParagraph._GetHyperlinkDisplayText(r.fieldSeparator,r.fieldEnd,h,c),v=f.displayText,h=f.isNestedField,c=f.format),u=r.OwnerParagraph._GetOffset(r,0),this.Start._SetPositionParagraph(r.OwnerParagraph,u),u=r.fieldEnd.OwnerParagraph._GetOffset(r.fieldEnd,1),this.End._SetPositionParagraph(r.fieldEnd.OwnerParagraph,u),this._DeleteSelectedContents(!1),(h||""==t)&&a!=null?(this.CurrentBaseHistoryInfo.InsertPosition==null&&(this.CurrentBaseHistoryInfo.InsertPosition=this.Start._GetHierarchicalIndexInternal()),e=new l(null),e.CharacterFormat._CopyFormat(r.CharacterFormat),this._InsertInlineInternal(e),o=new s(null),o.CharacterFormat._CopyFormat(r.CharacterFormat),o.Text=' HYPERLINK "'+n+'" ',this._InsertInlineInternal(o),this.CurrentBaseHistoryInfo._InsertClonedFieldResult(a),this._Selects(e.fieldEnd.OwnerParagraph,u,!0),this.CurrentBaseHistoryInfo.EndPosition=this.Start._GetHierarchicalIndexInternal(),this._Relayout(!0)):this._InsertHyperlinkByFormat(n,t,c),!0},n.prototype._InsertHyperlink=function(n,t,r){var u,f,a,h,e,v,c,y;this.Start.Paragraph.AssociatedCell==this.End.Paragraph.AssociatedCell&&(r?this._InserthyperlinkInternal(n,t):(this.preservedFontCol=this._GetFontColor(),u=this.Start,f=this.End,this.IsForward||(u=this.End,f=this.Start),a=new tt(this.ownerControl),a._SetPositionInternal(u),h=this._GetCharacterFormat()._CloneFormat(),this._InitComplexHistory(i.InsertHyperlink),this.CurrentHistoryInfo.InsertPosition=u._GetHierarchicalIndexInternal(),this._InitHistory(i.Underline),this._UpdateCharacterFormatForSelRange(this.CurrentSelectionRange,o.UnderlineProperty,ki.Single),this._Relayout(!1),this._InitHistory(i.FontColor),this._UpdateCharacterFormatForSelRange(this.CurrentSelectionRange,o.FontColorProperty,"#0563c1"),this._Relayout(!1),u._SetPositionInternal(f),f._SetPositionInternal(u),e=new b(null),e.CharacterFormat._CopyFormat(h),u._SetPositionInternal(f),this._InitInsertInline(e),u._SetPositionInternal(a),f._SetPositionInternal(u),v=new l(null),v.CharacterFormat._CopyFormat(h),this._InitInsertInline(v),c=new s(null),c.CharacterFormat._CopyFormat(h),c.Text=' HYPERLINK "'+n+'" ',this._InitInsertInline(c),y=new yi(null),y.CharacterFormat._CopyFormat(h),this._InitInsertInline(y),this._Selects(e.OwnerParagraph,e.OwnerParagraph._GetOffset(e,e.Length),!0),this.CurrentHistoryInfo.EndPosition=f._GetHierarchicalIndexInternal(),this._UpdateComplexHistory()))},n.prototype._RemoveHyperlink=function(){var e=this.preservedFontCol,n=this._GetHyperlinkField(),u;if(n!=null){var r=n.fieldEnd,t=n.fieldSeparator,f=new tt(this.ownerControl);f._SetPositionParagraph(n.OwnerParagraph,n.OwnerParagraph._GetOffset(n,0));u=new tt(this.ownerControl);u._SetPositionParagraph(t.OwnerParagraph,t.OwnerParagraph._GetOffset(t,t.Length));this._InitComplexHistory(i.RemoveHyperlink);this.Start._SetPositionParagraph(r.OwnerParagraph,r.OwnerParagraph._GetOffset(r,0));this.End._SetPositionInternal(this.Start);this._OnDelete();this.Start._SetPositionInternal(u);this._InitHistory(i.Underline);this._UpdateCharacterFormatForSelRange(this.CurrentSelectionRange,o.UnderlineProperty,ki.None);this._Relayout(!1);this._InitHistory(i.FontColor);this._UpdateCharacterFormatForSelRange(this.CurrentSelectionRange,o.FontColorProperty,e);this._Relayout(!1);this.End._SetPositionInternal(this.Start);this.Start._SetPositionInternal(f);this._InitHistory(i.Delete);this._DeleteSelectedContents(!1);this._Relayout(!0);this._UpdateComplexHistory()}},n.prototype._GetRowCountToInsert=function(){var r=1,i=this.CurrentSelectionRange,n=i.Start,t=i.End;return(i.IsForward||(n=i.End,t=i.Start),n!=null&&t!=null&&this._GetTable(n,t)!=null)?n.Paragraph.AssociatedCell==t.Paragraph.AssociatedCell||n.Paragraph.AssociatedCell.OwnerRow==t.Paragraph.AssociatedCell.OwnerRow?1:r+t.Paragraph.AssociatedCell.OwnerRow.RowIndex-n.Paragraph.AssociatedCell.OwnerRow.RowIndex:r==0?1:r},n.prototype._GetColumnCountToInsert=function(){var i=1,r=this.CurrentSelectionRange,n=r.Start,t=r.End,f,u,e;if(r.IsForward||(n=r.End,t=r.Start),n!=null&&t!=null&&this._GetTable(n,t)!=null){if(n.Paragraph.AssociatedCell==t.Paragraph.AssociatedCell)return 1;if(n.Paragraph.AssociatedCell.OwnerRow==t.Paragraph.AssociatedCell.OwnerRow)return i+t.Paragraph.AssociatedCell.CellIndex-n.Paragraph.AssociatedCell.CellIndex;for(i=0,f=n.Paragraph.AssociatedCell.OwnerTable._GetColumnCellsForSelection(n.Paragraph.AssociatedCell,t.Paragraph.AssociatedCell),u=void 0;u<f.length;u++)e=f[u],n.Paragraph.AssociatedCell.OwnerRow==e.OwnerRow&&i++}return i==0?1:i},n.prototype._DeleteTable=function(){var n,t;this.Start.Paragraph.IsInsideTable&&(n=this.Start.Paragraph.AssociatedCell.OwnerTable,this.OwnerControl.IsShiftingEnabled=!0,this.OwnerControl.History.IsRedoing||this._InitHistory(i.DeleteTable),this.CurrentBaseHistoryInfo.InsertPosition=n._GetHierarchicalIndex("0"),t=null,n.NextBlock!=null?t=n.NextBlock instanceof u?n.NextBlock:n.NextBlock._GetFirstParagraphInFirstCell():n.PreviousBlock!=null&&(t=n.PreviousBlock instanceof u?n.PreviousBlock:n.NextBlock._GetLastParagraphInLastCell()),n._RemoveBlock(),this.CurrentBaseHistoryInfo.RemovedNodes._Add(n),this._SelectParagraph(t,!0,!0),this.OwnerControl.History.IsRedoing||this._Relayout(!0))},n.prototype._DeleteRow=function(){var n,l,r,o,h,c,t,f,s,e;if(this.Start.Paragraph.IsInsideTable){if(n=this.Start.Paragraph.AssociatedCell.OwnerRow,this.OwnerControl.History.IsRedoing||this._InitHistory(i.DeleteRow),this.OwnerControl.IsShiftingEnabled=!0,l=n.OwnerTable._CloneTableToHistoryInfo(this.CurrentBaseHistoryInfo),r=null,n.NextNode!=null&&(s=n.NextNode.Cells[0],r=s._GetFirstParagraph()),r==null&&(n.OwnerTable.NextBlock!=null?r=n.OwnerTable.NextBlock instanceof u?n.OwnerTable.NextBlock:n.OwnerTable.NextBlock._GetFirstParagraphInFirstCell():n.OwnerTable.PreviousBlock!=null&&(r=n.OwnerTable.PreviousBlock instanceof u?n.OwnerTable.PreviousBlock:n.OwnerTable.NextBlock._GetLastParagraphInLastCell())),this.IsEmpty)n.OwnerTable.Rows.Count==1?n.OwnerTable._RemoveBlock():n.OwnerTable.Rows._Remove(n);else if(o=this.Start.Paragraph.AssociatedCell._GetContainerCellOf(this.End.Paragraph.AssociatedCell),o.OwnerTable._Contains(this.End.Paragraph.AssociatedCell))if(h=this.Start.Paragraph.AssociatedCell._GetSelectedCell(o),c=this.End.Paragraph.AssociatedCell._GetSelectedCell(o),o._Contains(this.End.Paragraph.AssociatedCell))n=h.OwnerRow,n.OwnerTable.Rows.Count==1?n.OwnerTable._RemoveBlock():n.OwnerTable.Rows._Remove(n);else{for(n=h.OwnerRow,t=c.OwnerRow,f=n.OwnerTable,r=null,t.NextNode!=null&&(s=t.NextNode.Cells[0],r=s._GetFirstParagraph()),r==null&&(t.OwnerTable.NextBlock!=null?r=t.OwnerTable.NextBlock instanceof u?t.OwnerTable.NextBlock:t.OwnerTable.NextBlock._GetFirstParagraphInFirstCell():t.OwnerTable.PreviousBlock!=null&&(r=t.OwnerTable.PreviousBlock instanceof u?t.OwnerTable.PreviousBlock:t.OwnerTable.NextBlock._GetLastParagraphInLastCell())),e=0;e<f.Rows.Count;e++)f.Rows[e].RowIndex>=n.RowIndex&&f.Rows[e].RowIndex<=t.RowIndex&&(f.Rows._RemoveAt(e),e--);f.Rows.Count==0&&f._RemoveBlock()}this._SelectParagraph(r,!0,!0);this.OwnerControl.History.IsRedoing||this._Relayout(!0)}},n.prototype._DeleteColumn=function(){var t,c,l,h,e,r,f;if(this.Start.Paragraph.IsInsideTable){this.OwnerControl.History.IsRedoing||this._InitHistory(i.DeleteColumn);this.OwnerControl.IsShiftingEnabled=!0;var o=this.Start.Paragraph.AssociatedCell,s=this.End.Paragraph.AssociatedCell,n=o.OwnerTable,a=n._CloneTableToHistoryInfo(this.CurrentBaseHistoryInfo);for(this.OwnerControl.IsLayoutEnabled=!1,t=null,s.NextNode!=null?(c=s.NextNode,t=c._GetFirstParagraph()):o.PreviousNode!=null&&(l=o.PreviousNode,t=l._GetFirstParagraph()),t==null&&(n.NextBlock!=null?t=n.NextBlock instanceof u?n.NextBlock:n.NextBlock._GetFirstParagraphInFirstCell():n.PreviousBlock!=null&&(t=n.PreviousBlock instanceof u?n.PreviousBlock:n.NextBlock._GetLastParagraphInLastCell())),h=n._GetColumnCellsForSelection(o,s),e=0;e<n.Rows.Count;e++)if(r=n.Rows[e],r.Cells.Count==1)h._Contains(r.Cells[0])&&(n.Rows._Remove(r),e--);else for(f=0;f<r.Cells.Count;f++)h._Contains(r.Cells[f])&&(r.Cells._RemoveAt(f),f--);this.OwnerControl.IsLayoutEnabled=!0;n.Rows.Count==0?(n._RemoveBlock(),this.CurrentBaseHistoryInfo.Action=i.Delete):n._Layout();this._SelectParagraph(t,!0,!0);this.OwnerControl.History.IsRedoing||this._Relayout(!0)}},n.prototype._RemoveSelectedContent=function(){return this._RemoveSelectedContentInternal(this.Start,this.End)},n.prototype._RemoveSelectedContentInternal=function(n,t){var i=n,r=t,f,u;return(n._IsExistBefore(t)||(i=t,r=n),i.Paragraph==r.Paragraph&&i.Offset==i.Paragraph._GetLength()&&i.Offset+1==r.Offset)?(this.OwnerControl.IsShiftingEnabled=!0,this._SelectContent(i,!0),!0):(this.EditPosition=i._GetHierarchicalIndexInternal(),f=i.Paragraph._RemoveSelectedContent(this,i,r),u=new tt(this.OwnerControl),u._SetPositionForCurrentIndex(this.EditPosition),this._SelectContent(u,!1),f)},n.prototype._Relayout=function(n){this._IsHandledComplexHistory()||(this._IsInComment()&&this.Start.Paragraph._GetOwnerComment()._Relayout(),this.OwnerControl.IsShiftingEnabled&&(this.OwnerControl.IsShiftingEnabled=!1,this.OwnerControl.Viewer._ShiftLayoutedItems(),this.Start._UpdatePhysicalPosition(),n?this.End._SetPositionInternal(this.Start):this.End._UpdatePhysicalPosition(),this.UpDownSelectionLength=this.End.Location.X,this._FireSelectionChanged(n),this._UpdateFocus()),this._UpdateHistory(),this._FireContentChanged())},n.prototype._CopySectionFormat=function(){},n.prototype._CopySelectionParagraphFormat=function(){var n=new a(null);return this.ParagraphFormat.AfterSpacing!=null&&(n.AfterSpacing=this.ParagraphFormat.AfterSpacing),this.ParagraphFormat.BeforeSpacing!=null&&(n.BeforeSpacing=this.ParagraphFormat.BeforeSpacing),this.ParagraphFormat.FirstLineIndent!=null&&(n.FirstLineIndent=this.ParagraphFormat.FirstLineIndent),this.ParagraphFormat.LeftIndent!=null&&(n.LeftIndent=this.ParagraphFormat.LeftIndent),this.ParagraphFormat.RightIndent!=null&&(n.RightIndent=this.ParagraphFormat.RightIndent),this.ParagraphFormat.TextAlignment!=null&&(n.TextAlignment=this.ParagraphFormat.TextAlignment),this.ParagraphFormat.LineSpacing!=null&&(n.LineSpacing=this.ParagraphFormat.LineSpacing),this.ParagraphFormat.LineSpacingType!=null&&(n.LineSpacingType=this.ParagraphFormat.LineSpacingType),n},n.prototype._CopySelectionCharacterFormat=function(){var n=new o(null);return this.CharacterFormat.BaselineAlignment!=null&&(n.BaselineAlignment=this.CharacterFormat.BaselineAlignment),this.CharacterFormat.Bold!=null&&(n.Bold=this.CharacterFormat.Bold),this.CharacterFormat.FontColor!=null&&(n.FontColor=this.CharacterFormat.FontColor),this.CharacterFormat.FontFamily!=null&&(n.FontFamily=this.CharacterFormat.FontFamily),this.CharacterFormat.FontSize!=0&&(n.FontSize=this.CharacterFormat.FontSize),this.CharacterFormat.HighlightColor!=null&&(n.HighlightColor=this.CharacterFormat.HighlightColor),this.CharacterFormat.Italic!=null&&(n.Italic=this.CharacterFormat.Italic),this.CharacterFormat.StrikeThrough!=null&&(n.StrikeThrough=this.CharacterFormat.StrikeThrough),this.CharacterFormat.Underline!=null&&(n.Underline=this.CharacterFormat.Underline),n},n.prototype._CopyInlineCharacterFormat=function(n,t){n._HasValue(o.BaselineAlignmentProperty)||(n.BaselineAlignment=t.BaselineAlignment);n._HasValue(o.BoldProperty)||(n.Bold=t.Bold);n._HasValue(o.FontColorProperty)||(n.FontColor=t.FontColor);n._HasValue(o.FontFamilyProperty)||(n.FontFamily=t.FontFamily);n._HasValue(o.FontSizeProperty)||(n.FontSize=t.FontSize);n._HasValue(o.HighlightColorProperty)||(n.HighlightColor=t.HighlightColor);n._HasValue(o.ItalicProperty)||(n.Italic=t.Italic);n._HasValue(o.StrikeThroughProperty)||(n.StrikeThrough=t.StrikeThrough);n._HasValue(o.UnderlineProperty)||(n.Underline=t.Underline)},n.prototype._RetrieveCurrentFormatProperties=function(){var n,t,r,i,u;if(this.IsRetrieveFormatting=!0,n=this.Start,t=this.End,this.IsForward||(n=this.End,t=this.Start),this._RetrieveCharacterFormat(n,t),this._RetrieveParagraphFormat(n,t),this._RetrieveSectionFormat(n,t),this._RetrieveTableFormat(n,t),this.OwnerControl.Selection.SelectionRanges.Count>1&&!this.IsEmpty)for(r=0;r<this.OwnerControl.Selection.SelectionRanges.Count;r++)i=this.OwnerControl.Selection.SelectionRanges._Get(r),u=i.Start.Paragraph._GetCharacterFormatofTextPostion(i.Start),u!=null&&(this.CharacterFormat._CombineFormat(u),this.ParagraphFormat._CombineFormat(i.Start.Paragraph.ParagraphFormat),this.Start.Paragraph.Section!=null&&this.SectionFormat._CombineFormat(i.Start.Paragraph.Section.SectionFormat));this.IsRetrieveFormatting=!1;this.EditingContext.Type=this.tableFormat==null||this.tableFormat.Table==null?rf.Text:rf.Table},n.prototype._InsertParagraph=function(n,t){if(this.CurrentBaseHistoryInfo.InsertPosition==null&&(this.CurrentBaseHistoryInfo.InsertPosition=this.Start._GetHierarchicalIndexInternal()),this.Start.Paragraph._InsertParagraph(n,this.Start.Offset,t),!t){var i=n._GetNextParagraph();i!=null?this._SelectParagraph(i,!0,!1):this._SelectParagraph(n,!0,!1)}this._FireContentChanged()},n.prototype._InitHistory=function(n){this._InitializeHistory(n,this.CurrentSelectionRange)},n.prototype._InitializeHistory=function(n,t){this.CurrentBaseHistoryInfo=new eu(this.OwnerControl);this.CurrentBaseHistoryInfo.Action=n;this.CurrentBaseHistoryInfo._UpdateSelectionRange(t)},n.prototype._InitComplexHistory=function(n){this.CurrentHistoryInfo=new gf(this.OwnerControl,this.CurrentHistoryInfo!=null);this.CurrentHistoryInfo.Action=n;this.CurrentHistoryInfo._UpdateSelection(this)},n.prototype._FitImageToPage=function(n){var t,i;if(this.Start.Paragraph._IsInComment())t=this.ownerControl.Viewer.ClientArea.Width,i=120,n.Width>t&&(n.Height=n.Height*t/n.Width,n.Width=t),n.Height>i&&(n.Width=n.Width*i/n.Height,n.Height=i);else{var r=this.Start.Paragraph.Section,t=r.SectionFormat.PageWidth-r.SectionFormat.LeftMargin-r.SectionFormat.RightMargin,i=r.SectionFormat.PageHeight-r.SectionFormat.TopMargin-r.SectionFormat.TopMargin;n.Width>t&&(n.Height=n.Height*t/n.Width,n.Width=t);n.Height>i&&(n.Width=n.Width*i/n.Height,n.Height=i)}},n.prototype._SelectTextRanges=function(){var n,t;for(this._InitComplexHistory(i.MultiSelection),n=null,t=0;t<this.OwnerControl.Selection.SelectionRanges.Count-1;t++)n=this.OwnerControl.Selection.SelectionRanges._Get(t),this._InitializeHistory(i.Selection,n),this.CurrentBaseHistoryInfo.InsertPosition==null&&(this.CurrentBaseHistoryInfo.InsertPosition=n.Start._GetHierarchicalIndexInternal()),this.CurrentBaseHistoryInfo.EndPosition==null&&(this.CurrentBaseHistoryInfo.EndPosition=n.End._GetHierarchicalIndexInternal()),this.CurrentHistoryInfo._AddModifiedAction(this.CurrentBaseHistoryInfo)},n.prototype._IsHandledComplexHistory=function(){var u=!1,f,r,n,e,o,t,i;if(this.removedCommentCharacters!=null){for(f=0;f<this.removedCommentCharacters.Count;f++)r=this.removedCommentCharacters[f],r instanceof g?(n=r,n.CommentStart!=null&&n.CommentEnd!=null&&(e=this.removedCommentCharacters._Contains(n.CommentStart),o=this.removedCommentCharacters._Contains(n.CommentEnd),e||o?(this.removedCommentCharacters._Remove(n.CommentStart),this.removedCommentCharacters._Remove(n.CommentEnd),this.removedCommentCharacters._Remove(n)):(this._InitComplexHistory(this.CurrentBaseHistoryInfo.Action),this._UpdateHistory(),e||this._RemoveInline(n.CommentStart),o||this._RemoveInline(n.CommentEnd),this._UpdateComplexHistory(),u=!0))):r instanceof ir?(t=r,t.Comment!=null&&t.Comment.CommentEnd!=null&&this.removedCommentCharacters._Contains(t.Comment.CommentEnd)?(this.removedCommentCharacters._Remove(t.Comment.CommentEnd),this.removedCommentCharacters._Remove(t),this.removedCommentCharacters._Contains(t.Comment)&&this.removedCommentCharacters._Remove(t.Comment)):(this._InitComplexHistory(this.CurrentBaseHistoryInfo.Action),this._UpdateHistory(),this._InitInsertInline(t._Clone()),this._UpdateComplexHistory(),u=!0)):(i=r,i.Comment!=null&&i.Comment.CommentStart!=null&&this.removedCommentCharacters._Contains(i.Comment.CommentStart)?(this.removedCommentCharacters._Remove(i.Comment.CommentStart),this.removedCommentCharacters._Remove(i),this.removedCommentCharacters._Contains(i.Comment)&&this.removedCommentCharacters._Remove(i.Comment)):(this._InitComplexHistory(this.CurrentBaseHistoryInfo.Action),this._UpdateHistory(),this._InitInsertInline(i._Clone()),this._UpdateComplexHistory(),u=!0));this.removedCommentCharacters._Clear();this.removedCommentCharacters=null}else this.CurrentHistoryInfo!=null&&(this._UpdateHistory(),u=!0);return u},n.prototype._UpdateHistory=function(){this.CurrentBaseHistoryInfo!=null&&(this.CurrentBaseHistoryInfo.EndPosition==null&&(this.CurrentBaseHistoryInfo.EndPosition=this.CurrentBaseHistoryInfo.InsertPosition),this.CurrentHistoryInfo!=null?this.CurrentHistoryInfo._AddModifiedAction(this.CurrentBaseHistoryInfo):this.OwnerControl.History._RecordChanges(this.CurrentBaseHistoryInfo),this.CurrentBaseHistoryInfo=null)},n.prototype._UpdateComplexHistory=function(){var n,t;this.CurrentHistoryInfo.HasAction&&(this.CurrentHistoryInfo.Action==i.AutoFormatHyperlink&&(n=new tt(this.ownerControl),n._SetPositionForCurrentIndex(this.CurrentHistoryInfo.InsertPosition),n.Paragraph._RelayoutParagraph(0),this.ownerControl.History.IsUndoing?(this.Start._SetPositionForCurrentIndex(this.CurrentHistoryInfo.SelectionStart),this.End._SetPositionForCurrentIndex(this.CurrentHistoryInfo.SelectionEnd)):(this.Start._SetPositionForCurrentIndex(this.CurrentHistoryInfo.EndPosition),this.End._SetPositionForCurrentIndex(this.CurrentHistoryInfo.EndPosition))),this.CurrentHistoryInfo.Action==i.InsertHyperlink&&(n=new tt(this.ownerControl),n._SetPositionForCurrentIndex(this.CurrentHistoryInfo.InsertPosition),t=new tt(this.ownerControl),t._SetPositionForCurrentIndex(this.CurrentHistoryInfo.EndPosition),n.Paragraph._RelayoutParagraph(0),t.Paragraph!=n.Paragraph&&t.Paragraph._RelayoutParagraph(0)),this.CurrentHistoryInfo.Action==i.ReplaceAll||this.CurrentHistoryInfo.Action==i.DeleteAllComments?(this.OwnerControl.IsLayoutEnabled=!0,this.OwnerControl.Document._LayoutItems(this.OwnerControl.Viewer)):this.OwnerControl.IsShiftingEnabled&&this.OwnerControl.Viewer._ShiftLayoutedItems());this.ownerControl.IsShiftingEnabled=!1;this._AddMutipleSelectionRanges();this.Start._UpdatePhysicalPosition();this.IsEmpty?this.End._SetPositionInternal(this.Start):this.End._UpdatePhysicalPosition();this.UpDownSelectionLength=this.End.Location.X;this._FireSelectionChanged(!0);this._UpdateFocus();this._FireContentChanged();this.CurrentHistoryInfo!=null&&(this.CurrentHistoryInfo.EndPosition==null&&(this.CurrentHistoryInfo.EndPosition=this.CurrentHistoryInfo.InsertPosition),this.OwnerControl.History._RecordChanges(this.CurrentHistoryInfo),this.CurrentHistoryInfo=null)},n.prototype._AddMutipleSelectionRanges=function(){var r={isCleared:!1},n,t;if(this.OwnerControl.History.IsUndoing||this.OwnerControl.History.IsRedoing)if(this.CurrentHistoryInfo.Action==i.MultiSelection)for(n=0;n<this.CurrentHistoryInfo.ModifiedActions.Count;n++)t=this.CurrentHistoryInfo.ModifiedActions[n],(this.OwnerControl.History.IsUndoing||this.OwnerControl.History.IsRedoing&&t.ModifiedProperties.Count>0)&&(this._AddSelectionRange(t,r),this.OwnerControl.History.IsUndoing&&(t.Action==i.Cut||t.Action==i.Delete)&&this._UpdateSelectionRangeOffSetInternal(n));else if(this.CurrentHistoryInfo.Action==i.Paste)for(n=this.CurrentHistoryInfo.ModifiedActions.Count-1;n>=0;n--)t=this.CurrentHistoryInfo.ModifiedActions[n],this.OwnerControl.History.IsUndoing&&this._AddSelectionRange(t,r)},n.prototype._AddSelectionRange=function(n,t){t.isCleared||(this.SelectionRanges._Clear(),t.isCleared=!0);n instanceof gf&&n.Action==i.InsertComment?this.SelectionRanges._AddSelection(this.CurrentHistoryInfo._GetTextPosition(this.CurrentHistoryInfo.SelectionStart),this.CurrentHistoryInfo._GetTextPosition(this.CurrentHistoryInfo.SelectionEnd)):this.SelectionRanges._AddSelection(n._GetTextPosition(n.InsertPosition),n._GetTextPosition(n.EndPosition))},n.prototype._OnEnter=function(){var h,w,c,r,l,t,o,a,v,y,p;if(this.SkipFormatRetrieval=!0,this.Start!=null){if(this.IsEmpty){if(h=this._GetHyperlinkField(),w=h!=null,w){this.OwnerControl._FireRequestNavigate(h);this.SkipFormatRetrieval=!1;return}if(r=this.Start.Paragraph,r._IsEmpty()&&r.ParagraphFormat.ListFormat.List!=null){this._OnApplyList(r.ParagraphFormat.ListFormat.List,r.ParagraphFormat.ListFormat.ListLevelNumber-1);return}}if(this._InitHistory(i.Enter),c=!0,this.IsEmpty?this._InitHistory(i.Enter):(this._SelectTextRanges(),this._InitHistory(i.Enter),this.CurrentHistoryInfo._AddModifiedAction(this.CurrentBaseHistoryInfo),c=this._RemoveSelectedContent()),c&&(this.OwnerControl.IsShiftingEnabled=!0,this.CurrentBaseHistoryInfo.InsertPosition==null&&(this.CurrentBaseHistoryInfo.InsertPosition=this.Start._GetHierarchicalIndexInternal()),this.Start.Paragraph._SplitParagraphInternal(this.Start.Offset),this.Start._SetPositionForCurrentIndex(this.CurrentBaseHistoryInfo.InsertPosition),this._SelectParagraph(this.Start.Paragraph.NextBlock,!0,!1),this.CurrentBaseHistoryInfo.EndPosition==null&&(this.CurrentBaseHistoryInfo.EndPosition=this.Start._GetHierarchicalIndexInternal()),this.CurrentHistoryInfo!=null?this._UpdateComplexHistory():this._Relayout(!0),r=this.Start.Paragraph.PreviousNode,r!=null&&!r._IsEmpty()&&r.Inlines[r.Inlines.Count-1]instanceof s)){for(var u=r.Inlines._Last(),n=u.Text,f=0,e=n.lastIndexOf("\t"),f=e>=0?e+1:n.lastIndexOf(" ")+1;u.PreviousNode instanceof s&&f==0;)u=u.PreviousNode,l=u.Text,e=l.lastIndexOf("\t"),f=e>=0?e+1:l.lastIndexOf(" ")+1,n=u.Text+n;n=n.substring(f);t=n.toLowerCase();o=!1;t.substring(0,8)=="file:///"||t.substring(0,7)=="http://"&&t.length>7||t.substring(0,8)=="https://"&&t.length>8||t.substring(0,4)=="www."&&t.length>4||t.substring(0,3)=="\\"&&t.length>3||t.substring(0,7)=="mailto:"&&t.length>7?(o=!0,t.substring(0,4)=="www."&&t.length>4&&(n="http://"+n)):(a=n.indexOf("@"),v=n.indexOf("."),a>0&&a<v&&v<n.length-1&&(o=!0,n="mailto:"+n));o&&(y=new tt(this.OwnerControl),y._SetPositionParagraph(u.OwnerParagraph,u.OwnerParagraph._GetOffset(u,f)),p=new tt(this.OwnerControl),p._SetPositionParagraph(r,r._GetEndOffset()),this._AutoFormatHyperlink(n,y,p))}this.SkipFormatRetrieval=!1}},n.prototype._OnBackspace=function(){if(this.Start!=null)if(this.IsEmpty)this._SingleBackspace(!1);else{this.OwnerControl.Selection.SelectionRanges.Count>0&&(this._SelectTextRanges(),this._InitHistory(i.BackSpace),this.CurrentHistoryInfo._AddModifiedAction(this.CurrentBaseHistoryInfo));var n=this._DeleteSelectedContents(!0);n?this.CurrentBaseHistoryInfo=null:this.CurrentHistoryInfo!=null?(this.CurrentBaseHistoryInfo.EndPosition==null&&(this.CurrentBaseHistoryInfo.EndPosition=this.End._GetHierarchicalIndexInternal()),this._UpdateComplexHistory()):this._Relayout(!0)}},n.prototype._SingleBackspace=function(n){var h,l,o,e,v,s;if(!n&&this.SelectionRanges.Count==1&&!this.OwnerControl.History.CanRedo&&this.OwnerControl.History.CanUndo&&(h=this.OwnerControl.History.UndoStack[this.OwnerControl.History.UndoStack.length-1],h.Action==i.AutoFormatHyperlink&&h.EndPosition==this.Start._GetHierarchicalIndexInternal()&&h.EndPosition==this.End._GetHierarchicalIndexInternal())){this.ownerControl.History._Undo();return}this._ValidateSelectionBasedOnCommentCharacter(!0);var t=this.Start.Paragraph,f=this.Start.Offset,c=0,a=t._GetInline(f,c),r=a.inline;if(c=a.index,l=r,r!=null&&c==0&&r.PreviousNode!=null&&(l=r.PreviousNode,c=r.Length),l instanceof g){this._DeleteComment(l);return}if(r instanceof b){if(o=r._GetPreviousValidInline(),o instanceof b){r=o.FieldBegin;t=r.OwnerParagraph;f=t._GetOffset(r,0);this.End._SetPositionParagraph(t,f);this._FireSelectionChanged(!0);return}o!=r&&(r=o,t=r.OwnerParagraph,f=t._GetOffset(r,r.Length))}if(n||this._InitHistory(i.BackSpace),f==t._GetStartOffset()){if(t.ParagraphFormat.ListFormat.List!=null){this._OnApplyList(null,0);return}if(t.ParagraphFormat.FirstLineIndent!=0){this._OnFirstLineIndent(0);return}if(t.ParagraphFormat.LeftIndent!=0){this._OnLeftIndent(0);return}if(t.ParagraphFormat.TextAlignment!=1){this._OnTextAlignment(1);return}if(t.PreviousBlock instanceof u){if(this.OwnerControl.IsShiftingEnabled=!0,e=t.PreviousBlock,e._IsEmpty())e._RemoveBlock(),this.CurrentBaseHistoryInfo.RemovedNodes._Add(e);else{for(v=e._GetEndOffset(),s=0;s<t.Inlines.Count;s++)r=t.Inlines[s],s--,e.Inlines._Add(r);t._RemoveBlock();this._Selects(e,v,!0);this.CurrentBaseHistoryInfo.RemovedNodes._Add(t)}this.CurrentBaseHistoryInfo.InsertPosition=this.Start._GetHierarchicalIndexInternal();this.CurrentBaseHistoryInfo.EndPosition=this.CurrentBaseHistoryInfo.InsertPosition;n||this._Relayout(!0)}else this.currentBaseHistoryInfo=null}else n||(this.OwnerControl.IsShiftingEnabled=!0),t._RemoveAtOffset(this.CurrentBaseHistoryInfo,f-1),this._Selects(this.Start.Paragraph,f-1,!0),this.CurrentBaseHistoryInfo.InsertPosition=this.Start._GetHierarchicalIndexInternal(),this.CurrentBaseHistoryInfo.EndPosition=this.CurrentBaseHistoryInfo.InsertPosition,n?this._FireContentChanged():this._Relayout(!0)},n.prototype._ValidateSelectionBasedOnCommentCharacter=function(n){var r=this.Start.Offset,i=0,u=this.Start.Paragraph._GetInline(this.Start.Offset,i),t=u.inline;if(i=u.index,t!=null){if(n){if(r==0)return;if(i==0&&t.PreviousNode!=null&&(t=t.PreviousNode,i=t.Length),i>0&&!(t instanceof vi))return;while(t!=null&&t instanceof ir||t instanceof hr)r-=t.Length,t=t.PreviousNode}else{if(i==t.Length&&t.NextNode!=null&&(t=t.NextNode,i=0),i<t.Length&&!(t instanceof vi))return;while(t!=null&&t instanceof ir||t instanceof hr)r+=t.Length,t=t.NextNode}this.Start._SetPositionParagraph(this.Start.Paragraph,r);this.End._SetPositionInternal(this.Start)}},n.prototype._InsertComment=function(){if(this.Start!=null){this.IsEmpty&&this._SelectCurrentWord(!0);var n=this._GetCharacterFormat();this._InsertCommentInternal(n)}},n.prototype._InsertCommentInternal=function(){var e=null,n,s,f,h,c;this.OwnerControl.Selection.SelectionRanges.Count>0&&(this._SelectTextRanges(),e=this.CurrentHistoryInfo);this._InitComplexHistory(i.InsertComment);var o=this.Start,r=this.End,t=new tt(this.ownerControl);this.IsForward||(o=this.End,r=this.Start);t._SetPositionInternal(r);n=new g(null,new Date);s=new u(n);n.Blocks._Add(s);f=new ir(null);f.Comment=n;h=new hr(null);h.Comment=n;n.CommentStart=f;n.CommentEnd=h;c=o._IsInSameParagraph(r);r._SetPositionInternal(o);this._InitInsertInline(f);c&&t._SetPositionParagraph(t.Paragraph,t.Offset+f.Length);o._SetPositionInternal(t);r._SetPositionInternal(t);this._InitInsertInline(h);this._InitInsertInline(n);this.Start._SetPositionParagraph(s,s._GetStartOffset());this._SelectContent(this.Start,!0);e!=null&&(e._AddModifiedAction(this.CurrentHistoryInfo),this.CurrentHistoryInfo=e);this.OwnerControl.Viewer._UpdateCaretPosition();this._UpdateComplexHistory()},n.prototype._DeleteAllComments=function(){var n,t;if(this.ownerControl!=null&&!this.ownerControl.IsReadOnlyMode&&this.ownerControl.Document!=null&&this.ownerControl.Document.Comments.Count!=0){for(this.ownerControl.Viewer!=null&&this.ownerControl.Viewer._ClearSearchHighlight(),this._InitComplexHistory(i.DeleteAllComments),n=this.CurrentHistoryInfo,this.OwnerControl.IsLayoutEnabled=!1;this.OwnerControl.Document.Comments.Count>0;)t=this.ownerControl.Document.Comments[0],this._InitComplexHistory(i.DeleteComment),this._DeleteCommentInternal(t),n._AddModifiedAction(this.CurrentHistoryInfo);this._SelectContent(this.OwnerControl.Document.DocumentStart,!0);this.CurrentHistoryInfo=n;this._UpdateComplexHistory()}},n.prototype._DeleteComment=function(n){this.OwnerControl.Viewer._RemoveCommentRangeWidget();this._InitComplexHistory(i.DeleteComment);this._DeleteCommentInternal(n);this._UpdateComplexHistory()},n.prototype._DeleteCommentInternal=function(n){if(n!=null){var t=n.CommentStart,i=n.CommentEnd;this._RemoveInline(n);this._RemoveInline(i);this._RemoveInline(t)}},n.prototype._NavigatePreviousComment=function(){var i;if(this._IsInComment()){var t=this.Start.Paragraph._GetOwnerComment(),n=this.ownerControl.Document.Comments,r=n._IndexOf(t);t=r==0?n[n.Count-1]:n[r-1];i=t._GetFirstParagraph();i!=null&&(this._SelectParagraph(i,!0,!0),this._SelectContent(this.Start,!0))}},n.prototype._NavigateNextComment=function(){var i;if(this._IsInComment()){var t=this.Start.Paragraph._GetOwnerComment(),n=this.ownerControl.Document.Comments,r=n._IndexOf(t);t=r==n.Count-1?n[0]:n[r+1];i=t._GetFirstParagraph();i!=null&&(this._SelectParagraph(i,!0,!0),this._SelectContent(this.Start,!0))}},n.prototype._RemoveInline=function(n){this.Start._SetPositionParagraph(n.OwnerParagraph,n.OwnerParagraph._GetOffset(n,0));this.End._SetPositionParagraph(this.Start.Paragraph,this.Start.Offset+n.Length);this._InitHistory(i.RemoveInline);this.CurrentBaseHistoryInfo.InsertPosition==null&&(this.CurrentBaseHistoryInfo.InsertPosition=this.Start._GetHierarchicalIndexInternal());this._RemoveSelectedContent();this._UpdateHistory();this._FireContentChanged()},n.prototype._OnParagraphFormat=function(n){this.ownerControl.IsShiftingEnabled=!0;this.IsEmpty?(this._InitHistory(i.ParagraphFormat),this.Start.Paragraph.ParagraphFormat._ApplyPropertyValue(this.CurrentBaseHistoryInfo,null,n,!1)):this.OwnerControl.Selection.SelectionRanges.Count>0&&this._UpdateMultipleSelectionParagraphFormatting(i.ParagraphFormat,n,!1);this._Relayout(!1)},n.prototype._OnStrikeThrough=function(n){if(this.IsEmpty){this.Start.Offset==this.Start.Paragraph._GetLength()&&(this._InitHistory(i.StrikeThrough),this.Start.Paragraph.CharacterFormat._ApplyPropertyValue(this.CurrentBaseHistoryInfo,o.StrikeThroughProperty,n,!1),this._UpdateHistory(),this._FireContentChanged());this._UpdateFocus();return}this.OwnerControl.Selection.SelectionRanges.Count>0&&this._UpdateMultipleSelectionCharacterFormatting(i.StrikeThrough,n,!1)},n.prototype._OnHighlightColor=function(n){if(!this.OwnerControl.IsReadOnlyMode&&this.OwnerControl.IsDocumentLoaded){if(this.IsEmpty){this.Start.Offset==this.Start.Paragraph._GetLength()&&(this._InitHistory(i.HighlightColor),this.Start.Paragraph.CharacterFormat._ApplyPropertyValue(this.CurrentBaseHistoryInfo,o.HighlightColorProperty,n,!1),this._UpdateHistory(),this._FireContentChanged());this._UpdateFocus();return}this.OwnerControl.Selection.SelectionRanges.Count>0&&this._UpdateMultipleSelectionCharacterFormatting(i.HighlightColor,n,!1)}},n.prototype._OnFontFamily=function(n){if(!this.OwnerControl.IsReadOnlyMode&&this.OwnerControl.IsDocumentLoaded){if(this.IsEmpty){this.Start.Offset==this.Start.Paragraph._GetLength()&&(this._InitHistory(i.FontFamily),this.Start.Paragraph.CharacterFormat._ApplyPropertyValue(this.CurrentBaseHistoryInfo,o.FontFamilyProperty,n,!1),this._UpdateHistory(),this._FireContentChanged());this._UpdateFocus();return}this.OwnerControl.Selection.SelectionRanges.Count>0&&this._UpdateMultipleSelectionCharacterFormatting(i.FontFamily,n,!1)}},n.prototype._OnFontColor=function(n){if(!this.OwnerControl.IsReadOnlyMode&&this.OwnerControl.IsDocumentLoaded){if(this.IsEmpty){this.Start.Offset==this.Start.Paragraph._GetLength()&&(this._InitHistory(i.FontColor),this.Start.Paragraph.CharacterFormat._ApplyPropertyValue(this.CurrentBaseHistoryInfo,o.FontColorProperty,n,!1),this._UpdateHistory(),this._FireContentChanged());this._UpdateFocus();return}this.OwnerControl.Selection.SelectionRanges.Count>0&&this._UpdateMultipleSelectionCharacterFormatting(i.FontColor,n,!1)}},n.prototype._OnFontSize=function(n){!this.OwnerControl.IsReadOnlyMode&&this.OwnerControl.IsDocumentLoaded&&this._OnFontSizeWithUpdate(n,!1)},n.prototype._OnFontSizeWithUpdate=function(n,t){if(this.IsEmpty){this.Start.Offset==this.Start.Paragraph._GetLength()&&(this._InitHistory(i.FontSize),this.Start.Paragraph.CharacterFormat._ApplyPropertyValue(this.CurrentBaseHistoryInfo,o.FontSizeProperty,n,t),this._UpdateHistory(),this._FireContentChanged());this._UpdateFocus();return}this.OwnerControl.Selection.SelectionRanges.Count>0&&this._UpdateMultipleSelectionCharacterFormatting(i.FontSize,n,t)},n.prototype._OnItalic=function(){if(!this.OwnerControl.IsReadOnlyMode&&this.OwnerControl.IsDocumentLoaded){if(this.IsEmpty){this.Start.Offset==this.Start.Paragraph._GetLength()&&(this._InitHistory(i.Italic),this.Start.Paragraph.CharacterFormat._ApplyPropertyValue(this.CurrentBaseHistoryInfo,o.ItalicProperty,!this.Start.Paragraph.CharacterFormat.Italic,!1),this._UpdateHistory(),this._FireContentChanged());this._UpdateFocus();return}this.OwnerControl.Selection.SelectionRanges.Count>0&&this._UpdateMultipleSelectionCharacterFormatting(i.Italic,null,!1)}},n.prototype._ToggleUnderline=function(n){var i,e,f,r;if(!this.OwnerControl.IsReadOnlyMode&&this.OwnerControl.IsDocumentLoaded){i=this.Start;e=this.End;this.IsForward||(i=this.End,e=this.Start);var u=0,o=i.Paragraph._GetInline(i.Offset,u),t=o.inline;u=o.index;t!=null&&t.Length==u&&(t=t.NextNode);f=i.Paragraph;r=ki.None;t!=null?r=t.CharacterFormat.Underline:f!=null&&(r=f.CharacterFormat.Underline);n==r?this._OnUnderline(ki.None):this._OnUnderline(n)}},n.prototype._ToggleTextAlignment=function(n){!this.OwnerControl.IsReadOnlyMode&&this.OwnerControl.IsDocumentLoaded&&(this.ParagraphFormat.TextAlignment!=null&&this.ParagraphFormat.TextAlignment==n?n==rt.Left?this._OnTextAlignment(rt.Justify):this._OnTextAlignment(rt.Left):this._OnTextAlignment(n))},n.prototype._OnUnderline=function(n){if(!this.OwnerControl.IsReadOnlyMode&&this.OwnerControl.IsDocumentLoaded){if(this.IsEmpty){this.Start.Offset==this.Start.Paragraph._GetLength()&&(this._InitHistory(i.Underline),this.Start.Paragraph.CharacterFormat._ApplyPropertyValue(this.CurrentBaseHistoryInfo,o.UnderlineProperty,n,!1),this._UpdateHistory(),this._FireContentChanged());this._UpdateFocus();return}this.OwnerControl.Selection.SelectionRanges.Count>0&&this._UpdateMultipleSelectionCharacterFormatting(i.Underline,n,!1)}},n.prototype._ToggleBaselineAlignment=function(n){var i=this.Start,o=this.End,f,r;this.IsForward||(i=this.End,o=this.Start);var u=0,e=i.Paragraph._GetInline(i.Offset,u),t=e.inline;u=e.index;t!=null&&t.Length==u&&(t=t.NextNode);f=i.Paragraph;r=vt.Normal;t!=null?r=t.CharacterFormat.BaselineAlignment:f!=null&&(r=f.CharacterFormat.BaselineAlignment);r==n?this._OnBaselineAlignment(vt.Normal):n==vt.Subscript?this._OnBaselineAlignment(vt.Subscript):this._OnBaselineAlignment(vt.Superscript)},n.prototype._OnBaselineAlignment=function(n){if(!this.OwnerControl.IsReadOnlyMode&&this.OwnerControl.IsDocumentLoaded){if(this.IsEmpty){this.Start.Offset==this.Start.Paragraph._GetLength()&&(this._InitHistory(i.BaselineAlignment),this.Start.Paragraph.CharacterFormat._ApplyPropertyValue(this.CurrentBaseHistoryInfo,o.BaselineAlignmentProperty,!this.Start.Paragraph.CharacterFormat.BaselineAlignment,!1),this._UpdateHistory(),this._FireContentChanged());this._UpdateFocus();return}this.OwnerControl.Selection.SelectionRanges.Count>0&&this._UpdateMultipleSelectionCharacterFormatting(i.BaselineAlignment,n,!1)}},n.prototype._OnBold=function(){if(!this.OwnerControl.IsReadOnlyMode&&this.OwnerControl.IsDocumentLoaded){if(this.IsEmpty){this.Start.Offset==this.Start.Paragraph._GetLength()&&(this._InitHistory(i.Bold),this.Start.Paragraph.CharacterFormat._ApplyPropertyValue(this.CurrentBaseHistoryInfo,o.BoldProperty,!this.Start.Paragraph.CharacterFormat.Bold,!1),this._UpdateHistory(),this._FireContentChanged());this._UpdateFocus();return}this.OwnerControl.Selection.SelectionRanges.Count>0&&this._UpdateMultipleSelectionCharacterFormatting(i.Bold,null,!1)}},n.prototype._UpdateMultipleSelectionCharacterFormatting=function(n,t,r){var u,f;for(this._InitComplexHistory(i.MultiSelection),u=0;u<this.OwnerControl.Selection.SelectionRanges.Count;u++)f=this.OwnerControl.Selection.SelectionRanges._Get(u),this._UpdateCharacterFormat(f,n,t,r),this._Relayout(!1);this._UpdateComplexHistory()},n.prototype._UpdateCharacterFormat=function(n,t,r,u){switch(t){case i.Bold:this._InitializeHistory(i.Bold,n);this._UpdateCharacterFormatForSelRange(n,o.BoldProperty,r);break;case i.Italic:this._InitializeHistory(i.Italic,n);this._UpdateCharacterFormatForSelRange(n,o.ItalicProperty,r);break;case i.FontColor:this._InitializeHistory(i.FontColor,n);this._UpdateCharacterFormatForSelRange(n,o.FontColorProperty,r);break;case i.FontFamily:this._InitializeHistory(i.FontFamily,n);this._UpdateCharacterFormatForSelRange(n,o.FontFamilyProperty,r);break;case i.FontSize:this._InitializeHistory(i.FontSize,n);this._UpdateCharacterFormatForSelRangeWithUpdate(n,o.FontSizeProperty,r,u);break;case i.HighlightColor:this._InitializeHistory(i.HighlightColor,n);this._UpdateCharacterFormatForSelRange(n,o.HighlightColorProperty,r);break;case i.BaselineAlignment:this._InitializeHistory(i.BaselineAlignment,n);this._UpdateCharacterFormatForSelRange(n,o.BaselineAlignmentProperty,r);break;case i.StrikeThrough:this._InitializeHistory(i.StrikeThrough,n);this._UpdateCharacterFormatForSelRange(n,o.StrikeThroughProperty,r);break;case i.Underline:this._InitializeHistory(i.Underline,n);this._UpdateCharacterFormatForSelRange(n,o.UnderlineProperty,r);break;case i.CharacterFormat:this._InitializeHistory(i.CharacterFormat,n);this._UpdateCharacterFormatForSelRange(n,null,r)}},n.prototype._UpdateCharacterFormatForSelRange=function(n,t,i){this._UpdateCharacterFormatForSelRangeWithUpdate(n,t,i,!1)},n.prototype._UpdateCharacterFormatForSelRangeWithUpdate=function(n,t,i,r){this.OwnerControl.IsShiftingEnabled=!0;var u=n.Start,f=n.End;n.IsForward||(u=n.End,f=n.Start);this.CurrentBaseHistoryInfo.InsertPosition==null&&(this.CurrentBaseHistoryInfo.InsertPosition=u._GetHierarchicalIndexInternal());u.Paragraph._ApplyCharacterFormatForSelection(this,u,f,t,i,r);u.Paragraph._StartSelectionRelayouting(this,u,f)},n.prototype._OnDelete=function(){var t,n,r;if(this.Start!=null)if(this.IsEmpty)this._SingleDelete(!1);else if(this.OwnerControl.Selection.SelectionRanges.Count>0){for(this._InitComplexHistory(i.MultiSelection),t=0;t<this.SelectionRanges.Count;t++)n=this.OwnerControl.Selection.SelectionRanges._Get(t),this._InitializeHistory(i.Delete,n),this._DeleteSelectedContent(!1,n.Start,n.End),this._Relayout(!0),this._UpdateSelectionRangeOffSet(t,n.Start,n.End);r=new tt(this.OwnerControl);r._SetPositionForCurrentIndex(this.EditPosition);this._SelectContent(r,!0);this._UpdateComplexHistory()}},n.prototype._SingleDelete=function(n){var f,a,p,w;this._ValidateSelectionBasedOnCommentCharacter(!1);var t=this.Start.Paragraph,o=this.Start.Offset,h=0,y=t._GetInline(this.Start.Offset,h),r=y.inline;if(h=y.index,r!=null&&h==r.Length&&r.NextNode!=null&&(r=r.NextNode,h=0),r instanceof g){this._DeleteComment(r);this._FireContentChanged();return}if(r!=null){if(f=null,a=r._GetNextRenderedInline(h),a instanceof k&&(f=a),f!=null&&f instanceof l){r=f.fieldEnd;t=r.OwnerParagraph;o=t._GetOffset(r,1);this.End._SetPositionParagraph(t,o);this._FireSelectionChanged(!0);return}r!=f&&(r=f,t=r.OwnerParagraph,o=t._GetOffset(r,0),r instanceof b&&o++)}if(o==t._GetLength()){if(t.IsInsideTable&&t.NextBlock==null)return;var c=null,s=null,v=t._GetNextParagraph();if(v==null){if(o>0)return;if(t.PreviousBlock instanceof u&&(c=t.PreviousBlock),t.PreviousBlock instanceof e)return;c==null&&(s=new u(null),t.Owner instanceof yt?t.Owner.ChildNodes._Add(s):t.Owner instanceof g&&t.Owner.Blocks._Add(s))}n||this._InitHistory(i.Delete);this.EditPosition=this.Start._GetHierarchicalIndexInternal();this.CurrentBaseHistoryInfo.InsertPosition==null&&(this.CurrentBaseHistoryInfo.InsertPosition=this.EditPosition,this.CurrentBaseHistoryInfo.EndPosition=this.EditPosition);this.OwnerControl.IsShiftingEnabled=!0;t._IsEmpty()?(t._RemoveBlock(),this.CurrentBaseHistoryInfo.RemovedNodes._Add(t),v==null?c==null?(this._SelectParagraph(s,!0,!0),p=s.GetLength()+1,this.CurrentBaseHistoryInfo.InsertPosition=this.Start._GetHierarchicalIndexInternal(),this.CurrentBaseHistoryInfo.EndPosition=s.GetHierarchicalIndex(p.toString())):(this._SelectParagraph(c,!1,!0),this.CurrentBaseHistoryInfo.InsertPosition=this.Start._GetHierarchicalIndexInternal(),this.CurrentBaseHistoryInfo.EndPosition=this.CurrentBaseHistoryInfo.InsertPosition):this._SelectParagraph(v,!0,!0)):(w=t._SplitParagraph(0,this.Start.Offset),t._RemoveBlock(),w._DeleteParagraphMark(this,0),this.CurrentBaseHistoryInfo.RemovedNodes._Add(t),this.Start._SetPositionForCurrentIndex(this.EditPosition),this._SelectContent(this.Start,!0));n||this._Relayout(!0)}else n||(this.OwnerControl.IsShiftingEnabled=!0,this._InitHistory(i.Delete)),this.CurrentBaseHistoryInfo.InsertPosition==null&&(this.CurrentBaseHistoryInfo.InsertPosition=this.Start._GetHierarchicalIndexInternal(),this.CurrentBaseHistoryInfo.EndPosition=this.CurrentBaseHistoryInfo.InsertPosition),t._RemoveAtOffset(this.CurrentBaseHistoryInfo,this.Start.Offset),this._Selects(this.Start.Paragraph,this.Start.Offset,!0),n?this._FireContentChanged():this._Relayout(!0)},n.prototype._DeleteSelectedContent=function(n,t,i){var u=t,r=i,f,o,s;return t._IsExistBefore(i)||(u=i,r=t),this.EditPosition=u._GetHierarchicalIndexInternal(),f=!1,n&&u._IsInSameParagraph(r)&&(u.Offset<r.Offset&&u.Offset==r.Paragraph._GetLength()&&(o=u.Paragraph._GetNextRenderedBlock(),f=o instanceof e),r.Offset==1&&r.Offset>r.Paragraph._GetLength()&&!(r.Paragraph.IsInsideTable&&r.Paragraph.NextBlock==null)&&(n=!1)),f||(this.OwnerControl.IsShiftingEnabled=!0,this.CurrentBaseHistoryInfo.InsertPosition==null&&(this.CurrentBaseHistoryInfo.InsertPosition=this.EditPosition),s=n?1:0,u.Paragraph._DeleteSelectedContent(this,u,r,s)),f},n.prototype._DeleteSelectedContents=function(n){var i=this._DeleteSelectedContent(n,this.Start,this.End),t=new tt(this.OwnerControl);return t._SetPositionForCurrentIndex(this.EditPosition),this._SelectContent(t,!0),i},n.prototype._UpdateSelectionRangeOffSet=function(n,t,i){for(var r=null,f=null,e=0,u,e=t.Paragraph==i.Paragraph?i.Offset-t.Offset:i.Offset,o=n+1;o<this.SelectionRanges.Count;o++)u=this.SelectionRanges._Get(o),r=u.Start,f=u.End,t.Paragraph==r.Paragraph&&i.Paragraph==f.Paragraph||i.Paragraph==r.Paragraph&&i.Paragraph==f.Paragraph?r.Offset>t.Offset&&(u.Start._SetPositionParagraph(r.Paragraph,r.Offset-e),u.End._SetPositionParagraph(f.Paragraph,f.Offset-e)):i.Paragraph==r.Paragraph&&u.Start._SetPositionParagraph(r.Paragraph,r.Offset-e)},n.prototype._UpdateSelectionRangeOffSetInternal=function(n){var i=0,r,t;if(this.SelectionRanges.Count>1)for(r=0;r<n;r++)t=this.SelectionRanges[r],i=t.Start.Paragraph==t.End.Paragraph?t.End.Offset-t.Start.Offset:t.End.Offset,t.Start.Paragraph==this.Start.Paragraph&&t.End.Paragraph==this.End.Paragraph||this.Start.Paragraph==this.End.Paragraph&&t.End.Paragraph==this.Start.Paragraph&&t.End.Paragraph==this.End.Paragraph?t.Start.Offset<this.Start.Offset&&(this.Start._SetPositionParagraph(this.Start.Paragraph,this.Start.Offset+i),this.End._SetPositionParagraph(this.End.Paragraph,this.End.Offset+i)):t.End.Paragraph==this.Start.Paragraph&&this.Start._SetPositionParagraph(this.Start.Paragraph,this.Start.Offset+i)},n.prototype._SelectTableCell=function(n,t){var r=n._GetFirstParagraph(),i=n._GetLastParagraph();r==i&&i._IsEmpty()?this._SelectParagraph(i,!0,t):(t&&this.SelectionRanges._ClearMultiSelection(),this.Start._SetPosition(r,!0),this.End._SetPositionParagraph(i,i._GetEndOffset()),this._FireSelectionChanged(!0))},n.prototype._OnApplyList=function(n,t){var r=new bi(null);n!=null&&t>=0&&t<9&&(r.List=n,r.ListLevelNumber=t);this.IsEmpty?(this._InitHistory(i.ListFormat),this.Start.Paragraph.ParagraphFormat._ApplyPropertyValueInternal(this.CurrentBaseHistoryInfo,a.ListFormatProperty,r)):this.OwnerControl.Selection.SelectionRanges.Count>0&&this._UpdateMultipleSelectionParagraphFormatting(i.ListFormat,r,!1);this.OwnerControl.IsShiftingEnabled=!0;this._Relayout(!1)},n.prototype._RetrieveCharacterFormat=function(n,t){var i,r,e,u,f;if(this.CharacterFormat._CopyFormat(n.Paragraph.CharacterFormat),n.Paragraph!=t.Paragraph||n.Offset+1!=t.Offset){for(i=n.Paragraph,n.Offset!=i._GetLength()||this.IsEmpty||(i=i._GetNextParagraph());i!=null&&i!=t.Paragraph&&i._IsEmpty();)i=i._GetNextParagraph();r=i==n.Paragraph?n.Offset:0;e=0;i==null||i._IsEmpty()||(u=new tt(null),f=i._GetInline(r,e),u._SetPositionPhysicalLocation(i,f.inline,f.index,i._GetPhysicalPosition(r)),i._GetCharacterFormatForSelection(this,u,t))}},n.prototype._RetrieveParagraphFormat=function(n,t){n.Paragraph._GetParagraphFormatForSelection(this,n,t)},n.prototype._RetrieveSectionFormat=function(n,t){var r,u,i;if(n.Paragraph.Section!=null)for(this.SectionFormat._CopyFormat(n.Paragraph.Section.SectionFormat),r=this.ownerControl.Document.Sections._IndexOf(n.Paragraph.Section),u=this.ownerControl.Document.Sections._IndexOf(t.Paragraph.Section),i=r+1;i<=u;i++)this.SectionFormat._CombineFormat(this.ownerControl.Document.Sections[i].SectionFormat)},n.prototype._RetrieveTableFormat=function(n,t){var i=this._GetTable(n,t);i!=null?(this.TableFormat._CopyFormat(i.TableFormat),this.TableFormat.Table=i,this._RetrieveCellFormat(n,t),this._RetriveRowFormat(n,t)):this.TableFormat._ClearFormat()},n.prototype._RetrieveCellFormat=function(n,t){n.Paragraph.IsInsideTable&&t.Paragraph.IsInsideTable?(this.CellFormat._CopyFormat(n.Paragraph.AssociatedCell.CellFormat),n.Paragraph.AssociatedCell.OwnerTable._GetCellFormat(this,n,t)):this.CellFormat._ClearCellFormat()},n.prototype._RetriveRowFormat=function(n,t){n.Paragraph.IsInsideTable&&t.Paragraph.IsInsideTable?(this.RowFormat._CopyFormat(n.Paragraph.AssociatedCell.OwnerRow.RowFormat),n.Paragraph.AssociatedCell.OwnerTable._GetRowFormat(this,n,t)):this.RowFormat._ClearRowFormat()},n.prototype._ReplaceAll=function(n){var r,t;if(this.OwnerControl==null||this.OwnerControl.IsReadOnlyMode||this.OwnerControl.textSearchResults==null||this.ownerControl.textSearchResults.Count==0)return 0;for(this.OwnerControl.Viewer!=null&&this.OwnerControl.Viewer._ClearSearchHighlight(),this._InitComplexHistory(i.ReplaceAll),r=this.OwnerControl.textSearchResults.Count,this.OwnerControl.IsLayoutEnabled=!1,t=r-1;t>=0;t--)this.OwnerControl.textSearchResults._GetResult(t)._Navigate(),this._InsertText(n,!0),this.OwnerControl.textSearchResults._GetResult(t)._Dispose(),this.OwnerControl.textSearchResults._RemoveAt(t);return this._UpdateComplexHistory(),r},n.prototype._UpdateImageSize=function(n){var u,r,f,o,s;this.OwnerControl.IsShiftingEnabled=!0;u=this.Start;r=this.End;this.IsForward||(u=this.End,r=this.Start);var t=null,e=0,i=u.Paragraph;i==r.Paragraph&&u.Offset+1==r.Offset&&(f=i._GetInline(r.Offset,e),t=f.inline,e=f.index);t instanceof pt&&(o=t.Width,s=t.Height,t.Width=n.Width,t.Height=n.Height,n.Width=o,n.Height=s,i!=null&&i.BaseParent!=null&&(i._RelayoutParagraph(i.Inlines._IndexOf(t)),this._HighlightSelection(!1)))},n.prototype._GetSelectedCells=function(){for(var t,i=new h,n=0;n<this.SelectionRanges.Last.SelectedWidgets.Keys.length;n++)t=this.SelectionRanges.Last.SelectedWidgets.Keys[n],t instanceof ii&&i._Add(t.TableCell);return i},n.prototype._UpdateTableFormat=function(n,t,i){var r=n.Start,u=n.End;n.IsForward||(r=n.End,u=n.Start);this.CurrentBaseHistoryInfo.InsertPosition==null&&(this.CurrentBaseHistoryInfo.InsertPosition=r._GetHierarchicalIndexInternal());r.Paragraph.AssociatedCell.OwnerTable.TableFormat._ApplyPropertyValue(this.CurrentBaseHistoryInfo,t,i)},n.prototype._UpdateCellFormat=function(n,t,i){var r=n.Start,u=n.End;n.IsForward||(r=n.End,u=n.Start);this.CurrentBaseHistoryInfo.InsertPosition==null&&(this.CurrentBaseHistoryInfo.InsertPosition=r._GetHierarchicalIndexInternal());r.Paragraph.AssociatedCell._ApplyCellFormat(this,r,u,t,i)},n.prototype._UpdateRowFormat=function(n,t,i){var r=n.Start,u=n.End;n.IsForward||(r=n.End,u=n.Start);this.CurrentBaseHistoryInfo.InsertPosition==null&&(this.CurrentBaseHistoryInfo.InsertPosition=r._GetHierarchicalIndexInternal());r.Paragraph.AssociatedCell.OwnerRow._ApplyRowFormat(this,r,u,t,i)},n.prototype._InitResizingHistory=function(n){var t,r;this.OwnerControl.ResizeNode==1?(this._InitHistory(i.RowResizing),this.CurrentBaseHistoryInfo!=null&&this.CurrentBaseHistoryInfo.ModifiedProperties._Add(new ie(n,this.OwnerControl.CurrentResizingTable.Rows[this.OwnerControl.ResizerPosition].RowFormat))):(this._InitHistory(i.CellResizing),this.CurrentBaseHistoryInfo!=null&&(t=new te(n),t.StartIndex=this.OwnerControl.ResizerPosition,r=this.OwnerControl.CurrentResizingTable.TableWidgets[this.OwnerControl.CurrentResizingTable.TableWidgets.Count-1],t.startX=n.X-r.X,t.startY=n.Y-r.Y,t.TableHierarchicalIndex=this.OwnerControl.CurrentResizingTable._GetHierarchicalIndex("0"),this.CurrentBaseHistoryInfo.ModifiedProperties._Add(t)))},n.prototype._UpdateResizingHistory=function(n){var i,t;this.OwnerControl.ResizeNode==1?this.CurrentBaseHistoryInfo!=null&&(i=this.CurrentBaseHistoryInfo.ModifiedProperties[0],i.StartingPoint.Y==n.Y?this.CurrentBaseHistoryInfo.ModifiedProperties._Clear():(i.Displacement=n.Y-i.StartingPoint.Y,this.OwnerControl.History._RecordChanges(this.CurrentBaseHistoryInfo),this.CurrentBaseHistoryInfo=null)):this.CurrentBaseHistoryInfo!=null&&(t=this.CurrentBaseHistoryInfo.ModifiedProperties[0],t.StartingPoint.X==n.X?this.CurrentBaseHistoryInfo.ModifiedProperties._Clear():(t.displacment=n.X-t.StartingPoint.X,t.EndIndex=this.OwnerControl.Viewer._GetCellReSizerPosition(n),this.OwnerControl.History._RecordChanges(this.CurrentBaseHistoryInfo),this.CurrentBaseHistoryInfo=null))},n.prototype._OnTableFormat=function(n){this.TableFormat!=null&&(this.ownerControl.IsShiftingEnabled=!0,this._InitHistory(i.TableFormat),this.TableFormat.Table.TableFormat._ApplyPropertyValue(this.CurrentBaseHistoryInfo,null,n),this._Relayout(!1))},n.prototype._OnCellFormat=function(n,t){t!=null&&(this.ownerControl.IsShiftingEnabled=!0,this._InitHistory(i.CellFormat),t.CellFormat._ApplyPropertyValue(this.CurrentBaseHistoryInfo,null,n),this._Relayout(!1))},n.prototype._OnRowFormat=function(n,t){t!=null&&(this.ownerControl.IsShiftingEnabled=!0,this._InitHistory(i.RowFormat),t.RowFormat._ApplyPropertyValue(this.CurrentBaseHistoryInfo,null,n),this._Relayout(!1))},n.prototype._UpdateSelectionTextPosition=function(n){this.Start._UpdatePhysicalPosition();this.IsEmpty?this.End._SetPositionInternal(this.Start):this.End._UpdatePhysicalPosition();this.UpDownSelectionLength=this.End.Location.X;this._FireSelectionChanged(n);this._UpdateHistory();this._FireContentChanged()},n.prototype._UpdateListChanges=function(n){var i,r,t;for(this.OwnerControl.IsLayoutEnabled=!1,this.OwnerControl.Document._UpdateListParagraphs(),i=0;i<n.ModifiedLevels.Keys.Count;i++)r=n.ModifiedLevels.Keys[0],t=n.ModifiedLevels._Get(r),this.CurrentBaseHistoryInfo!=null&&(t=this.CurrentBaseHistoryInfo._AddModifiedPropertiesForList(t.OwnerListLevel)),t.OwnerListLevel._CopyLevel(t.ModifiedListLevel);this.OwnerControl.Document._RevertListChanges(this.CurrentBaseHistoryInfo);this.OwnerControl.IsLayoutEnabled=!0;this.OwnerControl.Document._LayoutItems(this.OwnerControl.Viewer);this.Start._UpdatePhysicalPosition();this.IsEmpty?this.End._SetPositionInternal(this.Start):this.End._UpdatePhysicalPosition();this.UpDownSelectionLength=this.End.Location.X;this._FireSelectionChanged(!1);this._UpdateHistory();this._FireContentChanged()},n.prototype._Dispose=function(){this.editingContext!=null&&this.editingContext!=undefined&&(this.editingContext=null)},n}();t.SelectionAdv=cf;lf=function(){function n(n,t){this.height=n;this.width=t}return Object.defineProperty(n.prototype,"Width",{get:function(){return this.width},set:function(n){this.width=n},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"Height",{get:function(){return this.height},set:function(n){this.height=n},enumerable:!0,configurable:!0}),n}();t.Size=lf;tu=function(){function n(n,t,i,r){this.Left=n;this.Right=t;this.Top=i;this.Bottom=r}return Object.defineProperty(n.prototype,"Left",{get:function(){return this.left},set:function(n){this.left=n},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"Right",{get:function(){return this.right},set:function(n){this.right=n},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"Top",{get:function(){return this.top},set:function(n){this.top=n},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"Bottom",{get:function(){return this.bottom},set:function(n){this.bottom=n},enumerable:!0,configurable:!0}),n}();t.Thickness=tu;af=function(){function n(n){this.bold=null;this.italic=null;this.underline=null;this.strikeThrough=null;this.baselineAlignment=null;this.highlightColor=null;this.fontSize=0;this.fontColor=null;this.selection=n}return Object.defineProperty(n.prototype,"FontSize",{get:function(){return this.fontSize},set:function(n){n!=this.fontSize&&(this.fontSize=n,this._NotifyPropertyChanged("FontSize"))},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"FontFamily",{get:function(){return this.fontFamily},set:function(n){n!=this.fontFamily&&(this.fontFamily=n,this._NotifyPropertyChanged("FontFamily"))},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"FontColor",{get:function(){return this.fontColor},set:function(n){n!=this.fontColor&&(this.fontColor=n,this._NotifyPropertyChanged("FontColor"))},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"Bold",{get:function(){return this.bold},set:function(n){n!=this.bold&&(this.bold=n,this._NotifyPropertyChanged("Bold"))},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"Italic",{get:function(){return this.italic},set:function(n){n!=this.italic&&(this.italic=n,this._NotifyPropertyChanged("Italic"))},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"StrikeThrough",{get:function(){return this.strikeThrough},set:function(n){n!=this.strikeThrough&&(this.strikeThrough=n,this._NotifyPropertyChanged("StrikeThrough"))},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"BaselineAlignment",{get:function(){return this.baselineAlignment},set:function(n){n!=this.baselineAlignment&&(this.baselineAlignment=n,this._NotifyPropertyChanged("BaselineAlignment"))},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"Underline",{get:function(){return this.underline},set:function(n){n!=this.underline&&(this.underline=n,this._NotifyPropertyChanged("Underline"))},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"HighlightColor",{get:function(){return this.highlightColor},set:function(n){n!=this.highlightColor&&(this.highlightColor=n,this._NotifyPropertyChanged("HighlightColor"))},enumerable:!0,configurable:!0}),n.prototype._NotifyPropertyChanged=function(n){if((this.selection==null||this.selection.OwnerControl.IsDocumentLoaded||this.selection.IsRetrieveFormatting)&&this.selection!=null&&this.selection.Start!=null&&!this.selection.IsRetrieveFormatting)switch(n){case"Bold":(this.bold!=null||this.bold!=undefined)&&this.selection._OnBold();break;case"Italic":(this.italic!=null||this.italic!=undefined)&&this.selection._OnItalic();break;case"FontSize":this.fontSize>=1&&this.selection._OnFontSize(this.fontSize);break;case"FontFamily":(this.fontFamily!=null||this.fontFamily!=undefined)&&this.selection._OnFontFamily(this.fontFamily);break;case"StrikeThrough":(this.strikeThrough!=null||this.strikeThrough!=undefined)&&this.selection._OnStrikeThrough(this.strikeThrough);break;case"BaselineAlignment":(this.baselineAlignment!=null||this.baselineAlignment!=undefined)&&this.selection._OnBaselineAlignment(this.baselineAlignment);break;case"HighlightColor":(this.highlightColor!=null||this.highlightColor!=undefined)&&this.selection._OnHighlightColor(this.highlightColor);break;case"Underline":(this.underline!=null||this.underline!=undefined)&&this.selection._OnUnderline(this.underline);break;case"FontColor":(this.fontColor!=null||this.fontColor!=undefined)&&this.selection._OnFontColor(this.fontColor)}},n.prototype._CopyFormat=function(n){this.FontSize=n.FontSize;this.FontFamily=n.FontFamily;this.Bold=n.Bold;this.Italic=n.Italic;this.BaselineAlignment=n.BaselineAlignment;this.Underline=n.Underline;this.FontColor=n.FontColor;this.HighlightColor=n.HighlightColor;this.StrikeThrough=n.StrikeThrough},n.prototype._CombineFormat=function(n){this.Bold!=null&&this.Bold!=n.Bold&&(this.Bold=null);this.Italic!=null&&this.Italic!=n.Italic&&(this.Italic=null);this.FontSize!=0&&this.FontSize!=n.FontSize&&(this.FontSize=0);this.FontFamily!=null&&this.FontFamily!=n.FontFamily&&(this.FontFamily=null);this.HighlightColor!=null&&this.HighlightColor!=n.HighlightColor&&(this.HighlightColor=null);this.BaselineAlignment!=null&&this.BaselineAlignment!=n.BaselineAlignment&&(this.BaselineAlignment=null);this.FontColor!=null&&this.FontColor!=n.FontColor&&(this.FontColor=null);this.Underline!=null&&this.Underline!=n.Underline&&(this.Underline=null);this.StrikeThrough!=null&&this.StrikeThrough!=n.StrikeThrough&&(this.StrikeThrough=null)},n.prototype._CopyToFormat=function(n){n!=null&&(this.Bold!=null&&(n.Bold=this.Bold),this.Italic!=null&&(n.Italic=this.Italic),this.FontSize>0&&(n.FontSize=this.FontSize),this.FontFamily!=null&&(n.FontFamily=this.FontFamily),this.HighlightColor!=null&&(n.HighlightColor=this.HighlightColor),this.BaselineAlignment!=null&&(n.BaselineAlignment=this.BaselineAlignment),this.FontColor!=null&&(n.FontColor=this.FontColor),this.Underline!=null&&(n.Underline=this.Underline),this.StrikeThrough!=null&&(n.StrikeThrough=this.StrikeThrough))},n.prototype._CloneFormat=function(n){this.Bold=n.Bold;this.Italic=n.Italic;this.Underline=n.Underline;this.StrikeThrough=n.StrikeThrough;this.BaselineAlignment=n.BaselineAlignment;this.HighlightColor=n.HighlightColor;this.FontSize=n.FontSize;this.FontFamily=n.FontFamily;this.FontColor=n.FontColor},n.prototype._IsEqualFormat=function(n){return this.FontSize==n.FontSize&&this.FontFamily==n.FontFamily&&this.Bold==n.Bold&&this.Italic==n.Italic&&this.BaselineAlignment==n.BaselineAlignment&&this.Underline==n.Underline&&this.FontColor==n.FontColor&&this.StrikeThrough==n.StrikeThrough&&this.HighlightColor==n.HighlightColor},n.prototype._ClearFormat=function(){this.fontSize=0;this.bold=null;this.italic=null;this.fontFamily=null;this.fontColor=null;this.underline=null;this.strikeThrough=null;this.baselineAlignment=null},n.prototype._Dispose=function(){this.selection=null;this.bold=null;this.italic=null;this.fontFamily=null;this.fontColor=null;this.underline=null;this.strikeThrough=null;this.baselineAlignment=null},n}();t.SelectionCharacterFormat=af;vf=function(){function n(n){this.leftIndent=0;this.rightIndent=0;this.beforeSpacing=0;this.afterSpacing=0;this.textAlignment=null;this.firstLineIndent=0;this.lineSpacing=1;this.lineSpacingType=null;this.listLevelNumber=-1;this.selection=n}return Object.defineProperty(n.prototype,"LeftIndent",{get:function(){return this.leftIndent},set:function(n){n!=this.leftIndent&&(this.leftIndent=n,this._NotifyPropertyChanged("LeftIndent"))},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"RightIndent",{get:function(){return this.rightIndent},set:function(n){n!=this.rightIndent&&(this.rightIndent=n,this._NotifyPropertyChanged("RightIndent"))},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"FirstLineIndent",{get:function(){return this.firstLineIndent},set:function(n){n!=this.firstLineIndent&&(this.firstLineIndent=n,this._NotifyPropertyChanged("FirstLineIndent"))},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"TextAlignment",{get:function(){return this.textAlignment},set:function(n){n!=this.textAlignment&&(this.textAlignment=n,this._NotifyPropertyChanged("TextAlignment"))},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"AfterSpacing",{get:function(){return this.afterSpacing},set:function(n){n!=this.afterSpacing&&(this.afterSpacing=n,this._NotifyPropertyChanged("AfterSpacing"))},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"BeforeSpacing",{get:function(){return this.beforeSpacing},set:function(n){n!=this.beforeSpacing&&(this.beforeSpacing=n,this._NotifyPropertyChanged("BeforeSpacing"))},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"LineSpacing",{get:function(){return this.lineSpacing},set:function(n){n!=this.lineSpacing&&(this.lineSpacing=n,this._NotifyPropertyChanged("LineSpacing"))},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"LineSpacingType",{get:function(){return this.lineSpacingType},set:function(n){n!=this.lineSpacingType&&(this.lineSpacingType=n,this._NotifyPropertyChanged("LineSpacingType"))},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"ListLevelNumber",{get:function(){return this.listLevelNumber},set:function(n){n!=this.listLevelNumber&&(this.listLevelNumber=n,this._NotifyPropertyChanged("ListLevelNumber"))},enumerable:!0,configurable:!0}),n.prototype._NotifyPropertyChanged=function(n){if((this.selection==null||this.selection.OwnerControl.IsDocumentLoaded||this.selection.IsRetrieveFormatting)&&this.selection!=null&&this.selection.Start!=null&&!this.selection.IsRetrieveFormatting)switch(n){case"LeftIndent":this.leftIndent>=-1056&&this.leftIndent<1056&&this.selection._OnLeftIndent(this.leftIndent);break;case"RightIndent":this.rightIndent>=-1056&&this.rightIndent<1056&&this.selection._OnRightIndent(this.rightIndent);break;case"FirstLineIndent":this.firstLineIndent>=-1056&&this.firstLineIndent<1056&&this.selection._OnFirstLineIndent(this.firstLineIndent);break;case"BeforeSpacing":this.selection._OnBeforeSpacing(this.beforeSpacing);break;case"AfterSpacing":this.selection._OnAfterSpacing(this.afterSpacing);break;case"TextAlignment":this.selection._OnTextAlignment(this.textAlignment);break;case"LineSpacing":this.selection._OnLineSpacing(this.lineSpacing);break;case"LineSpacingType":this.lineSpacingType&&this.selection._OnLineSpacingType(this.lineSpacingType);break;case"ListLevelNumber":this.list!=null&&this.selection._OnApplyList(this.list,this.listLevelNumber)}},n.prototype._IsEqualFormat=function(n){return this.LeftIndent==n.LeftIndent&&this.RightIndent==n.RightIndent&&this.FirstLineIndent==n.FirstLineIndent&&this.AfterSpacing==n.AfterSpacing&&this.BeforeSpacing==n.BeforeSpacing&&this.LineSpacing==n.LineSpacing&&this.LineSpacingType==n.LineSpacingType&&this.TextAlignment==n.TextAlignment},n.prototype._CloneFormat=function(n){this.LeftIndent=n.LeftIndent;this.RightIndent=n.RightIndent;this.FirstLineIndent=n.FirstLineIndent;this.AfterSpacing=n.AfterSpacing;this.BeforeSpacing=n.BeforeSpacing;this.LineSpacing=n.LineSpacing;this.LineSpacingType=n.LineSpacingType;this.TextAlignment=n.TextAlignment;this.ListLevelNumber=n.ListLevelNumber},n.prototype._CopyFormat=function(n){this.LeftIndent=n.LeftIndent;this.RightIndent=n.RightIndent;this.FirstLineIndent=n.FirstLineIndent;this.AfterSpacing=n.AfterSpacing;this.BeforeSpacing=n.BeforeSpacing;this.LineSpacing=n.LineSpacing;this.LineSpacingType=n.LineSpacingType;this.TextAlignment=n.TextAlignment;n.ListFormat!=null&&n.ListFormat.List!=null?(this.list=n.ListFormat.List,this.listLevelNumber=n.ListFormat.ListLevelNumber):(this.list=null,this.listLevelNumber=0)},n.prototype._CombineFormat=function(n){isNaN(this.LeftIndent)||this.LeftIndent==n.LeftIndent||(this.LeftIndent=Number.NaN);isNaN(this.RightIndent)||this.RightIndent==n.RightIndent||(this.RightIndent=Number.NaN);isNaN(this.FirstLineIndent)||this.FirstLineIndent==n.FirstLineIndent||(this.FirstLineIndent=Number.NaN);this.LineSpacing!=0&&this.LineSpacing!=n.LineSpacing&&(this.LineSpacing=0);this.BeforeSpacing!=-1&&this.BeforeSpacing!=n.BeforeSpacing&&(this.BeforeSpacing=-1);this.AfterSpacing!=-1&&this.AfterSpacing!=n.AfterSpacing&&(this.AfterSpacing=-1);this.LineSpacingType!=null&&this.LineSpacingType!=n.LineSpacingType&&(this.LineSpacingType=null);this.TextAlignment!=null&&this.TextAlignment!=n.TextAlignment&&(this.TextAlignment=null);this.ListLevelNumber>=0&&this.list!=null&&(n.ListFormat==null||n.ListFormat.ListLevelNumber!=this.ListLevelNumber)&&(this.ListLevelNumber=-1);(n.ListFormat==null||n.ListFormat.List==null||this.list!=null&&this.list!=n.ListFormat.List)&&(this.list=null)},n.prototype._CopyToFormat=function(n){isNaN(this.LeftIndent)||(n.LeftIndent=this.LeftIndent);isNaN(this.RightIndent)||(n.RightIndent=this.RightIndent);isNaN(this.FirstLineIndent)||(n.FirstLineIndent=this.FirstLineIndent);this.AfterSpacing>=0&&(n.AfterSpacing=this.AfterSpacing);this.BeforeSpacing>=0&&(n.BeforeSpacing=this.BeforeSpacing);this.LineSpacingType!=null&&(n.LineSpacingType=this.LineSpacingType);this.LineSpacing>0&&(n.LineSpacing=this.LineSpacing);this.TextAlignment!=null&&(n.TextAlignment=this.TextAlignment)},n.prototype._ClearFormat=function(){this.leftIndent=0;this.rightIndent=0;this.beforeSpacing=0;this.afterSpacing=0;this.firstLineIndent=0;this.lineSpacing=1;this.textAlignment=null;this.lineSpacingType=null;this.list=null;this.listLevelNumber=-1},n.prototype._SetList=function(n){var e,u,t,o,f,r;if(this.list!=null&&n!=null&&n.AbstractList!=null&&n.SourceListId==this.list.ListId){for(e=this.list._GetListLevel(1),this.selection.OwnerControl.IsLayoutEnabled=!1,this.selection.CurrentBaseHistoryInfo=new eu(this.selection.OwnerControl),this.selection.CurrentBaseHistoryInfo.Action=i.List,this.selection.CurrentBaseHistoryInfo._UpdateSelection(this.selection),u=new ne,t=0;t<n.AbstractList.Levels.Count;t++)o=this.selection.CurrentBaseHistoryInfo._AddModifiedPropertiesForList(this.list.AbstractList.Levels[t]),f=new ou(this.list.AbstractList.Levels[t],n.AbstractList.Levels[t]),this.list.AbstractList.Levels[t]._CopyLevel(n.AbstractList.Levels[t]),u.ModifiedLevels._Add(t,f);this.selection.OwnerControl.Document._UpdateListParagraphs();this.selection.OwnerControl.Document._ApplyListChanges(this.selection.CurrentBaseHistoryInfo,u);this.selection.OwnerControl.IsLayoutEnabled=!0;this.selection.OwnerControl.Document._LayoutItems(this.selection.OwnerControl.Viewer);this.selection._UpdateSelectionTextPosition(!1)}else if(n!=null){if(r=this.selection.OwnerControl.Document,r==null)return;this.selection.OwnerControl.IsLayoutEnabled=!1;n.AbstractList==null||r.AbstractLists._Contains(n.AbstractList)||r.AbstractLists._Add(n.AbstractList);r.Lists._Contains(n)||r.Lists._Add(n);n.AbstractList._SetOwner(r);n._SetOwner(r);n.AbstractListId=n.AbstractList.AbstractListId;this.selection.OwnerControl.IsLayoutEnabled=!0;this.selection._OnApplyListInternal(n)}else this.selection._OnApplyListInternal(null)},n.prototype._GetList=function(){var t,i,r,n,u;if(this.list!=null){if(t=new fr(null),i=new nr(null),this.list.AbstractList!=null)for(n=0;n<this.list.AbstractList.Levels.Count;n++)r=this.list.AbstractList.Levels[n]._Clone(),i.Levels._Add(r);else i.AddListLevel();if(this.list.LevelOverrides!=null)for(n=0;n<this.list.LevelOverrides.Count;n++)u=this.list.LevelOverrides[n]._Clone(),t.LevelOverrides._Add(u);return t.AbstractList=i,t.ListId=this.list.ListId,t.SourceListId=this.list.ListId,t}},n.prototype._Dispose=function(){this.selection=null;this.textAlignment=null;this.lineSpacingType=null;this.list=null},n}();t.SelectionParagraphFormat=vf;ye=function(){function n(n){this.differentFirstPage=null;this.differentOddAndEvenPages=null;this.selection=n}return Object.defineProperty(n.prototype,"PageHeight",{get:function(){return this.pageHeight},set:function(n){this.pageHeight=n;this._NotifyPropertyChanged("PageSize")},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"PageWidth",{get:function(){return this.pageWidth},set:function(n){this.pageWidth=n;this._NotifyPropertyChanged("PageSize")},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"LeftMargin",{get:function(){return this.leftMargin},set:function(n){this.leftMargin=n;this._NotifyPropertyChanged("PageMargin")},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"RightMargin",{get:function(){return this.rightMargin},set:function(n){this.rightMargin=n;this._NotifyPropertyChanged("PageMargin")},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"TopMargin",{get:function(){return this.topMargin},set:function(n){this.topMargin=n;this._NotifyPropertyChanged("PageMargin")},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"BottomMargin",{get:function(){return this.bottomMargin},set:function(n){this.bottomMargin=n;this._NotifyPropertyChanged("PageMargin")},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"HeaderDistance",{get:function(){return this.headerDistance},set:function(n){this.headerDistance=n;this._NotifyPropertyChanged("HeaderDistance")},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"FooterDistance",{get:function(){return this.footerDistance},set:function(n){this.footerDistance=n;this._NotifyPropertyChanged("FooterDistance")},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"DifferentFirstPage",{get:function(){return this.differentFirstPage},set:function(n){this.differentFirstPage=n;this._NotifyPropertyChanged("DifferentFirstPage")},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"DifferentOddAndEvenPages",{get:function(){return this.differentOddAndEvenPages},set:function(n){this.differentOddAndEvenPages=n;this._NotifyPropertyChanged("DifferentOddAndEvenPages")},enumerable:!0,configurable:!0}),n.prototype._NotifyPropertyChanged=function(n){var t,i;if((this.selection==null||!this.selection.IsCleared&&this.selection.OwnerControl.IsDocumentLoaded||this.selection.IsRetrieveFormatting)&&this.selection!=null&&this.selection.Start!=null&&!this.selection.IsRetrieveFormatting)switch(n){case"PageSize":this.PageHeight>0&&this.PageWidth>0&&(t=new lf(this.PageHeight,this.PageWidth),this.selection._OnPageSizeChanged(t));break;case"PageMargin":if(this.LeftMargin>=0&&this.RightMargin>=0&&this.TopMargin>=0&&this.BottomMargin>=0){i=new tu(this.LeftMargin,this.RightMargin,this.TopMargin,this.BottomMargin);this.selection._OnPageMarginChanged(i);break}}},n.prototype._CopyFormat=function(n){this.PageHeight=n.PageHeight;this.PageWidth=n.PageWidth;this.LeftMargin=n.LeftMargin;this.TopMargin=n.TopMargin;this.RightMargin=n.RightMargin;this.BottomMargin=n.BottomMargin;this.HeaderDistance=n.HeaderDistance;this.FooterDistance=n.FooterDistance;this.DifferentFirstPage=n.DifferentFirstPage;this.DifferentOddAndEvenPages=n.DifferentOddAndEvenPages},n.prototype._CombineFormat=function(n){this.PageHeight>0&&this.PageHeight!=n.PageHeight&&(this.pageHeight=0);this.PageWidth>0&&this.PageWidth!=n.PageWidth&&(this.pageWidth=0);this.LeftMargin>-1&&this.LeftMargin!=n.LeftMargin&&this.LeftMargin-1;this.TopMargin>-1&&this.TopMargin!=n.TopMargin&&(this.TopMargin=-1);this.RightMargin>-1&&this.RightMargin!=n.RightMargin&&(this.RightMargin=-1);this.BottomMargin>-1&&this.BottomMargin!=n.BottomMargin&&(this.BottomMargin=-1);this.HeaderDistance!=0&&this.HeaderDistance!=n.HeaderDistance&&(this.HeaderDistance=0);this.FooterDistance!=0&&this.FooterDistance!=n.FooterDistance&&(this.FooterDistance=0);this.DifferentFirstPage!=null&&this.DifferentFirstPage!=n.DifferentFirstPage&&(this.DifferentFirstPage=null);this.DifferentOddAndEvenPages!=null&&this.DifferentOddAndEvenPages!=n.DifferentOddAndEvenPages&&(this.DifferentOddAndEvenPages=null)},n.prototype._ClearFormat=function(){this.headerDistance=0;this.footerDistance=0;this.pageHeight=0;this.pageWidth=0;this.leftMargin=-1;this.rightMargin=-1;this.topMargin=-1;this.bottomMargin=-1;this.differentFirstPage=null;this.differentOddAndEvenPages=null},n.prototype._Dispose=function(){this.selection=null;this.differentFirstPage=null;this.differentOddAndEvenPages=null},n}();t.SelectionSectionFormat=ye;pe=function(){function n(n){this.leftIndent=0;this.background=null;this.tableAlignment=null;this.cellSpacing=0;this.leftMargin=0;this.rightMargin=0;this.topMargin=0;this.bottomMargin=0;this.preferredWidth=0;this.selection=n}return Object.defineProperty(n.prototype,"Table",{get:function(){return this.table},set:function(n){this.table=n},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"LeftIndent",{get:function(){return this.leftIndent},set:function(n){n!=this.leftIndent&&(this.leftIndent=n,this._NotifyPropertyChanged("LeftIndent"))},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"Background",{get:function(){return this.background},set:function(n){n!=this.background&&(this.background=n,this._NotifyPropertyChanged("Background"))},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"TableAlignment",{get:function(){return this.tableAlignment},set:function(n){n!=this.tableAlignment&&(this.tableAlignment=n,this._NotifyPropertyChanged("TableAlignment"))},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"CellSpacing",{get:function(){return this.cellSpacing},set:function(n){n!=this.cellSpacing&&(this.cellSpacing=n,this._NotifyPropertyChanged("CellSpacing"))},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"LeftMargin",{get:function(){return this.leftMargin},set:function(n){n!=this.leftMargin&&(this.leftMargin=n,this._NotifyPropertyChanged("LeftMargin"))},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"RightMargin",{get:function(){return this.rightMargin},set:function(n){n!=this.rightMargin&&(this.rightMargin=n,this._NotifyPropertyChanged("RightMargin"))},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"TopMargin",{get:function(){return this.topMargin},set:function(n){n!=this.topMargin&&(this.topMargin=n,this._NotifyPropertyChanged("TopMargin"))},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"BottomMargin",{get:function(){return this.bottomMargin},set:function(n){n!=this.bottomMargin&&(this.bottomMargin=n,this._NotifyPropertyChanged("BottomMargin"))},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"PreferredWidth",{get:function(){return this.preferredWidth},set:function(n){n!=this.preferredWidth&&(this.preferredWidth=n,this._NotifyPropertyChanged("PreferredWidth"))},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"PreferredWidthType",{get:function(){return this.preferredWidthType},set:function(n){n!=this.preferredWidthType&&(this.preferredWidthType=n,this._NotifyPropertyChanged("PreferredWidthType"))},enumerable:!0,configurable:!0}),n.prototype._NotifyPropertyChanged=function(n){if((this.selection==null||!this.selection.IsCleared&&!this.selection.OwnerControl.IsReadOnlyMode&&this.selection.OwnerControl.IsDocumentLoaded||this.selection.IsRetrieveFormatting)&&this.selection!=null&&this.selection.Start!=null&&!this.selection.IsRetrieveFormatting)switch(n){case"TableAlignment":this.selection._OnTableAlignment(this.tableAlignment);break;case"LeftIndent":this.selection._OnTableLeftIndent(this.leftIndent);break;case"CellSpacing":this.selection._OnCellSpacing(this.cellSpacing);break;case"LeftMargin":this.selection._OnDefaultCellLeftMargin(this.leftMargin);break;case"RightMargin":this.selection._OnDefaultCellRightMargin(this.rightMargin);break;case"TopMargin":this.selection._OnDefaultCellTopMargin(this.topMargin);break;case"BottomMargin":this.selection._OnDefaultCellBottomMargin(this.bottomMargin)}},n.prototype._CopyFormat=function(n){this.LeftIndent=n.LeftIndent;this.Background=n.Shading.BackgroundColor;this.TableAlignment=n.TableAlignment;this.LeftMargin=n.LeftMargin;this.RightMargin=n.RightMargin;this.TopMargin=n.TopMargin;this.bottomMargin=n.BottomMargin;this.CellSpacing=n.CellSpacing},n.prototype._ClearFormat=function(){this.Table=null;this.leftIndent=0;this.background=null;this.leftIndent=0;this.leftMargin=0;this.rightMargin=0;this.topMargin=0;this.bottomMargin=0;this.cellSpacing=0;this.tableAlignment=null},n.prototype._Dispose=function(){this.selection=null;this.table=null;this.background=null;this.tableAlignment=null},n}();t.SelectionTableFormat=pe;we=function(){function n(n){this.verticalAlignment=null;this.leftMargin=0;this.rightMargin=0;this.topMargin=0;this.bottomMargin=0;this.background=null;this.preferredWidthType=null;this.selection=n}return Object.defineProperty(n.prototype,"VerticalAlignment",{get:function(){return this.verticalAlignment},set:function(n){n!=this.verticalAlignment&&(this.verticalAlignment=n,this._NotifyPropertyChanged("VerticalAlignment"))},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"LeftMargin",{get:function(){return this.leftMargin},set:function(n){n!=this.leftMargin&&(this.leftMargin=n,this._NotifyPropertyChanged("LeftMargin"))},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"RightMargin",{get:function(){return this.rightMargin},set:function(n){n!=this.rightMargin&&(this.rightMargin=n,this._NotifyPropertyChanged("RightMargin"))},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"TopMargin",{get:function(){return this.topMargin},set:function(n){n!=this.topMargin&&(this.topMargin=n,this._NotifyPropertyChanged("TopMargin"))},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"BottomMargin",{get:function(){return this.bottomMargin},set:function(n){n!=this.bottomMargin&&(this.bottomMargin=n,this._NotifyPropertyChanged("BottomMargin"))},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"Background",{get:function(){return this.background},set:function(n){n!=this.background&&(this.background=n,this._NotifyPropertyChanged("Background"))},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"PreferredWidth",{get:function(){return this.preferredWidth},set:function(n){n!=this.preferredWidth&&(this.preferredWidth=n,this._NotifyPropertyChanged("PreferredWidth"))},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"PreferredWidthType",{get:function(){return this.preferredWidthType},set:function(n){n!=this.preferredWidthType&&(this.preferredWidthType=n,this._NotifyPropertyChanged("PreferredWidthType"))},enumerable:!0,configurable:!0}),n.prototype._NotifyPropertyChanged=function(n){if((this.selection==null||!this.selection.IsCleared&&!this.selection.OwnerControl.IsReadOnlyMode&&this.selection.OwnerControl.IsDocumentLoaded||this.selection.IsRetrieveFormatting)&&this.selection!=null&&this.selection.Start!=null&&!this.selection.IsRetrieveFormatting)switch(n){case"VerticalAlignment":this.selection._OnCellContentVerticalAlignment(this.verticalAlignment);break;case"LeftMargin":this.selection._OnCellLeftMargin(this.leftMargin);break;case"RightMargin":this.selection._OnCellRightMargin(this.rightMargin);break;case"TopMargin":this.selection._OnCellTopMargin(this.topMargin);break;case"BottomMargin":this.selection._OnCellBottomMargin(this.bottomMargin)}},n.prototype._CopyFormat=function(n){this.LeftMargin=n.LeftMargin;this.RightMargin=n.RightMargin;this.TopMargin=n.TopMargin;this.BottomMargin=n.BottomMargin;this.Background=n.Shading.BackgroundColor;this.VerticalAlignment=n.VerticalAlignment},n.prototype._ClearCellFormat=function(){this.LeftMargin=Number.NaN;this.RightMargin=Number.NaN;this.TopMargin=Number.NaN;this.BottomMargin=Number.NaN;this.Background=null;this.VerticalAlignment=null},n.prototype._CombineFormat=function(n){isNaN(this.LeftMargin)||this.LeftMargin==n.LeftMargin||(this.LeftMargin=Number.NaN);isNaN(this.TopMargin)||this.TopMargin==n.TopMargin||(this.TopMargin=Number.NaN);isNaN(this.RightMargin)||this.RightMargin==n.RightMargin||(this.RightMargin=Number.NaN);isNaN(this.BottomMargin)||this.BottomMargin==n.BottomMargin||(this.BottomMargin=Number.NaN);this.Background!=null&&this.Background!=n.Shading.BackgroundColor&&(this.Background=null);this.VerticalAlignment!=null&&this.VerticalAlignment!=n.VerticalAlignment&&(this.VerticalAlignment=null)},n.prototype._ClearFormat=function(){this.background=null;this.bottomMargin=0;this.leftMargin=0;this.rightMargin=0;this.topMargin=0;this.verticalAlignment=null},n.prototype._Dispose=function(){this.selection=null;this.background=null;this.verticalAlignment=null},n}();t.SelectionCellFormat=we;be=function(){function n(n){this.isHeader=null;this.allowRowBreakAcrossPages=null;this.selection=n}return Object.defineProperty(n.prototype,"Height",{get:function(){return this.height},set:function(n){n!=this.height&&(this.height=n,this._NotifyPropertyChanged("Height"))},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"HeightType",{get:function(){return this.heightType},set:function(n){n!=this.heightType&&(this.heightType=n,this._NotifyPropertyChanged("HeightType"))},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"IsHeader",{get:function(){return this.isHeader},set:function(n){n!=this.isHeader&&(this.isHeader=n,this._NotifyPropertyChanged("IsHeader"))},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"AllowBreakAcrossPages",{get:function(){return this.allowRowBreakAcrossPages},set:function(n){n!=this.allowRowBreakAcrossPages&&(this.allowRowBreakAcrossPages=n,this._NotifyPropertyChanged("AllowBreakAcrossPages"))},enumerable:!0,configurable:!0}),n.prototype._NotifyPropertyChanged=function(n){if((this.selection==null||!this.selection.IsCleared&&!this.selection.OwnerControl.IsReadOnlyMode&&this.selection.OwnerControl.IsDocumentLoaded||this.selection.IsRetrieveFormatting)&&this.selection!=null&&this.selection.Start!=null&&!this.selection.IsRetrieveFormatting)switch(n){case"Height":this.selection._OnRowHeight(this.height);break;case"HeightType":this.selection._OnRowHeightType(this.heightType);break;case"IsHeader":this.selection._OnHeader(this.isHeader);break;case"AllowBreakAcrossPages":this.selection._OnAllowBreakAcrossPages(this.allowRowBreakAcrossPages)}},n.prototype._CopyFormat=function(n){this.Height=n.Height;this.HeightType=n.HeightType;this.AllowBreakAcrossPages=n.AllowBreakAcrossPages;this.IsHeader=n.IsHeader},n.prototype._CombineFormat=function(n){isNaN(this.Height)||this.Height==n.Height||(this.Height=Number.NaN);this.HeightType!=null&&this.HeightType!=n.HeightType&&(this.HeightType=null);this.AllowBreakAcrossPages!=null&&this.AllowBreakAcrossPages!=n.AllowBreakAcrossPages&&(this.AllowBreakAcrossPages=null);this.IsHeader!=null&&this.IsHeader!=n.IsHeader&&(this.IsHeader=null)},n.prototype._ClearRowFormat=function(){this.Height=Number.NaN;this.HeightType=null;this.AllowBreakAcrossPages=null;this.IsHeader=null},n.prototype._ClearFormat=function(){this.height=0;this.heightType=null;this.allowRowBreakAcrossPages=null;this.isHeader=null},n.prototype._Dispose=function(){this.selection=null;this.heightType=null;this.allowRowBreakAcrossPages=null;this.isHeader=null},n}();t.SelectionRowFormat=be;iu=function(){function n(n,t){this.left=0;this.width=0;this.left=n;this.width=t}return Object.defineProperty(n.prototype,"Left",{get:function(){return this.left},set:function(n){this.left=n},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"Width",{get:function(){return this.width},set:function(n){this.width=n},enumerable:!0,configurable:!0}),n}();t.SelectionWidgetInfo=iu;ke=function(){function n(n,t){this.left=0;this.width=0;this.left=n;this.width=t}return Object.defineProperty(n.prototype,"Left",{get:function(){return this.left},set:function(n){this.left=n},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"Width",{get:function(){return this.width},set:function(n){this.width=n},enumerable:!0,configurable:!0}),n}();t.SearchWidgetInfo=ke;de=function(){function n(n,t){this.height=0;this.width=0;this.height=n;this.width=t}return Object.defineProperty(n.prototype,"Height",{get:function(){return this.height},set:function(n){this.height=n},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"Width",{get:function(){return this.width},set:function(n){this.width=n},enumerable:!0,configurable:!0}),n}();t.SelectedImageInfo=de;ge=function(){function n(n){this.baseHistoryInfo=null;this.resizeContainerDiv=null;this.topLeftRect=null;this.topMiddleRect=null;this.topRightRect=null;this.bottomLeftRect=null;this.bottomMiddleRect=null;this.bottomRightRect=null;this.leftMiddleRect=null;this.rightMiddleRect=null;this.resizeMarkSize=7;this.SelectedImageWidget=null;this.ownerControl=n;this.SelectedImageWidget=new ni}return Object.defineProperty(n.prototype,"CurrentImageElementBox",{get:function(){return this.currentImageElementBox},set:function(n){this.currentImageElementBox=n},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"ResizeMarkSize",{get:function(){return this.resizeMarkSize},set:function(n){this.resizeMarkSize=n},enumerable:!0,configurable:!0}),n.prototype._InitResizeMarks=function(n){return this._InitResizeContainerDiv(),n.appendChild(this.resizeContainerDiv),this.topRightRect=document.createElement("div"),this.topRightRect.id=this.ownerControl.ContainerId+"_TopRightRect",this.topRightRect.style.cursor="ne-resize",this._applyProperties(this.topRightRect),n.appendChild(this.topRightRect),this.topLeftRect=document.createElement("div"),this.topLeftRect.id=this.ownerControl.ContainerId+"_TopLeftRect",this.topLeftRect.style.cursor="nw-resize",this._applyProperties(this.topLeftRect),n.appendChild(this.topLeftRect),this.topMiddleRect=document.createElement("div"),this.topMiddleRect.id=this.ownerControl.ContainerId+"_TopMiddleRect",this.topMiddleRect.style.cursor="n-resize",this._applyProperties(this.topMiddleRect),n.appendChild(this.topMiddleRect),this.bottomRightRect=document.createElement("div"),this.bottomRightRect.id=this.ownerControl.ContainerId+"_BottomRightRect",this.bottomRightRect.style.cursor="se-resize",this._applyProperties(this.bottomRightRect),n.appendChild(this.bottomRightRect),this.bottomLeftRect=document.createElement("div"),this.bottomLeftRect.id=this.ownerControl.ContainerId+"_BottomLeftRect",this.bottomLeftRect.style.cursor="sw-resize",this._applyProperties(this.bottomLeftRect),n.appendChild(this.bottomLeftRect),this.bottomMiddleRect=document.createElement("div"),this.bottomMiddleRect.id=this.ownerControl.ContainerId+"_BottomMiddleRect",this.bottomMiddleRect.style.cursor="s-resize",this._applyProperties(this.bottomMiddleRect),n.appendChild(this.bottomMiddleRect),this.rightMiddleRect=document.createElement("div"),this.rightMiddleRect.id=this.ownerControl.ContainerId+"_RightMiddleRect",this.rightMiddleRect.style.cursor="e-resize",this._applyProperties(this.rightMiddleRect),n.appendChild(this.rightMiddleRect),this.leftMiddleRect=document.createElement("div"),this.leftMiddleRect.id=this.ownerControl.ContainerId+"_LeftMiddleRect",this.leftMiddleRect.style.cursor="w-resize",this._applyProperties(this.leftMiddleRect),n.appendChild(this.leftMiddleRect),this.resizeContainerDiv},n.prototype._SetImageResizerPosition=function(n,t,i,r){this.resizeContainerDiv.style.width=i+"px";this.resizeContainerDiv.style.height=r+"px";this.resizeContainerDiv.style.left=n+"px";this.resizeContainerDiv.style.top=t+"px";this.topRightRect.style.left=n+i-3+"px";this.topRightRect.style.top=t-3+"px";this.topLeftRect.style.left=n-3+"px";this.topLeftRect.style.top=t-3+"px";this.topMiddleRect.style.left=parseFloat(this.topLeftRect.style.left)+i/2-3+"px";this.topMiddleRect.style.top=t-3+"px";this.bottomRightRect.style.left=this.topRightRect.style.left;this.bottomRightRect.style.top=parseFloat(this.topRightRect.style.top)+r+"px";this.bottomLeftRect.style.left=this.topLeftRect.style.left;this.bottomLeftRect.style.top=parseFloat(this.topLeftRect.style.top)+r+"px";this.bottomMiddleRect.style.left=this.topMiddleRect.style.left;this.bottomMiddleRect.style.top=parseFloat(this.topMiddleRect.style.top)+r+"px";this.rightMiddleRect.style.left=this.topRightRect.style.left;this.rightMiddleRect.style.top=parseFloat(this.topRightRect.style.top)+r/2+"px";this.leftMiddleRect.style.left=this.topLeftRect.style.left;this.leftMiddleRect.style.top=parseFloat(this.topLeftRect.style.top)+r/2+"px";this._setImageResizingPoints()},n.prototype._setImageResizingPoints=function(){this.ownerControl.ImageResizerPoints.resizeContainerDiv.X=parseFloat(this.resizeContainerDiv.style.left);this.ownerControl.ImageResizerPoints.resizeContainerDiv.Y=parseFloat(this.resizeContainerDiv.style.top);this.ownerControl.ImageResizerPoints.bottomLeftRect.X=parseFloat(this.bottomLeftRect.style.left);this.ownerControl.ImageResizerPoints.bottomLeftRect.Y=parseFloat(this.bottomLeftRect.style.top);this.ownerControl.ImageResizerPoints.bottomRightRect.X=parseFloat(this.bottomRightRect.style.left);this.ownerControl.ImageResizerPoints.bottomRightRect.Y=parseFloat(this.bottomRightRect.style.top);this.ownerControl.ImageResizerPoints.bottomMiddleRect.X=parseFloat(this.bottomMiddleRect.style.left);this.ownerControl.ImageResizerPoints.bottomMiddleRect.Y=parseFloat(this.bottomMiddleRect.style.top);this.ownerControl.ImageResizerPoints.topLeftRect.X=parseFloat(this.topLeftRect.style.left);this.ownerControl.ImageResizerPoints.topLeftRect.Y=parseFloat(this.topLeftRect.style.top);this.ownerControl.ImageResizerPoints.topRightRect.X=parseFloat(this.topRightRect.style.left);this.ownerControl.ImageResizerPoints.topRightRect.Y=parseFloat(this.topRightRect.style.top);this.ownerControl.ImageResizerPoints.topMiddleRect.X=parseFloat(this.topMiddleRect.style.left);this.ownerControl.ImageResizerPoints.topMiddleRect.Y=parseFloat(this.topMiddleRect.style.top);this.ownerControl.ImageResizerPoints.leftMiddleRect.X=parseFloat(this.leftMiddleRect.style.left);this.ownerControl.ImageResizerPoints.leftMiddleRect.Y=parseFloat(this.leftMiddleRect.style.top);this.ownerControl.ImageResizerPoints.rightMiddleRect.X=parseFloat(this.rightMiddleRect.style.left);this.ownerControl.ImageResizerPoints.rightMiddleRect.Y=parseFloat(this.rightMiddleRect.style.top)},n.prototype._InitResizeContainerDiv=function(){this.resizeContainerDiv=document.createElement("div");this.resizeContainerDiv.id=this.ownerControl.ContainerId+"_ResizeDivElement";this.resizeContainerDiv.style.position="absolute";this.resizeContainerDiv.style.border="1px solid black";this.resizeContainerDiv.style.zIndex="30";this.resizeContainerDiv.style.backgroundColor="transparent";this.resizeContainerDiv.style.display="none"},n.prototype._applyProperties=function(n){n.style.position="absolute";n.style.backgroundColor="gray";n.style.width="7px";n.style.height="7px";n.style.fontSize="0px";n.style.zIndex=" 551"},n.prototype._InitHistory=function(n){this.ownerControl!=null&&this.baseHistoryInfo==null&&(this.baseHistoryInfo=new eu(this.ownerControl),this.baseHistoryInfo.Action=i.ImageReszing,this.baseHistoryInfo._UpdateSelection(this.ownerControl.Selection),this.baseHistoryInfo.ModifiedProperties._Add(new sf(n)))},n.prototype._UpdateHistory=function(){if(this.ownerControl!=null&&this.baseHistoryInfo!=null){var n=this.baseHistoryInfo.ModifiedProperties[0];this.CurrentImageElementBox.ImageContainer.Width==n.Width&&this.CurrentImageElementBox.ImageContainer.Height==n.Height?this.baseHistoryInfo.ModifiedProperties._Clear():this.ownerControl.History._RecordChanges(this.baseHistoryInfo);this.baseHistoryInfo=null}},n.prototype._RenderImageResizer=function(n){var t;n!=null&&(t=document.getElementById(n.Id+"_resize"));this._DrawImageResizer(t)},n.prototype._ReDrawImageResizer=function(n,t){if(this.SelectedImageWidget._ContainsKey(n)){var i=void 0;t!=null&&(i=document.getElementById(t.Id+"_resize"));this._DrawImageResizer(i)}},n.prototype._DrawImageResizer=function(n){n!=null&&(this.resizeContainerDiv!=null&&n.appendChild(this.resizeContainerDiv),this.bottomLeftRect!=null&&n.appendChild(this.bottomLeftRect),this.bottomRightRect!=null&&n.appendChild(this.bottomRightRect),this.bottomMiddleRect!=null&&n.appendChild(this.bottomMiddleRect),this.rightMiddleRect!=null&&n.appendChild(this.rightMiddleRect),this.topRightRect!=null&&n.appendChild(this.topRightRect),this.topLeftRect!=null&&n.appendChild(this.topLeftRect),this.leftMiddleRect!=null&&n.appendChild(this.leftMiddleRect),this.topMiddleRect!=null&&n.appendChild(this.topMiddleRect))},n}();t.ImageResizer=ge;no=function(){function n(){this.resizeContainerDiv=new p(0,0);this.topLeftRect=new p(0,0);this.topMiddleRect=new p(0,0);this.topRightRect=new p(0,0);this.bottomLeftRect=new p(0,0);this.bottomMiddleRect=new p(0,0);this.bottomRightRect=new p(0,0);this.leftMiddleRect=new p(0,0);this.rightMiddleRect=new p(0,0)}return n}();t.ImageResizingPoints=no;yf=function(){function n(n){var t,i,r,u,e;if(this.CurrentPage=null,this.tableLeft=[],this.Pages=new h,this.selectionStartPage=null,this.selectionEndPage=null,this.zoomFactor=1,this.touchStart=null,this.touchEnd=null,this.Caret=null,this.IsTouchInput=!1,this.IsFieldCode=!1,this.CurrentComment=null,this.CurrentHeaderFooter=null,this.SplittedCellWidgets=null,this.isMousedown=!1,this.isSelectionChangedOnMouseMoved=!1,this.HorizontalScrollBar=null,this.VerticalScrollBar=null,this.preZoomFactor=0,this.preDifference=-1,this.PointerCount=0,this.Pointers=[],this.ScrollStartX=-1,this.ScrollStartY=-1,this.SearchHighlighters=null,this.TouchDownOnSelectionMark=0,this.useTouchSelectionMark=!0,this.isTouchScroll=!1,this.BlockToShift=null,this.FieldToLayout=null,this.FieldEndParagraph=null,this.isControlPressed=!1,this.HorizontalWidth=0,this.InsertTableDialog=null,this.InsertFindAndReplaceDialog=null,this.InsertAlertDialog=null,this.InsertListDialog=null,this.InsertCellMarginsDialog=null,this.CommentRangeWidget=null,this.SelectedCommentRangeWidget=new ni,this.pageFitType=cu.None,this.tapCount=0,this.timer=-1,this.TextWrap=!0,this.isReviewPanelShow=!1,this.IsImageResizing=!1,this.isImageResizerVisible=!1,this.TablePropertiesDialog=null,this.viewModel=new kf,this.TableBorderAndShadingDialog=null,this.isOptionsPaneShow=!1,this.LineElements=new fe,this.FieldStack=new h,this.CommentWidgets=new h,this.ImageResizer=new ge(n),n!=null){if(this.Pages=new h,this.SplittedCellWidgets=new h,this.OwnerControl=n,this.fontDialog=new to(this),t=this,this.OwnerControl.DocumentEditorElement==null)return;this._InitOptionPane();i=document.createElement("div");i.className=f.OptionsPane;navigator.userAgent.match("Safari")&&navigator.vendor.match("Apple")?i.setAttribute("style","display:-webkit-inline-box"):i.setAttribute("style","display:inline-flex");i.appendChild(this.OptionsPane);this.ViewerContatiner=document.createElement("div");this.ViewerContatiner.style.touchAction="pan-x pan-y";i.appendChild(this.ViewerContatiner);this.OwnerControl.DocumentEditorElement.appendChild(i);this.Container=document.createElement("div");this.Container.setAttribute("id",this.OwnerControl.ContainerId+"_viewerContainer");this.Container.style.overflow="hidden";this.Container.style.cssFloat="left";this.Container.style.position="relative";this.Container.style.pointerEvents="none";this.Container.className=f.DocumentEditor;this.ViewerContatiner.appendChild(this.Container);this.ViewerContatiner.tabIndex=0;this.ViewerContatiner.style.outline="none";this.EditableDiv=document.createElement("div");this.EditableDiv.contentEditable="true";this.EditableDiv.style.position="fixed";this.EditableDiv.style.left="-150em";this.EditableDiv.style.width="100%";this.EditableDiv.style.height="100%";this.EditableDiv.id=this.OwnerControl.ContainerId+"_editableDiv";document.body.appendChild(this.EditableDiv);r=this.OwnerControl.ej.buildTag("div","",{display:"none",float:"right"},{id:this.OwnerControl.ContainerId+"_verticalScrollBar"});r.ejScrollBar({orientation:"vertical",minimum:0,width:18,height:0,infiniteScrolling:!1,scroll:$.proxy(this._VerticalScrollBar_ValueChanged,this)});this.VerticalScrollBar=r.data("ejScrollBar");this.ViewerContatiner.appendChild(r[0]);u=this.OwnerControl.ej.buildTag("div","",{display:"none"},{id:this.OwnerControl.ContainerId+"_horizontalScrollBar"});u.ejScrollBar({orientation:"horizontal",minimum:0,width:0,height:18,infiniteScrolling:!1,scroll:$.proxy(this._HorizontalScrollBar_ValueChanged,this)});this.HorizontalScrollBar=u.data("ejScrollBar");this.ViewerContatiner.appendChild(u[0]);this._UpdateViewerSize();this.ParagraphDialog=new se(this);this.HyperlinkDialog=new oe(this);this._InitContextMenu();e=0;this.windowResizeHandler=function(){e&&clearTimeout(e);e=setTimeout(function(){t._UpdateViewerSizeOnWindowResize()},100);t.ContextMenu.style.display="none"};this.windowMouseDownHandler=function(){t._HideContextMenu()};this.windowKeyUpHandler=function(n){n.keyCode==27&&t._HideContextMenu();(n.ctrlKey||n.keyCode==17||n.which==17)&&(t.isControlPressed=!1)};window.addEventListener("resize",this.windowResizeHandler);this.ViewerContatiner.addEventListener("mousedown",function(n){t.timer=setTimeout(function(){t.tapCount++;t.tapCount==4&&(t.tapCount=2)},200);t._OnMouseDownInternal(n)});this.ContextMenu.addEventListener("mousedown",function(n){var i=t._GetContextMenuItem(n,f.ContextMenuItem);if(i!=null){t._HandleContextMenuItem(i.id);return}});this.ViewerContatiner.addEventListener("mousemove",function(n){t._OnMouseMoveInternal(n)});this.ViewerContatiner.addEventListener("mouseup",function(n){t._OnMouseUpInternal(n,t.tapCount)});this.ViewerContatiner.addEventListener("mousewheel",function(n){t._OnMouseWheelInternal(n)});this.ViewerContatiner.addEventListener("dblclick",function(n){navigator.userAgent.match("MSIE 10.0")||t._OnDoubleTap(n)});navigator.userAgent.match("Firefox")&&this.ViewerContatiner.addEventListener("DOMMouseScroll",function(n){t._OnMouseWheelInternal(n)});this.ViewerContatiner.addEventListener("contextmenu",function(n){t._OnContextMenuInternal(n)});this.EditableDiv.addEventListener("keydown",function(n){t._OnkeyDownInternal(n)});this.EditableDiv.addEventListener("keypress",function(n){t.OnTextInputInternal(n);n.preventDefault()});this.EditableDiv.addEventListener("paste",function(n){t._OnPaste(n)});window.addEventListener("mousedown",this.windowMouseDownHandler);window.addEventListener("keyup",this.windowKeyUpHandler);t._InitFindAndReplaceDialog();t._InitTableDialog();t._InitAlertDialog();t._InitCellMarginsDialog();t._InitListDialog();t._InitTouchEvents();t.EditableDiv.focus();t._InitTablePropertyDialog();t._InitBordersShadingsPropertiesDialog()}}return Object.defineProperty(n.prototype,"VisibleBounds",{get:function(){return this.visibleBounds},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"CurrentRenderingPage",{get:function(){return this.Pages.length==0?null:this.Pages[this.Pages.length-1]},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"SelectionStartPage",{get:function(){return this.selectionStartPage},set:function(n){this.selectionStartPage=n},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"SelectionEndPage",{get:function(){return this.selectionEndPage},set:function(n){this.selectionEndPage=n},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"ZoomFactor",{get:function(){return this.zoomFactor},set:function(n){this.zoomFactor=n;this._OnZoomFactorChanged()},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"TouchStart",{get:function(){return this.touchStart},set:function(n){this.touchStart=n},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"TouchEnd",{get:function(){return this.touchEnd},set:function(n){this.touchEnd=n},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"caret",{get:function(){return this.Caret},set:function(n){this.Caret=n},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"PageFitType",{get:function(){return this.pageFitType},set:function(n){this.pageFitType=n;this._OnPageFitTypeChanged(this.pageFitType)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"List",{get:function(){return this.viewModel!=null?this.viewModel.List:null},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"ListLevel",{get:function(){return this.viewModel!=null?this.viewModel.ListLevel:null},enumerable:!0,configurable:!0}),n.prototype._InitOptionPane=function(){var n=this,a,e,o,f,s,v,h,y,r,c,l,i,u,t;this.OptionsPane=document.createElement("div");this.OptionsPane.setAttribute("style","display:none;width:300px;top:0px;border-right: 1px solid #e1e1e1");a=document.createElement("div");a.innerHTML="Search";a.setAttribute("style","font-size:15px;position:relative;top:20px;left:25px;width:90%");this.OptionsPane.appendChild(a);e=document.createElement("div");e.setAttribute("class","e-icon e-close_01");e.setAttribute("style","font-size:large;position:relative;left:85%;cursor:pointer");this.OptionsPane.appendChild(e);o=document.createElement("div");o.setAttribute("style","width:82%;height:30px;position:relative;left:25px;top:20px;border-color:#c8c8c8 #c8c8c8;border-style:solid;border-width:1px;padding:0px;margin:0px");this.OptionsPane.appendChild(o);f=document.createElement("input");f.setAttribute("type","text");f.setAttribute("class","e-textbox");navigator.userAgent.match("MSIE")||navigator.userAgent.match(".NET")?f.setAttribute("style","height:29px;width:87.8%;"):f.setAttribute("style","height:29px;width:87.8%;padding-left: 7px;margin:1px 1px 0px 1px");f.setAttribute("id",this.OwnerControl.ContainerId+"_option_search_text_box");o.appendChild(f);s=document.createElement("span");s.setAttribute("style","position:relative;float:right;margin-right: 0px;padding-top:3px;width:10px;height:27px;padding-right:15px;padding-left:3px;cursor:pointer");v=document.createElement("a");v.setAttribute("class","e-icon e-search");v.setAttribute("style","font-size:x-large;text-decoration:none");s.appendChild(v);o.appendChild(s);h=document.createElement("div");h.setAttribute("style","position:relative;top:35px;left:25px;height:30px;width:85%");this.OptionsPane.appendChild(h);y=document.createElement("div");y.innerHTML="Result";y.setAttribute("style","font-size:15px;");r=document.createElement("div");r.setAttribute("style","display:none;position:absolute;top:0px;left:85%");r.setAttribute("id",n.OwnerControl.ContainerId+"_navigation_bar");c=document.createElement("span");c.setAttribute("class","e-icon e-arrow-up");c.setAttribute("style","margin:0px;font-size:large;cursor:pointer");l=document.createElement("span");l.setAttribute("class","e-icon e-arrow-down");l.setAttribute("style","margin:0px;font-size:large;cursor:pointer");r.appendChild(c);r.appendChild(l);h.appendChild(y);h.appendChild(r);i=document.createElement("div");i.innerHTML="Use search box for find text in the document";i.setAttribute("id",n.OwnerControl.ContainerId+"_search_status");i.setAttribute("style","position:relative;top:33px;left:25px;width:90%");this.OptionsPane.appendChild(i);u=n.OwnerControl.ej.buildTag("div","",{display:"none",position:"relative",top:"50px",left:"25px"},{id:this.OwnerControl.ContainerId+"_list_box_container"});t=n.OwnerControl.ej.buildTag("ul","","",{id:this.OwnerControl.ContainerId+"_option_pane_list_view"});u[0].appendChild(t[0]);t.ejListBox();this.OptionsPane.appendChild(u[0]);s.addEventListener("click",function(){var c=document.getElementById(n.OwnerControl.ContainerId+"_option_search_text_box"),h=c.value,e,o,f,s;if(h!="")if(n.OwnerControl._ClearSearchResultItems(),n._ClearSearchHighlight(),n.OwnerControl._FindAll(h,gr.None),n.OwnerControl.textSearchResults!=null&&n.OwnerControl.textSearchResults.Count>0){for(n.OwnerControl.textSearchResults._Highlight(),n.OwnerControl.textSearchResults._AddFindResultView(),u[0].style.display="block",r.style.display="flex",e=n.OwnerControl.findResultsList,o="",f=0;f<e.length;f++)o+=e[f];t.data("ejListBox").destroy();t[0].innerHTML="";t[0].innerHTML=o;t.ejListBox({width:"83%"});t.ejListBox({select:function(t){n.OwnerControl.textSearchResults.CurrentIndex=t.index;n.OwnerControl.textSearchResults.CurrentSearchResult._Navigate();i.innerHTML="Result "+(t.index+1)+" of "+n.OwnerControl.textSearchResults.Count}});s=n.OwnerControl.textSearchResults.CurrentIndex;i.innerHTML="Result "+(s+1)+" of "+n.OwnerControl.textSearchResults.Count;t.ejListBox("selectItemByIndex",s)}else i.innerHTML="We Couldn't find what you looking for.",u[0].style.display="none",r.style.display="none"});l.addEventListener("click",function(){if(t.data("ejListBox")!=null)if(n.OwnerControl.textSearchResults.CurrentIndex<n.OwnerControl.textSearchResults.Count-1){var i=n.OwnerControl.textSearchResults.CurrentIndex;t.ejListBox("selectItemByIndex",++i)}else t.ejListBox("selectItemByIndex",0)});c.addEventListener("click",function(){if(t.data("ejListBox")!=null)if(n.OwnerControl.textSearchResults.CurrentIndex==0)t.ejListBox("selectItemByIndex",n.OwnerControl.textSearchResults.Count-1);else{var i=n.OwnerControl.textSearchResults.CurrentIndex;t.ejListBox("selectItemByIndex",--i)}});e.addEventListener("click",function(){n._ShowHideOptionsPane(!1)});f.addEventListener("keydown",function(f){var y=f.which||f.keyCode,o,s,h,c,l,e,a,v;if(y==13){if(o=document.getElementById(n.OwnerControl.ContainerId+"_option_search_text_box"),o.blur(),s=o.value,s=="")return;if(h=n.OwnerControl.DocumentEditorElement.offsetHeight-200,n.OwnerControl._ClearSearchResultItems(),n._ClearSearchHighlight(),n.OwnerControl._FindAll(s,gr.None),n.OwnerControl.textSearchResults!=null&&n.OwnerControl.textSearchResults.Count>0){for(n.OwnerControl.textSearchResults._Highlight(),n.OwnerControl.textSearchResults._AddFindResultView(),u[0].style.display="block",u[0].style.height=h+"px",r.style.display="flex",c=n.OwnerControl.findResultsList,l="",e=0;e<c.length;e++)l+=c[e];t.data("ejListBox").destroy();t[0].innerHTML="";t[0].innerHTML=l;t.ejListBox({width:"83%",height:h+"px"});t.ejListBox({change:function(t){n.OwnerControl.textSearchResults.CurrentIndex=t.index;n.OwnerControl.textSearchResults.CurrentSearchResult._Navigate();i.innerHTML="Result "+(t.index+1)+" of "+n.OwnerControl.textSearchResults.Count}});a=n.OwnerControl.textSearchResults.CurrentIndex;i.innerHTML="Result "+(a+1)+" of "+n.OwnerControl.textSearchResults.Count;t.ejListBox("selectItemByIndex",a)}else i.innerHTML="We Couldn't find what you looking for.",u[0].style.display="none",r.style.display="none"}else u[0].style.display="none",i.innerHTML="Use search box for find text in the document",r.style.display="none";n.InsertFindAndReplaceDialog.data("ejDialog")!=null&&n.InsertFindAndReplaceDialog.data("ejDialog").isOpen()&&(v=n.InsertFindAndReplaceDialog.data("ejDialog"),v.close())})},n.prototype._ShowHideOptionsPane=function(n){var t,i,r,u,f;n?(this.OptionsPane.style.display="block",this.isOptionsPaneShow=!0,t=document.getElementById(this.OwnerControl.DocumentEditorElement.id+"_option_search_text_box"),i=this.OwnerControl.Selection.Text,t.value=i,t.select()):(this._ClearSearchHighlight(),this.OptionsPane.style.display="none",this.isOptionsPaneShow=!1,r=document.getElementById(this.OwnerControl.ContainerId+"_list_box_container"),r.style.display="none",u=document.getElementById(this.OwnerControl.ContainerId+"_search_status"),u.innerHTML="Use search box for find text in the document",f=document.getElementById(this.OwnerControl.ContainerId+"_navigation_bar"),f.style.display="none",this.OwnerControl.Selection._UpdateFocus());this._UpdateViewerSizeOnWindowResize()},n.prototype._OnPaste=function(n){var t=this;t.OwnerControl.Selection._Paste(n)},n.prototype._OnPasteMenuClick=function(){this.OwnerControl.Selection._PasteInternal()},n.prototype._OnInsertTable=function(){var n=this.InsertTableDialog.find("#"+this.InsertTableDialog[0].id+"_row")[0].value,t=this.InsertTableDialog.find("#"+this.InsertTableDialog[0].id+"_column")[0].value;this.OwnerControl._InsertTableInBlocks(n,t);this.InsertTableDialog.ejDialog("close")},n.prototype._InitTableDialog=function(){var n=this,t,i,r,u,f,e;n.InsertTableDialog=n.OwnerControl.ej.buildTag("div","",{display:"none"},{id:"documentEditor_"+n.OwnerControl.ContainerId+"_insertTableDialog",title:"Insert Table"});n.OwnerControl.DocumentEditorElement.appendChild(n.InsertTableDialog[0]);t=document.createElement("div");i=document.createElement("TABLE");i.innerHTML+="<tr style='height: 50px;'><td style= 'width:35%'>Column Size<\/td><td><input type='text' id= '"+n.InsertTableDialog[0].id+"_column' style= 'width:100%' /><\/td><\/tr><tr style='height:50px;'><td style='width:35%'>Row Size<\/td><td><input type='text' id= '"+n.InsertTableDialog[0].id+"_row' style= 'width:100%' / ><\/td><\/tr>";t.appendChild(i);r=n.OwnerControl.ej.buildTag("input","",{"margin-left":"0px",width:"55px",left:"100px",position:"relative"},{type:"button",id:n.InsertTableDialog[0].id+"_insert",value:"Insert"});r.ejButton({click:n.OwnerControl.ej.proxy(n._OnInsertTable,n)});u=n.OwnerControl.ej.buildTag("input","",{"margin-left":"0px",width:"55px",left:"130px",position:"relative"},{id:n.InsertTableDialog[0].id+"_cancel",type:"button",value:"Cancel"});u.ejButton({click:function(t){t.cancel||n.InsertTableDialog.ejDialog("close")}});t.appendChild(r[0]);t.appendChild(u[0]);n.InsertTableDialog[0].appendChild(t);f=n.InsertTableDialog.find("#"+n.InsertTableDialog[0].id+"_row");f.ejNumericTextbox({value:2,minValue:1,maxValue:32767,height:25,enablePersistence:!1});e=n.InsertTableDialog.find("#"+n.InsertTableDialog[0].id+"_column");e.ejNumericTextbox({value:2,minValue:1,maxValue:63,height:25,enablePersistence:!1});n.InsertTableDialog.keyup(function(t){t.keyCode==13&&e[0].value!=""&&f[0]!=""&&n._OnInsertTable()})},n.prototype._InitFindAndReplaceDialog=function(){var n=this,r,u,t,f,o,s,h,c,e,l,i;n.InsertFindAndReplaceDialog=n.OwnerControl.ej.buildTag("div","",{display:"none"},{id:"documentEditor_"+n.OwnerControl.ContainerId+"_insertFindAndReplaceDialog",title:"Insert Find And Replace"});n.OwnerControl.DocumentEditorElement.appendChild(n.InsertFindAndReplaceDialog[0]);r=document.createElement("div");r.style.width="auto";r.style.height="auto";u=n.OwnerControl.ej.buildTag("div","<ul><li><a href='#"+n.InsertFindAndReplaceDialog[0].id+"_find' > Find <\/a><\/li><li><a href='#"+n.InsertFindAndReplaceDialog[0].id+"_find' > Replace <\/a><\/li ><\/ul>","",{id:n.InsertFindAndReplaceDialog[0].id+"_tab"});r.appendChild(u[0]);u.ejTab({itemActive:function(t){n._OnFindReplaceTabChange(t.activeIndex)}});t=u.find("#"+n.InsertFindAndReplaceDialog[0].id+"_find");f=document.createElement("TABLE");f.innerHTML+="<tr id='"+n.InsertFindAndReplaceDialog[0].id+"_findrow' style='height: 50px;'><td style= 'width:40%'>Find What<\/td><td><input type='text' id= '"+n.InsertFindAndReplaceDialog[0].id+"_FindWhatText' style= 'width:200px;' /><\/td><\/tr>";f.innerHTML+="<tr id='"+n.InsertFindAndReplaceDialog[0].id+"_replaceTextBox' style='height:50px;'><td style='width:35%;'>Replace With<\/td><td><input type='text' id= '"+n.InsertFindAndReplaceDialog[0].id+"_replaceText' style= 'width:200px;' / ><\/td><\/tr>";t[0].appendChild(f);o=n.OwnerControl.ej.buildTag("input","",{"margin-left":"0px",width:"55px",left:"20px",position:"relative"},{type:"button",id:n.InsertFindAndReplaceDialog[0].id+"_FindNext",value:"Find Next"});o.ejButton({click:n.OwnerControl.ej.proxy(n._onFindNext,n)});s=n.OwnerControl.ej.buildTag("input","",{"margin-left":"0px",width:"55px",left:"30px",position:"relative"},{id:n.InsertFindAndReplaceDialog[0].id+"_cancel",type:"button",value:"Cancel"});s.ejButton({click:function(t){t.cancel||n.InsertFindAndReplaceDialog.ejDialog("close")}});h=n.OwnerControl.ej.buildTag("input","",{"margin-left":"0px",width:"55px",position:"relative"},{type:"button",id:n.InsertFindAndReplaceDialog[0].id+"_replace",value:"Replace"});h.ejButton({click:n.OwnerControl.ej.proxy(n._Replace,n)});c=n.OwnerControl.ej.buildTag("input","",{"margin-left":"0px",width:"55px",left:"10px",position:"relative"},{type:"button",id:n.InsertFindAndReplaceDialog[0].id+"_replaceAll",value:"ReplaceAll"});c.ejButton({click:n.OwnerControl.ej.proxy(n._ReplaceAll,n)});t[0].appendChild(h[0]);t[0].appendChild(c[0]);t[0].appendChild(o[0]);t[0].appendChild(s[0]);n.InsertFindAndReplaceDialog[0].appendChild(r);e=document.createElement("div");l=n.OwnerControl.ej.buildTag("input","",{"margin-left":"0px",width:"55px",left:"10px",position:"relative"},{type:"checkbox",id:n.InsertFindAndReplaceDialog[0].id+"_MoreLess"});e.appendChild(l[0]);t[0].appendChild(e);i=document.createElement("table");i.style.display="none";i.innerHTML+="<tr><td><input type='checkbox' id= '"+this.InsertFindAndReplaceDialog[0].id+"_matchcase' style= 'width:25%' /><br/><\/td><\/tr><tr><td><input type='checkbox' id= '"+this.InsertFindAndReplaceDialog[0].id+"_wholeword' style= 'width:25%' /><\/td><\/tr><tr><td><input type='checkbox' id= '"+this.InsertFindAndReplaceDialog[0].id+"_regular' style= 'width:25%' /><\/td><\/tr>";e.appendChild(i);var a=n.InsertFindAndReplaceDialog.find("#"+this.InsertFindAndReplaceDialog[0].id+"_matchcase"),v=n.InsertFindAndReplaceDialog.find("#"+this.InsertFindAndReplaceDialog[0].id+"_wholeword"),y=n.InsertFindAndReplaceDialog.find("#"+this.InsertFindAndReplaceDialog[0].id+"_regular");a.ejCheckBox({text:"Match Case",width:"auto"});v.ejCheckBox({text:"Find Whole Words Only",width:"auto"});y.ejCheckBox({text:"Use regular expression",width:"auto",change:function(n){n.isChecked?(a.ejCheckBox("disable"),v.ejCheckBox("disable")):(a.ejCheckBox("enable"),v.ejCheckBox("enable"))}});l.ejToggleButton({defaultText:"More >>",activeText:"<< Less",click:function(){i.style.display=i.style.display=="none"?"block":"none"}});n.InsertFindAndReplaceDialog.keyup(function(t){t.keycode==13&&n._onFindNext()});this._CreateEjDialog(this.InsertFindAndReplaceDialog)},n.prototype._InitListDialog=function(){var n=this,t,i;n.InsertListDialog=n.OwnerControl.ej.buildTag("div","",{display:"none"},{id:"documentEditor_"+n.OwnerControl.ContainerId+"_insertListDialog",title:"Define List"});n.OwnerControl.DocumentEditorElement.appendChild(this.InsertListDialog[0]);t=document.createElement("div");t.style.width="480px";t.style.height="auto";t.style.paddingBottom="20px";i=document.createElement("TABLE");i.style.width="500px";i.style.height="auto";i.style.padding="20px";i.style.margin="10px";i.innerHTML+="<tr><td><label>List Level<\/label><\/td><\/tr><tr><td style='font-size:12px'><label style='font-weight:normal'>Choose Level to modify<\/label><\/br><input type='text' id='"+this.InsertListDialog[0].id+"_listlevel'><\/br>";i.innerHTML+="<tr><td><label>Number Format<\/label><\/td><\/tr><tr><td style='font-size:12px'><label style='font-weight:normal'>Number Style for this level<\/label><\/br><input type='text' id='"+this.InsertListDialog[0].id+"_numberStyle'/><\/td><td style='font-size:12px'><label style='font-weight:normal'>Formatting For Number<\/label><\/br><input type='text' style='width:200px;height:15px;font-size:12px;' id='"+this.InsertListDialog[0].id+"_numberFormat' ><\/td><\/tr><tr><td style='font-size:12px'><label style='font-weight:normal'>Start At<\/label><\/br><input type='text' id='"+this.InsertListDialog[0].id+"_startAt' ><\/td><td style='font-size:12px'><label style='font-weight:normal'>Restart By<\/label><\/br><input type='text' id='"+this.InsertListDialog[0].id+"_restartBy'/> <div id='"+this.InsertListDialog[0].id+"_restartbyList' ><\/td> <\/tr><\/br> ";i.innerHTML+="<tr><td><label>Indents<\/label><\/td><\/tr><tr><td style='font-size:12px'><label style='font-weight:normal'>Text indent at<\/label><\/br><input type='text' id='"+this.InsertListDialog[0].id+"_textIndent'/><\/td><td style='font-size:12px'><label style='font-weight:normal'>Aligned At<\/label><\/br><input type='text' id='"+this.InsertListDialog[0].id+"_alignedAt'/><\/br><\/td><\/tr><tr><td style='font-size:12px'><label style='font-weight:normal'>Follow Number With<\/label><\/br><input type='text' id='"+this.InsertListDialog[0].id+"_followCharacter'><\/br><\/td><\/tr>";t.appendChild(i);var r=n.OwnerControl.ej.buildTag("input","",{"margin-left":"0px",position:"relative"},{type:"button",id:n.InsertListDialog[0].id+"_font",value:"Font"}),u=n.OwnerControl.ej.buildTag("input","",{"margin-left":"0px",left:"160px",position:"relative"},{type:"button",id:n.InsertListDialog[0].id+"_ok",value:"OK"}),f=n.OwnerControl.ej.buildTag("input","",{"margin-left":"0px",left:"190px",position:"relative"},{type:"button",id:n.InsertListDialog[0].id+"_cancel",value:"Cancel"});f.ejButton({width:"90px",height:"23px",click:function(t){n._DisposeBindingForListUI();t.cancel||n.InsertListDialog.ejDialog("close")}});u.ejButton({width:"90px",height:"23px",click:function(){n._OnApplyListButton()}});r.ejButton({width:"90px",height:"23px",click:function(){n._ShowFontDialog()}});t.appendChild(r[0]);t.appendChild(u[0]);t.appendChild(f[0]);n.InsertListDialog[0].appendChild(t);var e=n.InsertListDialog.find("#"+n.InsertListDialog[0].id+"_startAt"),o=n.InsertListDialog.find("#"+n.InsertListDialog[0].id+"_textIndent"),s=n.InsertListDialog.find("#"+n.InsertListDialog[0].id+"_alignedAt");e.ejNumericTextbox({minValue:0,maxValue:50,width:"200px",height:25,enablePersistence:!1,change:function(t){n.viewModel.ListLevel.StartAt=t.value}});o.ejNumericTextbox({maxValue:1584,incrementStep:4,width:"200px",height:25,enablePersistence:!1,change:function(t){n.viewModel.ListLevel.ParagraphFormat.LeftIndent=t.value}});s.ejNumericTextbox({maxValue:1584,incrementStep:6,width:"200px",height:25,enablePersistence:!1,change:function(t){n.viewModel.ListLevel.ParagraphFormat.FirstLineIndent=t.value}});var h=this.InsertListDialog.find("#"+this.InsertListDialog[0].id+"_followCharacter"),c=this.InsertListDialog.find("#"+this.InsertListDialog[0].id+"_restartBy"),l=this.InsertListDialog.find("#"+this.InsertListDialog[0].id+"_listlevel"),a=this.InsertListDialog.find("#"+this.InsertListDialog[0].id+"_numberStyle");h.ejDropDownList({dataSource:["Tab","Space","None"],width:"200px",height:25,select:function(t){n._OnFollowCharacterValueChanged(t.value)}});c.ejDropDownList({select:"restartBy",dataSource:["No Restart"],width:"200px",height:25,selectedItemIndex:0});l.ejDropDownList({dataSource:["Level 1","Level 2","Level 3","Level 4","Level 5","Level 6","Level 7","Level 8","Level 9"],width:"200px",selectedItemIndex:0,height:25,select:function(t){n.viewModel.LevelNumber=t.itemId;n._OnListLevelChanged()}});a.ejDropDownList({dataSource:["Arabic","UpRoman","LowRoman","Up Letter","Low Letter","Number","Leading Zero","Bullet","Ordinal","Ordinal Text","Special","Far East"],width:"200px",height:25,select:function(t){n._OnLevelPatternValueChanged(t)},change:function(t){n._OnLevelPatternValueChanged(t)}})},n.prototype._InitAlertDialog=function(){var n=this;n.InsertAlertDialog=n.OwnerControl.ej.buildTag("div","",{display:"none"},{id:"documentEditor_"+n.OwnerControl.ContainerId+"_InsertAlertDialog",title:"DocumentEditor"});n.OwnerControl.DocumentEditorElement.appendChild(n.InsertAlertDialog[0])},n.prototype._InitCellMarginsDialog=function(){var n=this,t,e,s,h,r,i,u,o,c,l,a,v,f,y;n.InsertCellMarginsDialog=n.OwnerControl.ej.buildTag("div","",{display:"none",width:"500px"},{id:"documentEditor_"+n.OwnerControl.ContainerId+"_insertCellMarginsDialog",title:"Table Options"});n.OwnerControl.DocumentEditorElement.appendChild(n.InsertCellMarginsDialog[0]);t=document.createElement("div");t.innerText="Default cell Margins";t.style.fontSize="12px";t.style.padding="10px";t.style.color="blue";e=document.createElement("TABLE");e.style.padding="10px";e.innerHTML+="<tr style='height: 50px;color:black;'><td style= 'width:70%'>Top<br/><input type='text' id= '"+this.InsertCellMarginsDialog[0].id+"_Top' style= 'width:25%' /><\/td><td style= 'width:70%'>Left<input type='text' id= '"+this.InsertCellMarginsDialog[0].id+"_left' style= 'width:100%' /><\/td><\/tr><tr style='height:50px;color:black;'><td style= 'width:40%'>Bottom<input type='text' id= '"+this.InsertCellMarginsDialog[0].id+"_bottom' style= 'width:100%' /><\/td><td style= 'width:40%'>Right<input type='text' id= '"+this.InsertCellMarginsDialog[0].id+"_right' style= 'width:100%' /><\/td><\/tr>";t.appendChild(e);s=n.OwnerControl.ej.buildTag("input","",{"margin-left":"0px",width:"65px",left:"170px",position:"relative"},{type:"button",id:n.InsertCellMarginsDialog[0].id+"_ok",value:"OK"});s.ejButton({width:75});h=n.OwnerControl.ej.buildTag("input","",{"margin-left":"0px",width:"65px",left:"190px",position:"relative"},{id:n.InsertCellMarginsDialog[0].id+"_cancel",type:"button",value:"Cancel"});h.ejButton({click:function(t){t.cancel||n.InsertCellMarginsDialog.ejDialog("close")},width:75});r=document.createElement("div");r.style.lineHeight="1px";r.style.height="1px";r.style.backgroundColor=" #D9D9D9";r.style.width="100%";i=document.createElement("div");i.innerText="Default Cell spacing";i.style.fontSize="12px";i.style.color="blue";i.style.padding="10px";u=document.createElement("table");u.style.padding="10px";u.style.height="75px";u.innerHTML+="<tr><td style='width:70%'><input type='checkbox' id= '"+this.InsertCellMarginsDialog[0].id+"_cellcheck' style= 'width:25%' /><\/td><td><input type='text' id= '"+this.InsertCellMarginsDialog[0].id+"_cellspacing' style= 'width:25%' /><\/td><\/tr>";i.appendChild(u);o=document.createElement("div");o.appendChild(s[0]);o.appendChild(h[0]);n.InsertCellMarginsDialog[0].appendChild(t);n.InsertCellMarginsDialog[0].appendChild(r);n.InsertCellMarginsDialog[0].appendChild(i);n.InsertCellMarginsDialog[0].appendChild(o);c=n.InsertCellMarginsDialog.find("#"+n.InsertCellMarginsDialog[0].id+"_Top");c.ejNumericTextbox({value:0,minValue:0,width:100,height:25,decimalPlaces:2,enablePersistence:!1});l=n.InsertCellMarginsDialog.find("#"+n.InsertCellMarginsDialog[0].id+"_left");l.ejNumericTextbox({value:0,minValue:0,width:100,height:25,decimalPlaces:2,enablePersistence:!1});a=n.InsertCellMarginsDialog.find("#"+n.InsertCellMarginsDialog[0].id+"_bottom");a.ejNumericTextbox({value:0,minValue:0,width:100,height:25,decimalPlaces:2,enablePersistence:!1});v=n.InsertCellMarginsDialog.find("#"+n.InsertCellMarginsDialog[0].id+"_right");v.ejNumericTextbox({value:0,minValue:0,width:100,height:25,decimalPlaces:2,enablePersistence:!1});f=n.InsertCellMarginsDialog.find("#"+n.InsertCellMarginsDialog[0].id+"_cellspacing");f.ejNumericTextbox({value:0,minValue:0,width:100,height:25,decimalPlaces:2,enablePersistence:!1});y=n.InsertCellMarginsDialog.find("#"+n.InsertCellMarginsDialog[0].id+"_cellcheck");y.ejCheckBox({text:"Allow Spacing between cells",width:100,change:function(n){n.isChecked?f.ejNumericTextbox("enable"):f.ejNumericTextbox("disable")}});f.ejNumericTextbox("disable")},n.prototype._InitTablePropertyDialog=function(){var n=this,r,e,o,c,l,t;n.TablePropertiesDialog=n.OwnerControl.ej.buildTag("div","",{display:"none"},{id:n.OwnerControl.ContainerId+"_TablePropertiesDialog",title:"Table Properties"});n.OwnerControl.DocumentEditorElement.appendChild(n.TablePropertiesDialog[0]);var s=document.createElement("div"),i=n.OwnerControl.ej.buildTag("div","",{height:"auto"},{id:n.OwnerControl.ContainerId+"_TablePropertiesDialogTab"}),a=document.createElement("ul");a.innerHTML="<li><a href=#"+n.TablePropertiesDialog[0].id+"_TableProperties>Table<\/a><\/li><li><a href=#"+n.TablePropertiesDialog[0].id+"_TableRowProperties>Row<\/a><\/li><li><a href=#"+n.TablePropertiesDialog[0].id+"_TableCellProperties>Cell<\/a><\/li>";var u=n.OwnerControl.ej.buildTag("div","",{"padding-bottom":"0px","padding-top":"8px"},{id:n.TablePropertiesDialog[0].id+"_TableProperties"}),h=n.OwnerControl.ej.buildTag("div","",{"padding-bottom":"0px","padding-top":"8px"},{id:n.TablePropertiesDialog[0].id+"_TableRowProperties"}),f=n.OwnerControl.ej.buildTag("div","",{"padding-bottom":"0px","padding-top":"8px"},{id:n.TablePropertiesDialog[0].id+"_TableCellProperties"});for(this._InitTableProperties(u[0]),this._InitTableRowProperties(h[0]),this._InitTableCellProprties(f[0]),s.appendChild(i[0]),i[0].appendChild(a),i[0].appendChild(u[0]),i[0].appendChild(h[0]),i[0].appendChild(f[0]),r=document.createElement("div"),r.style.cssFloat="right",e=n.OwnerControl.ej.buildTag("button","Ok",{"margin-bottom":"5px","margin-top":"6px","margin-right":"10px"},{id:n.TablePropertiesDialog[0].id+"_ok"}),o=n.OwnerControl.ej.buildTag("button","Cancel",{"margin-bottom":"5px","margin-top":"6px","margin-right":"10px"},{id:n.TablePropertiesDialog[0].id+"_cancel"}),o.ejButton({click:function(t){t.cancel||n.TablePropertiesDialog.ejDialog("close")}}),e.ejButton({showRoundedCorner:!1,size:"small"}),e.ejButton({click:function(){n.TablePropertiesDialog.ejDialog("close");n._OnInsertTableProperties()}}),o.ejButton({showRoundedCorner:!1,size:"small"}),r.appendChild(e[0]),r.appendChild(o[0]),s.appendChild(r),n.TablePropertiesDialog[0].appendChild(s),i.ejTab({height:"350px",width:"auto"}),u[0].style.height="300px",h[0].style.height="300px",f[0].style.height="300px",n.TablePropertiesDialog.ejDialog({showOnInit:!1,width:"500px",enableResize:!1}),n.TablePropertiesDialog.ejDialog({close:function(){n._UpdateClassForAlignmetProperties();n._UpdateClassForCellAlignment()}}),c=n.TablePropertiesDialog.find("."+u[0].id+"e-de-table-alignment"),t=0;t<c.length;t++)c[t].addEventListener("click",function(t){n._UpdateClassForAlignmetProperties();var u=t.target.id,r=document.getElementById(u),i=r.className;i=i.replace("e-de-table-properties-alignment","e-de-table-alignment-active");r.className=i});for(l=n.TablePropertiesDialog.find("."+f[0].id+"e-de-table-cell-alignment"),t=0;t<l.length;t++)l[t].addEventListener("click",function(t){n._UpdateClassForCellAlignment();var u=t.target.id,r=document.getElementById(u),i=r.className;i=i.replace("e-de-tablecell-alignment","e-de-table-alignment-active");r.className=i})},n.prototype._InitBordersShadingsPropertiesDialog=function(){var n=this,a,f,v,e,y,ni,i,p,w;n.TableBorderAndShadingDialog=n.OwnerControl.ej.buildTag("div","",{display:"none"},{id:n.OwnerControl.ContainerId+"_table_border_shadings",title:"Borders and Shading"});var ti=n.OwnerControl.ej.buildTag("div","Borders",{color:"#6db4df",width:"100%",display:"block",float:"left","margin-bottom":"10px"}),u=n.OwnerControl.ej.buildTag("div","",{display:"inline-block",position:"absolute",left:"15px",top:"30px",width:"100px",height:"235px",padding:"0px","border-style":"none"},{id:n.TableBorderAndShadingDialog[0].id+"_border_settings"}),r=n.OwnerControl.ej.buildTag("div","",{display:"inline-block",position:"absolute",left:"125px",top:"30px",width:"130px",height:"235px","padding-left":"5px","border-style":"none"},{id:n.TableBorderAndShadingDialog[0].id+"_border_style"}),t=n.OwnerControl.ej.buildTag("div","",{display:"inline-block",position:"absolute",left:"245px",top:"30px",width:"170px",height:"235px",padding:"0px","border-style":"none"},{id:n.TableBorderAndShadingDialog[0].id+"_border_preview"}),ii=n.OwnerControl.ej.buildTag("div","Style",{width:"100%","margin-bottom":"7px"}),ot=n.OwnerControl.ej.buildTag("input","",{display:"inline"},{id:n.TableBorderAndShadingDialog[0].id+"_border_style_dropDown",type:"text"}),ri=n.OwnerControl.ej.buildTag("div","Width",{width:"100%","margin-bottom":"7px","margin-top":"7px"}),st=n.OwnerControl.ej.buildTag("input","",{width:"100%"},{id:n.TableBorderAndShadingDialog[0].id+"_width",type:"text"}),ui=n.OwnerControl.ej.buildTag("div","Color",{width:"100%","margin-bottom":"7px","margin-top":"7px"}),b=n.OwnerControl.ej.buildTag("input","","",{id:n.TableBorderAndShadingDialog[0].id+"_border_color",type:"text"}),fi=n.OwnerControl.ej.buildTag("div","",{width:"420px","margin-top":"8px","margin-bottom":"8px",padding:"0px",height:"0px","border-style":"solid","border-color":"#e9e9e9","border-width":"1px",position:"absolute",top:"250px"}),ei=n.OwnerControl.ej.buildTag("div","Setting",{width:"100%","margin-bottom":"7px"}),o=n.OwnerControl.ej.buildTag("div","",{top:"25px",position:"absolute"},{id:n.TableBorderAndShadingDialog[0].id+"_None_Div_Container"}),ht=n.OwnerControl.ej.buildTag("div","",{width:"40px",height:"40px",border:"1px solid black",display:"inline-block"},{id:n.TableBorderAndShadingDialog[0].id+"_None_Div"}),oi=n.OwnerControl.ej.buildTag("label","None",{"font-size":"11px","font-weight":"normal","margin-left":"10px",top:"15px",position:"absolute"},{"for":n.TableBorderAndShadingDialog[0].id+"_None_Div_Label"}),s=n.OwnerControl.ej.buildTag("div","",{top:"75px",position:"absolute"},{id:n.TableBorderAndShadingDialog[0].id+"_Box_Div_Container"}),ct=n.OwnerControl.ej.buildTag("div","",{width:"40px",height:"40px",border:"1px solid black",display:"inline-block"},{id:n.TableBorderAndShadingDialog[0].id+"_Box_Div"}),si=n.OwnerControl.ej.buildTag("label","Box",{"font-size":"11px","font-weight":"normal","margin-left":"10px",top:"15px",position:"absolute"},{"for":n.TableBorderAndShadingDialog[0].id+"_Box_Div_Label"}),h=n.OwnerControl.ej.buildTag("div","",{top:"125px",position:"absolute"},{id:n.TableBorderAndShadingDialog[0].id+"_All_Div_Container"}),lt=n.OwnerControl.ej.buildTag("div","",{width:"40px",height:"40px",border:"1px solid black",display:"inline-block"},{id:n.TableBorderAndShadingDialog[0].id+"_All_Div"}),hi=n.OwnerControl.ej.buildTag("label","All",{"font-size":"11px","font-weight":"normal","margin-left":"10px",top:"15px",position:"absolute"},{"for":n.TableBorderAndShadingDialog[0].id+"_All_Div_Label"}),c=n.OwnerControl.ej.buildTag("div","",{top:"175px",position:"absolute"},{id:n.TableBorderAndShadingDialog[0].id+"_Custom_Div_Container"}),at=n.OwnerControl.ej.buildTag("div","",{width:"40px",height:"40px",border:"1px solid black",display:"inline-block"},{id:n.TableBorderAndShadingDialog[0].id+"_Custom_Div"}),ci=n.OwnerControl.ej.buildTag("label","Custom",{"font-size":"11px","font-weight":"normal","margin-left":"10px",top:"15px",position:"absolute"},{"for":n.TableBorderAndShadingDialog[0].id+"_Custom_Div_Label"}),li=n.OwnerControl.ej.buildTag("div","","",{id:n.TableBorderAndShadingDialog[0].id+"_None_Div_Transparent","class":"e-de-table-border-setting"}),ai=n.OwnerControl.ej.buildTag("div","","",{id:n.TableBorderAndShadingDialog[0].id+"_Box_Div_Transparent","class":"e-de-table-border-setting"}),vi=n.OwnerControl.ej.buildTag("div","","",{id:n.TableBorderAndShadingDialog[0].id+"_All_Div_Transparent","class":"e-de-table-border-setting"}),yi=n.OwnerControl.ej.buildTag("div","","",{id:n.TableBorderAndShadingDialog[0].id+"_Custom_Div_Transparent","class":"e-de-table-border-setting"}),pi=n.OwnerControl.ej.buildTag("div","Preview",{width:"100%","margin-bottom":"7px"});o.on("click",function(t){n._HandleSettingCheckBoxAction(t)});s.on("click",function(t){n._HandleSettingCheckBoxAction(t)});h.on("click",function(t){n._HandleSettingCheckBoxAction(t)});c.on("click",function(t){n._HandleSettingCheckBoxAction(t)});var wi=n.OwnerControl.ej.buildTag("div","",{width:"80px",height:"80px",border:"1px solid black",position:"absolute",left:"50px",top:"50px"},{id:n.TableBorderAndShadingDialog[0].id+"_Preview_Div"}),bi=n.OwnerControl.ej.buildTag("div","",{position:"absolute",width:"1px",height:"113px","background-color":"grey",left:"88px",top:"34px",transform:"rotate(135deg)"},{id:n.TableBorderAndShadingDialog[0].id+"_Preview_Div_Right_Diagonal"}),ki=n.OwnerControl.ej.buildTag("div","",{position:"absolute",width:"1px",height:"113px","background-color":"grey",left:"90px",top:"34px",transform:"rotate(45deg)"},{id:n.TableBorderAndShadingDialog[0].id+"_Preview_Div_Left_Diagonal"}),di=n.OwnerControl.ej.buildTag("div","",{width:"1px",height:"81px","background-color":"grey",position:"absolute",left:"90px",top:"50px"},{id:n.TableBorderAndShadingDialog[0].id+"_Preview_Div_Vertical"}),gi=n.OwnerControl.ej.buildTag("div","",{width:"81px",height:"1px","background-color":"grey",position:"absolute",left:"50px",top:"90px"},{id:n.TableBorderAndShadingDialog[0].id+"_Preview_Div_Horizontal"}),k=n.OwnerControl.ej.buildTag("div","",{top:"50px",position:"absolute",left:"10px"},{id:n.TableBorderAndShadingDialog[0].id+"_Preview_Div_TopTop_Container"}),vt=n.OwnerControl.ej.buildTag("div","",{width:"20px",height:"20px",border:"1px solid black",display:"inline-block"},{id:n.TableBorderAndShadingDialog[0].id+"_Preview_Div_TopTop"}),d=n.OwnerControl.ej.buildTag("div","",{top:"80px",position:"absolute",left:"10px"},{id:n.TableBorderAndShadingDialog[0].id+"_Preview_Div_TopCenter_Container"}),yt=n.OwnerControl.ej.buildTag("div","",{width:"20px",height:"20px",border:"1px solid black",display:"inline-block"},{id:n.TableBorderAndShadingDialog[0].id+"_Preview_Div_TopCenter"}),g=n.OwnerControl.ej.buildTag("div","",{top:"110px",position:"absolute",left:"10px"},{id:n.TableBorderAndShadingDialog[0].id+"_Preview_Div_TopBottom_Container"}),pt=n.OwnerControl.ej.buildTag("div","",{width:"20px",height:"20px",border:"1px solid black",display:"inline-block"},{id:n.TableBorderAndShadingDialog[0].id+"_Preview_Div_TopBottom"}),nt=n.OwnerControl.ej.buildTag("div","",{top:"150px",position:"absolute",left:"10px"},{id:n.TableBorderAndShadingDialog[0].id+"_Preview_Div_LeftDiagonal_Container"}),wt=n.OwnerControl.ej.buildTag("div","",{width:"20px",height:"20px",border:"1px solid black",display:"inline-block"},{id:n.TableBorderAndShadingDialog[0].id+"_Preview_Div_LeftDiagonal"}),tt=n.OwnerControl.ej.buildTag("div","",{top:"150px",position:"absolute",left:"50px"},{id:n.TableBorderAndShadingDialog[0].id+"_Preview_Div_BottomLeft_Container"}),bt=n.OwnerControl.ej.buildTag("div","",{width:"20px",height:"20px",border:"1px solid black",display:"inline-block"},{id:n.TableBorderAndShadingDialog[0].id+"_Preview_Div_BottomLeft"}),it=n.OwnerControl.ej.buildTag("div","",{top:"150px",position:"absolute",left:"80px"},{id:n.TableBorderAndShadingDialog[0].id+"_Preview_Div_BottomCenter_Container"}),kt=n.OwnerControl.ej.buildTag("div","",{width:"20px",height:"20px",border:"1px solid black",display:"inline-block"},{id:n.TableBorderAndShadingDialog[0].id+"_Preview_Div_BottomCenter"}),rt=n.OwnerControl.ej.buildTag("div","",{top:"150px",position:"absolute",left:"110px"},{id:n.TableBorderAndShadingDialog[0].id+"_Preview_Div_BottomRight_Container"}),dt=n.OwnerControl.ej.buildTag("div","",{width:"20px",height:"20px",border:"1px solid black",display:"inline-block"},{id:n.TableBorderAndShadingDialog[0].id+"_Preview_Div_BottomRight"}),ut=n.OwnerControl.ej.buildTag("div","",{top:"150px",position:"absolute",left:"150px"},{id:n.TableBorderAndShadingDialog[0].id+"_Preview_Div_RightDiagonal_Container"}),gt=n.OwnerControl.ej.buildTag("div","",{width:"20px",height:"20px",border:"1px solid black",display:"inline-block"},{id:n.TableBorderAndShadingDialog[0].id+"_Preview_Div_RightDiagonal"}),nr=n.OwnerControl.ej.buildTag("div","","",{id:n.TableBorderAndShadingDialog[0].id+"_previewDivTopTopTransParent","class":"e-de-table-border-preview"}),tr=n.OwnerControl.ej.buildTag("div","","",{id:n.TableBorderAndShadingDialog[0].id+"_previewDivTopCenterTransParent","class":"e-de-table-border-preview"}),ir=n.OwnerControl.ej.buildTag("div","","",{id:n.TableBorderAndShadingDialog[0].id+"_previewDivTopBottomTransParent","class":"e-de-table-border-preview"}),rr=n.OwnerControl.ej.buildTag("div","","",{id:n.TableBorderAndShadingDialog[0].id+"_previewDivLeftDiagonalTransParent","class":"e-de-table-border-preview"}),ur=n.OwnerControl.ej.buildTag("div","","",{id:n.TableBorderAndShadingDialog[0].id+"_previewDivBottomLeftTransparent","class":"e-de-table-border-preview"}),fr=n.OwnerControl.ej.buildTag("div","","",{id:n.TableBorderAndShadingDialog[0].id+"_previewDivBottomcenterTransparent","class":"e-de-table-border-preview"}),er=n.OwnerControl.ej.buildTag("div","","",{id:n.TableBorderAndShadingDialog[0].id+"_previewDivBottomRightTransparent","class":"e-de-table-border-preview"}),or=n.OwnerControl.ej.buildTag("div","","",{id:n.TableBorderAndShadingDialog[0].id+"_previewDivDiagonalRightTransparent","class":"e-de-table-border-preview"});it.on("click",function(t){n._HandlePreviewCheckBoxAction(t)});tt.on("click",function(t){n._HandlePreviewCheckBoxAction(t)});rt.on("click",function(t){n._HandlePreviewCheckBoxAction(t)});k.on("click",function(t){n._HandlePreviewCheckBoxAction(t)});g.on("click",function(t){n._HandlePreviewCheckBoxAction(t)});d.on("click",function(t){n._HandlePreviewCheckBoxAction(t)});ut.on("click",function(t){n._HandlePreviewCheckBoxAction(t)});nt.on("click",function(t){n._HandlePreviewCheckBoxAction(t)});var ft=n.OwnerControl.ej.buildTag("div","",{display:"inline-block",position:"absolute",left:"15px",top:"255px",width:"400px",height:"130px",padding:"0px","border-style":"none"},{id:n.TableBorderAndShadingDialog[0].id+"_shading_preview"}),sr=n.OwnerControl.ej.buildTag("div","Shading",{width:"100%","margin-top":"10px","margin-bottom":"10px",color:"#6db4df"}),l=document.createElement("div"),et=document.createElement("div");et.setAttribute("style","float:left;margin-top:5px;margin-right:20px");et.innerHTML="Fill";a=n.OwnerControl.ej.buildTag("input","","",{id:n.TableBorderAndShadingDialog[0].id+"_shading_color",type:"text"});f=document.createElement("div");f.setAttribute("style","position:absolute;top:45px;left:230px;width:180px");v=document.createElement("div");v.setAttribute("style","width:100px;padding-top:4px;margin-right:5px");v.innerHTML="Apply To";e=document.createElement("div");e.setAttribute("style","width:100px;position:absolute;left:60px;top:0px");y=n.OwnerControl.ej.buildTag("input","","",{type:"text",id:n.TableBorderAndShadingDialog[0].id+"_Apply_To"});ni=n.OwnerControl.ej.buildTag("ul","<li>Cell<\/li><li>Table<\/li>","",{id:n.TableBorderAndShadingDialog[0].id+"_shading"});e.appendChild(y[0]);e.appendChild(ni[0]);ht[0].appendChild(li[0]);ct[0].appendChild(ai[0]);lt[0].appendChild(vi[0]);at[0].appendChild(yi[0]);o[0].appendChild(ht[0]);o[0].appendChild(oi[0]);s[0].appendChild(ct[0]);s[0].appendChild(si[0]);h[0].appendChild(lt[0]);h[0].appendChild(hi[0]);c[0].appendChild(at[0]);c[0].appendChild(ci[0]);u[0].appendChild(ei[0]);u[0].appendChild(o[0]);u[0].appendChild(s[0]);u[0].appendChild(h[0]);u[0].appendChild(c[0]);kt[0].appendChild(fr[0]);dt[0].appendChild(er[0]);bt[0].appendChild(ur[0]);vt[0].appendChild(nr[0]);yt[0].appendChild(tr[0]);pt[0].appendChild(ir[0]);gt[0].appendChild(or[0]);wt[0].appendChild(rr[0]);it[0].appendChild(kt[0]);tt[0].appendChild(bt[0]);rt[0].appendChild(dt[0]);ut[0].appendChild(gt[0]);nt[0].appendChild(wt[0]);g[0].appendChild(pt[0]);d[0].appendChild(yt[0]);k[0].appendChild(vt[0]);t[0].appendChild(pi[0]);t[0].appendChild(wi[0]);t[0].appendChild(bi[0]);t[0].appendChild(gi[0]);t[0].appendChild(ki[0]);t[0].appendChild(di[0]);t[0].appendChild(it[0]);t[0].appendChild(tt[0]);t[0].appendChild(rt[0]);t[0].appendChild(ut[0]);t[0].appendChild(nt[0]);t[0].appendChild(g[0]);t[0].appendChild(d[0]);t[0].appendChild(k[0]);f.appendChild(v);f.appendChild(e);l.appendChild(et);l.appendChild(a[0]);l.appendChild(f);ft[0].appendChild(sr[0]);ft[0].appendChild(l);r[0].appendChild(ii[0]);r[0].appendChild(ot[0]);r[0].appendChild(ri[0]);r[0].appendChild(st[0]);r[0].appendChild(ui[0]);r[0].appendChild(b[0]);i=document.createElement("div");i.style.cssFloat="right";i.style.position="absolute";i.style.top="350px";i.style.left="225px";p=n.OwnerControl.ej.buildTag("button","OK",{"margin-bottom":"5px","margin-top":"6px","margin-right":"10px"},{id:n.TablePropertiesDialog[0].id+"_ok"});w=n.OwnerControl.ej.buildTag("button","Cancel",{"margin-bottom":"5px","margin-top":"6px","margin-right":"10px"},{id:n.TablePropertiesDialog[0].id+"_cancel"});w.ejButton({click:function(t){t.cancel||n.TableBorderAndShadingDialog.ejDialog("close")}});p.ejButton({showRoundedCorner:!1,size:"small"});p.ejButton({click:function(){n._InsertTableBorderShadingProperties();n.TableBorderAndShadingDialog.ejDialog("close")}});w.ejButton({showRoundedCorner:!1,size:"small"});i.appendChild(p[0]);i.appendChild(w[0]);n.TableBorderAndShadingDialog[0].appendChild(ti[0]);n.TableBorderAndShadingDialog[0].appendChild(u[0]);n.TableBorderAndShadingDialog[0].appendChild(r[0]);n.TableBorderAndShadingDialog[0].appendChild(t[0]);n.TableBorderAndShadingDialog[0].appendChild(fi[0]);n.TableBorderAndShadingDialog[0].appendChild(ft[0]);n.TableBorderAndShadingDialog[0].appendChild(i);y.ejDropDownList({targetID:n.TableBorderAndShadingDialog[0].id+"_shading",width:"100px",selectedItemIndex:1});a.ejColorPicker({value:"#000000"});b.ejColorPicker({value:"#000000"});ot.ejDropDownList({dataSource:[{text:"None"},{text:"Single"},{text:"Dot"},{text:"DashSmallGap"},{text:"DashLargeGap"},{text:"DashDot"},{text:"DashDotDot"},{text:"Double"},{text:"Triple"},{text:"ThinThickSmallGap"},{text:"ThickThinSmallGap"},{text:"ThinThickThinSmallGap"},{text:"ThinThickMediumGap"},{text:"ThickThinMediumGap"},{text:"ThinThickThinMediumGap"},{text:"ThinThickLargeGap"},{text:"ThickThinLargeGap"},{text:"ThinThickThinLargeGap"},{text:"SingleWavy"},{text:"DoubleWavy"},{text:"DashDotStroked "},{text:"Emboss3D"},{text:"Engrave3D"},{text:"Outset"},{text:"Inset"},{text:"Thick"}],targetID:n.TableBorderAndShadingDialog[0].id+"_border_style_dropDown",width:"100px",selectedItemIndex:0});st.ejNumericTextbox({name:"numeric",value:0,width:"100px",minValue:0,maxValue:6,incrementStep:.25,decimalPlaces:2});n.TableBorderAndShadingDialog.ejDialog({showOnInit:!1,width:"450px",height:"500px",enableResize:!1,overflow:"none"});b.ejColorPicker({select:function(t){n._ApplyPreviewTableBorderColor(t)}});a.ejColorPicker({select:function(t){n._ApplyPreviewTableBackgroundColor(t)}});y.ejDropDownList({change:function(t){n._ApplyTableCellPreviewBoxes(t)}});this.TableBorderAndShadingDialog.find("#"+this.TableBorderAndShadingDialog[0].id+"_shading_colorWrapper").css("width","100px");this.TableBorderAndShadingDialog.find("#"+this.TableBorderAndShadingDialog[0].id+"_shading_colorWrapper").css("height","22px");this.TableBorderAndShadingDialog.find("#"+this.TableBorderAndShadingDialog[0].id+"_shading_colorWrapper").css("border-radius","0px");this.TableBorderAndShadingDialog.find("#"+this.TableBorderAndShadingDialog[0].id+"_border_colorWrapper").css("width","100px");this.TableBorderAndShadingDialog.find("#"+this.TableBorderAndShadingDialog[0].id+"_border_colorWrapper").css("height","22px");this.TableBorderAndShadingDialog.find("#"+this.TableBorderAndShadingDialog[0].id+"_border_colorWrapper").css("border-radius","0px");this.TableBorderAndShadingDialog.find(".e-selected-color").css("width","75px");this.TableBorderAndShadingDialog.find(".e-selected-color").css("height","12px")},n.prototype._InsertTableBorderShadingProperties=function(){var t=this.OwnerControl.TableBoderShadingDialog,n=this.TableBorderAndShadingDialog,p=this.TableBorderAndShadingDialog[0].id,i=n.find("#"+n[0].id+"_border_style_dropDown"),r=n.find("#"+n[0].id+"_width"),u=n.find("#"+n[0].id+"_border_color"),f=n.find("#"+n[0].id+"_shading_color"),e=n.find("#"+n[0].id+"_Apply_To"),o=n.find("#"+n[0].id+"_previewDivTopTopTransParent"),s=n.find("#"+n[0].id+"_previewDivTopCenterTransParent"),h=n.find("#"+n[0].id+"_previewDivTopBottomTransParent"),c=n.find("#"+n[0].id+"_previewDivLeftDiagonalTransParent"),l=n.find("#"+n[0].id+"_previewDivDiagonalRightTransparent"),a=n.find("#"+n[0].id+"_previewDivBottomLeftTransparent"),v=n.find("#"+n[0].id+"_previewDivBottomcenterTransparent"),y=n.find("#"+n[0].id+"_previewDivBottomRightTransparent");t.BorderColor=u.data("ejColorPicker").model.value;t.LineWidth=r.data("ejNumericTextbox").model.value;t.LineStyle=i.data("ejDropDownList").model.selectedIndex;t.ShadingFill=f.data("ejColorPicker").model.value;t.ApplyTo=e.data("ejDropDownList").model.selectedIndex;t.TopBorder=o.hasClass("e-de-table-border-preview-click");t.BottomBorder=h.hasClass("e-de-table-border-preview-click");t.LeftBorder=a.hasClass("e-de-table-border-preview-click");t.RightBorder=y.hasClass("e-de-table-border-preview-click");t.HorizontalBorder=s.hasClass("e-de-table-border-preview-click");t.VerticalBorder=v.hasClass("e-de-table-border-preview-click");t.DiagonalLeftBorder=c.hasClass("e-de-table-border-preview-click");t.DiagonalRightBorder=l.hasClass("e-de-table-border-preview-click");t._ApplyBordersAndShadingButton_Click()},n.prototype._ApplyPreviewTableBackgroundColor=function(n){this.TableBorderAndShadingDialog!=null&&n.value!=""&&(this.TableBorderAndShadingDialog.find("#"+this.TableBorderAndShadingDialog[0].id+"_Preview_Div")[0].style.backgroundColor=n.value)},n.prototype._ApplyPreviewTableBorderColor=function(n){var t=this.TableBorderAndShadingDialog;t!=null&&n.value!=""&&(t.find("#"+t[0].id+"_Preview_Div")[0].style.borderColor=n.value,t.find("#"+t[0].id+"_Preview_Div_Right_Diagonal")[0].style.backgroundColor=n.value,t.find("#"+t[0].id+"_Preview_Div_Left_Diagonal")[0].style.backgroundColor=n.value,t.find("#"+t[0].id+"_Preview_Div_Vertical")[0].style.backgroundColor=n.value,t.find("#"+t[0].id+"_Preview_Div_Horizontal")[0].style.backgroundColor=n.value)},n.prototype._ApplyTableCellPreviewBoxes=function(n){var t=this.TableBorderAndShadingDialog;t.find("#"+t[0].id+"_Custom_Div_Container").click();t!=null&&n.model.selectedIndex==0?(t.find("#"+t[0].id+"_Preview_Div_BottomCenter_Container")[0].style.display="none",t.find("#"+t[0].id+"_Preview_Div_TopCenter_Container")[0].style.display="none"):(t.find("#"+t[0].id+"_Preview_Div_BottomCenter_Container")[0].style.display="",t.find("#"+t[0].id+"_Preview_Div_TopCenter_Container")[0].style.display="")},n.prototype._HandleSettingCheckBoxAction=function(n){var t=n.target.id,r=this.TableBorderAndShadingDialog,i=this.TableBorderAndShadingDialog[0].id;t==i+"_None_Div"||t==i+"_None_Div_Container"||t==i+"_None_Div_Transparent"?(this._UpdateClassForSettingDivElements(),r.find("#"+r[0].id+"_None_Div_Transparent").addClass("e-de-table-border-setting-click"),this._SetSettingPreviewDivElement("none")):t==i+"_Box_Div"||t==i+"_Box_Div_Container"||t==i+"_Box_Div_Transparent"?(this._UpdateClassForSettingDivElements(),r.find("#"+r[0].id+"_Box_Div_Transparent").addClass("e-de-table-border-setting-click"),this._SetSettingPreviewDivElement("box")):t==i+"_All_Div"||t==i+"_All_Div_Container"||t==i+"_All_Div_Transparent"?(this._UpdateClassForSettingDivElements(),r.find("#"+r[0].id+"_All_Div_Transparent").addClass("e-de-table-border-setting-click"),this._SetSettingPreviewDivElement("all")):(this._UpdateClassForSettingDivElements(),r.find("#"+r[0].id+"_Custom_Div_Transparent").addClass("e-de-table-border-setting-click"))},n.prototype._HandlePreviewCheckBoxAction=function(n){var f=n.target,i=f.id,r=this.TableBorderAndShadingDialog,t=r[0].id,u="e-de-table-border-preview-click";r.find("#"+r[0].id+"_Custom_Div_Container").click();i==t+"_Preview_Div_TopTop_Container"||i==t+"_Preview_Div_TopTop"||i==t+"_previewDivTopTopTransParent"?(this._HandlePreviewCheckBoxShowHide(r,t,u,"_previewDivTopTopTransParent"),this._ShowHidePreviewDivElements(r,t,u,"_Preview_Div","_previewDivTopTopTransParent","TopTop")):i==t+"_Preview_Div_TopCenter_Container"||i==t+"_Preview_Div_TopCenter"||i==t+"_previewDivTopCenterTransParent"?(this._HandlePreviewCheckBoxShowHide(r,t,u,"_previewDivTopCenterTransParent"),this._ShowHidePreviewDivElements(r,t,u,"_Preview_Div_Horizontal","_previewDivTopCenterTransParent","TopCenter")):i==t+"_Preview_Div_TopBottom_Container"||i==t+"_Preview_Div_TopBottom"||i==t+"_previewDivTopBottomTransParent"?(this._HandlePreviewCheckBoxShowHide(r,t,u,"_previewDivTopBottomTransParent"),this._ShowHidePreviewDivElements(r,t,u,"_Preview_Div","_previewDivTopBottomTransParent","TopBottom")):i==t+"_Preview_Div_LeftDiagonal_Container"||i==t+"_Preview_Div_LeftDiagonal"||i==t+"_previewDivLeftDiagonalTransParent"?(this._HandlePreviewCheckBoxShowHide(r,t,u,"_previewDivLeftDiagonalTransParent"),this._ShowHidePreviewDivElements(r,t,u,"_Preview_Div_Left_Diagonal","_previewDivLeftDiagonalTransParent","LeftDiagonal")):i==t+"_Preview_Div_BottomLeft_Container"||i==t+"_Preview_Div_BottomLeft"||i==t+"_previewDivBottomLeftTransparent"?(this._HandlePreviewCheckBoxShowHide(r,t,u,"_previewDivBottomLeftTransparent"),this._ShowHidePreviewDivElements(r,t,u,"_Preview_Div","_previewDivBottomLeftTransparent","BottomLeft")):i==t+"_Preview_Div_BottomCenter_Container"||i==t+"_Preview_Div_BottomCenter"||i==t+"_previewDivBottomcenterTransparent"?(this._HandlePreviewCheckBoxShowHide(r,t,u,"_previewDivBottomcenterTransparent"),this._ShowHidePreviewDivElements(r,t,u,"_Preview_Div_Vertical","_previewDivBottomcenterTransparent","BottomCenter")):i==t+"_Preview_Div_BottomRight_Container"||i==t+"_Preview_Div_BottomRight"||i==t+"_previewDivBottomRightTransparent"?(this._HandlePreviewCheckBoxShowHide(r,t,u,"_previewDivBottomRightTransparent"),this._ShowHidePreviewDivElements(r,t,u,"_Preview_Div","_previewDivBottomRightTransparent","BottomRight")):(i==t+"_Preview_Div_RightDiagonal_Container"||i==t+"_Preview_Div_RightDiagonal"||i==t+"_previewDivDiagonalRightTransparent")&&(this._HandlePreviewCheckBoxShowHide(r,t,u,"_previewDivDiagonalRightTransparent"),this._ShowHidePreviewDivElements(r,t,u,"_Preview_Div_Right_Diagonal","_previewDivDiagonalRightTransparent","RightDiagonal"))},n.prototype._HandlePreviewCheckBoxShowHide=function(n,t,i,r){var u=n.find("#"+t+r);u.hasClass(i)?u.removeClass(i):u.addClass(i)},n.prototype._ShowHidePreviewDivElements=function(n,t,i,r,u,f){var e=n.find("#"+t+r),o=n.find("#"+t+u);f=="TopTop"?this._SetPropertyPreviewDivElement(e,o,i,"border-top"):f=="TopCenter"?this._SetPropertyPreviewDivElement(e,o,i,"display"):f=="TopBottom"?this._SetPropertyPreviewDivElement(e,o,i,"border-bottom"):f=="LeftDiagonal"?this._SetPropertyPreviewDivElement(e,o,i,"display"):f=="BottomLeft"?this._SetPropertyPreviewDivElement(e,o,i,"border-left"):f=="BottomCenter"?this._SetPropertyPreviewDivElement(e,o,i,"display"):f=="BottomRight"?this._SetPropertyPreviewDivElement(e,o,i,"border-right"):f=="RightDiagonal"&&this._SetPropertyPreviewDivElement(e,o,i,"display")},n.prototype._SetPropertyPreviewDivElement=function(n,t,i,r){t.hasClass(i)&&r.split("-")[0]=="border"?n.css(r,"1px solid black"):t.hasClass(i)&&r=="display"?n.css(r,"block"):n.css(r,"none")},n.prototype._SetSettingPreviewDivElement=function(n){var t=this.TableBorderAndShadingDialog,c=t[0].id,i=t.find("#"+t[0].id+"_previewDivTopTopTransParent"),r=t.find("#"+t[0].id+"_previewDivTopCenterTransParent"),u=t.find("#"+t[0].id+"_previewDivTopBottomTransParent"),f=t.find("#"+t[0].id+"_previewDivLeftDiagonalTransParent"),e=t.find("#"+t[0].id+"_previewDivDiagonalRightTransparent"),o=t.find("#"+t[0].id+"_previewDivBottomRightTransparent"),s=t.find("#"+t[0].id+"_previewDivBottomLeftTransparent"),h=t.find("#"+t[0].id+"_previewDivBottomcenterTransparent");switch(n){case"none":i.removeClass("e-de-table-border-preview-click");r.removeClass("e-de-table-border-preview-click");u.removeClass("e-de-table-border-preview-click");f.removeClass("e-de-table-border-preview-click");e.removeClass("e-de-table-border-preview-click");o.removeClass("e-de-table-border-preview-click");s.removeClass("e-de-table-border-preview-click");h.removeClass("e-de-table-border-preview-click");this._isShowHidePreviewTableElements("none");break;case"box":r.removeClass("e-de-table-border-preview-click");f.removeClass("e-de-table-border-preview-click");e.removeClass("e-de-table-border-preview-click");h.removeClass("e-de-table-border-preview-click");i.addClass("e-de-table-border-preview-click");u.addClass("e-de-table-border-preview-click");o.addClass("e-de-table-border-preview-click");s.addClass("e-de-table-border-preview-click");this._isShowHidePreviewTableElements("box");break;case"all":f.removeClass("e-de-table-border-preview-click");e.removeClass("e-de-table-border-preview-click");h.addClass("e-de-table-border-preview-click");i.addClass("e-de-table-border-preview-click");u.addClass("e-de-table-border-preview-click");o.addClass("e-de-table-border-preview-click");s.addClass("e-de-table-border-preview-click");r.addClass("e-de-table-border-preview-click");this._isShowHidePreviewTableElements("all")}},n.prototype._UpdateClassForSettingDivElements=function(){for(var i,t=this.TableBorderAndShadingDialog.find(".e-de-table-border-setting"),n=0;n<t.length;n++)t[n].className.indexOf("e-de-table-border-setting-click")!=-1&&(i=t[n].className,i=i.replace("e-de-table-border-setting-click",""),t[n].className=i)},n.prototype._isShowHidePreviewTableElements=function(n){var i=this.TableBorderAndShadingDialog,o=i[0].id,t=i.find("#"+i[0].id+"_Preview_Div"),r=i.find("#"+i[0].id+"_Preview_Div_Right_Diagonal"),u=i.find("#"+i[0].id+"_Preview_Div_Left_Diagonal"),f=i.find("#"+i[0].id+"_Preview_Div_Horizontal"),e=i.find("#"+i[0].id+"_Preview_Div_Vertical");switch(n){case"none":t.css("border-bottom","none");t.css("border-top","none");t.css("border-left","none");t.css("border-right","none");r.css("display","none");u.css("display","none");f.css("display","none");e.css("display","none");break;case"box":t.css("border-bottom","1px solid black");t.css("border-top","1px solid black");t.css("border-left","1px solid black");t.css("border-right","1px solid black");r.css("display","none");u.css("display","none");f.css("display","none");e.css("display","none");break;case"all":t.css("border-bottom","1px solid black");t.css("border-top","1px solid black");t.css("border-left","1px solid black");t.css("border-right","1px solid black");r.css("display","none");u.css("display","none");f.css("display","block");e.css("display","block")}},n.prototype._UpdateClassForAlignmetProperties=function(){for(var i,r=this.TablePropertiesDialog[0].id+"_TableProperties",t=this.TablePropertiesDialog.find("."+r+"e-de-table-alignment"),n=0;n<t.length;n++)t[n].className.indexOf("e-de-table-alignment-active")!=-1&&(i=t[n].className,i=i.replace("e-de-table-alignment-active","e-de-table-properties-alignment"),t[n].className=i)},n.prototype._UpdateClassForCellAlignment=function(){for(var i,r=this,u=r.TablePropertiesDialog[0].id+"_TableCellProperties",t=r.TablePropertiesDialog.find("."+u+"e-de-table-cell-alignment"),n=0;n<t.length;n++)t[n].className.indexOf("e-de-table-alignment-active")!=-1&&(i=t[n].className,i=i.replace("e-de-table-alignment-active","e-de-tablecell-alignment"),t[n].className=i)},n.prototype._InitTableProperties=function(n){var t=this,a=t.OwnerControl.ej.buildTag("div","",{width:"100%"}),g=t.OwnerControl.ej.buildTag("div","Size",{color:"#6db4df",width:"100%",margin:"0px"}),r=t.OwnerControl.ej.buildTag("div","",{display:"inline",width:"100%"}),o=t.OwnerControl.ej.buildTag("div","",{display:"inline-block",width:"100px",float:"left","margin-top":"8px"}),v=t.OwnerControl.ej.buildTag("div","",{display:"inline-block","padding-left":"10px","padding-top":"5px"}),y=t.OwnerControl.ej.buildTag("div","",{display:"inline",float:"left"}),p=t.OwnerControl.ej.buildTag("div","",{display:"inline",float:"right"}),s=t.OwnerControl.ej.buildTag("div","",{float:"right",display:"inline",width:"auto","margin-top":"5px"}),w=t.OwnerControl.ej.buildTag("input","","",{type:"checkbox",id:n.id+"_Prefer_Width_CheckBox"},{"class":"nodetext"}),nt=t.OwnerControl.ej.buildTag("label","Preferred Width",{"font-size":"11px","font-weight":"normal","margin-left":"5px"},{"class":"clslab"},{"for":n.id+"_Prefer_Width_CheckBox"}),b=t.OwnerControl.ej.buildTag("input","",{width:"80px"},{id:n.id+"preferred_Width",type:"text"}),h=t.OwnerControl.ej.buildTag("div",""),k=t.OwnerControl.ej.buildTag("input","",{display:"inline"},{type:"text",id:n.id+"_width_dropdownList"}),tt=t.OwnerControl.ej.buildTag("ul","<li>Pixel<\/li><li>Percent<\/li>","",{id:n.id+"_width_dropdown"}),it=t.OwnerControl.ej.buildTag("label","Measure in",{"font-size":"11px","font-weight":"normal","padding-right":"10px","padding-top":"7px"}),rt=t.OwnerControl.ej.buildTag("div","",{width:"100%","margin-top":"8px","margin-bottom":"8px",padding:"0px",height:"0px","border-style":"inherit","border-bottom-color":"gray","border-width":"inherit"}),ut=t.OwnerControl.ej.buildTag("div","Alignment",{color:"#6db4df",width:"100%",margin:"0px"}),i=t.OwnerControl.ej.buildTag("div","",{width:"100%",height:"70px","margin-top":"10px"}),c=n.id+"e-de-table-alignment",ft=t.OwnerControl.ej.buildTag("div","<div class='e-de-table-properties-alignment e-de-table-left-alignment "+c+"' id= '"+n.id+"_left_alignment' style= 'width:100%;height:100%;padding:0px;margin:0px' ><\/div>",{width:"50px",height:"50px",display:"inline-block","border-style":"solid",margin:"0px 3px 0px 0px","border-width":"1px",padding:"5px 8px 8px 5px"}),et=t.OwnerControl.ej.buildTag("div","<div class='e-de-table-properties-alignment e-de-table-center-alignment "+c+"' id='"+n.id+"_center_alignment' style='width:100%;height:100%;padding:0px;margin:0px'><\/div>",{width:"50px",height:"50px",display:"inline-block","border-style":"solid",margin:"0px 3px 0px 5px","border-width":"1px",padding:"5px 8px 8px 5px"}),ot=t.OwnerControl.ej.buildTag("div","<div class='e-de-table-properties-alignment e-de-table-right-alignment "+c+"' id='"+n.id+"_right_alignment' style='width:100%;height:100%;padding:0px;margin:0px'><\/div>",{width:"50px",height:"50px",display:"inline-block","border-style":"solid",margin:"0px 3px 0px 5px","border-width":"1px",padding:"5px 8px 8px 5px"}),st=t.OwnerControl.ej.buildTag("label","Left",{position:"absolute",top:"235px",left:"57px","font-size":"13px","font-weight":"normal"}),ht=t.OwnerControl.ej.buildTag("label","Center",{position:"absolute",top:"235px",left:"123px","font-size":"13px","font-weight":"normal"}),ct=t.OwnerControl.ej.buildTag("label","Right",{position:"absolute",top:"235px",left:"197px","font-size":"13px","font-weight":"normal"}),l=t.OwnerControl.ej.buildTag("div","",{width:"auto",height:"auto",display:"inline","padding-top":"15px",margin:"5px",float:"right"}),lt=t.OwnerControl.ej.buildTag("label","Indent from Left",{float:"right","font-weight":"normal","margin-top":"7px","margin-right":"5px","font-size":"11px"}),d=t.OwnerControl.ej.buildTag("input","",{float:"right"},{id:n.id+"_left_indent",type:"text"}),u=document.createElement("div"),f,e;u.setAttribute("style","position:absolute;top:300px;left:250px");f=t.OwnerControl.ej.buildTag("button","Borders and Shadings",{"margin-bottom":"5px","margin-top":"6px","margin-right":"10px"},{id:n.id+"_borders_and_shadings"});e=t.OwnerControl.ej.buildTag("button","Options",{"margin-bottom":"5px","margin-top":"6px","margin-right":"10px"},{id:n.id+"_table_cellmargin"});e.ejButton({click:function(){t._ShowCellMarginsDialog()}});f.ejButton({click:function(){t._ShowBordersShadingsPropertiesDialog()}});f.ejButton({showRoundedCorner:!1,width:"150px",height:"auto"});e.ejButton({showRoundedCorner:!1,width:"auto",height:"auto"});u.appendChild(f[0]);u.appendChild(e[0]);l[0].appendChild(d[0]);l[0].appendChild(lt[0]);i[0].appendChild(ft[0]);i[0].appendChild(et[0]);i[0].appendChild(ot[0]);i[0].appendChild(st[0]);i[0].appendChild(ht[0]);i[0].appendChild(ct[0]);i[0].appendChild(l[0]);a[0].appendChild(g[0]);n.appendChild(a[0]);o[0].appendChild(w[0]);o[0].appendChild(nt[0]);r[0].appendChild(o[0]);v[0].appendChild(b[0]);r[0].appendChild(v[0]);h[0].appendChild(k[0]);h[0].appendChild(tt[0]);y[0].appendChild(it[0]);p[0].appendChild(h[0]);s[0].appendChild(y[0]);s[0].appendChild(p[0]);r[0].appendChild(s[0]);n.appendChild(r[0]);n.appendChild(rt[0]);n.appendChild(ut[0]);n.appendChild(i[0]);n.appendChild(u);w.ejCheckBox({change:function(){t._ChangeTableCheckBox(this)}});b.ejNumericTextbox({name:"numeric",value:0,width:"100px",minValue:0,maxValue:2112,decimalPlaces:2});d.ejNumericTextbox({name:"numeric",value:0,width:"100px",minValue:-1440,maxValue:1440,decimalPlaces:2});k.ejDropDownList({targetID:n.id+"_width_dropdown",width:"100px",watermarkText:"Measure in"})},n.prototype._InitTableRowProperties=function(n){var t=this,e=t.OwnerControl.ej.buildTag("div","",{width:"100%"}),p=t.OwnerControl.ej.buildTag("div","Size",{color:"#6db4df",width:"100%",margin:"0px"}),i=t.OwnerControl.ej.buildTag("div","",{display:"inline",width:"100%"}),r=t.OwnerControl.ej.buildTag("div","",{display:"inline",width:"100px",float:"left","margin-top":"8px"}),o=t.OwnerControl.ej.buildTag("input","","",{type:"checkbox",id:n.id+"_height_CheckBox"},{"class":"nodetext"}),w=t.OwnerControl.ej.buildTag("label","Specify height",{"font-size":"11px","font-weight":"normal","margin-left":"5px"},{"class":"clslab"},{"for":n.id+"_height_CheckBox"}),s=t.OwnerControl.ej.buildTag("div","",{display:"inline-block","padding-left":"10px","padding-top":"5px"}),h=t.OwnerControl.ej.buildTag("input","","",{type:"text",id:n.id+"_table_row_height"}),u=t.OwnerControl.ej.buildTag("div","",{float:"right",display:"inline",width:"auto","margin-top":"5px"}),c=t.OwnerControl.ej.buildTag("div","",{display:"inline",float:"left"}),l=t.OwnerControl.ej.buildTag("div","",{display:"inline",float:"right"}),f=t.OwnerControl.ej.buildTag("div",""),a=t.OwnerControl.ej.buildTag("input","",{display:"inline"},{type:"text",id:n.id+"_height_type_dropdownlist"}),b=t.OwnerControl.ej.buildTag("ul","<li>At least<\/li><li>Exactly<\/li>","",{id:n.id+"_height_type"}),k=t.OwnerControl.ej.buildTag("label","Specify height",{"font-size":"11px","font-weight":"normal","padding-right":"10px","padding-top":"7px"});e[0].appendChild(p[0]);n.appendChild(e[0]);r[0].appendChild(o[0]);r[0].appendChild(w[0]);i[0].appendChild(r[0]);s[0].appendChild(h[0]);i[0].appendChild(s[0]);f[0].appendChild(a[0]);f[0].appendChild(b[0]);c[0].appendChild(k[0]);l[0].appendChild(f[0]);u[0].appendChild(c[0]);u[0].appendChild(l[0]);i[0].appendChild(u[0]);n.appendChild(i[0]);var d=t.OwnerControl.ej.buildTag("div","",{width:"100%","margin-top":"8px","margin-bottom":"8px",padding:"0px",height:"0px","border-style":"inherit","border-bottom-color":"gray","border-width":"inherit"}),g=t.OwnerControl.ej.buildTag("div","Options",{color:"#6db4df",width:"100%","margin-bottom":"10px","margin-top":"0px"}),v=t.OwnerControl.ej.buildTag("input","","",{type:"checkbox",id:n.id+"_allow_row_break"},{"class":"nodetext"}),nt=t.OwnerControl.ej.buildTag("label","Allow row to break across pages<\/br>",{width:"400px","font-weight":"normal","font-size":"12px"},{"class":"clslab"},{"for":"options1"}),y=t.OwnerControl.ej.buildTag("input","","",{type:"checkbox",id:n.id+"_repeat_header"},{"class":"nodetext"}),tt=t.OwnerControl.ej.buildTag("label","Repeat as header row at the top of each page",{"font-size":"12px","font-weight":"normal"},{"class":"clslab"},{"for":"options2"});n.appendChild(d[0]);n.appendChild(g[0]);n.appendChild(v[0]);n.appendChild(nt[0]);n.appendChild(y[0]);n.appendChild(tt[0]);o.ejCheckBox({change:function(){t._ChangeTableRowCheckBox(this)}});v.ejCheckBox();y.ejCheckBox();h.ejNumericTextbox({name:"numeric",value:0,width:"100px",minValue:0,maxValue:2112,decimalPlaces:2});a.ejDropDownList({targetID:n.id+"_height_type",width:"100px",watermarkText:"Specify"})},n.prototype._InitTableCellProprties=function(n){var t=this,h=t.OwnerControl.ej.buildTag("div","",{width:"100%"}),w=t.OwnerControl.ej.buildTag("div","Size",{color:"#6db4df",width:"100%",margin:"0px"}),r=t.OwnerControl.ej.buildTag("div","",{display:"inline",width:"100%"}),u=t.OwnerControl.ej.buildTag("div","",{display:"inline",width:"100px",float:"left","margin-top":"8px"}),c=t.OwnerControl.ej.buildTag("input","","",{type:"checkbox",id:n.id+"_Prefer_Width_CheckBox_cell"},{"class":"nodetext"}),b=t.OwnerControl.ej.buildTag("label","Preferred Width",{"font-size":"11px","font-weight":"normal","margin-left":"5px"},{"class":"clslab"},{"for":n.id+"Prefer_Width_CheckBox"}),l=t.OwnerControl.ej.buildTag("div","",{display:"inline-block","padding-left":"10px","padding-top":"5px"}),a=t.OwnerControl.ej.buildTag("input","","",{id:n.id+"tablecell_Width_textBox"},{type:"text"}),f=t.OwnerControl.ej.buildTag("div","",{float:"right",display:"inline",width:"auto","margin-top":"5px"}),v=t.OwnerControl.ej.buildTag("div","",{display:"inline",float:"left"}),y=t.OwnerControl.ej.buildTag("div","",{display:"inline",float:"right"}),e=t.OwnerControl.ej.buildTag("div",""),p=t.OwnerControl.ej.buildTag("input","",{display:"inline"},{type:"text",id:n.id+"_measure_type_cell_dropdownlist"}),k=t.OwnerControl.ej.buildTag("ul","<li>Pixel<\/li><li>Percent<\/li>","",{id:n.id+"_measure_type_cell"}),d=t.OwnerControl.ej.buildTag("label","Measure in",{"font-size":"11px","font-weight":"normal","padding-right":"10px","padding-top":"7px"});h[0].appendChild(w[0]);n.appendChild(h[0]);u[0].appendChild(c[0]);u[0].appendChild(b[0]);r[0].appendChild(u[0]);l[0].appendChild(a[0]);r[0].appendChild(l[0]);e[0].appendChild(p[0]);e[0].appendChild(k[0]);v[0].appendChild(d[0]);y[0].appendChild(e[0]);f[0].appendChild(v[0]);f[0].appendChild(y[0]);r[0].appendChild(f[0]);n.appendChild(r[0]);var g=t.OwnerControl.ej.buildTag("div","",{width:"100%","margin-top":"8px","margin-bottom":"8px",padding:"0px",height:"0px","border-style":"inherit","border-bottom-color":"gray","border-width":"inherit"}),nt=t.OwnerControl.ej.buildTag("div","Vertical Alignment",{color:"#6db4df",width:"100%",margin:"0px"}),o=n.id+"e-de-table-cell-alignment",i=t.OwnerControl.ej.buildTag("div","",{width:"100%",height:"100px","margin-top":"10px"}),tt=t.OwnerControl.ej.buildTag("div","<div class='e-de-tablecell-alignment e-de-tablecell-top-alignment "+o+"' id='"+n.id+"_cell_top-alignment' style='width:100%;height:100%;padding:0px;margin:0px;border-style:solid;border-width:2px'><\/div>",{width:"50px",height:"50px",display:"inline-block","border-style":"solid",margin:"0px 3px 0px 0px","border-width":"1px",padding:"5px 8px 8px 5px"}),it=t.OwnerControl.ej.buildTag("div","<div class='e-de-tablecell-alignment e-de-tablecell-center-alignment "+o+"' id='"+n.id+"_cell_center-alignment' style='width:100%;height:100%;padding:0px;margin:0px;border-style:solid;border-width:2px'><\/div>",{width:"50px",height:"50px",display:"inline-block","border-style":"solid",margin:"0px 3px 0px 5px","border-width":"1px",padding:"5px 8px 8px 5px"}),rt=t.OwnerControl.ej.buildTag("div","<div class='e-de-tablecell-alignment e-de-tablecell-bottom-alignment "+o+"' id='"+n.id+"_cell_bottom-alignment' style='width:100%;height:100%;padding:0px;margin:0px;border-style:solid;border-width:2px'><\/div>",{width:"50px",height:"50px",display:"inline-block","border-style":"solid",margin:"0px 3px 0px 5px","border-width":"1px",padding:"5px 8px 8px 5px"}),ut=t.OwnerControl.ej.buildTag("label","Top",{position:"absolute",top:"235px",left:"55px","font-size":"13px","font-weight":"normal"}),ft=t.OwnerControl.ej.buildTag("label","Center",{position:"absolute",top:"235px",left:"120px","font-size":"13px","font-weight":"normal"}),et=t.OwnerControl.ej.buildTag("label","Bottom",{position:"absolute",top:"235px",left:"190px","font-size":"13px","font-weight":"normal"}),s=document.createElement("div");s.style.cssFloat="right";s.style.marginTop="30px";i[0].appendChild(tt[0]);i[0].appendChild(it[0]);i[0].appendChild(rt[0]);i[0].appendChild(ut[0]);i[0].appendChild(ft[0]);i[0].appendChild(et[0]);n.appendChild(g[0]);n.appendChild(nt[0]);n.appendChild(i[0]);n.appendChild(s);c.ejCheckBox({change:function(){t._ChangeTableCellCheckBox(this)}});a.ejNumericTextbox({name:"numeric",value:0,width:"100px",minValue:0,maxValue:2112,decimalPlaces:2});p.ejDropDownList({targetID:n.id+"_measure_type_cell",width:"100px",watermarkText:"Measure in"})},n.prototype._ChangeTableCheckBox=function(n){var t="#"+this.TablePropertiesDialog[0].id+"_TableProperties",i=this.TablePropertiesDialog.find(t+"preferred_Width"),r=this.TablePropertiesDialog.find(t+"_width_dropdownList");n.isChecked()?(i.ejNumericTextbox("enable"),r.ejDropDownList("enable")):(i.ejNumericTextbox("disable"),r.ejDropDownList("disable"))},n.prototype._ChangeTableRowCheckBox=function(n){var t="#"+this.TablePropertiesDialog[0].id+"_TableRowProperties",i=this.TablePropertiesDialog.find(t+"_table_row_height"),r=this.TablePropertiesDialog.find(t+"_height_type_dropdownlist");n.isChecked()?(i.ejNumericTextbox("enable"),r.ejDropDownList("enable")):(i.ejNumericTextbox("disable"),r.ejDropDownList("disable"))},n.prototype._ChangeTableCellCheckBox=function(n){var t="#"+this.TablePropertiesDialog[0].id+"_TableCellProperties",i=this.TablePropertiesDialog.find(t+"tablecell_Width_textBox"),r=this.TablePropertiesDialog.find(t+"_measure_type_cell_dropdownlist");n.isChecked()?(i.ejNumericTextbox("enable"),r.ejDropDownList("enable")):(i.ejNumericTextbox("disable"),r.ejDropDownList("disable"))},n.prototype._CreateEjDialog=function(n){var t=this;n.ejDialog({showOnInit:!1,width:"auto",enableResize:!1,close:function(){t.EditableDiv.focus();t.fontDialog._UnWireEventsAndBindings();t.ParagraphDialog.UnWireEventsAndBindings();t.HyperlinkDialog._ClearValues()}})},n.prototype._CreateEjListBox=function(n){n.ejListBox({})},n.prototype._CreateEjDropDownList=function(n){n.ejDropDownList({})},n.prototype._CreateEjCheckBox=function(n){n.ejCheckBox({checked:!1})},n.prototype._CreateEjNumericTextbox=function(n){n.ejNumericTextbox({name:"numeric",value:0,width:115,decimalPlaces:2})},n.prototype._CreateEjButton=function(n){n.ejButton({})},n.prototype._CreateEjColorPicker=function(n){n.ejColorPicker({value:"#FFFF00",modelType:"palette"})},n.prototype._ValidateClosestElement=function(n){var t,i=!1,r=!1,u=!1,f,e;return(this.VerticalScrollBar!=null||this.VerticalScrollBar!=undefined)&&(f=document.getElementById(this.VerticalScrollBar._id),t=this._Closest(n,f),i=t!=null&&t!=undefined?!0:!1),(this.HorizontalScrollBar!=null||this.HorizontalScrollBar!=undefined)&&(e=document.getElementById(this.HorizontalScrollBar._id),t=this._Closest(n,e),r=t!=null&&t!=undefined?!0:!1),(this.ViewerContatiner!=null||this.ViewerContatiner!=undefined)&&(t=this._Closest(n,this.ViewerContatiner),u=t!=null&&t!=undefined?!0:!1),{isVerticalScroller:i,isHorizontalScroller:r,isClosestToContainer:u}},n.prototype._Closest=function(n,t){for(var i=t.id!=""&&t.id!=undefined&&t!=null?t.id:t.parentElement.id!=""&&t.parentElement.id!=undefined&&t.parentElement!=null?t.parentElement.id:t.parentElement.parentElement.id,r="#"+i;(n=n.parentElement)&&!(n.matches||n.matchesSelector||n.msMatchesSelector||n.oMatchesSelector||n.mozMatchesSelector||n.webkitMatchesSelector).call(n,r););return n!=null||n!=undefined?n:null},n.prototype._OnInsertTableProperties=function(){var i,e,r,o,u,s,f,n,t;for(this.OwnerControl.TableDialog._WireUpEventsAndBindings(),i=this.TablePropertiesDialog[0].id+"_TableProperties",$("#"+i+"_Prefer_Width_CheckBox").data("ejCheckBox").isChecked()?(this.OwnerControl.TableDialog.HasTableWidth=!0,this.OwnerControl.TableDialog.TablePreferredWidth=parseFloat(this.TablePropertiesDialog.find("#"+this.TablePropertiesDialog[0].id+"_TablePropertiespreferred_Width")[0].value),e=this.TablePropertiesDialog.find("#"+this.TablePropertiesDialog[0].id+"_TableProperties_width_dropdownList").data("ejDropDownList"),e.selectedIndexValue==0?this.OwnerControl.TableDialog.TablePreferredWidthType=ht.Pixel:e.selectedIndexValue==1&&(this.OwnerControl.TableDialog.TablePreferredWidthType=ht.Percent)):$("#"+i+"_Prefer_Width_CheckBox").data("ejCheckBox").isChecked()||(this.OwnerControl.TableDialog.HasTableWidth=!1),this.OwnerControl.TableDialog.LeftIndent=parseFloat(this.TablePropertiesDialog.find("#"+this.TablePropertiesDialog[0].id+"_TableProperties_left_indent")[0].value),r=this.TablePropertiesDialog.find("."+i+"e-de-table-alignment"),n=0;n<r.length;n++)t=r[n].className,t.indexOf("e-de-table-alignment-active")!=-1&&(n==0?this.OwnerControl.TableDialog.TableAlignment=rr.Left:n==1?this.OwnerControl.TableDialog.TableAlignment=rr.Center:n==2&&(this.OwnerControl.TableDialog.TableAlignment=rr.Right),t=t.replace("e-de-table-alignment-active","e-de-table-properties-alignment"),r[n].className=t);for($("#"+this.TablePropertiesDialog[0].id+"_TableRowProperties_height_CheckBox").data("ejCheckBox").isChecked()?(this.OwnerControl.TableDialog.HasRowHeight=!0,this.OwnerControl.TableDialog.RowHeight=parseFloat(this.TablePropertiesDialog.find("#"+this.TablePropertiesDialog[0].id+"_TableRowProperties_table_row_height")[0].value),o=this.TablePropertiesDialog.find("#"+this.TablePropertiesDialog[0].id+"_TableRowProperties_height_type_dropdownlist").data("ejDropDownList"),o.selectedIndexValue==0?this.OwnerControl.TableDialog.RowHeightType=et.Atleast:o.selectedIndexValue==1&&(this.OwnerControl.TableDialog.RowHeightType=et.Exactly)):$("#"+this.TablePropertiesDialog[0].id+"_TableRowProperties_height_CheckBox").data("ejCheckBox").isChecked()||(this.OwnerControl.TableDialog.HasRowHeight=!1),this.OwnerControl.TableDialog.AllowBreakAcrossPages=this.TablePropertiesDialog.find("#"+this.TablePropertiesDialog[0].id+"_TableRowProperties_allow_row_break").data("ejCheckBox").isChecked(),this.OwnerControl.TableDialog.IsHeader=this.TablePropertiesDialog.find("#"+this.TablePropertiesDialog[0].id+"_TableRowProperties_repeat_header").data("ejCheckBox").isChecked(),u=this.TablePropertiesDialog[0].id+"_TableCellProperties",$("#"+u+"_Prefer_Width_CheckBox_cell").data("ejCheckBox").isChecked()?(this.OwnerControl.TableDialog.HasCellWidth=!0,this.OwnerControl.TableDialog.CellPreferredWidth=parseFloat(this.TablePropertiesDialog.find("#"+this.TablePropertiesDialog[0].id+"_TableCellPropertiestablecell_Width_textBox")[0].value),s=this.TablePropertiesDialog.find("#"+this.TablePropertiesDialog[0].id+"_TableCellProperties_measure_type_cell_dropdownlist").data("ejDropDownList"),s.selectedIndexValue==0?this.OwnerControl.TableDialog.CellPreferredWidthType=ht.Pixel:s.selectedIndexValue==1&&(this.OwnerControl.TableDialog.CellPreferredWidthType=ht.Percent)):$("#"+u+"_Prefer_Width_CheckBox_cell").data("ejCheckBox").isChecked()||(this.OwnerControl.TableDialog.HasCellWidth=!1),f=this.TablePropertiesDialog.find("."+u+"e-de-table-cell-alignment"),n=0;n<f.length;n++)t=f[n].className,t.indexOf("e-de-table-alignment-active")!=-1&&(n==0?this.OwnerControl.TableDialog.CellContentAlignment=or.Top:n==1?this.OwnerControl.TableDialog.CellContentAlignment=or.Center:n==2&&(this.OwnerControl.TableDialog.CellContentAlignment=or.Bottom),t=t.replace("e-de-table-alignment-active","e-de-tablecell-alignment"),f[n].className=t);this.OwnerControl.TableDialog._ApplyTablePropertiesButton_Click();this.OwnerControl.TableDialog._UnwireEventsAndBindings()},n.prototype._InitContextMenu=function(){var n,v,t,rt,y,i,ut,p,r,ft,w,u,et,b,e,ot,k,o,st,d,s,ht,g,h,ct,nt,c,lt,tt,l,at,it,a,vt;kt._AddCssStyle("."+f.ContextMenuItem+"{display:block}");kt._AddCssStyle("."+f.HiddenContextMenuItem+"{display:none;}");this.ContextMenu=document.createElement("nav");this.ContextMenu.style.zIndex="10000";this.ContextMenu.style.display="none";this.ContextMenu.style.position="absolute";this.ContextMenu.style.width="260px";this.ContextMenu.className=f.DocumentEditor;this.ContextMenu.style.border="1px solid #D3D3D3";this.ContextMenu.style.padding="4px 0px";this.ContextMenu.style.fontSize="12px";this.ContextMenu.style.fontStyle="normal";document.body.appendChild(this.ContextMenu);n=document.createElement("ul");n.style.listStyle="none";n.style.margin="0px";n.style.padding="0px";this.ContextMenu.appendChild(n);v=document.createElement("li");v.style.display="block";n.appendChild(v);t=document.createElement("a");t.className=f.ContextMenuItem;t.id=f.ContextMenuCut;this._SetStyleToContextMenuItem(t);v.appendChild(t);rt=document.createElement("span");rt.innerText="Cut";t.appendChild(rt);y=document.createElement("li");y.style.display="block";n.appendChild(y);i=document.createElement("a");i.className=f.ContextMenuItem;i.id=f.ContextMenuCopy;this._SetStyleToContextMenuItem(i);y.appendChild(i);ut=document.createElement("span");ut.innerText="Copy";i.appendChild(ut);p=document.createElement("li");p.style.display="block";n.appendChild(p);r=document.createElement("a");r.className=f.ContextMenuItem;r.id=f.ContextMenuOpenHyperlink;this._SetStyleToContextMenuItem(r);p.appendChild(r);ft=document.createElement("span");ft.innerText="Open link";r.appendChild(ft);w=document.createElement("li");w.style.display="block";n.appendChild(w);u=document.createElement("a");u.className=f.ContextMenuItem;u.id=f.ContextMenuCopyHyperlink;this._SetStyleToContextMenuItem(u);w.appendChild(u);et=document.createElement("span");et.innerText="Copy link address";u.appendChild(et);b=document.createElement("li");b.style.display="block";n.appendChild(b);e=document.createElement("a");e.className=f.ContextMenuItem;e.id=f.ContextMenuEditHyperlink;this._SetStyleToContextMenuItem(e);b.appendChild(e);ot=document.createElement("span");ot.innerText="Edit Hyperlink";e.appendChild(ot);k=document.createElement("li");k.style.display="block";n.appendChild(k);o=document.createElement("a");o.className=f.ContextMenuItem;o.id=f.ContextMenuHyperlink;this._SetStyleToContextMenuItem(o);k.appendChild(o);st=document.createElement("span");st.innerText="Hyperlink";o.appendChild(st);d=document.createElement("li");d.style.display="block";n.appendChild(d);s=document.createElement("a");s.className=f.ContextMenuItem;s.id=f.ContextMenuFont;this._SetStyleToContextMenuItem(s);d.appendChild(s);ht=document.createElement("span");ht.innerText="Font";s.appendChild(ht);g=document.createElement("li");g.style.display="block";n.appendChild(g);h=document.createElement("a");h.className=f.ContextMenuItem;h.id=f.ContextMenuParagraph;this._SetStyleToContextMenuItem(h);g.appendChild(h);ct=document.createElement("span");ct.innerText="Paragraph";h.appendChild(ct);nt=document.createElement("li");nt.style.display="block";n.appendChild(nt);c=document.createElement("a");c.className=f.ContextMenuItem;c.id=f.ContextMenuTableProperties;this._SetStyleToContextMenuItem(c);nt.appendChild(c);lt=document.createElement("span");lt.innerText="Table Properties";c.appendChild(lt);tt=document.createElement("li");tt.style.display="block";n.appendChild(tt);l=document.createElement("a");l.className=f.ContextMenuItem;l.id=f.ContextMenuRemoveHyperlink;this._SetStyleToContextMenuItem(l);tt.appendChild(l);at=document.createElement("span");at.innerText="Remove Hyperlink";l.appendChild(at);it=document.createElement("li");it.style.display="block";n.appendChild(it);a=document.createElement("a");a.className=f.ContextMenuItem;a.id=f.ContextMenuPaste;this._SetStyleToContextMenuItem(a);it.appendChild(a);vt=document.createElement("span");vt.innerText="Paste";a.appendChild(vt)},n.prototype._SetStyleToContextMenuItem=function(n){n.style.textDecoration="none";n.style.fontSize="12px";n.style.fontFamily="Segoe UI";n.style.cursor="default";n.style.position="relative";n.style.lineHeight="27px";n.style.padding="4px 20px"},n.prototype._OnContextMenuInternal=function(n){var t=this._ValidateClosestElement(n.target),i=t.isClosestToContainer,r=t.isVerticalScroller,u=t.isHorizontalScroller;(n.preventDefault(),n.target!=this.ViewerContatiner&&i&&(r||u))||this.OwnerControl.ej.browserInfo().name!="webkit"&&(this._AddContextMenuItems(),this._ShowContextMenu(),this._PositionContextMenu(n))},n.prototype._AddContextMenuItems=function(){var n=document.getElementById(f.ContextMenuCut),t=document.getElementById(f.ContextMenuCopy),r=document.getElementById(f.ContextMenuPaste),i=document.getElementById(f.ContextMenuHyperlink),u=document.getElementById(f.ContextMenuOpenHyperlink),e=document.getElementById(f.ContextMenuCopyHyperlink),o=document.getElementById(f.ContextMenuEditHyperlink),s=document.getElementById(f.ContextMenuRemoveHyperlink),a=document.getElementById(f.ContextMenuTableProperties),h=document.getElementById(f.ContextMenuFont),c=document.getElementById(f.ContextMenuParagraph),l;this.OwnerControl.IsReadOnlyMode&&!this.OwnerControl.Selection.IsEmpty?(t.className=f.ContextMenuItem,n.className=f.HiddenContextMenuItem,i.className=f.HiddenContextMenuItem):this.OwnerControl.Selection.IsEmpty?this.OwnerControl.IsReadOnlyMode?(t.className=f.DisabledContextMenuItem,n.className=f.HiddenContextMenuItem,i.className=f.HiddenContextMenuItem):(n.className=f.DisabledContextMenuItem,t.className=f.DisabledContextMenuItem):(n.className=f.ContextMenuItem,t.className=f.ContextMenuItem);a.className=!this.OwnerControl.IsReadOnlyMode&&this.OwnerControl.Selection.Start.Paragraph.IsInsideTable&&this.OwnerControl.Selection.End.Paragraph.IsInsideTable?f.ContextMenuItem:f.HiddenContextMenuItem;i.className=this.OwnerControl._CanInsertHyperlink()&&!this.OwnerControl.IsReadOnlyMode?f.ContextMenuItem:f.HiddenContextMenuItem;l=this.OwnerControl.Selection._GetHyperlinkField();l==null?(u.className=f.HiddenContextMenuItem,e.className=f.HiddenContextMenuItem,o.className=f.HiddenContextMenuItem,s.className=f.HiddenContextMenuItem):this.OwnerControl.IsReadOnlyMode||(i.className=f.HiddenContextMenuItem,u.className=f.ContextMenuItem,e.className=f.ContextMenuItem,o.className=f.ContextMenuItem,s.className=f.ContextMenuItem);this.OwnerControl.IsReadOnlyMode?(r.className=f.HiddenContextMenuItem,h.className=f.HiddenContextMenuItem,c.className=f.HiddenContextMenuItem):(r.className=f.ContextMenuItem,h.className=f.ContextMenuItem,c.className=f.ContextMenuItem)},n.prototype._ShowContextMenu=function(){this.ContextMenu.style.display=="none"&&(this.ContextMenu.style.display="block")},n.prototype._HideContextMenu=function(){this.ContextMenu.style.display!="none"&&(this.ContextMenu.style.display="none")},n.prototype._PositionContextMenu=function(n){var r=this._GetContextMenuPosition(n),t=r.X,i=r.Y,u=this.ContextMenu.offsetWidth+4,f=this.ContextMenu.offsetHeight+4,o=window.innerWidth,s=window.innerHeight,e=window.outerWidth/window.innerWidth;this.ContextMenu.style.left=t*e+u<screen.width-40?t+"px":t-u+"px";this.ContextMenu.style.top=i*e+f<screen.height-40?i+"px":i-f+"px"},n.prototype._GetContextMenuPosition=function(n){var t=0,i=0;return n||(n=window.event),n.pageX||n.pageY?(t=n.pageX,i=n.pageY):(n.clientX||n.clientY)&&(t=n.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,i=n.clientY+document.body.scrollTop+document.documentElement.scrollTop),new p(t,i)},n.prototype._GetContextMenuItem=function(n,t){var i=n.srcElement||n.target;if(i.classList.contains(t))return i;while((i=i.parentNode)!=null)if(i.classList&&i.classList.contains(t))return i;return null},n.prototype._HandleContextMenuItem=function(n){var t;switch(n){case f.ContextMenuCut:this.OwnerControl.Selection._Cut();break;case f.ContextMenuCopy:this.OwnerControl.Selection._Copy();break;case f.ContextMenuOpenHyperlink:t=this.OwnerControl.Selection._GetHyperlinkField();this.OwnerControl._FireRequestNavigate(t);break;case f.ContextMenuCopyHyperlink:var i=this.OwnerControl.Selection._GetHyperlinkField(),r=new nf(i),u=new cf(null);u._CopyToClipboard(r.NavigationLink);break;case f.ContextMenuEditHyperlink:this.OwnerControl.IsReadOnlyMode||this._ShowHyperlinkDialog();break;case f.ContextMenuHyperlink:this.OwnerControl.IsReadOnlyMode||this._ShowHyperlinkDialog();break;case f.ContextMenuRemoveHyperlink:this.OwnerControl.IsReadOnlyMode||this.OwnerControl.Selection._RemoveHyperlink();break;case f.ContextMenuFont:this._ShowFontDialog();break;case f.ContextMenuParagraph:this._ShowParagraphDialog();break;case f.ContextMenuPaste:this._OnPasteMenuClick();break;case f.ContextMenuTableProperties:this._ShowTablePropertiesDialog()}},n.prototype._GetPageCanvas=function(n){var t=n.Id;return{backgroundContainer:document.getElementById(t+"_background"),foregroundContainer:document.getElementById(t+"_foreground"),selectionContainer:document.getElementById(t+"_selection"),ellipseContainer:document.getElementById(t+"_ellipse"),resizeContainer:document.getElementById(t+"_resize")}},n.prototype._CloseAllEjDialog=function(){for(var n,i=[this.HyperlinkDialog.InsertHyperlinkDialog.data("ejDialog"),this.InsertFindAndReplaceDialog.data("ejDialog"),this.InsertTableDialog.data("ejDialog"),this.InsertAlertDialog.data("ejDialog"),this.fontDialog.InsertFontDialog.data("ejDialog"),this.ParagraphDialog.InsertParagraphDialog.data("ejDialog")],t=0;t<i.length;t++)n=i[t],n&&n.isOpen()&&n.close()},n.prototype._ShowHideComments=function(){for(var r,n,t=this,i=0;i<t.Pages.Count;i++){if(r=t.Pages[i],n=t._GetPageCanvas(r),n.backgroundContainer==null||n.foregroundContainer==null||n.selectionContainer==null||n.ellipseContainer==null||n.resizeContainer==null)return;var u=n.backgroundContainer,f=n.foregroundContainer,e=n.selectionContainer,o=n.ellipseContainer,s=n.resizeContainer;r._ShowHideComments(u,f,e,o,s,t)}},n.prototype._ShowTableDialog=function(){this._CreateEjDialog(this.InsertTableDialog);this._CloseAllEjDialog();this.InsertTableDialog.ejDialog("open")},n.prototype._ShowHyperlinkDialog=function(){this._CreateEjDialog(this.HyperlinkDialog.InsertHyperlinkDialog);this._CloseAllEjDialog();this.HyperlinkDialog.InsertHyperlinkDialog.ejDialog("open");this.HyperlinkDialog._loadHyperlinkFieldOnDialog()},n.prototype._ShowAlertDialog=function(n){this.InsertAlertDialog[0].innerText=n;this._CreateEjDialog(this.InsertAlertDialog);this._CloseAllEjDialog();this.InsertAlertDialog.ejDialog("open")},n.prototype._ShowCellMarginsDialog=function(){this._CreateEjDialog(this.InsertCellMarginsDialog);this._CloseAllEjDialog();this.InsertCellMarginsDialog.ejDialog("open")},n.prototype._ShowFontDialog=function(){this._CreateEjDialog(this.fontDialog.InsertFontDialog);this._CloseAllEjDialog();this.fontDialog.InsertFontDialog.ejDialog("open");this.fontDialog._loadFontDialog()},n.prototype._ShowListDialog=function(){this._CreateEjDialog(this.InsertListDialog);this._CloseAllEjDialog();this.InsertListDialog.ejDialog("open");this._InitBindingForListUI()},n.prototype._ShowParagraphDialog=function(){this._CreateEjDialog(this.ParagraphDialog.InsertParagraphDialog);this._CloseAllEjDialog();this.ParagraphDialog.InsertParagraphDialog.ejDialog("open");this.ParagraphDialog._LoadParagraphDialog()},n.prototype._ShowFindAndReplaceDialog=function(n){var t,i,r,u,f;n?(this._CreateEjDialog(this.InsertFindAndReplaceDialog),t=this.InsertFindAndReplaceDialog.find("#"+this.InsertFindAndReplaceDialog[0].id+"_tab"),t.ejTab({selectedItemIndex:1}),this._CloseAllEjDialog(),i=this.InsertFindAndReplaceDialog.find("#"+this.InsertFindAndReplaceDialog[0].id+"_replaceText"),i[0].value="",this.InsertFindAndReplaceDialog.ejDialog("open"),this._OnFindReplaceTabChange(1),this._loadFindAndReplaceDialog()):(r=this.InsertFindAndReplaceDialog.find("#"+this.InsertFindAndReplaceDialog[0].id+"_tab"),r.ejTab({selectedItemIndex:0}),this._CloseAllEjDialog(),u=this.InsertFindAndReplaceDialog.find("#"+this.InsertFindAndReplaceDialog[0].id+"_replaceTextBox"),u[0].value="",this.InsertFindAndReplaceDialog.ejDialog("open"),this._OnFindReplaceTabChange(0),f=this.InsertFindAndReplaceDialog.find("#"+this.InsertFindAndReplaceDialog[0].id+"_find"),f[0].style.display="block",this._loadFindAndReplaceDialog())},n.prototype._ShowTablePropertiesDialog=function(){this._LoadTableProperties();this.TablePropertiesDialog.ejDialog("open")},n.prototype._ShowBordersShadingsPropertiesDialog=function(){var f=this.TableBorderAndShadingDialog.find("#"+this.TableBorderAndShadingDialog[0].id+"_width"),e=this.TableBorderAndShadingDialog.find("#"+this.TableBorderAndShadingDialog[0].id+"_border_color"),o=this.TableBorderAndShadingDialog.find("#"+this.TableBorderAndShadingDialog[0].id+"_border_style_dropDown"),s=this.TableBorderAndShadingDialog.find("#"+this.TableBorderAndShadingDialog[0].id+"_shading_color"),h=this.TableBorderAndShadingDialog.find("#"+this.TableBorderAndShadingDialog[0].id+"_Custom_Div_Transparent"),c=this.TableBorderAndShadingDialog.find("#"+this.TableBorderAndShadingDialog[0].id+"_Preview_Div"),l=this.TableBorderAndShadingDialog.find("#"+this.TableBorderAndShadingDialog[0].id+"_Preview_Div_Right_Diagonal"),a=this.TableBorderAndShadingDialog.find("#"+this.TableBorderAndShadingDialog[0].id+"_Preview_Div_Left_Diagonal"),v=this.TableBorderAndShadingDialog.find("#"+this.TableBorderAndShadingDialog[0].id+"_Preview_Div_Horizontal"),y=this.TableBorderAndShadingDialog.find("#"+this.TableBorderAndShadingDialog[0].id+"_Preview_Div_Vertical"),p=this.TableBorderAndShadingDialog.find("#"+this.TableBorderAndShadingDialog[0].id+"_previewDivTopTopTransParent"),w=this.TableBorderAndShadingDialog.find("#"+this.TableBorderAndShadingDialog[0].id+"_previewDivTopCenterTransParent"),b=this.TableBorderAndShadingDialog.find("#"+this.TableBorderAndShadingDialog[0].id+"_previewDivTopBottomTransParent"),k=this.TableBorderAndShadingDialog.find("#"+this.TableBorderAndShadingDialog[0].id+"_previewDivDiagonalRightTransparent"),d=this.TableBorderAndShadingDialog.find("#"+this.TableBorderAndShadingDialog[0].id+"_previewDivBottomLeftTransparent"),g=this.TableBorderAndShadingDialog.find("#"+this.TableBorderAndShadingDialog[0].id+"_previewDivBottomcenterTransparent"),nt=this.TableBorderAndShadingDialog.find("#"+this.TableBorderAndShadingDialog[0].id+"_previewDivBottomRightTransparent"),tt=this.TableBorderAndShadingDialog.find("#"+this.TableBorderAndShadingDialog[0].id+"_previewDivLeftDiagonalTransParent"),n,it=new of(null),t,i,r,u;this.OwnerControl!=null&&(n=this.OwnerControl.Selection.TableFormat.Table.TableFormat);n!=null&&n.Borders!=null&&(n.Borders==null||n.Borders.Top==null?(t=1,i="black",u=0,r="black"):(t=it._GetLineStyle(n.Borders.Top.LineStyle),i=n.Borders.Top.Color,u=n.Borders.Top._GetLineWidth(),r=n.Shading.BackgroundColor));p.addClass("e-de-table-border-preview-click");w.addClass("e-de-table-border-preview-click");b.addClass("e-de-table-border-preview-click");k.addClass("e-de-table-border-preview-click");d.addClass("e-de-table-border-preview-click");g.addClass("e-de-table-border-preview-click");nt.addClass("e-de-table-border-preview-click");tt.addClass("e-de-table-border-preview-click");h.addClass("e-de-table-border-setting-click");c.css("border","1px solid black");l.css("display","block");a.css("display","block");y.css("display","block");v.css("display","block");e.ejColorPicker({value:i});s.ejColorPicker({value:r});f.ejNumericTextbox({value:u});o.ejDropDownList({selectedIndex:t});this.TableBorderAndShadingDialog.ejDialog("open")},n.prototype._OnFindReplaceTabChange=function(n){var u=this.InsertFindAndReplaceDialog.find("#"+this.InsertFindAndReplaceDialog[0].id+"_find"),t=this.InsertFindAndReplaceDialog.find("#"+this.InsertFindAndReplaceDialog[0].id+"_replaceAll"),i=this.InsertFindAndReplaceDialog.find("#"+this.InsertFindAndReplaceDialog[0].id+"_replace"),r=this.InsertFindAndReplaceDialog.find("#"+this.InsertFindAndReplaceDialog[0].id+"_replaceTextBox");n==0?(t[0].style.visibility="hidden",i[0].style.visibility="hidden",r[0].style.visibility="hidden"):this.OwnerControl.IsReadOnlyMode||(t[0].style.visibility="visible",i[0].style.visibility="visible",r[0].style.visibility="visible")},n.prototype._InitBindingForListUI=function(){var n;if(this.OwnerControl!=null&&(this.viewModel=new kf,this.OwnerControl.Selection.ParagraphFormat.ListLevelNumber>0&&(this.viewModel.LevelNumber=this.OwnerControl.Selection.ParagraphFormat.ListLevelNumber),this.viewModel.List=this.OwnerControl.Selection.ParagraphFormat._GetList(),this.ListLevel!=null)){this.ListLevel.CharacterFormat==null&&(this.ListLevel.CharacterFormat=new o(this.viewModel.ListLevel));this.ListLevel.ParagraphFormat==null&&(this.ListLevel.ParagraphFormat=new a(this.viewModel.ListLevel));var t=this.InsertListDialog.find("#"+this.InsertListDialog[0].id+"_followCharacter").data("ejDropDownList"),h=this.InsertListDialog.find("#"+this.InsertListDialog[0].id+"_restartBy"),i=this.InsertListDialog.find("#"+this.InsertListDialog[0].id+"_listlevel"),r=this.InsertListDialog.find("#"+this.InsertListDialog[0].id+"_numberStyle").data("ejDropDownList"),u=this.InsertListDialog.find("#"+this.InsertListDialog[0].id+"_startAt").data("ejNumericTextbox"),f=this.InsertListDialog.find("#"+this.InsertListDialog[0].id+"_textIndent").data("ejNumericTextbox"),e=this.InsertListDialog.find("#"+this.InsertListDialog[0].id+"_alignedAt").data("ejNumericTextbox"),s=this.InsertListDialog.find("#"+this.InsertListDialog[0].id+"_numberFormat");u.setModel({value:this.viewModel.ListLevel.StartAt});f.setModel({value:this.viewModel.ListLevel.ParagraphFormat.LeftIndent});e.setModel({value:this.viewModel.ListLevel.ParagraphFormat.FirstLineIndent});t.setModel({selectedItemIndex:this.viewModel.ListLevel.FollowCharacter});s[0].value=this.viewModel.ListLevel.NumberFormat;n=this.viewModel.ListLevel.ListLevelPattern==23?7:this.viewModel.ListLevel.ListLevelPattern;r.selectItemByIndex(n);i.ejDropDownList({selectedItemIndex:this.viewModel.LevelNumber});this.viewModel.LevelNumber=this.viewModel.LevelNumber}},n.prototype._OnListLevelChanged=function(){this._UpdateRestartLevelBox()},n.prototype._UpdateRestartLevelBox=function(){var t=this.InsertListDialog.find("#"+this.InsertListDialog[0].id+"_restartBy").data("ejDropDownList"),e=this.InsertListDialog.find("#"+this.InsertListDialog[0].id+"_followCharacter"),n=this.InsertListDialog.find("#"+this.InsertListDialog[0].id+"_listlevel").data("ejDropDownList"),r=this.InsertListDialog.find("#"+this.InsertListDialog[0].id+"_numberStyle").data("ejDropDownList"),o=this.InsertListDialog.find("#"+this.InsertListDialog[0].id+"_startAt"),u=this.InsertListDialog.find("#"+this.InsertListDialog[0].id+"_textIndent").data("ejNumericTextbox"),s=this.InsertListDialog.find("#"+this.InsertListDialog[0].id+"_alignedAt"),f=this.InsertListDialog.find("#"+this.InsertListDialog[0].id+"_numberFormat"),i;f[0].value=this.viewModel.ListLevel.NumberFormat;u._textBox.value=this.viewModel.ListLevel.ParagraphFormat.LeftIndent;i=this.viewModel.ListLevel.ListLevelPattern==23?7:this.viewModel.ListLevel.ListLevelPattern;r.selectItemByIndex(i);this.ListLevel.RestartLevel=n.selectedIndexValue==0?0:n.selectedIndexValue+1;n.selectedIndexValue==0?t.setModel({dataSource:["No Restart"]}):n.selectedIndexValue==1?t.setModel({dataSource:["Level 1","No Restart"]}):n.selectedIndexValue==2?t.setModel({dataSource:["Level 2","Level 1","No Restart"]}):n.selectedIndexValue==3?t.setModel({dataSource:["Level 3","Level 2","Level 1","No Restart"]}):n.selectedIndexValue==4?t.setModel({dataSource:["Level 4","Level 3","Level 2","Level 1","No Restart"]}):n.selectedIndexValue==5?t.setModel({dataSource:["Level 5","Level 4","Level 3","Level 2","Level 1","No Restart"]}):n.selectedIndexValue==6?t.setModel({dataSource:["Level 6","Level 5","Level 4","Level 3","Level 2","Level 1","No Restart"]}):n.selectedIndexValue==7?t.setModel({dataSource:["Level 7","Level 6","Level 5","Level 4","Level 3","Level 2","Level 1","No Restart"]}):n.selectedIndexValue==8&&t.setModel({dataSource:["Level 8","Level 7","Level 6","Level 5","Level 4","Level 3","Level 2","Level 1","No Restart"]});t.selectItemByIndex(0)},n.prototype._DisposeBindingForListUI=function(){this.viewModel.List=this.OwnerControl.Selection.ParagraphFormat._GetList();var n=this.InsertListDialog.find("#"+this.InsertListDialog[0].id+"_followCharacter").data("ejDropDownList"),o=this.InsertListDialog.find("#"+this.InsertListDialog[0].id+"_restartBy"),t=this.InsertListDialog.find("#"+this.InsertListDialog[0].id+"_listlevel").data("ejDropDownList"),i=this.InsertListDialog.find("#"+this.InsertListDialog[0].id+"_numberStyle"),r=this.InsertListDialog.find("#"+this.InsertListDialog[0].id+"_startAt").data("ejNumericTextbox"),u=this.InsertListDialog.find("#"+this.InsertListDialog[0].id+"_textIndent").data("ejNumericTextbox"),f=this.InsertListDialog.find("#"+this.InsertListDialog[0].id+"_alignedAt").data("ejNumericTextbox"),e=this.InsertListDialog.find("#"+this.InsertListDialog[0].id+"_numberFormat"),s=this.viewModel.ListLevel;this._OnFollowCharacterValueChanged(n._selectedValue);this._OnLevelPatternValueChanged(i[0]);e[0].value=this.viewModel.ListLevel.NumberFormat;r.setModel({value:this.viewModel.ListLevel.StartAt});u.setModel({value:this.viewModel.ListLevel.ParagraphFormat.LeftIndent});f.setModel({value:this.viewModel.ListLevel.ParagraphFormat.FirstLineIndent});t.setModel({selectedItemIndex:this.viewModel.ListLevel.LevelNumber});n.setModel({selectedItemIndex:this.viewModel.ListLevel.FollowCharacter});this.viewModel!=null&&this.viewModel._Dispose()},n.prototype._OnApplyListButton=function(){this.OwnerControl&&this.OwnerControl.Selection.ParagraphFormat._SetList(this.List);this.InsertListDialog.ejDialog("close");this._DisposeBindingForListUI()},n.prototype._OnFollowCharacterValueChanged=function(n){this.viewModel.ListLevel.FollowCharacter=n=="Space"?yr.Space:n=="Tab"?yr.Tab:yr.None},n.prototype._OnLevelPatternValueChanged=function(n){this.viewModel.ListLevel.ListLevelPattern=n.value=="UpRoman"?c.UpRoman:n.value=="LowRoman"?c.LowRoman:n.value=="Arabic"?c.Arabic:n.value=="Up Letter"?c.UpLetter:n.value=="Low Letter"?c.LowLetter:n.value=="Bullet"?c.Bullet:n.value=="Number"?c.Number:n.value=="Leading Zero"?c.LeadingZero:n.value=="Ordinal"?c.Ordinal:n.value=="Ordinal Text"?c.OrdinalText:n.value=="Special"?c.Special:n.value=="Far East"?c.FarEast:c.None;var t="%"+(this.ListLevel.LevelNumber+1).toString(),i=this.InsertListDialog.find("#"+this.InsertListDialog[0].id+"_numberFormat");this.ListLevel.ListLevelPattern==c.Bullet?(this.ListLevel.NumberFormat="",i[0].value=this.ListLevel.NumberFormat,this.ListLevel.CharacterFormat.FontFamily="Wingdings"):(this.ListLevel.ListLevelPattern==c.None&&(this.ListLevel.NumberFormat=""),this.ListLevel.NumberFormat.match(t)||this.ListLevel.ListLevelPattern==c.None||(this.ListLevel.NumberFormat=t+"."),i[0].value=this.ListLevel.NumberFormat,this.ListLevel.CharacterFormat.FontFamily="Verdana")},n.prototype._loadFindAndReplaceDialog=function(){var t=this.InsertFindAndReplaceDialog.find("#"+this.InsertFindAndReplaceDialog[0].id+"_FindWhatText")[0],n,i;t.value!=null&&this.OwnerControl.Selection!=null&&(n=this.OwnerControl.Selection._GetText(!0),n=n.replace("\v"," "),i=n.indexOf("\r"),t.value=n!=null&&n!=undefined?i<0?n:n.substring(0,i):t.value)},n.prototype._LoadTableProperties=function(){this._SetTableProperties();this._SetTableRowProperties();this._SetTableCellProperties()},n.prototype._SetTableProperties=function(){var i="#"+this.TablePropertiesDialog[0].id+"_TableProperties",u=this.TablePropertiesDialog.find(i+"_Prefer_Width_CheckBox"),f=this.TablePropertiesDialog.find(i+"preferred_Width"),e=this.TablePropertiesDialog.find(i+"_width_dropdownList"),o=this.TablePropertiesDialog.find(i+"_left_alignment"),s=this.TablePropertiesDialog.find(i+"_center_alignment"),h=this.TablePropertiesDialog.find(i+"_right_alignment"),c=this.TablePropertiesDialog.find(i+"_left_indent"),t=this.OwnerControl.Selection.TableFormat.Table.TableFormat,l=u.data("ejCheckBox"),r,n;u.ejCheckBox({checked:!1});r=e.data("ejDropDownList");f.ejNumericTextbox({value:t.PreferredWidth});t.PreferredWidthType==ht.Auto||t.PreferredWidthType==ht.Pixel?r.selectItemByIndex(0):t.PreferredWidthType==ht.Percent&&r.selectItemByIndex(1);c.ejNumericTextbox({value:t.LeftIndent});t.TableAlignment==rr.Left?(n=o[0].className,n=n.replace("e-de-table-properties-alignment","e-de-table-alignment-active"),o[0].className=n):t.TableAlignment==rr.Center?(n=s[0].className,n=n.replace("e-de-table-properties-alignment","e-de-table-alignment-active"),s[0].className=n):t.TableAlignment==rr.Right&&(n=h[0].className,n=n.replace("e-de-table-properties-alignment","e-de-table-alignment-active"),h[0].className=n);f.ejNumericTextbox("disable");e.ejDropDownList("disable")},n.prototype._SetTableRowProperties=function(){var e=this._GetCell(),n=e.OwnerRow.RowFormat,t="#"+this.TablePropertiesDialog[0].id+"_TableRowProperties",r=this.TablePropertiesDialog.find(t+"_height_CheckBox"),i=this.TablePropertiesDialog.find(t+"_table_row_height"),u=this.TablePropertiesDialog.find(t+"_height_type_dropdownlist"),o=this.TablePropertiesDialog.find(t+"_allow_row_break"),s=this.TablePropertiesDialog.find(t+"_repeat_header"),h=r.data("ejCheckBox"),c=i.data("ejNumericTextbox"),f=u.data("ejDropDownList");r.ejCheckBox({checked:!1});i.ejNumericTextbox({value:n.Height});s.ejCheckBox({checked:n.IsHeader});o.ejCheckBox({checked:n.AllowBreakAcrossPages});n.HeightType==et.Auto||n.HeightType==et.Atleast?f.selectItemByIndex(0):n.HeightType==et.Exactly&&f.selectItemByIndex(1);i.ejNumericTextbox("disable");u.ejDropDownList("disable")},n.prototype._GetCell=function(){var t=this.OwnerControl.Selection.Start,n;for(this.OwnerControl.Selection.IsForward||(t=this.OwnerControl.Selection.End),n=t.Paragraph.AssociatedCell;n.OwnerTable!=this.OwnerControl.Selection.TableFormat.Table;)n=n.OwnerTable.AssociatedCell;return n},n.prototype._SetTableCellProperties=function(){var s=this._GetCell(),t=s.CellFormat,i="#"+this.TablePropertiesDialog[0].id+"_TableCellProperties",h=this.TablePropertiesDialog.find(i+"_Prefer_Width_CheckBox_cell"),r=this.TablePropertiesDialog.find(i+"tablecell_Width_textBox"),c=this.TablePropertiesDialog.find(i+"_measure_type_cell_dropdownlist"),u=this.TablePropertiesDialog.find(i+"_cell_top-alignment"),f=this.TablePropertiesDialog.find(i+"_cell_center-alignment"),e=this.TablePropertiesDialog.find(i+"_cell_bottom-alignment"),l=r.data("ejNumericTextbox"),o=c.data("ejDropDownList"),n;r.ejNumericTextbox({value:t.PrefferedWidth});h.ejCheckBox({checked:!0});t.PrefferedWidthType==ht.Auto||t.PrefferedWidthType==ht.Pixel?o.selectItemByIndex(0):t.PrefferedWidthType==ht.Percent&&o.selectItemByIndex(1);t.VerticalAlignment==or.Top?(n=u[0].className,n=n.replace("e-de-tablecell-alignment","e-de-table-alignment-active"),u[0].className=n):t.VerticalAlignment==or.Center?(n=f[0].className,n=n.replace("e-de-tablecell-alignment","e-de-table-alignment-active"),f[0].className=n):t.VerticalAlignment==or.Bottom&&(n=e[0].className,n=n.replace("e-de-tablecell-alignment","e-de-table-alignment-active"),e[0].className=n)},n.prototype._onFindNext=function(){if(this.OwnerControl!=null){var n=this.InsertFindAndReplaceDialog.find("#"+this.InsertFindAndReplaceDialog[0].id+"_FindWhatText")[0];n!=null&&n!=undefined&&n!=""&&(this.OwnerControl._Find(n.value,0),this.OwnerControl.textSearchResults.Count==0&&this._ShowAlertDialog("We couldn't find what you were looking for"))}},n.prototype._UpdateViewerSizeOnWindowResize=function(){var n=this,t=this.OwnerControl.DocumentEditorElement;n._UpdateViewerSize();n._UpdateScrollBars()},n.prototype._UpdateViewerSize=function(){var u=this.OwnerControl.DocumentEditorElement,n=u.getBoundingClientRect(),t=0,i=0,r;this.isOptionsPaneShow?(r=this.OptionsPane.getBoundingClientRect(),t=n.width-r.width>0?n.width-r.width:200):t=n.width>0?n.width:200;i=n.height>0?n.height:200;this.ViewerContatiner.style.height=i.toString()+"px";this.ViewerContatiner.style.width=t.toString()+"px";this.Container.style.height=i.toString()+"px";this.Container.style.width=t.toString()+"px";this.visibleBounds=new nt(0,0,t,i)},n.prototype._ValidateFocus=function(){var n=window.pageXOffset,t=window.pageYOffset;this.ViewerContatiner.focus();window.scrollTo(n,t)},n.prototype._UpdatePageLeft=function(){var l=this,n,v,o,i,s,t;if(l instanceof w&&l.IsFitMultiplePages){var r=0,a=0,c=20,f=0,u=0,h=!1,e=0;for(n=0;n<=this.Pages.Count;n++)if(u=n,n!=this.Pages.Count&&(e=e+this.Pages[n].BoundingRectangle.Width*this.ZoomFactor),this.Pages.Count!=1&&n!=0&&(e+=20),v=this.Pages.Count==1?!0:this.Pages.Count==n?!0:!1,h=(this.VisibleBounds.Width-e)/2<=30?!0:v,this.Pages.Count!=1&&(u=n-1),this.Pages.Count==1&&u==this.Pages.Count&&(h=!1),h){for(o=0,i=0,s=f;s<=u;s++)o=Math.max(this.Pages[s].BoundingRectangle.Height*this.ZoomFactor,o),i=i+this.Pages[s].BoundingRectangle.Width*this.ZoomFactor;for(f<u&&(i=i+(u-f)*20),r=(this.VisibleBounds.Width-i)/2,r<30&&(r=30),a=0,i=i+r*2,t=f;t<=u;t++)a=c+(o-this.Pages[t].BoundingRectangle.Height*this.ZoomFactor)/2,t!=f&&(r=r+this.Pages[t-1].BoundingRectangle.Width*this.ZoomFactor+20),this.Pages[t].BoundingRectangle=new nt(r,this.Pages[t].BoundingRectangle.Y,this.Pages[t].BoundingRectangle.Width,this.Pages[t].BoundingRectangle.Height);c=c+o+20;f=n;h=!1;n!=this.Pages.Count&&(e=this.Pages[n].BoundingRectangle.Width*this.ZoomFactor)}}},n.prototype._PositionImageResizer=function(n){var d,g,tt,ot,t,ct,c,r,l,u,k,vt;this.ImageResizer.SelectedImageWidget._Clear();this.CurrentPage!=null&&(d=document.getElementById(this.CurrentPage.Id+"_resize"));d!=null&&this.ImageResizerDiv==null&&(this.ImageResizerDiv=this.ImageResizer._InitResizeMarks(d));this.ImageResizerDiv.style.width=n.Width+"px";this.ImageResizerDiv.style.height=n.Height+"px";this.ImageResizer.CurrentImageElementBox=n;var s=n.CurrentLineWidget,a=s._GetTop()+n.Margin.Top,v=s._GetLeftInternal(n,0);this.OwnerControl.Selection._IsInComment()&&(g=this.OwnerControl.Selection.Start.Paragraph._GetOwnerComment(),v+=g.LayoutedWidget.X,a+=g.LayoutedWidget.Y);var y=this instanceof st?this.CurrentPage:s.CurrentParagraphWidget._GetPage(),i=0,nt=0,et=this,p=0;if(et instanceof w)if(tt=y._GetPageWidth(),ot=et,p=parseFloat(document.getElementById(this.CurrentPage.Id+"_resize").style.width),ot.IsFitMultiplePages){var ht=null,it=20,e=0,f=0,b=!1,h=0;for(t=0;t<=this.Pages.Count;t++){if(f=t,t!=this.Pages.Count&&(h=h+this.Pages[t]._GetPageWidth()*this.ZoomFactor),this.Pages.Count!=1&&t!=0&&(h+=20),ct=this.Pages.Count==1?!0:this.Pages.Count==t?!0:!1,b=(this.VisibleBounds.Width-h)/2<=30?!0:ct,this.Pages.Count!=1&&(f=t-1),this.Pages.Count==1&&f==this.Pages.Count&&(b=!1),b){for(c=0,r=0,l=e;l<=f;l++)c=Math.max(this.Pages[l].BoundingRectangle.Height*this.ZoomFactor,c),r=r+this.Pages[l]._GetPageWidth()*this.ZoomFactor;for(e<f&&(r=r+(f-e)*20),i=(this.VisibleBounds.Width-r)/2,i<30&&(i=30),nt=0,r=r+i*2,u=e;u<=f;u++)if(nt=it+(c-this.Pages[u].BoundingRectangle.Height*this.ZoomFactor)/2,u!=e&&(i=i+this.Pages[u-1]._GetPageWidth()*this.ZoomFactor+20),this.Pages._IndexOf(this.Pages[u])==this.Pages._IndexOf(y)){ht=this.Pages[u];break}it=it+c+20;e=t;b=!1;t!=this.Pages.Count&&(h=this.Pages[t]._GetPageWidth()*this.ZoomFactor)}if(ht!=null)break}}else i=(this.VisibleBounds.Width-p*this.ZoomFactor)/2,i<30&&(i=30),tt<p&&(i+=(p-tt)*this.ZoomFactor/2),nt=y.BoundingRectangle.Top*this.ZoomFactor+(this.Pages._IndexOf(y)+1)*20*(1-this.ZoomFactor);if(k=document.getElementById(this.CurrentPage.Id+"_resize"),k!=null){var lt=parseFloat(k.style.width),at=parseFloat(k.style.height),yt=parseFloat(this.ImageResizerDiv.style.width),rt=parseFloat(this.ImageResizerDiv.style.height),o=(this.ImageResizer.ResizeMarkSize-1)/2,ut=yt+2*o,ft=rt+2*o;ut>(lt-v)*this.ZoomFactor+o&&(ut=(lt-v)*this.ZoomFactor);ft>(at-a)*this.ZoomFactor+o&&(ft=(at-a)*this.ZoomFactor);ut<rt+o||ft<rt+o}this.ImageResizer._SetImageResizerPosition(v,a,n.Width,n.Height);this.ImageResizer.SelectedImageWidget._ContainsKey(s)||(vt=new de(n.Height,n.Width),this.ImageResizer.SelectedImageWidget._Add(s,vt))},n.prototype._ShowImageResizer=function(){var n=this.ImageResizer;n!=null&&(n.resizeContainerDiv!=null&&(n.resizeContainerDiv.style.display=""),n.bottomLeftRect!=null&&(n.bottomLeftRect.style.display=""),n.bottomRightRect!=null&&(n.bottomRightRect.style.display=""),n.bottomMiddleRect!=null&&(n.bottomMiddleRect.style.display=""),n.rightMiddleRect!=null&&(n.rightMiddleRect.style.display=""),n.topRightRect!=null&&(n.topRightRect.style.display=""),n.topLeftRect!=null&&(n.topLeftRect.style.display=""),n.leftMiddleRect!=null&&(n.leftMiddleRect.style.display=""),n.topMiddleRect!=null&&(n.topMiddleRect.style.display=""),this.isImageResizerVisible=!0)},n.prototype._HideImageResizer=function(){var n=this.ImageResizer;n!=null&&(n.resizeContainerDiv!=null&&(n.resizeContainerDiv.style.display="none"),n.bottomLeftRect!=null&&(n.bottomLeftRect.style.display="none"),n.bottomRightRect!=null&&(n.bottomRightRect.style.display="none"),n.bottomMiddleRect!=null&&(n.bottomMiddleRect.style.display="none"),n.rightMiddleRect!=null&&(n.rightMiddleRect.style.display="none"),n.topRightRect!=null&&(n.topRightRect.style.display="none"),n.topLeftRect!=null&&(n.topLeftRect.style.display="none"),n.leftMiddleRect!=null&&(n.leftMiddleRect.style.display="none"),n.topMiddleRect!=null&&(n.topMiddleRect.style.display="none"),this.isImageResizerVisible=!1)},n.prototype._IsInRowResizerArea=function(n){var t=this._GetRowReSizerPosition(null,n);return t==-1?!1:(this.OwnerControl.ResizeNode=1,this.OwnerControl.ResizerPosition=t,!0)},n.prototype._GetRowReSizerPosition=function(n,t){var i=null,u=null,f,h,o,e,r,s;if(n==null?(i=this.OwnerControl.Viewer._GetTableWidget(t),u=this.OwnerControl.Viewer._GetTableCellWidget(t)):i=n._GetTableWidget(t),f=i==null?0:i.Table.TableFormat.CellSpacing,i!=null&&f>0){if(this.OwnerControl.CurrentResizingTable=i.Table,this._IsInsideRect(i.X,i.Y+i.Height-f,i.ChildWidgets[i.ChildWidgets.Count-1]._GetActualWidth(),i.Table.TableWidgets[i.Table.TableWidgets.Count-1]==i?i.BottomBorderWidth+f:0,t))return i.ChildWidgets[i.ChildWidgets.Count-1].TableRow.RowIndex;for(h=0;h<i.Table.Rows.Count;h++)for(o=0;o<i.Table.Rows.Count;o++)if(e=i.Table.Rows[o],e.TableRowWidgets.Count>0&&(r=e.TableRowWidgets[e.TableRowWidgets.Count-1],i.ChildWidgets._Contains(r)&&this._IsInsideRect(r.X,r.Y+r.Height+f/2,r._GetActualWidth(),f/2,t)))return e.RowIndex}else if(i!=null&&u==null&&(u=i._GetTableCellWidget(t,this instanceof w)),u!=null){if(r=u.ContainerWidget,s=0,s=r.TableRow.RowIndex==r.TableRow.OwnerTable.Rows.Count-1?r.BottomBorderWidth:r.TableRow.NextNode.TableRowWidgets[r.TableRow.NextNode.TableRowWidgets.Count-1].TopBorderWidth,this._IsInsideRect(r.X,r.Y+r.Height-s,r.Width,s*2,t))return this.OwnerControl.CurrentResizingTable=r.TableRow.OwnerTable,r.TableRow.RowIndex;if(u.ChildWidgets.Count>0)return this._GetRowReSizerPosition(u,t)}return-1},n.prototype._IsInsideRect=function(n,t,i,r,u){return u.X>n&&u.X<=n+i&&u.Y>t&&u.Y<=t+r?!0:!1},n.prototype._GetTableWidget=function(n){return this._GetTableWidgetInternal(n,!1)},n.prototype._GetTableWidgetInternal=function(n,t){var r=null,f,i,u,e;if(this.CurrentPage!=null){if(f=t&&this.OwnerControl.Selection._IsInComment(),(n.X>this.CurrentPage.BoundingRectangle.Width&&n.X<this.CurrentPage._GetPageWidth()||f)&&(i=this.CurrentPage._GetCommentWidget(n),f&&(i=this.OwnerControl.Selection.Start.Paragraph._GetOwnerComment().LayoutedWidget),i!=null&&i.RenderedElement!=null&&(n.X=n.X-this.CurrentPage.BoundingRectangle.Width,n.Y=n.Y-i.TopPosition,n.X>i.Width&&(n.X=i.Width),n.Y>i.Height&&(n.Y=i.Height),r=i.Comment.LayoutedWidget._GetTableWidget(n,this instanceof w),r!=null)))return r;for(u=0;u<this.CurrentPage.BodyWidgets.Count;u++)if(e=this.CurrentPage.BodyWidgets[u],r=e._GetTableWidget(n,this instanceof w),r!=null)break}return r},n.prototype._GetTableCellWidget=function(n){return this._GetTableCellWidgetInternal(n,!1)},n.prototype._GetTableCellWidgetInternal=function(n,t){var r=null,f,i,u,e;if(this.CurrentPage!=null){if(f=t&&this.OwnerControl.Selection._IsInComment(),(n.X>this.CurrentPage.BoundingRectangle.Width&&n.X<this.CurrentPage._GetPageWidth()||f)&&(i=this.CurrentPage._GetCommentWidget(n),f&&(i=this.OwnerControl.Selection.Start.Paragraph._GetOwnerComment().LayoutedWidget),i!=null&&i.RenderedElement!=null&&(n.X=n.X-this.CurrentPage.BoundingRectangle.Width,n.Y=n.Y-i.TopPosition,n.X>i.Width&&(n.X=i.Width),n.Y>i.Height&&(n.Y=i.Height),r=i.Comment.LayoutedWidget._GetTableCellWidget(n,this instanceof w),r!=null)))return r;for(u=0;u<this.CurrentPage.BodyWidgets.Count;u++)if(e=this.CurrentPage.BodyWidgets[u],r=e._GetTableCellWidget(n,this instanceof w),r!=null)break}return r},n.prototype._HandleResizing=function(n){var t=0;this.OwnerControl.ResizeNode==0?(t=n.X-this.OwnerControl.StartingPoint.X,this._ResizeTableCell(t)):(t=n.Y-this.OwnerControl.StartingPoint.Y,this._ResizeTableRow(t))},n.prototype._ResizeTableRow=function(n){var t=this.OwnerControl.CurrentResizingTable,i,r,u;t!=null&&(i=this.OwnerControl.Selection.CurrentSelectionRange,t.IsInsideTable&&(this.OwnerControl.IsLayoutEnabled=!1),this.OwnerControl.ResizerPosition>-1&&(r=t.Rows[this.OwnerControl.ResizerPosition],r._UpdateHeight(n),this.OwnerControl.Selection._SelectPosition(i.Start,i.End)),t.IsInsideTable&&(u=t._GetParentTable(),this.OwnerControl.IsLayoutEnabled=!0,u._LayoutItem(!0)),this.OwnerControl.StartingPoint.Y=this.OwnerControl.StartingPoint.Y+n)},n.prototype._GetCellReSizerPosition=function(n){var u=2,i=this.OwnerControl.Viewer._GetTableWidget(n),t=this.OwnerControl.Viewer._GetTableCellWidget(n),f,r;if(i!=null&&i.Table.TableFormat.CellSpacing>0){if(this.OwnerControl.CurrentResizingTable=i.Table,this._IsInsideRect(i.X-i.LeftBorderWidth-.25,i.Y,i.LeftBorderWidth+.5,i.Height,n))return 0;for(f=i.X,r=0;r<i.Table.TableHolder.Columns.Count;r++){if(this._IsInsideRect(f-1,i.Y,i.LeftBorderWidth,i.Height,n))return r>0?r:0;if(r>1&&this._IsInsideRect(f+i.Table.TableHolder.Columns[r].PreferredWidth-u/2,i.Y,u,i.Height,n))return r+1;f=f+i.Table.TableHolder.Columns[r].PreferredWidth}}else if(t!=null){if(this.OwnerControl.CurrentResizingTable=t.TableCell.OwnerTable,this._IsInsideRect(t.X-t.Margin.Left-u/2,t.Y-t.Margin.Top,u,t.Height,n))return t.TableCell.ColumnIndex;if(t.TableCell.NextNode==null&&this._IsInsideRect(t.X+t.Margin.Right+t.Width-u/2,t.Y-t.Margin.Top,u,t.Height,n))return t.TableCell.ColumnIndex+t.TableCell.CellFormat.ColumnSpan;if(t.ChildWidgets.Count>0)return this._GetCellReSizerPositionInternal(t,n)}return-1},n.prototype._GetCellReSizerPositionInternal=function(n,t){var r=n._GetTableWidget(t),i=null,f,u;if(r!=null&&r.Table.TableFormat.CellSpacing>0){if(this.OwnerControl.CurrentResizingTable=r.Table,this._IsInsideRect(r.X-r.LeftBorderWidth-.25,r.Y,r.LeftBorderWidth+.5,r.Height,t))return 0;for(f=r.X,u=0;u<r.Table.TableHolder.Columns.Count;u++){if(this._IsInsideRect(f-1,r.Y,r.LeftBorderWidth,r.Height,t))return u>0?u:0;if(u>1&&this._IsInsideRect(f+r.Table.TableHolder.Columns[u].PreferredWidth-1,r.Y,2,r.Height,t))return u+1;f=f+r.Table.TableHolder.Columns[u].PreferredWidth}}else if(r!=null&&(i=r._GetTableCellWidget(t,this instanceof w)),i!=null){if(this.OwnerControl.CurrentResizingTable=i.TableCell.OwnerTable,this._IsInsideRect(i.X-i.Margin.Left-1,i.Y-i.Margin.Top,2,i.Height,t))return i.TableCell.ColumnIndex;if(i.TableCell.NextNode==null&&this._IsInsideRect(i.X+i.Margin.Right+i.Width-1,i.Y-i.Margin.Top,2,i.Height,t))return i.TableCell.ColumnIndex+i.TableCell.CellFormat.ColumnSpan;if(i.ChildWidgets.Count>0)return this._GetCellReSizerPositionInternal(i,t)}return-1},n.prototype._IsInCellResizerArea=function(n){var t=this._GetCellReSizerPosition(n);return t==-1?!1:(this.OwnerControl.ResizeNode=0,this.OwnerControl.ResizerPosition=t,!0)},n.prototype._ResizeTableCell=function(n){var t=this.OwnerControl.CurrentResizingTable,b,y,p,h,a,c,k,r,e,v,o,l,u,i,f,s;if(t!=null&&n!=0){if(b=!0,this.OwnerControl.IsLayoutEnabled=!1,y=this.OwnerControl.Selection.CurrentSelectionRange,!this.OwnerControl.Selection.IsEmpty&&this.OwnerControl.Selection.SelectionRanges.Count>=1&&(p=this._GetTableCellWidget(this.OwnerControl.StartingPoint),p!=null&&(this.OwnerControl.Selection.SelectionRanges.Last.SelectedWidgets._ContainsKey(p)||p.TableCell.PreviousNode!=null&&this.OwnerControl.Selection.SelectionRanges[0].SelectedWidgets.ContainsKey(p.TableCell.PreviousNode.TableCellWidgets[0])))){if(h=this.OwnerControl.Selection._GetSelectedCells(),this.OwnerControl.ResizerPosition==0){if(e=t._GetColumnCells(this.OwnerControl.ResizerPosition,!1),v=0,t.IsTableGridUpdated=!1,o=h[0].OwnerRow,o.GridBeforeWidth>0){if(a=o.GridBeforeWidth+n,a>0)o._UpdateGridBefore(n);else if(c=t._GetLeastGridBefore(o),a<c&&v!=a)for(t.TableFormat.LeftIndent=t.LeftIndent+a>-344.333333?t.LeftIndent+a:-344.333333,i=0;i<t.Rows.length;i++)r=t.Rows[i],o!=r&&r._UpdateGridBefore(-a)}else if(n<0)for(t.TableFormat.LeftIndent=t.LeftIndent+n>-344.333333?t.LeftIndent+n:-344.333333,i=0;i<t.Rows.length;i++)r=t.Rows[i],h._Contains(r.Cells[0])?(t.IsTableGridUpdated=!1,r.Cells[0]._DecreaseWidth(n)):r._UpdateGridBefore(-n);else if(c=t._GetLeastGridBefore(o),k=t.TableFormat.LeftIndent,k==0)for(i=0;i<t.Rows.length;i++)r=t.Rows[i],h._Contains(r.Cells[0])&&(r._UpdateGridBefore(n),t.IsTableGridUpdated=!1,r.Cells[0]._DecreaseWidth(n));else if(l=c-n,l>0)for(t.IsTableGridUpdated=!1,t.TableFormat.LeftIndent=t.LeftIndent+n>-344.333333?t.LeftIndent+n:-344.333333,i=0;i<t.Rows.length;i++)r=t.Rows[i],h._Contains(r.Cells[0])?(t.IsTableGridUpdated=!1,r.Cells[0]._DecreaseWidth(n)):r._UpdateGridBefore(-n);else for(t.IsTableGridUpdated=!1,t.TableFormat.LeftIndent=t.LeftIndent+c>-344.333333?t.LeftIndent+c:-344.333333,i=0;i<t.Rows.length;i++)r=t.Rows[i],h._Contains(r.Cells[0])?(t.IsTableGridUpdated=!1,r.Cells[0]._DecreaseWidth(n),r._UpdateGridBefore(n-c)):r._UpdateGridBefore(-c);t._CalculateGridOnly();t.IsTableGridUpdated=!1;t._CheckTableGrid();this.OwnerControl.IsLayoutEnabled=!0;t.IsInsideTable?(s=t._GetParentTable(),s._LayoutItem(!0)):t._LayoutItem(!0);this.OwnerControl.StartingPoint.X=this.OwnerControl.StartingPoint.X+n;this.OwnerControl.ResizerPosition=this._GetCellReSizerPosition(this.OwnerControl.StartingPoint)}else if(t!=null&&this.OwnerControl.ResizerPosition==t.TableHolder.Columns.Count){for(u=t._GetColumnCells(this.OwnerControl.ResizerPosition,!0),i=0;i<u.length;i++)f=u[i],h._Contains(f)&&(f.OwnerTable.IsTableGridUpdated=!1,f._IncreaseWidth(n));t._UpdateRowsGridAfterWidth();t.IsTableGridUpdated=!1;t._UpdateWidth(n);t._CalculateGridOnly();t.IsTableGridUpdated=!1;t._CheckTableGrid();this.OwnerControl.IsLayoutEnabled=!0;t.IsInsideTable?t.AssociatedCell.OwnerTable._LayoutItem(!0):t._LayoutItem(!0);this.OwnerControl.StartingPoint.X=this.OwnerControl.StartingPoint.X+n;this.OwnerControl.ResizerPosition=this._GetCellReSizerPosition(this.OwnerControl.StartingPoint)}else{if(this.OwnerControl.ResizerPosition==-1)return;var w=this.OwnerControl.ResizerPosition,u=t._GetColumnCells(w,!0),e=t._GetColumnCells(w,!1),d=t._IsColumnSelected(w,this.OwnerControl.Selection);if(u.Count>0&&!d)for(i=0;i<u.Count;i++)h._Contains(u[i])||(u._RemoveAt(i),i--);if(e.Count>0&&!d)for(i=0;i<e.Count;i++)h._Contains(e[i])||(e._RemoveAt(i),i--);if(u.Count==0&&e.Count>0)for(i=0;i<e.length;i++)f=e[i],f.PreviousNode!=null&&u._Add(f.PreviousNode);else if(e.Count==0&&u.Count>0)for(i=0;i<u.length;i++)f=u[i],f.NextNode!=null&&e._Add(f.NextNode);this._ChangeWidthOfCells(t,u,e,n,!0);t._CalculateGridOnly();t.IsTableGridUpdated=!1;t._CheckTableGrid();this.OwnerControl.IsLayoutEnabled=!0;t.IsInsideTable?(s=t._GetParentTable(),s._LayoutItem(!0)):t._LayoutItem(!0);this.OwnerControl.StartingPoint.X=this.OwnerControl.StartingPoint.X+n;this.OwnerControl.ResizerPosition=this._GetCellReSizerPosition(this.OwnerControl.StartingPoint)}b=!1;this.OwnerControl.Selection._SelectPosition(y.Start,y.End)}if(b){if(this.OwnerControl.ResizerPosition==0){for(e=t._GetColumnCells(this.OwnerControl.ResizerPosition,!1),v=0,t.IsTableGridUpdated=!1,t.TableFormat.LeftIndent=t.LeftIndent+n>-344.333333?t.LeftIndent+n:-344.333333,i=0;i<t.Rows.length;i++)o=t.Rows[i],l=o.GridBeforeWidth-n,e._Contains(o.Cells[0])||(l>=0?o._UpdateGridBefore(-n):(t.IsTableGridUpdated=!1,l!=v&&(t.TableFormat.LeftIndent=t.LeftIndent+l>-344.333333?t.LeftIndent+l:-344.333333,v=l),o.GridBeforeWidth=0));for(i=0;i<e.length;i++)f=e[i],f.OwnerTable.IsTableGridUpdated=!1,f._DecreaseWidth(n),f.OwnerRow._UpdateGridBefore(v);t._CalculateGridOnly();t.IsTableGridUpdated=!1;t._CheckTableGrid();this.OwnerControl.IsLayoutEnabled=!0;t.IsInsideTable?(s=t._GetParentTable(),s._LayoutItem(!0)):t._LayoutItem(!0);this.OwnerControl.StartingPoint.X=this.OwnerControl.StartingPoint.X+n;this.OwnerControl.ResizerPosition=this._GetCellReSizerPosition(this.OwnerControl.StartingPoint)}else if(t!=null&&this.OwnerControl.ResizerPosition==t.TableHolder.Columns.Count){for(u=t._GetColumnCells(this.OwnerControl.ResizerPosition,!0),i=0;i<u.length;i++)f=u[i],f.OwnerTable.IsTableGridUpdated=!1,f._IncreaseWidth(n);t._UpdateRowsGridAfterWidth();t._UpdateWidth(n);t._CalculateGridOnly();t.IsTableGridUpdated=!1;t._CheckTableGrid();this.OwnerControl.IsLayoutEnabled=!0;t.IsInsideTable?(s=t._GetParentTable(),s._LayoutItem(!0)):t._LayoutItem(!0);this.OwnerControl.StartingPoint.X=this.OwnerControl.StartingPoint.X+n;this.OwnerControl.ResizerPosition=this._GetCellReSizerPosition(this.OwnerControl.StartingPoint)}else{if(this.OwnerControl.ResizerPosition==-1)return;var w=this.OwnerControl.ResizerPosition,u=t._GetColumnCells(w,!0),e=t._GetColumnCells(w,!1);this._ChangeWidthOfCells(t,u,e,n,!1);t._CalculateGridOnly();t.IsTableGridUpdated=!1;t._CheckTableGrid();this.OwnerControl.IsLayoutEnabled=!0;t.IsInsideTable?(s=t._GetParentTable(),s._LayoutItem(!0)):t._LayoutItem(!0);this.OwnerControl.StartingPoint.X=this.OwnerControl.StartingPoint.X+n;this.OwnerControl.ResizerPosition=this._GetCellReSizerPosition(this.OwnerControl.StartingPoint)}this.OwnerControl.IsLayoutEnabled=!0;this.OwnerControl.Selection._SelectPosition(y.Start,y.End)}}},n.prototype._ChangeWidthOfCells=function(n,t,i,r){var s,e,f,o,u,h;if(t.Count>0){for(s=!1,u=0;u<t.length;u++)f=t[u],f.OwnerTable.IsTableGridUpdated=!1,f._IncreaseWidth(r),f.CellIndex==f.OwnerRow.Cells.Count-1&&(s=!0);s&&n._UpdateRowsGridAfterWidth()}if(i.Count>0){for(e=0,u=0;u<i.length;u++)f=i[u],f.CellIndex==0&&(o=f.OwnerRow.GridBeforeWidth+r,o>=0?f.OwnerRow._UpdateGridBefore(r):(e!=o&&(e=o),f.OwnerRow.GridBeforeWidth=0)),f.OwnerTable.IsTableGridUpdated=!1,f._DecreaseWidth(r);if(e!=0)for(n.IsTableGridUpdated=!1,n.TableFormat.LeftIndent=n.LeftIndent+e>-344.333333?n.LeftIndent+e:-344.333333,u=0;u<n.Rows.length;u++)h=n.Rows[u],i._Contains(h.Cells[0])||h._UpdateGridBefore(e>0?e:-e)}},n.prototype._InitTouchEvents=function(){this._InitTouchEllipse();this._InitCaret();var n=this;navigator.userAgent.match("MSIE")||navigator.userAgent.match(".NET")?(this.ViewerContatiner.addEventListener("pointerdown",function(t){n._OnPointerDownInternal(t)}),this.ViewerContatiner.addEventListener("pointermove",function(t){n._OnPointerMoveInternal(t)}),this.ViewerContatiner.addEventListener("pointerup",function(t){n._OnPointerUpInternal(t)}),this.ViewerContatiner.addEventListener("pointerleave",function(t){n._OnPointerUpInternal(t)})):(navigator.userAgent.match("Edge")||navigator.userAgent.match("Chrome")||navigator.userAgent.match("FireFox")||navigator.userAgent.match("Safari"))&&(this.ViewerContatiner.addEventListener("touchstart",function(t){n._OnTouchStartInternal(t)}),this.ViewerContatiner.addEventListener("touchmove",function(t){n._OnTouchMoveInternal(t)}),this.ViewerContatiner.addEventListener("touchend",function(t){n._OnTouchEndInternal(t)}),this.ViewerContatiner.addEventListener("touchcancel",function(t){n._OnTouchEndInternal(t)}))},n.prototype._InitTouchEllipse=function(){this.touchStart=document.createElement("div");this.touchStart.style.backgroundColor="white";this.touchStart.style.borderStyle="solid";this.touchStart.style.borderColor="black";this.touchStart.style.borderWidth="2px";this.touchStart.style.borderRadius="50%";this.touchStart.style.width="14px";this.touchStart.style.height="13px";this.touchStart.style.position="absolute";this.touchStart.style.display="none";this.Container.appendChild(this.touchStart);this.touchEnd=document.createElement("div");this.touchEnd.style.backgroundColor="white";this.touchEnd.style.borderStyle="solid";this.touchEnd.style.borderColor="black";this.touchEnd.style.borderWidth="2px";this.touchEnd.style.borderRadius="50%";this.touchEnd.style.width="14px";this.touchEnd.style.height="13px";this.touchEnd.style.position="absolute";this.touchEnd.style.display="none";this.Container.appendChild(this.touchEnd)},n.prototype._InitCaret=function(){this.Caret=document.createElement("div");this.Caret.className="e-de-blinkcursor";this.Caret.style.height="12px";this.Caret.style.width="1px";this.Caret.style.backgroundColor="black";this.Caret.style.position="absolute";this.Caret.style.display="none";this.Caret.style.animation="deblinkcursor 1s infinite";this.Caret.style.webkitAnimation="deblinkcursor 1s infinite";this.Container.appendChild(this.Caret);var n=document.createElement("style");n.textContent="@keyframes deblinkcursor {0% { opacity: 0; }50%{ opacity: 1; }100%{ opacity: 0; }}@-webkit-keyframes deblinkcursor {0% { opacity: 0; }50%{ opacity: 1; }100%{ opacity: 0; }}@-moz-keyframes deblinkcursor{0% { opacity: 0; }50%{ opacity: 1; }100%{ opacity: 0; }}@-ms-keyframes deblinkcursor{0% { opacity: 0; }50%{ opacity: 1; }100%{ opacity: 0; }}";document.body.appendChild(n)},n.prototype._OnPointerDownInternal=function(n){n.pointerType=="touch"&&this._TouchDownInternal(n,!0);n.pointerType=="touch"&&(this.PointerCount=this.PointerCount+1,this.PointerCount<=2&&(n.preventDefault(),this.Pointers.push(n),this.PointerCount==2&&(this.PointerCount=0),this.ScrollStartX==-1&&this.ScrollStartY==-1&&(navigator.userAgent.match("MSIE")||navigator.userAgent.match(".NET"))&&(this.ScrollStartY=n.pageY,this.ScrollStartX=n.pageX)),this.IsTouchInput=!1)},n.prototype._OnPointerMoveInternal=function(n){var r,u,f,i,t,e;if(n.pointerType=="touch"&&this._TouchMoveInternal(n,!0),n.pointerType=="touch"&&(this.PointerCount==1&&(r=n.pageX-this.ViewerContatiner.offsetLeft,f=n.pageY-this.ViewerContatiner.offsetTop,r<this.Container.clientWidth&&f<this.Container.clientHeight&&(this._ScrollContainer(n),this.isTouchScroll=!0)),this.Pointers.length==2&&(this.isMousedown=!1,r=this.Pointers[0].pageX-this.ViewerContatiner.offsetLeft,u=this.Pointers[1].pageX-this.ViewerContatiner.offsetLeft,r<this.Container.offsetWidth&&u<this.Container.offsetWidth))){for(i=0;i<this.Pointers.length;i++)if(n.pointerId==this.Pointers[i].pointerId){this.Pointers[i]=n;break}t=Math.sqrt(Math.pow(this.Pointers[0].clientX-this.Pointers[1].clientX,2)+Math.pow(this.Pointers[0].clientY-this.Pointers[1].clientY,2));this.preDifference>-1&&(t>this.preDifference?this._OnPinchOutInternal(n):t<this.preDifference&&this._OnPinchInInternal(n));e=this.VerticalScrollBar.value;e==0||(t>this.preDifference?this._OnPinchOutInternal(n):t<this.preDifference&&this._OnPinchInInternal(n));this.preDifference=t}},n.prototype._OnPointerUpInternal=function(n){this.EditableDiv.focus();n.pointerType=="touch"&&this._TouchUpInternal(n,!0);n.pointerType=="touch"&&(this.Pointers=[],this.PointerCount=0,this.preDifference=-1,this.IsTouchInput=!1,this.ScrollStartX=-1,this.ScrollStartY=-1)},n.prototype._OnTouchStartInternal=function(n){this.IsTouchInput=!0;var t=n.touches;t.length==1&&this._TouchDownInternal(n,!1);this.ScrollStartX==-1&&this.ScrollStartY==-1&&(this.ScrollStartY=t[0].pageY,this.ScrollStartX=t[0].pageX);n.preventDefault()},n.prototype._OnTouchMoveInternal=function(n){var t=n.touches,r,u,i;this._TouchMoveInternal(n,!1);t.length==1&&(r=t[0].pageX-this.ViewerContatiner.offsetLeft,u=t[0].pageY-this.ViewerContatiner.offsetTop,r<this.Container.clientWidth&&u<this.Container.clientHeight&&(this._ScrollContainer(n),this.isTouchScroll=!0));t.length>1&&(this.isMousedown=!1,i=Math.sqrt(Math.pow(t[0].clientX-t[1].clientX,2)+Math.pow(t[0].clientY-t[1].clientY,2)),this.preDifference>-1?i>this.preDifference?this._OnPinchOutInternal(n):i<this.preDifference&&this._OnPinchInInternal(n):this.ZoomFactor<2?this.preDifference!=-1&&i>this.preDifference&&this._OnPinchInInternal(n):this.preDifference==-1&&this.ZoomFactor>2&&i>this.preDifference&&this._OnPinchInInternal(n),this.preDifference=i);n.preventDefault()},n.prototype._OnTouchEndInternal=function(n){n.changedTouches.length==1&&this._TouchUpInternal(n,!1);this.ScrollStartX=-1;this.ScrollStartY=-1;this.preDifference=-1;this.IsTouchInput=!1;n.preventDefault()},n.prototype._OnPinchInInternal=function(){if(this.preZoomFactor=this.ZoomFactor,this.ZoomFactor=this.ZoomFactor-.01,this.ZoomFactor<5&&this.ZoomFactor>2&&(this.ZoomFactor=this.ZoomFactor-.01),this.ZoomFactor<.1&&(this.ZoomFactor=.1),this.ZoomFactor>=.1){var n=this.VerticalScrollBar.model.value/this.preZoomFactor*this.ZoomFactor;this.VerticalScrollBar.scroll(n)}},n.prototype._OnPinchOutInternal=function(){if(this.preZoomFactor=this.ZoomFactor,this.ZoomFactor=this.ZoomFactor+.01,this.ZoomFactor>2&&(this.ZoomFactor=this.ZoomFactor+.01),this.ZoomFactor>5&&(this.ZoomFactor=5),this.ZoomFactor<=5){var n=this.VerticalScrollBar.model.value/this.preZoomFactor*this.ZoomFactor;this.VerticalScrollBar.scroll(n)}},n.prototype._ScrollContainer=function(n){var t,i;navigator.userAgent.match("MSIE")||navigator.userAgent.match(".NET")?(t=this.ScrollStartX-n.pageX,i=this.ScrollStartY-n.pageY):(t=this.ScrollStartX-n.touches[0].pageX,i=this.ScrollStartY-n.touches[0].pageY);t<0&&(t=-t);i<0&&(i=-i);t>i?this._ScrollHorizontal(n):this._ScrollVertical(n)},n.prototype._ScrollHorizontal=function(n){var t=this.HorizontalScrollBar.model.value,i;navigator.userAgent.match("MSIE")||navigator.userAgent.match(".NET")?(n.preventDefault(),i=n.pageX,this.preDifference!=-1&&(t=this.preDifference>i?t+10:t-10),this.preDifference=i):n instanceof TouchEvent&&(n.preventDefault(),i=n.touches[0].pageX,this.preDifference!=-1&&(t=this.preDifference>i?t+10:t-10),this.preDifference=i);t<0&&(t=0);t>this.HorizontalScrollBar.model.maximum&&(t=this.HorizontalScrollBar.model.maximum);this.HorizontalScrollBar.scroll(t)},n.prototype._ScrollVertical=function(n){var t=this.VerticalScrollBar.model.value,i;navigator.userAgent.match("MSIE")||navigator.userAgent.match(".NET")?(n.preventDefault(),i=n.pageY,this.preDifference!=-1&&(t=this.preDifference>i?t+10:t-10),this.preDifference=i):n instanceof TouchEvent&&(n.preventDefault(),i=n.touches[0].pageY,this.preDifference!=-1&&(t=this.preDifference>i?t+10:t-10),this.preDifference=i);t<0&&(t=0);t>this.VerticalScrollBar.model.maximum&&(t=this.VerticalScrollBar.model.maximum);this.VerticalScrollBar.scroll(t)},n.prototype._OnMouseDownInternal=function(n){var u,t,i,f;if(this._UpdateCursor(n),this._IsLeftButtonPressed(n)&&this.OwnerControl.SelectedResizeElement!=null&&(this.IsImageResizing=!0),u=new p(n.offsetX,n.offsetY),t=this._FindFocusedPage(u),!this.OwnerControl.IsReadOnlyMode&&(this._IsInRowResizerArea(t)||this._IsInCellResizerArea(t))){this._HideCaret(!0);this.isMousedown=!0;this.isSelectionChangedOnMouseMoved=!1;this._IsLeftButtonPressed(n)&&(this.OwnerControl.IsRowOrCellResizing=!0,this.OwnerControl.StartingPoint=t,this.OwnerControl.InitialPoint.X=t.X,this.OwnerControl.InitialPoint.Y=t.Y,this.OwnerControl.Selection._InitResizingHistory(this.OwnerControl.InitialPoint));return}var r=this._ValidateClosestElement(n.target),e=r.isClosestToContainer,o=r.isVerticalScroller,s=r.isHorizontalScroller;if(n.preventDefault(),this.IsTouchInput){n.preventDefault();return}if((n.target==this.ViewerContatiner||!e||!(o||s))&&(this._ValidateFocus(),i=new p(n.offsetX,n.offsetY),!(i.X>this.Container.clientWidth))&&!(i.Y>this.Container.clientHeight)){if(f=this._FindFocusedPage(i),n.which==3&&!this.OwnerControl.Selection.IsEmpty&&!this._UpdateCursorPosition(f)){n.preventDefault();return}this.OwnerControl.Selection.IsEmpty&&(this.useTouchSelectionMark=!1);this.OwnerControl.Selection.SelectionRanges.Count>0&&this.isControlPressed&&(this.OwnerControl.Selection.SelectionRanges.Count==1&&this.OwnerControl.Selection.IsEmpty&&n.detail==1&&this.OwnerControl.Selection.SelectionRanges._Clear(),n.detail==1?this.OwnerControl.Selection.SelectionRanges._AddSelection(this.OwnerControl.Document._GetDocumentStart(),this.OwnerControl.Document._GetDocumentStart()):this.OwnerControl.Selection.SelectionRanges._AddSelection(this.OwnerControl.Selection.Start,this.OwnerControl.Selection.End));this.IsTouchInput=!1;this.isMousedown=!0;this.isSelectionChangedOnMouseMoved=!1;n.preventDefault()}},n.prototype._OnMouseMoveInternal=function(n){var i,t,r,u;if(this.IsImageResizing){this._HandleImageResizing(n);return}if(this.IsTouchInput){n.preventDefault();return}if(this.tapCount=0,i=new p(n.offsetX,n.offsetY),t=this._FindFocusedPage(i),!this.OwnerControl.IsReadOnlyMode&&this.OwnerControl.IsRowOrCellResizing)this.OwnerControl.Selection.IsEmpty&&(this.Caret.style.display="none"),this._HandleResizing(t);else if(this.isMousedown&&!this.IsImageResizing){if(this.CurrentPage!=null&&(r=t.X,u=t.Y,this.IsTouchInput||this.isSelectionChangedOnMouseMoved||this.TouchDownOnSelectionMark>0||this._UpdateTextPositionforSelection(t,1,!n.ctrlKey),this._IsLeftButtonPressed(n))){n.preventDefault();var f=u,e=this.OwnerControl.Selection.End,o=new p(r,f);this.OwnerControl.Selection._MoveTextPosition(o,!n.ctrlKey,e,this);this.isSelectionChangedOnMouseMoved=!0}this._CheckForCursorVisibility(!1)}this.IsImageResizing||this._UpdateCursor(n)},n.prototype._OnMouseUpInternal=function(n,t){if(this.IsTouchInput){n.preventDefault();return}navigator.userAgent.match("Chrome")&&(t=n.detail);var r=new p(n.offsetX,n.offsetY),i=this._FindFocusedPage(r);!this.isMousedown||this.isSelectionChangedOnMouseMoved||this.CurrentPage==null||this.OwnerControl.Selection.Start==null||this.IsImageResizing||(this.TouchDownOnSelectionMark==0&&this._UpdateTextPositionforSelection(i,t,!n.ctrlKey),this._CheckForCursorVisibility(!1));this.CurrentPage!=null&&this.OwnerControl.Selection.Start!=null&&this.OwnerControl.Selection.IsEmpty&&(this.IsTouchInput||n.ctrlKey==!0&&this._IsLeftButtonPressed(n)==!0)&&this._NavigateHyperlink(i);this.isControlPressed&&this.isMousedown&&this.CurrentPage!=null&&this.OwnerControl.Selection.Start!=null&&this.OwnerControl.Selection.SelectionRanges._UpdateSelectionRange();this.IsImageResizing&&(this._ScrollToPosition(this.OwnerControl.Selection.Start,this.OwnerControl.Selection.End),this.IsImageResizing=!1,this.ImageResizer._UpdateHistory());this.OwnerControl.IsRowOrCellResizing&&(this.OwnerControl.Selection._UpdateResizingHistory(i),this.OwnerControl.IsRowOrCellResizing=!1,this.OwnerControl.ResizerPosition=-1);this.isImageResizerVisible&&this.Caret!=null&&(this.Caret.style.display="none");this.isMousedown=!1;this.isSelectionChangedOnMouseMoved=!1;this.IsTouchInput=!1;this.useTouchSelectionMark=!0;this.IsImageResizing=!1;this.EditableDiv.focus();n.preventDefault()},n.prototype._OnMouseWheelInternal=function(n){var i,r,t,u;this.IsTouchInput=!1;n.ctrlKey==!0?(n.preventDefault(),i=n.pageX-this.ViewerContatiner.offsetLeft,i<this.Container.offsetWidth&&(this.preZoomFactor=this.ZoomFactor,navigator.userAgent.match("Firefox")?n.detail<0?this.ZoomFactor<=4.9&&(this.ZoomFactor=this.ZoomFactor+.1):this.ZoomFactor>=.2&&(this.ZoomFactor=this.ZoomFactor-.1):this.ZoomFactor=n.wheelDelta>0?this.ZoomFactor<=4.9?this.ZoomFactor+.1:5:this.ZoomFactor>=.2?this.ZoomFactor-.1:.1,r=this.VerticalScrollBar.model.value/this.preZoomFactor*this.ZoomFactor,this.VerticalScrollBar.scroll(r))):(u=navigator.userAgent.match("Edge")||navigator.userAgent.match("MSIE")||navigator.userAgent.match(".NET")?n.wheelDelta:n.wheelDeltaY,t=navigator.userAgent.match("Firefox")?this.VerticalScrollBar.model.value+n.detail*40:this.VerticalScrollBar.model.value-u,t>=0&&t<=this.VerticalScrollBar.model.maximum?(this.VerticalScrollBar.scroll(t),n.preventDefault()):t>this.VerticalScrollBar.model.maximum?this.VerticalScrollBar.scroll(this.VerticalScrollBar.model.maximum):this.VerticalScrollBar.scroll(0))},n.prototype._IsLeftButtonPressed=function(n){this.IsTouchInput=!1;var t=n.which||n.button;return t==1},n.prototype._OnDoubleTap=function(n){this.IsTouchInput=!1;this._FindFocusedPage(n);var t=this.OwnerControl.Selection._GetText(!0);t.length==0&&this.CurrentPage!=null&&this.OwnerControl.Selection.Start!=null&&(this.OwnerControl.Selection._SelectCurrentWord(!0),this._CheckForCursorVisibility(!0),this.tapCount=2)},n.prototype._OnkeyDownInternal=function(n){var t=n.which||n.keyCode,i=n.ctrlKey?n.ctrlKey:t===17?!0:!1,r=n.shiftKey?n.shiftKey:t===16?!0:!1;if(i&&!r){this.isControlPressed=!0;switch(t){case 9:this._HandleTabKey(this.OwnerControl.Selection,!1);n.preventDefault();break;case 35:this._HandleControlEndKey();break;case 36:this._HandleControlHomeKey();break;case 37:this._HandleControlLeftKey();break;case 38:this._HandleControlUpKey();break;case 39:this._HandleControlRightKey();break;case 40:this._HandleControlDownKey();break;case 65:this.OwnerControl.Selection._SelectAll();break;case 66:n.preventDefault();this.OwnerControl.Selection._OnBold();break;case 67:n.preventDefault();this.OwnerControl.Selection._Copy();break;case 69:n.preventDefault();this.OwnerControl.Selection._ToggleTextAlignment(rt.Center);break;case 70:this._ShowHideOptionsPane(!0);n.preventDefault();break;case 72:n.preventDefault();this.OwnerControl.IsReadOnlyMode||this.OwnerControl.Viewer._ShowFindAndReplaceDialog(!0);break;case 73:n.preventDefault();this.OwnerControl.Selection._OnItalic();break;case 74:n.preventDefault();this.OwnerControl.Selection._ToggleTextAlignment(rt.Justify);break;case 75:n.preventDefault();this.OwnerControl.Viewer._ShowHyperlinkDialog();break;case 76:n.preventDefault();this.OwnerControl.Selection._ToggleTextAlignment(rt.Left);break;case 78:n.preventDefault();this.OwnerControl.DocumentEditor.newDocument();break;case 80:n.preventDefault();this.OwnerControl._Print();break;case 82:n.preventDefault();this.OwnerControl.Selection._ToggleTextAlignment(rt.Right);break;case 85:n.preventDefault();this.OwnerControl.Selection._ToggleUnderline(ki.Single);break;case 86:navigator.userAgent.match("Firefox")&&this.EditableDiv.blur();break;case 88:n.preventDefault();this.OwnerControl.Selection._Cut();break;case 89:this.OwnerControl.History._Redo();break;case 90:this.OwnerControl.History._Undo();break;case 187:n.preventDefault();this.OwnerControl.Selection._ToggleBaselineAlignment(vt.Subscript)}}else if(r&&!i)switch(t){case 35:this._HandleShiftEndKey();n.preventDefault();break;case 36:this._HandleShiftHomeKey();n.preventDefault();break;case 37:this._HandleShiftLeftKey();n.preventDefault();break;case 38:this._HandleShiftUpKey();n.preventDefault();break;case 39:this._HandleShiftRightKey();n.preventDefault();break;case 40:this._HandleShiftDownKey();n.preventDefault();break;case 13:this._HandleShiftEnter();n.preventDefault();break;case 9:this._HandleShiftTabKey(this.OwnerControl.Selection);n.preventDefault()}else if(r&&i){switch(t){case 35:this._HandleControlShiftEndKey();break;case 36:this._HandleControlShiftHomeKey();break;case 37:this._HandleControlShiftLeftKey();break;case 38:this._HandleControlShiftUpKey();break;case 39:this._HandleControlShiftRightKey();break;case 40:this._HandleControlShiftDownKey();break;case 43:this.OwnerControl.Selection._ToggleBaselineAlignment(vt.Superscript)}n.preventDefault()}else switch(t){case 35:this._HandleEndKey();n.preventDefault();break;case 36:this._HandleHomeKey();n.preventDefault();break;case 37:this._HandleLeftKey();n.preventDefault();break;case 38:this._HandleUpKey();n.preventDefault();break;case 39:this._HandleRightKey();n.preventDefault();break;case 40:this._HandleDownKey();n.preventDefault();break;case 46:this._HandleDelete();n.preventDefault();break;case 13:this._HandleEnter();n.preventDefault();break;case 9:this._HandleTabKey(this.OwnerControl.Selection,!0);n.preventDefault();break;case 8:this._HandleBackKey();n.preventDefault()}this.SearchHighlighters!=null&&this.SearchHighlighters.Count>0&&this._ClearSearchHighlight();(n.keyCode==27||n.which==27)&&(this._ClearSearchHighlight(),this._ShowHideOptionsPane(!1))},n.prototype.OnTextInputInternal=function(n){navigator.userAgent.match("Safari")&&navigator.vendor.match("Apple")?this._HandleTextInput(String.fromCharCode(n.keyCode)):n.key!="Spacebar"?n.key.length==1&&n.key!="\r"&&n.key!="\b"&&n.key!="\x1b"&&!this.OwnerControl.IsReadOnlyMode&&this.OwnerControl.IsDocumentLoaded&&n.ctrlKey==!1&&this._HandleTextInput(n.key):this._HandleTextInput(" ")},n.prototype._HandleImageResizing=function(n){var t,u,f;if(this.OwnerControl.SelectedResizeElement!=null){var o=parseFloat(this.OwnerControl.SelectedResizeElement.style.top),s=parseFloat(this.OwnerControl.SelectedResizeElement.style.left),h=new p(n.offsetX,n.offsetY),e=this._FindFocusedPage(h),r=0,i=0;r=e.X-s;i=e.Y-o;switch(this.OwnerControl.SelectedResizeElement.id.split("_")[1]){case"TopRightRect":i*=-1;break;case"TopLeftRect":r*=-1;i*=-1;break;case"TopMiddleRect":r=0;i*=-1;break;case"BottomLeftRect":r*=-1;break;case"BottomMiddleRect":r=0;break;case"RightMiddleRect":i=0;break;case"LeftMiddleRect":r*=-1;i=0}(r!=0||i!=0)&&(this.ImageResizer._InitHistory(this.ImageResizer.CurrentImageElementBox.ImageContainer),this.ImageResizer.CurrentImageElementBox.ImageContainer!=null&&(this.ImageResizer.CurrentImageElementBox.ImageContainer.Width=this.ImageResizer.CurrentImageElementBox.ImageContainer.Width+r>10?this.ImageResizer.CurrentImageElementBox.ImageContainer.Width+r:10,this.ImageResizer.CurrentImageElementBox.ImageContainer.Height=this.ImageResizer.CurrentImageElementBox.ImageContainer.Height+i>10?this.ImageResizer.CurrentImageElementBox.ImageContainer.Height+i:10,t=this.ImageResizer.CurrentImageElementBox.ImageContainer.OwnerParagraph,this._PositionImageResizer(this.ImageResizer.CurrentImageElementBox),t!=null&&t.BaseParent!=null&&(t._RelayoutParagraph(t.Inlines._IndexOf(this.ImageResizer.CurrentImageElementBox.ImageContainer)),this._UpdateScrollBars(),this.OwnerControl.Selection._HighlightSelection(!1)),this.OwnerControl.Viewer instanceof w&&t.ParagraphWidgets!=null&&t.ParagraphWidgets.Count>0&&t.ParagraphWidgets[0].ContainerWidget instanceof ii?t.ParagraphWidgets[0].ContainerWidget.ContainerWidget instanceof li&&(u=t.ParagraphWidgets[0].ContainerWidget.ContainerWidget,u.Y==this.OwnerControl.Viewer.ClientArea.Y&&i>0?this._UpdateScrollBars():u.Y!=this.OwnerControl.Viewer.ClientArea.Y&&i<0&&this._UpdateScrollBars()):this.OwnerControl.Viewer instanceof w&&t.ParagraphWidgets!=null&&t.ParagraphWidgets.Count>0&&t.ParagraphWidgets[0].ContainerWidget instanceof wt&&(f=t.ParagraphWidgets[0],f.Y==this.OwnerControl.Viewer.ClientArea.Y&&i>0?this._UpdateScrollBars():f.Y!=this.OwnerControl.Viewer.ClientArea.Y&&i<0&&this._UpdateScrollBars())),this.IsImageResizing=!0)}},n.prototype._GetCurrentPoint=function(n,t){var i=new p(0,0);return i.X=n-this.ViewerContatiner.offsetLeft,i.Y=t-this.ViewerContatiner.offsetTop,i},n.prototype._UpdateCursorPosition=function(n){var i=this._GetLineWidget(n),s=null,e,o,r,l,a;i!=null&&i.CurrentParagraphWidget!=null&&i.CurrentParagraphWidget.ContainerWidget instanceof ii&&(s=i.CurrentParagraphWidget.ContainerWidget);var f=0,h=null,y=null;if(this.OwnerControl.Selection.SelectionRanges.Count>0)for(e=0;e<this.OwnerControl.Selection.SelectionRanges.Count;e++){var t=this.OwnerControl.Selection.SelectionRanges._Get(e),c=t.IsForward?t.Start:t.End,p=t.IsForward?t.End:t.Start,v=c.Location,w=p.Location,u=t.SelectedWidgets.Keys;for(o=0;o<u.Count;o++){if(r=u[o],l=t.SelectedWidgets._Get(r),r instanceof ru&&r==i)return h=u[u.length-1],y=t.SelectedWidgets._Get(h),n.X<=this.CurrentPage.Viewer.ClientArea.X?u[0]==i?!c.IsAtParagraphStart:!1:u[0]==i?(f=v.X+l.Width,c.IsAtParagraphStart?!(f>n.X):!(f>n.X&&v.X<n.X)):h==i?(f=l.Width,!(w.X>n.X&&this.CurrentPage.Viewer.ClientArea.X<n.X)):!1;if(r instanceof ii&&s!=null&&s==r&&(a=r,a.X+a.Width>n.X))return!1}}return!0},n.prototype._OnZoomFactorChanged=function(){this.zoomFactor>5?this.zoomFactor=5:this.zoomFactor<.1&&(this.zoomFactor=.1);this._Zoom();this.OwnerControl._RaiseClientEvent(kr.ZoomFactorChange,null)},n.prototype._UpdateCommentClientArea=function(){this.ClientArea=new nt(30,0,280,0);this.ClientActiveArea=this.ClientArea},n.prototype._MoveCommentsToPage=function(n){for(var t,i=0;i<this.CommentWidgets.Count;i++)t=this.CommentWidgets[i],this.CommentWidgets._Remove(t),t.Comment!=null&&t.Comment.Elements.Count>0&&(t.TopPosition=t.Comment.Elements[0].CurrentLineWidget._GetTop()),n==null||n.CommentWidgets==null||n.CommentWidgets._Contains(t)||(n.CommentWidgets._Add(t),t.Page=n,n._AdjustCommentWidgets()),i--},n.prototype._ResetClientArea=function(n,t){this.ClientArea=n;this.ClientActiveArea=t},n.prototype._TouchDownInternal=function(n,t){var i,e,f,r,u;this.IsTouchInput=!0;this.OwnerControl.Selection.IsEmpty&&(this.useTouchSelectionMark=!1);this.isMousedown=!0;this.isSelectionChangedOnMouseMoved=!1;this._ValidateFocus();this.isMousedown&&this.CurrentPage!=null&&this.OwnerControl.Selection.Start!=null&&!t?(e=this._getTouchOffsetValue(n),i=new p(e.offsetX,e.offsetY)):this.isMousedown&&this.CurrentPage!=null&&this.OwnerControl.Selection.Start!=null&&t&&(i=new p(n.offsetX,n.offsetY));i=this._FindFocusedPage(i);this.isReviewPanelShow&&i.X>this.CurrentPage.BoundingRectangle.Width-this.CurrentPage.ReviewPanelWidth&&i.X<this.CurrentPage._GetPageWidth()&&(f=this.CurrentPage._GetCommentWidget(i),f!=null&&f.RenderedElement!=null&&(i.X=i.X-(this.CurrentPage.BoundingRectangle.Width-this.CurrentPage.ReviewPanelWidth),i.Y=i.Y-f.TopPosition,i.X>f.ContentWidth&&(i.X=f.ContentWidth),i.Y>f.Height&&(i.Y=f.Height)));r=this.OwnerControl.Selection.End.Location.X;u=this._GetCaretBottom(this.OwnerControl.Selection.End,this.OwnerControl.Selection.IsEmpty)+9;this.TouchDownOnSelectionMark=(i.Y<=u&&i.Y>=u-20||i.Y>=u&&i.Y<=u+20)&&(i.X<=r&&i.X>=r-20||i.X>=r&&i.X<=r+20)?1:0;this.OwnerControl.Selection.IsEmpty||this.TouchDownOnSelectionMark!=0||(r=this.OwnerControl.Selection.Start.Location.X,u=this._GetCaretBottom(this.OwnerControl.Selection.Start,!1)+9,this.TouchDownOnSelectionMark=(i.Y<=u&&i.Y>=u-20||i.Y>=u&&i.Y<=u+20)&&(i.X<=r&&i.X>=r-20||i.X>=r&&i.X<=r+20)?2:0)},n.prototype._TouchUpInternal=function(n,t){var i,u,r;this.EditableDiv.focus();this.isTouchScroll||!this.isMousedown||this.isSelectionChangedOnMouseMoved||this.CurrentPage==null||this.OwnerControl.Selection.Start==null||(i=void 0,t||(u=this._getTouchOffsetValue(n),i=new p(u.offsetX,u.offsetY)),t&&(i=new p(n.offsetX,n.offsetY)),r=this._FindFocusedPage(i),this.TouchDownOnSelectionMark==0&&this._UpdateTextPositionInternal(new p(r.X,r.Y),1,!0),this.OwnerControl.Selection.IsEmpty&&this._NavigateHyperlink(r),this._CheckForCursorVisibility(!0));this.isTouchScroll=!1;this.isMousedown=!1;this.TouchDownOnSelectionMark=0;this.useTouchSelectionMark=!0;this.isSelectionChangedOnMouseMoved=!1},n.prototype._TouchMoveInternal=function(n,t){var r,u,i,f,e,o;this.isMousedown&&(t||(u=this._getTouchOffsetValue(n),r=new p(u.offsetX,u.offsetY)),t&&(r=new p(n.offsetX,n.offsetY)),i=this._FindFocusedPage(r),this.TouchDownOnSelectionMark>0&&(f=i.Y,e=this.OwnerControl.Selection.End,this.TouchDownOnSelectionMark>0&&(o=void 0,f-=i.Y<=26?i.Y<0?0:i.Y+.5:36.5,e=this.TouchDownOnSelectionMark==2?this.OwnerControl.Selection.Start:this.OwnerControl.Selection.End),i=new p(i.X,f),this.OwnerControl.Selection._MoveTextPosition(i,!0,e,this),this.isSelectionChangedOnMouseMoved=!0),this._CheckForCursorVisibility(!0))},n.prototype._getTouchOffsetValue=function(n){var f=n.target,i=f.getBoundingClientRect(),t=n.touches[0],r,u;return t==null&&(t=n.changedTouches[0]),r=t.pageX-i.left,u=t.pageY-i.top,{offsetX:r,offsetY:u}},n.prototype._UpdateHFClientArea=function(n,t){var i=n.SectionFormat.PageWidth-n.SectionFormat.LeftMargin-n.SectionFormat.RightMargin;i<0&&(i=0);this.ClientArea=t?new nt(n.SectionFormat.LeftMargin,n.SectionFormat.HeaderDistance,i,n.SectionFormat.PageHeight-n.SectionFormat.HeaderDistance):new nt(n.SectionFormat.LeftMargin,n.SectionFormat.PageHeight-n.SectionFormat.FooterDistance,i,n.SectionFormat.PageHeight-n.SectionFormat.FooterDistance);this.ClientActiveArea=new nt(this.ClientArea.X,this.ClientArea.Y,this.ClientArea.Width,this.ClientArea.Height)},n.prototype._UpdateClientAreaInternal=function(){this.Padding=new tu(10,10,10,10);var n=(this.VisibleBounds.Width-this.Padding.Left-this.Padding.Right)/this.zoomFactor;n<0&&(n=0);this.ClientArea=new nt(this.Padding.Left/this.zoomFactor,this.Padding.Top/this.zoomFactor,n,0);this.ClientActiveArea=this.ClientArea},n.prototype._UpdateClientArea=function(n){var r,t,u,i,o,s,e,f,h;if(this instanceof st){if(n==null)return;r=n.OwnerBase;this.CurrentPage!=null&&r!=null&&r.Owner instanceof ti?(t=r._GetIndexInOwnerCollection(),t>0&&t-1<this.CurrentPage.BodyWidgets.Count&&this.CurrentPage.BodyWidgets[t-1].CurrentNode==r.PreviousNode?(u=this.CurrentPage.BodyWidgets[t-1],this.ClientActiveArea.X=u.X,this.ClientActiveArea.Y=u.Y+u.Height,this.ClientActiveArea.Width=u.Width):this._UpdateClientAreaInternal(),(t>this.CurrentPage.BodyWidgets.Count-1||this.CurrentPage.BodyWidgets[t].CurrentNode!=n.OwnerBase)&&this.CurrentPage.BodyWidgets._Insert(t,r._AddBodyWidget(this.ClientActiveArea))):this._UpdateClientAreaInternal();return}this.CurrentComment==null&&(i=0,n!=null&&(i=n.TopMargin),o=48,s=48,n!=null&&(o=n.HeaderDistance,s=n.FooterDistance),this.CurrentRenderingPage.HeaderWidget!=null&&(i=Math.max(o+this.CurrentRenderingPage.HeaderWidget.Height,i)),e=.667+n.BottomMargin,this.CurrentRenderingPage.FooterWidget!=null&&(e=.667+Math.max(s+this.CurrentRenderingPage.FooterWidget.Height,n.BottomMargin)),f=0,h=0,n!=null&&(f=n.PageWidth-n.LeftMargin-n.RightMargin,h=n.PageHeight-i-e),f<0&&(f=0),this.ClientArea=new nt(n.LeftMargin,i,f,n.PageHeight-i-e),this.ClientActiveArea=new nt(this.ClientArea.X,this.ClientArea.Y,this.ClientArea.Width,this.ClientArea.Height))},n.prototype._UpdateClientAreaForBlock=function(n,t){var i,r,f,u;t?n instanceof e&&n.TableWidgets.length>0?(r=n.TableWidgets[0],this.ClientActiveArea.X=this.ClientArea.X=r.X,this.ClientActiveArea.Width=this.ClientArea.Width=r.Width,r=n.TableWidgets[n.TableWidgets.length-1],r.X=this.ClientActiveArea.X,r.Y=this.ClientActiveArea.Y,this.ClientArea=new nt(this.ClientArea.X,this.ClientArea.Y,this.ClientArea.Width,this.ClientArea.Height),this.ClientActiveArea=new nt(this.ClientActiveArea.X,this.ClientActiveArea.Y,this.ClientActiveArea.Width,this.ClientActiveArea.Height)):(n instanceof e&&n.TableFormat!=null&&n.TableFormat.TableAlignment!=rr.Left?(f=n._GetTableWidth(),i=n.TableFormat.TableAlignment==rr.Center?(this.ClientArea.Width-f)/2:this.ClientArea.Width-f,(this.CurrentComment!=null||this instanceof st)&&Math.round(this.ClientArea.Width)<Math.round(f)&&(i=0),this.tableLeft.push(i)):i=n.LeftIndent,this.ClientActiveArea.X=this.ClientArea.X=this.ClientArea.X+i,u=this.ClientArea.Width-(i+n.RightIndent),this.ClientActiveArea.Width=this.ClientArea.Width=u>0?u:0,this.ClientArea=new nt(this.ClientArea.X,this.ClientArea.Y,this.ClientArea.Width,this.ClientArea.Height),this.ClientActiveArea=new nt(this.ClientActiveArea.X,this.ClientActiveArea.Y,this.ClientActiveArea.Width,this.ClientActiveArea.Height)):(i=n instanceof e&&n.TableFormat.TableAlignment!=rr.Left&&this.tableLeft.length>0?this.tableLeft.pop():n.LeftIndent,this.ClientActiveArea.X=this.ClientArea.X=this.ClientArea.X-i,u=this.ClientArea.Width+i+n.RightIndent,this.ClientActiveArea.Width=this.ClientArea.Width=u>0?u:0,this.ClientArea=new nt(this.ClientArea.X,this.ClientArea.Y,this.ClientArea.Width,this.ClientArea.Height),this.ClientActiveArea=new nt(this.ClientActiveArea.X,this.ClientActiveArea.Y,this.ClientActiveArea.Width,this.ClientActiveArea.Height))},n.prototype._UpdateClientAreaForRow=function(n,t){var i=n.OwnerTable.TableWidgets[n.OwnerTable.TableWidgets.length-1];t||(this.ClientActiveArea.X=this.ClientArea.X=i.X,this.ClientActiveArea.Width=this.ClientArea.Width=i.Width,this.ClientArea=new nt(this.ClientArea.X,this.ClientArea.Y,this.ClientArea.Width,this.ClientArea.Height),this.ClientActiveArea=new nt(this.ClientActiveArea.X,this.ClientActiveArea.Y,this.ClientActiveArea.Width,this.ClientActiveArea.Height))},n.prototype._UpdateClientAreaForCell=function(n,t){var r=n.OwnerRow.TableRowWidgets[n.OwnerRow.TableRowWidgets.length-1],i=n.TableCellWidgets[n.TableCellWidgets.length-1];t?(this.TextWrap=!0,this.ClientActiveArea.X=this.ClientArea.X=i.X,this.ClientActiveArea.Y=i.Y,this.ClientActiveArea.Width=this.ClientArea.Width=i.Width>0?i.Width:0,this instanceof w&&(this.ClientActiveArea.Height=Number.POSITIVE_INFINITY),this.ClientArea=new nt(this.ClientArea.X,this.ClientArea.Y,this.ClientArea.Width,this.ClientArea.Height),this.ClientActiveArea=new nt(this.ClientActiveArea.X,this.ClientActiveArea.Y,this.ClientActiveArea.Width,this.ClientActiveArea.Height)):(this.TextWrap=!0,this.ClientActiveArea.X=this.ClientArea.X=i.X+i.Width+i.Margin.Right,this.ClientActiveArea.Width=r.X+r.Width-this.ClientArea.X<0?this.ClientArea.Width=0:this.ClientArea.Width=r.X+r.Width-this.ClientArea.X,this.ClientActiveArea.Y=i.Y-i.Margin.Top-n.OwnerTable.TableFormat.CellSpacing,n.OwnerTable.IsInsideTable||(this.ClientActiveArea.Height=this.ClientArea.Bottom-r.Y>0?this.ClientArea.Bottom-r.Y:0),this.ClientArea=new nt(this.ClientArea.X,this.ClientArea.Y,this.ClientArea.Width,this.ClientArea.Height),this.ClientActiveArea=new nt(this.ClientActiveArea.X,this.ClientActiveArea.Y,this.ClientActiveArea.Width,this.ClientActiveArea.Height))},n.prototype._UpdateClientWidth=function(n){this.ClientActiveArea.X-=n;this.ClientActiveArea.Width+n>0?this.ClientActiveArea.Width+=n:this.ClientActiveArea.Width=0},n.prototype._CutFromLeft=function(n){n<this.ClientActiveArea.Left&&(n=this.ClientActiveArea.Left);n>this.ClientActiveArea.Right&&this.TextWrap&&(n=this.ClientActiveArea.Right);this.ClientActiveArea.Width=this.ClientActiveArea.Right>n?this.ClientActiveArea.Right-n:0;this.ClientActiveArea.X=n},n.prototype._CutFromTop=function(n){n<this.ClientActiveArea.Top&&(n=this.ClientActiveArea.Top);this instanceof w&&n>this.ClientActiveArea.Bottom&&this.CurrentComment==null&&(n=this.ClientActiveArea.Bottom);this instanceof w&&this.CurrentComment==null?this.ClientActiveArea.Height=this.ClientActiveArea.Bottom-n:(this.ClientActiveArea.Height=n,this.ClientArea.Height=this.ClientActiveArea.Height);this.ClientActiveArea.X=this.ClientArea.X;this.ClientActiveArea.Width=this.ClientArea.Width;this.ClientActiveArea.Y=n},n.prototype._ClearContainer=function(){this._RemoveRenderedPages();this.Pages._Clear();this.isReviewPanelShow=!1;this.VerticalScrollBar.scroll(0);this.HorizontalScrollBar.scroll(0);this.HorizontalWidth=0;this._HideImageResizer();this.LineElements.Count>0&&this.LineElements._Clear()},n.prototype._InsertPage=function(n,t){var i,r;for(this.Pages._Remove(t),this.Pages._Insert(n,t),i=20,n>0&&(i+=this.Pages[n-1].BoundingRectangle.Bottom),r=n;r<this.Pages.Count;r++)t=this.Pages[r],t.BoundingRectangle=new nt(t.BoundingRectangle.X,i,t.BoundingRectangle.Width,t.BoundingRectangle.Height),i=t.BoundingRectangle.Bottom+20},n.prototype._UpdateClientAreaTopOrLeft=function(n,t){t&&(this.ClientActiveArea.Y=this.ClientActiveArea.Y+n.TopBorderWidth,this.ClientActiveArea.X=this.ClientActiveArea.X+n.LeftBorderWidth)},n.prototype._UpdateClientAreaForTable=function(n){this.ClientActiveArea.X=this.ClientArea.X=n.X;this.ClientActiveArea.Width=this.ClientArea.Width=n.Width},n.prototype._UpdateTextPosition=function(n,t){var i=this._GetLineWidget(n);i!=null&&i._UpdateTextPosition(this.OwnerControl,n,t)},n.prototype._UpdateTextPositionforSelection=function(n,t,i){var r=this._GetLineWidget(n);if(r!=null&&r._UpdateTextPosition(this.OwnerControl,n,i),t>1){if(this.isMousedown=!1,this.useTouchSelectionMark=!1,this.Pages.Count==0)return;this.CurrentPage!=null&&this.OwnerControl.Selection.Start!=null&&(t%2==0?this.OwnerControl.Selection._SelectCurrentWord(i):this.OwnerControl.Selection._SelectCurrentParagraph(i))}},n.prototype._UpdateTextPositionInternal=function(n,t,i){if(this._UpdateTextPosition(n,i),t>1){if(this.isMousedown=!1,this.Pages.Count==0)return;this.CurrentPage=this.Pages[0];this.CurrentPage!=null&&this.OwnerControl.Selection.Start!=null&&(t==2?this.OwnerControl.Selection._SelectCurrentWord(i):this.OwnerControl.Selection._SelectCurrentParagraph(i),this._CheckForCursorVisibility(!0))}},n.prototype._GetLineWidget=function(n){return this._GetLineWidgetInternal(n,!1)},n.prototype._GetLineWidgetInternal=function(n,t){var r=null,f,i,u,e;if(this.CurrentPage!=null){if(f=t&&this.OwnerControl.Selection._IsInComment(),this.OwnerControl.ShowComments&&(n.X>this.CurrentPage.BoundingRectangle.Width-this.CurrentPage.ReviewPanelWidth&&n.X<this.CurrentPage._GetPageWidth()||f)&&(i=this.CurrentPage._GetCommentWidget(n),f&&(i=this.OwnerControl.Selection.Start.Paragraph._GetOwnerComment().LayoutedWidget),i!=null&&(n.X=n.X-(this.CurrentPage.BoundingRectangle.Width-this.CurrentPage.ReviewPanelWidth),n.Y=n.Y-i.TopPosition,n.X>i.ContentWidth&&(n.X=i.ContentWidth),n.Y>i.Height&&(n.Y=i.Height),r=i.Comment.LayoutedWidget._GetLineWidget(n),r!=null)))return r;for(u=0;u<this.CurrentPage.BodyWidgets.length;u++)if(e=this.CurrentPage.BodyWidgets[u],r=e._GetLineWidget(n),r!=null)break;return r}},n.prototype._ClearSelectionHighlight=function(){var n=!0;n=!this.isControlPressed||!this.isMousedown;this.OwnerControl.Selection.SelectionRanges.Count>0&&(n||this.isImageResizerVisible)?this.OwnerControl.Selection.SelectionRanges._ClearSelectionHighlight():this.OwnerControl.Selection.CurrentSelectionRange!=null&&this.isMousedown&&this.OwnerControl.Selection.CurrentSelectionRange._ClearSelectionHighlight();this._RemoveCommentRangeWidget();this._RenderVisiblePages()},n.prototype._RemoveCommentRangeWidget=function(){this.CommentRangeWidget!=null&&(this.CommentRangeWidget._Dispose(),this.CommentRangeWidget=null);this.SelectedCommentRangeWidget=new ni},n.prototype._NavigateHyperlink=function(n){var i=this._GetLineWidget(n),t;i!=null&&(t=i._GetHyperlinkField(this.OwnerControl,n),t!=null&&(this._UpdateTextPosition(n,!0),this.OwnerControl._FireRequestNavigate(t)))},n.prototype._ScrollToPosition=function(n,t){var c=t.Paragraph._GetLineWidgetInternal(t.Offset,!0),at,p,ft,k,d,g,nt,u,et,r,ht,v,o,y,s,ct;if(c!=null){at=c._GetTop();this.isMousedown&&(p=t.Paragraph._GetLineWidgetInternal(t.Offset,!1),ft=p._GetTop(),p!=c&&t.Location.Y>=ft&&(c=p));k=0;d=0;this.OwnerControl.Selection._IsInComment()&&(g=this.OwnerControl.Selection.Start.Paragraph._GetOwnerComment(),k=g.LayoutedWidget.Y,d=g.LayoutedWidget.X);nt=c.Height;u=this instanceof st?this.CurrentPage:c.CurrentParagraphWidget._GetPage();this.CurrentPage=u;var i=0,e=0,f=this,tt=0;if(f instanceof w)if(tt=parseFloat(f.PageContainer.style.width.replace("px","")),et=f,et.IsFitMultiplePages){var ot=null,it=20,l=0,h=0,b=!1,a=0;for(r=0;r<=this.Pages.Count;r++){if(h=r,r!=this.Pages.Count&&(a=a+this.Pages[r].BoundingRectangle.Width*this.ZoomFactor),this.Pages.Count!=1&&r!=0&&(a+=20),ht=this.Pages.Count==1?!0:this.Pages.Count==r?!0:!1,b=(this.VisibleBounds.Width-a)/2<=30?!0:ht,this.Pages.Count!=1&&(h=r-1),this.Pages.Count==1&&h==this.Pages.Count&&(b=!1),b){for(v=0,o=0,y=l;y<=h;y++)v=Math.max(this.Pages[y].BoundingRectangle.Height*this.ZoomFactor,v),o=o+this.Pages[y].BoundingRectangle.Width*this.ZoomFactor;for(l<h&&(o=o+(h-l)*20),i=(this.VisibleBounds.Width-o)/2,i<30&&(i=30),e=0,o=o+i*2,s=l;s<=h;s++)if(e=it+(v-this.Pages[s].BoundingRectangle.Height*this.ZoomFactor)/2,s!=l&&(i=i+this.Pages[s-1].BoundingRectangle.Width*this.ZoomFactor+20),this.Pages._IndexOf(this.Pages[s])==this.Pages._IndexOf(u)){ot=this.Pages[s];break}it=it+v+20;l=r;b=!1;r!=this.Pages.Count&&(a=this.Pages[r].BoundingRectangle.Width*this.ZoomFactor)}if(ot!=null)break}}else{if(u==null)return;ct=u.BoundingRectangle.Width;i=(this.VisibleBounds.Width-ct*this.ZoomFactor)/2;i<30&&(i=30);e=u.BoundingRectangle.Top*this.ZoomFactor+(this.Pages._IndexOf(u)+1)*f.PageGap*(1-this.ZoomFactor)}i+=(t.Location.X+d)*this.ZoomFactor;e+=(t.Location.Y+k)*this.ZoomFactor;var rt=0,ut=0,lt=parseFloat(this.Container.style.height.replace("px",""));f instanceof w&&(f.PageContainer.style.left.indexOf("px")>-1&&(ut=-parseFloat(f.PageContainer.style.left.replace("px",""))),f.PageContainer.style.top.indexOf("px")>-1&&(rt=-parseFloat(f.PageContainer.style.top.replace("px",""))));rt>e?this.VerticalScrollBar.scroll(e-10):rt+lt<e+nt?this.VerticalScrollBar.scroll(e+nt-lt+10):this.UpdateCaretToPage(n,u);this.UpdateCaretToPage(n,u);ut>i?this.HorizontalScrollBar.scroll(i-10):ut+this.VisibleBounds.Width<i&&(i>=tt-this.VisibleBounds.Width?this.HorizontalScrollBar.scroll(tt-this.VisibleBounds.Width):this.HorizontalScrollBar.scroll(i))}},n.prototype._RemovePage=function(n){var i,f,r,u,t;if(this.CurrentPage==n&&(this.CurrentPage=null),this.SelectionStartPage==n&&(this.SelectionStartPage=null),this.SelectionEndPage==n&&(this.SelectionEndPage=null),i=this.Pages._IndexOf(n),this.Pages._Remove(n),this._RemoveRenderedPages(),this instanceof w){for(f=this,f.VisiblePages!=null&&f.VisiblePages._Remove(n),r=0,t=0;t<this.Pages.length;t++)r=r+this.Pages[t].BoundingRectangle.Height;if(r-=n.BoundingRectangle.Height+20,u=20,i>0&&(u+=this.Pages[i-1].BoundingRectangle.Bottom),i!=-1)for(t=i;t<this.Pages.Count;t++)n=this.Pages[t],n.BoundingRectangle=new nt(n.BoundingRectangle.X,u,n.BoundingRectangle.Width,n.BoundingRectangle.Height),u=n.BoundingRectangle.Bottom+20,n.RepeatHeaderRowTableWidget=!1}this._UpdateScrollBars()},n.prototype._AddSearchHighlightBorder=function(n){var t=null,i;return this.SearchHighlighters._ContainsKey(n)?t=this.SearchHighlighters._Get(n):(t=new h,this.SearchHighlighters._Add(n,t)),i=new ke(0,0),t._Add(i),i},n.prototype._ClearSearchHighlight=function(){this.SearchHighlighters!=null&&(this.SearchHighlighters._Clear(),this.SearchHighlighters=null);this._RenderVisiblePages()},n.prototype.UpdateCaretToPage=function(n,t){if(t!=null)if(this.SelectionEndPage=t,this.OwnerControl.Selection.IsEmpty)this.SelectionStartPage=t;else{var r=n.Paragraph._GetLineWidget(n.Offset),i=r.CurrentParagraphWidget._GetPage();i!=null&&(this.SelectionStartPage=i)}this._CheckForCursorVisibility(!1)},n.prototype._CheckForCursorVisibility=function(n){this._ShowCaret(n)},n.prototype._ShowCaret=function(){if(!this.isImageResizerVisible){var t=this.CurrentPage?this.CurrentPage.Id:this.CurrentRenderingPage.Id,n=document.getElementById(t+"_ellipse");this.OwnerControl.Selection.IsEmpty&&!this.OwnerControl.IsReadOnlyMode?(this.Caret.style.display="block",n.appendChild(this.Caret)):this.Caret.style.display=="block"&&(this.Caret.style.display="none");this.IsTouchInput&&!this.OwnerControl.IsReadOnlyMode?(this.touchStart.style.display="block",this.touchEnd.style.display="block",n.appendChild(this.touchStart),n.appendChild(this.touchEnd)):(this.touchStart.style.display="none",this.touchEnd.style.display="none")}},n.prototype._HideCaret=function(){this.touchStart.style.display="none";this.touchEnd.style.display="none";this.isMousedown=!1;this.TouchDownOnSelectionMark=0;this.useTouchSelectionMark=!0},n.prototype._UpdateCaretPosition=function(){var t,n;if(this.OwnerControl.Selection._IsInComment()){t=this.OwnerControl.Selection.Start.Paragraph._GetOwnerComment();n=this.OwnerControl.Selection.End.Location;this.Caret.style.left=Math.round(n.X+t.LayoutedWidget.X)+"px";var i=this._UpdateCaretSize(this.OwnerControl.Selection.End),u=i.topMargin+t.LayoutedWidget.Y,r=i.caretHeight;this.Caret.style.top=Math.round(n.Y+u)+"px";this.touchStart.style.left=Math.round(n.X+t.LayoutedWidget.X-7)+"px";this.touchStart.style.top=n.Y+t.LayoutedWidget.Y+r+"px";this.touchEnd.style.left=Math.round(n.X+t.LayoutedWidget.X-7)+"px";this.touchEnd.style.top=n.Y+t.LayoutedWidget.Y+r+"px";return}if(this.OwnerControl.Selection.End!=null){n=this.OwnerControl.Selection.End.Location;this.Caret.style.left=Math.round(n.X)+"px";var i=this._UpdateCaretSize(this.OwnerControl.Selection.End),u=i.topMargin,r=i.caretHeight;this.Caret.style.top=Math.round(n.Y+u)+"px";this.OwnerControl.Selection.CharacterFormat.BaselineAlignment==2&&(this.Caret.style.top=parseFloat(this.Caret.style.top)+parseFloat(this.Caret.style.height)/2+"px");this.touchStart.style.left=Math.round(n.X-7)+"px";this.touchStart.style.top=n.Y+r+"px";this.touchEnd.style.left=Math.round(n.X-7)+"px";this.touchEnd.style.top=n.Y+r+"px"}},n.prototype._UpdateCaretSize=function(n){var t=0,u=!1,i=0,e,r,o,s;if(n.OwnerControl.Selection.CharacterFormat.Italic&&(u=n.OwnerControl.Selection.CharacterFormat.Italic),n.Paragraph._IsEmpty()){var c=n.Paragraph,h=0,f=c._GetParagraphMarkSize(t,h);t=f.TopMargin;h=f.BottomMargin;e=f.Height;i=t<0?t+e:e;this.Caret.style.height=i+"px";t=0}else r=0,o=n.Paragraph._GetInline(n.Offset,r),r=o.index,s=o.inline,i=s._GetCaretHeight(r,s.CharacterFormat,!0,t,u).Height,this.Caret.style.height=i+"px";return this.Caret.style.transform=u?"rotate(13deg)":"",{topMargin:t,caretHeight:i}},n.prototype._UpdateTouchMarkPosition=function(){var n,t,i;if(this.OwnerControl.Selection._IsInComment()){n=this.OwnerControl.Selection.Start.Paragraph._GetOwnerComment();t=this._GetCaretBottom(this.OwnerControl.Selection.Start,!1)+n.LayoutedWidget.Y;this.touchStart.style.left=Math.round(this.OwnerControl.Selection.Start.Location.X+n.LayoutedWidget.X-7)+"px";this.touchStart.style.top=t+"px";t=this._GetCaretBottom(this.OwnerControl.Selection.End,!1)+n.LayoutedWidget.Y;this.touchEnd.style.left=Math.round(this.OwnerControl.Selection.End.Location.X+n.LayoutedWidget.X-7)+"px";this.touchEnd.style.top=t+"px";return}i=this._GetCaretBottom(this.OwnerControl.Selection.Start,!1);this.touchStart.style.left=Math.round(this.OwnerControl.Selection.Start.Location.X-7)+"px";this.touchStart.style.top=i+"px";i=this._GetCaretBottom(this.OwnerControl.Selection.End,!1);this.touchEnd.style.left=Math.round(this.OwnerControl.Selection.End.Location.X-7)+"px";this.touchEnd.style.top=i+"px"},n.prototype._GetCaretBottom=function(n,t){var i=n.Location.Y;if(n.Paragraph._IsEmpty()){var l=n.Paragraph,r=0,u=0,f=l._GetParagraphMarkSize(r,u);r=f.TopMargin;u=f.BottomMargin;i+=f.Height;i+=r;t||(i+=u)}else{var e=0,s=n.Paragraph._GetInline(n.Offset,e),h=s.inline;e=s.index;var r=0,c=!1,o=h._GetCaretHeight(e,h.CharacterFormat,!1,r,c);r=o.TopMargin;c=o.IsItalic;i+=o.Height;t&&(i-=n.Paragraph.ParagraphFormat.AfterSpacing)}return i},n.prototype._HandleTextInput=function(n){this.OwnerControl.IsReadOnlyMode||this.OwnerControl.Selection._InsertText(n,!1);this._CheckForCursorVisibility(!1)},n.prototype._HandleShiftLeftKey=function(){this.OwnerControl.Selection._ExtendBackward(!0);this._CheckForCursorVisibility(!1)},n.prototype._HandleShiftRightKey=function(){this.OwnerControl.Selection._ExtendForward(!0);this._CheckForCursorVisibility(!1)},n.prototype._HandleShiftUpKey=function(){this.OwnerControl.Selection._ExtendToPreviousLine(!0);this._CheckForCursorVisibility(!1)},n.prototype._HandleShiftDownKey=function(){this.OwnerControl.Selection._ExtendToNextLine(!0);this._CheckForCursorVisibility(!1)},n.prototype._HandleShiftHomeKey=function(){this.OwnerControl.Selection._ExtendToLineStart(!0);this._CheckForCursorVisibility(!1)},n.prototype._HandleShiftEndKey=function(){this.OwnerControl.Selection._ExtendToLineEnd(!0);this._CheckForCursorVisibility(!1)},n.prototype._HandleControlShiftHomeKey=function(){var i,t,n;if(this.OwnerControl.Selection._IsInComment()){i=this.OwnerControl.Selection.Start.Paragraph._GetOwnerComment();t=i._GetFirstParagraph();this.OwnerControl.Selection.End._SetPositionParagraph(t,t._GetStartOffset());this.OwnerControl.Selection._FireSelectionChanged(!0);this._CheckForCursorVisibility(!1);return}n=null;this.OwnerControl.Document!=null&&(n=this.OwnerControl.Document.DocumentStart);n!=null&&(this.OwnerControl.Selection.End._SetPositionInternal(n),this.OwnerControl.Selection._FireSelectionChanged(!0));this._CheckForCursorVisibility(!1)},n.prototype._HandleControlShiftEndKey=function(){var n,t,i;if(this.OwnerControl.Selection._IsInComment()){n=this.OwnerControl.Selection.Start.Paragraph._GetOwnerComment();t=null;t=n.Blocks.Count==0?n._GetFirstParagraph():n.Blocks[n.Blocks.Count-1]._GetLastParagraph();this.OwnerControl.Selection.End._SetPositionParagraph(t,t._GetEndOffset()+1);this.OwnerControl.Selection._FireSelectionChanged(!0);this._CheckForCursorVisibility(!1);return}i=null;this.OwnerControl.Document!=null&&(i=this.OwnerControl.Document.DocumentEnd);i!=null&&(this.OwnerControl.Selection.End._SetPosition(i.Paragraph,!1),this.OwnerControl.Selection._FireSelectionChanged(!0));this._CheckForCursorVisibility(!1)},n.prototype._HandleControlShiftDownKey=function(){this.OwnerControl.Selection._ExtendToParagraphEnd(!0);this._CheckForCursorVisibility(!1)},n.prototype._HandleControlShiftLeftKey=function(){this.OwnerControl.Selection._ExtendToWordStart(!1,!0);this._CheckForCursorVisibility(!1)},n.prototype._HandleControlShiftUpKey=function(){this.OwnerControl.Selection._ExtendToParagraphStart(!0);this._CheckForCursorVisibility(!1)},n.prototype._HandleControlShiftRightKey=function(){this.OwnerControl.Selection._ExtendToWordEnd(!1,!0);this._CheckForCursorVisibility(!1)},n.prototype._HandleControlHomeKey=function(){var n=null;this.OwnerControl.Document!=null&&(n=this.OwnerControl.Document.DocumentStart);n!=null&&this.OwnerControl.Selection._SelectContent(n,!0);this._CheckForCursorVisibility(!1)},n.prototype._HandleControlEndKey=function(){var n=null;this.OwnerControl.Document!=null&&(n=this.OwnerControl.Document.DocumentEnd);n!=null&&this.OwnerControl.Selection._SelectContent(n,!0);this._CheckForCursorVisibility(!1)},n.prototype._HandleControlLeftKey=function(){this.OwnerControl.Selection._ExtendToWordStart(!0,!0);this._CheckForCursorVisibility(!1)},n.prototype._HandleControlRightKey=function(){this.OwnerControl.Selection._ExtendToWordEnd(!0,!0);this._CheckForCursorVisibility(!1)},n.prototype._HandleControlUpKey=function(){this.OwnerControl.Selection._MoveToPreviousParagraph(!0);this._CheckForCursorVisibility(!1)},n.prototype._HandleControlDownKey=function(){this.OwnerControl.Selection._MoveToNextParagraph(!0);this._CheckForCursorVisibility(!1)},n.prototype._HandleUpKey=function(){this.OwnerControl.Selection._MoveUp(!0);this._CheckForCursorVisibility(!1)},n.prototype._HandleDownKey=function(){this.OwnerControl.Selection._MoveDown(!0);this._CheckForCursorVisibility(!1)},n.prototype._HandleRightKey=function(){this.OwnerControl.Selection._MoveNextPosition(!0);this._CheckForCursorVisibility(!1)},n.prototype._HandleLeftKey=function(){this.OwnerControl.Selection._MovePreviousPosition(!0);this._CheckForCursorVisibility(!1)},n.prototype._HandleHomeKey=function(){this.OwnerControl.Selection._MoveToLineStart(!0);this._CheckForCursorVisibility(!1)},n.prototype._HandleEndKey=function(){this.OwnerControl.Selection._MoveToLineEnd(!0);this._CheckForCursorVisibility(!1)},n.prototype._HandleEnter=function(){this.OwnerControl.IsReadOnlyMode||this.OwnerControl.Selection._OnEnter();this._CheckForCursorVisibility(!1)},n.prototype._HandleDelete=function(){this.OwnerControl.IsReadOnlyMode||this.OwnerControl.Selection._OnDelete();this._CheckForCursorVisibility(!1)},n.prototype._HandleTabKey=function(n,t){var i=n.Start,o,s,e;if(i!=null){if(i.Paragraph.IsInsideTable&&n.End.Paragraph.IsInsideTable&&t){var u=i.Paragraph.AssociatedCell,f=u.OwnerRow,c=f.OwnerTable;u.NextNode==null?f.NextNode!=null||this.OwnerControl.IsReadOnlyMode?(o=null,f.NextNode instanceof bt&&(o=f.NextNode),n._SelectTableCell(o.Cells[0],!0)):n._InsertRow(hu.Below):(s=null,u.NextNode instanceof ot&&(s=u.NextNode),n._SelectTableCell(s,!0))}else if(t&&i!=null&&i.Offset==i.Paragraph._GetStartOffset()&&i.Paragraph.ParagraphFormat!=null&&i.Paragraph.ParagraphFormat.ListFormat!=null&&i.Paragraph.ParagraphFormat.ListFormat.List!=null){if(e=i.Paragraph.ParagraphFormat.ListFormat,e.OwnerBase instanceof a&&e.Document!=null){var r=e.OwnerBase,l=r.ListFormat.ListLevel,h=r.ListFormat.List._GetListLevel(r.ListFormat.ListLevelNumber+1);h!=null&&this.OwnerControl.Document!=null&&(n._OnApplyList(r.ListFormat.List,r.ListFormat.ListLevelNumber+1),i._UpdatePhysicalPosition(),n.End._UpdatePhysicalPosition(),this._UpdateCaretPosition())}}else this._HandleTextInput("\t");this._CheckForCursorVisibility(!1)}},n.prototype._HandleShiftTabKey=function(n){var t=n.Start,i,u,f,o,e;if(t!=null){if(t.Paragraph.IsInsideTable&&n.End.Paragraph.IsInsideTable)i=t.Paragraph.AssociatedCell,u=i.OwnerRow,i.PreviousNode==null?u.PreviousNode!=null&&(f=null,u.PreviousNode instanceof bt&&(f=u.PreviousNode),n._SelectTableCell(f.Cells[f.Cells.Count-1],!0)):(o=null,i.PreviousNode instanceof ot&&(o=i.PreviousNode),n._SelectTableCell(o,!0));else if(t.Offset==t.Paragraph._GetStartOffset()&&t.Paragraph.ParagraphFormat!=null&&t.Paragraph.ParagraphFormat.ListFormat!=null&&t.Paragraph.ParagraphFormat.ListFormat.List!=null){if(e=t.Paragraph.ParagraphFormat.ListFormat,e.OwnerBase instanceof a&&e.Document!=null){var r=e.OwnerBase,h=r.ListFormat.ListLevel,s=r.ListFormat.List._GetListLevel(r.ListFormat.ListLevelNumber-1);s!=null&&this.OwnerControl.Document!=null&&(n._OnApplyList(r.ListFormat.List,r.ListFormat.ListLevelNumber-1),t._UpdatePhysicalPosition(),n.End._UpdatePhysicalPosition(),this._UpdateCaretPosition())}}else this._HandleTextInput("\t");this._CheckForCursorVisibility(!1)}},n.prototype._HandleShiftEnter=function(){this.OwnerControl.IsReadOnlyMode||this._HandleTextInput("\v");this._CheckForCursorVisibility(!1)},n.prototype._HandleBackKey=function(){this.OwnerControl.IsReadOnlyMode||this.OwnerControl.Selection._OnBackspace();this._CheckForCursorVisibility(!1)},n.prototype._ShiftLayoutedItems=function(){var n,f,i,o,t,s,r;if(this.BlockToShift==null||this.BlockToShift.BaseParent==null){this.BlockToShift=null;return}for(n=this.BlockToShift,n._RelayoutOrShiftWidgets(this),f=!0;n.NextNode instanceof hi;){if(i=null,n instanceof u?i=n.ParagraphWidgets[n.ParagraphWidgets.Count-1]:(o=null,n instanceof e&&(o=n),i=o.TableWidgets[o.TableWidgets.Count-1]),n=n.NextNode,f=!1,t=null,n instanceof u?n.ParagraphWidgets.Count>0&&(t=n.ParagraphWidgets[0]):(s=null,n instanceof e&&(s=n),t=s.TableWidgets[0]),i!=null&&t!=null&&i.ContainerWidget==t.ContainerWidget&&v._Round(t.Y,2)==v._Round(this.ClientActiveArea.Y,2))break;f=!0;n._RelayoutOrShiftWidgets(this)}n._UpdateListItemsTillEnd(f);this.BlockToShift=null;this._UpdateScrollBars();r=this;r instanceof w?r._UpdateVisiblePages(!0):(this.CurrentPage._RemoveWidgets(r),this.CurrentPage._RenderWidget(r))},n.prototype._Replace=function(){var n,t,i,r,u;this.OwnerControl!=null&&(n=this.InsertFindAndReplaceDialog.find("#"+this.InsertFindAndReplaceDialog[0].id+"_FindWhatText")[0].value,t=this.InsertFindAndReplaceDialog.find("#"+this.InsertFindAndReplaceDialog[0].id+"_replaceText")[0].value,this.OwnerControl!=null)&&(this.OwnerControl.textSearchResults._ClearResults(),n!=""&&n!=null&&n!=undefined?(i=0,this.OwnerControl.Selection!=null&&(r=this.OwnerControl.Selection.Text,this.OwnerControl.Selection.IsEmpty||(this.OwnerControl.Selection.IsForward?this.OwnerControl.Selection._SelectContent(this.OwnerControl.Selection.Start,!0):this.OwnerControl.Selection._SelectContent(this.OwnerControl.Selection.End,!0)),this.OwnerControl._Find(n,i),this.OwnerControl.textSearchResults.CurrentSearchResult!=null&&this.OwnerControl.textSearchResults.CurrentSearchResult.Text==r&&(u=t==null||t==undefined?"":t,this.OwnerControl.textSearchResults.CurrentSearchResult._Replace(u),this.OwnerControl._Find(n,i)))):this._ShowAlertDialog("We couldn't find what you were looking for"))},n.prototype._ReplaceAll=function(){var n,t,i,r,u;this.OwnerControl!=null&&(n=this.InsertFindAndReplaceDialog.find("#"+this.InsertFindAndReplaceDialog[0].id+"_FindWhatText")[0].value,t=this.InsertFindAndReplaceDialog.find("#"+this.InsertFindAndReplaceDialog[0].id+"_replaceText")[0].value,this.OwnerControl!=null)&&(n!=""&&n!=null&&n!=undefined&&(i=0,this.OwnerControl._FindAll(n,i)),r=t==null||t==undefined?"":t,u=this.OwnerControl.textSearchResults._ReplaceAll(r),this.InsertFindAndReplaceDialog.ejDialog("close"),this._ShowAlertDialog("All done.We made "+u+" replacemant"))},n}();t.LayoutViewer=yf;w=function(t){function i(n){t.call(this,n);this.PageGap=20;this.PageLeft=30;this._GetCurrentPageHeaderFooter=function(n,t){var i;return i=t?si.OddHeader:si.OddFooter,n.SectionFormat.DifferentFirstPage&&(this.Pages.length==1||this.Pages[this.Pages.length-1].Section!=n)?i=t?si.FirstPageHeader:si.FirstPageFooter:n.SectionFormat.DifferentOddAndEvenPages&&this.Pages.length%2==0&&(i=t?si.EvenHeader:si.EvenFooter),n._GetCurrentHeaderFooter(i)};this.PageContainer=document.createElement("div");this.PageContainer.setAttribute("id",this.OwnerControl.ContainerId+"_pageContainer");this.PageContainer.style.position="relative";this.Container.appendChild(this.PageContainer);this.VisiblePages=new h}return n(i,t),Object.defineProperty(i.prototype,"IsFitMultiplePages",{get:function(){return this.PageFitType==cu.FitMultiplePages},enumerable:!0,configurable:!0}),i.prototype._FindFocusedPage=function(n){var t=new p(n.X,n.Y),d,l,u,a,r,s,i;if(this.PageContainer.style.left.indexOf("px")>-1&&(t.X-=parseFloat(this.PageContainer.style.left.replace("px",""))),this.PageContainer.style.top.indexOf("px")>-1&&(t.Y-=parseFloat(this.PageContainer.style.top.replace("px",""))),this.IsFitMultiplePages){var e=0,y=0,b=20,h=0,o=0,w=!1,c=0;for(i=0;i<=this.Pages.Count;i++)if(o=i,i!=this.Pages.Count&&(c=c+this.Pages[i]._GetPageWidth()*this.ZoomFactor),this.Pages.Count!=1&&i!=0&&(c+=20),d=this.Pages.Count==1?!0:this.Pages.Count==i?!0:!1,w=(this.VisibleBounds.Width-c)/2<=30?!0:d,this.Pages.Count!=1&&(o=i-1),this.Pages.Count==1&&o==this.Pages.Count&&(w=!1),w){for(l=0,u=0,a=h;a<=o;a++)l=Math.max(this.Pages[a].BoundingRectangle.Height*this.ZoomFactor,l),u=u+this.Pages[a]._GetPageWidth()*this.ZoomFactor;for(h<o&&(u=u+(o-h)*20),e=(this.VisibleBounds.Width-u)/2,e<30&&(e=30),y=0,u=u+e*2,r=h;r<=o;r++)if(y=b+(l-this.Pages[r].BoundingRectangle.Height*this.ZoomFactor)/2,r!=h&&(e=e+this.Pages[r-1]._GetPageWidth()*this.ZoomFactor+20),s=new nt(e,y,this.Pages[r]._GetPageWidth()*this.ZoomFactor,this.Pages[r].BoundingRectangle.Height*this.ZoomFactor),s.Bottom>=t.Y&&s.Left+this.Pages[r]._GetPageWidth()*this.ZoomFactor>=t.X||r==this.Pages.Count-1)return this.CurrentPage=this.Pages[r],t.Y=(t.Y-y)/this.ZoomFactor,t.X=t.X>s.Right?s.Right:t.X<s.Left?0:(t.X-s.Left)/this.ZoomFactor,t;b=b+l+20;h=i;w=!1;i!=this.Pages.Count&&(c=this.Pages[i]._GetPageWidth()*this.ZoomFactor)}}else for(i=0;i<this.Pages.length;i++){var f=this.Pages[i],k=(f.BoundingRectangle.Top-this.PageGap*(i+1))*this.ZoomFactor+this.PageGap*(i+1),g=f.BoundingRectangle.Height*this.ZoomFactor,v=f.BoundingRectangle.Left,tt=(f.BoundingRectangle.Right-v)*this.ZoomFactor+v;if(k<=t.Y&&k+g>=t.Y)return this.CurrentPage=f,t.Y=(t.Y-k)/this.ZoomFactor,t.X=this.IsImageResizing&&t.X>f.BoundingRectangle.Width?t.X-v:t.X>tt?f.BoundingRectangle.Right:t.X<v?f.BoundingRectangle.Left:(t.X-v)/this.ZoomFactor,t}return t},i.prototype._UpdateCursor=function(n){var f=null,i=this.ViewerContatiner,o=new p(n.offsetX,n.offsetY),t=this._FindFocusedPage(o),s=!this.OwnerControl.IsReadOnlyMode&&this._IsInRowResizerArea(t),h=!this.OwnerControl.IsReadOnlyMode&&this._IsInCellResizerArea(t),e=this._getImagePoint(t),r,u;this.OwnerControl.SelectedResizeElement=e.SelectedElement;r=e.ResizePosition;u=this._GetLineWidget(t);u!=null&&(f=u._GetHyperlinkField(this.OwnerControl,t));i.style.cursor=f!=null&&n.ctrlKey==!0?"pointer":r!=null?r:"default";s?i.style.cursor="row-resize":h&&(i.style.cursor="col-resize")},i.prototype._getImagePoint=function(n){var u=this.OwnerControl.ImageResizerPoints,t=this.ImageResizer,i="",r=null,f=u.bottomMiddleRect,e=u.bottomRightRect,o=u.bottomLeftRect,s=u.topMiddleRect,h=u.topRightRect,c=u.topLeftRect,l=u.rightMiddleRect,a=u.leftMiddleRect;return t.bottomMiddleRect!=null&&t.bottomMiddleRect.style.display!="none"&&(n.X>f.X&&n.X<=f.X+7&&n.Y>f.Y&&n.Y<=f.Y+7?(r=t.bottomMiddleRect,i="s-resize"):n.X>e.X&&n.X<=e.X+7&&n.Y>e.Y&&n.Y<=e.Y+7?(r=t.bottomRightRect,i="se-resize"):n.X>o.X&&n.X<=o.X+7&&n.Y>o.Y&&n.Y<=o.Y+7?(r=t.bottomLeftRect,i="sw-resize"):n.X>s.X&&n.X<=s.X+7&&n.Y>s.Y&&n.Y<=s.Y+7?(r=t.topMiddleRect,i="n-resize"):n.X>h.X&&n.X<=h.X+7&&n.Y>h.Y&&n.Y<=h.Y+7?(r=t.topRightRect,i="ne-resize"):n.X>c.X&&n.X<=c.X+7&&n.Y>c.Y&&n.Y<=c.Y+7?(r=t.topLeftRect,i="nw-resize"):n.X>a.X&&n.X<=a.X+7&&n.Y>a.Y&&n.Y<=a.Y+7?(r=t.leftMiddleRect,i="w-resize"):n.X>l.X&&n.X<=l.X+7&&n.Y>l.Y&&n.Y<=l.Y+7?(r=t.rightMiddleRect,i="e-resize"):this.ImageResizer.resizeContainerDiv!=null&&n.X>parseFloat(this.ImageResizer.resizeContainerDiv.style.left)&&n.X<=parseFloat(this.ImageResizer.resizeContainerDiv.style.left)+parseFloat(this.ImageResizer.resizeContainerDiv.style.width)&&n.Y>parseFloat(this.ImageResizer.resizeContainerDiv.style.top)&&n.Y<=parseFloat(this.ImageResizer.resizeContainerDiv.style.top)+parseFloat(this.ImageResizer.resizeContainerDiv.style.height)&&(i="move")),{SelectedElement:r,ResizePosition:i}},i.prototype._OnPageFitTypeChanged=function(n){var e=this.VisibleBounds.Width,r=this.VisibleBounds.Height,u=this.OwnerControl.Document.Sections[0],f=u.SectionFormat.PageWidth,i=u.SectionFormat.PageHeight,t;switch(n){case cu.FitFullPage:r>0&&i>0&&(t=(this.VisibleBounds.Height-2*this.PageGap-this.HorizontalScrollBar.model.height)/i,t==this.ZoomFactor?this._Zoom():this.ZoomFactor=t);break;case cu.FitPageWidth:e>0&&f>0&&(this.ZoomFactor=(this.VisibleBounds.Width-60)/f);break;case cu.FitMultiplePages:r>0&&i>0&&(t=(this.VisibleBounds.Height-2*this.PageGap-this.HorizontalScrollBar.model.height)/i,t==this.ZoomFactor?this._Zoom():this.ZoomFactor=t);break;default:this.ZoomFactor=this.ZoomFactor/100}},i.prototype._CreateNewPage=function(n){var u=this.PageGap,t,i,f,r;return this.Pages.length>0&&(u=this.Pages[this.Pages.length-1].BoundingRectangle.Bottom+this.PageGap),t=new pf,t.Viewer=this,t.Section=n,i=n.SectionFormat!=null?n.SectionFormat.PageWidth:816,f=n.SectionFormat!=null?n.SectionFormat.PageHeight:1056,this.isReviewPanelShow&&(i=i+t.ReviewPanelWidth),r=(this.VisibleBounds.Width-i*this.ZoomFactor)/2,r<this.PageLeft&&(r=this.PageLeft),t.BoundingRectangle=new nt(r,u,i,f),this.Pages._Add(t),this._LayoutHeaderFooter(n),this._UpdateClientArea(n.SectionFormat),t.BodyWidgets._Add(n._AddBodyWidget(this.ClientActiveArea)),t.BodyWidgets[t.BodyWidgets.length-1].Page=t,t},i.prototype._LayoutHeaderFooter=function(n){this.CurrentHeaderFooter=this._GetCurrentPageHeaderFooter(n,!0);this.CurrentHeaderFooter.Blocks.length>0&&(this._UpdateHFClientArea(n,!0),this.CurrentRenderingPage.HeaderWidget=this.CurrentHeaderFooter._LayoutItems(this));this.CurrentHeaderFooter=this._GetCurrentPageHeaderFooter(n,!1);this.CurrentHeaderFooter.Blocks.length>0&&(this._UpdateHFClientArea(n,!1),this.CurrentRenderingPage.FooterWidget=this.CurrentHeaderFooter._LayoutItems(this));this.CurrentHeaderFooter=null},i.prototype._Zoom=function(){this._UpdatePageLeft();this._UpdateScrollBars();this.OwnerControl.Selection!=null&&this.OwnerControl.Selection.Start!=null&&this.OwnerControl.Selection.End!=null&&this._ScrollToPosition(this.OwnerControl.Selection.Start,this.OwnerControl.Selection.End)},i.prototype._UpdateContainerPosition=function(){for(var r,w,v,t,h,b,p,i=0,n=0;n<this.Pages.length;n++)i=i+this.Pages[n].BoundingRectangle.Height;for(r=0,n=0;n<this.Pages.length;n++)r<this.Pages[n].BoundingRectangle.Width&&(r=this.Pages[n].BoundingRectangle.Width);var o=r*this.ZoomFactor+this.PageLeft*2,c=i*this.ZoomFactor+(this.Pages.length+1)*this.PageGap,u=this.VisibleBounds.Width,f=this.VisibleBounds.Height;if(c>f&&(u-=this.VerticalScrollBar.model.width),o>u&&(f-=this.HorizontalScrollBar.model.height),r=o>u?o:u,i=c>f?c:f,this.IsFitMultiplePages){i=this.PageGap;var l=0,e=0,a=!1,s=0,y=0;for(n=0;n<=this.Pages.Count;n++)if(e=n,n!=this.Pages.Count&&(s=s+this.Pages[n].BoundingRectangle.Width*this.ZoomFactor),this.Pages.Count!=1&&n!=0&&(s+=this.PageGap),w=this.Pages.Count==1?!0:this.Pages.Count==n?!0:!1,a=(this.VisibleBounds.Width-s)/2<=30?!0:w,this.Pages.Count!=1&&(e=n-1),this.Pages.Count==1&&e==this.Pages.Count&&(a=!1),a){for(v=0,t=0,h=l;h<=e;h++)v=Math.max(this.Pages[h].BoundingRectangle.Height,v),t=t+this.Pages[h].BoundingRectangle.Width*this.ZoomFactor;l<e&&(t=t+(e-l)*this.PageGap);b=(this.VisibleBounds.Width-t)/2>=30?(this.VisibleBounds.Width-t)/2:30;t=t+b*2;i+=v*this.ZoomFactor+this.PageGap;y=Math.max(y,t);l=n;a=!1;n!=this.Pages.Count&&(s=this.Pages[n].BoundingRectangle.Width*this.ZoomFactor)}o=y-this.VisibleBounds.Width}for(this.Container.style.width=u.toString()+"px",this.Container.style.height=f.toString()+"px",this.PageContainer.style.width=r.toString()+"px",this.PageContainer.style.height=i.toString()+"px",n=0;n<this.Pages.length;n++)p=(r-this.Pages[n].BoundingRectangle.Width*this.ZoomFactor)/2,this.Pages[n].BoundingRectangle=p>this.PageLeft?new nt(p,this.Pages[n].BoundingRectangle.Top,this.Pages[n].BoundingRectangle.Width,this.Pages[n].BoundingRectangle.Height):new nt(this.PageLeft,this.Pages[n].BoundingRectangle.Top,this.Pages[n].BoundingRectangle.Width,this.Pages[n].BoundingRectangle.Height);return{containerWidth:o,containerHeight:c,width:r,height:i,viewerWidth:u,viewerHeight:f}},i.prototype._UpdateScrollBars=function(){var n=this._UpdateContainerPosition(),s=n.containerWidth,h=n.containerHeight,t=n.viewerWidth,i=n.viewerHeight,f=n.width,e=n.containerHeight,o=this.VerticalScrollBar.element[0],u,r;h>i?(r=this.VerticalScrollBar.model.value,o.style.display="block",this.VerticalScrollBar.option("maximum",e-i),this.VerticalScrollBar.option("viewportsize",i),this.VerticalScrollBar.option("height",i),this.VerticalScrollBar._scrollData.handleSpace=i-2*this.VerticalScrollBar.model.buttonSize,this.VerticalScrollBar._scrollData.handle=Math.floor((i-18)/e*this.VerticalScrollBar._scrollData.handleSpace),this.VerticalScrollBar._scrollData.handle<15&&(this.VerticalScrollBar._scrollData.handle=15),this.VerticalScrollBar._scrollData.scrollable=this.VerticalScrollBar.model.maximum,this.VerticalScrollBar._scrollData.onePx=this.VerticalScrollBar._scrollData.scrollable/(this.VerticalScrollBar._scrollData.handleSpace-this.VerticalScrollBar._scrollData.handle),this.VerticalScrollBar["e-vhandle"].height(this.VerticalScrollBar._scrollData.handle),this.VerticalScrollBar.scroll(r)):(o.style.display="none",this.VerticalScrollBar.scroll(0));u=this.HorizontalScrollBar.element[0];s>t?(r=this.HorizontalScrollBar.model.value,u.style.display="block",this.HorizontalScrollBar.option("maximum",f-t),this.HorizontalScrollBar.option("viewportsize",t),this.HorizontalScrollBar.option("width",t),this.HorizontalScrollBar._scrollData.handleSpace=t-2*this.HorizontalScrollBar.model.buttonSize,this.HorizontalScrollBar._scrollData.handle=Math.floor((t-18)/f*this.HorizontalScrollBar._scrollData.handleSpace),this.HorizontalScrollBar._scrollData.handle<15&&(this.HorizontalScrollBar._scrollData.handle=15),this.HorizontalScrollBar._scrollData.scrollable=this.HorizontalScrollBar.model.maximum,this.HorizontalScrollBar._scrollData.onePx=this.HorizontalScrollBar._scrollData.scrollable/(this.HorizontalScrollBar._scrollData.handleSpace-this.HorizontalScrollBar._scrollData.handle),this.HorizontalScrollBar["e-hhandle"].width(this.HorizontalScrollBar._scrollData.handle),this.HorizontalScrollBar.scroll(r)):(u.style.display="none",this.HorizontalScrollBar.scroll(0))},i.prototype._VerticalScrollBar_ValueChanged=function(n){var t=n.scrollTop,i=parseFloat(this.Container.style.height),r=parseFloat(this.PageContainer.style.height);t>r-i&&(t=r-i);this.PageContainer.style.top=(-t).toString()+"px";this.OwnerControl.isReviewPanelShown||this._UpdateVisiblePages(!0)},i.prototype._HorizontalScrollBar_ValueChanged=function(n){var t=n.scrollLeft,i=parseFloat(this.Container.style.width),r=parseFloat(this.PageContainer.style.width);t>r-i&&(t=r-i);this.PageContainer.style.left=(-t).toString()+"px"},i.prototype._UpdateVisiblePages=function(n){var t;if(n){for(t=0;t<this.PageContainer.childNodes.length;t++)this.PageContainer.removeChild(this.PageContainer.childNodes[t]),t--;if(this._ClearVisiblePages(),this.IsFitMultiplePages)this._ArrangePages(!1);else{var o=this.PageGap,f=this.VisibleBounds.Height,i=-parseFloat(this.PageContainer.style.top),s=!0;for(t=0;t<this.Pages.length;t++){var u=this.Pages[t],r=(u.BoundingRectangle.Top-this.PageGap*(t+1))*this.ZoomFactor+this.PageGap*(t+1),e=u.BoundingRectangle.Height*this.ZoomFactor,h=u.BoundingRectangle.Left;(r>=i&&r<=i+f||r<=i&&r+e>=i+f||r+e>=i&&r+e<=i+f)&&(this._AddVisiblePage(u,h,o,!1),s=!1);o+=this.PageGap+u.BoundingRectangle.Height*this.ZoomFactor}}}else this.IsFitMultiplePages&&this._ArrangePages(!0)},i.prototype._ArrangePages=function(n){for(var o,f=this.PageGap,e=0,r=0,u=!1,i=0,t=0;t<=this.Pages.Count;t++)r=t,t!=this.Pages.Count&&(i=i+this.Pages[t].BoundingRectangle.Width*this.ZoomFactor),this.Pages.Count!=1&&t!=0&&(i+=this.PageGap),o=this.Pages.Count==1?!0:this.Pages.Count==t?!0:!1,u=(this.VisibleBounds.Width-i)/2<=30?!0:o,this.Pages.Count!=1&&(r=t-1),this.Pages.Count==1&&r==this.Pages.Count&&(u=!1),u&&(f=this._PositionPages(e,r,f,n),e=t,u=!1,t!=this.Pages.Count&&(i=this.Pages[t].BoundingRectangle.Width*this.ZoomFactor))},i.prototype._PositionPages=function(n,t,i,r){for(var e,s,o=0,f=0,u=n;u<=t;u++)o=Math.max(this.Pages[u].BoundingRectangle.Height*this.ZoomFactor,o),f=f+this.Pages[u].BoundingRectangle.Width*this.ZoomFactor;for(n<t&&(f=f+(t-n)*this.PageGap),e=(this.VisibleBounds.Width-f)/2>=30?(this.VisibleBounds.Width-f)/2:30,s=0,f=f+e*2,u=n;u<=t;u++)s=i+(o-this.Pages[u].BoundingRectangle.Height*this.ZoomFactor)/2,u!=n&&(e=e+this.Pages[u-1].BoundingRectangle.Width*this.ZoomFactor+this.PageGap),this._AddVisiblePage(this.Pages[u],e,s,r);return i+o+this.PageGap},i.prototype._AddVisiblePage=function(n,t,i){var s=n.BoundingRectangle.Height*this.ZoomFactor,h=n.BoundingRectangle.Width*this.ZoomFactor,r,u,f,o,e;n.Id=this.OwnerControl.ContainerId+"_page_"+Math.random().toString();r=document.createElement("canvas");r.style.position="absolute";r.style.top=i.toString()+"px";r.style.left=t.toString()+"px";r.style.borderWidth="1px";r.style.borderColor="#D9DCDD";r.style.borderStyle="solid";r.style.backgroundColor=this.OwnerControl.Document.BackgroundColor;r.height=s*2;r.width=h*2;r.style.height=s+"px";r.style.width=h+"px";r.style.zIndex="0";r.id=n.Id+"_background";this.PageContainer.appendChild(r);u=document.createElement("canvas");u.style.position="absolute";u.style.top=i.toString()+"px";u.style.left=t.toString()+"px";u.style.borderWidth="0px";u.height=s*2;u.width=h*2;u.style.height=s+"px";u.style.width=h+"px";u.style.zIndex="1";u.id=n.Id+"_foreground";this.PageContainer.appendChild(u);f=document.createElement("canvas");f.style.position="absolute";f.style.top=i.toString()+"px";f.style.left=t.toString()+"px";f.style.borderWidth="0px";f.height=s*2;f.width=h*2;f.style.height=s+"px";f.style.width=h+"px";f.style.zIndex="2";f.id=n.Id+"_selection";this.PageContainer.appendChild(f);o=document.createElement("div");o.style.position="absolute";o.style.top=i.toString()+"px";o.style.left=t.toString()+"px";o.style.borderWidth="0px";o.style.height=s+"px";o.style.width=h+"px";o.style.zIndex="2";o.id=n.Id+"_ellipse";this.PageContainer.appendChild(o);e=document.createElement("div");e.style.position="absolute";e.style.top=i.toString()+"px";e.style.left=t.toString()+"px";e.style.borderWidth="0px";e.style.height=s+"px";e.style.width=h+"px";e.style.backgroundColor="transparent";e.style.overflow="hidden";e.id=n.Id+"_resize";this.PageContainer.appendChild(e);n._ShowHideComments(u,r,f,o,e,this);this.VisiblePages._Add(n);n._RenderWidgets()},i.prototype._ClearVisiblePages=function(){for(var i,t,n=0;n<this.VisiblePages.length;n++)i=this.VisiblePages[n],t=document.getElementById(i.Id),t!=null&&t.parentElement.removeChild(t),i._RemoveWidgets(this);this.VisiblePages._Clear()},i.prototype._Print=function(){for(var r,i,n,u=0,t=0;t<this.Pages.length;t++)u<this.Pages[t].BoundingRectangle.Height&&(u=this.Pages[t].BoundingRectangle.Height);for(r=0,t=0;t<this.Pages.length;t++)r<this.Pages[t].BoundingRectangle.Width&&(r=this.Pages[t].BoundingRectangle.Width);for(i=navigator.userAgent,n=document.createElement("iframe"),n.style.position="absolute",n.style.left="-100em",document.body.appendChild(n),n.contentDocument.open(),i.indexOf("Chrome")!=-1||i.indexOf("Safari")!=-1||i.indexOf("Firefox")!=-1?(n.contentDocument.write("<!DOCTYPE html>"),n.contentDocument.write("<html moznomarginboxes mozdisallowselectionprint><head><style>html, body { height: 100 %; } img { height: 100 %; width: 100 %; display: block;}img { box-sizing: border-box; }br, button { display: none; }@page{ margin: 0cm; size:"+r.toString()+"px "+u.toString()+"px; }@media print{ body { margin: 0cm; }<\/style><\/head> <body><center>")):n.contentDocument.write("<html><head><style>@page{margin:0;size:"+r.toString()+"px "+u.toString()+"px;}<\/style><\/head><body><center>"),t=0;t<this.Pages.length;t++){var f=this.Pages[t],e=f.BoundingRectangle.Height,o=f.BoundingRectangle.Width,s=f._RenderCanvas().toDataURL();i.indexOf("Chrome")!=-1||i.indexOf("Safari")!=-1||i.indexOf("Firefox")!=-1?n.contentDocument.write('<div><img src="'+s+'" style="margin:0px;display:block;width:'+o.toString()+"px;height:"+e.toString()+'px; "/><\/div><br/>'):n.contentDocument.write('<img src="'+s+'" style="width:'+o.toString()+"px;height:"+e.toString()+';margin:0px;"/><br />')}n.contentDocument.write("<\/center><\/body><\/html>");n.contentDocument.write("<\/body><\/html>");navigator.userAgent.match("Firefox")?n.contentWindow.close():n.contentDocument.close();i.indexOf("Chrome")!=-1||i.indexOf("Safari")!=-1||i.indexOf("Firefox")!=-1?(n.contentWindow.focus(),n.contentWindow.print(),setTimeout(function(){document.body.removeChild(n)},500)):n.contentWindow.document.execCommand("print",!1,null)},i.prototype._RenderVisiblePages=function(){var n,t,i;if(this.VisiblePages!=undefined&&this.VisiblePages!=null&&!(this.VisiblePages.Count<1))for(n=0;n<this.VisiblePages.Count;n++)t=this.VisiblePages[n],i=document.getElementById(t.Id+"_background"),t._RemoveWidgets(this),t._RenderWidgets()},i.prototype._RemoveRenderedPages=function(){for(var t,i,n=0;n<this.Pages.length;n++)t=this.Pages[n],i=document.getElementById(t.Id),i!=null&&i.remove(),t._RemoveWidgets(this)},i.prototype._SetPageCount=function(){this.OwnerControl.PageCount=this.Pages.Count>0?this.Pages.Count:1},i}(yf);t.PageLayoutViewer=w;st=function(t){function i(n){t.call(this,n);this.PageContainer=document.createElement("div");this.PageContainer.setAttribute("id",this.OwnerControl.ContainerId+"_pageContainer");this.PageContainer.style.position="relative";this.Container.appendChild(this.PageContainer);this.VisiblePages=new h}return n(i,t),i.prototype._GetContentHeight=function(){var t=0,n,i;if(this.CurrentPage!=null&&this.CurrentPage.BodyWidgets.Count>0){for(n=0;n<this.CurrentPage.BodyWidgets.Count;n++)i=this.CurrentPage.BodyWidgets[n],t+=i.Height;return t}},i.prototype._CreateNewPage=function(n){return this.Pages.Count==0&&this._InitPage(),this._UpdateClientAreaInternal(),this.CurrentPage.BodyWidgets.Count==0&&(this.CurrentPage.BodyWidgets._Add(n._AddBodyWidget(this.ClientActiveArea)),this.CurrentPage.BodyWidgets[this.CurrentPage.BodyWidgets.length-1].Page=this.CurrentPage),this.CurrentPage},i.prototype._Zoom=function(){this.OwnerControl.Document._LayoutItems(this);this.OwnerControl.Selection!=null&&this.OwnerControl.Selection.Start!=null&&this.OwnerControl.Selection.End!=null&&this._ScrollToPosition(this.OwnerControl.Selection.Start,this.OwnerControl.Selection.End)},i.prototype._VerticalScrollBar_ValueChanged=function(n){var t=n.scrollTop,i=parseFloat(this.Container.style.height),r=parseFloat(this.PageContainer.style.height);t>r-i&&(t=r-i);this.PageContainer.style.top=(-t).toString()+"px";this._RenderVisiblePages()},i.prototype._HorizontalScrollBar_ValueChanged=function(n){var t=n.scrollLeft,i=parseFloat(this.Container.style.width),r=parseFloat(this.PageContainer.style.width);t>r-i&&(t=r-i);this.PageContainer.style.left=(-t).toString()+"px"},i.prototype._UpdateCursor=function(n){var t=null,f=new p(n.offsetX,n.offsetY),i=this._FindFocusedPage(f),r=this._GetLineWidget(i),u;r!=null&&(t=r._GetHyperlinkField(this.OwnerControl,i));u=this.ViewerContatiner;u.style.cursor=t!=null&&n.ctrlKey==!0?"pointer":"default"},i.prototype._Print=function(){},i.prototype._FindFocusedPage=function(n){var t=new p(n.X,n.Y);this.PageContainer.style.left.indexOf("px")>-1&&(t.X-=parseFloat(this.PageContainer.style.left.replace("px","")));this.PageContainer.style.top.indexOf("px")>-1&&(t.Y-=parseFloat(this.PageContainer.style.top.replace("px","")));var i=this.CurrentPage,r=(i.BoundingRectangle.Top-20)*this.ZoomFactor+20,f=i.BoundingRectangle.Height*this.ZoomFactor,u=i.BoundingRectangle.Left,e=i.BoundingRectangle.Right;return r<=t.Y&&r+f>=t.Y?(this.CurrentPage=i,t.Y=(t.Y-r)/this.ZoomFactor,t.X=t.X>e?i.BoundingRectangle.Right:t.X<u?i.BoundingRectangle.Left:(t.X-u)/this.ZoomFactor,t):t},i.prototype._OnPageFitTypeChanged=function(){this.ZoomFactor=1},i.prototype._RemoveRenderedPages=function(){this._ClearVisiblePages()},i.prototype._UpdateContainerPosition=function(){var n,f,r,u;this.Padding=new tu(10,10,10,10);n=0;f=0;this.TextWrap||this._UpdateHorizontalWidth();var e=this.HorizontalWidth*this.ZoomFactor>this.VisibleBounds.Width?this.HorizontalWidth*this.ZoomFactor:this.VisibleBounds.Width,o=this._GetContentHeight()*this.ZoomFactor+this.Padding.Top+this.Padding.Bottom,t=this.VisibleBounds.Width,i=this.VisibleBounds.Height;if(o>i&&(t-=this.VerticalScrollBar.model.width),e>t&&(i-=this.HorizontalScrollBar.model.height),f=e>t?e:t,n=o>i?o:i,r=f,this.VerticalScrollBar!=null&&(r=r+Math.max(this.VerticalScrollBar.model.width,this.VerticalScrollBar.model.minimum)),this.Container.style.width=t.toString()+"px",this.Container.style.height=i.toString()+"px",this.PageContainer.style.width=r.toString()+"px",this.PageContainer.style.height=n.toString()+"px",this.CurrentPage!=null){for(u=0;u<this.PageContainer.childNodes.length;u++)this.PageContainer.removeChild(this.PageContainer.childNodes[u]),u--;this._ClearVisiblePages();this._AddvisiblePage(this.CurrentPage,r,n,!0);this.CurrentPage.BoundingRectangle=new nt(0,0,r,n)}return{containerWidth:e,containerHeight:o,width:f,height:n,viewerWidth:t,viewerHeight:i}},i.prototype._UpdateScrollBars=function(){var n=this._UpdateContainerPosition(),s=n.containerWidth,h=n.containerHeight,t=n.viewerWidth,i=n.viewerHeight,f=n.width,e=n.containerHeight,o=this.VerticalScrollBar.element[0],u,r;h>i&&this.OwnerControl.LayoutType==pi.Continuous?(r=this.VerticalScrollBar.model.value,o.style.display="block",this.VerticalScrollBar.option("maximum",e-i),this.VerticalScrollBar.option("viewportsize",i),this.VerticalScrollBar.option("height",i),this.VerticalScrollBar._scrollData.handleSpace=i-2*this.VerticalScrollBar.model.buttonSize,this.VerticalScrollBar._scrollData.handle=Math.floor((i-18)/e*this.VerticalScrollBar._scrollData.handleSpace),this.VerticalScrollBar._scrollData.handle<15&&(this.VerticalScrollBar._scrollData.handle=15),this.VerticalScrollBar._scrollData.scrollable=this.VerticalScrollBar.model.maximum,this.VerticalScrollBar._scrollData.onePx=this.VerticalScrollBar._scrollData.scrollable/(this.VerticalScrollBar._scrollData.handleSpace-this.VerticalScrollBar._scrollData.handle),this.VerticalScrollBar["e-vhandle"].height(this.VerticalScrollBar._scrollData.handle),this.VerticalScrollBar.scroll(r)):(o.style.display="none",this.VerticalScrollBar.scroll(0));u=this.HorizontalScrollBar.element[0];s>t&&this.OwnerControl.LayoutType==pi.Continuous?(r=this.HorizontalScrollBar.model.value,u.style.display="block",this.HorizontalScrollBar.option("maximum",f-t),this.HorizontalScrollBar.option("viewportsize",t),this.HorizontalScrollBar.option("width",t),this.HorizontalScrollBar._scrollData.handleSpace=t-2*this.HorizontalScrollBar.model.buttonSize,this.HorizontalScrollBar._scrollData.handle=Math.floor((t-18)/f*this.HorizontalScrollBar._scrollData.handleSpace),this.HorizontalScrollBar._scrollData.handle<15&&(this.HorizontalScrollBar._scrollData.handle=15),this.HorizontalScrollBar._scrollData.scrollable=this.HorizontalScrollBar.model.maximum,this.HorizontalScrollBar._scrollData.onePx=this.HorizontalScrollBar._scrollData.scrollable/(this.HorizontalScrollBar._scrollData.handleSpace-this.HorizontalScrollBar._scrollData.handle),this.HorizontalScrollBar["e-hhandle"].width(this.HorizontalScrollBar._scrollData.handle),this.HorizontalScrollBar.scroll(r)):(u.style.display="none",this.HorizontalScrollBar.scroll(0))},i.prototype._AddvisiblePage=function(n,t,i){var r=document.createElement("canvas"),u,f,e;r.style.position="absolute";r.style.borderWidth="1px";r.style.borderColor="#D9DCDD";r.style.borderStyle="solid";r.style.backgroundColor=this.OwnerControl.Document.BackgroundColor;r.height=i*2;r.width=t*2;r.style.height=i+"px";r.style.width=t+"px";r.style.zIndex="0";r.id=n.Id+"_background";this.PageContainer.appendChild(r);this.Container.appendChild(this.PageContainer);u=document.createElement("canvas");u.style.position="absolute";u.style.borderWidth="0px";u.height=i*2;u.width=t*2;u.style.height=i+"px";u.style.width=t+"px";u.style.zIndex="1";u.id=n.Id+"_foreground";this.PageContainer.appendChild(u);f=document.createElement("canvas");f.style.position="absolute";f.style.borderWidth="0px";f.height=i*2;f.width=t*2;f.style.height=i+"px";f.style.width=t+"px";f.style.zIndex="2";f.id=n.Id+"_selection";this.PageContainer.appendChild(f);e=document.createElement("div");e.style.position="absolute";e.style.top=top.toString()+"px";e.style.left=top.toString()+"px";e.style.borderWidth="0px";e.style.height=i+"px";e.style.width=t+"px";e.style.zIndex="2";e.id=n.Id+"_ellipse";this.PageContainer.appendChild(e);this.VisiblePages._Add(n)},i.prototype._UpdateHorizontalWidth=function(){var t,n,r,i,u;if(this.CurrentPage!=null){for(this.HorizontalWidth=0,t=new h,n=0;n<this.CurrentPage.BodyWidgets.Count;n++)this.CurrentPage.BodyWidgets[n]._UpdateHorizontalWidth(t,this);for(this.HorizontalWidth>0&&(this.HorizontalWidth+=this.Padding.Right),n=0;n<t.Count;n++)for(r=t[n],i=0;i<r.ChildWidgets.Count;i++)u=r.ChildWidgets[i],u._UpdateSubWidth(this);t.Count>0&&this._RenderVisiblePages()}},i.prototype._InitPage=function(){var n=new pf,t;n.Id=this.OwnerControl.ContainerId+"_page_"+Math.random().toString();n.Viewer=this;n.BoundingRectangle=new nt(0,0,this.VisibleBounds.Width,this.VisibleBounds.Height);this.CurrentPage=n;t=10;this.Pages._Add(n)},i.prototype._RenderVisiblePages=function(){this.CurrentPage!=null&&(this.CurrentPage._RemoveWidgets(this),this.CurrentPage._RenderWidget(this))},i.prototype._ClearVisiblePages=function(){var n,i,t;if(this.VisiblePages!=undefined){for(n=0;n<this.VisiblePages.length;n++)i=this.VisiblePages[n],t=document.getElementById(i.Id),t!=null&&t.parentElement.removeChild(t),i._RemoveWidgets(this);this.VisiblePages._Clear()}},i}(yf);t.FlowLayoutViewer=st;to=function(){function n(n){this.characterFormat=null;this.fontStyle=null;this.InsertFontDialog=null;this.fontNameList=null;this.fontNameText=null;this.fontStyleList=null;this.fontStyleText=null;this.fontSizeList=null;this.fontSizeText=null;this.fontColor=null;this.underline=null;this.strikethrough=null;this.doublestrikethrough=null;this.superscript=null;this.subscript=null;this.viewer=n;this.characterFormat=new af(null);this._InitFontDialog()}return Object.defineProperty(n.prototype,"CharacterFormat",{get:function(){return this.characterFormat},set:function(n){this.characterFormat=n},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"FontStyle",{get:function(){return this.fontStyle},set:function(n){this.fontStyle=n;switch(this.fontStyle){case"Bold":this.characterFormat.Bold=!0;this.characterFormat.Italic=!1;break;case"Italic":this.characterFormat.Bold=!1;this.characterFormat.Italic=!0;break;case"BoldItalic":this.characterFormat.Bold=!0;this.characterFormat.Italic=!0;break;case"Regular":this.characterFormat.Bold=!1;this.characterFormat.Italic=!1}},enumerable:!0,configurable:!0}),n.prototype._InitFontDialog=function(){var n=this.viewer,t,i,f;this.InsertFontDialog=this.viewer.OwnerControl.ej.buildTag("div","",{display:"none"},{id:"documentEditor_"+this.viewer.OwnerControl.ContainerId+"_insertFontDialog",title:"Font"});n.OwnerControl.DocumentEditorElement.appendChild(this.InsertFontDialog[0]);t=document.createElement("div");t.style.width="500px";t.style.height="420px";i=document.createElement("TABLE");i.style.width="500px";i.style.height="auto";i.style.padding="20px";i.style.margin="10px";i.innerHTML+="<tr><td><label>Font<\/label><\/br><input type='text' id='"+this.InsertFontDialog[0].id+"_fontName' style='width:150px;height:15px;font-size:11px;'value=''><ul id='"+this.InsertFontDialog[0].id+"_fontNames' style='font-size:11px;'><\/td><td><label>Font Style<\/label><\/br><input type='text' id='"+this.InsertFontDialog[0].id+"_fontStyle' style='width:100px;height:15px;font-size:11px;' value=''><ul id='"+this.InsertFontDialog[0].id+"_fontStyles' style='font-size:12px;'><li>Regular<\/li><li>Bold<\/li><li>Italic<\/li><li>BoldItalic<\/li><\/td><td><label>Size<\/label><\/br><input type='text' id='"+this.InsertFontDialog[0].id+"_fontSize' style='width:100px;height:15px;font-size:11px;' value=''><ul id='"+this.InsertFontDialog[0].id+"_fontSizes' style='font-size:12px;'><li>8<\/li><li>9<\/li><li>10<\/li><li>11<\/li><li>12<\/li><li>14<\/li><li>16<\/li><li>18<\/li><li>20<\/li><li>24<\/li><li>26<\/li><li>28<\/li><li>36<\/li><li>48<\/li><li>72<\/li><li>96<\/li><\/td><\/tr><tr><td><label>Font Color<\/label><input type='text' id='"+this.InsertFontDialog[0].id+"_fontColor'/><\/td><td><label>Underline<\/label><input type='text' id='"+this.InsertFontDialog[0].id+"_underLine'/><\/td> <\/tr><tr><td><label>Effects<\/label><\/td><\/tr><tr><td><input type='checkbox' id='"+this.InsertFontDialog[0].id+"_strikeThrough' class='nodetext'><label style='padding:5px;'>StrikeThrough<\/label><\/br><input type='checkbox' id='"+this.InsertFontDialog[0].id+"_doubleStrikeThrough' class='nodetext'><label style='padding:5px;'>Double StrikeThrough<\/label><\/td><td><input type='checkbox' id='"+this.InsertFontDialog[0].id+"_superScript' class='nodetext'><label style='padding:5px;'>Superscript<\/label><\/br><input type='checkbox' id='"+this.InsertFontDialog[0].id+"_subScript' class='nodetext'><label style='padding:5px;'>Subscript<\/label><\/td><\/tr>";t.appendChild(i);var e=this,r=this.viewer.OwnerControl.ej.buildTag("input","",{"margin-left":"0px",left:"280px",position:"relative"},{type:"button",id:this.InsertFontDialog[0].id+"_ok",value:"Ok"}),u=this.viewer.OwnerControl.ej.buildTag("input","",{"margin-left":"0px",left:"310px",position:"relative"},{type:"button",id:this.InsertFontDialog[0].id+"_cancel",value:"Cancel"});u.ejButton({width:"90px",height:"23px",click:function(n){n.cancel||e.InsertFontDialog.ejDialog("close")}});r.ejButton({width:"90px",height:"23px",click:n.OwnerControl.ej.proxy(this._OnInsertFontFormat,this)});t.appendChild(r[0]);t.appendChild(u[0]);this.InsertFontDialog[0].appendChild(t);this.fontNameList=this.InsertFontDialog.find("#"+this.InsertFontDialog[0].id+"_fontNames");this.fontStyleList=this.InsertFontDialog.find("#"+this.InsertFontDialog[0].id+"_fontStyles");this.fontSizeList=this.InsertFontDialog.find("#"+this.InsertFontDialog[0].id+"_fontSizes");this.fontNameText=this.InsertFontDialog.find("#"+this.InsertFontDialog[0].id+"_fontName");this.fontStyleText=this.InsertFontDialog.find("#"+this.InsertFontDialog[0].id+"_fontStyle");this.fontSizeText=this.InsertFontDialog.find("#"+this.InsertFontDialog[0].id+"_fontSize");this.fontColor=this.InsertFontDialog.find("#"+this.InsertFontDialog[0].id+"_fontColor");this.underline=this.InsertFontDialog.find("#"+this.InsertFontDialog[0].id+"_underLine");this.strikethrough=this.InsertFontDialog.find("#"+this.InsertFontDialog[0].id+"_strikeThrough");this.doublestrikethrough=this.InsertFontDialog.find("#"+this.InsertFontDialog[0].id+"_doubleStrikeThrough");this.superscript=this.InsertFontDialog.find("#"+this.InsertFontDialog[0].id+"_superScript");this.subscript=this.InsertFontDialog.find("#"+this.InsertFontDialog[0].id+"_subScript");n._CreateEjListBox(this.fontNameList);n._CreateEjListBox(this.fontStyleList);n._CreateEjListBox(this.fontSizeList);n._CreateEjColorPicker(this.fontColor);n._CreateEjDropDownList(this.underline);n._CreateEjCheckBox(this.strikethrough);n._CreateEjCheckBox(this.doublestrikethrough);n._CreateEjCheckBox(this.superscript);n._CreateEjCheckBox(this.subscript);f=[{fontName:"Arial"},{fontName:"Calibri"},{fontName:"Cambria"},{fontName:"Cambria Math"},{fontName:"Candara"},{fontName:"Comic Sans MS"},{fontName:"Consolas"},{fontName:"Constantia"},{fontName:"Corbel"},{fontName:"Courier New"},{fontName:"Ebrima"},{fontName:"Franklin Gothic"},{fontName:"Gabriola"},{fontName:"Gadugi"},{fontName:"Georgia"},{fontName:"Impact"},{fontName:"Javanese Text"},{fontName:"Leelawadee UI"},{fontName:"Lucida Console"},{fontName:"Lucida Sans Unicode"},{fontName:"Malgun Gothic"},{fontName:"Microsoft Himalaya"},{fontName:"Microsoft JhengHei"},{fontName:"Microsoft JhengHei UI"},{fontName:"Microsoft New Tai Lue"},{fontName:"Microsoft PhagsPa"},{fontName:"Microsoft Sans Serif"},{fontName:"Microsoft Tai Le"},{fontName:"Microsoft YaHei"},{fontName:"Microsoft YaHei UI"},{fontName:"Microsoft Yi Baiti"},{fontName:"MingLiU-ExtB"},{fontName:"PMingLiU-ExtB"},{fontName:"MingLiU_HKSCS-ExtB"},{fontName:"Mongolian Baiti"},{fontName:"MS Gothic"},{fontName:"MS UI Gothic"},{fontName:"MS PGothic"},{fontName:"MV Boli"},{fontName:"Myanmar Text"},{fontName:"Nirmala UI"},{fontName:"Palatino Linotype"},{fontName:"Segoe MDL2 Assets"},{fontName:"Segoe Print"},{fontName:"Segoe Script"},{fontName:"Segoe UI"},{fontName:"Segoe UI Emoji"},{fontName:"Segoe UI Historic"},{fontName:"Segoe UI Symbol"},{fontName:"SimSun"}];this.fontNameList.ejListBox({width:"154px",height:"135px",dataSource:f,fields:{text:"fontName"}});this.fontStyleList.ejListBox({width:"104px",height:"135px"});this.fontSizeList.ejListBox({width:"104px",height:"135px"});this.underline.ejDropDownList({dataSource:["(none)","_________"],width:"134px",height:"22px"});this.strikethrough.ejCheckBox({checked:!1});this.doublestrikethrough.ejCheckBox({checked:!1});this.superscript.ejCheckBox({checked:!1});this.subscript.ejCheckBox({checked:!1});this.InsertFontDialog.find("#"+this.InsertFontDialog[0].id+"_fontColorWrapper").css("width","134px");this.InsertFontDialog.find("#"+this.InsertFontDialog[0].id+"_fontColorWrapper").css("height","22px");this.InsertFontDialog.find("#"+this.InsertFontDialog[0].id+"_fontColorWrapper").css("border-radius","0px");this.InsertFontDialog.find(".e-selected-color").css("width","85px");this.InsertFontDialog.find(".e-selected-color").css("height","12px")},n.prototype._WireUpEventsAndBindings=function(){var n=this;this.fontNameList.ejListBox({select:function(t){var i=n.fontNameText[0];n.CharacterFormat.FontFamily=t.value;i.value=t.value}});this.fontStyleList.ejListBox({select:function(t){var i=n.fontStyleText[0];n.FontStyle=t.value;i.value=t.value}});this.fontSizeList.ejListBox({select:function(t){var i=n.fontSizeText[0];n.CharacterFormat.FontSize=t.value;i.value=t.value}});this.fontColor.ejColorPicker({select:function(t){n.CharacterFormat.FontColor=t.value}});this.underline.ejDropDownList({change:function(t){n.CharacterFormat.Underline=t.itemId}});this.strikethrough.ejCheckBox({change:function(t){n._EnableCheckBoxproperty(t);n.CharacterFormat.StrikeThrough=t.isChecked?1:0}});this.doublestrikethrough.ejCheckBox({change:function(t){n._EnableCheckBoxproperty(t);n.CharacterFormat.StrikeThrough=t.isChecked?2:0}});this.superscript.ejCheckBox({change:function(t){n._EnableCheckBoxproperty(t);n.CharacterFormat.BaselineAlignment=t.isChecked?1:0}});this.subscript.ejCheckBox({change:function(t){n._EnableCheckBoxproperty(t);n.CharacterFormat.BaselineAlignment=t.isChecked?2:0}})},n.prototype._EnableCheckBoxproperty=function(n){var t=this.strikethrough.data("ejCheckBox"),i=this.doublestrikethrough.data("ejCheckBox"),r=this.superscript.data("ejCheckBox"),u=this.subscript.data("ejCheckBox");t._isChecked&&i._isChecked&&(t.setModel({checked:!1}),i.setModel({checked:!1}),$("#"+n.model.id).data("ejCheckBox").setModel({checked:!0}));r._isChecked&&u._isChecked&&(r.setModel({checked:!1}),u.setModel({checked:!1}),$("#"+n.model.id).data("ejCheckBox").setModel({checked:!0}))},n.prototype._loadFontDialog=function(){var n,i;this._WireUpEventsAndBindings();var t=this.fontStyleList.data("ejListBox"),r=this.fontSizeList.data("ejListBox"),u=this.underline.data("ejDropDownList"),f=this.strikethrough.data("ejCheckBox"),e=this.doublestrikethrough.data("ejCheckBox"),o=this.superscript.data("ejCheckBox"),s=this.subscript.data("ejCheckBox");if(this.CharacterFormat._CloneFormat(this.viewer.OwnerControl.Selection.CharacterFormat),n=this.CharacterFormat,this.fontNameText[0].value=n.FontFamily,n.Bold||n.Italic?n.Bold&&!n.Italic?(this.fontStyleText[0].value=t.getItemByIndex(1).value,t.selectItemByIndex(1)):!n.Bold&&n.Italic?(this.fontStyleText[0].value=t.getItemByIndex(2).value,t.selectItemByIndex(2)):n.Bold&&n.Italic&&(this.fontStyleText[0].value=t.getItemByIndex(3).value,t.selectItemByIndex(3)):(this.fontStyleText[0].value=t.getItemByIndex(0).value,t.selectItemByIndex(0)),n.FontSize!=null)for(i=0;i<=15;i++)if(n.FontSize==r.getItemByIndex(i).value){this.fontSizeText[0].value=n.FontSize;r.selectItemByIndex(i);break}n.FontColor!=null?this.InsertFontDialog.find("span.e-selected-color").css("background-color",n.FontColor):this.InsertFontDialog.find("span.e-selected-color").css("background-color","#000000");n.Underline==0?this.underline[0].value=u.selectItemByIndex(0):n.Underline==1&&(this.underline[0].value=u.selectItemByIndex(1));n.StrikeThrough==cr.SingleStrike?f.setModel({checked:!0}):n.StrikeThrough==cr.DoubleStrike?e.setModel({checked:!0}):(f.setModel({checked:!1}),e.setModel({checked:!1}));n.BaselineAlignment==vt.Superscript?o.setModel({checked:!0}):n.BaselineAlignment==vt.Subscript?s.setModel({checked:!0}):(o.setModel({checked:!1}),s.setModel({checked:!1}))},n.prototype._OnInsertFontFormat=function(){var n=this.CharacterFormat,t;n!=null&&(this.viewer.OwnerControl.Selection==null||this.viewer.OwnerControl.Selection.CharacterFormat._IsEqualFormat(n)||(t=new o(null),n._CopyToFormat(t),this.viewer.OwnerControl.Selection._OnCharacterFormat(t)));this.InsertFontDialog.ejDialog("close")},n.prototype._UnWireEventsAndBindings=function(){this.fontNameList.ejListBox({change:""});this.fontStyleList.ejListBox({change:""});this.fontSizeList.ejListBox({change:""});this.fontColor.ejColorPicker({change:""});this.underline.ejDropDownList({change:""});this.strikethrough.ejCheckBox({change:""});this.doublestrikethrough.ejCheckBox({change:""});this.superscript.ejCheckBox({change:""});this.subscript.ejCheckBox({change:""})},n}();t.FontDialog=to;pf=function(){function n(){this.RepeatHeaderRowTableWidget=!1;this.HeaderWidget=null;this.FooterWidget=null;this.ReviewPanelWidth=316;this.BodyWidgets=new h;this.CommentWidgets=new h}return n.prototype._GetPageWidth=function(){return this.BoundingRectangle.Width},n.prototype._IsHideComments=function(){return this.Viewer==null||this.Viewer.OwnerControl==null||this.Viewer.OwnerControl.Document==null||this.Viewer.OwnerControl.Document.Comments.Count==0||!this.Viewer.OwnerControl.ShowComments},n.prototype._ShowHideComments=function(n,t,i,r,u,f){this._IsHideComments()?(this.Viewer.isReviewPanelShow=!1,this._RemoveReviewPanel(n,t,i,r,u)):(this.Viewer.isReviewPanelShow=!0,this._ShowReviewPanel(n,t,i,r,u,f))},n.prototype._AdjustCommentWidgets=function(){for(var i,e,t,u,f,r,n=this.CommentWidgets.length-1;n>=1;n--)for(i=0;i<n;i++)this.CommentWidgets[i].TopPosition>this.CommentWidgets[i+1].TopPosition&&(e=this.CommentWidgets[i],this.CommentWidgets[i]=this.CommentWidgets[i+1],this.CommentWidgets[i+1]=e);for(t=this.CommentWidgets,u=0,n=0;n<t.Count;n++)u+=t[n].Height;if(this.BoundingRectangle.Height-40<u){f=30;(this.BoundingRectangle.Height-40)/t.Count>30&&(f=(this.BoundingRectangle.Height-40)/t.Count);var s=f*t.Count,h=f,o=20;for(n=0;n<t.Count;n++)t[n].X=t[n].X,t[n].Y=o,t[n].VisibleHeight=f,o+=f}else for(r=20,n=0;n<t.Count;n++)r<t[n].TopPosition&&this.BoundingRectangle.Height-20-t[n].TopPosition<u?r=this.BoundingRectangle.Height-20-u:r<t[n].TopPosition&&(r=t[n].TopPosition),t[n].X=t[n].X,t[n].Y=r,t[n].VisibleHeight=t[n].Height,r+=t[n].Height,u-=t[n].Height},n.prototype._UpdateContainer=function(n,t,i,r,u,f){var e=null,s,o,h;for(this.Viewer instanceof w&&(e=this.Viewer),n.width=f*e.ZoomFactor,t.width=f*e.ZoomFactor,i.width=f*e.ZoomFactor,r.style.width=f*e.ZoomFactor+"px",u.style.width=f*e.ZoomFactor+"px",s=0;s<this.Viewer.Pages.length;s++)o=this.Viewer.Pages[s],o.BoundingRectangle=new nt(o.BoundingRectangle.X,o.BoundingRectangle.Y,f,o.BoundingRectangle.Height);this.BoundingRectangle.Width==this.Section.SectionFormat.PageWidth+this.ReviewPanelWidth&&(h=e._UpdateContainerPosition(),n.style.left=this.BoundingRectangle.Left+"px",t.style.left=this.BoundingRectangle.Left+"px",i.style.left=this.BoundingRectangle.Left+"px",r.style.left=this.BoundingRectangle.Left+"px",u.style.left=this.BoundingRectangle.Left+"px");e._UpdateScrollBars()},n.prototype._GetCommentWidget=function(n){var i,t;if(this.CommentWidgets.Count>0)for(i=0;i<this.CommentWidgets.Count;i++)if(t=this.CommentWidgets[i],n.Y>t.Y&&n.Y<t.Y+t.VisibleHeight)return t;return null},n.prototype._RemoveReviewPanel=function(n,t,i,r,u){var f=this.Section.SectionFormat.PageWidth;this.BoundingRectangle.Width>f&&this._UpdateContainer(n,t,i,r,u,f)},n.prototype._ShowReviewPanel=function(n,t,i,r,u){var f=this.BoundingRectangle.Width+this.ReviewPanelWidth;this.Viewer.OwnerControl.isReviewPanelShown=!0;this.BoundingRectangle.Width<this.Section.SectionFormat.PageWidth+this.ReviewPanelWidth&&this._UpdateContainer(n,t,i,r,u,f);this.Viewer.OwnerControl.isReviewPanelShown=!1},n.prototype._ShowBorder=function(n,t,i){if(n!=null||n!=undefined){var r=n.getContext("2d"),u=t.ZoomFactor;r.beginPath();i&&(u=1);r.moveTo(this.BoundingRectangle.Width-this.ReviewPanelWidth,0);r.lineTo(this.BoundingRectangle.Width-this.ReviewPanelWidth,this.BoundingRectangle.Height);r.strokeStyle="rgb(217, 220, 221)";r.stroke();r.closePath()}},n.prototype._RenderWidgets=function(){var i=document.getElementById(this.Id+"_background").getContext("2d"),r=document.getElementById(this.Id+"_selection").getContext("2d"),u=document.getElementById(this.Id+"_foreground").getContext("2d"),t=document.getElementById(this.Id+"_resize"),n;for(this._SetZoomTransform(i,u,r,t,this),this.Section.SectionFormat.PageWidth<this.BoundingRectangle.Width&&this._ShowBorder(document.getElementById(this.Id+"_background"),this.Viewer,!0),this.HeaderWidget!=null&&this.HeaderWidget._render(this),this.FooterWidget!=null&&this.FooterWidget._render(this),n=0;n<this.BodyWidgets.length;n++)this.BodyWidgets[n]._render(this);t!=null&&this.Viewer.IsImageResizing&&this.Viewer.ImageResizer._RenderImageResizer(this)},n.prototype._RemoveWidgets=function(){var f=document.getElementById(this.Id+"_background"),n,r,t,u,i;f!=null&&(n=f.getContext("2d"),n.beginPath(),n.save(),n.setTransform(1,0,0,1,0,0),n.scale(2,2),n.clearRect(0,0,f.width,f.height),n.restore());r=document.getElementById(this.Id+"_selection");r!=null&&(t=r.getContext("2d"),t.beginPath(),t.save(),t.setTransform(1,0,0,1,0,0),t.scale(2,2),t.clearRect(0,0,r.width,r.height),t.restore());u=document.getElementById(this.Id+"_foreground");u!=null&&(i=u.getContext("2d"),i.beginPath(),i.save(),i.setTransform(1,0,0,1,0,0),i.scale(2,2),i.clearRect(0,0,u.width,u.height),i.restore())},n.prototype._RenderWidget=function(n){var i=document.getElementById(this.Id+"_background").getContext("2d"),r=document.getElementById(this.Id+"_selection").getContext("2d"),u=document.getElementById(this.Id+"_foreground").getContext("2d"),f=document.getElementById(this.Id+"_resize"),t;for(this._SetZoomTransform(i,u,r,f,this),t=0;t<this.BodyWidgets.Count;t++)if(this.BodyWidgets[t]._Render(n))break},n.prototype._RenderCanvas=function(){var n=document.createElement("canvas"),i,t;for(n.style.position="absolute",n.style.borderStyle="solid",n.style.borderWidth="1px",n.setAttribute("width",this.BoundingRectangle.Width.toString()),n.setAttribute("height",this.BoundingRectangle.Height.toString()),i=null,this.Viewer instanceof w&&(i=this.Viewer),this.Section.SectionFormat.PageWidth<this.BoundingRectangle.Width&&this._ShowBorder(n,i,!0),this.HeaderWidget!=null&&this.HeaderWidget._renderCanvas(n),this.FooterWidget!=null&&this.FooterWidget._renderCanvas(n),t=0;t<this.BodyWidgets.length;t++)this.BodyWidgets[t]._renderCanvas(n);return n},n.prototype._SetZoomTransform=function(n,t,i,r,u){n.setTransform(u.Viewer.ZoomFactor,0,0,u.Viewer.ZoomFactor,1,1);t.setTransform(u.Viewer.ZoomFactor,0,0,u.Viewer.ZoomFactor,1,1);i.setTransform(u.Viewer.ZoomFactor,0,0,u.Viewer.ZoomFactor,1,1);n.scale(2,2);t.scale(2,2);i.scale(2,2);u.Viewer.TouchStart.style.zoom=u.Viewer.ZoomFactor*100+"%";u.Viewer.TouchEnd.style.zoom=u.Viewer.ZoomFactor*100+"%";u.Viewer.caret.style.zoom=u.Viewer.ZoomFactor*100+"%";this._SetResizerZoomTransform(u)},n.prototype._SetResizerZoomTransform=function(n){if(n!=null){var t=this.Viewer.ImageResizer,i=n.Viewer.ZoomFactor;t.resizeContainerDiv!=null&&(t.resizeContainerDiv.style.zoom=i*100+"%");t.bottomLeftRect!=null&&(t.bottomLeftRect.style.zoom=i*100+"%");t.bottomRightRect!=null&&(t.bottomRightRect.style.zoom=i*100+"%");t.bottomMiddleRect!=null&&(t.bottomMiddleRect.style.zoom=i*100+"%");t.topRightRect!=null&&(t.topRightRect.style.zoom=i*100+"%");t.topMiddleRect!=null&&(t.topMiddleRect.style.zoom=i*100+"%");t.topLeftRect!=null&&(t.topLeftRect.style.zoom=i*100+"%");t.leftMiddleRect!=null&&(t.leftMiddleRect.style.zoom=i*100+"%");t.rightMiddleRect!=null&&(t.rightMiddleRect.style.zoom=i*100+"%")}},n.prototype._ClearTransform=function(n,t,i){n.setTransform(1,0,0,1,0,0);t.setTransform(1,0,0,1,0,0);i.setTransform(1,0,0,1,0,0);n.scale(2,2);t.scale(2,2);i.scale(2,2)},n.prototype._Dispose=function(){this.HeaderWidget=null;this.FooterWidget=null;this.Section=null;this._RemoveWidgets(this.Viewer);this.BodyWidgets!=null&&(this.BodyWidgets._Clear(),this.BodyWidgets=null);this.Viewer!=null&&(this.Viewer.Pages!=null&&this.Viewer._RemovePage(this),this.Viewer=null)},n}();t.Page=pf;oi=function(){function n(){this.X=0;this.Y=0;this.Width=0;this.Height=0;this.ChildWidgets=new h}return n.prototype._UpdateClientAreaLocation=function(n){this.X=n.X;this.Y=n.Y;this.Width=n.Width},n.prototype._UpdateWidgetLocation=function(n){this.X=n.X;this.Y=n.Y;this.Width=n.Width},n.prototype._GetPage=function(){var n=null,t;return this.ContainerWidget instanceof wt?(t=this.ContainerWidget,n=this.ContainerWidget.Page):this.ContainerWidget!=null&&(n=this.ContainerWidget._GetPage()),n},n.prototype._RenderSingleBorder=function(n,t,i,r,u,f,e){n.beginPath();n.moveTo(i,r);n.lineTo(u,f);n.lineWidth=e;n.strokeStyle=t.Color?t.Color:"#000000";e>=0&&n.stroke();n.closePath()},n.prototype._ClearChildSelectionHighlight=function(t){for(var i=0;i<this.ChildWidgets.Count;i++)this.ChildWidgets[i]instanceof ru?this.ChildWidgets[i]._ClearSelectionHighlight(t):this.ChildWidgets[i]instanceof ii?this.ChildWidgets[i]._ClearSelectionHighlight(t):this.ChildWidgets[i]instanceof n&&this.ChildWidgets[i]._ClearChildSelectionHighlight(t)},n.prototype._UpdateContainerWidget=function(n,t){this.ContainerWidget!=null&&(this.ContainerWidget.ChildWidgets._Remove(this),this.ContainerWidget.Height-=this.Height,(this.ContainerWidget.ChildWidgets==null||this.ContainerWidget.ChildWidgets.Count==0)&&this.ContainerWidget instanceof wt&&this.ContainerWidget._Dispose());n.ChildWidgets._Insert(t,this);n.Height+=this.Height;this.ContainerWidget=n},n.prototype._UpdateContainerWidgetForCell=function(n){var u=this,i,r,t;this.ContainerWidget!=null&&(this.ContainerWidget.ChildWidgets._Remove(this),this.ContainerWidget.Height-=this.Height,(this.ContainerWidget.ChildWidgets==null||this.ContainerWidget.ChildWidgets.Count==0)&&this.ContainerWidget instanceof ii&&this.ContainerWidget._Dispose());n.ChildWidgets._Add(this);this.ContainerWidget=n;i=n.Y;n.ChildWidgets.Count>1?(r=n.ChildWidgets[n.ChildWidgets.Count-2],t=new p(this.X,r.Y+r.Height),n.Height=t.Y+this.Height-i,this.X=t.X,this.Y=t.Y,i=t.Y):(t=new p(this.X,i),n.Height=t.Y+this.Height-i);u instanceof ci&&u._UpdateChildLocation(i)},n}();t.Widget=oi;wt=function(t){function i(n){t.call(this);this.CurrentNode=n}return n(i,t),i.prototype._renderComment=function(){},i.prototype._renderCommentCanvas=function(){},i.prototype._render=function(n){var i=document.getElementById(n.Id+"_foreground"),r,t,u;if(i!=null)for(r=i.getContext("2d"),r.globalAlpha=1,t=0;t<this.ChildWidgets.length;t++)u=this.ChildWidgets[t],u._render(n)},i.prototype._renderCanvas=function(n){var t,i;if(this.ChildWidgets!=null)for(t=0;t<this.ChildWidgets.length;t++)i=this.ChildWidgets[t],i._renderCanvas(n)},i.prototype._Render=function(n){var u=pi.Continuous,i,r,t;if(u=n.OwnerControl.LayoutType,i=this.Y,u==pi.Continuous&&(n.CurrentPage.BoundingRectangle.Top>(i+this.Height)*n.ZoomFactor||n.CurrentPage.BoundingRectangle.Bottom<i*n.ZoomFactor))return n.VisibleBounds.Bottom<i*n.ZoomFactor;for(r=!1,t=0;t<this.ChildWidgets.Count;t++)if(r=this.ChildWidgets[t]instanceof ri?this.ChildWidgets[t]._Render(n):this.ChildWidgets[t]._Render(n),r)return!0;return!1},i.prototype._ShiftChildLocation=function(n){var i,t,r;for(this.Y+=n,i=0;i<this.ChildWidgets.length;i++)t=this.ChildWidgets[i],t instanceof ri?(t.X=t.X,t.Y=t.Y+n):(r=null,t instanceof ci&&(r=t),r!=null&&r._ShiftChildLocation(n))},i.prototype._GetLineWidget=function(n){for(var u,i,t,r=0;r<this.ChildWidgets.length;r++)if(t=this.ChildWidgets[r],t instanceof oi&&t.Y<=n.Y&&t.Y+t.Height>=n.Y)return t._GetLineWidget(n);return u=null,this.ChildWidgets.length>0&&(i=this.ChildWidgets[0],i instanceof oi&&i.Y<=n.Y?u=this.ChildWidgets[this.ChildWidgets.length-1]._GetLineWidget(n):(t=null,i instanceof oi&&(t=i),t!=null&&(u=i._GetLineWidget(n)))),u},i.prototype._CreateOrGetNextBodyWiget=function(n){var f=null,u,e,t,i,r;return n instanceof st?(u=n.CurrentPage,e=u.BodyWidgets._IndexOf(this)+1,e<u.BodyWidgets.Count)?u.BodyWidgets[e]:null:(t=0,t=n.Pages._IndexOf(this.Page),i=null,r=null,this.CurrentNode instanceof ct&&(r=this.CurrentNode),t==n.Pages.Count-1||n.Pages[t+1].Section!=r?(i=n._CreateNewPage(r),n.Pages[t+1].Section!=r&&n._InsertPage(t+1,i),f=i.BodyWidgets[0]):(i=n.Pages[t+1],f=i.BodyWidgets[0]),f)},i.prototype._UpdateHorizontalWidth=function(n,t){for(var i,o,s,f,e,h,c,r,u=0;u<this.ChildWidgets.Count;u++)if(i=this.ChildWidgets[u],i instanceof ri)for(o=i,s=i.CurrentNode.ParagraphFormat.TextAlignment,(s==rt.Right||s==rt.Center)&&n._Add(i),f=0;f<o.ChildWidgets.Count;f++)e=o.ChildWidgets[f],e.Children.Count>0&&(h=e.Children[0],h.Margin.Left=0),r=i.X+e._GetWidth(!0),r>t.VisibleBounds.Width&&r>t.HorizontalWidth&&(t.HorizontalWidth=r);else c=i,r=i.X+c.Table._GetTableWidth(),r>t.VisibleBounds.Width&&r>t.HorizontalWidth&&(t.HorizontalWidth=r)},i.prototype._GetTableCellWidget=function(n,t){for(var r,i=0;i<this.ChildWidgets.Count;i++)if(this.ChildWidgets[i].Y<=n.Y&&this.ChildWidgets[i].Y+this.ChildWidgets[i].Height>=n.Y)return this.ChildWidgets[i]._GetTableCellWidget(n,t);return r=null,this.ChildWidgets.Count>0&&t&&(r=this.ChildWidgets[0].Y<=n.Y?this.ChildWidgets[this.ChildWidgets.Count-1]._GetTableCellWidget(n,t):this.ChildWidgets[0]._GetTableCellWidget(n,t)),r},i.prototype._GetTableWidget=function(n){for(var t=0;t<this.ChildWidgets.Count;t++)if(this.ChildWidgets[t]instanceof ci&&this.ChildWidgets[t].Y<=n.Y&&this.ChildWidgets[t].Y+this.ChildWidgets[t].Height>=n.Y)return this.ChildWidgets[t];return null},i.prototype._Dispose=function(){var i=this.Height,t,n;if(this.ChildWidgets!=null){for(t=0;t<this.ChildWidgets.Count;t++){if(n=this.ChildWidgets[t],n instanceof ri?n._Dispose():n instanceof li?n._Dispose():n._Dispose(),this.ChildWidgets==null)break;this.ChildWidgets._Remove(n);t--}this.ChildWidgets=null}this.ContainerWidget!=null&&(this.ContainerWidget.ChildWidgets!=null&&(this.ContainerWidget.ChildWidgets._Remove(this),this.ContainerWidget.Height-=i),this.ContainerWidget=null);this instanceof wf&&this.CurrentNode!=null?(this.CurrentNode.LayoutedWidgets!=null&&this.CurrentNode.LayoutedWidgets._Remove(this),this.CurrentNode=null):this instanceof ar?(n=this,n.Comment!=null&&(n.Comment.LayoutedWidget!=null&&(n.Comment.LayoutedWidget=null),this.CurrentNode=null)):this.CurrentNode instanceof ct&&(this.CurrentNode.BodyWidgets!=null&&this.CurrentNode.BodyWidgets._Remove(this),this.CurrentNode=null);this.Page!=null&&(this.Page.BodyWidgets!=null&&this.Page.BodyWidgets._Contains(this)?(this.Page.BodyWidgets._Remove(this),this.Page.BodyWidgets.Count==0&&this.Page._Dispose()):this.Page.HeaderWidget==this?this.Page.HeaderWidget=null:this.Page.FooterWidget==this?this.Page.FooterWidget=null:this.Page.CommentWidgets!=null&&this instanceof ar&&this.Page.CommentWidgets._Contains(this)&&(this.Page.CommentWidgets._Remove(this),this.Page._AdjustCommentWidgets()),this.Page=null)},i}(oi);t.BodyWidget=wt;wf=function(t){function i(n){t.call(this,n)}return n(i,t),i.prototype._render=function(n){var i=document.getElementById(n.Id+"_foreground"),r,t,u;if(i!=null)for(r=i.getContext("2d"),r.globalAlpha=.75,t=0;t<this.ChildWidgets.length;t++)u=this.ChildWidgets[t],u._render(n)},i.prototype._renderCommentCanvas=function(){},i.prototype._renderCanvas=function(n){var i,t,r;if(n!=null)for(i=n.getContext("2d"),i.globalAlpha=.75,t=0;t<this.ChildWidgets.length;t++)r=this.ChildWidgets[t],r._renderCanvas(n)},i.prototype._GetLineWidget=function(n){for(var i,t=0;t<this.ChildWidgets.length;t++)if(this.ChildWidgets[t]instanceof oi&&this.ChildWidgets[t].Y<=n.Y&&this.ChildWidgets[t].Y+this.ChildWidgets[t].Height>=n.Y)return this.ChildWidgets[t]._GetLineWidget(n);return i=null,this.ChildWidgets.length>0&&(i=this.ChildWidgets[0]instanceof oi&&this.ChildWidgets[0].Y<=n.Y?this.ChildWidgets[this.ChildWidgets.length-1]._GetLineWidget(n):this.ChildWidgets[0]._GetLineWidget(n)),i},i}(wt);t.HeaderFooterWidget=wf;ci=function(t){function i(n){t.call(this);this.leftMargin=0;this.topMargin=0;this.rightMargin=0;this.bottomMargin=0;this.CurrentNode=n;n instanceof e&&(this.Table=n);this.Margin=new wr(this.leftMargin,this.topMargin,this.rightMargin,this.bottomMargin);this.LeftBorderWidth=0;this.RightBorderWidth=0;this.TopBorderWidth=0;this.BottomBorderWidth=0}return n(i,t),i.prototype._renderCommentCanvas=function(n,t,i){var o=this.X,s=this.Y,u,f,r,e;for(this.ContainerWidget instanceof ar&&(u=this.CurrentNode.OwnerBase.OwnerBase.OwnerBase.SectionFormat,this.Y=i+=this.Y,this.X=t=this.X+u.PageWidth),this.CurrentNode.TableFormat.CellSpacing>0&&(f=n.getContext("2d"),this._RenderTableOutline(f)),r=0;r<this.ChildWidgets.length;r++)e=this.ChildWidgets[r],e._renderCommentCanvas(n,t,i);this.X=o;this.Y=s},i.prototype._renderComment=function(n,t,i){var s=this.X,h=this.Y,u,f,e,r,o;for(this.ContainerWidget instanceof ar&&(u=this.CurrentNode.OwnerBase.OwnerBase.OwnerBase.SectionFormat,this.Y=i+=this.Y,this.X=t=this.X+u.PageWidth),f=document.getElementById(n.Id+"_background"),this.CurrentNode.TableFormat.CellSpacing>0&&(e=f.getContext("2d"),this._RenderTableOutline(e)),r=0;r<this.ChildWidgets.length;r++)o=this.ChildWidgets[r],o._renderComment(n,t,i);this.X=s;this.Y=h},i.prototype._render=function(n){var u=document.getElementById(n.Id+"_background"),i,t,r;for(this.CurrentNode.TableFormat.CellSpacing>0&&(i=u.getContext("2d"),this._RenderTableOutline(i)),t=0;t<this.ChildWidgets.length;t++)r=this.ChildWidgets[t],r._render(n)},i.prototype._renderCanvas=function(n){var i,t,r;for(this.CurrentNode.TableFormat.CellSpacing>0&&(i=n.getContext("2d"),this._RenderTableOutline(i)),t=0;t<this.ChildWidgets.length;t++)r=this.ChildWidgets[t],r._renderCanvas(n)},i.prototype._Render=function(n){var u=pi.Continuous,f,e,o,s,t,r,i;if(u=n.OwnerControl.LayoutType,f=this.Table.TableFormat.CellSpacing,u==pi.Continuous&&(n.CurrentPage.BoundingRectangle.Top>(this.Y+this.Height)*n.ZoomFactor||n.CurrentPage.BoundingRectangle.Bottom<this.Y*n.ZoomFactor))return n.VisibleBounds.Bottom<this.Y*n.ZoomFactor;for(e=n.CurrentPage,f>0&&(o=document.getElementById(e.Id+"_background"),s=o.getContext("2d")),t=0;t<this.ChildWidgets.Count;t++)for(r=this.ChildWidgets[t],i=0;i<r.ChildWidgets.Count;i++)if(r.ChildWidgets[i]._Render(n))return!0;return!1},i.prototype._UpdateHeight=function(n){for(var i,r,t=0;t<this.ChildWidgets.length;t++)i=null,r=this.ChildWidgets[t],r instanceof li&&(i=r),i!=null&&i._UpdateHeight(n,!0)},i.prototype._ShiftChildLocation=function(n){var t,i,r;for(this.Y=this.Y+n,t=0;t<this.ChildWidgets.Count;t++)i=null,r=this.ChildWidgets[t],r instanceof li&&(i=r),i!=null&&i._ShiftChildLocation(n)},i.prototype._GetSplittedWidget=function(n){for(var u,e,o,r,s=this.Y,t=null,f=0;f<this.ChildWidgets.length;f++){if(u=null,e=this.ChildWidgets[f],e instanceof li&&(u=e),o=u.Height,(n<s+o||t!=null)&&(r=t==null&&u._IsFirstLineFit(n)?u._GetSplittedWidget(n):u,r!=null)){if(f==0&&r==u)return this;this.ChildWidgets._Contains(r)?(this.ChildWidgets._RemoveAt(this.ChildWidgets.indexOf(r)),f--,this.Height-=r.Height):this.Height-=o-u.Height;t==null?(t=new i(this.Table),t._UpdateWidgetLocation(this),this.Table.TableWidgets._Add(t),t.Height=r.Height):t.Height+=r.Height;t.ChildWidgets._Add(r);r.ContainerWidget=t}s+=u.Height}return t},i.prototype._IsFirstLineFit=function(n){var t=null,i=this.ChildWidgets[0];return i instanceof li&&(t=i),t!=null?t._IsFirstLineFit(n):void 0},i.prototype._UpdateChildLocation=function(n){for(var t,i=0;i<this.ChildWidgets.length;i++)t=this.ChildWidgets[i],t.X=t.X,t.Y=n,t._UpdateChildLocation(n),n+=t.Height},i.prototype._GetLineWidget=function(n){for(var f,t,u,s,h,e,r=null,o=0;o<this.ChildWidgets.Count;o++)if(f=this.ChildWidgets[o],f instanceof li&&f.Y<=n.Y){r=f._GetLineWidget(n);t=null;r!=null&&r.CurrentParagraphWidget.ContainerWidget instanceof ii&&(t=r.CurrentParagraphWidget.ContainerWidget);u=0;s=0;t!=null&&(u=t.TableCell.OwnerTable.TableFormat.CellSpacing,s=t.TableCell.CellFormat.RowSpan);var c=0,l=0,a=0,v=0;if(u>0&&(c=t.TableCell.CellIndex==0?u:u/2,l=t.TableCell.CellIndex==t.TableCell.OwnerRow.Cells.Count-1?u:u/2,h=null,t.ContainerWidget instanceof li&&(h=t.ContainerWidget),e=null,t.ContainerWidget.ContainerWidget instanceof i&&(e=t.ContainerWidget.ContainerWidget),h!=null&&e!=null&&e.Table.TableWidgets.Count>0&&(a=t.TableCell.OwnerRow.RowIndex==0?u:u/2,v=t.TableCell.OwnerRow.RowIndex+s==t.TableCell.OwnerTable.Rows.Count?u:u/2)),r!=null&&r.CurrentParagraphWidget.X<=n.X&&r.CurrentParagraphWidget.X+r.Width>=n.X&&r.CurrentParagraphWidget.Y<=n.Y&&r._GetTop()+r.Height>=n.Y||t!=null&&t.X-t.Margin.Left-c<=n.X&&t.X+t.Width+t.Margin.Right+l>=n.X&&t.Y-t.Margin.Top-a<=n.Y&&t.Y+t.Height+t.Margin.Bottom+v>=n.Y)break}return r},i.prototype._RenderTableOutlines=function(n){var t,i,r,u;if(this.ContainerWidget!=null){for(t=this.ContainerWidget;t.ContainerWidget instanceof oi;)t=t.ContainerWidget;i=null;t instanceof wt&&(i=t.Page);r=document.getElementById(i.Id+"_background");u=r.getContext("2d");(n instanceof w&&n.VisiblePages._Contains(i)||n instanceof st&&n.CurrentPage==i)&&this._RenderTableOutline(u)}},i.prototype._RenderTableOutline=function(n){var r=this.CurrentNode,i=r.TableFormat.Borders._GetTableTopBorder(),t=0;i!=null&&(t=i._GetLineWidth(),this._RenderSingleBorder(n,i,this.X-this.Margin.Left-t/2,this.Y,this.X-this.Margin.Left-t/2,this.Y+this.Height,t));i=r.TableFormat.Borders._GetTableTopBorder();t=0;i!=null&&(t=i._GetLineWidth(),this._RenderSingleBorder(n,i,this.X-this.Margin.Left-t,this.Y-t/2,this.X+this.Width+t+this.Margin.Right,this.Y-t/2,t));i=r.TableFormat.Borders._GetTableRightBorder();t=0;i!=null&&(t=i._GetLineWidth(),this._RenderSingleBorder(n,i,this.X+this.Width+this.Margin.Right+t/2,this.Y,this.X+this.Width+this.Margin.Right+t/2,this.Y+this.Height,t));i=r.TableFormat.Borders._GetTableBottomBorder();t=0;i!=null&&(t=i._GetLineWidth(),this._RenderSingleBorder(n,i,this.X-this.Margin.Left-t,this.Y+this.Height-t/2,this.X+this.Width+t+this.Margin.Right,this.Y+this.Height-t/2,t))},i.prototype._GetTableCellWidget=function(n,t){for(var r=null,i=0;i<this.ChildWidgets.Count;i++)if(this.ChildWidgets[i].Y<=n.Y&&this.ChildWidgets[i].Y+this.ChildWidgets[i].Height>=n.Y){r=this.ChildWidgets[i]._GetTableCellWidget(n,t);break}return r},i.prototype._Dispose=function(){var r=this.Height,n,t,i;if(this.ChildWidgets!=null){for(n=0;n<this.ChildWidgets.Count;n++){if(t=null,i=this.ChildWidgets[n],i instanceof li&&(t=i),t!=null&&t._Dispose(),this.ChildWidgets==null)break;this.ChildWidgets._Remove(t);n--}this.ChildWidgets=null}this.Table!=null&&(this.Table.TableWidgets!=null&&this.Table.TableWidgets._Remove(this),this.Table=null);this.ContainerWidget!=null&&(this.ContainerWidget.ChildWidgets!=null&&(this.ContainerWidget.ChildWidgets._Remove(this),this.ContainerWidget.Height-=r,(this.ContainerWidget.ChildWidgets==null||this.ContainerWidget.ChildWidgets.Count==0)&&this.ContainerWidget instanceof wt&&this.ContainerWidget._Dispose()),this.ContainerWidget=null)},i}(oi);t.TableWidget=ci;li=function(t){function i(n){t.call(this);this.TableRow=null;this.CurrentNode=n;n instanceof bt&&(this.TableRow=n);this.TopBorderWidth=0;this.BottomBorderWidth=0}return n(i,t),i.prototype._renderCommentCanvas=function(n,t,i){var f=this.X,e=this.Y,r,u;for(this.X=t,this.Y=i,r=0;r<this.ChildWidgets.length;r++)u=this.ChildWidgets[r],u._renderCommentCanvas(n,t,i);this.X=f;this.Y=e},i.prototype._renderComment=function(n,t,i){var f=this.X,e=this.Y,r,u;for(this.X=t,this.Y=i,r=0;r<this.ChildWidgets.length;r++)u=this.ChildWidgets[r],u._renderComment(n,t,i);this.X=f;this.Y=e},i.prototype._render=function(n){for(var i,t=0;t<this.ChildWidgets.length;t++)i=this.ChildWidgets[t],i._render(n)},i.prototype._renderCanvas=function(n){for(var i,t=0;t<this.ChildWidgets.length;t++)i=this.ChildWidgets[t],i._renderCanvas(n)},i.prototype._splitSpannedCellWidget=function(n,t){var i=n._GetSplittedWidget(t.ClientArea.Bottom,!1);i!=null&&t.SplittedCellWidgets._Add(i)},i.prototype._UpdateHeight=function(n,t){for(var l,a,s,u,p,v,h,e,f,c=0;c<this.ChildWidgets.length;c++){var o=0,r=null,y=this.ChildWidgets[c];for(y instanceof ii&&(r=y),l=1,l=r.TableCell.CellFormat.RowSpan,o=r.TableCell.OwnerTable.TableFormat.CellSpacing,l>1?(a=this.ContainerWidget.ChildWidgets.indexOf(this),s=a+l-1-(this.TableRow.RowIndex-r.TableCell.OwnerRow.RowIndex),(n.ClientArea.Bottom<r.Y+r.Height+r.Margin.Bottom||s>=a+1)&&this._splitSpannedCellWidget(r,n),u=this,s>0&&(s<this.ContainerWidget.ChildWidgets.length?(p=null,v=this.ContainerWidget.ChildWidgets[s],v instanceof i&&(u=v)):u=this.ContainerWidget.ChildWidgets[this.ContainerWidget.ChildWidgets.length-1]),r.Y+r.Height+r.Margin.Bottom<u.Y+u.Height?r.Height=u.Y+u.Height-r.Y-r.Margin.Bottom:this.ContainerWidget.ContainerWidget!=null&&r.Y+r.Height+r.Margin.Bottom>u.Y+u.Height&&(u.Height=r.Y+r.Height+r.Margin.Bottom-u.Y,this==u&&this.TableRow.NextNode instanceof bt&&(h=this.TableRow.NextNode,h.TableRowWidgets.length>0&&(h.TableRowWidgets[0].X=h.TableRowWidgets[0].X,h.TableRowWidgets[0].Y=this.Y+this.Height)))):(o>0&&this.TableRow.OwnerTable.TableWidgets.Count>1&&this.Y==this.TableRow.OwnerTable.Document.OwnerControl.Viewer.ClientArea.Y&&n instanceof w&&(o=o/2),r.Height=this.Height-r.Margin.Top-r.Margin.Bottom-o),r._UpdateHeight(n),e=this.ContainerWidget;e.ContainerWidget instanceof oi;)e=e.ContainerWidget;f=null;e instanceof wt&&(f=e.Page);(n instanceof w&&n.VisiblePages._Contains(f)||n instanceof st&&n.CurrentPage==f||t)&&r._UpdateCellVerticalPosition(!1,!1);n instanceof w&&n.VisiblePages._Contains(f)?(n.CommentWidgets.Count>0&&n._MoveCommentsToPage(f),this.TableRow!=null&&this.TableRow.RowFormat!=null&&r._render(f)):n instanceof st&&n.CurrentPage==f&&r._Render(n)}},i.prototype._GetSplittedWidget=function(n){for(var u,t,e,r=null,o=this.TableRow.RowIndex,f=0;f<this.ChildWidgets.length;f++)if(u=this.ChildWidgets[f],t=u._GetSplittedWidget(n,!0),t!=null){if(t==u)return this;this.ChildWidgets._Contains(t)&&this.ChildWidgets._Remove(t);(f==0||this.Height<u.Height+u.Margin.Top+u.Margin.Bottom)&&(this.Height=u.Height+u.Margin.Top+u.Margin.Bottom);r==null&&(r=new i(this.TableRow),r._UpdateWidgetLocation(this),this.TableRow.TableRowWidgets._Add(r),r.Height=0);e=1;e=t==null||t.TableCell==null||t.TableCell.CellFormat==null?e:t.TableCell.CellFormat.RowSpan;o-t.TableCell.OwnerRow.RowIndex==e-1&&r.Height<t.Height+t.Margin.Top+t.Margin.Bottom&&(r.Height=t.Height+t.Margin.Top+t.Margin.Bottom);r.ChildWidgets._Add(t);t.ContainerWidget=r}return r},i.prototype._IsFirstLineFit=function(n){for(var i,t=0;t<this.ChildWidgets.length;t++)if(i=this.ChildWidgets[t],!i._IsFirstLineFit(n))return!1;return!0},i.prototype._InsertSplittedCellWidgets=function(n){for(var t=this.X,o=0,u,r,f,e,o=this.TableRow.OwnerTable.TableWidth,i=0;i<this.ChildWidgets.length;i++){if(u=this.ChildWidgets[i],Math.round(t)<Math.round(u.X-u.Margin.Left)){if(this._InsertRowSpannedWidget(n,t,i)){i--;continue}if(e=this.ChildWidgets.length,this._InsertEmptySplittedCellWidget(t,i),e<this.ChildWidgets.length){i--;continue}}if(t+=u.Margin.Left+u.Width+u.Margin.Right,i==this.ChildWidgets.length-1&&Math.round(t)<Math.round(this.X+o)){if(this._InsertRowSpannedWidget(n,t,i+1))continue;this._InsertEmptySplittedCellWidget(t,i+1);continue}if((this.ChildWidgets==null||this.ChildWidgets.Count==0)&&n.SplittedCellWidgets.Count>0)for(r=0;r<n.SplittedCellWidgets.Count;r++){if(f=n.SplittedCellWidgets[r],Math.round(t)<=Math.round(f.X-f.Margin.Left)){if(this._InsertRowSpannedWidget(n,t,r)){r--;continue}if(e=this.ChildWidgets.Count,this._InsertEmptySplittedCellWidget(t,r),e<this.ChildWidgets.Count){r--;continue}}if(t+=f.Margin.Left+f.Width+f.Margin.Right,r==this.ChildWidgets.Count-1&&Math.round(t)<Math.round(this.X+o)){if(this._InsertRowSpannedWidget(n,t,r+1))continue;this._InsertEmptySplittedCellWidget(t,r+1);continue}}n.SplittedCellWidgets.Count>0&&n.SplittedCellWidgets._Clear()}},i.prototype._InsertRowSpannedWidget=function(n,t,i){var f=0,u,r;for(this.TableRow.OwnerTable.TableFormat.CellSpacing>0&&(f=this.TableRow.OwnerTable.TableFormat.CellSpacing),u=0;u<n.SplittedCellWidgets.length;u++)if(r=n.SplittedCellWidgets[u],Math.round(t)==Math.round(r.X-r.Margin.Left))return this.ChildWidgets._Insert(i,r),r.ContainerWidget=this,r.Y!=this.Y+r.Margin.Top+f&&this._UpdateChildLocation(this.Y),n.SplittedCellWidgets._Remove(r),!0;return!1},i.prototype._InsertEmptySplittedCellWidget=function(n,t){for(var r,o,u,f,i,s,h=this.TableRow.OwnerTable.TableWidgets[this.TableRow.OwnerTable.TableWidgets.length-1],e=h.ChildWidgets.length-1;e>=0;e--)for(r=h.ChildWidgets[e],o=r.X,u=0;u<r.ChildWidgets.length;u++){if(f=1,i=r.ChildWidgets[u],Math.round(n)==Math.round(o)){f=i==null||i.TableCell==null||i.TableCell.CellFormat==null?f:i.TableCell.CellFormat.RowSpan;f>1&&(s=i._CreateCellWidget(),this.ChildWidgets._Insert(t,s),s.ContainerWidget=this);return}o+=i.Margin.Left+i.Width+i.Margin.Right}},i.prototype._UpdateChildLocation=function(n){var r=0,i,t;for(this.TableRow.OwnerTable.TableFormat.CellSpacing>0&&(r=this.TableRow.OwnerTable.TableFormat.CellSpacing),i=0;i<this.ChildWidgets.length;i++)t=this.ChildWidgets[i],t.X=t.X,t.Y=n+t.Margin.Top+r,t._UpdateChildLocation(t.Y)},i.prototype._ShiftChildLocation=function(n){this.Y=this.Y+n;for(var t=0;t<this.ChildWidgets.Count;t++)this.ChildWidgets[t]._ShiftChildLocation(n)},i.prototype._GetLineWidget=function(n){for(var i,r,u,f,t=0;t<this.ChildWidgets.length;t++)if(i=0,i=this.TableRow.OwnerTable.TableFormat.CellSpacing,r=0,u=0,i>0&&(r=this.ChildWidgets[t].TableCell.ColumnIndex==0?i:i/2,u=this.ChildWidgets[t].TableCell.CellIndex==this.ChildWidgets[t].TableCell.OwnerRow.Cells.Count-1?i:i/2),this.ChildWidgets[t].X-this.ChildWidgets[t].Margin.Left-r<=n.X&&this.ChildWidgets[t].X+this.ChildWidgets[t].Width+this.ChildWidgets[t].Margin.Right+u>=n.X)return this.ChildWidgets[t]._GetLineWidget(n);return f=null,this.ChildWidgets.length>0&&(f=this.ChildWidgets[0].X<=n.X?this.ChildWidgets[this.ChildWidgets.length-1]._GetLineWidget(n):this.ChildWidgets[0]._GetLineWidget(n)),f},i.prototype._UpdateTableWidget=function(n,t){this.ContainerWidget!=null&&(this.ContainerWidget.ChildWidgets._Remove(this),(this.ContainerWidget.ChildWidgets==null||this.ContainerWidget.ChildWidgets.Count==0)&&this.ContainerWidget instanceof ci?this.ContainerWidget._Dispose():this.ContainerWidget.ContainerWidget instanceof wt&&(this.ContainerWidget.ContainerWidget.Height-=this.Height),this.ContainerWidget.Height-=this.Height);n.ChildWidgets._Insert(t,this);n.Height+=this.Height;this.ContainerWidget=n},i.prototype._GetTableCellWidget=function(n,t){for(var r,i=0;i<this.ChildWidgets.Count;i++)if(this.ChildWidgets[i].X-this.ChildWidgets[i].Margin.Left-1<=n.X&&this.ChildWidgets[i].X+this.ChildWidgets[i].Width>=n.X||i==this.ChildWidgets.Count-1&&this.ChildWidgets[i].X+this.ChildWidgets[i].Width+1<=n.X)return this.ChildWidgets[i];return r=null,this.ChildWidgets.Count>0&&t&&(r=this.ChildWidgets[0].X<=n.X?this.ChildWidgets[this.ChildWidgets.Count-1]._GetTableCellWidget(n,t):this.ChildWidgets[0]._GetTableCellWidget(n,t)),r},i.prototype._GetActualWidth=function(){var t=0,n;if(this.ChildWidgets.Count>0)for(n=0;n<this.ChildWidgets.Count;n++)t+=this.ChildWidgets[n].TableCell.CellFormat.CellWidth;return t},i.prototype._Dispose=function(){var i=this.Height,n,t;if(this.ChildWidgets!=null){for(n=0;n<this.ChildWidgets.Count;n++){if(t=this.ChildWidgets[n],t._Dispose(),this.ChildWidgets==null)break;this.ChildWidgets._Remove(t);n--}this.ChildWidgets=null}this.TableRow!=null&&(this.TableRow.TableRowWidgets!=null&&this.TableRow.TableRowWidgets._Remove(this),this.TableRow=null);this.ContainerWidget!=null&&(this.ContainerWidget.ChildWidgets!=null&&(this.ContainerWidget.ChildWidgets._Remove(this),(this.ContainerWidget.ChildWidgets==null||this.ContainerWidget.ChildWidgets.Count==0)&&this.ContainerWidget instanceof ci?this.ContainerWidget._Dispose():this.ContainerWidget.ContainerWidget instanceof wt&&(this.ContainerWidget.ContainerWidget.Height-=i),this.ContainerWidget.Height-=i),this.ContainerWidget=null)},i}(oi);t.TableRowWidget=li;ii=function(t){function i(n){t.call(this);this.leftMargin=0;this.topMargin=0;this.rightMargin=0;this.bottomMargin=0;this.TableCell=n;this.CurrentNode=n;this.Margin=new wr(this.leftMargin,this.topMargin,this.rightMargin,this.bottomMargin);this.LeftBorderWidth=0;this.RightBorderWidth=0}return n(i,t),i.prototype._renderCommentCanvas=function(n,t,i){var e=this.X,o=this.Y,u,r,f;for(this.X=t,this.Y=i,u=n.getContext("2d"),this._RenderTableCellOutline(u),r=0;r<this.ChildWidgets.length;r++)f=this.ChildWidgets[r],f._renderCommentCanvas(n,t,i);this.X=e;this.Y=o},i.prototype._renderComment=function(n,t,i){var f=this.X,e=this.Y,o,s,r,u;this.X=t;this.Y=i;var h=document.getElementById(n.Id+"_background"),c=h.getContext("2d");for(this._RenderTableCellOutline(c),o=document.getElementById(n.Id+"_selection"),s=o.getContext("2d"),n.Viewer.OwnerControl.Selection.SelectionRanges.Count>0&&n.Viewer.OwnerControl.Selection.SelectionRanges._AddSelectionHighlightTable(s,this),r=0;r<this.ChildWidgets.length;r++)u=this.ChildWidgets[r],u._renderComment(n,this.X-f+u.X,this.Y-e+u.Y);this.X=f;this.Y=e},i.prototype._render=function(n){var f=document.getElementById(n.Id+"_background"),e=f.getContext("2d"),i,r,t,u;for(this._RenderTableCellOutline(e),i=document.getElementById(n.Id+"_selection"),r=i.getContext("2d"),n.Viewer.OwnerControl.Selection.SelectionRanges.Count>0&&n.Viewer.OwnerControl.Selection.SelectionRanges._AddSelectionHighlightTable(r,this),t=0;t<this.ChildWidgets.length;t++)u=this.ChildWidgets[t],u._render(n)},i.prototype._renderCanvas=function(n){var r=n.getContext("2d"),t,i;for(this._RenderTableCellOutline(r),t=0;t<this.ChildWidgets.length;t++)i=this.ChildWidgets[t],i._renderCanvas(n)},i.prototype._Render=function(n){var r=pi.Continuous,i,t,f,e;if(r=n.OwnerControl.LayoutType,r==pi.Continuous&&(n.CurrentPage.BoundingRectangle.Top>(this.Y+this.Height)*n.ZoomFactor||n.CurrentPage.BoundingRectangle.Bottom<this.Y*n.ZoomFactor))return n.VisibleBounds.Bottom<this.Y*n.ZoomFactor;for(i=!1,t=0;t<this.ChildWidgets.Count;t++)i=this.ChildWidgets[t]instanceof ri?this.ChildWidgets[t]._Render(n):this.ChildWidgets[t]._Render(n);var u=n.CurrentPage,o=document.getElementById(u.Id+"_selection"),s=o.getContext("2d");return n.OwnerControl.Selection.SelectionRanges.Count>0&&n.OwnerControl.Selection.SelectionRanges._AddSelectionHighlightTable(s,this),this.TableCell.CellFormat.RowSpan>0&&this.TableCell.CellFormat.ColumnSpan>0&&(f=document.getElementById(u.Id+"_background"),e=f.getContext("2d"),this._RenderTableCellOutline(e)),i},i.prototype._ShiftChildLocation=function(n){this.Y=this.Y+n;for(var t=0;t<this.ChildWidgets.Count;t++)this.ChildWidgets[t]instanceof ri?(this.ChildWidgets[t].X=this.ChildWidgets[t].X,this.ChildWidgets[t].Y=this.ChildWidgets[t].Y+n):this.ChildWidgets[t]._ShiftChildLocation(n)},i.prototype._GetSplittedWidget=function(n,t){var i=null,r,o,u,e,s,f;if(this.Y+this.Height>n-this.Margin.Bottom)for(r=0;r<this.ChildWidgets.length;r++)if(this.ChildWidgets[r]instanceof ri){if(o=this.ChildWidgets[r],u=o._GetSplittedWidget(n-this.Margin.Bottom),u!=null){if(r==0&&u==o)return this;this.ChildWidgets._Contains(u)&&(this.ChildWidgets._Remove(u),r--);this.Height-=u.Height;i==null&&(i=this._CreateCellWidget());i.Height+=u.Height;i.ChildWidgets._Add(u);u.ContainerWidget=i}}else if(e=this.ChildWidgets[r],n-this.Margin.Bottom<e.Y+e.Height&&(s=e.Height,f=e._GetSplittedWidget(n-this.Margin.Bottom),f!=null)){if(r==0&&f==e)return this;this.ChildWidgets._Contains(f)?(this.ChildWidgets._Remove(f),r--,this.Height-=f.Height):this.Height-=s-e.Height;i==null&&(i=this._CreateCellWidget());i.Height+=f.Height;i.ChildWidgets._Add(f);f.ContainerWidget=i}return i==null&&t&&(this.ChildWidgets.length==0&&(this.Height=0),i=this._CreateCellWidget()),i},i.prototype._CreateCellWidget=function(){var n=new i(this.TableCell);return n._UpdateWidgetLocation(this),this.TableCell.TableCellWidgets._Add(n),n.Margin=this.Margin,n.LeftBorderWidth=this.LeftBorderWidth,n.RightBorderWidth=this.RightBorderWidth,n},i.prototype._IsFirstLineFit=function(n){var t,i;return this.ChildWidgets.length==0?!0:this.ChildWidgets[0]instanceof ri?(t=this.ChildWidgets[0],t._IsFirstLineFit(n-this.Margin.Bottom)):(i=this.ChildWidgets[0],i._IsFirstLineFit(n-this.Margin.Bottom))},i.prototype._UpdateHeight=function(n){for(var t=0;t<this.ChildWidgets.length;t++)this.ChildWidgets[t]instanceof ci&&this.ChildWidgets[t]._UpdateHeight(n)},i.prototype._UpdateChildLocation=function(n){for(var t=0;t<this.ChildWidgets.length;t++)this.ChildWidgets[t].X=this.ChildWidgets[t].X,this.ChildWidgets[t].Y=n,this.ChildWidgets[t]instanceof ci&&this.ChildWidgets[t]._UpdateChildLocation(n),n+=this.ChildWidgets[t].Height},i.prototype._GetLineWidget=function(n){for(var i,t=0;t<this.ChildWidgets.length;t++)if(this.ChildWidgets[t].Y<=n.Y&&this.ChildWidgets[t].Y+this.ChildWidgets[t].Height>=n.Y)return this.ChildWidgets[t]._GetLineWidget(n);return i=null,this.ChildWidgets.length>0&&(i=this.ChildWidgets[0].Y<=n.Y?this.ChildWidgets[this.ChildWidgets.length-1]._GetLineWidget(n):this.ChildWidgets[0]._GetLineWidget(n)),i},i.prototype._UpdateCellVerticalPosition=function(n,t){if(this.TableCell.OwnerTable.Owner instanceof ct||t){var i=this._GetDisplacement(n);this._UpdateCellContentVerticalPosition(i,n)}},i.prototype._GetDisplacement=function(n){var i=0,u=this.ContainerWidget,f=this.Margin.Top+this.Margin.Bottom,r,t;return i=this.TableCell!=null&&this.TableCell.CellFormat!=null&&this.TableCell.CellFormat.RowSpan>1?this.Height:(u!=null?u.Height:0)-f,r=this._GetCellContentHeight(),t=0,i>r&&(t=i-r,this.TableCell.CellFormat.VerticalAlignment==or.Center?t=t/2:(this.TableCell.CellFormat.VerticalAlignment==or.Top||n)&&(t=0)),t},i.prototype._GetCellContentHeight=function(){var t,n;if(this.ChildWidgets==null)return 0;for(t=0,n=0;n<this.ChildWidgets.Count;n++)this.ChildWidgets[n]instanceof ri?t+=this.ChildWidgets[n].Height:this.ChildWidgets[n]instanceof ci&&(t+=this.ChildWidgets[n].Height);return t},i.prototype._UpdateCellContentVerticalPosition=function(n,t){var r,i;if(n!=0)for(r=this.Y+n,i=0;i<this.ChildWidgets.Count;i++)this.ChildWidgets[i]instanceof ri?this.ChildWidgets[i].Y=r:this.ChildWidgets[i]instanceof ci&&(r=this._UpdateTableWidgetLocation(this.ChildWidgets[i],r,t)),r=r+this.ChildWidgets[i].Height},i.prototype._UpdateTableWidgetLocation=function(n,t,i){var o,u,r,f,e;for(n.Y=t=t+n.TopBorderWidth,o=0,u=0;u<n.ChildWidgets.Count;u++){for(r=n.ChildWidgets[u],r.Y=t,f=0;f<r.ChildWidgets.Count;f++)e=r.ChildWidgets[f],e.Y=t+e.Margin.Top+o,e._UpdateCellVerticalPosition(i,!0);t=t+r.Height}return t},i.prototype._UpdateWidgetHeight=function(){if(this.ChildWidgets.Count>0){var n=this.ChildWidgets[this.ChildWidgets.Count-1];this.Height=n.Y+n.Height-this.Y}},i.prototype._RenderTableCellOutline=function(n){var f=null,t=this.TableCell,e=0,u=0,o=0,c=0,a=0,i,r,s,l,h;f=t.CellFormat.Borders;u=t.BottomMargin;e=t.TopMargin;o=t.LeftMargin;c=t.RightMargin;a=t.OwnerRow!=null&&t.OwnerRow.RowFormat.HeightType==et.Exactly?t.OwnerRow.RowFormat.Height+e+u:t.OwnerRow!=null&&t.OwnerRow.TableRowWidgets.Count<=1?Math.max(t.OwnerRow.RowFormat.Height,this.Height)+e+u:this.Height+e+u;i=f._GetCellLeftBorder(t);r=0;i!=null&&(r=i._GetLineWidth(),this._RenderSingleBorder(n,i,this.X-o-r/2,this.Y-e,this.X-o-r/2,this.Y+this.Height+u,r));i=f._GetCellTopBorder(t);i!=null&&(r=i._GetLineWidth(),this._RenderSingleBorder(n,i,this.X-this.Margin.Left,this.Y-this.Margin.Top+r/2,this.X+this.Width+this.Margin.Right,this.Y-this.Margin.Top+r/2,r));(t.OwnerTable.TableFormat.CellSpacing>0||t.CellIndex==t.OwnerRow.Cells.Count-1)&&(i=f._GetCellRightBorder(t),i!=null&&(r=i._GetLineWidth(),this._RenderSingleBorder(n,i,this.X+this.Width+this.Margin.Right-r/2,this.Y-e,this.X+this.Width+this.Margin.Right-r/2,this.Y+this.Height+u,r)));s=t.OwnerRow.NextNode;l=!1;s!=null&&(h=null,s.TableRowWidgets!=null&&s.TableRowWidgets.Count>0&&(h=s.TableRowWidgets[0]),h instanceof li&&this.ContainerWidget instanceof li&&this.ContainerWidget instanceof ci&&(l=this.ContainerWidget.ChildWidgets._Contains(h)));(t.OwnerTable.TableFormat.CellSpacing>0||t.OwnerRow.RowIndex==t.OwnerTable.Rows.Count-1||t.CellFormat.RowSpan>1&&t.OwnerRow.RowIndex+t.CellFormat.RowSpan==t.OwnerTable.Rows.Count||!l)&&(i=t.CellFormat.RowSpan>1&&t.OwnerRow.RowIndex+t.CellFormat.RowSpan==t.OwnerTable.Rows.Count?f._GetBorderBasedOnPriority(t.CellFormat.Borders.Bottom,t.OwnerTable.TableFormat.Borders._GetCellBottomBorder(t)):f._GetCellBottomBorder(t),i!=null&&(r=i._GetLineWidth(),this._RenderSingleBorder(n,i,this.X-this.Margin.Left,this.Y+this.Height+u+r/2,this.X+this.Width+this.Margin.Right,this.Y+this.Height+u+r/2,r)));i=f._GetCellDiagonalUpBorder(t);i!=null&&(r=i._GetLineWidth(),r>0&&this._RenderSingleBorder(n,i,this.X-o,this.Y+this.Height+u,this.X+this.Width+c,this.Y-e,r));i=f._GetCellDiagonalDownBorder(t);i!=null&&(r=i._GetLineWidth(),r>0&&this._RenderSingleBorder(n,i,this.X-o,this.Y-e,this.X+this.Width+c,this.Y+this.Height+u,r));this._RenderCellBackground(n,a)},i.prototype._RenderCellBackground=function(n,t){var r=this.CurrentNode.CellFormat,i=r.Shading.BackgroundColor;i!="empty"&&(n.fillStyle=i,n.fillRect(this.X-this.Margin.Left+this.LeftBorderWidth,this.Y-this.TableCell.TopMargin,this.Width+this.Margin.Left+this.Margin.Right-this.LeftBorderWidth-this.RightBorderWidth,t),n.fill())},i.prototype._UpdateTableRowWidget=function(n,t){this.ContainerWidget!=null&&(this.ContainerWidget.ChildWidgets._Remove(this),(this.ContainerWidget.ChildWidgets==null||this.ContainerWidget.ChildWidgets.Count==0)&&this.ContainerWidget instanceof li&&this.ContainerWidget._Dispose());n.ChildWidgets._Insert(t,this);this.ContainerWidget=n},i.prototype._Highlight=function(n,t){this._ClearChildSelectionHighlight(n.OwnerControl.Viewer);n._CreateHighlightBorderInsideTable(this,n,t)},i.prototype._ClearSelectionHighlight=function(n){n!=null&&n.OwnerControl!=null&&n.OwnerControl.Selection.SelectionRanges.Count>0&&n.OwnerControl.Selection.SelectionRanges._ClearSelectionHighlightInternal(this)},i.prototype._GetTableWidget=function(n){for(var t=0;t<this.ChildWidgets.Count;t++)if(this.ChildWidgets[t]instanceof ci&&this.ChildWidgets[t].Y<=n.Y&&this.ChildWidgets[t].Y+this.ChildWidgets[t].Height>=n.Y)return this.ChildWidgets[t];return null},i.prototype._GetTableCellWidget=function(n,t){for(var r,i=0;i<this.ChildWidgets.Count;i++)if(this.ChildWidgets[i].Y<=n.Y&&this.ChildWidgets[i].Y+this.ChildWidgets[i].Height>=n.Y)return this.ChildWidgets[i]._GetTableCellWidget(n,t);return r=null,this.ChildWidgets.Count>0&&t&&(r=this.ChildWidgets[0].Y<=n.Y?this.ChildWidgets[this.ChildWidgets.Count-1]._GetTableCellWidget(n,t):this.ChildWidgets[0]._GetTableCellWidget(n,t)),r},i.prototype._Dispose=function(){var i=null,r=this._GetPage(),n,t;if(r!=null&&(i=r.Viewer),this.ChildWidgets!=null){for(n=0;n<this.ChildWidgets.Count;n++){if(t=this.ChildWidgets[n],t instanceof ri?t._Dispose():t._Dispose(),this.ChildWidgets==null)break;this.ChildWidgets._Remove(t);n--}this.ChildWidgets=null}this._ClearSelectionHighlight(i);this.ContainerWidget!=null&&(this.ContainerWidget.ChildWidgets!=null&&this.ContainerWidget.ChildWidgets._Remove(this),this.ContainerWidget=null);this.TableCell!=null&&(this.TableCell.TableCellWidgets!=null&&this.TableCell.TableCellWidgets._Remove(this),this.TableCell=null)},i}(oi);t.TableCellWidget=ii;ri=function(t){function i(n){t.call(this);this.CurrentNode=n}return n(i,t),i.prototype._renderComment=function(n,t,i){var f,r,u;for(this.ContainerWidget instanceof ar&&(f=this.CurrentNode.Section.SectionFormat,i=i+this.Y,t=this.X+f.PageWidth),r=0;r<this.ChildWidgets.length;r++)u=this.ChildWidgets[r],u._render(n,t,i),i+=u.Height},i.prototype._renderCommentCanvas=function(n,t,i){var f,r,u;for(this.ContainerWidget instanceof ar&&(f=this.CurrentNode.Section.SectionFormat,i=i+this.Y,t=this.X+f.PageWidth),r=0;r<this.ChildWidgets.length;r++)u=this.ChildWidgets[r],u._renderCanvas(n,t,i),i+=u.Height},i.prototype._render=function(n){for(var i,r=this.Y,u=this.X,t=0;t<this.ChildWidgets.length;t++)i=this.ChildWidgets[t],i._render(n,u,r),r+=i.Height},i.prototype._renderCanvas=function(n){for(var i,r=this.Y,u=this.X,t=0;t<this.ChildWidgets.length;t++)i=this.ChildWidgets[t],i._renderCanvas(n,u,r),r+=i.Height},i.prototype._Render=function(n){var r=pi.Continuous,t,u,i;if(r=n.OwnerControl.LayoutType,t=this.Y,r==pi.Continuous&&(n.CurrentPage.BoundingRectangle.Top>(t+this.Height)*n.ZoomFactor||n.CurrentPage.BoundingRectangle.Bottom<t*n.ZoomFactor))return n.VisibleBounds.Bottom<t*n.ZoomFactor;for(u=n.CurrentPage,i=0;i<this.ChildWidgets.Count;i++)n.CurrentPage.BoundingRectangle.Top>(t+this.ChildWidgets[i].Height)*n.ZoomFactor||n.CurrentPage.BoundingRectangle.Bottom<t*n.ZoomFactor||this.ChildWidgets[i]._render(u,this.X,t),t+=this.ChildWidgets[i].Height},i.prototype._IsFirstLineFit=function(n){var t=this.ChildWidgets[0],r,i;return t.CurrentParagraphWidget.ContainerWidget instanceof ii&&(r=t.CurrentParagraphWidget.ContainerWidget,i=null,t.CurrentParagraphWidget.CurrentNode!=null&&r.ContainerWidget!=null&&(i=t.CurrentParagraphWidget.CurrentNode._GetOwnerDocument()),i!=null&&i.OwnerControl!=null&&r.ContainerWidget.Y==i.OwnerControl.Viewer.ClientArea.Y&&this.Y+t.Height>=n)?!0:this.Y+t.Height<=n},i.prototype._GetSplittedWidget=function(n){for(var t,e,f=this.Y,r=null,u=0;u<this.ChildWidgets.length;u++){if(t=this.ChildWidgets[u],n<f+t.Height){if(u==0){if(t.CurrentParagraphWidget.ContainerWidget instanceof ii&&t.CurrentParagraphWidget.ContainerWidget.Y==this.Y){f+=t.Height;continue}r=this;break}this.ChildWidgets._Contains(t)&&(this.ChildWidgets._Remove(t),u--);this.Height-=t.Height;r==null?(r=new i(this.CurrentNode),r._UpdateWidgetLocation(this),e=this.CurrentNode,e.ParagraphWidgets._Add(r),r.Height=t.Height):r.Height+=t.Height;r.ChildWidgets._Add(t);t.CurrentParagraphWidget=r}f+=t.Height}return r},i.prototype._GetLineWidget=function(n){for(var r,i=this.Y,t=0;t<this.ChildWidgets.length;t++){if(i<=n.Y&&i+this.ChildWidgets[t].Height>=n.Y)return this.ChildWidgets[t];i+=this.ChildWidgets[t].Height}return r=null,this.ChildWidgets.length>0&&(r=this.Y<=n.Y?this.ChildWidgets[this.ChildWidgets.length-1]:this.ChildWidgets[0]),r},i.prototype._IsFitInClientArea=function(n){var t=this.ChildWidgets[this.ChildWidgets.Count-1],i=this.Height,r=t._GetMaxElementHeight();return t.Height>r&&(i-=t.Height-r),n.ClientActiveArea.Height>=i},i.prototype._SplitWidget=function(n,t,r){var c=this.ChildWidgets[0],l=c._GetMaxElementHeight(),f=this.ContainerWidget,u,o,e,s,h;if(n.ClientActiveArea.Height>=l){for(u=null,o=this.CurrentNode.ParagraphWidgets._IndexOf(this),o<this.CurrentNode.ParagraphWidgets.Count-1?(u=this.CurrentNode.ParagraphWidgets[o+1],f=u.ContainerWidget):(u=new i(this.CurrentNode),u.Width=this.Width,u.X=this.X,u.Y=this.Y,this.CurrentNode.ParagraphWidgets._Add(u)),t!=this.ContainerWidget&&this._UpdateContainerWidget(t,r),e=this.ChildWidgets.Count-1;e>0;e--)if(this._IsFitInClientArea(n))break;else s=this.ChildWidgets[e],s._UpdateParagraphWidget(u,0);if(u.ContainerWidget==null&&(h=n.ClientActiveArea.Y,f=t._CreateOrGetNextBodyWiget(n),f.ChildWidgets._Insert(0,u),f.Height+=u.Height,u.ContainerWidget=f,f.ChildWidgets.Count==1))return this.X=this.X,this.Y=h,!0}else f=t._CreateOrGetNextBodyWiget(n),this.ContainerWidget!=f&&this._UpdateContainerWidget(f,0);return t==this.ContainerWidget?(this.Y=n.ClientActiveArea.Y,n._CutFromTop(n.ClientActiveArea.Y+this.Height)):n._UpdateClientArea(f.CurrentNode.SectionFormat),!1},i.prototype._ShiftToPreviousWidget=function(n,t){for(var r,e,f,u,i=0;i<this.ChildWidgets.Count;i++)if(r=this.ChildWidgets[i],e=r._GetMaxElementHeight(),n.ClientActiveArea.Height>=e){if(r._UpdateParagraphWidget(t,t.ChildWidgets.Count),this.ChildWidgets==null)break;i--;n._CutFromTop(n.ClientActiveArea.Y+r.Height)}else{f=t.ContainerWidget;u=f._CreateOrGetNextBodyWiget(n);f!=u&&this._UpdateContainerWidget(u,0);n._UpdateClientArea(u.CurrentNode.SectionFormat);break}},i.prototype._ShiftChildsToWidget=function(n){for(var i,t=0;t<this.ChildWidgets.Count;t++){if(i=this.ChildWidgets[t],i._UpdateParagraphWidget(n,n.ChildWidgets.Count),this.ChildWidgets==null)break;t--}},i.prototype._Highlight=function(n,t,i,r,u,f){for(var e,o,c,s=0,h=i;h<this.ChildWidgets.length;h++){if(e=this.ChildWidgets[h],h==i&&(s=e._GetTop()),o=e._GetLeft(),e==r){c=r._GetLeftInternal(u,f);n._CreateHighlightBorder(t,e,c-o,o,s);return}n._CreateHighlightBorder(t,e,e._GetWidth(!0)-(o-this.X),o,s);s+=e.Height}},i.prototype._HighlightSearchResult=function(n,t,i,r,u){for(var f,e,h,o=0,s=t;s<this.ChildWidgets.Count;s++){if(f=this.ChildWidgets[s],s==t&&(o=f._GetTop()),e=f._GetLeft(),f==i){h=i._GetLeftInternal(r,u);n._CreateHighlightBorder(f,h-e,e,o);return}n._CreateHighlightBorder(f,f._GetWidth(!0)-(e-this.X),e,o);o+=f.Height}},i.prototype._GetTableCellWidget=function(){return null},i.prototype._Dispose=function(){var i=this.Height,n,t;if(this.ChildWidgets!=null){for(n=0;n<this.ChildWidgets.Count;n++){if(t=this.ChildWidgets[n],t._Dispose(),this.ChildWidgets==null)break;this.ChildWidgets._Remove(t);n--}this.ChildWidgets=null}this.CurrentNode!=null&&(this.CurrentNode.ParagraphWidgets!=null&&this.CurrentNode.ParagraphWidgets._Remove(this),this.CurrentNode=null);this.ContainerWidget!=null&&(this.ContainerWidget.ChildWidgets._Remove(this),this.ContainerWidget.Height-=i,(this.ContainerWidget.ChildWidgets==null||this.ContainerWidget.ChildWidgets.Count==0)&&this.ContainerWidget instanceof wt&&this.ContainerWidget._Dispose(),this.ContainerWidget=null)},i}(oi);t.ParagraphWidget=ri;ru=function(){function n(n){this.X=0;this.Y=0;this.Width=0;this.Height=0;this.Children=null;this.CurrentParagraphWidget=n;this.Children=new h}return n.prototype._IsParagraphFirstLine=function(){return this==this.CurrentParagraphWidget.ChildWidgets[0]?!0:!1},n.prototype._render=function(n,t,i){var s,e,u,f,l;if(n!=null&&n.Viewer!=null){var h=document.getElementById(n.Id+"_background"),a=document.getElementById(n.Id+"_foreground"),v=document.getElementById(n.Id+"_selection");if(h!=null){var o=h.getContext("2d"),y=a.getContext("2d"),r=v.getContext("2d");if(n.Viewer.OwnerControl.Selection.SelectionRanges.Count>0&&n.Viewer.OwnerControl.Selection.SelectionRanges._AddSelectionHighlight(r,this,i),n.Viewer.ImageResizer.SelectedImageWidget.Count>0&&n.Viewer.ImageResizer._ReDrawImageResizer(this,n),n.Viewer.SearchHighlighters!=null&&n.Viewer.SearchHighlighters._ContainsKey(this))for(s=this,e=n.Viewer.SearchHighlighters._Get(s),u=0;u<e.Count;u++)o.fillStyle="#ffe97f",o.fillRect(e[u].Left,i,e[u].Width,s.Height);if(n!=null&&n.Viewer!=null&&n.Viewer instanceof w&&n.Viewer.CommentRangeWidget!=null&&n.Viewer.CommentRangeWidget.CurrentWidget==this&&n.Viewer.CommentRangeWidget.CommentRangeMarker!=null&&n.Viewer.CommentRangeWidget.CommentRangeLinker!=null&&(r.beginPath(),r.moveTo(n.Viewer.CommentRangeWidget.CommentRangeMarker.X1,n.Viewer.CommentRangeWidget.CommentRangeMarker.Y1+.5),r.lineTo(n.Viewer.CommentRangeWidget.CommentRangeMarker.X2,n.Viewer.CommentRangeWidget.CommentRangeMarker.Y2+.5),r.moveTo(n.Viewer.CommentRangeWidget.CommentRangeLinker.X1,n.Viewer.CommentRangeWidget.CommentRangeLinker.Y1+.5),r.lineTo(n.Viewer.CommentRangeWidget.CommentRangeLinker.X2,n.Viewer.CommentRangeWidget.CommentRangeLinker.Y2+.5),r.strokeStyle="#19c7ff",r.lineWidth=.5,r.globalAlpha=1,r.stroke(),r.closePath()),n.Viewer.SelectedCommentRangeWidget!=null&&n.Viewer.SelectedCommentRangeWidget._ContainsKey(this)){var c=n.Viewer.SelectedCommentRangeWidget._Get(this),p=c.Left,b=c.Width;r.fillStyle="#67CCEC";r.globalAlpha=.4;r.fillRect(p,i,b,this.Height)}for(this._IsParagraphFirstLine()&&(t+=this.CurrentParagraphWidget.CurrentNode.ParagraphFormat.FirstLineIndent),u=0;u<this.Children.Count;u++)f=this.Children[u],l=this._getUnderlineYposition(),f instanceof gi?f._renderComment(n):f._render(y,o,t,i,l),t+=f.Width+f.Margin.Left,n.Viewer instanceof st&&n.Viewer.OwnerControl.Selection.IsCleared&&n.Viewer.OwnerControl.Selection.Start!=null&&n.Viewer.OwnerControl.Selection._FireSelectionChanged(!0)}}},n.prototype._renderCanvas=function(n,t,i){var u,f,r,e;if(n!=null)for(this._IsParagraphFirstLine()&&(t+=this.CurrentParagraphWidget.CurrentNode.ParagraphFormat.FirstLineIndent),u=n.getContext("2d"),f=0;f<this.Children.Count;f++)r=this.Children[f],e=this._getUnderlineYposition(),r instanceof gi?r._renderCanvas(n):r instanceof br?r._renderCanvas(u,u,t,i,e):r._render(u,u,t,i,e),t+=r.Width+r.Margin.Left},n.prototype._getUnderlineYposition=function(){var t=0,i=0,n;if(this.Children.Count==0||this.Children.Count==1&&this.Children[0]instanceof dt||this.Children.Count==2&&this.Children[0]instanceof dt&&this.Children[1]instanceof dt)return 0;for(n=0;n<this.Children.Count;n++)t<this.Children[n].Height&&(t=this.Children[0].Margin.Top+this.Children[0].Height,i=this.Children[0].Height/20);return t-2*i},n.prototype._GetLeft=function(){var t=this.CurrentParagraphWidget.X,r=this.CurrentParagraphWidget.CurrentNode.ParagraphFormat,i,n;for(!this._IsParagraphFirstLine()||r.TextAlignment==rt.Right||(t+=r.FirstLineIndent),r.TextAlignment==rt.Center&&(t-=r.FirstLineIndent/2),i=0;i<this.Children.Count;i++)if(n=this.Children[i],n instanceof dt)t+=i==0?n.Margin.Left+n.Width:n.Width;else{t+=n.Margin.Left;break}return t},n.prototype._GetLeftInternal=function(n,t){var i=this.CurrentParagraphWidget.X,u,r;for(this._IsParagraphFirstLine()&&(i+=this.CurrentParagraphWidget.CurrentNode.ParagraphFormat.FirstLineIndent),u=this.Children._IndexOf(n),r=0;r<u;r++)i+=this.Children[r].Margin.Left+this.Children[r].Width;return n!=null&&(i+=n.Margin.Left),n instanceof it?i+=t==n.Length?n.Width:t>n.Length?n.Width+ft._GetParagraphMarkSize(n.Inline.OwnerParagraph.CharacterFormat).Width:ft._GetWidth(n.Text.substr(0,t),n.Inline.CharacterFormat):t>0&&(n!=null?(i+=n.Width,t==2&&(i+=ft._GetParagraphMarkSize(n.Inline.OwnerParagraph.CharacterFormat).Width)):i+=ft._GetParagraphMarkSize(this.CurrentParagraphWidget.CurrentNode.CharacterFormat).Width),i},n.prototype._GetLineStartLeft=function(){var n=this.CurrentParagraphWidget.X;return this._IsParagraphFirstLine()&&(n+=this.CurrentParagraphWidget.CurrentNode.ParagraphFormat.FirstLineIndent),this.Children.Count>0&&(n+=this.Children[0].Margin.Left),n},n.prototype._GetTop=function(){for(var t=this.CurrentParagraphWidget.Y,i=this.CurrentParagraphWidget.ChildWidgets._IndexOf(this),n=0;n<i;n++)t+=this.CurrentParagraphWidget.ChildWidgets[n].Height;return t},n.prototype._UpdateTextPosition=function(n,t,i){var f=t,e=null,r=0,o=!1,u=this._UpdateTextPositionInternal(n,e,r,f,!1);u!=null&&(e=u.inline,r=u.index,f=u.caretPosition,o=u.isImageSelected);o?(n.Selection._Select(this.CurrentParagraphWidget.CurrentNode,e,r,f,!0),r==0?n.Selection._ExtendForward(!1):n.Selection._ExtendBackward(!1)):n.Selection._Select(this.CurrentParagraphWidget.CurrentNode,e,r,f,i)},n.prototype._UpdateTextPositionInternal=function(n,t,i,r,u){var b=!1,c=this._GetTop(),e=this.CurrentParagraphWidget.X,nt=this._GetFirstElement(e),f=nt.element,k,l,a,o,rt,h,d,g,s;if(e=nt.left,f==null){var v=0,tt=0,w=this.CurrentParagraphWidget.CurrentNode._GetParagraphMarkSize(v,tt);v=w.TopMargin;tt=w.BottomMargin;u&&r.X>e+w.Width/2&&(e+=w.Width,this.CurrentParagraphWidget.CurrentNode.Inlines.Count>0&&(t=this.CurrentParagraphWidget.CurrentNode.Inlines[this.CurrentParagraphWidget.CurrentNode.Inlines.Count-1],i=t.Length),i++);r=new p(e,v>0?c+v:c)}else if(f!=null){if(r.X>e+f.Margin.Left){for(o=this.Children._IndexOf(f);o<this.Children.Count;o++){if(f=this.Children[o],r.X<e+f.Margin.Left+f.Width||o==this.Children.Count-1)break;e+=f.Margin.Left+f.Width}if(r.X>e+f.Margin.Left+f.Width)i=f instanceof it?this._GetTextLength(f)+f.Length:1,e+=f.Margin.Left+f.Width;else if(f instanceof it){for(k=r.X-e-f.Margin.Left,e+=f.Margin.Left,l=0,a=0,o=1;o<=f.Length;o++){if(s=0,s=o==f.Length?f.Width:ft._GetWidth(f.Text.substr(0,o),f.Inline.CharacterFormat),k<s||o==f.Length){rt=s-l;k-l>rt/2?(e+=s,a=o):(e+=l,a=o-1,o==1&&f!=this.Children[0]&&(h=this.Children._IndexOf(f),this.Children[h-1]instanceof dt||(f=this.Children[h-1],a=f instanceof it?f.Length:1)));break}l=s}i=this._GetTextLength(f)+a}else b=f instanceof br,r.X-e-f.Margin.Left>f.Width/2?(i=1,e+=f.Margin.Left+f.Width):f==this.Children[0]||b||(h=this.Children._IndexOf(f),this.Children[h-1]instanceof dt||(f=this.Children[h-1],i=f instanceof it?this._GetTextLength(f)+f.Length:1))}else e+=f.Margin.Left,i=this._GetTextLength(f);if(f instanceof it)c+=f.Margin.Top>0?f.Margin.Top:0;else{var ut=ft._MeasureText("a",f.Inline.CharacterFormat),ot=ut.Height,et=ut.BaselineOffset;c+=f.Margin.Top+f.Height-et}t=f.Inline;d=t._ValidateTextPosition(i);t=d.inline;i=d.index;g=t.NextNode==null&&i==t.Length;u&&t.NextNode instanceof y&&i==t.Length&&(g=t._IsLastRenderedInline(i));u&&g&&(s=ft._GetParagraphMarkSize(t.OwnerParagraph.CharacterFormat).Width,r.X>e+s/2&&(e+=s,i=t.Length+1));r=new p(e,c)}return{inline:t,index:i,caretPosition:r,isImageSelected:b}},n.prototype._GetTextLength=function(n){for(var i=0,r=n.Inline.Elements._IndexOf(n),t=0;t<r;t++)i+=n.Inline.Elements[t].Length;return i},n.prototype._GetFirstElementInternal=function(){for(var n=null,t=0;t<this.Children.Count;t++)if(n=this.Children[t],n instanceof dt)n=null;else break;return n},n.prototype._GetFirstElement=function(n){var r=0,t,i;for(this._IsParagraphFirstLine()&&(r=this.CurrentParagraphWidget.CurrentNode.ParagraphFormat.FirstLineIndent),n+=r,t=null,i=0;i<this.Children.Count;i++)if(t=this.Children[i],t instanceof dt||t instanceof gi)n+=t.Margin.Left+t.Width,t=null;else break;return{element:t,left:n}},n.prototype._GetWidth=function(n){var i=0,t;for(this._IsParagraphFirstLine()&&(i+=this.CurrentParagraphWidget.CurrentNode.ParagraphFormat.FirstLineIndent),t=0;t<this.Children.Count;t++)i+=this.Children[t].Margin.Left+this.Children[t].Width;return n&&this.CurrentParagraphWidget.CurrentNode.ParagraphWidgets.indexOf(this.CurrentParagraphWidget)==this.CurrentParagraphWidget.CurrentNode.ParagraphWidgets.Count-1&&this.CurrentParagraphWidget.ChildWidgets._IndexOf(this)==this.CurrentParagraphWidget.ChildWidgets.Count-1&&(i+=ft._GetParagraphMarkSize(this.CurrentParagraphWidget.CurrentNode.CharacterFormat).Width),i},n.prototype._UpdateTextPositionWidget=function(n,t,i,r){var f=t,e=null,o=0,u=this._UpdateTextPositionInternal(n,e,o,f,r);u!=null&&(e=u.inline,o=u.index,f=u.caretPosition);i._SetPositionForSelection(this.CurrentParagraphWidget.CurrentNode,e,o,f)},n.prototype._GetHyperlinkField=function(n,t){var u=null,a=this._GetTop(),s=this._GetLineStartLeft(),f,l,i,o,e,r,c;if(t.Y<a||t.Y>a+this.Height||t.X<s||t.X>s+this.Width)return null;if(f=this.CurrentParagraphWidget.X,l=this._GetFirstElement(f),f=l.left,i=l.element,i==null){if(e=ft._GetParagraphMarkSize(this.CurrentParagraphWidget.CurrentNode.CharacterFormat).Width,t.X<=s+e||t.X>=s+e)return r=new h,c=this.CurrentParagraphWidget.CurrentNode._GetHyperlinkFields(this.CurrentParagraphWidget.CurrentNode,r),r._Clear(),r=null,c}else{if(t.X>f+i.Margin.Left)for(o=this.Children._IndexOf(i);o<this.Children.Count;o++){if(i=this.Children[o],t.X<f+i.Margin.Left+i.Width||o==this.Children.Count-1)break;f+=i.Margin.Left+i.Width}if(u=i.Inline,e=i.Margin.Left+i.Width,u.NextNode==null&&i==u.Elements[u.Elements.Count-1]&&(e+=ft._GetParagraphMarkSize(u.OwnerParagraph.CharacterFormat).Width),t.X<=f+e)return r=new h,c=u.OwnerParagraph._GetHyperlinkField(u,r),r._Clear(),r=null,c}return null},n.prototype._GetMaxElementHeight=function(){var t=0,r,u,i,n;if(this.Children.Count==0||this.Children.Count==1&&this.Children[0]instanceof dt||this.Children.Count==2&&this.Children[0]instanceof dt&&this.Children[1]instanceof dt)r=0,u=0,t=this.CurrentParagraphWidget.CurrentNode._GetParagraphMarkSize(r,u).Height,t+=r,this.Children.Count>0&&(n=this.Children[0],t<n.Margin.Top+n.Height&&(t=n.Margin.Top+n.Height));else for(i=0;i<this.Children.Count;i++)(n=this.Children[i],n instanceof gi)||t<n.Margin.Top+n.Height&&(t=n.Margin.Top+n.Height);return t},n.prototype._PreservePreviousElements=function(n){var r=0,i,t,u;for(this._IsParagraphFirstLine()&&(r+=this.CurrentParagraphWidget.CurrentNode.ParagraphFormat.FirstLineIndent),i=0;i<this.Children.Count;i++){if(t=this.Children[i],t.CurrentLineWidget=null,u=t.BaseNode instanceof k?t.BaseNode.OwnerParagraph:t.BaseNode,u==null||u==this.CurrentParagraphWidget.CurrentNode)break;else n.LineElements._Add(t),r+=t.Margin.Left+t.Width;this.Children._Remove(t);i--}return r},n.prototype._UpdateParagraphWidget=function(n,t){this.CurrentParagraphWidget!=null&&(this.CurrentParagraphWidget.ChildWidgets._Remove(this),this.CurrentParagraphWidget.Height-=this.Height,this.CurrentParagraphWidget.ContainerWidget!=null&&(this.CurrentParagraphWidget.ContainerWidget.Height-=this.Height),(this.CurrentParagraphWidget.ChildWidgets==null||this.CurrentParagraphWidget.ChildWidgets.Count==0)&&this.CurrentParagraphWidget._Dispose());n.ChildWidgets._Insert(t,this);this.CurrentParagraphWidget=n;n.Height+=this.Height;n.ContainerWidget!=null&&(n.ContainerWidget.Height+=this.Height)},n.prototype._ClearChildWidgets=function(n,t){var e=!1,u=0,r,i,f,o;for(this._IsParagraphFirstLine()&&(u+=this.CurrentParagraphWidget.CurrentNode.ParagraphFormat.FirstLineIndent),r=0;r<this.Children.Count;r++)i=this.Children[r],i.CurrentLineWidget=null,e||t==null?i._Dispose(n):(f=i.Width,i instanceof it&&this.CurrentParagraphWidget.CurrentNode.ParagraphFormat.TextAlignment==rt.Justify&&(o=i.Inline.CharacterFormat,ft._GetTextSize(i,o),f=i.Width),n.LineElements._Add(i),u+=i.Margin.Left+f),t==i&&(e=!0),this.Children._Remove(i),r--;return this.CurrentParagraphWidget=null,this._ClearSelectionHighlight(n),u},n.prototype._UpdateSubWidth=function(n){var u=0,f=0,e,s,i,r,t,o;for(f=n.VisibleBounds.Width>n.HorizontalWidth?n.VisibleBounds.Width:n.HorizontalWidth-n.Padding.Left-2*n.Padding.Right,e=this.CurrentParagraphWidget.CurrentNode.ParagraphFormat.FirstLineIndent,s="",i=this.Children.Count-1;i>=0;i--)if(t=this.Children[i],t instanceof gi)continue;else u+=t.Width;r=f-e-u;this.Children.Count>0&&(t=this.Children[0],o=this.CurrentParagraphWidget.CurrentNode.ParagraphFormat.TextAlignment,t.Margin.Left+=o==rt.Right?r:r/2)},n.prototype._ClearSelectionHighlight=function(n){n!=null&&n.OwnerControl!=null&&n.OwnerControl.Selection.SelectionRanges.Count>0&&n.OwnerControl.Selection.SelectionRanges._ClearSelectionHighlightInternal(this)},n.prototype._Dispose=function(){var n=null;this.CurrentParagraphWidget!=null&&this.CurrentParagraphWidget._GetPage()!=null&&(n=this.CurrentParagraphWidget._GetPage().Viewer);this._DisposeInternal(n)},n.prototype._DisposeInternal=function(n){var t,i;if(this._ClearSelectionHighlight(n),this.Children!=null){for(t=0;t<this.Children.Count;t++)i=this.Children[t],i._Dispose(n),this.Children._Remove(i),t--;this.Children=null}this.CurrentParagraphWidget!=null&&(this.CurrentParagraphWidget.ChildWidgets!=null&&(this.CurrentParagraphWidget.ChildWidgets._Remove(this),this.CurrentParagraphWidget.Height-=this.Height),this.CurrentParagraphWidget=null)},n}();t.LineWidget=ru;ar=function(t){function i(n){t.call(this,n);this.ContentWidth=316;this.visibleHeight=0;this.TopPosition=0;this.RenderedElement=null;this.currentNode=n}return n(i,t),Object.defineProperty(i.prototype,"VisibleHeight",{get:function(){return this.visibleHeight},set:function(n){this.visibleHeight=n},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Comment",{get:function(){return this.currentNode},enumerable:!0,configurable:!0}),i.prototype._render=function(n){this.RenderedElement!=null&&(this.RenderedElement._Dispose(),this.RenderedElement=null);this.RenderedElement=new io(this);n.Viewer.OwnerControl.Selection!=null&&n.Viewer.OwnerControl.Selection.Start.Paragraph._GetOwnerComment()==this.Comment&&this.RenderedElement._ShowBorder();for(var t=0;t<this.ChildWidgets.Count;t++)this.ChildWidgets[t]instanceof ri?this.ChildWidgets[t]._renderComment(n,this.X,this.Y):this.ChildWidgets[t]._renderComment(n,this.X,this.Y)},i.prototype._renderCanvas=function(n){for(var t=0;t<this.ChildWidgets.Count;t++)this.ChildWidgets[t]instanceof ri?this.ChildWidgets[t]._renderCommentCanvas(n,this.X,this.Y):this.ChildWidgets[t]._renderCommentCanvas(n,this.X,this.Y)},i}(wt);t.CommentWidget=ar;bf=function(){function n(n){this.CurrentWidget=null;this.CommentRangeMarker=null;this.CommentRangeLinker=null;this.CurrentWidget=n}return n.prototype._Dispose=function(){this.CurrentWidget=null;this.CommentRangeMarker=null;this.CommentRangeLinker=null},n}();t.CommentRangeWidget=bf;io=function(){function n(n){this.Layoutedwidget=n;this._InitBorder()}return n.prototype._InitBorder=function(){var t,n;(this.Layoutedwidget!=null||this.Layoutedwidget.Comment!=null)&&(this.Left=new lr(0+this.Layoutedwidget.X,0+this.Layoutedwidget.Y,0+this.Layoutedwidget.X,0+this.Layoutedwidget.Height+this.Layoutedwidget.Y),this.Top=new lr(0+this.Layoutedwidget.X,0+this.Layoutedwidget.Y,316+this.Layoutedwidget.X,0+this.Layoutedwidget.Y),this.Bottom=new lr(0+this.Layoutedwidget.X,0+this.Layoutedwidget.Y+this.Layoutedwidget.Height,316+this.Layoutedwidget.X,0+this.Layoutedwidget.Y+this.Layoutedwidget.Height),t=this.Layoutedwidget.Page,this.canvas=document.getElementById(t.Id+"_selection"),n=this.canvas.getContext("2d"),n.beginPath(),n.moveTo(this.Left.X1,this.Left.Y1),n.lineTo(this.Left.X2,this.Left.Y2),n.strokeStyle="#19c7ff",n.globalAlpha=1,n.stroke())},n.prototype._ShowBorder=function(){var n=this.canvas.getContext("2d");n.beginPath();n.moveTo(this.Top.X1,this.Top.Y1+.5);n.lineTo(this.Top.X2,this.Top.Y2+.5);n.moveTo(this.Bottom.X1,this.Bottom.Y1+.5);n.lineTo(this.Bottom.X2,this.Bottom.Y2+.5);n.strokeStyle="#19c7ff";n.globalAlpha=1;n.stroke();var i=this.Layoutedwidget.Page,r=document.getElementById(i.Id+"_background"),t=r.getContext("2d");t.fillStyle="#F1F2F2";t.fillRect(this.Top.X1,this.Top.Y1,this.Top.X2,this.Layoutedwidget.Height)},n.prototype._Dispose=function(){this.Layoutedwidget=null;this.Left=null;this.Bottom=null;this.Top=null},n}();t.TextBoxContainerAdv=io;uu=function(){function n(n){this.X=0;this.Y=0;this.Width=0;this.Height=0;this.BaseNode=n}return Object.defineProperty(n.prototype,"Inline",{get:function(){return this.BaseNode},enumerable:!0,configurable:!0}),n.prototype._GetIndexInInline=function(){var t=0,i,n;if(k!=null&&this instanceof it)for(i=this.Inline.Elements._IndexOf(this),n=0;n<i;n++)t+=this.Inline.Elements[n].Length;return t},n.prototype._renderUnderline=function(n,t,i,r,u,f,e){var s=this.Height/(e==vt.Normal?1:1.5),h=this.Margin.Top,c=s/20,o=0;e==vt.Subscript||this instanceof dt?(o=s-2*c+i,h+=this.Height-s,o+=h>0?h:0):o=r+i;n.fillRect(t+this.Margin.Left,o,this.Width,c)},n.prototype._renderStrikeThrough=function(n,t,i,r,u,f){var o=this.Height/(f==vt.Normal?1:1.5),s=this.Margin.Top;f==vt.Subscript&&(s+=this.Height-o);i+=s>0?s:0;var e=o/20,h=o/2+.5*e,c=0;for(r==cr.DoubleStrike&&(h-=e);c<(r==cr.DoubleStrike?2:1);)c++,n.fillRect(t+this.Margin.Left,h+i,this.Width,e),h+=2*e},n.prototype._ClipRect=function(n,t,i,r,u){n.beginPath();n.save();n.rect(t,i,r,u);n.clip()},n}();t.ElementBox=uu;it=function(t){function i(n){t.call(this,n);this.BaselineOffset=0;this.Index=0;this.Length=0}return n(i,t),Object.defineProperty(i.prototype,"Text",{get:function(){return this.Inline instanceof s?this.Inline.Text.substr(this.Index,this.Length):""},enumerable:!0,configurable:!0}),i.prototype._render=function(n,t,i,r,u){var c=!1,e=this.CurrentLineWidget.CurrentParagraphWidget.ContainerWidget,s,h,f,o,y;e instanceof ii&&(c=e.CurrentNode.OwnerRow.RowFormat.HeightType==et.Exactly);s=this.Margin.Top;h=this.Margin.Left;c&&this._ClipRect(n,e.X,e.Y,e.Width,e.Height);f=this.Inline.CharacterFormat;o=f.FontColor;n.textBaseline="top";var l="",a="",v=11;l=f.Bold?"bold":"";a=f.Italic?"italic":"";v=f.FontSize==0?.5:f.FontSize/(f.BaselineAlignment==vt.Normal?1:1.5);n.font=l+" "+a+" "+v+"px "+f.FontFamily;f.BaselineAlignment==vt.Subscript&&(s+=this.Height-this.Height/1.5);f.HighlightColor!=gt.NoColor&&(t.fillStyle=kt._GetHighlightColorCode(f.HighlightColor),t.fillRect(i+h,r+s,this.Width,this.Height));o=="empty"&&(y=this.Inline.OwnerParagraph.Document,o=this.Inline.CharacterFormat._GetDefaultFontColor(y));n.fillStyle=o;n.fillText(this.Text,i+h,r+s,this.Width);n.restore();f.Underline!=ki.None&&this._renderUnderline(n,i,r,u,o,f.Underline,f.BaselineAlignment);f.StrikeThrough!=cr.None&&this._renderStrikeThrough(n,i,r,f.StrikeThrough,o,f.BaselineAlignment)},i.prototype._Dispose=function(){var n=null;this.CurrentLineWidget!=null&&this.CurrentLineWidget.CurrentParagraphWidget!=null&&this.CurrentLineWidget.CurrentParagraphWidget._GetPage()!=null&&(n=this.CurrentLineWidget.CurrentParagraphWidget._GetPage().Viewer);this._DisposeInternal(n)},i.prototype._DisposeInternal=function(){this.CurrentLineWidget!=null&&(this.CurrentLineWidget.Children._Contains(this)&&this.CurrentLineWidget.Children._Remove(this),this.CurrentLineWidget=null);this.Inline!=null&&(this.Inline.Elements!=null&&this.Inline.Elements._Contains(this)&&this.Inline.Elements._Remove(this),this.BaseNode=null)},i}(uu);t.TextElementBox=it;dt=function(t){function i(n,i,r){t.call(this,n);this.BaselineOffset=0;this.index=0;this.isFollowCharacter=!1;this.ListLevel=i;this.isFollowCharacter=r}return n(i,t),Object.defineProperty(i.prototype,"Paragraph",{get:function(){return this.BaseNode},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Text",{get:function(){return this.text},set:function(n){this.text=n},enumerable:!0,configurable:!0}),i.prototype._render=function(n,t,i,r,u){var h=this.Margin.Top,l=this.Margin.Left,f=this.ListLevel.CharacterFormat,c=this.Paragraph.CharacterFormat,e=f.FontColor,y;n.textBaseline="top";var a="",v="",p=f.FontFamily=="verdana"?c.FontFamily:f.FontFamily,o=f.FontSize==11?c.FontSize:f.FontSize,s=f.BaselineAlignment==0?c.BaselineAlignment:f.BaselineAlignment;a=f.Bold?"bold":"";v=f.Italic?"italic":"";o=o==0?.5:o/(s==vt.Normal?1:1.5);n.font=a+" "+v+" "+o+"px "+p;s==vt.Subscript&&(h+=this.Height-this.Height/1.5);f.HighlightColor!=gt.NoColor&&(t.fillStyle=kt._GetHighlightColorCode(f.HighlightColor),t.fillRect(i+l,r+h,this.Width,this.Height));e=="empty"&&(y=this.Paragraph.Document,e=this.ListLevel.CharacterFormat._GetDefaultFontColor(y));n.fillStyle=e;n.fillText(this.Text,i+l,r+h);f.Underline!=ki.None&&this._renderUnderline(n,i,r,u,e,f.Underline,s);f.StrikeThrough!=cr.None&&this._renderStrikeThrough(n,i,r,f.StrikeThrough,e,s)},i.prototype._Dispose=function(){var n=null;this.CurrentLineWidget!=null&&this.CurrentLineWidget.CurrentParagraphWidget!=null&&this.CurrentLineWidget.CurrentParagraphWidget._GetPage()!=null&&(n=this.CurrentLineWidget.CurrentParagraphWidget._GetPage().Viewer);this._DisposeInternal(n)},i.prototype._DisposeInternal=function(){this.CurrentLineWidget!=null&&(this.CurrentLineWidget.Children._Contains(this)&&this.CurrentLineWidget.Children._Remove(this),this.CurrentLineWidget=null);this.BaseNode=null;this.ListLevel=null},i}(uu);t.ListTextElementBox=dt;gi=function(t){function i(n){t.call(this,n)}return n(i,t),i.prototype._Dispose=function(){var n=null;this.CurrentLineWidget!=null&&this.CurrentLineWidget.CurrentParagraphWidget!=null&&this.CurrentLineWidget.CurrentParagraphWidget._GetPage()!=null&&(n=this.CurrentLineWidget.CurrentParagraphWidget._GetPage().Viewer);this._DisposeInternal(n)},i.prototype._DisposeInternal=function(){this.Inline instanceof g&&this.Inline.LayoutedWidget!=null&&this.Inline.LayoutedWidget._Dispose();this.CurrentLineWidget!=null&&(this.CurrentLineWidget.Children._Contains(this)&&this.CurrentLineWidget.Children._Remove(this),this.CurrentLineWidget=null);this.BaseNode=null},i.prototype._render=function(){},i.prototype._renderComment=function(n){this.BaseNode instanceof g&&this.BaseNode.LayoutedWidget!=null&&this.BaseNode.LayoutedWidget._render(n)},i.prototype._renderCanvas=function(n){this.BaseNode instanceof g&&this.BaseNode.LayoutedWidget!=null&&this.BaseNode.LayoutedWidget._renderCanvas(n)},i}(uu);t.CommentElementBox=gi;br=function(t){function i(n){t.call(this,n)}return n(i,t),Object.defineProperty(i.prototype,"ImageContainer",{get:function(){return this.Inline},enumerable:!0,configurable:!0}),i.prototype._DrawImageonCanvas=function(n,t,i,r,u,f){f.addEventListener("load",function(){u.drawImage(f,n,t,i,r);u.restore()},!1)},i.prototype._render=function(n,t,i,r){var f=this.Margin.Top,o=this.Margin.Left,s=0,l=this.Inline.CharacterFormat,e,u,h,c;n.textBaseline="top";e=document.createElement("img");e.src=this.Inline.ImageString;n.save();(f<0||this.CurrentLineWidget.Width<this.Width)&&(u=this.CurrentLineWidget.CurrentParagraphWidget.ContainerWidget,u instanceof wt?s=u.Width+u.X:u instanceof ii&&(h=0,u.ChildWidgets[0]instanceof ri&&(c=u.ChildWidgets[0].CurrentNode,h=c.ParagraphFormat.LeftIndent),s=u.Width+u.Margin.Left-u.LeftBorderWidth-h),this._ClipRect(n,i+o,r+f,s,u.Height));this.Inline.IsMetaFile||(navigator.userAgent.match("Firefox")?this._DrawImageonCanvas(i+o,r+f,this.Width,this.Height,n,e):(n.drawImage(e,i+o,r+f,this.Width,this.Height),n.restore()))},i.prototype._renderCanvas=function(n,t,i,r){var f=this.Margin.Top,h=this.Margin.Left,e=0,l=this.Inline.CharacterFormat,o,u,s,c;n.textBaseline="top";o=document.createElement("img");o.src=this.Inline.ImageString;n.save();(f<0||this.CurrentLineWidget.Width<this.Width)&&(u=this.CurrentLineWidget.CurrentParagraphWidget.ContainerWidget,u instanceof wt?e=u.Width+u.X:u instanceof ii&&(s=0,u.ChildWidgets[0]instanceof ri&&(c=u.ChildWidgets[0].CurrentNode,s=c.ParagraphFormat.LeftIndent),e=u.Width+u.Margin.Left-u.LeftBorderWidth-s),this._ClipRect(n,i+h,r+f,e,u.Height));this.Inline.IsMetaFile||(n.drawImage(o,i+h,r+f,this.Width,this.Height),n.restore())},i.prototype._Dispose=function(){var n=null;this.CurrentLineWidget!=null&&this.CurrentLineWidget.CurrentParagraphWidget!=null&&this.CurrentLineWidget.CurrentParagraphWidget._GetPage()!=null&&(n=this.CurrentLineWidget.CurrentParagraphWidget._GetPage().Viewer);this._DisposeInternal(n)},i.prototype._DisposeInternal=function(){this.CurrentLineWidget!=null&&(this.CurrentLineWidget.Children._Contains(this)&&this.CurrentLineWidget.Children._Remove(this),this.CurrentLineWidget=null);this.Inline!=null&&(this.Inline.Elements!=null&&this.Inline.Elements._Contains(this)&&this.Inline.Elements._Remove(this),this.BaseNode=null)},i}(uu);t.ImageElementBox=br;fr=function(t){function i(n){t.call(this,n);this.listId=-1;this.SourceListId=-1;this.abstractListId=-1;this.levelOverrides=new yu(this)}return n(i,t),Object.defineProperty(i.prototype,"OwnerDocument",{get:function(){return this.OwnerBase},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"AbstractList",{get:function(){var n=null;return(this.OwnerDocument!=null&&(n=this.OwnerDocument._GetAbstractListAdvByID(this.AbstractListId)),n!=null)?n:this.abstractList},set:function(n){this.abstractList=n},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"ListId",{get:function(){return this.listId},set:function(n){this.listId=n},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"AbstractListId",{get:function(){return this.abstractListId},set:function(n){this.abstractListId=n},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"LevelOverrides",{get:function(){return this.levelOverrides},set:function(n){this.levelOverrides=n},enumerable:!0,configurable:!0}),i.prototype._GetListLevel=function(n){this.AbstractList!=null&&this.AbstractList.Levels.Count<=n&&n>=0&&n<9&&this.OwnerDocument._AddListLevel(this.AbstractList);var t=null;return this.LevelOverrides!=null&&(t=this.LevelOverrides._Get(n))!=null&&t.OverrideListLevel!=null?t.OverrideListLevel:this.AbstractList!=null&&n>=0&&n<this.AbstractList.Levels.Count?this.AbstractList.Levels[n]:null},i.prototype._GetListStartValue=function(n){var t=this.LevelOverrides!=null?this.LevelOverrides._Get(n):null,i;return t!=null&&t.OverrideListLevel==null?t.StartAt:(i=this._GetListLevel(n),i==null?0:i.StartAt)},i.prototype._Dispose=function(){this._SetOwner(null);this.LevelOverrides!=null&&this.LevelOverrides._Dispose();this.levelOverrides=null},i.prototype._SerializeLevelOverrides=function(){for(var t={LevelOverrides:[]},n=0;n<this.LevelOverrides.Count;n++)t.LevelOverrides[n]=this.LevelOverrides[n]._SerializeLevelOverRides();return t.LevelOverrides},i}(fi);t.ListAdv=fr;nr=function(t){function i(n){t.call(this,n);this.abstractListId=-1;this.name="";this.levels=new vu(this)}return n(i,t),Object.defineProperty(i.prototype,"OwnerDocument",{get:function(){return this.OwnerBase},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"AbstractListId",{get:function(){return this.abstractListId},set:function(n){this.abstractListId=n},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Levels",{get:function(){return this.levels},set:function(n){this.levels=n},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Name",{get:function(){return this.name},set:function(n){this.name=n},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"ListType",{get:function(){return this.listType},set:function(n){this.listType=n},enumerable:!0,configurable:!0}),i.prototype.AddListLevel=function(){var n=new lt(this);return this.Levels._Add(n),n},i.prototype._Dispose=function(){var n,t;if(this._SetOwner(null),this.levels!=null)for(n=0;n<this.levels.length;n++)t=this.levels[n],this.levels._Dispose,this.levels._Remove(t),n--},i.prototype._SerializeListLevelAdvCollection=function(){for(var r,n={Levels:[],AbstractListId:[],Name:[],ListType:[]},i=this.Levels,t=0;t<i.Count;t++)r=i[t],n.Levels[t]=r._SerializeListLevelAdv();return n.AbstractListId=this.AbstractListId,n.Name=this.Name,n.ListType=this.ListType,n},i}(fi);t.AbstractListAdv=nr;lt=function(t){function i(n){t.call(this,n);this.listLevelPattern=c.Arabic;this.startAt=0;this.numberFormat="";this.followCharacter=yr.Tab;this.levelNumber=0;this.paragraphFormat=null;this.characterFormat=null;this.restartLevel=0;this.CharacterFormat=new o(this);this.ParagraphFormat=new a(this)}return n(i,t),Object.defineProperty(i.prototype,"OwnerDocument",{get:function(){return this.OwnerBase!=null?this.OwnerBase.OwnerDocument:this.OwnerBase!=null?this.OwnerBase.OwnerList.OwnerDocument:null},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"ListLevelPattern",{get:function(){return this.listLevelPattern},set:function(n){this.listLevelPattern=n},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"FollowCharacter",{get:function(){return this.followCharacter},set:function(n){this.followCharacter=n},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"StartAt",{get:function(){return this.startAt},set:function(n){this.startAt=n},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"NumberFormat",{get:function(){return this.numberFormat},set:function(n){this.numberFormat=n},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"RestartLevel",{get:function(){return this.restartLevel},set:function(n){this.restartLevel=n},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"LevelNumber",{get:function(){return this.OwnerBase instanceof dr?this.OwnerBase.LevelNumber:this.OwnerBase instanceof nr&&this.OwnerBase.Levels!=null?this.OwnerBase.Levels._IndexOf(this):-1},set:function(n){this.levelNumber=n},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"CharacterFormat",{get:function(){return this.characterFormat},set:function(n){this.characterFormat=n},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"ParagraphFormat",{get:function(){return this.paragraphFormat},set:function(n){this.paragraphFormat=n},enumerable:!0,configurable:!0}),i.prototype._GetListText=function(n){switch(this.ListLevelPattern){case c.UpRoman:return this._GetAsRoman(n).toUpperCase();case c.LowRoman:return this._GetAsRoman(n).toLowerCase();case c.UpLetter:return this._GetAsLetter(n).toUpperCase();case c.LowLetter:return this._GetAsLetter(n).toLowerCase();case c.Arabic:return n.toString();case c.LeadingZero:return n<10?"0"+n.toString():n.toString();case c.Number:return n.toString();case c.OrdinalText:return n.toString();case c.Ordinal:return n.toString();case c.FarEast:return n.toString();case c.Special:return n.toString();default:return""}},i.prototype._GetAsRoman=function(n){var t="",i={number:n};return t+=this._GenerateNumber(i,1e3,"M"),t+=this._GenerateNumber(i,900,"CM"),t+=this._GenerateNumber(i,500,"D"),t+=this._GenerateNumber(i,400,"CD"),t+=this._GenerateNumber(i,100,"C"),t+=this._GenerateNumber(i,90,"XC"),t+=this._GenerateNumber(i,50,"L"),t+=this._GenerateNumber(i,40,"XL"),t+=this._GenerateNumber(i,10,"X"),t+=this._GenerateNumber(i,9,"IX"),t+=this._GenerateNumber(i,5,"V"),t+=this._GenerateNumber(i,4,"IV"),t+=this._GenerateNumber(i,1,"I"),t.toString()},i.prototype._GenerateNumber=function(n,t,i){for(var r="";n.number>=t;)n.number-=t,r+=i;return r.toString()},i.prototype._GetAsLetter=function(n){var t,i,r,u;if(n<=0)return"";for(t=n/26,i=n%26,i==0&&(i=26,t--),r=String.fromCharCode(64+i),u=r.toString();t>0;)u=r.toString(),t--;return u},i.prototype._SerializeListLevelAdv=function(){var n={CharacterFormat:[],ParagraphFormat:[],RestartLevel:[],StartAt:[],FollowCharacter:[],LevelNumber:[],ListLevelPattern:[],NumberFormat:[]};return n.CharacterFormat=this.CharacterFormat._SerializeCharacterFormat(),n.ParagraphFormat=this.ParagraphFormat._SerializeParagraphFormat(),n.RestartLevel=this.RestartLevel,n.StartAt=this.StartAt,n.FollowCharacter=this.FollowCharacter,n.LevelNumber=this.LevelNumber,n.ListLevelPattern=this.ListLevelPattern,n.NumberFormat=this.NumberFormat,n},i.prototype._Clone=function(){var n=new i(null);return n._CopyLevel(this),n},i.prototype._CopyLevel=function(n){n.ParagraphFormat!=null&&n.ParagraphFormat!=undefined&&(this.ParagraphFormat=new a(this),this.ParagraphFormat._CopyFormat(n.ParagraphFormat));n.CharacterFormat!=null&&n.CharacterFormat!=undefined&&(this.CharacterFormat=new o(this),this.CharacterFormat._CopyFormat(n.CharacterFormat));n.FollowCharacter!=null&&n.FollowCharacter!=undefined&&(this.FollowCharacter=n.FollowCharacter);n.ListLevelPattern!=null&&n.ListLevelPattern!=undefined&&(this.ListLevelPattern=n.ListLevelPattern);n.NumberFormat!=null&&n.NumberFormat!=undefined&&(this.NumberFormat=n.NumberFormat);n.RestartLevel!=null&&n.RestartLevel!=undefined&&(this.RestartLevel=n.RestartLevel);n.StartAt!=null&&n.StartAt!=undefined&&(this.StartAt=n.StartAt)},i.prototype._Dispose=function(){this._SetOwner(null);this.CharacterFormat._Dispose();this.ParagraphFormat._Dispose()},i.DOTBULLET="",i.SQUAREBULLET="",i.ARROWBULLET="➤",i.CIRCLEBULLET=" ",i}(fi);t.ListLevelAdv=lt;dr=function(t){function i(n){t.call(this,n)}return n(i,t),Object.defineProperty(i.prototype,"OwnerList",{get:function(){return this.OwnerBase},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"StartAt",{get:function(){return this.startAt},set:function(n){this.startAt=n},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"LevelNumber",{get:function(){return this.levelNumber},set:function(n){this.levelNumber=n},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"OverrideListLevel",{get:function(){return this.overrideListLevel},set:function(n){this.overrideListLevel=n},enumerable:!0,configurable:!0}),i.prototype._Clone=function(){var n=new i(null);return n.StartAt!=null&&n.StartAt!=undefined&&(n.StartAt=this.StartAt),n.OverrideListLevel!=null&&n.OverrideListLevel!=undefined&&(n.OverrideListLevel=this.OverrideListLevel),n.LevelNumber!=null&&n.LevelNumber!=undefined&&(n.LevelNumber=this.LevelNumber),n},i.prototype._SerializeLevelOverRides=function(){var n={LevelNumber:[],OverrideListLevel:[],StartAt:[]};return n.LevelNumber=this.LevelNumber,this.OverrideListLevel!=null&&(n.OverrideListLevel=this.OverrideListLevel._SerializeListLevelAdv()),n.StartAt=this.StartAt,n},i}(fi);t.LevelOverrideAdv=dr;kf=function(){function n(){this.levelNumber=0}return Object.defineProperty(n.prototype,"LevelNumber",{get:function(){return this.levelNumber},set:function(n){this.levelNumber=n;this._NotifyPropertyChanged("ListLevel");this._NotifyPropertyChanged("LevelNumber");this._NotifyPropertyChanged("ListLevelPattern");this._NotifyPropertyChanged("FollowCharacter")},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"List",{get:function(){return this.list},set:function(n){n==null?this._CreateList():this.list=n},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"ListLevel",{get:function(){return this.list!=null&&this.levelNumber>=0&&this.levelNumber<9?(this.list.AbstractList.Levels.Count<=this.levelNumber&&this._AddListLevels(),this.list.AbstractList.Levels[this.levelNumber]):null},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"ListLevelPattern",{get:function(){return this.ListLevel!=null?this.ListLevel.ListLevelPattern:c.Arabic},set:function(n){this.ListLevel!=null&&(this.ListLevel.ListLevelPattern=n)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"FollowCharacter",{get:function(){return this.ListLevel!=null?this.ListLevel.FollowCharacter:yr.None},set:function(n){this.ListLevel!=null&&(this.ListLevel.FollowCharacter=n)},enumerable:!0,configurable:!0}),n.prototype._CreateList=function(){this.list=new fr(null);this.list.AbstractList=new nr(null);var n=new lt(this.list.AbstractList);n.ParagraphFormat=new a(n);n.ParagraphFormat.LeftIndent=48;n.ParagraphFormat.FirstLineIndent=-24;n.CharacterFormat=new o(n);n.NumberFormat="%1.";n.StartAt=1;this.list.AbstractList.Levels._Add(n)},n.prototype._AddListLevels=function(){var t,n;if(this.list!=null&&this.list.AbstractList!=null)for(t=this.list.AbstractList.Levels.Count;t<9;t++)n=new lt(this.list.AbstractList),n.CharacterFormat=new o(n),n.ParagraphFormat=new a(n),n.ParagraphFormat.LeftIndent=(t+1)*48,n.ParagraphFormat.FirstLineIndent=-24,n.NumberFormat="%"+(t+1).toString()+".",n.ListLevelPattern=t%3,n.FollowCharacter=yr.Tab,n.StartAt=1,n.RestartLevel=t,this.list.AbstractList.Levels._Add(n)},n.prototype._NotifyPropertyChanged=function(n){switch(n){case"ListLevel":return this.ListLevel}},n.prototype._Dispose=function(){this.list=null},n}();t.ListDialogVieModel=kf;fu=function(t){function i(n){t.call(this,n);this.propertyFlag=0}return n(i,t),Object.defineProperty(i.prototype,"HeaderDistance",{get:function(){return this._GetValue(i.HeaderDistanceProperty)},set:function(n){this._SetValue(i.HeaderDistanceProperty,n);this._RelayoutForSectionFormat()},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"FooterDistance",{get:function(){return this._GetValue(i.FooterDistanceProperty)},set:function(n){this._SetValue(i.FooterDistanceProperty,n);this._RelayoutForSectionFormat()},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"DifferentFirstPage",{get:function(){return this._GetValue(i.DifferentFirstPageProperty)},set:function(n){this._SetValue(i.DifferentFirstPageProperty,n)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"DifferentOddAndEvenPages",{get:function(){return this._GetValue(i.DifferentOddAndEvenPagesProperty)},set:function(n){this._SetValue(i.DifferentOddAndEvenPagesProperty,n)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"PageWidth",{get:function(){return this._GetValue(i.PageWidthProperty)},set:function(n){this._SetValue(i.PageWidthProperty,n);this._RelayoutForSectionFormat()},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"PageHeight",{get:function(){return this._GetValue(i.PageHeightProperty)},set:function(n){this._SetValue(i.PageHeightProperty,n);this._RelayoutForSectionFormat()},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"LeftMargin",{get:function(){return this._GetValue(i.LeftMarginProperty)},set:function(n){this._SetValue(i.LeftMarginProperty,n);this._RelayoutForSectionFormat()},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"TopMargin",{get:function(){return this._GetValue(i.TopMarginProperty)},set:function(n){this._SetValue(i.TopMarginProperty,n);this._RelayoutForSectionFormat()},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"RightMargin",{get:function(){return this._GetValue(i.RightMarginProperty)},set:function(n){this._SetValue(i.RightMarginProperty,n);this._RelayoutForSectionFormat()},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"BottomMargin",{get:function(){return this._GetValue(i.BottomMarginProperty)},set:function(n){this._SetValue(i.BottomMarginProperty,n);this._RelayoutForSectionFormat()},enumerable:!0,configurable:!0}),i.prototype._HasValue=function(n){switch(n){case i.HeaderDistanceProperty:return(this.propertyFlag&1)==1;case i.FooterDistanceProperty:return(this.propertyFlag&2)==2;case i.BottomMarginProperty:return(this.propertyFlag&4)==4;case i.TopMarginProperty:return(this.propertyFlag&8)==8;case i.DifferentFirstPageProperty:return(this.propertyFlag&16)==16;case i.DifferentOddAndEvenPagesProperty:return(this.propertyFlag&32)==32;case i.PageHeightProperty:return(this.propertyFlag&64)==64;case i.PageWidthProperty:return(this.propertyFlag&128)==128;case i.LeftMarginProperty:return(this.propertyFlag&256)==256;case i.RightMarginProperty:return(this.propertyFlag&512)==512;default:return!1}},i.prototype._SetValue=function(n,t){if(t!=undefined){var u=this._HasValue(n),r=0;switch(n){case i.HeaderDistanceProperty:r|=1;this.headerDistance=t;break;case i.FooterDistanceProperty:r|=2;this.footerDistance=t;break;case i.BottomMarginProperty:r|=4;this.bottomMargin=t;break;case i.TopMarginProperty:r|=8;this.topMargin=t;break;case i.DifferentFirstPageProperty:r|=16;this.differentFirstPage=t;break;case i.DifferentOddAndEvenPagesProperty:r|=32;this.differentOddAndEvenPages=t;break;case i.PageHeightProperty:r|=64;this.pageHeight=t;break;case i.PageWidthProperty:r|=128;this.pageWidth=t;break;case i.LeftMarginProperty:r|=256;this.leftMargin=t;break;case i.RightMarginProperty:r|=512;this.rightMargin=t}u||(this.propertyFlag|=r)}},i.prototype._GetValue=function(n){var u=this._HasValue(n),r=!u,t;switch(n){case i.HeaderDistanceProperty:t=r?48:this.headerDistance;break;case i.FooterDistanceProperty:t=r?48:this.footerDistance;break;case i.BottomMarginProperty:t=r?96:this.bottomMargin;break;case i.TopMarginProperty:t=r?96:this.topMargin;break;case i.DifferentFirstPageProperty:t=r?!1:this.differentFirstPage;break;case i.DifferentOddAndEvenPagesProperty:t=r?!1:this.differentOddAndEvenPages;break;case i.PageHeightProperty:t=r?1056:this.pageHeight;break;case i.PageWidthProperty:t=r?816:this.pageWidth;break;case i.LeftMarginProperty:t=r?96:this.leftMargin;break;case i.RightMarginProperty:t=r?96:this.rightMargin}return t},i.prototype._ClearValue=function(n){switch(n){case i.HeaderDistanceProperty:this.propertyFlag=this.propertyFlag^1;case i.FooterDistanceProperty:this.propertyFlag=this.propertyFlag^2;case i.BottomMarginProperty:this.propertyFlag=this.propertyFlag^4;case i.TopMarginProperty:this.propertyFlag=this.propertyFlag^8;case i.DifferentFirstPageProperty:this.propertyFlag=this.propertyFlag^16;case i.DifferentOddAndEvenPagesProperty:this.propertyFlag=this.propertyFlag^32;case i.PageHeightProperty:this.propertyFlag=this.propertyFlag^64;case i.PageWidthProperty:this.propertyFlag=this.propertyFlag^128;case i.LeftMarginProperty:this.propertyFlag=this.propertyFlag^256;case i.RightMarginProperty:this.propertyFlag=this.propertyFlag^512}},i.prototype._RelayoutForSectionFormat=function(){var n,t,i;this.OwnerBase instanceof ct&&this.OwnerBase.BaseParent!=null&&(n=0,t=0,this.OwnerBase.BaseParent!=null&&this.OwnerBase.BaseParent.IsDocumentLoaded&&this.OwnerBase.BaseParent.IsLayoutEnabled&&(this.OwnerBase.BaseParent.Viewer.VerticalScrollBar!=null&&(n=this.OwnerBase.BaseParent.Viewer.VerticalScrollBar.model.value),this.OwnerBase.BaseParent.Viewer.HorizontalScrollBar!=null&&(t=this.OwnerBase.BaseParent.Viewer.HorizontalScrollBar.model.value)),i=void 0,this.OwnerBase.Document._LayoutItems(i),this.OwnerBase.BaseParent!=null&&this.OwnerBase.BaseParent.IsDocumentLoaded&&this.OwnerBase.BaseParent.IsLayoutEnabled&&(this.OwnerBase.BaseParent.Viewer.VerticalScrollBar!=null&&(this.OwnerBase.BaseParent.Viewer.VerticalScrollBar.model.value=n),this.OwnerBase.BaseParent.Viewer.HorizontalScrollBar!=null&&(this.OwnerBase.BaseParent.Viewer.HorizontalScrollBar.model.value=t)))},i.prototype._ApplyPropertyValue=function(n,t,i){n!=null&&(i=n._AddModifiedPropertiesForSectionFormat(this,t,i));t=="PageSizeProperty"?(this.PageWidth=i.Width,this.PageHeight=i.Height):t=="PageMarginProperty"&&(this.LeftMargin=i.Left,this.RightMargin=i.Right,this.TopMargin=i.Top,this.BottomMargin=i.Bottom)},i.prototype._CopyFormat=function(n){n.PageHeight!=null&&n.PageWidth!=undefined&&(this.PageHeight=n.PageHeight);n.PageWidth!=null&&n.PageWidth!=undefined&&(this.PageWidth=n.PageWidth);n.LeftMargin!=null&&n.LeftMargin!=undefined&&(this.LeftMargin=n.LeftMargin);n.RightMargin!=null&&n.RightMargin!=undefined&&(this.RightMargin=n.RightMargin);n.TopMargin!=null&&n.TopMargin!=undefined&&(this.TopMargin=n.TopMargin);n.BottomMargin!=null&&n.BottomMargin!=undefined&&(this.BottomMargin=n.BottomMargin);n.HeaderDistance!=null&&n.HeaderDistance!=undefined&&(this.HeaderDistance=n.HeaderDistance);n.FooterDistance!=null&&n.FooterDistance!=undefined&&(this.FooterDistance=n.FooterDistance)},i.prototype._GetSectionPropertyValue=function(n,t){var i;return n=="PageSizeProperty"?(i=new lf(null,null),i.Height=t.PageHeight,i.Width=t.PageWidth):n=="PageMarginProperty"&&(i=new tu(null,null,null,null),i.Left=t.LeftMargin,i.Right=t.RightMargin,i.Top=t.TopMargin,i.Bottom=t.BottomMargin),i},i.prototype._SerializeSectionFormat=function(){var n={BottomMargin:[],DifferentFirstPage:[],DifferentOddAndEvenPages:[],FooterDistance:[],HeaderDistance:[],LeftMargin:[],PageHeight:[],PageWidth:[],RightMargin:[],TopMargin:[]};return n.BottomMargin=this._HasValue(i.BottomMarginProperty)?this.BottomMargin:null,n.DifferentFirstPage=this._HasValue(i.DifferentFirstPageProperty)?this.DifferentFirstPage:null,n.DifferentOddAndEvenPages=this._HasValue(i.DifferentOddAndEvenPagesProperty)?this.DifferentOddAndEvenPages:null,n.FooterDistance=this._HasValue(i.FooterDistanceProperty)?this.FooterDistance:null,n.HeaderDistance=this._HasValue(i.HeaderDistanceProperty)?this.HeaderDistance:null,n.LeftMargin=this._HasValue(i.LeftMarginProperty)?this.LeftMargin:null,n.PageHeight=this._HasValue(i.PageHeightProperty)?this.PageHeight:null,n.PageWidth=this._HasValue(i.PageWidthProperty)?this.PageWidth:null,n.RightMargin=this._HasValue(i.RightMarginProperty)?this.RightMargin:null,n.TopMargin=this._HasValue(i.TopMarginProperty)?this.TopMargin:null,n},i.prototype._Dispose=function(){this._SetOwner(null)},i.HeaderDistanceProperty="HeaderDistance",i.FooterDistanceProperty="FooterDistance",i.DifferentFirstPageProperty="DifferentFirstPage",i.DifferentOddAndEvenPagesProperty="DifferentOddAndEvenPages",i.PageWidthProperty="PageWidth",i.PageHeightProperty="PageHeight",i.LeftMarginProperty="LeftMargin",i.TopMarginProperty="TopMargin",i.RightMarginProperty="RightMargin",i.BottomMarginProperty="BottomMargin",i}(yt);t.SectionFormat=fu;o=function(t){function i(n){t.call(this,n);this.propertyFlag=0}return n(i,t),Object.defineProperty(i.prototype,"Bold",{get:function(){return this._GetPropertyValue(i.BoldProperty)},set:function(n){this._SetValue(i.BoldProperty,n)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Italic",{get:function(){return this._GetPropertyValue(i.ItalicProperty)},set:function(n){this._SetValue(i.ItalicProperty,n)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"FontSize",{get:function(){return this._GetPropertyValue(i.FontSizeProperty)},set:function(n){this._SetValue(i.FontSizeProperty,n)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"FontFamily",{get:function(){return this._GetPropertyValue(i.FontFamilyProperty)},set:function(n){this._SetValue(i.FontFamilyProperty,n)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Underline",{get:function(){return this._GetPropertyValue(i.UnderlineProperty)},set:function(n){this._SetValue(i.UnderlineProperty,n)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"StrikeThrough",{get:function(){return this._GetPropertyValue(i.StrikeThroughProperty)},set:function(n){this._SetValue(i.StrikeThroughProperty,n)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"BaselineAlignment",{get:function(){return this._GetPropertyValue(i.BaselineAlignmentProperty)},set:function(n){this._SetValue(i.BaselineAlignmentProperty,n)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"HighlightColor",{get:function(){return this._GetPropertyValue(i.HighlightColorProperty)},set:function(n){this._SetValue(i.HighlightColorProperty,n)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"FontColor",{get:function(){return this._GetPropertyValue(i.FontColorProperty)},set:function(n){this._SetValue(i.FontColorProperty,n)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"OwnerDocument",{get:function(){return this.OwnerBase instanceof k&&this.OwnerBase.OwnerParagraph!=null&&this.OwnerBase.OwnerParagraph.Document!=null?this.OwnerBase.OwnerParagraph.Document:this.OwnerBase instanceof u&&this.OwnerBase.Document!=null?this.OwnerBase.Document:this.OwnerBase instanceof lt?this.OwnerBase.OwnerDocument:this.OwnerBase instanceof ti?this.OwnerBase:null},enumerable:!0,configurable:!0}),i.prototype._HasValue=function(n){switch(n){case i.BoldProperty:return(this.propertyFlag&1)==1;case i.ItalicProperty:return(this.propertyFlag&2)==2;case i.FontSizeProperty:return(this.propertyFlag&4)==4;case i.FontFamilyProperty:return(this.propertyFlag&8)==8;case i.UnderlineProperty:return(this.propertyFlag&16)==16;case i.StrikeThroughProperty:return(this.propertyFlag&32)==32;case i.BaselineAlignmentProperty:return(this.propertyFlag&64)==64;case i.HighlightColorProperty:return(this.propertyFlag&128)==128;case i.FontColorProperty:return(this.propertyFlag&256)==256;default:return!1}},i.prototype._ClearValue=function(n){switch(n){case i.BoldProperty:this.propertyFlag=this.propertyFlag^1;case i.ItalicProperty:this.propertyFlag=this.propertyFlag^2;case i.FontSizeProperty:this.propertyFlag=this.propertyFlag^4;case i.FontFamilyProperty:this.propertyFlag=this.propertyFlag^8;case i.UnderlineProperty:this.propertyFlag=this.propertyFlag^16;case i.StrikeThroughProperty:this.propertyFlag=this.propertyFlag^32;case i.BaselineAlignmentProperty:this.propertyFlag=this.propertyFlag^64;case i.HighlightColorProperty:this.propertyFlag=this.propertyFlag^128;case i.FontColorProperty:this.propertyFlag=this.propertyFlag^256}},i.prototype._SetValue=function(n,t){if(t!=undefined){var u=this._HasValue(n),r=0;switch(n){case i.BoldProperty:r|=1;this.bold=t;break;case i.ItalicProperty:r|=2;this.italic=t;break;case i.FontSizeProperty:r|=4;this.fontSize=t;break;case i.FontFamilyProperty:r|=8;this.fontFamily=t;break;case i.UnderlineProperty:r|=16;this.underline=t;break;case i.StrikeThroughProperty:r|=32;this.strikeThrough=t;break;case i.BaselineAlignmentProperty:r|=64;this.baselineAlignment=t;break;case i.HighlightColorProperty:r|=128;this.highlightColor=t;break;case i.FontColorProperty:r|=256;this.fontColor=t}u||(this.propertyFlag|=r)}},i.prototype._GetValue=function(n,t){var r;switch(n){case i.BoldProperty:r=t?!1:this.bold;break;case i.ItalicProperty:r=t?!1:this.italic;break;case i.FontSizeProperty:r=t?11:this.fontSize;break;case i.FontFamilyProperty:r=t?"verdana":this.fontFamily;break;case i.UnderlineProperty:r=t?ki.None:this.underline;break;case i.StrikeThroughProperty:r=t?cr.None:this.strikeThrough;break;case i.BaselineAlignmentProperty:r=t?vt.Normal:this.baselineAlignment;break;case i.HighlightColorProperty:r=t?gt.NoColor:this.highlightColor;break;case i.FontColorProperty:r=t?"empty":this.fontColor}return r},i.prototype._GetPropertyValue=function(n){var i=this._HasValue(n),t;if(i)return this._GetValue(n,!1);if(this.OwnerBase instanceof k||this.OwnerBase instanceof u){if(t=this.OwnerDocument,t!=null)return t.CharacterFormat._GetPropertyValue(n)}else if(this.OwnerBase instanceof ti)return this._GetDefaultValue(n);return this._GetValue(n,!0)},i.prototype._GetDefaultValue=function(n){var t=null,i=this.OwnerBase;return t=this._GetControlDefaultValue(i.OwnerControl,n),t==null&&(t=this._GetValue(n,!0)),t},i.prototype._GetControlDefaultValue=function(n,t){var r;return n==null||n.DocumentEditorElement==null?null:(r=n.DocumentEditorElement,t==i.FontColorProperty)?this._GetDefaultFontColor(n.Document):t==i.FontFamilyProperty?r.style.fontFamily!=""?r.style.fontFamily:null:t==i.FontSizeProperty?r.style.fontSize!=""?parseFloat(r.style.fontSize):null:t==i.BoldProperty?null:t==i.ItalicProperty?r.style.fontStyle.toLowerCase()=="italic"?!0:null:null},i.prototype._GetDefaultFontColor=function(n){if(n!=null){var t=n.BackgroundColor;return kt._IsVeryDark(t)?"#FFFFFF":"#000000"}},i.prototype._GetCharacterPropertyValue=function(n,t){var r;return n==i.BoldProperty?r=t.Bold:n==i.ItalicProperty?r=t.Italic:n==i.FontColorProperty?r=t.FontColor:n==i.FontFamilyProperty?r=t.FontFamily:n==i.FontSizeProperty?r=t.FontSize:n==i.HighlightColorProperty?r=t.HighlightColor:n==i.BaselineAlignmentProperty?r=t.BaselineAlignment:n==i.StrikeThroughProperty?r=t.StrikeThrough:n==i.UnderlineProperty&&(r=t.Underline),r},i.prototype._CloneFormat=function(){var n=new i(null);return n.BaselineAlignment!=undefined&&n.BaselineAlignment!=null&&(n.BaselineAlignment=this.BaselineAlignment),n.Underline!=undefined&&n.Underline!=null&&(n.Underline=this.Underline),n.StrikeThrough!=undefined&&n.StrikeThrough!=null&&(n.StrikeThrough=this.StrikeThrough),n.FontSize!=undefined&&n.FontSize!=null&&(n.FontSize=this.FontSize),n.FontFamily!=undefined&&n.FontFamily!=null&&(n.FontFamily=this.FontFamily),n.Bold!=undefined&&n.Bold!=null&&(n.Bold=this.Bold),n.Italic!=undefined&&n.Italic!=null&&(n.Italic=this.Italic),n.HighlightColor!=undefined&&n.HighlightColor!=null&&(n.HighlightColor=this.HighlightColor),n.FontColor!=undefined&&n.FontColor!=null&&(n.FontColor=this.FontColor),n},i.prototype._CopyFormat=function(n){n.baselineAlignment!=undefined&&n.baselineAlignment!=null&&(this.BaselineAlignment=n.baselineAlignment);n.underline!=undefined&&n.underline!=null&&(this.Underline=n.underline);n.strikeThrough!=undefined&&n.strikeThrough!=null&&(this.StrikeThrough=n.strikeThrough);n.fontSize!=undefined&&n.fontSize!=null&&(this.FontSize=n.fontSize);n.fontFamily!=undefined&&n.fontFamily!=null&&(this.FontFamily=n.fontFamily);n.bold!=undefined&&n.bold!=null&&(this.Bold=n.bold);n.italic!=undefined&&n.italic!=null&&(this.Italic=n.italic);n.highlightColor!=undefined&&n.highlightColor!=null&&(this.HighlightColor=n.highlightColor);n.fontColor!=undefined&&n.fontColor!=null&&(this.FontColor=n.fontColor)},i.prototype._GetAsHtmlStyle=function(){var n='style="';return n+=this.Bold?"font-weight:bold; ":"font-weight:normal; ",n+=this.Italic?"font-style:italic; ":"font-style:normal; ",this.Underline!=ki.None&&(n+="text-decoration:underline; "),this.StrikeThrough!=cr.None&&(n+="text-decoration:line-through; "),this.BaselineAlignment==vt.Subscript?n+="vertical-align:sub;":this.BaselineAlignment==vt.Superscript&&(n+="vertical-align:super; "),this.FontColor=this.FontColor.replace(/"/g,""),this.FontFamily=this.FontFamily.replace(/"/g,""),n+="color:"+this.FontColor+"; font-family:"+this.FontFamily+"; font-size:"+this.FontSize+"px; ",this.HighlightColor!=gt.NoColor&&(n+="background:"+kt._GetHighlightColorCode(this.HighlightColor)),n+'" '},i.prototype._IsEqualFormat=function(n){return this.FontSize==n.FontSize&&this.FontFamily==n.FontFamily&&this.Bold==n.Bold&&this.Italic==n.Italic&&this.BaselineAlignment==n.BaselineAlignment&&this.Underline==n.Underline&&this.FontColor==n.FontColor&&this.StrikeThrough==n.StrikeThrough&&this.HighlightColor==n.HighlightColor},i.prototype._Relayout=function(){var n,t,i;this.OwnerBase instanceof ti?(n=0,t=0,this.OwnerBase.OwnerControl!=null&&this.OwnerBase.OwnerControl.IsDocumentLoaded&&this.OwnerBase.OwnerControl.IsLayoutEnabled&&(this.OwnerBase.OwnerControl.Viewer.VerticalScrollBar!=null&&(n=this.OwnerBase.OwnerControl.Viewer.VerticalScrollBar.model.value),this.OwnerBase.OwnerControl.Viewer.HorizontalScrollBar!=null&&(t=this.OwnerBase.OwnerControl.Viewer.HorizontalScrollBar.model.value)),this.OwnerBase._LayoutItems(this.OwnerBase.OwnerControl.Viewer),this.OwnerBase.OwnerControl!=null&&this.OwnerBase.OwnerControl.IsDocumentLoaded&&this.OwnerBase.OwnerControl.IsLayoutEnabled&&(this.OwnerBase.OwnerControl.Viewer.VerticalScrollBar!=null&&this.OwnerBase.OwnerControl.Viewer.VerticalScrollBar.setModel[n],this.OwnerBase.OwnerControl.Viewer.HorizontalScrollBar!=null&&this.OwnerBase.OwnerControl.Viewer.HorizontalScrollBar.setModel[t])):this.OwnerBase instanceof u?this.OwnerBase._RelayoutWithIndex(0):this.OwnerBase instanceof k&&this.OwnerBase.OwnerParagraph!=null&&(i=this.OwnerBase.OwnerParagraph.Inlines._IndexOf(this.OwnerBase),this.OwnerBase.OwnerParagraph._RelayoutWithIndex(i))},i.prototype._HandleCharacterFormat=function(n){var t=this.OwnerDocument;t!=null&&t.OwnerControl!=null&&(t.OwnerControl.IsLayoutEnabled=!1);this._CopyFormat(n);t!=null&&t.OwnerControl!=null&&(t.OwnerControl.IsLayoutEnabled=!0);this._Relayout()},i.prototype._ApplyPropertyValueInternal=function(n,t,i){this._ApplyPropertyValue(n,t,i,!1)},i.prototype._ApplyPropertyValue=function(n,t,r,u){if(u&&t==i.FontFamilyProperty&&(r=this._UpdateFontSize(r)),n!=null&&(r=n._AddModifiedProperties(this,t,r)),r==di.PropertyUnsetValue){this._ClearValue(t);return}if(r instanceof i){this._HandleCharacterFormat(r);return}t==i.BoldProperty?this.Bold=r:t==i.ItalicProperty?this.Italic=r:t==i.FontColorProperty?this.FontColor=r:t==i.FontFamilyProperty?this.FontFamily=r:t==i.FontSizeProperty?this.FontSize=r:t==i.HighlightColorProperty?this.HighlightColor=r:t==i.BaselineAlignmentProperty?this.BaselineAlignment=r:t==i.StrikeThroughProperty?this.StrikeThrough=r:t==i.UnderlineProperty&&(this.Underline=r)},i.prototype._UpdateFontSize=function(n){var i,t;if(typeof n=="number"&&!(n<0&&this.FontSize==1))return this.FontSize+n;if(i=[8,9,10,11,12,14,16,18,20,24,26,28,36,48,72],typeof n=="string"&&n=="increment"){if(this.FontSize<8)return this.FontSize+1;if(this.FontSize>=72&&this.FontSize<80)return 80;if(this.FontSize>=80)return this.FontSize+10;for(t=0;t<i.length;t++)if(this.FontSize<i[t])return i[t]}else if(typeof n=="string"&&n=="decrement"&&this.FontSize>1){if(this.FontSize<=8)return this.FontSize-1;if(this.FontSize>72&&this.FontSize<=80)return 72;if(this.FontSize>80)return this.FontSize-10;for(t=0;t<i.length;t++)if(this.FontSize<=i[t])return i[t-1]}return this.FontSize},i.prototype._Dispose=function(){this._SetOwner(null)},i.prototype._SerializeCharacterFormat=function(){var n={BaselineAlignment:[],Bold:[],FontColor:[],FontFamily:[],FontSize:[],HighlightColor:[],Italic:[],StrikeThrough:[],Underline:[]};return n.BaselineAlignment=this._HasValue(i.BaselineAlignmentProperty)?this.BaselineAlignment:null,n.Bold=this._HasValue(i.BoldProperty)?this.Bold:null,n.FontColor=this._HasValue(i.FontColorProperty)?this.FontColor:null,n.FontFamily=this._HasValue(i.FontFamilyProperty)?this.FontFamily:null,n.FontSize=this._HasValue(i.FontSizeProperty)?this.FontSize:null,n.HighlightColor=this._HasValue(i.HighlightColorProperty)?this.HighlightColor:null,n.Italic=this._HasValue(i.ItalicProperty)?this.Italic:null,n.StrikeThrough=this._HasValue(i.StrikeThroughProperty)?this.StrikeThrough:null,n.Underline=this._HasValue(i.UnderlineProperty)?this.Underline:null,n},i.BoldProperty="Bold",i.ItalicProperty="Italic",i.FontSizeProperty="FontSize",i.FontFamilyProperty="FontFamily",i.UnderlineProperty="Underline",i.StrikeThroughProperty="StrikeThrough",i.BaselineAlignmentProperty="BaselineAlignment",i.HighlightColorProperty="HighlightColor",i.FontColorProperty="FontColor",i}(fi);t.CharacterFormat=o;a=function(t){function i(n){t.call(this,n);this.propertyFlag=0;this.ListFormat=new bi(this)}return n(i,t),Object.defineProperty(i.prototype,"Document",{get:function(){return this.OwnerBase instanceof u&&this.OwnerBase.Document!=null?this.OwnerBase.Document:this.OwnerBase instanceof lt?this.OwnerBase.OwnerDocument:this.OwnerBase instanceof ti?this.OwnerBase:null},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"LeftIndent",{get:function(){return this._GetPropertyValue(i.LeftIndentProperty)},set:function(n){this._SetValue(i.LeftIndentProperty,n);this._RelayoutParagraph()},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"RightIndent",{get:function(){return this._GetPropertyValue(i.RightIndentProperty)},set:function(n){this._SetValue(i.RightIndentProperty,n);this._RelayoutParagraph()},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"FirstLineIndent",{get:function(){return this._GetPropertyValue(i.FirstLineIndentProperty)},set:function(n){this._SetValue(i.FirstLineIndentProperty,n);this._RelayoutParagraph()},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"BeforeSpacing",{get:function(){return this._GetPropertyValue(i.BeforeSpacingProperty)},set:function(n){this._ValidateSpacing(n);this._SetValue(i.BeforeSpacingProperty,n);this._RelayoutParagraph()},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"AfterSpacing",{get:function(){return this._GetPropertyValue(i.AfterSpacingProperty)},set:function(n){this._ValidateSpacing(n);this._SetValue(i.AfterSpacingProperty,n);this._RelayoutParagraph()},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"LineSpacing",{get:function(){return this._GetPropertyValue(i.LineSpacingProperty)},set:function(n){this._ValidateLineSpacing(n);this._SetValue(i.LineSpacingProperty,n);this._RelayoutParagraph()},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"LineSpacingType",{get:function(){return this._GetPropertyValue(i.LineSpacingTypeProperty)},set:function(n){this.LineSpacing=n==ei.Multiple?1:16;this._SetValue(i.LineSpacingTypeProperty,n);this._RelayoutParagraph()},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"TextAlignment",{get:function(){return this._GetPropertyValue(i.TextAlignmentProperty)},set:function(n){this._SetValue(i.TextAlignmentProperty,n);this._RelayoutParagraph()},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"ListFormat",{get:function(){return this._GetPropertyValue(i.ListFormatProperty)},set:function(n){this._SetValue(i.ListFormatProperty,n);this._OnListFormatChanged(this.listFormat)},enumerable:!0,configurable:!0}),i.prototype._HasValue=function(n){switch(n){case i.LeftIndentProperty:return(this.propertyFlag&1)==1;case i.RightIndentProperty:return(this.propertyFlag&2)==2;case i.FirstLineIndentProperty:return(this.propertyFlag&4)==4;case i.BeforeSpacingProperty:return(this.propertyFlag&8)==8;case i.AfterSpacingProperty:return(this.propertyFlag&16)==16;case i.LineSpacingProperty:return(this.propertyFlag&32)==32;case i.LineSpacingTypeProperty:return(this.propertyFlag&64)==64;case i.TextAlignmentProperty:return(this.propertyFlag&128)==128;case i.ListFormatProperty:return(this.propertyFlag&256)==256;default:return!1}},i.prototype._SetValue=function(n,t){if(t!=undefined){var u=this._HasValue(n),r=0;switch(n){case i.LeftIndentProperty:r|=1;this.leftIndent=t;break;case i.RightIndentProperty:r|=2;this.rightIndent=t;break;case i.FirstLineIndentProperty:r|=4;this.firstLineIndent=t;break;case i.BeforeSpacingProperty:r|=8;this.beforeSpacing=t;break;case i.AfterSpacingProperty:r|=16;this.afterSpacing=t;break;case i.LineSpacingProperty:r|=32;this.lineSpacing=t;break;case i.LineSpacingTypeProperty:r|=64;this.lineSpacingType=t;break;case i.TextAlignmentProperty:r|=128;this.textalignment=t;break;case i.ListFormatProperty:r|=256;this.listFormat=t}u||(this.propertyFlag|=r)}},i.prototype._ClearValue=function(n){switch(n){case i.LeftIndentProperty:this.propertyFlag=this.propertyFlag^1;case i.RightIndentProperty:this.propertyFlag=this.propertyFlag^2;case i.FirstLineIndentProperty:this.propertyFlag=this.propertyFlag^4;case i.BeforeSpacingProperty:this.propertyFlag=this.propertyFlag^8;case i.AfterSpacingProperty:this.propertyFlag=this.propertyFlag^16;case i.LineSpacingProperty:this.propertyFlag=this.propertyFlag^32;case i.LineSpacingTypeProperty:this.propertyFlag=this.propertyFlag^64;case i.TextAlignmentProperty:this.propertyFlag=this.propertyFlag^128;case i.ListFormatProperty:this.propertyFlag=this.propertyFlag^256}},i.prototype._GetValue=function(n,t){var r;switch(n){case i.LeftIndentProperty:r=t?0:this.leftIndent;break;case i.RightIndentProperty:r=t?0:this.rightIndent;break;case i.FirstLineIndentProperty:r=t?0:this.firstLineIndent;break;case i.BeforeSpacingProperty:r=t?0:this.beforeSpacing;break;case i.AfterSpacingProperty:r=t?0:this.afterSpacing;break;case i.LineSpacingProperty:r=t?1:this.lineSpacing;break;case i.LineSpacingTypeProperty:r=t?ei.Multiple:this.lineSpacingType;break;case i.TextAlignmentProperty:r=t?rt.Left:this.textalignment;break;case i.ListFormatProperty:r=t?null:this.listFormat}return r},i.prototype._GetPropertyValue=function(n){var i=this._HasValue(n),t;return i?this._GetValue(n,!1):this.OwnerBase instanceof u&&(t=this.Document,t!=null)?t.ParagraphFormat._GetPropertyValue(n):this._GetValue(n,!0)},i.prototype._ValidateSpacing=function(n){if(n<0||n>2112)throw new RangeError("The value must be 0px to 2112px.");},i.prototype._ValidateLineSpacing=function(n){switch(this.LineSpacingType){case ei.AtLeast:if(n<.9||n>2112)throw new RangeError("The value must be between 0.9px to 2112px");break;case ei.Exactly:if(n<.9||n>2112)throw new RangeError("The value must be between 0.9px to 2112px");break;case ei.Multiple:if(n<.06||n>132)throw new RangeError("The value must be between 0.06 to 132");}},i.prototype._OnListFormatChanged=function(n){if(n instanceof bi){var t=n;t._SetOwner(this);n._UpdateOwnerParagraphFormat();t._Relayout()}},i.prototype._CopyFromListLevelParagrahFormat=function(n){n.LeftIndent!=null&&n.LeftIndent!=undefined&&(this.LeftIndent=n.LeftIndent);n.FirstLineIndent!=null&&n.FirstLineIndent!=undefined&&(this.FirstLineIndent=n.FirstLineIndent)},i.prototype._RelayoutParagraph=function(){var n,t,i;this.OwnerBase instanceof ti?(n=0,t=0,this.OwnerBase.OwnerControl!=null&&this.OwnerBase.OwnerControl.IsLayoutEnabled&&(this.OwnerBase.OwnerControl.IsDocumentLoaded&&(this.OwnerBase.OwnerControl.Viewer.VerticalScrollBar!=null&&(n=this.OwnerBase.OwnerControl.Viewer.VerticalScrollBar.model.value),this.OwnerBase.OwnerControl.Viewer.HorizontalScrollBar!=null&&(t=this.OwnerBase.OwnerControl.Viewer.HorizontalScrollBar.model.value)),i=void 0,this.OwnerBase._LayoutItems(i),this.OwnerBase.OwnerControl.IsDocumentLoaded&&(this.OwnerBase.OwnerControl.Viewer.VerticalScrollBar!=null&&(this.OwnerBase.OwnerControl.Viewer.VerticalScrollBar.Value=n),this.OwnerBase.OwnerControl.Viewer.HorizontalScrollBar!=null&&(this.OwnerBase.OwnerControl.Viewer.HorizontalScrollBar.model.value=t)))):this.OwnerBase instanceof u&&this.OwnerBase._RelayoutParagraph(0)},i.prototype._ApplyPropertyValueInternal=function(n,t,i){this._ApplyPropertyValue(n,t,i,!1)},i.prototype._ApplyPropertyValue=function(n,t,r,u){if(u&&t==i.LeftIndentProperty&&(r=this.LeftIndent+r),t==i.ListFormatProperty&&r instanceof bi){var f=r;this._HasValue(bi.ListLevelNumberProperty)||(f.ListLevelNumber=f.ListLevelNumber)}if(n!=null&&(r=n._AddModifiedPropertiesForParagraphFormat(this,t,r)),r==di.PropertyUnsetValue){this._ClearValue(t);return}if(r instanceof i){t==null?this._HandleParagraphFormat(r):t==i.ListFormatProperty&&this._HandleListFormat(r,n.OwnerControl.History);return}t==i.AfterSpacingProperty?this.AfterSpacing=r:t==i.BeforeSpacingProperty?this.BeforeSpacing=r:t==i.LeftIndentProperty?this.LeftIndent=r:t==i.LineSpacingTypeProperty?this.LineSpacingType=r:t==i.LineSpacingProperty?this.LineSpacing=r:t==i.RightIndentProperty?this.RightIndent=r:t==i.FirstLineIndentProperty?this.FirstLineIndent=r:t==i.TextAlignmentProperty?this.TextAlignment=r:t==i.ListFormatProperty&&(this.ListFormat=r)},i.prototype._GetParagraphPropertyValue=function(n,t){var r;return n==i.AfterSpacingProperty?r=t.AfterSpacing:n==i.BeforeSpacingProperty?r=t.BeforeSpacing:n==i.FirstLineIndentProperty?r=t.FirstLineIndent:n==i.LeftIndentProperty?r=t.LeftIndent:n==i.LineSpacingTypeProperty?r=t.LineSpacingType:n==i.LineSpacingProperty?r=t.LineSpacing:n==i.RightIndentProperty?r=t.RightIndent:n==i.TextAlignmentProperty&&(r=t.TextAlignment),r},i.prototype._HandleParagraphFormat=function(n){var t=this.Document;t!=null&&t.OwnerControl!=null&&(t.OwnerControl.IsLayoutEnabled=!1);n._HasValue(i.ListFormatProperty)&&this.ListFormat._CopyFormat(n.ListFormat);n._HasValue(i.LeftIndentProperty)&&(this.LeftIndent=n.LeftIndent);n._HasValue(i.RightIndentProperty)&&(this.RightIndent=n.RightIndent);n._HasValue(i.FirstLineIndentProperty)&&(this.FirstLineIndent=n.FirstLineIndent);n._HasValue(i.AfterSpacingProperty)&&(this.AfterSpacing=n.AfterSpacing);n._HasValue(i.BeforeSpacingProperty)&&(this.BeforeSpacing=n.BeforeSpacing);n._HasValue(i.LineSpacingTypeProperty)&&(this.LineSpacingType=n.LineSpacingType);n._HasValue(i.LineSpacingProperty)&&(this.LineSpacing=n.LineSpacing);n._HasValue(i.TextAlignmentProperty)&&(this.TextAlignment=n.TextAlignment);t!=null&&t.OwnerControl!=null&&(t.OwnerControl.IsLayoutEnabled=!0);this._RelayoutParagraph()},i.prototype._HandleListFormat=function(n,t){var i=this.Document;i!=null&&i.OwnerControl!=null&&(i.OwnerControl.IsLayoutEnabled=!1);this.ListFormat=n.ListFormat;t.IsUndoing&&(this.LeftIndent=n.LeftIndent,this.FirstLineIndent=n.FirstLineIndent);i!=null&&i.OwnerControl!=null&&(i.OwnerControl.IsLayoutEnabled=!0);this._RelayoutParagraph()},i.prototype._CopyFormat=function(n){n.afterSpacing!=undefined&&n.afterSpacing!=null&&(this.AfterSpacing=n.afterSpacing);n.beforeSpacing!=undefined&&n.beforeSpacing!=null&&(this.BeforeSpacing=n.beforeSpacing);n.leftIndent!=undefined&&n.leftIndent!=null&&(this.LeftIndent=n.leftIndent);n.rightIndent!=undefined&&n.rightIndent!=null&&(this.RightIndent=n.rightIndent);n.firstLineIndent!=undefined&&n.firstLineIndent!=null&&(this.FirstLineIndent=n.firstLineIndent);n.lineSpacingType!=undefined&&n.lineSpacingType!=null&&(this.LineSpacingType=n.lineSpacingType);n.lineSpacing!=undefined&&n.lineSpacing!=null&&(this.LineSpacing=n.lineSpacing);n.textalignment!=undefined&&n.textalignment!=null&&(this.TextAlignment=n.textalignment);n.listFormat!=undefined&&n.listFormat!=null&&this.ListFormat._CopyFormat(n.listFormat)},i.prototype._CloneFormat=function(){var n=new i(null);return n.LeftIndent=this.LeftIndent,n.RightIndent=this.RightIndent,n.FirstLineIndent=this.FirstLineIndent,n.BeforeSpacing=this.BeforeSpacing,n.AfterSpacing=this.AfterSpacing,n.LineSpacingType=this.LineSpacingType,n.LineSpacing=this.LineSpacing,n.TextAlignment=this.TextAlignment,bi==null?n.ListFormat=null:(n.ListFormat=new bi(null),n.ListFormat.ListId=this.ListFormat.ListId,n.ListFormat.ListLevelNumber=this.ListFormat.ListLevelNumber),n},i.prototype._GetAsHtmlStyle=function(){var n='style="',i,t;return n+=wi.TextAlign+ui.Colon+kt._GetHtmlTextAlign(this.TextAlignment)+ui.SemiColon,i=this.LeftIndent,t=this.FirstLineIndent,this.ListFormat.ListLevel!=null&&(i-=48,t+=24),n+=wi.Margin+ui.Colon+this.BeforeSpacing.toString()+"px "+this.RightIndent.toString()+"px "+this.AfterSpacing.toString()+"px "+i.toString()+"px;",t!=0&&(n+=wi.TextIndent+ui.Colon+t.toString()+wi.Px+ui.SemiColon),n+=this.LineSpacingType==ei.Multiple?wi.LineHeight+ui.Colon+(this.LineSpacing*100).toString()+wi.Percentage+ui.SemiColon:wi.LineHeight+ui.Colon+this.LineSpacing.toString()+wi.Px+ui.SemiColon,n+'" '},i.prototype._Dispose=function(){this._SetOwner(null)},i.prototype._SerializeParagraphFormat=function(){var n={AfterSpacing:[],BeforeSpacing:[],FirstLineIndent:[],LeftIndent:[],LineSpacing:[],LineSpacingType:[],ListFormat:[],RightIndent:[],TextAlignment:[]};return n.AfterSpacing=this._HasValue(i.AfterSpacingProperty)?this.AfterSpacing:null,n.BeforeSpacing=this._HasValue(i.BeforeSpacingProperty)?this.BeforeSpacing:null,n.FirstLineIndent=this._HasValue(i.FirstLineIndentProperty)?this.FirstLineIndent:null,n.LeftIndent=this._HasValue(i.LeftIndentProperty)?this.LeftIndent:null,n.RightIndent=this._HasValue(i.RightIndentProperty)?this.RightIndent:null,n.LineSpacingType=this._HasValue(i.LineSpacingTypeProperty)?this.LineSpacingType:null,n.LineSpacing=this._HasValue(i.LineSpacingProperty)?this.LineSpacing:null,n.TextAlignment=this._HasValue(i.TextAlignmentProperty)?this.TextAlignment:null,this.ListFormat!=null&&this.ListFormat!=undefined&&(n.ListFormat={ListId:[],ListLevelNumber:[]},n.ListFormat.ListId=this.ListFormat._HasValue(bi.ListIdProperty)?this.ListFormat.ListId:null,n.ListFormat.ListLevelNumber=this.ListFormat._HasValue(bi.ListLevelNumberProperty)?this.ListFormat.ListLevelNumber:null),n},i.LeftIndentProperty="LeftIndent",i.RightIndentProperty="RightIndent",i.FirstLineIndentProperty="FirstLineIndent",i.BeforeSpacingProperty="BeforeSpacing",i.AfterSpacingProperty="AfterSpacing",i.LineSpacingProperty="LineSpacing",i.LineSpacingTypeProperty="LineSpacingType",i.TextAlignmentProperty="TextAlignment",i.ListFormatProperty="ListFormat",i}(fi);t.ParagraphFormat=a;bi=function(t){function i(n){t.call(this,n);this.listId=-1;this.listLevelNumber=0;this.propertyFlag=0}return n(i,t),Object.defineProperty(i.prototype,"Document",{get:function(){return this.OwnerBase instanceof a?this.OwnerBase.Document:null},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"ListId",{get:function(){return this._GetPropertyValue(i.ListIdProperty)},set:function(n){this._SetValue(i.ListIdProperty,n)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"ListLevelNumber",{get:function(){return this._GetPropertyValue(i.ListLevelNumberProperty)},set:function(n){this._SetValue(i.ListLevelNumberProperty,n)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"ListLevel",{get:function(){return this.List!=null?this.List._GetListLevel(this.ListLevelNumber):null},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"List",{get:function(){if(this.Document!=null)return this.Document._GetListByID(this.ListId)},set:function(n){this.list=n},enumerable:!0,configurable:!0}),i.prototype._GetPropertyValue=function(n){var i=this._HasValue(n),t;return i?this._GetValue(n,!1):n==di.PropertyUnsetValue&&this.OwnerBase instanceof a&&this.OwnerBase.OwnerBase instanceof u&&(t=this.Document,t!=null)?t.ParagraphFormat._GetValue(n,!0):this._GetValue(n,!0)},i.prototype._GetValue=function(n,t){var r;switch(n){case i.ListIdProperty:r=t?-1:this.listId;break;case i.ListLevelNumberProperty:r=t?0:this.listLevelNumber}return r},i.prototype._SetValue=function(n,t){if(t!=undefined){var u=this._HasValue(n),r=0;switch(n){case i.ListIdProperty:r|=1;this.listId=t;break;case i.ListLevelNumberProperty:r|=2;this.listLevelNumber=t}u||(this.propertyFlag|=r)}},i.prototype._HasValue=function(n){switch(n){case i.ListIdProperty:return(this.propertyFlag&1)==1;case i.ListLevelNumberProperty:return(this.propertyFlag&2)==2;default:return!1}},i.prototype._ClearValue=function(n){switch(n){case i.ListIdProperty:this.propertyFlag=this.propertyFlag^1;case i.ListLevelNumberProperty:this.propertyFlag=this.propertyFlag^2}},i.prototype._CopyFormat=function(n){n.List!=null&&n.List!=undefined&&(this.List=n.List);n._HasValue(i.ListIdProperty)&&(this.ListId=n.listId);n._HasValue(i.ListLevelNumberProperty)&&(this.ListLevelNumber=n.listLevelNumber)},i.prototype._UpdateOwnerParagraphFormat=function(){this.OwnerBase instanceof a&&this.ListLevel!=null&&this.ListLevel.ParagraphFormat!=null&&this.OwnerBase.OwnerBase!=null?this.OwnerBase._CopyFromListLevelParagrahFormat(this.ListLevel.ParagraphFormat):this.OwnerBase instanceof a&&this.OwnerBase.OwnerBase!=null&&this.List==null&&(this.OwnerBase.LeftIndent=0,this.OwnerBase.FirstLineIndent=0)},i.prototype._Relayout=function(){var n,t,i;this.OwnerBase instanceof a&&this.OwnerBase.OwnerBase instanceof u?this.OwnerBase.OwnerBase._Layout():this.Document instanceof ti&&(n=0,t=0,this.Document.OwnerControl!=null&&this.Document.OwnerControl.IsLayoutEnabled&&(this.Document.OwnerControl.IsDocumentLoaded&&(this.Document.OwnerControl.Viewer.VerticalScrollBar!=null&&(n=this.Document.OwnerControl.Viewer.VerticalScrollBar.model.value),this.Document.OwnerControl.Viewer.HorizontalScrollBar!=null&&(t=this.Document.OwnerControl.Viewer.HorizontalScrollBar.model.value)),i=void 0,this.Document._LayoutItems(i),this.Document.OwnerControl.IsDocumentLoaded&&(this.Document.OwnerControl.Viewer.VerticalScrollBar!=null&&(this.Document.OwnerControl.Viewer.VerticalScrollBar.model.value=n),this.Document.OwnerControl.Viewer.HorizontalScrollBar!=null&&(this.Document.OwnerControl.Viewer.HorizontalScrollBar.model.value=t))))},i.ListIdProperty="ListId",i.ListLevelNumberProperty="ListLevelNumber",i}(fi);t.ListFormat=bi;df=function(){function n(){this.tableColumns=new ee}return Object.defineProperty(n.prototype,"Columns",{get:function(){return this.tableColumns},enumerable:!0,configurable:!0}),n.prototype._GetPreviousSpannedCellWidth=function(n,t){for(var r=0,i=n;i<t;i++)r+=this.tableColumns[i].PreferredWidth;return r},n.prototype._Dispose=function(){this.tableColumns!=null&&(this.tableColumns._Clear(),this.tableColumns=null)},n}();t.TableHolder=df;vr=function(t){function i(n){t.call(this,n);this.propertyFlag=0}return n(i,t),Object.defineProperty(i.prototype,"BackgroundColor",{get:function(){return this._GetValue(i.BackgroundColorProperty)},set:function(n){this._SetValue(i.BackgroundColorProperty,n)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"ForegroundColor",{get:function(){return this._GetValue(i.ForegroundColorProperty)},set:function(n){this._SetValue(i.ForegroundColorProperty,n)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"TextureStyle",{get:function(){return this._GetValue(i.TextureStyleProperty)},set:function(n){this._SetValue(i.TextureStyleProperty,n)},enumerable:!0,configurable:!0}),i.prototype._HasValue=function(n){switch(n){case i.BackgroundColorProperty:return(this.propertyFlag&1)==1;case i.ForegroundColorProperty:return(this.propertyFlag&2)==2;case i.TextureStyleProperty:return(this.propertyFlag&4)==4;default:return!1}},i.prototype._SetValue=function(n,t){if(t!=undefined){var u=this._HasValue(n),r=0;switch(n){case i.BackgroundColorProperty:r|=1;this.backgroundColor=t;break;case i.ForegroundColorProperty:r|=2;this.foregroundColor=t;break;case i.TextureStyleProperty:r|=4;this.textureStyle=t}u||(this.propertyFlag|=r)}},i.prototype._GetValue=function(n){var u=this._HasValue(n),r=!u,t;switch(n){case i.BackgroundColorProperty:t=r?"#ffffff":this.backgroundColor;break;case i.ForegroundColorProperty:t=r?"empty":this.foregroundColor;break;case i.TextureStyleProperty:t=r?0:this.textureStyle}return t},i.prototype._ClearValue=function(n){switch(n){case i.BackgroundColorProperty:this.propertyFlag=this.propertyFlag^1;case i.ForegroundColorProperty:this.propertyFlag=this.propertyFlag^2;case i.TextureStyleProperty:this.propertyFlag=this.propertyFlag^4}},i.prototype._CopyFormat=function(n){n.backgroundColor!=null&&n.backgroundColor!=undefined&&(this.BackgroundColor=n.backgroundColor);n.foregroundColor!=null&&n.foregroundColor!=undefined&&(this.ForegroundColor=n.foregroundColor);n.textureStyle!=null&&n.textureStyle!=undefined&&(this.TextureStyle=n.textureStyle)},i.prototype._Clone=function(){var n=new i(null);return n.BackgroundColor=this.BackgroundColor,n.ForegroundColor=this.ForegroundColor,n},i.prototype._Dispose=function(){this._SetOwner(null)},i.prototype._SerializeShading=function(){var n={BackgroundColor:[],Texture:[]};return n.BackgroundColor=this._HasValue(i.BackgroundColorProperty)?this.BackgroundColor:null,n.Texture=this._HasValue(i.TextureStyleProperty)?this.TextureStyle:null,n},i.BackgroundColorProperty="BackgroundColor",i.ForegroundColorProperty="ForegroundColor",i.TextureStyleProperty="TextureStyle",i}(fi);t.Shading=vr;er=function(t){function i(n){t.call(this,n);this.propertyFlag=0;this.Left=new ut(this);this.Right=new ut(this);this.Top=new ut(this);this.Bottom=new ut(this);this.DiagonalUp=new ut(this);this.DiagonalDown=new ut(this);this.Horizontal=new ut(this);this.Vertical=new ut(this)}return n(i,t),Object.defineProperty(i.prototype,"Left",{get:function(){return this._GetValue(i.LeftProperty)},set:function(n){this._SetValue(i.LeftProperty,n)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Right",{get:function(){return this._GetValue(i.RightProperty)},set:function(n){this._SetValue(i.RightProperty,n)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Top",{get:function(){return this._GetValue(i.TopProperty)},set:function(n){this._SetValue(i.TopProperty,n)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Bottom",{get:function(){return this._GetValue(i.BottomProperty)},set:function(n){this._SetValue(i.BottomProperty,n)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Horizontal",{get:function(){return this._GetValue(i.HorizontalProperty)},set:function(n){this._SetValue(i.HorizontalProperty,n)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Vertical",{get:function(){return this._GetValue(i.VerticalProperty)},set:function(n){this._SetValue(i.VerticalProperty,n)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"DiagonalUp",{get:function(){return this._GetValue(i.DiagonalUpProperty)},set:function(n){this._SetValue(i.DiagonalUpProperty,n)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"DiagonalDown",{get:function(){return this._GetValue(i.DiagonalDownProperty)},set:function(n){this._SetValue(i.DiagonalDownProperty,n)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"LineStyle",{set:function(n){this.Left!=null&&(this.Left.LineStyle=n);this.Right!=null&&(this.Right.LineStyle=n);this.Top!=null&&(this.Top.LineStyle=n);this.Bottom!=null&&(this.Bottom.LineStyle=n);this.Horizontal!=null&&(this.Horizontal.LineStyle=n);this.Vertical!=null&&(this.Vertical.LineStyle=n);this.DiagonalUp!=null&&(this.DiagonalUp.LineStyle=n);this.DiagonalDown!=null&&(this.DiagonalDown.LineStyle=n)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"LineWidth",{set:function(n){this.Left!=null&&(this.Left.LineWidth=n);this.Right!=null&&(this.Right.LineWidth=n);this.Top!=null&&(this.Top.LineWidth=n);this.Bottom!=null&&(this.Bottom.LineWidth=n);this.Horizontal!=null&&(this.Horizontal.LineWidth=n);this.Vertical!=null&&(this.Vertical.LineWidth=n);this.DiagonalUp!=null&&(this.DiagonalUp.LineWidth=n);this.DiagonalDown!=null&&(this.DiagonalDown.LineWidth=n)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Color",{set:function(n){this.Left!=null&&(this.Left.Color=n);this.Right!=null&&(this.Right.Color=n);this.Top!=null&&(this.Top.Color=n);this.Bottom!=null&&(this.Bottom.Color=n);this.Horizontal!=null&&(this.Horizontal.Color=n);this.Vertical!=null&&(this.Vertical.Color=n);this.DiagonalUp!=null&&(this.DiagonalUp.Color=n);this.DiagonalDown!=null&&(this.DiagonalDown.Color=n)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"OwnerCell",{get:function(){return this.OwnerBase instanceof ai&&this.OwnerBase.OwnerBase instanceof ot?this.OwnerBase.OwnerBase:null},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"OwnerRow",{get:function(){return this.OwnerCell!=null?this.OwnerCell.OwnerRow:this.OwnerBase instanceof tr&&this.OwnerBase.OwnerBase instanceof bt?this.OwnerBase.OwnerBase:null},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"OwnerTable",{get:function(){return this.OwnerRow!=null?this.OwnerRow.OwnerTable:this.OwnerBase instanceof at&&this.OwnerBase.OwnerBase instanceof e?this.OwnerBase.OwnerBase:null},enumerable:!0,configurable:!0}),i.prototype._SetValue=function(n,t){if(t!=undefined){var u=this._HasValue(n),r=0;switch(n){case i.LeftProperty:r|=1;this.left=t;break;case i.RightProperty:r|=2;this.right=t;break;case i.TopProperty:r|=4;this.top=t;break;case i.BottomProperty:r|=8;this.bottom=t;break;case i.HorizontalProperty:r|=16;this.horizontal=t;break;case i.VerticalProperty:r|=32;this.vertical=t;break;case i.DiagonalUpProperty:r|=64;this.diagonalUp=t;break;case i.DiagonalDownProperty:r|=128;this.diagonalDown=t}u||(this.propertyFlag|=r)}},i.prototype._GetValue=function(n){var u=this._HasValue(n),r=!u,t;switch(n){case i.LeftProperty:t=r?null:this.left;break;case i.RightProperty:t=r?null:this.right;break;case i.TopProperty:t=r?null:this.top;break;case i.BottomProperty:t=r?null:this.bottom;break;case i.HorizontalProperty:t=r?null:this.horizontal;break;case i.VerticalProperty:t=r?null:this.vertical;break;case i.DiagonalUpProperty:t=r?null:this.diagonalUp;break;case i.DiagonalDownProperty:t=r?null:this.diagonalDown}return t},i.prototype._HasValue=function(n){switch(n){case i.LeftProperty:return(this.propertyFlag&1)==1;case i.RightProperty:return(this.propertyFlag&2)==2;case i.TopProperty:return(this.propertyFlag&4)==4;case i.BottomProperty:return(this.propertyFlag&8)==8;case i.HorizontalProperty:return(this.propertyFlag&16)==16;case i.VerticalProperty:return(this.propertyFlag&32)==32;case i.DiagonalUpProperty:return(this.propertyFlag&64)==64;case i.DiagonalDownProperty:return(this.propertyFlag&128)==128;default:return!1}},i.prototype._ClearValue=function(n){switch(n){case i.LeftProperty:this.propertyFlag=this.propertyFlag^1;case i.RightProperty:this.propertyFlag=this.propertyFlag^2;case i.TopProperty:this.propertyFlag=this.propertyFlag^4;case i.BottomProperty:this.propertyFlag=this.propertyFlag^8;case i.HorizontalProperty:this.propertyFlag=this.propertyFlag^16;case i.VerticalProperty:this.propertyFlag=this.propertyFlag^32;case i.DiagonalUpProperty:this.propertyFlag=this.propertyFlag^64;case i.DiagonalDownProperty:this.propertyFlag=this.propertyFlag^128}},i.prototype._CopyFormat=function(n){n.left!=undefined&&n.left instanceof ut&&(this.Left=new ut(this),this.Left._CopyFormat(n.left));n.right!=undefined&&n.right instanceof ut&&(this.Right=new ut(this),this.Right._CopyFormat(n.right));n.top!=undefined&&n.top instanceof ut&&(this.Top=new ut(this),this.Top._CopyFormat(n.top));n.bottom!=undefined&&n.bottom instanceof ut&&(this.Bottom=new ut(this),this.Bottom._CopyFormat(n.bottom));n.horizontal!=undefined&&n.horizontal instanceof ut&&(this.Horizontal=new ut(this),this.Horizontal._CopyFormat(n.horizontal));n.vertical!=undefined&&n.vertical instanceof ut&&(this.Vertical=new ut(this),this.Vertical._CopyFormat(n.vertical));n.diagonalDown!=undefined&&n.diagonalDown instanceof ut&&(this.DiagonalDown=new ut(this),this.DiagonalDown._CopyFormat(n.diagonalDown));n.diagonalUp!=undefined&&n.diagonalUp instanceof ut&&(this.DiagonalUp=new ut(this),this.DiagonalUp._CopyFormat(n.diagonalUp))},i.prototype._GetTableLeftBorder=function(){if(this.Left!=null)return this.Left;var n=new ut(this);return n.LineStyle=r.Single,n.LineWidth=.66,n},i.prototype._GetTableRightBorder=function(){if(this.Right!=null)return this.Right;var n=new ut(this);return n.LineStyle=r.Single,n.LineWidth=.66,n},i.prototype._GetTableTopBorder=function(){if(this.Top!=null)return this.Top;var n=new ut(this);return n.LineStyle=r.Single,n.LineWidth=.66,n},i.prototype._GetTableBottomBorder=function(){if(this.Bottom!=null)return this.Bottom;var n=new ut(this);return n.LineStyle=r.Single,n.LineWidth=.66,n},i.prototype._GetCellLeftBorder=function(n){var t=null,r=n.CellFormat.Borders,u=n.OwnerRow!=null?n.OwnerRow.RowFormat.Borders:null,f=n.OwnerTable!=null?n.OwnerTable.TableFormat.Borders:null,i;return r.Left!=null&&(t=r.Left),t==null&&(t=this._GetLeftBorderToRenderByHierarchy(t,u,f)),n.OwnerTable.TableFormat.CellSpacing>0?t=this._GetLeftBorderToRenderByHierarchy(t,u,f):(i=null,n.PreviousNode!=null&&(i=n.PreviousNode),t=this._GetPrevCellLeftBorder(t,i)),t==null&&(t=new ut(this)),t},i.prototype._GetPrevCellLeftBorder=function(n,t){if(t!=null&&(n==null||n.LineStyle!=r.None||n.HasNoneStyle)){var u=void 0,i=null;if(t.CellFormat.Borders!=null&&t.CellFormat.Borders.Right!=null&&t.CellFormat.Borders.Right.LineStyle!=r.None&&(i=t.CellFormat.Borders.Right),i!=null&&i.LineStyle!=r.None)u=this._GetBorderBasedOnPriority(i,n);else if(n!=null&&!(n.OwnerBase.OwnerBase instanceof at))return this._GetLeftBorderToRenderByHierarchy(n,n.OwnerBase.OwnerRow.RowFormat.Borders,n.OwnerBase.OwnerTable.TableFormat.Borders)}else if(n!=null&&!(n.OwnerBase.OwnerBase instanceof at))return this._GetLeftBorderToRenderByHierarchy(n,n.OwnerBase.OwnerRow.RowFormat.Borders,n.OwnerBase.OwnerTable.TableFormat.Borders);return n},i.prototype._GetLeftBorderToRenderByHierarchy=function(n,t,u){return n!=null&&(n.LineStyle!=r.None||n.HasNoneStyle)?n:n!=null&&n.OwnerBase instanceof i&&n.OwnerBase.OwnerCell.ColumnIndex==0?(u!=null&&u.Left!=null&&(n=u.Left),n):t!=null&&t.Vertical!=null&&t.Vertical.LineStyle!=r.None?t.Vertical:u!=null&&u.Vertical!=null&&u.Vertical.LineStyle!=r.None?u.Vertical:n},i.prototype._GetCellDiagonalUpBorder=function(n){var i=null,t=null;return t=n.CellFormat.Borders,t.DiagonalUp!=null&&(i=t.DiagonalUp),i},i.prototype._GetCellDiagonalDownBorder=function(n){var i=null,t=null;return t=n.CellFormat.Borders,t.DiagonalDown!=null&&(i=t.DiagonalDown),i},i.prototype._GetCellRightBorder=function(n){var t=null,r=n.CellFormat.Borders,u=n.OwnerRow!=null?n.OwnerRow.RowFormat.Borders:null,f=n.OwnerTable!=null?n.OwnerTable.TableFormat.Borders:null,i;return r.Right!=null&&(t=r.Right),t==null&&(t=this._GetRightBorderToRenderByHierarchy(t,u,f)),n.OwnerTable.TableFormat.CellSpacing>0?t=this._GetRightBorderToRenderByHierarchy(t,u,f):(i=null,n.NextNode!=null&&(i=n.NextNode),t=this._GetAdjacentCellRightBorder(t,i)),t==null&&(t=new ut(this)),t},i.prototype._GetAdjacentCellRightBorder=function(n,t){if(t!=null&&(n==null||n.LineStyle!=r.None||n.HasNoneStyle)){var i=null;if(t.CellFormat.Borders!=null&&t.CellFormat.Borders.Left!=null&&t.CellFormat.Borders.Left.LineStyle!=r.None&&(i=t.CellFormat.Borders.Left),i!=null&&i.LineStyle!=r.None)return this._GetBorderBasedOnPriority(n,i);if(n!=null&&!(n.OwnerBase.OwnerBase instanceof at))return this._GetRightBorderToRenderByHierarchy(n,n.OwnerBase.OwnerRow.RowFormat.Borders,n.OwnerBase.OwnerTable.TableFormat.Borders)}else if(n!=null&&!(n.OwnerBase.OwnerBase instanceof at))return this._GetRightBorderToRenderByHierarchy(n,n.OwnerBase.OwnerRow.RowFormat.Borders,n.OwnerBase.OwnerTable.TableFormat.Borders);return n},i.prototype._GetRightBorderToRenderByHierarchy=function(n,t,u){return n!=null&&(n.LineStyle!=r.None||n.HasNoneStyle)?n:n!=null&&n.OwnerBase instanceof i&&n.OwnerBase.OwnerCell.ColumnIndex==n.OwnerBase.OwnerCell.OwnerRow.Cells.Count-1?(u!=null&&u.Right!=null&&(n=u.Right),n):t!=null&&t.Vertical!=null&&t.Vertical.LineStyle!=r.None?t.Vertical:u!=null&&u.Vertical!=null&&u.Vertical.LineStyle!=r.None?u.Vertical:n},i.prototype._GetCellTopBorder=function(n){var t=null,u=n.CellFormat.Borders,f=n.OwnerRow!=null?n.OwnerRow.RowFormat.Borders:null,e=n.OwnerTable!=null?n.OwnerTable.TableFormat.Borders:null,r,i;return u.Top!=null&&(t=u.Top),t==null&&(t=this._GetTopBorderToRenderByHierarchy(t,f,e)),n.OwnerTable.TableFormat.CellSpacing>0?t=this._GetTopBorderToRenderByHierarchy(t,f,e):(r=null,i=n.OwnerRow.PreviousNode,i!=null&&n.ColumnIndex<i.Cells.Count&&(r=i.Cells[n.ColumnIndex]),t=this._GetPrevCellTopBorder(t,r)),t==null&&(t=new ut(this)),t},i.prototype._GetPrevCellTopBorder=function(n,t){if(t!=null&&(n==null||n.LineStyle!=r.None||n.HasNoneStyle)){var i=null;if(t.CellFormat.Borders!=null&&t.CellFormat.Borders.Bottom!=null&&t.CellFormat.Borders.Bottom.LineStyle!=r.None&&(i=t.CellFormat.Borders.Left),i!=null&&i.LineStyle!=r.None)return this._GetBorderBasedOnPriority(n,i);if(n!=null&&!(n.OwnerBase.OwnerBase instanceof at))return this._GetTopBorderToRenderByHierarchy(n,n.OwnerBase.OwnerRow.RowFormat.Borders,n.OwnerBase.OwnerTable.TableFormat.Borders)}else if(n!=null&&!(n.OwnerBase.OwnerBase instanceof at))return this._GetTopBorderToRenderByHierarchy(n,n.OwnerBase.OwnerRow.RowFormat.Borders,n.OwnerBase.OwnerTable.TableFormat.Borders);return n},i.prototype._GetTopBorderToRenderByHierarchy=function(n,t,u){return n!=null&&(n.LineStyle!=r.None||n.HasNoneStyle)?n:n!=null&&n.OwnerBase instanceof i&&n.OwnerBase.OwnerCell.OwnerRow.RowIndex==0?(u!=null&&u.Top!=null&&(n=u.Top),n):t!=null&&t.Horizontal!=null&&t.Horizontal.LineStyle!=r.None?t.Horizontal:u!=null&&u.Horizontal!=null&&u.Horizontal.LineStyle!=r.None?u.Horizontal:n},i.prototype._GetCellBottomBorder=function(n){var t=null,u=n.CellFormat.Borders,f=n.OwnerRow!=null?n.OwnerRow.RowFormat.Borders:null,e=n.OwnerTable!=null?n.OwnerTable.TableFormat.Borders:null,r,i;return u.Bottom!=null&&(t=u.Bottom),t==null&&(t=this._GetBottomBorderToRenderByHierarchy(t,f,e)),n.OwnerTable.TableFormat.CellSpacing>0?t=this._GetBottomBorderToRenderByHierarchy(t,f,e):(r=null,i=n.OwnerRow.NextNode,i!=null&&n.ColumnIndex<i.Cells.Count&&(r=i.Cells[n.ColumnIndex]),t=this._GetAdjacentCellBottomBorder(t,r)),t==null&&(t=new ut(this)),t},i.prototype._GetAdjacentCellBottomBorder=function(n,t){if(t!=null&&(n==null||n.LineStyle!=r.None||n.HasNoneStyle)){var i=null;if(t.CellFormat.Borders!=null&&t.CellFormat.Borders.Top!=null&&t.CellFormat.Borders.Top.LineStyle!=r.None&&(i=t.CellFormat.Borders.Top),i!=null&&i.LineStyle!=r.None)return this._GetBorderBasedOnPriority(n,i);if(n!=null&&!(n.OwnerBase.OwnerBase instanceof at))return this._GetBottomBorderToRenderByHierarchy(n,n.OwnerBase.OwnerRow.RowFormat.Borders,n.OwnerBase.OwnerTable.TableFormat.Borders)}else if(n!=null&&!(n.OwnerBase.OwnerBase instanceof at))return this._GetBottomBorderToRenderByHierarchy(n,n.OwnerBase.OwnerRow.RowFormat.Borders,n.OwnerBase.OwnerTable.TableFormat.Borders);return n},i.prototype._GetBottomBorderToRenderByHierarchy=function(n,t,u){return n!=null&&(n.LineStyle!=r.None||n.HasNoneStyle)?n:n!=null&&n.OwnerBase instanceof i&&n.OwnerBase.OwnerCell.OwnerRow.RowIndex+n.OwnerBase.OwnerCell.CellFormat.RowSpan==n.OwnerBase.OwnerCell.OwnerTable.Rows.Count?(u!=null&&u.Bottom!=null&&(n=u.Bottom),n):t!=null&&t.Horizontal!=null&&t.Horizontal.LineStyle!=r.None?t.Horizontal:u!=null&&u.Horizontal!=null&&u.Horizontal.LineStyle!=r.None?u.Horizontal:n},i.prototype._GetBorderBasedOnPriority=function(n,t){var e,o,s,h;if(n==null)return t;if(t==null)return n;if(e=n._GetBorderWeight(),o=t._GetBorderWeight(),e==o){if(s=n._GetPrecedence(),h=t._GetPrecedence(),s==h){var c=this._ConvertHexToRGB(n.Color),y=c.R,u=c.G,a=c.B,l=this._ConvertHexToRGB(t.Color),p=l.R,f=l.G,v=l.B,i=y+a+2*u,r=p+v+2*f;return i==r?(i=a+2*u,r=v+2*f,i==r?u==f?n:u>f?t:n:i>r?t:n):i>r?t:n}return s>h?n:t}return e>o?n:t},i.prototype._ConvertHexToRGB=function(n){if(n){n=n.replace(/[^0-9A-‌​F]/gi,"");var t=parseInt(n,16),i=t>>16&255,r=t>>8&255,u=t&255;return{R:i,G:r,B:u}}},i.prototype._GetAsHtmlStyle=function(){var t="",n=null;return n=this.OwnerCell!=null?this._GetCellLeftBorder(this.OwnerCell):this._GetTableLeftBorder(),n!=null&&n.LineStyle!=r.None?t+=n._GetAsHtmlStyle("left"):n!=null&&n.HasNoneStyle&&(t+="border-left-style:none;"),n=this.OwnerCell!=null?this._GetCellRightBorder(this.OwnerCell):this._GetTableRightBorder(),n!=null&&n.LineStyle!=r.None?t+=n._GetAsHtmlStyle("right"):n!=null&&n.HasNoneStyle&&(t+="border-right-style:none;"),n=this.OwnerCell!=null?this._GetCellTopBorder(this.OwnerCell):this._GetTableTopBorder(),n!=null&&n.LineStyle!=r.None?t+=n._GetAsHtmlStyle("top"):n!=null&&n.HasNoneStyle&&(t+="border-top-style:none;"),n=this.OwnerCell!=null?this._GetCellBottomBorder(this.OwnerCell):this._GetTableBottomBorder(),n!=null&&n.LineStyle!=r.None?t+=n._GetAsHtmlStyle("bottom"):n!=null&&n.HasNoneStyle&&(t+="border-bottom-style:none;"),t},i.prototype._Clone=function(){var n=new i(null);return n.Top=this.Top==null?null:this.Top._Clone(),n.Bottom=this.Bottom==null?null:this.Bottom._Clone(),n.Left=this.Left==null?null:this.Left._Clone(),n.Right=this.Right==null?null:this.Right._Clone(),n.Horizontal=this.Horizontal==null?null:this.Horizontal._Clone(),n.Vertical=this.Vertical==null?null:this.Vertical._Clone(),n.DiagonalUp=this.DiagonalUp==null?null:this.DiagonalUp._Clone(),n.DiagonalDown=this.DiagonalDown==null?null:this.DiagonalDown._Clone(),n},i.prototype._Dispose=function(){this._SetOwner(null)},i.prototype._SerializeBorders=function(){var n={Bottom:[],DiagonalDown:[],DiagonalUp:[],Horizontal:[],Left:[],Right:[],Top:[],Vertical:[]};return n.Bottom=this._HasValue(i.BottomProperty)?this.Bottom._SerializeBorder():null,n.DiagonalDown=this._HasValue(i.DiagonalDownProperty)?this.DiagonalDown._SerializeBorder():null,n.DiagonalUp=this._HasValue(i.DiagonalUpProperty)?this.DiagonalUp._SerializeBorder():null,n.Horizontal=this._HasValue(i.HorizontalProperty)?this.Horizontal._SerializeBorder():null,n.Left=this._HasValue(i.LeftProperty)?this.Left._SerializeBorder():null,n.Right=this._HasValue(i.RightProperty)?this.Right._SerializeBorder():null,n.Top=this._HasValue(i.TopProperty)?this.Top._SerializeBorder():null,n.Vertical=this._HasValue(i.VerticalProperty)?this.Vertical._SerializeBorder():null,n},i.LeftProperty="Left",i.RightProperty="Right",i.TopProperty="Top",i.BottomProperty="Bottom",i.HorizontalProperty="Horizontal",i.VerticalProperty="Vertical",i.DiagonalUpProperty="DiagonalUp",i.DiagonalDownProperty="DiagonalDown",i}(fi);t.Borders=er;ut=function(t){function i(n){t.call(this,n);this.propertyFlag=0}return n(i,t),Object.defineProperty(i.prototype,"Color",{get:function(){return this._GetValue(i.ColorProperty)},set:function(n){this._SetValue(i.ColorProperty,n)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"LineStyle",{get:function(){return this._GetValue(i.LineStyleProperty)},set:function(n){n==r.None&&(this.HasNoneStyle=!0);this._SetValue(i.LineStyleProperty,n)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"LineWidth",{get:function(){return this._GetValue(i.LineWidthProperty)},set:function(n){this._SetValue(i.LineWidthProperty,n)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Shadow",{get:function(){return this._GetValue(i.ShadowProperty)},set:function(n){this._SetValue(i.ShadowProperty,n)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Space",{get:function(){return this._GetValue(i.SpaceProperty)},set:function(n){this._SetValue(i.SpaceProperty,n)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"HasNoneStyle",{get:function(){return this.hasNoneStyle},set:function(n){this.hasNoneStyle=n},enumerable:!0,configurable:!0}),i.prototype._HasValue=function(n){switch(n){case i.ColorProperty:return(this.propertyFlag&1)==1;case i.LineStyleProperty:return(this.propertyFlag&2)==2;case i.LineWidthProperty:return(this.propertyFlag&4)==4;case i.ShadowProperty:return(this.propertyFlag&8)==8;case i.SpaceProperty:return(this.propertyFlag&16)==16;default:return!1}},i.prototype._SetValue=function(n,t){if(t!=undefined){var u=this._HasValue(n),r=0;switch(n){case i.ColorProperty:r|=1;this.color=t;break;case i.LineStyleProperty:r|=2;this.lineStyle=t;break;case i.LineWidthProperty:r|=4;this.lineWidth=t;break;case i.ShadowProperty:r|=8;this.shadow=t;break;case i.SpaceProperty:r|=16;this.space=t}u||(this.propertyFlag|=r)}},i.prototype._GetValue=function(n){var f=this._HasValue(n),u=!f,t;switch(n){case i.ColorProperty:t=u?"#000000":this.color;break;case i.LineStyleProperty:t=u?r.None:this.lineStyle;break;case i.LineWidthProperty:t=u?0:this.lineWidth;break;case i.ShadowProperty:t=u?!1:this.shadow;break;case i.SpaceProperty:t=u?0:this.space}return t},i.prototype._ClearValue=function(n){switch(n){case i.ColorProperty:this.propertyFlag=this.propertyFlag^1;case i.LineStyleProperty:this.propertyFlag=this.propertyFlag^2;case i.LineWidthProperty:this.propertyFlag=this.propertyFlag^4;case i.ShadowProperty:this.propertyFlag=this.propertyFlag^8;case i.SpaceProperty:this.propertyFlag=this.propertyFlag^16}},i.prototype._CopyFormat=function(n){n.color!=null&&n.color!=undefined&&(this.Color=n.color);n.lineStyle!=null&&n.lineStyle!=undefined&&(this.LineStyle=n.lineStyle);n.lineWidth!=null&&n.lineWidth!=undefined&&(this.LineWidth=n.lineWidth);n.shadow!=null&&n.shadow!=undefined&&(this.Shadow=n.shadow);n.space!=null&&n.space!=undefined&&(this.Space=n.space)},i.prototype._GetPrecedence=function(){var n=0;switch(this.LineStyle){case r.Single:n=1;break;case r.Thick:n=2;break;case r.Double:n=3;break;case r.Dot:n=4;break;case r.DashLargeGap:n=5;break;case r.DashDot:n=6;break;case r.DashDotDot:n=7;break;case r.Triple:n=8;break;case r.ThinThickSmallGap:n=9;break;case r.ThickThinSmallGap:n=10;break;case r.ThinThickThinSmallGap:n=11;break;case r.ThinThickMediumGap:n=12;break;case r.ThickThinMediumGap:n=13;break;case r.ThinThickThinMediumGap:n=14;break;case r.ThinThickLargeGap:n=15;break;case r.ThickThinLargeGap:n=16;break;case r.ThinThickThinLargeGap:n=17;break;case r.SingleWavy:n=18;break;case r.DoubleWavy:n=19;break;case r.DashSmallGap:n=20;break;case r.DashDotStroked:n=21;break;case r.Emboss3D:n=22;break;case r.Engrave3D:n=23;break;case r.Outset:n=24;break;case r.Inset:n=25}return n},i.prototype._GetBorderWeight=function(){var n=0,t=this._GetNumberOfLines(),i=this._GetBorderNumber();switch(this.LineStyle){case r.Single:case r.DashSmallGap:case r.DashDot:case r.DashDotDot:case r.Double:case r.Triple:case r.ThinThickSmallGap:case r.ThickThinSmallGap:case r.ThinThickThinSmallGap:case r.ThinThickMediumGap:case r.ThickThinMediumGap:case r.ThinThickThinMediumGap:case r.ThinThickLargeGap:case r.ThickThinLargeGap:case r.ThinThickThinLargeGap:case r.SingleWavy:case r.DoubleWavy:case r.DashDotStroked:case r.Emboss3D:case r.Engrave3D:case r.Outset:case r.Inset:case r.Thick:n=t*i;break;case r.Dot:case r.DashLargeGap:n=1}return n},i.prototype._GetBorderNumber=function(){var n=0;switch(this.LineStyle){case r.Single:n=1;break;case r.Thick:n=2;break;case r.Double:n=3;break;case r.Dot:n=4;break;case r.DashLargeGap:n=5;break;case r.DashDot:n=6;break;case r.DashDotDot:n=7;break;case r.Triple:n=8;break;case r.ThinThickSmallGap:n=9;break;case r.ThickThinSmallGap:n=10;break;case r.ThinThickThinSmallGap:n=11;break;case r.ThinThickMediumGap:n=12;break;case r.ThickThinMediumGap:n=13;break;case r.ThinThickThinMediumGap:n=14;break;case r.ThinThickLargeGap:n=15;break;case r.ThickThinLargeGap:n=16;break;case r.ThinThickThinLargeGap:n=17;break;case r.SingleWavy:n=18;break;case r.DoubleWavy:n=19;break;case r.DashSmallGap:n=20;break;case r.DashDotStroked:n=21;break;case r.Emboss3D:n=22;break;case r.Engrave3D:n=23;break;case r.Outset:n=24;break;case r.Inset:n=25}return n},i.prototype._GetNumberOfLines=function(){var n=0;switch(this.LineStyle){case r.Single:case r.Dot:case r.DashSmallGap:case r.DashLargeGap:case r.DashDot:case r.DashDotDot:n=1;break;case r.Double:n=3;break;case r.Triple:n=5;break;case r.ThinThickSmallGap:n=3;break;case r.ThickThinSmallGap:n=3;break;case r.ThinThickThinSmallGap:n=5;break;case r.ThinThickMediumGap:n=3;break;case r.ThickThinMediumGap:n=3;break;case r.ThinThickThinMediumGap:n=5;break;case r.ThinThickLargeGap:n=3;break;case r.ThickThinLargeGap:n=3;break;case r.ThinThickThinLargeGap:n=5;break;case r.SingleWavy:n=1;break;case r.DoubleWavy:n=2;break;case r.DashDotStroked:n=1;break;case r.Emboss3D:case r.Engrave3D:n=3;break;case r.Outset:case r.Inset:case r.Thick:n=1}return n},i.prototype._GetLineWidth=function(){var t,i,n;switch(this.LineStyle){case r.None:return 0;case r.Triple:case r.Double:case r.ThinThickSmallGap:case r.ThickThinSmallGap:case r.ThinThickThinSmallGap:case r.ThinThickMediumGap:case r.ThickThinMediumGap:case r.ThinThickThinMediumGap:case r.ThinThickLargeGap:case r.ThickThinLargeGap:case r.ThinThickThinLargeGap:case r.Emboss3D:case r.Engrave3D:for(t=this._GetBorderLineWidthArray(r,this.LineWidth),i=0,n=0;n<t.length;n++)i+=t[n];return i;case r.Single:case r.DashLargeGap:case r.DashSmallGap:case r.Dot:case r.DashDot:case r.DashDotDot:case r.Thick:return this.LineWidth;case r.SingleWavy:return this.LineWidth==1.5?3:2.5;case r.DoubleWavy:return 6.75;case r.DashDotStroked:case r.Outset:return this.LineWidth}return this.LineWidth},i.prototype._GetBorderLineWidthArray=function(n,t){var i=[t],r;switch(this.LineStyle){case n.Double:i=[1,1,1];break;case n.ThinThickSmallGap:i=[1,-.75,-.75];break;case n.ThickThinSmallGap:i=[-.75,-.75,1];break;case n.ThinThickMediumGap:i=[1,.5,.5];break;case n.ThickThinMediumGap:i=[.5,.5,1];break;case n.ThinThickLargeGap:i=[-1.5,1,-.75];break;case n.ThickThinLargeGap:i=[-.75,1,-1.5];break;case n.Triple:i=[1,1,1,1,1];break;case n.ThinThickThinSmallGap:i=[-.75,-.75,1,-.75,-.75];break;case n.ThinThickThinMediumGap:i=[.5,.5,1,.5,.5];break;case n.ThinThickThinLargeGap:i=[-.75,1,-1.5,1,-.75];break;case n.Emboss3D:case n.Engrave3D:i=[.25,0,1,0,.25]}if(i.length==1)return[t];for(r=0;r<i.length;r++)i[r]=i[r]>=0?i[r]*t:Math.abs(i[r]);return i},i.prototype._GetAsHtmlStyle=function(n){var t="";return t+="border-"+n+"-style:"+this._GetHtmlLineStyle(),t+=ui.SemiColon,this.LineWidth>0&&(t+="border-"+n+"-width:"+this.LineWidth.toString()+"px;"),this.Color!="#000000"&&(t+="border-"+n+"-color:"+this.Color+ui.SemiColon),t},i.prototype._GetHtmlLineStyle=function(){switch(this.LineStyle){case r.None:return"none";case r.Single:return"solid";case r.Dot:return"dotted";case r.DashSmallGap:case r.DashLargeGap:case r.DashDot:case r.DashDotDot:return"dashed";case r.Double:case r.Triple:case r.ThinThickSmallGap:case r.ThickThinSmallGap:case r.ThinThickThinSmallGap:case r.ThinThickMediumGap:case r.ThickThinMediumGap:case r.ThinThickThinMediumGap:case r.ThinThickLargeGap:case r.ThickThinLargeGap:case r.ThinThickThinLargeGap:return"double";case r.SingleWavy:return"solid";case r.DoubleWavy:return"double";case r.DashDotStroked:return"solid";case r.Emboss3D:return"ridge";case r.Engrave3D:return"groove";case r.Outset:return"outset";case r.Inset:return"inset";default:return"solid"}},i.prototype._Clone=function(){var n=new i(null);return n.Color=this.Color,n.LineStyle=this.LineStyle,n.LineWidth=this.LineWidth,n.Shadow=this.Shadow,n.Space=this.Space,n},i.prototype._SerializeBorder=function(){var n={Color:[],LineStyle:[],LineWidth:[]};return n.Color=this._HasValue(i.ColorProperty)?this.Color:null,n.LineStyle=this._HasValue(i.LineStyleProperty)?this.LineStyle:null,n.LineWidth=this._HasValue(i.LineWidthProperty)?this.LineWidth:null,n},i.ColorProperty="Color",i.LineStyleProperty="LineStyle",i.LineWidthProperty="LineWidth",i.ShadowProperty="Shadow",i.SpaceProperty="Space",i}(fi);t.Border=ut;at=function(t){function i(n){t.call(this,n);this.propertyFlag=0;this.Borders=new er(this);this._AssignTableMarginValue(7.2,7.2,7.2,7.2);this.Shading=new vr(this)}return n(i,t),Object.defineProperty(i.prototype,"Borders",{get:function(){return this._GetValue(i.BordersProperty)},set:function(n){this._SetValue(i.BordersProperty,n)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"CellSpacing",{get:function(){return this._GetValue(i.CellSpacingProperty)},set:function(n){if(n<0||n>264.6)throw new RangeError("The measuremnet must be between 0 px and 264.6 px.");this._SetValue(i.CellSpacingProperty,n);this._OnCellSpacingChanged(this)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"LeftMargin",{get:function(){return this._GetValue(i.LeftMarginProperty)},set:function(n){this._ValidateMarginValue(n);this._SetValue(i.LeftMarginProperty,n);this._OnLeftMarginChanged(this)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"TopMargin",{get:function(){return this._GetValue(i.TopMarginProperty)},set:function(n){this._ValidateMarginValue(n);this._SetValue(i.TopMarginProperty,n);this._OnTopMarginChanged(this)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"RightMargin",{get:function(){return this._GetValue(i.RightMarginProperty)},set:function(n){this._ValidateMarginValue(n);this._SetValue(i.RightMarginProperty,n);this._OnRightMarginChanged(this)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"BottomMargin",{get:function(){return this._GetValue(i.BottomMarginProperty)},set:function(n){this._ValidateMarginValue(n);this._SetValue(i.BottomMarginProperty,n);this._OnBottomMarginChanged(this)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"LeftIndent",{get:function(){return this._GetValue(i.LeftIndentProperty)},set:function(n){if(n<-1440||n>1440)throw new RangeError("The measuremnet must be between -1440 px and 1440 px.");this._SetValue(i.LeftIndentProperty,n);this._OnLeftIndentChanged(this)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Shading",{get:function(){return this._GetValue(i.ShadingProperty)},set:function(n){this._SetValue(i.ShadingProperty,n)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"TableAlignment",{get:function(){return this._GetValue(i.TableAlignmentProperty)},set:function(n){this._SetValue(i.TableAlignmentProperty,n);this._OnTableAlignmentChanged(this)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"PreferredWidth",{get:function(){return this._GetValue(i.PreferredWidthProperty)},set:function(n){this._SetValue(i.PreferredWidthProperty,n);this._OnTableWidthChanged(this)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"PreferredWidthType",{get:function(){return this._GetValue(i.PreferredWidthTypeProperty)},set:function(n){this._SetValue(i.PreferredWidthTypeProperty,n)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Document",{get:function(){return this.OwnerBase instanceof e&&this.OwnerBase!=null&&this.OwnerBase.Document!=null?this.OwnerBase.Document:null},enumerable:!0,configurable:!0}),i.prototype._OnCellSpacingChanged=function(n){n._Relayout()},i.prototype._OnLeftIndentChanged=function(n){n.OwnerBase instanceof e&&n._Relayout()},i.prototype._OnTableAlignmentChanged=function(n){n.TableAlignment!=rr.Left&&n.LeftIndent!=0?n.LeftIndent=0:n._Relayout()},i.prototype._OnTableWidthChanged=function(n){n.OwnerBase instanceof e&&n._Relayout()},i.prototype._OnLeftMarginChanged=function(n){n._Relayout()},i.prototype._OnRightMarginChanged=function(n){n._Relayout()},i.prototype._OnTopMarginChanged=function(n){n._Relayout()},i.prototype._OnBottomMarginChanged=function(n){n._Relayout()},i.prototype._GetAsHtmlStyle=function(){var t="",n;return this.Shading!=undefined&&this.Shading!=null&&this.Shading.BackgroundColor!=undefined&&this.Shading.BackgroundColor!=null&&(t+=" "+wi.BgColor+ui.Equal+'"'+this.Shading.BackgroundColor+'"'),t+=' border="1"',t+=' cellpadding="0"',n=' style="',this.LeftIndent!=undefined&&this.LeftIndent!=0&&(n+=wi.LeftIndent+ui.Colon+this.LeftIndent.toString()+"px;"),n+=this._HasValue(i.CellSpacingProperty)?"cellspacing:"+(this.CellSpacing*72/48).toString()+ui.SemiColon:"border-collapse:collapse;",this.Borders!=undefined&&this.Borders!=null&&(n+=this.Borders._GetAsHtmlStyle()),n+='" ',t+n},i.prototype._CopyFormat=function(n){n.borders!=undefined&&n.borders!=null&&(this.Borders=new er(this),this.Borders._CopyFormat(n.borders));n.cellSpacing!=undefined&&n.cellSpacing!=null&&(this.CellSpacing=n.cellSpacing);n.leftMargin!=undefined&&n.leftMargin!=null&&(this.LeftMargin=n.leftMargin);n.topMargin!=undefined&&n.topMargin!=null&&(this.TopMargin=n.topMargin);n.rightMargin!=undefined&&n.rightMargin!=null&&(this.RightMargin=n.rightMargin);n.bottomMargin!=undefined&&n.bottomMargin!=null&&(this.BottomMargin=n.bottomMargin);n.leftIndent!=undefined&&n.leftIndent!=null&&(this.LeftIndent=n.leftIndent);n.shading!=undefined&&n.shading!=null&&(this.Shading=new vr(this),this.Shading._CopyFormat(n.shading));n.tableAlignment!=undefined&&n.tableAlignment!=null&&(this.TableAlignment=n.tableAlignment);n.prefferedWidth!=undefined&&n.prefferedWidth!=null&&(this.PreferredWidth=n.prefferedWidth);n.prefferedWidthType!=undefined&&n.prefferedWidthType!=null&&(this.PreferredWidthType=n.prefferedWidthType)},i.prototype._InitializeTableBorders=function(){this.Borders.Left.LineStyle=r.Single;this.Borders.Left.LineWidth=.66;this.Borders.Right.LineStyle=r.Single;this.Borders.Right.LineWidth=.66;this.Borders.Top.LineStyle=r.Single;this.Borders.Top.LineWidth=.66;this.Borders.Bottom.LineStyle=r.Single;this.Borders.Bottom.LineWidth=.66;this.Borders.Horizontal.LineStyle=r.Single;this.Borders.Horizontal.LineWidth=.66;this.Borders.Vertical.LineStyle=r.Single;this.Borders.Vertical.LineWidth=.66},i.prototype._AssignTableMarginValue=function(n,t,i,r){this.LeftMargin=n;this.TopMargin=t;this.RightMargin=i;this.BottomMargin=r},i.prototype._ApplyPropertyValue=function(n,t,r){if(n!=null&&(r=n._AddModifiedPropertiesForTableFormat(this,t,r)),r==null){this._ClearValue(t);return}if(r instanceof i){t==null&&this._HandleTableFormat(r);return}t==i.LeftIndentProperty?this.LeftIndent=r:t==i.TableAlignmentProperty?this.TableAlignment=r:t==i.CellSpacingProperty?this.CellSpacing=r:t==i.LeftMarginProperty?this.LeftMargin=r:t==i.RightMarginProperty?this.RightMargin=r:t==i.TopMarginProperty?this.TopMargin=r:t==i.BottomMarginProperty?this.BottomMargin=r:t==i.ShadingProperty?this.Shading=r:t==i.BordersProperty&&(this.Borders=r)},i.prototype._HandleTableFormat=function(n){n._HasValue(i.PreferredWidthProperty)&&(this.PreferredWidth=n.PreferredWidth);var t=this.Document;t!=null&&t.OwnerControl!=null&&(t.OwnerControl.IsLayoutEnabled=!1);n._HasValue(i.LeftIndentProperty)&&(this.LeftIndent=n.LeftIndent);n._HasValue(i.TableAlignmentProperty)&&(this.TableAlignment=n.TableAlignment);n._HasValue(i.CellSpacingProperty)&&(this.CellSpacing=n.CellSpacing);n._HasValue(i.LeftMarginProperty)&&(this.LeftMargin=n.LeftMargin);n._HasValue(i.RightMarginProperty)&&(this.RightMargin=n.RightMargin);n._HasValue(i.TopMarginProperty)&&(this.TopMargin=n.TopMargin);n._HasValue(i.BottomMarginProperty)&&(this.BottomMargin=n.BottomMargin);n._HasValue(i.BordersProperty)&&(this.Borders=n.Borders);n._HasValue(i.ShadingProperty)&&(this.Shading=n.Shading);t!=null&&t.OwnerControl!=null&&(t.OwnerControl.IsLayoutEnabled=!0);this._Relayout()},i.prototype._Relayout=function(){this.OwnerBase instanceof e&&this.OwnerBase._LayoutItem(!0)},i.prototype._CloneFormat=function(){var n=new i(null);return n.LeftIndent=this.LeftIndent,n.TableAlignment=this.TableAlignment,n.CellSpacing=this.CellSpacing,n.LeftMargin=this.LeftMargin,n.RightMargin=this.RightMargin,n.TopMargin=this.TopMargin,n.BottomMargin=this.BottomMargin,n.Borders=er==null?null:this.Borders._Clone(),n.Shading=vr==null?null:this.Shading._Clone(),n},i.prototype._Dispose=function(){this._SetOwner(null);this.Borders._Dispose();this.Shading._Dispose()},i.prototype._SerializeTableFormat=function(){var n={Borders:[],BottomMargin:[],CellSpacing:[],LeftIndent:[],LeftMargin:[],PreferredWidth:[],PreferredWidthType:[],RightMargin:[],Shading:[],TableAlignment:[],TopMargin:[]};return n.Borders=this._HasValue(i.BordersProperty)?this.Borders._SerializeBorders():null,n.Shading=this._HasValue(i.ShadingProperty)?this.Shading._SerializeShading():null,n.BottomMargin=this._HasValue(i.BottomMarginProperty)?this.BottomMargin:null,n.CellSpacing=this._HasValue(i.CellSpacingProperty)?this.CellSpacing:null,n.LeftIndent=this._HasValue(i.LeftIndentProperty)?this.LeftIndent:null,n.LeftMargin=this._HasValue(i.LeftMarginProperty)?this.LeftMargin:null,n.PreferredWidth=this._HasValue(i.PreferredWidthProperty)?this.PreferredWidth:null,n.PreferredWidthType=this._HasValue(i.PreferredWidthTypeProperty)?this.PreferredWidthType:null,n.RightMargin=this._HasValue(i.RightMarginProperty)?this.RightMargin:null,n.TableAlignment=this._HasValue(i.TableAlignmentProperty)?this.TableAlignment:null,n.TopMargin=this._HasValue(i.TopMarginProperty)?this.TopMargin:null,n},i.prototype._HasValue=function(n){switch(n){case i.BordersProperty:return(this.propertyFlag&1)==1;case i.CellSpacingProperty:return(this.propertyFlag&2)==2;case i.LeftMarginProperty:return(this.propertyFlag&4)==4;case i.RightMarginProperty:return(this.propertyFlag&8)==8;case i.TopMarginProperty:return(this.propertyFlag&16)==16;case i.BottomMarginProperty:return(this.propertyFlag&32)==32;case i.LeftIndentProperty:return(this.propertyFlag&64)==64;case i.ShadingProperty:return(this.propertyFlag&128)==128;case i.TableAlignmentProperty:return(this.propertyFlag&256)==256;case i.PreferredWidthProperty:return(this.propertyFlag&512)==512;case i.PreferredWidthTypeProperty:return(this.propertyFlag&1024)==1024;default:return!1}},i.prototype._SetValue=function(n,t){if(t!=undefined){var u=this._HasValue(n),r=0;switch(n){case i.BordersProperty:r|=1;this.borders=t;break;case i.CellSpacingProperty:r|=2;this.cellSpacing=t;break;case i.LeftMarginProperty:r|=4;this.leftMargin=t;break;case i.RightMarginProperty:r|=8;this.rightMargin=t;break;case i.TopMarginProperty:r|=16;this.topMargin=t;break;case i.BottomMarginProperty:r|=32;this.bottomMargin=t;break;case i.LeftIndentProperty:r|=64;this.leftIndent=t;break;case i.ShadingProperty:r|=128;this.shading=t;break;case i.TableAlignmentProperty:r|=256;this.tableAlignment=t;break;case i.PreferredWidthProperty:r|=512;this.prefferedWidth=t;break;case i.PreferredWidthTypeProperty:r|=1024;this.prefferedWidthType=t}u||(this.propertyFlag|=r)}},i.prototype._GetValue=function(n){var u=this._HasValue(n),r=!u,t;switch(n){case i.BordersProperty:t=r?null:this.borders;break;case i.CellSpacingProperty:t=r?0:this.cellSpacing;break;case i.LeftMarginProperty:t=r?7.2:this.leftMargin;break;case i.RightMarginProperty:t=r?7.2:this.rightMargin;break;case i.TopMarginProperty:t=r?0:this.topMargin;break;case i.BottomMarginProperty:t=r?0:this.bottomMargin;break;case i.LeftIndentProperty:t=r?0:this.leftIndent;break;case i.ShadingProperty:t=r?null:this.shading;break;case i.TableAlignmentProperty:t=r?rr.Left:this.tableAlignment;break;case i.PreferredWidthProperty:t=r?0:this.prefferedWidth;break;case i.PreferredWidthTypeProperty:t=r?ht.Pixel:this.prefferedWidthType}return t},i.prototype._ValidateMarginValue=function(n){if(n<0||n>2112)throw new RangeError("The measurement must be between 0px and 2112px");},i.prototype._ClearValue=function(n){switch(n){case i.BordersProperty:this.propertyFlag=this.propertyFlag^1;case i.CellSpacingProperty:this.propertyFlag=this.propertyFlag^2;case i.LeftMarginProperty:this.propertyFlag=this.propertyFlag^4;case i.RightMarginProperty:this.propertyFlag=this.propertyFlag^8;case i.TopMarginProperty:this.propertyFlag=this.propertyFlag^16;case i.BottomMarginProperty:this.propertyFlag=this.propertyFlag^32;case i.LeftIndentProperty:this.propertyFlag=this.propertyFlag^64;case i.ShadingProperty:this.propertyFlag=this.propertyFlag^128;case i.TableAlignmentProperty:this.propertyFlag=this.propertyFlag^256;case i.PreferredWidthProperty:this.propertyFlag=this.propertyFlag^512;case i.PreferredWidthTypeProperty:this.propertyFlag=this.propertyFlag^1024}},i.BordersProperty="Borders",i.CellSpacingProperty="CellSpacing",i.LeftMarginProperty="LeftMargin",i.TopMarginProperty="TopMargin",i.RightMarginProperty="RightMargin",i.BottomMarginProperty="BottomMargin",i.LeftIndentProperty="LeftIndent",i.ShadingProperty="Shading",i.TableAlignmentProperty="TableAlignment",i.PreferredWidthProperty="PreferredWidth",i.PreferredWidthTypeProperty="PreferredWidthType",i}(fi);t.TableFormat=at;tr=function(t){function i(n){t.call(this,n);this.propertyFlag=0;this.Borders=new er(this)}return n(i,t),Object.defineProperty(i.prototype,"AllowBreakAcrossPages",{get:function(){return this._GetValue(i.AllowBreakAcrossPagesProperty)},set:function(n){this._SetValue(i.AllowBreakAcrossPagesProperty,n);this._OnAllowRowBreakAcrossPagesChanged(this)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"IsHeader",{get:function(){return this._GetValue(i.IsHeaderProperty)},set:function(n){this._SetValue(i.IsHeaderProperty,n);this._OnIsHeaderChanged(this)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Height",{get:function(){return this._GetValue(i.HeightProperty)},set:function(n){n==0&&(this.HeightType==et.Atleast||this.HeightType==et.Exactly)?n=1.33:this.HeightType==et.Auto&&(n=0);this._ValidateRowHeight(n);this._SetValue(i.HeightProperty,n);this._OnHeightChanged(this)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"HeightType",{get:function(){return this._GetValue(i.HeightTypeProperty)},set:function(n){this.Height=n==et.Atleast||n==et.Exactly?16:0;this._SetValue(i.HeightTypeProperty,n);this._OnHeightTypeChanged(this)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Borders",{get:function(){return this._GetValue(i.BordersProperty)},set:function(n){this._SetValue(i.BordersProperty,n)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Document",{get:function(){return this.OwnerBase instanceof bt&&this.OwnerBase.OwnerTable!=null&&this.OwnerBase.OwnerTable.Document!=null?this.OwnerBase.OwnerTable.Document:null},enumerable:!0,configurable:!0}),i.prototype._OnAllowRowBreakAcrossPagesChanged=function(n){n._Relayout()},i.prototype._OnHeightTypeChanged=function(n){n._Relayout()},i.prototype._OnIsHeaderChanged=function(n){n._Relayout()},i.prototype._HasValue=function(n){switch(n){case i.AllowBreakAcrossPagesProperty:return(this.propertyFlag&1)==1;case i.IsHeaderProperty:return(this.propertyFlag&2)==2;case i.HeightProperty:return(this.propertyFlag&4)==4;case i.HeightTypeProperty:return(this.propertyFlag&8)==8;case i.BordersProperty:return(this.propertyFlag&16)==16;default:return!1}},i.prototype._SetValue=function(n,t){if(t!=undefined){var u=this._HasValue(n),r=0;switch(n){case i.AllowBreakAcrossPagesProperty:r|=1;this.allowBreakAcrossPages=t;break;case i.IsHeaderProperty:r|=2;this.isHeader=t;break;case i.HeightProperty:r|=4;this.height=t;break;case i.HeightTypeProperty:r|=8;this.heightType=t;break;case i.BordersProperty:r|=16;this.borders=t}u||(this.propertyFlag|=r)}},i.prototype._GetValue=function(n){var u=this._HasValue(n),r=!u,t;switch(n){case i.AllowBreakAcrossPagesProperty:t=r?!0:this.allowBreakAcrossPages;break;case i.IsHeaderProperty:t=r?!1:this.isHeader;break;case i.HeightProperty:t=r?0:this.height;break;case i.HeightTypeProperty:t=r?et.Auto:this.heightType;break;case i.BordersProperty:t=r?null:this.borders}return t},i.prototype._ValidateRowHeight=function(n){switch(this.HeightType){case et.Auto:break;default:if(n<1.33||n>2112)throw new RangeError("The value must be between 1.33px to 2112px");}},i.prototype._ClearValue=function(n){switch(n){case i.AllowBreakAcrossPagesProperty:this.propertyFlag=this.propertyFlag^1;case i.IsHeaderProperty:this.propertyFlag=this.propertyFlag^2;case i.HeightProperty:this.propertyFlag=this.propertyFlag^4;case i.HeightTypeProperty:this.propertyFlag=this.propertyFlag^8;case i.BordersProperty:this.propertyFlag=this.propertyFlag^16}},i.prototype._CopyFormat=function(n){n.allowBreakAcrossPages!=undefined&&n.allowBreakAcrossPages!=null&&(this.AllowBreakAcrossPages=n.allowBreakAcrossPages);n.isHeader!=undefined&&n.isHeader!=null&&(this.IsHeader=n.isHeader);n.height!=undefined&&n.height!=null&&(this.Height=n.height);n.heightType!=undefined&&n.heightType!=null&&(this.HeightType=n.heightType);n.borders!=undefined&&n.borders!=null&&(this.Borders=new er(this),this.Borders._CopyFormat(n.borders))},i.prototype._GetAsHtmlStyle=function(){var n="";return this.Height!=undefined&&this.Height>0&&(n='style ="height:'+this.Height.toString()+'px;"'),n},i.prototype._ApplyPropertyValue=function(n,t,r){if(n!=null&&(r=n._AddModifiedPropertiesForRowFormat(this,t,r)),r==null){this._ClearValue(t);return}if(r instanceof i){t==null&&this._HandleRowFormat(r);return}t==i.HeightTypeProperty?this.HeightType=r:t==i.HeightProperty?this.Height=r:t==i.IsHeaderProperty?this.IsHeader=r:t==i.AllowBreakAcrossPagesProperty&&(this.AllowBreakAcrossPages=r)},i.prototype._HandleRowFormat=function(n){var t=this.Document;t!=null&&t.OwnerControl!=null&&(t.OwnerControl.IsLayoutEnabled=!1);n._HasValue(i.HeightTypeProperty)&&(this.HeightType=n.HeightType);n._HasValue(i.HeightProperty)&&(this.Height=n.Height);n._HasValue(i.IsHeaderProperty)&&(this.IsHeader=n.IsHeader);n._HasValue(i.AllowBreakAcrossPagesProperty)&&(this.AllowBreakAcrossPages=n.AllowBreakAcrossPages);t!=null&&t.OwnerControl!=null&&(t.OwnerControl.IsLayoutEnabled=!0);this._Relayout()},i.prototype._Relayout=function(){this.OwnerBase instanceof bt&&this.Document!=null&&this.OwnerBase.OwnerTable._LayoutItem(!0)},i.prototype._CloneFormat=function(){var n=new i(null);return n.AllowBreakAcrossPages=this.AllowBreakAcrossPages,n.Height=this.Height,n.HeightType=this.HeightType,n.IsHeader=this.IsHeader,n},i.prototype._OnHeightChanged=function(n){n._Relayout()},i.prototype._SerializeRowFormat=function(){var n={AllowBreakAcrossPages:[],Borders:[],Height:[],HeightType:[],IsHeader:[]};return n.AllowBreakAcrossPages=this._HasValue(i.AllowBreakAcrossPagesProperty)?this.AllowBreakAcrossPages:null,n.Height=this._HasValue(i.HeightProperty)?this.Height:null,n.HeightType=this._HasValue(i.HeightTypeProperty)?this.HeightType:null,n.IsHeader=this._HasValue(i.IsHeaderProperty)?this.IsHeader:null,n.Borders=this._HasValue(i.BordersProperty)?this.Borders._SerializeBorders():null,n},i.AllowBreakAcrossPagesProperty="AllowBreakAcrossPages",i.IsHeaderProperty="IsHeader",i.HeightProperty="Height",i.HeightTypeProperty="HeightType",i.BordersProperty="Borders",i}(fi);t.RowFormat=tr;ai=function(t){function i(n){t.call(this,n);this.propertyFlag=0;this.Borders=new er(this);this.Shading=new vr(this)}return n(i,t),Object.defineProperty(i.prototype,"Borders",{get:function(){return this._GetValue(i.BordersProperty)},set:function(n){this._SetValue(i.BordersProperty,n)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"LeftMargin",{get:function(){return this._GetValue(i.LeftMarginProperty)},set:function(n){this._ValidateMarginValue(n);this._SetValue(i.LeftMarginProperty,n);this._OnLeftMarginChanged(this)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"TopMargin",{get:function(){return this._GetValue(i.TopMarginProperty)},set:function(n){this._ValidateMarginValue(n);this._SetValue(i.TopMarginProperty,n);this._OnTopMarginChanged(this)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"BottomMargin",{get:function(){return this._GetValue(i.BottomMarginProperty)},set:function(n){this._ValidateMarginValue(n);this._SetValue(i.BottomMarginProperty,n);this._OnBottomMarginChanged(this)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"RightMargin",{get:function(){return this._GetValue(i.RightMarginProperty)},set:function(n){this._ValidateMarginValue(n);this._SetValue(i.RightMarginProperty,n);this._OnRightMarginChanged(this)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"CellWidth",{get:function(){return this._GetValue(i.CellWidthProperty)},set:function(n){this._SetValue(i.CellWidthProperty,n)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"ColumnSpan",{get:function(){return this._GetValue(i.ColSpanProperty)},set:function(n){if(n<1)throw new RangeError("ColumnSpan value must be greater than or equal to one.");this._SetValue(i.ColSpanProperty,n);this._OnColumnSpanChanged(this)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"RowSpan",{get:function(){return this._GetValue(i.RowSpanProperty)},set:function(n){if(n<1)throw new RangeError("ColumnSpan value must be greater than or equal to one.");this._SetValue(i.RowSpanProperty,n);this._OnRowSpanChanged(this)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"PrefferedWidth",{get:function(){return this._GetValue(i.PreferredWidthProperty)},set:function(n){this._SetValue(i.PreferredWidthProperty,n);this._OnPreferredWidthChanged(this)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"PrefferedWidthType",{get:function(){return this._GetValue(i.PreferredWidthTypeProperty)},set:function(n){this._SetValue(i.PreferredWidthTypeProperty,n)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Shading",{get:function(){return this._GetValue(i.ShadingProperty)},set:function(n){this._SetValue(i.ShadingProperty,n)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"VerticalAlignment",{get:function(){return this._GetValue(i.VerticalAlignmentProperty)},set:function(n){this._SetValue(i.VerticalAlignmentProperty,n);this._OnVerticalAlignmentChanged(this)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Document",{get:function(){return this.OwnerBase instanceof ot&&this.OwnerBase.OwnerTable!=null&&this.OwnerBase.OwnerTable.Document!=null?this.OwnerBase.OwnerTable.Document:null},enumerable:!0,configurable:!0}),i.prototype._OnColumnSpanChanged=function(n){n.OwnerBase instanceof ot&&n._Relayout()},i.prototype._OnRowSpanChanged=function(n){n.OwnerBase instanceof ot&&n._Relayout()},i.prototype._OnVerticalAlignmentChanged=function(n){n.OwnerBase instanceof ot&&n.Document!=null&&n.OwnerBase._UpdateCellVerticalPosition(n.Document.OwnerControl.Viewer)},i.prototype._OnLeftMarginChanged=function(n){n._Relayout()},i.prototype._OnRightMarginChanged=function(n){n._Relayout()},i.prototype._OnTopMarginChanged=function(n){n._Relayout()},i.prototype._OnBottomMarginChanged=function(n){n._Relayout()},i.prototype._OnPreferredWidthChanged=function(n){n.OwnerBase instanceof ot&&n._Relayout()},i.prototype._HasValue=function(n){switch(n){case i.BordersProperty:return(this.propertyFlag&1)==1;case i.LeftMarginProperty:return(this.propertyFlag&2)==2;case i.RightMarginProperty:return(this.propertyFlag&4)==4;case i.TopMarginProperty:return(this.propertyFlag&8)==8;case i.BottomMarginProperty:return(this.propertyFlag&16)==16;case i.CellWidthProperty:return(this.propertyFlag&32)==32;case i.ColSpanProperty:return(this.propertyFlag&64)==64;case i.RowSpanProperty:return(this.propertyFlag&128)==128;case i.ShadingProperty:return(this.propertyFlag&256)==256;case i.VerticalAlignmentProperty:return(this.propertyFlag&512)==512;case i.PreferredWidthProperty:return(this.propertyFlag&1024)==1024;case i.PreferredWidthTypeProperty:return(this.propertyFlag&2048)==2048;default:return!1}},i.prototype._SetValue=function(n,t){if(t!=undefined){var u=this._HasValue(n),r=0;switch(n){case i.BordersProperty:r|=1;this.borders=t;break;case i.LeftMarginProperty:r|=2;this.leftMargin=t;break;case i.RightMarginProperty:r|=4;this.rightMargin=t;break;case i.TopMarginProperty:r|=8;this.topMargin=t;break;case i.BottomMarginProperty:r|=16;this.bottomMargin=t;break;case i.CellWidthProperty:r|=32;this.cellWidth=t;break;case i.ColSpanProperty:r|=64;this.colSpan=t;break;case i.RowSpanProperty:r|=128;this.rowSpan=t;break;case i.ShadingProperty:r|=256;this.shading=t;break;case i.VerticalAlignmentProperty:r|=512;this.verticalAlignment=t;break;case i.PreferredWidthProperty:r|=1024;this.prefferedWidth=t;break;case i.PreferredWidthTypeProperty:r|=2048;this.prefferedWidthtype=t}u||(this.propertyFlag|=r)}},i.prototype._GetValue=function(n){var u=this._HasValue(n),r=!u,t;switch(n){case i.BordersProperty:t=r?null:this.borders;break;case i.CellWidthProperty:t=r?0:this.cellWidth;break;case i.LeftMarginProperty:t=r?0:this.leftMargin;break;case i.RightMarginProperty:t=r?0:this.rightMargin;break;case i.TopMarginProperty:t=r?0:this.topMargin;break;case i.BottomMarginProperty:t=r?0:this.bottomMargin;break;case i.ColSpanProperty:t=r?1:this.colSpan;break;case i.RowSpanProperty:t=r?1:this.rowSpan;break;case i.ShadingProperty:t=r?null:this.shading;break;case i.VerticalAlignmentProperty:t=r?or.Top:this.verticalAlignment;break;case i.PreferredWidthProperty:t=r?0:this.prefferedWidth;break;case i.PreferredWidthTypeProperty:t=r?ht.Pixel:this.prefferedWidthtype}return t},i.prototype._ClearValue=function(n){switch(n){case i.BordersProperty:this.propertyFlag=this.propertyFlag^1;case i.LeftMarginProperty:this.propertyFlag=this.propertyFlag^2;case i.RightMarginProperty:this.propertyFlag=this.propertyFlag^4;case i.TopMarginProperty:this.propertyFlag=this.propertyFlag^8;case i.BottomMarginProperty:this.propertyFlag=this.propertyFlag^16;case i.CellWidthProperty:this.propertyFlag=this.propertyFlag^32;case i.ColSpanProperty:this.propertyFlag=this.propertyFlag^64;case i.RowSpanProperty:this.propertyFlag=this.propertyFlag^128;case i.ShadingProperty:this.propertyFlag=this.propertyFlag^256;case i.VerticalAlignmentProperty:this.propertyFlag=this.propertyFlag^512;case i.PreferredWidthProperty:this.propertyFlag=this.propertyFlag^1024;case i.PreferredWidthTypeProperty:this.propertyFlag=this.propertyFlag^2048}},i.prototype._CopyFormat=function(n){n.borders!=undefined&&n.borders!=null&&(this.Borders=new er(this),this.Borders._CopyFormat(n.borders));n.leftMargin!=undefined&&n.leftMargin!=null&&(this.LeftMargin=n.leftMargin);n.rightMargin!=undefined&&n.rightMargin!=null&&(this.RightMargin=n.rightMargin);n.topMargin!=undefined&&n.topMargin!=null&&(this.TopMargin=n.topMargin);n.bottomMargin!=undefined&&n.bottomMargin!=null&&(this.BottomMargin=n.bottomMargin);n.cellWidth!=undefined&&n.cellWidth!=null&&(this.CellWidth=n.cellWidth);n.colSpan!=undefined&&n.colSpan!=null&&(this.ColumnSpan=n.colSpan);n.rowSpan!=undefined&&n.rowSpan!=null&&(this.RowSpan=n.rowSpan);n.shading!=undefined&&n.shading!=null&&(this.Shading=new vr(this),this.Shading._CopyFormat(n.shading));n.verticalAlignment!=undefined&&n.verticalAlignment!=null&&(this.VerticalAlignment=n.verticalAlignment);n.prefferedWidthtype!=undefined&&n.prefferedWidthtype!=null&&(this.PrefferedWidthType=n.prefferedWidthtype);n.prefferedWidth!=undefined&&n.prefferedWidth!=null&&(this.PrefferedWidth=n.prefferedWidth)},i.prototype._ContainsMargins=function(){return this._HasValue(i.LeftMarginProperty)||this._HasValue(i.RightMarginProperty)||this._HasValue(i.BottomMarginProperty)||this._HasValue(i.TopMarginProperty)},i.prototype._ClearMargins=function(){this.LeftMargin=this.RightMargin=this.TopMargin=this.BottomMargin=undefined},i.prototype._GetAsHtmlStyle=function(){var t="",n;return t+=" rowspan="+this.RowSpan.toString(),t+=" colspan="+this.ColumnSpan.toString(),this.Shading!=undefined&&this.Shading!=null&&this.Shading.BackgroundColor!=undefined&&this.Shading.BackgroundColor!=null&&(t+=" "+wi.BgColor+ui.Equal+'"'+this.Shading.BackgroundColor+'"'),this.CellWidth!=undefined&&this.CellWidth>0&&(t+=" width="+this.CellWidth.toString()),n=' style="',this.VerticalAlignment!=or.Top&&(n+="valign:"+this.VerticalAlignment.toString().toLowerCase()),this._ContainsMargins()&&(this.LeftMargin!=undefined&&this.LeftMargin!=0&&(n+="padding-left:"+this.LeftMargin.toString()+"px;"),this.RightMargin!=undefined&&this.RightMargin!=0&&(n+="padding-right:"+this.RightMargin.toString()+"px;"),this.TopMargin!=undefined&&this.TopMargin!=0&&(n+="padding-top:"+this.TopMargin.toString()+"px;"),this.BottomMargin!=undefined&&this.BottomMargin!=0&&(n+="padding-bottom:"+this.BottomMargin.toString()+"px;")),this.Borders!=undefined&&this.Borders!=null&&(n+=this.Borders._GetAsHtmlStyle()),n+='" ',t+n},i.prototype._ApplyPropertyValue=function(n,t,r){if(n!=null&&(r=n._AddModifiedPropertiesForCellFormat(this,t,r)),r==null){this._ClearValue(t);return}if(r instanceof i){t==null&&this._HandleCellFormat(r);return}t==i.LeftMarginProperty?this.LeftMargin=r:t==i.TopMarginProperty?this.TopMargin=r:t==i.RightMarginProperty?this.RightMargin=r:t==i.BottomMarginProperty?this.BottomMargin=r:t==i.PreferredWidthProperty?this.PrefferedWidth=r:t==i.ColSpanProperty?this.ColumnSpan=r:t==i.RowSpanProperty?this.RowSpan=r:t==i.PreferredWidthTypeProperty?this.PrefferedWidthType=r:t==i.VerticalAlignmentProperty?this.VerticalAlignment=r:t==i.ShadingProperty?this.Shading=r:t==i.BordersProperty&&(this.Borders=r)},i.prototype._CloneFormat=function(){var n=new i(null);return n.VerticalAlignment=this.VerticalAlignment,n.LeftMargin=this.LeftMargin,n.RightMargin=this.RightMargin,n.TopMargin=this.TopMargin,n.BottomMargin=this.BottomMargin,n.Borders=er==null?null:this.Borders._Clone(),n.Shading=vr==null?null:this.Shading._Clone(),n},i.prototype._HandleCellFormat=function(n){var t=this.Document;t!=null&&t.OwnerControl!=null&&(t.OwnerControl.IsLayoutEnabled=!1);n._HasValue(i.LeftMarginProperty)&&(this.LeftMargin=n.LeftMargin);n._HasValue(i.TopMarginProperty)&&(this.TopMargin=n.TopMargin);n._HasValue(i.RightMarginProperty)&&(this.RightMargin=n.RightMargin);n._HasValue(i.BottomMarginProperty)&&(this.BottomMargin=n.BottomMargin);n._HasValue(i.PreferredWidthProperty)&&(this.PrefferedWidth=n.PrefferedWidth);n._HasValue(i.ColSpanProperty)&&(this.ColumnSpan=n.ColumnSpan);n._HasValue(i.RowSpanProperty)&&(this.RowSpan=n.RowSpan);n._HasValue(i.PreferredWidthTypeProperty)&&(this.PrefferedWidthType=n.PrefferedWidthType);n._HasValue(i.VerticalAlignmentProperty)&&(this.VerticalAlignment=n.VerticalAlignment);t!=null&&t.OwnerControl!=null&&(t.OwnerControl.IsLayoutEnabled=!0);this._Relayout()},i.prototype._Relayout=function(){this.OwnerBase instanceof ot&&this.Document!=null&&this.OwnerBase.OwnerRow._LayoutInternal(this.Document.OwnerControl.Viewer)},i.prototype._Dispose=function(){this._SetOwner(null)},i.prototype._SerializeCellFormat=function(){var n={Borders:[],BottomMargin:[],CellWidth:[],ColumnSpan:[],IsSamePaddingAsTable:[],LeftMargin:[],PreferredWidth:[],PreferredWidthType:[],RightMargin:[],RowSpan:[],Shading:[],TopMargin:[],VerticalAlignment:[]};return n.BottomMargin=this._HasValue(i.BottomMarginProperty)?this.BottomMargin:null,n.CellWidth=this._HasValue(i.CellWidthProperty)?this.CellWidth:null,n.ColumnSpan=this._HasValue(i.ColSpanProperty)?this.ColumnSpan:null,n.LeftMargin=this._HasValue(i.LeftMarginProperty)?this.LeftMargin:null,n.PreferredWidth=this._HasValue(i.PreferredWidthProperty)?this.PrefferedWidth:null,n.PreferredWidthType=this._HasValue(i.PreferredWidthTypeProperty)?this.PrefferedWidthType:null,n.RightMargin=this._HasValue(i.RightMarginProperty)?this.RightMargin:null,n.RowSpan=this._HasValue(i.RowSpanProperty)?this.RowSpan:null,n.TopMargin=this._HasValue(i.TopMarginProperty)?this.TopMargin:null,n.VerticalAlignment=this._HasValue(i.VerticalAlignmentProperty)?this.VerticalAlignment:null,n.IsSamePaddingAsTable=!0,n.Borders=this._HasValue(i.BordersProperty)?this.Borders._SerializeBorders():null,n.Shading=this._HasValue(i.ShadingProperty)?this.Shading._SerializeShading():null,n},i.prototype._ValidateMarginValue=function(n){if(n<0||n>2112)throw new RangeError("The measurement must be between 0px and 2112px");},i.BordersProperty="Borders",i.LeftMarginProperty="LeftMargin",i.TopMarginProperty="TopMargin",i.RightMarginProperty="RightMargin",i.BottomMarginProperty="BottomMargin",i.CellWidthProperty="CellWidth",i.ColSpanProperty="ColSpan",i.RowSpanProperty="RowSpan",i.ShadingProperty="Shading",i.VerticalAlignmentProperty="VerticalAlignment",i.PreferredWidthProperty="PreferredWidth",i.PreferredWidthTypeProperty="PreferredWidthType",i}(fi);t.CellFormat=ai;vi=function(t){function i(n){t.call(this,n)}return n(i,t),Object.defineProperty(i.prototype,"Length",{get:function(){return 1},enumerable:!0,configurable:!0}),i.prototype._AddElementBox=function(){var n=new gi(this);n.Width=0;this.Elements._Add(n)},i.prototype._Dispose=function(){this.CharacterFormat._Dispose();this._SetOwner(null);this._ClearElements(!0)},i.prototype._InsertText=function(n,t){var i=new s(this),r;i.Text=t;r=this.OwnerParagraph.Inlines._IndexOf(this);i.CharacterFormat._CopyFormat(this.CharacterFormat);this.OwnerParagraph.Inlines._Insert(r,i)},i.prototype._GetPreviousWordOffset=function(){},i.prototype._GetNextWordOffset=function(){},i}(k);t.CommentCharacterAdv=vi;g=function(t){function i(n,i){t.call(this,n);this.author="";this.initial="";this.createdDate=i;this.blocks=new ur(this)}return n(i,t),Object.defineProperty(i.prototype,"CommentId",{get:function(){return this.OwnerParagraph!=null&&this.OwnerParagraph.Document!=null?this.OwnerParagraph.Document.Comments._IndexOf(this):-1},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"CommentStart",{get:function(){return this.commentStart},set:function(n){this.commentStart=n},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"CommentEnd",{get:function(){return this.commentEnd},set:function(n){this.commentEnd=n},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Author",{get:function(){return this.author},set:function(n){this.author=n},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Initial",{get:function(){return this.initial},set:function(n){this.initial=n},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Date",{get:function(){return this.createdDate},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Blocks",{get:function(){return this.blocks},set:function(n){this.blocks=n},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"LayoutedWidget",{get:function(){return this.layoutedWidget},set:function(n){this.layoutedWidget=n},enumerable:!0,configurable:!0}),i.prototype._SerializeInline=function(){var n={Author:[],CharacterFormat:[],CommentId:[],Date:[],createdDate:[],Initial:[],Blocks:[],CommentAdv:[]},t,i;for(n.Author=this.Author,n.CharacterFormat=this.CharacterFormat._SerializeCharacterFormat(),n.CommentId=this.CommentId,n.Date=this.Date,n.createdDate=this.createdDate,n.Initial=this.Initial,n.CommentAdv=!0,t=0;t<this.Blocks.Count;t++)i=this.Blocks[t],i instanceof u?n.Blocks[t]=i._SerializeBlock():i instanceof e&&(n.Blocks[t]=i._SerializeBlock());return n},i.prototype._Clone=function(){var t=new i(this,this.createdDate),n;for(t.CharacterFormat._CopyFormat(this.CharacterFormat),n=0;n<this.Blocks.Count;n++)t.Blocks._Add(this.Blocks[n]._Clone());return t},i.prototype._LayoutCommentItems=function(n){var f,r,t;this.LayoutedWidget!=null&&this.LayoutedWidget._Dispose();var e=n.ClientArea,o=n.ClientActiveArea,i=null;if(n.LineElements.Count>0&&(i=n.LineElements._ToList(),n.LineElements._Clear()),n.CurrentComment=this,this._AddCommentWidget(n),n._UpdateCommentClientArea(),this.LayoutedWidget.Width=n.ClientArea.Width,this.Blocks.Count!=null){for(this.Blocks.Count==0&&(f=null,f=new u(this),this.Blocks._Add(f)),t=0;t<this.Blocks.Count;t++)r=this.Blocks[t],n._UpdateClientAreaForBlock(r,!0),r._LayoutItems(n),n._UpdateClientAreaForBlock(r,!1);if(n.CommentWidgets._Add(this.LayoutedWidget),n._ResetClientArea(e,o),n.CurrentComment=null,i!=null&&n.LineElements.Count==0)for(t=0;t<i.Count;t++)n.LineElements._Add(i[t])}},i.prototype._AddCommentWidget=function(n){var t=new ar(this);t.X=n.isReviewPanelShow?n.CurrentRenderingPage.BoundingRectangle.Width-n.CurrentRenderingPage.ReviewPanelWidth:n.CurrentRenderingPage.BoundingRectangle.Width;t.Y=n.ClientActiveArea.Y;this.LayoutedWidget=t},i.prototype._GetFirstParagraph=function(){return(this.Blocks==null||this.Blocks.Count==0)&&this.Blocks._Add(new u(this)),this.Blocks[0]instanceof u?this.Blocks[0]:this.Blocks[0]._GetNextParagraph()},i.prototype._GetNextParagraph=function(n){return n.NextNode instanceof u?n.NextNode:n.NextNode instanceof e?n.NextNode._GetFirstParagraphInFirstCell():null},i.prototype._GetPreviousParagraph=function(n){return n.PreviousNode instanceof u?n.PreviousNode:n.PreviousNode instanceof e?n.PreviousNode._GetFirstParagraphInFirstCell():null},i.prototype._GetHierarchialIndex=function(n){if(n!=null&&this.OwnerParagraph!=null&&this.OwnerParagraph.Owner instanceof yt){var t=this.OwnerParagraph.Owner,i=t._GetHierarchicalIndex(t.ChildNodes._IndexOf(this.OwnerParagraph).toString());return i+";"+this.OwnerParagraph._GetOffset(this,0).toString()+";C;"+this.Blocks._IndexOf(n).toString()+";"}return""},i.prototype._Relayout=function(){var n=this._GetOwnerDocument();this.Elements!=null&&this.Elements.Count>0&&n!=null&&n.OwnerControl!=null&&n.OwnerControl.IsDocumentLoaded&&n.OwnerControl.IsLayoutEnabled&&n.OwnerControl.Viewer!=null&&n.OwnerControl.Viewer instanceof w&&(n.OwnerControl.IsLayoutEnabled=!1,this._LayoutCommentItems(n.OwnerControl.Viewer),this._UpdateCommentWidgetToPage(),n.OwnerControl.IsLayoutEnabled=!0)},i.prototype._UpdateCommentWidgetToPage=function(){var n=this.Elements[0].CurrentLineWidget.CurrentParagraphWidget._GetPage();this.LayoutedWidget.TopPosition=this.Elements[0].CurrentLineWidget._GetTop();this.LayoutedWidget.Page=n;n.CommentWidgets._Contains(this.LayoutedWidget)||(n.CommentWidgets._Add(this.LayoutedWidget),n._AdjustCommentWidgets());n.Viewer.CommentWidgets._Remove(this.LayoutedWidget)},i.prototype._SerializeComments=function(){var n={Author:[]},t,i;for(n.Author=this.Author,n.CharacterFormat=this.CharacterFormat._SerializeCharacterFormat(),n.CmtID=this.CommentId,n.Date=this.Date,n.WordSplitCharacters=this.WordSplitCharacters,n.Initial=this.Initial,n.Blocks={},t=0;t<this.Blocks.Count;t++)i=this.Blocks[t],i instanceof u?n.Blocks[t]=i._SerializeBlock():i instanceof e&&(n.Blocks[t]=i._SerializeBlock());return n},i}(vi);t.CommentAdv=g;ir=function(t){function i(n){t.call(this,n)}return n(i,t),Object.defineProperty(i.prototype,"Comment",{get:function(){return this.comment},set:function(n){this.comment=n},enumerable:!0,configurable:!0}),i.prototype._SerializeInline=function(){var n={CharacterFormat:[],CommentStartAdv:[],CommentID:[]};return n.CharacterFormat=this.CharacterFormat._SerializeCharacterFormat(),n.CommentID=this.Comment.CommentId,n.CommentStartAdv=!0,n},i.prototype._Clone=function(){var n=new i(this);return n.CharacterFormat._CopyFormat(this.CharacterFormat),n},i}(vi);t.CommentStartAdv=ir;hr=function(t){function i(n){t.call(this,n)}return n(i,t),Object.defineProperty(i.prototype,"Comment",{get:function(){return this.comment},set:function(n){this.comment=n},enumerable:!0,configurable:!0}),i.prototype._SerializeInline=function(){var n={CharacterFormat:[],CommentID:[],CommentEndAdv:[]};return n.CharacterFormat=this.CharacterFormat._SerializeCharacterFormat(),n.CommentID=this.Comment.CommentId,n.CommentEndAdv=!0,n},i.prototype._Clone=function(){var n=new i(this);return n.CharacterFormat._CopyFormat(this.CharacterFormat),n},i}(vi);t.CommentEndAdv=hr;eu=function(){function n(n){this.ownerControl=n;this.removedNodes=new h;this.modifiedProperties=new h;this.modifiedNodeLength=new h}return Object.defineProperty(n.prototype,"OwnerControl",{get:function(){return this.ownerControl},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"Action",{get:function(){return this.action},set:function(n){this.action=n},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"RemovedNodes",{get:function(){return this.removedNodes},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"ModifiedProperties",{get:function(){return this.modifiedProperties},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"SelectionStart",{get:function(){return this.selectionStart},set:function(n){this.selectionStart=n},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"SelectionEnd",{get:function(){return this.selectionEnd},set:function(n){this.selectionEnd=n},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"InsertPosition",{get:function(){return this.insertPosition},set:function(n){this.insertPosition=n},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"EndPosition",{get:function(){return this.endPosition},set:function(n){this.endPosition=n},enumerable:!0,configurable:!0}),n.prototype._UpdateSelectionRange=function(n){this.selectionStart=n.Start._GetHierarchicalIndexInternal();this.selectionEnd=n.End._GetHierarchicalIndexInternal()},n.prototype._UpdateSelection=function(n){this.selectionStart=n.Start._GetHierarchicalIndexInternal();this.selectionEnd=n.End._GetHierarchicalIndexInternal()},n.prototype._GetProperty=function(){switch(this.Action){case i.Bold:return o.BoldProperty;case i.Italic:return o.ItalicProperty;case i.FontColor:return o.FontColorProperty;case i.FontFamily:return o.FontFamilyProperty;case i.FontSize:return o.FontSizeProperty;case i.HighlightColor:return o.HighlightColorProperty;case i.BaselineAlignment:return o.BaselineAlignmentProperty;case i.StrikeThrough:return o.StrikeThroughProperty;case i.Underline:return o.UnderlineProperty;case i.AfterSpacing:return a.AfterSpacingProperty;case i.BeforeSpacing:return a.BeforeSpacingProperty;case i.LeftIndent:return a.LeftIndentProperty;case i.RightIndent:return a.RightIndentProperty;case i.FirstLineIndent:return a.FirstLineIndentProperty;case i.LineSpacingType:return a.LineSpacingTypeProperty;case i.LineSpacing:return a.LineSpacingProperty;case i.TextAlignment:return a.TextAlignmentProperty;case i.ListFormat:return a.ListFormatProperty;case i.PageSize:return"PageSizeProperty";case i.PageMargin:return"PageMarginProperty"}return null},n.prototype._InsertClonedFieldResult=function(n){for(var t,i,f=!1,r=0;r<this.RemovedNodes.Count;r++){if(t=this.RemovedNodes[r],!f)if(n==t)f=!0;else{t instanceof u&&t==n.OwnerParagraph&&(f=!0,i=null,r==0?(i=this.OwnerControl.Selection.Start.Paragraph,n.OwnerParagraph._GetClonedFieldResultWithSel(this.OwnerControl.Selection,n)):(i=n.OwnerParagraph._GetClonedFieldResult(n),this.OwnerControl.Selection.Start.Paragraph._InsertParagraph(i,this.OwnerControl.Selection.Start.Offset,!0)),this.OwnerControl.Selection._SelectParagraph(i._GetNextParagraph(),!0,!0));continue}t instanceof k?this.OwnerControl.Selection._InsertInlineInternal(t._Clone()):t instanceof hi?this.OwnerControl.Selection._InsertBlockInternal(t._Clone()):t instanceof ct&&this.OwnerControl.Selection._InsertSection(t._Clone())}},n.prototype._RevertProperties=function(n){var t,i,r,u;if(this.OwnerControl.Selection.CurrentBaseHistoryInfo=this,this.currentPropertyIndex=0,t=this._GetProperty(),this.modifiedProperties[0]instanceof o)this.OwnerControl.Selection._UpdateCharacterFormatForSelRange(n,t,null);else if(this.modifiedProperties[0]instanceof a)this.OwnerControl.Selection._UpdateParagraphFormats(n,t,null);else if(this.modifiedProperties[0]instanceof sf)this.OwnerControl.Selection._UpdateImageSize(this.modifiedProperties[0]);else if(this.modifiedProperties[0]instanceof fu)this.OwnerControl.Selection._UpdateSectionFormat(t,null);else if(this.modifiedProperties[0]instanceof ou){for(i=new ne,r=0;r<this.modifiedProperties.Count;r++)u=this.modifiedProperties[r],i.ModifiedLevels._Add(u.OwnerListLevel.LevelNumber,u);this.OwnerControl.Selection._UpdateListChanges(i);i._Dispose();i=null}else this.modifiedProperties[0]instanceof at?this.OwnerControl.Selection._UpdateTableFormat(n,t,null):this.modifiedProperties[0]instanceof ai?this.OwnerControl.Selection._UpdateCellFormat(n,t,null):this.modifiedProperties[0]instanceof tr&&this.OwnerControl.Selection._UpdateRowFormat(n,t,null);this.currentPropertyIndex=0},n.prototype._Revert=function(){var a,n,s,c,y,p,l;this.OwnerControl.IsShiftingEnabled=!0;var e=null,o=null,r=this.selectionStart,u=this.selectionEnd,w=tt._IsForwardSelection(r,u);if(this.ModifiedProperties.Count>0||this.Action==i.Selection)e=this._GetTextPosition(r),o=this._GetTextPosition(u),this.ownerControl.Selection._SelectRange(e,o,!0),this.Action==i.RowResizing||this.Action==i.CellResizing?this._RevertResizing():this.Action!=i.Selection&&this._RevertProperties(this.OwnerControl.Selection.CurrentSelectionRange);else{a=this.RemovedNodes;this.removedNodes=new h;var v=tt._IsForwardSelection(this.InsertPosition,this.EndPosition),t=this._GetTextPosition(v?this.InsertPosition:this.EndPosition),f=this._GetTextPosition(v?this.EndPosition:this.InsertPosition);t._IsAtSamePosition(f)?this.OwnerControl.Selection._SelectContent(t,!0):this.OwnerControl.Selection._SelectPosition(t,f);this.Action==i.InsertHyperlink&&this.OwnerControl.History.IsRedoing&&(n=this.OwnerControl.Selection._GetHyperlinkField(),n!=null&&(s=n.OwnerParagraph._GetOffset(n,0),t._SetPositionParagraph(n.OwnerParagraph,s),this.OwnerControl.Selection.Start._SetPositionInternal(t),s=n.fieldEnd.OwnerParagraph._GetOffset(n.fieldEnd,1),f._SetPositionParagraph(n.fieldEnd.OwnerParagraph,s)));this.OwnerControl.Selection.CurrentBaseHistoryInfo=this;this.selectionStart=this.InsertPosition;this.InsertPosition=null;this.selectionEnd=this.EndPosition;this.EndPosition=null;c=!1;t._IsAtSamePosition(f)||(c=this.Action==i.BackSpace||this.Action==i.Delete||this.Action==i.ClearCells||this.Action==i.DeleteCells)||this.Action==i.InsertRowAbove||this.Action==i.InsertRowBelow||this.Action==i.InsertColumnLeft||this.Action==i.InsertColumnRight||(this.OwnerControl.Selection.End._SetPositionInternal(f),this.OwnerControl.Selection.IsEmpty||(this.OwnerControl.History.IsRedoing?this.OwnerControl.Selection._RemoveSelectedContent():this.OwnerControl.Selection._DeleteSelectedContents(!0)));y=this.OwnerControl.History.IsRedoing&&!c;this._RevertModifiedNodes(a,y,w?r:u,r==u);c&&(this.OwnerControl.Selection._SelectRange(t,f,!0),p=this.Action==i.DeleteCells||this.Action==i.BackSpace?!0:!1,this.OwnerControl.Selection._DeleteSelectedContents(p))}l=!1;this.OwnerControl.History.IsUndoing&&this.ownerControl.Selection.CurrentHistoryInfo==null&&(e=this._GetTextPosition(r),o=this._GetTextPosition(u),this.OwnerControl.Selection._SelectRange(e,o,!0),l=!0);this.InsertPosition=r;this.EndPosition=u;this.OwnerControl.Selection._Relayout(this.OwnerControl.Selection.IsEmpty);l&&this.OwnerControl.Viewer._ScrollToPosition(this.OwnerControl.Selection.Start,this.OwnerControl.Selection.End)},n.prototype._RevertResizing=function(){if(this.OwnerControl.Selection.CurrentBaseHistoryInfo=this,this.Action==i.RowResizing)this.ModifiedProperties[0]instanceof ie&&this.ModifiedProperties[0]._RevertChanges(this.OwnerControl.History.IsRedoing);else if(this.ModifiedProperties[0]instanceof te){this.OwnerControl.Selection.SelectionRanges.Last.SelectedWidgets.Count==0&&this.OwnerControl.Selection._HighlightSelection(!0);var n=this.ModifiedProperties[0],r=n.TableHierarchicalIndex,u=this.OwnerControl.Document._GetBlock(r),t=u.node;t instanceof e&&(this.OwnerControl.CurrentResizingTable=t,this.OwnerControl.History.IsUndoing?(this.OwnerControl.StartingPoint=this._GetStartingPoint(n.startX+n.displacment,n.startY),this.OwnerControl.ResizerPosition=n.EndIndex,this.OwnerControl.Viewer._ResizeTableCell(-n.displacment)):(this.OwnerControl.StartingPoint=this._GetStartingPoint(n.startX,n.startY),this.OwnerControl.ResizerPosition=n.StartIndex,this.OwnerControl.Viewer._ResizeTableCell(n.displacment)))}},n.prototype._GetStartingPoint=function(n,t){var i=new p(0,0);return i.X=this.OwnerControl.CurrentResizingTable.TableWidgets[this.OwnerControl.CurrentResizingTable.TableWidgets.Count-1].X+n,i.Y=this.OwnerControl.CurrentResizingTable.TableWidgets[this.OwnerControl.CurrentResizingTable.TableWidgets.Count-1].Y+t,i},n.prototype._RevertModifiedNodes=function(n,t,r,f){var c,v,o,h,p,y;if(t&&(this.Action==i.BackSpace||this.Action==i.Delete||this.Action==i.DeleteColumn||this.Action==i.DeleteRow||this.Action==i.InsertRowAbove||this.Action==i.InsertRowBelow||this.Action==i.InsertColumnLeft||this.Action==i.InsertColumnRight||this.Action==i.DeleteTable)&&this._RedoAction(),n.Count>0)if(this.OwnerControl.History.IsUndoing&&(this.Action==i.DeleteColumn||this.Action==i.DeleteRow||this.Action==i.InsertRowAbove||this.Action==i.InsertRowBelow||this.Action==i.InsertColumnLeft||this.Action==i.InsertColumnRight||this.Action==i.DeleteCells||this.Action==i.ClearCells)){var a=this.selectionStart,h=this.OwnerControl.Document._GetBlock(a),s=h.node;a=h.position;o=n[0];s instanceof e&&o instanceof e&&(s._InsertTable(o,!1),n._Remove(o))}else{var l=r,h=this.OwnerControl.Document._GetBlock(l),s=h.node;l=h.position;n.Count>0&&(this.Action==i.BackSpace&&f||!(s instanceof e))&&(c=n[n.Count-1],c instanceof u&&this.OwnerControl.Selection.Start.Offset>0&&(this.OwnerControl.Selection._InsertParagraph(c,!0),n._Remove(c),s==null&&(v=c._GetNextRenderedBlock(),v==null&&this.OwnerControl.Selection._SelectParagraph(c,!0,!0))));n.Count>0&&(o=n[0],s instanceof e?o instanceof e&&(s._InsertTable(o,!0),n._Remove(o),this.InsertPosition=r,o.NextNode instanceof e?s=o.NextNode:(l=r,h=this.OwnerControl.Document._GetBlock(l),p=h.node,l=h.position)):o instanceof u&&this.OwnerControl.Selection.Start.Offset>0&&this.OwnerControl.Selection.Start.Offset==this.OwnerControl.Selection.Start.Paragraph._GetLength()&&(this.OwnerControl.Selection._InsertParagraph(o,!1),n._Remove(o),this.Action!=i.Paste&&this.OwnerControl.Selection.Start.Paragraph._RemoveBlock(),y=o._GetNextParagraph(),this.OwnerControl.Selection._SelectParagraph(y,!0,!0)));n.Count>0&&this._InsertRemovedNodes(n,s)}},n.prototype._InsertRemovedNodes=function(n,t){for(var r,o,u=0,f=0;u<n.Count;u++)r=n[u],n._Remove(r),u--,r instanceof k?this.OwnerControl.Selection._InsertInline(r):r instanceof hi?t instanceof e?this.OwnerControl.Selection._InsertBlockTable(r,t):(this.OwnerControl.Selection._InsertBlock(r),this.Action==i.InsertTable&&r instanceof e&&n.Count==0&&(o=r._GetFirstParagraphInFirstCell(),this.OwnerControl.Selection._SelectParagraph(o,!0,!0))):r instanceof bt?t instanceof e&&(t.Rows._Insert(f,r),f++):r instanceof ct&&(t instanceof e?this.OwnerControl.Selection._InsertSectionInternal(r,t):this.OwnerControl.Selection._InsertSection(r))},n.prototype._RedoAction=function(){switch(this.Action){case i.BackSpace:this.OwnerControl.Selection._SingleBackspace(!0);break;case i.Delete:this.OwnerControl.Selection._SingleDelete(!0);break;case i.InsertRowAbove:this.OwnerControl.Selection._InsertRow(hu.Above);break;case i.InsertRowBelow:this.OwnerControl.Selection._InsertRow(hu.Below);break;case i.InsertColumnLeft:this.OwnerControl.Selection._InsertColumn(tf.Left);break;case i.InsertColumnRight:this.OwnerControl.Selection._InsertColumn(tf.Right);break;case i.DeleteColumn:this.OwnerControl.Selection._DeleteColumn();break;case i.DeleteRow:this.OwnerControl.Selection._DeleteRow();break;case i.DeleteTable:this.OwnerControl.Selection._DeleteTable()}},n.prototype._GetTextPosition=function(n){var t=new tt(this.OwnerControl);return t._SetPositionForCurrentIndex(n),t},n.prototype._AddModifiedProperties=function(n,t,i){var r,u,f,e;return this.OwnerControl.History.IsUndoing||this.OwnerControl.History.IsRedoing?(r=this.currentPropertyIndex<this.modifiedProperties.Count?this.modifiedProperties[this.currentPropertyIndex]:this.modifiedProperties[this.modifiedProperties.Count-1],n.OwnerBase instanceof k&&(u=this.modifiedNodeLength[this.currentPropertyIndex],n.OwnerBase.Length<u&&(this.modifiedNodeLength[this.currentPropertyIndex]=n.OwnerBase.Length,this.modifiedNodeLength._Insert(this.currentPropertyIndex+1,u-n.OwnerBase.Length),f=new o(null),f._CopyFormat(r),this.modifiedProperties._Insert(this.currentPropertyIndex+1,f))),t==null?(i=r,this.currentPropertyIndex<this.modifiedProperties.Count?this.modifiedProperties[this.currentPropertyIndex]=n._CloneFormat():this.modifiedProperties[this.modifiedProperties.Count-1]=n._CloneFormat()):(i=r._GetCharacterPropertyValue(t,r),r._CopyFormat(n)),this.currentPropertyIndex++):(t==null?this.ModifiedProperties._Add(n._CloneFormat()):(e=new o(null),e._CopyFormat(n),this.ModifiedProperties._Add(e)),n.OwnerBase instanceof k?this.modifiedNodeLength._Add(n.OwnerBase.Length):this.modifiedNodeLength._Add(0)),i},n.prototype._AddModifiedPropertiesForParagraphFormat=function(n,t,i){var r,u;if(this.OwnerControl.History.IsUndoing||this.OwnerControl.History.IsRedoing){if(r=this.currentPropertyIndex<this.modifiedProperties.Count?this.modifiedProperties[this.currentPropertyIndex]:this.modifiedProperties[this.modifiedProperties.Count-1],t==null)return i=r,this.currentPropertyIndex<this.modifiedProperties.Count?this.modifiedProperties[this.currentPropertyIndex]=n._CloneFormat():this.modifiedProperties[this.modifiedProperties.Count-1]=n._CloneFormat(),this.currentPropertyIndex++,i;if(t==a.ListFormatProperty)return i=new a(null),i._CopyFormat(r),r.ListFormat=new bi(null),r.ListFormat._CopyFormat(n.ListFormat),this.currentPropertyIndex++,i;i=r._GetParagraphPropertyValue(t,r);r._CopyFormat(n);this.currentPropertyIndex++}else t==null?this.ModifiedProperties._Add(n._CloneFormat()):(u=new a(null),u._CopyFormat(n),this.ModifiedProperties._Add(u));return i},n.prototype._AddModifiedPropertiesForSectionFormat=function(n,t,i){var r,u;return this.OwnerControl.History.IsUndoing||this.OwnerControl.History.IsRedoing?(r=this.currentPropertyIndex<this.modifiedProperties.Count?this.modifiedProperties[this.currentPropertyIndex]:this.modifiedProperties[this.modifiedProperties.Count-1],i=r._GetSectionPropertyValue(t,r),r._CopyFormat(n),this.currentPropertyIndex++):(u=new fu(null),u._CopyFormat(n),this.ModifiedProperties._Add(u)),i},n.prototype._AddModifiedPropertiesForTableFormat=function(n,t,i){var r,u;if(this.OwnerControl.History.IsUndoing||this.OwnerControl.History.IsRedoing){if(r=this.currentPropertyIndex<this.modifiedProperties.Count?this.modifiedProperties[this.currentPropertyIndex]:this.modifiedProperties[this.modifiedProperties.Count-1],t==null)return i=r,this.currentPropertyIndex<this.modifiedProperties.Count?this.modifiedProperties[this.currentPropertyIndex]=n._CloneFormat():this.modifiedProperties[this.modifiedProperties.Count-1]=n._CloneFormat(),this.currentPropertyIndex++,i;i=r._HasValue(t);r._ClearValue(t);r._CopyFormat(n);this.currentPropertyIndex++}else u=new at(null),u._CopyFormat(n),this.ModifiedProperties._Add(u);return i},n.prototype._AddModifiedPropertiesForCellFormat=function(n,t,i){var r,u;if(this.OwnerControl.History.IsUndoing||this.OwnerControl.History.IsRedoing){if(r=this.currentPropertyIndex<this.modifiedProperties.Count?this.modifiedProperties[this.currentPropertyIndex]:this.modifiedProperties[this.modifiedProperties.Count-1],t==null)return i=r,this.currentPropertyIndex<this.modifiedProperties.Count?this.modifiedProperties[this.currentPropertyIndex]=n._CloneFormat():this.modifiedProperties[this.modifiedProperties.Count-1]=n._CloneFormat(),this.currentPropertyIndex++,i;i=r._HasValue(t);r._ClearValue(t);r._CopyFormat(n);this.currentPropertyIndex++}else u=new ai(null),u._CopyFormat(n),this.ModifiedProperties._Add(u);return i},n.prototype._AddModifiedPropertiesForRowFormat=function(n,t,i){var r,u;if(this.OwnerControl.History.IsUndoing||this.OwnerControl.History.IsRedoing){if(r=this.currentPropertyIndex<this.modifiedProperties.Count?this.modifiedProperties[this.currentPropertyIndex]:this.modifiedProperties[this.modifiedProperties.Count-1],t==null)return i=r,this.currentPropertyIndex<this.modifiedProperties.Count?this.modifiedProperties[this.currentPropertyIndex]=n._CloneFormat():this.modifiedProperties[this.modifiedProperties.Count-1]=n._CloneFormat(),this.currentPropertyIndex++,i;i=r._HasValue(t);r._ClearValue(t);r._CopyFormat(n);this.currentPropertyIndex++}else u=new tr(null),u._CopyFormat(n),this.ModifiedProperties._Add(u);return i},n.prototype._AddModifiedPropertiesForList=function(n){var i,t;return this.OwnerControl.History.IsUndoing||this.OwnerControl.History.IsRedoing?(t=this.currentPropertyIndex<this.modifiedProperties.Count?this.modifiedProperties[this.currentPropertyIndex]:this.modifiedProperties[this.modifiedProperties.Count-1],i=t,t=new ou(n,n._Clone()),this.currentPropertyIndex<this.modifiedProperties.Count?this.modifiedProperties[this.currentPropertyIndex]=t:this.modifiedProperties[this.modifiedProperties.Count-1]=t,this.currentPropertyIndex++):(this.ModifiedProperties._Add(new ou(n,n._Clone())),i=n),i},n.prototype._Dispose=function(){var i,t,n;if(this.selectionStart=null,this.selectionEnd=null,this.insertPosition=null,this.endPosition=null,this.modifiedNodeLength!=null&&(this.modifiedNodeLength._Clear(),this.modifiedNodeLength=null),this.modifiedProperties!=null){for(t=0;t<this.modifiedProperties.Count;t++)i=this.modifiedProperties[t],i instanceof o?i._Dispose():i instanceof a?i._Dispose():i instanceof fu&&i._Dispose(),this.modifiedProperties._Remove(i),t--;this.modifiedProperties=null}if(this.removedNodes!=null){for(t=0;t<this.removedNodes.Count;t++)n=this.removedNodes[t],n instanceof ct?n._Dispose():n instanceof hi?n._Dispose():n instanceof bt?n._Dispose():n instanceof ot?n._Dispose():n instanceof k&&n._Dispose(),this.removedNodes._Remove(n),t--;this.removedNodes=null}this.ownerControl=null},n}();t.BaseHistoryInfo=eu;gf=function(t){function r(n,i){t.call(this,n);this.isChildHistoryInfo=!1;this.isChildHistoryInfo=i}return n(r,t),Object.defineProperty(r.prototype,"HasAction",{get:function(){return this.ModifiedActions!=null},enumerable:!0,configurable:!0}),r.prototype._AddModifiedAction=function(n){this.OwnerControl.History.IsUndoing||this.OwnerControl.History.IsRedoing||(this.ModifiedActions==null&&(this.ModifiedActions=new h),this.ModifiedActions._Add(n))},r.prototype._Revert=function(){var n,t;if(this.OwnerControl.Selection.CurrentHistoryInfo=this,this.ModifiedActions!=null)if((this.Action==i.ReplaceAll||this.Action==i.ChangeAll)&&(this.OwnerControl.IsLayoutEnabled=!1),this.OwnerControl.History.IsUndoing)for(n=this.ModifiedActions.Count;n>0;)t=this.ModifiedActions[n-1],t._Revert(),n=n-1,this.OwnerControl.Selection.CurrentHistoryInfo!=this&&(this.OwnerControl.Selection.CurrentHistoryInfo=this);else for(n=0;n<this.ModifiedActions.Count;)t=this.ModifiedActions[n],t._Revert(),n=n+1,this.OwnerControl.Selection.CurrentHistoryInfo!=this&&(this.OwnerControl.Selection.CurrentHistoryInfo=this);this.isChildHistoryInfo||this.OwnerControl.Selection._UpdateComplexHistory()},r}(eu);t.HistoryInfo=gf;ro=function(){function n(){this.modifiedFormats=new h}return Object.defineProperty(n.prototype,"ModifiedFormats",{get:function(){return this.modifiedFormats},enumerable:!0,configurable:!0}),n.prototype._Dispose=function(){for(var n=0;n<this.modifiedFormats.Count;n++)this.ModifiedFormats[n]._Dispose();this.ModifiedFormats._Clear()},n}();t.ModifiedParagraphFormatCollection=ro;uo=function(){function n(n,t){this.OwnerFormat=n;this.ModifiedFormat=t}return Object.defineProperty(n.prototype,"OwnerFormat",{get:function(){return this.ownerFormat},set:function(n){this.ownerFormat=n},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"ModifiedFormat",{get:function(){return this.modifiedFormat},set:function(n){this.modifiedFormat=n},enumerable:!0,configurable:!0}),n.prototype._Dispose=function(){this.OwnerFormat=null;this.ModifiedFormat._Dispose();this.ModifiedFormat=null},n}();t.ModifiedParagraphFormat=uo;ne=function(){function n(){this.modifiedLevels=new ni}return Object.defineProperty(n.prototype,"ModifiedLevels",{get:function(){return this.modifiedLevels},enumerable:!0,configurable:!0}),n.prototype._Dispose=function(){for(var t,n=0;n<this.ModifiedLevels.Keys.Count;n++)t=this.ModifiedLevels.Keys[n],this.ModifiedLevels._Get(t)._Dispose();this.ModifiedLevels._Clear()},n}();t.ModifiedLevelCollection=ne;ou=function(){function n(n,t){this.OwnerListLevel=n;this.ModifiedListLevel=t}return Object.defineProperty(n.prototype,"OwnerListLevel",{get:function(){return this.ownerListLevel},set:function(n){this.ownerListLevel=n},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"ModifiedListLevel",{get:function(){return this.modifiedListLevel},set:function(n){this.modifiedListLevel=n},enumerable:!0,configurable:!0}),n.prototype._Dispose=function(){this.OwnerListLevel=null;this.ModifiedListLevel._Dispose();this.ModifiedListLevel=null},n}();t.ModifiedLevel=ou;te=function(){function n(n){this.StartingPoint=n}return n}();t.CellHistoryFormat=te;ie=function(){function n(n,t){this.StartingPoint=n;this.RowFormat=t;this.RowHeightType=t.HeightType}return n.prototype._RevertChanges=function(n){var t=this.RowFormat.HeightType;n?this.RowFormat.OwnerBase instanceof bt&&this.RowFormat.OwnerBase._UpdateHeight(this.Displacement):this.RowFormat.OwnerBase instanceof bt&&this.RowFormat.OwnerBase._UpdateHeight(-this.Displacement);this.RowFormat.HeightType!=this.RowHeightType&&(this.RowFormat.HeightType=this.RowHeightType);this.RowHeightType=t},n}();t.RowHistoryFormat=ie;fo=function(){function n(n){this.IsUndoing=!1;this.IsRedoing=!1;this.ownerControl=n}return Object.defineProperty(n.prototype,"OwnerControl",{get:function(){return this.ownerControl},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"UndoStack",{get:function(){return this.undoStack},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"RedoStack",{get:function(){return this.redoStack},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"CanUndo",{get:function(){return this.undoStack!=null&&this.undoStack.Count>0},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"CanRedo",{get:function(){return this.redoStack!=null&&this.redoStack.Count>0},enumerable:!0,configurable:!0}),n.prototype._RecordChanges=function(n){this.OwnerControl.DisableHistory||(this.IsUndoing?(this.redoStack==null&&(this.redoStack=new uf(this.OwnerControl.StackSize)),this.redoStack._Push(n)):(!this.IsRedoing&&this.CanRedo&&this.redoStack._Clear(),this.undoStack==null&&(this.undoStack=new uf(this.OwnerControl.StackSize)),this.undoStack._Push(n)))},n.prototype._Undo=function(){if(!this.OwnerControl.IsReadOnlyMode&&this.CanUndo&&!this.OwnerControl.DisableHistory){var n=this.undoStack._Pop();this.IsUndoing=!0;n._Revert();this.IsUndoing=!1;this.OwnerControl.Viewer._CheckForCursorVisibility(!1)}},n.prototype._Redo=function(){if(!this.OwnerControl.IsReadOnlyMode&&this.CanRedo&&!this.OwnerControl.DisableHistory){var n=this.RedoStack._Pop();this.IsRedoing=!0;n._Revert();this.IsRedoing=!1;this.OwnerControl.Viewer._CheckForCursorVisibility(!1)}},n.prototype._Dispose=function(){this._ClearHistory();this.undoStack=null;this.redoStack=null},n.prototype._ClearHistory=function(){this._ClearUndoStack();this._ClearRedoStack()},n.prototype._ClearUndoStack=function(){if(this.CanUndo)while(this.undoStack.Count>0){var n=this.undoStack._Pop();n._Dispose();n=null}},n.prototype._ClearRedoStack=function(){if(this.CanRedo)while(this.redoStack.Count>0){var n=this.redoStack._Pop();n._Dispose();n=null}},n}();t.History=fo,function(n){n[n.Bold=0]="Bold";n[n.Italic=1]="Italic";n[n.FontSize=2]="FontSize";n[n.FontFamily=3]="FontFamily";n[n.FontColor=4]="FontColor";n[n.HighlightColor=5]="HighlightColor";n[n.BaselineAlignment=6]="BaselineAlignment";n[n.StrikeThrough=7]="StrikeThrough";n[n.Underline=8]="Underline";n[n.TextAlignment=9]="TextAlignment";n[n.LineSpacingType=10]="LineSpacingType";n[n.LineSpacing=11]="LineSpacing";n[n.AfterSpacing=12]="AfterSpacing";n[n.BeforeSpacing=13]="BeforeSpacing";n[n.LeftIndent=14]="LeftIndent";n[n.RightIndent=15]="RightIndent";n[n.FirstLineIndent=16]="FirstLineIndent";n[n.ImageReszing=17]="ImageReszing";n[n.Insert=18]="Insert";n[n.ReplaceAll=19]="ReplaceAll";n[n.ChangeAll=20]="ChangeAll";n[n.IgnoreAll=21]="IgnoreAll";n[n.AddToDictionary=22]="AddToDictionary";n[n.InsertHyperlink=23]="InsertHyperlink";n[n.EditHyperlink=24]="EditHyperlink";n[n.RemoveHyperlink=25]="RemoveHyperlink";n[n.AutoFormatHyperlink=26]="AutoFormatHyperlink";n[n.InsertInline=27]="InsertInline";n[n.RemoveInline=28]="RemoveInline";n[n.InsertRowAbove=29]="InsertRowAbove";n[n.InsertRowBelow=30]="InsertRowBelow";n[n.InsertColumnLeft=31]="InsertColumnLeft";n[n.InsertColumnRight=32]="InsertColumnRight";n[n.InsertTable=33]="InsertTable";n[n.Enter=34]="Enter";n[n.BackSpace=35]="BackSpace";n[n.Delete=36]="Delete";n[n.Cut=37]="Cut";n[n.Paste=38]="Paste";n[n.ClearCells=39]="ClearCells";n[n.DeleteCells=40]="DeleteCells";n[n.DeleteRow=41]="DeleteRow";n[n.DeleteColumn=42]="DeleteColumn";n[n.DeleteTable=43]="DeleteTable";n[n.MergeCells=44]="MergeCells";n[n.TableCellBackground=45]="TableCellBackground";n[n.ListFormat=46]="ListFormat";n[n.DragDrop=47]="DragDrop";n[n.PageMargin=48]="PageMargin";n[n.PageSize=49]="PageSize";n[n.List=50]="List";n[n.InsertComment=51]="InsertComment";n[n.DeleteComment=52]="DeleteComment";n[n.DeleteAllComments=53]="DeleteAllComments";n[n.ParagraphFormat=54]="ParagraphFormat";n[n.CharacterFormat=55]="CharacterFormat";n[n.TableFormat=56]="TableFormat";n[n.CellFormat=57]="CellFormat";n[n.RowFormat=58]="RowFormat";n[n.MultiSelection=59]="MultiSelection";n[n.Selection=60]="Selection";n[n.TableAlignment=61]="TableAlignment";n[n.TableLeftIndent=62]="TableLeftIndent";n[n.CellSpacing=63]="CellSpacing";n[n.DefaultCellLeftMargin=64]="DefaultCellLeftMargin";n[n.DefaultCellRightMargin=65]="DefaultCellRightMargin";n[n.DefaultCellTopMargin=66]="DefaultCellTopMargin";n[n.DefaultCellBottomMargin=67]="DefaultCellBottomMargin";n[n.CellContentVerticalAlignment=68]="CellContentVerticalAlignment";n[n.CellLeftMargin=69]="CellLeftMargin";n[n.CellRightMargin=70]="CellRightMargin";n[n.CellTopMargin=71]="CellTopMargin";n[n.CellBottomtMargin=72]="CellBottomtMargin";n[n.RowHeight=73]="RowHeight";n[n.RowHeightType=74]="RowHeightType";n[n.RowHeader=75]="RowHeader";n[n.AllowBreakAcrossPages=76]="AllowBreakAcrossPages";n[n.CellResizing=77]="CellResizing";n[n.RowResizing=78]="RowResizing"}(t.Actions||(t.Actions={}));i=t.Actions,function(n){n[n.None=0]="None";n[n.Single=1]="Single";n[n.Dot=2]="Dot";n[n.DashSmallGap=3]="DashSmallGap";n[n.DashLargeGap=4]="DashLargeGap";n[n.DashDot=5]="DashDot";n[n.DashDotDot=6]="DashDotDot";n[n.Double=7]="Double";n[n.Triple=8]="Triple";n[n.ThinThickSmallGap=9]="ThinThickSmallGap";n[n.ThickThinSmallGap=10]="ThickThinSmallGap";n[n.ThinThickThinSmallGap=11]="ThinThickThinSmallGap";n[n.ThinThickMediumGap=12]="ThinThickMediumGap";n[n.ThickThinMediumGap=13]="ThickThinMediumGap";n[n.ThinThickThinMediumGap=14]="ThinThickThinMediumGap";n[n.ThinThickLargeGap=15]="ThinThickLargeGap";n[n.ThickThinLargeGap=16]="ThickThinLargeGap";n[n.ThinThickThinLargeGap=17]="ThinThickThinLargeGap";n[n.SingleWavy=18]="SingleWavy";n[n.DoubleWavy=19]="DoubleWavy";n[n.DashDotStroked=20]="DashDotStroked";n[n.Emboss3D=21]="Emboss3D";n[n.Engrave3D=22]="Engrave3D";n[n.Outset=23]="Outset";n[n.Inset=24]="Inset";n[n.Thick=25]="Thick"}(t.LineStyle||(t.LineStyle={}));r=t.LineStyle,function(n){n[n.TextureNone=0]="TextureNone";n[n.Texture2Pt5Percent=35]="Texture2Pt5Percent";n[n.Texture5Percent=2]="Texture5Percent";n[n.Texture7Pt5Percent=36]="Texture7Pt5Percent";n[n.Texture10Percent=3]="Texture10Percent";n[n.Texture12Pt5Percent=37]="Texture12Pt5Percent";n[n.Texture15Percent=26]="Texture15Percent";n[n.Texture17Pt5Percent=39]="Texture17Pt5Percent";n[n.Texture20Percent=4]="Texture20Percent";n[n.Texture22Pt5Percent=40]="Texture22Pt5Percent";n[n.Texture25Percent=5]="Texture25Percent";n[n.Texture27Pt5Percent=41]="Texture27Pt5Percent";n[n.Texture30Percent=6]="Texture30Percent";n[n.Texture32Pt5Percent=42]="Texture32Pt5Percent";n[n.Texture35Percent=43]="Texture35Percent";n[n.Texture37Pt5Percent=44]="Texture37Pt5Percent";n[n.Texture40Percent=7]="Texture40Percent";n[n.Texture42Pt5Percent=45]="Texture42Pt5Percent";n[n.Texture45Percent=46]="Texture45Percent";n[n.Texture47Pt5Percent=47]="Texture47Pt5Percent";n[n.Texture50Percent=8]="Texture50Percent";n[n.Texture52Pt5Percent=48]="Texture52Pt5Percent";n[n.Texture55Percent=49]="Texture55Percent";n[n.Texture57Pt5Percent=50]="Texture57Pt5Percent";n[n.Texture60Percent=9]="Texture60Percent";n[n.Texture62Pt5Percent=51]="Texture62Pt5Percent";n[n.Texture65Percent=52]="Texture65Percent";n[n.Texture67Pt5Percent=53]="Texture67Pt5Percent";n[n.Texture70Percent=10]="Texture70Percent";n[n.Texture72Pt5Percent=54]="Texture72Pt5Percent";n[n.Texture75Percent=11]="Texture75Percent";n[n.Texture77Pt5Percent=55]="Texture77Pt5Percent";n[n.Texture80Percent=12]="Texture80Percent";n[n.Texture82Pt5Percent=56]="Texture82Pt5Percent";n[n.Texture85Percent=57]="Texture85Percent";n[n.Texture87Pt5Percent=58]="Texture87Pt5Percent";n[n.Texture90Percent=13]="Texture90Percent";n[n.Texture92Pt5Percent=59]="Texture92Pt5Percent";n[n.Texture95Percent=60]="Texture95Percent";n[n.Texture97Pt5Percent=61]="Texture97Pt5Percent";n[n.TextureSolid=1]="TextureSolid";n[n.TextureDarkHorizontal=14]="TextureDarkHorizontal";n[n.TextureDarkVertical=15]="TextureDarkVertical";n[n.TextureDarkDiagonalDown=16]="TextureDarkDiagonalDown";n[n.TextureDarkDiagonalUp=17]="TextureDarkDiagonalUp";n[n.TextureDarkCross=18]="TextureDarkCross";n[n.TextureDarkDiagonalCross=19]="TextureDarkDiagonalCross";n[n.TextureHorizontal=20]="TextureHorizontal";n[n.TextureVertical=21]="TextureVertical";n[n.TextureDiagonalDown=22]="TextureDiagonalDown";n[n.TextureDiagonalUp=23]="TextureDiagonalUp";n[n.TextureCross=24]="TextureCross";n[n.TextureDiagonalCross=25]="TextureDiagonalCross"}(t.TextureStyle||(t.TextureStyle={}));oo=t.TextureStyle,function(n){n[n.Wrap=0]="Wrap";n[n.NoWrap=1]="NoWrap"}(t.TextWrapping||(t.TextWrapping={}));so=t.TextWrapping,function(n){n[n.EvenHeader=0]="EvenHeader";n[n.OddHeader=1]="OddHeader";n[n.EvenFooter=2]="EvenFooter";n[n.OddFooter=3]="OddFooter";n[n.FirstPageHeader=4]="FirstPageHeader";n[n.FirstPageFooter=5]="FirstPageFooter"}(t.HeaderFooterType||(t.HeaderFooterType={}));si=t.HeaderFooterType,function(n){n[n.Tab=0]="Tab";n[n.Space=1]="Space";n[n.None=2]="None"}(t.FollowCharacterType||(t.FollowCharacterType={}));yr=t.FollowCharacterType,function(n){n[n.File=0]="File";n[n.Webpage=1]="Webpage";n[n.Email=2]="Email";n[n.Bookmark=3]="Bookmark"}(t.HyperlinkType||(t.HyperlinkType={}));su=t.HyperlinkType,function(n){n[n.Above=0]="Above";n[n.Below=1]="Below"}(t.RowPlacement||(t.RowPlacement={}));hu=t.RowPlacement,function(n){n[n.Left=0]="Left";n[n.Right=1]="Right"}(t.ColumnPlacement||(t.ColumnPlacement={}));tf=t.ColumnPlacement,function(n){n[n.None=0]="None";n[n.Bullet=1]="Bullet";n[n.Numbering=2]="Numbering";n[n.OutlineNumbering=3]="OutlineNumbering"}(t.ListType||(t.ListType={}));ho=t.ListType,function(n){n[n.Pages=0]="Pages";n[n.Continuous=1]="Continuous"}(t.LayoutType||(t.LayoutType={}));pi=t.LayoutType,function(n){n[n.Doc=0]="Doc";n[n.Docx=1]="Docx";n[n.Html=2]="Html";n[n.Rtf=3]="Rtf";n[n.Txt=4]="Txt";n[n.WordML=5]="WordML"}(t.FormatType||(t.FormatType={}));co=t.FormatType,function(n){n[n.Text=0]="Text";n[n.Table=1]="Table"}(t.EditingContextType||(t.EditingContextType={}));rf=t.EditingContextType,function(n){n[n.None=0]="None";n[n.FitFullPage=1]="FitFullPage";n[n.FitMultiplePages=2]="FitMultiplePages";n[n.FitPageWidth=3]="FitPageWidth"}(t.PageFitType||(t.PageFitType={}));cu=t.PageFitType,function(n){n[n.None=0]="None";n[n.SingleStrike=1]="SingleStrike";n[n.DoubleStrike=2]="DoubleStrike"}(t.StrikeThrough||(t.StrikeThrough={}));cr=t.StrikeThrough,function(n){n[n.Normal=0]="Normal";n[n.Superscript=1]="Superscript";n[n.Subscript=2]="Subscript"}(t.BaselineAlignment||(t.BaselineAlignment={}));vt=t.BaselineAlignment,function(n){n[n.None=0]="None";n[n.Single=1]="Single";n[n.Words=2]="Words";n[n.Double=3]="Double";n[n.Dotted=4]="Dotted";n[n.Thick=6]="Thick";n[n.Dash=7]="Dash";n[n.DashLong=39]="DashLong";n[n.DotDash=9]="DotDash";n[n.DotDotDash=10]="DotDotDash";n[n.Wavy=11]="Wavy";n[n.DottedHeavy=20]="DottedHeavy";n[n.DashHeavy=23]="DashHeavy";n[n.DashLongHeavy=55]="DashLongHeavy";n[n.DotDashHeavy=25]="DotDashHeavy";n[n.DotDotDashHeavy=26]="DotDotDashHeavy";n[n.WavyHeavy=27]="WavyHeavy";n[n.WavyDouble=43]="WavyDouble"}(t.Underline||(t.Underline={}));ki=t.Underline,function(n){n[n.NoColor=0]="NoColor";n[n.Yellow=1]="Yellow";n[n.BrightGreen=2]="BrightGreen";n[n.Turquoise=3]="Turquoise";n[n.Pink=4]="Pink";n[n.Blue=5]="Blue";n[n.Red=6]="Red";n[n.DarkBlue=7]="DarkBlue";n[n.Teal=8]="Teal";n[n.Green=9]="Green";n[n.Violet=10]="Violet";n[n.DarkRed=11]="DarkRed";n[n.DarkYellow=12]="DarkYellow";n[n.Gray50=13]="Gray50";n[n.Gray25=14]="Gray25";n[n.Black=15]="Black"}(t.HighlightColor||(t.HighlightColor={}));gt=t.HighlightColor,function(n){n[n.AtLeast=0]="AtLeast";n[n.Exactly=1]="Exactly";n[n.Multiple=2]="Multiple"}(t.LineSpacingType||(t.LineSpacingType={}));ei=t.LineSpacingType,function(n){n[n.Center=0]="Center";n[n.Left=1]="Left";n[n.Right=2]="Right";n[n.Justify=3]="Justify"}(t.TextAlignment||(t.TextAlignment={}));rt=t.TextAlignment,function(n){n[n.None=0]="None";n[n.WholeWord=1]="WholeWord";n[n.CaseSensitive=2]="CaseSensitive";n[n.CaseSensitiveWholeWord=3]="CaseSensitiveWholeWord"}(t.FindOptions||(t.FindOptions={}));gr=t.FindOptions,function(n){n[n.Left=0]="Left";n[n.Center=1]="Center";n[n.Right=2]="Right"}(t.TableAlignment||(t.TableAlignment={}));rr=t.TableAlignment,function(n){n[n.Auto=0]="Auto";n[n.Percent=1]="Percent";n[n.Pixel=2]="Pixel"}(t.WidthType||(t.WidthType={}));ht=t.WidthType,function(n){n[n.Top=0]="Top";n[n.Center=1]="Center";n[n.Bottom=2]="Bottom"}(t.CellVerticalAlignment||(t.CellVerticalAlignment={}));or=t.CellVerticalAlignment,function(n){n[n.Auto=0]="Auto";n[n.Atleast=1]="Atleast";n[n.Exactly=2]="Exactly"}(t.HeightType||(t.HeightType={}));et=t.HeightType,function(n){n[n.Arabic=0]="Arabic";n[n.UpRoman=1]="UpRoman";n[n.LowRoman=2]="LowRoman";n[n.UpLetter=3]="UpLetter";n[n.LowLetter=4]="LowLetter";n[n.Ordinal=5]="Ordinal";n[n.Number=6]="Number";n[n.OrdinalText=7]="OrdinalText";n[n.LeadingZero=22]="LeadingZero";n[n.Bullet=23]="Bullet";n[n.FarEast=20]="FarEast";n[n.Special=58]="Special";n[n.None=255]="None"}(t.ListLevelPattern||(t.ListLevelPattern={}));c=t.ListLevelPattern}(i||(i={})))});
|